@itwin/imodel-transformer 2.0.0-dev.29 → 2.0.0-dev.30
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/ChangesetScanner.d.ts +60 -0
- package/lib/cjs/ChangesetScanner.d.ts.map +1 -0
- package/lib/cjs/ChangesetScanner.js +101 -0
- package/lib/cjs/ChangesetScanner.js.map +1 -0
- package/lib/cjs/IModelExporter.d.ts +4 -4
- package/lib/cjs/IModelExporter.d.ts.map +1 -1
- package/lib/cjs/IModelExporter.js +9 -41
- package/lib/cjs/IModelExporter.js.map +1 -1
- package/lib/cjs/IModelTransformer.d.ts +2 -0
- package/lib/cjs/IModelTransformer.d.ts.map +1 -1
- package/lib/cjs/IModelTransformer.js +63 -62
- package/lib/cjs/IModelTransformer.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { IModelDb } from "@itwin/core-backend";
|
|
2
|
+
import { Id64String } from "@itwin/core-bentley";
|
|
3
|
+
import { ChangesetFileProps } from "@itwin/core-common";
|
|
4
|
+
import type { ChangedInstanceIds } from "./IModelExporter";
|
|
5
|
+
/**
|
|
6
|
+
* Metadata retained from a deleted EC instance for later target remapping.
|
|
7
|
+
* Properties are optional when the deleted instance did not contain that value.
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export interface ChangesetDeletionRecord {
|
|
11
|
+
/** ID of the deleted source instance. */
|
|
12
|
+
ecInstanceId: Id64String;
|
|
13
|
+
/** EC class ID of the deleted source instance. */
|
|
14
|
+
ecClassId: Id64String;
|
|
15
|
+
/** Full EC class name resolved from [[ecClassId]]. */
|
|
16
|
+
classFullName?: string;
|
|
17
|
+
/** Federation GUID used to find the corresponding target element. */
|
|
18
|
+
federationGuid?: string;
|
|
19
|
+
/** Source endpoint of a deleted relationship. */
|
|
20
|
+
sourceECInstanceId?: Id64String;
|
|
21
|
+
/** Target endpoint of a deleted relationship. */
|
|
22
|
+
targetECInstanceId?: Id64String;
|
|
23
|
+
/** Scope of a deleted ExternalSourceAspect. */
|
|
24
|
+
scopeId?: Id64String;
|
|
25
|
+
/** Element owning a deleted ElementAspect. */
|
|
26
|
+
elementId?: Id64String;
|
|
27
|
+
/** Kind of a deleted ExternalSourceAspect. */
|
|
28
|
+
kind?: string;
|
|
29
|
+
/** Identifier of a deleted ExternalSourceAspect. */
|
|
30
|
+
identifier?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Pre-delete properties grouped by changeset. [[ChangedInstanceIds]] retains
|
|
34
|
+
* operation sets but not the properties needed to remap deleted instances.
|
|
35
|
+
* Grouping keeps scoped ExternalSourceAspect metadata paired with deletions
|
|
36
|
+
* from the same changeset.
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
export type ChangesetDeletionRecordsByChangeset = ChangesetDeletionRecord[][];
|
|
40
|
+
/**
|
|
41
|
+
* Reads each changeset once, unifies table changes into EC instance changes,
|
|
42
|
+
* normalizes overflow-only inserts and deletes to updates, writes all operations
|
|
43
|
+
* to [[ChangedInstanceIds]], and retains properties needed to process deletions.
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
46
|
+
export declare class ChangesetScanner {
|
|
47
|
+
/**
|
|
48
|
+
* Scans each changeset file in order with one reader and unifier per file.
|
|
49
|
+
* @param iModel Database used to resolve EC class names.
|
|
50
|
+
* @param csFileProps Ordered changeset files to scan.
|
|
51
|
+
* @param changedInstanceIds Aggregate updated with the unified changes unless disabled by [[options]].
|
|
52
|
+
* @param options Controls whether the aggregate is populated while deletion records are collected.
|
|
53
|
+
* @returns Deleted-instance properties needed after the scan; changed IDs are written to [[changedInstanceIds]].
|
|
54
|
+
*/
|
|
55
|
+
static scan(iModel: IModelDb, csFileProps: ChangesetFileProps[], changedInstanceIds: ChangedInstanceIds, options?: {
|
|
56
|
+
populateChangedInstanceIds?: boolean;
|
|
57
|
+
}): Promise<ChangesetDeletionRecordsByChangeset>;
|
|
58
|
+
private static toDeletionRecord;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=ChangesetScanner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChangesetScanner.d.ts","sourceRoot":"","sources":["../../src/ChangesetScanner.ts"],"names":[],"mappings":"AAKA,OAAO,EAGL,QAAQ,EAGT,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAc,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAM3D;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACtC,yCAAyC;IACzC,YAAY,EAAE,UAAU,CAAC;IACzB,kDAAkD;IAClD,SAAS,EAAE,UAAU,CAAC;IACtB,sDAAsD;IACtD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qEAAqE;IACrE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iDAAiD;IACjD,kBAAkB,CAAC,EAAE,UAAU,CAAC;IAChC,iDAAiD;IACjD,kBAAkB,CAAC,EAAE,UAAU,CAAC;IAChC,+CAA+C;IAC/C,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB,8CAA8C;IAC9C,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,8CAA8C;IAC9C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oDAAoD;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,mCAAmC,GAAG,uBAAuB,EAAE,EAAE,CAAC;AAE9E;;;;;GAKG;AACH,qBAAa,gBAAgB;IAC3B;;;;;;;OAOG;WACiB,IAAI,CACtB,MAAM,EAAE,QAAQ,EAChB,WAAW,EAAE,kBAAkB,EAAE,EACjC,kBAAkB,EAAE,kBAAkB,EACtC,OAAO,GAAE;QAAE,0BAA0B,CAAC,EAAE,OAAO,CAAA;KAAO,GACrD,OAAO,CAAC,mCAAmC,CAAC;IAmD/C,OAAO,CAAC,MAAM,CAAC,gBAAgB;CA4BhC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.ChangesetScanner = void 0;
|
|
8
|
+
const core_backend_1 = require("@itwin/core-backend");
|
|
9
|
+
const core_bentley_1 = require("@itwin/core-bentley");
|
|
10
|
+
const IModelTransformerError_1 = require("./IModelTransformerError");
|
|
11
|
+
/**
|
|
12
|
+
* Reads each changeset once, unifies table changes into EC instance changes,
|
|
13
|
+
* normalizes overflow-only inserts and deletes to updates, writes all operations
|
|
14
|
+
* to [[ChangedInstanceIds]], and retains properties needed to process deletions.
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
class ChangesetScanner {
|
|
18
|
+
/**
|
|
19
|
+
* Scans each changeset file in order with one reader and unifier per file.
|
|
20
|
+
* @param iModel Database used to resolve EC class names.
|
|
21
|
+
* @param csFileProps Ordered changeset files to scan.
|
|
22
|
+
* @param changedInstanceIds Aggregate updated with the unified changes unless disabled by [[options]].
|
|
23
|
+
* @param options Controls whether the aggregate is populated while deletion records are collected.
|
|
24
|
+
* @returns Deleted-instance properties needed after the scan; changed IDs are written to [[changedInstanceIds]].
|
|
25
|
+
*/
|
|
26
|
+
static async scan(iModel, csFileProps, changedInstanceIds, options = {}) {
|
|
27
|
+
const deletionRecordsByChangeset = [];
|
|
28
|
+
for (const csFile of csFileProps) {
|
|
29
|
+
const csReader = core_backend_1.ChangesetReader.openFile({
|
|
30
|
+
fileName: csFile.pathname,
|
|
31
|
+
db: iModel,
|
|
32
|
+
propFilter: core_backend_1.PropertyFilter.BisCoreElement,
|
|
33
|
+
});
|
|
34
|
+
const changeUnifier = new core_backend_1.PartialChangeUnifier();
|
|
35
|
+
try {
|
|
36
|
+
while (csReader.step())
|
|
37
|
+
changeUnifier.appendFrom(csReader);
|
|
38
|
+
const deletionRecords = [];
|
|
39
|
+
for (const change of changeUnifier.instances) {
|
|
40
|
+
const ecClassId = change.ECClassId;
|
|
41
|
+
if (ecClassId === undefined)
|
|
42
|
+
core_bentley_1.ITwinError.throwError({
|
|
43
|
+
iTwinErrorId: {
|
|
44
|
+
scope: IModelTransformerError_1.IModelTransformerErrorScope,
|
|
45
|
+
key: IModelTransformerError_1.IModelTransformerError.ChangedInstanceMetadataMissing,
|
|
46
|
+
},
|
|
47
|
+
message: `ECClassId was not found for id: ${change.ECInstanceId}! Table is : ${change.$meta.tables}`,
|
|
48
|
+
});
|
|
49
|
+
// Change is recorded at table level, not EC entity level.
|
|
50
|
+
// This normalizes overflow-table expansion records so they do not
|
|
51
|
+
// appear as element inserts or deletes.
|
|
52
|
+
if ((change.$meta.op === "Inserted" || change.$meta.op === "Deleted") &&
|
|
53
|
+
change.$meta.tables.every((table) => table.endsWith("Overflow"))) {
|
|
54
|
+
change.$meta.op = "Updated";
|
|
55
|
+
}
|
|
56
|
+
if (options.populateChangedInstanceIds !== false)
|
|
57
|
+
await changedInstanceIds.addChange(change);
|
|
58
|
+
if (change.$meta.op === "Deleted") {
|
|
59
|
+
deletionRecords.push(this.toDeletionRecord(iModel, change));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
deletionRecordsByChangeset.push(deletionRecords);
|
|
63
|
+
}
|
|
64
|
+
finally {
|
|
65
|
+
try {
|
|
66
|
+
changeUnifier[Symbol.dispose]();
|
|
67
|
+
}
|
|
68
|
+
finally {
|
|
69
|
+
csReader[Symbol.dispose]();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return deletionRecordsByChangeset;
|
|
74
|
+
}
|
|
75
|
+
static toDeletionRecord(iModel, change) {
|
|
76
|
+
const ecClassId = change.ECClassId;
|
|
77
|
+
if (ecClassId === undefined) {
|
|
78
|
+
core_bentley_1.ITwinError.throwError({
|
|
79
|
+
iTwinErrorId: {
|
|
80
|
+
scope: IModelTransformerError_1.IModelTransformerErrorScope,
|
|
81
|
+
key: IModelTransformerError_1.IModelTransformerError.ChangedInstanceMetadataMissing,
|
|
82
|
+
},
|
|
83
|
+
message: `ECClassId was not found for id: ${change.ECInstanceId}! Table is : ${change.$meta.tables}`,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
ecInstanceId: change.ECInstanceId,
|
|
88
|
+
ecClassId,
|
|
89
|
+
classFullName: iModel.getClassNameFromId(ecClassId),
|
|
90
|
+
federationGuid: change.FederationGuid,
|
|
91
|
+
sourceECInstanceId: change.SourceECInstanceId,
|
|
92
|
+
targetECInstanceId: change.TargetECInstanceId,
|
|
93
|
+
scopeId: change.Scope?.Id,
|
|
94
|
+
elementId: change.Element?.Id,
|
|
95
|
+
kind: change.Kind,
|
|
96
|
+
identifier: change.Identifier,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.ChangesetScanner = ChangesetScanner;
|
|
101
|
+
//# sourceMappingURL=ChangesetScanner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChangesetScanner.js","sourceRoot":"","sources":["../../src/ChangesetScanner.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,sDAM6B;AAC7B,sDAA6D;AAG7D,qEAGkC;AAuClC;;;;;GAKG;AACH,MAAa,gBAAgB;IAC3B;;;;;;;OAOG;IACI,MAAM,CAAC,KAAK,CAAC,IAAI,CACtB,MAAgB,EAChB,WAAiC,EACjC,kBAAsC,EACtC,UAAoD,EAAE;QAEtD,MAAM,0BAA0B,GAAgC,EAAE,CAAC;QACnE,KAAK,MAAM,M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AE;YAC7B,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,UAAU,EAAE,MAAM,CAAC,UAAU;SAC9B,CAAC;IACJ,CAAC;CACF;AA7FD,4CA6FC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport {\n ChangeInstance,\n ChangesetReader,\n IModelDb,\n PartialChangeUnifier,\n PropertyFilter,\n} from \"@itwin/core-backend\";\nimport { Id64String, ITwinError } from \"@itwin/core-bentley\";\nimport { ChangesetFileProps } from \"@itwin/core-common\";\nimport type { ChangedInstanceIds } from \"./IModelExporter\";\nimport {\n IModelTransformerError,\n IModelTransformerErrorScope,\n} from \"./IModelTransformerError\";\n\n/**\n * Metadata retained from a deleted EC instance for later target remapping.\n * Properties are optional when the deleted instance did not contain that value.\n * @internal\n */\nexport interface ChangesetDeletionRecord {\n /** ID of the deleted source instance. */\n ecInstanceId: Id64String;\n /** EC class ID of the deleted source instance. */\n ecClassId: Id64String;\n /** Full EC class name resolved from [[ecClassId]]. */\n classFullName?: string;\n /** Federation GUID used to find the corresponding target element. */\n federationGuid?: string;\n /** Source endpoint of a deleted relationship. */\n sourceECInstanceId?: Id64String;\n /** Target endpoint of a deleted relationship. */\n targetECInstanceId?: Id64String;\n /** Scope of a deleted ExternalSourceAspect. */\n scopeId?: Id64String;\n /** Element owning a deleted ElementAspect. */\n elementId?: Id64String;\n /** Kind of a deleted ExternalSourceAspect. */\n kind?: string;\n /** Identifier of a deleted ExternalSourceAspect. */\n identifier?: string;\n}\n\n/**\n * Pre-delete properties grouped by changeset. [[ChangedInstanceIds]] retains\n * operation sets but not the properties needed to remap deleted instances.\n * Grouping keeps scoped ExternalSourceAspect metadata paired with deletions\n * from the same changeset.\n * @internal\n */\nexport type ChangesetDeletionRecordsByChangeset = ChangesetDeletionRecord[][];\n\n/**\n * Reads each changeset once, unifies table changes into EC instance changes,\n * normalizes overflow-only inserts and deletes to updates, writes all operations\n * to [[ChangedInstanceIds]], and retains properties needed to process deletions.\n * @internal\n */\nexport class ChangesetScanner {\n /**\n * Scans each changeset file in order with one reader and unifier per file.\n * @param iModel Database used to resolve EC class names.\n * @param csFileProps Ordered changeset files to scan.\n * @param changedInstanceIds Aggregate updated with the unified changes unless disabled by [[options]].\n * @param options Controls whether the aggregate is populated while deletion records are collected.\n * @returns Deleted-instance properties needed after the scan; changed IDs are written to [[changedInstanceIds]].\n */\n public static async scan(\n iModel: IModelDb,\n csFileProps: ChangesetFileProps[],\n changedInstanceIds: ChangedInstanceIds,\n options: { populateChangedInstanceIds?: boolean } = {}\n ): Promise<ChangesetDeletionRecordsByChangeset> {\n const deletionRecordsByChangeset: ChangesetDeletionRecord[][] = [];\n for (const csFile of csFileProps) {\n const csReader = ChangesetReader.openFile({\n fileName: csFile.pathname,\n db: iModel,\n propFilter: PropertyFilter.BisCoreElement,\n });\n const changeUnifier = new PartialChangeUnifier();\n try {\n while (csReader.step()) changeUnifier.appendFrom(csReader);\n const deletionRecords: ChangesetDeletionRecord[] = [];\n for (const change of changeUnifier.instances) {\n const ecClassId = change.ECClassId;\n if (ecClassId === undefined)\n ITwinError.throwError({\n iTwinErrorId: {\n scope: IModelTransformerErrorScope,\n key: IModelTransformerError.ChangedInstanceMetadataMissing,\n },\n message: `ECClassId was not found for id: ${change.ECInstanceId}! Table is : ${change.$meta.tables}`,\n });\n // Change is recorded at table level, not EC entity level.\n // This normalizes overflow-table expansion records so they do not\n // appear as element inserts or deletes.\n if (\n (change.$meta.op === \"Inserted\" || change.$meta.op === \"Deleted\") &&\n change.$meta.tables.every((table) => table.endsWith(\"Overflow\"))\n ) {\n change.$meta.op = \"Updated\";\n }\n\n if (options.populateChangedInstanceIds !== false)\n await changedInstanceIds.addChange(change);\n if (change.$meta.op === \"Deleted\") {\n deletionRecords.push(this.toDeletionRecord(iModel, change));\n }\n }\n deletionRecordsByChangeset.push(deletionRecords);\n } finally {\n try {\n changeUnifier[Symbol.dispose]();\n } finally {\n csReader[Symbol.dispose]();\n }\n }\n }\n\n return deletionRecordsByChangeset;\n }\n\n private static toDeletionRecord(\n iModel: IModelDb,\n change: ChangeInstance\n ): ChangesetDeletionRecord {\n const ecClassId = change.ECClassId;\n if (ecClassId === undefined) {\n ITwinError.throwError({\n iTwinErrorId: {\n scope: IModelTransformerErrorScope,\n key: IModelTransformerError.ChangedInstanceMetadataMissing,\n },\n message: `ECClassId was not found for id: ${change.ECInstanceId}! Table is : ${change.$meta.tables}`,\n });\n }\n\n return {\n ecInstanceId: change.ECInstanceId,\n ecClassId,\n classFullName: iModel.getClassNameFromId(ecClassId),\n federationGuid: change.FederationGuid,\n sourceECInstanceId: change.SourceECInstanceId,\n targetECInstanceId: change.TargetECInstanceId,\n scopeId: change.Scope?.Id,\n elementId: change.Element?.Id,\n kind: change.Kind,\n identifier: change.Identifier,\n };\n }\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @packageDocumentation
|
|
2
2
|
* @module iModels
|
|
3
3
|
*/
|
|
4
|
-
import { BriefcaseDb,
|
|
4
|
+
import { BriefcaseDb, ChangeInstance, Element, ElementAspect, ElementMultiAspect, ElementUniqueAspect, IModelDb, IModelJsNative, Model, Relationship, SqliteChangeOp } from "@itwin/core-backend";
|
|
5
5
|
import { Id64Arg, Id64String } from "@itwin/core-bentley";
|
|
6
6
|
import { ChangesetFileProps, CodeSpec, FontFamilyDescriptor, FontProps } from "@itwin/core-common";
|
|
7
7
|
import { Schema, SchemaKey } from "@itwin/ecschema-metadata";
|
|
@@ -393,12 +393,12 @@ export declare class ChangedInstanceIds {
|
|
|
393
393
|
*/
|
|
394
394
|
get hasChanges(): boolean;
|
|
395
395
|
/**
|
|
396
|
-
* Adds the provided [[
|
|
396
|
+
* Adds the provided [[ChangeInstance]] to the appropriate set of changes by class type (codeSpec, model, element, aspect, or relationship) maintained by this instance of ChangedInstanceIds.
|
|
397
397
|
* If the same ECInstanceId is seen multiple times, the changedInstanceIds will be modified accordingly, i.e. if an id 'x' was updated but now we see 'x' was deleted, we will remove 'x'
|
|
398
398
|
* from the set of updatedIds and add it to the set of deletedIds for the appropriate class type.
|
|
399
|
-
* @param change
|
|
399
|
+
* @param change Changed EC instance with the ID, operation, and EC class ID of the changed entity.
|
|
400
400
|
*/
|
|
401
|
-
addChange(change:
|
|
401
|
+
addChange(change: ChangeInstance): Promise<void>;
|
|
402
402
|
/**
|
|
403
403
|
* This method should only be called inside [[IModelTransformer.addCustomChanges]].
|
|
404
404
|
* It adds the provided change to the element changes maintained by this instance of ChangedInstanceIds.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelExporter.d.ts","sourceRoot":"","sources":["../../src/IModelExporter.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EACL,WAAW,EAEX,
|
|
1
|
+
{"version":3,"file":"IModelExporter.d.ts","sourceRoot":"","sources":["../../src/IModelExporter.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EACL,WAAW,EAEX,cAAc,EAGd,OAAO,EACP,aAAa,EACb,kBAAkB,EAElB,mBAAmB,EAEnB,QAAQ,EACR,cAAc,EACd,KAAK,EAEL,YAAY,EACZ,cAAc,EACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAGL,OAAO,EAEP,UAAU,EAKX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,kBAAkB,EAClB,QAAQ,EACR,oBAAoB,EAEpB,SAAS,EAIV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAa,MAAM,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAGxE,OAAO,EACL,qBAAqB,EACrB,4BAA4B,EAC7B,MAAM,gCAAgC,CAAC;AAUxC;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,uFAAuF;IACvF,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,M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@itwin/ecschema-metadata");
|
|
|
15
15
|
const TransformerLoggerCategory_1 = require("./TransformerLoggerCategory");
|
|
16
16
|
const nodeAssert = require("assert");
|
|
17
17
|
const ExportElementAspectsWithElementsStrategy_1 = require("./ExportElementAspectsWithElementsStrategy");
|
|
18
|
+
const ChangesetScanner_1 = require("./ChangesetScanner");
|
|
18
19
|
const IModelTransformerError_1 = require("./IModelTransformerError");
|
|
19
20
|
const loggerCategory = TransformerLoggerCategory_1.TransformerLoggerCategory.IModelExporter;
|
|
20
21
|
/** Handles the events generated by IModelExporter.
|
|
@@ -502,8 +503,8 @@ class IModelExporter {
|
|
|
502
503
|
* @note This method is called from [[exportChanges]] and [[exportAll]], so it only needs to be called directly when exporting a subset of an iModel.
|
|
503
504
|
*/
|
|
504
505
|
async exportFontByNumber(fontNumber) {
|
|
505
|
-
/**
|
|
506
|
-
*
|
|
506
|
+
/** ChangedInstanceIds contains EC-mapped changes, but the font table is not EC-mapped.
|
|
507
|
+
* Always export fonts because their changes are therefore absent from sourceDbChanges.
|
|
507
508
|
* It is very rare and even problematic for the font table to reach a large size, so it is not a bottleneck in transforming changes.
|
|
508
509
|
* See https://github.com/iTwin/imodel-transformer/pull/135 for removed code.
|
|
509
510
|
*/
|
|
@@ -890,25 +891,24 @@ class ChangedInstanceIds {
|
|
|
890
891
|
!this.font.isEmpty);
|
|
891
892
|
}
|
|
892
893
|
/**
|
|
893
|
-
* Adds the provided [[
|
|
894
|
+
* Adds the provided [[ChangeInstance]] to the appropriate set of changes by class type (codeSpec, model, element, aspect, or relationship) maintained by this instance of ChangedInstanceIds.
|
|
894
895
|
* If the same ECInstanceId is seen multiple times, the changedInstanceIds will be modified accordingly, i.e. if an id 'x' was updated but now we see 'x' was deleted, we will remove 'x'
|
|
895
896
|
* from the set of updatedIds and add it to the set of deletedIds for the appropriate class type.
|
|
896
|
-
* @param change
|
|
897
|
+
* @param change Changed EC instance with the ID, operation, and EC class ID of the changed entity.
|
|
897
898
|
*/
|
|
898
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
899
899
|
async addChange(change) {
|
|
900
900
|
if (!this._ecClassIdsInitialized)
|
|
901
901
|
await this.setupECClassIds();
|
|
902
|
-
const ecClassId = change.ECClassId
|
|
902
|
+
const ecClassId = change.ECClassId;
|
|
903
903
|
if (ecClassId === undefined)
|
|
904
904
|
core_bentley_1.ITwinError.throwError({
|
|
905
905
|
iTwinErrorId: {
|
|
906
906
|
scope: IModelTransformerError_1.IModelTransformerErrorScope,
|
|
907
907
|
key: IModelTransformerError_1.IModelTransformerError.ChangedInstanceMetadataMissing,
|
|
908
908
|
},
|
|
909
|
-
message: `ECClassId was not found for id: ${change.ECInstanceId}! Table is : ${change
|
|
909
|
+
message: `ECClassId was not found for id: ${change.ECInstanceId}! Table is : ${change.$meta.tables}`,
|
|
910
910
|
});
|
|
911
|
-
const changeType = change.$meta
|
|
911
|
+
const changeType = change.$meta.op;
|
|
912
912
|
if (changeType === undefined)
|
|
913
913
|
core_bentley_1.ITwinError.throwError({
|
|
914
914
|
iTwinErrorId: {
|
|
@@ -1121,39 +1121,7 @@ class ChangedInstanceIds {
|
|
|
1121
1121
|
if (csFileProps === undefined)
|
|
1122
1122
|
return undefined;
|
|
1123
1123
|
const changedInstanceIds = new ChangedInstanceIds(opts.iModel);
|
|
1124
|
-
|
|
1125
|
-
const csReader = core_backend_1.SqliteChangesetReader.openFile({
|
|
1126
|
-
fileName: csFile.pathname,
|
|
1127
|
-
db: opts.iModel,
|
|
1128
|
-
disableSchemaCheck: true,
|
|
1129
|
-
});
|
|
1130
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1131
|
-
const csAdaptor = new core_backend_1.ChangesetECAdaptor(csReader);
|
|
1132
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1133
|
-
const ecChangeUnifier = new core_backend_1.PartialECChangeUnifier(opts.iModel);
|
|
1134
|
-
while (csAdaptor.step()) {
|
|
1135
|
-
ecChangeUnifier.appendFrom(csAdaptor);
|
|
1136
|
-
}
|
|
1137
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1138
|
-
const changes = [...ecChangeUnifier.instances];
|
|
1139
|
-
for (const change of changes) {
|
|
1140
|
-
// Change is recorded at table level, not EC entity level.
|
|
1141
|
-
// This `change.$meta.op` operation overwrite is needed to properly handle scenario when:
|
|
1142
|
-
// 1. Source has an EC class with less than 32 properties. There are existing elements for that class.
|
|
1143
|
-
// 2. Class is then updated to have more than 32 properties. Which means overflow table is now needed to store its elements.
|
|
1144
|
-
// During schema update all elements that belong to updated class, will be expanded into overflow table.
|
|
1145
|
-
// 3. Changeset will have a record about `insert` operation into overflow table for already existing elements.
|
|
1146
|
-
// This fix will overwrite such 'insert' and 'delete' operations to 'update' as no changes are done to main table.
|
|
1147
|
-
// It ensures that changes will be processed and squashed correctly.
|
|
1148
|
-
if (change.$meta &&
|
|
1149
|
-
(change.$meta.op === "Inserted" || change.$meta.op === "Deleted") &&
|
|
1150
|
-
change.$meta.tables.every((e) => e.endsWith("Overflow"))) {
|
|
1151
|
-
change.$meta.op = "Updated";
|
|
1152
|
-
}
|
|
1153
|
-
await changedInstanceIds.addChange(change);
|
|
1154
|
-
}
|
|
1155
|
-
csReader.close();
|
|
1156
|
-
}
|
|
1124
|
+
await ChangesetScanner_1.ChangesetScanner.scan(opts.iModel, csFileProps, changedInstanceIds);
|
|
1157
1125
|
return changedInstanceIds;
|
|
1158
1126
|
}
|
|
1159
1127
|
}
|