@itwin/core-backend 4.8.0-dev.9 → 4.9.0-dev.2
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/CHANGELOG.md +45 -1
- package/lib/cjs/BackendHubAccess.d.ts +18 -16
- package/lib/cjs/BackendHubAccess.d.ts.map +1 -1
- package/lib/cjs/BackendHubAccess.js +16 -15
- package/lib/cjs/BackendHubAccess.js.map +1 -1
- package/lib/cjs/BackendLoggerCategory.js.map +1 -1
- package/lib/cjs/BisCoreSchema.js.map +1 -1
- package/lib/cjs/BlobContainerService.js.map +1 -1
- package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
- package/lib/cjs/BriefcaseManager.js +19 -11
- package/lib/cjs/BriefcaseManager.js.map +1 -1
- package/lib/cjs/Category.d.ts +0 -6
- package/lib/cjs/Category.d.ts.map +1 -1
- package/lib/cjs/Category.js +0 -6
- package/lib/cjs/Category.js.map +1 -1
- package/lib/cjs/ChangeSummaryManager.d.ts.map +1 -1
- package/lib/cjs/ChangeSummaryManager.js +13 -11
- package/lib/cjs/ChangeSummaryManager.js.map +1 -1
- package/lib/cjs/ChangedElementsDb.d.ts.map +1 -1
- package/lib/cjs/ChangedElementsDb.js +5 -3
- package/lib/cjs/ChangedElementsDb.js.map +1 -1
- package/lib/cjs/ChangedElementsManager.js.map +1 -1
- package/lib/cjs/ChangesetECAdaptor.d.ts.map +1 -1
- package/lib/cjs/ChangesetECAdaptor.js +242 -237
- package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
- package/lib/cjs/ChannelControl.d.ts +4 -26
- package/lib/cjs/ChannelControl.d.ts.map +1 -1
- package/lib/cjs/ChannelControl.js +2 -101
- package/lib/cjs/ChannelControl.js.map +1 -1
- package/lib/cjs/CheckpointManager.d.ts.map +1 -1
- package/lib/cjs/CheckpointManager.js +5 -3
- package/lib/cjs/CheckpointManager.js.map +1 -1
- package/lib/cjs/ClassRegistry.d.ts.map +1 -1
- package/lib/cjs/ClassRegistry.js +8 -7
- package/lib/cjs/ClassRegistry.js.map +1 -1
- package/lib/cjs/CloudSqlite.d.ts +1 -1
- package/lib/cjs/CloudSqlite.d.ts.map +1 -1
- package/lib/cjs/CloudSqlite.js +2 -2
- package/lib/cjs/CloudSqlite.js.map +1 -1
- package/lib/cjs/CodeService.js.map +1 -1
- package/lib/cjs/CodeSpecs.js.map +1 -1
- package/lib/cjs/ConcurrentQuery.js.map +1 -1
- package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
- package/lib/cjs/DevTools.d.ts.map +1 -1
- package/lib/cjs/DevTools.js +2 -1
- package/lib/cjs/DevTools.js.map +1 -1
- package/lib/cjs/DisplayStyle.d.ts +0 -3
- package/lib/cjs/DisplayStyle.d.ts.map +1 -1
- package/lib/cjs/DisplayStyle.js +0 -3
- package/lib/cjs/DisplayStyle.js.map +1 -1
- package/lib/cjs/ECDb.d.ts +6 -1
- package/lib/cjs/ECDb.d.ts.map +1 -1
- package/lib/cjs/ECDb.js +19 -14
- package/lib/cjs/ECDb.js.map +1 -1
- package/lib/cjs/ECSchemaXmlContext.js +2 -2
- package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
- package/lib/cjs/ECSqlStatement.d.ts +6 -3
- package/lib/cjs/ECSqlStatement.d.ts.map +1 -1
- package/lib/cjs/ECSqlStatement.js +3 -3
- package/lib/cjs/ECSqlStatement.js.map +1 -1
- package/lib/cjs/Element.d.ts +2 -59
- package/lib/cjs/Element.d.ts.map +1 -1
- package/lib/cjs/Element.js +7 -63
- package/lib/cjs/Element.js.map +1 -1
- package/lib/cjs/ElementAspect.d.ts +0 -5
- package/lib/cjs/ElementAspect.d.ts.map +1 -1
- package/lib/cjs/ElementAspect.js +4 -8
- package/lib/cjs/ElementAspect.js.map +1 -1
- package/lib/cjs/ElementGraphics.d.ts.map +1 -1
- package/lib/cjs/ElementGraphics.js +2 -1
- package/lib/cjs/ElementGraphics.js.map +1 -1
- package/lib/cjs/ElementTreeWalker.d.ts +19 -0
- package/lib/cjs/ElementTreeWalker.d.ts.map +1 -1
- package/lib/cjs/ElementTreeWalker.js +23 -9
- package/lib/cjs/ElementTreeWalker.js.map +1 -1
- package/lib/cjs/Entity.js.map +1 -1
- package/lib/cjs/EntityReferences.js.map +1 -1
- package/lib/cjs/ExportGraphics.js.map +1 -1
- package/lib/cjs/ExternalSource.js.map +1 -1
- package/lib/cjs/GeoCoordConfig.d.ts.map +1 -1
- package/lib/cjs/GeoCoordConfig.js +2 -1
- package/lib/cjs/GeoCoordConfig.js.map +1 -1
- package/lib/cjs/GeographicCRSServices.js +2 -2
- package/lib/cjs/GeographicCRSServices.js.map +1 -1
- package/lib/cjs/GeometrySummary.d.ts.map +1 -1
- package/lib/cjs/GeometrySummary.js +49 -48
- package/lib/cjs/GeometrySummary.js.map +1 -1
- package/lib/cjs/HubMock.js.map +1 -1
- package/lib/cjs/IModelCloneContext.js.map +1 -1
- package/lib/cjs/IModelDb.d.ts +24 -94
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +196 -151
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/IModelElementCloneContext.d.ts.map +1 -1
- package/lib/cjs/IModelElementCloneContext.js +5 -4
- package/lib/cjs/IModelElementCloneContext.js.map +1 -1
- package/lib/cjs/IModelHost.d.ts +5 -3
- package/lib/cjs/IModelHost.d.ts.map +1 -1
- package/lib/cjs/IModelHost.js +16 -18
- package/lib/cjs/IModelHost.js.map +1 -1
- package/lib/cjs/IModelJsFs.js.map +1 -1
- package/lib/cjs/IpcHost.d.ts.map +1 -1
- package/lib/cjs/IpcHost.js +15 -13
- package/lib/cjs/IpcHost.js.map +1 -1
- package/lib/cjs/LineStyle.js.map +1 -1
- package/lib/cjs/LocalHub.d.ts +2 -2
- package/lib/cjs/LocalHub.d.ts.map +1 -1
- package/lib/cjs/LocalHub.js +18 -18
- package/lib/cjs/LocalHub.js.map +1 -1
- package/lib/cjs/LocalhostIpcHost.js.map +1 -1
- package/lib/cjs/LockControl.d.ts +73 -0
- package/lib/cjs/LockControl.d.ts.map +1 -0
- package/lib/cjs/LockControl.js +11 -0
- package/lib/cjs/LockControl.js.map +1 -0
- package/lib/cjs/Material.d.ts +2 -5
- package/lib/cjs/Material.d.ts.map +1 -1
- package/lib/cjs/Material.js +1 -4
- package/lib/cjs/Material.js.map +1 -1
- package/lib/cjs/Model.d.ts +0 -22
- package/lib/cjs/Model.d.ts.map +1 -1
- package/lib/cjs/Model.js +5 -26
- package/lib/cjs/Model.js.map +1 -1
- package/lib/cjs/NativeAppStorage.js.map +1 -1
- package/lib/cjs/NativeHost.js.map +1 -1
- package/lib/cjs/NavigationRelationship.js.map +1 -1
- package/lib/cjs/PromiseMemoizer.js.map +1 -1
- package/lib/cjs/PropertyStore.js.map +1 -1
- package/lib/cjs/Relationship.d.ts +0 -12
- package/lib/cjs/Relationship.d.ts.map +1 -1
- package/lib/cjs/Relationship.js +5 -16
- package/lib/cjs/Relationship.js.map +1 -1
- package/lib/cjs/RpcBackend.js.map +1 -1
- package/lib/cjs/SQLiteDb.d.ts +6 -1
- package/lib/cjs/SQLiteDb.d.ts.map +1 -1
- package/lib/cjs/SQLiteDb.js +23 -16
- package/lib/cjs/SQLiteDb.js.map +1 -1
- package/lib/cjs/Schema.js.map +1 -1
- package/lib/cjs/SchemaSync.d.ts +3 -0
- package/lib/cjs/SchemaSync.d.ts.map +1 -1
- package/lib/cjs/SchemaSync.js +24 -11
- package/lib/cjs/SchemaSync.js.map +1 -1
- package/lib/cjs/SchemaUtils.js +3 -3
- package/lib/cjs/SchemaUtils.js.map +1 -1
- package/lib/cjs/SqliteChangesetReader.d.ts.map +1 -1
- package/lib/cjs/SqliteChangesetReader.js +2 -2
- package/lib/cjs/SqliteChangesetReader.js.map +1 -1
- package/lib/cjs/SqliteStatement.js +2 -2
- package/lib/cjs/SqliteStatement.js.map +1 -1
- package/lib/cjs/TextAnnotationElement.js.map +1 -1
- package/lib/cjs/TextAnnotationGeometry.js.map +1 -1
- package/lib/cjs/TextAnnotationLayout.js.map +1 -1
- package/lib/cjs/Texture.js.map +1 -1
- package/lib/cjs/TileStorage.js.map +1 -1
- package/lib/cjs/TxnManager.d.ts +2 -1
- package/lib/cjs/TxnManager.d.ts.map +1 -1
- package/lib/cjs/TxnManager.js +4 -2
- package/lib/cjs/TxnManager.js.map +1 -1
- package/lib/cjs/ViewDefinition.d.ts +1 -18
- package/lib/cjs/ViewDefinition.d.ts.map +1 -1
- package/lib/cjs/ViewDefinition.js +1 -18
- package/lib/cjs/ViewDefinition.js.map +1 -1
- package/lib/cjs/ViewStateHydrator.js.map +1 -1
- package/lib/cjs/ViewStore.d.ts.map +1 -1
- package/lib/cjs/ViewStore.js +6 -5
- package/lib/cjs/ViewStore.js.map +1 -1
- package/lib/cjs/assets/IModelChange.02.00.00.ecschema.xml +90 -90
- package/lib/cjs/assets/Settings/Schemas/Base.Schema.json +32 -32
- package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +27 -27
- package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +94 -94
- package/lib/cjs/assets/Settings/backend.setting.json5 +21 -21
- package/lib/cjs/core-backend.d.ts +2 -1
- package/lib/cjs/core-backend.d.ts.map +1 -1
- package/lib/cjs/core-backend.js +3 -5
- package/lib/cjs/core-backend.js.map +1 -1
- package/lib/cjs/domains/FunctionalElements.d.ts +0 -10
- package/lib/cjs/domains/FunctionalElements.d.ts.map +1 -1
- package/lib/cjs/domains/FunctionalElements.js +0 -10
- package/lib/cjs/domains/FunctionalElements.js.map +1 -1
- package/lib/cjs/domains/FunctionalSchema.d.ts.map +1 -1
- package/lib/cjs/domains/FunctionalSchema.js +2 -1
- package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
- package/lib/cjs/domains/GenericElements.d.ts +0 -18
- package/lib/cjs/domains/GenericElements.d.ts.map +1 -1
- package/lib/cjs/domains/GenericElements.js +0 -18
- package/lib/cjs/domains/GenericElements.js.map +1 -1
- package/lib/cjs/domains/GenericSchema.js.map +1 -1
- package/lib/cjs/internal/ChangesetConflictArgs.d.ts +24 -0
- package/lib/cjs/internal/ChangesetConflictArgs.d.ts.map +1 -0
- package/lib/cjs/internal/ChangesetConflictArgs.js +7 -0
- package/lib/cjs/internal/ChangesetConflictArgs.js.map +1 -0
- package/lib/cjs/internal/ChannelAdmin.d.ts +34 -0
- package/lib/cjs/internal/ChannelAdmin.d.ts.map +1 -0
- package/lib/cjs/internal/ChannelAdmin.js +117 -0
- package/lib/cjs/internal/ChannelAdmin.js.map +1 -0
- package/lib/cjs/internal/NativePlatform.d.ts +15 -0
- package/lib/cjs/internal/NativePlatform.d.ts.map +1 -0
- package/lib/cjs/internal/NativePlatform.js +49 -0
- package/lib/cjs/internal/NativePlatform.js.map +1 -0
- package/lib/cjs/internal/NoLocks.d.ts +6 -0
- package/lib/cjs/internal/NoLocks.d.ts.map +1 -0
- package/lib/cjs/internal/NoLocks.js +31 -0
- package/lib/cjs/internal/NoLocks.js.map +1 -0
- package/lib/cjs/{ServerBasedLocks.d.ts → internal/ServerBasedLocks.d.ts} +10 -16
- package/lib/cjs/internal/ServerBasedLocks.d.ts.map +1 -0
- package/lib/cjs/{ServerBasedLocks.js → internal/ServerBasedLocks.js} +29 -18
- package/lib/cjs/internal/ServerBasedLocks.js.map +1 -0
- package/lib/cjs/internal/Symbols.d.ts +11 -0
- package/lib/cjs/internal/Symbols.d.ts.map +1 -0
- package/lib/cjs/internal/Symbols.js +21 -0
- package/lib/cjs/internal/Symbols.js.map +1 -0
- package/lib/cjs/internal/cross-package.d.ts +4 -0
- package/lib/cjs/internal/cross-package.d.ts.map +1 -0
- package/lib/cjs/internal/cross-package.js +16 -0
- package/lib/cjs/internal/cross-package.js.map +1 -0
- package/lib/cjs/internal/workspace/SettingsImpl.d.ts +2 -2
- package/lib/cjs/internal/workspace/SettingsImpl.d.ts.map +1 -1
- package/lib/cjs/internal/workspace/SettingsImpl.js +3 -3
- package/lib/cjs/internal/workspace/SettingsImpl.js.map +1 -1
- package/lib/cjs/internal/workspace/SettingsSchemasImpl.js +2 -2
- package/lib/cjs/internal/workspace/SettingsSchemasImpl.js.map +1 -1
- package/lib/cjs/internal/workspace/WorkspaceImpl.d.ts.map +1 -1
- package/lib/cjs/internal/workspace/WorkspaceImpl.js +31 -27
- package/lib/cjs/internal/workspace/WorkspaceImpl.js.map +1 -1
- package/lib/cjs/internal/workspace/WorkspaceSqliteDb.d.ts.map +1 -1
- package/lib/cjs/internal/workspace/WorkspaceSqliteDb.js +2 -1
- package/lib/cjs/internal/workspace/WorkspaceSqliteDb.js.map +1 -1
- package/lib/cjs/rpc/multipart.js.map +1 -1
- package/lib/cjs/rpc/tracing.d.ts.map +1 -1
- package/lib/cjs/rpc/tracing.js +5 -2
- package/lib/cjs/rpc/tracing.js.map +1 -1
- package/lib/cjs/rpc/web/logging.js.map +1 -1
- package/lib/cjs/rpc/web/request.js.map +1 -1
- package/lib/cjs/rpc/web/response.js.map +1 -1
- package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts +1 -0
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts.map +1 -1
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +9 -4
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/IModelTileRpcImpl.d.ts.map +1 -1
- package/lib/cjs/rpc-impl/IModelTileRpcImpl.js +5 -3
- package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
- package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/WipRpcImpl.js.map +1 -1
- package/lib/cjs/workspace/Settings.d.ts +3 -3
- package/lib/cjs/workspace/Settings.d.ts.map +1 -1
- package/lib/cjs/workspace/Settings.js +1 -1
- package/lib/cjs/workspace/Settings.js.map +1 -1
- package/lib/cjs/workspace/SettingsSchemas.d.ts +2 -2
- package/lib/cjs/workspace/SettingsSchemas.d.ts.map +1 -1
- package/lib/cjs/workspace/SettingsSchemas.js +1 -1
- package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
- package/lib/cjs/workspace/Workspace.d.ts +4 -4
- package/lib/cjs/workspace/Workspace.d.ts.map +1 -1
- package/lib/cjs/workspace/Workspace.js +1 -1
- package/lib/cjs/workspace/Workspace.js.map +1 -1
- package/lib/cjs/workspace/WorkspaceEditor.d.ts +2 -2
- package/lib/cjs/workspace/WorkspaceEditor.d.ts.map +1 -1
- package/lib/cjs/workspace/WorkspaceEditor.js +1 -1
- package/lib/cjs/workspace/WorkspaceEditor.js.map +1 -1
- package/package.json +13 -13
- package/lib/cjs/ServerBasedLocks.d.ts.map +0 -1
- package/lib/cjs/ServerBasedLocks.js.map +0 -1
- package/lib/cjs/internal/ImplementationProhibited.d.ts +0 -44
- package/lib/cjs/internal/ImplementationProhibited.d.ts.map +0 -1
- package/lib/cjs/internal/ImplementationProhibited.js +0 -51
- package/lib/cjs/internal/ImplementationProhibited.js.map +0 -1
package/lib/cjs/Model.d.ts
CHANGED
|
@@ -47,7 +47,6 @@ export interface OnElementInModelIdArg extends OnModelIdArg {
|
|
|
47
47
|
* @public
|
|
48
48
|
*/
|
|
49
49
|
export declare class Model extends Entity {
|
|
50
|
-
/** @internal */
|
|
51
50
|
static get className(): string;
|
|
52
51
|
/** @internal */
|
|
53
52
|
static get protectedOperations(): string[];
|
|
@@ -161,7 +160,6 @@ export declare class Model extends Entity {
|
|
|
161
160
|
*/
|
|
162
161
|
export declare class GeometricModel extends Model {
|
|
163
162
|
geometryGuid?: GuidString;
|
|
164
|
-
/** @internal */
|
|
165
163
|
static get className(): string;
|
|
166
164
|
protected constructor(props: GeometricModelProps, iModel: IModelDb);
|
|
167
165
|
/** Query for the union of the extents of the elements contained by this model.
|
|
@@ -185,7 +183,6 @@ export declare abstract class GeometricModel3d extends GeometricModel {
|
|
|
185
183
|
readonly isNotSpatiallyLocated: boolean;
|
|
186
184
|
/** If true, then the elements in this GeometricModel3d are in real-world coordinates and will be in the spatial index. */
|
|
187
185
|
get isSpatiallyLocated(): boolean;
|
|
188
|
-
/** @internal */
|
|
189
186
|
static get className(): string;
|
|
190
187
|
protected constructor(props: GeometricModel3dProps, iModel: IModelDb);
|
|
191
188
|
toJSON(): GeometricModel3dProps;
|
|
@@ -196,7 +193,6 @@ export declare abstract class GeometricModel3d extends GeometricModel {
|
|
|
196
193
|
export declare abstract class GeometricModel2d extends GeometricModel {
|
|
197
194
|
/** The actual coordinates of (0,0) in modeling coordinates. An offset applied to all modeling coordinates. */
|
|
198
195
|
globalOrigin?: Point2d;
|
|
199
|
-
/** @internal */
|
|
200
196
|
static get className(): string;
|
|
201
197
|
protected constructor(props: GeometricModel2dProps, iModel: IModelDb);
|
|
202
198
|
toJSON(): GeometricModel2dProps;
|
|
@@ -205,7 +201,6 @@ export declare abstract class GeometricModel2d extends GeometricModel {
|
|
|
205
201
|
* @public
|
|
206
202
|
*/
|
|
207
203
|
export declare abstract class GraphicalModel2d extends GeometricModel2d {
|
|
208
|
-
/** @internal */
|
|
209
204
|
static get className(): string;
|
|
210
205
|
}
|
|
211
206
|
/** A container for persisting GraphicalElement3d instances.
|
|
@@ -214,14 +209,12 @@ export declare abstract class GraphicalModel2d extends GeometricModel2d {
|
|
|
214
209
|
* @public
|
|
215
210
|
*/
|
|
216
211
|
export declare abstract class GraphicalModel3d extends GeometricModel3d {
|
|
217
|
-
/** @internal */
|
|
218
212
|
static get className(): string;
|
|
219
213
|
}
|
|
220
214
|
/** A container for persisting 3d geometric elements that are spatially located.
|
|
221
215
|
* @public
|
|
222
216
|
*/
|
|
223
217
|
export declare abstract class SpatialModel extends GeometricModel3d {
|
|
224
|
-
/** @internal */
|
|
225
218
|
static get className(): string;
|
|
226
219
|
}
|
|
227
220
|
/** A container for persisting physical elements that model physical space.
|
|
@@ -229,7 +222,6 @@ export declare abstract class SpatialModel extends GeometricModel3d {
|
|
|
229
222
|
* @public
|
|
230
223
|
*/
|
|
231
224
|
export declare class PhysicalModel extends SpatialModel {
|
|
232
|
-
/** @internal */
|
|
233
225
|
static get className(): string;
|
|
234
226
|
/** Insert a PhysicalPartition and a PhysicalModel that sub-models it.
|
|
235
227
|
* @param iModelDb Insert into this iModel
|
|
@@ -246,7 +238,6 @@ export declare class PhysicalModel extends SpatialModel {
|
|
|
246
238
|
* @public
|
|
247
239
|
*/
|
|
248
240
|
export declare class SpatialLocationModel extends SpatialModel {
|
|
249
|
-
/** @internal */
|
|
250
241
|
static get className(): string;
|
|
251
242
|
/** Insert a SpatialLocationPartition and a SpatialLocationModel that sub-models it.
|
|
252
243
|
* @param iModelDb Insert into this iModel
|
|
@@ -262,14 +253,12 @@ export declare class SpatialLocationModel extends SpatialModel {
|
|
|
262
253
|
* @public
|
|
263
254
|
*/
|
|
264
255
|
export declare class DrawingModel extends GraphicalModel2d {
|
|
265
|
-
/** @internal */
|
|
266
256
|
static get className(): string;
|
|
267
257
|
}
|
|
268
258
|
/** A container for persisting section [[DrawingGraphic]]s.
|
|
269
259
|
* @public
|
|
270
260
|
*/
|
|
271
261
|
export declare class SectionDrawingModel extends DrawingModel {
|
|
272
|
-
/** @internal */
|
|
273
262
|
static get className(): string;
|
|
274
263
|
}
|
|
275
264
|
/** A container for persisting [[ViewAttachment]]s and [[DrawingGraphic]]s.
|
|
@@ -278,21 +267,18 @@ export declare class SectionDrawingModel extends DrawingModel {
|
|
|
278
267
|
* @public
|
|
279
268
|
*/
|
|
280
269
|
export declare class SheetModel extends GraphicalModel2d {
|
|
281
|
-
/** @internal */
|
|
282
270
|
static get className(): string;
|
|
283
271
|
}
|
|
284
272
|
/** A container for persisting role elements.
|
|
285
273
|
* @public
|
|
286
274
|
*/
|
|
287
275
|
export declare class RoleModel extends Model {
|
|
288
|
-
/** @internal */
|
|
289
276
|
static get className(): string;
|
|
290
277
|
}
|
|
291
278
|
/** A container for persisting information elements.
|
|
292
279
|
* @public
|
|
293
280
|
*/
|
|
294
281
|
export declare abstract class InformationModel extends Model {
|
|
295
|
-
/** @internal */
|
|
296
282
|
static get className(): string;
|
|
297
283
|
}
|
|
298
284
|
/** A container for persisting group information elements.
|
|
@@ -300,7 +286,6 @@ export declare abstract class InformationModel extends Model {
|
|
|
300
286
|
* @public
|
|
301
287
|
*/
|
|
302
288
|
export declare abstract class GroupInformationModel extends InformationModel {
|
|
303
|
-
/** @internal */
|
|
304
289
|
static get className(): string;
|
|
305
290
|
}
|
|
306
291
|
/** A container for persisting Information Record Elements
|
|
@@ -308,7 +293,6 @@ export declare abstract class GroupInformationModel extends InformationModel {
|
|
|
308
293
|
* @public
|
|
309
294
|
*/
|
|
310
295
|
export declare class InformationRecordModel extends InformationModel {
|
|
311
|
-
/** @internal */
|
|
312
296
|
static get className(): string;
|
|
313
297
|
/** Insert a InformationRecordPartition and a InformationRecordModel that sub-models it.
|
|
314
298
|
* @param iModelDb Insert into this iModel
|
|
@@ -324,7 +308,6 @@ export declare class InformationRecordModel extends InformationModel {
|
|
|
324
308
|
* @public
|
|
325
309
|
*/
|
|
326
310
|
export declare class DefinitionModel extends InformationModel {
|
|
327
|
-
/** @internal */
|
|
328
311
|
static get className(): string;
|
|
329
312
|
/** Insert a DefinitionPartition and a DefinitionModel that sub-models it.
|
|
330
313
|
* @param iModelDb Insert into this iModel
|
|
@@ -339,7 +322,6 @@ export declare class DefinitionModel extends InformationModel {
|
|
|
339
322
|
* @public
|
|
340
323
|
*/
|
|
341
324
|
export declare class RepositoryModel extends DefinitionModel {
|
|
342
|
-
/** @internal */
|
|
343
325
|
static get className(): string;
|
|
344
326
|
}
|
|
345
327
|
/** Contains a list of document elements.
|
|
@@ -347,7 +329,6 @@ export declare class RepositoryModel extends DefinitionModel {
|
|
|
347
329
|
* @public
|
|
348
330
|
*/
|
|
349
331
|
export declare class DocumentListModel extends InformationModel {
|
|
350
|
-
/** @internal */
|
|
351
332
|
static get className(): string;
|
|
352
333
|
/** Insert a DocumentPartition and a DocumentListModel that sub-models it.
|
|
353
334
|
* @param iModelDb Insert into this iModel
|
|
@@ -363,21 +344,18 @@ export declare class DocumentListModel extends InformationModel {
|
|
|
363
344
|
* @public
|
|
364
345
|
*/
|
|
365
346
|
export declare class LinkModel extends InformationModel {
|
|
366
|
-
/** @internal */
|
|
367
347
|
static get className(): string;
|
|
368
348
|
}
|
|
369
349
|
/** The singleton container for repository-specific definition elements.
|
|
370
350
|
* @public
|
|
371
351
|
*/
|
|
372
352
|
export declare class DictionaryModel extends DefinitionModel {
|
|
373
|
-
/** @internal */
|
|
374
353
|
static get className(): string;
|
|
375
354
|
}
|
|
376
355
|
/** Obtains and displays multi-resolution tiled raster organized according to the WebMercator tiling system.
|
|
377
356
|
* @public
|
|
378
357
|
*/
|
|
379
358
|
export declare class WebMercatorModel extends SpatialModel {
|
|
380
|
-
/** @internal */
|
|
381
359
|
static get className(): string;
|
|
382
360
|
}
|
|
383
361
|
//# sourceMappingURL=Model.d.ts.map
|
package/lib/cjs/Model.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Model.d.ts","sourceRoot":"","sources":["../../src/Model.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAa,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,OAAO,EAAW,MAAM,sBAAsB,CAAC;AACxD,OAAO,EACL,gBAAgB,EAAE,YAAY,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,mBAAmB,EACnF,UAAU,EAAE,cAAc,EAC7D,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"Model.d.ts","sourceRoot":"","sources":["../../src/Model.ts"],"names":[],"mappings":"AAIA;;GA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13 @@ const core_common_1 = require("@itwin/core-common");
|
|
|
15
15
|
const Element_1 = require("./Element");
|
|
16
16
|
const Entity_1 = require("./Entity");
|
|
17
17
|
const NavigationRelationship_1 = require("./NavigationRelationship");
|
|
18
|
+
const Symbols_1 = require("./internal/Symbols");
|
|
18
19
|
/** A Model is a container for persisting a collection of related elements within an iModel.
|
|
19
20
|
* See [[IModelDb.Models]] for how to query and manage the Models in an IModelDb.
|
|
20
21
|
* See [Creating models]($docs/learning/backend/CreateModels.md)
|
|
21
22
|
* @public
|
|
22
23
|
*/
|
|
23
24
|
class Model extends Entity_1.Entity {
|
|
24
|
-
/** @internal */
|
|
25
25
|
static get className() { return "Model"; }
|
|
26
26
|
/** @internal */
|
|
27
27
|
static get protectedOperations() { return ["onInsert", "onUpdate", "onDelete"]; }
|
|
@@ -45,7 +45,7 @@ class Model extends Entity_1.Entity {
|
|
|
45
45
|
*/
|
|
46
46
|
static onInsert(arg) {
|
|
47
47
|
const { props, iModel } = arg;
|
|
48
|
-
iModel.channels.
|
|
48
|
+
iModel.channels[Symbols_1._verifyChannel](props.modeledElement.id);
|
|
49
49
|
if (props.parentModel) // inserting requires shared lock on parent, if present
|
|
50
50
|
iModel.locks.checkSharedLock(props.parentModel, "parent model", "insert");
|
|
51
51
|
}
|
|
@@ -65,7 +65,7 @@ class Model extends Entity_1.Entity {
|
|
|
65
65
|
*/
|
|
66
66
|
static onUpdate(arg) {
|
|
67
67
|
const id = arg.props.id; // eslint-disable-line @typescript-eslint/no-non-null-assertion
|
|
68
|
-
arg.iModel.channels.
|
|
68
|
+
arg.iModel.channels[Symbols_1._verifyChannel](id);
|
|
69
69
|
arg.iModel.locks.checkExclusiveLock(id, "model", "update");
|
|
70
70
|
}
|
|
71
71
|
/** Called after a Model is updated.
|
|
@@ -82,7 +82,7 @@ class Model extends Entity_1.Entity {
|
|
|
82
82
|
* @beta
|
|
83
83
|
*/
|
|
84
84
|
static onDelete(arg) {
|
|
85
|
-
arg.iModel.channels.
|
|
85
|
+
arg.iModel.channels[Symbols_1._verifyChannel](arg.id);
|
|
86
86
|
arg.iModel.locks.checkExclusiveLock(arg.id, "model", "delete");
|
|
87
87
|
}
|
|
88
88
|
/** Called after a Model was deleted.
|
|
@@ -161,14 +161,13 @@ exports.Model = Model;
|
|
|
161
161
|
* @public
|
|
162
162
|
*/
|
|
163
163
|
class GeometricModel extends Model {
|
|
164
|
-
/** @internal */
|
|
165
164
|
static get className() { return "GeometricModel"; }
|
|
166
165
|
constructor(props, iModel) { super(props, iModel); }
|
|
167
166
|
/** Query for the union of the extents of the elements contained by this model.
|
|
168
167
|
* @note This function blocks the JavaScript event loop. Consider using [[queryRange]] instead.
|
|
169
168
|
*/
|
|
170
169
|
queryExtents() {
|
|
171
|
-
const extents = this.iModel.
|
|
170
|
+
const extents = this.iModel[Symbols_1._nativeDb].queryModelExtents({ id: this.id }).modelExtents;
|
|
172
171
|
return core_geometry_1.Range3d.fromJSON(extents);
|
|
173
172
|
}
|
|
174
173
|
/** Query for the union of the extents of all elements contained within this model. */
|
|
@@ -183,7 +182,6 @@ exports.GeometricModel = GeometricModel;
|
|
|
183
182
|
class GeometricModel3d extends GeometricModel {
|
|
184
183
|
/** If true, then the elements in this GeometricModel3d are in real-world coordinates and will be in the spatial index. */
|
|
185
184
|
get isSpatiallyLocated() { return !this.isNotSpatiallyLocated; }
|
|
186
|
-
/** @internal */
|
|
187
185
|
static get className() { return "GeometricModel3d"; }
|
|
188
186
|
constructor(props, iModel) {
|
|
189
187
|
super(props, iModel);
|
|
@@ -204,7 +202,6 @@ exports.GeometricModel3d = GeometricModel3d;
|
|
|
204
202
|
* @public
|
|
205
203
|
*/
|
|
206
204
|
class GeometricModel2d extends GeometricModel {
|
|
207
|
-
/** @internal */
|
|
208
205
|
static get className() { return "GeometricModel2d"; }
|
|
209
206
|
constructor(props, iModel) { super(props, iModel); }
|
|
210
207
|
toJSON() {
|
|
@@ -219,7 +216,6 @@ exports.GeometricModel2d = GeometricModel2d;
|
|
|
219
216
|
* @public
|
|
220
217
|
*/
|
|
221
218
|
class GraphicalModel2d extends GeometricModel2d {
|
|
222
|
-
/** @internal */
|
|
223
219
|
static get className() { return "GraphicalModel2d"; }
|
|
224
220
|
}
|
|
225
221
|
exports.GraphicalModel2d = GraphicalModel2d;
|
|
@@ -229,7 +225,6 @@ exports.GraphicalModel2d = GraphicalModel2d;
|
|
|
229
225
|
* @public
|
|
230
226
|
*/
|
|
231
227
|
class GraphicalModel3d extends GeometricModel3d {
|
|
232
|
-
/** @internal */
|
|
233
228
|
static get className() { return "GraphicalModel3d"; }
|
|
234
229
|
}
|
|
235
230
|
exports.GraphicalModel3d = GraphicalModel3d;
|
|
@@ -237,7 +232,6 @@ exports.GraphicalModel3d = GraphicalModel3d;
|
|
|
237
232
|
* @public
|
|
238
233
|
*/
|
|
239
234
|
class SpatialModel extends GeometricModel3d {
|
|
240
|
-
/** @internal */
|
|
241
235
|
static get className() { return "SpatialModel"; }
|
|
242
236
|
}
|
|
243
237
|
exports.SpatialModel = SpatialModel;
|
|
@@ -246,7 +240,6 @@ exports.SpatialModel = SpatialModel;
|
|
|
246
240
|
* @public
|
|
247
241
|
*/
|
|
248
242
|
class PhysicalModel extends SpatialModel {
|
|
249
|
-
/** @internal */
|
|
250
243
|
static get className() { return "PhysicalModel"; }
|
|
251
244
|
/** Insert a PhysicalPartition and a PhysicalModel that sub-models it.
|
|
252
245
|
* @param iModelDb Insert into this iModel
|
|
@@ -278,7 +271,6 @@ exports.PhysicalModel = PhysicalModel;
|
|
|
278
271
|
* @public
|
|
279
272
|
*/
|
|
280
273
|
class SpatialLocationModel extends SpatialModel {
|
|
281
|
-
/** @internal */
|
|
282
274
|
static get className() { return "SpatialLocationModel"; }
|
|
283
275
|
/** Insert a SpatialLocationPartition and a SpatialLocationModel that sub-models it.
|
|
284
276
|
* @param iModelDb Insert into this iModel
|
|
@@ -309,7 +301,6 @@ exports.SpatialLocationModel = SpatialLocationModel;
|
|
|
309
301
|
* @public
|
|
310
302
|
*/
|
|
311
303
|
class DrawingModel extends GraphicalModel2d {
|
|
312
|
-
/** @internal */
|
|
313
304
|
static get className() { return "DrawingModel"; }
|
|
314
305
|
}
|
|
315
306
|
exports.DrawingModel = DrawingModel;
|
|
@@ -317,7 +308,6 @@ exports.DrawingModel = DrawingModel;
|
|
|
317
308
|
* @public
|
|
318
309
|
*/
|
|
319
310
|
class SectionDrawingModel extends DrawingModel {
|
|
320
|
-
/** @internal */
|
|
321
311
|
static get className() { return "SectionDrawingModel"; }
|
|
322
312
|
}
|
|
323
313
|
exports.SectionDrawingModel = SectionDrawingModel;
|
|
@@ -327,7 +317,6 @@ exports.SectionDrawingModel = SectionDrawingModel;
|
|
|
327
317
|
* @public
|
|
328
318
|
*/
|
|
329
319
|
class SheetModel extends GraphicalModel2d {
|
|
330
|
-
/** @internal */
|
|
331
320
|
static get className() { return "SheetModel"; }
|
|
332
321
|
}
|
|
333
322
|
exports.SheetModel = SheetModel;
|
|
@@ -335,7 +324,6 @@ exports.SheetModel = SheetModel;
|
|
|
335
324
|
* @public
|
|
336
325
|
*/
|
|
337
326
|
class RoleModel extends Model {
|
|
338
|
-
/** @internal */
|
|
339
327
|
static get className() { return "RoleModel"; }
|
|
340
328
|
}
|
|
341
329
|
exports.RoleModel = RoleModel;
|
|
@@ -343,7 +331,6 @@ exports.RoleModel = RoleModel;
|
|
|
343
331
|
* @public
|
|
344
332
|
*/
|
|
345
333
|
class InformationModel extends Model {
|
|
346
|
-
/** @internal */
|
|
347
334
|
static get className() { return "InformationModel"; }
|
|
348
335
|
}
|
|
349
336
|
exports.InformationModel = InformationModel;
|
|
@@ -352,7 +339,6 @@ exports.InformationModel = InformationModel;
|
|
|
352
339
|
* @public
|
|
353
340
|
*/
|
|
354
341
|
class GroupInformationModel extends InformationModel {
|
|
355
|
-
/** @internal */
|
|
356
342
|
static get className() { return "GroupInformationModel"; }
|
|
357
343
|
}
|
|
358
344
|
exports.GroupInformationModel = GroupInformationModel;
|
|
@@ -361,7 +347,6 @@ exports.GroupInformationModel = GroupInformationModel;
|
|
|
361
347
|
* @public
|
|
362
348
|
*/
|
|
363
349
|
class InformationRecordModel extends InformationModel {
|
|
364
|
-
/** @internal */
|
|
365
350
|
static get className() { return "InformationRecordModel"; }
|
|
366
351
|
/** Insert a InformationRecordPartition and a InformationRecordModel that sub-models it.
|
|
367
352
|
* @param iModelDb Insert into this iModel
|
|
@@ -390,7 +375,6 @@ exports.InformationRecordModel = InformationRecordModel;
|
|
|
390
375
|
* @public
|
|
391
376
|
*/
|
|
392
377
|
class DefinitionModel extends InformationModel {
|
|
393
|
-
/** @internal */
|
|
394
378
|
static get className() { return "DefinitionModel"; }
|
|
395
379
|
/** Insert a DefinitionPartition and a DefinitionModel that sub-models it.
|
|
396
380
|
* @param iModelDb Insert into this iModel
|
|
@@ -418,7 +402,6 @@ exports.DefinitionModel = DefinitionModel;
|
|
|
418
402
|
* @public
|
|
419
403
|
*/
|
|
420
404
|
class RepositoryModel extends DefinitionModel {
|
|
421
|
-
/** @internal */
|
|
422
405
|
static get className() { return "RepositoryModel"; }
|
|
423
406
|
}
|
|
424
407
|
exports.RepositoryModel = RepositoryModel;
|
|
@@ -427,7 +410,6 @@ exports.RepositoryModel = RepositoryModel;
|
|
|
427
410
|
* @public
|
|
428
411
|
*/
|
|
429
412
|
class DocumentListModel extends InformationModel {
|
|
430
|
-
/** @internal */
|
|
431
413
|
static get className() { return "DocumentListModel"; }
|
|
432
414
|
/** Insert a DocumentPartition and a DocumentListModel that sub-models it.
|
|
433
415
|
* @param iModelDb Insert into this iModel
|
|
@@ -456,7 +438,6 @@ exports.DocumentListModel = DocumentListModel;
|
|
|
456
438
|
* @public
|
|
457
439
|
*/
|
|
458
440
|
class LinkModel extends InformationModel {
|
|
459
|
-
/** @internal */
|
|
460
441
|
static get className() { return "LinkModel"; }
|
|
461
442
|
}
|
|
462
443
|
exports.LinkModel = LinkModel;
|
|
@@ -464,7 +445,6 @@ exports.LinkModel = LinkModel;
|
|
|
464
445
|
* @public
|
|
465
446
|
*/
|
|
466
447
|
class DictionaryModel extends DefinitionModel {
|
|
467
|
-
/** @internal */
|
|
468
448
|
static get className() { return "DictionaryModel"; }
|
|
469
449
|
}
|
|
470
450
|
exports.DictionaryModel = DictionaryModel;
|
|
@@ -472,7 +452,6 @@ exports.DictionaryModel = DictionaryModel;
|
|
|
472
452
|
* @public
|
|
473
453
|
*/
|
|
474
454
|
class WebMercatorModel extends SpatialModel {
|
|
475
|
-
/** @internal */
|
|
476
455
|
static get className() { return "WebMercatorModel"; }
|
|
477
456
|
}
|
|
478
457
|
exports.WebMercatorModel = WebMercatorModel;
|
package/lib/cjs/Model.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Model.js","sourceRoot":"","sources":["../../src/Model.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,qBAAqB;AAErB,sDAAwE;AACxE,wDAAwD;AACxD,oDAG4B;AAC5B,uCAA4I;AAC5I,qCAAkC;AAElC,qEAAwE;AA0CxE;;;;GAIG;AACH,MAAa,KAAM,SAAQ,eAAM;IAC/B,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,OAAO,CAAC,CAAC,CAAC;IAClE,gBAAgB;IACT,MAAM,KAAc,mBAAmB,KAAK,OAAO,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IAQjG,YAAsB,KAAiB,EAAE,MAAgB;QACvD,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,8IAA8I;QACxL,IAAI,CAAC,SAAS,GAAG,wBAAS,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACnD,IAAI,CAAC,UAAU,GAAG,wBAAS,CAAC,MA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AC,iBAAiB;YAC/B,MAAM,EAAE,IAAI,qDAA4B,CAAC,eAAe,CAAC;YACzD,IAAI,EAAE,2BAAiB,CAAC,UAAU,CAAC,QAAQ,EAAE,eAAe,EAAE,IAAI,CAAC;SACpE,CAAC;QACF,MAAM,WAAW,GAAe,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;QAChF,OAAO,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC;YACjC,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,cAAc,EAAE,EAAE,EAAE,EAAE,WAAW,EAAE;SACpC,CAAC,CAAC;IACL,CAAC;CACF;AAvBD,8CAuBC;AAED;;;GAGG;AACH,MAAa,SAAU,SAAQ,gBAAgB;IAC7C,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,WAAW,CAAC,CAAC,CAAC;CACvE;AAHD,8BAGC;AAED;;GAEG;AACH,MAAa,eAAgB,SAAQ,eAAe;IAClD,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,iBAAiB,CAAC,CAAC,CAAC;CAC7E;AAHD,0CAGC;AAED;;GAEG;AACH,MAAa,gBAAiB,SAAQ,YAAY;IAChD,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,kBAAkB,CAAC,CAAC,CAAC;CAC9E;AAHD,4CAGC","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 Models\n */\n\n// cspell:ignore elid\n\nimport { GuidString, Id64String, JsonUtils } from \"@itwin/core-bentley\";\nimport { Point2d, Range3d } from \"@itwin/core-geometry\";\nimport {\n AxisAlignedBox3d, ElementProps, EntityReferenceSet, GeometricModel2dProps, GeometricModel3dProps, GeometricModelProps, IModel,\n InformationPartitionElementProps, ModelProps, RelatedElement,\n} from \"@itwin/core-common\";\nimport { DefinitionPartition, DocumentPartition, InformationRecordPartition, PhysicalPartition, SpatialLocationPartition } from \"./Element\";\nimport { Entity } from \"./Entity\";\nimport { IModelDb } from \"./IModelDb\";\nimport { SubjectOwnsPartitionElements } from \"./NavigationRelationship\";\n\n/** Argument for the `Model.onXxx` static methods\n * @beta\n */\nexport interface OnModelArg {\n /** The iModel for the Model affected. */\n iModel: IModelDb;\n}\n\n/** Argument for the `Model.onXxx` static methods that supply the properties of a Model to be inserted or updated.\n * @beta\n */\nexport interface OnModelPropsArg extends OnModelArg {\n /** The new properties of the Model affected. */\n props: Readonly<ModelProps>;\n}\n\n/** Argument for the `Model.onXxx` static methods that only supply the Id of the affected Model.\n * @beta\n */\nexport interface OnModelIdArg extends OnModelArg {\n /** The Id of the Model affected */\n id: Id64String;\n}\n\n/** Argument for the `Model.onXxxElement` static methods that supply the properties of an Element for a Model.\n * @beta\n */\nexport interface OnElementInModelPropsArg extends OnModelIdArg {\n /** The new properties of an Element for the affected Model */\n elementProps: Readonly<ElementProps>;\n}\n\n/** Argument for the `Model.onXxxElement` static methods that supply the Id of an Element for a Model.\n * @beta\n */\nexport interface OnElementInModelIdArg extends OnModelIdArg {\n /** The Id of the Element for the affected Model */\n elementId: Id64String;\n}\n\n/** A Model is a container for persisting a collection of related elements within an iModel.\n * See [[IModelDb.Models]] for how to query and manage the Models in an IModelDb.\n * See [Creating models]($docs/learning/backend/CreateModels.md)\n * @public\n */\nexport class Model extends Entity {\n /** @internal */\n public static override get className(): string { return \"Model\"; }\n /** @internal */\n public static override get protectedOperations() { return [\"onInsert\", \"onUpdate\", \"onDelete\"]; }\n public readonly modeledElement!: RelatedElement;\n public readonly name: string;\n public readonly parentModel!: Id64String;\n public readonly jsonProperties: { [key: string]: any };\n public isPrivate: boolean;\n public isTemplate: boolean;\n\n protected constructor(props: ModelProps, iModel: IModelDb) {\n super(props, iModel);\n this.name = props.name ? props.name : \"\"; // NB this isn't really a property of Model (it's the code.value of the modeled element), but it comes in ModelProps because it's often needed\n this.isPrivate = JsonUtils.asBool(props.isPrivate);\n this.isTemplate = JsonUtils.asBool(props.isTemplate);\n this.jsonProperties = { ...props.jsonProperties }; // make sure we have our own copy\n }\n\n public override toJSON(): ModelProps {\n const val = super.toJSON() as ModelProps;\n val.name = this.name; // for cloning\n return val;\n }\n\n /** Called before a new Model is inserted.\n * @note throw an exception to disallow the insert\n * @note If you override this method, you must call super.\n * @note `this` is the class of the Model to be inserted\n * @beta\n */\n protected static onInsert(arg: OnModelPropsArg): void {\n const { props, iModel } = arg;\n iModel.channels.verifyChannel(props.modeledElement.id);\n if (props.parentModel) // inserting requires shared lock on parent, if present\n iModel.locks.checkSharedLock(props.parentModel, \"parent model\", \"insert\");\n }\n\n /** Called after a new Model is inserted.\n * @note If you override this method, you must call super.\n * @note `this` is the class of the Model that was inserted\n * @beta\n */\n protected static onInserted(_arg: OnModelIdArg): void {\n // we don't need to tell LockControl about models being created - their ModeledElement does that\n }\n\n /** Called before a Model is updated.\n * @note throw an exception to disallow the update\n * @note If you override this method, you must call super.\n * @note `this` is the class of the Model to be updated\n * @beta\n */\n protected static onUpdate(arg: OnModelPropsArg): void {\n const id = arg.props.id!; // eslint-disable-line @typescript-eslint/no-non-null-assertion\n arg.iModel.channels.verifyChannel(id);\n arg.iModel.locks.checkExclusiveLock(id, \"model\", \"update\");\n }\n\n /** Called after a Model is updated.\n * @note If you override this method, you must call super.\n * @note `this` is the class of the Model that was updated.\n * @beta\n */\n protected static onUpdated(_arg: OnModelIdArg): void {\n }\n\n /** Called before a Model is deleted.\n * @note throw an exception to disallow the delete\n * @note If you override this method, you must call super.\n * @note `this` is the class of the Model to be deleted\n * @beta\n */\n protected static onDelete(arg: OnModelIdArg): void {\n arg.iModel.channels.verifyChannel(arg.id);\n arg.iModel.locks.checkExclusiveLock(arg.id, \"model\", \"delete\");\n }\n\n /** Called after a Model was deleted.\n * @note If you override this method, you must call super.\n * @note `this` is the class of the Model that was deleted\n * @beta\n */\n protected static onDeleted(_arg: OnModelIdArg): void { }\n\n /** Called before a prospective Element is to be inserted into an instance of a Model of this class.\n * @note throw an exception to disallow the insert\n * @note If you override this method, you must call super.\n * @note `this` is the class of the Model to hold the element\n * @beta\n */\n protected static onInsertElement(_arg: OnElementInModelPropsArg): void { }\n\n /** Called after an Element has been inserted into an instance of a Model of this class.\n * @note If you override this method, you must call super.\n * @note `this` is the class of the Model holding the element\n * @beta\n */\n protected static onInsertedElement(_arg: OnElementInModelIdArg): void { }\n\n /** Called when an Element in an instance of a Model of this class is about to be updated.\n * @note throw an exception to disallow the update\n * @note If you override this method, you must call super.\n * @note `this` is the class of the Model holding the element\n * @beta\n */\n protected static onUpdateElement(_arg: OnElementInModelPropsArg): void { }\n\n /** Called after an Element in an instance of a Model of this class has been updated.\n * @note If you override this method, you must call super.\n * @note `this` is the class of the Model holding the element\n * @beta\n */\n protected static onUpdatedElement(_arg: OnElementInModelIdArg): void { }\n\n /** Called when an Element in an instance of a Model of this class is about to be deleted.\n * @note throw an exception to disallow the delete\n * @note If you override this method, you must call super.\n * @note `this` is the class of the Model holding the element\n * @beta\n */\n protected static onDeleteElement(_arg: OnElementInModelIdArg): void { }\n\n /** Called after an Element in an instance of a Model of this class has been deleted.\n * @note If you override this method, you must call super.\n * @note `this` is the class of the Model that held the element\n * @beta\n */\n protected static onDeletedElement(_arg: OnElementInModelIdArg): void { }\n\n private getAllUserProperties(): any {\n if (!this.jsonProperties.UserProps)\n this.jsonProperties.UserProps = new Object();\n\n return this.jsonProperties.UserProps;\n }\n\n /** Get a set of JSON user properties by namespace */\n public getUserProperties(namespace: string) { return this.getAllUserProperties()[namespace]; }\n\n /** Change a set of user JSON properties of this Element by namespace. */\n public setUserProperties(nameSpace: string, value: any) { this.getAllUserProperties()[nameSpace] = value; }\n\n /** Remove a set of JSON user properties, specified by namespace, from this Element */\n public removeUserProperties(nameSpace: string) { delete this.getAllUserProperties()[nameSpace]; }\n\n public getJsonProperty(name: string): any { return this.jsonProperties[name]; }\n public setJsonProperty(name: string, value: any) { this.jsonProperties[name] = value; }\n\n /** Insert this Model in the iModel */\n public insert() { return this.id = this.iModel.models.insertModel(this.toJSON()); }\n /** Update this Model in the iModel. */\n public update() { this.iModel.models.updateModel(this.toJSON()); }\n /** Delete this Model from the iModel. */\n public delete() { this.iModel.models.deleteModel(this.id); }\n\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\n super.collectReferenceIds(referenceIds);\n if (this.parentModel)\n referenceIds.addModel(this.parentModel);\n referenceIds.addElement(this.modeledElement.id);\n }\n}\n\n/** A container for persisting geometric elements.\n * @public\n */\nexport class GeometricModel extends Model {\n public geometryGuid?: GuidString; // Initialized by the Entity constructor\n\n /** @internal */\n public static override get className(): string { return \"GeometricModel\"; }\n\n protected constructor(props: GeometricModelProps, iModel: IModelDb) { super(props, iModel); }\n\n /** Query for the union of the extents of the elements contained by this model.\n * @note This function blocks the JavaScript event loop. Consider using [[queryRange]] instead.\n */\n public queryExtents(): AxisAlignedBox3d {\n const extents = this.iModel.nativeDb.queryModelExtents({ id: this.id }).modelExtents;\n return Range3d.fromJSON(extents);\n }\n\n /** Query for the union of the extents of all elements contained within this model. */\n public async queryRange(): Promise<AxisAlignedBox3d> {\n return this.iModel.models.queryRange(this.id);\n }\n}\n\n/** A container for persisting 3d geometric elements.\n * @public\n */\nexport abstract class GeometricModel3d extends GeometricModel {\n /** If true, then the elements in this GeometricModel3d are expected to be in an XY plane.\n * @note The associated ECProperty was added to the BisCore schema in version 1.0.8\n */\n public readonly isPlanProjection: boolean;\n /** If true, then the elements in this GeometricModel3d are not in real-world coordinates and will not be in the spatial index.\n * @note The associated ECProperty was added to the BisCore schema in version 1.0.8\n */\n public readonly isNotSpatiallyLocated: boolean;\n /** If true, then the elements in this GeometricModel3d are in real-world coordinates and will be in the spatial index. */\n public get isSpatiallyLocated(): boolean { return !this.isNotSpatiallyLocated; }\n\n /** @internal */\n public static override get className(): string { return \"GeometricModel3d\"; }\n\n protected constructor(props: GeometricModel3dProps, iModel: IModelDb) {\n super(props, iModel);\n this.isNotSpatiallyLocated = JsonUtils.asBool(props.isNotSpatiallyLocated);\n this.isPlanProjection = JsonUtils.asBool(props.isPlanProjection);\n }\n\n public override toJSON(): GeometricModel3dProps {\n const val = super.toJSON() as GeometricModel3dProps;\n if (this.isNotSpatiallyLocated)\n val.isNotSpatiallyLocated = true;\n\n if (this.isPlanProjection)\n val.isPlanProjection = true;\n\n return val;\n }\n}\n\n/** A container for persisting 2d geometric elements.\n * @public\n */\nexport abstract class GeometricModel2d extends GeometricModel {\n /** The actual coordinates of (0,0) in modeling coordinates. An offset applied to all modeling coordinates. */\n public globalOrigin?: Point2d; // Initialized by the Entity constructor\n /** @internal */\n public static override get className(): string { return \"GeometricModel2d\"; }\n\n protected constructor(props: GeometricModel2dProps, iModel: IModelDb) { super(props, iModel); }\n\n public override toJSON(): GeometricModel2dProps {\n const val = super.toJSON() as GeometricModel2dProps;\n if (undefined !== this.globalOrigin)\n val.globalOrigin = Point2d.fromJSON(this.globalOrigin);\n\n return val;\n }\n}\n\n/** A container for persisting 2d graphical elements.\n * @public\n */\nexport abstract class GraphicalModel2d extends GeometricModel2d {\n /** @internal */\n public static override get className(): string { return \"GraphicalModel2d\"; }\n}\n\n/** A container for persisting GraphicalElement3d instances.\n * @note The associated ECClass was added to the BisCore schema in version 1.0.8\n * @see [[GraphicalPartition3d]]\n * @public\n */\nexport abstract class GraphicalModel3d extends GeometricModel3d {\n /** @internal */\n public static override get className(): string { return \"GraphicalModel3d\"; }\n}\n\n/** A container for persisting 3d geometric elements that are spatially located.\n * @public\n */\nexport abstract class SpatialModel extends GeometricModel3d {\n /** @internal */\n public static override get className(): string { return \"SpatialModel\"; }\n}\n\n/** A container for persisting physical elements that model physical space.\n * @see [[PhysicalPartition]]\n * @public\n */\nexport class PhysicalModel extends SpatialModel {\n /** @internal */\n public static override get className(): string { return \"PhysicalModel\"; }\n /** Insert a PhysicalPartition and a PhysicalModel that sub-models it.\n * @param iModelDb Insert into this iModel\n * @param parentSubjectId The PhysicalPartition will be inserted as a child of this Subject element.\n * @param name The name of the PhysicalPartition that the new PhysicalModel will sub-model.\n * @param isPlanProjection Optional value (default is false) that indicates if the contents of this model are expected to be in an XY plane.\n * @returns The Id of the newly inserted PhysicalPartition and PhysicalModel (same value).\n * @throws [[IModelError]] if there is an insert problem.\n */\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string, isPlanProjection?: boolean): Id64String {\n const partitionProps: InformationPartitionElementProps = {\n classFullName: PhysicalPartition.classFullName,\n model: IModel.repositoryModelId,\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\n code: PhysicalPartition.createCode(iModelDb, parentSubjectId, name),\n };\n const partitionId = iModelDb.elements.insertElement(partitionProps);\n const modelProps: GeometricModel3dProps = {\n classFullName: this.classFullName,\n modeledElement: { id: partitionId },\n isPlanProjection,\n };\n return iModelDb.models.insertModel(modelProps);\n }\n}\n\n/** A container for persisting spatial location elements.\n * @see [[SpatialLocationPartition]]\n * @public\n */\nexport class SpatialLocationModel extends SpatialModel {\n /** @internal */\n public static override get className(): string { return \"SpatialLocationModel\"; }\n /** Insert a SpatialLocationPartition and a SpatialLocationModel that sub-models it.\n * @param iModelDb Insert into this iModel\n * @param parentSubjectId The SpatialLocationPartition will be inserted as a child of this Subject element.\n * @param name The name of the SpatialLocationPartition that the new SpatialLocationModel will sub-model.\n * @param isPlanProjection Optional value (default is false) that indicates if the contents of this model are expected to be in an XY plane.\n * @returns The Id of the newly inserted SpatialLocationPartition and SpatialLocationModel (same value).\n * @throws [[IModelError]] if there is an insert problem.\n */\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string, isPlanProjection?: boolean): Id64String {\n const partitionProps: InformationPartitionElementProps = {\n classFullName: SpatialLocationPartition.classFullName,\n model: IModel.repositoryModelId,\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\n code: SpatialLocationPartition.createCode(iModelDb, parentSubjectId, name),\n };\n const partitionId = iModelDb.elements.insertElement(partitionProps);\n const modelProps: GeometricModel3dProps = {\n classFullName: this.classFullName,\n modeledElement: { id: partitionId },\n isPlanProjection,\n };\n return iModelDb.models.insertModel(modelProps);\n }\n}\n\n/** A 2d model that holds [[DrawingGraphic]]s. DrawingModels may be dimensional or non-dimensional.\n * @public\n */\nexport class DrawingModel extends GraphicalModel2d {\n /** @internal */\n public static override get className(): string { return \"DrawingModel\"; }\n}\n\n/** A container for persisting section [[DrawingGraphic]]s.\n * @public\n */\nexport class SectionDrawingModel extends DrawingModel {\n /** @internal */\n public static override get className(): string { return \"SectionDrawingModel\"; }\n}\n\n/** A container for persisting [[ViewAttachment]]s and [[DrawingGraphic]]s.\n * A SheetModel is a digital representation of a *sheet of paper*. SheetModels are 2d models in bounded paper coordinates.\n * SheetModels may contain annotation Elements as well as references to 2d or 3d Views.\n * @public\n */\nexport class SheetModel extends GraphicalModel2d {\n /** @internal */\n public static override get className(): string { return \"SheetModel\"; }\n}\n\n/** A container for persisting role elements.\n * @public\n */\nexport class RoleModel extends Model {\n /** @internal */\n public static override get className(): string { return \"RoleModel\"; }\n}\n\n/** A container for persisting information elements.\n * @public\n */\nexport abstract class InformationModel extends Model {\n /** @internal */\n public static override get className(): string { return \"InformationModel\"; }\n}\n\n/** A container for persisting group information elements.\n * @see [[GroupInformationPartition]]\n * @public\n */\nexport abstract class GroupInformationModel extends InformationModel {\n /** @internal */\n public static override get className(): string { return \"GroupInformationModel\"; }\n}\n\n/** A container for persisting Information Record Elements\n * @see [[InformationRecordPartition]]\n * @public\n */\nexport class InformationRecordModel extends InformationModel {\n /** @internal */\n public static override get className(): string { return \"InformationRecordModel\"; }\n\n /** Insert a InformationRecordPartition and a InformationRecordModel that sub-models it.\n * @param iModelDb Insert into this iModel\n * @param parentSubjectId The InformationRecordPartition will be inserted as a child of this Subject element.\n * @param name The name of the InformationRecordPartition that the new InformationRecordModel will sub-model.\n * @returns The Id of the newly inserted InformationRecordModel.\n * @throws [[IModelError]] if there is an insert problem.\n */\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string): Id64String {\n const partitionProps: InformationPartitionElementProps = {\n classFullName: InformationRecordPartition.classFullName,\n model: IModel.repositoryModelId,\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\n code: InformationRecordPartition.createCode(iModelDb, parentSubjectId, name),\n };\n const partitionId = iModelDb.elements.insertElement(partitionProps);\n return iModelDb.models.insertModel({\n classFullName: this.classFullName,\n modeledElement: { id: partitionId },\n });\n }\n}\n\n/** A container for persisting definition elements.\n * @see [[DefinitionPartition]]\n * @public\n */\nexport class DefinitionModel extends InformationModel {\n /** @internal */\n public static override get className(): string { return \"DefinitionModel\"; }\n\n /** Insert a DefinitionPartition and a DefinitionModel that sub-models it.\n * @param iModelDb Insert into this iModel\n * @param parentSubjectId The DefinitionPartition will be inserted as a child of this Subject element.\n * @param name The name of the DefinitionPartition that the new DefinitionModel will sub-model.\n * @returns The Id of the newly inserted DefinitionModel.\n * @throws [[IModelError]] if there is an insert problem.\n */\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string): Id64String {\n const partitionProps: InformationPartitionElementProps = {\n classFullName: DefinitionPartition.classFullName,\n model: IModel.repositoryModelId,\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\n code: DefinitionPartition.createCode(iModelDb, parentSubjectId, name),\n };\n const partitionId = iModelDb.elements.insertElement(partitionProps);\n return iModelDb.models.insertModel({\n classFullName: this.classFullName,\n modeledElement: { id: partitionId },\n });\n }\n}\n\n/** The singleton container of repository-related information elements.\n * @public\n */\nexport class RepositoryModel extends DefinitionModel {\n /** @internal */\n public static override get className(): string { return \"RepositoryModel\"; }\n}\n\n/** Contains a list of document elements.\n * @see [[DocumentPartition]]\n * @public\n */\nexport class DocumentListModel extends InformationModel {\n /** @internal */\n public static override get className(): string { return \"DocumentListModel\"; }\n /** Insert a DocumentPartition and a DocumentListModel that sub-models it.\n * @param iModelDb Insert into this iModel\n * @param parentSubjectId The DocumentPartition will be inserted as a child of this Subject element.\n * @param name The name of the DocumentPartition that the new DocumentListModel will sub-model.\n * @returns The Id of the newly inserted DocumentPartition and DocumentListModel (same value)\n * @throws [[IModelError]] if there is an insert problem.\n */\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string): Id64String {\n const partitionProps: InformationPartitionElementProps = {\n classFullName: DocumentPartition.classFullName,\n model: IModel.repositoryModelId,\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\n code: DocumentPartition.createCode(iModelDb, parentSubjectId, name),\n };\n const partitionId: Id64String = iModelDb.elements.insertElement(partitionProps);\n return iModelDb.models.insertModel({\n classFullName: this.classFullName,\n modeledElement: { id: partitionId },\n });\n }\n}\n\n/** A container for persisting link elements.\n * @see [[LinkPartition]]\n * @public\n */\nexport class LinkModel extends InformationModel {\n /** @internal */\n public static override get className(): string { return \"LinkModel\"; }\n}\n\n/** The singleton container for repository-specific definition elements.\n * @public\n */\nexport class DictionaryModel extends DefinitionModel {\n /** @internal */\n public static override get className(): string { return \"DictionaryModel\"; }\n}\n\n/** Obtains and displays multi-resolution tiled raster organized according to the WebMercator tiling system.\n * @public\n */\nexport class WebMercatorModel extends SpatialModel {\n /** @internal */\n public static override get className(): string { return \"WebMercatorModel\"; }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Model.js","sourceRoot":"","sources":["../../src/Model.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,qBAAqB;AAErB,sDAAwE;AACxE,wDAAwD;AACxD,oDAG4B;AAC5B,uCAA4I;AAC5I,qCAAkC;AAElC,qEAAwE;AACxE,gDAA+D;AA0C/D;;;;GAIG;AACH,MAAa,KAAM,SAAQ,eAAM;IACxB,MAAM,KAAc,SAAS,KAAa,OAAO,OAAO,CAAC,CAAC,CAAC;IAClE,gBAAgB;IACT,MAAM,KAAc,mBAAmB,KAAK,OAAO,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IAQjG,YAAsB,KAAiB,EAA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eAA2B,EAAE,IAAY;QAChF,MAAM,cAAc,GAAqC;YACvD,aAAa,EAAE,2BAAiB,CAAC,aAAa;YAC9C,KAAK,EAAE,oBAAM,CAAC,iBAAiB;YAC/B,MAAM,EAAE,IAAI,qDAA4B,CAAC,eAAe,CAAC;YACzD,IAAI,EAAE,2BAAiB,CAAC,UAAU,CAAC,QAAQ,EAAE,eAAe,EAAE,IAAI,CAAC;SACpE,CAAC;QACF,MAAM,WAAW,GAAe,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;QAChF,OAAO,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC;YACjC,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,cAAc,EAAE,EAAE,EAAE,EAAE,WAAW,EAAE;SACpC,CAAC,CAAC;IACL,CAAC;CACF;AAtBD,8CAsBC;AAED;;;GAGG;AACH,MAAa,SAAU,SAAQ,gBAAgB;IACtC,MAAM,KAAc,SAAS,KAAa,OAAO,WAAW,CAAC,CAAC,CAAC;CACvE;AAFD,8BAEC;AAED;;GAEG;AACH,MAAa,eAAgB,SAAQ,eAAe;IAC3C,MAAM,KAAc,SAAS,KAAa,OAAO,iBAAiB,CAAC,CAAC,CAAC;CAC7E;AAFD,0CAEC;AAED;;GAEG;AACH,MAAa,gBAAiB,SAAQ,YAAY;IACzC,MAAM,KAAc,SAAS,KAAa,OAAO,kBAAkB,CAAC,CAAC,CAAC;CAC9E;AAFD,4CAEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Models\r\n */\r\n\r\n// cspell:ignore elid\r\n\r\nimport { GuidString, Id64String, JsonUtils } from \"@itwin/core-bentley\";\r\nimport { Point2d, Range3d } from \"@itwin/core-geometry\";\r\nimport {\r\n AxisAlignedBox3d, ElementProps, EntityReferenceSet, GeometricModel2dProps, GeometricModel3dProps, GeometricModelProps, IModel,\r\n InformationPartitionElementProps, ModelProps, RelatedElement,\r\n} from \"@itwin/core-common\";\r\nimport { DefinitionPartition, DocumentPartition, InformationRecordPartition, PhysicalPartition, SpatialLocationPartition } from \"./Element\";\r\nimport { Entity } from \"./Entity\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { SubjectOwnsPartitionElements } from \"./NavigationRelationship\";\r\nimport { _nativeDb, _verifyChannel } from \"./internal/Symbols\";\r\n\r\n/** Argument for the `Model.onXxx` static methods\r\n * @beta\r\n */\r\nexport interface OnModelArg {\r\n /** The iModel for the Model affected. */\r\n iModel: IModelDb;\r\n}\r\n\r\n/** Argument for the `Model.onXxx` static methods that supply the properties of a Model to be inserted or updated.\r\n * @beta\r\n */\r\nexport interface OnModelPropsArg extends OnModelArg {\r\n /** The new properties of the Model affected. */\r\n props: Readonly<ModelProps>;\r\n}\r\n\r\n/** Argument for the `Model.onXxx` static methods that only supply the Id of the affected Model.\r\n * @beta\r\n */\r\nexport interface OnModelIdArg extends OnModelArg {\r\n /** The Id of the Model affected */\r\n id: Id64String;\r\n}\r\n\r\n/** Argument for the `Model.onXxxElement` static methods that supply the properties of an Element for a Model.\r\n * @beta\r\n */\r\nexport interface OnElementInModelPropsArg extends OnModelIdArg {\r\n /** The new properties of an Element for the affected Model */\r\n elementProps: Readonly<ElementProps>;\r\n}\r\n\r\n/** Argument for the `Model.onXxxElement` static methods that supply the Id of an Element for a Model.\r\n * @beta\r\n */\r\nexport interface OnElementInModelIdArg extends OnModelIdArg {\r\n /** The Id of the Element for the affected Model */\r\n elementId: Id64String;\r\n}\r\n\r\n/** A Model is a container for persisting a collection of related elements within an iModel.\r\n * See [[IModelDb.Models]] for how to query and manage the Models in an IModelDb.\r\n * See [Creating models]($docs/learning/backend/CreateModels.md)\r\n * @public\r\n */\r\nexport class Model extends Entity {\r\n public static override get className(): string { return \"Model\"; }\r\n /** @internal */\r\n public static override get protectedOperations() { return [\"onInsert\", \"onUpdate\", \"onDelete\"]; }\r\n public readonly modeledElement!: RelatedElement;\r\n public readonly name: string;\r\n public readonly parentModel!: Id64String;\r\n public readonly jsonProperties: { [key: string]: any };\r\n public isPrivate: boolean;\r\n public isTemplate: boolean;\r\n\r\n protected constructor(props: ModelProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.name = props.name ? props.name : \"\"; // NB this isn't really a property of Model (it's the code.value of the modeled element), but it comes in ModelProps because it's often needed\r\n this.isPrivate = JsonUtils.asBool(props.isPrivate);\r\n this.isTemplate = JsonUtils.asBool(props.isTemplate);\r\n this.jsonProperties = { ...props.jsonProperties }; // make sure we have our own copy\r\n }\r\n\r\n public override toJSON(): ModelProps {\r\n const val = super.toJSON() as ModelProps;\r\n val.name = this.name; // for cloning\r\n return val;\r\n }\r\n\r\n /** Called before a new Model is inserted.\r\n * @note throw an exception to disallow the insert\r\n * @note If you override this method, you must call super.\r\n * @note `this` is the class of the Model to be inserted\r\n * @beta\r\n */\r\n protected static onInsert(arg: OnModelPropsArg): void {\r\n const { props, iModel } = arg;\r\n iModel.channels[_verifyChannel](props.modeledElement.id);\r\n if (props.parentModel) // inserting requires shared lock on parent, if present\r\n iModel.locks.checkSharedLock(props.parentModel, \"parent model\", \"insert\");\r\n }\r\n\r\n /** Called after a new Model is inserted.\r\n * @note If you override this method, you must call super.\r\n * @note `this` is the class of the Model that was inserted\r\n * @beta\r\n */\r\n protected static onInserted(_arg: OnModelIdArg): void {\r\n // we don't need to tell LockControl about models being created - their ModeledElement does that\r\n }\r\n\r\n /** Called before a Model is updated.\r\n * @note throw an exception to disallow the update\r\n * @note If you override this method, you must call super.\r\n * @note `this` is the class of the Model to be updated\r\n * @beta\r\n */\r\n protected static onUpdate(arg: OnModelPropsArg): void {\r\n const id = arg.props.id!; // eslint-disable-line @typescript-eslint/no-non-null-assertion\r\n arg.iModel.channels[_verifyChannel](id);\r\n arg.iModel.locks.checkExclusiveLock(id, \"model\", \"update\");\r\n }\r\n\r\n /** Called after a Model is updated.\r\n * @note If you override this method, you must call super.\r\n * @note `this` is the class of the Model that was updated.\r\n * @beta\r\n */\r\n protected static onUpdated(_arg: OnModelIdArg): void {\r\n }\r\n\r\n /** Called before a Model is deleted.\r\n * @note throw an exception to disallow the delete\r\n * @note If you override this method, you must call super.\r\n * @note `this` is the class of the Model to be deleted\r\n * @beta\r\n */\r\n protected static onDelete(arg: OnModelIdArg): void {\r\n arg.iModel.channels[_verifyChannel](arg.id);\r\n arg.iModel.locks.checkExclusiveLock(arg.id, \"model\", \"delete\");\r\n }\r\n\r\n /** Called after a Model was deleted.\r\n * @note If you override this method, you must call super.\r\n * @note `this` is the class of the Model that was deleted\r\n * @beta\r\n */\r\n protected static onDeleted(_arg: OnModelIdArg): void { }\r\n\r\n /** Called before a prospective Element is to be inserted into an instance of a Model of this class.\r\n * @note throw an exception to disallow the insert\r\n * @note If you override this method, you must call super.\r\n * @note `this` is the class of the Model to hold the element\r\n * @beta\r\n */\r\n protected static onInsertElement(_arg: OnElementInModelPropsArg): void { }\r\n\r\n /** Called after an Element has been inserted into an instance of a Model of this class.\r\n * @note If you override this method, you must call super.\r\n * @note `this` is the class of the Model holding the element\r\n * @beta\r\n */\r\n protected static onInsertedElement(_arg: OnElementInModelIdArg): void { }\r\n\r\n /** Called when an Element in an instance of a Model of this class is about to be updated.\r\n * @note throw an exception to disallow the update\r\n * @note If you override this method, you must call super.\r\n * @note `this` is the class of the Model holding the element\r\n * @beta\r\n */\r\n protected static onUpdateElement(_arg: OnElementInModelPropsArg): void { }\r\n\r\n /** Called after an Element in an instance of a Model of this class has been updated.\r\n * @note If you override this method, you must call super.\r\n * @note `this` is the class of the Model holding the element\r\n * @beta\r\n */\r\n protected static onUpdatedElement(_arg: OnElementInModelIdArg): void { }\r\n\r\n /** Called when an Element in an instance of a Model of this class is about to be deleted.\r\n * @note throw an exception to disallow the delete\r\n * @note If you override this method, you must call super.\r\n * @note `this` is the class of the Model holding the element\r\n * @beta\r\n */\r\n protected static onDeleteElement(_arg: OnElementInModelIdArg): void { }\r\n\r\n /** Called after an Element in an instance of a Model of this class has been deleted.\r\n * @note If you override this method, you must call super.\r\n * @note `this` is the class of the Model that held the element\r\n * @beta\r\n */\r\n protected static onDeletedElement(_arg: OnElementInModelIdArg): void { }\r\n\r\n private getAllUserProperties(): any {\r\n if (!this.jsonProperties.UserProps)\r\n this.jsonProperties.UserProps = new Object();\r\n\r\n return this.jsonProperties.UserProps;\r\n }\r\n\r\n /** Get a set of JSON user properties by namespace */\r\n public getUserProperties(namespace: string) { return this.getAllUserProperties()[namespace]; }\r\n\r\n /** Change a set of user JSON properties of this Element by namespace. */\r\n public setUserProperties(nameSpace: string, value: any) { this.getAllUserProperties()[nameSpace] = value; }\r\n\r\n /** Remove a set of JSON user properties, specified by namespace, from this Element */\r\n public removeUserProperties(nameSpace: string) { delete this.getAllUserProperties()[nameSpace]; }\r\n\r\n public getJsonProperty(name: string): any { return this.jsonProperties[name]; }\r\n public setJsonProperty(name: string, value: any) { this.jsonProperties[name] = value; }\r\n\r\n /** Insert this Model in the iModel */\r\n public insert() { return this.id = this.iModel.models.insertModel(this.toJSON()); }\r\n /** Update this Model in the iModel. */\r\n public update() { this.iModel.models.updateModel(this.toJSON()); }\r\n /** Delete this Model from the iModel. */\r\n public delete() { this.iModel.models.deleteModel(this.id); }\r\n\r\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\r\n super.collectReferenceIds(referenceIds);\r\n if (this.parentModel)\r\n referenceIds.addModel(this.parentModel);\r\n referenceIds.addElement(this.modeledElement.id);\r\n }\r\n}\r\n\r\n/** A container for persisting geometric elements.\r\n * @public\r\n */\r\nexport class GeometricModel extends Model {\r\n public geometryGuid?: GuidString; // Initialized by the Entity constructor\r\n\r\n public static override get className(): string { return \"GeometricModel\"; }\r\n\r\n protected constructor(props: GeometricModelProps, iModel: IModelDb) { super(props, iModel); }\r\n\r\n /** Query for the union of the extents of the elements contained by this model.\r\n * @note This function blocks the JavaScript event loop. Consider using [[queryRange]] instead.\r\n */\r\n public queryExtents(): AxisAlignedBox3d {\r\n const extents = this.iModel[_nativeDb].queryModelExtents({ id: this.id }).modelExtents;\r\n return Range3d.fromJSON(extents);\r\n }\r\n\r\n /** Query for the union of the extents of all elements contained within this model. */\r\n public async queryRange(): Promise<AxisAlignedBox3d> {\r\n return this.iModel.models.queryRange(this.id);\r\n }\r\n}\r\n\r\n/** A container for persisting 3d geometric elements.\r\n * @public\r\n */\r\nexport abstract class GeometricModel3d extends GeometricModel {\r\n /** If true, then the elements in this GeometricModel3d are expected to be in an XY plane.\r\n * @note The associated ECProperty was added to the BisCore schema in version 1.0.8\r\n */\r\n public readonly isPlanProjection: boolean;\r\n /** If true, then the elements in this GeometricModel3d are not in real-world coordinates and will not be in the spatial index.\r\n * @note The associated ECProperty was added to the BisCore schema in version 1.0.8\r\n */\r\n public readonly isNotSpatiallyLocated: boolean;\r\n /** If true, then the elements in this GeometricModel3d are in real-world coordinates and will be in the spatial index. */\r\n public get isSpatiallyLocated(): boolean { return !this.isNotSpatiallyLocated; }\r\n\r\n public static override get className(): string { return \"GeometricModel3d\"; }\r\n\r\n protected constructor(props: GeometricModel3dProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.isNotSpatiallyLocated = JsonUtils.asBool(props.isNotSpatiallyLocated);\r\n this.isPlanProjection = JsonUtils.asBool(props.isPlanProjection);\r\n }\r\n\r\n public override toJSON(): GeometricModel3dProps {\r\n const val = super.toJSON() as GeometricModel3dProps;\r\n if (this.isNotSpatiallyLocated)\r\n val.isNotSpatiallyLocated = true;\r\n\r\n if (this.isPlanProjection)\r\n val.isPlanProjection = true;\r\n\r\n return val;\r\n }\r\n}\r\n\r\n/** A container for persisting 2d geometric elements.\r\n * @public\r\n */\r\nexport abstract class GeometricModel2d extends GeometricModel {\r\n /** The actual coordinates of (0,0) in modeling coordinates. An offset applied to all modeling coordinates. */\r\n public globalOrigin?: Point2d; // Initialized by the Entity constructor\r\n public static override get className(): string { return \"GeometricModel2d\"; }\r\n\r\n protected constructor(props: GeometricModel2dProps, iModel: IModelDb) { super(props, iModel); }\r\n\r\n public override toJSON(): GeometricModel2dProps {\r\n const val = super.toJSON() as GeometricModel2dProps;\r\n if (undefined !== this.globalOrigin)\r\n val.globalOrigin = Point2d.fromJSON(this.globalOrigin);\r\n\r\n return val;\r\n }\r\n}\r\n\r\n/** A container for persisting 2d graphical elements.\r\n * @public\r\n */\r\nexport abstract class GraphicalModel2d extends GeometricModel2d {\r\n public static override get className(): string { return \"GraphicalModel2d\"; }\r\n}\r\n\r\n/** A container for persisting GraphicalElement3d instances.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.8\r\n * @see [[GraphicalPartition3d]]\r\n * @public\r\n */\r\nexport abstract class GraphicalModel3d extends GeometricModel3d {\r\n public static override get className(): string { return \"GraphicalModel3d\"; }\r\n}\r\n\r\n/** A container for persisting 3d geometric elements that are spatially located.\r\n * @public\r\n */\r\nexport abstract class SpatialModel extends GeometricModel3d {\r\n public static override get className(): string { return \"SpatialModel\"; }\r\n}\r\n\r\n/** A container for persisting physical elements that model physical space.\r\n * @see [[PhysicalPartition]]\r\n * @public\r\n */\r\nexport class PhysicalModel extends SpatialModel {\r\n public static override get className(): string { return \"PhysicalModel\"; }\r\n /** Insert a PhysicalPartition and a PhysicalModel that sub-models it.\r\n * @param iModelDb Insert into this iModel\r\n * @param parentSubjectId The PhysicalPartition will be inserted as a child of this Subject element.\r\n * @param name The name of the PhysicalPartition that the new PhysicalModel will sub-model.\r\n * @param isPlanProjection Optional value (default is false) that indicates if the contents of this model are expected to be in an XY plane.\r\n * @returns The Id of the newly inserted PhysicalPartition and PhysicalModel (same value).\r\n * @throws [[IModelError]] if there is an insert problem.\r\n */\r\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string, isPlanProjection?: boolean): Id64String {\r\n const partitionProps: InformationPartitionElementProps = {\r\n classFullName: PhysicalPartition.classFullName,\r\n model: IModel.repositoryModelId,\r\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\r\n code: PhysicalPartition.createCode(iModelDb, parentSubjectId, name),\r\n };\r\n const partitionId = iModelDb.elements.insertElement(partitionProps);\r\n const modelProps: GeometricModel3dProps = {\r\n classFullName: this.classFullName,\r\n modeledElement: { id: partitionId },\r\n isPlanProjection,\r\n };\r\n return iModelDb.models.insertModel(modelProps);\r\n }\r\n}\r\n\r\n/** A container for persisting spatial location elements.\r\n * @see [[SpatialLocationPartition]]\r\n * @public\r\n */\r\nexport class SpatialLocationModel extends SpatialModel {\r\n public static override get className(): string { return \"SpatialLocationModel\"; }\r\n /** Insert a SpatialLocationPartition and a SpatialLocationModel that sub-models it.\r\n * @param iModelDb Insert into this iModel\r\n * @param parentSubjectId The SpatialLocationPartition will be inserted as a child of this Subject element.\r\n * @param name The name of the SpatialLocationPartition that the new SpatialLocationModel will sub-model.\r\n * @param isPlanProjection Optional value (default is false) that indicates if the contents of this model are expected to be in an XY plane.\r\n * @returns The Id of the newly inserted SpatialLocationPartition and SpatialLocationModel (same value).\r\n * @throws [[IModelError]] if there is an insert problem.\r\n */\r\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string, isPlanProjection?: boolean): Id64String {\r\n const partitionProps: InformationPartitionElementProps = {\r\n classFullName: SpatialLocationPartition.classFullName,\r\n model: IModel.repositoryModelId,\r\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\r\n code: SpatialLocationPartition.createCode(iModelDb, parentSubjectId, name),\r\n };\r\n const partitionId = iModelDb.elements.insertElement(partitionProps);\r\n const modelProps: GeometricModel3dProps = {\r\n classFullName: this.classFullName,\r\n modeledElement: { id: partitionId },\r\n isPlanProjection,\r\n };\r\n return iModelDb.models.insertModel(modelProps);\r\n }\r\n}\r\n\r\n/** A 2d model that holds [[DrawingGraphic]]s. DrawingModels may be dimensional or non-dimensional.\r\n * @public\r\n */\r\nexport class DrawingModel extends GraphicalModel2d {\r\n public static override get className(): string { return \"DrawingModel\"; }\r\n}\r\n\r\n/** A container for persisting section [[DrawingGraphic]]s.\r\n * @public\r\n */\r\nexport class SectionDrawingModel extends DrawingModel {\r\n public static override get className(): string { return \"SectionDrawingModel\"; }\r\n}\r\n\r\n/** A container for persisting [[ViewAttachment]]s and [[DrawingGraphic]]s.\r\n * A SheetModel is a digital representation of a *sheet of paper*. SheetModels are 2d models in bounded paper coordinates.\r\n * SheetModels may contain annotation Elements as well as references to 2d or 3d Views.\r\n * @public\r\n */\r\nexport class SheetModel extends GraphicalModel2d {\r\n public static override get className(): string { return \"SheetModel\"; }\r\n}\r\n\r\n/** A container for persisting role elements.\r\n * @public\r\n */\r\nexport class RoleModel extends Model {\r\n public static override get className(): string { return \"RoleModel\"; }\r\n}\r\n\r\n/** A container for persisting information elements.\r\n * @public\r\n */\r\nexport abstract class InformationModel extends Model {\r\n public static override get className(): string { return \"InformationModel\"; }\r\n}\r\n\r\n/** A container for persisting group information elements.\r\n * @see [[GroupInformationPartition]]\r\n * @public\r\n */\r\nexport abstract class GroupInformationModel extends InformationModel {\r\n public static override get className(): string { return \"GroupInformationModel\"; }\r\n}\r\n\r\n/** A container for persisting Information Record Elements\r\n * @see [[InformationRecordPartition]]\r\n * @public\r\n */\r\nexport class InformationRecordModel extends InformationModel {\r\n public static override get className(): string { return \"InformationRecordModel\"; }\r\n\r\n /** Insert a InformationRecordPartition and a InformationRecordModel that sub-models it.\r\n * @param iModelDb Insert into this iModel\r\n * @param parentSubjectId The InformationRecordPartition will be inserted as a child of this Subject element.\r\n * @param name The name of the InformationRecordPartition that the new InformationRecordModel will sub-model.\r\n * @returns The Id of the newly inserted InformationRecordModel.\r\n * @throws [[IModelError]] if there is an insert problem.\r\n */\r\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string): Id64String {\r\n const partitionProps: InformationPartitionElementProps = {\r\n classFullName: InformationRecordPartition.classFullName,\r\n model: IModel.repositoryModelId,\r\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\r\n code: InformationRecordPartition.createCode(iModelDb, parentSubjectId, name),\r\n };\r\n const partitionId = iModelDb.elements.insertElement(partitionProps);\r\n return iModelDb.models.insertModel({\r\n classFullName: this.classFullName,\r\n modeledElement: { id: partitionId },\r\n });\r\n }\r\n}\r\n\r\n/** A container for persisting definition elements.\r\n * @see [[DefinitionPartition]]\r\n * @public\r\n */\r\nexport class DefinitionModel extends InformationModel {\r\n public static override get className(): string { return \"DefinitionModel\"; }\r\n\r\n /** Insert a DefinitionPartition and a DefinitionModel that sub-models it.\r\n * @param iModelDb Insert into this iModel\r\n * @param parentSubjectId The DefinitionPartition will be inserted as a child of this Subject element.\r\n * @param name The name of the DefinitionPartition that the new DefinitionModel will sub-model.\r\n * @returns The Id of the newly inserted DefinitionModel.\r\n * @throws [[IModelError]] if there is an insert problem.\r\n */\r\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string): Id64String {\r\n const partitionProps: InformationPartitionElementProps = {\r\n classFullName: DefinitionPartition.classFullName,\r\n model: IModel.repositoryModelId,\r\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\r\n code: DefinitionPartition.createCode(iModelDb, parentSubjectId, name),\r\n };\r\n const partitionId = iModelDb.elements.insertElement(partitionProps);\r\n return iModelDb.models.insertModel({\r\n classFullName: this.classFullName,\r\n modeledElement: { id: partitionId },\r\n });\r\n }\r\n}\r\n\r\n/** The singleton container of repository-related information elements.\r\n * @public\r\n */\r\nexport class RepositoryModel extends DefinitionModel {\r\n public static override get className(): string { return \"RepositoryModel\"; }\r\n}\r\n\r\n/** Contains a list of document elements.\r\n * @see [[DocumentPartition]]\r\n * @public\r\n */\r\nexport class DocumentListModel extends InformationModel {\r\n public static override get className(): string { return \"DocumentListModel\"; }\r\n /** Insert a DocumentPartition and a DocumentListModel that sub-models it.\r\n * @param iModelDb Insert into this iModel\r\n * @param parentSubjectId The DocumentPartition will be inserted as a child of this Subject element.\r\n * @param name The name of the DocumentPartition that the new DocumentListModel will sub-model.\r\n * @returns The Id of the newly inserted DocumentPartition and DocumentListModel (same value)\r\n * @throws [[IModelError]] if there is an insert problem.\r\n */\r\n public static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string): Id64String {\r\n const partitionProps: InformationPartitionElementProps = {\r\n classFullName: DocumentPartition.classFullName,\r\n model: IModel.repositoryModelId,\r\n parent: new SubjectOwnsPartitionElements(parentSubjectId),\r\n code: DocumentPartition.createCode(iModelDb, parentSubjectId, name),\r\n };\r\n const partitionId: Id64String = iModelDb.elements.insertElement(partitionProps);\r\n return iModelDb.models.insertModel({\r\n classFullName: this.classFullName,\r\n modeledElement: { id: partitionId },\r\n });\r\n }\r\n}\r\n\r\n/** A container for persisting link elements.\r\n * @see [[LinkPartition]]\r\n * @public\r\n */\r\nexport class LinkModel extends InformationModel {\r\n public static override get className(): string { return \"LinkModel\"; }\r\n}\r\n\r\n/** The singleton container for repository-specific definition elements.\r\n * @public\r\n */\r\nexport class DictionaryModel extends DefinitionModel {\r\n public static override get className(): string { return \"DictionaryModel\"; }\r\n}\r\n\r\n/** Obtains and displays multi-resolution tiled raster organized according to the WebMercator tiling system.\r\n * @public\r\n */\r\nexport class WebMercatorModel extends SpatialModel {\r\n public static override get className(): string { return \"WebMercatorModel\"; }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeAppStorage.js","sourceRoot":"","sources":["../../src/NativeAppStorage.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,yCAA2C;AAC3C,sDAA6D;AAC7D,oDAA+D;AAC/D,iCAA4C;AAC5C,6CAA0C;AAC1C,6CAA0C;AAC1C,6CAA0C;AAE1C,qBAAqB;AAErB;;;GAGG;AACH,MAAa,gBAAgB;IAI3B,YAA4B,KAAW,EAAkB,EAAU;QAAvC,UAAK,GAAL,KAAK,CAAM;QAAkB,OAAE,GAAF,EAAE,CAAQ;IAAI,CAAC;IAExE,8BAA8B;IACvB,OAAO,CAAC,GAAW,EAAE,KAAmB;QAC7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B,CAAC;AAChD,sBAAK,GAAY,KAAK,CAAC","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 { join, relative } from \"node:path\";\nimport { DbResult, IModelStatus } from \"@itwin/core-bentley\";\nimport { IModelError, StorageValue } from \"@itwin/core-common\";\nimport { ECDb, ECDbOpenMode } from \"./ECDb\";\nimport { IModelHost } from \"./IModelHost\";\nimport { IModelJsFs } from \"./IModelJsFs\";\nimport { NativeHost } from \"./NativeHost\";\n\n// cspell:ignore ecdb\n\n/**\n * A local file stored in the [[NativeHost.appSettingsCacheDir]] for storing key/value pairs.\n * @public\n */\nexport class NativeAppStorage {\n private static readonly _ext = \".settings-db\";\n private static _storages = new Map<string, NativeAppStorage>();\n private static _init: boolean = false;\n private constructor(private _ecdb: ECDb, public readonly id: string) { }\n\n /** Set the value for a key */\n public setData(key: string, value: StorageValue): void {\n const rc = this._ecdb.withPreparedSqliteStatement(\"INSERT INTO app_setting(key,type,val)VALUES(?,?,?) ON CONFLICT(key) DO UPDATE SET type=excluded.type,val=excluded.val\", (stmt) => {\n let valType = (value === undefined || value === null) ? \"null\" : typeof value;\n if (valType === \"object\" && (value instanceof Uint8Array))\n valType = \"Uint8Array\";\n\n switch (valType) {\n case \"null\":\n case \"number\":\n case \"string\":\n case \"boolean\":\n case \"Uint8Array\":\n break;\n default:\n throw new IModelError(DbResult.BE_SQLITE_ERROR, `Unsupported type ${valType} for value for key='${key}`);\n }\n\n stmt.bindValue(1, key);\n stmt.bindValue(2, valType);\n stmt.bindValue(3, value);\n return stmt.step();\n });\n if (rc !== DbResult.BE_SQLITE_DONE)\n throw new IModelError(rc, \"SQLite error\");\n\n this._ecdb.saveChanges();\n }\n\n /** Get the value for a key from this Storage. If key is not present or is null, return undefined. */\n public getData(key: string): StorageValue {\n return this._ecdb.withPreparedSqliteStatement(\"SELECT type,val FROM app_setting WHERE key=?\", (stmt) => {\n stmt.bindValue(1, key);\n if (DbResult.BE_SQLITE_ROW !== stmt.step())\n return undefined;\n const valType = stmt.getValueString(0);\n switch (valType) {\n case \"number\":\n return stmt.getValueDouble(1);\n case \"string\":\n return stmt.getValueString(1);\n case \"boolean\":\n return Boolean(stmt.getValueInteger(1));\n case \"Uint8Array\":\n return stmt.getValueBlob(1);\n case \"null\":\n return undefined;\n }\n throw new IModelError(DbResult.BE_SQLITE_ERROR, `Unsupported type in cache ${valType}`);\n });\n }\n\n /** return the type of the value for a key, or undefined if not present. */\n public getValueType(key: string): \"number\" | \"string\" | \"boolean\" | \"Uint8Array\" | \"null\" | undefined {\n return this._ecdb.withSqliteStatement(\"SELECT type FROM app_setting WHERE key=?\", (stmt) => {\n stmt.bindValue(1, key);\n return stmt.step() === DbResult.BE_SQLITE_ROW ? stmt.getValueString(0) as any : undefined;\n });\n }\n\n /** return `true` if the key is present, but has a null value. */\n public hasNullValue(key: string): boolean {\n return this.getValueType(key) === \"null\";\n }\n\n /** Get the value for a key as a string. If it is not present, or not of type string, return undefined */\n public getString(key: string): string | undefined {\n const val = this.getData(key);\n return typeof val === \"string\" ? val : undefined;\n }\n\n /** Get the value for a key as a number. If it is not present, or not of type number, return undefined */\n public getNumber(key: string): number | undefined {\n const val = this.getData(key);\n return typeof val === \"number\" ? val : undefined;\n }\n\n /** Get the value for a key as a boolean. If it is not present, or not of type boolean, return undefined */\n public getBoolean(key: string): boolean | undefined {\n const val = this.getData(key);\n return typeof val === \"boolean\" ? val : undefined;\n }\n\n /** Get the value for a key as a Uint8Array. If it is not present, or not of type Uint8Array, return undefined */\n public getUint8Array(key: string): Uint8Array | undefined {\n const val = this.getData(key);\n return val instanceof Uint8Array ? val : undefined;\n }\n\n /** Get all key names in this Storage */\n public getKeys(): string[] {\n const keys = new Array<string>();\n this._ecdb.withPreparedSqliteStatement(\"SELECT key FROM app_setting\", (stmt) => {\n while (DbResult.BE_SQLITE_ROW === stmt.step()) {\n keys.push(stmt.getValueString(0));\n }\n });\n return keys;\n }\n\n /** Remove a key/value pair from this Storage */\n public removeData(key: string) {\n const rc = this._ecdb.withPreparedSqliteStatement(\"DELETE FROM app_setting WHERE key=?\", (stmt) => {\n stmt.bindValue(1, key);\n return stmt.step();\n });\n if (rc !== DbResult.BE_SQLITE_DONE) {\n throw new IModelError(rc, \"SQLite error\");\n }\n }\n\n /** Remove all key/value pairs */\n public removeAll() {\n const rc = this._ecdb.withPreparedSqliteStatement(\"DELETE FROM app_setting\", (stmt) => {\n return stmt.step();\n });\n if (rc !== DbResult.BE_SQLITE_DONE) {\n throw new IModelError(rc, \"SQLite error\");\n }\n }\n\n /** Close this Storage. */\n public close(deleteFile: boolean = false) {\n const storageFile = join(NativeHost.appSettingsCacheDir, this.id);\n this._ecdb.saveChanges();\n this._ecdb.closeDb();\n (this._ecdb as any) = undefined;\n if (deleteFile)\n IModelJsFs.removeSync(storageFile);\n NativeAppStorage._storages.delete(this.id);\n }\n\n private static init(ecdb: ECDb): DbResult {\n return ecdb.withPreparedSqliteStatement(\"CREATE TABLE app_setting(key PRIMARY KEY,type,val);\", (stmt) => {\n return stmt.step();\n });\n }\n\n /** find and open storage by its name. */\n public static find(name: string): NativeAppStorage {\n const storage = this._storages.get(name);\n if (undefined === storage)\n throw new IModelError(IModelStatus.FileNotFound, `Storage ${name} not open`);\n return storage;\n }\n\n /** Close all opened Storages.\n * @internal\n */\n public static closeAll() {\n this._storages.forEach((value) => value.close());\n this._storages.clear();\n }\n\n /** @internal */\n public static getStorageNames(): string[] {\n return IModelJsFs.readdirSync(NativeHost.appSettingsCacheDir).filter((name) => name.endsWith(this._ext));\n }\n\n /** Open or find a Storage by name. */\n public static open(name: string): NativeAppStorage {\n if (!this._init) {\n IModelHost.onBeforeShutdown.addOnce(() => this.closeAll());\n this._init = true;\n }\n if (name.includes(\"\\x00\"))\n throw new Error(\"Storage name contains illegal characters\");\n const fileName = name + this._ext;\n if (!IModelJsFs.existsSync(NativeHost.appSettingsCacheDir))\n IModelJsFs.recursiveMkDirSync(NativeHost.appSettingsCacheDir);\n\n const storageFile = join(NativeHost.appSettingsCacheDir, fileName);\n if (relative(NativeHost.appSettingsCacheDir, storageFile).startsWith(\"..\"))\n throw new Error(\"Storage name should not be a path\");\n\n try {\n return this.find(fileName); // see if it's already open\n } catch (err) {\n const ecdb = new ECDb();\n if (IModelJsFs.existsSync(storageFile)) {\n ecdb.openDb(storageFile, ECDbOpenMode.ReadWrite);\n } else {\n ecdb.createDb(storageFile);\n const rc = this.init(ecdb);\n if (rc !== DbResult.BE_SQLITE_DONE)\n throw new IModelError(rc, \"SQLite error\");\n ecdb.saveChanges();\n }\n const storage = new NativeAppStorage(ecdb, fileName);\n this._storages.set(fileName, storage);\n return storage;\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"NativeAppStorage.js","sourceRoot":"","sources":["../../src/NativeAppStorage.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,yCAA2C;AAC3C,sDAA6D;AAC7D,oDAA+D;AAC/D,iCAA4C;AAC5C,6CAA0C;AAC1C,6CAA0C;AAC1C,6CAA0C;AAE1C,qBAAqB;AAErB;;;GAGG;AACH,MAAa,gBAAgB;IAI3B,YAA4B,KAAW,EAAkB,EAAU;QAAvC,UAAK,GAAL,KAAK,CAAM;QAAkB,OAAE,GAAF,EAAE,CAAQ;IAAI,CAAC;IAExE,8BAA8B;IACvB,OAAO,CAAC,GAAW,EAAE,KAAmB;QAC7C,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,2BAA2B,CAAC,uHAAuH,EAAE,CAAC,IAAI,EAAE,EAAE;YAClL,IAAI,OAAO,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC;YAC9E,IAAI,OAAO,KAA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UAAU,CAAC,IAAI,CAAC;YACxE,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;QAEvD,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,2BAA2B;QACzD,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,IAAI,GAAG,IAAI,WAAI,EAAE,CAAC;YACxB,IAAI,uBAAU,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;gBACvC,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,mBAAY,CAAC,SAAS,CAAC,CAAC;YACnD,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;gBAC3B,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC3B,IAAI,EAAE,KAAK,uBAAQ,CAAC,cAAc;oBAChC,MAAM,IAAI,yBAAW,CAAC,EAAE,EAAE,cAAc,CAAC,CAAC;gBAC5C,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,CAAC;YACD,MAAM,OAAO,GAAG,IAAI,gBAAgB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;YACrD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YACtC,OAAO,OAAO,CAAC;QACjB,CAAC;IACH,CAAC;;AAtMH,4CAuMC;AAtMyB,qBAAI,GAAG,cAAc,CAAC;AAC/B,0BAAS,GAAG,IAAI,GAAG,EAA4B,CAAC;AAChD,sBAAK,GAAY,KAAK,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module NativeApp\r\n */\r\n\r\nimport { join, relative } from \"node:path\";\r\nimport { DbResult, IModelStatus } from \"@itwin/core-bentley\";\r\nimport { IModelError, StorageValue } from \"@itwin/core-common\";\r\nimport { ECDb, ECDbOpenMode } from \"./ECDb\";\r\nimport { IModelHost } from \"./IModelHost\";\r\nimport { IModelJsFs } from \"./IModelJsFs\";\r\nimport { NativeHost } from \"./NativeHost\";\r\n\r\n// cspell:ignore ecdb\r\n\r\n/**\r\n * A local file stored in the [[NativeHost.appSettingsCacheDir]] for storing key/value pairs.\r\n * @public\r\n */\r\nexport class NativeAppStorage {\r\n private static readonly _ext = \".settings-db\";\r\n private static _storages = new Map<string, NativeAppStorage>();\r\n private static _init: boolean = false;\r\n private constructor(private _ecdb: ECDb, public readonly id: string) { }\r\n\r\n /** Set the value for a key */\r\n public setData(key: string, value: StorageValue): void {\r\n const rc = this._ecdb.withPreparedSqliteStatement(\"INSERT INTO app_setting(key,type,val)VALUES(?,?,?) ON CONFLICT(key) DO UPDATE SET type=excluded.type,val=excluded.val\", (stmt) => {\r\n let valType = (value === undefined || value === null) ? \"null\" : typeof value;\r\n if (valType === \"object\" && (value instanceof Uint8Array))\r\n valType = \"Uint8Array\";\r\n\r\n switch (valType) {\r\n case \"null\":\r\n case \"number\":\r\n case \"string\":\r\n case \"boolean\":\r\n case \"Uint8Array\":\r\n break;\r\n default:\r\n throw new IModelError(DbResult.BE_SQLITE_ERROR, `Unsupported type ${valType} for value for key='${key}`);\r\n }\r\n\r\n stmt.bindValue(1, key);\r\n stmt.bindValue(2, valType);\r\n stmt.bindValue(3, value);\r\n return stmt.step();\r\n });\r\n if (rc !== DbResult.BE_SQLITE_DONE)\r\n throw new IModelError(rc, \"SQLite error\");\r\n\r\n this._ecdb.saveChanges();\r\n }\r\n\r\n /** Get the value for a key from this Storage. If key is not present or is null, return undefined. */\r\n public getData(key: string): StorageValue {\r\n return this._ecdb.withPreparedSqliteStatement(\"SELECT type,val FROM app_setting WHERE key=?\", (stmt) => {\r\n stmt.bindValue(1, key);\r\n if (DbResult.BE_SQLITE_ROW !== stmt.step())\r\n return undefined;\r\n const valType = stmt.getValueString(0);\r\n switch (valType) {\r\n case \"number\":\r\n return stmt.getValueDouble(1);\r\n case \"string\":\r\n return stmt.getValueString(1);\r\n case \"boolean\":\r\n return Boolean(stmt.getValueInteger(1));\r\n case \"Uint8Array\":\r\n return stmt.getValueBlob(1);\r\n case \"null\":\r\n return undefined;\r\n }\r\n throw new IModelError(DbResult.BE_SQLITE_ERROR, `Unsupported type in cache ${valType}`);\r\n });\r\n }\r\n\r\n /** return the type of the value for a key, or undefined if not present. */\r\n public getValueType(key: string): \"number\" | \"string\" | \"boolean\" | \"Uint8Array\" | \"null\" | undefined {\r\n return this._ecdb.withSqliteStatement(\"SELECT type FROM app_setting WHERE key=?\", (stmt) => {\r\n stmt.bindValue(1, key);\r\n return stmt.step() === DbResult.BE_SQLITE_ROW ? stmt.getValueString(0) as any : undefined;\r\n });\r\n }\r\n\r\n /** return `true` if the key is present, but has a null value. */\r\n public hasNullValue(key: string): boolean {\r\n return this.getValueType(key) === \"null\";\r\n }\r\n\r\n /** Get the value for a key as a string. If it is not present, or not of type string, return undefined */\r\n public getString(key: string): string | undefined {\r\n const val = this.getData(key);\r\n return typeof val === \"string\" ? val : undefined;\r\n }\r\n\r\n /** Get the value for a key as a number. If it is not present, or not of type number, return undefined */\r\n public getNumber(key: string): number | undefined {\r\n const val = this.getData(key);\r\n return typeof val === \"number\" ? val : undefined;\r\n }\r\n\r\n /** Get the value for a key as a boolean. If it is not present, or not of type boolean, return undefined */\r\n public getBoolean(key: string): boolean | undefined {\r\n const val = this.getData(key);\r\n return typeof val === \"boolean\" ? val : undefined;\r\n }\r\n\r\n /** Get the value for a key as a Uint8Array. If it is not present, or not of type Uint8Array, return undefined */\r\n public getUint8Array(key: string): Uint8Array | undefined {\r\n const val = this.getData(key);\r\n return val instanceof Uint8Array ? val : undefined;\r\n }\r\n\r\n /** Get all key names in this Storage */\r\n public getKeys(): string[] {\r\n const keys = new Array<string>();\r\n this._ecdb.withPreparedSqliteStatement(\"SELECT key FROM app_setting\", (stmt) => {\r\n while (DbResult.BE_SQLITE_ROW === stmt.step()) {\r\n keys.push(stmt.getValueString(0));\r\n }\r\n });\r\n return keys;\r\n }\r\n\r\n /** Remove a key/value pair from this Storage */\r\n public removeData(key: string) {\r\n const rc = this._ecdb.withPreparedSqliteStatement(\"DELETE FROM app_setting WHERE key=?\", (stmt) => {\r\n stmt.bindValue(1, key);\r\n return stmt.step();\r\n });\r\n if (rc !== DbResult.BE_SQLITE_DONE) {\r\n throw new IModelError(rc, \"SQLite error\");\r\n }\r\n }\r\n\r\n /** Remove all key/value pairs */\r\n public removeAll() {\r\n const rc = this._ecdb.withPreparedSqliteStatement(\"DELETE FROM app_setting\", (stmt) => {\r\n return stmt.step();\r\n });\r\n if (rc !== DbResult.BE_SQLITE_DONE) {\r\n throw new IModelError(rc, \"SQLite error\");\r\n }\r\n }\r\n\r\n /** Close this Storage. */\r\n public close(deleteFile: boolean = false) {\r\n const storageFile = join(NativeHost.appSettingsCacheDir, this.id);\r\n this._ecdb.saveChanges();\r\n this._ecdb.closeDb();\r\n (this._ecdb as any) = undefined;\r\n if (deleteFile)\r\n IModelJsFs.removeSync(storageFile);\r\n NativeAppStorage._storages.delete(this.id);\r\n }\r\n\r\n private static init(ecdb: ECDb): DbResult {\r\n return ecdb.withPreparedSqliteStatement(\"CREATE TABLE app_setting(key PRIMARY KEY,type,val);\", (stmt) => {\r\n return stmt.step();\r\n });\r\n }\r\n\r\n /** find and open storage by its name. */\r\n public static find(name: string): NativeAppStorage {\r\n const storage = this._storages.get(name);\r\n if (undefined === storage)\r\n throw new IModelError(IModelStatus.FileNotFound, `Storage ${name} not open`);\r\n return storage;\r\n }\r\n\r\n /** Close all opened Storages.\r\n * @internal\r\n */\r\n public static closeAll() {\r\n this._storages.forEach((value) => value.close());\r\n this._storages.clear();\r\n }\r\n\r\n /** @internal */\r\n public static getStorageNames(): string[] {\r\n return IModelJsFs.readdirSync(NativeHost.appSettingsCacheDir).filter((name) => name.endsWith(this._ext));\r\n }\r\n\r\n /** Open or find a Storage by name. */\r\n public static open(name: string): NativeAppStorage {\r\n if (!this._init) {\r\n IModelHost.onBeforeShutdown.addOnce(() => this.closeAll());\r\n this._init = true;\r\n }\r\n if (name.includes(\"\\x00\"))\r\n throw new Error(\"Storage name contains illegal characters\");\r\n const fileName = name + this._ext;\r\n if (!IModelJsFs.existsSync(NativeHost.appSettingsCacheDir))\r\n IModelJsFs.recursiveMkDirSync(NativeHost.appSettingsCacheDir);\r\n\r\n const storageFile = join(NativeHost.appSettingsCacheDir, fileName);\r\n if (relative(NativeHost.appSettingsCacheDir, storageFile).startsWith(\"..\"))\r\n throw new Error(\"Storage name should not be a path\");\r\n\r\n try {\r\n return this.find(fileName); // see if it's already open\r\n } catch (err) {\r\n const ecdb = new ECDb();\r\n if (IModelJsFs.existsSync(storageFile)) {\r\n ecdb.openDb(storageFile, ECDbOpenMode.ReadWrite);\r\n } else {\r\n ecdb.createDb(storageFile);\r\n const rc = this.init(ecdb);\r\n if (rc !== DbResult.BE_SQLITE_DONE)\r\n throw new IModelError(rc, \"SQLite error\");\r\n ecdb.saveChanges();\r\n }\r\n const storage = new NativeAppStorage(ecdb, fileName);\r\n this._storages.set(fileName, storage);\r\n return storage;\r\n }\r\n }\r\n}\r\n"]}
|