Skip to content

Commit

Permalink
Editcommands now require an iModel (iTwin#488)
Browse files Browse the repository at this point in the history
* wip

* wip

* rename EditCommand.test.ts to TestEditCommands.ts

* pass imodelconnection to startCommand

* Edit commands now require an iModel

* rush changes

* make iModel member of EditCommand readonly

* eslint allowed 2 blank lines. Switch back to 1, cleanup mess.

* rush change, again

* rush change, again

* Fix presentation forceLoadSchemas

* extract-api

* yet another extract-api

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Saulius Skliutas <[email protected]>
  • Loading branch information
3 people authored Dec 22, 2020
1 parent 0ddb064 commit c4c01d7
Show file tree
Hide file tree
Showing 96 changed files with 388 additions and 231 deletions.
6 changes: 3 additions & 3 deletions common/api/imodeljs-backend.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2819,7 +2819,7 @@ export class IModelImporter {
progressInterval: number;
simplifyElementGeometry: boolean;
readonly targetDb: IModelDb;
}
}

// @beta
export interface IModelImportOptions {
Expand Down Expand Up @@ -3545,9 +3545,9 @@ export class RepositoryModel extends DefinitionModel {
}

// @beta
export interface RequestNewBriefcaseArg extends RequestNewBriefcaseProps {
export type RequestNewBriefcaseArg = RequestNewBriefcaseProps & {
onProgress?: ProgressFunction;
}
};

// @public
export abstract class RoleElement extends Element {
Expand Down
6 changes: 4 additions & 2 deletions common/api/imodeljs-editor-backend.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@

import { CommandMethodProps } from '@bentley/imodeljs-editor-common';
import { CommandResult } from '@bentley/imodeljs-editor-common';
import { IModelDb } from '@bentley/imodeljs-backend';
import { PingResult } from '@bentley/imodeljs-editor-common';
import { StartCommandProps } from '@bentley/imodeljs-editor-common';

// @alpha
export class EditCommand {
constructor(_arg?: any);
constructor(iModel: IModelDb, _arg?: any);
static commandId: string;
// (undocumented)
get ctor(): typeof EditCommand;
get ctor(): EditCommandType;
readonly iModel: IModelDb;
// (undocumented)
onCleanup(): void;
// (undocumented)
Expand Down
16 changes: 10 additions & 6 deletions common/api/imodeljs-editor-common.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ export interface CommandMethodProps<T> {
name: string;
}

// @alpha (undocumented)
export interface CommandResult<T> {
// (undocumented)
error?: CommandError;
// (undocumented)
// @alpha
export type CommandResult<T> = {
result?: T;
}
error?: never;
} | {
error: CommandError;
details?: any;
result?: never;
};

// @alpha (undocumented)
export const editCommandApi: {
Expand All @@ -45,6 +47,8 @@ export interface StartCommandProps<T> {
args?: T;
// (undocumented)
commandId: string;
// (undocumented)
iModelKey: string;
}


Expand Down
3 changes: 2 additions & 1 deletion common/api/imodeljs-editor-frontend.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
```ts

import { CommandResult } from '@bentley/imodeljs-editor-common';
import { IModelConnection } from '@bentley/imodeljs-frontend';
import { PrimitiveTool } from '@bentley/imodeljs-frontend';

// @alpha (undocumented)
Expand All @@ -14,7 +15,7 @@ export class EditTool extends PrimitiveTool {
// (undocumented)
onRestartTool(): void;
// (undocumented)
static startCommand<Arg, Result>(commandId: string, args?: Arg): Promise<CommandResult<Result>>;
static startCommand<Arg, Result>(commandId: string, connection: IModelConnection, args?: Arg): Promise<CommandResult<Result>>;
}


Expand Down
2 changes: 1 addition & 1 deletion common/api/summary/imodeljs-backend.exports.csv
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public;RenderMaterialElement
public;RenderMaterialOwnsRenderMaterials
public;RepositoryLink
public;RepositoryModel
beta;RequestNewBriefcaseArg
beta;RequestNewBriefcaseArg = RequestNewBriefcaseProps &
public;class RoleElement
public;RoleModel
public;Schema
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@bentley/ecschema-metadata",
"comment": "",
"type": "none"
}
],
"packageName": "@bentley/ecschema-metadata",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@bentley/eslint-plugin",
"comment": "only allow 1 blank line",
"type": "none"
}
],
"packageName": "@bentley/eslint-plugin",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@bentley/frontend-devtools",
"comment": "",
"type": "none"
}
],
"packageName": "@bentley/frontend-devtools",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@bentley/geometry-core",
"comment": "",
"type": "none"
}
],
"packageName": "@bentley/geometry-core",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@bentley/imodeljs-backend",
"comment": "",
"type": "none"
}
],
"packageName": "@bentley/imodeljs-backend",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@bentley/imodeljs-common",
"comment": "",
"type": "none"
}
],
"packageName": "@bentley/imodeljs-common",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@bentley/imodeljs-editor-backend",
"comment": "EditCommands now require an iModel",
"type": "none"
}
],
"packageName": "@bentley/imodeljs-editor-backend",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@bentley/imodeljs-editor-common",
"comment": "EditCommands now require an iModel",
"type": "none"
}
],
"packageName": "@bentley/imodeljs-editor-common",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@bentley/imodeljs-editor-frontend",
"comment": "EditCommands now require an iModel",
"type": "none"
}
],
"packageName": "@bentley/imodeljs-editor-frontend",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@bentley/imodeljs-frontend",
"comment": "",
"type": "none"
}
],
"packageName": "@bentley/imodeljs-frontend",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@bentley/map-layers",
"comment": "",
"type": "none"
}
],
"packageName": "@bentley/map-layers",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@bentley/presentation-backend",
"comment": "",
"type": "none"
}
],
"packageName": "@bentley/presentation-backend",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@bentley/presentation-components",
"comment": "",
"type": "none"
}
],
"packageName": "@bentley/presentation-components",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@bentley/presentation-frontend",
"comment": "",
"type": "none"
}
],
"packageName": "@bentley/presentation-frontend",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@bentley/rpcinterface-full-stack-tests",
"comment": "",
"type": "none"
}
],
"packageName": "@bentley/rpcinterface-full-stack-tests",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@bentley/ui-abstract",
"comment": "",
"type": "none"
}
],
"packageName": "@bentley/ui-abstract",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@bentley/ui-components",
"comment": "",
"type": "none"
}
],
"packageName": "@bentley/ui-components",
"email": "[email protected]"
}
11 changes: 11 additions & 0 deletions common/changes/@bentley/ui-core/editcommand2_2020-12-22-15-00.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@bentley/ui-core",
"comment": "",
"type": "none"
}
],
"packageName": "@bentley/ui-core",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@bentley/ui-framework",
"comment": "",
"type": "none"
}
],
"packageName": "@bentley/ui-framework",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@bentley/ui-ninezone",
"comment": "",
"type": "none"
}
],
"packageName": "@bentley/ui-ninezone",
"email": "[email protected]"
}
8 changes: 4 additions & 4 deletions core/backend/src/BriefcaseManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ export enum BriefcaseIdValue {
/** The argument for [[BriefcaseManager.downloadBriefcase]]
* @beta
*/
export interface RequestNewBriefcaseArg extends RequestNewBriefcaseProps {
export type RequestNewBriefcaseArg = RequestNewBriefcaseProps & {
/** If present, a function called periodically during the download to indicate progress.
* @note return non-zero from this function to abort the download.
*/
onProgress?: ProgressFunction;
}
};

/** A token that represents a ChangeSet
* @internal
Expand Down Expand Up @@ -260,15 +260,15 @@ export class BriefcaseManager {

/** Download a new briefcase from iModelHub for the supplied iModelId.
*
* The process of downloading a briefcase file involves first obtaining a valid BriefcaseId from IModelHub. For each IModelId, IModelHub maintains
* The process of downloading a briefcase file involves first obtaining a valid BriefcaseId from IModelHub. For each IModel, IModelHub maintains
* a list of BriefcaseIds assigned to users, to ensure that no two users have the same BriefcaseId. Typically a given user will have only
* one briefcase on their machine for a given iModelId. Rarely, it may be necessary to use more than one briefcase to make isolated independent sets of changes,
* but that is exceedingly complicated and rare. If no BriefcaseId is supplied, a new one is acquired from iModelHub.
*
* Then, a Checkpoint file (as of a ChangesetId, typically "Latest") is downloaded from IModelHub. After the download completes,
* the briefcaseId in the local file is changed to acquired briefcaseId, changing the checkpoint file into a briefcase file.
*
* Each of these steps requires an valid `AuthorizedClientRequestContext` to provide the user's authorization for the requests.
* Each of these steps requires a valid `AuthorizedClientRequestContext` to provide the user's credentials for the requests.
*
* @param request The properties that specify the briefcase file to be downloaded.
* @returns The properties of the local briefcase in a Promise that is resolved after the briefcase is fully downloaded and the briefcase file is ready for use via [BriefcaseDb.open]($backend).
Expand Down
Loading

0 comments on commit c4c01d7

Please sign in to comment.