@itwin/imodel-transformer 2.0.0-dev.27 → 2.0.0-dev.29
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/lib/cjs/ECReferenceTypesCache.d.ts.map +1 -1
- package/lib/cjs/ECReferenceTypesCache.js +8 -1
- package/lib/cjs/ECReferenceTypesCache.js.map +1 -1
- package/lib/cjs/IModelExporter.d.ts +1 -1
- package/lib/cjs/IModelExporter.d.ts.map +1 -1
- package/lib/cjs/IModelExporter.js +39 -8
- package/lib/cjs/IModelExporter.js.map +1 -1
- package/lib/cjs/IModelImporter.d.ts.map +1 -1
- package/lib/cjs/IModelImporter.js +93 -37
- package/lib/cjs/IModelImporter.js.map +1 -1
- package/lib/cjs/IModelTransformer.d.ts.map +1 -1
- package/lib/cjs/IModelTransformer.js +186 -43
- package/lib/cjs/IModelTransformer.js.map +1 -1
- package/lib/cjs/IModelTransformerError.d.ts +74 -0
- package/lib/cjs/IModelTransformerError.d.ts.map +1 -0
- package/lib/cjs/IModelTransformerError.js +83 -0
- package/lib/cjs/IModelTransformerError.js.map +1 -0
- package/lib/cjs/ProvenanceManager.d.ts.map +1 -1
- package/lib/cjs/ProvenanceManager.js +52 -9
- package/lib/cjs/ProvenanceManager.js.map +1 -1
- package/lib/cjs/SyncTypeResolver.d.ts.map +1 -1
- package/lib/cjs/SyncTypeResolver.js +13 -1
- package/lib/cjs/SyncTypeResolver.js.map +1 -1
- package/lib/cjs/imodel-transformer.d.ts +5 -0
- package/lib/cjs/imodel-transformer.d.ts.map +1 -1
- package/lib/cjs/imodel-transformer.js +26 -7
- package/lib/cjs/imodel-transformer.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SyncTypeResolver = void 0;
|
|
4
|
+
/*---------------------------------------------------------------------------------------------
|
|
5
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
6
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
7
|
+
*--------------------------------------------------------------------------------------------*/
|
|
8
|
+
const core_bentley_1 = require("@itwin/core-bentley");
|
|
4
9
|
const core_backend_1 = require("@itwin/core-backend");
|
|
5
10
|
const core_common_1 = require("@itwin/core-common");
|
|
6
11
|
const ProvenanceManager_1 = require("./ProvenanceManager");
|
|
12
|
+
const IModelTransformerError_1 = require("./IModelTransformerError");
|
|
7
13
|
/**
|
|
8
14
|
* Encapsulates sync direction determination logic.
|
|
9
15
|
* Given a source and target iModel, resolves whether the transformation is
|
|
@@ -56,7 +62,13 @@ class SyncTypeResolver {
|
|
|
56
62
|
if (esaPropsFromSourceDb !== undefined) {
|
|
57
63
|
return "reverse";
|
|
58
64
|
}
|
|
59
|
-
|
|
65
|
+
core_bentley_1.ITwinError.throwError({
|
|
66
|
+
iTwinErrorId: {
|
|
67
|
+
scope: IModelTransformerError_1.IModelTransformerErrorScope,
|
|
68
|
+
key: IModelTransformerError_1.IModelTransformerError.SynchronizationTypeNotDetermined,
|
|
69
|
+
},
|
|
70
|
+
message: SyncTypeResolver.noEsaSyncDirectionErrorMessage,
|
|
71
|
+
});
|
|
60
72
|
}
|
|
61
73
|
/** Returns the sync type, lazily resolving it on first call. */
|
|
62
74
|
async getSyncType() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SyncTypeResolver.js","sourceRoot":"","sources":["../../src/SyncTypeResolver.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"SyncTypeResolver.js","sourceRoot":"","sources":["../../src/SyncTypeResolver.ts"],"names":[],"mappings":";;;AAAA;;;gGAGgG;AAChG,sDAA6D;AAC7D,sDAI6B;AAC7B,oDAA4C;AAG5C,2DAAwD;AACxD,qEAGkC;AAKlC;;;;;GAKG;AACH,MAAa,gBAAgB;IACpB,MAAM,CAAC,8BAA8B,GAC1C,uOAAuO,CAAC;IAE1N,OAA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AS,EAAE,CAAC;YACvC,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,yBAAU,CAAC,UAAU,CAAC;YACpB,YAAY,EAAE;gBACZ,KAAK,EAAE,oDAA2B;gBAClC,GAAG,EAAE,+CAAsB,CAAC,gCAAgC;aAC7D;YACD,OAAO,EAAE,gBAAgB,CAAC,8BAA8B;SACzD,CAAC,CAAC;IACL,CAAC;IAED,gEAAgE;IACzD,KAAK,CAAC,WAAW;QACtB,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;YACjC,IAAI,IAAI,CAAC,0BAA0B,EAAE,CAAC;gBACpC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;YAC7B,CAAC;iBAAM,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC;gBAClC,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC;YAC9B,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,SAAS,GAAG,MAAM,gBAAgB,CAAC,iBAAiB,CACvD,IAAI,CAAC,OAAO,CAAC,QAAQ,EACrB,IAAI,CAAC,OAAO,CAAC,QAAQ,EACrB,IAAI,CAAC,qBAAqB,CAC3B,CAAC;YACJ,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAEO,KAAK,CAAC,2BAA2B;QACvC,OAAO,CAAC,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,SAAS,CAAC;IAClD,CAAC;IAEO,KAAK,CAAC,2BAA2B;QACvC,OAAO,CAAC,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,SAAS,CAAC;IAClD,CAAC;;AAvGH,4CAwGC","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 *--------------------------------------------------------------------------------------------*/\nimport { Id64String, ITwinError } from \"@itwin/core-bentley\";\nimport {\n ElementOwnsExternalSourceAspects,\n ExternalSourceAspect,\n IModelDb,\n} from \"@itwin/core-backend\";\nimport { IModel } from \"@itwin/core-common\";\nimport type { TargetScopeProvenanceJsonProps } from \"./IModelTransformer\";\nimport type { IModelCloneContext } from \"./IModelCloneContext\";\nimport { ProvenanceManager } from \"./ProvenanceManager\";\nimport {\n IModelTransformerError,\n IModelTransformerErrorScope,\n} from \"./IModelTransformerError\";\n\n/** @internal */\nexport type SyncType = \"not-sync\" | \"forward\" | \"reverse\";\n\n/**\n * Encapsulates sync direction determination logic.\n * Given a source and target iModel, resolves whether the transformation is\n * a forward sync, reverse sync, or not a sync at all.\n * @internal\n */\nexport class SyncTypeResolver {\n public static noEsaSyncDirectionErrorMessage =\n \"Couldn't find an external source aspect to determine sync direction. This often means that the master->branch relationship has not been established. Consider running the transformer with wasSourceIModelCopiedToTarget set to true.\";\n\n public readonly context: IModelCloneContext;\n\n private _syncType?: SyncType;\n private readonly _targetScopeElementId: Id64String;\n private readonly _isProvenanceInitTransform: boolean;\n private readonly _isSyncTransform: boolean;\n\n public constructor(\n context: IModelCloneContext,\n targetScopeElementId: Id64String,\n isProvenanceInitTransform: boolean = false,\n isSyncTransform: boolean = false\n ) {\n this.context = context;\n this._targetScopeElementId = targetScopeElementId;\n this._isProvenanceInitTransform = isProvenanceInitTransform;\n this._isSyncTransform = isSyncTransform;\n }\n\n /**\n * Determines the sync direction \"forward\" or \"reverse\" of a given sourceDb and targetDb by looking for the scoping ESA.\n * If the sourceDb's iModelId is found as the identifier of the expected scoping ESA in the targetDb, then it is a forward synchronization.\n * If the targetDb's iModelId is found as the identifier of the expected scoping ESA in the sourceDb, then it is a reverse synchronization.\n * @note This is a standalone utility that does not depend on instance state.\n * @throws if no scoping ESA can be found in either the sourceDb or targetDb which describes a master branch relationship between the two databases.\n * @returns \"forward\" or \"reverse\"\n */\n public static async determineSyncType(\n sourceDb: IModelDb,\n targetDb: IModelDb,\n targetScopeElementId: Id64String\n ): Promise<\"forward\" | \"reverse\"> {\n const aspectProps = {\n id: undefined as string | undefined,\n version: undefined as string | undefined,\n classFullName: ExternalSourceAspect.classFullName,\n element: {\n id: targetScopeElementId,\n relClassName: ElementOwnsExternalSourceAspects.classFullName,\n },\n scope: { id: IModel.rootSubjectId },\n identifier: sourceDb.iModelId,\n kind: ExternalSourceAspect.Kind.Scope,\n jsonProperties: undefined as TargetScopeProvenanceJsonProps | undefined,\n };\n // First check if the targetDb is the branch (branch is the provenanceDb)\n const esaPropsFromTargetDb =\n await ProvenanceManager.queryScopeExternalSourceAspect(\n targetDb,\n aspectProps\n );\n if (esaPropsFromTargetDb !== undefined) {\n return \"forward\";\n }\n\n // Now check if the sourceDb is the branch\n aspectProps.identifier = targetDb.iModelId;\n const esaPropsFromSourceDb =\n await ProvenanceManager.queryScopeExternalSourceAspect(\n sourceDb,\n aspectProps\n );\n\n if (esaPropsFromSourceDb !== undefined) {\n return \"reverse\";\n }\n ITwinError.throwError({\n iTwinErrorId: {\n scope: IModelTransformerErrorScope,\n key: IModelTransformerError.SynchronizationTypeNotDetermined,\n },\n message: SyncTypeResolver.noEsaSyncDirectionErrorMessage,\n });\n }\n\n /** Returns the sync type, lazily resolving it on first call. */\n public async getSyncType(): Promise<SyncType> {\n if (this._syncType === undefined) {\n if (this._isProvenanceInitTransform) {\n this._syncType = \"forward\";\n } else if (!this._isSyncTransform) {\n this._syncType = \"not-sync\";\n } else {\n this._syncType = await SyncTypeResolver.determineSyncType(\n this.context.sourceDb,\n this.context.targetDb,\n this._targetScopeElementId\n );\n }\n }\n return this._syncType;\n }\n\n private async getIsReverseSynchronization(): Promise<boolean> {\n return (await this.getSyncType()) === \"reverse\";\n }\n\n private async getIsForwardSynchronization(): Promise<boolean> {\n return (await this.getSyncType()) === \"forward\";\n }\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from "./TransformerLoggerCategory";
|
|
2
|
+
export * from "./IModelTransformerError";
|
|
2
3
|
export * from "./IModelExporter";
|
|
3
4
|
export * from "./IModelImporter";
|
|
4
5
|
export * from "./IModelTransformer";
|
|
@@ -23,4 +24,8 @@ export * from "./BranchProvenanceInitializer";
|
|
|
23
24
|
* @docs-group-description Logging
|
|
24
25
|
* Logger categories used by this package.
|
|
25
26
|
*/
|
|
27
|
+
/**
|
|
28
|
+
* @docs-group-description IModelTransformerError
|
|
29
|
+
* Stable identifiers for errors originating from this package.
|
|
30
|
+
*/
|
|
26
31
|
//# sourceMappingURL=imodel-transformer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imodel-transformer.d.ts","sourceRoot":"","sources":["../../src/imodel-transformer.ts"],"names":[],"mappings":"AAIA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"imodel-transformer.d.ts","sourceRoot":"","sources":["../../src/imodel-transformer.ts"],"names":[],"mappings":"AAIA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AA0G9C;;;;;;GAMG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG"}
|
|
@@ -19,12 +19,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
19
19
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
20
20
|
*--------------------------------------------------------------------------------------------*/
|
|
21
21
|
__exportStar(require("./TransformerLoggerCategory"), exports);
|
|
22
|
+
__exportStar(require("./IModelTransformerError"), exports);
|
|
22
23
|
__exportStar(require("./IModelExporter"), exports);
|
|
23
24
|
__exportStar(require("./IModelImporter"), exports);
|
|
24
25
|
__exportStar(require("./IModelTransformer"), exports);
|
|
25
26
|
__exportStar(require("./BranchProvenanceInitializer"), exports);
|
|
26
27
|
const semver = require("semver");
|
|
28
|
+
const core_bentley_1 = require("@itwin/core-bentley");
|
|
27
29
|
const package_json_1 = require("@itwin/core-backend/package.json");
|
|
30
|
+
const IModelTransformerError_1 = require("./IModelTransformerError");
|
|
28
31
|
// must use an untyped require to not hoist src into lib/cjs, also the compiled output will be in 'lib/cjs', not 'src' so use `../..` to reach package.json
|
|
29
32
|
const { version: ourVersion, name: ourName, peerDependencies,
|
|
30
33
|
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports
|
|
@@ -63,16 +66,28 @@ if (process.env[noStrictDepCheckEnvVar] !== "1" &&
|
|
|
63
66
|
.map(([k]) => k)
|
|
64
67
|
.filter(isTaglessVersion)
|
|
65
68
|
.reverse();
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
core_bentley_1.ITwinError.throwError({
|
|
70
|
+
iTwinErrorId: {
|
|
71
|
+
scope: IModelTransformerError_1.IModelTransformerErrorScope,
|
|
72
|
+
key: IModelTransformerError_1.IModelTransformerError.DependencyVersionMismatch,
|
|
73
|
+
},
|
|
74
|
+
message: [
|
|
75
|
+
errHeader,
|
|
76
|
+
`You have ${suggestEnvVarName}=1 set in the environment, so we suggest one of the following versions.`,
|
|
77
|
+
"Be aware that older versions may be missing bug fixes.",
|
|
78
|
+
...latestFirstApplicableVersions,
|
|
79
|
+
].join("\n"),
|
|
80
|
+
});
|
|
72
81
|
});
|
|
73
82
|
}
|
|
74
83
|
else {
|
|
75
|
-
|
|
84
|
+
core_bentley_1.ITwinError.throwError({
|
|
85
|
+
iTwinErrorId: {
|
|
86
|
+
scope: IModelTransformerError_1.IModelTransformerErrorScope,
|
|
87
|
+
key: IModelTransformerError_1.IModelTransformerError.DependencyVersionMismatch,
|
|
88
|
+
},
|
|
89
|
+
message: `${errHeader}You can rerun with the environment variable ${suggestEnvVarName}=1 to have this error suggest a version`,
|
|
90
|
+
});
|
|
76
91
|
}
|
|
77
92
|
}
|
|
78
93
|
/** @docs-package-description
|
|
@@ -95,4 +110,8 @@ if (process.env[noStrictDepCheckEnvVar] !== "1" &&
|
|
|
95
110
|
* @docs-group-description Logging
|
|
96
111
|
* Logger categories used by this package.
|
|
97
112
|
*/
|
|
113
|
+
/**
|
|
114
|
+
* @docs-group-description IModelTransformerError
|
|
115
|
+
* Stable identifiers for errors originating from this package.
|
|
116
|
+
*/
|
|
98
117
|
//# sourceMappingURL=imodel-transformer.js.map
|
|
@@ -1 +1 @@
|
|
|
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,gEAA8C;AAE9C,iCAAiC;AACjC,mEAAsF;
|
|
1
|
+
{"version":3,"file":"imodel-transformer.js","sourceRoot":"","sources":["../../src/imodel-transformer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;gGAGgG;AAChG,8DAA4C;AAC5C,2DAAyC;AACzC,mDAAiC;AACjC,mDAAiC;AACjC,sDAAoC;AACpC,gEAA8C;AAE9C,iCAAiC;AACjC,sDAAiD;AACjD,mEAAsF;AACtF,qEAGkC;AAElC,2JAA2J;AAC3J,MAAM,EACJ,OAAO,EAAE,UAAU,EACnB,IAAI,EAAE,OAAO,EACb,gBAAgB;AAChB,qGAAqG;EACtG,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAElC,MAAM,2BAA2B,GAAG,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;AAE5E,MAAM,sBAAsB,GAAG,iCAAiC,CAAC;AACjE,MAAM,iBAAiB,GAAG,8BAA8B,CAAC;AAEzD,4CAA4C;AAC5C,IAAI,MAAM,CAAC,UAAU,CAAC,sBAAuB,CAAC,EAAE,CAAC;IAC/C,sCAAsC;IACtC,OAAO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,CAClD,aAAa,CAAC,QAAQ,CACvB;iBACE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAChB,MAAM,CAAC,SAAS,CACd,sBAAuB,EACvB,CAAC,CAAC,gBAAgB,EAAE,CAAC,qBAAqB,CAAC,IAAI,EAAE,CAClD,CACF;iBACA,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;iBACf,MAAM,CAAC,gBAAgB,CAAC;iBACxB,OAAO,EAAE,CAAC;YAEb,yBAAU,CAAC,UAAU,CAAC;gBACpB,YAAY,EAAE;oBACZ,KAAK,EAAE,oDAA2B;oBAClC,GAAG,EAAE,+CAAsB,CAAC,yBAAyB;iBACtD;gBACD,OAAO,EAAE;oBACP,SAAS;oBACT,YAAY,iBAAiB,yEAAyE;oBACtG,wDAAwD;oBACxD,GAAG,6BAA6B;iBACjC,CAAC,IAAI,CAAC,IAAI,CAAC;aACb,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,yBAAU,CAAC,UAAU,CAAC;YACpB,YAAY,EAAE;gBACZ,KAAK,EAAE,oDAA2B;gBAClC,GAAG,EAAE,+CAAsB,CAAC,yBAAyB;aACtD;YACD,OAAO,EAAE,GAAG,SAAS,+CAA+C,iBAAiB,yCAAyC;SAC/H,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH;;;;GAIG;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 \"./IModelTransformerError\";\nexport * from \"./IModelExporter\";\nexport * from \"./IModelImporter\";\nexport * from \"./IModelTransformer\";\nexport * from \"./BranchProvenanceInitializer\";\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\";\n\n// must use an untyped require to not hoist src into lib/cjs, also the compiled output will be in 'lib/cjs', not 'src' so use `../..` to reach package.json\nconst {\n version: ourVersion,\n name: ourName,\n peerDependencies,\n // eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports\n} = require(\"../../package.json\");\n\nconst ourITwinCoreBackendDepRange = peerDependencies[\"@itwin/core-backend\"];\n\nconst noStrictDepCheckEnvVar = \"TRANSFORMER_NO_STRICT_DEP_CHECK\";\nconst suggestEnvVarName = \"SUGGEST_TRANSFORMER_VERSIONS\";\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 if (process.env[suggestEnvVarName]) {\n // let's not import https except in this case\n // eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports\n const https = require(\"https\") as typeof import(\"https\");\n https.get(`https://registry.npmjs.org/${ourName}`, async (resp) => {\n const chunks: string[] = [];\n const packumentSrc = await new Promise<string>((r) =>\n resp\n .setEncoding(\"utf8\")\n .on(\"data\", (d) => chunks.push(d))\n .on(\"end\", () => r(chunks.join(\"\")))\n );\n interface PackumentSubset {\n versions: Record<\n string,\n {\n peerDependencies?: {\n \"@itwin/core-backend\": string; // eslint-disable-line @typescript-eslint/naming-convention\n };\n }\n >;\n }\n\n const packumentJson = JSON.parse(packumentSrc) as PackumentSubset;\n const isTaglessVersion = (version: string) => version.includes(\"-\");\n const latestFirstApplicableVersions = Object.entries(\n packumentJson.versions\n )\n .filter(([, v]) =>\n semver.satisfies(\n iTwinCoreBackendVersion,\n v.peerDependencies?.[\"@itwin/core-backend\"] ?? \"\"\n )\n )\n .map(([k]) => k)\n .filter(isTaglessVersion)\n .reverse();\n\n ITwinError.throwError({\n iTwinErrorId: {\n scope: IModelTransformerErrorScope,\n key: IModelTransformerError.DependencyVersionMismatch,\n },\n message: [\n errHeader,\n `You have ${suggestEnvVarName}=1 set in the environment, so we suggest one of the following versions.`,\n \"Be aware that older versions may be missing bug fixes.\",\n ...latestFirstApplicableVersions,\n ].join(\"\\n\"),\n });\n });\n } else {\n ITwinError.throwError({\n iTwinErrorId: {\n scope: IModelTransformerErrorScope,\n key: IModelTransformerError.DependencyVersionMismatch,\n },\n message: `${errHeader}You can rerun with the environment variable ${suggestEnvVarName}=1 to have this error suggest a version`,\n });\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 IModelTransformerError\n * Stable identifiers for errors originating from this package.\n */\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/imodel-transformer",
|
|
3
|
-
"version": "2.0.0-dev.
|
|
3
|
+
"version": "2.0.0-dev.29",
|
|
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
6
|
"typings": "lib/cjs/imodel-transformer",
|