@itwin/imodel-transformer 2.0.0-dev.7 → 2.0.0-dev.71
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.d.ts +0 -4
- package/lib/cjs/Algo.d.ts.map +1 -1
- package/lib/cjs/Algo.js +0 -11
- 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 +26 -26
- 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 +141 -0
- package/lib/cjs/ChangesetScanner.d.ts.map +1 -0
- package/lib/cjs/ChangesetScanner.js +187 -0
- package/lib/cjs/ChangesetScanner.js.map +1 -0
- package/lib/cjs/ECReferenceTypesCache.d.ts +0 -4
- package/lib/cjs/ECReferenceTypesCache.d.ts.map +1 -1
- package/lib/cjs/ECReferenceTypesCache.js +61 -111
- 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/EntityUnifier.d.ts +7 -7
- package/lib/cjs/EntityUnifier.d.ts.map +1 -1
- package/lib/cjs/EntityUnifier.js +55 -24
- 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 +56 -22
- package/lib/cjs/IModelCloneContext.js.map +1 -1
- package/lib/cjs/IModelExporter.d.ts +180 -43
- package/lib/cjs/IModelExporter.d.ts.map +1 -1
- package/lib/cjs/IModelExporter.js +946 -247
- 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 +184 -206
- package/lib/cjs/IModelTransformer.d.ts.map +1 -1
- package/lib/cjs/IModelTransformer.js +819 -1278
- 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/SourceClassKinds.d.ts +22 -0
- package/lib/cjs/SourceClassKinds.d.ts.map +1 -0
- package/lib/cjs/SourceClassKinds.js +60 -0
- package/lib/cjs/SourceClassKinds.js.map +1 -0
- package/lib/cjs/SyncTypeResolver.d.ts +32 -0
- package/lib/cjs/SyncTypeResolver.d.ts.map +1 -0
- package/lib/cjs/SyncTypeResolver.js +92 -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 +28 -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 +70 -57
- 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/EntityMap.d.ts +0 -26
- package/lib/cjs/EntityMap.d.ts.map +0 -1
- package/lib/cjs/EntityMap.js +0 -54
- package/lib/cjs/EntityMap.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
|
@@ -10,9 +10,31 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
11
|
o[k2] = m[k];
|
|
12
12
|
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
13
18
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
19
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
20
|
};
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
16
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
39
|
/*---------------------------------------------------------------------------------------------
|
|
18
40
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
@@ -22,16 +44,18 @@ __exportStar(require("./TransformerLoggerCategory"), exports);
|
|
|
22
44
|
__exportStar(require("./IModelExporter"), exports);
|
|
23
45
|
__exportStar(require("./IModelImporter"), exports);
|
|
24
46
|
__exportStar(require("./IModelTransformer"), exports);
|
|
47
|
+
__exportStar(require("./IModelTransformContext"), exports);
|
|
48
|
+
__exportStar(require("./schema-processing/SchemaProcessingStrategy"), exports);
|
|
49
|
+
__exportStar(require("./IModelTransformerError"), exports);
|
|
25
50
|
__exportStar(require("./BranchProvenanceInitializer"), exports);
|
|
26
|
-
const semver = require("semver");
|
|
51
|
+
const semver = __importStar(require("semver"));
|
|
52
|
+
const core_bentley_1 = require("@itwin/core-bentley");
|
|
27
53
|
const package_json_1 = require("@itwin/core-backend/package.json");
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
} = require("../../package.json");
|
|
54
|
+
const IModelTransformerError_1 = require("./IModelTransformerError");
|
|
55
|
+
const TransformerPackageMetadata_1 = require("./TransformerPackageMetadata");
|
|
56
|
+
const { version: ourVersion, name: ourName, peerDependencies, } = TransformerPackageMetadata_1.transformerPackageMetadata;
|
|
32
57
|
const ourITwinCoreBackendDepRange = peerDependencies["@itwin/core-backend"];
|
|
33
58
|
const noStrictDepCheckEnvVar = "TRANSFORMER_NO_STRICT_DEP_CHECK";
|
|
34
|
-
const suggestEnvVarName = "SUGGEST_TRANSFORMER_VERSIONS";
|
|
35
59
|
// warn if using a prerelease or dev version
|
|
36
60
|
if (semver.prerelease(package_json_1.version)) {
|
|
37
61
|
// eslint-disable-next-line no-console
|
|
@@ -46,34 +70,13 @@ if (process.env[noStrictDepCheckEnvVar] !== "1" &&
|
|
|
46
70
|
const errHeader = `${ourName}@${ourVersion} only supports @itwin/core-backend@${ourITwinCoreBackendDepRange}, ` +
|
|
47
71
|
`but @itwin/core-backend${package_json_1.version} was resolved when looking for the peer dependency.\n` +
|
|
48
72
|
`If you know exactly what you are doing, you can disable this check by setting ${noStrictDepCheckEnvVar}=1 in the environment\n`;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
.setEncoding("utf8")
|
|
57
|
-
.on("data", (d) => chunks.push(d))
|
|
58
|
-
.on("end", () => r(chunks.join(""))));
|
|
59
|
-
const packumentJson = JSON.parse(packumentSrc);
|
|
60
|
-
const isTaglessVersion = (version) => version.includes("-");
|
|
61
|
-
const latestFirstApplicableVersions = Object.entries(packumentJson.versions)
|
|
62
|
-
.filter(([, v]) => semver.satisfies(package_json_1.version, v.peerDependencies?.["@itwin/core-backend"] ?? ""))
|
|
63
|
-
.map(([k]) => k)
|
|
64
|
-
.filter(isTaglessVersion)
|
|
65
|
-
.reverse();
|
|
66
|
-
throw Error([
|
|
67
|
-
errHeader,
|
|
68
|
-
`You have ${suggestEnvVarName}=1 set in the environment, so we suggest one of the following versions.`,
|
|
69
|
-
"Be aware that older versions may be missing bug fixes.",
|
|
70
|
-
...latestFirstApplicableVersions,
|
|
71
|
-
].join("\n"));
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
throw Error(`${errHeader}You can rerun with the environment variable ${suggestEnvVarName}=1 to have this error suggest a version`);
|
|
76
|
-
}
|
|
73
|
+
core_bentley_1.ITwinError.throwError({
|
|
74
|
+
iTwinErrorId: {
|
|
75
|
+
scope: IModelTransformerError_1.IModelTransformerErrorScope,
|
|
76
|
+
key: IModelTransformerError_1.IModelTransformerError.DependencyVersionMismatch,
|
|
77
|
+
},
|
|
78
|
+
message: errHeader,
|
|
79
|
+
});
|
|
77
80
|
}
|
|
78
81
|
/** @docs-package-description
|
|
79
82
|
* The @itwin/imodel-transformer package contains classes that [backend code]($docs/learning/backend/index.md) can use to
|
|
@@ -95,4 +98,28 @@ if (process.env[noStrictDepCheckEnvVar] !== "1" &&
|
|
|
95
98
|
* @docs-group-description Logging
|
|
96
99
|
* Logger categories used by this package.
|
|
97
100
|
*/
|
|
101
|
+
/**
|
|
102
|
+
* @docs-group-description ChangedElementForest
|
|
103
|
+
* Internal indexing of changed elements and their ancestors for incremental export traversal.
|
|
104
|
+
*/
|
|
105
|
+
/**
|
|
106
|
+
* @docs-group-description ElementAspectExportCoordinator
|
|
107
|
+
* Internal coordination for scoped, owner-batched ElementAspect export.
|
|
108
|
+
*/
|
|
109
|
+
/**
|
|
110
|
+
* @docs-group-description ElementAspectExportProcessor
|
|
111
|
+
* Internal source queries, filtering, and export callbacks for ElementAspects owned by accepted elements.
|
|
112
|
+
*/
|
|
113
|
+
/**
|
|
114
|
+
* @docs-group-description ChangedElementForest
|
|
115
|
+
* Internal index of changed elements and their ancestors for incremental traversal.
|
|
116
|
+
*/
|
|
117
|
+
/**
|
|
118
|
+
* @docs-group-description IModelTransformerError
|
|
119
|
+
* Stable identifiers for errors originating from this package.
|
|
120
|
+
*/
|
|
121
|
+
/**
|
|
122
|
+
* @docs-group-description TransformerPackageMetadata
|
|
123
|
+
* Internal metadata describing this package and its peer dependencies.
|
|
124
|
+
*/
|
|
98
125
|
//# sourceMappingURL=imodel-transformer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imodel-transformer.js","sourceRoot":"","sources":["../../src/imodel-transformer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"imodel-transformer.js","sourceRoot":"","sources":["../../src/imodel-transformer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;gGAGgG;AAChG,8DAA4C;AAC5C,mDAAiC;AACjC,mDAAiC;AACjC,sDAAoC;AACpC,2DAAyC;AACzC,+EAA6D;AAC7D,2DAAyC;AACzC,gEAA8C;AAW9C,MAAY,MAAM,mCAAe;AACjC,sDAAiD;AACjD,mEAAsF;AACtF,qEAGkC;AAClC,6EAA0E;AAE1E,MAAM,EACJ,OAAO,EAAE,UAAU,EACnB,IAAI,EAAE,OAAO,EACb,gBAAgB,GACjB,GAAG,uDAA0B,CAAC;AAE/B,MAAM,2BAA2B,GAAG,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;AAE5E,MAAM,sBAAsB,GAAG,iCAAiC,CAAC;AAEjE,4CAA4C;AAC5C,IAAI,MAAM,CAAC,UAAU,CAAC,sBAAuB,CAAC,EAAE,CAAC;IAC/C,sCAAsC;IACtC,OAAO,CAAC,IAAI,CACV,kCAAkC,sBAAuB,KAAK;QAC5D,uFAAuF;QACvF,+FAA+F,CAClG,CAAC;AACJ,CAAC;AAED,IACE,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,KAAK,GAAG;IAC3C,CAAC,MAAM,CAAC,SAAS,CAAC,sBAAuB,EAAE,2BAA2B,EAAE;QACtE,iBAAiB,EAAE,IAAI;KACxB,CAAC,EACF,CAAC;IACD,MAAM,SAAS,GACb,GAAG,OAAO,IAAI,UAAU,sCAAsC,2BAA2B,IAAI;QAC7F,0BAA0B,sBAAuB,uDAAuD;QACxG,iFAAiF,sBAAsB,yBAAyB,CAAC;IAEnI,yBAAU,CAAC,UAAU,CAAC;QACpB,YAAY,EAAE;YACZ,KAAK,EAAE,oDAA2B;YAClC,GAAG,EAAE,+CAAsB,CAAC,yBAAyB;SACtD;QACD,OAAO,EAAE,SAAS;KACnB,CAAC,CAAC;AACL,CAAC;AAED;;;;;;GAMG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG","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 *--------------------------------------------------------------------------------------------*/\nexport * from \"./TransformerLoggerCategory\";\nexport * from \"./IModelExporter\";\nexport * from \"./IModelImporter\";\nexport * from \"./IModelTransformer\";\nexport * from \"./IModelTransformContext\";\nexport * from \"./schema-processing/SchemaProcessingStrategy\";\nexport * from \"./IModelTransformerError\";\nexport * from \"./BranchProvenanceInitializer\";\nexport type {\n CollectedChanges,\n DeletionBatch,\n DeletionRecordBase,\n ElementDeletionRecord,\n ExternalSourceAspectDeletionRecord,\n ModelDeletionRecord,\n RelationshipDeletionRecord,\n} from \"./ChangesetScanner\";\n\nimport * as semver from \"semver\";\nimport { ITwinError } from \"@itwin/core-bentley\";\nimport { version as iTwinCoreBackendVersion } from \"@itwin/core-backend/package.json\";\nimport {\n IModelTransformerError,\n IModelTransformerErrorScope,\n} from \"./IModelTransformerError\";\nimport { transformerPackageMetadata } from \"./TransformerPackageMetadata\";\n\nconst {\n version: ourVersion,\n name: ourName,\n peerDependencies,\n} = transformerPackageMetadata;\n\nconst ourITwinCoreBackendDepRange = peerDependencies[\"@itwin/core-backend\"];\n\nconst noStrictDepCheckEnvVar = \"TRANSFORMER_NO_STRICT_DEP_CHECK\";\n\n// warn if using a prerelease or dev version\nif (semver.prerelease(iTwinCoreBackendVersion)) {\n // eslint-disable-next-line no-console\n console.warn(\n `Warning: dev version detected (${iTwinCoreBackendVersion}). ` +\n \"This version is most likely fine, but it may introduce new behavior that could cause \" +\n \"unexpected issues or changes in the transformer's functionality. Please proceed with caution.\"\n );\n}\n\nif (\n process.env[noStrictDepCheckEnvVar] !== \"1\" &&\n !semver.satisfies(iTwinCoreBackendVersion, ourITwinCoreBackendDepRange, {\n includePrerelease: true,\n })\n) {\n const errHeader =\n `${ourName}@${ourVersion} only supports @itwin/core-backend@${ourITwinCoreBackendDepRange}, ` +\n `but @itwin/core-backend${iTwinCoreBackendVersion} was resolved when looking for the peer dependency.\\n` +\n `If you know exactly what you are doing, you can disable this check by setting ${noStrictDepCheckEnvVar}=1 in the environment\\n`;\n\n ITwinError.throwError({\n iTwinErrorId: {\n scope: IModelTransformerErrorScope,\n key: IModelTransformerError.DependencyVersionMismatch,\n },\n message: errHeader,\n });\n}\n\n/** @docs-package-description\n * The @itwin/imodel-transformer package contains classes that [backend code]($docs/learning/backend/index.md) can use to\n * traverse iModels, as well as *transform* an iModel into another existing or empty one, by exporting elements from one during\n * traversal and importing them into another.\n *\n * You can read further in [iModelTransformation and Data Exchange]($docs/learning/transformer/index.md) here.\n */\n/**\n * @docs-group-description iModels\n * Classes for working with [iModels]($docs/learning/iModels.md).\n * See [the learning article]($docs/learning/backend/index.md).\n */\n/**\n * @docs-group-description Utils\n * Miscellaneous utility classes.\n */\n/**\n * @docs-group-description Logging\n * Logger categories used by this package.\n */\n/**\n * @docs-group-description ChangedElementForest\n * Internal indexing of changed elements and their ancestors for incremental export traversal.\n */\n/**\n * @docs-group-description ElementAspectExportCoordinator\n * Internal coordination for scoped, owner-batched ElementAspect export.\n */\n/**\n * @docs-group-description ElementAspectExportProcessor\n * Internal source queries, filtering, and export callbacks for ElementAspects owned by accepted elements.\n */\n/**\n * @docs-group-description ChangedElementForest\n * Internal index of changed elements and their ancestors for incremental traversal.\n */\n/**\n * @docs-group-description IModelTransformerError\n * Stable identifiers for errors originating from this package.\n */\n/**\n * @docs-group-description TransformerPackageMetadata\n * Internal metadata describing this package and its peer dependencies.\n */\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module iModels
|
|
3
|
+
*/
|
|
4
|
+
import { SchemaDifferenceResult } from "@itwin/ecschema-editing";
|
|
5
|
+
import { Schema } from "@itwin/ecschema-metadata";
|
|
6
|
+
import { SchemaProcessingContext, SchemaProcessingResult, SchemaProcessingStrategy } from "./SchemaProcessingStrategy";
|
|
7
|
+
/**
|
|
8
|
+
* Processes ordinary schemas with newer-version selection and unions compatible
|
|
9
|
+
* differences for existing dynamic schemas. Dynamic schema root read and write
|
|
10
|
+
* versions must match; only the minor version may differ.
|
|
11
|
+
* @beta
|
|
12
|
+
*/
|
|
13
|
+
export declare class DynamicSchemaUnionStrategy implements SchemaProcessingStrategy {
|
|
14
|
+
/**
|
|
15
|
+
* Transform schema differences before conflict validation and merging.
|
|
16
|
+
* A subclass that changes the differencing result is responsible for ensuring
|
|
17
|
+
* that its changes are safe for the source and target schemas.
|
|
18
|
+
* @param sourceSchema The source schema being processed.
|
|
19
|
+
* @param targetSchema The existing target schema.
|
|
20
|
+
* @param differences The complete result from [[getSchemaDifferences]].
|
|
21
|
+
* @returns The differencing result to validate and merge.
|
|
22
|
+
* @beta
|
|
23
|
+
*/
|
|
24
|
+
protected onSchemaDifferences(_sourceSchema: Schema, _targetSchema: Schema, differences: SchemaDifferenceResult): Promise<SchemaDifferenceResult>;
|
|
25
|
+
/** Select ordinary schemas and union compatible dynamic schema differences. */
|
|
26
|
+
processSchemas(context: SchemaProcessingContext): Promise<SchemaProcessingResult[]>;
|
|
27
|
+
private createPlan;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=DynamicSchemaUnionStrategy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DynamicSchemaUnionStrategy.d.ts","sourceRoot":"","sources":["../../../src/schema-processing/DynamicSchemaUnionStrategy.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAKL,sBAAsB,EAEvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEL,MAAM,EAGP,MAAM,0BAA0B,CAAC;AAKlC,OAAO,EAEL,uBAAuB,EACvB,sBAAsB,EACtB,wBAAwB,EACzB,MAAM,4BAA4B,CAAC;AAsBpC;;;;;GAKG;AACH,qBAAa,0BAA2B,YAAW,wBAAwB;IACzE;;;;;;;;;OASG;IACH,UAAgB,mBAAmB,CACjC,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,sBAAsB,GAClC,OAAO,CAAC,sBAAsB,CAAC,CAEjC;IAED,+EAA+E;IAClE,cAAc,CACzB,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,sBAAsB,EAAE,CAAC,CA2EnC;YAEa,UAAU;CAwDzB"}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module iModels
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.DynamicSchemaUnionStrategy = void 0;
|
|
11
|
+
const core_bentley_1 = require("@itwin/core-bentley");
|
|
12
|
+
const ecschema_editing_1 = require("@itwin/ecschema-editing");
|
|
13
|
+
const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
|
|
14
|
+
const IModelTransformerError_1 = require("../IModelTransformerError");
|
|
15
|
+
/**
|
|
16
|
+
* Processes ordinary schemas with newer-version selection and unions compatible
|
|
17
|
+
* differences for existing dynamic schemas. Dynamic schema root read and write
|
|
18
|
+
* versions must match; only the minor version may differ.
|
|
19
|
+
* @beta
|
|
20
|
+
*/
|
|
21
|
+
class DynamicSchemaUnionStrategy {
|
|
22
|
+
/**
|
|
23
|
+
* Transform schema differences before conflict validation and merging.
|
|
24
|
+
* A subclass that changes the differencing result is responsible for ensuring
|
|
25
|
+
* that its changes are safe for the source and target schemas.
|
|
26
|
+
* @param sourceSchema The source schema being processed.
|
|
27
|
+
* @param targetSchema The existing target schema.
|
|
28
|
+
* @param differences The complete result from [[getSchemaDifferences]].
|
|
29
|
+
* @returns The differencing result to validate and merge.
|
|
30
|
+
* @beta
|
|
31
|
+
*/
|
|
32
|
+
async onSchemaDifferences(_sourceSchema, _targetSchema, differences) {
|
|
33
|
+
return differences;
|
|
34
|
+
}
|
|
35
|
+
/** Select ordinary schemas and union compatible dynamic schema differences. */
|
|
36
|
+
async processSchemas(context) {
|
|
37
|
+
const plans = [];
|
|
38
|
+
const conflicts = [];
|
|
39
|
+
for (const sourceSchema of context.sourceSchemas) {
|
|
40
|
+
try {
|
|
41
|
+
plans.push(await this.createPlan(sourceSchema, context.targetSchemas));
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
if (core_bentley_1.ITwinError.isError(error, IModelTransformerError_1.IModelTransformerErrorScope, IModelTransformerError_1.IModelTransformerError.SchemaConflict)) {
|
|
45
|
+
conflicts.push(error);
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
throw error;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
throwSchemaConflicts(conflicts);
|
|
52
|
+
const schemaEditingContext = new ecschema_metadata_1.SchemaContext();
|
|
53
|
+
const schemaCandidates = new Map();
|
|
54
|
+
for (const plan of plans) {
|
|
55
|
+
if (plan.kind === "dynamic-merge") {
|
|
56
|
+
collectSchemaCandidates(plan.target, schemaCandidates, true);
|
|
57
|
+
collectSchemaReferences(plan.source, schemaCandidates);
|
|
58
|
+
}
|
|
59
|
+
else if (plan.kind === "dynamic-noop") {
|
|
60
|
+
collectSchemaCandidates(plan.source, schemaCandidates, false);
|
|
61
|
+
collectSchemaReferences(plan.source, schemaCandidates);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
for (const { schema } of schemaCandidates.values()) {
|
|
65
|
+
await schemaEditingContext.addSchema(schema);
|
|
66
|
+
}
|
|
67
|
+
const schemaMerger = new ecschema_editing_1.SchemaMerger(schemaEditingContext);
|
|
68
|
+
const results = [];
|
|
69
|
+
for (const plan of plans) {
|
|
70
|
+
switch (plan.kind) {
|
|
71
|
+
case "new":
|
|
72
|
+
if (plan.source.isDynamic ||
|
|
73
|
+
(await context.shouldExportSchema(plan.source.schemaKey))) {
|
|
74
|
+
results.push({ kind: "source", schema: plan.source });
|
|
75
|
+
}
|
|
76
|
+
break;
|
|
77
|
+
case "ordinary":
|
|
78
|
+
if (await context.shouldExportSchema(plan.source.schemaKey)) {
|
|
79
|
+
results.push({ kind: "source", schema: plan.source });
|
|
80
|
+
}
|
|
81
|
+
break;
|
|
82
|
+
case "dynamic-noop":
|
|
83
|
+
break;
|
|
84
|
+
case "dynamic-merge": {
|
|
85
|
+
const mergedSchema = await schemaMerger.merge({
|
|
86
|
+
...plan.differences,
|
|
87
|
+
conflicts: undefined,
|
|
88
|
+
});
|
|
89
|
+
const sourceVersion = plan.source.schemaKey.version;
|
|
90
|
+
mergedSchema.setVersion(sourceVersion.read, sourceVersion.write, incrementMinorVersion(sourceVersion, plan.target.schemaKey.version));
|
|
91
|
+
results.push({ kind: "generated", schema: mergedSchema });
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
appendRequiredNoOpSchemas(results, plans);
|
|
97
|
+
return results;
|
|
98
|
+
}
|
|
99
|
+
async createPlan(source, targetSchemas) {
|
|
100
|
+
const target = await targetSchemas.getSchema(source.name);
|
|
101
|
+
if (target === undefined)
|
|
102
|
+
return { kind: "new", source };
|
|
103
|
+
if (source.isDynamic !== target.isDynamic) {
|
|
104
|
+
throw createSchemaConflictError(source, "Schema DynamicSchema marker changed", new Error("The source and target DynamicSchema markers differ."));
|
|
105
|
+
}
|
|
106
|
+
if (!source.isDynamic)
|
|
107
|
+
return { kind: "ordinary", source, target };
|
|
108
|
+
const sourceVersion = source.schemaKey.version;
|
|
109
|
+
const targetVersion = target.schemaKey.version;
|
|
110
|
+
if (sourceVersion.read !== targetVersion.read ||
|
|
111
|
+
sourceVersion.write !== targetVersion.write) {
|
|
112
|
+
throw createSchemaConflictError(source, "Dynamic schema has incompatible root versions", new Error(`source ${sourceVersion.toString(false)}, target ${targetVersion.toString(false)}`));
|
|
113
|
+
}
|
|
114
|
+
const differences = await this.onSchemaDifferences(source, target, await (0, ecschema_editing_1.getSchemaDifferences)(target, source));
|
|
115
|
+
const unresolvedConflicts = (differences.conflicts ?? []).filter((conflict) => !isCompatibleReferenceVersionConflict(conflict));
|
|
116
|
+
if (unresolvedConflicts.length > 0) {
|
|
117
|
+
throw createSchemaConflictError(source, "Schema conflict", new ecschema_editing_1.SchemaConflictsError(`Schema '${source.name}' has unresolved conflicts`, unresolvedConflicts, source.schemaKey, target.schemaKey));
|
|
118
|
+
}
|
|
119
|
+
return differences.differences.length === 0
|
|
120
|
+
? { kind: "dynamic-noop", source, target }
|
|
121
|
+
: { kind: "dynamic-merge", source, target, differences };
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
exports.DynamicSchemaUnionStrategy = DynamicSchemaUnionStrategy;
|
|
125
|
+
function createSchemaConflictError(schema, operation, cause) {
|
|
126
|
+
return core_bentley_1.ITwinError.create({
|
|
127
|
+
message: `${operation} for '${schema.schemaKey.toString(false)}': ${cause.message}`,
|
|
128
|
+
iTwinErrorId: {
|
|
129
|
+
scope: IModelTransformerError_1.IModelTransformerErrorScope,
|
|
130
|
+
key: IModelTransformerError_1.IModelTransformerError.SchemaConflict,
|
|
131
|
+
},
|
|
132
|
+
cause,
|
|
133
|
+
schemaKey: schema.schemaKey.toString(false),
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
function throwSchemaConflicts(conflicts) {
|
|
137
|
+
if (conflicts.length === 1)
|
|
138
|
+
throw conflicts[0];
|
|
139
|
+
if (conflicts.length > 1)
|
|
140
|
+
throw new AggregateError(conflicts, "Schema processing failed");
|
|
141
|
+
}
|
|
142
|
+
function appendRequiredNoOpSchemas(results, plans) {
|
|
143
|
+
const noOpSchemas = new Map(plans
|
|
144
|
+
.filter((plan) => plan.kind === "dynamic-noop")
|
|
145
|
+
.map((plan) => [plan.source.name.toLowerCase(), plan.source]));
|
|
146
|
+
const requiredNoOpSchemas = new Set();
|
|
147
|
+
const schemasToVisit = results.map((result) => result.schema);
|
|
148
|
+
for (const schema of schemasToVisit) {
|
|
149
|
+
for (const reference of schema.references) {
|
|
150
|
+
const schemaName = reference.name.toLowerCase();
|
|
151
|
+
const noOpSchema = noOpSchemas.get(schemaName);
|
|
152
|
+
if (noOpSchema === undefined || requiredNoOpSchemas.has(schemaName))
|
|
153
|
+
continue;
|
|
154
|
+
requiredNoOpSchemas.add(schemaName);
|
|
155
|
+
schemasToVisit.push(noOpSchema);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
for (const schemaName of requiredNoOpSchemas) {
|
|
159
|
+
const schema = noOpSchemas.get(schemaName);
|
|
160
|
+
if (schema !== undefined)
|
|
161
|
+
results.push({ kind: "source", schema });
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
function incrementMinorVersion(sourceVersion, targetVersion) {
|
|
165
|
+
const maximumVersion = sourceVersion.compare(targetVersion) >= 0 ? sourceVersion : targetVersion;
|
|
166
|
+
if (maximumVersion.minor >= 9_999_999) {
|
|
167
|
+
throw new Error(`Cannot increment schema version ${maximumVersion.toString(false)}`);
|
|
168
|
+
}
|
|
169
|
+
return maximumVersion.minor + 1;
|
|
170
|
+
}
|
|
171
|
+
function isCompatibleReferenceVersionConflict(conflict) {
|
|
172
|
+
if (conflict.code !== ecschema_editing_1.ConflictCode.ConflictingReferenceVersion)
|
|
173
|
+
return false;
|
|
174
|
+
if (typeof conflict.source !== "string" ||
|
|
175
|
+
typeof conflict.target !== "string")
|
|
176
|
+
return false;
|
|
177
|
+
const sourceVersion = ecschema_metadata_1.SchemaKey.parseString(conflict.source).version;
|
|
178
|
+
const targetVersion = ecschema_metadata_1.SchemaKey.parseString(conflict.target).version;
|
|
179
|
+
return (sourceVersion.read === targetVersion.read &&
|
|
180
|
+
sourceVersion.write === targetVersion.write);
|
|
181
|
+
}
|
|
182
|
+
function collectSchemaCandidates(schema, candidates, isTargetRoot, visited = new Set()) {
|
|
183
|
+
const traversalKey = schema.schemaKey.toString();
|
|
184
|
+
if (visited.has(traversalKey))
|
|
185
|
+
return;
|
|
186
|
+
visited.add(traversalKey);
|
|
187
|
+
const schemaName = schema.name.toLowerCase();
|
|
188
|
+
const existing = candidates.get(schemaName);
|
|
189
|
+
if (existing === undefined) {
|
|
190
|
+
candidates.set(schemaName, { schema, isTargetRoot });
|
|
191
|
+
}
|
|
192
|
+
else if (existing.schema.schemaKey.version.read !== schema.schemaKey.version.read ||
|
|
193
|
+
existing.schema.schemaKey.version.write !== schema.schemaKey.version.write) {
|
|
194
|
+
throw createSchemaConflictError(schema, "Schema reference has incompatible read/write versions", new Error(`${existing.schema.schemaKey.version.read}.${existing.schema.schemaKey.version.write} ` +
|
|
195
|
+
`and ${schema.schemaKey.version.read}.${schema.schemaKey.version.write} differ. ` +
|
|
196
|
+
"Only minor-version reference differences are supported."));
|
|
197
|
+
}
|
|
198
|
+
else if (isTargetRoot ||
|
|
199
|
+
(!existing.isTargetRoot &&
|
|
200
|
+
schema.schemaKey.version.compare(existing.schema.schemaKey.version) > 0)) {
|
|
201
|
+
candidates.set(schemaName, { schema, isTargetRoot });
|
|
202
|
+
}
|
|
203
|
+
for (const reference of schema.references) {
|
|
204
|
+
collectSchemaCandidates(reference, candidates, false, visited);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
function collectSchemaReferences(schema, candidates) {
|
|
208
|
+
for (const reference of schema.references) {
|
|
209
|
+
collectSchemaCandidates(reference, candidates, false);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
//# sourceMappingURL=DynamicSchemaUnionStrategy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DynamicSchemaUnionStrategy.js","sourceRoot":"","sources":["../../../src/schema-processing/DynamicSchemaUnionStrategy.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,sDAAiD;AACjD,8DAOiC;AACjC,gEAKkC;AAClC,sEAGmC;AA4BnC;;;;;GAKG;AACH;IACE;;;;;;;;;OASG;IACO,KAAK,CAAC,mBAAmB,CACjC,aAAqB,EACrB,aAAqB,EACrB,WAAmC;QAEnC,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,+EAA+E;IACxE,KAAK,CAAC,cAAc,CACzB,OAAgC;QAEhC,MAAM,KAAK,GAAiB,EAAE,CAAC;QAC/B,MAAM,SAAS,GAAY,EAAE,CAAC;QAC9B,KAAK,MAAM,YAAY,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;YACjD,IAAI,CAAC;gBACH,KAAK,CAAC,IAAI,CAAC,MAAM,IA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B,CAC9B,MAAc,EACd,UAAwC;IAExC,KAAK,MAAM,SAAS,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;QAC1C,uBAAuB,CAAC,SAAS,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;IACxD,CAAC;AACH,CAAC","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 { ITwinError } from \"@itwin/core-bentley\";\nimport {\n AnySchemaDifferenceConflict,\n ConflictCode,\n getSchemaDifferences,\n SchemaConflictsError,\n SchemaDifferenceResult,\n SchemaMerger,\n} from \"@itwin/ecschema-editing\";\nimport {\n ECVersion,\n Schema,\n SchemaContext,\n SchemaKey,\n} from \"@itwin/ecschema-metadata\";\nimport {\n IModelTransformerError,\n IModelTransformerErrorScope,\n} from \"../IModelTransformerError\";\nimport {\n ReadonlySchemaAccessor,\n SchemaProcessingContext,\n SchemaProcessingResult,\n SchemaProcessingStrategy,\n} from \"./SchemaProcessingStrategy\";\n\ntype SchemaPlan =\n | { kind: \"new\"; source: Schema }\n | { kind: \"ordinary\"; source: Schema; target: Schema }\n | { kind: \"dynamic-noop\"; source: Schema; target: Schema }\n | {\n kind: \"dynamic-merge\";\n source: Schema;\n target: Schema;\n differences: SchemaDifferenceResult;\n };\n\ninterface SchemaCandidate {\n schema: Schema;\n isTargetRoot: boolean;\n}\n\ninterface SchemaConflictError extends ITwinError {\n schemaKey: string;\n}\n\n/**\n * Processes ordinary schemas with newer-version selection and unions compatible\n * differences for existing dynamic schemas. Dynamic schema root read and write\n * versions must match; only the minor version may differ.\n * @beta\n */\nexport class DynamicSchemaUnionStrategy implements SchemaProcessingStrategy {\n /**\n * Transform schema differences before conflict validation and merging.\n * A subclass that changes the differencing result is responsible for ensuring\n * that its changes are safe for the source and target schemas.\n * @param sourceSchema The source schema being processed.\n * @param targetSchema The existing target schema.\n * @param differences The complete result from [[getSchemaDifferences]].\n * @returns The differencing result to validate and merge.\n * @beta\n */\n protected async onSchemaDifferences(\n _sourceSchema: Schema,\n _targetSchema: Schema,\n differences: SchemaDifferenceResult\n ): Promise<SchemaDifferenceResult> {\n return differences;\n }\n\n /** Select ordinary schemas and union compatible dynamic schema differences. */\n public async processSchemas(\n context: SchemaProcessingContext\n ): Promise<SchemaProcessingResult[]> {\n const plans: SchemaPlan[] = [];\n const conflicts: Error[] = [];\n for (const sourceSchema of context.sourceSchemas) {\n try {\n plans.push(await this.createPlan(sourceSchema, context.targetSchemas));\n } catch (error: unknown) {\n if (\n ITwinError.isError(\n error,\n IModelTransformerErrorScope,\n IModelTransformerError.SchemaConflict\n )\n ) {\n conflicts.push(error);\n continue;\n }\n throw error;\n }\n }\n throwSchemaConflicts(conflicts);\n\n const schemaEditingContext = new SchemaContext();\n const schemaCandidates = new Map<string, SchemaCandidate>();\n for (const plan of plans) {\n if (plan.kind === \"dynamic-merge\") {\n collectSchemaCandidates(plan.target, schemaCandidates, true);\n collectSchemaReferences(plan.source, schemaCandidates);\n } else if (plan.kind === \"dynamic-noop\") {\n collectSchemaCandidates(plan.source, schemaCandidates, false);\n collectSchemaReferences(plan.source, schemaCandidates);\n }\n }\n for (const { schema } of schemaCandidates.values()) {\n await schemaEditingContext.addSchema(schema);\n }\n\n const schemaMerger = new SchemaMerger(schemaEditingContext);\n const results: SchemaProcessingResult[] = [];\n for (const plan of plans) {\n switch (plan.kind) {\n case \"new\":\n if (\n plan.source.isDynamic ||\n (await context.shouldExportSchema(plan.source.schemaKey))\n ) {\n results.push({ kind: \"source\", schema: plan.source });\n }\n break;\n case \"ordinary\":\n if (await context.shouldExportSchema(plan.source.schemaKey)) {\n results.push({ kind: \"source\", schema: plan.source });\n }\n break;\n case \"dynamic-noop\":\n break;\n case \"dynamic-merge\": {\n const mergedSchema = await schemaMerger.merge({\n ...plan.differences,\n conflicts: undefined,\n });\n const sourceVersion = plan.source.schemaKey.version;\n mergedSchema.setVersion(\n sourceVersion.read,\n sourceVersion.write,\n incrementMinorVersion(sourceVersion, plan.target.schemaKey.version)\n );\n results.push({ kind: \"generated\", schema: mergedSchema });\n break;\n }\n }\n }\n\n appendRequiredNoOpSchemas(results, plans);\n return results;\n }\n\n private async createPlan(\n source: Schema,\n targetSchemas: ReadonlySchemaAccessor\n ): Promise<SchemaPlan> {\n const target = await targetSchemas.getSchema(source.name);\n if (target === undefined) return { kind: \"new\", source };\n\n if (source.isDynamic !== target.isDynamic) {\n throw createSchemaConflictError(\n source,\n \"Schema DynamicSchema marker changed\",\n new Error(\"The source and target DynamicSchema markers differ.\")\n );\n }\n if (!source.isDynamic) return { kind: \"ordinary\", source, target };\n\n const sourceVersion = source.schemaKey.version;\n const targetVersion = target.schemaKey.version;\n if (\n sourceVersion.read !== targetVersion.read ||\n sourceVersion.write !== targetVersion.write\n ) {\n throw createSchemaConflictError(\n source,\n \"Dynamic schema has incompatible root versions\",\n new Error(\n `source ${sourceVersion.toString(false)}, target ${targetVersion.toString(false)}`\n )\n );\n }\n\n const differences = await this.onSchemaDifferences(\n source,\n target,\n await getSchemaDifferences(target, source)\n );\n const unresolvedConflicts = (differences.conflicts ?? []).filter(\n (conflict) => !isCompatibleReferenceVersionConflict(conflict)\n );\n if (unresolvedConflicts.length > 0) {\n throw createSchemaConflictError(\n source,\n \"Schema conflict\",\n new SchemaConflictsError(\n `Schema '${source.name}' has unresolved conflicts`,\n unresolvedConflicts,\n source.schemaKey,\n target.schemaKey\n )\n );\n }\n\n return differences.differences.length === 0\n ? { kind: \"dynamic-noop\", source, target }\n : { kind: \"dynamic-merge\", source, target, differences };\n }\n}\n\nfunction createSchemaConflictError(\n schema: Schema,\n operation: string,\n cause: Error\n): Error {\n return ITwinError.create<SchemaConflictError>({\n message: `${operation} for '${schema.schemaKey.toString(false)}': ${cause.message}`,\n iTwinErrorId: {\n scope: IModelTransformerErrorScope,\n key: IModelTransformerError.SchemaConflict,\n },\n cause,\n schemaKey: schema.schemaKey.toString(false),\n });\n}\n\nfunction throwSchemaConflicts(conflicts: Error[]): void {\n if (conflicts.length === 1) throw conflicts[0];\n if (conflicts.length > 1)\n throw new AggregateError(conflicts, \"Schema processing failed\");\n}\n\nfunction appendRequiredNoOpSchemas(\n results: SchemaProcessingResult[],\n plans: SchemaPlan[]\n): void {\n const noOpSchemas = new Map(\n plans\n .filter((plan) => plan.kind === \"dynamic-noop\")\n .map((plan) => [plan.source.name.toLowerCase(), plan.source])\n );\n const requiredNoOpSchemas = new Set<string>();\n const schemasToVisit = results.map((result) => result.schema);\n for (const schema of schemasToVisit) {\n for (const reference of schema.references) {\n const schemaName = reference.name.toLowerCase();\n const noOpSchema = noOpSchemas.get(schemaName);\n if (noOpSchema === undefined || requiredNoOpSchemas.has(schemaName))\n continue;\n\n requiredNoOpSchemas.add(schemaName);\n schemasToVisit.push(noOpSchema);\n }\n }\n for (const schemaName of requiredNoOpSchemas) {\n const schema = noOpSchemas.get(schemaName);\n if (schema !== undefined) results.push({ kind: \"source\", schema });\n }\n}\n\nfunction incrementMinorVersion(\n sourceVersion: ECVersion,\n targetVersion: ECVersion\n): number {\n const maximumVersion =\n sourceVersion.compare(targetVersion) >= 0 ? sourceVersion : targetVersion;\n if (maximumVersion.minor >= 9_999_999) {\n throw new Error(\n `Cannot increment schema version ${maximumVersion.toString(false)}`\n );\n }\n return maximumVersion.minor + 1;\n}\n\nfunction isCompatibleReferenceVersionConflict(\n conflict: AnySchemaDifferenceConflict\n): boolean {\n if (conflict.code !== ConflictCode.ConflictingReferenceVersion) return false;\n if (\n typeof conflict.source !== \"string\" ||\n typeof conflict.target !== \"string\"\n )\n return false;\n\n const sourceVersion = SchemaKey.parseString(conflict.source).version;\n const targetVersion = SchemaKey.parseString(conflict.target).version;\n return (\n sourceVersion.read === targetVersion.read &&\n sourceVersion.write === targetVersion.write\n );\n}\n\nfunction collectSchemaCandidates(\n schema: Schema,\n candidates: Map<string, SchemaCandidate>,\n isTargetRoot: boolean,\n visited: Set<string> = new Set<string>()\n): void {\n const traversalKey = schema.schemaKey.toString();\n if (visited.has(traversalKey)) return;\n visited.add(traversalKey);\n\n const schemaName = schema.name.toLowerCase();\n const existing = candidates.get(schemaName);\n if (existing === undefined) {\n candidates.set(schemaName, { schema, isTargetRoot });\n } else if (\n existing.schema.schemaKey.version.read !== schema.schemaKey.version.read ||\n existing.schema.schemaKey.version.write !== schema.schemaKey.version.write\n ) {\n throw createSchemaConflictError(\n schema,\n \"Schema reference has incompatible read/write versions\",\n new Error(\n `${existing.schema.schemaKey.version.read}.${existing.schema.schemaKey.version.write} ` +\n `and ${schema.schemaKey.version.read}.${schema.schemaKey.version.write} differ. ` +\n \"Only minor-version reference differences are supported.\"\n )\n );\n } else if (\n isTargetRoot ||\n (!existing.isTargetRoot &&\n schema.schemaKey.version.compare(existing.schema.schemaKey.version) > 0)\n ) {\n candidates.set(schemaName, { schema, isTargetRoot });\n }\n\n for (const reference of schema.references) {\n collectSchemaCandidates(reference, candidates, false, visited);\n }\n}\n\nfunction collectSchemaReferences(\n schema: Schema,\n candidates: Map<string, SchemaCandidate>\n): void {\n for (const reference of schema.references) {\n collectSchemaCandidates(reference, candidates, false);\n }\n}\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { IModelDb } from "@itwin/core-backend";
|
|
2
|
+
import { Schema, SchemaKey } from "@itwin/ecschema-metadata";
|
|
3
|
+
import { ExportSchemaResult, IModelExporter } from "../IModelExporter";
|
|
4
|
+
import { SchemaProcessingStrategy } from "./SchemaProcessingStrategy";
|
|
5
|
+
interface SchemaProcessingCoordinatorArgs {
|
|
6
|
+
exporter: IModelExporter;
|
|
7
|
+
targetDb: IModelDb;
|
|
8
|
+
getSchemaExportDirectory: () => string;
|
|
9
|
+
shouldExportSchema: (schemaKey: SchemaKey) => Promise<boolean>;
|
|
10
|
+
serializeSourceSchema: (schema: Schema) => Promise<void | ExportSchemaResult>;
|
|
11
|
+
}
|
|
12
|
+
/** @internal */
|
|
13
|
+
export declare class SchemaProcessingCoordinator {
|
|
14
|
+
private readonly _args;
|
|
15
|
+
private readonly _longNamedSchemas;
|
|
16
|
+
constructor(_args: SchemaProcessingCoordinatorArgs);
|
|
17
|
+
process(strategy: SchemaProcessingStrategy): Promise<void>;
|
|
18
|
+
serializeSourceSchema(schema: Schema): Promise<ExportSchemaResult>;
|
|
19
|
+
private get _schemaExportDirectory();
|
|
20
|
+
private serializeSchema;
|
|
21
|
+
private getSchemaExportFileName;
|
|
22
|
+
private createLongNameResolvingSchemaContext;
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=SchemaProcessingCoordinator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SchemaProcessingCoordinator.d.ts","sourceRoot":"","sources":["../../../src/schema-processing/SchemaProcessingCoordinator.ts"],"names":[],"mappings":"AAOA,OAAO,EAAsB,QAAQ,EAAc,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,MAAM,EAAE,SAAS,EAAgB,MAAM,0BAA0B,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAKvE,OAAO,EAGL,wBAAwB,EACzB,MAAM,4BAA4B,CAAC;AAEpC,UAAU,+BAA+B;IACvC,QAAQ,EAAE,cAAc,CAAC;IACzB,QAAQ,EAAE,QAAQ,CAAC;IACnB,wBAAwB,EAAE,MAAM,MAAM,CAAC;IACvC,kBAAkB,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/D,qBAAqB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,GAAG,kBAAkB,CAAC,CAAC;CAC/E;AAED,gBAAgB;AAChB,qBAAa,2BAA2B;IAGnB,OAAO,CAAC,QAAQ,CAAC,KAAK;IAFzC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAA6B;IAE/D,YAAoC,KAAK,EAAE,+BAA+B,EAAI;IAEjE,OAAO,CAAC,QAAQ,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAmEtE;IAEY,qBAAqB,CAChC,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,kBAAkB,CAAC,CAU7B;IAED,OAAO,KAAK,sBAAsB,GAEjC;YAEa,eAAe;IAe7B,OAAO,CAAC,uBAAuB;IAkB/B,OAAO,CAAC,oCAAoC;CAU7C"}
|