@itwin/core-backend 3.5.0-dev.63 → 3.5.0-dev.66

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 (244) hide show
  1. package/CHANGELOG.md +16 -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 +170 -170
  15. package/lib/cjs/BriefcaseManager.js +413 -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 +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 +350 -350
  36. package/lib/cjs/CloudSqlite.js +152 -152
  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 +13 -13
  48. package/lib/cjs/ConcurrentQuery.js +36 -36
  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 +1102 -1102
  69. package/lib/cjs/Element.js +1416 -1416
  70. package/lib/cjs/Element.js.map +1 -1
  71. package/lib/cjs/ElementAspect.d.ts +176 -176
  72. package/lib/cjs/ElementAspect.js +211 -211
  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 +49 -49
  84. package/lib/cjs/EntityReferences.js +95 -95
  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 +85 -85
  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 +94 -94
  99. package/lib/cjs/HubMock.js +222 -222
  100. package/lib/cjs/HubMock.js.map +1 -1
  101. package/lib/cjs/IModelCloneContext.d.ts +8 -8
  102. package/lib/cjs/IModelCloneContext.js +15 -15
  103. package/lib/cjs/IModelCloneContext.js.map +1 -1
  104. package/lib/cjs/IModelDb.d.ts +1183 -1183
  105. package/lib/cjs/IModelDb.js +2374 -2374
  106. package/lib/cjs/IModelDb.js.map +1 -1
  107. package/lib/cjs/IModelElementCloneContext.d.ts +89 -89
  108. package/lib/cjs/IModelElementCloneContext.js +159 -159
  109. package/lib/cjs/IModelElementCloneContext.js.map +1 -1
  110. package/lib/cjs/IModelHost.d.ts +370 -370
  111. package/lib/cjs/IModelHost.js +496 -496
  112. package/lib/cjs/IModelHost.js.map +1 -1
  113. package/lib/cjs/IModelJsFs.d.ts +62 -62
  114. package/lib/cjs/IModelJsFs.js +140 -140
  115. package/lib/cjs/IModelJsFs.js.map +1 -1
  116. package/lib/cjs/IpcHost.d.ts +104 -104
  117. package/lib/cjs/IpcHost.js +278 -278
  118. package/lib/cjs/IpcHost.js.map +1 -1
  119. package/lib/cjs/LineStyle.d.ts +311 -311
  120. package/lib/cjs/LineStyle.js +295 -295
  121. package/lib/cjs/LineStyle.js.map +1 -1
  122. package/lib/cjs/LocalHub.d.ts +162 -162
  123. package/lib/cjs/LocalHub.js +587 -587
  124. package/lib/cjs/LocalHub.js.map +1 -1
  125. package/lib/cjs/LocalhostIpcHost.d.ts +20 -20
  126. package/lib/cjs/LocalhostIpcHost.js +81 -81
  127. package/lib/cjs/LocalhostIpcHost.js.map +1 -1
  128. package/lib/cjs/Material.d.ts +103 -103
  129. package/lib/cjs/Material.js +147 -147
  130. package/lib/cjs/Material.js.map +1 -1
  131. package/lib/cjs/Model.d.ts +392 -392
  132. package/lib/cjs/Model.js +485 -485
  133. package/lib/cjs/Model.js.map +1 -1
  134. package/lib/cjs/NativeAppStorage.d.ts +51 -51
  135. package/lib/cjs/NativeAppStorage.js +202 -202
  136. package/lib/cjs/NativeAppStorage.js.map +1 -1
  137. package/lib/cjs/NativeHost.d.ts +52 -52
  138. package/lib/cjs/NativeHost.js +163 -163
  139. package/lib/cjs/NativeHost.js.map +1 -1
  140. package/lib/cjs/NavigationRelationship.d.ts +156 -156
  141. package/lib/cjs/NavigationRelationship.js +225 -225
  142. package/lib/cjs/NavigationRelationship.js.map +1 -1
  143. package/lib/cjs/PromiseMemoizer.d.ts +51 -51
  144. package/lib/cjs/PromiseMemoizer.js +101 -101
  145. package/lib/cjs/PromiseMemoizer.js.map +1 -1
  146. package/lib/cjs/PropertyStore.d.ts +132 -132
  147. package/lib/cjs/PropertyStore.js +11 -11
  148. package/lib/cjs/PropertyStore.js.map +1 -1
  149. package/lib/cjs/Relationship.d.ts +416 -416
  150. package/lib/cjs/Relationship.js +494 -494
  151. package/lib/cjs/Relationship.js.map +1 -1
  152. package/lib/cjs/RpcBackend.d.ts +5 -5
  153. package/lib/cjs/RpcBackend.js +31 -31
  154. package/lib/cjs/RpcBackend.js.map +1 -1
  155. package/lib/cjs/SQLiteDb.d.ts +219 -219
  156. package/lib/cjs/SQLiteDb.js +214 -214
  157. package/lib/cjs/SQLiteDb.js.map +1 -1
  158. package/lib/cjs/Schema.d.ts +55 -55
  159. package/lib/cjs/Schema.js +83 -83
  160. package/lib/cjs/Schema.js.map +1 -1
  161. package/lib/cjs/ServerBasedLocks.d.ts +57 -57
  162. package/lib/cjs/ServerBasedLocks.js +168 -168
  163. package/lib/cjs/ServerBasedLocks.js.map +1 -1
  164. package/lib/cjs/SqliteStatement.d.ts +360 -360
  165. package/lib/cjs/SqliteStatement.js +586 -586
  166. package/lib/cjs/SqliteStatement.js.map +1 -1
  167. package/lib/cjs/Texture.d.ts +58 -58
  168. package/lib/cjs/Texture.js +82 -82
  169. package/lib/cjs/Texture.js.map +1 -1
  170. package/lib/cjs/TileStorage.d.ts +18 -18
  171. package/lib/cjs/TileStorage.js +90 -90
  172. package/lib/cjs/TileStorage.js.map +1 -1
  173. package/lib/cjs/TxnManager.d.ts +202 -202
  174. package/lib/cjs/TxnManager.js +356 -356
  175. package/lib/cjs/TxnManager.js.map +1 -1
  176. package/lib/cjs/ViewDefinition.d.ts +439 -439
  177. package/lib/cjs/ViewDefinition.js +646 -646
  178. package/lib/cjs/ViewDefinition.js.map +1 -1
  179. package/lib/cjs/ViewStateHydrator.d.ts +13 -13
  180. package/lib/cjs/ViewStateHydrator.js +103 -103
  181. package/lib/cjs/ViewStateHydrator.js.map +1 -1
  182. package/lib/cjs/assets/IModelChange.02.00.00.ecschema.xml +90 -90
  183. package/lib/cjs/assets/Settings/Schemas/Cloud.Schema.json +67 -67
  184. package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +31 -31
  185. package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +52 -52
  186. package/lib/cjs/assets/Settings/backend.setting.json5 +138 -138
  187. package/lib/cjs/core-backend.d.ts +184 -184
  188. package/lib/cjs/core-backend.js +204 -204
  189. package/lib/cjs/core-backend.js.map +1 -1
  190. package/lib/cjs/domains/FunctionalElements.d.ts +101 -101
  191. package/lib/cjs/domains/FunctionalElements.js +145 -145
  192. package/lib/cjs/domains/FunctionalElements.js.map +1 -1
  193. package/lib/cjs/domains/FunctionalSchema.d.ts +13 -13
  194. package/lib/cjs/domains/FunctionalSchema.js +40 -40
  195. package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
  196. package/lib/cjs/domains/GenericElements.d.ts +177 -177
  197. package/lib/cjs/domains/GenericElements.js +263 -263
  198. package/lib/cjs/domains/GenericElements.js.map +1 -1
  199. package/lib/cjs/domains/GenericSchema.d.ts +10 -10
  200. package/lib/cjs/domains/GenericSchema.js +28 -28
  201. package/lib/cjs/domains/GenericSchema.js.map +1 -1
  202. package/lib/cjs/rpc/multipart.d.ts +11 -11
  203. package/lib/cjs/rpc/multipart.js +70 -70
  204. package/lib/cjs/rpc/multipart.js.map +1 -1
  205. package/lib/cjs/rpc/tracing.d.ts +28 -28
  206. package/lib/cjs/rpc/tracing.js +73 -73
  207. package/lib/cjs/rpc/tracing.js.map +1 -1
  208. package/lib/cjs/rpc/web/logging.d.ts +9 -9
  209. package/lib/cjs/rpc/web/logging.js +42 -42
  210. package/lib/cjs/rpc/web/logging.js.map +1 -1
  211. package/lib/cjs/rpc/web/request.d.ts +6 -6
  212. package/lib/cjs/rpc/web/request.js +73 -73
  213. package/lib/cjs/rpc/web/request.js.map +1 -1
  214. package/lib/cjs/rpc/web/response.d.ts +6 -6
  215. package/lib/cjs/rpc/web/response.js +105 -105
  216. package/lib/cjs/rpc/web/response.js.map +1 -1
  217. package/lib/cjs/rpc-impl/DevToolsRpcImpl.d.ts +15 -15
  218. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js +32 -32
  219. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -1
  220. package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts +47 -47
  221. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +291 -291
  222. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  223. package/lib/cjs/rpc-impl/IModelTileRpcImpl.d.ts +22 -22
  224. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js +202 -202
  225. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  226. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts +36 -36
  227. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js +168 -168
  228. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  229. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.d.ts +16 -16
  230. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js +43 -43
  231. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  232. package/lib/cjs/rpc-impl/WipRpcImpl.d.ts +15 -15
  233. package/lib/cjs/rpc-impl/WipRpcImpl.js +37 -37
  234. package/lib/cjs/rpc-impl/WipRpcImpl.js.map +1 -1
  235. package/lib/cjs/workspace/Settings.d.ts +186 -186
  236. package/lib/cjs/workspace/Settings.js +155 -155
  237. package/lib/cjs/workspace/Settings.js.map +1 -1
  238. package/lib/cjs/workspace/SettingsSchemas.d.ts +75 -75
  239. package/lib/cjs/workspace/SettingsSchemas.js +191 -191
  240. package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
  241. package/lib/cjs/workspace/Workspace.d.ts +414 -414
  242. package/lib/cjs/workspace/Workspace.js +543 -543
  243. package/lib/cjs/workspace/Workspace.js.map +1 -1
  244. 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 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,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,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CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC7B,GAAG,CAAC,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;AAtGD,oDAsGC;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":["/*---------------------------------------------------------------------------------------------\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 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,EA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AAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC5C,CAAC;CACF;AAtGD,oDAsGC;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 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 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"]}