@itwin/imodel-transformer 2.0.0-dev.6 → 2.0.0-dev.61
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.
- package/README.md +13 -27
- package/lib/cjs/Algo.js.map +1 -1
- package/lib/cjs/BigMap.d.ts.map +1 -1
- package/lib/cjs/BigMap.js.map +1 -1
- package/lib/cjs/BranchProvenanceInitializer.d.ts.map +1 -1
- package/lib/cjs/BranchProvenanceInitializer.js +34 -34
- package/lib/cjs/BranchProvenanceInitializer.js.map +1 -1
- package/lib/cjs/ChangedElementForest.d.ts +14 -0
- package/lib/cjs/ChangedElementForest.d.ts.map +1 -0
- package/lib/cjs/ChangedElementForest.js +86 -0
- package/lib/cjs/ChangedElementForest.js.map +1 -0
- package/lib/cjs/ChangesetScanner.d.ts +61 -0
- package/lib/cjs/ChangesetScanner.d.ts.map +1 -0
- package/lib/cjs/ChangesetScanner.js +104 -0
- package/lib/cjs/ChangesetScanner.js.map +1 -0
- package/lib/cjs/ECReferenceTypesCache.d.ts +0 -3
- package/lib/cjs/ECReferenceTypesCache.d.ts.map +1 -1
- package/lib/cjs/ECReferenceTypesCache.js +61 -104
- package/lib/cjs/ECReferenceTypesCache.js.map +1 -1
- package/lib/cjs/ECSqlReaderAsyncIterableIteratorAdapter.d.ts.map +1 -1
- package/lib/cjs/ECSqlReaderAsyncIterableIteratorAdapter.js.map +1 -1
- package/lib/cjs/ElementAspectCleanup.d.ts +16 -0
- package/lib/cjs/ElementAspectCleanup.d.ts.map +1 -0
- package/lib/cjs/ElementAspectCleanup.js +87 -0
- package/lib/cjs/ElementAspectCleanup.js.map +1 -0
- package/lib/cjs/ElementAspectExportCoordinator.d.ts +44 -0
- package/lib/cjs/ElementAspectExportCoordinator.d.ts.map +1 -0
- package/lib/cjs/ElementAspectExportCoordinator.js +148 -0
- package/lib/cjs/ElementAspectExportCoordinator.js.map +1 -0
- package/lib/cjs/ElementAspectExportProcessor.d.ts +44 -0
- package/lib/cjs/ElementAspectExportProcessor.d.ts.map +1 -0
- package/lib/cjs/ElementAspectExportProcessor.js +152 -0
- package/lib/cjs/ElementAspectExportProcessor.js.map +1 -0
- package/lib/cjs/ElementBulkDelete.d.ts +30 -0
- package/lib/cjs/ElementBulkDelete.d.ts.map +1 -0
- package/lib/cjs/ElementBulkDelete.js +358 -0
- package/lib/cjs/ElementBulkDelete.js.map +1 -0
- package/lib/cjs/EntityExistenceCache.d.ts +43 -0
- package/lib/cjs/EntityExistenceCache.d.ts.map +1 -0
- package/lib/cjs/EntityExistenceCache.js +91 -0
- package/lib/cjs/EntityExistenceCache.js.map +1 -0
- package/lib/cjs/EntityMap.d.ts.map +1 -1
- package/lib/cjs/EntityMap.js.map +1 -1
- package/lib/cjs/EntityUnifier.d.ts +8 -8
- package/lib/cjs/EntityUnifier.d.ts.map +1 -1
- package/lib/cjs/EntityUnifier.js +56 -32
- package/lib/cjs/EntityUnifier.js.map +1 -1
- package/lib/cjs/IModelCloneContext.d.ts +9 -3
- package/lib/cjs/IModelCloneContext.d.ts.map +1 -1
- package/lib/cjs/IModelCloneContext.js +66 -31
- package/lib/cjs/IModelCloneContext.js.map +1 -1
- package/lib/cjs/IModelExporter.d.ts +143 -30
- package/lib/cjs/IModelExporter.d.ts.map +1 -1
- package/lib/cjs/IModelExporter.js +893 -178
- package/lib/cjs/IModelExporter.js.map +1 -1
- package/lib/cjs/IModelImporter.d.ts +75 -30
- package/lib/cjs/IModelImporter.d.ts.map +1 -1
- package/lib/cjs/IModelImporter.js +292 -132
- package/lib/cjs/IModelImporter.js.map +1 -1
- package/lib/cjs/IModelTransformContext.d.ts +54 -0
- package/lib/cjs/IModelTransformContext.d.ts.map +1 -0
- package/lib/cjs/IModelTransformContext.js +3 -0
- package/lib/cjs/IModelTransformContext.js.map +1 -0
- package/lib/cjs/IModelTransformer.d.ts +130 -196
- package/lib/cjs/IModelTransformer.d.ts.map +1 -1
- package/lib/cjs/IModelTransformer.js +697 -1155
- package/lib/cjs/IModelTransformer.js.map +1 -1
- package/lib/cjs/IModelTransformerError.d.ts +84 -0
- package/lib/cjs/IModelTransformerError.d.ts.map +1 -0
- package/lib/cjs/IModelTransformerError.js +93 -0
- package/lib/cjs/IModelTransformerError.js.map +1 -0
- package/lib/cjs/ProvenanceManager.d.ts +177 -0
- package/lib/cjs/ProvenanceManager.d.ts.map +1 -0
- package/lib/cjs/ProvenanceManager.js +719 -0
- package/lib/cjs/ProvenanceManager.js.map +1 -0
- package/lib/cjs/SyncTypeResolver.d.ts +34 -0
- package/lib/cjs/SyncTypeResolver.d.ts.map +1 -0
- package/lib/cjs/SyncTypeResolver.js +98 -0
- package/lib/cjs/SyncTypeResolver.js.map +1 -0
- package/lib/cjs/TransformerLoggerCategory.d.ts +1 -1
- package/lib/cjs/TransformerLoggerCategory.js +1 -1
- package/lib/cjs/TransformerLoggerCategory.js.map +1 -1
- package/lib/cjs/TransformerPackageMetadata.d.ts +8 -0
- package/lib/cjs/TransformerPackageMetadata.d.ts.map +1 -0
- package/lib/cjs/TransformerPackageMetadata.js +47 -0
- package/lib/cjs/TransformerPackageMetadata.js.map +1 -0
- package/lib/cjs/imodel-transformer.d.ts +27 -0
- package/lib/cjs/imodel-transformer.d.ts.map +1 -1
- package/lib/cjs/imodel-transformer.js +61 -34
- package/lib/cjs/imodel-transformer.js.map +1 -1
- package/lib/cjs/schema-processing/DynamicSchemaUnionStrategy.d.ts +29 -0
- package/lib/cjs/schema-processing/DynamicSchemaUnionStrategy.d.ts.map +1 -0
- package/lib/cjs/schema-processing/DynamicSchemaUnionStrategy.js +212 -0
- package/lib/cjs/schema-processing/DynamicSchemaUnionStrategy.js.map +1 -0
- package/lib/cjs/schema-processing/SchemaProcessingCoordinator.d.ts +25 -0
- package/lib/cjs/schema-processing/SchemaProcessingCoordinator.d.ts.map +1 -0
- package/lib/cjs/schema-processing/SchemaProcessingCoordinator.js +196 -0
- package/lib/cjs/schema-processing/SchemaProcessingCoordinator.js.map +1 -0
- package/lib/cjs/schema-processing/SchemaProcessingStrategy.d.ts +59 -0
- package/lib/cjs/schema-processing/SchemaProcessingStrategy.d.ts.map +1 -0
- package/lib/cjs/schema-processing/SchemaProcessingStrategy.js +28 -0
- package/lib/cjs/schema-processing/SchemaProcessingStrategy.js.map +1 -0
- package/lib/cjs/schema-processing.d.ts +7 -0
- package/lib/cjs/schema-processing.d.ts.map +1 -0
- package/lib/cjs/schema-processing.js +27 -0
- package/lib/cjs/schema-processing.js.map +1 -0
- package/package.json +65 -43
- package/lib/cjs/DetachedExportElementAspectsStrategy.d.ts +0 -16
- package/lib/cjs/DetachedExportElementAspectsStrategy.d.ts.map +0 -1
- package/lib/cjs/DetachedExportElementAspectsStrategy.js +0 -106
- package/lib/cjs/DetachedExportElementAspectsStrategy.js.map +0 -1
- package/lib/cjs/ElementCascadingDeleter.d.ts +0 -22
- package/lib/cjs/ElementCascadingDeleter.d.ts.map +0 -1
- package/lib/cjs/ElementCascadingDeleter.js +0 -57
- package/lib/cjs/ElementCascadingDeleter.js.map +0 -1
- package/lib/cjs/ExportElementAspectsStrategy.d.ts +0 -35
- package/lib/cjs/ExportElementAspectsStrategy.d.ts.map +0 -1
- package/lib/cjs/ExportElementAspectsStrategy.js +0 -52
- package/lib/cjs/ExportElementAspectsStrategy.js.map +0 -1
- package/lib/cjs/ExportElementAspectsWithElementsStrategy.d.ts +0 -12
- package/lib/cjs/ExportElementAspectsWithElementsStrategy.d.ts.map +0 -1
- package/lib/cjs/ExportElementAspectsWithElementsStrategy.js +0 -47
- package/lib/cjs/ExportElementAspectsWithElementsStrategy.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SchemaProcessingStrategy.js","sourceRoot":"","sources":["../../../src/schema-processing/SchemaProcessingStrategy.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAqDH;;;GAGG;AACH;IAGE,8EAA8E;IACvE,KAAK,CAAC,cAAc,CACzB,OAAgC;QAEhC,MAAM,OAAO,GAA6B,EAAE,CAAC;QAC7C,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;YAC3C,IAAI,MAAM,OAAO,CAAC,kBAAkB,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;gBACvD,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;YAC3C,CAAC;QACH,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF","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 */\n\nimport { Schema, SchemaKey } from \"@itwin/ecschema-metadata\";\n\n/**\n * The result of processing one schema.\n * @beta\n */\nexport type SchemaProcessingResult =\n | { kind: \"source\"; schema: Schema }\n | { kind: \"generated\"; schema: Schema };\n\n/** Read-only access to schemas already present in the target iModel.\n * @beta\n */\nexport interface ReadonlySchemaAccessor {\n /** Load a target schema by name, or return `undefined` when it is absent. */\n getSchema(schemaName: string): Promise<Schema | undefined>;\n}\n\n/**\n * Context supplied to a [[SchemaProcessingStrategy]].\n * @beta\n */\nexport interface SchemaProcessingContext {\n /** Source schemas in dependency order. */\n readonly sourceSchemas: readonly Schema[];\n /** Read-only access to schemas already present in the target. */\n readonly targetSchemas: ReadonlySchemaAccessor;\n /** The schema-selection hook used by the default transformer path. */\n readonly shouldExportSchema: (schemaKey: SchemaKey) => Promise<boolean>;\n}\n\n/**\n * Selects source schemas and produces definitions for import into a target iModel.\n * @beta\n */\nexport interface SchemaProcessingStrategy {\n /** Select source schemas and produce definitions for import into the target iModel. */\n processSchemas(\n context: SchemaProcessingContext\n ): Promise<SchemaProcessingResult[]>;\n}\n\n/**\n * Options for [[IModelTransformer.processSchemas]].\n * @beta\n */\nexport interface ProcessSchemasOptions {\n /** Strategy used to select and process source schemas. */\n strategy?: SchemaProcessingStrategy;\n}\n\n/**\n * Selects source schemas that are absent from the target or have a newer version.\n * @beta\n */\nexport class NewerVersionSchemaImportStrategy\n implements SchemaProcessingStrategy\n{\n /** Select schemas that are absent from the target or have a newer version. */\n public async processSchemas(\n context: SchemaProcessingContext\n ): Promise<SchemaProcessingResult[]> {\n const results: SchemaProcessingResult[] = [];\n for (const schema of context.sourceSchemas) {\n if (await context.shouldExportSchema(schema.schemaKey)) {\n results.push({ kind: \"source\", schema });\n }\n }\n return results;\n }\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* Optional schema-processing strategies for `@itwin/imodel-transformer`.
|
|
3
|
+
* @module iModels
|
|
4
|
+
*/
|
|
5
|
+
export * from "./schema-processing/SchemaProcessingStrategy";
|
|
6
|
+
export * from "./schema-processing/DynamicSchemaUnionStrategy";
|
|
7
|
+
//# sourceMappingURL=schema-processing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-processing.d.ts","sourceRoot":"","sources":["../../src/schema-processing.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,cAAc,8CAA8C,CAAC;AAC7D,cAAc,gDAAgD,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
/*---------------------------------------------------------------------------------------------
|
|
18
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
19
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
20
|
+
*--------------------------------------------------------------------------------------------*/
|
|
21
|
+
/** @packageDocumentation
|
|
22
|
+
* Optional schema-processing strategies for `@itwin/imodel-transformer`.
|
|
23
|
+
* @module iModels
|
|
24
|
+
*/
|
|
25
|
+
__exportStar(require("./schema-processing/SchemaProcessingStrategy"), exports);
|
|
26
|
+
__exportStar(require("./schema-processing/DynamicSchemaUnionStrategy"), exports);
|
|
27
|
+
//# sourceMappingURL=schema-processing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-processing.js","sourceRoot":"","sources":["../../src/schema-processing.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;gGAGgG;AAChG;;;GAGG;AACH,+EAA6D;AAC7D,iFAA+D","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 * Optional schema-processing strategies for `@itwin/imodel-transformer`.\n * @module iModels\n */\nexport * from \"./schema-processing/SchemaProcessingStrategy\";\nexport * from \"./schema-processing/DynamicSchemaUnionStrategy\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,31 +1,53 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/imodel-transformer",
|
|
3
|
-
"version": "2.0.0-dev.
|
|
3
|
+
"version": "2.0.0-dev.61",
|
|
4
4
|
"description": "API for exporting an iModel's parts and also importing them into another iModel",
|
|
5
5
|
"main": "lib/cjs/imodel-transformer.js",
|
|
6
|
-
"typings": "lib/cjs/imodel-transformer",
|
|
6
|
+
"typings": "lib/cjs/imodel-transformer.d.ts",
|
|
7
|
+
"typesVersions": {
|
|
8
|
+
"*": {
|
|
9
|
+
"schema-processing": [
|
|
10
|
+
"lib/cjs/schema-processing.d.ts"
|
|
11
|
+
]
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./lib/cjs/imodel-transformer.d.ts",
|
|
17
|
+
"require": "./lib/cjs/imodel-transformer.js",
|
|
18
|
+
"default": "./lib/cjs/imodel-transformer.js"
|
|
19
|
+
},
|
|
20
|
+
"./schema-processing": {
|
|
21
|
+
"types": "./lib/cjs/schema-processing.d.ts",
|
|
22
|
+
"require": "./lib/cjs/schema-processing.js",
|
|
23
|
+
"default": "./lib/cjs/schema-processing.js"
|
|
24
|
+
},
|
|
25
|
+
"./package.json": "./package.json"
|
|
26
|
+
},
|
|
7
27
|
"license": "MIT",
|
|
8
28
|
"engines": {
|
|
9
|
-
"node": "^22.12.0"
|
|
29
|
+
"node": "^22.12.0 || ^24.18.0"
|
|
10
30
|
},
|
|
11
31
|
"scripts": {
|
|
12
|
-
"build": "npm run -s
|
|
13
|
-
"build:cjs": "tsc 1>&2 --outDir lib/cjs",
|
|
32
|
+
"build": "npm run -s typecheck && npm run -s build:cjs && npm run -s extract-api",
|
|
33
|
+
"build:cjs": "tsc -p tsconfig.build.json 1>&2 --outDir lib/cjs",
|
|
14
34
|
"clean": "rimraf lib",
|
|
15
35
|
"docs": "npm run -s docs:extract && npm run -s docs:reference && npm run -s docs:changelog",
|
|
16
|
-
"docs:changelog": "
|
|
36
|
+
"docs:changelog": "node scripts/copyChangelog.js",
|
|
17
37
|
"# env var is workaround, need to contribute a better rush-less root-package.json detector to betools": "",
|
|
18
38
|
"docs:reference": "cross-env RUSHSTACK_FILE_ERROR_BASE_FOLDER='../..' betools docs --includes=../../build/docs/extract --json=../../build/docs/reference/imodel-transformer/file.json --tsIndexFile=imodel-transformer.ts --onlyJson",
|
|
19
39
|
"docs:extract": "betools extract --fileExt=ts --extractFrom=./src/test --recursive --out=../../build/docs/extract",
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"extract-api": "betools extract-api --entry=imodel-transformer --apiReportFolder=../../common/api --apiReportTempFolder=../../common/api/temp --apiSummaryFolder=../../common/api/summary",
|
|
40
|
+
"cover": "vitest run --coverage",
|
|
41
|
+
"extract-api": "npm run -s extract-api:root && npm run -s extract-api:schema-processing",
|
|
42
|
+
"extract-api:root": "betools extract-api --entry=imodel-transformer --apiReportFolder=../../common/api --apiReportTempFolder=../../common/api/temp --apiSummaryFolder=../../common/api/summary",
|
|
43
|
+
"extract-api:schema-processing": "betools extract-api --entry=schema-processing --apiReportFolder=../../common/api --apiReportTempFolder=../../common/api/temp --apiSummaryFolder=../../common/api/summary",
|
|
23
44
|
"lint": "eslint -f visualstudio --quiet \"./src/**/*.ts\" 1>&2",
|
|
24
45
|
"lint:no-tests": "eslint -f visualstudio --quiet \"./src/*.ts\" 1>&2",
|
|
25
46
|
"lint:fix": "eslint --fix -f visualstudio --quiet \"./src/**/*.ts\" 1>&2",
|
|
26
47
|
"format": "prettier \"./src/**/*.ts\" --write",
|
|
27
48
|
"lint:with-warnings": "eslint -f visualstudio \"./src/**/*.ts\" 1>&2",
|
|
28
|
-
"test": "
|
|
49
|
+
"test": "vitest run",
|
|
50
|
+
"typecheck": "tsc -p tsconfig.json --noEmit --incremental false 1>&2",
|
|
29
51
|
"no-internal-report": "no-internal-report src/**/*.ts"
|
|
30
52
|
},
|
|
31
53
|
"repository": {
|
|
@@ -49,59 +71,59 @@
|
|
|
49
71
|
"This package relies on @internal APIs in iTwin.js, and therefore has very strict peerDep versions",
|
|
50
72
|
"We perform a version check at runtime to ensure this.",
|
|
51
73
|
"Every new iTwin.js version must be validated, and fixes are rarely ported to old versions.",
|
|
52
|
-
"Removing Dependencies on internal APIs is ongoing."
|
|
53
|
-
"You can find a script to see the latest @itwin/imodel-transformer version for your iTwin.js version in the README"
|
|
74
|
+
"Removing Dependencies on internal APIs is ongoing."
|
|
54
75
|
],
|
|
55
76
|
"peerDependencies": {
|
|
56
|
-
"@itwin/core-backend": "^5.
|
|
57
|
-
"@itwin/core-bentley": "^5.
|
|
58
|
-
"@itwin/core-common": "^5.
|
|
59
|
-
"@itwin/core-geometry": "^5.
|
|
60
|
-
"@itwin/core-quantity": "^5.
|
|
61
|
-
"@itwin/ecschema-
|
|
77
|
+
"@itwin/core-backend": "^5.13.0",
|
|
78
|
+
"@itwin/core-bentley": "^5.13.0",
|
|
79
|
+
"@itwin/core-common": "^5.13.0",
|
|
80
|
+
"@itwin/core-geometry": "^5.13.0",
|
|
81
|
+
"@itwin/core-quantity": "^5.13.0",
|
|
82
|
+
"@itwin/ecschema-editing": "^5.13.0",
|
|
83
|
+
"@itwin/ecschema-locaters": "^5.13.0",
|
|
84
|
+
"@itwin/ecschema-metadata": "^5.13.0"
|
|
85
|
+
},
|
|
86
|
+
"peerDependenciesMeta": {
|
|
87
|
+
"@itwin/ecschema-editing": {
|
|
88
|
+
"optional": true
|
|
89
|
+
},
|
|
90
|
+
"@itwin/ecschema-locaters": {
|
|
91
|
+
"optional": true
|
|
92
|
+
}
|
|
62
93
|
},
|
|
63
94
|
"//devDependencies": [
|
|
64
95
|
"NOTE: All peerDependencies should also be listed as devDependencies since peerDependencies are not considered by npm install",
|
|
65
96
|
"NOTE: All tools used by scripts in this package must be listed as devDependencies"
|
|
66
97
|
],
|
|
67
98
|
"devDependencies": {
|
|
68
|
-
"@itwin/build-tools": "^5.
|
|
69
|
-
"@itwin/core-backend": "^5.
|
|
70
|
-
"@itwin/core-bentley": "^5.
|
|
71
|
-
"@itwin/core-common": "^5.
|
|
72
|
-
"@itwin/core-geometry": "^5.
|
|
73
|
-
"@itwin/core-quantity": "^5.
|
|
74
|
-
"@itwin/ecschema-
|
|
75
|
-
"@itwin/ecschema-
|
|
76
|
-
"@itwin/
|
|
77
|
-
"@
|
|
78
|
-
"@
|
|
79
|
-
"@types/mocha": "^8.2.3",
|
|
99
|
+
"@itwin/build-tools": "^5.13.0",
|
|
100
|
+
"@itwin/core-backend": "^5.13.0",
|
|
101
|
+
"@itwin/core-bentley": "^5.13.0",
|
|
102
|
+
"@itwin/core-common": "^5.13.0",
|
|
103
|
+
"@itwin/core-geometry": "^5.13.0",
|
|
104
|
+
"@itwin/core-quantity": "^5.13.0",
|
|
105
|
+
"@itwin/ecschema-editing": "5.13.0",
|
|
106
|
+
"@itwin/ecschema-locaters": "5.13.0",
|
|
107
|
+
"@itwin/ecschema-metadata": "^5.13.0",
|
|
108
|
+
"@itwin/eslint-plugin": "^6.1.0",
|
|
109
|
+
"@itwin/imodel-transformer-test-utils": "0.0.0",
|
|
80
110
|
"@types/node": "^22.18.8",
|
|
81
111
|
"@types/node-fetch": "^2.6.13",
|
|
82
112
|
"@types/semver": "^7.7.1",
|
|
83
|
-
"@
|
|
84
|
-
"@
|
|
85
|
-
"chai": "^4.5.0",
|
|
86
|
-
"chai-as-promised": "^7.1.2",
|
|
87
|
-
"cpx2": "^3.0.2",
|
|
113
|
+
"@typescript-eslint/parser": "^8.64.0",
|
|
114
|
+
"@vitest/coverage-v8": "4.1.10",
|
|
88
115
|
"cross-env": "^5.2.1",
|
|
89
116
|
"eslint": "^9.36.0",
|
|
90
117
|
"eslint-config-prettier": "^9.1.2",
|
|
91
118
|
"js-base64": "^3.7.8",
|
|
92
|
-
"mocha": "^10.8.2",
|
|
93
119
|
"npm-run-all": "^4.1.5",
|
|
94
|
-
"nyc": "^15.1.0",
|
|
95
120
|
"prettier": "^3.6.2",
|
|
96
121
|
"rimraf": "^3.0.2",
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
"
|
|
122
|
+
"@typescript/native": "npm:typescript@~7.0.2",
|
|
123
|
+
"typescript": "npm:@typescript/typescript6@~6.0.2",
|
|
124
|
+
"vitest": "4.1.10"
|
|
100
125
|
},
|
|
101
126
|
"dependencies": {
|
|
102
127
|
"semver": "^7.7.2"
|
|
103
|
-
},
|
|
104
|
-
"nyc": {
|
|
105
|
-
"extends": "./node_modules/@itwin/build-tools/.nycrc"
|
|
106
128
|
}
|
|
107
129
|
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { ExportElementAspectsStrategy } from "./ExportElementAspectsStrategy";
|
|
2
|
-
/**
|
|
3
|
-
* Detached ElementAspect export strategy for [[IModelExporter]].
|
|
4
|
-
* This strategy exports all ElementAspects separately from the Elements that own them.
|
|
5
|
-
*
|
|
6
|
-
* @note Since aspects are exported separately from elements that own them, this strategy will export aspects of filtered out elements by default and
|
|
7
|
-
* this needs to be handled by ElementAspectHandler
|
|
8
|
-
* @internal
|
|
9
|
-
*/
|
|
10
|
-
export declare class DetachedExportElementAspectsStrategy extends ExportElementAspectsStrategy {
|
|
11
|
-
exportAllElementAspects(): Promise<void>;
|
|
12
|
-
private exportAspectsLoop;
|
|
13
|
-
private queryAspects;
|
|
14
|
-
exportElementAspectsForElement(_elementId: string): Promise<void>;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=DetachedExportElementAspectsStrategy.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DetachedExportElementAspectsStrategy.d.ts","sourceRoot":"","sources":["../../src/DetachedExportElementAspectsStrategy.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAQ9E;;;;;;;GAOG;AACH,qBAAa,oCAAqC,SAAQ,4BAA4B;IAC9D,uBAAuB,IAAI,OAAO,CAAC,IAAI,CAAC;YAmDhD,iBAAiB;YAahB,YAAY;IA8DL,8BAA8B,CAClD,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC;CAGjB"}
|
|
@@ -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
|
-
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":"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","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 this.handler.onExportElementUniqueAspect(uniqueAspect, isKnownUpdate);\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,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"}
|