@itwin/core-backend 3.4.0-dev.59 → 3.4.0-dev.60

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 (222) 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 +165 -165
  14. package/lib/cjs/BriefcaseManager.js +405 -405
  15. package/lib/cjs/BriefcaseManager.js.map +1 -1
  16. package/lib/cjs/Category.d.ts +153 -153
  17. package/lib/cjs/Category.js +243 -243
  18. package/lib/cjs/Category.js.map +1 -1
  19. package/lib/cjs/ChangeSummaryManager.d.ts +187 -187
  20. package/lib/cjs/ChangeSummaryManager.js +445 -445
  21. package/lib/cjs/ChangeSummaryManager.js.map +1 -1
  22. package/lib/cjs/ChangedElementsDb.d.ts +99 -99
  23. package/lib/cjs/ChangedElementsDb.js +165 -165
  24. package/lib/cjs/ChangedElementsDb.js.map +1 -1
  25. package/lib/cjs/ChangedElementsManager.d.ts +39 -39
  26. package/lib/cjs/ChangedElementsManager.js +88 -88
  27. package/lib/cjs/ChangedElementsManager.js.map +1 -1
  28. package/lib/cjs/CheckpointManager.d.ts +120 -120
  29. package/lib/cjs/CheckpointManager.js +343 -343
  30. package/lib/cjs/CheckpointManager.js.map +1 -1
  31. package/lib/cjs/ClassRegistry.d.ts +71 -71
  32. package/lib/cjs/ClassRegistry.js +215 -215
  33. package/lib/cjs/ClassRegistry.js.map +1 -1
  34. package/lib/cjs/CloudSqlite.d.ts +349 -349
  35. package/lib/cjs/CloudSqlite.js +151 -151
  36. package/lib/cjs/CloudSqlite.js.map +1 -1
  37. package/lib/cjs/CloudStorageBackend.d.ts +58 -58
  38. package/lib/cjs/CloudStorageBackend.js +173 -173
  39. package/lib/cjs/CloudStorageBackend.js.map +1 -1
  40. package/lib/cjs/CodeService.d.ts +396 -396
  41. package/lib/cjs/CodeService.js +63 -63
  42. package/lib/cjs/CodeService.js.map +1 -1
  43. package/lib/cjs/CodeSpecs.d.ts +50 -50
  44. package/lib/cjs/CodeSpecs.js +112 -112
  45. package/lib/cjs/CodeSpecs.js.map +1 -1
  46. package/lib/cjs/ConcurrentQuery.d.ts +11 -11
  47. package/lib/cjs/ConcurrentQuery.js +30 -30
  48. package/lib/cjs/ConcurrentQuery.js.map +1 -1
  49. package/lib/cjs/CustomViewState3dCreator.d.ts +32 -32
  50. package/lib/cjs/CustomViewState3dCreator.js +113 -113
  51. package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
  52. package/lib/cjs/DevTools.d.ts +71 -71
  53. package/lib/cjs/DevTools.js +154 -154
  54. package/lib/cjs/DevTools.js.map +1 -1
  55. package/lib/cjs/DisplayStyle.d.ts +106 -106
  56. package/lib/cjs/DisplayStyle.js +256 -256
  57. package/lib/cjs/DisplayStyle.js.map +1 -1
  58. package/lib/cjs/ECDb.d.ts +191 -191
  59. package/lib/cjs/ECDb.js +350 -350
  60. package/lib/cjs/ECDb.js.map +1 -1
  61. package/lib/cjs/ECSchemaXmlContext.d.ts +18 -18
  62. package/lib/cjs/ECSchemaXmlContext.js +41 -41
  63. package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
  64. package/lib/cjs/ECSqlStatement.d.ts +466 -466
  65. package/lib/cjs/ECSqlStatement.js +791 -791
  66. package/lib/cjs/ECSqlStatement.js.map +1 -1
  67. package/lib/cjs/Element.d.ts +1109 -1109
  68. package/lib/cjs/Element.js +1420 -1420
  69. package/lib/cjs/Element.js.map +1 -1
  70. package/lib/cjs/ElementAspect.d.ts +156 -156
  71. package/lib/cjs/ElementAspect.js +178 -178
  72. package/lib/cjs/ElementAspect.js.map +1 -1
  73. package/lib/cjs/ElementGraphics.d.ts +9 -9
  74. package/lib/cjs/ElementGraphics.js +41 -41
  75. package/lib/cjs/ElementGraphics.js.map +1 -1
  76. package/lib/cjs/ElementTreeWalker.d.ts +162 -162
  77. package/lib/cjs/ElementTreeWalker.js +409 -409
  78. package/lib/cjs/ElementTreeWalker.js.map +1 -1
  79. package/lib/cjs/Entity.d.ts +76 -76
  80. package/lib/cjs/Entity.js +82 -82
  81. package/lib/cjs/Entity.js.map +1 -1
  82. package/lib/cjs/ExportGraphics.d.ts +317 -317
  83. package/lib/cjs/ExportGraphics.js +208 -208
  84. package/lib/cjs/ExportGraphics.js.map +1 -1
  85. package/lib/cjs/ExternalSource.d.ts +94 -94
  86. package/lib/cjs/ExternalSource.js +125 -125
  87. package/lib/cjs/ExternalSource.js.map +1 -1
  88. package/lib/cjs/GeoCoordConfig.d.ts +19 -19
  89. package/lib/cjs/GeoCoordConfig.js +82 -82
  90. package/lib/cjs/GeoCoordConfig.js.map +1 -1
  91. package/lib/cjs/GeometrySummary.d.ts +4 -4
  92. package/lib/cjs/GeometrySummary.js +380 -380
  93. package/lib/cjs/GeometrySummary.js.map +1 -1
  94. package/lib/cjs/HubMock.d.ts +93 -93
  95. package/lib/cjs/HubMock.js +190 -190
  96. package/lib/cjs/HubMock.js.map +1 -1
  97. package/lib/cjs/IModelCloneContext.d.ts +85 -85
  98. package/lib/cjs/IModelCloneContext.js +150 -150
  99. package/lib/cjs/IModelCloneContext.js.map +1 -1
  100. package/lib/cjs/IModelDb.d.ts +1164 -1164
  101. package/lib/cjs/IModelDb.js +2324 -2324
  102. package/lib/cjs/IModelDb.js.map +1 -1
  103. package/lib/cjs/IModelHost.d.ts +361 -361
  104. package/lib/cjs/IModelHost.js +489 -489
  105. package/lib/cjs/IModelHost.js.map +1 -1
  106. package/lib/cjs/IModelJsFs.d.ts +62 -62
  107. package/lib/cjs/IModelJsFs.js +140 -140
  108. package/lib/cjs/IModelJsFs.js.map +1 -1
  109. package/lib/cjs/IpcHost.d.ts +98 -98
  110. package/lib/cjs/IpcHost.js +234 -234
  111. package/lib/cjs/IpcHost.js.map +1 -1
  112. package/lib/cjs/LineStyle.d.ts +311 -311
  113. package/lib/cjs/LineStyle.js +295 -295
  114. package/lib/cjs/LineStyle.js.map +1 -1
  115. package/lib/cjs/LocalHub.d.ts +162 -162
  116. package/lib/cjs/LocalHub.js +587 -587
  117. package/lib/cjs/LocalHub.js.map +1 -1
  118. package/lib/cjs/LocalhostIpcHost.d.ts +20 -20
  119. package/lib/cjs/LocalhostIpcHost.js +81 -81
  120. package/lib/cjs/LocalhostIpcHost.js.map +1 -1
  121. package/lib/cjs/Material.d.ts +103 -103
  122. package/lib/cjs/Material.js +147 -147
  123. package/lib/cjs/Material.js.map +1 -1
  124. package/lib/cjs/Model.d.ts +386 -386
  125. package/lib/cjs/Model.js +471 -471
  126. package/lib/cjs/Model.js.map +1 -1
  127. package/lib/cjs/NativeAppStorage.d.ts +51 -51
  128. package/lib/cjs/NativeAppStorage.js +202 -202
  129. package/lib/cjs/NativeAppStorage.js.map +1 -1
  130. package/lib/cjs/NativeHost.d.ts +52 -52
  131. package/lib/cjs/NativeHost.js +168 -168
  132. package/lib/cjs/NativeHost.js.map +1 -1
  133. package/lib/cjs/NavigationRelationship.d.ts +156 -156
  134. package/lib/cjs/NavigationRelationship.js +225 -225
  135. package/lib/cjs/NavigationRelationship.js.map +1 -1
  136. package/lib/cjs/PromiseMemoizer.d.ts +51 -51
  137. package/lib/cjs/PromiseMemoizer.js +101 -101
  138. package/lib/cjs/PromiseMemoizer.js.map +1 -1
  139. package/lib/cjs/PropertyStore.d.ts +132 -132
  140. package/lib/cjs/PropertyStore.js +11 -11
  141. package/lib/cjs/PropertyStore.js.map +1 -1
  142. package/lib/cjs/Relationship.d.ts +400 -400
  143. package/lib/cjs/Relationship.js +465 -465
  144. package/lib/cjs/Relationship.js.map +1 -1
  145. package/lib/cjs/RpcBackend.d.ts +28 -28
  146. package/lib/cjs/RpcBackend.js +126 -126
  147. package/lib/cjs/RpcBackend.js.map +1 -1
  148. package/lib/cjs/SQLiteDb.d.ts +219 -219
  149. package/lib/cjs/SQLiteDb.js +214 -214
  150. package/lib/cjs/SQLiteDb.js.map +1 -1
  151. package/lib/cjs/Schema.d.ts +55 -55
  152. package/lib/cjs/Schema.js +83 -83
  153. package/lib/cjs/Schema.js.map +1 -1
  154. package/lib/cjs/ServerBasedLocks.d.ts +57 -57
  155. package/lib/cjs/ServerBasedLocks.js +168 -168
  156. package/lib/cjs/ServerBasedLocks.js.map +1 -1
  157. package/lib/cjs/SqliteStatement.d.ts +283 -283
  158. package/lib/cjs/SqliteStatement.js +448 -448
  159. package/lib/cjs/SqliteStatement.js.map +1 -1
  160. package/lib/cjs/Texture.d.ts +58 -58
  161. package/lib/cjs/Texture.js +82 -82
  162. package/lib/cjs/Texture.js.map +1 -1
  163. package/lib/cjs/TileStorage.d.ts +18 -18
  164. package/lib/cjs/TileStorage.js +90 -90
  165. package/lib/cjs/TileStorage.js.map +1 -1
  166. package/lib/cjs/TxnManager.d.ts +202 -202
  167. package/lib/cjs/TxnManager.js +356 -356
  168. package/lib/cjs/TxnManager.js.map +1 -1
  169. package/lib/cjs/ViewDefinition.d.ts +435 -435
  170. package/lib/cjs/ViewDefinition.js +635 -635
  171. package/lib/cjs/ViewDefinition.js.map +1 -1
  172. package/lib/cjs/ViewStateHydrator.d.ts +13 -13
  173. package/lib/cjs/ViewStateHydrator.js +103 -103
  174. package/lib/cjs/ViewStateHydrator.js.map +1 -1
  175. package/lib/cjs/assets/IModelChange.02.00.00.ecschema.xml +90 -90
  176. package/lib/cjs/assets/Settings/Schemas/Cloud.Schema.json +67 -67
  177. package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +31 -31
  178. package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +52 -52
  179. package/lib/cjs/assets/Settings/backend.setting.json5 +138 -138
  180. package/lib/cjs/core-backend.d.ts +182 -182
  181. package/lib/cjs/core-backend.js +202 -202
  182. package/lib/cjs/core-backend.js.map +1 -1
  183. package/lib/cjs/domains/FunctionalElements.d.ts +101 -101
  184. package/lib/cjs/domains/FunctionalElements.js +145 -145
  185. package/lib/cjs/domains/FunctionalElements.js.map +1 -1
  186. package/lib/cjs/domains/FunctionalSchema.d.ts +13 -13
  187. package/lib/cjs/domains/FunctionalSchema.js +40 -40
  188. package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
  189. package/lib/cjs/domains/GenericElements.d.ts +177 -177
  190. package/lib/cjs/domains/GenericElements.js +263 -263
  191. package/lib/cjs/domains/GenericElements.js.map +1 -1
  192. package/lib/cjs/domains/GenericSchema.d.ts +10 -10
  193. package/lib/cjs/domains/GenericSchema.js +28 -28
  194. package/lib/cjs/domains/GenericSchema.js.map +1 -1
  195. package/lib/cjs/rpc-impl/DevToolsRpcImpl.d.ts +15 -15
  196. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js +32 -32
  197. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -1
  198. package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts +45 -45
  199. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +262 -262
  200. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  201. package/lib/cjs/rpc-impl/IModelTileRpcImpl.d.ts +22 -22
  202. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js +204 -204
  203. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  204. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts +36 -36
  205. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js +168 -168
  206. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  207. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.d.ts +16 -16
  208. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js +43 -43
  209. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  210. package/lib/cjs/rpc-impl/WipRpcImpl.d.ts +15 -15
  211. package/lib/cjs/rpc-impl/WipRpcImpl.js +37 -37
  212. package/lib/cjs/rpc-impl/WipRpcImpl.js.map +1 -1
  213. package/lib/cjs/workspace/Settings.d.ts +186 -186
  214. package/lib/cjs/workspace/Settings.js +155 -155
  215. package/lib/cjs/workspace/Settings.js.map +1 -1
  216. package/lib/cjs/workspace/SettingsSchemas.d.ts +75 -75
  217. package/lib/cjs/workspace/SettingsSchemas.js +191 -191
  218. package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
  219. package/lib/cjs/workspace/Workspace.d.ts +414 -414
  220. package/lib/cjs/workspace/Workspace.js +543 -543
  221. package/lib/cjs/workspace/Workspace.js.map +1 -1
  222. package/package.json +11 -11
@@ -1,86 +1,86 @@
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 IModelCloneContext {
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 IModelCloneContext.
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
- /** Returns `true` if this context is for transforming between 2 iModels and `false` if it for transforming within the same iModel. */
26
- get isBetweenIModels(): boolean;
27
- /** Dispose any native resources associated with this IModelCloneContext. */
28
- dispose(): void;
29
- /** Debugging aid that dumps the Id remapping details and other information to the specified output file.
30
- * @internal
31
- */
32
- dump(outputFileName: string): void;
33
- /** Add a rule that remaps the specified source [CodeSpec]($common) to the specified target [CodeSpec]($common).
34
- * @param sourceCodeSpecName The name of the CodeSpec from the source iModel.
35
- * @param targetCodeSpecName The name of the CodeSpec from the target iModel.
36
- * @throws [[IModelError]] if either CodeSpec could not be found.
37
- */
38
- remapCodeSpec(sourceCodeSpecName: string, targetCodeSpecName: string): void;
39
- /** Add a rule that remaps the specified source class to the specified target class. */
40
- remapElementClass(sourceClassFullName: string, targetClassFullName: string): void;
41
- /** Add a rule that remaps the specified source Element to the specified target Element. */
42
- remapElement(sourceId: Id64String, targetId: Id64String): void;
43
- /** Remove a rule that remaps the specified source Element. */
44
- removeElement(sourceId: Id64String): void;
45
- /** Look up a target CodeSpecId from the source CodeSpecId.
46
- * @returns the target CodeSpecId or [Id64.invalid]($bentley) if a mapping not found.
47
- */
48
- findTargetCodeSpecId(sourceId: Id64String): Id64String;
49
- /** Look up a target ElementId from the source ElementId.
50
- * @returns the target ElementId or [Id64.invalid]($bentley) if a mapping not found.
51
- */
52
- findTargetElementId(sourceElementId: Id64String): Id64String;
53
- /** Filter out geometry entries in the specified SubCategory from GeometryStreams in the target iModel.
54
- * @note It is not possible to filter out a *default* SubCategory. A request to do so will be ignored.
55
- * @see [SubCategory.isDefaultSubCategory]($backend)
56
- */
57
- filterSubCategory(sourceSubCategoryId: Id64String): void;
58
- /** Returns `true` if there are any SubCategories being filtered. */
59
- get hasSubCategoryFilter(): boolean;
60
- /** Returns `true` if this SubCategory is being filtered. */
61
- isSubCategoryFiltered(subCategoryId: Id64String): boolean;
62
- /** Import the specified font from the source iModel into the target iModel.
63
- * @internal
64
- */
65
- importFont(sourceFontNumber: number): void;
66
- /** Import a single CodeSpec from the source iModel into the target iModel.
67
- * @internal
68
- */
69
- importCodeSpec(sourceCodeSpecId: Id64String): void;
70
- /** Clone the specified source Element into ElementProps for the target iModel.
71
- * @internal
72
- */
73
- cloneElement(sourceElement: Element, cloneOptions?: IModelJsNative.CloneElementOptions): ElementProps;
74
- /**
75
- * serialize state to a sqlite database at a given path
76
- * assumes the database has not already had any context state serialized to it
77
- * @internal
78
- */
79
- saveStateToDb(db: SQLiteDb): void;
80
- /**
81
- * load state from a sqlite database at a given path
82
- * @internal
83
- */
84
- loadStateFromDb(db: SQLiteDb): void;
85
- }
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 IModelCloneContext {
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 IModelCloneContext.
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
+ /** Returns `true` if this context is for transforming between 2 iModels and `false` if it for transforming within the same iModel. */
26
+ get isBetweenIModels(): boolean;
27
+ /** Dispose any native resources associated with this IModelCloneContext. */
28
+ dispose(): void;
29
+ /** Debugging aid that dumps the Id remapping details and other information to the specified output file.
30
+ * @internal
31
+ */
32
+ dump(outputFileName: string): void;
33
+ /** Add a rule that remaps the specified source [CodeSpec]($common) to the specified target [CodeSpec]($common).
34
+ * @param sourceCodeSpecName The name of the CodeSpec from the source iModel.
35
+ * @param targetCodeSpecName The name of the CodeSpec from the target iModel.
36
+ * @throws [[IModelError]] if either CodeSpec could not be found.
37
+ */
38
+ remapCodeSpec(sourceCodeSpecName: string, targetCodeSpecName: string): void;
39
+ /** Add a rule that remaps the specified source class to the specified target class. */
40
+ remapElementClass(sourceClassFullName: string, targetClassFullName: string): void;
41
+ /** Add a rule that remaps the specified source Element to the specified target Element. */
42
+ remapElement(sourceId: Id64String, targetId: Id64String): void;
43
+ /** Remove a rule that remaps the specified source Element. */
44
+ removeElement(sourceId: Id64String): void;
45
+ /** Look up a target CodeSpecId from the source CodeSpecId.
46
+ * @returns the target CodeSpecId or [Id64.invalid]($bentley) if a mapping not found.
47
+ */
48
+ findTargetCodeSpecId(sourceId: Id64String): Id64String;
49
+ /** Look up a target ElementId from the source ElementId.
50
+ * @returns the target ElementId or [Id64.invalid]($bentley) if a mapping not found.
51
+ */
52
+ findTargetElementId(sourceElementId: Id64String): Id64String;
53
+ /** Filter out geometry entries in the specified SubCategory from GeometryStreams in the target iModel.
54
+ * @note It is not possible to filter out a *default* SubCategory. A request to do so will be ignored.
55
+ * @see [SubCategory.isDefaultSubCategory]($backend)
56
+ */
57
+ filterSubCategory(sourceSubCategoryId: Id64String): void;
58
+ /** Returns `true` if there are any SubCategories being filtered. */
59
+ get hasSubCategoryFilter(): boolean;
60
+ /** Returns `true` if this SubCategory is being filtered. */
61
+ isSubCategoryFiltered(subCategoryId: Id64String): boolean;
62
+ /** Import the specified font from the source iModel into the target iModel.
63
+ * @internal
64
+ */
65
+ importFont(sourceFontNumber: number): void;
66
+ /** Import a single CodeSpec from the source iModel into the target iModel.
67
+ * @internal
68
+ */
69
+ importCodeSpec(sourceCodeSpecId: Id64String): void;
70
+ /** Clone the specified source Element into ElementProps for the target iModel.
71
+ * @internal
72
+ */
73
+ cloneElement(sourceElement: Element, cloneOptions?: IModelJsNative.CloneElementOptions): ElementProps;
74
+ /**
75
+ * serialize state to a sqlite database at a given path
76
+ * assumes the database has not already had any context state serialized to it
77
+ * @internal
78
+ */
79
+ saveStateToDb(db: SQLiteDb): void;
80
+ /**
81
+ * load state from a sqlite database at a given path
82
+ * @internal
83
+ */
84
+ loadStateFromDb(db: SQLiteDb): void;
85
+ }
86
86
  //# sourceMappingURL=IModelCloneContext.d.ts.map
@@ -1,151 +1,151 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IModelCloneContext = 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 IModelCloneContext {
19
- /** Construct a new IModelCloneContext.
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
- /** Returns `true` if this context is for transforming between 2 iModels and `false` if it for transforming within the same iModel. */
29
- get isBetweenIModels() { return this.sourceDb !== this.targetDb; }
30
- /** Dispose any native resources associated with this IModelCloneContext. */
31
- dispose() { this._nativeContext.dispose(); }
32
- /** Debugging aid that dumps the Id remapping details and other information to the specified output file.
33
- * @internal
34
- */
35
- dump(outputFileName) { this._nativeContext.dump(outputFileName); }
36
- /** Add a rule that remaps the specified source [CodeSpec]($common) to the specified target [CodeSpec]($common).
37
- * @param sourceCodeSpecName The name of the CodeSpec from the source iModel.
38
- * @param targetCodeSpecName The name of the CodeSpec from the target iModel.
39
- * @throws [[IModelError]] if either CodeSpec could not be found.
40
- */
41
- remapCodeSpec(sourceCodeSpecName, targetCodeSpecName) {
42
- const sourceCodeSpec = this.sourceDb.codeSpecs.getByName(sourceCodeSpecName);
43
- const targetCodeSpec = this.targetDb.codeSpecs.getByName(targetCodeSpecName);
44
- this._nativeContext.addCodeSpecId(sourceCodeSpec.id, targetCodeSpec.id);
45
- }
46
- /** Add a rule that remaps the specified source class to the specified target class. */
47
- remapElementClass(sourceClassFullName, targetClassFullName) {
48
- this._nativeContext.addClass(sourceClassFullName, targetClassFullName);
49
- }
50
- /** Add a rule that remaps the specified source Element to the specified target Element. */
51
- remapElement(sourceId, targetId) {
52
- this._nativeContext.addElementId(sourceId, targetId);
53
- }
54
- /** Remove a rule that remaps the specified source Element. */
55
- removeElement(sourceId) {
56
- this._nativeContext.removeElementId(sourceId);
57
- }
58
- /** Look up a target CodeSpecId from the source CodeSpecId.
59
- * @returns the target CodeSpecId or [Id64.invalid]($bentley) if a mapping not found.
60
- */
61
- findTargetCodeSpecId(sourceId) {
62
- if (core_bentley_1.Id64.invalid === sourceId) {
63
- return core_bentley_1.Id64.invalid;
64
- }
65
- return this._nativeContext.findCodeSpecId(sourceId);
66
- }
67
- /** Look up a target ElementId from the source ElementId.
68
- * @returns the target ElementId or [Id64.invalid]($bentley) if a mapping not found.
69
- */
70
- findTargetElementId(sourceElementId) {
71
- if (core_bentley_1.Id64.invalid === sourceElementId) {
72
- return core_bentley_1.Id64.invalid;
73
- }
74
- return this._nativeContext.findElementId(sourceElementId);
75
- }
76
- /** Filter out geometry entries in the specified SubCategory from GeometryStreams in the target iModel.
77
- * @note It is not possible to filter out a *default* SubCategory. A request to do so will be ignored.
78
- * @see [SubCategory.isDefaultSubCategory]($backend)
79
- */
80
- filterSubCategory(sourceSubCategoryId) {
81
- const sourceSubCategory = this.sourceDb.elements.tryGetElement(sourceSubCategoryId, Category_1.SubCategory);
82
- if (sourceSubCategory && !sourceSubCategory.isDefaultSubCategory) {
83
- this._nativeContext.filterSubCategoryId(sourceSubCategoryId);
84
- }
85
- }
86
- /** Returns `true` if there are any SubCategories being filtered. */
87
- get hasSubCategoryFilter() {
88
- return this._nativeContext.hasSubCategoryFilter();
89
- }
90
- /** Returns `true` if this SubCategory is being filtered. */
91
- isSubCategoryFiltered(subCategoryId) {
92
- return this._nativeContext.isSubCategoryFiltered(subCategoryId);
93
- }
94
- /** Import the specified font from the source iModel into the target iModel.
95
- * @internal
96
- */
97
- importFont(sourceFontNumber) {
98
- this.targetDb.clearFontMap(); // so it will be reloaded with new font info
99
- this._nativeContext.importFont(sourceFontNumber);
100
- }
101
- /** Import a single CodeSpec from the source iModel into the target iModel.
102
- * @internal
103
- */
104
- importCodeSpec(sourceCodeSpecId) {
105
- this._nativeContext.importCodeSpec(sourceCodeSpecId);
106
- }
107
- /** Clone the specified source Element into ElementProps for the target iModel.
108
- * @internal
109
- */
110
- cloneElement(sourceElement, cloneOptions) {
111
- const targetElementProps = this._nativeContext.cloneElement(sourceElement.id, cloneOptions);
112
- // Ensure that all NavigationProperties in targetElementProps have a defined value so "clearing" changes will be part of the JSON used for update
113
- sourceElement.forEachProperty((propertyName, meta) => {
114
- if ((meta.isNavigation) && (undefined === sourceElement[propertyName])) {
115
- targetElementProps[propertyName] = core_common_1.RelatedElement.none;
116
- }
117
- }, false); // exclude custom because C++ has already handled them
118
- if (this.isBetweenIModels) {
119
- // The native C++ cloneElement strips off federationGuid, want to put it back if transformation is between iModels
120
- targetElementProps.federationGuid = sourceElement.federationGuid;
121
- if (core_common_1.CodeScopeSpec.Type.Repository === this.targetDb.codeSpecs.getById(targetElementProps.code.spec).scopeType) {
122
- targetElementProps.code.scope = core_common_1.IModel.rootSubjectId;
123
- }
124
- }
125
- // unlike other references, code cannot be null. If it is null, use an empty code instead
126
- if (targetElementProps.code.scope === core_bentley_1.Id64.invalid || targetElementProps.code.spec === core_bentley_1.Id64.invalid) {
127
- targetElementProps.code = core_common_1.Code.createEmpty();
128
- }
129
- const jsClass = this.sourceDb.getJsClass(sourceElement.classFullName);
130
- // eslint-disable-next-line @typescript-eslint/dot-notation
131
- jsClass["onCloned"](this, sourceElement.toJSON(), targetElementProps);
132
- return targetElementProps;
133
- }
134
- /**
135
- * serialize state to a sqlite database at a given path
136
- * assumes the database has not already had any context state serialized to it
137
- * @internal
138
- */
139
- saveStateToDb(db) {
140
- this._nativeContext.saveStateToDb(db.nativeDb);
141
- }
142
- /**
143
- * load state from a sqlite database at a given path
144
- * @internal
145
- */
146
- loadStateFromDb(db) {
147
- this._nativeContext.loadStateFromDb(db.nativeDb);
148
- }
149
- }
150
- exports.IModelCloneContext = IModelCloneContext;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IModelCloneContext = 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 IModelCloneContext {
19
+ /** Construct a new IModelCloneContext.
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
+ /** Returns `true` if this context is for transforming between 2 iModels and `false` if it for transforming within the same iModel. */
29
+ get isBetweenIModels() { return this.sourceDb !== this.targetDb; }
30
+ /** Dispose any native resources associated with this IModelCloneContext. */
31
+ dispose() { this._nativeContext.dispose(); }
32
+ /** Debugging aid that dumps the Id remapping details and other information to the specified output file.
33
+ * @internal
34
+ */
35
+ dump(outputFileName) { this._nativeContext.dump(outputFileName); }
36
+ /** Add a rule that remaps the specified source [CodeSpec]($common) to the specified target [CodeSpec]($common).
37
+ * @param sourceCodeSpecName The name of the CodeSpec from the source iModel.
38
+ * @param targetCodeSpecName The name of the CodeSpec from the target iModel.
39
+ * @throws [[IModelError]] if either CodeSpec could not be found.
40
+ */
41
+ remapCodeSpec(sourceCodeSpecName, targetCodeSpecName) {
42
+ const sourceCodeSpec = this.sourceDb.codeSpecs.getByName(sourceCodeSpecName);
43
+ const targetCodeSpec = this.targetDb.codeSpecs.getByName(targetCodeSpecName);
44
+ this._nativeContext.addCodeSpecId(sourceCodeSpec.id, targetCodeSpec.id);
45
+ }
46
+ /** Add a rule that remaps the specified source class to the specified target class. */
47
+ remapElementClass(sourceClassFullName, targetClassFullName) {
48
+ this._nativeContext.addClass(sourceClassFullName, targetClassFullName);
49
+ }
50
+ /** Add a rule that remaps the specified source Element to the specified target Element. */
51
+ remapElement(sourceId, targetId) {
52
+ this._nativeContext.addElementId(sourceId, targetId);
53
+ }
54
+ /** Remove a rule that remaps the specified source Element. */
55
+ removeElement(sourceId) {
56
+ this._nativeContext.removeElementId(sourceId);
57
+ }
58
+ /** Look up a target CodeSpecId from the source CodeSpecId.
59
+ * @returns the target CodeSpecId or [Id64.invalid]($bentley) if a mapping not found.
60
+ */
61
+ findTargetCodeSpecId(sourceId) {
62
+ if (core_bentley_1.Id64.invalid === sourceId) {
63
+ return core_bentley_1.Id64.invalid;
64
+ }
65
+ return this._nativeContext.findCodeSpecId(sourceId);
66
+ }
67
+ /** Look up a target ElementId from the source ElementId.
68
+ * @returns the target ElementId or [Id64.invalid]($bentley) if a mapping not found.
69
+ */
70
+ findTargetElementId(sourceElementId) {
71
+ if (core_bentley_1.Id64.invalid === sourceElementId) {
72
+ return core_bentley_1.Id64.invalid;
73
+ }
74
+ return this._nativeContext.findElementId(sourceElementId);
75
+ }
76
+ /** Filter out geometry entries in the specified SubCategory from GeometryStreams in the target iModel.
77
+ * @note It is not possible to filter out a *default* SubCategory. A request to do so will be ignored.
78
+ * @see [SubCategory.isDefaultSubCategory]($backend)
79
+ */
80
+ filterSubCategory(sourceSubCategoryId) {
81
+ const sourceSubCategory = this.sourceDb.elements.tryGetElement(sourceSubCategoryId, Category_1.SubCategory);
82
+ if (sourceSubCategory && !sourceSubCategory.isDefaultSubCategory) {
83
+ this._nativeContext.filterSubCategoryId(sourceSubCategoryId);
84
+ }
85
+ }
86
+ /** Returns `true` if there are any SubCategories being filtered. */
87
+ get hasSubCategoryFilter() {
88
+ return this._nativeContext.hasSubCategoryFilter();
89
+ }
90
+ /** Returns `true` if this SubCategory is being filtered. */
91
+ isSubCategoryFiltered(subCategoryId) {
92
+ return this._nativeContext.isSubCategoryFiltered(subCategoryId);
93
+ }
94
+ /** Import the specified font from the source iModel into the target iModel.
95
+ * @internal
96
+ */
97
+ importFont(sourceFontNumber) {
98
+ this.targetDb.clearFontMap(); // so it will be reloaded with new font info
99
+ this._nativeContext.importFont(sourceFontNumber);
100
+ }
101
+ /** Import a single CodeSpec from the source iModel into the target iModel.
102
+ * @internal
103
+ */
104
+ importCodeSpec(sourceCodeSpecId) {
105
+ this._nativeContext.importCodeSpec(sourceCodeSpecId);
106
+ }
107
+ /** Clone the specified source Element into ElementProps for the target iModel.
108
+ * @internal
109
+ */
110
+ cloneElement(sourceElement, cloneOptions) {
111
+ const targetElementProps = this._nativeContext.cloneElement(sourceElement.id, cloneOptions);
112
+ // Ensure that all NavigationProperties in targetElementProps have a defined value so "clearing" changes will be part of the JSON used for update
113
+ sourceElement.forEachProperty((propertyName, meta) => {
114
+ if ((meta.isNavigation) && (undefined === sourceElement[propertyName])) {
115
+ targetElementProps[propertyName] = core_common_1.RelatedElement.none;
116
+ }
117
+ }, false); // exclude custom because C++ has already handled them
118
+ if (this.isBetweenIModels) {
119
+ // The native C++ cloneElement strips off federationGuid, want to put it back if transformation is between iModels
120
+ targetElementProps.federationGuid = sourceElement.federationGuid;
121
+ if (core_common_1.CodeScopeSpec.Type.Repository === this.targetDb.codeSpecs.getById(targetElementProps.code.spec).scopeType) {
122
+ targetElementProps.code.scope = core_common_1.IModel.rootSubjectId;
123
+ }
124
+ }
125
+ // unlike other references, code cannot be null. If it is null, use an empty code instead
126
+ if (targetElementProps.code.scope === core_bentley_1.Id64.invalid || targetElementProps.code.spec === core_bentley_1.Id64.invalid) {
127
+ targetElementProps.code = core_common_1.Code.createEmpty();
128
+ }
129
+ const jsClass = this.sourceDb.getJsClass(sourceElement.classFullName);
130
+ // eslint-disable-next-line @typescript-eslint/dot-notation
131
+ jsClass["onCloned"](this, sourceElement.toJSON(), targetElementProps);
132
+ return targetElementProps;
133
+ }
134
+ /**
135
+ * serialize state to a sqlite database at a given path
136
+ * assumes the database has not already had any context state serialized to it
137
+ * @internal
138
+ */
139
+ saveStateToDb(db) {
140
+ this._nativeContext.saveStateToDb(db.nativeDb);
141
+ }
142
+ /**
143
+ * load state from a sqlite database at a given path
144
+ * @internal
145
+ */
146
+ loadStateFromDb(db) {
147
+ this._nativeContext.loadStateFromDb(db.nativeDb);
148
+ }
149
+ }
150
+ exports.IModelCloneContext = IModelCloneContext;
151
151
  //# sourceMappingURL=IModelCloneContext.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"IModelCloneContext.js","sourceRoot":"","sources":["../../src/IModelCloneContext.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,sDAAuD;AACvD,oDAA2H;AAE3H,yCAAyC;AAGzC,6CAA0C;AAG1C;;GAEG;AACH,MAAa,kBAAkB;IAQ7B;;;OAGG;IACH,YAAmB,QAAkB,EAAE,QAAmB;QACxD,IAAI,CAAC,QAAQ,GA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AAiB,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;AA3JD,gDA2JC","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 IModelCloneContext {\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 IModelCloneContext.\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 /** 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 IModelCloneContext. */\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":"IModelCloneContext.js","sourceRoot":"","sources":["../../src/IModelCloneContext.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,sDAAuD;AACvD,oDAA2H;AAE3H,yCAAyC;AAGzC,6CAA0C;AAG1C;;GAEG;AACH,MAAa,kBAAkB;IAQ7B;;;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,uBAA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AC5B,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;AA3JD,gDA2JC","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 IModelCloneContext {\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 IModelCloneContext.\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 /** 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 IModelCloneContext. */\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"]}