@itwin/core-backend 3.5.0-dev.27 → 3.5.0-dev.28

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 (232) 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 -165
  14. package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
  15. package/lib/cjs/BriefcaseManager.js +413 -405
  16. package/lib/cjs/BriefcaseManager.js.map +1 -1
  17. package/lib/cjs/Category.d.ts +153 -153
  18. package/lib/cjs/Category.js +243 -243
  19. package/lib/cjs/Category.js.map +1 -1
  20. package/lib/cjs/ChangeSummaryManager.d.ts +187 -187
  21. package/lib/cjs/ChangeSummaryManager.js +445 -445
  22. package/lib/cjs/ChangeSummaryManager.js.map +1 -1
  23. package/lib/cjs/ChangedElementsDb.d.ts +99 -99
  24. package/lib/cjs/ChangedElementsDb.js +165 -165
  25. package/lib/cjs/ChangedElementsDb.js.map +1 -1
  26. package/lib/cjs/ChangedElementsManager.d.ts +39 -39
  27. package/lib/cjs/ChangedElementsManager.js +88 -88
  28. package/lib/cjs/ChangedElementsManager.js.map +1 -1
  29. package/lib/cjs/CheckpointManager.d.ts +120 -120
  30. package/lib/cjs/CheckpointManager.js +343 -343
  31. package/lib/cjs/CheckpointManager.js.map +1 -1
  32. package/lib/cjs/ClassRegistry.d.ts +72 -72
  33. package/lib/cjs/ClassRegistry.js +243 -243
  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 +11 -11
  48. package/lib/cjs/ConcurrentQuery.js +30 -30
  49. package/lib/cjs/ConcurrentQuery.js.map +1 -1
  50. package/lib/cjs/CustomViewState3dCreator.d.ts +21 -21
  51. package/lib/cjs/CustomViewState3dCreator.js +81 -81
  52. package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
  53. package/lib/cjs/DevTools.d.ts +71 -71
  54. package/lib/cjs/DevTools.js +154 -154
  55. package/lib/cjs/DevTools.js.map +1 -1
  56. package/lib/cjs/DisplayStyle.d.ts +106 -106
  57. package/lib/cjs/DisplayStyle.js +256 -256
  58. package/lib/cjs/DisplayStyle.js.map +1 -1
  59. package/lib/cjs/ECDb.d.ts +191 -191
  60. package/lib/cjs/ECDb.js +350 -350
  61. package/lib/cjs/ECDb.js.map +1 -1
  62. package/lib/cjs/ECSchemaXmlContext.d.ts +18 -18
  63. package/lib/cjs/ECSchemaXmlContext.js +41 -41
  64. package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
  65. package/lib/cjs/ECSqlStatement.d.ts +466 -466
  66. package/lib/cjs/ECSqlStatement.js +791 -791
  67. package/lib/cjs/ECSqlStatement.js.map +1 -1
  68. package/lib/cjs/Element.d.ts +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 +158 -158
  72. package/lib/cjs/ElementAspect.js +186 -186
  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 +82 -82
  94. package/lib/cjs/GeoCoordConfig.js.map +1 -1
  95. package/lib/cjs/GeometrySummary.d.ts +4 -4
  96. package/lib/cjs/GeometrySummary.js +380 -380
  97. package/lib/cjs/GeometrySummary.js.map +1 -1
  98. package/lib/cjs/HubMock.d.ts +94 -93
  99. package/lib/cjs/HubMock.d.ts.map +1 -1
  100. package/lib/cjs/HubMock.js +222 -190
  101. package/lib/cjs/HubMock.js.map +1 -1
  102. package/lib/cjs/IModelCloneContext.d.ts +8 -8
  103. package/lib/cjs/IModelCloneContext.js +15 -15
  104. package/lib/cjs/IModelCloneContext.js.map +1 -1
  105. package/lib/cjs/IModelDb.d.ts +1183 -1183
  106. package/lib/cjs/IModelDb.js +2374 -2374
  107. package/lib/cjs/IModelDb.js.map +1 -1
  108. package/lib/cjs/IModelElementCloneContext.d.ts +89 -89
  109. package/lib/cjs/IModelElementCloneContext.js +159 -159
  110. package/lib/cjs/IModelElementCloneContext.js.map +1 -1
  111. package/lib/cjs/IModelHost.d.ts +369 -369
  112. package/lib/cjs/IModelHost.js +492 -492
  113. package/lib/cjs/IModelHost.js.map +1 -1
  114. package/lib/cjs/IModelJsFs.d.ts +62 -62
  115. package/lib/cjs/IModelJsFs.js +140 -140
  116. package/lib/cjs/IModelJsFs.js.map +1 -1
  117. package/lib/cjs/IpcHost.d.ts +104 -98
  118. package/lib/cjs/IpcHost.d.ts.map +1 -1
  119. package/lib/cjs/IpcHost.js +278 -234
  120. package/lib/cjs/IpcHost.js.map +1 -1
  121. package/lib/cjs/LineStyle.d.ts +311 -311
  122. package/lib/cjs/LineStyle.js +295 -295
  123. package/lib/cjs/LineStyle.js.map +1 -1
  124. package/lib/cjs/LocalHub.d.ts +162 -162
  125. package/lib/cjs/LocalHub.js +587 -587
  126. package/lib/cjs/LocalHub.js.map +1 -1
  127. package/lib/cjs/LocalhostIpcHost.d.ts +20 -20
  128. package/lib/cjs/LocalhostIpcHost.js +81 -81
  129. package/lib/cjs/LocalhostIpcHost.js.map +1 -1
  130. package/lib/cjs/Material.d.ts +103 -103
  131. package/lib/cjs/Material.js +147 -147
  132. package/lib/cjs/Material.js.map +1 -1
  133. package/lib/cjs/Model.d.ts +392 -392
  134. package/lib/cjs/Model.js +485 -485
  135. package/lib/cjs/Model.js.map +1 -1
  136. package/lib/cjs/NativeAppStorage.d.ts +51 -51
  137. package/lib/cjs/NativeAppStorage.js +202 -202
  138. package/lib/cjs/NativeAppStorage.js.map +1 -1
  139. package/lib/cjs/NativeHost.d.ts +52 -52
  140. package/lib/cjs/NativeHost.d.ts.map +1 -1
  141. package/lib/cjs/NativeHost.js +163 -168
  142. package/lib/cjs/NativeHost.js.map +1 -1
  143. package/lib/cjs/NavigationRelationship.d.ts +156 -156
  144. package/lib/cjs/NavigationRelationship.js +225 -225
  145. package/lib/cjs/NavigationRelationship.js.map +1 -1
  146. package/lib/cjs/PromiseMemoizer.d.ts +51 -51
  147. package/lib/cjs/PromiseMemoizer.js +101 -101
  148. package/lib/cjs/PromiseMemoizer.js.map +1 -1
  149. package/lib/cjs/PropertyStore.d.ts +132 -132
  150. package/lib/cjs/PropertyStore.js +11 -11
  151. package/lib/cjs/PropertyStore.js.map +1 -1
  152. package/lib/cjs/Relationship.d.ts +416 -416
  153. package/lib/cjs/Relationship.js +494 -494
  154. package/lib/cjs/Relationship.js.map +1 -1
  155. package/lib/cjs/RpcBackend.d.ts +28 -28
  156. package/lib/cjs/RpcBackend.js +126 -126
  157. package/lib/cjs/RpcBackend.js.map +1 -1
  158. package/lib/cjs/SQLiteDb.d.ts +219 -219
  159. package/lib/cjs/SQLiteDb.js +214 -214
  160. package/lib/cjs/SQLiteDb.js.map +1 -1
  161. package/lib/cjs/Schema.d.ts +55 -55
  162. package/lib/cjs/Schema.js +83 -83
  163. package/lib/cjs/Schema.js.map +1 -1
  164. package/lib/cjs/ServerBasedLocks.d.ts +57 -57
  165. package/lib/cjs/ServerBasedLocks.js +168 -168
  166. package/lib/cjs/ServerBasedLocks.js.map +1 -1
  167. package/lib/cjs/SqliteStatement.d.ts +360 -360
  168. package/lib/cjs/SqliteStatement.js +586 -586
  169. package/lib/cjs/SqliteStatement.js.map +1 -1
  170. package/lib/cjs/Texture.d.ts +58 -58
  171. package/lib/cjs/Texture.js +82 -82
  172. package/lib/cjs/Texture.js.map +1 -1
  173. package/lib/cjs/TileStorage.d.ts +18 -18
  174. package/lib/cjs/TileStorage.js +90 -90
  175. package/lib/cjs/TileStorage.js.map +1 -1
  176. package/lib/cjs/TxnManager.d.ts +202 -202
  177. package/lib/cjs/TxnManager.js +356 -356
  178. package/lib/cjs/TxnManager.js.map +1 -1
  179. package/lib/cjs/ViewDefinition.d.ts +439 -439
  180. package/lib/cjs/ViewDefinition.js +646 -646
  181. package/lib/cjs/ViewDefinition.js.map +1 -1
  182. package/lib/cjs/ViewStateHydrator.d.ts +13 -13
  183. package/lib/cjs/ViewStateHydrator.js +103 -103
  184. package/lib/cjs/ViewStateHydrator.js.map +1 -1
  185. package/lib/cjs/assets/IModelChange.02.00.00.ecschema.xml +90 -90
  186. package/lib/cjs/assets/Settings/Schemas/Cloud.Schema.json +67 -67
  187. package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +31 -31
  188. package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +52 -52
  189. package/lib/cjs/assets/Settings/backend.setting.json5 +138 -138
  190. package/lib/cjs/core-backend.d.ts +184 -184
  191. package/lib/cjs/core-backend.js +204 -204
  192. package/lib/cjs/core-backend.js.map +1 -1
  193. package/lib/cjs/domains/FunctionalElements.d.ts +101 -101
  194. package/lib/cjs/domains/FunctionalElements.js +145 -145
  195. package/lib/cjs/domains/FunctionalElements.js.map +1 -1
  196. package/lib/cjs/domains/FunctionalSchema.d.ts +13 -13
  197. package/lib/cjs/domains/FunctionalSchema.js +40 -40
  198. package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
  199. package/lib/cjs/domains/GenericElements.d.ts +177 -177
  200. package/lib/cjs/domains/GenericElements.js +263 -263
  201. package/lib/cjs/domains/GenericElements.js.map +1 -1
  202. package/lib/cjs/domains/GenericSchema.d.ts +10 -10
  203. package/lib/cjs/domains/GenericSchema.js +28 -28
  204. package/lib/cjs/domains/GenericSchema.js.map +1 -1
  205. package/lib/cjs/rpc-impl/DevToolsRpcImpl.d.ts +15 -15
  206. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js +32 -32
  207. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -1
  208. package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts +46 -46
  209. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +287 -287
  210. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  211. package/lib/cjs/rpc-impl/IModelTileRpcImpl.d.ts +22 -22
  212. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js +202 -202
  213. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  214. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts +36 -36
  215. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js +168 -168
  216. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  217. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.d.ts +16 -16
  218. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js +43 -43
  219. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  220. package/lib/cjs/rpc-impl/WipRpcImpl.d.ts +15 -15
  221. package/lib/cjs/rpc-impl/WipRpcImpl.js +37 -37
  222. package/lib/cjs/rpc-impl/WipRpcImpl.js.map +1 -1
  223. package/lib/cjs/workspace/Settings.d.ts +186 -186
  224. package/lib/cjs/workspace/Settings.js +155 -155
  225. package/lib/cjs/workspace/Settings.js.map +1 -1
  226. package/lib/cjs/workspace/SettingsSchemas.d.ts +75 -75
  227. package/lib/cjs/workspace/SettingsSchemas.js +191 -191
  228. package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
  229. package/lib/cjs/workspace/Workspace.d.ts +414 -414
  230. package/lib/cjs/workspace/Workspace.js +543 -543
  231. package/lib/cjs/workspace/Workspace.js.map +1 -1
  232. package/package.json +12 -12
@@ -1,90 +1,90 @@
1
- /** @packageDocumentation
2
- * @module iModels
3
- */
4
- import { Id64String } from "@itwin/core-bentley";
5
- import { ElementProps } from "@itwin/core-common";
6
- import { IModelJsNative } from "@bentley/imodeljs-native";
7
- import { Element } from "./Element";
8
- import { IModelDb } from "./IModelDb";
9
- import { SQLiteDb } from "./SQLiteDb";
10
- /** The context for transforming a *source* Element to a *target* Element and remapping internal identifiers to the target iModel.
11
- * @beta
12
- */
13
- export declare class IModelElementCloneContext {
14
- /** The source IModelDb. */
15
- readonly sourceDb: IModelDb;
16
- /** The target IModelDb. */
17
- readonly targetDb: IModelDb;
18
- /** The native import context */
19
- private _nativeContext;
20
- /** Construct a new IModelElementCloneContext. It must be initialized with `initialize`, consider using [[IModelElementCloneContext.create]] instead
21
- * @param sourceDb The source IModelDb.
22
- * @param targetDb If provided the target IModelDb. If not provided, the source and target are the same IModelDb.
23
- */
24
- constructor(sourceDb: IModelDb, targetDb?: IModelDb);
25
- /** perform necessary initialization to use a clone context, namely caching the reference types in the source's schemas */
26
- initialize(): Promise<void>;
27
- /** construct and initialize an IModelElementCloneContext at once, for where you construct in an async context */
28
- static create(...args: ConstructorParameters<typeof IModelElementCloneContext>): Promise<IModelElementCloneContext>;
29
- /** Returns `true` if this context is for transforming between 2 iModels and `false` if it for transforming within the same iModel. */
30
- get isBetweenIModels(): boolean;
31
- /** Dispose any native resources associated with this IModelElementCloneContext. */
32
- dispose(): void;
33
- /** Debugging aid that dumps the Id remapping details and other information to the specified output file.
34
- * @internal
35
- */
36
- dump(outputFileName: string): void;
37
- /** Add a rule that remaps the specified source [CodeSpec]($common) to the specified target [CodeSpec]($common).
38
- * @param sourceCodeSpecName The name of the CodeSpec from the source iModel.
39
- * @param targetCodeSpecName The name of the CodeSpec from the target iModel.
40
- * @throws [[IModelError]] if either CodeSpec could not be found.
41
- */
42
- remapCodeSpec(sourceCodeSpecName: string, targetCodeSpecName: string): void;
43
- /** Add a rule that remaps the specified source class to the specified target class. */
44
- remapElementClass(sourceClassFullName: string, targetClassFullName: string): void;
45
- /** Add a rule that remaps the specified source Element to the specified target Element. */
46
- remapElement(sourceId: Id64String, targetId: Id64String): void;
47
- /** Remove a rule that remaps the specified source Element. */
48
- removeElement(sourceId: Id64String): void;
49
- /** Look up a target CodeSpecId from the source CodeSpecId.
50
- * @returns the target CodeSpecId or [Id64.invalid]($bentley) if a mapping not found.
51
- */
52
- findTargetCodeSpecId(sourceId: Id64String): Id64String;
53
- /** Look up a target ElementId from the source ElementId.
54
- * @returns the target ElementId or [Id64.invalid]($bentley) if a mapping not found.
55
- */
56
- findTargetElementId(sourceElementId: Id64String): Id64String;
57
- /** Filter out geometry entries in the specified SubCategory from GeometryStreams in the target iModel.
58
- * @note It is not possible to filter out a *default* SubCategory. A request to do so will be ignored.
59
- * @see [SubCategory.isDefaultSubCategory]($backend)
60
- */
61
- filterSubCategory(sourceSubCategoryId: Id64String): void;
62
- /** Returns `true` if there are any SubCategories being filtered. */
63
- get hasSubCategoryFilter(): boolean;
64
- /** Returns `true` if this SubCategory is being filtered. */
65
- isSubCategoryFiltered(subCategoryId: Id64String): boolean;
66
- /** Import the specified font from the source iModel into the target iModel.
67
- * @internal
68
- */
69
- importFont(sourceFontNumber: number): void;
70
- /** Import a single CodeSpec from the source iModel into the target iModel.
71
- * @internal
72
- */
73
- importCodeSpec(sourceCodeSpecId: Id64String): void;
74
- /** Clone the specified source Element into ElementProps for the target iModel.
75
- * @internal
76
- */
77
- cloneElement(sourceElement: Element, cloneOptions?: IModelJsNative.CloneElementOptions): ElementProps;
78
- /**
79
- * serialize state to a sqlite database at a given path
80
- * assumes the database has not already had any context state serialized to it
81
- * @internal
82
- */
83
- saveStateToDb(db: SQLiteDb): void;
84
- /**
85
- * load state from a sqlite database at a given path
86
- * @internal
87
- */
88
- loadStateFromDb(db: SQLiteDb): void;
89
- }
1
+ /** @packageDocumentation
2
+ * @module iModels
3
+ */
4
+ import { Id64String } from "@itwin/core-bentley";
5
+ import { ElementProps } from "@itwin/core-common";
6
+ import { IModelJsNative } from "@bentley/imodeljs-native";
7
+ import { Element } from "./Element";
8
+ import { IModelDb } from "./IModelDb";
9
+ import { SQLiteDb } from "./SQLiteDb";
10
+ /** The context for transforming a *source* Element to a *target* Element and remapping internal identifiers to the target iModel.
11
+ * @beta
12
+ */
13
+ export declare class IModelElementCloneContext {
14
+ /** The source IModelDb. */
15
+ readonly sourceDb: IModelDb;
16
+ /** The target IModelDb. */
17
+ readonly targetDb: IModelDb;
18
+ /** The native import context */
19
+ private _nativeContext;
20
+ /** Construct a new IModelElementCloneContext. It must be initialized with `initialize`, consider using [[IModelElementCloneContext.create]] instead
21
+ * @param sourceDb The source IModelDb.
22
+ * @param targetDb If provided the target IModelDb. If not provided, the source and target are the same IModelDb.
23
+ */
24
+ constructor(sourceDb: IModelDb, targetDb?: IModelDb);
25
+ /** perform necessary initialization to use a clone context, namely caching the reference types in the source's schemas */
26
+ initialize(): Promise<void>;
27
+ /** construct and initialize an IModelElementCloneContext at once, for where you construct in an async context */
28
+ static create(...args: ConstructorParameters<typeof IModelElementCloneContext>): Promise<IModelElementCloneContext>;
29
+ /** Returns `true` if this context is for transforming between 2 iModels and `false` if it for transforming within the same iModel. */
30
+ get isBetweenIModels(): boolean;
31
+ /** Dispose any native resources associated with this IModelElementCloneContext. */
32
+ dispose(): void;
33
+ /** Debugging aid that dumps the Id remapping details and other information to the specified output file.
34
+ * @internal
35
+ */
36
+ dump(outputFileName: string): void;
37
+ /** Add a rule that remaps the specified source [CodeSpec]($common) to the specified target [CodeSpec]($common).
38
+ * @param sourceCodeSpecName The name of the CodeSpec from the source iModel.
39
+ * @param targetCodeSpecName The name of the CodeSpec from the target iModel.
40
+ * @throws [[IModelError]] if either CodeSpec could not be found.
41
+ */
42
+ remapCodeSpec(sourceCodeSpecName: string, targetCodeSpecName: string): void;
43
+ /** Add a rule that remaps the specified source class to the specified target class. */
44
+ remapElementClass(sourceClassFullName: string, targetClassFullName: string): void;
45
+ /** Add a rule that remaps the specified source Element to the specified target Element. */
46
+ remapElement(sourceId: Id64String, targetId: Id64String): void;
47
+ /** Remove a rule that remaps the specified source Element. */
48
+ removeElement(sourceId: Id64String): void;
49
+ /** Look up a target CodeSpecId from the source CodeSpecId.
50
+ * @returns the target CodeSpecId or [Id64.invalid]($bentley) if a mapping not found.
51
+ */
52
+ findTargetCodeSpecId(sourceId: Id64String): Id64String;
53
+ /** Look up a target ElementId from the source ElementId.
54
+ * @returns the target ElementId or [Id64.invalid]($bentley) if a mapping not found.
55
+ */
56
+ findTargetElementId(sourceElementId: Id64String): Id64String;
57
+ /** Filter out geometry entries in the specified SubCategory from GeometryStreams in the target iModel.
58
+ * @note It is not possible to filter out a *default* SubCategory. A request to do so will be ignored.
59
+ * @see [SubCategory.isDefaultSubCategory]($backend)
60
+ */
61
+ filterSubCategory(sourceSubCategoryId: Id64String): void;
62
+ /** Returns `true` if there are any SubCategories being filtered. */
63
+ get hasSubCategoryFilter(): boolean;
64
+ /** Returns `true` if this SubCategory is being filtered. */
65
+ isSubCategoryFiltered(subCategoryId: Id64String): boolean;
66
+ /** Import the specified font from the source iModel into the target iModel.
67
+ * @internal
68
+ */
69
+ importFont(sourceFontNumber: number): void;
70
+ /** Import a single CodeSpec from the source iModel into the target iModel.
71
+ * @internal
72
+ */
73
+ importCodeSpec(sourceCodeSpecId: Id64String): void;
74
+ /** Clone the specified source Element into ElementProps for the target iModel.
75
+ * @internal
76
+ */
77
+ cloneElement(sourceElement: Element, cloneOptions?: IModelJsNative.CloneElementOptions): ElementProps;
78
+ /**
79
+ * serialize state to a sqlite database at a given path
80
+ * assumes the database has not already had any context state serialized to it
81
+ * @internal
82
+ */
83
+ saveStateToDb(db: SQLiteDb): void;
84
+ /**
85
+ * load state from a sqlite database at a given path
86
+ * @internal
87
+ */
88
+ loadStateFromDb(db: SQLiteDb): void;
89
+ }
90
90
  //# sourceMappingURL=IModelElementCloneContext.d.ts.map
@@ -1,160 +1,160 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IModelElementCloneContext = void 0;
4
- /*---------------------------------------------------------------------------------------------
5
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
6
- * See LICENSE.md in the project root for license terms and full copyright notice.
7
- *--------------------------------------------------------------------------------------------*/
8
- /** @packageDocumentation
9
- * @module iModels
10
- */
11
- const core_bentley_1 = require("@itwin/core-bentley");
12
- const core_common_1 = require("@itwin/core-common");
13
- const Category_1 = require("./Category");
14
- const IModelHost_1 = require("./IModelHost");
15
- /** The context for transforming a *source* Element to a *target* Element and remapping internal identifiers to the target iModel.
16
- * @beta
17
- */
18
- class IModelElementCloneContext {
19
- /** Construct a new IModelElementCloneContext. It must be initialized with `initialize`, consider using [[IModelElementCloneContext.create]] instead
20
- * @param sourceDb The source IModelDb.
21
- * @param targetDb If provided the target IModelDb. If not provided, the source and target are the same IModelDb.
22
- */
23
- constructor(sourceDb, targetDb) {
24
- this.sourceDb = sourceDb;
25
- this.targetDb = (undefined !== targetDb) ? targetDb : sourceDb;
26
- this._nativeContext = new IModelHost_1.IModelHost.platform.ImportContext(this.sourceDb.nativeDb, this.targetDb.nativeDb);
27
- }
28
- /** perform necessary initialization to use a clone context, namely caching the reference types in the source's schemas */
29
- async initialize() {
30
- }
31
- /** construct and initialize an IModelElementCloneContext at once, for where you construct in an async context */
32
- static async create(...args) {
33
- const instance = new this(...args);
34
- await instance.initialize();
35
- return instance;
36
- }
37
- /** Returns `true` if this context is for transforming between 2 iModels and `false` if it for transforming within the same iModel. */
38
- get isBetweenIModels() { return this.sourceDb !== this.targetDb; }
39
- /** Dispose any native resources associated with this IModelElementCloneContext. */
40
- dispose() { this._nativeContext.dispose(); }
41
- /** Debugging aid that dumps the Id remapping details and other information to the specified output file.
42
- * @internal
43
- */
44
- dump(outputFileName) { this._nativeContext.dump(outputFileName); }
45
- /** Add a rule that remaps the specified source [CodeSpec]($common) to the specified target [CodeSpec]($common).
46
- * @param sourceCodeSpecName The name of the CodeSpec from the source iModel.
47
- * @param targetCodeSpecName The name of the CodeSpec from the target iModel.
48
- * @throws [[IModelError]] if either CodeSpec could not be found.
49
- */
50
- remapCodeSpec(sourceCodeSpecName, targetCodeSpecName) {
51
- const sourceCodeSpec = this.sourceDb.codeSpecs.getByName(sourceCodeSpecName);
52
- const targetCodeSpec = this.targetDb.codeSpecs.getByName(targetCodeSpecName);
53
- this._nativeContext.addCodeSpecId(sourceCodeSpec.id, targetCodeSpec.id);
54
- }
55
- /** Add a rule that remaps the specified source class to the specified target class. */
56
- remapElementClass(sourceClassFullName, targetClassFullName) {
57
- this._nativeContext.addClass(sourceClassFullName, targetClassFullName);
58
- }
59
- /** Add a rule that remaps the specified source Element to the specified target Element. */
60
- remapElement(sourceId, targetId) {
61
- this._nativeContext.addElementId(sourceId, targetId);
62
- }
63
- /** Remove a rule that remaps the specified source Element. */
64
- removeElement(sourceId) {
65
- this._nativeContext.removeElementId(sourceId);
66
- }
67
- /** Look up a target CodeSpecId from the source CodeSpecId.
68
- * @returns the target CodeSpecId or [Id64.invalid]($bentley) if a mapping not found.
69
- */
70
- findTargetCodeSpecId(sourceId) {
71
- if (core_bentley_1.Id64.invalid === sourceId) {
72
- return core_bentley_1.Id64.invalid;
73
- }
74
- return this._nativeContext.findCodeSpecId(sourceId);
75
- }
76
- /** Look up a target ElementId from the source ElementId.
77
- * @returns the target ElementId or [Id64.invalid]($bentley) if a mapping not found.
78
- */
79
- findTargetElementId(sourceElementId) {
80
- if (core_bentley_1.Id64.invalid === sourceElementId) {
81
- return core_bentley_1.Id64.invalid;
82
- }
83
- return this._nativeContext.findElementId(sourceElementId);
84
- }
85
- /** Filter out geometry entries in the specified SubCategory from GeometryStreams in the target iModel.
86
- * @note It is not possible to filter out a *default* SubCategory. A request to do so will be ignored.
87
- * @see [SubCategory.isDefaultSubCategory]($backend)
88
- */
89
- filterSubCategory(sourceSubCategoryId) {
90
- const sourceSubCategory = this.sourceDb.elements.tryGetElement(sourceSubCategoryId, Category_1.SubCategory);
91
- if (sourceSubCategory && !sourceSubCategory.isDefaultSubCategory) {
92
- this._nativeContext.filterSubCategoryId(sourceSubCategoryId);
93
- }
94
- }
95
- /** Returns `true` if there are any SubCategories being filtered. */
96
- get hasSubCategoryFilter() {
97
- return this._nativeContext.hasSubCategoryFilter();
98
- }
99
- /** Returns `true` if this SubCategory is being filtered. */
100
- isSubCategoryFiltered(subCategoryId) {
101
- return this._nativeContext.isSubCategoryFiltered(subCategoryId);
102
- }
103
- /** Import the specified font from the source iModel into the target iModel.
104
- * @internal
105
- */
106
- importFont(sourceFontNumber) {
107
- this.targetDb.clearFontMap(); // so it will be reloaded with new font info
108
- this._nativeContext.importFont(sourceFontNumber);
109
- }
110
- /** Import a single CodeSpec from the source iModel into the target iModel.
111
- * @internal
112
- */
113
- importCodeSpec(sourceCodeSpecId) {
114
- this._nativeContext.importCodeSpec(sourceCodeSpecId);
115
- }
116
- /** Clone the specified source Element into ElementProps for the target iModel.
117
- * @internal
118
- */
119
- cloneElement(sourceElement, cloneOptions) {
120
- const targetElementProps = this._nativeContext.cloneElement(sourceElement.id, cloneOptions);
121
- // Ensure that all NavigationProperties in targetElementProps have a defined value so "clearing" changes will be part of the JSON used for update
122
- sourceElement.forEachProperty((propertyName, meta) => {
123
- if ((meta.isNavigation) && (undefined === sourceElement[propertyName])) {
124
- targetElementProps[propertyName] = core_common_1.RelatedElement.none;
125
- }
126
- }, false); // exclude custom because C++ has already handled them
127
- if (this.isBetweenIModels) {
128
- // The native C++ cloneElement strips off federationGuid, want to put it back if transformation is between iModels
129
- targetElementProps.federationGuid = sourceElement.federationGuid;
130
- if (core_common_1.CodeScopeSpec.Type.Repository === this.targetDb.codeSpecs.getById(targetElementProps.code.spec).scopeType) {
131
- targetElementProps.code.scope = core_common_1.IModel.rootSubjectId;
132
- }
133
- }
134
- // unlike other references, code cannot be null. If it is null, use an empty code instead
135
- if (targetElementProps.code.scope === core_bentley_1.Id64.invalid || targetElementProps.code.spec === core_bentley_1.Id64.invalid) {
136
- targetElementProps.code = core_common_1.Code.createEmpty();
137
- }
138
- const jsClass = this.sourceDb.getJsClass(sourceElement.classFullName);
139
- // eslint-disable-next-line @typescript-eslint/dot-notation
140
- jsClass["onCloned"](this, sourceElement.toJSON(), targetElementProps);
141
- return targetElementProps;
142
- }
143
- /**
144
- * serialize state to a sqlite database at a given path
145
- * assumes the database has not already had any context state serialized to it
146
- * @internal
147
- */
148
- saveStateToDb(db) {
149
- this._nativeContext.saveStateToDb(db.nativeDb);
150
- }
151
- /**
152
- * load state from a sqlite database at a given path
153
- * @internal
154
- */
155
- loadStateFromDb(db) {
156
- this._nativeContext.loadStateFromDb(db.nativeDb);
157
- }
158
- }
159
- exports.IModelElementCloneContext = IModelElementCloneContext;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IModelElementCloneContext = void 0;
4
+ /*---------------------------------------------------------------------------------------------
5
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
6
+ * See LICENSE.md in the project root for license terms and full copyright notice.
7
+ *--------------------------------------------------------------------------------------------*/
8
+ /** @packageDocumentation
9
+ * @module iModels
10
+ */
11
+ const core_bentley_1 = require("@itwin/core-bentley");
12
+ const core_common_1 = require("@itwin/core-common");
13
+ const Category_1 = require("./Category");
14
+ const IModelHost_1 = require("./IModelHost");
15
+ /** The context for transforming a *source* Element to a *target* Element and remapping internal identifiers to the target iModel.
16
+ * @beta
17
+ */
18
+ class IModelElementCloneContext {
19
+ /** Construct a new IModelElementCloneContext. It must be initialized with `initialize`, consider using [[IModelElementCloneContext.create]] instead
20
+ * @param sourceDb The source IModelDb.
21
+ * @param targetDb If provided the target IModelDb. If not provided, the source and target are the same IModelDb.
22
+ */
23
+ constructor(sourceDb, targetDb) {
24
+ this.sourceDb = sourceDb;
25
+ this.targetDb = (undefined !== targetDb) ? targetDb : sourceDb;
26
+ this._nativeContext = new IModelHost_1.IModelHost.platform.ImportContext(this.sourceDb.nativeDb, this.targetDb.nativeDb);
27
+ }
28
+ /** perform necessary initialization to use a clone context, namely caching the reference types in the source's schemas */
29
+ async initialize() {
30
+ }
31
+ /** construct and initialize an IModelElementCloneContext at once, for where you construct in an async context */
32
+ static async create(...args) {
33
+ const instance = new this(...args);
34
+ await instance.initialize();
35
+ return instance;
36
+ }
37
+ /** Returns `true` if this context is for transforming between 2 iModels and `false` if it for transforming within the same iModel. */
38
+ get isBetweenIModels() { return this.sourceDb !== this.targetDb; }
39
+ /** Dispose any native resources associated with this IModelElementCloneContext. */
40
+ dispose() { this._nativeContext.dispose(); }
41
+ /** Debugging aid that dumps the Id remapping details and other information to the specified output file.
42
+ * @internal
43
+ */
44
+ dump(outputFileName) { this._nativeContext.dump(outputFileName); }
45
+ /** Add a rule that remaps the specified source [CodeSpec]($common) to the specified target [CodeSpec]($common).
46
+ * @param sourceCodeSpecName The name of the CodeSpec from the source iModel.
47
+ * @param targetCodeSpecName The name of the CodeSpec from the target iModel.
48
+ * @throws [[IModelError]] if either CodeSpec could not be found.
49
+ */
50
+ remapCodeSpec(sourceCodeSpecName, targetCodeSpecName) {
51
+ const sourceCodeSpec = this.sourceDb.codeSpecs.getByName(sourceCodeSpecName);
52
+ const targetCodeSpec = this.targetDb.codeSpecs.getByName(targetCodeSpecName);
53
+ this._nativeContext.addCodeSpecId(sourceCodeSpec.id, targetCodeSpec.id);
54
+ }
55
+ /** Add a rule that remaps the specified source class to the specified target class. */
56
+ remapElementClass(sourceClassFullName, targetClassFullName) {
57
+ this._nativeContext.addClass(sourceClassFullName, targetClassFullName);
58
+ }
59
+ /** Add a rule that remaps the specified source Element to the specified target Element. */
60
+ remapElement(sourceId, targetId) {
61
+ this._nativeContext.addElementId(sourceId, targetId);
62
+ }
63
+ /** Remove a rule that remaps the specified source Element. */
64
+ removeElement(sourceId) {
65
+ this._nativeContext.removeElementId(sourceId);
66
+ }
67
+ /** Look up a target CodeSpecId from the source CodeSpecId.
68
+ * @returns the target CodeSpecId or [Id64.invalid]($bentley) if a mapping not found.
69
+ */
70
+ findTargetCodeSpecId(sourceId) {
71
+ if (core_bentley_1.Id64.invalid === sourceId) {
72
+ return core_bentley_1.Id64.invalid;
73
+ }
74
+ return this._nativeContext.findCodeSpecId(sourceId);
75
+ }
76
+ /** Look up a target ElementId from the source ElementId.
77
+ * @returns the target ElementId or [Id64.invalid]($bentley) if a mapping not found.
78
+ */
79
+ findTargetElementId(sourceElementId) {
80
+ if (core_bentley_1.Id64.invalid === sourceElementId) {
81
+ return core_bentley_1.Id64.invalid;
82
+ }
83
+ return this._nativeContext.findElementId(sourceElementId);
84
+ }
85
+ /** Filter out geometry entries in the specified SubCategory from GeometryStreams in the target iModel.
86
+ * @note It is not possible to filter out a *default* SubCategory. A request to do so will be ignored.
87
+ * @see [SubCategory.isDefaultSubCategory]($backend)
88
+ */
89
+ filterSubCategory(sourceSubCategoryId) {
90
+ const sourceSubCategory = this.sourceDb.elements.tryGetElement(sourceSubCategoryId, Category_1.SubCategory);
91
+ if (sourceSubCategory && !sourceSubCategory.isDefaultSubCategory) {
92
+ this._nativeContext.filterSubCategoryId(sourceSubCategoryId);
93
+ }
94
+ }
95
+ /** Returns `true` if there are any SubCategories being filtered. */
96
+ get hasSubCategoryFilter() {
97
+ return this._nativeContext.hasSubCategoryFilter();
98
+ }
99
+ /** Returns `true` if this SubCategory is being filtered. */
100
+ isSubCategoryFiltered(subCategoryId) {
101
+ return this._nativeContext.isSubCategoryFiltered(subCategoryId);
102
+ }
103
+ /** Import the specified font from the source iModel into the target iModel.
104
+ * @internal
105
+ */
106
+ importFont(sourceFontNumber) {
107
+ this.targetDb.clearFontMap(); // so it will be reloaded with new font info
108
+ this._nativeContext.importFont(sourceFontNumber);
109
+ }
110
+ /** Import a single CodeSpec from the source iModel into the target iModel.
111
+ * @internal
112
+ */
113
+ importCodeSpec(sourceCodeSpecId) {
114
+ this._nativeContext.importCodeSpec(sourceCodeSpecId);
115
+ }
116
+ /** Clone the specified source Element into ElementProps for the target iModel.
117
+ * @internal
118
+ */
119
+ cloneElement(sourceElement, cloneOptions) {
120
+ const targetElementProps = this._nativeContext.cloneElement(sourceElement.id, cloneOptions);
121
+ // Ensure that all NavigationProperties in targetElementProps have a defined value so "clearing" changes will be part of the JSON used for update
122
+ sourceElement.forEachProperty((propertyName, meta) => {
123
+ if ((meta.isNavigation) && (undefined === sourceElement[propertyName])) {
124
+ targetElementProps[propertyName] = core_common_1.RelatedElement.none;
125
+ }
126
+ }, false); // exclude custom because C++ has already handled them
127
+ if (this.isBetweenIModels) {
128
+ // The native C++ cloneElement strips off federationGuid, want to put it back if transformation is between iModels
129
+ targetElementProps.federationGuid = sourceElement.federationGuid;
130
+ if (core_common_1.CodeScopeSpec.Type.Repository === this.targetDb.codeSpecs.getById(targetElementProps.code.spec).scopeType) {
131
+ targetElementProps.code.scope = core_common_1.IModel.rootSubjectId;
132
+ }
133
+ }
134
+ // unlike other references, code cannot be null. If it is null, use an empty code instead
135
+ if (targetElementProps.code.scope === core_bentley_1.Id64.invalid || targetElementProps.code.spec === core_bentley_1.Id64.invalid) {
136
+ targetElementProps.code = core_common_1.Code.createEmpty();
137
+ }
138
+ const jsClass = this.sourceDb.getJsClass(sourceElement.classFullName);
139
+ // eslint-disable-next-line @typescript-eslint/dot-notation
140
+ jsClass["onCloned"](this, sourceElement.toJSON(), targetElementProps);
141
+ return targetElementProps;
142
+ }
143
+ /**
144
+ * serialize state to a sqlite database at a given path
145
+ * assumes the database has not already had any context state serialized to it
146
+ * @internal
147
+ */
148
+ saveStateToDb(db) {
149
+ this._nativeContext.saveStateToDb(db.nativeDb);
150
+ }
151
+ /**
152
+ * load state from a sqlite database at a given path
153
+ * @internal
154
+ */
155
+ loadStateFromDb(db) {
156
+ this._nativeContext.loadStateFromDb(db.nativeDb);
157
+ }
158
+ }
159
+ exports.IModelElementCloneContext = IModelElementCloneContext;
160
160
  //# sourceMappingURL=IModelElementCloneContext.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"IModelElementCloneContext.js","sourceRoot":"","sources":["../../src/IModelElementCloneContext.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,sDAAuD;AACvD,oDAA2H;AAE3H,yCAAyC;AAGzC,6CAA0C;AAG1C;;GAEG;AACH,MAAa,yBAAyB;IAQpC;;;OAGG;IACH,YAAmB,QAAkB,EAAE,QAAmB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a,CAAC;aACtD;SACF;QACD,yFAAyF;QACzF,IAAI,kBAAkB,CAAC,IAAI,CAAC,KAAK,KAAK,mBAAI,CAAC,OAAO,IAAI,kBAAkB,CAAC,IAAI,CAAC,IAAI,KAAK,mBAAI,CAAC,OAAO,EAAE;YACnG,kBAAkB,CAAC,IAAI,GAAG,kBAAI,CAAC,WAAW,EAAE,CAAC;SAC9C;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAiB,aAAa,CAAC,aAAa,CAAC,CAAC;QACtF,2DAA2D;QAC3D,OAAO,CAAC,UAAU,CAAC,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,EAAE,EAAE,kBAAkB,CAAC,CAAC;QACtE,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACI,aAAa,CAAC,EAAY;QAC/B,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;IACjD,CAAC;IAED;;;OAGG;IACI,eAAe,CAAC,EAAY;QACjC,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;IACnD,CAAC;CACF;AAtKD,8DAsKC","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 iModels\n */\nimport { Id64, Id64String } from \"@itwin/core-bentley\";\nimport { Code, CodeScopeSpec, CodeSpec, ElementProps, IModel, PropertyMetaData, RelatedElement } from \"@itwin/core-common\";\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\nimport { SubCategory } from \"./Category\";\nimport { Element } from \"./Element\";\nimport { IModelDb } from \"./IModelDb\";\nimport { IModelHost } from \"./IModelHost\";\nimport { SQLiteDb } from \"./SQLiteDb\";\n\n/** The context for transforming a *source* Element to a *target* Element and remapping internal identifiers to the target iModel.\n * @beta\n */\nexport class IModelElementCloneContext {\n /** The source IModelDb. */\n public readonly sourceDb: IModelDb;\n /** The target IModelDb. */\n public readonly targetDb: IModelDb;\n /** The native import context */\n private _nativeContext: IModelJsNative.ImportContext;\n\n /** Construct a new IModelElementCloneContext. It must be initialized with `initialize`, consider using [[IModelElementCloneContext.create]] instead\n * @param sourceDb The source IModelDb.\n * @param targetDb If provided the target IModelDb. If not provided, the source and target are the same IModelDb.\n */\n public constructor(sourceDb: IModelDb, targetDb?: IModelDb) {\n this.sourceDb = sourceDb;\n this.targetDb = (undefined !== targetDb) ? targetDb : sourceDb;\n this._nativeContext = new IModelHost.platform.ImportContext(this.sourceDb.nativeDb, this.targetDb.nativeDb);\n }\n\n /** perform necessary initialization to use a clone context, namely caching the reference types in the source's schemas */\n public async initialize() {\n }\n\n /** construct and initialize an IModelElementCloneContext at once, for where you construct in an async context */\n public static async create(...args: ConstructorParameters<typeof IModelElementCloneContext>): Promise<IModelElementCloneContext> {\n const instance = new this(...args);\n await instance.initialize();\n return instance;\n }\n\n /** Returns `true` if this context is for transforming between 2 iModels and `false` if it for transforming within the same iModel. */\n public get isBetweenIModels(): boolean { return this.sourceDb !== this.targetDb; }\n\n /** Dispose any native resources associated with this IModelElementCloneContext. */\n public dispose(): void { this._nativeContext.dispose(); }\n\n /** Debugging aid that dumps the Id remapping details and other information to the specified output file.\n * @internal\n */\n public dump(outputFileName: string): void { this._nativeContext.dump(outputFileName); }\n\n /** Add a rule that remaps the specified source [CodeSpec]($common) to the specified target [CodeSpec]($common).\n * @param sourceCodeSpecName The name of the CodeSpec from the source iModel.\n * @param targetCodeSpecName The name of the CodeSpec from the target iModel.\n * @throws [[IModelError]] if either CodeSpec could not be found.\n */\n public remapCodeSpec(sourceCodeSpecName: string, targetCodeSpecName: string): void {\n const sourceCodeSpec: CodeSpec = this.sourceDb.codeSpecs.getByName(sourceCodeSpecName);\n const targetCodeSpec: CodeSpec = this.targetDb.codeSpecs.getByName(targetCodeSpecName);\n this._nativeContext.addCodeSpecId(sourceCodeSpec.id, targetCodeSpec.id);\n }\n\n /** Add a rule that remaps the specified source class to the specified target class. */\n public remapElementClass(sourceClassFullName: string, targetClassFullName: string): void {\n this._nativeContext.addClass(sourceClassFullName, targetClassFullName);\n }\n\n /** Add a rule that remaps the specified source Element to the specified target Element. */\n public remapElement(sourceId: Id64String, targetId: Id64String): void {\n this._nativeContext.addElementId(sourceId, targetId);\n }\n\n /** Remove a rule that remaps the specified source Element. */\n public removeElement(sourceId: Id64String): void {\n this._nativeContext.removeElementId(sourceId);\n }\n\n /** Look up a target CodeSpecId from the source CodeSpecId.\n * @returns the target CodeSpecId or [Id64.invalid]($bentley) if a mapping not found.\n */\n public findTargetCodeSpecId(sourceId: Id64String): Id64String {\n if (Id64.invalid === sourceId) {\n return Id64.invalid;\n }\n return this._nativeContext.findCodeSpecId(sourceId);\n }\n\n /** Look up a target ElementId from the source ElementId.\n * @returns the target ElementId or [Id64.invalid]($bentley) if a mapping not found.\n */\n public findTargetElementId(sourceElementId: Id64String): Id64String {\n if (Id64.invalid === sourceElementId) {\n return Id64.invalid;\n }\n return this._nativeContext.findElementId(sourceElementId);\n }\n\n /** Filter out geometry entries in the specified SubCategory from GeometryStreams in the target iModel.\n * @note It is not possible to filter out a *default* SubCategory. A request to do so will be ignored.\n * @see [SubCategory.isDefaultSubCategory]($backend)\n */\n public filterSubCategory(sourceSubCategoryId: Id64String): void {\n const sourceSubCategory = this.sourceDb.elements.tryGetElement<SubCategory>(sourceSubCategoryId, SubCategory);\n if (sourceSubCategory && !sourceSubCategory.isDefaultSubCategory) {\n this._nativeContext.filterSubCategoryId(sourceSubCategoryId);\n }\n }\n\n /** Returns `true` if there are any SubCategories being filtered. */\n public get hasSubCategoryFilter(): boolean {\n return this._nativeContext.hasSubCategoryFilter();\n }\n\n /** Returns `true` if this SubCategory is being filtered. */\n public isSubCategoryFiltered(subCategoryId: Id64String): boolean {\n return this._nativeContext.isSubCategoryFiltered(subCategoryId);\n }\n\n /** Import the specified font from the source iModel into the target iModel.\n * @internal\n */\n public importFont(sourceFontNumber: number): void {\n this.targetDb.clearFontMap(); // so it will be reloaded with new font info\n this._nativeContext.importFont(sourceFontNumber);\n }\n\n /** Import a single CodeSpec from the source iModel into the target iModel.\n * @internal\n */\n public importCodeSpec(sourceCodeSpecId: Id64String): void {\n this._nativeContext.importCodeSpec(sourceCodeSpecId);\n }\n\n /** Clone the specified source Element into ElementProps for the target iModel.\n * @internal\n */\n public cloneElement(sourceElement: Element, cloneOptions?: IModelJsNative.CloneElementOptions): ElementProps {\n const targetElementProps: ElementProps = this._nativeContext.cloneElement(sourceElement.id, cloneOptions);\n // Ensure that all NavigationProperties in targetElementProps have a defined value so \"clearing\" changes will be part of the JSON used for update\n sourceElement.forEachProperty((propertyName: string, meta: PropertyMetaData) => {\n if ((meta.isNavigation) && (undefined === (sourceElement as any)[propertyName])) {\n (targetElementProps as any)[propertyName] = RelatedElement.none;\n }\n }, false); // exclude custom because C++ has already handled them\n if (this.isBetweenIModels) {\n // The native C++ cloneElement strips off federationGuid, want to put it back if transformation is between iModels\n targetElementProps.federationGuid = sourceElement.federationGuid;\n if (CodeScopeSpec.Type.Repository === this.targetDb.codeSpecs.getById(targetElementProps.code.spec).scopeType) {\n targetElementProps.code.scope = IModel.rootSubjectId;\n }\n }\n // unlike other references, code cannot be null. If it is null, use an empty code instead\n if (targetElementProps.code.scope === Id64.invalid || targetElementProps.code.spec === Id64.invalid) {\n targetElementProps.code = Code.createEmpty();\n }\n const jsClass = this.sourceDb.getJsClass<typeof Element>(sourceElement.classFullName);\n // eslint-disable-next-line @typescript-eslint/dot-notation\n jsClass[\"onCloned\"](this, sourceElement.toJSON(), targetElementProps);\n return targetElementProps;\n }\n\n /**\n * serialize state to a sqlite database at a given path\n * assumes the database has not already had any context state serialized to it\n * @internal\n */\n public saveStateToDb(db: SQLiteDb): void {\n this._nativeContext.saveStateToDb(db.nativeDb);\n }\n\n /**\n * load state from a sqlite database at a given path\n * @internal\n */\n public loadStateFromDb(db: SQLiteDb): void {\n this._nativeContext.loadStateFromDb(db.nativeDb);\n }\n}\n"]}
1
+ {"version":3,"file":"IModelElementCloneContext.js","sourceRoot":"","sources":["../../src/IModelElementCloneContext.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,sDAAuD;AACvD,oDAA2H;AAE3H,yCAAyC;AAGzC,6CAA0C;AAG1C;;GAEG;AACH,MAAa,yBAAyB;IAQpC;;;OAGG;IACH,YAAmB,QAAkB,EAAE,QAAmB;QACxD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC;QAC/D,IAAI,CAAC,cAAc,GAAG,IAAI,uBAAU,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC9G,CAAC;IAED,0HAA0H;IACnH,KAAK,CAAC,UAAU;IACvB,CAAC;IAED,iHAAiH;IAC1G,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,IAA6D;QACzF,MAAM,QAAQ,GAAG,IAAI,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;QACnC,MAAM,QAAQ,CAAC,UAAU,EAAE,CAAC;QAC5B,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,sIAAsI;IACtI,IAAW,gBAAgB,KAAc,OAAO,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAElF,mFAAmF;IAC5E,OAAO,KAAW,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAEzD;;OAEG;IACI,IAAI,CAAC,cAAsB,IAAU,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,cAAc,C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CAAC,sDAAsD;QACjE,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACzB,kHAAkH;YAClH,kBAAkB,CAAC,cAAc,GAAG,aAAa,CAAC,cAAc,CAAC;YACjE,IAAI,2BAAa,CAAC,IAAI,CAAC,UAAU,KAAK,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE;gBAC7G,kBAAkB,CAAC,IAAI,CAAC,KAAK,GAAG,oBAAM,CAAC,aAAa,CAAC;aACtD;SACF;QACD,yFAAyF;QACzF,IAAI,kBAAkB,CAAC,IAAI,CAAC,KAAK,KAAK,mBAAI,CAAC,OAAO,IAAI,kBAAkB,CAAC,IAAI,CAAC,IAAI,KAAK,mBAAI,CAAC,OAAO,EAAE;YACnG,kBAAkB,CAAC,IAAI,GAAG,kBAAI,CAAC,WAAW,EAAE,CAAC;SAC9C;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAiB,aAAa,CAAC,aAAa,CAAC,CAAC;QACtF,2DAA2D;QAC3D,OAAO,CAAC,UAAU,CAAC,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,EAAE,EAAE,kBAAkB,CAAC,CAAC;QACtE,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACI,aAAa,CAAC,EAAY;QAC/B,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;IACjD,CAAC;IAED;;;OAGG;IACI,eAAe,CAAC,EAAY;QACjC,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;IACnD,CAAC;CACF;AAtKD,8DAsKC","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 iModels\r\n */\r\nimport { Id64, Id64String } from \"@itwin/core-bentley\";\r\nimport { Code, CodeScopeSpec, CodeSpec, ElementProps, IModel, PropertyMetaData, RelatedElement } from \"@itwin/core-common\";\r\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\r\nimport { SubCategory } from \"./Category\";\r\nimport { Element } from \"./Element\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { IModelHost } from \"./IModelHost\";\r\nimport { SQLiteDb } from \"./SQLiteDb\";\r\n\r\n/** The context for transforming a *source* Element to a *target* Element and remapping internal identifiers to the target iModel.\r\n * @beta\r\n */\r\nexport class IModelElementCloneContext {\r\n /** The source IModelDb. */\r\n public readonly sourceDb: IModelDb;\r\n /** The target IModelDb. */\r\n public readonly targetDb: IModelDb;\r\n /** The native import context */\r\n private _nativeContext: IModelJsNative.ImportContext;\r\n\r\n /** Construct a new IModelElementCloneContext. It must be initialized with `initialize`, consider using [[IModelElementCloneContext.create]] instead\r\n * @param sourceDb The source IModelDb.\r\n * @param targetDb If provided the target IModelDb. If not provided, the source and target are the same IModelDb.\r\n */\r\n public constructor(sourceDb: IModelDb, targetDb?: IModelDb) {\r\n this.sourceDb = sourceDb;\r\n this.targetDb = (undefined !== targetDb) ? targetDb : sourceDb;\r\n this._nativeContext = new IModelHost.platform.ImportContext(this.sourceDb.nativeDb, this.targetDb.nativeDb);\r\n }\r\n\r\n /** perform necessary initialization to use a clone context, namely caching the reference types in the source's schemas */\r\n public async initialize() {\r\n }\r\n\r\n /** construct and initialize an IModelElementCloneContext at once, for where you construct in an async context */\r\n public static async create(...args: ConstructorParameters<typeof IModelElementCloneContext>): Promise<IModelElementCloneContext> {\r\n const instance = new this(...args);\r\n await instance.initialize();\r\n return instance;\r\n }\r\n\r\n /** Returns `true` if this context is for transforming between 2 iModels and `false` if it for transforming within the same iModel. */\r\n public get isBetweenIModels(): boolean { return this.sourceDb !== this.targetDb; }\r\n\r\n /** Dispose any native resources associated with this IModelElementCloneContext. */\r\n public dispose(): void { this._nativeContext.dispose(); }\r\n\r\n /** Debugging aid that dumps the Id remapping details and other information to the specified output file.\r\n * @internal\r\n */\r\n public dump(outputFileName: string): void { this._nativeContext.dump(outputFileName); }\r\n\r\n /** Add a rule that remaps the specified source [CodeSpec]($common) to the specified target [CodeSpec]($common).\r\n * @param sourceCodeSpecName The name of the CodeSpec from the source iModel.\r\n * @param targetCodeSpecName The name of the CodeSpec from the target iModel.\r\n * @throws [[IModelError]] if either CodeSpec could not be found.\r\n */\r\n public remapCodeSpec(sourceCodeSpecName: string, targetCodeSpecName: string): void {\r\n const sourceCodeSpec: CodeSpec = this.sourceDb.codeSpecs.getByName(sourceCodeSpecName);\r\n const targetCodeSpec: CodeSpec = this.targetDb.codeSpecs.getByName(targetCodeSpecName);\r\n this._nativeContext.addCodeSpecId(sourceCodeSpec.id, targetCodeSpec.id);\r\n }\r\n\r\n /** Add a rule that remaps the specified source class to the specified target class. */\r\n public remapElementClass(sourceClassFullName: string, targetClassFullName: string): void {\r\n this._nativeContext.addClass(sourceClassFullName, targetClassFullName);\r\n }\r\n\r\n /** Add a rule that remaps the specified source Element to the specified target Element. */\r\n public remapElement(sourceId: Id64String, targetId: Id64String): void {\r\n this._nativeContext.addElementId(sourceId, targetId);\r\n }\r\n\r\n /** Remove a rule that remaps the specified source Element. */\r\n public removeElement(sourceId: Id64String): void {\r\n this._nativeContext.removeElementId(sourceId);\r\n }\r\n\r\n /** Look up a target CodeSpecId from the source CodeSpecId.\r\n * @returns the target CodeSpecId or [Id64.invalid]($bentley) if a mapping not found.\r\n */\r\n public findTargetCodeSpecId(sourceId: Id64String): Id64String {\r\n if (Id64.invalid === sourceId) {\r\n return Id64.invalid;\r\n }\r\n return this._nativeContext.findCodeSpecId(sourceId);\r\n }\r\n\r\n /** Look up a target ElementId from the source ElementId.\r\n * @returns the target ElementId or [Id64.invalid]($bentley) if a mapping not found.\r\n */\r\n public findTargetElementId(sourceElementId: Id64String): Id64String {\r\n if (Id64.invalid === sourceElementId) {\r\n return Id64.invalid;\r\n }\r\n return this._nativeContext.findElementId(sourceElementId);\r\n }\r\n\r\n /** Filter out geometry entries in the specified SubCategory from GeometryStreams in the target iModel.\r\n * @note It is not possible to filter out a *default* SubCategory. A request to do so will be ignored.\r\n * @see [SubCategory.isDefaultSubCategory]($backend)\r\n */\r\n public filterSubCategory(sourceSubCategoryId: Id64String): void {\r\n const sourceSubCategory = this.sourceDb.elements.tryGetElement<SubCategory>(sourceSubCategoryId, SubCategory);\r\n if (sourceSubCategory && !sourceSubCategory.isDefaultSubCategory) {\r\n this._nativeContext.filterSubCategoryId(sourceSubCategoryId);\r\n }\r\n }\r\n\r\n /** Returns `true` if there are any SubCategories being filtered. */\r\n public get hasSubCategoryFilter(): boolean {\r\n return this._nativeContext.hasSubCategoryFilter();\r\n }\r\n\r\n /** Returns `true` if this SubCategory is being filtered. */\r\n public isSubCategoryFiltered(subCategoryId: Id64String): boolean {\r\n return this._nativeContext.isSubCategoryFiltered(subCategoryId);\r\n }\r\n\r\n /** Import the specified font from the source iModel into the target iModel.\r\n * @internal\r\n */\r\n public importFont(sourceFontNumber: number): void {\r\n this.targetDb.clearFontMap(); // so it will be reloaded with new font info\r\n this._nativeContext.importFont(sourceFontNumber);\r\n }\r\n\r\n /** Import a single CodeSpec from the source iModel into the target iModel.\r\n * @internal\r\n */\r\n public importCodeSpec(sourceCodeSpecId: Id64String): void {\r\n this._nativeContext.importCodeSpec(sourceCodeSpecId);\r\n }\r\n\r\n /** Clone the specified source Element into ElementProps for the target iModel.\r\n * @internal\r\n */\r\n public cloneElement(sourceElement: Element, cloneOptions?: IModelJsNative.CloneElementOptions): ElementProps {\r\n const targetElementProps: ElementProps = this._nativeContext.cloneElement(sourceElement.id, cloneOptions);\r\n // Ensure that all NavigationProperties in targetElementProps have a defined value so \"clearing\" changes will be part of the JSON used for update\r\n sourceElement.forEachProperty((propertyName: string, meta: PropertyMetaData) => {\r\n if ((meta.isNavigation) && (undefined === (sourceElement as any)[propertyName])) {\r\n (targetElementProps as any)[propertyName] = RelatedElement.none;\r\n }\r\n }, false); // exclude custom because C++ has already handled them\r\n if (this.isBetweenIModels) {\r\n // The native C++ cloneElement strips off federationGuid, want to put it back if transformation is between iModels\r\n targetElementProps.federationGuid = sourceElement.federationGuid;\r\n if (CodeScopeSpec.Type.Repository === this.targetDb.codeSpecs.getById(targetElementProps.code.spec).scopeType) {\r\n targetElementProps.code.scope = IModel.rootSubjectId;\r\n }\r\n }\r\n // unlike other references, code cannot be null. If it is null, use an empty code instead\r\n if (targetElementProps.code.scope === Id64.invalid || targetElementProps.code.spec === Id64.invalid) {\r\n targetElementProps.code = Code.createEmpty();\r\n }\r\n const jsClass = this.sourceDb.getJsClass<typeof Element>(sourceElement.classFullName);\r\n // eslint-disable-next-line @typescript-eslint/dot-notation\r\n jsClass[\"onCloned\"](this, sourceElement.toJSON(), targetElementProps);\r\n return targetElementProps;\r\n }\r\n\r\n /**\r\n * serialize state to a sqlite database at a given path\r\n * assumes the database has not already had any context state serialized to it\r\n * @internal\r\n */\r\n public saveStateToDb(db: SQLiteDb): void {\r\n this._nativeContext.saveStateToDb(db.nativeDb);\r\n }\r\n\r\n /**\r\n * load state from a sqlite database at a given path\r\n * @internal\r\n */\r\n public loadStateFromDb(db: SQLiteDb): void {\r\n this._nativeContext.loadStateFromDb(db.nativeDb);\r\n }\r\n}\r\n"]}