@itwin/core-backend 4.0.0-dev.8 → 4.0.0-dev.81

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.
Files changed (259) hide show
  1. package/CHANGELOG.md +55 -1
  2. package/lib/cjs/BackendHubAccess.d.ts +224 -224
  3. package/lib/cjs/BackendHubAccess.d.ts.map +1 -1
  4. package/lib/cjs/BackendHubAccess.js +41 -41
  5. package/lib/cjs/BackendHubAccess.js.map +1 -1
  6. package/lib/cjs/BackendLoggerCategory.d.ts +90 -91
  7. package/lib/cjs/BackendLoggerCategory.d.ts.map +1 -1
  8. package/lib/cjs/BackendLoggerCategory.js +98 -99
  9. package/lib/cjs/BackendLoggerCategory.js.map +1 -1
  10. package/lib/cjs/BisCoreSchema.d.ts +21 -21
  11. package/lib/cjs/BisCoreSchema.js +60 -60
  12. package/lib/cjs/BriefcaseManager.d.ts +170 -170
  13. package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
  14. package/lib/cjs/BriefcaseManager.js +408 -414
  15. package/lib/cjs/BriefcaseManager.js.map +1 -1
  16. package/lib/cjs/Category.d.ts +153 -153
  17. package/lib/cjs/Category.js +243 -243
  18. package/lib/cjs/Category.js.map +1 -1
  19. package/lib/cjs/ChangeSummaryManager.d.ts +187 -187
  20. package/lib/cjs/ChangeSummaryManager.js +444 -445
  21. package/lib/cjs/ChangeSummaryManager.js.map +1 -1
  22. package/lib/cjs/ChangedElementsDb.d.ts +99 -99
  23. package/lib/cjs/ChangedElementsDb.js +165 -165
  24. package/lib/cjs/ChangedElementsManager.d.ts +39 -39
  25. package/lib/cjs/ChangedElementsManager.js +88 -88
  26. package/lib/cjs/ChannelControl.d.ts +70 -0
  27. package/lib/cjs/ChannelControl.d.ts.map +1 -0
  28. package/lib/cjs/ChannelControl.js +89 -0
  29. package/lib/cjs/ChannelControl.js.map +1 -0
  30. package/lib/cjs/CheckpointManager.d.ts +121 -121
  31. package/lib/cjs/CheckpointManager.d.ts.map +1 -1
  32. package/lib/cjs/CheckpointManager.js +351 -349
  33. package/lib/cjs/CheckpointManager.js.map +1 -1
  34. package/lib/cjs/ClassRegistry.d.ts +79 -79
  35. package/lib/cjs/ClassRegistry.js +249 -245
  36. package/lib/cjs/ClassRegistry.js.map +1 -1
  37. package/lib/cjs/CloudSqlite.d.ts +423 -350
  38. package/lib/cjs/CloudSqlite.d.ts.map +1 -1
  39. package/lib/cjs/CloudSqlite.js +189 -153
  40. package/lib/cjs/CloudSqlite.js.map +1 -1
  41. package/lib/cjs/CodeService.d.ts +437 -396
  42. package/lib/cjs/CodeService.d.ts.map +1 -1
  43. package/lib/cjs/CodeService.js +63 -63
  44. package/lib/cjs/CodeService.js.map +1 -1
  45. package/lib/cjs/CodeSpecs.d.ts +58 -55
  46. package/lib/cjs/CodeSpecs.d.ts.map +1 -1
  47. package/lib/cjs/CodeSpecs.js +154 -124
  48. package/lib/cjs/CodeSpecs.js.map +1 -1
  49. package/lib/cjs/ConcurrentQuery.d.ts +13 -13
  50. package/lib/cjs/ConcurrentQuery.d.ts.map +1 -1
  51. package/lib/cjs/ConcurrentQuery.js +36 -36
  52. package/lib/cjs/CustomViewState3dCreator.d.ts +21 -21
  53. package/lib/cjs/CustomViewState3dCreator.d.ts.map +1 -1
  54. package/lib/cjs/CustomViewState3dCreator.js +80 -81
  55. package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
  56. package/lib/cjs/DevTools.d.ts +74 -71
  57. package/lib/cjs/DevTools.d.ts.map +1 -1
  58. package/lib/cjs/DevTools.js +156 -154
  59. package/lib/cjs/DevTools.js.map +1 -1
  60. package/lib/cjs/DisplayStyle.d.ts +106 -106
  61. package/lib/cjs/DisplayStyle.js +253 -256
  62. package/lib/cjs/DisplayStyle.js.map +1 -1
  63. package/lib/cjs/ECDb.d.ts +194 -191
  64. package/lib/cjs/ECDb.d.ts.map +1 -1
  65. package/lib/cjs/ECDb.js +351 -350
  66. package/lib/cjs/ECDb.js.map +1 -1
  67. package/lib/cjs/ECSchemaXmlContext.d.ts +18 -18
  68. package/lib/cjs/ECSchemaXmlContext.d.ts.map +1 -1
  69. package/lib/cjs/ECSchemaXmlContext.js +41 -41
  70. package/lib/cjs/ECSqlStatement.d.ts +473 -473
  71. package/lib/cjs/ECSqlStatement.js +791 -791
  72. package/lib/cjs/Element.d.ts +1113 -1109
  73. package/lib/cjs/Element.d.ts.map +1 -1
  74. package/lib/cjs/Element.js +1424 -1427
  75. package/lib/cjs/Element.js.map +1 -1
  76. package/lib/cjs/ElementAspect.d.ts +176 -179
  77. package/lib/cjs/ElementAspect.d.ts.map +1 -1
  78. package/lib/cjs/ElementAspect.js +203 -211
  79. package/lib/cjs/ElementAspect.js.map +1 -1
  80. package/lib/cjs/ElementGraphics.d.ts +9 -9
  81. package/lib/cjs/ElementGraphics.js +41 -41
  82. package/lib/cjs/ElementGraphics.js.map +1 -1
  83. package/lib/cjs/ElementTreeWalker.d.ts +162 -162
  84. package/lib/cjs/ElementTreeWalker.d.ts.map +1 -1
  85. package/lib/cjs/ElementTreeWalker.js +409 -409
  86. package/lib/cjs/ElementTreeWalker.js.map +1 -1
  87. package/lib/cjs/Entity.d.ts +106 -106
  88. package/lib/cjs/Entity.d.ts.map +1 -1
  89. package/lib/cjs/Entity.js +135 -134
  90. package/lib/cjs/Entity.js.map +1 -1
  91. package/lib/cjs/EntityReferences.d.ts +49 -49
  92. package/lib/cjs/EntityReferences.d.ts.map +1 -1
  93. package/lib/cjs/EntityReferences.js +95 -95
  94. package/lib/cjs/ExportGraphics.d.ts +317 -317
  95. package/lib/cjs/ExportGraphics.d.ts.map +1 -1
  96. package/lib/cjs/ExportGraphics.js +208 -208
  97. package/lib/cjs/ExternalSource.d.ts +96 -96
  98. package/lib/cjs/ExternalSource.js +131 -131
  99. package/lib/cjs/ExternalSource.js.map +1 -1
  100. package/lib/cjs/GeoCoordConfig.d.ts +19 -19
  101. package/lib/cjs/GeoCoordConfig.js +85 -85
  102. package/lib/cjs/GeoCoordConfig.js.map +1 -1
  103. package/lib/cjs/GeometrySummary.d.ts +4 -4
  104. package/lib/cjs/GeometrySummary.js +333 -333
  105. package/lib/cjs/GeometrySummary.js.map +1 -1
  106. package/lib/cjs/HubMock.d.ts +94 -94
  107. package/lib/cjs/HubMock.js +220 -222
  108. package/lib/cjs/HubMock.js.map +1 -1
  109. package/lib/cjs/IModelCloneContext.d.ts +8 -8
  110. package/lib/cjs/IModelCloneContext.d.ts.map +1 -1
  111. package/lib/cjs/IModelCloneContext.js +15 -15
  112. package/lib/cjs/IModelDb.d.ts +1222 -1196
  113. package/lib/cjs/IModelDb.d.ts.map +1 -1
  114. package/lib/cjs/IModelDb.js +2389 -2392
  115. package/lib/cjs/IModelDb.js.map +1 -1
  116. package/lib/cjs/IModelElementCloneContext.d.ts +89 -89
  117. package/lib/cjs/IModelElementCloneContext.js +159 -159
  118. package/lib/cjs/IModelHost.d.ts +368 -369
  119. package/lib/cjs/IModelHost.d.ts.map +1 -1
  120. package/lib/cjs/IModelHost.js +474 -496
  121. package/lib/cjs/IModelHost.js.map +1 -1
  122. package/lib/cjs/IModelJsFs.d.ts +62 -62
  123. package/lib/cjs/IModelJsFs.js +139 -140
  124. package/lib/cjs/IModelJsFs.js.map +1 -1
  125. package/lib/cjs/IpcHost.d.ts +104 -104
  126. package/lib/cjs/IpcHost.js +276 -278
  127. package/lib/cjs/IpcHost.js.map +1 -1
  128. package/lib/cjs/LineStyle.d.ts +311 -311
  129. package/lib/cjs/LineStyle.js +295 -295
  130. package/lib/cjs/LocalHub.d.ts +162 -162
  131. package/lib/cjs/LocalHub.d.ts.map +1 -1
  132. package/lib/cjs/LocalHub.js +579 -584
  133. package/lib/cjs/LocalHub.js.map +1 -1
  134. package/lib/cjs/LocalhostIpcHost.d.ts +21 -20
  135. package/lib/cjs/LocalhostIpcHost.d.ts.map +1 -1
  136. package/lib/cjs/LocalhostIpcHost.js +79 -81
  137. package/lib/cjs/LocalhostIpcHost.js.map +1 -1
  138. package/lib/cjs/Material.d.ts +131 -131
  139. package/lib/cjs/Material.js +180 -181
  140. package/lib/cjs/Material.js.map +1 -1
  141. package/lib/cjs/Model.d.ts +392 -392
  142. package/lib/cjs/Model.d.ts.map +1 -1
  143. package/lib/cjs/Model.js +489 -485
  144. package/lib/cjs/Model.js.map +1 -1
  145. package/lib/cjs/NativeAppStorage.d.ts +51 -51
  146. package/lib/cjs/NativeAppStorage.js +202 -202
  147. package/lib/cjs/NativeAppStorage.js.map +1 -1
  148. package/lib/cjs/NativeHost.d.ts +52 -52
  149. package/lib/cjs/NativeHost.d.ts.map +1 -1
  150. package/lib/cjs/NativeHost.js +158 -163
  151. package/lib/cjs/NativeHost.js.map +1 -1
  152. package/lib/cjs/NavigationRelationship.d.ts +156 -156
  153. package/lib/cjs/NavigationRelationship.js +225 -225
  154. package/lib/cjs/NavigationRelationship.js.map +1 -1
  155. package/lib/cjs/PromiseMemoizer.d.ts +51 -51
  156. package/lib/cjs/PromiseMemoizer.d.ts.map +1 -1
  157. package/lib/cjs/PromiseMemoizer.js +101 -101
  158. package/lib/cjs/PromiseMemoizer.js.map +1 -1
  159. package/lib/cjs/PropertyStore.d.ts +132 -132
  160. package/lib/cjs/PropertyStore.js +11 -11
  161. package/lib/cjs/Relationship.d.ts +416 -416
  162. package/lib/cjs/Relationship.js +494 -494
  163. package/lib/cjs/Relationship.js.map +1 -1
  164. package/lib/cjs/RpcBackend.d.ts +5 -5
  165. package/lib/cjs/RpcBackend.js +32 -32
  166. package/lib/cjs/SQLiteDb.d.ts +219 -219
  167. package/lib/cjs/SQLiteDb.js +212 -214
  168. package/lib/cjs/SQLiteDb.js.map +1 -1
  169. package/lib/cjs/Schema.d.ts +55 -55
  170. package/lib/cjs/Schema.js +83 -83
  171. package/lib/cjs/Schema.js.map +1 -1
  172. package/lib/cjs/ServerBasedLocks.d.ts +57 -57
  173. package/lib/cjs/ServerBasedLocks.js +168 -168
  174. package/lib/cjs/ServerBasedLocks.js.map +1 -1
  175. package/lib/cjs/SqliteStatement.d.ts +360 -360
  176. package/lib/cjs/SqliteStatement.d.ts.map +1 -1
  177. package/lib/cjs/SqliteStatement.js +586 -586
  178. package/lib/cjs/Texture.d.ts +58 -58
  179. package/lib/cjs/Texture.js +82 -82
  180. package/lib/cjs/Texture.js.map +1 -1
  181. package/lib/cjs/TileStorage.d.ts +44 -18
  182. package/lib/cjs/TileStorage.d.ts.map +1 -1
  183. package/lib/cjs/TileStorage.js +109 -90
  184. package/lib/cjs/TileStorage.js.map +1 -1
  185. package/lib/cjs/TxnManager.d.ts +202 -202
  186. package/lib/cjs/TxnManager.d.ts.map +1 -1
  187. package/lib/cjs/TxnManager.js +356 -356
  188. package/lib/cjs/TxnManager.js.map +1 -1
  189. package/lib/cjs/ViewDefinition.d.ts +435 -439
  190. package/lib/cjs/ViewDefinition.d.ts.map +1 -1
  191. package/lib/cjs/ViewDefinition.js +646 -646
  192. package/lib/cjs/ViewDefinition.js.map +1 -1
  193. package/lib/cjs/ViewStateHydrator.d.ts +13 -13
  194. package/lib/cjs/ViewStateHydrator.js +103 -103
  195. package/lib/cjs/core-backend.d.ts +183 -184
  196. package/lib/cjs/core-backend.d.ts.map +1 -1
  197. package/lib/cjs/core-backend.js +207 -204
  198. package/lib/cjs/core-backend.js.map +1 -1
  199. package/lib/cjs/domains/FunctionalElements.d.ts +101 -101
  200. package/lib/cjs/domains/FunctionalElements.js +145 -145
  201. package/lib/cjs/domains/FunctionalElements.js.map +1 -1
  202. package/lib/cjs/domains/FunctionalSchema.d.ts +13 -13
  203. package/lib/cjs/domains/FunctionalSchema.d.ts.map +1 -1
  204. package/lib/cjs/domains/FunctionalSchema.js +39 -40
  205. package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
  206. package/lib/cjs/domains/GenericElements.d.ts +177 -177
  207. package/lib/cjs/domains/GenericElements.js +263 -263
  208. package/lib/cjs/domains/GenericSchema.d.ts +10 -10
  209. package/lib/cjs/domains/GenericSchema.js +28 -28
  210. package/lib/cjs/rpc/multipart.d.ts +11 -11
  211. package/lib/cjs/rpc/multipart.js +71 -71
  212. package/lib/cjs/rpc/tracing.d.ts +28 -28
  213. package/lib/cjs/rpc/tracing.js +73 -74
  214. package/lib/cjs/rpc/tracing.js.map +1 -1
  215. package/lib/cjs/rpc/web/logging.d.ts +9 -9
  216. package/lib/cjs/rpc/web/logging.js +43 -43
  217. package/lib/cjs/rpc/web/request.d.ts +6 -6
  218. package/lib/cjs/rpc/web/request.js +73 -74
  219. package/lib/cjs/rpc/web/request.js.map +1 -1
  220. package/lib/cjs/rpc/web/response.d.ts +6 -6
  221. package/lib/cjs/rpc/web/response.js +105 -106
  222. package/lib/cjs/rpc/web/response.js.map +1 -1
  223. package/lib/cjs/rpc-impl/DevToolsRpcImpl.d.ts +15 -15
  224. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js +32 -32
  225. package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts +47 -47
  226. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +293 -294
  227. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  228. package/lib/cjs/rpc-impl/IModelTileRpcImpl.d.ts +20 -22
  229. package/lib/cjs/rpc-impl/IModelTileRpcImpl.d.ts.map +1 -1
  230. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js +190 -205
  231. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  232. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts +36 -36
  233. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js +166 -168
  234. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  235. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.d.ts +16 -16
  236. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js +42 -43
  237. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  238. package/lib/cjs/rpc-impl/WipRpcImpl.d.ts +15 -15
  239. package/lib/cjs/rpc-impl/WipRpcImpl.js +37 -37
  240. package/lib/cjs/workspace/Settings.d.ts +186 -186
  241. package/lib/cjs/workspace/Settings.d.ts.map +1 -1
  242. package/lib/cjs/workspace/Settings.js +154 -155
  243. package/lib/cjs/workspace/Settings.js.map +1 -1
  244. package/lib/cjs/workspace/SettingsSchemas.d.ts +75 -75
  245. package/lib/cjs/workspace/SettingsSchemas.js +190 -191
  246. package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
  247. package/lib/cjs/workspace/Workspace.d.ts +411 -414
  248. package/lib/cjs/workspace/Workspace.d.ts.map +1 -1
  249. package/lib/cjs/workspace/Workspace.js +521 -543
  250. package/lib/cjs/workspace/Workspace.js.map +1 -1
  251. package/package.json +22 -24
  252. package/lib/cjs/AliCloudStorageService.d.ts +0 -24
  253. package/lib/cjs/AliCloudStorageService.d.ts.map +0 -1
  254. package/lib/cjs/AliCloudStorageService.js +0 -72
  255. package/lib/cjs/AliCloudStorageService.js.map +0 -1
  256. package/lib/cjs/CloudStorageBackend.d.ts +0 -59
  257. package/lib/cjs/CloudStorageBackend.d.ts.map +0 -1
  258. package/lib/cjs/CloudStorageBackend.js +0 -174
  259. package/lib/cjs/CloudStorageBackend.js.map +0 -1
@@ -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
- /** Look up the Id of the CodeSpec with the specified name. */
25
- queryId(name) {
26
- return this._imodel.withPreparedStatement("SELECT ECInstanceId FROM BisCore.CodeSpec WHERE Name=:name", (stmt) => {
27
- stmt.bindString("name", name);
28
- if (core_bentley_1.DbResult.BE_SQLITE_ROW !== stmt.step())
29
- throw new core_common_1.IModelError(core_bentley_1.IModelStatus.NotFound, "CodeSpec not found", () => ({ name }));
30
- return stmt.getValue(0).getId();
31
- });
32
- }
33
- /** Look up a CodeSpec by Id. The CodeSpec will be loaded from the database if necessary.
34
- * @param codeSpecId The Id of the CodeSpec to load
35
- * @returns The CodeSpec with the specified Id
36
- * @throws [[IModelError]] if the Id is invalid or if no CodeSpec with that Id could be found.
37
- */
38
- getById(codeSpecId) {
39
- if (core_bentley_1.Id64.isInvalid(codeSpecId))
40
- throw new core_common_1.IModelError(core_bentley_1.IModelStatus.InvalidId, "Invalid codeSpecId");
41
- // good chance it is already loaded - check there before running a query
42
- const found = this._loadedCodeSpecs.find((codeSpec) => codeSpec.id === codeSpecId);
43
- if (found !== undefined)
44
- return found;
45
- // must load this codespec
46
- const loadedCodeSpec = this.load(codeSpecId);
47
- this._loadedCodeSpecs.push(loadedCodeSpec);
48
- return loadedCodeSpec;
49
- }
50
- /** Returns true if the IModelDb has a CodeSpec of the specified Id. */
51
- hasId(codeSpecId) {
52
- try {
53
- return undefined !== this.getById(codeSpecId);
54
- }
55
- catch (error) {
56
- return false;
57
- }
58
- }
59
- /** Look up a CodeSpec by name. The CodeSpec will be loaded from the database if necessary.
60
- * @param name The name of the CodeSpec to load
61
- * @returns The CodeSpec with the specified name
62
- * @throws [[IModelError]] if no CodeSpec with the specified name could be found.
63
- */
64
- getByName(name) {
65
- // good chance it is already loaded - check there before running a query
66
- const found = this._loadedCodeSpecs.find((codeSpec) => codeSpec.name === name);
67
- if (found !== undefined)
68
- return found;
69
- const codeSpecId = this.queryId(name);
70
- if (codeSpecId === undefined)
71
- throw new core_common_1.IModelError(core_bentley_1.IModelStatus.NotFound, "CodeSpec not found", () => ({ name }));
72
- return this.getById(codeSpecId);
73
- }
74
- /** Returns true if the IModelDb has a CodeSpec of the specified name. */
75
- hasName(name) {
76
- try {
77
- return undefined !== this.getByName(name);
78
- }
79
- catch (error) {
80
- return false;
81
- }
82
- }
83
- insert(codeSpecOrName, scopeType) {
84
- if (codeSpecOrName instanceof core_common_1.CodeSpec) {
85
- const codeSpec = codeSpecOrName;
86
- const id = this._imodel.insertCodeSpec(codeSpec);
87
- codeSpec.id = id;
88
- return id;
89
- }
90
- if (typeof codeSpecOrName === "string") {
91
- const name = codeSpecOrName;
92
- if (scopeType)
93
- return this._imodel.insertCodeSpec(core_common_1.CodeSpec.create(this._imodel, name, scopeType));
94
- }
95
- throw new core_common_1.IModelError(core_bentley_1.IModelStatus.BadArg, "Invalid argument");
96
- }
97
- /** Update the Json properties of an existing CodeSpec.
98
- * @param codeSpec The codeSpec holding Json properties values to update
99
- * @throws if unable to update the codeSpec.
100
- */
101
- updateProperties(codeSpec) {
102
- this._imodel.withPreparedSqliteStatement("UPDATE bis_CodeSpec SET JsonProperties=? WHERE Id=?", (stmt) => {
103
- stmt.bindString(1, JSON.stringify(codeSpec.properties));
104
- stmt.bindId(2, codeSpec.id);
105
- if (core_bentley_1.DbResult.BE_SQLITE_DONE !== stmt.step())
106
- throw new core_common_1.IModelError(core_bentley_1.IModelStatus.BadArg, "error updating CodeSpec properties");
107
- });
108
- }
109
- /** Load a CodeSpec from the iModel
110
- * @param id The persistent Id of the CodeSpec to load
111
- */
112
- load(id) {
113
- if (core_bentley_1.Id64.isInvalid(id))
114
- throw new core_common_1.IModelError(core_bentley_1.IModelStatus.InvalidId, "Invalid codeSpecId");
115
- return this._imodel.withPreparedStatement("SELECT name,jsonProperties FROM BisCore.CodeSpec WHERE ECInstanceId=?", (stmt) => {
116
- stmt.bindId(1, id);
117
- if (core_bentley_1.DbResult.BE_SQLITE_ROW !== stmt.step())
118
- throw new core_common_1.IModelError(core_bentley_1.IModelStatus.InvalidId, "Invalid codeSpecId");
119
- const row = stmt.getRow();
120
- return core_common_1.CodeSpec.createFromJson(this._imodel, id, row.name, JSON.parse(row.jsonProperties));
121
- });
122
- }
123
- }
124
- exports.CodeSpecs = CodeSpecs;
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.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
@@ -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,CA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AAI,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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,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,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.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 declare 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
- }
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,oBAAY,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
+ {"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,EAAkB,MAAM,oBAAoB,CAAC;AAG7G,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"}
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"}