@itwin/core-backend 4.0.0-dev.1 → 4.0.0-dev.100
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 +68 -1
- package/lib/cjs/BackendHubAccess.d.ts +226 -224
- package/lib/cjs/BackendHubAccess.d.ts.map +1 -1
- package/lib/cjs/BackendHubAccess.js +41 -41
- package/lib/cjs/BackendHubAccess.js.map +1 -1
- package/lib/cjs/BackendLoggerCategory.d.ts +90 -91
- package/lib/cjs/BackendLoggerCategory.d.ts.map +1 -1
- package/lib/cjs/BackendLoggerCategory.js +98 -99
- package/lib/cjs/BackendLoggerCategory.js.map +1 -1
- package/lib/cjs/BisCoreSchema.d.ts +21 -21
- package/lib/cjs/BisCoreSchema.js +60 -60
- package/lib/cjs/BlobContainerService.d.ts +120 -0
- package/lib/cjs/BlobContainerService.d.ts.map +1 -0
- package/lib/cjs/BlobContainerService.js +18 -0
- package/lib/cjs/BlobContainerService.js.map +1 -0
- package/lib/cjs/BriefcaseManager.d.ts +184 -170
- package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
- package/lib/cjs/BriefcaseManager.js +421 -414
- package/lib/cjs/BriefcaseManager.js.map +1 -1
- package/lib/cjs/Category.d.ts +153 -153
- package/lib/cjs/Category.js +243 -243
- package/lib/cjs/Category.js.map +1 -1
- package/lib/cjs/ChangeSummaryManager.d.ts +187 -187
- package/lib/cjs/ChangeSummaryManager.js +444 -445
- package/lib/cjs/ChangeSummaryManager.js.map +1 -1
- package/lib/cjs/ChangedElementsDb.d.ts +99 -99
- package/lib/cjs/ChangedElementsDb.js +165 -165
- package/lib/cjs/ChangedElementsManager.d.ts +39 -39
- package/lib/cjs/ChangedElementsManager.js +88 -88
- package/lib/cjs/ChannelControl.d.ts +70 -0
- package/lib/cjs/ChannelControl.d.ts.map +1 -0
- package/lib/cjs/ChannelControl.js +89 -0
- package/lib/cjs/ChannelControl.js.map +1 -0
- package/lib/cjs/CheckpointManager.d.ts +121 -121
- package/lib/cjs/CheckpointManager.d.ts.map +1 -1
- package/lib/cjs/CheckpointManager.js +351 -349
- package/lib/cjs/CheckpointManager.js.map +1 -1
- package/lib/cjs/ClassRegistry.d.ts +79 -79
- package/lib/cjs/ClassRegistry.js +249 -245
- package/lib/cjs/ClassRegistry.js.map +1 -1
- package/lib/cjs/CloudSqlite.d.ts +572 -350
- package/lib/cjs/CloudSqlite.d.ts.map +1 -1
- package/lib/cjs/CloudSqlite.js +374 -153
- package/lib/cjs/CloudSqlite.js.map +1 -1
- package/lib/cjs/CodeService.d.ts +399 -396
- package/lib/cjs/CodeService.d.ts.map +1 -1
- package/lib/cjs/CodeService.js +63 -63
- package/lib/cjs/CodeService.js.map +1 -1
- package/lib/cjs/CodeSpecs.d.ts +58 -55
- package/lib/cjs/CodeSpecs.d.ts.map +1 -1
- package/lib/cjs/CodeSpecs.js +154 -124
- package/lib/cjs/CodeSpecs.js.map +1 -1
- package/lib/cjs/ConcurrentQuery.d.ts +13 -13
- package/lib/cjs/ConcurrentQuery.d.ts.map +1 -1
- package/lib/cjs/ConcurrentQuery.js +36 -36
- package/lib/cjs/CustomViewState3dCreator.d.ts +21 -21
- package/lib/cjs/CustomViewState3dCreator.d.ts.map +1 -1
- package/lib/cjs/CustomViewState3dCreator.js +80 -81
- package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
- package/lib/cjs/DevTools.d.ts +74 -71
- package/lib/cjs/DevTools.d.ts.map +1 -1
- package/lib/cjs/DevTools.js +156 -154
- package/lib/cjs/DevTools.js.map +1 -1
- package/lib/cjs/DisplayStyle.d.ts +104 -106
- package/lib/cjs/DisplayStyle.d.ts.map +1 -1
- package/lib/cjs/DisplayStyle.js +251 -256
- package/lib/cjs/DisplayStyle.js.map +1 -1
- package/lib/cjs/ECDb.d.ts +194 -191
- package/lib/cjs/ECDb.d.ts.map +1 -1
- package/lib/cjs/ECDb.js +351 -350
- package/lib/cjs/ECDb.js.map +1 -1
- package/lib/cjs/ECSchemaXmlContext.d.ts +18 -18
- package/lib/cjs/ECSchemaXmlContext.d.ts.map +1 -1
- package/lib/cjs/ECSchemaXmlContext.js +41 -41
- package/lib/cjs/ECSqlStatement.d.ts +473 -473
- package/lib/cjs/ECSqlStatement.js +791 -791
- package/lib/cjs/Element.d.ts +1105 -1109
- package/lib/cjs/Element.d.ts.map +1 -1
- package/lib/cjs/Element.js +1416 -1427
- package/lib/cjs/Element.js.map +1 -1
- package/lib/cjs/ElementAspect.d.ts +175 -179
- package/lib/cjs/ElementAspect.d.ts.map +1 -1
- package/lib/cjs/ElementAspect.js +202 -211
- package/lib/cjs/ElementAspect.js.map +1 -1
- package/lib/cjs/ElementGraphics.d.ts +9 -9
- package/lib/cjs/ElementGraphics.js +41 -41
- package/lib/cjs/ElementGraphics.js.map +1 -1
- package/lib/cjs/ElementTreeWalker.d.ts +162 -162
- package/lib/cjs/ElementTreeWalker.d.ts.map +1 -1
- package/lib/cjs/ElementTreeWalker.js +409 -409
- package/lib/cjs/ElementTreeWalker.js.map +1 -1
- package/lib/cjs/Entity.d.ts +102 -106
- package/lib/cjs/Entity.d.ts.map +1 -1
- package/lib/cjs/Entity.js +118 -134
- package/lib/cjs/Entity.js.map +1 -1
- package/lib/cjs/EntityReferences.d.ts +49 -49
- package/lib/cjs/EntityReferences.d.ts.map +1 -1
- package/lib/cjs/EntityReferences.js +95 -95
- package/lib/cjs/ExportGraphics.d.ts +317 -317
- package/lib/cjs/ExportGraphics.d.ts.map +1 -1
- package/lib/cjs/ExportGraphics.js +208 -208
- package/lib/cjs/ExternalSource.d.ts +95 -96
- package/lib/cjs/ExternalSource.d.ts.map +1 -1
- package/lib/cjs/ExternalSource.js +130 -131
- package/lib/cjs/ExternalSource.js.map +1 -1
- package/lib/cjs/GeoCoordConfig.d.ts +19 -19
- package/lib/cjs/GeoCoordConfig.js +85 -85
- package/lib/cjs/GeoCoordConfig.js.map +1 -1
- package/lib/cjs/GeometrySummary.d.ts +4 -4
- package/lib/cjs/GeometrySummary.js +333 -333
- package/lib/cjs/GeometrySummary.js.map +1 -1
- package/lib/cjs/HubMock.d.ts +94 -94
- package/lib/cjs/HubMock.js +220 -222
- package/lib/cjs/HubMock.js.map +1 -1
- package/lib/cjs/IModelCloneContext.d.ts +8 -8
- package/lib/cjs/IModelCloneContext.d.ts.map +1 -1
- package/lib/cjs/IModelCloneContext.js +15 -15
- package/lib/cjs/IModelDb.d.ts +1222 -1196
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +2389 -2392
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/IModelElementCloneContext.d.ts +89 -89
- package/lib/cjs/IModelElementCloneContext.js +159 -159
- package/lib/cjs/IModelHost.d.ts +370 -369
- package/lib/cjs/IModelHost.d.ts.map +1 -1
- package/lib/cjs/IModelHost.js +476 -496
- package/lib/cjs/IModelHost.js.map +1 -1
- package/lib/cjs/IModelJsFs.d.ts +62 -62
- package/lib/cjs/IModelJsFs.js +139 -140
- package/lib/cjs/IModelJsFs.js.map +1 -1
- package/lib/cjs/IpcHost.d.ts +104 -104
- package/lib/cjs/IpcHost.js +276 -278
- package/lib/cjs/IpcHost.js.map +1 -1
- package/lib/cjs/LineStyle.d.ts +311 -311
- package/lib/cjs/LineStyle.js +295 -295
- package/lib/cjs/LocalHub.d.ts +162 -162
- package/lib/cjs/LocalHub.d.ts.map +1 -1
- package/lib/cjs/LocalHub.js +579 -584
- package/lib/cjs/LocalHub.js.map +1 -1
- package/lib/cjs/LocalhostIpcHost.d.ts +21 -20
- package/lib/cjs/LocalhostIpcHost.d.ts.map +1 -1
- package/lib/cjs/LocalhostIpcHost.js +79 -81
- package/lib/cjs/LocalhostIpcHost.js.map +1 -1
- package/lib/cjs/Material.d.ts +131 -131
- package/lib/cjs/Material.d.ts.map +1 -1
- package/lib/cjs/Material.js +185 -181
- package/lib/cjs/Material.js.map +1 -1
- package/lib/cjs/Model.d.ts +391 -392
- package/lib/cjs/Model.d.ts.map +1 -1
- package/lib/cjs/Model.js +487 -485
- package/lib/cjs/Model.js.map +1 -1
- package/lib/cjs/NativeAppStorage.d.ts +51 -51
- package/lib/cjs/NativeAppStorage.js +202 -202
- package/lib/cjs/NativeAppStorage.js.map +1 -1
- package/lib/cjs/NativeHost.d.ts +52 -52
- package/lib/cjs/NativeHost.d.ts.map +1 -1
- package/lib/cjs/NativeHost.js +158 -163
- package/lib/cjs/NativeHost.js.map +1 -1
- package/lib/cjs/NavigationRelationship.d.ts +156 -156
- package/lib/cjs/NavigationRelationship.js +225 -225
- package/lib/cjs/NavigationRelationship.js.map +1 -1
- package/lib/cjs/PromiseMemoizer.d.ts +51 -51
- package/lib/cjs/PromiseMemoizer.d.ts.map +1 -1
- package/lib/cjs/PromiseMemoizer.js +101 -101
- package/lib/cjs/PromiseMemoizer.js.map +1 -1
- package/lib/cjs/PropertyStore.d.ts +123 -132
- package/lib/cjs/PropertyStore.d.ts.map +1 -1
- package/lib/cjs/PropertyStore.js +179 -11
- package/lib/cjs/PropertyStore.js.map +1 -1
- package/lib/cjs/Relationship.d.ts +413 -416
- package/lib/cjs/Relationship.d.ts.map +1 -1
- package/lib/cjs/Relationship.js +491 -494
- package/lib/cjs/Relationship.js.map +1 -1
- package/lib/cjs/RpcBackend.d.ts +5 -5
- package/lib/cjs/RpcBackend.js +32 -32
- package/lib/cjs/SQLiteDb.d.ts +317 -219
- package/lib/cjs/SQLiteDb.d.ts.map +1 -1
- package/lib/cjs/SQLiteDb.js +318 -214
- package/lib/cjs/SQLiteDb.js.map +1 -1
- package/lib/cjs/Schema.d.ts +55 -55
- package/lib/cjs/Schema.js +83 -83
- package/lib/cjs/Schema.js.map +1 -1
- package/lib/cjs/ServerBasedLocks.d.ts +57 -57
- package/lib/cjs/ServerBasedLocks.js +168 -168
- package/lib/cjs/ServerBasedLocks.js.map +1 -1
- package/lib/cjs/SqliteStatement.d.ts +360 -360
- package/lib/cjs/SqliteStatement.d.ts.map +1 -1
- package/lib/cjs/SqliteStatement.js +586 -586
- package/lib/cjs/Texture.d.ts +58 -58
- package/lib/cjs/Texture.js +82 -82
- package/lib/cjs/Texture.js.map +1 -1
- package/lib/cjs/TileStorage.d.ts +44 -18
- package/lib/cjs/TileStorage.d.ts.map +1 -1
- package/lib/cjs/TileStorage.js +109 -90
- package/lib/cjs/TileStorage.js.map +1 -1
- package/lib/cjs/TxnManager.d.ts +202 -202
- package/lib/cjs/TxnManager.d.ts.map +1 -1
- package/lib/cjs/TxnManager.js +356 -356
- package/lib/cjs/TxnManager.js.map +1 -1
- package/lib/cjs/ViewDefinition.d.ts +429 -439
- package/lib/cjs/ViewDefinition.d.ts.map +1 -1
- package/lib/cjs/ViewDefinition.js +640 -646
- package/lib/cjs/ViewDefinition.js.map +1 -1
- package/lib/cjs/ViewStateHydrator.d.ts +13 -13
- package/lib/cjs/ViewStateHydrator.js +103 -103
- package/lib/cjs/core-backend.d.ts +181 -184
- package/lib/cjs/core-backend.d.ts.map +1 -1
- package/lib/cjs/core-backend.js +205 -204
- package/lib/cjs/core-backend.js.map +1 -1
- package/lib/cjs/domains/FunctionalElements.d.ts +101 -101
- package/lib/cjs/domains/FunctionalElements.js +145 -145
- package/lib/cjs/domains/FunctionalElements.js.map +1 -1
- package/lib/cjs/domains/FunctionalSchema.d.ts +13 -13
- package/lib/cjs/domains/FunctionalSchema.d.ts.map +1 -1
- package/lib/cjs/domains/FunctionalSchema.js +39 -40
- package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
- package/lib/cjs/domains/GenericElements.d.ts +177 -177
- package/lib/cjs/domains/GenericElements.js +263 -263
- package/lib/cjs/domains/GenericSchema.d.ts +10 -10
- package/lib/cjs/domains/GenericSchema.js +28 -28
- package/lib/cjs/rpc/multipart.d.ts +11 -11
- package/lib/cjs/rpc/multipart.js +71 -71
- package/lib/cjs/rpc/tracing.d.ts +28 -28
- package/lib/cjs/rpc/tracing.js +73 -74
- package/lib/cjs/rpc/tracing.js.map +1 -1
- package/lib/cjs/rpc/web/logging.d.ts +9 -9
- package/lib/cjs/rpc/web/logging.js +43 -43
- package/lib/cjs/rpc/web/request.d.ts +6 -6
- package/lib/cjs/rpc/web/request.js +73 -74
- package/lib/cjs/rpc/web/request.js.map +1 -1
- package/lib/cjs/rpc/web/response.d.ts +6 -6
- package/lib/cjs/rpc/web/response.js +105 -106
- package/lib/cjs/rpc/web/response.js.map +1 -1
- package/lib/cjs/rpc-impl/DevToolsRpcImpl.d.ts +15 -15
- package/lib/cjs/rpc-impl/DevToolsRpcImpl.js +32 -32
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts +47 -47
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +293 -294
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/IModelTileRpcImpl.d.ts +20 -22
- package/lib/cjs/rpc-impl/IModelTileRpcImpl.d.ts.map +1 -1
- package/lib/cjs/rpc-impl/IModelTileRpcImpl.js +193 -205
- package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts +36 -36
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js +166 -168
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
- package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.d.ts +16 -16
- package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js +42 -43
- package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/WipRpcImpl.d.ts +15 -15
- package/lib/cjs/rpc-impl/WipRpcImpl.js +37 -37
- package/lib/cjs/workspace/Settings.d.ts +186 -186
- package/lib/cjs/workspace/Settings.d.ts.map +1 -1
- package/lib/cjs/workspace/Settings.js +155 -155
- package/lib/cjs/workspace/Settings.js.map +1 -1
- package/lib/cjs/workspace/SettingsSchemas.d.ts +75 -75
- package/lib/cjs/workspace/SettingsSchemas.js +190 -191
- package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
- package/lib/cjs/workspace/Workspace.d.ts +411 -414
- package/lib/cjs/workspace/Workspace.d.ts.map +1 -1
- package/lib/cjs/workspace/Workspace.js +521 -543
- package/lib/cjs/workspace/Workspace.js.map +1 -1
- package/package.json +25 -28
- package/lib/cjs/AliCloudStorageService.d.ts +0 -24
- package/lib/cjs/AliCloudStorageService.d.ts.map +0 -1
- package/lib/cjs/AliCloudStorageService.js +0 -72
- package/lib/cjs/AliCloudStorageService.js.map +0 -1
- package/lib/cjs/CloudStorageBackend.d.ts +0 -59
- package/lib/cjs/CloudStorageBackend.d.ts.map +0 -1
- package/lib/cjs/CloudStorageBackend.js +0 -174
- package/lib/cjs/CloudStorageBackend.js.map +0 -1
package/lib/cjs/CodeSpecs.js
CHANGED
|
@@ -1,125 +1,155 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
/** @packageDocumentation
|
|
7
|
-
* @module Codes
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.CodeSpecs = void 0;
|
|
11
|
-
const core_bentley_1 = require("@itwin/core-bentley");
|
|
12
|
-
const core_common_1 = require("@itwin/core-common");
|
|
13
|
-
/** Manages [CodeSpecs]($docs/BIS/guide/fundamentals/element-fundamentals.md#codespec) within an [[IModelDb]]
|
|
14
|
-
* @public
|
|
15
|
-
*/
|
|
16
|
-
class CodeSpecs {
|
|
17
|
-
constructor(imodel) {
|
|
18
|
-
this._loadedCodeSpecs = [];
|
|
19
|
-
this._imodel = imodel;
|
|
20
|
-
if (imodel.isBriefcaseDb()) {
|
|
21
|
-
imodel.onChangesetApplied.addListener(() => this._loadedCodeSpecs.length = 0);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
stmt.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
this
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
* @
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module Codes
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.CodeSpecs = void 0;
|
|
11
|
+
const core_bentley_1 = require("@itwin/core-bentley");
|
|
12
|
+
const core_common_1 = require("@itwin/core-common");
|
|
13
|
+
/** Manages [CodeSpecs]($docs/BIS/guide/fundamentals/element-fundamentals.md#codespec) within an [[IModelDb]]
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
class CodeSpecs {
|
|
17
|
+
constructor(imodel) {
|
|
18
|
+
this._loadedCodeSpecs = [];
|
|
19
|
+
this._imodel = imodel;
|
|
20
|
+
if (imodel.isBriefcaseDb()) {
|
|
21
|
+
imodel.onChangesetApplied.addListener(() => this._loadedCodeSpecs.length = 0);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
findByName(name) {
|
|
25
|
+
return this._imodel.withSqliteStatement(`SELECT Id FROM ${CodeSpecs.tableName} WHERE Name=?`, (stmt) => {
|
|
26
|
+
stmt.bindString(1, name);
|
|
27
|
+
return stmt.nextRow() ? stmt.getValueId(0) : undefined;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/** Look up the Id of the CodeSpec with the specified name. */
|
|
31
|
+
queryId(name) {
|
|
32
|
+
const id = this.findByName(name);
|
|
33
|
+
if (!id)
|
|
34
|
+
throw new core_common_1.IModelError(core_bentley_1.IModelStatus.NotFound, "CodeSpec not found");
|
|
35
|
+
return id;
|
|
36
|
+
}
|
|
37
|
+
/** Look up a CodeSpec by Id. The CodeSpec will be loaded from the database if necessary.
|
|
38
|
+
* @param codeSpecId The Id of the CodeSpec to load
|
|
39
|
+
* @returns The CodeSpec with the specified Id
|
|
40
|
+
* @throws [[IModelError]] if the Id is invalid or if no CodeSpec with that Id could be found.
|
|
41
|
+
*/
|
|
42
|
+
getById(codeSpecId) {
|
|
43
|
+
// good chance it is already loaded - check there before running a query
|
|
44
|
+
const found = this._loadedCodeSpecs.find((codeSpec) => codeSpec.id === codeSpecId);
|
|
45
|
+
if (found !== undefined)
|
|
46
|
+
return found;
|
|
47
|
+
// must load this codespec
|
|
48
|
+
const loadedCodeSpec = this.load(codeSpecId);
|
|
49
|
+
this._loadedCodeSpecs.push(loadedCodeSpec);
|
|
50
|
+
return loadedCodeSpec;
|
|
51
|
+
}
|
|
52
|
+
/** Returns true if the IModelDb has a CodeSpec of the specified Id. */
|
|
53
|
+
hasId(codeSpecId) {
|
|
54
|
+
try {
|
|
55
|
+
return undefined !== this.getById(codeSpecId);
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/** Look up a CodeSpec by name. The CodeSpec will be loaded from the database if necessary.
|
|
62
|
+
* @param name The name of the CodeSpec to load
|
|
63
|
+
* @returns The CodeSpec with the specified name
|
|
64
|
+
* @throws [[IModelError]] if no CodeSpec with the specified name could be found.
|
|
65
|
+
*/
|
|
66
|
+
getByName(name) {
|
|
67
|
+
// good chance it is already loaded - check there before running a query
|
|
68
|
+
const found = this._loadedCodeSpecs.find((codeSpec) => codeSpec.name === name);
|
|
69
|
+
if (found !== undefined)
|
|
70
|
+
return found;
|
|
71
|
+
const codeSpecId = this.queryId(name);
|
|
72
|
+
if (codeSpecId === undefined)
|
|
73
|
+
throw new core_common_1.IModelError(core_bentley_1.IModelStatus.NotFound, "CodeSpec not found");
|
|
74
|
+
return this.getById(codeSpecId);
|
|
75
|
+
}
|
|
76
|
+
/** Returns true if the IModelDb has a CodeSpec of the specified name. */
|
|
77
|
+
hasName(name) {
|
|
78
|
+
try {
|
|
79
|
+
return undefined !== this.getByName(name);
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
insertCodeSpec(specName, properties) {
|
|
86
|
+
const iModel = this._imodel;
|
|
87
|
+
const spec = { name: specName.trim(), props: JSON.stringify(properties) };
|
|
88
|
+
if (this.findByName(spec.name))
|
|
89
|
+
throw new core_common_1.IModelError(core_bentley_1.IModelStatus.DuplicateName, "CodeSpec already exists");
|
|
90
|
+
const internalCodes = iModel.codeService?.internalCodes;
|
|
91
|
+
if (internalCodes) {
|
|
92
|
+
// Since there is no lock on the codespec table, to add a codespec to an iModel it must first be reserved in the
|
|
93
|
+
// internal code index via `internalCodes.reserveBisCodeSpecs` prior to calling this function.
|
|
94
|
+
// This ensures that the Ids will be unique, and the property values consistent, even if more than one user
|
|
95
|
+
// adds them without pushing their changes. The call to `verifyBisCodeSpec` will throw otherwise.
|
|
96
|
+
internalCodes.reader.verifyBisCodeSpec(spec);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
// If this iModel doesn't have an internal code index, we have no way of coordinating the Ids for CodeSpecs across multiple users.
|
|
100
|
+
// Just look in this briefcase to find the currently highest used Id and hope for the best.
|
|
101
|
+
spec.id = iModel.withSqliteStatement(`SELECT MAX(Id) FROM ${CodeSpecs.tableName}`, (stmt) => stmt.nextRow() ? stmt.getValueInteger(0) + 1 : 1);
|
|
102
|
+
}
|
|
103
|
+
const id = spec.id; // eslint-disable-line @typescript-eslint/no-non-null-assertion
|
|
104
|
+
iModel.withSqliteStatement(`INSERT INTO ${CodeSpecs.tableName}(Id,Name,JsonProperties) VALUES(?,?,?)`, (stmt) => {
|
|
105
|
+
stmt.bindInteger(1, id);
|
|
106
|
+
stmt.bindString(2, spec.name);
|
|
107
|
+
stmt.bindString(3, spec.props);
|
|
108
|
+
const rc = stmt.step();
|
|
109
|
+
if (rc !== core_bentley_1.DbResult.BE_SQLITE_DONE)
|
|
110
|
+
throw new core_bentley_1.BentleyError(rc, "Error inserting codeSpec");
|
|
111
|
+
});
|
|
112
|
+
return core_bentley_1.Id64.fromLocalAndBriefcaseIds(id, 0);
|
|
113
|
+
}
|
|
114
|
+
insert(codeSpecOrName, props) {
|
|
115
|
+
if (codeSpecOrName instanceof core_common_1.CodeSpec) {
|
|
116
|
+
const id = this.insertCodeSpec(codeSpecOrName.name, codeSpecOrName.properties);
|
|
117
|
+
codeSpecOrName.id = id;
|
|
118
|
+
return id;
|
|
119
|
+
}
|
|
120
|
+
if (props === undefined)
|
|
121
|
+
throw new core_common_1.IModelError(core_bentley_1.IModelStatus.BadArg, "Invalid argument");
|
|
122
|
+
if (typeof props === "object")
|
|
123
|
+
return this.insertCodeSpec(codeSpecOrName, props);
|
|
124
|
+
const spec = core_common_1.CodeSpec.create(this._imodel, codeSpecOrName, props);
|
|
125
|
+
return this.insertCodeSpec(spec.name, spec.properties);
|
|
126
|
+
}
|
|
127
|
+
/** Update the Json properties of an existing CodeSpec.
|
|
128
|
+
* @param codeSpec The codeSpec holding Json properties values to update
|
|
129
|
+
* @throws if unable to update the codeSpec.
|
|
130
|
+
*/
|
|
131
|
+
updateProperties(codeSpec) {
|
|
132
|
+
this._imodel.withSqliteStatement(`UPDATE ${CodeSpecs.tableName} SET JsonProperties=? WHERE Id=?`, (stmt) => {
|
|
133
|
+
stmt.bindString(1, JSON.stringify(codeSpec.properties));
|
|
134
|
+
stmt.bindId(2, codeSpec.id);
|
|
135
|
+
if (core_bentley_1.DbResult.BE_SQLITE_DONE !== stmt.step())
|
|
136
|
+
throw new core_common_1.IModelError(core_bentley_1.IModelStatus.BadArg, "error updating CodeSpec properties");
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
/** Load a CodeSpec from the iModel
|
|
140
|
+
* @param id The persistent Id of the CodeSpec to load
|
|
141
|
+
*/
|
|
142
|
+
load(id) {
|
|
143
|
+
if (core_bentley_1.Id64.isInvalid(id))
|
|
144
|
+
throw new core_common_1.IModelError(core_bentley_1.IModelStatus.InvalidId, "Invalid codeSpecId");
|
|
145
|
+
return this._imodel.withSqliteStatement(`SELECT Name,JsonProperties FROM ${CodeSpecs.tableName} WHERE Id=?`, (stmt) => {
|
|
146
|
+
stmt.bindId(1, id);
|
|
147
|
+
if (!stmt.nextRow())
|
|
148
|
+
throw new core_common_1.IModelError(core_bentley_1.IModelStatus.InvalidId, "CodeSpec not found");
|
|
149
|
+
return core_common_1.CodeSpec.createFromJson(this._imodel, id, stmt.getValueString(0), JSON.parse(stmt.getValueString(1)));
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
CodeSpecs.tableName = "bis_CodeSpec";
|
|
154
|
+
exports.CodeSpecs = CodeSpecs;
|
|
125
155
|
//# sourceMappingURL=CodeSpecs.js.map
|
package/lib/cjs/CodeSpecs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeSpecs.js","sourceRoot":"","sources":["../../src/CodeSpecs.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA+E;AAC/E,oDAA0E;AAI1E;;GAEG;AACH,MAAa,SAAS;IAIpB,YAAY,MAAgB;QAFpB,qBAAgB,GAAe,EAAE,CAAC;QAGxC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,MAAM,CAAC,aAAa,EAAE,EAAE;YAC1B,MAAM,CAAC,kBAAkB,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;SAC/E;IACH,CAAC;IAED,8DAA8D;IACvD,OAAO,CAAC,IAAY;QACzB,OAAO,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,4DAA4D,EAAE,CAAC,IAAoB,EAAE,EAAE;YAC/H,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;YAC9B,I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AAI,EAAE,EAAE;YACvG,IAAI,CAAC,UAAU,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;YACxD,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC;YAC5B,IAAI,uBAAQ,CAAC,cAAc,KAAK,IAAI,CAAC,IAAI,EAAE;gBACzC,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,MAAM,EAAE,oCAAoC,CAAC,CAAC;QACrF,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACI,IAAI,CAAC,EAAc;QACxB,IAAI,mBAAI,CAAC,SAAS,CAAC,EAAE,CAAC;YACpB,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;QAEtE,OAAO,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,uEAAuE,EAAE,CAAC,IAAoB,EAAE,EAAE;YAC1I,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACnB,IAAI,uBAAQ,CAAC,aAAa,KAAK,IAAI,CAAC,IAAI,EAAE;gBACxC,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;YAEtE,MAAM,GAAG,GAAQ,IAAI,CAAC,MAAM,EAAE,CAAC;YAC/B,OAAO,sBAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,EAAE,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC;QAC7F,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AArID,8BAqIC","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 Codes\r\n */\r\n\r\nimport { DbResult, Id64, Id64String, IModelStatus } from \"@itwin/core-bentley\";\r\nimport { CodeScopeSpec, CodeSpec, IModelError } from \"@itwin/core-common\";\r\nimport { ECSqlStatement } from \"./ECSqlStatement\";\r\nimport { IModelDb } from \"./IModelDb\";\r\n\r\n/** Manages [CodeSpecs]($docs/BIS/guide/fundamentals/element-fundamentals.md#codespec) within an [[IModelDb]]\r\n * @public\r\n */\r\nexport class CodeSpecs {\r\n private _imodel: IModelDb;\r\n private _loadedCodeSpecs: CodeSpec[] = [];\r\n\r\n constructor(imodel: IModelDb) {\r\n this._imodel = imodel;\r\n if (imodel.isBriefcaseDb()) {\r\n imodel.onChangesetApplied.addListener(() => this._loadedCodeSpecs.length = 0);\r\n }\r\n }\r\n\r\n /** Look up the Id of the CodeSpec with the specified name. */\r\n public queryId(name: string): Id64String {\r\n return this._imodel.withPreparedStatement(\"SELECT ECInstanceId FROM BisCore.CodeSpec WHERE Name=:name\", (stmt: ECSqlStatement) => {\r\n stmt.bindString(\"name\", name);\r\n if (DbResult.BE_SQLITE_ROW !== stmt.step())\r\n throw new IModelError(IModelStatus.NotFound, \"CodeSpec not found\", () => ({ name }));\r\n return stmt.getValue(0).getId();\r\n });\r\n }\r\n\r\n /** Look up a CodeSpec by Id. The CodeSpec will be loaded from the database if necessary.\r\n * @param codeSpecId The Id of the CodeSpec to load\r\n * @returns The CodeSpec with the specified Id\r\n * @throws [[IModelError]] if the Id is invalid or if no CodeSpec with that Id could be found.\r\n */\r\n public getById(codeSpecId: Id64String): CodeSpec {\r\n if (Id64.isInvalid(codeSpecId))\r\n throw new IModelError(IModelStatus.InvalidId, \"Invalid codeSpecId\");\r\n\r\n // good chance it is already loaded - check there before running a query\r\n const found = this._loadedCodeSpecs.find((codeSpec) => codeSpec.id === codeSpecId);\r\n if (found !== undefined)\r\n return found;\r\n\r\n // must load this codespec\r\n const loadedCodeSpec = this.load(codeSpecId);\r\n this._loadedCodeSpecs.push(loadedCodeSpec);\r\n return loadedCodeSpec;\r\n }\r\n\r\n /** Returns true if the IModelDb has a CodeSpec of the specified Id. */\r\n public hasId(codeSpecId: Id64String): boolean {\r\n try {\r\n return undefined !== this.getById(codeSpecId);\r\n } catch (error) {\r\n return false;\r\n }\r\n }\r\n\r\n /** Look up a CodeSpec by name. The CodeSpec will be loaded from the database if necessary.\r\n * @param name The name of the CodeSpec to load\r\n * @returns The CodeSpec with the specified name\r\n * @throws [[IModelError]] if no CodeSpec with the specified name could be found.\r\n */\r\n public getByName(name: string): CodeSpec {\r\n // good chance it is already loaded - check there before running a query\r\n const found: CodeSpec | undefined = this._loadedCodeSpecs.find((codeSpec) => codeSpec.name === name);\r\n if (found !== undefined)\r\n return found;\r\n const codeSpecId = this.queryId(name);\r\n if (codeSpecId === undefined)\r\n throw new IModelError(IModelStatus.NotFound, \"CodeSpec not found\", () => ({ name }));\r\n return this.getById(codeSpecId);\r\n }\r\n\r\n /** Returns true if the IModelDb has a CodeSpec of the specified name. */\r\n public hasName(name: string): boolean {\r\n try {\r\n return undefined !== this.getByName(name);\r\n } catch (error) {\r\n return false;\r\n }\r\n }\r\n\r\n /** Add a new CodeSpec to the iModel.\r\n * @param codeSpec The CodeSpec to insert\r\n * @returns The Id of the persistent CodeSpec.\r\n * @note If successful, this method will assign a valid CodeSpecId to the supplied CodeSpec\r\n * @throws IModelError if the insertion fails\r\n */\r\n public insert(codeSpec: CodeSpec): Id64String;\r\n /** Add a new CodeSpec to the IModelDb.\r\n * @param name The name for the new CodeSpec.\r\n * @param scopeType The scope type\r\n * @returns The Id of the persistent CodeSpec.\r\n * @throws IModelError if the insertion fails\r\n */\r\n public insert(name: string, scopeType: CodeScopeSpec.Type): Id64String;\r\n public insert(codeSpecOrName: CodeSpec | string, scopeType?: CodeScopeSpec.Type): Id64String {\r\n if (codeSpecOrName instanceof CodeSpec) {\r\n const codeSpec = codeSpecOrName;\r\n const id: Id64String = this._imodel.insertCodeSpec(codeSpec);\r\n codeSpec.id = id;\r\n return id;\r\n }\r\n if (typeof codeSpecOrName === \"string\") {\r\n const name = codeSpecOrName;\r\n if (scopeType)\r\n return this._imodel.insertCodeSpec(CodeSpec.create(this._imodel, name, scopeType));\r\n }\r\n throw new IModelError(IModelStatus.BadArg, \"Invalid argument\");\r\n }\r\n\r\n /** Update the Json properties of an existing CodeSpec.\r\n * @param codeSpec The codeSpec holding Json properties values to update\r\n * @throws if unable to update the codeSpec.\r\n */\r\n public updateProperties(codeSpec: CodeSpec): void {\r\n this._imodel.withPreparedSqliteStatement(\"UPDATE bis_CodeSpec SET JsonProperties=? WHERE Id=?\", (stmt) => {\r\n stmt.bindString(1, JSON.stringify(codeSpec.properties));\r\n stmt.bindId(2, codeSpec.id);\r\n if (DbResult.BE_SQLITE_DONE !== stmt.step())\r\n throw new IModelError(IModelStatus.BadArg, \"error updating CodeSpec properties\");\r\n });\r\n }\r\n\r\n /** Load a CodeSpec from the iModel\r\n * @param id The persistent Id of the CodeSpec to load\r\n */\r\n public load(id: Id64String): CodeSpec {\r\n if (Id64.isInvalid(id))\r\n throw new IModelError(IModelStatus.InvalidId, \"Invalid codeSpecId\");\r\n\r\n return this._imodel.withPreparedStatement(\"SELECT name,jsonProperties FROM BisCore.CodeSpec WHERE ECInstanceId=?\", (stmt: ECSqlStatement) => {\r\n stmt.bindId(1, id);\r\n if (DbResult.BE_SQLITE_ROW !== stmt.step())\r\n throw new IModelError(IModelStatus.InvalidId, \"Invalid codeSpecId\");\r\n\r\n const row: any = stmt.getRow();\r\n return CodeSpec.createFromJson(this._imodel, id, row.name, JSON.parse(row.jsonProperties));\r\n });\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"CodeSpecs.js","sourceRoot":"","sources":["../../src/CodeSpecs.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA6F;AAC7F,oDAA8F;AAI9F;;GAEG;AACH,MAAa,SAAS;IAKpB,YAAY,MAA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,CAAC,2BAAY,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;QAEtE,OAAO,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,mCAAmC,SAAS,CAAC,SAAS,aAAa,EAAE,CAAC,IAAI,EAAE,EAAE;YACpH,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACnB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;gBACjB,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;YAEtE,OAAO,sBAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/G,CAAC,CAAC,CAAC;IACL,CAAC;;AAvKc,mBAAS,GAAG,cAAc,AAAjB,CAAkB;AAD/B,8BAAS","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 Codes\r\n */\r\n\r\nimport { BentleyError, DbResult, Id64, Id64String, IModelStatus } from \"@itwin/core-bentley\";\r\nimport { CodeScopeSpec, CodeSpec, CodeSpecProperties, IModelError } from \"@itwin/core-common\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { CodeService } from \"./CodeService\";\r\n\r\n/** Manages [CodeSpecs]($docs/BIS/guide/fundamentals/element-fundamentals.md#codespec) within an [[IModelDb]]\r\n * @public\r\n */\r\nexport class CodeSpecs {\r\n private static tableName = \"bis_CodeSpec\";\r\n private _imodel: IModelDb;\r\n private _loadedCodeSpecs: CodeSpec[] = [];\r\n\r\n constructor(imodel: IModelDb) {\r\n this._imodel = imodel;\r\n if (imodel.isBriefcaseDb()) {\r\n imodel.onChangesetApplied.addListener(() => this._loadedCodeSpecs.length = 0);\r\n }\r\n }\r\n\r\n private findByName(name: string): Id64String | undefined {\r\n return this._imodel.withSqliteStatement(`SELECT Id FROM ${CodeSpecs.tableName} WHERE Name=?`, (stmt) => {\r\n stmt.bindString(1, name);\r\n return stmt.nextRow() ? stmt.getValueId(0) : undefined;\r\n });\r\n }\r\n\r\n /** Look up the Id of the CodeSpec with the specified name. */\r\n public queryId(name: string): Id64String {\r\n const id = this.findByName(name);\r\n if (!id)\r\n throw new IModelError(IModelStatus.NotFound, \"CodeSpec not found\");\r\n return id;\r\n }\r\n\r\n /** Look up a CodeSpec by Id. The CodeSpec will be loaded from the database if necessary.\r\n * @param codeSpecId The Id of the CodeSpec to load\r\n * @returns The CodeSpec with the specified Id\r\n * @throws [[IModelError]] if the Id is invalid or if no CodeSpec with that Id could be found.\r\n */\r\n public getById(codeSpecId: Id64String): CodeSpec {\r\n // good chance it is already loaded - check there before running a query\r\n const found = this._loadedCodeSpecs.find((codeSpec) => codeSpec.id === codeSpecId);\r\n if (found !== undefined)\r\n return found;\r\n\r\n // must load this codespec\r\n const loadedCodeSpec = this.load(codeSpecId);\r\n this._loadedCodeSpecs.push(loadedCodeSpec);\r\n return loadedCodeSpec;\r\n }\r\n\r\n /** Returns true if the IModelDb has a CodeSpec of the specified Id. */\r\n public hasId(codeSpecId: Id64String): boolean {\r\n try {\r\n return undefined !== this.getById(codeSpecId);\r\n } catch (error) {\r\n return false;\r\n }\r\n }\r\n\r\n /** Look up a CodeSpec by name. The CodeSpec will be loaded from the database if necessary.\r\n * @param name The name of the CodeSpec to load\r\n * @returns The CodeSpec with the specified name\r\n * @throws [[IModelError]] if no CodeSpec with the specified name could be found.\r\n */\r\n public getByName(name: string): CodeSpec {\r\n // good chance it is already loaded - check there before running a query\r\n const found = this._loadedCodeSpecs.find((codeSpec) => codeSpec.name === name);\r\n if (found !== undefined)\r\n return found;\r\n const codeSpecId = this.queryId(name);\r\n if (codeSpecId === undefined)\r\n throw new IModelError(IModelStatus.NotFound, \"CodeSpec not found\");\r\n return this.getById(codeSpecId);\r\n }\r\n\r\n /** Returns true if the IModelDb has a CodeSpec of the specified name. */\r\n public hasName(name: string): boolean {\r\n try {\r\n return undefined !== this.getByName(name);\r\n } catch (error) {\r\n return false;\r\n }\r\n }\r\n\r\n private insertCodeSpec(specName: string, properties: CodeSpecProperties): Id64String {\r\n const iModel = this._imodel;\r\n const spec: CodeService.BisCodeSpecIndexProps = { name: specName.trim(), props: JSON.stringify(properties) };\r\n if (this.findByName(spec.name))\r\n throw new IModelError(IModelStatus.DuplicateName, \"CodeSpec already exists\");\r\n\r\n const internalCodes = iModel.codeService?.internalCodes;\r\n if (internalCodes) {\r\n // Since there is no lock on the codespec table, to add a codespec to an iModel it must first be reserved in the\r\n // internal code index via `internalCodes.reserveBisCodeSpecs` prior to calling this function.\r\n // This ensures that the Ids will be unique, and the property values consistent, even if more than one user\r\n // adds them without pushing their changes. The call to `verifyBisCodeSpec` will throw otherwise.\r\n internalCodes.reader.verifyBisCodeSpec(spec);\r\n } else {\r\n // If this iModel doesn't have an internal code index, we have no way of coordinating the Ids for CodeSpecs across multiple users.\r\n // Just look in this briefcase to find the currently highest used Id and hope for the best.\r\n spec.id = iModel.withSqliteStatement(`SELECT MAX(Id) FROM ${CodeSpecs.tableName}`, (stmt) => stmt.nextRow() ? stmt.getValueInteger(0) + 1 : 1);\r\n }\r\n\r\n const id = spec.id!; // eslint-disable-line @typescript-eslint/no-non-null-assertion\r\n iModel.withSqliteStatement(`INSERT INTO ${CodeSpecs.tableName}(Id,Name,JsonProperties) VALUES(?,?,?)`, (stmt) => {\r\n stmt.bindInteger(1, id);\r\n stmt.bindString(2, spec.name);\r\n stmt.bindString(3, spec.props);\r\n const rc = stmt.step();\r\n if (rc !== DbResult.BE_SQLITE_DONE)\r\n throw new BentleyError(rc, \"Error inserting codeSpec\");\r\n });\r\n\r\n return Id64.fromLocalAndBriefcaseIds(id, 0);\r\n }\r\n\r\n /** Add a new CodeSpec to the iModel.\r\n * @param codeSpec The CodeSpec to insert\r\n * @returns The Id of the persistent CodeSpec.\r\n * @note If successful, this method will assign a valid CodeSpecId to the supplied CodeSpec\r\n * @throws IModelError if the insertion fails\r\n */\r\n public insert(codeSpec: CodeSpec): Id64String;\r\n\r\n /** Add a new CodeSpec to the IModelDb.\r\n * @param name The name for the new CodeSpec.\r\n * @param properties The properties or the CodeSpec. For backwards compatibility this may also be a `CodeScopeSpec.Type`.\r\n * @returns The Id of the persistent CodeSpec.\r\n * @throws IModelError if the insertion fails\r\n */\r\n public insert(name: string, properties: CodeSpecProperties | CodeScopeSpec.Type): Id64String;\r\n public insert(codeSpecOrName: CodeSpec | string, props?: CodeSpecProperties | CodeScopeSpec.Type): Id64String {\r\n if (codeSpecOrName instanceof CodeSpec) {\r\n const id = this.insertCodeSpec(codeSpecOrName.name, codeSpecOrName.properties);\r\n codeSpecOrName.id = id;\r\n return id;\r\n }\r\n if (props === undefined)\r\n throw new IModelError(IModelStatus.BadArg, \"Invalid argument\");\r\n\r\n if (typeof props === \"object\")\r\n return this.insertCodeSpec(codeSpecOrName, props);\r\n\r\n const spec = CodeSpec.create(this._imodel, codeSpecOrName, props);\r\n return this.insertCodeSpec(spec.name, spec.properties);\r\n }\r\n\r\n /** Update the Json properties of an existing CodeSpec.\r\n * @param codeSpec The codeSpec holding Json properties values to update\r\n * @throws if unable to update the codeSpec.\r\n */\r\n public updateProperties(codeSpec: CodeSpec): void {\r\n this._imodel.withSqliteStatement(`UPDATE ${CodeSpecs.tableName} SET JsonProperties=? WHERE Id=?`, (stmt) => {\r\n stmt.bindString(1, JSON.stringify(codeSpec.properties));\r\n stmt.bindId(2, codeSpec.id);\r\n if (DbResult.BE_SQLITE_DONE !== stmt.step())\r\n throw new IModelError(IModelStatus.BadArg, \"error updating CodeSpec properties\");\r\n });\r\n }\r\n\r\n /** Load a CodeSpec from the iModel\r\n * @param id The persistent Id of the CodeSpec to load\r\n */\r\n public load(id: Id64String): CodeSpec {\r\n if (Id64.isInvalid(id))\r\n throw new IModelError(IModelStatus.InvalidId, \"Invalid codeSpecId\");\r\n\r\n return this._imodel.withSqliteStatement(`SELECT Name,JsonProperties FROM ${CodeSpecs.tableName} WHERE Id=?`, (stmt) => {\r\n stmt.bindId(1, id);\r\n if (!stmt.nextRow())\r\n throw new IModelError(IModelStatus.InvalidId, \"CodeSpec not found\");\r\n\r\n return CodeSpec.createFromJson(this._imodel, id, stmt.getValueString(0), JSON.parse(stmt.getValueString(1)));\r\n });\r\n }\r\n}\r\n"]}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { IModelJsNative } from "@bentley/imodeljs-native";
|
|
2
|
-
import { DbBlobRequest, DbBlobResponse, DbQueryConfig, DbQueryRequest, DbQueryResponse } from "@itwin/core-common";
|
|
3
|
-
/** @internal */
|
|
4
|
-
export
|
|
5
|
-
/** @internal */
|
|
6
|
-
export declare class ConcurrentQuery {
|
|
7
|
-
/** @internal */
|
|
8
|
-
static executeQueryRequest(conn: IModelJsNative.ECDb | IModelJsNative.DgnDb, request: DbQueryRequest): Promise<DbQueryResponse>;
|
|
9
|
-
/** @internal */
|
|
10
|
-
static executeBlobRequest(conn: IModelJsNative.ECDb | IModelJsNative.DgnDb, request: DbBlobRequest): Promise<DbBlobResponse>;
|
|
11
|
-
static resetConfig(conn: IModelJsNative.ECDb | IModelJsNative.DgnDb, config?: DbQueryConfig): DbQueryConfig;
|
|
12
|
-
static shutdown(conn: IModelJsNative.ECDb | IModelJsNative.DgnDb): void;
|
|
13
|
-
}
|
|
1
|
+
import { IModelJsNative } from "@bentley/imodeljs-native";
|
|
2
|
+
import { DbBlobRequest, DbBlobResponse, DbQueryConfig, DbQueryRequest, DbQueryResponse } from "@itwin/core-common";
|
|
3
|
+
/** @internal */
|
|
4
|
+
export type OnResponse = (response: Response) => void;
|
|
5
|
+
/** @internal */
|
|
6
|
+
export declare class ConcurrentQuery {
|
|
7
|
+
/** @internal */
|
|
8
|
+
static executeQueryRequest(conn: IModelJsNative.ECDb | IModelJsNative.DgnDb, request: DbQueryRequest): Promise<DbQueryResponse>;
|
|
9
|
+
/** @internal */
|
|
10
|
+
static executeBlobRequest(conn: IModelJsNative.ECDb | IModelJsNative.DgnDb, request: DbBlobRequest): Promise<DbBlobResponse>;
|
|
11
|
+
static resetConfig(conn: IModelJsNative.ECDb | IModelJsNative.DgnDb, config?: DbQueryConfig): DbQueryConfig;
|
|
12
|
+
static shutdown(conn: IModelJsNative.ECDb | IModelJsNative.DgnDb): void;
|
|
13
|
+
}
|
|
14
14
|
//# sourceMappingURL=ConcurrentQuery.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConcurrentQuery.d.ts","sourceRoot":"","sources":["../../src/ConcurrentQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAK1D,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,EAAiB,MAAM,oBAAoB,CAAC;AAElI,gBAAgB;AAChB,
|
|
1
|
+
{"version":3,"file":"ConcurrentQuery.d.ts","sourceRoot":"","sources":["../../src/ConcurrentQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAK1D,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,EAAiB,MAAM,oBAAoB,CAAC;AAElI,gBAAgB;AAChB,MAAM,MAAM,UAAU,GAAG,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAC;AAEtD,gBAAgB;AAChB,qBAAa,eAAe;IAC1B,gBAAgB;WACI,mBAAmB,CAAC,IAAI,EAAE,cAAc,CAAC,IAAI,GAAG,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC;IAQ5I,gBAAgB;WACI,kBAAkB,CAAC,IAAI,EAAE,cAAc,CAAC,IAAI,GAAG,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC;WAQ3H,WAAW,CAAC,IAAI,EAAE,cAAc,CAAC,IAAI,GAAG,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,aAAa,GAAG,aAAa;WAGpG,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC,IAAI,GAAG,cAAc,CAAC,KAAK;CAGxE"}
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ConcurrentQuery = void 0;
|
|
4
|
-
/*---------------------------------------------------------------------------------------------
|
|
5
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
6
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
7
|
-
*--------------------------------------------------------------------------------------------*/
|
|
8
|
-
const core_common_1 = require("@itwin/core-common");
|
|
9
|
-
/** @internal */
|
|
10
|
-
class ConcurrentQuery {
|
|
11
|
-
/** @internal */
|
|
12
|
-
static async executeQueryRequest(conn, request) {
|
|
13
|
-
return new Promise((resolve) => {
|
|
14
|
-
request.kind = core_common_1.DbRequestKind.ECSql;
|
|
15
|
-
conn.concurrentQueryExecute(request, (response) => {
|
|
16
|
-
resolve(response);
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
/** @internal */
|
|
21
|
-
static async executeBlobRequest(conn, request) {
|
|
22
|
-
return new Promise((resolve) => {
|
|
23
|
-
request.kind = core_common_1.DbRequestKind.BlobIO;
|
|
24
|
-
conn.concurrentQueryExecute(request, (response) => {
|
|
25
|
-
resolve(response);
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
static resetConfig(conn, config) {
|
|
30
|
-
return conn.concurrentQueryResetConfig(config);
|
|
31
|
-
}
|
|
32
|
-
static shutdown(conn) {
|
|
33
|
-
conn.concurrentQueryShutdown();
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
exports.ConcurrentQuery = ConcurrentQuery;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConcurrentQuery = void 0;
|
|
4
|
+
/*---------------------------------------------------------------------------------------------
|
|
5
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
6
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
7
|
+
*--------------------------------------------------------------------------------------------*/
|
|
8
|
+
const core_common_1 = require("@itwin/core-common");
|
|
9
|
+
/** @internal */
|
|
10
|
+
class ConcurrentQuery {
|
|
11
|
+
/** @internal */
|
|
12
|
+
static async executeQueryRequest(conn, request) {
|
|
13
|
+
return new Promise((resolve) => {
|
|
14
|
+
request.kind = core_common_1.DbRequestKind.ECSql;
|
|
15
|
+
conn.concurrentQueryExecute(request, (response) => {
|
|
16
|
+
resolve(response);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
/** @internal */
|
|
21
|
+
static async executeBlobRequest(conn, request) {
|
|
22
|
+
return new Promise((resolve) => {
|
|
23
|
+
request.kind = core_common_1.DbRequestKind.BlobIO;
|
|
24
|
+
conn.concurrentQueryExecute(request, (response) => {
|
|
25
|
+
resolve(response);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
static resetConfig(conn, config) {
|
|
30
|
+
return conn.concurrentQueryResetConfig(config);
|
|
31
|
+
}
|
|
32
|
+
static shutdown(conn) {
|
|
33
|
+
conn.concurrentQueryShutdown();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.ConcurrentQuery = ConcurrentQuery;
|
|
37
37
|
//# sourceMappingURL=ConcurrentQuery.js.map
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { CustomViewState3dCreatorOptions, CustomViewState3dProps } from "@itwin/core-common";
|
|
2
|
-
import { IModelDb } from "./IModelDb";
|
|
3
|
-
/**
|
|
4
|
-
* Class which helps to generate a custom ViewState3d.
|
|
5
|
-
* @internal
|
|
6
|
-
*/
|
|
7
|
-
export declare class CustomViewState3dCreator {
|
|
8
|
-
private _imodel;
|
|
9
|
-
constructor(iModel: IModelDb);
|
|
10
|
-
/** Gets default view state data such as category Ids and modelextents. If no model ids are passed in, all 3D models in the iModel are used.
|
|
11
|
-
* @param [modelIds] Ids of models to display in the view.
|
|
12
|
-
* @throws [IModelError]($common) If no 3d models are found in the iModel.
|
|
13
|
-
*/
|
|
14
|
-
getCustomViewState3dData(options: CustomViewState3dCreatorOptions): Promise<CustomViewState3dProps>;
|
|
15
|
-
private _getAllCategories;
|
|
16
|
-
/** Compute the union of the extents of all the specified models. */
|
|
17
|
-
private _getModelExtents;
|
|
18
|
-
/** Get the Ids of all spatially-located, non-template 3d models in the iModel. */
|
|
19
|
-
private _getAllModels;
|
|
20
|
-
private _executeQuery;
|
|
21
|
-
}
|
|
1
|
+
import { CustomViewState3dCreatorOptions, CustomViewState3dProps } from "@itwin/core-common";
|
|
2
|
+
import { IModelDb } from "./IModelDb";
|
|
3
|
+
/**
|
|
4
|
+
* Class which helps to generate a custom ViewState3d.
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare class CustomViewState3dCreator {
|
|
8
|
+
private _imodel;
|
|
9
|
+
constructor(iModel: IModelDb);
|
|
10
|
+
/** Gets default view state data such as category Ids and modelextents. If no model ids are passed in, all 3D models in the iModel are used.
|
|
11
|
+
* @param [modelIds] Ids of models to display in the view.
|
|
12
|
+
* @throws [IModelError]($common) If no 3d models are found in the iModel.
|
|
13
|
+
*/
|
|
14
|
+
getCustomViewState3dData(options: CustomViewState3dCreatorOptions): Promise<CustomViewState3dProps>;
|
|
15
|
+
private _getAllCategories;
|
|
16
|
+
/** Compute the union of the extents of all the specified models. */
|
|
17
|
+
private _getModelExtents;
|
|
18
|
+
/** Get the Ids of all spatially-located, non-template 3d models in the iModel. */
|
|
19
|
+
private _getAllModels;
|
|
20
|
+
private _executeQuery;
|
|
21
|
+
}
|
|
22
22
|
//# sourceMappingURL=CustomViewState3dCreator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomViewState3dCreator.d.ts","sourceRoot":"","sources":["../../src/CustomViewState3dCreator.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,+BAA+B,EAAE,sBAAsB,
|
|
1
|
+
{"version":3,"file":"CustomViewState3dCreator.d.ts","sourceRoot":"","sources":["../../src/CustomViewState3dCreator.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,+BAA+B,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAG7F,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAItC;;;GAGG;AACH,qBAAa,wBAAwB;IACnC,OAAO,CAAC,OAAO,CAAW;gBACP,MAAM,EAAE,QAAQ;IAGnC;;;OAGG;IACU,wBAAwB,CAAC,OAAO,EAAE,+BAA+B,GAAG,OAAO,CAAC,sBAAsB,CAAC;YAelG,iBAAiB;IAS/B,oEAAoE;YACtD,gBAAgB;IAa9B,kFAAkF;YACpE,aAAa;IAmB3B,OAAO,CAAC,aAAa,CAMnB;CACH"}
|