@itwin/imodel-transformer 2.0.0-dev.7 → 2.0.0-dev.70

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 (132) hide show
  1. package/README.md +13 -27
  2. package/lib/cjs/Algo.d.ts +0 -4
  3. package/lib/cjs/Algo.d.ts.map +1 -1
  4. package/lib/cjs/Algo.js +0 -11
  5. package/lib/cjs/Algo.js.map +1 -1
  6. package/lib/cjs/BigMap.d.ts.map +1 -1
  7. package/lib/cjs/BigMap.js.map +1 -1
  8. package/lib/cjs/BranchProvenanceInitializer.d.ts.map +1 -1
  9. package/lib/cjs/BranchProvenanceInitializer.js +26 -26
  10. package/lib/cjs/BranchProvenanceInitializer.js.map +1 -1
  11. package/lib/cjs/ChangedElementForest.d.ts +14 -0
  12. package/lib/cjs/ChangedElementForest.d.ts.map +1 -0
  13. package/lib/cjs/ChangedElementForest.js +86 -0
  14. package/lib/cjs/ChangedElementForest.js.map +1 -0
  15. package/lib/cjs/ChangesetScanner.d.ts +141 -0
  16. package/lib/cjs/ChangesetScanner.d.ts.map +1 -0
  17. package/lib/cjs/ChangesetScanner.js +187 -0
  18. package/lib/cjs/ChangesetScanner.js.map +1 -0
  19. package/lib/cjs/ECReferenceTypesCache.d.ts +0 -4
  20. package/lib/cjs/ECReferenceTypesCache.d.ts.map +1 -1
  21. package/lib/cjs/ECReferenceTypesCache.js +61 -111
  22. package/lib/cjs/ECReferenceTypesCache.js.map +1 -1
  23. package/lib/cjs/ECSqlReaderAsyncIterableIteratorAdapter.d.ts.map +1 -1
  24. package/lib/cjs/ECSqlReaderAsyncIterableIteratorAdapter.js.map +1 -1
  25. package/lib/cjs/ElementAspectCleanup.d.ts +16 -0
  26. package/lib/cjs/ElementAspectCleanup.d.ts.map +1 -0
  27. package/lib/cjs/ElementAspectCleanup.js +87 -0
  28. package/lib/cjs/ElementAspectCleanup.js.map +1 -0
  29. package/lib/cjs/ElementAspectExportCoordinator.d.ts +44 -0
  30. package/lib/cjs/ElementAspectExportCoordinator.d.ts.map +1 -0
  31. package/lib/cjs/ElementAspectExportCoordinator.js +148 -0
  32. package/lib/cjs/ElementAspectExportCoordinator.js.map +1 -0
  33. package/lib/cjs/ElementAspectExportProcessor.d.ts +44 -0
  34. package/lib/cjs/ElementAspectExportProcessor.d.ts.map +1 -0
  35. package/lib/cjs/ElementAspectExportProcessor.js +152 -0
  36. package/lib/cjs/ElementAspectExportProcessor.js.map +1 -0
  37. package/lib/cjs/ElementBulkDelete.d.ts +30 -0
  38. package/lib/cjs/ElementBulkDelete.d.ts.map +1 -0
  39. package/lib/cjs/ElementBulkDelete.js +358 -0
  40. package/lib/cjs/ElementBulkDelete.js.map +1 -0
  41. package/lib/cjs/EntityExistenceCache.d.ts +43 -0
  42. package/lib/cjs/EntityExistenceCache.d.ts.map +1 -0
  43. package/lib/cjs/EntityExistenceCache.js +91 -0
  44. package/lib/cjs/EntityExistenceCache.js.map +1 -0
  45. package/lib/cjs/EntityUnifier.d.ts +7 -7
  46. package/lib/cjs/EntityUnifier.d.ts.map +1 -1
  47. package/lib/cjs/EntityUnifier.js +55 -24
  48. package/lib/cjs/EntityUnifier.js.map +1 -1
  49. package/lib/cjs/IModelCloneContext.d.ts +9 -3
  50. package/lib/cjs/IModelCloneContext.d.ts.map +1 -1
  51. package/lib/cjs/IModelCloneContext.js +56 -22
  52. package/lib/cjs/IModelCloneContext.js.map +1 -1
  53. package/lib/cjs/IModelExporter.d.ts +171 -43
  54. package/lib/cjs/IModelExporter.d.ts.map +1 -1
  55. package/lib/cjs/IModelExporter.js +946 -247
  56. package/lib/cjs/IModelExporter.js.map +1 -1
  57. package/lib/cjs/IModelImporter.d.ts +75 -30
  58. package/lib/cjs/IModelImporter.d.ts.map +1 -1
  59. package/lib/cjs/IModelImporter.js +292 -132
  60. package/lib/cjs/IModelImporter.js.map +1 -1
  61. package/lib/cjs/IModelTransformContext.d.ts +54 -0
  62. package/lib/cjs/IModelTransformContext.d.ts.map +1 -0
  63. package/lib/cjs/IModelTransformContext.js +3 -0
  64. package/lib/cjs/IModelTransformContext.js.map +1 -0
  65. package/lib/cjs/IModelTransformer.d.ts +180 -206
  66. package/lib/cjs/IModelTransformer.d.ts.map +1 -1
  67. package/lib/cjs/IModelTransformer.js +811 -1278
  68. package/lib/cjs/IModelTransformer.js.map +1 -1
  69. package/lib/cjs/IModelTransformerError.d.ts +84 -0
  70. package/lib/cjs/IModelTransformerError.d.ts.map +1 -0
  71. package/lib/cjs/IModelTransformerError.js +93 -0
  72. package/lib/cjs/IModelTransformerError.js.map +1 -0
  73. package/lib/cjs/ProvenanceManager.d.ts +177 -0
  74. package/lib/cjs/ProvenanceManager.d.ts.map +1 -0
  75. package/lib/cjs/ProvenanceManager.js +719 -0
  76. package/lib/cjs/ProvenanceManager.js.map +1 -0
  77. package/lib/cjs/SourceClassKinds.d.ts +22 -0
  78. package/lib/cjs/SourceClassKinds.d.ts.map +1 -0
  79. package/lib/cjs/SourceClassKinds.js +60 -0
  80. package/lib/cjs/SourceClassKinds.js.map +1 -0
  81. package/lib/cjs/SyncTypeResolver.d.ts +32 -0
  82. package/lib/cjs/SyncTypeResolver.d.ts.map +1 -0
  83. package/lib/cjs/SyncTypeResolver.js +92 -0
  84. package/lib/cjs/SyncTypeResolver.js.map +1 -0
  85. package/lib/cjs/TransformerLoggerCategory.d.ts +1 -1
  86. package/lib/cjs/TransformerLoggerCategory.js +1 -1
  87. package/lib/cjs/TransformerLoggerCategory.js.map +1 -1
  88. package/lib/cjs/TransformerPackageMetadata.d.ts +8 -0
  89. package/lib/cjs/TransformerPackageMetadata.d.ts.map +1 -0
  90. package/lib/cjs/TransformerPackageMetadata.js +47 -0
  91. package/lib/cjs/TransformerPackageMetadata.js.map +1 -0
  92. package/lib/cjs/imodel-transformer.d.ts +28 -0
  93. package/lib/cjs/imodel-transformer.d.ts.map +1 -1
  94. package/lib/cjs/imodel-transformer.js +61 -34
  95. package/lib/cjs/imodel-transformer.js.map +1 -1
  96. package/lib/cjs/schema-processing/DynamicSchemaUnionStrategy.d.ts +29 -0
  97. package/lib/cjs/schema-processing/DynamicSchemaUnionStrategy.d.ts.map +1 -0
  98. package/lib/cjs/schema-processing/DynamicSchemaUnionStrategy.js +212 -0
  99. package/lib/cjs/schema-processing/DynamicSchemaUnionStrategy.js.map +1 -0
  100. package/lib/cjs/schema-processing/SchemaProcessingCoordinator.d.ts +25 -0
  101. package/lib/cjs/schema-processing/SchemaProcessingCoordinator.d.ts.map +1 -0
  102. package/lib/cjs/schema-processing/SchemaProcessingCoordinator.js +196 -0
  103. package/lib/cjs/schema-processing/SchemaProcessingCoordinator.js.map +1 -0
  104. package/lib/cjs/schema-processing/SchemaProcessingStrategy.d.ts +59 -0
  105. package/lib/cjs/schema-processing/SchemaProcessingStrategy.d.ts.map +1 -0
  106. package/lib/cjs/schema-processing/SchemaProcessingStrategy.js +28 -0
  107. package/lib/cjs/schema-processing/SchemaProcessingStrategy.js.map +1 -0
  108. package/lib/cjs/schema-processing.d.ts +7 -0
  109. package/lib/cjs/schema-processing.d.ts.map +1 -0
  110. package/lib/cjs/schema-processing.js +27 -0
  111. package/lib/cjs/schema-processing.js.map +1 -0
  112. package/package.json +70 -57
  113. package/lib/cjs/DetachedExportElementAspectsStrategy.d.ts +0 -16
  114. package/lib/cjs/DetachedExportElementAspectsStrategy.d.ts.map +0 -1
  115. package/lib/cjs/DetachedExportElementAspectsStrategy.js +0 -106
  116. package/lib/cjs/DetachedExportElementAspectsStrategy.js.map +0 -1
  117. package/lib/cjs/ElementCascadingDeleter.d.ts +0 -22
  118. package/lib/cjs/ElementCascadingDeleter.d.ts.map +0 -1
  119. package/lib/cjs/ElementCascadingDeleter.js +0 -57
  120. package/lib/cjs/ElementCascadingDeleter.js.map +0 -1
  121. package/lib/cjs/EntityMap.d.ts +0 -26
  122. package/lib/cjs/EntityMap.d.ts.map +0 -1
  123. package/lib/cjs/EntityMap.js +0 -54
  124. package/lib/cjs/EntityMap.js.map +0 -1
  125. package/lib/cjs/ExportElementAspectsStrategy.d.ts +0 -35
  126. package/lib/cjs/ExportElementAspectsStrategy.d.ts.map +0 -1
  127. package/lib/cjs/ExportElementAspectsStrategy.js +0 -52
  128. package/lib/cjs/ExportElementAspectsStrategy.js.map +0 -1
  129. package/lib/cjs/ExportElementAspectsWithElementsStrategy.d.ts +0 -12
  130. package/lib/cjs/ExportElementAspectsWithElementsStrategy.d.ts.map +0 -1
  131. package/lib/cjs/ExportElementAspectsWithElementsStrategy.js +0 -47
  132. package/lib/cjs/ExportElementAspectsWithElementsStrategy.js.map +0 -1
@@ -1,106 +0,0 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.DetachedExportElementAspectsStrategy = void 0;
8
- const core_backend_1 = require("@itwin/core-backend");
9
- const ExportElementAspectsStrategy_1 = require("./ExportElementAspectsStrategy");
10
- const ECSqlReaderAsyncIterableIteratorAdapter_1 = require("./ECSqlReaderAsyncIterableIteratorAdapter");
11
- const core_common_1 = require("@itwin/core-common");
12
- /**
13
- * Detached ElementAspect export strategy for [[IModelExporter]].
14
- * This strategy exports all ElementAspects separately from the Elements that own them.
15
- *
16
- * @note Since aspects are exported separately from elements that own them, this strategy will export aspects of filtered out elements by default and
17
- * this needs to be handled by ElementAspectHandler
18
- * @internal
19
- */
20
- class DetachedExportElementAspectsStrategy extends ExportElementAspectsStrategy_1.ExportElementAspectsStrategy {
21
- async exportAllElementAspects() {
22
- await this.exportAspectsLoop(core_backend_1.ElementUniqueAspect.classFullName, async (uniqueAspect) => {
23
- const isInsertChange = this.aspectChanges?.insertIds.has(uniqueAspect.id) ?? false;
24
- const isUpdateChange = this.aspectChanges?.updateIds.has(uniqueAspect.id) ?? false;
25
- const doExport = this.aspectChanges === undefined || isInsertChange || isUpdateChange;
26
- if (doExport) {
27
- const isKnownUpdate = this.aspectChanges ? isUpdateChange : undefined;
28
- await this.handler.onExportElementUniqueAspect(uniqueAspect, isKnownUpdate);
29
- await this.handler.trackProgress();
30
- }
31
- });
32
- let batchedElementMultiAspects = [];
33
- await this.exportAspectsLoop(core_backend_1.ElementMultiAspect.classFullName, async (multiAspect) => {
34
- if (batchedElementMultiAspects.length === 0) {
35
- batchedElementMultiAspects.push(multiAspect);
36
- return;
37
- }
38
- // element id changed so all element's aspects are in the array and can be exported
39
- if (batchedElementMultiAspects[0].element.id !== multiAspect.element.id) {
40
- await this.handler.onExportElementMultiAspects(batchedElementMultiAspects);
41
- await this.handler.trackProgress();
42
- batchedElementMultiAspects = [];
43
- }
44
- batchedElementMultiAspects.push(multiAspect);
45
- });
46
- if (batchedElementMultiAspects.length > 0) {
47
- // aspects that are left in the array have not been exported
48
- await this.handler.onExportElementMultiAspects(batchedElementMultiAspects);
49
- await this.handler.trackProgress();
50
- }
51
- }
52
- async exportAspectsLoop(baseAspectClass, exportAspect) {
53
- for await (const aspect of this.queryAspects(baseAspectClass)) {
54
- if (!this.shouldExportElementAspect(aspect)) {
55
- continue;
56
- }
57
- await exportAspect(aspect);
58
- }
59
- }
60
- async *queryAspects(baseElementAspectClassFullName) {
61
- const aspectClassNameIdMap = new Map();
62
- const optimizesAspectClassesSql = `
63
- SELECT c.ECInstanceId as classId, (ec_className(c.ECInstanceId, 's')) as schemaName, (ec_className(c.ECInstanceId, 'c')) as className
64
- FROM ECDbMeta.ClassHasAllBaseClasses r
65
- JOIN ECDbMeta.ECClassDef c ON c.ECInstanceId = r.SourceECInstanceId
66
- WHERE r.TargetECInstanceId = ec_classId(:baseClassName)
67
- `;
68
- const aspectClassesQueryReader = this.sourceDb.createQueryReader(optimizesAspectClassesSql, new core_common_1.QueryBinder().bindString("baseClassName", baseElementAspectClassFullName));
69
- const aspectClassesAsyncQueryReader = (0, ECSqlReaderAsyncIterableIteratorAdapter_1.ensureECSqlReaderIsAsyncIterableIterator)(aspectClassesQueryReader);
70
- for await (const rowProxy of aspectClassesAsyncQueryReader) {
71
- const row = rowProxy.toRow();
72
- aspectClassNameIdMap.set(row.classId, {
73
- schemaName: row.schemaName,
74
- className: row.className,
75
- });
76
- }
77
- for (const [classId, { schemaName, className }] of aspectClassNameIdMap) {
78
- const classFullName = `${schemaName}:${className}`;
79
- if (this.excludedElementAspectClassFullNames.has(classFullName))
80
- continue;
81
- const getAspectPropsSql = `SELECT * FROM [${schemaName}]:[${className}] WHERE ECClassId = :classId ORDER BY Element.Id`;
82
- const aspectQueryReader = this.sourceDb.createQueryReader(getAspectPropsSql, new core_common_1.QueryBinder().bindId("classId", classId), { rowFormat: core_common_1.QueryRowFormat.UseJsPropertyNames });
83
- const aspectAsyncQueryReader = (0, ECSqlReaderAsyncIterableIteratorAdapter_1.ensureECSqlReaderIsAsyncIterableIterator)(aspectQueryReader);
84
- let firstDone = false;
85
- for await (const rowProxy of aspectAsyncQueryReader) {
86
- const row = rowProxy.toRow();
87
- const aspectProps = {
88
- ...row,
89
- classFullName,
90
- className: undefined,
91
- }; // add in property required by EntityProps
92
- if (!firstDone) {
93
- firstDone = true;
94
- }
95
- delete aspectProps.className; // clear property from SELECT * that we don't want in the final instance
96
- const aspectEntity = this.sourceDb.constructEntity(aspectProps);
97
- yield aspectEntity;
98
- }
99
- }
100
- }
101
- async exportElementAspectsForElement(_elementId) {
102
- // All aspects are exported separately from their elements and don't need to be exported when element is exported.
103
- }
104
- }
105
- exports.DetachedExportElementAspectsStrategy = DetachedExportElementAspectsStrategy;
106
- //# sourceMappingURL=DetachedExportElementAspectsStrategy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DetachedExportElementAspectsStrategy.js","sourceRoot":"","sources":["../../src/DetachedExportElementAspectsStrategy.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,sDAI6B;AAE7B,iFAA8E;AAC9E,uGAAqG;AACrG,oDAI4B;AAE5B;;;;;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;QACH,CAAC;IACH,CAAC;IAEe,KAAK,CAAC,8BAA8B,CAClD,UAAkB;QAElB,kHAAkH;IACpH,CAAC;CACF;AAvID,oFAuIC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport {\n ElementAspect,\n ElementMultiAspect,\n ElementUniqueAspect,\n} from \"@itwin/core-backend\";\nimport { Id64String } from \"@itwin/core-bentley\";\nimport { ExportElementAspectsStrategy } from \"./ExportElementAspectsStrategy\";\nimport { ensureECSqlReaderIsAsyncIterableIterator } from \"./ECSqlReaderAsyncIterableIteratorAdapter\";\nimport {\n ElementAspectProps,\n QueryBinder,\n QueryRowFormat,\n} from \"@itwin/core-common\";\n\n/**\n * Detached ElementAspect export strategy for [[IModelExporter]].\n * This strategy exports all ElementAspects separately from the Elements that own them.\n *\n * @note Since aspects are exported separately from elements that own them, this strategy will export aspects of filtered out elements by default and\n * this needs to be handled by ElementAspectHandler\n * @internal\n */\nexport class DetachedExportElementAspectsStrategy extends ExportElementAspectsStrategy {\n public override async exportAllElementAspects(): Promise<void> {\n await this.exportAspectsLoop<ElementUniqueAspect>(\n ElementUniqueAspect.classFullName,\n async (uniqueAspect) => {\n const isInsertChange =\n this.aspectChanges?.insertIds.has(uniqueAspect.id) ?? false;\n const isUpdateChange =\n this.aspectChanges?.updateIds.has(uniqueAspect.id) ?? false;\n const doExport =\n this.aspectChanges === undefined || isInsertChange || isUpdateChange;\n if (doExport) {\n const isKnownUpdate = this.aspectChanges ? isUpdateChange : undefined;\n await this.handler.onExportElementUniqueAspect(\n uniqueAspect,\n isKnownUpdate\n );\n await this.handler.trackProgress();\n }\n }\n );\n\n let batchedElementMultiAspects: ElementMultiAspect[] = [];\n await this.exportAspectsLoop<ElementMultiAspect>(\n ElementMultiAspect.classFullName,\n async (multiAspect) => {\n if (batchedElementMultiAspects.length === 0) {\n batchedElementMultiAspects.push(multiAspect);\n return;\n }\n\n // element id changed so all element's aspects are in the array and can be exported\n if (\n batchedElementMultiAspects[0].element.id !== multiAspect.element.id\n ) {\n await this.handler.onExportElementMultiAspects(\n batchedElementMultiAspects\n );\n await this.handler.trackProgress();\n batchedElementMultiAspects = [];\n }\n\n batchedElementMultiAspects.push(multiAspect);\n }\n );\n\n if (batchedElementMultiAspects.length > 0) {\n // aspects that are left in the array have not been exported\n await this.handler.onExportElementMultiAspects(\n batchedElementMultiAspects\n );\n await this.handler.trackProgress();\n }\n }\n\n private async exportAspectsLoop<T extends ElementAspect>(\n baseAspectClass: string,\n exportAspect: (aspect: T) => Promise<void>\n ) {\n for await (const aspect of this.queryAspects<T>(baseAspectClass)) {\n if (!this.shouldExportElementAspect(aspect)) {\n continue;\n }\n\n await exportAspect(aspect);\n }\n }\n\n private async *queryAspects<T extends ElementAspect>(\n baseElementAspectClassFullName: string\n ) {\n const aspectClassNameIdMap = new Map<\n Id64String,\n { schemaName: string; className: string }\n >();\n\n const optimizesAspectClassesSql = `\n SELECT c.ECInstanceId as classId, (ec_className(c.ECInstanceId, 's')) as schemaName, (ec_className(c.ECInstanceId, 'c')) as className\n FROM ECDbMeta.ClassHasAllBaseClasses r\n JOIN ECDbMeta.ECClassDef c ON c.ECInstanceId = r.SourceECInstanceId\n WHERE r.TargetECInstanceId = ec_classId(:baseClassName)\n `;\n const aspectClassesQueryReader = this.sourceDb.createQueryReader(\n optimizesAspectClassesSql,\n new QueryBinder().bindString(\n \"baseClassName\",\n baseElementAspectClassFullName\n )\n );\n const aspectClassesAsyncQueryReader =\n ensureECSqlReaderIsAsyncIterableIterator(aspectClassesQueryReader);\n for await (const rowProxy of aspectClassesAsyncQueryReader) {\n const row = rowProxy.toRow();\n aspectClassNameIdMap.set(row.classId, {\n schemaName: row.schemaName,\n className: row.className,\n });\n }\n\n for (const [classId, { schemaName, className }] of aspectClassNameIdMap) {\n const classFullName = `${schemaName}:${className}`;\n if (this.excludedElementAspectClassFullNames.has(classFullName)) continue;\n\n const getAspectPropsSql = `SELECT * FROM [${schemaName}]:[${className}] WHERE ECClassId = :classId ORDER BY Element.Id`;\n const aspectQueryReader = this.sourceDb.createQueryReader(\n getAspectPropsSql,\n new QueryBinder().bindId(\"classId\", classId),\n { rowFormat: QueryRowFormat.UseJsPropertyNames }\n );\n const aspectAsyncQueryReader =\n ensureECSqlReaderIsAsyncIterableIterator(aspectQueryReader);\n let firstDone = false;\n for await (const rowProxy of aspectAsyncQueryReader) {\n const row = rowProxy.toRow();\n const aspectProps: ElementAspectProps = {\n ...row,\n classFullName,\n className: undefined,\n }; // add in property required by EntityProps\n if (!firstDone) {\n firstDone = true;\n }\n delete (aspectProps as any).className; // clear property from SELECT * that we don't want in the final instance\n const aspectEntity = this.sourceDb.constructEntity<T>(aspectProps);\n\n yield aspectEntity;\n }\n }\n }\n\n public override async exportElementAspectsForElement(\n _elementId: string\n ): Promise<void> {\n // All aspects are exported separately from their elements and don't need to be exported when element is exported.\n }\n}\n"]}
@@ -1,22 +0,0 @@
1
- /** @packageDocumentation
2
- * @module iModels
3
- */
4
- import { ElementTreeDeleter, ElementTreeWalkerScope, IModelDb } from "@itwin/core-backend";
5
- import { Id64String } from "@itwin/core-bentley";
6
- /** Deletes an element tree and code scope references starting with the specified top element. The top element is also deleted. Uses ElementCascadeDeleter.
7
- * @param iModel The iModel
8
- * @param topElement The parent of the sub-tree
9
- */
10
- export declare function deleteElementTreeCascade(iModel: IModelDb, topElement: Id64String): void;
11
- /** Deletes an entire element tree, including sub-models, child elements and code scope references.
12
- * Items are deleted in bottom-up order. Definitions and Subjects are deleted after normal elements.
13
- * Call deleteNormalElements on each tree. Then call deleteSpecialElements.
14
- */
15
- export declare class ElementCascadingDeleter extends ElementTreeDeleter {
16
- protected shouldVisitCodeScopes(_elementId: Id64String, _scope: ElementTreeWalkerScope): boolean;
17
- /** The main tree-walking function */
18
- protected processElementTree(element: Id64String, scope: ElementTreeWalkerScope): void;
19
- /** Process code scope references */
20
- private _processCodeScopes;
21
- }
22
- //# sourceMappingURL=ElementCascadingDeleter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ElementCascadingDeleter.d.ts","sourceRoot":"","sources":["../../src/ElementCascadingDeleter.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,QAAQ,EACT,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAY,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE3D;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,QAAQ,EAChB,UAAU,EAAE,UAAU,GACrB,IAAI,CAIN;AAED;;;GAGG;AACH,qBAAa,uBAAwB,SAAQ,kBAAkB;IAC7D,SAAS,CAAC,qBAAqB,CAC7B,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,sBAAsB;IAKhC,qCAAqC;cAClB,kBAAkB,CACnC,OAAO,EAAE,UAAU,EACnB,KAAK,EAAE,sBAAsB,GAC5B,IAAI;IAMP,oCAAoC;IACpC,OAAO,CAAC,kBAAkB;CAsB3B"}
@@ -1,57 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ElementCascadingDeleter = void 0;
4
- exports.deleteElementTreeCascade = deleteElementTreeCascade;
5
- /*---------------------------------------------------------------------------------------------
6
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
7
- * See LICENSE.md in the project root for license terms and full copyright notice.
8
- *--------------------------------------------------------------------------------------------*/
9
- /** @packageDocumentation
10
- * @module iModels
11
- */
12
- const core_backend_1 = require("@itwin/core-backend");
13
- const core_bentley_1 = require("@itwin/core-bentley");
14
- /** Deletes an element tree and code scope references starting with the specified top element. The top element is also deleted. Uses ElementCascadeDeleter.
15
- * @param iModel The iModel
16
- * @param topElement The parent of the sub-tree
17
- */
18
- function deleteElementTreeCascade(iModel, topElement) {
19
- const del = new ElementCascadingDeleter(iModel);
20
- del.deleteNormalElements(topElement);
21
- del.deleteSpecialElements();
22
- }
23
- /** Deletes an entire element tree, including sub-models, child elements and code scope references.
24
- * Items are deleted in bottom-up order. Definitions and Subjects are deleted after normal elements.
25
- * Call deleteNormalElements on each tree. Then call deleteSpecialElements.
26
- */
27
- class ElementCascadingDeleter extends core_backend_1.ElementTreeDeleter {
28
- shouldVisitCodeScopes(_elementId, _scope) {
29
- return true;
30
- }
31
- /** The main tree-walking function */
32
- processElementTree(element, scope) {
33
- if (this.shouldVisitCodeScopes(element, scope)) {
34
- this._processCodeScopes(element, scope);
35
- }
36
- super.processElementTree(element, scope);
37
- }
38
- /** Process code scope references */
39
- _processCodeScopes(element, scope) {
40
- const newScope = new core_backend_1.ElementTreeWalkerScope(scope, element);
41
- // eslint-disable-next-line @itwin/no-internal, @typescript-eslint/no-deprecated
42
- this._iModel.withPreparedStatement(`
43
- SELECT ECInstanceId
44
- FROM bis.Element
45
- WHERE CodeScope.id=?
46
- AND Parent.id IS NULL
47
- `, (stmt) => {
48
- stmt.bindId(1, element);
49
- while (stmt.step() === core_bentley_1.DbResult.BE_SQLITE_ROW) {
50
- const elementId = stmt.getValue(0).getId();
51
- this.processElementTree(elementId, newScope);
52
- }
53
- });
54
- }
55
- }
56
- exports.ElementCascadingDeleter = ElementCascadingDeleter;
57
- //# sourceMappingURL=ElementCascadingDeleter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ElementCascadingDeleter.js","sourceRoot":"","sources":["../../src/ElementCascadingDeleter.ts"],"names":[],"mappings":";;;AAkBA,4DAOC;AAzBD;;;gGAGgG;AAChG;;GAEG;AACH,sDAI6B;AAC7B,sDAA2D;AAE3D;;;GAGG;AACH,SAAgB,wBAAwB,CACtC,MAAgB,EAChB,UAAsB;IAEtB,MAAM,GAAG,GAAG,IAAI,uBAAuB,CAAC,MAAM,CAAC,CAAC;IAChD,GAAG,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC;IACrC,GAAG,CAAC,qBAAqB,EAAE,CAAC;AAC9B,CAAC;AAED;;;GAGG;AACH,MAAa,uBAAwB,SAAQ,iCAAkB;IACnD,qBAAqB,CAC7B,UAAsB,EACtB,MAA8B;QAE9B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,qCAAqC;IAClB,kBAAkB,CACnC,OAAmB,EACnB,KAA6B;QAE7B,IAAI,IAAI,CAAC,qBAAqB,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC;YAC/C,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAC1C,CAAC;QACD,KAAK,CAAC,kBAAkB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC3C,CAAC;IACD,oCAAoC;IAC5B,kBAAkB,CACxB,OAAmB,EACnB,KAA6B;QAE7B,MAAM,QAAQ,GAAG,IAAI,qCAAsB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAC5D,gFAAgF;QAChF,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAChC;;;;;KAKD,EACC,CAAC,IAAI,EAAE,EAAE;YACP,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;YACxB,OAAO,IAAI,CAAC,IAAI,EAAE,KAAK,uBAAQ,CAAC,aAAa,EAAE,CAAC;gBAC9C,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;gBAC3C,IAAI,CAAC,kBAAkB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;YAC/C,CAAC;QACH,CAAC,CACF,CAAC;IACJ,CAAC;CACF;AAzCD,0DAyCC","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 {\n ElementTreeDeleter,\n ElementTreeWalkerScope,\n IModelDb,\n} from \"@itwin/core-backend\";\nimport { DbResult, Id64String } from \"@itwin/core-bentley\";\n\n/** Deletes an element tree and code scope references starting with the specified top element. The top element is also deleted. Uses ElementCascadeDeleter.\n * @param iModel The iModel\n * @param topElement The parent of the sub-tree\n */\nexport function deleteElementTreeCascade(\n iModel: IModelDb,\n topElement: Id64String\n): void {\n const del = new ElementCascadingDeleter(iModel);\n del.deleteNormalElements(topElement);\n del.deleteSpecialElements();\n}\n\n/** Deletes an entire element tree, including sub-models, child elements and code scope references.\n * Items are deleted in bottom-up order. Definitions and Subjects are deleted after normal elements.\n * Call deleteNormalElements on each tree. Then call deleteSpecialElements.\n */\nexport class ElementCascadingDeleter extends ElementTreeDeleter {\n protected shouldVisitCodeScopes(\n _elementId: Id64String,\n _scope: ElementTreeWalkerScope\n ) {\n return true;\n }\n\n /** The main tree-walking function */\n protected override processElementTree(\n element: Id64String,\n scope: ElementTreeWalkerScope\n ): void {\n if (this.shouldVisitCodeScopes(element, scope)) {\n this._processCodeScopes(element, scope);\n }\n super.processElementTree(element, scope);\n }\n /** Process code scope references */\n private _processCodeScopes(\n element: Id64String,\n scope: ElementTreeWalkerScope\n ) {\n const newScope = new ElementTreeWalkerScope(scope, element);\n // eslint-disable-next-line @itwin/no-internal, @typescript-eslint/no-deprecated\n this._iModel.withPreparedStatement(\n `\n SELECT ECInstanceId\n FROM bis.Element\n WHERE CodeScope.id=?\n AND Parent.id IS NULL\n `,\n (stmt) => {\n stmt.bindId(1, element);\n while (stmt.step() === DbResult.BE_SQLITE_ROW) {\n const elementId = stmt.getValue(0).getId();\n this.processElementTree(elementId, newScope);\n }\n }\n );\n }\n}\n"]}
@@ -1,26 +0,0 @@
1
- /** @packageDocumentation
2
- * @module Utils
3
- */
4
- import { EntityReference } from "@itwin/core-common";
5
- import { ConcreteEntity } from "@itwin/core-backend";
6
- /** @internal */
7
- export type EntityKey = EntityReference;
8
- /** @internal */
9
- export declare class EntityMap<V> {
10
- private _map;
11
- static makeKey(entity: ConcreteEntity): EntityKey;
12
- clear(): void;
13
- has(entity: ConcreteEntity): boolean;
14
- set(entity: ConcreteEntity, val: V): EntityMap<V>;
15
- setByKey(k: EntityKey, val: V): EntityMap<V>;
16
- get(entity: ConcreteEntity): V | undefined;
17
- getByKey(k: EntityKey): V | undefined;
18
- delete(entity: ConcreteEntity): boolean;
19
- deleteByKey(k: EntityKey): boolean;
20
- keys(): MapIterator<string>;
21
- values(): MapIterator<V>;
22
- entries(): MapIterator<[string, V]>;
23
- [Symbol.iterator](): MapIterator<[string, V]>;
24
- get size(): number;
25
- }
26
- //# sourceMappingURL=EntityMap.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EntityMap.d.ts","sourceRoot":"","sources":["../../src/EntityMap.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAoB,MAAM,qBAAqB,CAAC;AAGvE,gBAAgB;AAChB,MAAM,MAAM,SAAS,GAAG,eAAe,CAAC;AAExC,gBAAgB;AAChB,qBAAa,SAAS,CAAC,CAAC;IACtB,OAAO,CAAC,IAAI,CAAmB;WAEjB,OAAO,CAAC,MAAM,EAAE,cAAc,GAAG,SAAS;IAIjD,KAAK,IAAI,IAAI;IAIb,GAAG,CAAC,MAAM,EAAE,cAAc;IAI1B,GAAG,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC;IAIjD,QAAQ,CAAC,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC;IAK5C,GAAG,CAAC,MAAM,EAAE,cAAc,GAAG,CAAC,GAAG,SAAS;IAI1C,QAAQ,CAAC,CAAC,EAAE,SAAS,GAAG,CAAC,GAAG,SAAS;IAIrC,MAAM,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO;IAIvC,WAAW,CAAC,CAAC,EAAE,SAAS,GAAG,OAAO;IAIlC,IAAI;IAIJ,MAAM;IAIN,OAAO;IAIP,CAAC,MAAM,CAAC,QAAQ,CAAC;IAIxB,IAAW,IAAI,WAEd;CACF"}
@@ -1,54 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EntityMap = void 0;
4
- const core_backend_1 = require("@itwin/core-backend");
5
- const BigMap_1 = require("./BigMap");
6
- /** @internal */
7
- class EntityMap {
8
- _map = new BigMap_1.BigMap();
9
- static makeKey(entity) {
10
- return core_backend_1.EntityReferences.from(entity);
11
- }
12
- clear() {
13
- return this._map.clear();
14
- }
15
- has(entity) {
16
- return this._map.has(EntityMap.makeKey(entity));
17
- }
18
- set(entity, val) {
19
- return this.setByKey(EntityMap.makeKey(entity), val);
20
- }
21
- setByKey(k, val) {
22
- this._map.set(k, val);
23
- return this;
24
- }
25
- get(entity) {
26
- return this.getByKey(EntityMap.makeKey(entity));
27
- }
28
- getByKey(k) {
29
- return this._map.get(k);
30
- }
31
- delete(entity) {
32
- return this.deleteByKey(EntityMap.makeKey(entity));
33
- }
34
- deleteByKey(k) {
35
- return this._map.delete(k);
36
- }
37
- keys() {
38
- return this._map.keys();
39
- }
40
- values() {
41
- return this._map.values();
42
- }
43
- entries() {
44
- return this._map.entries();
45
- }
46
- [Symbol.iterator]() {
47
- return this._map[Symbol.iterator]();
48
- }
49
- get size() {
50
- return this._map.size;
51
- }
52
- }
53
- exports.EntityMap = EntityMap;
54
- //# sourceMappingURL=EntityMap.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EntityMap.js","sourceRoot":"","sources":["../../src/EntityMap.ts"],"names":[],"mappings":";;;AAQA,sDAAuE;AACvE,qCAAkC;AAKlC,gBAAgB;AAChB,MAAa,SAAS;IACZ,IAAI,GAAG,IAAI,eAAM,EAAK,CAAC;IAExB,MAAM,CAAC,OAAO,CAAC,MAAsB;QAC1C,OAAO,+BAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACvC,CAAC;IAE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tB,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;IACtC,CAAC;IAED,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;IACxB,CAAC;CACF;AA3DD,8BA2DC","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 Utils\n */\nimport { EntityReference } from \"@itwin/core-common\";\nimport { ConcreteEntity, EntityReferences } from \"@itwin/core-backend\";\nimport { BigMap } from \"./BigMap\";\n\n/** @internal */\nexport type EntityKey = EntityReference;\n\n/** @internal */\nexport class EntityMap<V> {\n private _map = new BigMap<V>();\n\n public static makeKey(entity: ConcreteEntity): EntityKey {\n return EntityReferences.from(entity);\n }\n\n public clear(): void {\n return this._map.clear();\n }\n\n public has(entity: ConcreteEntity) {\n return this._map.has(EntityMap.makeKey(entity));\n }\n\n public set(entity: ConcreteEntity, val: V): EntityMap<V> {\n return this.setByKey(EntityMap.makeKey(entity), val);\n }\n\n public setByKey(k: EntityKey, val: V): EntityMap<V> {\n this._map.set(k, val);\n return this;\n }\n\n public get(entity: ConcreteEntity): V | undefined {\n return this.getByKey(EntityMap.makeKey(entity));\n }\n\n public getByKey(k: EntityKey): V | undefined {\n return this._map.get(k);\n }\n\n public delete(entity: ConcreteEntity): boolean {\n return this.deleteByKey(EntityMap.makeKey(entity));\n }\n\n public deleteByKey(k: EntityKey): boolean {\n return this._map.delete(k);\n }\n\n public keys() {\n return this._map.keys();\n }\n\n public values() {\n return this._map.values();\n }\n\n public entries() {\n return this._map.entries();\n }\n\n public [Symbol.iterator]() {\n return this._map[Symbol.iterator]();\n }\n\n public get size() {\n return this._map.size;\n }\n}\n"]}
@@ -1,35 +0,0 @@
1
- import { ElementAspect, ElementMultiAspect, ElementUniqueAspect, IModelDb } from "@itwin/core-backend";
2
- import { Id64String } from "@itwin/core-bentley";
3
- import { ChangedInstanceOps } from "./IModelExporter";
4
- /**
5
- * Handler for [[ExportElementAspectsStrategy]]
6
- * @internal
7
- */
8
- export interface ElementAspectsHandler {
9
- shouldExportElementAspect(aspect: ElementAspect): boolean;
10
- onExportElementUniqueAspect(uniqueAspect: ElementUniqueAspect, isUpdate?: boolean | undefined): Promise<void>;
11
- onExportElementMultiAspects(multiAspects: ElementMultiAspect[]): Promise<void>;
12
- trackProgress: () => Promise<void>;
13
- }
14
- /**
15
- * Base ElementAspect export strategy. Base export strategy includes state saving and loading and
16
- * ElementAspect filtering.
17
- * @internal
18
- */
19
- export declare abstract class ExportElementAspectsStrategy {
20
- /** The set of classes of ElementAspects that will be excluded (polymorphically) from transformation to the target iModel. */
21
- protected _excludedElementAspectClasses: Set<typeof ElementAspect>;
22
- /** The set of classFullNames for ElementAspects that will be excluded from transformation to the target iModel. */
23
- readonly excludedElementAspectClassFullNames: Set<string>;
24
- protected sourceDb: IModelDb;
25
- protected aspectChanges: ChangedInstanceOps | undefined;
26
- protected handler: ElementAspectsHandler;
27
- constructor(sourceDb: IModelDb, handler: ElementAspectsHandler);
28
- abstract exportElementAspectsForElement(_elementId: Id64String): Promise<void>;
29
- abstract exportAllElementAspects(): Promise<void>;
30
- protected shouldExportElementAspect(aspect: ElementAspect): boolean;
31
- setAspectChanges(aspectChanges?: ChangedInstanceOps): void;
32
- loadExcludedElementAspectClasses(excludedElementAspectClassFullNames: string[]): void;
33
- excludeElementAspectClass(classFullName: string): void;
34
- }
35
- //# sourceMappingURL=ExportElementAspectsStrategy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ExportElementAspectsStrategy.d.ts","sourceRoot":"","sources":["../../src/ExportElementAspectsStrategy.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,mBAAmB,EACnB,QAAQ,EACT,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAU,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAItD;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,yBAAyB,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC;IAC1D,2BAA2B,CACzB,YAAY,EAAE,mBAAmB,EACjC,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,GAC7B,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,2BAA2B,CACzB,YAAY,EAAE,kBAAkB,EAAE,GACjC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,aAAa,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC;AAED;;;;GAIG;AACH,8BAAsB,4BAA4B;IAChD,6HAA6H;IAC7H,SAAS,CAAC,6BAA6B,4BAAmC;IAC1E,mHAAmH;IACnH,SAAgB,mCAAmC,cAAqB;IAExE,SAAS,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAE7B,SAAS,CAAC,aAAa,EAAE,kBAAkB,GAAG,SAAS,CAAC;IAExD,SAAS,CAAC,OAAO,EAAE,qBAAqB,CAAC;gBAEtB,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,qBAAqB;aAKrD,8BAA8B,CAC5C,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,IAAI,CAAC;aACA,uBAAuB,IAAI,OAAO,CAAC,IAAI,CAAC;IAExD,SAAS,CAAC,yBAAyB,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO;IAe5D,gBAAgB,CAAC,aAAa,CAAC,EAAE,kBAAkB;IAInD,gCAAgC,CACrC,mCAAmC,EAAE,MAAM,EAAE,GAC5C,IAAI;IAWA,yBAAyB,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI;CAM9D"}
@@ -1,52 +0,0 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.ExportElementAspectsStrategy = void 0;
8
- const core_bentley_1 = require("@itwin/core-bentley");
9
- const TransformerLoggerCategory_1 = require("./TransformerLoggerCategory");
10
- const loggerCategory = TransformerLoggerCategory_1.TransformerLoggerCategory.IModelExporter;
11
- /**
12
- * Base ElementAspect export strategy. Base export strategy includes state saving and loading and
13
- * ElementAspect filtering.
14
- * @internal
15
- */
16
- class ExportElementAspectsStrategy {
17
- /** The set of classes of ElementAspects that will be excluded (polymorphically) from transformation to the target iModel. */
18
- _excludedElementAspectClasses = new Set();
19
- /** The set of classFullNames for ElementAspects that will be excluded from transformation to the target iModel. */
20
- excludedElementAspectClassFullNames = new Set();
21
- sourceDb;
22
- aspectChanges;
23
- handler;
24
- constructor(sourceDb, handler) {
25
- this.sourceDb = sourceDb;
26
- this.handler = handler;
27
- }
28
- shouldExportElementAspect(aspect) {
29
- for (const excludedElementAspectClass of this
30
- ._excludedElementAspectClasses) {
31
- if (aspect instanceof excludedElementAspectClass) {
32
- core_bentley_1.Logger.logInfo(loggerCategory, `Excluded ElementAspect by class: ${aspect.classFullName}`);
33
- return false;
34
- }
35
- }
36
- // ElementAspect has passed standard exclusion rules, now give handler a chance to accept/reject
37
- return this.handler.shouldExportElementAspect(aspect);
38
- }
39
- setAspectChanges(aspectChanges) {
40
- this.aspectChanges = aspectChanges;
41
- }
42
- loadExcludedElementAspectClasses(excludedElementAspectClassFullNames) {
43
- this.excludedElementAspectClassFullNames = new Set(excludedElementAspectClassFullNames);
44
- this._excludedElementAspectClasses = new Set(excludedElementAspectClassFullNames.map((c) => this.sourceDb.getJsClass(c)));
45
- }
46
- excludeElementAspectClass(classFullName) {
47
- this.excludedElementAspectClassFullNames.add(classFullName); // allows non-polymorphic exclusion before query
48
- this._excludedElementAspectClasses.add(this.sourceDb.getJsClass(classFullName)); // allows polymorphic exclusion after query/load
49
- }
50
- }
51
- exports.ExportElementAspectsStrategy = ExportElementAspectsStrategy;
52
- //# sourceMappingURL=ExportElementAspectsStrategy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ExportElementAspectsStrategy.js","sourceRoot":"","sources":["../../src/ExportElementAspectsStrategy.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAQhG,sDAAyD;AACzD,2EAAwE;AAGxE,MAAM,cAAc,GAAG,qDAAyB,CAAC,cAAc,CAAC;AAkBhE;;;;GAIG;AACH,MAAsB,4BAA4B;IAChD,6HAA6H;IACnH,6BAA6B,GAAG,IAAI,GAAG,EAAwB,CAAC;IAC1E,mHAAmH;IACnG,mCAAmC,GAAG,IAAI,GAAG,EAAU,CAAC;IAE9D,QAAQ,CAAW;IAEnB,aAAa,CAAiC;IAE9C,OAAO,CAAwB;IAEzC,YAAmB,QAAkB,EAAE,OAA8B;QACnE,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAOS,yBAAyB,CAAC,MAAqB;QACvD,KAAK,MAAM,0BAA0B,IAAI,IAAI;aAC1C,6BAA6B,EAAE,CAAC;YACjC,IAAI,MAAM,YAAY,0BAA0B,EAAE,CAAC;gBACjD,qBAAM,CAAC,OAAO,CACZ,cAAc,EACd,oCAAoC,MAAM,CAAC,aAAa,EAAE,CAC3D,CAAC;gBACF,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;QACD,gGAAgG;QAChG,OAAO,IAAI,CAAC,OAAO,CAAC,yBAAyB,CAAC,MAAM,CAAC,CAAC;IACxD,CAAC;IAEM,gBAAgB,CAAC,aAAkC;QACxD,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;IAEM,gCAAgC,CACrC,mCAA6C;QAE5C,IAAI,CAAC,mCAA2C,GAAG,IAAI,GAAG,CACzD,mCAAmC,CACpC,CAAC;QACF,IAAI,CAAC,6BAA6B,GAAG,IAAI,GAAG,CAC1C,mCAAmC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAC5C,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAC5B,CACF,CAAC;IACJ,CAAC;IAEM,yBAAyB,CAAC,aAAqB;QACpD,IAAI,CAAC,mCAAmC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,gDAAgD;QAC7G,IAAI,CAAC,6BAA6B,CAAC,GAAG,CACpC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAuB,aAAa,CAAC,CAC9D,CAAC,CAAC,gDAAgD;IACrD,CAAC;CACF;AA5DD,oEA4DC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport {\n ElementAspect,\n ElementMultiAspect,\n ElementUniqueAspect,\n IModelDb,\n} from \"@itwin/core-backend\";\nimport { Id64String, Logger } from \"@itwin/core-bentley\";\nimport { TransformerLoggerCategory } from \"./TransformerLoggerCategory\";\nimport { ChangedInstanceOps } from \"./IModelExporter\";\n\nconst loggerCategory = TransformerLoggerCategory.IModelExporter;\n\n/**\n * Handler for [[ExportElementAspectsStrategy]]\n * @internal\n */\nexport interface ElementAspectsHandler {\n shouldExportElementAspect(aspect: ElementAspect): boolean;\n onExportElementUniqueAspect(\n uniqueAspect: ElementUniqueAspect,\n isUpdate?: boolean | undefined\n ): Promise<void>;\n onExportElementMultiAspects(\n multiAspects: ElementMultiAspect[]\n ): Promise<void>;\n trackProgress: () => Promise<void>;\n}\n\n/**\n * Base ElementAspect export strategy. Base export strategy includes state saving and loading and\n * ElementAspect filtering.\n * @internal\n */\nexport abstract class ExportElementAspectsStrategy {\n /** The set of classes of ElementAspects that will be excluded (polymorphically) from transformation to the target iModel. */\n protected _excludedElementAspectClasses = new Set<typeof ElementAspect>();\n /** The set of classFullNames for ElementAspects that will be excluded from transformation to the target iModel. */\n public readonly excludedElementAspectClassFullNames = new Set<string>();\n\n protected sourceDb: IModelDb;\n\n protected aspectChanges: ChangedInstanceOps | undefined;\n\n protected handler: ElementAspectsHandler;\n\n public constructor(sourceDb: IModelDb, handler: ElementAspectsHandler) {\n this.sourceDb = sourceDb;\n this.handler = handler;\n }\n\n public abstract exportElementAspectsForElement(\n _elementId: Id64String\n ): Promise<void>;\n public abstract exportAllElementAspects(): Promise<void>;\n\n protected shouldExportElementAspect(aspect: ElementAspect): boolean {\n for (const excludedElementAspectClass of this\n ._excludedElementAspectClasses) {\n if (aspect instanceof excludedElementAspectClass) {\n Logger.logInfo(\n loggerCategory,\n `Excluded ElementAspect by class: ${aspect.classFullName}`\n );\n return false;\n }\n }\n // ElementAspect has passed standard exclusion rules, now give handler a chance to accept/reject\n return this.handler.shouldExportElementAspect(aspect);\n }\n\n public setAspectChanges(aspectChanges?: ChangedInstanceOps) {\n this.aspectChanges = aspectChanges;\n }\n\n public loadExcludedElementAspectClasses(\n excludedElementAspectClassFullNames: string[]\n ): void {\n (this.excludedElementAspectClassFullNames as any) = new Set(\n excludedElementAspectClassFullNames\n );\n this._excludedElementAspectClasses = new Set(\n excludedElementAspectClassFullNames.map((c) =>\n this.sourceDb.getJsClass(c)\n )\n );\n }\n\n public excludeElementAspectClass(classFullName: string): void {\n this.excludedElementAspectClassFullNames.add(classFullName); // allows non-polymorphic exclusion before query\n this._excludedElementAspectClasses.add(\n this.sourceDb.getJsClass<typeof ElementAspect>(classFullName)\n ); // allows polymorphic exclusion after query/load\n }\n}\n"]}
@@ -1,12 +0,0 @@
1
- import { Id64String } from "@itwin/core-bentley";
2
- import { ExportElementAspectsStrategy } from "./ExportElementAspectsStrategy";
3
- /**
4
- * ElementAspect export strategy for [[IModelExporter]].
5
- * This strategy exports ElementAspects together with their Elements.
6
- * @internal
7
- */
8
- export declare class ExportElementAspectsWithElementsStrategy extends ExportElementAspectsStrategy {
9
- exportElementAspectsForElement(elementId: Id64String): Promise<void>;
10
- exportAllElementAspects(): Promise<void>;
11
- }
12
- //# sourceMappingURL=ExportElementAspectsWithElementsStrategy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ExportElementAspectsWithElementsStrategy.d.ts","sourceRoot":"","sources":["../../src/ExportElementAspectsWithElementsStrategy.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAE9E;;;;GAIG;AACH,qBAAa,wCAAyC,SAAQ,4BAA4B;IAClE,8BAA8B,CAClD,SAAS,EAAE,UAAU,GACpB,OAAO,CAAC,IAAI,CAAC;IA6CM,uBAAuB,IAAI,OAAO,CAAC,IAAI,CAAC;CAG/D"}
@@ -1,47 +0,0 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.ExportElementAspectsWithElementsStrategy = void 0;
8
- const core_backend_1 = require("@itwin/core-backend");
9
- const ExportElementAspectsStrategy_1 = require("./ExportElementAspectsStrategy");
10
- /**
11
- * ElementAspect export strategy for [[IModelExporter]].
12
- * This strategy exports ElementAspects together with their Elements.
13
- * @internal
14
- */
15
- class ExportElementAspectsWithElementsStrategy extends ExportElementAspectsStrategy_1.ExportElementAspectsStrategy {
16
- async exportElementAspectsForElement(elementId) {
17
- const _uniqueAspects = await Promise.all(this.sourceDb.elements
18
- ._queryAspects(elementId, core_backend_1.ElementUniqueAspect.classFullName, this.excludedElementAspectClassFullNames)
19
- .filter((a) => this.shouldExportElementAspect(a))
20
- .map(async (uniqueAspect) => {
21
- const isInsertChange = this.aspectChanges?.insertIds.has(uniqueAspect.id) ?? false;
22
- const isUpdateChange = this.aspectChanges?.updateIds.has(uniqueAspect.id) ?? false;
23
- const doExport = this.aspectChanges === undefined ||
24
- isInsertChange ||
25
- isUpdateChange;
26
- if (doExport) {
27
- const isKnownUpdate = this.aspectChanges
28
- ? isUpdateChange
29
- : undefined;
30
- await this.handler.onExportElementUniqueAspect(uniqueAspect, isKnownUpdate);
31
- await this.handler.trackProgress();
32
- }
33
- }));
34
- const multiAspects = this.sourceDb.elements
35
- ._queryAspects(elementId, core_backend_1.ElementMultiAspect.classFullName, this.excludedElementAspectClassFullNames)
36
- .filter((a) => this.shouldExportElementAspect(a));
37
- if (multiAspects.length > 0) {
38
- await this.handler.onExportElementMultiAspects(multiAspects);
39
- return this.handler.trackProgress();
40
- }
41
- }
42
- async exportAllElementAspects() {
43
- // All aspects are exported with their owning elements and don't need to be exported separately.
44
- }
45
- }
46
- exports.ExportElementAspectsWithElementsStrategy = ExportElementAspectsWithElementsStrategy;
47
- //# sourceMappingURL=ExportElementAspectsWithElementsStrategy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ExportElementAspectsWithElementsStrategy.js","sourceRoot":"","sources":["../../src/ExportElementAspectsWithElementsStrategy.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,sDAA8E;AAE9E,iFAA8E;AAE9E;;;;GAIG;AACH,MAAa,wCAAyC,SAAQ,2DAA4B;IACxE,KAAK,CAAC,8BAA8B,CAClD,SAAqB;QAErB,MAAM,cAAc,GAAG,MAAM,OAAO,CAAC,GAAG,CACtC,IAAI,CAAC,QAAQ,CAAC,QAAQ;aACnB,aAAa,CACZ,SAAS,EACT,kCAAmB,CAAC,aAAa,EACjC,IAAI,CAAC,mCAAmC,CACzC;aACA,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC;aAChD,GAAG,CAAC,KAAK,EAAE,YAAiC,EAAE,EAAE;YAC/C,MAAM,cAAc,GAClB,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC,IAAI,KAAK,CAAC;YAC9D,MAAM,cAAc,GAClB,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC,IAAI,KAAK,CAAC;YAC9D,MAAM,QAAQ,GACZ,IAAI,CAAC,aAAa,KAAK,SAAS;gBAChC,cAAc;gBACd,cAAc,CAAC;YACjB,IAAI,QAAQ,EAAE,CAAC;gBACb,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa;oBACtC,CAAC,CAAC,cAAc;oBAChB,CAAC,CAAC,SAAS,CAAC;gBACd,MAAM,IAAI,CAAC,OAAO,CAAC,2BAA2B,CAC5C,YAAY,EACZ,aAAa,CACd,CAAC;gBACF,MAAM,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;YACrC,CAAC;QACH,CAAC,CAAC,CACL,CAAC;QAEF,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ;aACxC,aAAa,CACZ,SAAS,EACT,iCAAkB,CAAC,aAAa,EAChC,IAAI,CAAC,mCAAmC,CACzC;aACA,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC,CAAC;QAEpD,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC5B,MAAM,IAAI,CAAC,OAAO,CAAC,2BAA2B,CAAC,YAAY,CAAC,CAAC;YAC7D,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;QACtC,CAAC;IACH,CAAC;IAEe,KAAK,CAAC,uBAAuB;QAC3C,gGAAgG;IAClG,CAAC;CACF;AAnDD,4FAmDC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { ElementMultiAspect, ElementUniqueAspect } from \"@itwin/core-backend\";\nimport { Id64String } from \"@itwin/core-bentley\";\nimport { ExportElementAspectsStrategy } from \"./ExportElementAspectsStrategy\";\n\n/**\n * ElementAspect export strategy for [[IModelExporter]].\n * This strategy exports ElementAspects together with their Elements.\n * @internal\n */\nexport class ExportElementAspectsWithElementsStrategy extends ExportElementAspectsStrategy {\n public override async exportElementAspectsForElement(\n elementId: Id64String\n ): Promise<void> {\n const _uniqueAspects = await Promise.all(\n this.sourceDb.elements\n ._queryAspects(\n elementId,\n ElementUniqueAspect.classFullName,\n this.excludedElementAspectClassFullNames\n )\n .filter((a) => this.shouldExportElementAspect(a))\n .map(async (uniqueAspect: ElementUniqueAspect) => {\n const isInsertChange =\n this.aspectChanges?.insertIds.has(uniqueAspect.id) ?? false;\n const isUpdateChange =\n this.aspectChanges?.updateIds.has(uniqueAspect.id) ?? false;\n const doExport =\n this.aspectChanges === undefined ||\n isInsertChange ||\n isUpdateChange;\n if (doExport) {\n const isKnownUpdate = this.aspectChanges\n ? isUpdateChange\n : undefined;\n await this.handler.onExportElementUniqueAspect(\n uniqueAspect,\n isKnownUpdate\n );\n await this.handler.trackProgress();\n }\n })\n );\n\n const multiAspects = this.sourceDb.elements\n ._queryAspects(\n elementId,\n ElementMultiAspect.classFullName,\n this.excludedElementAspectClassFullNames\n )\n .filter((a) => this.shouldExportElementAspect(a));\n\n if (multiAspects.length > 0) {\n await this.handler.onExportElementMultiAspects(multiAspects);\n return this.handler.trackProgress();\n }\n }\n\n public override async exportAllElementAspects(): Promise<void> {\n // All aspects are exported with their owning elements and don't need to be exported separately.\n }\n}\n"]}