@itwin/core-backend 3.4.4 → 3.4.5

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 (226) hide show
  1. package/CHANGELOG.md +6 -1
  2. package/lib/cjs/AliCloudStorageService.d.ts +23 -23
  3. package/lib/cjs/AliCloudStorageService.js +71 -71
  4. package/lib/cjs/AliCloudStorageService.js.map +1 -1
  5. package/lib/cjs/BackendHubAccess.d.ts +224 -224
  6. package/lib/cjs/BackendHubAccess.js +41 -41
  7. package/lib/cjs/BackendHubAccess.js.map +1 -1
  8. package/lib/cjs/BackendLoggerCategory.d.ts +91 -91
  9. package/lib/cjs/BackendLoggerCategory.js +99 -99
  10. package/lib/cjs/BackendLoggerCategory.js.map +1 -1
  11. package/lib/cjs/BisCoreSchema.d.ts +21 -21
  12. package/lib/cjs/BisCoreSchema.js +60 -60
  13. package/lib/cjs/BisCoreSchema.js.map +1 -1
  14. package/lib/cjs/BriefcaseManager.d.ts +165 -165
  15. package/lib/cjs/BriefcaseManager.js +405 -405
  16. package/lib/cjs/BriefcaseManager.js.map +1 -1
  17. package/lib/cjs/Category.d.ts +153 -153
  18. package/lib/cjs/Category.js +243 -243
  19. package/lib/cjs/Category.js.map +1 -1
  20. package/lib/cjs/ChangeSummaryManager.d.ts +187 -187
  21. package/lib/cjs/ChangeSummaryManager.js +445 -445
  22. package/lib/cjs/ChangeSummaryManager.js.map +1 -1
  23. package/lib/cjs/ChangedElementsDb.d.ts +99 -99
  24. package/lib/cjs/ChangedElementsDb.js +165 -165
  25. package/lib/cjs/ChangedElementsDb.js.map +1 -1
  26. package/lib/cjs/ChangedElementsManager.d.ts +39 -39
  27. package/lib/cjs/ChangedElementsManager.js +88 -88
  28. package/lib/cjs/ChangedElementsManager.js.map +1 -1
  29. package/lib/cjs/CheckpointManager.d.ts +120 -120
  30. package/lib/cjs/CheckpointManager.js +343 -343
  31. package/lib/cjs/CheckpointManager.js.map +1 -1
  32. package/lib/cjs/ClassRegistry.d.ts +79 -79
  33. package/lib/cjs/ClassRegistry.js +249 -249
  34. package/lib/cjs/ClassRegistry.js.map +1 -1
  35. package/lib/cjs/CloudSqlite.d.ts +349 -349
  36. package/lib/cjs/CloudSqlite.js +151 -151
  37. package/lib/cjs/CloudSqlite.js.map +1 -1
  38. package/lib/cjs/CloudStorageBackend.d.ts +58 -58
  39. package/lib/cjs/CloudStorageBackend.js +173 -173
  40. package/lib/cjs/CloudStorageBackend.js.map +1 -1
  41. package/lib/cjs/CodeService.d.ts +396 -396
  42. package/lib/cjs/CodeService.js +63 -63
  43. package/lib/cjs/CodeService.js.map +1 -1
  44. package/lib/cjs/CodeSpecs.d.ts +50 -50
  45. package/lib/cjs/CodeSpecs.js +112 -112
  46. package/lib/cjs/CodeSpecs.js.map +1 -1
  47. package/lib/cjs/ConcurrentQuery.d.ts +11 -11
  48. package/lib/cjs/ConcurrentQuery.js +30 -30
  49. package/lib/cjs/ConcurrentQuery.js.map +1 -1
  50. package/lib/cjs/CustomViewState3dCreator.d.ts +21 -21
  51. package/lib/cjs/CustomViewState3dCreator.js +81 -81
  52. package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
  53. package/lib/cjs/DevTools.d.ts +71 -71
  54. package/lib/cjs/DevTools.js +154 -154
  55. package/lib/cjs/DevTools.js.map +1 -1
  56. package/lib/cjs/DisplayStyle.d.ts +106 -106
  57. package/lib/cjs/DisplayStyle.js +256 -256
  58. package/lib/cjs/DisplayStyle.js.map +1 -1
  59. package/lib/cjs/ECDb.d.ts +191 -191
  60. package/lib/cjs/ECDb.js +350 -350
  61. package/lib/cjs/ECDb.js.map +1 -1
  62. package/lib/cjs/ECSchemaXmlContext.d.ts +18 -18
  63. package/lib/cjs/ECSchemaXmlContext.js +41 -41
  64. package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
  65. package/lib/cjs/ECSqlStatement.d.ts +466 -466
  66. package/lib/cjs/ECSqlStatement.js +791 -791
  67. package/lib/cjs/ECSqlStatement.js.map +1 -1
  68. package/lib/cjs/Element.d.ts +1120 -1120
  69. package/lib/cjs/Element.js +1438 -1438
  70. package/lib/cjs/Element.js.map +1 -1
  71. package/lib/cjs/ElementAspect.d.ts +161 -161
  72. package/lib/cjs/ElementAspect.js +187 -187
  73. package/lib/cjs/ElementAspect.js.map +1 -1
  74. package/lib/cjs/ElementGraphics.d.ts +9 -9
  75. package/lib/cjs/ElementGraphics.js +41 -41
  76. package/lib/cjs/ElementGraphics.js.map +1 -1
  77. package/lib/cjs/ElementTreeWalker.d.ts +162 -162
  78. package/lib/cjs/ElementTreeWalker.js +409 -409
  79. package/lib/cjs/ElementTreeWalker.js.map +1 -1
  80. package/lib/cjs/Entity.d.ts +106 -106
  81. package/lib/cjs/Entity.js +134 -134
  82. package/lib/cjs/Entity.js.map +1 -1
  83. package/lib/cjs/EntityReferences.d.ts +45 -45
  84. package/lib/cjs/EntityReferences.js +91 -91
  85. package/lib/cjs/EntityReferences.js.map +1 -1
  86. package/lib/cjs/ExportGraphics.d.ts +317 -317
  87. package/lib/cjs/ExportGraphics.js +208 -208
  88. package/lib/cjs/ExportGraphics.js.map +1 -1
  89. package/lib/cjs/ExternalSource.d.ts +96 -96
  90. package/lib/cjs/ExternalSource.js +131 -131
  91. package/lib/cjs/ExternalSource.js.map +1 -1
  92. package/lib/cjs/GeoCoordConfig.d.ts +19 -19
  93. package/lib/cjs/GeoCoordConfig.js +82 -82
  94. package/lib/cjs/GeoCoordConfig.js.map +1 -1
  95. package/lib/cjs/GeometrySummary.d.ts +4 -4
  96. package/lib/cjs/GeometrySummary.js +380 -380
  97. package/lib/cjs/GeometrySummary.js.map +1 -1
  98. package/lib/cjs/HubMock.d.ts +93 -93
  99. package/lib/cjs/HubMock.js +190 -190
  100. package/lib/cjs/HubMock.js.map +1 -1
  101. package/lib/cjs/IModelCloneContext.d.ts +89 -89
  102. package/lib/cjs/IModelCloneContext.js +159 -159
  103. package/lib/cjs/IModelCloneContext.js.map +1 -1
  104. package/lib/cjs/IModelDb.d.ts +1180 -1180
  105. package/lib/cjs/IModelDb.js +2371 -2371
  106. package/lib/cjs/IModelDb.js.map +1 -1
  107. package/lib/cjs/IModelHost.d.ts +361 -361
  108. package/lib/cjs/IModelHost.js +489 -489
  109. package/lib/cjs/IModelHost.js.map +1 -1
  110. package/lib/cjs/IModelJsFs.d.ts +62 -62
  111. package/lib/cjs/IModelJsFs.js +140 -140
  112. package/lib/cjs/IModelJsFs.js.map +1 -1
  113. package/lib/cjs/IpcHost.d.ts +98 -98
  114. package/lib/cjs/IpcHost.js +234 -234
  115. package/lib/cjs/IpcHost.js.map +1 -1
  116. package/lib/cjs/LineStyle.d.ts +311 -311
  117. package/lib/cjs/LineStyle.js +295 -295
  118. package/lib/cjs/LineStyle.js.map +1 -1
  119. package/lib/cjs/LocalHub.d.ts +162 -162
  120. package/lib/cjs/LocalHub.js +587 -587
  121. package/lib/cjs/LocalHub.js.map +1 -1
  122. package/lib/cjs/LocalhostIpcHost.d.ts +20 -20
  123. package/lib/cjs/LocalhostIpcHost.js +81 -81
  124. package/lib/cjs/LocalhostIpcHost.js.map +1 -1
  125. package/lib/cjs/Material.d.ts +103 -103
  126. package/lib/cjs/Material.js +147 -147
  127. package/lib/cjs/Material.js.map +1 -1
  128. package/lib/cjs/Model.d.ts +392 -392
  129. package/lib/cjs/Model.js +485 -485
  130. package/lib/cjs/Model.js.map +1 -1
  131. package/lib/cjs/NativeAppStorage.d.ts +51 -51
  132. package/lib/cjs/NativeAppStorage.js +202 -202
  133. package/lib/cjs/NativeAppStorage.js.map +1 -1
  134. package/lib/cjs/NativeHost.d.ts +52 -52
  135. package/lib/cjs/NativeHost.js +168 -168
  136. package/lib/cjs/NativeHost.js.map +1 -1
  137. package/lib/cjs/NavigationRelationship.d.ts +156 -156
  138. package/lib/cjs/NavigationRelationship.js +225 -225
  139. package/lib/cjs/NavigationRelationship.js.map +1 -1
  140. package/lib/cjs/PromiseMemoizer.d.ts +51 -51
  141. package/lib/cjs/PromiseMemoizer.js +101 -101
  142. package/lib/cjs/PromiseMemoizer.js.map +1 -1
  143. package/lib/cjs/PropertyStore.d.ts +132 -132
  144. package/lib/cjs/PropertyStore.js +11 -11
  145. package/lib/cjs/PropertyStore.js.map +1 -1
  146. package/lib/cjs/Relationship.d.ts +416 -416
  147. package/lib/cjs/Relationship.js +494 -494
  148. package/lib/cjs/Relationship.js.map +1 -1
  149. package/lib/cjs/RpcBackend.d.ts +28 -28
  150. package/lib/cjs/RpcBackend.js +126 -126
  151. package/lib/cjs/RpcBackend.js.map +1 -1
  152. package/lib/cjs/SQLiteDb.d.ts +219 -219
  153. package/lib/cjs/SQLiteDb.js +214 -214
  154. package/lib/cjs/SQLiteDb.js.map +1 -1
  155. package/lib/cjs/Schema.d.ts +55 -55
  156. package/lib/cjs/Schema.js +83 -83
  157. package/lib/cjs/Schema.js.map +1 -1
  158. package/lib/cjs/ServerBasedLocks.d.ts +57 -57
  159. package/lib/cjs/ServerBasedLocks.js +168 -168
  160. package/lib/cjs/ServerBasedLocks.js.map +1 -1
  161. package/lib/cjs/SqliteStatement.d.ts +283 -283
  162. package/lib/cjs/SqliteStatement.js +448 -448
  163. package/lib/cjs/SqliteStatement.js.map +1 -1
  164. package/lib/cjs/Texture.d.ts +58 -58
  165. package/lib/cjs/Texture.js +82 -82
  166. package/lib/cjs/Texture.js.map +1 -1
  167. package/lib/cjs/TileStorage.d.ts +18 -18
  168. package/lib/cjs/TileStorage.js +90 -90
  169. package/lib/cjs/TileStorage.js.map +1 -1
  170. package/lib/cjs/TxnManager.d.ts +202 -202
  171. package/lib/cjs/TxnManager.js +356 -356
  172. package/lib/cjs/TxnManager.js.map +1 -1
  173. package/lib/cjs/ViewDefinition.d.ts +439 -439
  174. package/lib/cjs/ViewDefinition.js +646 -646
  175. package/lib/cjs/ViewDefinition.js.map +1 -1
  176. package/lib/cjs/ViewStateHydrator.d.ts +13 -13
  177. package/lib/cjs/ViewStateHydrator.js +103 -103
  178. package/lib/cjs/ViewStateHydrator.js.map +1 -1
  179. package/lib/cjs/assets/IModelChange.02.00.00.ecschema.xml +90 -90
  180. package/lib/cjs/assets/Settings/Schemas/Cloud.Schema.json +67 -67
  181. package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +31 -31
  182. package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +52 -52
  183. package/lib/cjs/assets/Settings/backend.setting.json5 +138 -138
  184. package/lib/cjs/core-backend.d.ts +183 -183
  185. package/lib/cjs/core-backend.js +203 -203
  186. package/lib/cjs/core-backend.js.map +1 -1
  187. package/lib/cjs/domains/FunctionalElements.d.ts +101 -101
  188. package/lib/cjs/domains/FunctionalElements.js +145 -145
  189. package/lib/cjs/domains/FunctionalElements.js.map +1 -1
  190. package/lib/cjs/domains/FunctionalSchema.d.ts +13 -13
  191. package/lib/cjs/domains/FunctionalSchema.js +40 -40
  192. package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
  193. package/lib/cjs/domains/GenericElements.d.ts +177 -177
  194. package/lib/cjs/domains/GenericElements.js +263 -263
  195. package/lib/cjs/domains/GenericElements.js.map +1 -1
  196. package/lib/cjs/domains/GenericSchema.d.ts +10 -10
  197. package/lib/cjs/domains/GenericSchema.js +28 -28
  198. package/lib/cjs/domains/GenericSchema.js.map +1 -1
  199. package/lib/cjs/rpc-impl/DevToolsRpcImpl.d.ts +15 -15
  200. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js +32 -32
  201. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -1
  202. package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts +46 -46
  203. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +287 -287
  204. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  205. package/lib/cjs/rpc-impl/IModelTileRpcImpl.d.ts +22 -22
  206. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js +202 -202
  207. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  208. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts +36 -36
  209. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js +168 -168
  210. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  211. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.d.ts +16 -16
  212. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js +43 -43
  213. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  214. package/lib/cjs/rpc-impl/WipRpcImpl.d.ts +15 -15
  215. package/lib/cjs/rpc-impl/WipRpcImpl.js +37 -37
  216. package/lib/cjs/rpc-impl/WipRpcImpl.js.map +1 -1
  217. package/lib/cjs/workspace/Settings.d.ts +186 -186
  218. package/lib/cjs/workspace/Settings.js +155 -155
  219. package/lib/cjs/workspace/Settings.js.map +1 -1
  220. package/lib/cjs/workspace/SettingsSchemas.d.ts +75 -75
  221. package/lib/cjs/workspace/SettingsSchemas.js +191 -191
  222. package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
  223. package/lib/cjs/workspace/Workspace.d.ts +414 -414
  224. package/lib/cjs/workspace/Workspace.js +543 -543
  225. package/lib/cjs/workspace/Workspace.js.map +1 -1
  226. package/package.json +12 -12
@@ -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,CAA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SACtF;QACD,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IACjE,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;AAxHD,8BAwHC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Codes\n */\n\nimport { DbResult, Id64, Id64String, IModelStatus } from \"@itwin/core-bentley\";\nimport { CodeScopeSpec, CodeSpec, IModelError } from \"@itwin/core-common\";\nimport { ECSqlStatement } from \"./ECSqlStatement\";\nimport { IModelDb } from \"./IModelDb\";\n\n/** Manages [CodeSpecs]($docs/BIS/guide/fundamentals/element-fundamentals.md#codespec) within an [[IModelDb]]\n * @public\n */\nexport class CodeSpecs {\n private _imodel: IModelDb;\n private _loadedCodeSpecs: CodeSpec[] = [];\n\n constructor(imodel: IModelDb) {\n this._imodel = imodel;\n if (imodel.isBriefcaseDb()) {\n imodel.onChangesetApplied.addListener(() => this._loadedCodeSpecs.length = 0);\n }\n }\n\n /** Look up the Id of the CodeSpec with the specified name. */\n public queryId(name: string): Id64String {\n return this._imodel.withPreparedStatement(\"SELECT ECInstanceId FROM BisCore.CodeSpec WHERE Name=:name\", (stmt: ECSqlStatement) => {\n stmt.bindString(\"name\", name);\n if (DbResult.BE_SQLITE_ROW !== stmt.step())\n throw new IModelError(IModelStatus.NotFound, \"CodeSpec not found\", () => ({ name }));\n return stmt.getValue(0).getId();\n });\n }\n\n /** Look up a CodeSpec by Id. The CodeSpec will be loaded from the database if necessary.\n * @param codeSpecId The Id of the CodeSpec to load\n * @returns The CodeSpec with the specified Id\n * @throws [[IModelError]] if the Id is invalid or if no CodeSpec with that Id could be found.\n */\n public getById(codeSpecId: Id64String): CodeSpec {\n if (Id64.isInvalid(codeSpecId))\n throw new IModelError(IModelStatus.InvalidId, \"Invalid codeSpecId\");\n\n // good chance it is already loaded - check there before running a query\n const found = this._loadedCodeSpecs.find((codeSpec) => codeSpec.id === codeSpecId);\n if (found !== undefined)\n return found;\n\n // must load this codespec\n const loadedCodeSpec = this.load(codeSpecId);\n this._loadedCodeSpecs.push(loadedCodeSpec);\n return loadedCodeSpec;\n }\n\n /** Returns true if the IModelDb has a CodeSpec of the specified Id. */\n public hasId(codeSpecId: Id64String): boolean {\n try {\n return undefined !== this.getById(codeSpecId);\n } catch (error) {\n return false;\n }\n }\n\n /** Look up a CodeSpec by name. The CodeSpec will be loaded from the database if necessary.\n * @param name The name of the CodeSpec to load\n * @returns The CodeSpec with the specified name\n * @throws [[IModelError]] if no CodeSpec with the specified name could be found.\n */\n public getByName(name: string): CodeSpec {\n // good chance it is already loaded - check there before running a query\n const found: CodeSpec | undefined = this._loadedCodeSpecs.find((codeSpec) => codeSpec.name === name);\n if (found !== undefined)\n return found;\n const codeSpecId = this.queryId(name);\n if (codeSpecId === undefined)\n throw new IModelError(IModelStatus.NotFound, \"CodeSpec not found\", () => ({ name }));\n return this.getById(codeSpecId);\n }\n\n /** Returns true if the IModelDb has a CodeSpec of the specified name. */\n public hasName(name: string): boolean {\n try {\n return undefined !== this.getByName(name);\n } catch (error) {\n return false;\n }\n }\n\n /** Add a new CodeSpec to the iModel.\n * @param codeSpec The CodeSpec to insert\n * @returns The Id of the persistent CodeSpec.\n * @note If successful, this method will assign a valid CodeSpecId to the supplied CodeSpec\n * @throws IModelError if the insertion fails\n */\n public insert(codeSpec: CodeSpec): Id64String;\n /** Add a new CodeSpec to the IModelDb.\n * @param name The name for the new CodeSpec.\n * @param scopeType The scope type\n * @returns The Id of the persistent CodeSpec.\n * @throws IModelError if the insertion fails\n */\n public insert(name: string, scopeType: CodeScopeSpec.Type): Id64String;\n public insert(codeSpecOrName: CodeSpec | string, scopeType?: CodeScopeSpec.Type): Id64String {\n if (codeSpecOrName instanceof CodeSpec) {\n const codeSpec = codeSpecOrName;\n const id: Id64String = this._imodel.insertCodeSpec(codeSpec);\n codeSpec.id = id;\n return id;\n }\n if (typeof codeSpecOrName === \"string\") {\n const name = codeSpecOrName;\n if (scopeType)\n return this._imodel.insertCodeSpec(CodeSpec.create(this._imodel, name, scopeType));\n }\n throw new IModelError(IModelStatus.BadArg, \"Invalid argument\");\n }\n\n /** Load a CodeSpec from the iModel\n * @param id The persistent Id of the CodeSpec to load\n */\n public load(id: Id64String): CodeSpec {\n if (Id64.isInvalid(id))\n throw new IModelError(IModelStatus.InvalidId, \"Invalid codeSpecId\");\n\n return this._imodel.withPreparedStatement(\"SELECT name,jsonProperties FROM BisCore.CodeSpec WHERE ECInstanceId=?\", (stmt: ECSqlStatement) => {\n stmt.bindId(1, id);\n if (DbResult.BE_SQLITE_ROW !== stmt.step())\n throw new IModelError(IModelStatus.InvalidId, \"Invalid codeSpecId\");\n\n const row: any = stmt.getRow();\n return CodeSpec.createFromJson(this._imodel, id, row.name, JSON.parse(row.jsonProperties));\n });\n }\n}\n"]}
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,IAAI,uBAAQ,CAAC,aAAa,KAAK,IAAI,CAAC,IAAI,EAAE;gBACxC,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,QAAQ,EAAE,oBAAoB,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;YACvF,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;QAClC,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACI,OAAO,CAAC,UAAsB;QACnC,IAAI,mBAAI,CAAC,SAAS,CAAC,UAAU,CAAC;YAC5B,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;QAEtE,wEAAwE;QACxE,MAAM,KAAK,GAAG,IAAI,CAAC,gBAA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AK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC;QAC7F,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAxHD,8BAwHC","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 /** 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,12 +1,12 @@
1
- import { IModelJsNative } from "@bentley/imodeljs-native";
2
- import { DbBlobRequest, DbBlobResponse, 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
- }
1
+ import { IModelJsNative } from "@bentley/imodeljs-native";
2
+ import { DbBlobRequest, DbBlobResponse, 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
+ }
12
12
  //# sourceMappingURL=ConcurrentQuery.d.ts.map
@@ -1,31 +1,31 @@
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
- }
30
- 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
+ }
30
+ exports.ConcurrentQuery = ConcurrentQuery;
31
31
  //# sourceMappingURL=ConcurrentQuery.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ConcurrentQuery.js","sourceRoot":"","sources":["../../src/ConcurrentQuery.ts"],"names":[],"mappings":";;;AACA;;;+FAG+F;AAC/F,oDAAmH;AAKnH,gBAAgB;AAChB,MAAa,eAAe;IAC1B,gBAAgB;IACT,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,IAAgD,EAAE,OAAuB;QAC/G,OAAO,IAAI,OAAO,CAAkB,CAAC,OAAO,EAAE,EAAE;YAC9C,OAAO,CAAC,IAAI,GAAG,2BAAa,CAAC,KAAK,CAAC;YACnC,IAAI,CAAC,sBAAsB,CAAC,OAAc,EAAE,CAAC,QAAa,EAAE,EAAE;gBAC5D,OAAO,CAAC,QAA2B,CAAC,CAAC;YACvC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IACD,gBAAgB;IACT,MAAM,CAAC,KAAK,CAAC,kBAAkB,CAAC,IAAgD,EAAE,OAAsB;QAC7G,OAAO,IAAI,OAAO,CAAiB,CAAC,OAAO,EAAE,EAAE;YAC7C,OAAO,CAAC,IAAI,GAAG,2BAAa,CAAC,MAAM,CAAC;YACpC,IAAI,CAAC,sBAAsB,CAAC,OAAc,EAAE,CAAC,QAAa,EAAE,EAAE;gBAC5D,OAAO,CAAC,QAA0B,CAAC,CAAC;YACtC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAnBD,0CAmBC","sourcesContent":["import { IModelJsNative } from \"@bentley/imodeljs-native\";\n/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { DbBlobRequest, DbBlobResponse, DbQueryRequest, DbQueryResponse, DbRequestKind } from \"@itwin/core-common\";\n\n/** @internal */\nexport type OnResponse = (response: Response) => void;\n\n/** @internal */\nexport class ConcurrentQuery {\n /** @internal */\n public static async executeQueryRequest(conn: IModelJsNative.ECDb | IModelJsNative.DgnDb, request: DbQueryRequest): Promise<DbQueryResponse> {\n return new Promise<DbQueryResponse>((resolve) => {\n request.kind = DbRequestKind.ECSql;\n conn.concurrentQueryExecute(request as any, (response: any) => {\n resolve(response as DbQueryResponse);\n });\n });\n }\n /** @internal */\n public static async executeBlobRequest(conn: IModelJsNative.ECDb | IModelJsNative.DgnDb, request: DbBlobRequest): Promise<DbBlobResponse> {\n return new Promise<DbBlobResponse>((resolve) => {\n request.kind = DbRequestKind.BlobIO;\n conn.concurrentQueryExecute(request as any, (response: any) => {\n resolve(response as DbBlobResponse);\n });\n });\n }\n}\n"]}
1
+ {"version":3,"file":"ConcurrentQuery.js","sourceRoot":"","sources":["../../src/ConcurrentQuery.ts"],"names":[],"mappings":";;;AACA;;;+FAG+F;AAC/F,oDAAmH;AAKnH,gBAAgB;AAChB,MAAa,eAAe;IAC1B,gBAAgB;IACT,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,IAAgD,EAAE,OAAuB;QAC/G,OAAO,IAAI,OAAO,CAAkB,CAAC,OAAO,EAAE,EAAE;YAC9C,OAAO,CAAC,IAAI,GAAG,2BAAa,CAAC,KAAK,CAAC;YACnC,IAAI,CAAC,sBAAsB,CAAC,OAAc,EAAE,CAAC,QAAa,EAAE,EAAE;gBAC5D,OAAO,CAAC,QAA2B,CAAC,CAAC;YACvC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IACD,gBAAgB;IACT,MAAM,CAAC,KAAK,CAAC,kBAAkB,CAAC,IAAgD,EAAE,OAAsB;QAC7G,OAAO,IAAI,OAAO,CAAiB,CAAC,OAAO,EAAE,EAAE;YAC7C,OAAO,CAAC,IAAI,GAAG,2BAAa,CAAC,MAAM,CAAC;YACpC,IAAI,CAAC,sBAAsB,CAAC,OAAc,EAAE,CAAC,QAAa,EAAE,EAAE;gBAC5D,OAAO,CAAC,QAA0B,CAAC,CAAC;YACtC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAnBD,0CAmBC","sourcesContent":["import { IModelJsNative } from \"@bentley/imodeljs-native\";\r\n/*---------------------------------------------------------------------------------------------\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\nimport { DbBlobRequest, DbBlobResponse, DbQueryRequest, DbQueryResponse, DbRequestKind } from \"@itwin/core-common\";\r\n\r\n/** @internal */\r\nexport type OnResponse = (response: Response) => void;\r\n\r\n/** @internal */\r\nexport class ConcurrentQuery {\r\n /** @internal */\r\n public static async executeQueryRequest(conn: IModelJsNative.ECDb | IModelJsNative.DgnDb, request: DbQueryRequest): Promise<DbQueryResponse> {\r\n return new Promise<DbQueryResponse>((resolve) => {\r\n request.kind = DbRequestKind.ECSql;\r\n conn.concurrentQueryExecute(request as any, (response: any) => {\r\n resolve(response as DbQueryResponse);\r\n });\r\n });\r\n }\r\n /** @internal */\r\n public static async executeBlobRequest(conn: IModelJsNative.ECDb | IModelJsNative.DgnDb, request: DbBlobRequest): Promise<DbBlobResponse> {\r\n return new Promise<DbBlobResponse>((resolve) => {\r\n request.kind = DbRequestKind.BlobIO;\r\n conn.concurrentQueryExecute(request as any, (response: any) => {\r\n resolve(response as DbBlobResponse);\r\n });\r\n });\r\n }\r\n}\r\n"]}
@@ -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,82 +1,82 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.CustomViewState3dCreator = void 0;
8
- const core_bentley_1 = require("@itwin/core-bentley");
9
- const core_common_1 = require("@itwin/core-common");
10
- const core_geometry_1 = require("@itwin/core-geometry");
11
- const BackendLoggerCategory_1 = require("./BackendLoggerCategory");
12
- const loggerCategory = BackendLoggerCategory_1.BackendLoggerCategory.CustomViewState3dCreator;
13
- /**
14
- * Class which helps to generate a custom ViewState3d.
15
- * @internal
16
- */
17
- class CustomViewState3dCreator {
18
- constructor(iModel) {
19
- this._executeQuery = async (query) => {
20
- const rows = [];
21
- for await (const row of this._imodel.query(query, undefined, { rowFormat: core_common_1.QueryRowFormat.UseJsPropertyNames }))
22
- rows.push(row.id);
23
- return rows;
24
- };
25
- this._imodel = iModel;
26
- }
27
- /** 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.
28
- * @param [modelIds] Ids of models to display in the view.
29
- * @throws [IModelError]($common) If no 3d models are found in the iModel.
30
- */
31
- async getCustomViewState3dData(options) {
32
- let decompressedModelIds;
33
- if ((options === null || options === void 0 ? void 0 : options.modelIds) !== undefined)
34
- decompressedModelIds = core_bentley_1.CompressedId64Set.decompressArray(options.modelIds);
35
- const models = decompressedModelIds !== null && decompressedModelIds !== void 0 ? decompressedModelIds : await this._getAllModels();
36
- const categories = await this._getAllCategories();
37
- const modelExtents = await this._getModelExtents(models);
38
- return {
39
- modelIds: core_bentley_1.CompressedId64Set.sortAndCompress(models),
40
- categoryIds: core_bentley_1.CompressedId64Set.sortAndCompress(categories),
41
- modelExtents: modelExtents.toJSON(),
42
- };
43
- }
44
- async _getAllCategories() {
45
- // Only use categories with elements in them
46
- core_bentley_1.Logger.logInfo(loggerCategory, "Starting getAllCategories query.");
47
- const query = `SELECT DISTINCT Category.Id AS id FROM BisCore.GeometricElement3d WHERE Category.Id IN (SELECT ECInstanceId FROM BisCore.SpatialCategory)`;
48
- const categories = await this._executeQuery(query);
49
- core_bentley_1.Logger.logInfo(loggerCategory, "Finished getAllCategories query.");
50
- return categories;
51
- }
52
- /** Compute the union of the extents of all the specified models. */
53
- async _getModelExtents(modelIds) {
54
- if (modelIds.length === 0)
55
- return new core_geometry_1.Range3d();
56
- const timer = new core_bentley_1.StopWatch("getModelExtents query", true);
57
- const range = await this._imodel.models.queryRange(modelIds);
58
- timer.stop();
59
- core_bentley_1.Logger.logInfo(loggerCategory, "Finished getModelExtents query.", { timeElapsedMs: timer.elapsed });
60
- return range;
61
- }
62
- /** Get the Ids of all spatially-located, non-template 3d models in the iModel. */
63
- async _getAllModels() {
64
- // Note: IsNotSpatiallyLocated was introduced in a later version of the BisCore ECSchema.
65
- // If the iModel has an earlier version, the statement will throw because the property does not exist.
66
- // If the iModel was created from an earlier version and later upgraded to a newer version, the property may be NULL for models created prior to the upgrade.
67
- const select = "SELECT ECInstanceId FROM Bis.GeometricModel3D WHERE IsPrivate = false AND IsTemplate = false";
68
- const spatialCriterion = "AND (IsNotSpatiallyLocated IS NULL OR IsNotSpatiallyLocated = false)";
69
- let models = [];
70
- core_bentley_1.Logger.logInfo(loggerCategory, "Starting getAllModels query.");
71
- try {
72
- models = await this._executeQuery(`${select} ${spatialCriterion}`);
73
- }
74
- catch {
75
- models = await this._executeQuery(select);
76
- }
77
- core_bentley_1.Logger.logInfo(loggerCategory, "Finished getAllModels query.");
78
- return models;
79
- }
80
- }
81
- exports.CustomViewState3dCreator = CustomViewState3dCreator;
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
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.CustomViewState3dCreator = void 0;
8
+ const core_bentley_1 = require("@itwin/core-bentley");
9
+ const core_common_1 = require("@itwin/core-common");
10
+ const core_geometry_1 = require("@itwin/core-geometry");
11
+ const BackendLoggerCategory_1 = require("./BackendLoggerCategory");
12
+ const loggerCategory = BackendLoggerCategory_1.BackendLoggerCategory.CustomViewState3dCreator;
13
+ /**
14
+ * Class which helps to generate a custom ViewState3d.
15
+ * @internal
16
+ */
17
+ class CustomViewState3dCreator {
18
+ constructor(iModel) {
19
+ this._executeQuery = async (query) => {
20
+ const rows = [];
21
+ for await (const row of this._imodel.query(query, undefined, { rowFormat: core_common_1.QueryRowFormat.UseJsPropertyNames }))
22
+ rows.push(row.id);
23
+ return rows;
24
+ };
25
+ this._imodel = iModel;
26
+ }
27
+ /** 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.
28
+ * @param [modelIds] Ids of models to display in the view.
29
+ * @throws [IModelError]($common) If no 3d models are found in the iModel.
30
+ */
31
+ async getCustomViewState3dData(options) {
32
+ let decompressedModelIds;
33
+ if ((options === null || options === void 0 ? void 0 : options.modelIds) !== undefined)
34
+ decompressedModelIds = core_bentley_1.CompressedId64Set.decompressArray(options.modelIds);
35
+ const models = decompressedModelIds !== null && decompressedModelIds !== void 0 ? decompressedModelIds : await this._getAllModels();
36
+ const categories = await this._getAllCategories();
37
+ const modelExtents = await this._getModelExtents(models);
38
+ return {
39
+ modelIds: core_bentley_1.CompressedId64Set.sortAndCompress(models),
40
+ categoryIds: core_bentley_1.CompressedId64Set.sortAndCompress(categories),
41
+ modelExtents: modelExtents.toJSON(),
42
+ };
43
+ }
44
+ async _getAllCategories() {
45
+ // Only use categories with elements in them
46
+ core_bentley_1.Logger.logInfo(loggerCategory, "Starting getAllCategories query.");
47
+ const query = `SELECT DISTINCT Category.Id AS id FROM BisCore.GeometricElement3d WHERE Category.Id IN (SELECT ECInstanceId FROM BisCore.SpatialCategory)`;
48
+ const categories = await this._executeQuery(query);
49
+ core_bentley_1.Logger.logInfo(loggerCategory, "Finished getAllCategories query.");
50
+ return categories;
51
+ }
52
+ /** Compute the union of the extents of all the specified models. */
53
+ async _getModelExtents(modelIds) {
54
+ if (modelIds.length === 0)
55
+ return new core_geometry_1.Range3d();
56
+ const timer = new core_bentley_1.StopWatch("getModelExtents query", true);
57
+ const range = await this._imodel.models.queryRange(modelIds);
58
+ timer.stop();
59
+ core_bentley_1.Logger.logInfo(loggerCategory, "Finished getModelExtents query.", { timeElapsedMs: timer.elapsed });
60
+ return range;
61
+ }
62
+ /** Get the Ids of all spatially-located, non-template 3d models in the iModel. */
63
+ async _getAllModels() {
64
+ // Note: IsNotSpatiallyLocated was introduced in a later version of the BisCore ECSchema.
65
+ // If the iModel has an earlier version, the statement will throw because the property does not exist.
66
+ // If the iModel was created from an earlier version and later upgraded to a newer version, the property may be NULL for models created prior to the upgrade.
67
+ const select = "SELECT ECInstanceId FROM Bis.GeometricModel3D WHERE IsPrivate = false AND IsTemplate = false";
68
+ const spatialCriterion = "AND (IsNotSpatiallyLocated IS NULL OR IsNotSpatiallyLocated = false)";
69
+ let models = [];
70
+ core_bentley_1.Logger.logInfo(loggerCategory, "Starting getAllModels query.");
71
+ try {
72
+ models = await this._executeQuery(`${select} ${spatialCriterion}`);
73
+ }
74
+ catch {
75
+ models = await this._executeQuery(select);
76
+ }
77
+ core_bentley_1.Logger.logInfo(loggerCategory, "Finished getAllModels query.");
78
+ return models;
79
+ }
80
+ }
81
+ exports.CustomViewState3dCreator = CustomViewState3dCreator;
82
82
  //# sourceMappingURL=CustomViewState3dCreator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CustomViewState3dCreator.js","sourceRoot":"","sources":["../../src/CustomViewState3dCreator.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,sDAAkG;AAClG,oDAA6G;AAC7G,wDAA+C;AAC/C,mEAAgE;AAGhE,MAAM,cAAc,GAAG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Ac,EAAE,8BAA8B,CAAC,CAAC;QAC/D,OAAO,MAAM,CAAC;IAChB,CAAC;CASF;AA1ED,4DA0EC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport { CompressedId64Set, Id64Array, Id64String, Logger, StopWatch } from \"@itwin/core-bentley\";\nimport { CustomViewState3dCreatorOptions, CustomViewState3dProps, QueryRowFormat } from \"@itwin/core-common\";\nimport { Range3d } from \"@itwin/core-geometry\";\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\nimport { IModelDb } from \"./IModelDb\";\n\nconst loggerCategory = BackendLoggerCategory.CustomViewState3dCreator;\n\n/**\n * Class which helps to generate a custom ViewState3d.\n * @internal\n */\nexport class CustomViewState3dCreator {\n private _imodel: IModelDb;\n public constructor(iModel: IModelDb) {\n this._imodel = iModel;\n }\n /** 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.\n * @param [modelIds] Ids of models to display in the view.\n * @throws [IModelError]($common) If no 3d models are found in the iModel.\n */\n public async getCustomViewState3dData(options: CustomViewState3dCreatorOptions): Promise<CustomViewState3dProps> {\n let decompressedModelIds;\n if (options?.modelIds !== undefined)\n decompressedModelIds = CompressedId64Set.decompressArray(options.modelIds);\n\n const models: Id64Array = decompressedModelIds ?? await this._getAllModels();\n const categories: Id64Array = await this._getAllCategories();\n const modelExtents: Range3d = await this._getModelExtents(models);\n return {\n modelIds: CompressedId64Set.sortAndCompress(models),\n categoryIds: CompressedId64Set.sortAndCompress(categories),\n modelExtents: modelExtents.toJSON(),\n };\n }\n\n private async _getAllCategories(): Promise<Id64Array> {\n // Only use categories with elements in them\n Logger.logInfo(loggerCategory, \"Starting getAllCategories query.\");\n const query = `SELECT DISTINCT Category.Id AS id FROM BisCore.GeometricElement3d WHERE Category.Id IN (SELECT ECInstanceId FROM BisCore.SpatialCategory)`;\n const categories: Id64Array = await this._executeQuery(query);\n Logger.logInfo(loggerCategory, \"Finished getAllCategories query.\");\n return categories;\n }\n\n /** Compute the union of the extents of all the specified models. */\n private async _getModelExtents(modelIds: Id64String[]): Promise<Range3d> {\n if (modelIds.length === 0)\n return new Range3d();\n\n const timer = new StopWatch(\"getModelExtents query\", true);\n const range = await this._imodel.models.queryRange(modelIds);\n\n timer.stop();\n Logger.logInfo(loggerCategory, \"Finished getModelExtents query.\", {timeElapsedMs: timer.elapsed});\n\n return range;\n }\n\n /** Get the Ids of all spatially-located, non-template 3d models in the iModel. */\n private async _getAllModels(): Promise<Id64Array> {\n // Note: IsNotSpatiallyLocated was introduced in a later version of the BisCore ECSchema.\n // If the iModel has an earlier version, the statement will throw because the property does not exist.\n // If the iModel was created from an earlier version and later upgraded to a newer version, the property may be NULL for models created prior to the upgrade.\n const select = \"SELECT ECInstanceId FROM Bis.GeometricModel3D WHERE IsPrivate = false AND IsTemplate = false\";\n const spatialCriterion = \"AND (IsNotSpatiallyLocated IS NULL OR IsNotSpatiallyLocated = false)\";\n\n let models = [];\n Logger.logInfo(loggerCategory, \"Starting getAllModels query.\");\n try {\n models = await this._executeQuery(`${select} ${spatialCriterion}`);\n } catch {\n models = await this._executeQuery(select);\n }\n\n Logger.logInfo(loggerCategory, \"Finished getAllModels query.\");\n return models;\n }\n\n private _executeQuery = async (query: string) => {\n const rows = [];\n for await (const row of this._imodel.query(query, undefined, { rowFormat: QueryRowFormat.UseJsPropertyNames }))\n rows.push(row.id);\n\n return rows;\n };\n}\n"]}
1
+ {"version":3,"file":"CustomViewState3dCreator.js","sourceRoot":"","sources":["../../src/CustomViewState3dCreator.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,sDAAkG;AAClG,oDAA6G;AAC7G,wDAA+C;AAC/C,mEAAgE;AAGhE,MAAM,cAAc,GAAG,6CAAqB,CAAC,wBAAwB,CAAC;AAEtE;;;GAGG;AACH,MAAa,wBAAwB;IAEnC,Y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A1ED,4DA0EC","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\r\nimport { CompressedId64Set, Id64Array, Id64String, Logger, StopWatch } from \"@itwin/core-bentley\";\r\nimport { CustomViewState3dCreatorOptions, CustomViewState3dProps, QueryRowFormat } from \"@itwin/core-common\";\r\nimport { Range3d } from \"@itwin/core-geometry\";\r\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\r\nimport { IModelDb } from \"./IModelDb\";\r\n\r\nconst loggerCategory = BackendLoggerCategory.CustomViewState3dCreator;\r\n\r\n/**\r\n * Class which helps to generate a custom ViewState3d.\r\n * @internal\r\n */\r\nexport class CustomViewState3dCreator {\r\n private _imodel: IModelDb;\r\n public constructor(iModel: IModelDb) {\r\n this._imodel = iModel;\r\n }\r\n /** 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.\r\n * @param [modelIds] Ids of models to display in the view.\r\n * @throws [IModelError]($common) If no 3d models are found in the iModel.\r\n */\r\n public async getCustomViewState3dData(options: CustomViewState3dCreatorOptions): Promise<CustomViewState3dProps> {\r\n let decompressedModelIds;\r\n if (options?.modelIds !== undefined)\r\n decompressedModelIds = CompressedId64Set.decompressArray(options.modelIds);\r\n\r\n const models: Id64Array = decompressedModelIds ?? await this._getAllModels();\r\n const categories: Id64Array = await this._getAllCategories();\r\n const modelExtents: Range3d = await this._getModelExtents(models);\r\n return {\r\n modelIds: CompressedId64Set.sortAndCompress(models),\r\n categoryIds: CompressedId64Set.sortAndCompress(categories),\r\n modelExtents: modelExtents.toJSON(),\r\n };\r\n }\r\n\r\n private async _getAllCategories(): Promise<Id64Array> {\r\n // Only use categories with elements in them\r\n Logger.logInfo(loggerCategory, \"Starting getAllCategories query.\");\r\n const query = `SELECT DISTINCT Category.Id AS id FROM BisCore.GeometricElement3d WHERE Category.Id IN (SELECT ECInstanceId FROM BisCore.SpatialCategory)`;\r\n const categories: Id64Array = await this._executeQuery(query);\r\n Logger.logInfo(loggerCategory, \"Finished getAllCategories query.\");\r\n return categories;\r\n }\r\n\r\n /** Compute the union of the extents of all the specified models. */\r\n private async _getModelExtents(modelIds: Id64String[]): Promise<Range3d> {\r\n if (modelIds.length === 0)\r\n return new Range3d();\r\n\r\n const timer = new StopWatch(\"getModelExtents query\", true);\r\n const range = await this._imodel.models.queryRange(modelIds);\r\n\r\n timer.stop();\r\n Logger.logInfo(loggerCategory, \"Finished getModelExtents query.\", {timeElapsedMs: timer.elapsed});\r\n\r\n return range;\r\n }\r\n\r\n /** Get the Ids of all spatially-located, non-template 3d models in the iModel. */\r\n private async _getAllModels(): Promise<Id64Array> {\r\n // Note: IsNotSpatiallyLocated was introduced in a later version of the BisCore ECSchema.\r\n // If the iModel has an earlier version, the statement will throw because the property does not exist.\r\n // If the iModel was created from an earlier version and later upgraded to a newer version, the property may be NULL for models created prior to the upgrade.\r\n const select = \"SELECT ECInstanceId FROM Bis.GeometricModel3D WHERE IsPrivate = false AND IsTemplate = false\";\r\n const spatialCriterion = \"AND (IsNotSpatiallyLocated IS NULL OR IsNotSpatiallyLocated = false)\";\r\n\r\n let models = [];\r\n Logger.logInfo(loggerCategory, \"Starting getAllModels query.\");\r\n try {\r\n models = await this._executeQuery(`${select} ${spatialCriterion}`);\r\n } catch {\r\n models = await this._executeQuery(select);\r\n }\r\n\r\n Logger.logInfo(loggerCategory, \"Finished getAllModels query.\");\r\n return models;\r\n }\r\n\r\n private _executeQuery = async (query: string) => {\r\n const rows = [];\r\n for await (const row of this._imodel.query(query, undefined, { rowFormat: QueryRowFormat.UseJsPropertyNames }))\r\n rows.push(row.id);\r\n\r\n return rows;\r\n };\r\n}\r\n"]}
@@ -1,72 +1,72 @@
1
- /// <reference types="node" />
2
- import * as os from "os";
3
- import { LogLevel } from "@itwin/core-bentley";
4
- /**
5
- * Performance and Memory statistics of backend
6
- * @internal
7
- */
8
- export interface DevToolsStats {
9
- os: DevToolsOsStats;
10
- process: DevToolsProcessStats;
11
- }
12
- /**
13
- * OS stats of backend
14
- * @internal
15
- */
16
- export interface DevToolsOsStats {
17
- platform: NodeJS.Platform;
18
- hostname: string;
19
- totalmem: number;
20
- freemem: number;
21
- uptime: number;
22
- cpus: os.CpuInfo[];
23
- cpuUsage: number;
24
- }
25
- /**
26
- * Process stats of backend
27
- * @internal
28
- */
29
- export interface DevToolsProcessStats {
30
- uptime: number;
31
- pid: number;
32
- ppid: number;
33
- memoryUsage: NodeJS.MemoryUsage;
34
- }
35
- /** Utility to format the JSON created by DevTools.stats() to include the appropriate units
36
- * @internal
37
- */
38
- export declare class DevToolsStatsFormatter {
39
- private static readonly _megaByteProps;
40
- private static readonly _percentProps;
41
- private static readonly _mHzProps;
42
- private static readonly _secondsProps;
43
- /** Replacer that includes units - can be used with JSON.stringify() */
44
- private static _replacer;
45
- /** Converts the input stats to another JSON object with the appropriate units setup for various fields */
46
- static toFormattedJson(stats: any): any;
47
- }
48
- /**
49
- * Internal diagnostic utility
50
- * @internal
51
- */
52
- export declare class DevTools {
53
- /** Receives a ping and returns true */
54
- static ping(): boolean;
55
- private static hrtimeToMS;
56
- private static bytesToMegaBytes;
57
- private static evaluateCpuUsage;
58
- private static evaluateCpus;
59
- private static evaluateMemoryUsage;
60
- private static evaluateProcessStats;
61
- private static evaluateOsStats;
62
- /** Returns JSON object with backend statistics */
63
- static stats(): DevToolsStats;
64
- /** Sets up a log level at the backend and returns the old log level */
65
- static setLogLevel(inLoggerCategory: string, newLevel: LogLevel): LogLevel | undefined;
66
- /** Obtains the backend application and iTwin.js Core versions */
67
- static versions(): {
68
- application: string;
69
- iTwinJs: any;
70
- };
71
- }
1
+ /// <reference types="node" />
2
+ import * as os from "os";
3
+ import { LogLevel } from "@itwin/core-bentley";
4
+ /**
5
+ * Performance and Memory statistics of backend
6
+ * @internal
7
+ */
8
+ export interface DevToolsStats {
9
+ os: DevToolsOsStats;
10
+ process: DevToolsProcessStats;
11
+ }
12
+ /**
13
+ * OS stats of backend
14
+ * @internal
15
+ */
16
+ export interface DevToolsOsStats {
17
+ platform: NodeJS.Platform;
18
+ hostname: string;
19
+ totalmem: number;
20
+ freemem: number;
21
+ uptime: number;
22
+ cpus: os.CpuInfo[];
23
+ cpuUsage: number;
24
+ }
25
+ /**
26
+ * Process stats of backend
27
+ * @internal
28
+ */
29
+ export interface DevToolsProcessStats {
30
+ uptime: number;
31
+ pid: number;
32
+ ppid: number;
33
+ memoryUsage: NodeJS.MemoryUsage;
34
+ }
35
+ /** Utility to format the JSON created by DevTools.stats() to include the appropriate units
36
+ * @internal
37
+ */
38
+ export declare class DevToolsStatsFormatter {
39
+ private static readonly _megaByteProps;
40
+ private static readonly _percentProps;
41
+ private static readonly _mHzProps;
42
+ private static readonly _secondsProps;
43
+ /** Replacer that includes units - can be used with JSON.stringify() */
44
+ private static _replacer;
45
+ /** Converts the input stats to another JSON object with the appropriate units setup for various fields */
46
+ static toFormattedJson(stats: any): any;
47
+ }
48
+ /**
49
+ * Internal diagnostic utility
50
+ * @internal
51
+ */
52
+ export declare class DevTools {
53
+ /** Receives a ping and returns true */
54
+ static ping(): boolean;
55
+ private static hrtimeToMS;
56
+ private static bytesToMegaBytes;
57
+ private static evaluateCpuUsage;
58
+ private static evaluateCpus;
59
+ private static evaluateMemoryUsage;
60
+ private static evaluateProcessStats;
61
+ private static evaluateOsStats;
62
+ /** Returns JSON object with backend statistics */
63
+ static stats(): DevToolsStats;
64
+ /** Sets up a log level at the backend and returns the old log level */
65
+ static setLogLevel(inLoggerCategory: string, newLevel: LogLevel): LogLevel | undefined;
66
+ /** Obtains the backend application and iTwin.js Core versions */
67
+ static versions(): {
68
+ application: string;
69
+ iTwinJs: any;
70
+ };
71
+ }
72
72
  //# sourceMappingURL=DevTools.d.ts.map