@itwin/core-frontend 5.0.0-dev.106 → 5.0.0-dev.109
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/BriefcaseConnection.d.ts +1 -1
- package/lib/cjs/BriefcaseConnection.d.ts.map +1 -1
- package/lib/cjs/BriefcaseConnection.js.map +1 -1
- package/lib/cjs/CatalogConnection.d.ts +71 -0
- package/lib/cjs/CatalogConnection.d.ts.map +1 -0
- package/lib/cjs/CatalogConnection.js +95 -0
- package/lib/cjs/CatalogConnection.js.map +1 -0
- package/lib/cjs/IpcApp.d.ts +1 -1
- package/lib/cjs/IpcApp.d.ts.map +1 -1
- package/lib/cjs/IpcApp.js.map +1 -1
- package/lib/cjs/NativeApp.d.ts +2 -1
- package/lib/cjs/NativeApp.d.ts.map +1 -1
- package/lib/cjs/NativeApp.js +1 -0
- package/lib/cjs/NativeApp.js.map +1 -1
- package/lib/cjs/core-frontend.d.ts +1 -0
- package/lib/cjs/core-frontend.d.ts.map +1 -1
- package/lib/cjs/core-frontend.js +1 -0
- package/lib/cjs/core-frontend.js.map +1 -1
- package/lib/cjs/internal/render/webgl/SolarShadowMap.js +2 -2
- package/lib/cjs/internal/render/webgl/SolarShadowMap.js.map +1 -1
- package/lib/cjs/tile/map/CesiumTerrainProvider.d.ts +1 -1
- package/lib/cjs/tile/map/CesiumTerrainProvider.d.ts.map +1 -1
- package/lib/cjs/tile/map/CesiumTerrainProvider.js +2 -3
- package/lib/cjs/tile/map/CesiumTerrainProvider.js.map +1 -1
- package/lib/esm/BriefcaseConnection.d.ts +1 -1
- package/lib/esm/BriefcaseConnection.d.ts.map +1 -1
- package/lib/esm/BriefcaseConnection.js.map +1 -1
- package/lib/esm/CatalogConnection.d.ts +71 -0
- package/lib/esm/CatalogConnection.d.ts.map +1 -0
- package/lib/esm/CatalogConnection.js +92 -0
- package/lib/esm/CatalogConnection.js.map +1 -0
- package/lib/esm/IpcApp.d.ts +1 -1
- package/lib/esm/IpcApp.d.ts.map +1 -1
- package/lib/esm/IpcApp.js.map +1 -1
- package/lib/esm/NativeApp.d.ts +2 -1
- package/lib/esm/NativeApp.d.ts.map +1 -1
- package/lib/esm/NativeApp.js +1 -0
- package/lib/esm/NativeApp.js.map +1 -1
- package/lib/esm/core-frontend.d.ts +1 -0
- package/lib/esm/core-frontend.d.ts.map +1 -1
- package/lib/esm/core-frontend.js +1 -0
- package/lib/esm/core-frontend.js.map +1 -1
- package/lib/esm/internal/render/webgl/SolarShadowMap.js +2 -2
- package/lib/esm/internal/render/webgl/SolarShadowMap.js.map +1 -1
- package/lib/esm/tile/map/CesiumTerrainProvider.d.ts +1 -1
- package/lib/esm/tile/map/CesiumTerrainProvider.d.ts.map +1 -1
- package/lib/esm/tile/map/CesiumTerrainProvider.js +3 -4
- package/lib/esm/tile/map/CesiumTerrainProvider.js.map +1 -1
- package/lib/public/scripts/parse-imdl-worker.js +1 -1
- package/lib/workers/webpack/parse-imdl-worker.js +1 -1
- package/package.json +16 -16
|
@@ -108,7 +108,7 @@ export declare class BriefcaseConnection extends IModelConnection {
|
|
|
108
108
|
* @note make sure to call [[saveChanges]] before calling this method. Unsaved local changes are abandoned.
|
|
109
109
|
*/
|
|
110
110
|
close(): Promise<void>;
|
|
111
|
-
|
|
111
|
+
protected requireTimeline(): void;
|
|
112
112
|
/** Query if there are any pending Txns in this briefcase that are waiting to be pushed. */
|
|
113
113
|
hasPendingTxns(): Promise<boolean>;
|
|
114
114
|
/** Commit pending changes to this briefcase.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BriefcaseConnection.d.ts","sourceRoot":"","sources":["../../src/BriefcaseConnection.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAU,OAAO,EAA2B,UAAU,EAAE,UAAU,EAAgB,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/H,OAAO,EACL,cAAc,EAAE,mBAAmB,EAA4B,qBAAqB,EACpC,kBAAk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OAEG;IACa,sBAAsB,GAAG,IAAI,sBAAO,EAA0C,CAAC;CAChG;AAvKD,kDAuKC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module IModelConnection\n */\n\nimport { assert, BeEvent, CompressedId64Set, Guid, GuidString, Id64String, IModelStatus, OpenMode } from \"@itwin/core-bentley\";\nimport {\n ChangesetIndex, ChangesetIndexAndId, getPullChangesIpcChannel, IModelConnectionProps, IModelError,\n PullChangesOptions as IpcAppPullChangesOptions, OpenBriefcaseProps, StandaloneOpenOptions,\n} from \"@itwin/core-common\";\nimport { BriefcaseTxns } from \"./BriefcaseTxns\";\nimport { GraphicalEditingScope } from \"./GraphicalEditingScope\";\nimport { IModelApp } from \"./IModelApp\";\nimport { IModelConnection } from \"./IModelConnection\";\nimport { IpcApp } from \"./IpcApp\";\nimport { disposeTileTreesForGeometricModels } from \"./tile/internal\";\nimport { Viewport } from \"./Viewport\";\n\n/**\n * Download progress information.\n * @public\n */\nexport interface DownloadProgressInfo {\n /** Bytes downloaded. */\n loaded: number;\n /** Total size of the download in bytes. */\n total: number;\n}\n\n/**\n * Called to show progress during a download.\n * @public\n */\nexport type OnDownloadProgress = (progress: DownloadProgressInfo) => void;\n\n/**\n * Partial interface of AbortSignal.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal\n * @beta\n */\nexport interface GenericAbortSignal {\n /** Add Listener for abort signal. */\n addEventListener: (type: \"abort\", listener: (this: GenericAbortSignal, ev: any) => any) => void;\n /** Remove Listener for abort signal. */\n removeEventListener: (type: \"abort\", listener: (this: GenericAbortSignal, ev: any) => any) => void;\n}\n\n/**\n * Options for pulling iModel changes.\n * @public\n */\nexport interface PullChangesOptions {\n /** Function called regularly to report progress of changes download. */\n downloadProgressCallback?: OnDownloadProgress;\n /** Interval for calling progress callback (in milliseconds). */\n progressInterval?: number;\n /** Signal for cancelling the download.\n * @beta\n */\n abortSignal?: GenericAbortSignal;\n}\n\n/** Keeps track of changes to models, buffering them until synchronization points.\n * While a GraphicalEditingScope is open, the changes are buffered until the scope exits, at which point they are processed.\n * Otherwise, the buffered changes are processed after undo/redo, commit, or pull+merge changes.\n */\nclass ModelChangeMonitor {\n private _editingScope?: GraphicalEditingScope;\n private readonly _briefcase: BriefcaseConnection;\n private readonly _deletedModels = new Set<string>();\n private readonly _modelIdToGuid = new Map<string, string>();\n private readonly _removals: VoidFunction[] = [];\n\n public constructor(briefcase: BriefcaseConnection) {\n this._briefcase = briefcase;\n\n // Buffer updated geometry guids.\n this._removals.push(briefcase.txns.onModelGeometryChanged.addListener((changes) => {\n for (const change of changes) {\n this._deletedModels.delete(change.id);\n this._modelIdToGuid.set(change.id, change.guid);\n }\n }));\n\n // Buffer deletions of models.\n this._removals.push(briefcase.txns.onModelsChanged.addListener((changes) => {\n if (changes.deleted) {\n for (const id of CompressedId64Set.iterable(changes.deleted)) {\n this._modelIdToGuid.delete(id);\n this._deletedModels.add(id);\n }\n }\n }));\n\n // Outside of an editing scope, we want to update viewport contents after commit, undo/redo, or merging changes.\n const maybeProcess = async () => {\n if (this.editingScope)\n return;\n\n const modelIds = Array.from(this._modelIdToGuid.keys());\n if (modelIds.length > 0)\n await IModelApp.tileAdmin.purgeTileTrees(this._briefcase, modelIds);\n\n this.processBuffered();\n };\n\n this._removals.push(briefcase.txns.onCommitted.addListener(maybeProcess));\n this._removals.push(briefcase.txns.onReplayedExternalTxns.addListener(maybeProcess));\n this._removals.push(briefcase.txns.onAfterUndoRedo.addListener(maybeProcess));\n this._removals.push(briefcase.txns.onChangesPulled.addListener(maybeProcess));\n }\n\n public async close(): Promise<void> {\n for (const removal of this._removals)\n removal();\n\n this._removals.length = 0;\n\n if (this._editingScope) {\n await this._editingScope.exit();\n this._editingScope = undefined;\n }\n }\n\n public get editingScope(): GraphicalEditingScope | undefined {\n return this._editingScope;\n }\n\n public async enterEditingScope(): Promise<GraphicalEditingScope> {\n if (this._editingScope)\n throw new Error(\"Cannot create an editing scope for an iModel that already has one\");\n\n this._editingScope = await GraphicalEditingScope.enter(this._briefcase);\n\n const removeGeomListener = this._editingScope.onGeometryChanges.addListener((changes) => {\n const modelIds = [];\n for (const change of changes)\n modelIds.push(change.id);\n\n this.invalidateScenes(modelIds);\n });\n\n this._editingScope.onExited.addOnce((scope) => {\n assert(scope === this._editingScope);\n this._editingScope = undefined;\n removeGeomListener();\n this.processBuffered();\n });\n\n return this._editingScope;\n }\n\n private processBuffered(): void {\n const models = this._briefcase.models;\n for (const [id, guid] of this._modelIdToGuid) {\n const model = models.getLoaded(id)?.asGeometricModel;\n if (model)\n model.geometryGuid = guid;\n }\n\n const modelIds = new Set<string>(this._modelIdToGuid.keys());\n for (const deleted of this._deletedModels) {\n modelIds.add(deleted);\n models.unload(deleted);\n }\n\n this.invalidateScenes(modelIds);\n disposeTileTreesForGeometricModels(modelIds, this._briefcase);\n\n this._briefcase.onBufferedModelChanges.raiseEvent(modelIds);\n\n this._modelIdToGuid.clear();\n this._deletedModels.clear();\n }\n\n private invalidateScenes(changedModels: Iterable<Id64String>): void {\n for (const user of IModelApp.tileAdmin.tileUsers) {\n if (user instanceof Viewport && user.iModel === this._briefcase) {\n for (const modelId of changedModels) {\n if (user.view.viewsModel(modelId)) {\n user.invalidateScene();\n user.setFeatureOverrideProviderChanged();\n break;\n }\n }\n }\n }\n }\n}\n\n/** Settings that can be used to control the behavior of [[Tool]]s that modify a [[BriefcaseConnection]].\n * For example, tools that want to create new elements can consult the briefcase's editor tool settings to\n * determine into which model and category to insert the elements.\n * Specialized tools are free to ignore these settings.\n * @see [[BriefcaseConnection.editorToolSettings]] to query or modify the current settings for a briefcase.\n * @see [CreateElementTool]($editor-frontend) for an example of a tool that uses these settings.\n * @beta\n */\nexport class BriefcaseEditorToolSettings {\n private _category?: Id64String;\n private _model?: Id64String;\n\n /** An event raised just after the default [[category]] is changed. */\n public readonly onCategoryChanged = new BeEvent<(previousCategory: Id64String | undefined) => void>();\n\n /** An event raised just after the default [[model]] is changed. */\n public readonly onModelChanged = new BeEvent<(previousModel: Id64String | undefined) => void>();\n\n /** The [Category]($backend) into which new elements should be inserted by default.\n * Specialized tools are free to ignore this setting and instead use their own logic to select an appropriate category.\n * @see [[onCategoryChanged]] to be notified when this property is modified.\n * @see [CreateElementTool.targetCategory]($editor-frontend) for an example of a tool that uses this setting.\n */\n public get category(): Id64String | undefined {\n return this._category;\n }\n public set category(category: Id64String | undefined) {\n const previousCategory = this.category;\n if (category !== this.category) {\n this._category = category;\n this.onCategoryChanged.raiseEvent(previousCategory);\n }\n }\n\n /** The [Model]($backend) into which new elements should be inserted by default.\n * Specialized tools are free to ignore this setting and instead use their own logic to select an appropriate model.\n * @see [[onModelChanged]] to be notified when this property is modified.\n * @see [CreateElementTool.targetModelId]($editor-frontend) for an example of a tool that uses this setting.\n */\n public get model(): Id64String | undefined {\n return this._model;\n }\n public set model(model: Id64String | undefined) {\n const previousModel = this.model;\n if (model !== this.model) {\n this._model = model;\n this.onModelChanged.raiseEvent(previousModel);\n }\n }\n}\n\n/** A connection to an editable briefcase on the backend. This class uses [Ipc]($docs/learning/IpcInterface.md) to communicate\n * to the backend and may only be used by [[IpcApp]]s.\n * @public\n */\nexport class BriefcaseConnection extends IModelConnection {\n protected _isClosed?: boolean;\n private readonly _modelsMonitor: ModelChangeMonitor;\n /** Default settings that can be used to control the behavior of [[Tool]]s that modify this briefcase.\n * @beta\n */\n public readonly editorToolSettings = new BriefcaseEditorToolSettings();\n\n /** Manages local changes to the briefcase via [Txns]($docs/learning/InteractiveEditing.md). */\n public readonly txns: BriefcaseTxns;\n\n public override isBriefcaseConnection(): this is BriefcaseConnection { return true; }\n\n /** The Guid that identifies the iTwin that owns this iModel. */\n public override get iTwinId(): GuidString { return super.iTwinId!; } // GuidString | undefined for IModelConnection, but required for BriefcaseConnection\n\n /** The Guid that identifies this iModel. */\n public override get iModelId(): GuidString { return super.iModelId!; } // GuidString | undefined for IModelConnection, but required for BriefcaseConnection\n\n protected constructor(props: IModelConnectionProps, openMode: OpenMode) {\n super(props);\n this._openMode = openMode;\n this.txns = new BriefcaseTxns(this);\n this._modelsMonitor = new ModelChangeMonitor(this);\n if (OpenMode.ReadWrite === this._openMode)\n this.txns.onAfterUndoRedo.addListener(async () => { await IModelApp.toolAdmin.restartPrimitiveTool(); });\n }\n\n /** Open a BriefcaseConnection to a [BriefcaseDb]($backend). */\n public static async openFile(briefcaseProps: OpenBriefcaseProps): Promise<BriefcaseConnection> {\n const iModelProps = await IpcApp.appFunctionIpc.openBriefcase(briefcaseProps);\n const connection = new this({ ...briefcaseProps, ...iModelProps }, briefcaseProps.readonly ? OpenMode.Readonly : OpenMode.ReadWrite);\n IModelConnection.onOpen.raiseEvent(connection);\n return connection;\n }\n\n /** Open a BriefcaseConnection to a [StandaloneDb]($backend)\n * @note StandaloneDbs, by definition, may not push or pull changes. Attempting to do so will throw exceptions.\n */\n public static async openStandalone(filePath: string, openMode: OpenMode = OpenMode.ReadWrite, opts?: StandaloneOpenOptions): Promise<BriefcaseConnection> {\n const openResponse = await IpcApp.appFunctionIpc.openStandalone(filePath, openMode, opts);\n const connection = new this(openResponse, openMode);\n IModelConnection.onOpen.raiseEvent(connection);\n return connection;\n }\n\n /** Returns `true` if [[close]] has already been called. */\n public get isClosed(): boolean { return this._isClosed === true; }\n\n /**\n * Close this BriefcaseConnection.\n * @note make sure to call [[saveChanges]] before calling this method. Unsaved local changes are abandoned.\n */\n public async close(): Promise<void> {\n if (this.isClosed)\n return;\n\n await this._modelsMonitor.close();\n\n this.beforeClose();\n this.txns[Symbol.dispose]();\n\n this._isClosed = true;\n await IpcApp.appFunctionIpc.closeIModel(this._fileKey);\n }\n\n private requireTimeline() {\n if (this.iTwinId === Guid.empty)\n throw new IModelError(IModelStatus.WrongIModel, \"iModel has no timeline\");\n }\n\n /** Query if there are any pending Txns in this briefcase that are waiting to be pushed. */\n public async hasPendingTxns(): Promise<boolean> { // eslint-disable-line @itwin/prefer-get\n return this.txns.hasPendingTxns();\n }\n\n /** Commit pending changes to this briefcase.\n * @param description Optional description of the changes.\n */\n public async saveChanges(description?: string): Promise<void> {\n await IpcApp.appFunctionIpc.saveChanges(this.key, description);\n }\n\n /** Abandon pending changes to this briefcase. */\n public async abandonChanges(): Promise<void> {\n await IpcApp.appFunctionIpc.abandonChanges(this.key);\n }\n\n /** Pull (and potentially merge if there are local changes) up to a specified changeset from iModelHub into this briefcase\n * @param toIndex The changeset index to pull changes to. If `undefined`, pull all changes.\n * @param options Options for pulling changes.\n * @see [[BriefcaseTxns.onChangesPulled]] for the event dispatched after changes are pulled.\n */\n public async pullChanges(toIndex?: ChangesetIndex, options?: PullChangesOptions): Promise<void> {\n const removeListeners: VoidFunction[] = [];\n const shouldReportProgress = !!options?.downloadProgressCallback;\n\n if (shouldReportProgress) {\n const handleProgress = (_evt: Event, data: { loaded: number, total: number }) => {\n options?.downloadProgressCallback?.(data);\n };\n\n const removeProgressListener = IpcApp.addListener(\n getPullChangesIpcChannel(this.iModelId),\n handleProgress,\n );\n removeListeners.push(removeProgressListener);\n }\n\n if (options?.abortSignal) {\n const abort = () => void IpcApp.appFunctionIpc.cancelPullChangesRequest(this.key);\n options?.abortSignal.addEventListener(\"abort\", abort);\n removeListeners.push(() => options?.abortSignal?.removeEventListener(\"abort\", abort));\n }\n\n this.requireTimeline();\n const ipcAppOptions: IpcAppPullChangesOptions = {\n reportProgress: shouldReportProgress,\n progressInterval: options?.progressInterval,\n enableCancellation: !!options?.abortSignal,\n };\n try {\n this.changeset = await IpcApp.appFunctionIpc.pullChanges(this.key, toIndex, ipcAppOptions);\n } finally {\n removeListeners.forEach((remove) => remove());\n }\n }\n\n /** Create a changeset from local Txns and push to iModelHub. On success, clear Txn table.\n * @param description The description for the changeset\n * @returns the changesetId of the pushed changes\n * @see [[BriefcaseTxns.onChangesPushed]] for the event dispatched after changes are pushed.\n */\n public async pushChanges(description: string): Promise<ChangesetIndexAndId> {\n this.requireTimeline();\n return IpcApp.appFunctionIpc.pushChanges(this.key, description);\n }\n\n /** The current graphical editing scope, if one is in progress.\n * @see [[enterEditingScope]] to begin graphical editing.\n */\n public get editingScope(): GraphicalEditingScope | undefined {\n return this._modelsMonitor.editingScope;\n }\n\n /** Return whether graphical editing is supported for this briefcase. It is not supported if the briefcase is read-only, or the briefcase contains a version of\n * the BisCore ECSchema older than v0.1.11.\n * @see [[enterEditingScope]] to enable graphical editing.\n */\n public async supportsGraphicalEditing(): Promise<boolean> {\n return IpcApp.appFunctionIpc.isGraphicalEditingSupported(this.key);\n }\n\n /** Begin a new graphical editing scope.\n * @throws Error if an editing scope already exists or one could not be created.\n * @see [[GraphicalEditingScope.exit]] to exit the scope.\n * @see [[supportsGraphicalEditing]] to determine whether this method should be expected to succeed.\n * @see [[editingScope]] to obtain the current editing scope, if one is in progress.\n */\n public async enterEditingScope(): Promise<GraphicalEditingScope> {\n return this._modelsMonitor.enterEditingScope();\n }\n\n /** Strictly for tests - dispatched from ModelChangeMonitor.processBuffered.\n * @internal\n */\n public readonly onBufferedModelChanges = new BeEvent<(changedModelIds: Set<string>) => void>();\n}\n"]}
|
|
1
|
+
{"version":3,"file":"BriefcaseConnection.js","sourceRoot":"","sources":["../../src/BriefcaseConnection.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA+H;AAC/H,oDAG4B;AAC5B,mDAAgD;AAChD,mEAAgE;AAChE,2CAAwC;AACxC,yDAAsD;AACtD,qCAAkC;AAClC,8CAAqE;AACrE,yCAAsC;AA8CtC;;;GAGG;AACH,MAAM,kBAAkB;IACd,aAAa,CAAyB;IAC7B,UAAU,CAAsB;IAChC,cAAc,GAAG,IAAI,GAAG,EAAU,CAAC;IACnC,cAAc,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC3C,SAAS,GAAmB,EAAE,CAAC;IAEhD,YAAmB,SAA8B;QAC/C,IAAI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CAAC;IAED;;OAEG;IACa,sBAAsB,GAAG,IAAI,sBAAO,EAA0C,CAAC;CAChG;AAvKD,kDAuKC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module IModelConnection\n */\n\nimport { assert, BeEvent, CompressedId64Set, Guid, GuidString, Id64String, IModelStatus, OpenMode } from \"@itwin/core-bentley\";\nimport {\n ChangesetIndex, ChangesetIndexAndId, getPullChangesIpcChannel, IModelConnectionProps, IModelError,\n PullChangesOptions as IpcAppPullChangesOptions, OpenBriefcaseProps, StandaloneOpenOptions,\n} from \"@itwin/core-common\";\nimport { BriefcaseTxns } from \"./BriefcaseTxns\";\nimport { GraphicalEditingScope } from \"./GraphicalEditingScope\";\nimport { IModelApp } from \"./IModelApp\";\nimport { IModelConnection } from \"./IModelConnection\";\nimport { IpcApp } from \"./IpcApp\";\nimport { disposeTileTreesForGeometricModels } from \"./tile/internal\";\nimport { Viewport } from \"./Viewport\";\n\n/**\n * Download progress information.\n * @public\n */\nexport interface DownloadProgressInfo {\n /** Bytes downloaded. */\n loaded: number;\n /** Total size of the download in bytes. */\n total: number;\n}\n\n/**\n * Called to show progress during a download.\n * @public\n */\nexport type OnDownloadProgress = (progress: DownloadProgressInfo) => void;\n\n/**\n * Partial interface of AbortSignal.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal\n * @beta\n */\nexport interface GenericAbortSignal {\n /** Add Listener for abort signal. */\n addEventListener: (type: \"abort\", listener: (this: GenericAbortSignal, ev: any) => any) => void;\n /** Remove Listener for abort signal. */\n removeEventListener: (type: \"abort\", listener: (this: GenericAbortSignal, ev: any) => any) => void;\n}\n\n/**\n * Options for pulling iModel changes.\n * @public\n */\nexport interface PullChangesOptions {\n /** Function called regularly to report progress of changes download. */\n downloadProgressCallback?: OnDownloadProgress;\n /** Interval for calling progress callback (in milliseconds). */\n progressInterval?: number;\n /** Signal for cancelling the download.\n * @beta\n */\n abortSignal?: GenericAbortSignal;\n}\n\n/** Keeps track of changes to models, buffering them until synchronization points.\n * While a GraphicalEditingScope is open, the changes are buffered until the scope exits, at which point they are processed.\n * Otherwise, the buffered changes are processed after undo/redo, commit, or pull+merge changes.\n */\nclass ModelChangeMonitor {\n private _editingScope?: GraphicalEditingScope;\n private readonly _briefcase: BriefcaseConnection;\n private readonly _deletedModels = new Set<string>();\n private readonly _modelIdToGuid = new Map<string, string>();\n private readonly _removals: VoidFunction[] = [];\n\n public constructor(briefcase: BriefcaseConnection) {\n this._briefcase = briefcase;\n\n // Buffer updated geometry guids.\n this._removals.push(briefcase.txns.onModelGeometryChanged.addListener((changes) => {\n for (const change of changes) {\n this._deletedModels.delete(change.id);\n this._modelIdToGuid.set(change.id, change.guid);\n }\n }));\n\n // Buffer deletions of models.\n this._removals.push(briefcase.txns.onModelsChanged.addListener((changes) => {\n if (changes.deleted) {\n for (const id of CompressedId64Set.iterable(changes.deleted)) {\n this._modelIdToGuid.delete(id);\n this._deletedModels.add(id);\n }\n }\n }));\n\n // Outside of an editing scope, we want to update viewport contents after commit, undo/redo, or merging changes.\n const maybeProcess = async () => {\n if (this.editingScope)\n return;\n\n const modelIds = Array.from(this._modelIdToGuid.keys());\n if (modelIds.length > 0)\n await IModelApp.tileAdmin.purgeTileTrees(this._briefcase, modelIds);\n\n this.processBuffered();\n };\n\n this._removals.push(briefcase.txns.onCommitted.addListener(maybeProcess));\n this._removals.push(briefcase.txns.onReplayedExternalTxns.addListener(maybeProcess));\n this._removals.push(briefcase.txns.onAfterUndoRedo.addListener(maybeProcess));\n this._removals.push(briefcase.txns.onChangesPulled.addListener(maybeProcess));\n }\n\n public async close(): Promise<void> {\n for (const removal of this._removals)\n removal();\n\n this._removals.length = 0;\n\n if (this._editingScope) {\n await this._editingScope.exit();\n this._editingScope = undefined;\n }\n }\n\n public get editingScope(): GraphicalEditingScope | undefined {\n return this._editingScope;\n }\n\n public async enterEditingScope(): Promise<GraphicalEditingScope> {\n if (this._editingScope)\n throw new Error(\"Cannot create an editing scope for an iModel that already has one\");\n\n this._editingScope = await GraphicalEditingScope.enter(this._briefcase);\n\n const removeGeomListener = this._editingScope.onGeometryChanges.addListener((changes) => {\n const modelIds = [];\n for (const change of changes)\n modelIds.push(change.id);\n\n this.invalidateScenes(modelIds);\n });\n\n this._editingScope.onExited.addOnce((scope) => {\n assert(scope === this._editingScope);\n this._editingScope = undefined;\n removeGeomListener();\n this.processBuffered();\n });\n\n return this._editingScope;\n }\n\n private processBuffered(): void {\n const models = this._briefcase.models;\n for (const [id, guid] of this._modelIdToGuid) {\n const model = models.getLoaded(id)?.asGeometricModel;\n if (model)\n model.geometryGuid = guid;\n }\n\n const modelIds = new Set<string>(this._modelIdToGuid.keys());\n for (const deleted of this._deletedModels) {\n modelIds.add(deleted);\n models.unload(deleted);\n }\n\n this.invalidateScenes(modelIds);\n disposeTileTreesForGeometricModels(modelIds, this._briefcase);\n\n this._briefcase.onBufferedModelChanges.raiseEvent(modelIds);\n\n this._modelIdToGuid.clear();\n this._deletedModels.clear();\n }\n\n private invalidateScenes(changedModels: Iterable<Id64String>): void {\n for (const user of IModelApp.tileAdmin.tileUsers) {\n if (user instanceof Viewport && user.iModel === this._briefcase) {\n for (const modelId of changedModels) {\n if (user.view.viewsModel(modelId)) {\n user.invalidateScene();\n user.setFeatureOverrideProviderChanged();\n break;\n }\n }\n }\n }\n }\n}\n\n/** Settings that can be used to control the behavior of [[Tool]]s that modify a [[BriefcaseConnection]].\n * For example, tools that want to create new elements can consult the briefcase's editor tool settings to\n * determine into which model and category to insert the elements.\n * Specialized tools are free to ignore these settings.\n * @see [[BriefcaseConnection.editorToolSettings]] to query or modify the current settings for a briefcase.\n * @see [CreateElementTool]($editor-frontend) for an example of a tool that uses these settings.\n * @beta\n */\nexport class BriefcaseEditorToolSettings {\n private _category?: Id64String;\n private _model?: Id64String;\n\n /** An event raised just after the default [[category]] is changed. */\n public readonly onCategoryChanged = new BeEvent<(previousCategory: Id64String | undefined) => void>();\n\n /** An event raised just after the default [[model]] is changed. */\n public readonly onModelChanged = new BeEvent<(previousModel: Id64String | undefined) => void>();\n\n /** The [Category]($backend) into which new elements should be inserted by default.\n * Specialized tools are free to ignore this setting and instead use their own logic to select an appropriate category.\n * @see [[onCategoryChanged]] to be notified when this property is modified.\n * @see [CreateElementTool.targetCategory]($editor-frontend) for an example of a tool that uses this setting.\n */\n public get category(): Id64String | undefined {\n return this._category;\n }\n public set category(category: Id64String | undefined) {\n const previousCategory = this.category;\n if (category !== this.category) {\n this._category = category;\n this.onCategoryChanged.raiseEvent(previousCategory);\n }\n }\n\n /** The [Model]($backend) into which new elements should be inserted by default.\n * Specialized tools are free to ignore this setting and instead use their own logic to select an appropriate model.\n * @see [[onModelChanged]] to be notified when this property is modified.\n * @see [CreateElementTool.targetModelId]($editor-frontend) for an example of a tool that uses this setting.\n */\n public get model(): Id64String | undefined {\n return this._model;\n }\n public set model(model: Id64String | undefined) {\n const previousModel = this.model;\n if (model !== this.model) {\n this._model = model;\n this.onModelChanged.raiseEvent(previousModel);\n }\n }\n}\n\n/** A connection to an editable briefcase on the backend. This class uses [Ipc]($docs/learning/IpcInterface.md) to communicate\n * to the backend and may only be used by [[IpcApp]]s.\n * @public\n */\nexport class BriefcaseConnection extends IModelConnection {\n protected _isClosed?: boolean;\n private readonly _modelsMonitor: ModelChangeMonitor;\n /** Default settings that can be used to control the behavior of [[Tool]]s that modify this briefcase.\n * @beta\n */\n public readonly editorToolSettings = new BriefcaseEditorToolSettings();\n\n /** Manages local changes to the briefcase via [Txns]($docs/learning/InteractiveEditing.md). */\n public readonly txns: BriefcaseTxns;\n\n public override isBriefcaseConnection(): this is BriefcaseConnection { return true; }\n\n /** The Guid that identifies the iTwin that owns this iModel. */\n public override get iTwinId(): GuidString { return super.iTwinId!; } // GuidString | undefined for IModelConnection, but required for BriefcaseConnection\n\n /** The Guid that identifies this iModel. */\n public override get iModelId(): GuidString { return super.iModelId!; } // GuidString | undefined for IModelConnection, but required for BriefcaseConnection\n\n protected constructor(props: IModelConnectionProps, openMode: OpenMode) {\n super(props);\n this._openMode = openMode;\n this.txns = new BriefcaseTxns(this);\n this._modelsMonitor = new ModelChangeMonitor(this);\n if (OpenMode.ReadWrite === this._openMode)\n this.txns.onAfterUndoRedo.addListener(async () => { await IModelApp.toolAdmin.restartPrimitiveTool(); });\n }\n\n /** Open a BriefcaseConnection to a [BriefcaseDb]($backend). */\n public static async openFile(briefcaseProps: OpenBriefcaseProps): Promise<BriefcaseConnection> {\n const iModelProps = await IpcApp.appFunctionIpc.openBriefcase(briefcaseProps);\n const connection = new this({ ...briefcaseProps, ...iModelProps }, briefcaseProps.readonly ? OpenMode.Readonly : OpenMode.ReadWrite);\n IModelConnection.onOpen.raiseEvent(connection);\n return connection;\n }\n\n /** Open a BriefcaseConnection to a [StandaloneDb]($backend)\n * @note StandaloneDbs, by definition, may not push or pull changes. Attempting to do so will throw exceptions.\n */\n public static async openStandalone(filePath: string, openMode: OpenMode = OpenMode.ReadWrite, opts?: StandaloneOpenOptions): Promise<BriefcaseConnection> {\n const openResponse = await IpcApp.appFunctionIpc.openStandalone(filePath, openMode, opts);\n const connection = new this(openResponse, openMode);\n IModelConnection.onOpen.raiseEvent(connection);\n return connection;\n }\n\n /** Returns `true` if [[close]] has already been called. */\n public get isClosed(): boolean { return this._isClosed === true; }\n\n /**\n * Close this BriefcaseConnection.\n * @note make sure to call [[saveChanges]] before calling this method. Unsaved local changes are abandoned.\n */\n public async close(): Promise<void> {\n if (this.isClosed)\n return;\n\n await this._modelsMonitor.close();\n\n this.beforeClose();\n this.txns[Symbol.dispose]();\n\n this._isClosed = true;\n await IpcApp.appFunctionIpc.closeIModel(this._fileKey);\n }\n\n protected requireTimeline() {\n if (this.iTwinId === Guid.empty)\n throw new IModelError(IModelStatus.WrongIModel, \"iModel has no timeline\");\n }\n\n /** Query if there are any pending Txns in this briefcase that are waiting to be pushed. */\n public async hasPendingTxns(): Promise<boolean> { // eslint-disable-line @itwin/prefer-get\n return this.txns.hasPendingTxns();\n }\n\n /** Commit pending changes to this briefcase.\n * @param description Optional description of the changes.\n */\n public async saveChanges(description?: string): Promise<void> {\n await IpcApp.appFunctionIpc.saveChanges(this.key, description);\n }\n\n /** Abandon pending changes to this briefcase. */\n public async abandonChanges(): Promise<void> {\n await IpcApp.appFunctionIpc.abandonChanges(this.key);\n }\n\n /** Pull (and potentially merge if there are local changes) up to a specified changeset from iModelHub into this briefcase\n * @param toIndex The changeset index to pull changes to. If `undefined`, pull all changes.\n * @param options Options for pulling changes.\n * @see [[BriefcaseTxns.onChangesPulled]] for the event dispatched after changes are pulled.\n */\n public async pullChanges(toIndex?: ChangesetIndex, options?: PullChangesOptions): Promise<void> {\n const removeListeners: VoidFunction[] = [];\n const shouldReportProgress = !!options?.downloadProgressCallback;\n\n if (shouldReportProgress) {\n const handleProgress = (_evt: Event, data: { loaded: number, total: number }) => {\n options?.downloadProgressCallback?.(data);\n };\n\n const removeProgressListener = IpcApp.addListener(\n getPullChangesIpcChannel(this.iModelId),\n handleProgress,\n );\n removeListeners.push(removeProgressListener);\n }\n\n if (options?.abortSignal) {\n const abort = () => void IpcApp.appFunctionIpc.cancelPullChangesRequest(this.key);\n options?.abortSignal.addEventListener(\"abort\", abort);\n removeListeners.push(() => options?.abortSignal?.removeEventListener(\"abort\", abort));\n }\n\n this.requireTimeline();\n const ipcAppOptions: IpcAppPullChangesOptions = {\n reportProgress: shouldReportProgress,\n progressInterval: options?.progressInterval,\n enableCancellation: !!options?.abortSignal,\n };\n try {\n this.changeset = await IpcApp.appFunctionIpc.pullChanges(this.key, toIndex, ipcAppOptions);\n } finally {\n removeListeners.forEach((remove) => remove());\n }\n }\n\n /** Create a changeset from local Txns and push to iModelHub. On success, clear Txn table.\n * @param description The description for the changeset\n * @returns the changesetId of the pushed changes\n * @see [[BriefcaseTxns.onChangesPushed]] for the event dispatched after changes are pushed.\n */\n public async pushChanges(description: string): Promise<ChangesetIndexAndId> {\n this.requireTimeline();\n return IpcApp.appFunctionIpc.pushChanges(this.key, description);\n }\n\n /** The current graphical editing scope, if one is in progress.\n * @see [[enterEditingScope]] to begin graphical editing.\n */\n public get editingScope(): GraphicalEditingScope | undefined {\n return this._modelsMonitor.editingScope;\n }\n\n /** Return whether graphical editing is supported for this briefcase. It is not supported if the briefcase is read-only, or the briefcase contains a version of\n * the BisCore ECSchema older than v0.1.11.\n * @see [[enterEditingScope]] to enable graphical editing.\n */\n public async supportsGraphicalEditing(): Promise<boolean> {\n return IpcApp.appFunctionIpc.isGraphicalEditingSupported(this.key);\n }\n\n /** Begin a new graphical editing scope.\n * @throws Error if an editing scope already exists or one could not be created.\n * @see [[GraphicalEditingScope.exit]] to exit the scope.\n * @see [[supportsGraphicalEditing]] to determine whether this method should be expected to succeed.\n * @see [[editingScope]] to obtain the current editing scope, if one is in progress.\n */\n public async enterEditingScope(): Promise<GraphicalEditingScope> {\n return this._modelsMonitor.enterEditingScope();\n }\n\n /** Strictly for tests - dispatched from ModelChangeMonitor.processBuffered.\n * @internal\n */\n public readonly onBufferedModelChanges = new BeEvent<(changedModelIds: Set<string>) => void>();\n}\n"]}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module IModelConnection
|
|
3
|
+
*/
|
|
4
|
+
import { CatalogIModel } from "@itwin/core-common";
|
|
5
|
+
import { BriefcaseConnection } from "./BriefcaseConnection";
|
|
6
|
+
/**
|
|
7
|
+
* A read-only connection to a [CatalogDb]($backend).
|
|
8
|
+
* @note CatalogConnection may only be used in [[NativeApp]]s
|
|
9
|
+
* @see [[CatalogConnection.openReadonly]] to instantiate this type.
|
|
10
|
+
* @beta
|
|
11
|
+
*/
|
|
12
|
+
export interface CatalogConnection extends BriefcaseConnection {
|
|
13
|
+
getCatalogInfo(): Promise<{
|
|
14
|
+
manifest?: CatalogIModel.Manifest;
|
|
15
|
+
version: string;
|
|
16
|
+
}>;
|
|
17
|
+
isEditable(): this is EditableCatalogConnection;
|
|
18
|
+
}
|
|
19
|
+
/** A writable connection to an [EditableCatalogDb]($backend).
|
|
20
|
+
* @see [[CatalogConnection.openEditable]] to instantiate this type.
|
|
21
|
+
* @beta
|
|
22
|
+
*/
|
|
23
|
+
export interface EditableCatalogConnection extends CatalogConnection {
|
|
24
|
+
updateManifest(manifest: CatalogIModel.Manifest): Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
/** @beta */
|
|
27
|
+
export declare namespace CatalogConnection {
|
|
28
|
+
/** Create a new [BlobContainer]($backend) to hold versions of a [CatalogIModel]($common).
|
|
29
|
+
* @returns The properties of the newly created container.
|
|
30
|
+
* @note creating new containers requires "admin" authorization.
|
|
31
|
+
*/
|
|
32
|
+
function createNewContainer(args: CatalogIModel.CreateNewContainerArgs): Promise<CatalogIModel.NewContainerProps>;
|
|
33
|
+
/** Acquire the write lock for a CatalogIModel container. Only one person may obtain the write lock at a time.
|
|
34
|
+
* @note this requires "write" authorization to the container
|
|
35
|
+
*/
|
|
36
|
+
function acquireWriteLock(args: {
|
|
37
|
+
/** The id of the container */
|
|
38
|
+
containerId: string;
|
|
39
|
+
/**
|
|
40
|
+
* The name of the individual acquiring the lock. This will be shown to others who attempt to acquire the lock while it is held.
|
|
41
|
+
* It is also stored in the "lastEditedBy" field of the manifest of any new version edited while the lock is held.
|
|
42
|
+
*/
|
|
43
|
+
username: string;
|
|
44
|
+
}): Promise<void>;
|
|
45
|
+
/** Release the write lock on a CatalogIModel container. This uploads all changes made while the lock is held, so they become visible to other users. */
|
|
46
|
+
function releaseWriteLock(args: {
|
|
47
|
+
containerId: string;
|
|
48
|
+
abandon?: true;
|
|
49
|
+
}): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Create a new version of a CatalogIModel as a copy of an existing version. Immediately after this operation, the new version will be an exact copy
|
|
52
|
+
* of the source CatalogIModel. Then, use [[openEditable]] to modify the new version with new content.
|
|
53
|
+
* @note the write lock must be held for this operation to succeed
|
|
54
|
+
* @see [[acquireWriteLock]]
|
|
55
|
+
*/
|
|
56
|
+
function createNewVersion(args: CatalogIModel.CreateNewVersionArgs): Promise<{
|
|
57
|
+
oldDb: CatalogIModel.NameAndVersion;
|
|
58
|
+
newDb: CatalogIModel.NameAndVersion;
|
|
59
|
+
}>;
|
|
60
|
+
/** Open a CatalogIModel for read access.
|
|
61
|
+
* @returns the [[CatalogConnection]] to access the contents of the Catalog.
|
|
62
|
+
* @note CatalogConnection extends BriefcaseConnection. When finished reading, call `close` on the connection.
|
|
63
|
+
*/
|
|
64
|
+
function openReadonly(args: CatalogIModel.OpenArgs): Promise<CatalogConnection>;
|
|
65
|
+
/** Open a CatalogIModel for write access.
|
|
66
|
+
* @note Once a version of a CatalogIModel has been published (i.e. the write lock has been released), it is no longer editable, *unless* it is a prerelease version.
|
|
67
|
+
* @note the write lock must be held for this operation to succeed
|
|
68
|
+
*/
|
|
69
|
+
function openEditable(args: CatalogIModel.OpenArgs): Promise<EditableCatalogConnection>;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=CatalogConnection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CatalogConnection.d.ts","sourceRoot":"","sources":["../../src/CatalogConnection.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAsC,MAAM,oBAAoB,CAAC;AACvF,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAI5D;;;;;GAKG;AACH,MAAM,WAAW,iBAAkB,SAAQ,mBAAmB;IAC5D,cAAc,IAAI,OAAO,CAAC;QAAE,QAAQ,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAClF,UAAU,IAAI,IAAI,IAAI,yBAAyB,CAAC;CACjD;AAED;;;GAGG;AACH,MAAM,WAAW,yBAA0B,SAAQ,iBAAiB;IAClE,cAAc,CAAC,QAAQ,EAAE,aAAa,CAAC,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACjE;AAED,YAAY;AACZ,yBAAiB,iBAAiB,CAAC;IACjC;;;MAGE;IACF,SAAsB,kBAAkB,CAAC,IAAI,EAAE,aAAa,CAAC,sBAAsB,GAAG,OAAO,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAE7H;IAED;;MAEE;IACF,SAAsB,gBAAgB,CAAC,IAAI,EAAE;QAC3C,8BAA8B;QAC9B,WAAW,EAAE,MAAM,CAAC;QACpB;;;WAGG;QACH,QAAQ,EAAE,MAAM,CAAC;KAClB,GAAG,OAAO,CAAC,IAAI,CAAC,CAEhB;IAED,wJAAwJ;IACxJ,SAAsB,gBAAgB,CAAC,IAAI,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,IAAI,CAAC;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAEpG;IAED;;;;;OAKG;IACH,SAAsB,gBAAgB,CAAC,IAAI,EAAE,aAAa,CAAC,oBAAoB,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,aAAa,CAAC,cAAc,CAAC;QAAC,KAAK,EAAE,aAAa,CAAC,cAAc,CAAC;KAAE,CAAC,CAEvK;IAED;;;OAGG;IACH,SAAsB,YAAY,CAAC,IAAI,EAAE,aAAa,CAAC,QAAQ,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAK3F;IAED;;;OAGG;IACH,SAAsB,YAAY,CAAC,IAAI,EAAE,aAAa,CAAC,QAAQ,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAKnG;CACF"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module IModelConnection
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.CatalogConnection = void 0;
|
|
11
|
+
const core_common_1 = require("@itwin/core-common");
|
|
12
|
+
const BriefcaseConnection_1 = require("./BriefcaseConnection");
|
|
13
|
+
const core_bentley_1 = require("@itwin/core-bentley");
|
|
14
|
+
const NativeApp_1 = require("./NativeApp");
|
|
15
|
+
/** @beta */
|
|
16
|
+
var CatalogConnection;
|
|
17
|
+
(function (CatalogConnection) {
|
|
18
|
+
/** Create a new [BlobContainer]($backend) to hold versions of a [CatalogIModel]($common).
|
|
19
|
+
* @returns The properties of the newly created container.
|
|
20
|
+
* @note creating new containers requires "admin" authorization.
|
|
21
|
+
*/
|
|
22
|
+
async function createNewContainer(args) {
|
|
23
|
+
return NativeApp_1.NativeApp.catalogIpc.createNewContainer(args);
|
|
24
|
+
}
|
|
25
|
+
CatalogConnection.createNewContainer = createNewContainer;
|
|
26
|
+
/** Acquire the write lock for a CatalogIModel container. Only one person may obtain the write lock at a time.
|
|
27
|
+
* @note this requires "write" authorization to the container
|
|
28
|
+
*/
|
|
29
|
+
async function acquireWriteLock(args) {
|
|
30
|
+
return NativeApp_1.NativeApp.catalogIpc.acquireWriteLock(args);
|
|
31
|
+
}
|
|
32
|
+
CatalogConnection.acquireWriteLock = acquireWriteLock;
|
|
33
|
+
/** Release the write lock on a CatalogIModel container. This uploads all changes made while the lock is held, so they become visible to other users. */
|
|
34
|
+
async function releaseWriteLock(args) {
|
|
35
|
+
return NativeApp_1.NativeApp.catalogIpc.releaseWriteLock(args);
|
|
36
|
+
}
|
|
37
|
+
CatalogConnection.releaseWriteLock = releaseWriteLock;
|
|
38
|
+
/**
|
|
39
|
+
* Create a new version of a CatalogIModel as a copy of an existing version. Immediately after this operation, the new version will be an exact copy
|
|
40
|
+
* of the source CatalogIModel. Then, use [[openEditable]] to modify the new version with new content.
|
|
41
|
+
* @note the write lock must be held for this operation to succeed
|
|
42
|
+
* @see [[acquireWriteLock]]
|
|
43
|
+
*/
|
|
44
|
+
async function createNewVersion(args) {
|
|
45
|
+
return NativeApp_1.NativeApp.catalogIpc.createNewVersion(args);
|
|
46
|
+
}
|
|
47
|
+
CatalogConnection.createNewVersion = createNewVersion;
|
|
48
|
+
/** Open a CatalogIModel for read access.
|
|
49
|
+
* @returns the [[CatalogConnection]] to access the contents of the Catalog.
|
|
50
|
+
* @note CatalogConnection extends BriefcaseConnection. When finished reading, call `close` on the connection.
|
|
51
|
+
*/
|
|
52
|
+
async function openReadonly(args) {
|
|
53
|
+
const openResponse = await NativeApp_1.NativeApp.catalogIpc.openReadonly(args);
|
|
54
|
+
const connection = new CatalogConnectionImpl(openResponse, core_bentley_1.OpenMode.Readonly);
|
|
55
|
+
BriefcaseConnection_1.BriefcaseConnection.onOpen.raiseEvent(connection);
|
|
56
|
+
return connection;
|
|
57
|
+
}
|
|
58
|
+
CatalogConnection.openReadonly = openReadonly;
|
|
59
|
+
/** Open a CatalogIModel for write access.
|
|
60
|
+
* @note Once a version of a CatalogIModel has been published (i.e. the write lock has been released), it is no longer editable, *unless* it is a prerelease version.
|
|
61
|
+
* @note the write lock must be held for this operation to succeed
|
|
62
|
+
*/
|
|
63
|
+
async function openEditable(args) {
|
|
64
|
+
const openResponse = await NativeApp_1.NativeApp.catalogIpc.openEditable(args);
|
|
65
|
+
const connection = new EditableCatalogConnectionImpl(openResponse, core_bentley_1.OpenMode.ReadWrite);
|
|
66
|
+
BriefcaseConnection_1.BriefcaseConnection.onOpen.raiseEvent(connection);
|
|
67
|
+
return connection;
|
|
68
|
+
}
|
|
69
|
+
CatalogConnection.openEditable = openEditable;
|
|
70
|
+
})(CatalogConnection || (exports.CatalogConnection = CatalogConnection = {}));
|
|
71
|
+
class CatalogConnectionImpl extends BriefcaseConnection_1.BriefcaseConnection {
|
|
72
|
+
constructor(props, openMode) {
|
|
73
|
+
super(props, openMode);
|
|
74
|
+
}
|
|
75
|
+
requireTimeline() {
|
|
76
|
+
throw new core_common_1.IModelError(core_bentley_1.IModelStatus.WrongIModel, "Catalogs have no timeline");
|
|
77
|
+
}
|
|
78
|
+
/** Get the manifest and version information for an open CatalogConnection. */
|
|
79
|
+
async getCatalogInfo() {
|
|
80
|
+
return NativeApp_1.NativeApp.catalogIpc.getInfo(this.key);
|
|
81
|
+
}
|
|
82
|
+
isEditable() {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
class EditableCatalogConnectionImpl extends CatalogConnectionImpl {
|
|
87
|
+
/** Update the contents of the manifest in a CatalogIModel that is open with [[openEditable]]. */
|
|
88
|
+
async updateManifest(manifest) {
|
|
89
|
+
return NativeApp_1.NativeApp.catalogIpc.updateCatalogManifest(this.key, manifest);
|
|
90
|
+
}
|
|
91
|
+
isEditable() {
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=CatalogConnection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CatalogConnection.js","sourceRoot":"","sources":["../../src/CatalogConnection.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oDAAuF;AACvF,+DAA4D;AAC5D,sDAA6D;AAC7D,2CAAwC;AAqBxC,YAAY;AACZ,IAAiB,iBAAiB,CA4DjC;AA5DD,WAAiB,iBAAiB;IAChC;;;MAGE;IACK,KAAK,UAAU,kBAAkB,CAAC,IAA0C;QACjF,OAAO,qBAAS,CAAC,UAAU,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;IACvD,CAAC;IAFqB,oCAAkB,qBAEvC,CAAA;IAED;;MAEE;IACK,KAAK,UAAU,gBAAgB,CAAC,IAQtC;QACC,OAAO,qBAAS,CAAC,UAAU,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACrD,CAAC;IAVqB,kCAAgB,mBAUrC,C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Ae;QAChC,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,WAAW,EAAE,2BAA2B,CAAC,CAAC;IAC/E,CAAC;IAED,8EAA8E;IACvE,KAAK,CAAC,cAAc;QACzB,OAAO,qBAAS,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAChD,CAAC;IAEM,UAAU;QACf,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAED,MAAM,6BAA8B,SAAQ,qBAAqB;IAC/D,iGAAiG;IAC1F,KAAK,CAAC,cAAc,CAAC,QAAgC;QAC1D,OAAO,qBAAS,CAAC,UAAU,CAAC,qBAAqB,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IACxE,CAAC;IAEe,UAAU;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module IModelConnection\n */\n\nimport { CatalogIModel, IModelConnectionProps, IModelError } from \"@itwin/core-common\";\nimport { BriefcaseConnection } from \"./BriefcaseConnection\";\nimport { IModelStatus, OpenMode } from \"@itwin/core-bentley\";\nimport { NativeApp } from \"./NativeApp\";\n\n/**\n * A read-only connection to a [CatalogDb]($backend).\n * @note CatalogConnection may only be used in [[NativeApp]]s\n * @see [[CatalogConnection.openReadonly]] to instantiate this type.\n * @beta\n */\nexport interface CatalogConnection extends BriefcaseConnection {\n getCatalogInfo(): Promise<{ manifest?: CatalogIModel.Manifest, version: string }>;\n isEditable(): this is EditableCatalogConnection;\n}\n\n/** A writable connection to an [EditableCatalogDb]($backend).\n * @see [[CatalogConnection.openEditable]] to instantiate this type.\n * @beta\n */\nexport interface EditableCatalogConnection extends CatalogConnection {\n updateManifest(manifest: CatalogIModel.Manifest): Promise<void>;\n}\n\n/** @beta */\nexport namespace CatalogConnection {\n /** Create a new [BlobContainer]($backend) to hold versions of a [CatalogIModel]($common).\n * @returns The properties of the newly created container.\n * @note creating new containers requires \"admin\" authorization.\n */\n export async function createNewContainer(args: CatalogIModel.CreateNewContainerArgs): Promise<CatalogIModel.NewContainerProps> {\n return NativeApp.catalogIpc.createNewContainer(args);\n }\n\n /** Acquire the write lock for a CatalogIModel container. Only one person may obtain the write lock at a time.\n * @note this requires \"write\" authorization to the container\n */\n export async function acquireWriteLock(args: {\n /** The id of the container */\n containerId: string,\n /**\n * The name of the individual acquiring the lock. This will be shown to others who attempt to acquire the lock while it is held.\n * It is also stored in the \"lastEditedBy\" field of the manifest of any new version edited while the lock is held.\n */\n username: string;\n }): Promise<void> {\n return NativeApp.catalogIpc.acquireWriteLock(args);\n }\n\n /** Release the write lock on a CatalogIModel container. This uploads all changes made while the lock is held, so they become visible to other users. */\n export async function releaseWriteLock(args: { containerId: string, abandon?: true; }): Promise<void> {\n return NativeApp.catalogIpc.releaseWriteLock(args);\n }\n\n /**\n * Create a new version of a CatalogIModel as a copy of an existing version. Immediately after this operation, the new version will be an exact copy\n * of the source CatalogIModel. Then, use [[openEditable]] to modify the new version with new content.\n * @note the write lock must be held for this operation to succeed\n * @see [[acquireWriteLock]]\n */\n export async function createNewVersion(args: CatalogIModel.CreateNewVersionArgs): Promise<{ oldDb: CatalogIModel.NameAndVersion; newDb: CatalogIModel.NameAndVersion; }> {\n return NativeApp.catalogIpc.createNewVersion(args);\n }\n\n /** Open a CatalogIModel for read access.\n * @returns the [[CatalogConnection]] to access the contents of the Catalog.\n * @note CatalogConnection extends BriefcaseConnection. When finished reading, call `close` on the connection.\n */\n export async function openReadonly(args: CatalogIModel.OpenArgs): Promise<CatalogConnection> {\n const openResponse = await NativeApp.catalogIpc.openReadonly(args);\n const connection = new CatalogConnectionImpl(openResponse, OpenMode.Readonly);\n BriefcaseConnection.onOpen.raiseEvent(connection);\n return connection;\n }\n\n /** Open a CatalogIModel for write access.\n * @note Once a version of a CatalogIModel has been published (i.e. the write lock has been released), it is no longer editable, *unless* it is a prerelease version.\n * @note the write lock must be held for this operation to succeed\n */\n export async function openEditable(args: CatalogIModel.OpenArgs): Promise<EditableCatalogConnection> {\n const openResponse = await NativeApp.catalogIpc.openEditable(args);\n const connection = new EditableCatalogConnectionImpl(openResponse, OpenMode.ReadWrite);\n BriefcaseConnection.onOpen.raiseEvent(connection);\n return connection;\n }\n}\n\nclass CatalogConnectionImpl extends BriefcaseConnection implements CatalogConnection{\n public constructor(props: IModelConnectionProps, openMode: OpenMode) {\n super(props, openMode);\n }\n\n protected override requireTimeline(): void {\n throw new IModelError(IModelStatus.WrongIModel, \"Catalogs have no timeline\");\n }\n\n /** Get the manifest and version information for an open CatalogConnection. */\n public async getCatalogInfo(): Promise<{ manifest?: CatalogIModel.Manifest, version: string }> {\n return NativeApp.catalogIpc.getInfo(this.key);\n }\n\n public isEditable(): this is EditableCatalogConnection {\n return false;\n }\n}\n\nclass EditableCatalogConnectionImpl extends CatalogConnectionImpl implements EditableCatalogConnection {\n /** Update the contents of the manifest in a CatalogIModel that is open with [[openEditable]]. */\n public async updateManifest(manifest: CatalogIModel.Manifest): Promise<void> {\n return NativeApp.catalogIpc.updateCatalogManifest(this.key, manifest);\n }\n\n public override isEditable(): this is EditableCatalogConnection {\n return true;\n }\n}\n"]}
|
package/lib/cjs/IpcApp.d.ts
CHANGED
|
@@ -73,7 +73,7 @@ export declare class IpcApp {
|
|
|
73
73
|
/** Create a type safe Proxy object to make IPC calls to a registered backend interface.
|
|
74
74
|
* @param channelName the channel registered by the backend handler.
|
|
75
75
|
*/
|
|
76
|
-
static makeIpcProxy<K>(channelName:
|
|
76
|
+
static makeIpcProxy<K, C extends string = string>(channelName: C): PickAsyncMethods<K>;
|
|
77
77
|
/** Create a type safe Proxy object to call an IPC function on a of registered backend handler that accepts a "methodName" argument followed by optional arguments
|
|
78
78
|
* @param channelName the channel registered by the backend handler.
|
|
79
79
|
* @param functionName the function to call on the handler.
|
package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AQ,8DAA8D,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;YAErL,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,QAAQ;QACpB,OAAQ,IAAK,IAAY,EAA0B,CAAC,YAAY,EAAE,CAAC,CAAC,uFAAuF;IAC7J,CAAC;CACF;AAvBD,kDAuBC;AAED,wCAAwC;AACxC,MAAM,mBAAoB,SAAQ,mBAAmB;IACnD,IAAW,WAAW,KAAK,OAAO,4BAAc,CAAC,SAAS,CAAC,CAAC,CAAC;IACtD,SAAS,KAAK,CAAC;CACvB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module NativeApp\n */\n\nimport { BentleyError, IModelStatus, JsonUtils, PickAsyncMethods } from \"@itwin/core-bentley\";\nimport {\n BackendError, IModelError, ipcAppChannels, IpcAppFunctions, IpcAppNotifications, IpcInvokeReturn, IpcListener, IpcSocketFrontend, iTwinChannel,\n RemoveFunction,\n} from \"@itwin/core-common\";\nimport { _callIpcChannel } from \"./common/internal/Symbols\";\nimport { IModelApp, IModelAppOptions } from \"./IModelApp\";\n\n/**\n * Options for [[IpcApp.startup]]\n * @public\n */\nexport interface IpcAppOptions {\n iModelApp?: IModelAppOptions;\n}\n\n/**\n * The frontend of apps with a dedicated backend that can use [Ipc]($docs/learning/IpcInterface.md).\n * @public\n */\nexport class IpcApp {\n private static _ipc: IpcSocketFrontend | undefined;\n /** Get the implementation of the [[IpcSocketFrontend]] interface. */\n\n private static get ipc(): IpcSocketFrontend { return this._ipc!; }\n\n /** Determine whether Ipc is available for this frontend. This will only be true if [[startup]] has been called on this class. */\n public static get isValid(): boolean { return undefined !== this._ipc; }\n\n /**\n * Establish a message handler function for the supplied channel over Ipc. The handler will be called when messages are sent for\n * the channel via [[BackendIpc.send]].\n * @param channel the name of the channel\n * @param handler the message handler\n * @returns A function to remove the handler\n * @note Ipc is only supported if [[isValid]] is true.\n */\n public static addListener(channel: string, handler: IpcListener): RemoveFunction {\n return this.ipc.addListener(iTwinChannel(channel), handler);\n }\n\n /**\n * Remove a previously registered listener\n * @param channel The name of the channel for the listener previously registered with [[addListener]]\n * @param listener The function passed to [[addListener]]\n */\n public static removeListener(channel: string, listener: IpcListener) {\n this.ipc.removeListener(iTwinChannel(channel), listener);\n }\n\n /**\n * Send a message to the backend via `channel` and expect a result asynchronously. The handler must be established on the backend via [[BackendIpc.handle]]\n * @param channel The name of the channel for the method.\n * @see Electron [ipcRenderer.invoke](https://www.electronjs.org/docs/api/ipc-renderer) documentation for details.\n * Note that this interface may be implemented via Electron for desktop apps, or via\n * [WebSockets](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API) for mobile or web-based\n * Ipc connections. In either case, the Electron documentation provides the specifications for how it works.\n * @note `args` are serialized with the [Structured Clone Algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm), so only\n * primitive types and `ArrayBuffers` are allowed.\n */\n public static async invoke(channel: string, ...args: any[]): Promise<any> {\n return this.ipc.invoke(iTwinChannel(channel), ...args);\n }\n\n /**\n * Send a message over the socket.\n * @param channel The name of the channel for the message.\n * @param data The optional data of the message.\n * @note `data` is serialized with the [Structured Clone Algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm), so only\n * primitive types and `ArrayBuffers` are allowed.\n */\n public static send(channel: string, ...data: any[]) {\n return this.ipc.send(iTwinChannel(channel), ...data);\n }\n\n /**\n * Call a method on the backend through an Ipc channel.\n * @param channelName the channel registered by the backend handler.\n * @param methodName the name of a method implemented by the backend handler.\n * @param args arguments to `methodName`\n * @return a Promise with the return value from `methodName`\n * @note If the backend implementation throws an exception, this method will throw an exception with its contents\n * @internal Use [[makeIpcProxy]] for a type-safe interface.\n */\n public static async [_callIpcChannel](channelName: string, methodName: string, ...args: any[]): Promise<any> {\n const retVal = (await this.invoke(channelName, methodName, ...args)) as IpcInvokeReturn;\n\n if (retVal.error === undefined)\n return retVal.result; // method was successful\n\n // backend threw an exception, rethrow one on frontend\n const err = retVal.error;\n if (!JsonUtils.isObject(err)) {\n // Exception wasn't an object?\n throw retVal.error; // eslint-disable-line @typescript-eslint/only-throw-error\n }\n\n // Note: for backwards compatibility, if the exception was from a BentleyError on the backend, throw an exception of type `BackendError`.\n if (!BentleyError.isError(err))\n throw Object.assign(new Error(typeof err.message === \"string\" ? err.message : \"unknown error\"), err);\n\n const trimErr = { ...err } as any;\n delete trimErr.iTwinErrorId // these are methods on BackendError and will cause Object.assign to fail.\n delete trimErr.loggingMetadata;\n throw Object.assign(new BackendError(err.errorNumber, err.iTwinErrorId.key, err.message, err.loggingMetadata), trimErr);\n }\n\n /** @internal\n * @deprecated in 4.8. Use [[makeIpcProxy]] for a type-safe interface.\n */\n public static async callIpcChannel(channelName: string, methodName: string, ...args: any[]): Promise<any> {\n return this[_callIpcChannel](channelName, methodName, ...args);\n }\n\n /** Create a type safe Proxy object to make IPC calls to a registered backend interface.\n * @param channelName the channel registered by the backend handler.\n */\n public static makeIpcProxy<K>(channelName: string): PickAsyncMethods<K> {\n return new Proxy({} as PickAsyncMethods<K>, {\n get(_target, methodName: string) {\n return async (...args: any[]) =>\n IpcApp[_callIpcChannel](channelName, methodName, ...args);\n },\n });\n }\n\n /** Create a type safe Proxy object to call an IPC function on a of registered backend handler that accepts a \"methodName\" argument followed by optional arguments\n * @param channelName the channel registered by the backend handler.\n * @param functionName the function to call on the handler.\n */\n public static makeIpcFunctionProxy<K>(channelName: string, functionName: string): PickAsyncMethods<K> {\n return new Proxy({} as PickAsyncMethods<K>, {\n get(_target, methodName: string) {\n return async (...args: any[]) =>\n IpcApp[_callIpcChannel](channelName, functionName, methodName, ...args);\n },\n });\n }\n\n /** A Proxy to call one of the [IpcAppFunctions]($common) functions via IPC. */\n public static appFunctionIpc = IpcApp.makeIpcProxy<IpcAppFunctions>(ipcAppChannels.functions);\n\n /** start an IpcApp.\n * @note this should not be called directly. It is called by NativeApp.startup */\n public static async startup(ipc: IpcSocketFrontend, opts?: IpcAppOptions) {\n this._ipc = ipc;\n IpcAppNotifyHandler.register(); // receives notifications from backend\n await IModelApp.startup(opts?.iModelApp);\n }\n\n /** @internal */\n public static async shutdown() {\n this._ipc = undefined;\n await IModelApp.shutdown();\n }\n}\n\n/**\n * Base class for all implementations of an Ipc notification response interface. This class is implemented on your frontend to supply\n * methods to receive notifications from your backend.\n *\n * Create a subclass to implement your Ipc response interface. Your class should be declared like this:\n * ```ts\n * class MyNotificationHandler extends NotificationHandler implements MyNotifications\n * ```\n * to ensure all method names and signatures are correct. Your methods cannot have a return value.\n *\n * Then, call `MyNotificationHandler.register` at startup to connect your class to your channel.\n * @public\n * @extensions\n */\nexport abstract class NotificationHandler {\n /** All subclasses must implement this method to specify their response channel name. */\n public abstract get channelName(): string;\n\n public registerImpl(): RemoveFunction {\n return IpcApp.addListener(this.channelName, (_evt: Event, funcName: string, ...args: any[]) => {\n const func = (this as any)[funcName];\n if (typeof func !== \"function\")\n throw new IModelError(IModelStatus.FunctionNotFound, `Method \"${this.constructor.name}.${funcName}\" not found on NotificationHandler registered for channel: ${this.channelName}`);\n\n func.call(this, ...args);\n });\n }\n\n /**\n * Register this class as the handler for notifications on its channel. This static method creates a new instance\n * that becomes the notification handler and is `this` when its methods are called.\n * @returns A function that can be called to remove the handler.\n * @note this method should only be called once per channel. If it is called multiple times, multiple handlers are established.\n */\n public static register(): RemoveFunction {\n return (new (this as any)() as NotificationHandler).registerImpl(); // create an instance of subclass. \"as any\" is necessary because base class is abstract\n }\n}\n\n/** IpcApp notifications from backend */\nclass IpcAppNotifyHandler extends NotificationHandler implements IpcAppNotifications {\n public get channelName() { return ipcAppChannels.appNotify; }\n public notifyApp() { }\n}\n"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;;GAaG;AACH,MAAsB,mBAAmB;IAIhC,YAAY;QACjB,OAAO,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,IAAW,EAAE,QAAgB,EAAE,GAAG,IAAW,EAAE,EAAE;YAC5F,MAAM,IAAI,GAAI,IAAY,CAAC,QAAQ,CAAC,CAAC;YACrC,IAAI,OAAO,IAAI,KAAK,UAAU;gBAC5B,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,gBAAgB,EAAE,WAAW,IAAI,CAAC,WAAW,CAAC,IAAI,IAAI,QAAQ,8DAA8D,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;YAErL,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,QAAQ;QACpB,OAAQ,IAAK,IAAY,EAA0B,CAAC,YAAY,EAAE,CAAC,CAAC,uFAAuF;IAC7J,CAAC;CACF;AAvBD,kDAuBC;AAED,wCAAwC;AACxC,MAAM,mBAAoB,SAAQ,mBAAmB;IACnD,IAAW,WAAW,KAAK,OAAO,4BAAc,CAAC,SAAS,CAAC,CAAC,CAAC;IACtD,SAAS,KAAK,CAAC;CACvB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module NativeApp\n */\n\nimport { BentleyError, IModelStatus, JsonUtils, PickAsyncMethods } from \"@itwin/core-bentley\";\nimport {\n BackendError, IModelError, ipcAppChannels, IpcAppFunctions, IpcAppNotifications, IpcInvokeReturn, IpcListener, IpcSocketFrontend, iTwinChannel,\n RemoveFunction,\n} from \"@itwin/core-common\";\nimport { _callIpcChannel } from \"./common/internal/Symbols\";\nimport { IModelApp, IModelAppOptions } from \"./IModelApp\";\n\n/**\n * Options for [[IpcApp.startup]]\n * @public\n */\nexport interface IpcAppOptions {\n iModelApp?: IModelAppOptions;\n}\n\n/**\n * The frontend of apps with a dedicated backend that can use [Ipc]($docs/learning/IpcInterface.md).\n * @public\n */\nexport class IpcApp {\n private static _ipc: IpcSocketFrontend | undefined;\n /** Get the implementation of the [[IpcSocketFrontend]] interface. */\n\n private static get ipc(): IpcSocketFrontend { return this._ipc!; }\n\n /** Determine whether Ipc is available for this frontend. This will only be true if [[startup]] has been called on this class. */\n public static get isValid(): boolean { return undefined !== this._ipc; }\n\n /**\n * Establish a message handler function for the supplied channel over Ipc. The handler will be called when messages are sent for\n * the channel via [[BackendIpc.send]].\n * @param channel the name of the channel\n * @param handler the message handler\n * @returns A function to remove the handler\n * @note Ipc is only supported if [[isValid]] is true.\n */\n public static addListener(channel: string, handler: IpcListener): RemoveFunction {\n return this.ipc.addListener(iTwinChannel(channel), handler);\n }\n\n /**\n * Remove a previously registered listener\n * @param channel The name of the channel for the listener previously registered with [[addListener]]\n * @param listener The function passed to [[addListener]]\n */\n public static removeListener(channel: string, listener: IpcListener) {\n this.ipc.removeListener(iTwinChannel(channel), listener);\n }\n\n /**\n * Send a message to the backend via `channel` and expect a result asynchronously. The handler must be established on the backend via [[BackendIpc.handle]]\n * @param channel The name of the channel for the method.\n * @see Electron [ipcRenderer.invoke](https://www.electronjs.org/docs/api/ipc-renderer) documentation for details.\n * Note that this interface may be implemented via Electron for desktop apps, or via\n * [WebSockets](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API) for mobile or web-based\n * Ipc connections. In either case, the Electron documentation provides the specifications for how it works.\n * @note `args` are serialized with the [Structured Clone Algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm), so only\n * primitive types and `ArrayBuffers` are allowed.\n */\n public static async invoke(channel: string, ...args: any[]): Promise<any> {\n return this.ipc.invoke(iTwinChannel(channel), ...args);\n }\n\n /**\n * Send a message over the socket.\n * @param channel The name of the channel for the message.\n * @param data The optional data of the message.\n * @note `data` is serialized with the [Structured Clone Algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm), so only\n * primitive types and `ArrayBuffers` are allowed.\n */\n public static send(channel: string, ...data: any[]) {\n return this.ipc.send(iTwinChannel(channel), ...data);\n }\n\n /**\n * Call a method on the backend through an Ipc channel.\n * @param channelName the channel registered by the backend handler.\n * @param methodName the name of a method implemented by the backend handler.\n * @param args arguments to `methodName`\n * @return a Promise with the return value from `methodName`\n * @note If the backend implementation throws an exception, this method will throw an exception with its contents\n * @internal Use [[makeIpcProxy]] for a type-safe interface.\n */\n public static async [_callIpcChannel](channelName: string, methodName: string, ...args: any[]): Promise<any> {\n const retVal = (await this.invoke(channelName, methodName, ...args)) as IpcInvokeReturn;\n\n if (retVal.error === undefined)\n return retVal.result; // method was successful\n\n // backend threw an exception, rethrow one on frontend\n const err = retVal.error;\n if (!JsonUtils.isObject(err)) {\n // Exception wasn't an object?\n throw retVal.error; // eslint-disable-line @typescript-eslint/only-throw-error\n }\n\n // Note: for backwards compatibility, if the exception was from a BentleyError on the backend, throw an exception of type `BackendError`.\n if (!BentleyError.isError(err))\n throw Object.assign(new Error(typeof err.message === \"string\" ? err.message : \"unknown error\"), err);\n\n const trimErr = { ...err } as any;\n delete trimErr.iTwinErrorId // these are methods on BackendError and will cause Object.assign to fail.\n delete trimErr.loggingMetadata;\n throw Object.assign(new BackendError(err.errorNumber, err.iTwinErrorId.key, err.message, err.loggingMetadata), trimErr);\n }\n\n /** @internal\n * @deprecated in 4.8. Use [[makeIpcProxy]] for a type-safe interface.\n */\n public static async callIpcChannel(channelName: string, methodName: string, ...args: any[]): Promise<any> {\n return this[_callIpcChannel](channelName, methodName, ...args);\n }\n\n /** Create a type safe Proxy object to make IPC calls to a registered backend interface.\n * @param channelName the channel registered by the backend handler.\n */\n public static makeIpcProxy<K, C extends string = string>(channelName: C): PickAsyncMethods<K> {\n return new Proxy({} as PickAsyncMethods<K>, {\n get(_target, methodName: string) {\n return async (...args: any[]) =>\n IpcApp[_callIpcChannel](channelName, methodName, ...args);\n },\n });\n }\n\n /** Create a type safe Proxy object to call an IPC function on a of registered backend handler that accepts a \"methodName\" argument followed by optional arguments\n * @param channelName the channel registered by the backend handler.\n * @param functionName the function to call on the handler.\n */\n public static makeIpcFunctionProxy<K>(channelName: string, functionName: string): PickAsyncMethods<K> {\n return new Proxy({} as PickAsyncMethods<K>, {\n get(_target, methodName: string) {\n return async (...args: any[]) =>\n IpcApp[_callIpcChannel](channelName, functionName, methodName, ...args);\n },\n });\n }\n\n /** A Proxy to call one of the [IpcAppFunctions]($common) functions via IPC. */\n public static appFunctionIpc = IpcApp.makeIpcProxy<IpcAppFunctions>(ipcAppChannels.functions);\n\n /** start an IpcApp.\n * @note this should not be called directly. It is called by NativeApp.startup */\n public static async startup(ipc: IpcSocketFrontend, opts?: IpcAppOptions) {\n this._ipc = ipc;\n IpcAppNotifyHandler.register(); // receives notifications from backend\n await IModelApp.startup(opts?.iModelApp);\n }\n\n /** @internal */\n public static async shutdown() {\n this._ipc = undefined;\n await IModelApp.shutdown();\n }\n}\n\n/**\n * Base class for all implementations of an Ipc notification response interface. This class is implemented on your frontend to supply\n * methods to receive notifications from your backend.\n *\n * Create a subclass to implement your Ipc response interface. Your class should be declared like this:\n * ```ts\n * class MyNotificationHandler extends NotificationHandler implements MyNotifications\n * ```\n * to ensure all method names and signatures are correct. Your methods cannot have a return value.\n *\n * Then, call `MyNotificationHandler.register` at startup to connect your class to your channel.\n * @public\n * @extensions\n */\nexport abstract class NotificationHandler {\n /** All subclasses must implement this method to specify their response channel name. */\n public abstract get channelName(): string;\n\n public registerImpl(): RemoveFunction {\n return IpcApp.addListener(this.channelName, (_evt: Event, funcName: string, ...args: any[]) => {\n const func = (this as any)[funcName];\n if (typeof func !== \"function\")\n throw new IModelError(IModelStatus.FunctionNotFound, `Method \"${this.constructor.name}.${funcName}\" not found on NotificationHandler registered for channel: ${this.channelName}`);\n\n func.call(this, ...args);\n });\n }\n\n /**\n * Register this class as the handler for notifications on its channel. This static method creates a new instance\n * that becomes the notification handler and is `this` when its methods are called.\n * @returns A function that can be called to remove the handler.\n * @note this method should only be called once per channel. If it is called multiple times, multiple handlers are established.\n */\n public static register(): RemoveFunction {\n return (new (this as any)() as NotificationHandler).registerImpl(); // create an instance of subclass. \"as any\" is necessary because base class is abstract\n }\n}\n\n/** IpcApp notifications from backend */\nclass IpcAppNotifyHandler extends NotificationHandler implements IpcAppNotifications {\n public get channelName() { return ipcAppChannels.appNotify; }\n public notifyApp() { }\n}\n"]}
|
package/lib/cjs/NativeApp.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @module NativeApp
|
|
3
3
|
*/
|
|
4
4
|
import { BeEvent, GuidString } from "@itwin/core-bentley";
|
|
5
|
-
import { BriefcaseDownloader, BriefcaseProps, IModelVersion, InternetConnectivityStatus, IpcSocketFrontend, LocalBriefcaseProps, NativeAppFunctions, StorageValue, SyncMode } from "@itwin/core-common";
|
|
5
|
+
import { BriefcaseDownloader, BriefcaseProps, CatalogIModel, IModelVersion, InternetConnectivityStatus, IpcSocketFrontend, LocalBriefcaseProps, NativeAppFunctions, StorageValue, SyncMode } from "@itwin/core-common";
|
|
6
6
|
import { IpcAppOptions } from "./IpcApp";
|
|
7
7
|
import { OnDownloadProgress } from "./BriefcaseConnection";
|
|
8
8
|
/** Properties for specifying the BriefcaseId for downloading. May either specify a BriefcaseId directly (preferable) or, for
|
|
@@ -44,6 +44,7 @@ export declare class NativeApp {
|
|
|
44
44
|
private static _removeAppNotify?;
|
|
45
45
|
/** A Proxy to call one of the [NativeAppFunctions]($common) functions via IPC. */
|
|
46
46
|
static nativeAppIpc: import("@itwin/core-bentley").PickAsyncMethods<NativeAppFunctions>;
|
|
47
|
+
static catalogIpc: import("@itwin/core-bentley").PickAsyncMethods<CatalogIModel.IpcMethods>;
|
|
47
48
|
private static _storages;
|
|
48
49
|
private static _onOnline;
|
|
49
50
|
private static _onOffline;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeApp.d.ts","sourceRoot":"","sources":["../../src/NativeApp.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,UAAU,EAAU,MAAM,qBAAqB,CAAC;AAClE,OAAO,EACL,mBAAmB,EAAE,cAAc,EAAE,aAAa,EAAE,0BAA0B,EAAE,iBAAiB,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"NativeApp.d.ts","sourceRoot":"","sources":["../../src/NativeApp.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,UAAU,EAAU,MAAM,qBAAqB,CAAC;AAClE,OAAO,EACL,mBAAmB,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,0BAA0B,EAAE,iBAAiB,EAAE,mBAAmB,EACrI,kBAAkB,EACwB,YAAY,EAAE,QAAQ,EACjE,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAU,aAAa,EAAuB,MAAM,UAAU,CAAC;AAEtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAG3D;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAC7B;IAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAAC,WAAW,CAAC,EAAE,KAAK,CAAA;CAAE,GAC5C;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AAE5C;;;EAGE;AACF,MAAM,MAAM,wBAAwB,GAAG,mBAAmB,GAAG;IAC3D,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gEAAgE;IAChE,gBAAgB,CAAC,EAAE,kBAAkB,CAAC;IACtC,8DAA8D;IAC9D,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAWF;;;GAGG;AACH,MAAM,WAAW,aAAc,SAAQ,aAAa;IA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mB,EAAE,CAAC;IAI9F;;;;OAIG;WACiB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAS/D;;;;OAIG;WACiB,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,aAAa,GAAE,OAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAQjG,2DAA2D;WACvC,eAAe,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;CAGzD;AAED;;;;GAIG;AACH,qBAAa,OAAO;aACU,EAAE,EAAE,MAAM;gBAAV,EAAE,EAAE,MAAM;IAEtC,sEAAsE;IACzD,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,YAAY,GAAG,MAAM,GAAG,SAAS,CAAC;IAIpH,8BAA8B;IACjB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAIxD,0BAA0B;IACb,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrE;;;OAGG;IACU,OAAO,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAIzC,iCAAiC;IACpB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAInD,sCAAsC;IACzB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;CAGxC"}
|
package/lib/cjs/NativeApp.js
CHANGED
|
@@ -30,6 +30,7 @@ class NativeApp {
|
|
|
30
30
|
static _removeAppNotify;
|
|
31
31
|
/** A Proxy to call one of the [NativeAppFunctions]($common) functions via IPC. */
|
|
32
32
|
static nativeAppIpc = IpcApp_1.IpcApp.makeIpcProxy(core_common_1.nativeAppIpcStrings.channelName);
|
|
33
|
+
static catalogIpc = IpcApp_1.IpcApp.makeIpcProxy("catalogIModel/ipc");
|
|
33
34
|
static _storages = new Map();
|
|
34
35
|
static _onOnline = async () => {
|
|
35
36
|
await NativeApp.setConnectivity(core_common_1.OverriddenBy.Browser, core_common_1.InternetConnectivityStatus.Online);
|
package/lib/cjs/NativeApp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeApp.js","sourceRoot":"","sources":["../../src/NativeApp.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAkE;AAClE,oDAI4B;AAC5B,4EAAyE;AACzE,qCAAsE;AACtE,uDAAoD;AAyBpD,2CAA2C;AAC3C,MAAM,sBAAuB,SAAQ,4BAAmB;IACtD,IAAW,WAAW,KAAK,OAAO,iCAAmB,CAAC,aAAa,CAAC,CAAC,CAAC;IAC/D,iCAAiC,CAAC,MAAkC;QACzE,qBAAM,CAAC,OAAO,CAAC,+CAAsB,CAAC,SAAS,EAAE,+BAA+B,CAAC,CAAC;QAClF,SAAS,CAAC,6BAA6B,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAC7D,CAAC;CACF;AAUD;;;;GAIG;AACH,MAAa,SAAS;IACZ,MAAM,CAAC,gBAAgB,CAAkB;IAEjD,kFAAkF;IAC3E,MAAM,CAAC,YAAY,GAAG,eAAM,CAAC,YAAY,CAAqB,iCAAmB,CAAC,WAAW,CAAC,CAAC;IAE9F,MAAM,CAAC,SAAS,GAAG,IAAI,GAAG,EAAmB,CAAC;IAC9C,MAAM,CAAC,SAAS,GAAG,KAAK,IAAI,EAAE;QACpC,MAAM,SAAS,CAAC,eAAe,CAAC,0BAAY,CAAC,OAAO,EAAE,wCAA0B,CAAC,MAAM,CAAC,CAAC;IAC3F,CAAC,CAAC;IACM,MAAM,CAAC,UAAU,GAAG,KAAK,IAAI,EAAE;QACrC,MAAM,SAAS,CAAC,eAAe,CAAC,0BAAY,CAAC,OAAO,EAAE,wCAA0B,CAAC,OAAO,CAAC,CAAC;IAC5F,CAAC,CAAC;IACM,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,EAAgB,EAAE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------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module NativeApp\n */\n\nimport { BeEvent, GuidString, Logger } from \"@itwin/core-bentley\";\nimport {\n BriefcaseDownloader, BriefcaseProps, IModelVersion, InternetConnectivityStatus, IpcSocketFrontend, LocalBriefcaseProps,\n NativeAppFunctions, nativeAppIpcStrings, NativeAppNotifications, OverriddenBy,\n RemoveFunction, RequestNewBriefcaseProps, StorageValue, SyncMode,\n} from \"@itwin/core-common\";\nimport { FrontendLoggerCategory } from \"./common/FrontendLoggerCategory\";\nimport { IpcApp, IpcAppOptions, NotificationHandler } from \"./IpcApp\";\nimport { NativeAppLogger } from \"./NativeAppLogger\";\nimport { OnDownloadProgress } from \"./BriefcaseConnection\";\nimport { _callIpcChannel } from \"./common/internal/Symbols\";\n\n/** Properties for specifying the BriefcaseId for downloading. May either specify a BriefcaseId directly (preferable) or, for\n * backwards compatibility, a [SyncMode]($common). If [SyncMode.PullAndPush]($common) is supplied, a new briefcaseId will be acquired.\n * @public\n */\nexport type DownloadBriefcaseId =\n { syncMode?: SyncMode, briefcaseId?: never } |\n { briefcaseId: number, syncMode?: never };\n\n/**\n* Options to download a briefcase\n* @public\n*/\nexport type DownloadBriefcaseOptions = DownloadBriefcaseId & {\n /** the full path for the briefcase file */\n fileName?: string;\n /** Function called regularly to report progress of download. */\n progressCallback?: OnDownloadProgress;\n /** interval for calling progress function, in milliseconds */\n progressInterval?: number;\n};\n\n/** NativeApp notifications from backend */\nclass NativeAppNotifyHandler extends NotificationHandler implements NativeAppNotifications {\n public get channelName() { return nativeAppIpcStrings.notifyChannel; }\n public notifyInternetConnectivityChanged(status: InternetConnectivityStatus) {\n Logger.logInfo(FrontendLoggerCategory.NativeApp, \"Internet connectivity changed\");\n NativeApp.onInternetConnectivityChanged.raiseEvent(status);\n }\n}\n\n/**\n * Options for [[NativeApp.startup]]\n * @public\n */\nexport interface NativeAppOpts extends IpcAppOptions {\n nativeApp?: object;\n}\n\n/**\n * The frontend of a native application\n * @see [Native Applications]($docs/learning/NativeApps.md)\n * @public\n */\nexport class NativeApp {\n private static _removeAppNotify?: RemoveFunction;\n\n /** A Proxy to call one of the [NativeAppFunctions]($common) functions via IPC. */\n public static nativeAppIpc = IpcApp.makeIpcProxy<NativeAppFunctions>(nativeAppIpcStrings.channelName);\n\n private static _storages = new Map<string, Storage>();\n private static _onOnline = async () => {\n await NativeApp.setConnectivity(OverriddenBy.Browser, InternetConnectivityStatus.Online);\n };\n private static _onOffline = async () => {\n await NativeApp.setConnectivity(OverriddenBy.Browser, InternetConnectivityStatus.Offline);\n };\n private static async setConnectivity(by: OverriddenBy, status: InternetConnectivityStatus) {\n await this.nativeAppIpc.overrideInternetConnectivity(by, status);\n }\n private static hookBrowserConnectivityEvents() {\n if (typeof window === \"object\" && window.ononline && window.onoffline) {\n window.addEventListener(\"online\", this._onOnline);\n window.addEventListener(\"offline\", this._onOffline);\n }\n }\n private static unhookBrowserConnectivityEvents() {\n if (typeof window === \"object\" && window.ononline && window.onoffline) {\n window.removeEventListener(\"online\", this._onOnline);\n window.removeEventListener(\"offline\", this._onOffline);\n }\n }\n /** event called when internet connectivity changes, if known */\n public static onInternetConnectivityChanged = new BeEvent<(status: InternetConnectivityStatus) => void>();\n\n /** determine whether the app currently has internet connectivity, if known */\n public static async checkInternetConnectivity(): Promise<InternetConnectivityStatus> {\n return this.nativeAppIpc.checkInternetConnectivity();\n }\n /** @internal */\n public static async overrideInternetConnectivity(status: InternetConnectivityStatus): Promise<void> {\n return this.nativeAppIpc.overrideInternetConnectivity(OverriddenBy.User, status);\n }\n private static _isValid = false;\n public static get isValid(): boolean { return this._isValid; }\n\n /**\n * This is called by either ElectronApp.startup or MobileApp.startup - it should not be called directly\n * @internal\n */\n public static async startup(ipc: IpcSocketFrontend, opts?: NativeAppOpts) {\n await IpcApp.startup(ipc, opts);\n if (this._isValid)\n return;\n this._isValid = true;\n\n this._removeAppNotify = NativeAppNotifyHandler.register(); // receives notifications from backend\n NativeApp.hookBrowserConnectivityEvents();\n\n // initialize current online state.\n if (window.navigator.onLine) {\n await this.setConnectivity(OverriddenBy.Browser, window.navigator.onLine ? InternetConnectivityStatus.Online : InternetConnectivityStatus.Offline);\n }\n }\n\n /** @internal */\n public static async shutdown() {\n this._removeAppNotify?.();\n NativeApp.unhookBrowserConnectivityEvents();\n await NativeAppLogger.flush();\n await IpcApp.shutdown();\n this._isValid = false;\n }\n\n public static async requestDownloadBriefcase(iTwinId: string, iModelId: string, downloadOptions: DownloadBriefcaseOptions,\n asOf?: IModelVersion): Promise<BriefcaseDownloader>;\n\n public static async requestDownloadBriefcase(\n iTwinId: string,\n iModelId: string,\n downloadOptions: DownloadBriefcaseOptions,\n asOf: IModelVersion = IModelVersion.latest()\n ): Promise<BriefcaseDownloader> {\n const shouldReportProgress = !!downloadOptions.progressCallback;\n\n let stopProgressEvents = () => { };\n if (shouldReportProgress) {\n const handleProgress = (_evt: Event, data: { loaded: number, total: number }) => {\n downloadOptions.progressCallback?.(data);\n };\n\n stopProgressEvents = IpcApp.addListener(`nativeApp.progress-${iModelId}`, handleProgress);\n }\n\n const briefcaseId = (undefined !== downloadOptions.briefcaseId) ? downloadOptions.briefcaseId :\n (downloadOptions.syncMode === SyncMode.PullOnly ? 0 : await this.nativeAppIpc.acquireNewBriefcaseId(iModelId));\n\n const fileName = downloadOptions.fileName ?? await this.getBriefcaseFileName({ briefcaseId, iModelId });\n const requestProps: RequestNewBriefcaseProps = { iModelId, briefcaseId, iTwinId, asOf: asOf.toJSON(), fileName };\n\n const doDownload = async (): Promise<void> => {\n try {\n await this.nativeAppIpc.downloadBriefcase(requestProps, shouldReportProgress, downloadOptions.progressInterval);\n } finally {\n stopProgressEvents();\n }\n };\n\n const requestCancel = async (): Promise<boolean> => {\n const status = await this.nativeAppIpc.requestCancelDownloadBriefcase(fileName);\n if (status)\n stopProgressEvents();\n return status;\n };\n\n return { briefcaseId, fileName, downloadPromise: doDownload(), requestCancel };\n }\n\n /** Get the full path filename for a briefcase within the briefcase cache */\n public static async getBriefcaseFileName(props: BriefcaseProps): Promise<string> {\n return this.nativeAppIpc.getBriefcaseFileName(props);\n }\n\n /** Delete an existing briefcase\n * @param fileName the briefcase fileName\n */\n public static async deleteBriefcase(fileName: string): Promise<void> {\n await this.nativeAppIpc.deleteBriefcaseFiles(fileName);\n }\n\n /** Get a list of all briefcase files held in the local briefcase cache directory */\n public static async getCachedBriefcases(iModelId?: GuidString): Promise<LocalBriefcaseProps[]> {\n return this.nativeAppIpc.getCachedBriefcases(iModelId);\n }\n\n /**\n * Open a [[Storage]]. Creates a new Storage with that name if it does not already exist.\n * @param name Should be a local filename without an extension.\n * @returns a Promise for the [[Storage]].\n */\n public static async openStorage(name: string): Promise<Storage> {\n if (this._storages.has(name))\n return this._storages.get(name)!;\n\n const storage = new Storage(await this.nativeAppIpc.storageMgrOpen(name));\n this._storages.set(storage.id, storage);\n return storage;\n }\n\n /**\n * Close a Storage and optionally delete it.\n * @param storage normally not call directly instead use Storage.close()\n * @param deleteStorage if true, delete the storage from disk after closing it.\n */\n public static async closeStorage(storage: Storage, deleteStorage: boolean = false): Promise<void> {\n if (!this._storages.has(storage.id))\n throw new Error(`Storage [Id=${storage.id}] not open`);\n\n await this.nativeAppIpc.storageMgrClose(storage.id, deleteStorage);\n this._storages.delete(storage.id);\n }\n\n /** Get the list of existing Storages on the local disk. */\n public static async getStorageNames(): Promise<string[]> {\n return NativeApp.nativeAppIpc.storageMgrNames();\n }\n}\n\n/**\n * A local disk-based cache for key value pairs for NativeApps.\n * @note This should be used only for local caching, since its not guaranteed to exist permanently.\n * @public\n */\nexport class Storage {\n constructor(public readonly id: string) { }\n\n /** get the type of a value for a key, or undefined if not present. */\n public async getValueType(key: string): Promise<\"number\" | \"string\" | \"boolean\" | \"Uint8Array\" | \"null\" | undefined> {\n return NativeApp.nativeAppIpc.storageGetValueType(this.id, key);\n }\n\n /** Get the value for a key */\n public async getData(key: string): Promise<StorageValue> {\n return NativeApp.nativeAppIpc.storageGet(this.id, key);\n }\n\n /** Set value for a key */\n public async setData(key: string, value: StorageValue): Promise<void> {\n return NativeApp.nativeAppIpc.storageSet(this.id, key, value);\n }\n\n /**\n * Return an array of all keys in this Storage.\n * @note This can be expensive, depending on the number of keys present.\n */\n public async getKeys(): Promise<string[]> {\n return NativeApp.nativeAppIpc.storageKeys(this.id);\n }\n\n /** Remove a key and its data. */\n public async removeData(key: string): Promise<void> {\n return NativeApp.nativeAppIpc.storageRemove(this.id, key);\n }\n\n /** Remove all keys and their data. */\n public async removeAll(): Promise<void> {\n return NativeApp.nativeAppIpc.storageRemoveAll(this.id);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"NativeApp.js","sourceRoot":"","sources":["../../src/NativeApp.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAkE;AAClE,oDAI4B;AAC5B,4EAAyE;AACzE,qCAAsE;AACtE,uDAAoD;AAyBpD,2CAA2C;AAC3C,MAAM,sBAAuB,SAAQ,4BAAmB;IACtD,IAAW,WAAW,KAAK,OAAO,iCAAmB,CAAC,aAAa,CAAC,CAAC,CAAC;IAC/D,iCAAiC,CAAC,MAAkC;QACzE,qBAAM,CAAC,OAAO,CAAC,+CAAsB,CAAC,SAAS,EAAE,+BAA+B,CAAC,CAAC;QAClF,SAAS,CAAC,6BAA6B,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAC7D,CAAC;CACF;AAUD;;;;GAIG;AACH,MAAa,SAAS;IACZ,MAAM,CAAC,gBAAgB,CAAkB;IAEjD,kFAAkF;IAC3E,MAAM,CAAC,YAAY,GAAG,eAAM,CAAC,YAAY,CAAqB,iCAAmB,CAAC,WAAW,CAAC,CAAC;IAC/F,MAAM,CAAC,UAAU,GAAG,eAAM,CAAC,YAAY,CAAqD,mBAAmB,CAAC,CAAC;IAEhH,MAAM,CAAC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AO,SAAS,CAAC,YAAY,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACrD,CAAC;IAED,iCAAiC;IAC1B,KAAK,CAAC,UAAU,CAAC,GAAW;QACjC,OAAO,SAAS,CAAC,YAAY,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;IAC5D,CAAC;IAED,sCAAsC;IAC/B,KAAK,CAAC,SAAS;QACpB,OAAO,SAAS,CAAC,YAAY,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1D,CAAC;CACF;AAnCD,0BAmCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module NativeApp\n */\n\nimport { BeEvent, GuidString, Logger } from \"@itwin/core-bentley\";\nimport {\n BriefcaseDownloader, BriefcaseProps, CatalogIModel, IModelVersion, InternetConnectivityStatus, IpcSocketFrontend, LocalBriefcaseProps,\n NativeAppFunctions, nativeAppIpcStrings, NativeAppNotifications, OverriddenBy,\n RemoveFunction, RequestNewBriefcaseProps, StorageValue, SyncMode,\n} from \"@itwin/core-common\";\nimport { FrontendLoggerCategory } from \"./common/FrontendLoggerCategory\";\nimport { IpcApp, IpcAppOptions, NotificationHandler } from \"./IpcApp\";\nimport { NativeAppLogger } from \"./NativeAppLogger\";\nimport { OnDownloadProgress } from \"./BriefcaseConnection\";\nimport { _callIpcChannel } from \"./common/internal/Symbols\";\n\n/** Properties for specifying the BriefcaseId for downloading. May either specify a BriefcaseId directly (preferable) or, for\n * backwards compatibility, a [SyncMode]($common). If [SyncMode.PullAndPush]($common) is supplied, a new briefcaseId will be acquired.\n * @public\n */\nexport type DownloadBriefcaseId =\n { syncMode?: SyncMode, briefcaseId?: never } |\n { briefcaseId: number, syncMode?: never };\n\n/**\n* Options to download a briefcase\n* @public\n*/\nexport type DownloadBriefcaseOptions = DownloadBriefcaseId & {\n /** the full path for the briefcase file */\n fileName?: string;\n /** Function called regularly to report progress of download. */\n progressCallback?: OnDownloadProgress;\n /** interval for calling progress function, in milliseconds */\n progressInterval?: number;\n};\n\n/** NativeApp notifications from backend */\nclass NativeAppNotifyHandler extends NotificationHandler implements NativeAppNotifications {\n public get channelName() { return nativeAppIpcStrings.notifyChannel; }\n public notifyInternetConnectivityChanged(status: InternetConnectivityStatus) {\n Logger.logInfo(FrontendLoggerCategory.NativeApp, \"Internet connectivity changed\");\n NativeApp.onInternetConnectivityChanged.raiseEvent(status);\n }\n}\n\n/**\n * Options for [[NativeApp.startup]]\n * @public\n */\nexport interface NativeAppOpts extends IpcAppOptions {\n nativeApp?: object;\n}\n\n/**\n * The frontend of a native application\n * @see [Native Applications]($docs/learning/NativeApps.md)\n * @public\n */\nexport class NativeApp {\n private static _removeAppNotify?: RemoveFunction;\n\n /** A Proxy to call one of the [NativeAppFunctions]($common) functions via IPC. */\n public static nativeAppIpc = IpcApp.makeIpcProxy<NativeAppFunctions>(nativeAppIpcStrings.channelName);\n public static catalogIpc = IpcApp.makeIpcProxy<CatalogIModel.IpcMethods, CatalogIModel.IpcChannel>(\"catalogIModel/ipc\");\n\n private static _storages = new Map<string, Storage>();\n private static _onOnline = async () => {\n await NativeApp.setConnectivity(OverriddenBy.Browser, InternetConnectivityStatus.Online);\n };\n private static _onOffline = async () => {\n await NativeApp.setConnectivity(OverriddenBy.Browser, InternetConnectivityStatus.Offline);\n };\n private static async setConnectivity(by: OverriddenBy, status: InternetConnectivityStatus) {\n await this.nativeAppIpc.overrideInternetConnectivity(by, status);\n }\n private static hookBrowserConnectivityEvents() {\n if (typeof window === \"object\" && window.ononline && window.onoffline) {\n window.addEventListener(\"online\", this._onOnline);\n window.addEventListener(\"offline\", this._onOffline);\n }\n }\n private static unhookBrowserConnectivityEvents() {\n if (typeof window === \"object\" && window.ononline && window.onoffline) {\n window.removeEventListener(\"online\", this._onOnline);\n window.removeEventListener(\"offline\", this._onOffline);\n }\n }\n /** event called when internet connectivity changes, if known */\n public static onInternetConnectivityChanged = new BeEvent<(status: InternetConnectivityStatus) => void>();\n\n /** determine whether the app currently has internet connectivity, if known */\n public static async checkInternetConnectivity(): Promise<InternetConnectivityStatus> {\n return this.nativeAppIpc.checkInternetConnectivity();\n }\n /** @internal */\n public static async overrideInternetConnectivity(status: InternetConnectivityStatus): Promise<void> {\n return this.nativeAppIpc.overrideInternetConnectivity(OverriddenBy.User, status);\n }\n private static _isValid = false;\n public static get isValid(): boolean { return this._isValid; }\n\n /**\n * This is called by either ElectronApp.startup or MobileApp.startup - it should not be called directly\n * @internal\n */\n public static async startup(ipc: IpcSocketFrontend, opts?: NativeAppOpts) {\n await IpcApp.startup(ipc, opts);\n if (this._isValid)\n return;\n this._isValid = true;\n\n this._removeAppNotify = NativeAppNotifyHandler.register(); // receives notifications from backend\n NativeApp.hookBrowserConnectivityEvents();\n\n // initialize current online state.\n if (window.navigator.onLine) {\n await this.setConnectivity(OverriddenBy.Browser, window.navigator.onLine ? InternetConnectivityStatus.Online : InternetConnectivityStatus.Offline);\n }\n }\n\n /** @internal */\n public static async shutdown() {\n this._removeAppNotify?.();\n NativeApp.unhookBrowserConnectivityEvents();\n await NativeAppLogger.flush();\n await IpcApp.shutdown();\n this._isValid = false;\n }\n\n public static async requestDownloadBriefcase(iTwinId: string, iModelId: string, downloadOptions: DownloadBriefcaseOptions,\n asOf?: IModelVersion): Promise<BriefcaseDownloader>;\n\n public static async requestDownloadBriefcase(\n iTwinId: string,\n iModelId: string,\n downloadOptions: DownloadBriefcaseOptions,\n asOf: IModelVersion = IModelVersion.latest()\n ): Promise<BriefcaseDownloader> {\n const shouldReportProgress = !!downloadOptions.progressCallback;\n\n let stopProgressEvents = () => { };\n if (shouldReportProgress) {\n const handleProgress = (_evt: Event, data: { loaded: number, total: number }) => {\n downloadOptions.progressCallback?.(data);\n };\n\n stopProgressEvents = IpcApp.addListener(`nativeApp.progress-${iModelId}`, handleProgress);\n }\n\n const briefcaseId = (undefined !== downloadOptions.briefcaseId) ? downloadOptions.briefcaseId :\n (downloadOptions.syncMode === SyncMode.PullOnly ? 0 : await this.nativeAppIpc.acquireNewBriefcaseId(iModelId));\n\n const fileName = downloadOptions.fileName ?? await this.getBriefcaseFileName({ briefcaseId, iModelId });\n const requestProps: RequestNewBriefcaseProps = { iModelId, briefcaseId, iTwinId, asOf: asOf.toJSON(), fileName };\n\n const doDownload = async (): Promise<void> => {\n try {\n await this.nativeAppIpc.downloadBriefcase(requestProps, shouldReportProgress, downloadOptions.progressInterval);\n } finally {\n stopProgressEvents();\n }\n };\n\n const requestCancel = async (): Promise<boolean> => {\n const status = await this.nativeAppIpc.requestCancelDownloadBriefcase(fileName);\n if (status)\n stopProgressEvents();\n return status;\n };\n\n return { briefcaseId, fileName, downloadPromise: doDownload(), requestCancel };\n }\n\n /** Get the full path filename for a briefcase within the briefcase cache */\n public static async getBriefcaseFileName(props: BriefcaseProps): Promise<string> {\n return this.nativeAppIpc.getBriefcaseFileName(props);\n }\n\n /** Delete an existing briefcase\n * @param fileName the briefcase fileName\n */\n public static async deleteBriefcase(fileName: string): Promise<void> {\n await this.nativeAppIpc.deleteBriefcaseFiles(fileName);\n }\n\n /** Get a list of all briefcase files held in the local briefcase cache directory */\n public static async getCachedBriefcases(iModelId?: GuidString): Promise<LocalBriefcaseProps[]> {\n return this.nativeAppIpc.getCachedBriefcases(iModelId);\n }\n\n /**\n * Open a [[Storage]]. Creates a new Storage with that name if it does not already exist.\n * @param name Should be a local filename without an extension.\n * @returns a Promise for the [[Storage]].\n */\n public static async openStorage(name: string): Promise<Storage> {\n if (this._storages.has(name))\n return this._storages.get(name)!;\n\n const storage = new Storage(await this.nativeAppIpc.storageMgrOpen(name));\n this._storages.set(storage.id, storage);\n return storage;\n }\n\n /**\n * Close a Storage and optionally delete it.\n * @param storage normally not call directly instead use Storage.close()\n * @param deleteStorage if true, delete the storage from disk after closing it.\n */\n public static async closeStorage(storage: Storage, deleteStorage: boolean = false): Promise<void> {\n if (!this._storages.has(storage.id))\n throw new Error(`Storage [Id=${storage.id}] not open`);\n\n await this.nativeAppIpc.storageMgrClose(storage.id, deleteStorage);\n this._storages.delete(storage.id);\n }\n\n /** Get the list of existing Storages on the local disk. */\n public static async getStorageNames(): Promise<string[]> {\n return NativeApp.nativeAppIpc.storageMgrNames();\n }\n}\n\n/**\n * A local disk-based cache for key value pairs for NativeApps.\n * @note This should be used only for local caching, since its not guaranteed to exist permanently.\n * @public\n */\nexport class Storage {\n constructor(public readonly id: string) { }\n\n /** get the type of a value for a key, or undefined if not present. */\n public async getValueType(key: string): Promise<\"number\" | \"string\" | \"boolean\" | \"Uint8Array\" | \"null\" | undefined> {\n return NativeApp.nativeAppIpc.storageGetValueType(this.id, key);\n }\n\n /** Get the value for a key */\n public async getData(key: string): Promise<StorageValue> {\n return NativeApp.nativeAppIpc.storageGet(this.id, key);\n }\n\n /** Set value for a key */\n public async setData(key: string, value: StorageValue): Promise<void> {\n return NativeApp.nativeAppIpc.storageSet(this.id, key, value);\n }\n\n /**\n * Return an array of all keys in this Storage.\n * @note This can be expensive, depending on the number of keys present.\n */\n public async getKeys(): Promise<string[]> {\n return NativeApp.nativeAppIpc.storageKeys(this.id);\n }\n\n /** Remove a key and its data. */\n public async removeData(key: string): Promise<void> {\n return NativeApp.nativeAppIpc.storageRemove(this.id, key);\n }\n\n /** Remove all keys and their data. */\n public async removeAll(): Promise<void> {\n return NativeApp.nativeAppIpc.storageRemoveAll(this.id);\n }\n}\n"]}
|
|
@@ -4,6 +4,7 @@ export * from "./AuxCoordSys";
|
|
|
4
4
|
export * from "./BingLocation";
|
|
5
5
|
export * from "./BriefcaseConnection";
|
|
6
6
|
export * from "./BriefcaseTxns";
|
|
7
|
+
export * from "./CatalogConnection";
|
|
7
8
|
export * from "./CategorySelectorState";
|
|
8
9
|
export * from "./ChangeFlags";
|
|
9
10
|
export * from "./CheckpointConnection";
|
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