@itwin/imodel-transformer 1.0.1-dev.0 → 1.1.0
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/CHANGELOG.md +49 -1
- package/README.md +17 -0
- package/lib/cjs/Algo.d.ts +7 -0
- package/lib/cjs/Algo.d.ts.map +1 -1
- package/lib/cjs/Algo.js +7 -0
- package/lib/cjs/Algo.js.map +1 -1
- package/lib/cjs/BigMap.d.ts +6 -1
- package/lib/cjs/BigMap.d.ts.map +1 -1
- package/lib/cjs/BigMap.js +28 -2
- package/lib/cjs/BigMap.js.map +1 -1
- package/lib/cjs/BranchProvenanceInitializer.d.ts.map +1 -1
- package/lib/cjs/BranchProvenanceInitializer.js +2 -0
- package/lib/cjs/BranchProvenanceInitializer.js.map +1 -1
- package/lib/cjs/DetachedExportElementAspectsStrategy.js.map +1 -1
- package/lib/cjs/ECReferenceTypesCache.js.map +1 -1
- package/lib/cjs/ECSqlReaderAsyncIterableIteratorAdapter.js.map +1 -1
- package/lib/cjs/ElementCascadingDeleter.js.map +1 -1
- package/lib/cjs/EntityUnifier.d.ts.map +1 -1
- package/lib/cjs/EntityUnifier.js.map +1 -1
- package/lib/cjs/ExportElementAspectsStrategy.js.map +1 -1
- package/lib/cjs/ExportElementAspectsWithElementsStrategy.js.map +1 -1
- package/lib/cjs/IModelCloneContext.d.ts +1 -4
- package/lib/cjs/IModelCloneContext.d.ts.map +1 -1
- package/lib/cjs/IModelCloneContext.js +16 -31
- package/lib/cjs/IModelCloneContext.js.map +1 -1
- package/lib/cjs/IModelExporter.d.ts +67 -62
- package/lib/cjs/IModelExporter.d.ts.map +1 -1
- package/lib/cjs/IModelExporter.js +173 -83
- package/lib/cjs/IModelExporter.js.map +1 -1
- package/lib/cjs/IModelImporter.d.ts +31 -47
- package/lib/cjs/IModelImporter.d.ts.map +1 -1
- package/lib/cjs/IModelImporter.js +62 -72
- package/lib/cjs/IModelImporter.js.map +1 -1
- package/lib/cjs/IModelTransformer.d.ts +146 -210
- package/lib/cjs/IModelTransformer.d.ts.map +1 -1
- package/lib/cjs/IModelTransformer.js +515 -657
- package/lib/cjs/IModelTransformer.js.map +1 -1
- package/lib/cjs/{transformer.d.ts → imodel-transformer.d.ts} +1 -1
- package/lib/cjs/imodel-transformer.d.ts.map +1 -0
- package/lib/cjs/{transformer.js → imodel-transformer.js} +13 -3
- package/lib/cjs/imodel-transformer.js.map +1 -0
- package/package.json +22 -20
- package/lib/cjs/PendingReferenceMap.d.ts +0 -37
- package/lib/cjs/PendingReferenceMap.d.ts.map +0 -1
- package/lib/cjs/PendingReferenceMap.js +0 -92
- package/lib/cjs/PendingReferenceMap.js.map +0 -1
- package/lib/cjs/transformer.d.ts.map +0 -1
- package/lib/cjs/transformer.js.map +0 -1
|
@@ -0,0 +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;AA6F9C;;;;;;GAMG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;GAGG"}
|
|
@@ -26,13 +26,23 @@ __exportStar(require("./BranchProvenanceInitializer"), exports);
|
|
|
26
26
|
const semver = require("semver");
|
|
27
27
|
const package_json_1 = require("@itwin/core-backend/package.json");
|
|
28
28
|
// 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
|
+
const { version: ourVersion, name: ourName, peerDependencies,
|
|
29
30
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
30
|
-
|
|
31
|
+
} = require("../../package.json");
|
|
31
32
|
const ourITwinCoreBackendDepRange = peerDependencies["@itwin/core-backend"];
|
|
32
33
|
const noStrictDepCheckEnvVar = "TRANSFORMER_NO_STRICT_DEP_CHECK";
|
|
33
34
|
const suggestEnvVarName = "SUGGEST_TRANSFORMER_VERSIONS";
|
|
35
|
+
// warn if using a prerelease or dev version
|
|
36
|
+
if (semver.prerelease(package_json_1.version)) {
|
|
37
|
+
// eslint-disable-next-line no-console
|
|
38
|
+
console.warn(`Warning: dev version detected (${package_json_1.version}). ` +
|
|
39
|
+
"This version is most likely fine, but it may introduce new behavior that could cause " +
|
|
40
|
+
"unexpected issues or changes in the transformer's functionality. Please proceed with caution.");
|
|
41
|
+
}
|
|
34
42
|
if (process.env[noStrictDepCheckEnvVar] !== "1" &&
|
|
35
|
-
!semver.satisfies(package_json_1.version, ourITwinCoreBackendDepRange
|
|
43
|
+
!semver.satisfies(package_json_1.version, ourITwinCoreBackendDepRange, {
|
|
44
|
+
includePrerelease: true,
|
|
45
|
+
})) {
|
|
36
46
|
const errHeader = `${ourName}@${ourVersion} only supports @itwin/core-backend@${ourITwinCoreBackendDepRange}, ` +
|
|
37
47
|
`but @itwin/core-backend${package_json_1.version} was resolved when looking for the peer dependency.\n` +
|
|
38
48
|
`If you know exactly what you are doing, you can disable this check by setting ${noStrictDepCheckEnvVar}=1 in the environment\n`;
|
|
@@ -85,4 +95,4 @@ if (process.env[noStrictDepCheckEnvVar] !== "1" &&
|
|
|
85
95
|
* @docs-group-description Logging
|
|
86
96
|
* Logger categories used by this package.
|
|
87
97
|
*/
|
|
88
|
-
//# sourceMappingURL=transformer.js.map
|
|
98
|
+
//# sourceMappingURL=imodel-transformer.js.map
|
|
@@ -0,0 +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;AAEtF,2JAA2J;AAC3J,MAAM,EACJ,OAAO,EAAE,UA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C,CAAC,CAAC,CAAC;iBACjC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CACvC,CAAC;YAYF,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAoB,CAAC;YAClE,MAAM,gBAAgB,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;YACpE,MAAM,6BAA6B,GAAG,MAAM,CAAC,OAAO,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,MAAM,KAAK,CACT;gBACE,SAAS;gBACT,YAAY,iBAAiB,yEAAyE;gBACtG,wDAAwD;gBACxD,GAAG,6BAA6B;aACjC,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,MAAM,KAAK,CACT,GAAG,SAAS,+CAA+C,iBAAiB,yCAAyC,CACtH,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH;;;;GAIG;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 \"./BranchProvenanceInitializer\";\n\nimport * as semver from \"semver\";\nimport { version as iTwinCoreBackendVersion } from \"@itwin/core-backend/package.json\";\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\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\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 throw Error(\n [\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 throw Error(\n `${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"]}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/imodel-transformer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "API for exporting an iModel's parts and also importing them into another iModel",
|
|
5
|
-
"main": "lib/cjs/transformer.js",
|
|
6
|
-
"typings": "lib/cjs/transformer",
|
|
5
|
+
"main": "lib/cjs/imodel-transformer.js",
|
|
6
|
+
"typings": "lib/cjs/imodel-transformer",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"engines": {
|
|
9
9
|
"node": "^18.0.0"
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
"docs": "npm run -s docs:extract && npm run -s docs:reference && npm run -s docs:changelog",
|
|
17
17
|
"docs:changelog": "cpx ./CHANGELOG.md ../../build/docs/reference/imodel-transformer",
|
|
18
18
|
"# env var is workaround, need to contribute a better rush-less root-package.json detector to betools": "",
|
|
19
|
-
"docs:reference": "cross-env RUSHSTACK_FILE_ERROR_BASE_FOLDER='../..' betools docs --includes=../../build/docs/extract --json=../../build/docs/reference/imodel-transformer/file.json --tsIndexFile=transformer.ts --onlyJson",
|
|
19
|
+
"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",
|
|
20
20
|
"docs:extract": "betools extract --fileExt=ts --extractFrom=./src/test --recursive --out=../../build/docs/extract",
|
|
21
21
|
"copy:test-assets": "cpx \"./src/test/assets/**/*\" ./lib/cjs/test/assets",
|
|
22
22
|
"cover": "nyc npm -s test",
|
|
23
|
-
"extract-api": "betools extract-api --entry=imodel-transformer",
|
|
23
|
+
"extract-api": "betools extract-api --entry=imodel-transformer --apiReportFolder=../../common/api --apiReportTempFolder=../../common/api/temp --apiSummaryFolder=../../common/api/summary",
|
|
24
24
|
"lint": "eslint -f visualstudio --quiet \"./src/**/*.ts\" 1>&2",
|
|
25
25
|
"lint:no-tests": "eslint -f visualstudio --quiet \"./src/*.ts\" 1>&2",
|
|
26
26
|
"lint:fix": "eslint --fix -f visualstudio --quiet \"./src/**/*.ts\" 1>&2",
|
|
@@ -54,30 +54,32 @@
|
|
|
54
54
|
"You can find a script to see the latest @itwin/imodel-transformer version for your iTwin.js version in the README"
|
|
55
55
|
],
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"@itwin/core-backend": "^4.3.
|
|
58
|
-
"@itwin/core-bentley": "^4.3.
|
|
59
|
-
"@itwin/core-common": "^4.3.
|
|
60
|
-
"@itwin/core-geometry": "^4.3.
|
|
61
|
-
"@itwin/core-quantity": "^4.3.
|
|
62
|
-
"@itwin/ecschema-metadata": "^4.3.
|
|
57
|
+
"@itwin/core-backend": "^4.3.5",
|
|
58
|
+
"@itwin/core-bentley": "^4.3.5",
|
|
59
|
+
"@itwin/core-common": "^4.3.5",
|
|
60
|
+
"@itwin/core-geometry": "^4.3.5",
|
|
61
|
+
"@itwin/core-quantity": "^4.3.5",
|
|
62
|
+
"@itwin/ecschema-metadata": "^4.3.5"
|
|
63
63
|
},
|
|
64
64
|
"//devDependencies": [
|
|
65
65
|
"NOTE: All peerDependencies should also be listed as devDependencies since peerDependencies are not considered by npm install",
|
|
66
66
|
"NOTE: All tools used by scripts in this package must be listed as devDependencies"
|
|
67
67
|
],
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@itwin/build-tools": "^4.
|
|
70
|
-
"@itwin/core-backend": "
|
|
71
|
-
"@itwin/core-bentley": "
|
|
72
|
-
"@itwin/core-common": "
|
|
73
|
-
"@itwin/core-geometry": "
|
|
74
|
-
"@itwin/core-quantity": "
|
|
75
|
-
"@itwin/ecschema-metadata": "
|
|
76
|
-
"@itwin/
|
|
69
|
+
"@itwin/build-tools": "^4.10.6",
|
|
70
|
+
"@itwin/core-backend": "4.3.5",
|
|
71
|
+
"@itwin/core-bentley": "4.3.5",
|
|
72
|
+
"@itwin/core-common": "4.3.5",
|
|
73
|
+
"@itwin/core-geometry": "4.3.5",
|
|
74
|
+
"@itwin/core-quantity": "4.3.5",
|
|
75
|
+
"@itwin/ecschema-metadata": "4.3.5",
|
|
76
|
+
"@itwin/ecschema-locaters": "4.3.5",
|
|
77
|
+
"@itwin/eslint-plugin": "^4.0.2",
|
|
77
78
|
"@types/chai": "4.3.1",
|
|
78
79
|
"@types/chai-as-promised": "^7.1.5",
|
|
79
80
|
"@types/mocha": "^8.2.3",
|
|
80
81
|
"@types/node": "^18.16.14",
|
|
82
|
+
"@types/node-fetch": "2.6.11",
|
|
81
83
|
"@types/semver": "7.3.10",
|
|
82
84
|
"@types/sinon": "^9.0.11",
|
|
83
85
|
"chai": "^4.3.7",
|
|
@@ -94,7 +96,7 @@
|
|
|
94
96
|
"rimraf": "^3.0.2",
|
|
95
97
|
"sinon": "^9.2.4",
|
|
96
98
|
"source-map-support": "^0.5.21",
|
|
97
|
-
"typescript": "^5.
|
|
99
|
+
"typescript": "^5.3.3"
|
|
98
100
|
},
|
|
99
101
|
"dependencies": {
|
|
100
102
|
"semver": "^7.5.1"
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/** @packageDocumentation
|
|
2
|
-
* @module Utils
|
|
3
|
-
*/
|
|
4
|
-
import { EntityReference } from "@itwin/core-common";
|
|
5
|
-
import { ConcreteEntity } from "@itwin/core-backend";
|
|
6
|
-
import { EntityKey } from "./EntityMap";
|
|
7
|
-
/**
|
|
8
|
-
* A reference relationships from an element, "referencer", to an element or its submodel, "referenced"
|
|
9
|
-
* @internal
|
|
10
|
-
*/
|
|
11
|
-
export interface PendingReference {
|
|
12
|
-
referencer: EntityReference;
|
|
13
|
-
referenced: EntityReference;
|
|
14
|
-
}
|
|
15
|
-
export declare namespace PendingReference {
|
|
16
|
-
function from(referencer: ConcreteEntity | EntityReference, referenced: ConcreteEntity | EntityReference): PendingReference;
|
|
17
|
-
function toKey(props: PendingReference): string;
|
|
18
|
-
function fromKey(key: string): PendingReference;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* a map that supports using PendingReferences objects as structural keys,
|
|
22
|
-
* as well as getting a list of referencers from a referencee (called referenced)
|
|
23
|
-
*/
|
|
24
|
-
export declare class PendingReferenceMap<T> {
|
|
25
|
-
private _map;
|
|
26
|
-
private _referencedToReferencers;
|
|
27
|
-
getReferencers(referenced: ConcreteEntity): Set<EntityReference>;
|
|
28
|
-
getReferencersByEntityKey(referenced: EntityKey): Set<EntityReference>;
|
|
29
|
-
clear(): void;
|
|
30
|
-
delete(ref: PendingReference): boolean;
|
|
31
|
-
get(ref: PendingReference): T | undefined;
|
|
32
|
-
has(ref: PendingReference): boolean;
|
|
33
|
-
set(ref: PendingReference, value: T): this;
|
|
34
|
-
get size(): number;
|
|
35
|
-
get [Symbol.toStringTag](): string;
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=PendingReferenceMap.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PendingReferenceMap.d.ts","sourceRoot":"","sources":["../../src/PendingReferenceMap.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAoB,MAAM,qBAAqB,CAAC;AAEvE,OAAO,EAAE,SAAS,EAAa,MAAM,aAAa,CAAC;AAEnD;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,eAAe,CAAC;IAC5B,UAAU,EAAE,eAAe,CAAC;CAC7B;AAED,yBAAiB,gBAAgB,CAAC;IAChC,SAAgB,IAAI,CAClB,UAAU,EAAE,cAAc,GAAG,eAAe,EAC5C,UAAU,EAAE,cAAc,GAAG,eAAe,GAC3C,gBAAgB,CAMlB;IAED,SAAgB,KAAK,CAAC,KAAK,EAAE,gBAAgB,GAAG,MAAM,CAErD;IAED,SAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAMrD;CACF;AAED;;;GAGG;AACH,qBAAa,mBAAmB,CAAC,CAAC;IAChC,OAAO,CAAC,IAAI,CAAmB;IAC/B,OAAO,CAAC,wBAAwB,CAAyC;IAElE,cAAc,CAAC,UAAU,EAAE,cAAc,GAAG,GAAG,CAAC,eAAe,CAAC;IAKhE,yBAAyB,CAC9B,UAAU,EAAE,SAAS,GACpB,GAAG,CAAC,eAAe,CAAC;IAUhB,KAAK,IAAI,IAAI;IAIb,MAAM,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO;IAQtC,GAAG,CAAC,GAAG,EAAE,gBAAgB,GAAG,CAAC,GAAG,SAAS;IAIzC,GAAG,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO;IAInC,GAAG,CAAC,GAAG,EAAE,gBAAgB,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI;IAYjD,IAAW,IAAI,IAAI,MAAM,CAExB;IAED,IAAW,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAExC;CACF"}
|
|
@@ -1,92 +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
|
-
/** @packageDocumentation
|
|
7
|
-
* @module Utils
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.PendingReferenceMap = exports.PendingReference = void 0;
|
|
11
|
-
const core_backend_1 = require("@itwin/core-backend");
|
|
12
|
-
const BigMap_1 = require("./BigMap");
|
|
13
|
-
const EntityMap_1 = require("./EntityMap");
|
|
14
|
-
var PendingReference;
|
|
15
|
-
(function (PendingReference) {
|
|
16
|
-
function from(referencer, referenced) {
|
|
17
|
-
if (typeof referencer !== "string")
|
|
18
|
-
referencer = core_backend_1.EntityReferences.from(referencer);
|
|
19
|
-
if (typeof referenced !== "string")
|
|
20
|
-
referenced = core_backend_1.EntityReferences.from(referenced);
|
|
21
|
-
return { referencer, referenced };
|
|
22
|
-
}
|
|
23
|
-
PendingReference.from = from;
|
|
24
|
-
function toKey(props) {
|
|
25
|
-
return `${props.referencer}\x00${props.referenced}`;
|
|
26
|
-
}
|
|
27
|
-
PendingReference.toKey = toKey;
|
|
28
|
-
function fromKey(key) {
|
|
29
|
-
const [referencer, referenced] = key.split("\x00");
|
|
30
|
-
return { referencer, referenced };
|
|
31
|
-
}
|
|
32
|
-
PendingReference.fromKey = fromKey;
|
|
33
|
-
})(PendingReference || (exports.PendingReference = PendingReference = {}));
|
|
34
|
-
/**
|
|
35
|
-
* a map that supports using PendingReferences objects as structural keys,
|
|
36
|
-
* as well as getting a list of referencers from a referencee (called referenced)
|
|
37
|
-
*/
|
|
38
|
-
class PendingReferenceMap {
|
|
39
|
-
constructor() {
|
|
40
|
-
this._map = new BigMap_1.BigMap();
|
|
41
|
-
this._referencedToReferencers = new EntityMap_1.EntityMap();
|
|
42
|
-
}
|
|
43
|
-
getReferencers(referenced) {
|
|
44
|
-
const referencedKey = EntityMap_1.EntityMap.makeKey(referenced);
|
|
45
|
-
return this.getReferencersByEntityKey(referencedKey);
|
|
46
|
-
}
|
|
47
|
-
getReferencersByEntityKey(referenced) {
|
|
48
|
-
let referencers = this._referencedToReferencers.getByKey(referenced);
|
|
49
|
-
if (referencers === undefined) {
|
|
50
|
-
referencers = new Set();
|
|
51
|
-
this._referencedToReferencers.setByKey(referenced, referencers);
|
|
52
|
-
}
|
|
53
|
-
return referencers;
|
|
54
|
-
}
|
|
55
|
-
/// Map implementation
|
|
56
|
-
clear() {
|
|
57
|
-
this._map.clear();
|
|
58
|
-
}
|
|
59
|
-
delete(ref) {
|
|
60
|
-
const deleteResult = this._map.delete(PendingReference.toKey(ref));
|
|
61
|
-
const referencedKey = ref.referenced;
|
|
62
|
-
const referencers = this._referencedToReferencers.getByKey(referencedKey);
|
|
63
|
-
if (referencers !== undefined)
|
|
64
|
-
referencers.delete(ref.referencer);
|
|
65
|
-
return deleteResult;
|
|
66
|
-
}
|
|
67
|
-
get(ref) {
|
|
68
|
-
return this._map.get(PendingReference.toKey(ref));
|
|
69
|
-
}
|
|
70
|
-
has(ref) {
|
|
71
|
-
return this._map.has(PendingReference.toKey(ref));
|
|
72
|
-
}
|
|
73
|
-
set(ref, value) {
|
|
74
|
-
this._map.set(PendingReference.toKey(ref), value);
|
|
75
|
-
const referencedKey = ref.referenced;
|
|
76
|
-
let referencers = this._referencedToReferencers.getByKey(referencedKey);
|
|
77
|
-
if (referencers === undefined) {
|
|
78
|
-
referencers = new Set();
|
|
79
|
-
this._referencedToReferencers.setByKey(referencedKey, referencers);
|
|
80
|
-
}
|
|
81
|
-
referencers.add(ref.referencer);
|
|
82
|
-
return this;
|
|
83
|
-
}
|
|
84
|
-
get size() {
|
|
85
|
-
return this._map.size;
|
|
86
|
-
}
|
|
87
|
-
get [Symbol.toStringTag]() {
|
|
88
|
-
return "PendingReferenceMap";
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
exports.PendingReferenceMap = PendingReferenceMap;
|
|
92
|
-
//# sourceMappingURL=PendingReferenceMap.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PendingReferenceMap.js","sourceRoot":"","sources":["../../src/PendingReferenceMap.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAGH,sDAAuE;AACvE,qCAAkC;AAClC,2CAAmD;AAWnD,IAAiB,gBAAgB,CAuBhC;AAvBD,WAAiB,gBAAgB;IAC/B,SAAgB,IAAI,CAClB,UAA4C,EAC5C,UAA4C;QAE5C,IAAI,OAAO,UAAU,KAAK,QAAQ;YAChC,UAAU,GAAG,+BAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACjD,IAAI,OAAO,UAAU,KAAK,QAAQ;YAChC,UAAU,GAAG,+BAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACjD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC;IACpC,CAAC;IATe,qBAAI,OASnB,CAAA;IAED,SAAgB,KAAK,CAAC,KAAuB;QAC3C,OAAO,GAAG,KAAK,CAAC,UAAU,OAAO,KAAK,CAAC,UAAU,EAAE,CAAC;IACtD,CAAC;IAFe,sBAAK,QAEpB,CAAA;IAED,SAAgB,OAAO,CAAC,GA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WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAClE,OAAO,YAAY,CAAC;IACtB,CAAC;IAEM,GAAG,CAAC,GAAqB;QAC9B,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IACpD,CAAC;IAEM,GAAG,CAAC,GAAqB;QAC9B,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IACpD,CAAC;IAEM,GAAG,CAAC,GAAqB,EAAE,KAAQ;QACxC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;QAClD,MAAM,aAAa,GAAG,GAAG,CAAC,UAAU,CAAC;QACrC,IAAI,WAAW,GAAG,IAAI,CAAC,wBAAwB,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;QACxE,IAAI,WAAW,KAAK,SAAS,EAAE;YAC7B,WAAW,GAAG,IAAI,GAAG,EAAE,CAAC;YACxB,IAAI,CAAC,wBAAwB,CAAC,QAAQ,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;SACpE;QACD,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAChC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;IACxB,CAAC;IAED,IAAW,CAAC,MAAM,CAAC,WAAW,CAAC;QAC7B,OAAO,qBAAqB,CAAC;IAC/B,CAAC;CACF;AA5DD,kDA4DC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Utils\n */\n\nimport { EntityReference } from \"@itwin/core-common\";\nimport { ConcreteEntity, EntityReferences } from \"@itwin/core-backend\";\nimport { BigMap } from \"./BigMap\";\nimport { EntityKey, EntityMap } from \"./EntityMap\";\n\n/**\n * A reference relationships from an element, \"referencer\", to an element or its submodel, \"referenced\"\n * @internal\n */\nexport interface PendingReference {\n referencer: EntityReference;\n referenced: EntityReference;\n}\n\nexport namespace PendingReference {\n export function from(\n referencer: ConcreteEntity | EntityReference,\n referenced: ConcreteEntity | EntityReference\n ): PendingReference {\n if (typeof referencer !== \"string\")\n referencer = EntityReferences.from(referencer);\n if (typeof referenced !== \"string\")\n referenced = EntityReferences.from(referenced);\n return { referencer, referenced };\n }\n\n export function toKey(props: PendingReference): string {\n return `${props.referencer}\\x00${props.referenced}`;\n }\n\n export function fromKey(key: string): PendingReference {\n const [referencer, referenced] = key.split(\"\\x00\") as [\n EntityReference,\n EntityReference,\n ];\n return { referencer, referenced };\n }\n}\n\n/**\n * a map that supports using PendingReferences objects as structural keys,\n * as well as getting a list of referencers from a referencee (called referenced)\n */\nexport class PendingReferenceMap<T> {\n private _map = new BigMap<T>();\n private _referencedToReferencers = new EntityMap<Set<EntityReference>>();\n\n public getReferencers(referenced: ConcreteEntity): Set<EntityReference> {\n const referencedKey = EntityMap.makeKey(referenced);\n return this.getReferencersByEntityKey(referencedKey);\n }\n\n public getReferencersByEntityKey(\n referenced: EntityKey\n ): Set<EntityReference> {\n let referencers = this._referencedToReferencers.getByKey(referenced);\n if (referencers === undefined) {\n referencers = new Set();\n this._referencedToReferencers.setByKey(referenced, referencers);\n }\n return referencers;\n }\n\n /// Map implementation\n public clear(): void {\n this._map.clear();\n }\n\n public delete(ref: PendingReference): boolean {\n const deleteResult = this._map.delete(PendingReference.toKey(ref));\n const referencedKey = ref.referenced;\n const referencers = this._referencedToReferencers.getByKey(referencedKey);\n if (referencers !== undefined) referencers.delete(ref.referencer);\n return deleteResult;\n }\n\n public get(ref: PendingReference): T | undefined {\n return this._map.get(PendingReference.toKey(ref));\n }\n\n public has(ref: PendingReference): boolean {\n return this._map.has(PendingReference.toKey(ref));\n }\n\n public set(ref: PendingReference, value: T): this {\n this._map.set(PendingReference.toKey(ref), value);\n const referencedKey = ref.referenced;\n let referencers = this._referencedToReferencers.getByKey(referencedKey);\n if (referencers === undefined) {\n referencers = new Set();\n this._referencedToReferencers.setByKey(referencedKey, referencers);\n }\n referencers.add(ref.referencer);\n return this;\n }\n\n public get size(): number {\n return this._map.size;\n }\n\n public get [Symbol.toStringTag](): string {\n return \"PendingReferenceMap\";\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transformer.d.ts","sourceRoot":"","sources":["../../src/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;AAiF9C;;;;;;GAMG;AACH;;;;GAIG;AACH;;;GAGG;AACH;;;GAGG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transformer.js","sourceRoot":"","sources":["../../src/transformer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;gGAGgG;AAChG,8DAA4C;AAC5C,mDAAiC;AACjC,mDAAiC;AACjC,sDAAoC;AACpC,gEAA8C;AAE9C,iCAAiC;AACjC,mEAAsF;AAEtF,2JAA2J;AAC3J,8DAA8D;AAC9D,MAAM,EACJ,OAAO,EAAE,UAAU,EACnB,IAAI,EAAE,OAAO,EACb,gBAAgB,GACjB,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,IACE,OAAO,CAAC,GAAG,CAAC,sBAAsB,CA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,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,MAAM,KAAK,CACT;gBACE,SAAS;gBACT,YAAY,iBAAiB,yEAAyE;gBACtG,wDAAwD;gBACxD,GAAG,6BAA6B;aACjC,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;QACJ,CAAC,CAAC,CAAC;KACJ;SAAM;QACL,MAAM,KAAK,CACT,GAAG,SAAS,+CAA+C,iBAAiB,yCAAyC,CACtH,CAAC;KACH;CACF;AAED;;;;;;GAMG;AACH;;;;GAIG;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 \"./BranchProvenanceInitializer\";\n\nimport * as semver from \"semver\";\nimport { version as iTwinCoreBackendVersion } from \"@itwin/core-backend/package.json\";\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\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst {\n version: ourVersion,\n name: ourName,\n peerDependencies,\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\nif (\n process.env[noStrictDepCheckEnvVar] !== \"1\" &&\n !semver.satisfies(iTwinCoreBackendVersion, ourITwinCoreBackendDepRange)\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\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 throw Error(\n [\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 throw Error(\n `${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"]}
|