@itwin/imodel-transformer 2.0.0-dev.39 → 2.0.0-dev.40
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
CHANGED
|
@@ -25,36 +25,12 @@ const context: IModelTransformContext = transformer.context;
|
|
|
25
25
|
This package, for the time being, relies on @internal APIs in iTwin.js, and therefore has very strict peerDependencies versions.
|
|
26
26
|
We perform a version check at runtime to ensure this. Every new iTwin.js version must be validated, and fixes are rarely ported
|
|
27
27
|
to old versions currently, you must request this in an issue. Removing Dependencies on internal APIs is ongoing.
|
|
28
|
-
You can find the latest @itwin/imodel-transformer version for your iTwin.js version by copy and pasting this into a bash shell
|
|
29
|
-
|
|
30
|
-
(use git bash on windows).
|
|
31
|
-
|
|
32
|
-
```sh
|
|
33
|
-
MY_ITWINJS_VERSION="3.6.0" # edit me
|
|
34
|
-
pnpm -s --package=semver -c dlx node <<EOF
|
|
35
|
-
json=""
|
|
36
|
-
require("https").get("https://registry.npmjs.org/@itwin/imodel-transformer", r=>r.setEncoding("utf8").on("data", d=>json+=d).on("end", ()=>{
|
|
37
|
-
semver=require(process.env.PATH.split(":").find(x=>x.includes(".bin"))+"/../semver")
|
|
38
|
-
console.log(Object.entries(JSON.parse(json).versions)
|
|
39
|
-
.filter(([,v])=>semver.satisfies("$MY_ITWINJS_VERSION", v.peerDependencies["@itwin/core-backend"]))
|
|
40
|
-
.map(([k,v])=>k).reverse())
|
|
41
|
-
}))
|
|
42
|
-
EOF
|
|
43
|
-
```
|
|
44
|
-
|
|
45
28
|
## Environment Variables
|
|
46
29
|
|
|
47
30
|
### TRANSFORMER_NO_STRICT_DEP_CHECK
|
|
48
31
|
|
|
49
|
-
Set this variable to `1` to disable strict dependency checks in `packages/transformer/src/transformer.ts`. The strict dependency check validates that the version of
|
|
50
|
-
|
|
51
|
-
### SUGGEST_TRANSFORMER_VERSIONS
|
|
52
|
-
|
|
53
|
-
Set this variable to `1` to enable `packages/transformer/src/transformer.ts` to suggest compatible versions if dependencies are not in the specified peer dependency range of this package.
|
|
32
|
+
Set this variable to `1` to disable strict dependency checks in `packages/transformer/src/imodel-transformer.ts`. The strict dependency check validates that the version of `@itwin/core-backend` provided falls in the range defined by the peer dependencies of the transformer package.
|
|
54
33
|
|
|
55
34
|
```dotenv
|
|
56
|
-
# Disable strict dependency checks in transformer.ts
|
|
57
35
|
TRANSFORMER_NO_STRICT_DEP_CHECK=1
|
|
58
|
-
|
|
59
|
-
# Enable version suggestions in transformer.ts
|
|
60
|
-
SUGGEST_TRANSFORMER_VERSIONS=1
|
|
36
|
+
```
|
|
@@ -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,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,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,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAmD9C;;;;;;GAMG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG"}
|
|
@@ -33,7 +33,6 @@ const TransformerPackageMetadata_1 = require("./TransformerPackageMetadata");
|
|
|
33
33
|
const { version: ourVersion, name: ourName, peerDependencies, } = TransformerPackageMetadata_1.transformerPackageMetadata;
|
|
34
34
|
const ourITwinCoreBackendDepRange = peerDependencies["@itwin/core-backend"];
|
|
35
35
|
const noStrictDepCheckEnvVar = "TRANSFORMER_NO_STRICT_DEP_CHECK";
|
|
36
|
-
const suggestEnvVarName = "SUGGEST_TRANSFORMER_VERSIONS";
|
|
37
36
|
// warn if using a prerelease or dev version
|
|
38
37
|
if (semver.prerelease(package_json_1.version)) {
|
|
39
38
|
// eslint-disable-next-line no-console
|
|
@@ -48,46 +47,13 @@ if (process.env[noStrictDepCheckEnvVar] !== "1" &&
|
|
|
48
47
|
const errHeader = `${ourName}@${ourVersion} only supports @itwin/core-backend@${ourITwinCoreBackendDepRange}, ` +
|
|
49
48
|
`but @itwin/core-backend${package_json_1.version} was resolved when looking for the peer dependency.\n` +
|
|
50
49
|
`If you know exactly what you are doing, you can disable this check by setting ${noStrictDepCheckEnvVar}=1 in the environment\n`;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
.setEncoding("utf8")
|
|
59
|
-
.on("data", (d) => chunks.push(d))
|
|
60
|
-
.on("end", () => r(chunks.join(""))));
|
|
61
|
-
const packumentJson = JSON.parse(packumentSrc);
|
|
62
|
-
const isTaglessVersion = (version) => version.includes("-");
|
|
63
|
-
const latestFirstApplicableVersions = Object.entries(packumentJson.versions)
|
|
64
|
-
.filter(([, v]) => semver.satisfies(package_json_1.version, v.peerDependencies?.["@itwin/core-backend"] ?? ""))
|
|
65
|
-
.map(([k]) => k)
|
|
66
|
-
.filter(isTaglessVersion)
|
|
67
|
-
.reverse();
|
|
68
|
-
core_bentley_1.ITwinError.throwError({
|
|
69
|
-
iTwinErrorId: {
|
|
70
|
-
scope: IModelTransformerError_1.IModelTransformerErrorScope,
|
|
71
|
-
key: IModelTransformerError_1.IModelTransformerError.DependencyVersionMismatch,
|
|
72
|
-
},
|
|
73
|
-
message: [
|
|
74
|
-
errHeader,
|
|
75
|
-
`You have ${suggestEnvVarName}=1 set in the environment, so we suggest one of the following versions.`,
|
|
76
|
-
"Be aware that older versions may be missing bug fixes.",
|
|
77
|
-
...latestFirstApplicableVersions,
|
|
78
|
-
].join("\n"),
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
core_bentley_1.ITwinError.throwError({
|
|
84
|
-
iTwinErrorId: {
|
|
85
|
-
scope: IModelTransformerError_1.IModelTransformerErrorScope,
|
|
86
|
-
key: IModelTransformerError_1.IModelTransformerError.DependencyVersionMismatch,
|
|
87
|
-
},
|
|
88
|
-
message: `${errHeader}You can rerun with the environment variable ${suggestEnvVarName}=1 to have this error suggest a version`,
|
|
89
|
-
});
|
|
90
|
-
}
|
|
50
|
+
core_bentley_1.ITwinError.throwError({
|
|
51
|
+
iTwinErrorId: {
|
|
52
|
+
scope: IModelTransformerError_1.IModelTransformerErrorScope,
|
|
53
|
+
key: IModelTransformerError_1.IModelTransformerError.DependencyVersionMismatch,
|
|
54
|
+
},
|
|
55
|
+
message: errHeader,
|
|
56
|
+
});
|
|
91
57
|
}
|
|
92
58
|
/** @docs-package-description
|
|
93
59
|
* The @itwin/imodel-transformer package contains classes that [backend code]($docs/learning/backend/index.md) can use to
|
|
@@ -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,2DAAyC;AACzC,2DAAyC;AACzC,gEAA8C;AAE9C,iCAAiC;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;AAE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AED;;;;;;GAMG;AACH;;;;GAIG;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 \"./IModelTransformerError\";\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\";\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 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 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"]}
|
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.40",
|
|
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",
|
|
@@ -49,8 +49,7 @@
|
|
|
49
49
|
"This package relies on @internal APIs in iTwin.js, and therefore has very strict peerDep versions",
|
|
50
50
|
"We perform a version check at runtime to ensure this.",
|
|
51
51
|
"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"
|
|
52
|
+
"Removing Dependencies on internal APIs is ongoing."
|
|
54
53
|
],
|
|
55
54
|
"peerDependencies": {
|
|
56
55
|
"@itwin/core-backend": "^5.9.1",
|