@itwin/core-backend 3.6.0-dev.51 → 3.6.0-dev.53

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 (252) hide show
  1. package/lib/cjs/AliCloudStorageService.d.ts +23 -23
  2. package/lib/cjs/AliCloudStorageService.js +71 -71
  3. package/lib/cjs/AliCloudStorageService.js.map +1 -1
  4. package/lib/cjs/BackendHubAccess.d.ts +224 -224
  5. package/lib/cjs/BackendHubAccess.js +41 -41
  6. package/lib/cjs/BackendHubAccess.js.map +1 -1
  7. package/lib/cjs/BackendLoggerCategory.d.ts +91 -91
  8. package/lib/cjs/BackendLoggerCategory.js +99 -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/BisCoreSchema.js.map +1 -1
  13. package/lib/cjs/BriefcaseManager.d.ts +170 -170
  14. package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
  15. package/lib/cjs/BriefcaseManager.js +414 -413
  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 +447 -447
  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 +121 -121
  30. package/lib/cjs/CheckpointManager.js +349 -349
  31. package/lib/cjs/CheckpointManager.js.map +1 -1
  32. package/lib/cjs/ClassRegistry.d.ts +79 -79
  33. package/lib/cjs/ClassRegistry.d.ts.map +1 -1
  34. package/lib/cjs/ClassRegistry.js +250 -249
  35. package/lib/cjs/ClassRegistry.js.map +1 -1
  36. package/lib/cjs/CloudSqlite.d.ts +350 -350
  37. package/lib/cjs/CloudSqlite.js +153 -153
  38. package/lib/cjs/CloudSqlite.js.map +1 -1
  39. package/lib/cjs/CloudStorageBackend.d.ts +58 -58
  40. package/lib/cjs/CloudStorageBackend.js +173 -173
  41. package/lib/cjs/CloudStorageBackend.js.map +1 -1
  42. package/lib/cjs/CodeService.d.ts +396 -396
  43. package/lib/cjs/CodeService.js +63 -63
  44. package/lib/cjs/CodeService.js.map +1 -1
  45. package/lib/cjs/CodeSpecs.d.ts +55 -55
  46. package/lib/cjs/CodeSpecs.js +124 -124
  47. package/lib/cjs/CodeSpecs.js.map +1 -1
  48. package/lib/cjs/ConcurrentQuery.d.ts +13 -13
  49. package/lib/cjs/ConcurrentQuery.js +36 -36
  50. package/lib/cjs/ConcurrentQuery.js.map +1 -1
  51. package/lib/cjs/CustomViewState3dCreator.d.ts +21 -21
  52. package/lib/cjs/CustomViewState3dCreator.js +81 -81
  53. package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
  54. package/lib/cjs/DevTools.d.ts +71 -71
  55. package/lib/cjs/DevTools.js +154 -154
  56. package/lib/cjs/DevTools.js.map +1 -1
  57. package/lib/cjs/DisplayStyle.d.ts +106 -106
  58. package/lib/cjs/DisplayStyle.js +256 -256
  59. package/lib/cjs/DisplayStyle.js.map +1 -1
  60. package/lib/cjs/ECDb.d.ts +191 -191
  61. package/lib/cjs/ECDb.js +350 -350
  62. package/lib/cjs/ECDb.js.map +1 -1
  63. package/lib/cjs/ECSchemaXmlContext.d.ts +18 -18
  64. package/lib/cjs/ECSchemaXmlContext.js +41 -41
  65. package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
  66. package/lib/cjs/ECSqlStatement.d.ts +473 -473
  67. package/lib/cjs/ECSqlStatement.js +791 -791
  68. package/lib/cjs/ECSqlStatement.js.map +1 -1
  69. package/lib/cjs/Element.d.ts +1102 -1102
  70. package/lib/cjs/Element.js +1416 -1416
  71. package/lib/cjs/Element.js.map +1 -1
  72. package/lib/cjs/ElementAspect.d.ts +179 -179
  73. package/lib/cjs/ElementAspect.d.ts.map +1 -1
  74. package/lib/cjs/ElementAspect.js +211 -211
  75. package/lib/cjs/ElementAspect.js.map +1 -1
  76. package/lib/cjs/ElementGraphics.d.ts +9 -9
  77. package/lib/cjs/ElementGraphics.js +41 -41
  78. package/lib/cjs/ElementGraphics.js.map +1 -1
  79. package/lib/cjs/ElementTreeWalker.d.ts +162 -162
  80. package/lib/cjs/ElementTreeWalker.js +409 -409
  81. package/lib/cjs/ElementTreeWalker.js.map +1 -1
  82. package/lib/cjs/Entity.d.ts +106 -106
  83. package/lib/cjs/Entity.js +134 -134
  84. package/lib/cjs/Entity.js.map +1 -1
  85. package/lib/cjs/EntityReferences.d.ts +49 -49
  86. package/lib/cjs/EntityReferences.js +95 -95
  87. package/lib/cjs/EntityReferences.js.map +1 -1
  88. package/lib/cjs/ExportGraphics.d.ts +317 -317
  89. package/lib/cjs/ExportGraphics.js +208 -208
  90. package/lib/cjs/ExportGraphics.js.map +1 -1
  91. package/lib/cjs/ExternalSource.d.ts +96 -96
  92. package/lib/cjs/ExternalSource.js +131 -131
  93. package/lib/cjs/ExternalSource.js.map +1 -1
  94. package/lib/cjs/GeoCoordConfig.d.ts +19 -19
  95. package/lib/cjs/GeoCoordConfig.js +85 -85
  96. package/lib/cjs/GeoCoordConfig.js.map +1 -1
  97. package/lib/cjs/GeometrySummary.d.ts +4 -4
  98. package/lib/cjs/GeometrySummary.js +380 -380
  99. package/lib/cjs/GeometrySummary.js.map +1 -1
  100. package/lib/cjs/HubMock.d.ts +94 -94
  101. package/lib/cjs/HubMock.js +222 -222
  102. package/lib/cjs/HubMock.js.map +1 -1
  103. package/lib/cjs/IModelCloneContext.d.ts +8 -8
  104. package/lib/cjs/IModelCloneContext.d.ts.map +1 -1
  105. package/lib/cjs/IModelCloneContext.js +15 -15
  106. package/lib/cjs/IModelCloneContext.js.map +1 -1
  107. package/lib/cjs/IModelDb.d.ts +1192 -1183
  108. package/lib/cjs/IModelDb.d.ts.map +1 -1
  109. package/lib/cjs/IModelDb.js +2388 -2374
  110. package/lib/cjs/IModelDb.js.map +1 -1
  111. package/lib/cjs/IModelElementCloneContext.d.ts +89 -89
  112. package/lib/cjs/IModelElementCloneContext.js +159 -159
  113. package/lib/cjs/IModelElementCloneContext.js.map +1 -1
  114. package/lib/cjs/IModelHost.d.ts +369 -369
  115. package/lib/cjs/IModelHost.d.ts.map +1 -1
  116. package/lib/cjs/IModelHost.js +496 -496
  117. package/lib/cjs/IModelHost.js.map +1 -1
  118. package/lib/cjs/IModelJsFs.d.ts +62 -62
  119. package/lib/cjs/IModelJsFs.js +140 -140
  120. package/lib/cjs/IModelJsFs.js.map +1 -1
  121. package/lib/cjs/IpcHost.d.ts +104 -104
  122. package/lib/cjs/IpcHost.js +278 -278
  123. package/lib/cjs/IpcHost.js.map +1 -1
  124. package/lib/cjs/LineStyle.d.ts +311 -311
  125. package/lib/cjs/LineStyle.js +295 -295
  126. package/lib/cjs/LineStyle.js.map +1 -1
  127. package/lib/cjs/LocalHub.d.ts +162 -162
  128. package/lib/cjs/LocalHub.d.ts.map +1 -1
  129. package/lib/cjs/LocalHub.js +585 -587
  130. package/lib/cjs/LocalHub.js.map +1 -1
  131. package/lib/cjs/LocalhostIpcHost.d.ts +20 -20
  132. package/lib/cjs/LocalhostIpcHost.js +81 -81
  133. package/lib/cjs/LocalhostIpcHost.js.map +1 -1
  134. package/lib/cjs/Material.d.ts +131 -103
  135. package/lib/cjs/Material.d.ts.map +1 -1
  136. package/lib/cjs/Material.js +181 -147
  137. package/lib/cjs/Material.js.map +1 -1
  138. package/lib/cjs/Model.d.ts +392 -392
  139. package/lib/cjs/Model.js +485 -485
  140. package/lib/cjs/Model.js.map +1 -1
  141. package/lib/cjs/NativeAppStorage.d.ts +51 -51
  142. package/lib/cjs/NativeAppStorage.js +202 -202
  143. package/lib/cjs/NativeAppStorage.js.map +1 -1
  144. package/lib/cjs/NativeHost.d.ts +52 -52
  145. package/lib/cjs/NativeHost.js +163 -163
  146. package/lib/cjs/NativeHost.js.map +1 -1
  147. package/lib/cjs/NavigationRelationship.d.ts +156 -156
  148. package/lib/cjs/NavigationRelationship.js +225 -225
  149. package/lib/cjs/NavigationRelationship.js.map +1 -1
  150. package/lib/cjs/PromiseMemoizer.d.ts +51 -51
  151. package/lib/cjs/PromiseMemoizer.js +101 -101
  152. package/lib/cjs/PromiseMemoizer.js.map +1 -1
  153. package/lib/cjs/PropertyStore.d.ts +132 -132
  154. package/lib/cjs/PropertyStore.js +11 -11
  155. package/lib/cjs/PropertyStore.js.map +1 -1
  156. package/lib/cjs/Relationship.d.ts +416 -416
  157. package/lib/cjs/Relationship.js +494 -494
  158. package/lib/cjs/Relationship.js.map +1 -1
  159. package/lib/cjs/RpcBackend.d.ts +5 -5
  160. package/lib/cjs/RpcBackend.js +31 -31
  161. package/lib/cjs/RpcBackend.js.map +1 -1
  162. package/lib/cjs/SQLiteDb.d.ts +219 -219
  163. package/lib/cjs/SQLiteDb.js +214 -214
  164. package/lib/cjs/SQLiteDb.js.map +1 -1
  165. package/lib/cjs/Schema.d.ts +55 -55
  166. package/lib/cjs/Schema.js +83 -83
  167. package/lib/cjs/Schema.js.map +1 -1
  168. package/lib/cjs/ServerBasedLocks.d.ts +57 -57
  169. package/lib/cjs/ServerBasedLocks.js +168 -168
  170. package/lib/cjs/ServerBasedLocks.js.map +1 -1
  171. package/lib/cjs/SqliteStatement.d.ts +360 -360
  172. package/lib/cjs/SqliteStatement.js +586 -586
  173. package/lib/cjs/SqliteStatement.js.map +1 -1
  174. package/lib/cjs/Texture.d.ts +58 -58
  175. package/lib/cjs/Texture.js +82 -82
  176. package/lib/cjs/Texture.js.map +1 -1
  177. package/lib/cjs/TileStorage.d.ts +18 -18
  178. package/lib/cjs/TileStorage.js +90 -90
  179. package/lib/cjs/TileStorage.js.map +1 -1
  180. package/lib/cjs/TxnManager.d.ts +202 -202
  181. package/lib/cjs/TxnManager.js +356 -356
  182. package/lib/cjs/TxnManager.js.map +1 -1
  183. package/lib/cjs/ViewDefinition.d.ts +439 -439
  184. package/lib/cjs/ViewDefinition.js +646 -646
  185. package/lib/cjs/ViewDefinition.js.map +1 -1
  186. package/lib/cjs/ViewStateHydrator.d.ts +13 -13
  187. package/lib/cjs/ViewStateHydrator.js +103 -103
  188. package/lib/cjs/ViewStateHydrator.js.map +1 -1
  189. package/lib/cjs/assets/IModelChange.02.00.00.ecschema.xml +90 -90
  190. package/lib/cjs/assets/Settings/Schemas/Cloud.Schema.json +67 -67
  191. package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +31 -31
  192. package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +52 -52
  193. package/lib/cjs/assets/Settings/backend.setting.json5 +138 -138
  194. package/lib/cjs/core-backend.d.ts +184 -184
  195. package/lib/cjs/core-backend.js +204 -204
  196. package/lib/cjs/core-backend.js.map +1 -1
  197. package/lib/cjs/domains/FunctionalElements.d.ts +101 -101
  198. package/lib/cjs/domains/FunctionalElements.js +145 -145
  199. package/lib/cjs/domains/FunctionalElements.js.map +1 -1
  200. package/lib/cjs/domains/FunctionalSchema.d.ts +13 -13
  201. package/lib/cjs/domains/FunctionalSchema.d.ts.map +1 -1
  202. package/lib/cjs/domains/FunctionalSchema.js +40 -40
  203. package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
  204. package/lib/cjs/domains/GenericElements.d.ts +177 -177
  205. package/lib/cjs/domains/GenericElements.js +263 -263
  206. package/lib/cjs/domains/GenericElements.js.map +1 -1
  207. package/lib/cjs/domains/GenericSchema.d.ts +10 -10
  208. package/lib/cjs/domains/GenericSchema.js +28 -28
  209. package/lib/cjs/domains/GenericSchema.js.map +1 -1
  210. package/lib/cjs/rpc/multipart.d.ts +11 -11
  211. package/lib/cjs/rpc/multipart.js +70 -70
  212. package/lib/cjs/rpc/multipart.js.map +1 -1
  213. package/lib/cjs/rpc/tracing.d.ts +28 -28
  214. package/lib/cjs/rpc/tracing.js +73 -73
  215. package/lib/cjs/rpc/tracing.js.map +1 -1
  216. package/lib/cjs/rpc/web/logging.d.ts +9 -9
  217. package/lib/cjs/rpc/web/logging.js +42 -42
  218. package/lib/cjs/rpc/web/logging.js.map +1 -1
  219. package/lib/cjs/rpc/web/request.d.ts +6 -6
  220. package/lib/cjs/rpc/web/request.js +73 -73
  221. package/lib/cjs/rpc/web/request.js.map +1 -1
  222. package/lib/cjs/rpc/web/response.d.ts +6 -6
  223. package/lib/cjs/rpc/web/response.js +105 -105
  224. package/lib/cjs/rpc/web/response.js.map +1 -1
  225. package/lib/cjs/rpc-impl/DevToolsRpcImpl.d.ts +15 -15
  226. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js +32 -32
  227. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -1
  228. package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts +47 -47
  229. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +291 -291
  230. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  231. package/lib/cjs/rpc-impl/IModelTileRpcImpl.d.ts +22 -22
  232. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js +202 -202
  233. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  234. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts +36 -36
  235. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js +168 -168
  236. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  237. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.d.ts +16 -16
  238. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js +43 -43
  239. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  240. package/lib/cjs/rpc-impl/WipRpcImpl.d.ts +15 -15
  241. package/lib/cjs/rpc-impl/WipRpcImpl.js +37 -37
  242. package/lib/cjs/rpc-impl/WipRpcImpl.js.map +1 -1
  243. package/lib/cjs/workspace/Settings.d.ts +186 -186
  244. package/lib/cjs/workspace/Settings.js +155 -155
  245. package/lib/cjs/workspace/Settings.js.map +1 -1
  246. package/lib/cjs/workspace/SettingsSchemas.d.ts +75 -75
  247. package/lib/cjs/workspace/SettingsSchemas.js +191 -191
  248. package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
  249. package/lib/cjs/workspace/Workspace.d.ts +414 -414
  250. package/lib/cjs/workspace/Workspace.js +543 -543
  251. package/lib/cjs/workspace/Workspace.js.map +1 -1
  252. package/package.json +12 -12
@@ -1,212 +1,212 @@
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 ElementAspects
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.ExternalSourceAspect = exports.ChannelRootAspect = exports.ElementMultiAspect = exports.ElementUniqueAspect = exports.ElementAspect = void 0;
11
- const core_common_1 = require("@itwin/core-common");
12
- const Entity_1 = require("./Entity");
13
- const core_bentley_1 = require("@itwin/core-bentley");
14
- /** An Element Aspect is a class that defines a set of properties that are related to (and owned by) a single element.
15
- * Semantically, an ElementAspect can be considered part of the Element. Thus, an ElementAspect is deleted if its owning Element is deleted.
16
- * BIS Guideline: Subclass ElementUniqueAspect or ElementMultiAspect rather than subclassing ElementAspect directly.
17
- * @public
18
- */
19
- class ElementAspect extends Entity_1.Entity {
20
- /** @internal */
21
- constructor(props, iModel) {
22
- super(props, iModel);
23
- this.element = core_common_1.RelatedElement.fromJSON(props.element); // eslint-disable-line @typescript-eslint/no-non-null-assertion
24
- }
25
- /** @internal */
26
- static get className() { return "ElementAspect"; }
27
- /** @internal */
28
- toJSON() {
29
- const val = super.toJSON();
30
- val.element = this.element;
31
- return val;
32
- }
33
- /** Called before a new ElementAspect is inserted.
34
- * @note throw an exception to disallow the insert
35
- * @note If you override this method, you must call super.
36
- * @beta
37
- */
38
- static onInsert(_arg) { }
39
- /** Called after a new ElementAspect was inserted.
40
- * @note If you override this method, you must call super.
41
- * @beta
42
- */
43
- static onInserted(_arg) { }
44
- /** Called before an ElementAspect is updated.
45
- * @note throw an exception to disallow the update
46
- * @note If you override this method, you must call super.
47
- * @beta
48
- */
49
- static onUpdate(_arg) { }
50
- /** Called after an ElementAspect was updated.
51
- * @note If you override this method, you must call super.
52
- * @beta
53
- */
54
- static onUpdated(_arg) { }
55
- /** Called before an ElementAspect is deleted.
56
- * @note throw an exception to disallow the delete
57
- * @note If you override this method, you must call super.
58
- * @beta
59
- */
60
- static onDelete(_arg) { }
61
- /** Called after an ElementAspect was deleted.
62
- * @note If you override this method, you must call super.
63
- * @beta
64
- */
65
- static onDeleted(_arg) { }
66
- }
67
- exports.ElementAspect = ElementAspect;
68
- /** An Element Unique Aspect is an ElementAspect where there can be only zero or one instance of the Element Aspect class per Element.
69
- * @public
70
- */
71
- class ElementUniqueAspect extends ElementAspect {
72
- /** @internal */
73
- static get className() { return "ElementUniqueAspect"; }
74
- }
75
- exports.ElementUniqueAspect = ElementUniqueAspect;
76
- /** An Element Multi-Aspect is an ElementAspect where there can be **n** instances of the Element Aspect class per Element.
77
- * @public
78
- */
79
- class ElementMultiAspect extends ElementAspect {
80
- /** @internal */
81
- static get className() { return "ElementMultiAspect"; }
82
- }
83
- exports.ElementMultiAspect = ElementMultiAspect;
84
- /** A ChannelRootAspect identifies an Element as the root of a *channel* which is a subset of the overall iModel hierarchy that is independently maintained.
85
- * @note The associated ECClass was added to the BisCore schema in version 1.0.10
86
- * @public
87
- */
88
- class ChannelRootAspect extends ElementUniqueAspect {
89
- /** @internal */
90
- constructor(props, iModel) {
91
- super(props, iModel);
92
- this.owner = props.owner;
93
- }
94
- /** @internal */
95
- static get className() { return "ChannelRootAspect"; }
96
- /** @internal */
97
- toJSON() {
98
- const val = super.toJSON();
99
- val.owner = this.owner;
100
- return val;
101
- }
102
- /** Insert a ChannelRootAspect on the specified element. */
103
- static insert(iModel, ownerId, ownerDescription) {
104
- const props = {
105
- classFullName: ChannelRootAspect.classFullName,
106
- element: { id: ownerId },
107
- owner: ownerDescription,
108
- };
109
- iModel.elements.insertAspect(props);
110
- }
111
- }
112
- exports.ChannelRootAspect = ChannelRootAspect;
113
- /** An ElementMultiAspect that stores synchronization information for an Element originating from an external source.
114
- * @note The associated ECClass was added to the BisCore schema in version 1.0.2
115
- * @public
116
- */
117
- class ExternalSourceAspect extends ElementMultiAspect {
118
- /** @internal */
119
- constructor(props, iModel) {
120
- super(props, iModel);
121
- this.scope = core_common_1.RelatedElement.fromJSON(props.scope); // eslint-disable-line @typescript-eslint/no-non-null-assertion
122
- this.source = core_common_1.RelatedElement.fromJSON(props.source);
123
- this.identifier = props.identifier;
124
- this.kind = props.kind;
125
- this.checksum = props.checksum;
126
- this.version = props.version;
127
- this.jsonProperties = props.jsonProperties;
128
- }
129
- /** @internal */
130
- static get className() { return "ExternalSourceAspect"; }
131
- /** @deprecated findAllBySource */
132
- static findBySource(iModelDb, scope, kind, identifier) {
133
- const sql = `SELECT Element.Id, ECInstanceId FROM ${ExternalSourceAspect.classFullName} WHERE (Scope.Id=:scope AND Kind=:kind AND Identifier=:identifier)`;
134
- let elementId;
135
- let aspectId;
136
- iModelDb.withPreparedStatement(sql, (statement) => {
137
- statement.bindId("scope", scope);
138
- statement.bindString("kind", kind);
139
- statement.bindString("identifier", identifier);
140
- if (core_bentley_1.DbResult.BE_SQLITE_ROW === statement.step()) {
141
- elementId = statement.getValue(0).getId();
142
- aspectId = statement.getValue(1).getId();
143
- }
144
- });
145
- return { elementId, aspectId };
146
- }
147
- /** Look up the elements that contain one or more ExternalSourceAspect with the specified Scope, Kind, and Identifier.
148
- * The result of this function is an array of all of the ExternalSourceAspects that were found, each associated with the owning element.
149
- * A given element could have more than one ExternalSourceAspect with the given scope, kind, and identifier.
150
- * Also, many elements could have ExternalSourceAspect with the same scope, kind, and identifier.
151
- * Therefore, the result array could have more than one entry with the same elementId.
152
- * Aspects are never shared. Each aspect has its own unique ECInstanceId.
153
- * @param iModelDb The iModel to query
154
- * @param scope The scope of the ExternalSourceAspects to find
155
- * @param kind The kind of the ExternalSourceAspects to find
156
- * @param identifier The identifier of the ExternalSourceAspects to find
157
- * @returns the query results
158
- */
159
- static findAllBySource(iModelDb, scope, kind, identifier) {
160
- const sql = `SELECT Element.Id, ECInstanceId FROM ${ExternalSourceAspect.classFullName} WHERE (Scope.Id=:scope AND Kind=:kind AND Identifier=:identifier)`;
161
- const found = [];
162
- iModelDb.withPreparedStatement(sql, (statement) => {
163
- statement.bindId("scope", scope);
164
- statement.bindString("kind", kind);
165
- statement.bindString("identifier", identifier);
166
- while (core_bentley_1.DbResult.BE_SQLITE_ROW === statement.step()) {
167
- found.push({ elementId: statement.getValue(0).getId(), aspectId: statement.getValue(1).getId() });
168
- }
169
- });
170
- return found;
171
- }
172
- /** @internal */
173
- toJSON() {
174
- const val = super.toJSON();
175
- val.scope = this.scope;
176
- val.source = this.source;
177
- val.identifier = this.identifier;
178
- val.kind = this.kind;
179
- val.checksum = this.checksum;
180
- val.version = this.version;
181
- val.jsonProperties = this.jsonProperties;
182
- return val;
183
- }
184
- /** @internal */
185
- collectReferenceConcreteIds(referenceIds) {
186
- super.collectReferenceConcreteIds(referenceIds);
187
- if (this.scope)
188
- referenceIds.addElement(this.scope.id);
189
- referenceIds.addElement(this.element.id);
190
- if (this.source)
191
- referenceIds.addElement(this.source.id);
192
- }
193
- }
194
- exports.ExternalSourceAspect = ExternalSourceAspect;
195
- /** @public */
196
- (function (ExternalSourceAspect) {
197
- /** Standard values for the `Kind` property of `ExternalSourceAspect`.
198
- * @public
199
- */
200
- let Kind;
201
- (function (Kind) {
202
- /** Indicates that the [[ExternalSourceAspect]] is storing [[Element]] provenance */
203
- Kind["Element"] = "Element";
204
- /** Indicates that the [[ExternalSourceAspect]] is storing [[Relationship]] provenance */
205
- Kind["Relationship"] = "Relationship";
206
- /** Indicates that the [[ExternalSourceAspect]] is storing *scope* provenance
207
- * @see [[ExternalSourceAspect.scope]]
208
- */
209
- Kind["Scope"] = "Scope";
210
- })(Kind = ExternalSourceAspect.Kind || (ExternalSourceAspect.Kind = {}));
211
- })(ExternalSourceAspect = exports.ExternalSourceAspect || (exports.ExternalSourceAspect = {}));
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 ElementAspects
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.ExternalSourceAspect = exports.ChannelRootAspect = exports.ElementMultiAspect = exports.ElementUniqueAspect = exports.ElementAspect = void 0;
11
+ const core_common_1 = require("@itwin/core-common");
12
+ const Entity_1 = require("./Entity");
13
+ const core_bentley_1 = require("@itwin/core-bentley");
14
+ /** An Element Aspect is a class that defines a set of properties that are related to (and owned by) a single element.
15
+ * Semantically, an ElementAspect can be considered part of the Element. Thus, an ElementAspect is deleted if its owning Element is deleted.
16
+ * BIS Guideline: Subclass ElementUniqueAspect or ElementMultiAspect rather than subclassing ElementAspect directly.
17
+ * @public
18
+ */
19
+ class ElementAspect extends Entity_1.Entity {
20
+ /** @internal */
21
+ constructor(props, iModel) {
22
+ super(props, iModel);
23
+ this.element = core_common_1.RelatedElement.fromJSON(props.element); // eslint-disable-line @typescript-eslint/no-non-null-assertion
24
+ }
25
+ /** @internal */
26
+ static get className() { return "ElementAspect"; }
27
+ /** @internal */
28
+ toJSON() {
29
+ const val = super.toJSON();
30
+ val.element = this.element;
31
+ return val;
32
+ }
33
+ /** Called before a new ElementAspect is inserted.
34
+ * @note throw an exception to disallow the insert
35
+ * @note If you override this method, you must call super.
36
+ * @beta
37
+ */
38
+ static onInsert(_arg) { }
39
+ /** Called after a new ElementAspect was inserted.
40
+ * @note If you override this method, you must call super.
41
+ * @beta
42
+ */
43
+ static onInserted(_arg) { }
44
+ /** Called before an ElementAspect is updated.
45
+ * @note throw an exception to disallow the update
46
+ * @note If you override this method, you must call super.
47
+ * @beta
48
+ */
49
+ static onUpdate(_arg) { }
50
+ /** Called after an ElementAspect was updated.
51
+ * @note If you override this method, you must call super.
52
+ * @beta
53
+ */
54
+ static onUpdated(_arg) { }
55
+ /** Called before an ElementAspect is deleted.
56
+ * @note throw an exception to disallow the delete
57
+ * @note If you override this method, you must call super.
58
+ * @beta
59
+ */
60
+ static onDelete(_arg) { }
61
+ /** Called after an ElementAspect was deleted.
62
+ * @note If you override this method, you must call super.
63
+ * @beta
64
+ */
65
+ static onDeleted(_arg) { }
66
+ }
67
+ exports.ElementAspect = ElementAspect;
68
+ /** An Element Unique Aspect is an ElementAspect where there can be only zero or one instance of the Element Aspect class per Element.
69
+ * @public
70
+ */
71
+ class ElementUniqueAspect extends ElementAspect {
72
+ /** @internal */
73
+ static get className() { return "ElementUniqueAspect"; }
74
+ }
75
+ exports.ElementUniqueAspect = ElementUniqueAspect;
76
+ /** An Element Multi-Aspect is an ElementAspect where there can be **n** instances of the Element Aspect class per Element.
77
+ * @public
78
+ */
79
+ class ElementMultiAspect extends ElementAspect {
80
+ /** @internal */
81
+ static get className() { return "ElementMultiAspect"; }
82
+ }
83
+ exports.ElementMultiAspect = ElementMultiAspect;
84
+ /** A ChannelRootAspect identifies an Element as the root of a *channel* which is a subset of the overall iModel hierarchy that is independently maintained.
85
+ * @note The associated ECClass was added to the BisCore schema in version 1.0.10
86
+ * @public
87
+ */
88
+ class ChannelRootAspect extends ElementUniqueAspect {
89
+ /** @internal */
90
+ constructor(props, iModel) {
91
+ super(props, iModel);
92
+ this.owner = props.owner;
93
+ }
94
+ /** @internal */
95
+ static get className() { return "ChannelRootAspect"; }
96
+ /** @internal */
97
+ toJSON() {
98
+ const val = super.toJSON();
99
+ val.owner = this.owner;
100
+ return val;
101
+ }
102
+ /** Insert a ChannelRootAspect on the specified element. */
103
+ static insert(iModel, ownerId, ownerDescription) {
104
+ const props = {
105
+ classFullName: ChannelRootAspect.classFullName,
106
+ element: { id: ownerId },
107
+ owner: ownerDescription,
108
+ };
109
+ iModel.elements.insertAspect(props);
110
+ }
111
+ }
112
+ exports.ChannelRootAspect = ChannelRootAspect;
113
+ /** An ElementMultiAspect that stores synchronization information for an Element originating from an external source.
114
+ * @note The associated ECClass was added to the BisCore schema in version 1.0.2
115
+ * @public
116
+ */
117
+ class ExternalSourceAspect extends ElementMultiAspect {
118
+ /** @internal */
119
+ constructor(props, iModel) {
120
+ super(props, iModel);
121
+ this.scope = core_common_1.RelatedElement.fromJSON(props.scope); // eslint-disable-line @typescript-eslint/no-non-null-assertion
122
+ this.source = core_common_1.RelatedElement.fromJSON(props.source);
123
+ this.identifier = props.identifier;
124
+ this.kind = props.kind;
125
+ this.checksum = props.checksum;
126
+ this.version = props.version;
127
+ this.jsonProperties = props.jsonProperties;
128
+ }
129
+ /** @internal */
130
+ static get className() { return "ExternalSourceAspect"; }
131
+ /** @deprecated in 3.x. findAllBySource */
132
+ static findBySource(iModelDb, scope, kind, identifier) {
133
+ const sql = `SELECT Element.Id, ECInstanceId FROM ${ExternalSourceAspect.classFullName} WHERE (Scope.Id=:scope AND Kind=:kind AND Identifier=:identifier)`;
134
+ let elementId;
135
+ let aspectId;
136
+ iModelDb.withPreparedStatement(sql, (statement) => {
137
+ statement.bindId("scope", scope);
138
+ statement.bindString("kind", kind);
139
+ statement.bindString("identifier", identifier);
140
+ if (core_bentley_1.DbResult.BE_SQLITE_ROW === statement.step()) {
141
+ elementId = statement.getValue(0).getId();
142
+ aspectId = statement.getValue(1).getId();
143
+ }
144
+ });
145
+ return { elementId, aspectId };
146
+ }
147
+ /** Look up the elements that contain one or more ExternalSourceAspect with the specified Scope, Kind, and Identifier.
148
+ * The result of this function is an array of all of the ExternalSourceAspects that were found, each associated with the owning element.
149
+ * A given element could have more than one ExternalSourceAspect with the given scope, kind, and identifier.
150
+ * Also, many elements could have ExternalSourceAspect with the same scope, kind, and identifier.
151
+ * Therefore, the result array could have more than one entry with the same elementId.
152
+ * Aspects are never shared. Each aspect has its own unique ECInstanceId.
153
+ * @param iModelDb The iModel to query
154
+ * @param scope The scope of the ExternalSourceAspects to find
155
+ * @param kind The kind of the ExternalSourceAspects to find
156
+ * @param identifier The identifier of the ExternalSourceAspects to find
157
+ * @returns the query results
158
+ */
159
+ static findAllBySource(iModelDb, scope, kind, identifier) {
160
+ const sql = `SELECT Element.Id, ECInstanceId FROM ${ExternalSourceAspect.classFullName} WHERE (Scope.Id=:scope AND Kind=:kind AND Identifier=:identifier)`;
161
+ const found = [];
162
+ iModelDb.withPreparedStatement(sql, (statement) => {
163
+ statement.bindId("scope", scope);
164
+ statement.bindString("kind", kind);
165
+ statement.bindString("identifier", identifier);
166
+ while (core_bentley_1.DbResult.BE_SQLITE_ROW === statement.step()) {
167
+ found.push({ elementId: statement.getValue(0).getId(), aspectId: statement.getValue(1).getId() });
168
+ }
169
+ });
170
+ return found;
171
+ }
172
+ /** @internal */
173
+ toJSON() {
174
+ const val = super.toJSON();
175
+ val.scope = this.scope;
176
+ val.source = this.source;
177
+ val.identifier = this.identifier;
178
+ val.kind = this.kind;
179
+ val.checksum = this.checksum;
180
+ val.version = this.version;
181
+ val.jsonProperties = this.jsonProperties;
182
+ return val;
183
+ }
184
+ /** @internal */
185
+ collectReferenceConcreteIds(referenceIds) {
186
+ super.collectReferenceConcreteIds(referenceIds);
187
+ if (this.scope)
188
+ referenceIds.addElement(this.scope.id);
189
+ referenceIds.addElement(this.element.id);
190
+ if (this.source)
191
+ referenceIds.addElement(this.source.id);
192
+ }
193
+ }
194
+ exports.ExternalSourceAspect = ExternalSourceAspect;
195
+ /** @public */
196
+ (function (ExternalSourceAspect) {
197
+ /** Standard values for the `Kind` property of `ExternalSourceAspect`.
198
+ * @public
199
+ */
200
+ let Kind;
201
+ (function (Kind) {
202
+ /** Indicates that the [[ExternalSourceAspect]] is storing [[Element]] provenance */
203
+ Kind["Element"] = "Element";
204
+ /** Indicates that the [[ExternalSourceAspect]] is storing [[Relationship]] provenance */
205
+ Kind["Relationship"] = "Relationship";
206
+ /** Indicates that the [[ExternalSourceAspect]] is storing *scope* provenance
207
+ * @see [[ExternalSourceAspect.scope]]
208
+ */
209
+ Kind["Scope"] = "Scope";
210
+ })(Kind = ExternalSourceAspect.Kind || (ExternalSourceAspect.Kind = {}));
211
+ })(ExternalSourceAspect = exports.ExternalSourceAspect || (exports.ExternalSourceAspect = {}));
212
212
  //# sourceMappingURL=ElementAspect.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ElementAspect.js","sourceRoot":"","sources":["../../src/ElementAspect.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oDAA+I;AAC/I,qCAAkC;AAGlC,sDAA2D;AAwB3D;;;;GAIG;AACH,MAAa,aAAc,SAAQ,eAAM;IAKvC,gBAAgB;IAChB,YAAY,KAAyB,EAAE,MAAgB;QACrD,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,4BAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAE,CAAC,CAAC,+DAA+D;IACzH,CAAC;IARD,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,eAAe,CAAC,CAAC,CAAC;IAS1E,gBAAgB;IACA,MAAM;QACpB,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,EAAwB,CAAC;QACjD,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC3B,OAAO,GAAG,CAAC;IACb,CAAC;IAED;;;;OAIG;IACO,MAAM,CAAC,Q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------------------------------------------\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 ElementAspects\r\n */\r\n\r\nimport { ChannelRootAspectProps, ElementAspectProps, EntityReferenceSet, ExternalSourceAspectProps, RelatedElement } from \"@itwin/core-common\";\r\nimport { Entity } from \"./Entity\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { ECSqlStatement } from \"./ECSqlStatement\";\r\nimport { DbResult, Id64String } from \"@itwin/core-bentley\";\r\n\r\n/** Argument for the `ElementAspect.onXxx` static methods\r\n * @beta\r\n */\r\nexport interface OnAspectArg {\r\n /** The iModel for the aspect affected by this event. */\r\n iModel: IModelDb;\r\n}\r\n/** Argument for the `ElementAspect.onXxx` static methods that supply the properties of an aspect to be inserted or updated.\r\n * @beta\r\n */\r\nexport interface OnAspectPropsArg extends OnAspectArg {\r\n /** The new properties of the aspect affected by this event. */\r\n props: Readonly<ElementAspectProps>;\r\n}\r\n/** Argument for the `ElementAspect.onXxx` static methods that only supply the Id of the affected aspect.\r\n * @beta\r\n */\r\nexport interface OnAspectIdArg extends OnAspectArg {\r\n /** The Id of the aspect affected by this event */\r\n aspectId: Id64String;\r\n}\r\n\r\n/** An Element Aspect is a class that defines a set of properties that are related to (and owned by) a single element.\r\n * Semantically, an ElementAspect can be considered part of the Element. Thus, an ElementAspect is deleted if its owning Element is deleted.\r\n * BIS Guideline: Subclass ElementUniqueAspect or ElementMultiAspect rather than subclassing ElementAspect directly.\r\n * @public\r\n */\r\nexport class ElementAspect extends Entity {\r\n /** @internal */\r\n public static override get className(): string { return \"ElementAspect\"; }\r\n public element: RelatedElement;\r\n\r\n /** @internal */\r\n constructor(props: ElementAspectProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.element = RelatedElement.fromJSON(props.element)!; // eslint-disable-line @typescript-eslint/no-non-null-assertion\r\n }\r\n\r\n /** @internal */\r\n public override toJSON(): ElementAspectProps {\r\n const val = super.toJSON() as ElementAspectProps;\r\n val.element = this.element;\r\n return val;\r\n }\r\n\r\n /** Called before a new ElementAspect is inserted.\r\n * @note throw an exception to disallow the insert\r\n * @note If you override this method, you must call super.\r\n * @beta\r\n */\r\n protected static onInsert(_arg: OnAspectPropsArg): void { }\r\n\r\n /** Called after a new ElementAspect was inserted.\r\n * @note If you override this method, you must call super.\r\n * @beta\r\n */\r\n protected static onInserted(_arg: OnAspectPropsArg): void { }\r\n\r\n /** Called before an ElementAspect is updated.\r\n * @note throw an exception to disallow the update\r\n * @note If you override this method, you must call super.\r\n * @beta\r\n */\r\n protected static onUpdate(_arg: OnAspectPropsArg): void { }\r\n\r\n /** Called after an ElementAspect was updated.\r\n * @note If you override this method, you must call super.\r\n * @beta\r\n */\r\n protected static onUpdated(_arg: OnAspectPropsArg): void { }\r\n\r\n /** Called before an ElementAspect is deleted.\r\n * @note throw an exception to disallow the delete\r\n * @note If you override this method, you must call super.\r\n * @beta\r\n */\r\n protected static onDelete(_arg: OnAspectIdArg): void { }\r\n\r\n /** Called after an ElementAspect was deleted.\r\n * @note If you override this method, you must call super.\r\n * @beta\r\n */\r\n protected static onDeleted(_arg: OnAspectIdArg): void { }\r\n}\r\n\r\n/** An Element Unique Aspect is an ElementAspect where there can be only zero or one instance of the Element Aspect class per Element.\r\n * @public\r\n */\r\nexport class ElementUniqueAspect extends ElementAspect {\r\n /** @internal */\r\n public static override get className(): string { return \"ElementUniqueAspect\"; }\r\n}\r\n\r\n/** An Element Multi-Aspect is an ElementAspect where there can be **n** instances of the Element Aspect class per Element.\r\n * @public\r\n */\r\nexport class ElementMultiAspect extends ElementAspect {\r\n /** @internal */\r\n public static override get className(): string { return \"ElementMultiAspect\"; }\r\n}\r\n\r\n/** A ChannelRootAspect identifies an Element as the root of a *channel* which is a subset of the overall iModel hierarchy that is independently maintained.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.10\r\n * @public\r\n */\r\nexport class ChannelRootAspect extends ElementUniqueAspect {\r\n /** @internal */\r\n public static override get className(): string { return \"ChannelRootAspect\"; }\r\n\r\n /** The owner of the channel */\r\n public owner: string;\r\n\r\n /** @internal */\r\n constructor(props: ChannelRootAspectProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.owner = props.owner;\r\n }\r\n\r\n /** @internal */\r\n public override toJSON(): ChannelRootAspectProps {\r\n const val = super.toJSON() as ChannelRootAspectProps;\r\n val.owner = this.owner;\r\n return val;\r\n }\r\n\r\n /** Insert a ChannelRootAspect on the specified element. */\r\n public static insert(iModel: IModelDb, ownerId: Id64String, ownerDescription: string) {\r\n const props: ChannelRootAspectProps = {\r\n classFullName: ChannelRootAspect.classFullName,\r\n element: { id: ownerId },\r\n owner: ownerDescription,\r\n };\r\n iModel.elements.insertAspect(props);\r\n }\r\n}\r\n\r\n/** An ElementMultiAspect that stores synchronization information for an Element originating from an external source.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.2\r\n * @public\r\n */\r\nexport class ExternalSourceAspect extends ElementMultiAspect {\r\n /** @internal */\r\n public static override get className(): string { return \"ExternalSourceAspect\"; }\r\n\r\n /** An element that scopes the combination of `kind` and `identifier` to uniquely identify the object from the external source.\r\n * @note Warning: in a future major release the `scope` property will be optional, since the scope is intended to be potentially invalid.\r\n * all references should treat it as potentially undefined, but we cannot change the type yet since that is a breaking change.\r\n */\r\n public scope: RelatedElement;\r\n /** The identifier of the object in the source repository. */\r\n public identifier: string;\r\n /** The kind of object within the source repository. */\r\n public kind: string;\r\n /** The cryptographic hash (any algorithm) of the source object's content. If defined, it must be guaranteed to change when the source object's content changes. */\r\n public checksum?: string;\r\n /** An optional value that is typically a version number or a pseudo version number like last modified time.\r\n * It will be used by the synchronization process to detect that a source object is unchanged so that computing a cryptographic hash can be avoided.\r\n * If present, this value must be guaranteed to change when any of the source object's content changes.\r\n */\r\n public version?: string;\r\n /** A place where additional JSON properties can be stored. For example, provenance information or properties relating to the synchronization process.\r\n * @note Warning: in a future major release, the type of `jsonProperties` will be changed to object, and itwin.js will automatically stringify it when writing to the iModel.\r\n * This will be a breaking change, since application code will have to change from supplying a string to supplying an object.\r\n */\r\n public jsonProperties?: string;\r\n /** The source of the imported/synchronized object. Should point to an instance of [ExternalSource]($backend). */\r\n public source?: RelatedElement;\r\n\r\n /** @internal */\r\n constructor(props: ExternalSourceAspectProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.scope = RelatedElement.fromJSON(props.scope)!; // eslint-disable-line @typescript-eslint/no-non-null-assertion\r\n this.source = RelatedElement.fromJSON(props.source);\r\n this.identifier = props.identifier;\r\n this.kind = props.kind;\r\n this.checksum = props.checksum;\r\n this.version = props.version;\r\n this.jsonProperties = props.jsonProperties;\r\n }\r\n\r\n /** @deprecated findAllBySource */\r\n public static findBySource(iModelDb: IModelDb, scope: Id64String, kind: string, identifier: string): { elementId?: Id64String, aspectId?: Id64String } {\r\n const sql = `SELECT Element.Id, ECInstanceId FROM ${ExternalSourceAspect.classFullName} WHERE (Scope.Id=:scope AND Kind=:kind AND Identifier=:identifier)`;\r\n let elementId: Id64String | undefined;\r\n let aspectId: Id64String | undefined;\r\n iModelDb.withPreparedStatement(sql, (statement: ECSqlStatement) => {\r\n statement.bindId(\"scope\", scope);\r\n statement.bindString(\"kind\", kind);\r\n statement.bindString(\"identifier\", identifier);\r\n if (DbResult.BE_SQLITE_ROW === statement.step()) {\r\n elementId = statement.getValue(0).getId();\r\n aspectId = statement.getValue(1).getId();\r\n }\r\n });\r\n return { elementId, aspectId };\r\n }\r\n\r\n /** Look up the elements that contain one or more ExternalSourceAspect with the specified Scope, Kind, and Identifier.\r\n * The result of this function is an array of all of the ExternalSourceAspects that were found, each associated with the owning element.\r\n * A given element could have more than one ExternalSourceAspect with the given scope, kind, and identifier.\r\n * Also, many elements could have ExternalSourceAspect with the same scope, kind, and identifier.\r\n * Therefore, the result array could have more than one entry with the same elementId.\r\n * Aspects are never shared. Each aspect has its own unique ECInstanceId.\r\n * @param iModelDb The iModel to query\r\n * @param scope The scope of the ExternalSourceAspects to find\r\n * @param kind The kind of the ExternalSourceAspects to find\r\n * @param identifier The identifier of the ExternalSourceAspects to find\r\n * @returns the query results\r\n */\r\n public static findAllBySource(iModelDb: IModelDb, scope: Id64String, kind: string, identifier: string): Array<{ elementId: Id64String, aspectId: Id64String }> {\r\n const sql = `SELECT Element.Id, ECInstanceId FROM ${ExternalSourceAspect.classFullName} WHERE (Scope.Id=:scope AND Kind=:kind AND Identifier=:identifier)`;\r\n const found: Array<{ elementId: Id64String, aspectId: Id64String }> = [];\r\n iModelDb.withPreparedStatement(sql, (statement: ECSqlStatement) => {\r\n statement.bindId(\"scope\", scope);\r\n statement.bindString(\"kind\", kind);\r\n statement.bindString(\"identifier\", identifier);\r\n while (DbResult.BE_SQLITE_ROW === statement.step()) {\r\n found.push({ elementId: statement.getValue(0).getId(), aspectId: statement.getValue(1).getId() });\r\n }\r\n });\r\n return found;\r\n }\r\n\r\n /** @internal */\r\n public override toJSON(): ExternalSourceAspectProps {\r\n const val = super.toJSON() as ExternalSourceAspectProps;\r\n val.scope = this.scope;\r\n val.source = this.source;\r\n val.identifier = this.identifier;\r\n val.kind = this.kind;\r\n val.checksum = this.checksum;\r\n val.version = this.version;\r\n val.jsonProperties = this.jsonProperties;\r\n return val;\r\n }\r\n\r\n /** @internal */\r\n protected override collectReferenceConcreteIds(referenceIds: EntityReferenceSet): void {\r\n super.collectReferenceConcreteIds(referenceIds);\r\n if (this.scope)\r\n referenceIds.addElement(this.scope.id);\r\n referenceIds.addElement(this.element.id);\r\n if (this.source)\r\n referenceIds.addElement(this.source.id);\r\n }\r\n}\r\n\r\n/** @public */\r\nexport namespace ExternalSourceAspect { // eslint-disable-line no-redeclare\r\n /** Standard values for the `Kind` property of `ExternalSourceAspect`.\r\n * @public\r\n */\r\n export enum Kind {\r\n /** Indicates that the [[ExternalSourceAspect]] is storing [[Element]] provenance */\r\n Element = \"Element\",\r\n /** Indicates that the [[ExternalSourceAspect]] is storing [[Relationship]] provenance */\r\n Relationship = \"Relationship\",\r\n /** Indicates that the [[ExternalSourceAspect]] is storing *scope* provenance\r\n * @see [[ExternalSourceAspect.scope]]\r\n */\r\n Scope = \"Scope\",\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ElementAspect.js","sourceRoot":"","sources":["../../src/ElementAspect.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oDAA+I;AAC/I,qCAAkC;AAGlC,sDAA2D;AAwB3D;;;;GAIG;AACH,MAAa,aAAc,SAAQ,eAAM;IAKvC,gBAAgB;IAChB,YAAY,KAAyB,EAAE,MAAgB;QACrD,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,4BAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAE,CAAC,CAAC,+DAA+D;IACzH,CAAC;IARD,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,eAAe,CAAC,CAAC,CAAC;IAS1E,gBAAgB;IACA,MAAM;QACpB,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,EAAwB,CAAC;QACjD,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC3B,OAAO,GAAG,CAAC;IACb,CAAC;IAED;;;;OAIG;IACO,MAAM,CAAC,QAAQ,CAAC,IAAsB,IAAU,CAAC;IAE3D;;;OAGG;IACO,MAAM,CAAC,UAAU,CAAC,IAAsB,IAAU,CAAC;IAE7D;;;;OAIG;IACO,MAAM,CAAC,QAAQ,CAAC,IAAsB,IAAU,CAAC;IAE3D;;;OAGG;IACO,MAAM,CAAC,SAAS,CAAC,IAAsB,IAAU,CAAC;IAE5D;;;;OAIG;IACO,MAAM,CAAC,QAAQ,CAAC,IAAmB,IAAU,CAAC;IAExD;;;OAGG;IACO,MAAM,CAAC,SAAS,CAAC,IAAmB,IAAU,CAAC;CAC1D;AAxDD,sCAwDC;AAED;;G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OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC3B,GAAG,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;QACzC,OAAO,GAAG,CAAC;IACb,CAAC;IAED,gBAAgB;IACG,2BAA2B,CAAC,YAAgC;QAC7E,KAAK,CAAC,2BAA2B,CAAC,YAAY,CAAC,CAAC;QAChD,IAAI,IAAI,CAAC,KAAK;YACZ,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACzC,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACzC,IAAI,IAAI,CAAC,MAAM;YACb,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC5C,CAAC;CACF;AAzGD,oDAyGC;AAED,cAAc;AACd,WAAiB,oBAAoB;IACnC;;OAEG;IACH,IAAY,IASX;IATD,WAAY,IAAI;QACd,oFAAoF;QACpF,2BAAmB,CAAA;QACnB,yFAAyF;QACzF,qCAA6B,CAAA;QAC7B;;WAEG;QACH,uBAAe,CAAA;IACjB,CAAC,EATW,IAAI,GAAJ,yBAAI,KAAJ,yBAAI,QASf;AACH,CAAC,EAdgB,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAcpC","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 ElementAspects\n */\n\nimport { ChannelRootAspectProps, ElementAspectProps, EntityReferenceSet, ExternalSourceAspectProps, RelatedElement } from \"@itwin/core-common\";\nimport { Entity } from \"./Entity\";\nimport { IModelDb } from \"./IModelDb\";\nimport { ECSqlStatement } from \"./ECSqlStatement\";\nimport { DbResult, Id64String } from \"@itwin/core-bentley\";\n\n/** Argument for the `ElementAspect.onXxx` static methods\n * @beta\n */\nexport interface OnAspectArg {\n /** The iModel for the aspect affected by this event. */\n iModel: IModelDb;\n}\n/** Argument for the `ElementAspect.onXxx` static methods that supply the properties of an aspect to be inserted or updated.\n * @beta\n */\nexport interface OnAspectPropsArg extends OnAspectArg {\n /** The new properties of the aspect affected by this event. */\n props: Readonly<ElementAspectProps>;\n}\n/** Argument for the `ElementAspect.onXxx` static methods that only supply the Id of the affected aspect.\n * @beta\n */\nexport interface OnAspectIdArg extends OnAspectArg {\n /** The Id of the aspect affected by this event */\n aspectId: Id64String;\n}\n\n/** An Element Aspect is a class that defines a set of properties that are related to (and owned by) a single element.\n * Semantically, an ElementAspect can be considered part of the Element. Thus, an ElementAspect is deleted if its owning Element is deleted.\n * BIS Guideline: Subclass ElementUniqueAspect or ElementMultiAspect rather than subclassing ElementAspect directly.\n * @public\n */\nexport class ElementAspect extends Entity {\n /** @internal */\n public static override get className(): string { return \"ElementAspect\"; }\n public element: RelatedElement;\n\n /** @internal */\n constructor(props: ElementAspectProps, iModel: IModelDb) {\n super(props, iModel);\n this.element = RelatedElement.fromJSON(props.element)!; // eslint-disable-line @typescript-eslint/no-non-null-assertion\n }\n\n /** @internal */\n public override toJSON(): ElementAspectProps {\n const val = super.toJSON() as ElementAspectProps;\n val.element = this.element;\n return val;\n }\n\n /** Called before a new ElementAspect is inserted.\n * @note throw an exception to disallow the insert\n * @note If you override this method, you must call super.\n * @beta\n */\n protected static onInsert(_arg: OnAspectPropsArg): void { }\n\n /** Called after a new ElementAspect was inserted.\n * @note If you override this method, you must call super.\n * @beta\n */\n protected static onInserted(_arg: OnAspectPropsArg): void { }\n\n /** Called before an ElementAspect is updated.\n * @note throw an exception to disallow the update\n * @note If you override this method, you must call super.\n * @beta\n */\n protected static onUpdate(_arg: OnAspectPropsArg): void { }\n\n /** Called after an ElementAspect was updated.\n * @note If you override this method, you must call super.\n * @beta\n */\n protected static onUpdated(_arg: OnAspectPropsArg): void { }\n\n /** Called before an ElementAspect is deleted.\n * @note throw an exception to disallow the delete\n * @note If you override this method, you must call super.\n * @beta\n */\n protected static onDelete(_arg: OnAspectIdArg): void { }\n\n /** Called after an ElementAspect was deleted.\n * @note If you override this method, you must call super.\n * @beta\n */\n protected static onDeleted(_arg: OnAspectIdArg): void { }\n}\n\n/** An Element Unique Aspect is an ElementAspect where there can be only zero or one instance of the Element Aspect class per Element.\n * @public\n */\nexport class ElementUniqueAspect extends ElementAspect {\n /** @internal */\n public static override get className(): string { return \"ElementUniqueAspect\"; }\n}\n\n/** An Element Multi-Aspect is an ElementAspect where there can be **n** instances of the Element Aspect class per Element.\n * @public\n */\nexport class ElementMultiAspect extends ElementAspect {\n /** @internal */\n public static override get className(): string { return \"ElementMultiAspect\"; }\n}\n\n/** A ChannelRootAspect identifies an Element as the root of a *channel* which is a subset of the overall iModel hierarchy that is independently maintained.\n * @note The associated ECClass was added to the BisCore schema in version 1.0.10\n * @public\n */\nexport class ChannelRootAspect extends ElementUniqueAspect {\n /** @internal */\n public static override get className(): string { return \"ChannelRootAspect\"; }\n\n /** The owner of the channel */\n public owner: string;\n\n /** @internal */\n constructor(props: ChannelRootAspectProps, iModel: IModelDb) {\n super(props, iModel);\n this.owner = props.owner;\n }\n\n /** @internal */\n public override toJSON(): ChannelRootAspectProps {\n const val = super.toJSON() as ChannelRootAspectProps;\n val.owner = this.owner;\n return val;\n }\n\n /** Insert a ChannelRootAspect on the specified element. */\n public static insert(iModel: IModelDb, ownerId: Id64String, ownerDescription: string) {\n const props: ChannelRootAspectProps = {\n classFullName: ChannelRootAspect.classFullName,\n element: { id: ownerId },\n owner: ownerDescription,\n };\n iModel.elements.insertAspect(props);\n }\n}\n\n/** An ElementMultiAspect that stores synchronization information for an Element originating from an external source.\n * @note The associated ECClass was added to the BisCore schema in version 1.0.2\n * @public\n */\nexport class ExternalSourceAspect extends ElementMultiAspect {\n /** @internal */\n public static override get className(): string { return \"ExternalSourceAspect\"; }\n\n /** An element that scopes the combination of `kind` and `identifier` to uniquely identify the object from the external source.\n * @note Warning: in a future major release the `scope` property will be optional, since the scope is intended to be potentially invalid.\n * all references should treat it as potentially undefined, but we cannot change the type yet since that is a breaking change.\n */\n public scope: RelatedElement;\n /** The identifier of the object in the source repository. */\n public identifier: string;\n /** The kind of object within the source repository. */\n public kind: string;\n /** The cryptographic hash (any algorithm) of the source object's content. If defined, it must be guaranteed to change when the source object's content changes. */\n public checksum?: string;\n /** An optional value that is typically a version number or a pseudo version number like last modified time.\n * It will be used by the synchronization process to detect that a source object is unchanged so that computing a cryptographic hash can be avoided.\n * If present, this value must be guaranteed to change when any of the source object's content changes.\n */\n public version?: string;\n /** A place where additional JSON properties can be stored. For example, provenance information or properties relating to the synchronization process.\n * @note Warning: in a future major release, the type of `jsonProperties` will be changed to object, and itwin.js will automatically stringify it when writing to the iModel.\n * This will be a breaking change, since application code will have to change from supplying a string to supplying an object.\n */\n public jsonProperties?: string;\n /** The source of the imported/synchronized object. Should point to an instance of [ExternalSource]($backend). */\n public source?: RelatedElement;\n\n /** @internal */\n constructor(props: ExternalSourceAspectProps, iModel: IModelDb) {\n super(props, iModel);\n this.scope = RelatedElement.fromJSON(props.scope)!; // eslint-disable-line @typescript-eslint/no-non-null-assertion\n this.source = RelatedElement.fromJSON(props.source);\n this.identifier = props.identifier;\n this.kind = props.kind;\n this.checksum = props.checksum;\n this.version = props.version;\n this.jsonProperties = props.jsonProperties;\n }\n\n /** @deprecated in 3.x. findAllBySource */\n public static findBySource(iModelDb: IModelDb, scope: Id64String, kind: string, identifier: string): { elementId?: Id64String, aspectId?: Id64String } {\n const sql = `SELECT Element.Id, ECInstanceId FROM ${ExternalSourceAspect.classFullName} WHERE (Scope.Id=:scope AND Kind=:kind AND Identifier=:identifier)`;\n let elementId: Id64String | undefined;\n let aspectId: Id64String | undefined;\n iModelDb.withPreparedStatement(sql, (statement: ECSqlStatement) => {\n statement.bindId(\"scope\", scope);\n statement.bindString(\"kind\", kind);\n statement.bindString(\"identifier\", identifier);\n if (DbResult.BE_SQLITE_ROW === statement.step()) {\n elementId = statement.getValue(0).getId();\n aspectId = statement.getValue(1).getId();\n }\n });\n return { elementId, aspectId };\n }\n\n /** Look up the elements that contain one or more ExternalSourceAspect with the specified Scope, Kind, and Identifier.\n * The result of this function is an array of all of the ExternalSourceAspects that were found, each associated with the owning element.\n * A given element could have more than one ExternalSourceAspect with the given scope, kind, and identifier.\n * Also, many elements could have ExternalSourceAspect with the same scope, kind, and identifier.\n * Therefore, the result array could have more than one entry with the same elementId.\n * Aspects are never shared. Each aspect has its own unique ECInstanceId.\n * @param iModelDb The iModel to query\n * @param scope The scope of the ExternalSourceAspects to find\n * @param kind The kind of the ExternalSourceAspects to find\n * @param identifier The identifier of the ExternalSourceAspects to find\n * @returns the query results\n */\n public static findAllBySource(iModelDb: IModelDb, scope: Id64String, kind: string, identifier: string): Array<{ elementId: Id64String, aspectId: Id64String }> {\n const sql = `SELECT Element.Id, ECInstanceId FROM ${ExternalSourceAspect.classFullName} WHERE (Scope.Id=:scope AND Kind=:kind AND Identifier=:identifier)`;\n const found: Array<{ elementId: Id64String, aspectId: Id64String }> = [];\n iModelDb.withPreparedStatement(sql, (statement: ECSqlStatement) => {\n statement.bindId(\"scope\", scope);\n statement.bindString(\"kind\", kind);\n statement.bindString(\"identifier\", identifier);\n while (DbResult.BE_SQLITE_ROW === statement.step()) {\n found.push({ elementId: statement.getValue(0).getId(), aspectId: statement.getValue(1).getId() });\n }\n });\n return found;\n }\n\n /** @internal */\n public override toJSON(): ExternalSourceAspectProps {\n const val = super.toJSON() as ExternalSourceAspectProps;\n val.scope = this.scope;\n val.source = this.source;\n val.identifier = this.identifier;\n val.kind = this.kind;\n val.checksum = this.checksum;\n val.version = this.version;\n val.jsonProperties = this.jsonProperties;\n return val;\n }\n\n /** @internal */\n protected override collectReferenceConcreteIds(referenceIds: EntityReferenceSet): void {\n super.collectReferenceConcreteIds(referenceIds);\n if (this.scope)\n referenceIds.addElement(this.scope.id);\n referenceIds.addElement(this.element.id);\n if (this.source)\n referenceIds.addElement(this.source.id);\n }\n}\n\n/** @public */\nexport namespace ExternalSourceAspect { // eslint-disable-line no-redeclare\n /** Standard values for the `Kind` property of `ExternalSourceAspect`.\n * @public\n */\n export enum Kind {\n /** Indicates that the [[ExternalSourceAspect]] is storing [[Element]] provenance */\n Element = \"Element\",\n /** Indicates that the [[ExternalSourceAspect]] is storing [[Relationship]] provenance */\n Relationship = \"Relationship\",\n /** Indicates that the [[ExternalSourceAspect]] is storing *scope* provenance\n * @see [[ExternalSourceAspect.scope]]\n */\n Scope = \"Scope\",\n }\n}\n"]}
@@ -1,10 +1,10 @@
1
- /** @packageDocumentation
2
- * @module Tiles
3
- */
4
- import { ElementGraphicsRequestProps } from "@itwin/core-common";
5
- import { IModelDb } from "./IModelDb";
6
- /** See [[IModelDb.generateElementGraphics]] and IModelTileRpcImpl.requestElementGraphics.
7
- * @internal
8
- */
9
- export declare function generateElementGraphics(request: ElementGraphicsRequestProps, iModel: IModelDb): Promise<Uint8Array | undefined>;
1
+ /** @packageDocumentation
2
+ * @module Tiles
3
+ */
4
+ import { ElementGraphicsRequestProps } from "@itwin/core-common";
5
+ import { IModelDb } from "./IModelDb";
6
+ /** See [[IModelDb.generateElementGraphics]] and IModelTileRpcImpl.requestElementGraphics.
7
+ * @internal
8
+ */
9
+ export declare function generateElementGraphics(request: ElementGraphicsRequestProps, iModel: IModelDb): Promise<Uint8Array | undefined>;
10
10
  //# sourceMappingURL=ElementGraphics.d.ts.map
@@ -1,42 +1,42 @@
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 Tiles
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.generateElementGraphics = void 0;
11
- const core_bentley_1 = require("@itwin/core-bentley");
12
- const core_common_1 = require("@itwin/core-common");
13
- /** See [[IModelDb.generateElementGraphics]] and IModelTileRpcImpl.requestElementGraphics.
14
- * @internal
15
- */
16
- async function generateElementGraphics(request, iModel) {
17
- const result = await iModel.nativeDb.generateElementGraphics(request); // ###TODO update package versions in addon
18
- let error;
19
- switch (result.status) {
20
- case 2 /* NoGeometry */:
21
- case 1 /* Canceled */:
22
- return undefined;
23
- case 0 /* Success */:
24
- return result.content;
25
- case 3 /* InvalidJson */:
26
- error = "Invalid JSON";
27
- break;
28
- case 4 /* UnknownMajorFormatVersion */:
29
- error = "Unknown major format version";
30
- break;
31
- case 5 /* ElementNotFound */:
32
- error = `Element Id ${request.elementId} not found`;
33
- break;
34
- case 6 /* DuplicateRequestId */:
35
- error = `Duplicate request Id "${request.id}"`;
36
- break;
37
- }
38
- (0, core_bentley_1.assert)(undefined !== error);
39
- throw new core_common_1.IModelError(core_bentley_1.IModelStatus.BadRequest, error);
40
- }
41
- exports.generateElementGraphics = generateElementGraphics;
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 Tiles
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.generateElementGraphics = void 0;
11
+ const core_bentley_1 = require("@itwin/core-bentley");
12
+ const core_common_1 = require("@itwin/core-common");
13
+ /** See [[IModelDb.generateElementGraphics]] and IModelTileRpcImpl.requestElementGraphics.
14
+ * @internal
15
+ */
16
+ async function generateElementGraphics(request, iModel) {
17
+ const result = await iModel.nativeDb.generateElementGraphics(request); // ###TODO update package versions in addon
18
+ let error;
19
+ switch (result.status) {
20
+ case 2 /* NoGeometry */:
21
+ case 1 /* Canceled */:
22
+ return undefined;
23
+ case 0 /* Success */:
24
+ return result.content;
25
+ case 3 /* InvalidJson */:
26
+ error = "Invalid JSON";
27
+ break;
28
+ case 4 /* UnknownMajorFormatVersion */:
29
+ error = "Unknown major format version";
30
+ break;
31
+ case 5 /* ElementNotFound */:
32
+ error = `Element Id ${request.elementId} not found`;
33
+ break;
34
+ case 6 /* DuplicateRequestId */:
35
+ error = `Duplicate request Id "${request.id}"`;
36
+ break;
37
+ }
38
+ (0, core_bentley_1.assert)(undefined !== error);
39
+ throw new core_common_1.IModelError(core_bentley_1.IModelStatus.BadRequest, error);
40
+ }
41
+ exports.generateElementGraphics = generateElementGraphics;
42
42
  //# sourceMappingURL=ElementGraphics.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ElementGraphics.js","sourceRoot":"","sources":["../../src/ElementGraphics.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA2D;AAC3D,oDAA8E;AAI9E;;GAEG;AACI,KAAK,UAAU,uBAAuB,CAAC,OAAoC,EAAE,MAAgB;IAClG,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,uBAAuB,CAAC,OAAc,CAAC,CAAC,CAAC,2CAA2C;IAEzH,IAAI,KAAyB,CAAC;IAC9B,QAAQ,MAAM,CAAC,MAAM,EAAE;QACrB,wBAAsC;QACtC;YACE,OAAO,SAAS,CAAC;QACnB;YACE,OAAO,MAAM,CAAC,OAAO,CAAC;QACxB;YACE,KAAK,GAAG,cAAc,CAAC;YACvB,MAAM;QACR;YACE,KAAK,GAAG,8BAA8B,CAAC;YACvC,MAAM;QACR;YACE,KAAK,GAAG,cAAc,OAAO,CAAC,SAAS,YAAY,CAAC;YACpD,MAAM;QACR;YACE,KAAK,GAAG,yBAAyB,OAAO,CAAC,EAAE,GAAG,CAAC;YAC/C,MAAM;KACT;IAED,IAAA,qBAAM,EAAC,SAAS,KAAK,KAAK,CAAC,CAAC;IAC5B,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;AACxD,CAAC;AA1BD,0DA0BC","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 Tiles\r\n */\r\n\r\nimport { assert, IModelStatus } from \"@itwin/core-bentley\";\r\nimport { ElementGraphicsRequestProps, IModelError } from \"@itwin/core-common\";\r\nimport { ElementGraphicsStatus } from \"@bentley/imodeljs-native\";\r\nimport { IModelDb } from \"./IModelDb\";\r\n\r\n/** See [[IModelDb.generateElementGraphics]] and IModelTileRpcImpl.requestElementGraphics.\r\n * @internal\r\n */\r\nexport async function generateElementGraphics(request: ElementGraphicsRequestProps, iModel: IModelDb): Promise<Uint8Array | undefined> {\r\n const result = await iModel.nativeDb.generateElementGraphics(request as any); // ###TODO update package versions in addon\r\n\r\n let error: string | undefined;\r\n switch (result.status) {\r\n case ElementGraphicsStatus.NoGeometry:\r\n case ElementGraphicsStatus.Canceled:\r\n return undefined;\r\n case ElementGraphicsStatus.Success:\r\n return result.content;\r\n case ElementGraphicsStatus.InvalidJson:\r\n error = \"Invalid JSON\";\r\n break;\r\n case ElementGraphicsStatus.UnknownMajorFormatVersion:\r\n error = \"Unknown major format version\";\r\n break;\r\n case ElementGraphicsStatus.ElementNotFound:\r\n error = `Element Id ${request.elementId} not found`;\r\n break;\r\n case ElementGraphicsStatus.DuplicateRequestId:\r\n error = `Duplicate request Id \"${request.id}\"`;\r\n break;\r\n }\r\n\r\n assert(undefined !== error);\r\n throw new IModelError(IModelStatus.BadRequest, error);\r\n}\r\n"]}
1
+ {"version":3,"file":"ElementGraphics.js","sourceRoot":"","sources":["../../src/ElementGraphics.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA2D;AAC3D,oDAA8E;AAI9E;;GAEG;AACI,KAAK,UAAU,uBAAuB,CAAC,OAAoC,EAAE,MAAgB;IAClG,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,uBAAuB,CAAC,OAAc,CAAC,CAAC,CAAC,2CAA2C;IAEzH,IAAI,KAAyB,CAAC;IAC9B,QAAQ,MAAM,CAAC,MAAM,EAAE;QACrB,wBAAsC;QACtC;YACE,OAAO,SAAS,CAAC;QACnB;YACE,OAAO,MAAM,CAAC,OAAO,CAAC;QACxB;YACE,KAAK,GAAG,cAAc,CAAC;YACvB,MAAM;QACR;YACE,KAAK,GAAG,8BAA8B,CAAC;YACvC,MAAM;QACR;YACE,KAAK,GAAG,cAAc,OAAO,CAAC,SAAS,YAAY,CAAC;YACpD,MAAM;QACR;YACE,KAAK,GAAG,yBAAyB,OAAO,CAAC,EAAE,GAAG,CAAC;YAC/C,MAAM;KACT;IAED,IAAA,qBAAM,EAAC,SAAS,KAAK,KAAK,CAAC,CAAC;IAC5B,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;AACxD,CAAC;AA1BD,0DA0BC","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 Tiles\n */\n\nimport { assert, IModelStatus } from \"@itwin/core-bentley\";\nimport { ElementGraphicsRequestProps, IModelError } from \"@itwin/core-common\";\nimport { ElementGraphicsStatus } from \"@bentley/imodeljs-native\";\nimport { IModelDb } from \"./IModelDb\";\n\n/** See [[IModelDb.generateElementGraphics]] and IModelTileRpcImpl.requestElementGraphics.\n * @internal\n */\nexport async function generateElementGraphics(request: ElementGraphicsRequestProps, iModel: IModelDb): Promise<Uint8Array | undefined> {\n const result = await iModel.nativeDb.generateElementGraphics(request as any); // ###TODO update package versions in addon\n\n let error: string | undefined;\n switch (result.status) {\n case ElementGraphicsStatus.NoGeometry:\n case ElementGraphicsStatus.Canceled:\n return undefined;\n case ElementGraphicsStatus.Success:\n return result.content;\n case ElementGraphicsStatus.InvalidJson:\n error = \"Invalid JSON\";\n break;\n case ElementGraphicsStatus.UnknownMajorFormatVersion:\n error = \"Unknown major format version\";\n break;\n case ElementGraphicsStatus.ElementNotFound:\n error = `Element Id ${request.elementId} not found`;\n break;\n case ElementGraphicsStatus.DuplicateRequestId:\n error = `Duplicate request Id \"${request.id}\"`;\n break;\n }\n\n assert(undefined !== error);\n throw new IModelError(IModelStatus.BadRequest, error);\n}\n"]}