@itwin/imodel-transformer 2.0.0-dev.68 → 2.0.0-dev.69
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 +111 -31
- package/lib/cjs/ChangesetScanner.d.ts.map +1 -1
- package/lib/cjs/ChangesetScanner.js +130 -47
- package/lib/cjs/ChangesetScanner.js.map +1 -1
- package/lib/cjs/IModelExporter.d.ts +28 -13
- package/lib/cjs/IModelExporter.d.ts.map +1 -1
- package/lib/cjs/IModelExporter.js +65 -81
- package/lib/cjs/IModelExporter.js.map +1 -1
- package/lib/cjs/IModelTransformer.d.ts +48 -15
- package/lib/cjs/IModelTransformer.d.ts.map +1 -1
- package/lib/cjs/IModelTransformer.js +174 -207
- package/lib/cjs/IModelTransformer.js.map +1 -1
- package/lib/cjs/SourceClassKinds.d.ts +22 -0
- package/lib/cjs/SourceClassKinds.d.ts.map +1 -0
- package/lib/cjs/SourceClassKinds.js +60 -0
- package/lib/cjs/SourceClassKinds.js.map +1 -0
- package/lib/cjs/imodel-transformer.d.ts +1 -0
- package/lib/cjs/imodel-transformer.d.ts.map +1 -1
- package/lib/cjs/imodel-transformer.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,61 +1,141 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module iModels
|
|
3
|
+
*/
|
|
1
4
|
import { IModelDb } from "@itwin/core-backend";
|
|
2
5
|
import { Id64String } from "@itwin/core-bentley";
|
|
3
6
|
import { ChangesetFileProps } from "@itwin/core-common";
|
|
4
7
|
import type { ChangedInstanceIds } from "./IModelExporter";
|
|
8
|
+
import { SourceClassKinds } from "./SourceClassKinds";
|
|
5
9
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* @internal
|
|
10
|
+
* Identity shared by all deletion records.
|
|
11
|
+
* @beta
|
|
9
12
|
*/
|
|
10
|
-
export interface
|
|
13
|
+
export interface DeletionRecordBase {
|
|
11
14
|
/** ID of the deleted source instance. */
|
|
12
15
|
ecInstanceId: Id64String;
|
|
13
16
|
/** EC class ID of the deleted source instance. */
|
|
14
17
|
ecClassId: Id64String;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A deleted source element.
|
|
21
|
+
* @beta
|
|
22
|
+
*/
|
|
23
|
+
export interface ElementDeletionRecord extends DeletionRecordBase {
|
|
24
|
+
/** Federation GUID used to find the corresponding target element. Undefined when the element had none. */
|
|
25
|
+
federationGuid?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A deleted source model.
|
|
29
|
+
* @beta
|
|
30
|
+
*/
|
|
31
|
+
export type ModelDeletionRecord = DeletionRecordBase;
|
|
32
|
+
/**
|
|
33
|
+
* A deleted source relationship derived from `BisCore:ElementRefersToElements`, excluding `BisCore:ElementDrivesElement`.
|
|
34
|
+
* @beta
|
|
35
|
+
*/
|
|
36
|
+
export interface RelationshipDeletionRecord extends DeletionRecordBase {
|
|
37
|
+
/** Source endpoint of the deleted relationship. */
|
|
38
|
+
sourceECInstanceId: Id64String;
|
|
39
|
+
/** Target endpoint of the deleted relationship. */
|
|
40
|
+
targetECInstanceId: Id64String;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A deleted source ExternalSourceAspect, used to find the target of an element deleted in the same batch.
|
|
44
|
+
* Only aspects of kind `Element` with a scope and identifier are recorded, because only those identify a target element.
|
|
45
|
+
* @beta
|
|
46
|
+
*/
|
|
47
|
+
export interface ExternalSourceAspectDeletionRecord extends DeletionRecordBase {
|
|
48
|
+
/** Element that owned the deleted aspect. */
|
|
49
|
+
elementId: Id64String;
|
|
50
|
+
/** Scope of the deleted aspect. */
|
|
51
|
+
scopeId: Id64String;
|
|
52
|
+
/** Kind of the deleted aspect. */
|
|
53
|
+
kind: string;
|
|
54
|
+
/** Identifier of the deleted aspect. */
|
|
55
|
+
identifier: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Deleted source instances from one batch of changes.
|
|
59
|
+
* @note Batches are processed in order. An `Element`-kind ExternalSourceAspect deletion is used to identify element deletions in the same batch. An empty array means nothing of that kind was deleted.
|
|
60
|
+
* @beta
|
|
61
|
+
*/
|
|
62
|
+
export interface DeletionBatch {
|
|
63
|
+
/** Deleted elements. */
|
|
64
|
+
elements: ElementDeletionRecord[];
|
|
65
|
+
/** Deleted models. */
|
|
66
|
+
models: ModelDeletionRecord[];
|
|
67
|
+
/** Deleted relationships derived from `BisCore:ElementRefersToElements`, excluding `BisCore:ElementDrivesElement`. */
|
|
68
|
+
relationships: RelationshipDeletionRecord[];
|
|
69
|
+
/** Deleted `Element`-kind ExternalSourceAspects with a scope and identifier. Aspects of other kinds can be omitted. */
|
|
70
|
+
externalSourceAspects: ExternalSourceAspectDeletionRecord[];
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Changes read for [[IModelTransformer.collectChanges]].
|
|
74
|
+
* @note The result must describe every change in the given ranges, as the default implementation does. Changes missing from
|
|
75
|
+
* `changedInstanceIds`, including CodeSpec changes, aren't exported. Every relationship in
|
|
76
|
+
* `changedInstanceIds.relationship.deleteIds` needs a matching deletion record, or its deletion is skipped with a warning.
|
|
77
|
+
* An element or model deletion whose target can't be found through its record or the transformation's provenance is ignored.
|
|
78
|
+
* @beta
|
|
79
|
+
*/
|
|
80
|
+
export interface CollectedChanges {
|
|
81
|
+
/** Changed instance IDs, including the owning elements of changed aspects. */
|
|
82
|
+
changedInstanceIds: ChangedInstanceIds;
|
|
83
|
+
/** Deletion batches of any granularity: one per changeset, one per range, or one for all ranges. */
|
|
84
|
+
deletionBatches: DeletionBatch[];
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* The identifiers of a deleted instance that deletion records are built from, as read from a changeset with
|
|
88
|
+
* `PropertyFilter.InstanceKeyAndIdentifiers`.
|
|
89
|
+
* @internal
|
|
90
|
+
*/
|
|
91
|
+
export interface DeletedInstance {
|
|
92
|
+
ecInstanceId: Id64String;
|
|
93
|
+
ecClassId: Id64String;
|
|
18
94
|
federationGuid?: string;
|
|
19
|
-
/** Source endpoint of a deleted relationship. */
|
|
20
95
|
sourceECInstanceId?: Id64String;
|
|
21
|
-
/** Target endpoint of a deleted relationship. */
|
|
22
96
|
targetECInstanceId?: Id64String;
|
|
23
|
-
/**
|
|
24
|
-
scopeId?: Id64String;
|
|
25
|
-
/** Element owning a deleted ElementAspect. */
|
|
97
|
+
/** Owner of a deleted aspect. */
|
|
26
98
|
elementId?: Id64String;
|
|
27
|
-
|
|
99
|
+
scopeId?: Id64String;
|
|
28
100
|
kind?: string;
|
|
29
|
-
/** Identifier of a deleted ExternalSourceAspect. */
|
|
30
101
|
identifier?: string;
|
|
31
102
|
}
|
|
103
|
+
interface ScanOptions {
|
|
104
|
+
/** Receives the changes. When undefined, changes are read only for their deletion records. */
|
|
105
|
+
changedInstanceIds?: ChangedInstanceIds;
|
|
106
|
+
/** Whether to collect deletion records. Defaults to true. */
|
|
107
|
+
collectDeletionRecords?: boolean;
|
|
108
|
+
}
|
|
32
109
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* from the same changeset.
|
|
110
|
+
* Adds a deleted instance to the deletion batch for its class.
|
|
111
|
+
* @note Throws `IModelStatus.NotFound` when the instance's class is missing from the current schemas, because such a
|
|
112
|
+
* deletion can't be classified.
|
|
37
113
|
* @internal
|
|
38
114
|
*/
|
|
39
|
-
export
|
|
115
|
+
export declare function addDeletionRecord(batch: DeletionBatch, deleted: DeletedInstance, classKinds: SourceClassKinds, iModel: IModelDb): void;
|
|
40
116
|
/**
|
|
41
117
|
* Reads each changeset once, unifies table changes into EC instance changes,
|
|
42
118
|
* normalizes overflow-only inserts and deletes to updates, writes all operations
|
|
43
|
-
* to [[ChangedInstanceIds]], and
|
|
119
|
+
* to [[ChangedInstanceIds]], and records the deleted instances needed to process deletions.
|
|
44
120
|
* @internal
|
|
45
121
|
*/
|
|
46
122
|
export declare class ChangesetScanner {
|
|
47
123
|
/**
|
|
48
|
-
*
|
|
49
|
-
* @param iModel
|
|
50
|
-
* @param
|
|
51
|
-
* @
|
|
52
|
-
|
|
53
|
-
|
|
124
|
+
* Downloads the changesets in each range of an iModel.
|
|
125
|
+
* @param iModel the iModel to download changesets for.
|
|
126
|
+
* @param ranges inclusive ranges of changeset indices.
|
|
127
|
+
* @returns one group of changeset files per range, in the order of `ranges`.
|
|
128
|
+
*/
|
|
129
|
+
static download(iModel: IModelDb, ranges: readonly (readonly [number, number])[]): Promise<ChangesetFileProps[][]>;
|
|
130
|
+
/**
|
|
131
|
+
* Scans each group of changeset files in order with one reader and unifier per file.
|
|
132
|
+
* @param iModel Database used to resolve EC classes.
|
|
133
|
+
* @param csFileGroups Ordered groups of changeset files. Each group produces one deletion batch.
|
|
134
|
+
* @param options Where to write the changes, and whether to collect deletion records.
|
|
135
|
+
* @returns One deletion batch per group, empty when deletion records aren't collected.
|
|
54
136
|
*/
|
|
55
|
-
static scan(iModel: IModelDb,
|
|
56
|
-
|
|
57
|
-
}): Promise<ChangesetDeletionRecordsByChangeset>;
|
|
58
|
-
private static readChanges;
|
|
59
|
-
private static toDeletionRecord;
|
|
137
|
+
static scan(iModel: IModelDb, csFileGroups: ChangesetFileProps[][], { changedInstanceIds, collectDeletionRecords }: ScanOptions): Promise<DeletionBatch[]>;
|
|
138
|
+
private static readFiles;
|
|
60
139
|
}
|
|
140
|
+
export {};
|
|
61
141
|
//# sourceMappingURL=ChangesetScanner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChangesetScanner.d.ts","sourceRoot":"","sources":["../../src/ChangesetScanner.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ChangesetScanner.d.ts","sourceRoot":"","sources":["../../src/ChangesetScanner.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAKL,QAAQ,EAGT,MA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AC,MAAM,CAAE,SAAS;CA0C1B"}
|
|
@@ -3,46 +3,158 @@
|
|
|
3
3
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
4
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
5
|
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module iModels
|
|
8
|
+
*/
|
|
6
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
10
|
exports.ChangesetScanner = void 0;
|
|
11
|
+
exports.addDeletionRecord = addDeletionRecord;
|
|
8
12
|
const core_backend_1 = require("@itwin/core-backend");
|
|
9
13
|
const core_bentley_1 = require("@itwin/core-bentley");
|
|
10
14
|
const IModelTransformerError_1 = require("./IModelTransformerError");
|
|
15
|
+
const SourceClassKinds_1 = require("./SourceClassKinds");
|
|
16
|
+
/**
|
|
17
|
+
* Adds a deleted instance to the deletion batch for its class.
|
|
18
|
+
* @note Throws `IModelStatus.NotFound` when the instance's class is missing from the current schemas, because such a
|
|
19
|
+
* deletion can't be classified.
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
function addDeletionRecord(batch, deleted, classKinds, iModel) {
|
|
23
|
+
const { ecInstanceId, ecClassId } = deleted;
|
|
24
|
+
switch (classKinds.kindOf(ecClassId)) {
|
|
25
|
+
case "element":
|
|
26
|
+
batch.elements.push({
|
|
27
|
+
ecInstanceId,
|
|
28
|
+
ecClassId,
|
|
29
|
+
federationGuid: deleted.federationGuid,
|
|
30
|
+
});
|
|
31
|
+
return;
|
|
32
|
+
case "model":
|
|
33
|
+
batch.models.push({ ecInstanceId, ecClassId });
|
|
34
|
+
return;
|
|
35
|
+
case "relationship": {
|
|
36
|
+
const { sourceECInstanceId, targetECInstanceId } = deleted;
|
|
37
|
+
if (sourceECInstanceId === undefined || targetECInstanceId === undefined)
|
|
38
|
+
core_bentley_1.ITwinError.throwError({
|
|
39
|
+
iTwinErrorId: {
|
|
40
|
+
scope: IModelTransformerError_1.IModelTransformerErrorScope,
|
|
41
|
+
key: IModelTransformerError_1.IModelTransformerError.ChangedInstanceMetadataMissing,
|
|
42
|
+
},
|
|
43
|
+
message: `Relationship deletion ${ecInstanceId} is missing an endpoint.`,
|
|
44
|
+
});
|
|
45
|
+
batch.relationships.push({
|
|
46
|
+
ecInstanceId,
|
|
47
|
+
ecClassId,
|
|
48
|
+
sourceECInstanceId,
|
|
49
|
+
targetECInstanceId,
|
|
50
|
+
});
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
case "externalSourceAspect": {
|
|
54
|
+
const { elementId, scopeId, kind, identifier } = deleted;
|
|
55
|
+
// Only an Element-kind aspect with these set can identify a target element.
|
|
56
|
+
if (elementId !== undefined &&
|
|
57
|
+
scopeId !== undefined &&
|
|
58
|
+
kind === core_backend_1.ExternalSourceAspect.Kind.Element &&
|
|
59
|
+
identifier !== undefined)
|
|
60
|
+
batch.externalSourceAspects.push({
|
|
61
|
+
ecInstanceId,
|
|
62
|
+
ecClassId,
|
|
63
|
+
elementId,
|
|
64
|
+
scopeId,
|
|
65
|
+
kind,
|
|
66
|
+
identifier,
|
|
67
|
+
});
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
case "aspect":
|
|
71
|
+
case "codeSpec":
|
|
72
|
+
case "skippedRelationship":
|
|
73
|
+
return;
|
|
74
|
+
case undefined:
|
|
75
|
+
// Throws NotFound for a class missing from the current schemas. Other unhandled classes need no records.
|
|
76
|
+
iModel.getClassNameFromId(ecClassId);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
11
80
|
/**
|
|
12
81
|
* Reads each changeset once, unifies table changes into EC instance changes,
|
|
13
82
|
* normalizes overflow-only inserts and deletes to updates, writes all operations
|
|
14
|
-
* to [[ChangedInstanceIds]], and
|
|
83
|
+
* to [[ChangedInstanceIds]], and records the deleted instances needed to process deletions.
|
|
15
84
|
* @internal
|
|
16
85
|
*/
|
|
17
86
|
class ChangesetScanner {
|
|
18
87
|
/**
|
|
19
|
-
*
|
|
20
|
-
* @param iModel
|
|
21
|
-
* @param
|
|
22
|
-
* @
|
|
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]].
|
|
88
|
+
* Downloads the changesets in each range of an iModel.
|
|
89
|
+
* @param iModel the iModel to download changesets for.
|
|
90
|
+
* @param ranges inclusive ranges of changeset indices.
|
|
91
|
+
* @returns one group of changeset files per range, in the order of `ranges`.
|
|
25
92
|
*/
|
|
26
|
-
static async
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
93
|
+
static async download(iModel, ranges) {
|
|
94
|
+
const iModelId = iModel.iModelId;
|
|
95
|
+
return Promise.all(ranges.map(async ([first, end]) => core_backend_1.BriefcaseManager.downloadChangesets({
|
|
96
|
+
iModelId,
|
|
97
|
+
range: { first, end },
|
|
98
|
+
targetDir: core_backend_1.BriefcaseManager.getChangeSetsPath(iModelId),
|
|
99
|
+
})));
|
|
30
100
|
}
|
|
31
|
-
|
|
32
|
-
|
|
101
|
+
/**
|
|
102
|
+
* Scans each group of changeset files in order with one reader and unifier per file.
|
|
103
|
+
* @param iModel Database used to resolve EC classes.
|
|
104
|
+
* @param csFileGroups Ordered groups of changeset files. Each group produces one deletion batch.
|
|
105
|
+
* @param options Where to write the changes, and whether to collect deletion records.
|
|
106
|
+
* @returns One deletion batch per group, empty when deletion records aren't collected.
|
|
107
|
+
*/
|
|
108
|
+
static async scan(iModel, csFileGroups, { changedInstanceIds, collectDeletionRecords = true }) {
|
|
109
|
+
const classKinds = collectDeletionRecords
|
|
110
|
+
? await SourceClassKinds_1.SourceClassKinds.query(iModel)
|
|
111
|
+
: undefined;
|
|
112
|
+
const batches = csFileGroups.map(() => ({
|
|
113
|
+
elements: [],
|
|
114
|
+
models: [],
|
|
115
|
+
relationships: [],
|
|
116
|
+
externalSourceAspects: [],
|
|
117
|
+
}));
|
|
118
|
+
const readChanges = function* () {
|
|
119
|
+
for (const [index, csFiles] of csFileGroups.entries()) {
|
|
120
|
+
for (const change of ChangesetScanner.readFiles(iModel, csFiles)) {
|
|
121
|
+
if (classKinds !== undefined && change.$meta.op === "Deleted")
|
|
122
|
+
addDeletionRecord(batches[index], {
|
|
123
|
+
ecInstanceId: change.ECInstanceId,
|
|
124
|
+
ecClassId: change.ECClassId,
|
|
125
|
+
federationGuid: change.FederationGuid,
|
|
126
|
+
sourceECInstanceId: change.SourceECInstanceId,
|
|
127
|
+
targetECInstanceId: change.TargetECInstanceId,
|
|
128
|
+
elementId: change.Element?.Id,
|
|
129
|
+
scopeId: change.Scope?.Id,
|
|
130
|
+
kind: change.Kind,
|
|
131
|
+
identifier: change.Identifier,
|
|
132
|
+
}, classKinds, iModel);
|
|
133
|
+
yield change;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
if (changedInstanceIds !== undefined)
|
|
138
|
+
await changedInstanceIds.addChanges(readChanges());
|
|
139
|
+
// Without an aggregate, the changes are read only to record their deletions.
|
|
140
|
+
else
|
|
141
|
+
for (const _change of readChanges())
|
|
142
|
+
;
|
|
143
|
+
return batches;
|
|
144
|
+
}
|
|
145
|
+
static *readFiles(iModel, csFiles) {
|
|
146
|
+
for (const csFile of csFiles) {
|
|
33
147
|
const csReader = core_backend_1.ChangesetReader.openFile({
|
|
34
148
|
fileName: csFile.pathname,
|
|
35
149
|
db: iModel,
|
|
36
|
-
propFilter: core_backend_1.PropertyFilter.
|
|
150
|
+
propFilter: core_backend_1.PropertyFilter.InstanceKeyAndIdentifiers,
|
|
37
151
|
});
|
|
38
152
|
const changeUnifier = new core_backend_1.PartialChangeUnifier();
|
|
39
153
|
try {
|
|
40
154
|
while (csReader.step())
|
|
41
155
|
changeUnifier.appendFrom(csReader);
|
|
42
|
-
const deletionRecords = [];
|
|
43
156
|
for (const change of changeUnifier.instances) {
|
|
44
|
-
|
|
45
|
-
if (ecClassId === undefined)
|
|
157
|
+
if (change.ECClassId === undefined)
|
|
46
158
|
core_bentley_1.ITwinError.throwError({
|
|
47
159
|
iTwinErrorId: {
|
|
48
160
|
scope: IModelTransformerError_1.IModelTransformerErrorScope,
|
|
@@ -57,13 +169,8 @@ class ChangesetScanner {
|
|
|
57
169
|
change.$meta.tables.every((table) => table.endsWith("Overflow"))) {
|
|
58
170
|
change.$meta.op = "Updated";
|
|
59
171
|
}
|
|
60
|
-
|
|
61
|
-
yield change;
|
|
62
|
-
if (change.$meta.op === "Deleted") {
|
|
63
|
-
deletionRecords.push(this.toDeletionRecord(iModel, change));
|
|
64
|
-
}
|
|
172
|
+
yield change;
|
|
65
173
|
}
|
|
66
|
-
deletionRecordsByChangeset.push(deletionRecords);
|
|
67
174
|
}
|
|
68
175
|
finally {
|
|
69
176
|
try {
|
|
@@ -75,30 +182,6 @@ class ChangesetScanner {
|
|
|
75
182
|
}
|
|
76
183
|
}
|
|
77
184
|
}
|
|
78
|
-
static toDeletionRecord(iModel, change) {
|
|
79
|
-
const ecClassId = change.ECClassId;
|
|
80
|
-
if (ecClassId === undefined) {
|
|
81
|
-
core_bentley_1.ITwinError.throwError({
|
|
82
|
-
iTwinErrorId: {
|
|
83
|
-
scope: IModelTransformerError_1.IModelTransformerErrorScope,
|
|
84
|
-
key: IModelTransformerError_1.IModelTransformerError.ChangedInstanceMetadataMissing,
|
|
85
|
-
},
|
|
86
|
-
message: `ECClassId was not found for id: ${change.ECInstanceId}! Table is : ${change.$meta.tables}`,
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
return {
|
|
90
|
-
ecInstanceId: change.ECInstanceId,
|
|
91
|
-
ecClassId,
|
|
92
|
-
classFullName: iModel.getClassNameFromId(ecClassId),
|
|
93
|
-
federationGuid: change.FederationGuid,
|
|
94
|
-
sourceECInstanceId: change.SourceECInstanceId,
|
|
95
|
-
targetECInstanceId: change.TargetECInstanceId,
|
|
96
|
-
scopeId: change.Scope?.Id,
|
|
97
|
-
elementId: change.Element?.Id,
|
|
98
|
-
kind: change.Kind,
|
|
99
|
-
identifier: change.Identifier,
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
185
|
}
|
|
103
186
|
exports.ChangesetScanner = ChangesetScanner;
|
|
104
187
|
//# sourceMappingURL=ChangesetScanner.js.map
|
|
@@ -1 +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;IACE;;;;;;;OAOG;IACI,MAAM,CAAC,KAAK,CAAC,IAAI,CACtB,MAAgB,EAChB,WAAiC,EACjC,kBAAsC,EACtC,OAAO,GAA6C,EAAE;QAEtD,MAAM,0BAA0B,GAAgC,EAAE,CAAC;QACnE,MAAM,kBAAkB,CAAC,UAAU,CACjC,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,WAAW,EAAE,0BAA0B,EAAE,OAAO,CAAC,CAC3E,CAAC;QACF,OAAO,0BAA0B,CAAC;IACpC,CAAC;IAEO,MAAM,CAAC,CAAC,WAAW,CACzB,MAAgB,EAChB,WAAiC,EACjC,0BAA+D,EAC/D,OAAiD;QAEjD,KAAK,MAAM,MAAM,IAAI,WAAW,EAAE,CAAC;YACjC,MAAM,QAAQ,GAAG,8BAAe,CAAC,QAAQ,CAAC;gBACxC,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,EAAE,EAAE,MAAM;gBACV,UAAU,EAAE,6BAAc,CAAC,cAAc;aAC1C,CAAC,CAAC;YACH,MAAM,aAAa,GAAG,IAAI,mCAAoB,EAAE,CAAC;YACjD,IAAI,CAAC;gBACH,OAAO,QAAQ,CAAC,IAAI,EAAE;oBAAE,aAAa,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;gBAC3D,MAAM,eAAe,GAA8B,EAAE,CAAC;gBACtD,KAAK,MAAM,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AC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAEO,MAAM,CAAC,gBAAgB,CAC7B,MAAgB,EAChB,MAAsB;QAEtB,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;QACnC,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;YAC5B,yBAAU,CAAC,UAAU,CAAC;gBACpB,YAAY,EAAE;oBACZ,KAAK,EAAE,oDAA2B;oBAClC,GAAG,EAAE,+CAAsB,CAAC,8BAA8B;iBAC3D;gBACD,OAAO,EAAE,mCAAmC,MAAM,CAAC,YAAY,gBAAgB,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE;aACrG,CAAC,CAAC;QACL,CAAC;QAED,OAAO;YACL,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,SAAS;YACT,aAAa,EAAE,MAAM,CAAC,kBAAkB,CAAC,SAAS,CAAC;YACnD,cAAc,EAAE,MAAM,CAAC,cAAc;YACrC,kBAAkB,EAAE,MAAM,CAAC,kBAAkB;YAC7C,kBAAkB,EAAE,MAAM,CAAC,kBAAkB;YAC7C,OAAO,EAAE,MAAM,CAAC,KAAK,EAAE,EAAE;YACzB,SAAS,EAAE,MAAM,CAAC,OAAO,EAAE,EAAE;YAC7B,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,UAAU,EAAE,MAAM,CAAC,UAAU;SAC9B,CAAC;IACJ,CAAC;CACF","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 await changedInstanceIds.addChanges(\n this.readChanges(iModel, csFileProps, deletionRecordsByChangeset, options)\n );\n return deletionRecordsByChangeset;\n }\n\n private static *readChanges(\n iModel: IModelDb,\n csFileProps: ChangesetFileProps[],\n deletionRecordsByChangeset: ChangesetDeletionRecordsByChangeset,\n options: { populateChangedInstanceIds?: boolean }\n ): Generator<ChangeInstance> {\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) yield 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\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
|
+
{"version":3,"file":"ChangesetScanner.js","sourceRoot":"","sources":["../../src/ChangesetScanner.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;AAEH,sDAQ6B;AAC7B,sDAA6D;AAG7D,qEAGkC;AAClC,yDAAsD;AA+GtD;;;;;GAKG;AACH,2BACE,KAAoB,EACpB,OAAwB,EACxB,UAA4B,EAC5B,MAAgB;IAEhB,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAC5C,QAAQ,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;QACrC,KAAK,SAAS;YACZ,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;gBAClB,YAAY;gBACZ,SAAS;gBACT,cAAc,EAAE,OAAO,CAAC,cAAc;aACvC,CAAC,CAAC;YACH,OAAO;QACT,KAAK,OAAO;YACV,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC,CAAC;YAC/C,OAAO;QACT,KAAK,cAAc,EAAE,CAAC;YACpB,MAAM,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAAC;YAC3D,IAAI,kBAAkB,KAAK,SAAS,IAAI,kBAAkB,KAAK,SAAS;gBACtE,yBAAU,CAAC,UAAU,CAAC;oBACpB,YAAY,EAAE;wBACZ,KAAK,EAAE,oDAA2B;wBAClC,GAAG,EAAE,+CAAsB,CAAC,8BAA8B;qBAC3D;oBACD,OAA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AC;wBACjE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,EAChE,CAAC;wBACD,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,SAAS,CAAC;oBAC9B,CAAC;oBACD,MAAM,MAAM,CAAC;gBACf,CAAC;YACH,CAAC;oBAAS,CAAC;gBACT,IAAI,CAAC;oBACH,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;gBAClC,CAAC;wBAAS,CAAC;oBACT,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC7B,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module iModels\n */\n\nimport {\n BriefcaseManager,\n ChangeInstance,\n ChangesetReader,\n ExternalSourceAspect,\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\";\nimport { SourceClassKinds } from \"./SourceClassKinds\";\n\n/**\n * Identity shared by all deletion records.\n * @beta\n */\nexport interface DeletionRecordBase {\n /** ID of the deleted source instance. */\n ecInstanceId: Id64String;\n /** EC class ID of the deleted source instance. */\n ecClassId: Id64String;\n}\n\n/**\n * A deleted source element.\n * @beta\n */\nexport interface ElementDeletionRecord extends DeletionRecordBase {\n /** Federation GUID used to find the corresponding target element. Undefined when the element had none. */\n federationGuid?: string;\n}\n\n/**\n * A deleted source model.\n * @beta\n */\nexport type ModelDeletionRecord = DeletionRecordBase;\n\n/**\n * A deleted source relationship derived from `BisCore:ElementRefersToElements`, excluding `BisCore:ElementDrivesElement`.\n * @beta\n */\nexport interface RelationshipDeletionRecord extends DeletionRecordBase {\n /** Source endpoint of the deleted relationship. */\n sourceECInstanceId: Id64String;\n /** Target endpoint of the deleted relationship. */\n targetECInstanceId: Id64String;\n}\n\n/**\n * A deleted source ExternalSourceAspect, used to find the target of an element deleted in the same batch.\n * Only aspects of kind `Element` with a scope and identifier are recorded, because only those identify a target element.\n * @beta\n */\nexport interface ExternalSourceAspectDeletionRecord extends DeletionRecordBase {\n /** Element that owned the deleted aspect. */\n elementId: Id64String;\n /** Scope of the deleted aspect. */\n scopeId: Id64String;\n /** Kind of the deleted aspect. */\n kind: string;\n /** Identifier of the deleted aspect. */\n identifier: string;\n}\n\n/**\n * Deleted source instances from one batch of changes.\n * @note Batches are processed in order. An `Element`-kind ExternalSourceAspect deletion is used to identify element deletions in the same batch. An empty array means nothing of that kind was deleted.\n * @beta\n */\nexport interface DeletionBatch {\n /** Deleted elements. */\n elements: ElementDeletionRecord[];\n /** Deleted models. */\n models: ModelDeletionRecord[];\n /** Deleted relationships derived from `BisCore:ElementRefersToElements`, excluding `BisCore:ElementDrivesElement`. */\n relationships: RelationshipDeletionRecord[];\n /** Deleted `Element`-kind ExternalSourceAspects with a scope and identifier. Aspects of other kinds can be omitted. */\n externalSourceAspects: ExternalSourceAspectDeletionRecord[];\n}\n\n/**\n * Changes read for [[IModelTransformer.collectChanges]].\n * @note The result must describe every change in the given ranges, as the default implementation does. Changes missing from\n * `changedInstanceIds`, including CodeSpec changes, aren't exported. Every relationship in\n * `changedInstanceIds.relationship.deleteIds` needs a matching deletion record, or its deletion is skipped with a warning.\n * An element or model deletion whose target can't be found through its record or the transformation's provenance is ignored.\n * @beta\n */\nexport interface CollectedChanges {\n /** Changed instance IDs, including the owning elements of changed aspects. */\n changedInstanceIds: ChangedInstanceIds;\n /** Deletion batches of any granularity: one per changeset, one per range, or one for all ranges. */\n deletionBatches: DeletionBatch[];\n}\n\n/**\n * The identifiers of a deleted instance that deletion records are built from, as read from a changeset with\n * `PropertyFilter.InstanceKeyAndIdentifiers`.\n * @internal\n */\nexport interface DeletedInstance {\n ecInstanceId: Id64String;\n ecClassId: Id64String;\n federationGuid?: string;\n sourceECInstanceId?: Id64String;\n targetECInstanceId?: Id64String;\n /** Owner of a deleted aspect. */\n elementId?: Id64String;\n scopeId?: Id64String;\n kind?: string;\n identifier?: string;\n}\n\ninterface ScanOptions {\n /** Receives the changes. When undefined, changes are read only for their deletion records. */\n changedInstanceIds?: ChangedInstanceIds;\n /** Whether to collect deletion records. Defaults to true. */\n collectDeletionRecords?: boolean;\n}\n\n/**\n * Adds a deleted instance to the deletion batch for its class.\n * @note Throws `IModelStatus.NotFound` when the instance's class is missing from the current schemas, because such a\n * deletion can't be classified.\n * @internal\n */\nexport function addDeletionRecord(\n batch: DeletionBatch,\n deleted: DeletedInstance,\n classKinds: SourceClassKinds,\n iModel: IModelDb\n): void {\n const { ecInstanceId, ecClassId } = deleted;\n switch (classKinds.kindOf(ecClassId)) {\n case \"element\":\n batch.elements.push({\n ecInstanceId,\n ecClassId,\n federationGuid: deleted.federationGuid,\n });\n return;\n case \"model\":\n batch.models.push({ ecInstanceId, ecClassId });\n return;\n case \"relationship\": {\n const { sourceECInstanceId, targetECInstanceId } = deleted;\n if (sourceECInstanceId === undefined || targetECInstanceId === undefined)\n ITwinError.throwError({\n iTwinErrorId: {\n scope: IModelTransformerErrorScope,\n key: IModelTransformerError.ChangedInstanceMetadataMissing,\n },\n message: `Relationship deletion ${ecInstanceId} is missing an endpoint.`,\n });\n batch.relationships.push({\n ecInstanceId,\n ecClassId,\n sourceECInstanceId,\n targetECInstanceId,\n });\n return;\n }\n case \"externalSourceAspect\": {\n const { elementId, scopeId, kind, identifier } = deleted;\n // Only an Element-kind aspect with these set can identify a target element.\n if (\n elementId !== undefined &&\n scopeId !== undefined &&\n kind === ExternalSourceAspect.Kind.Element &&\n identifier !== undefined\n )\n batch.externalSourceAspects.push({\n ecInstanceId,\n ecClassId,\n elementId,\n scopeId,\n kind,\n identifier,\n });\n return;\n }\n case \"aspect\":\n case \"codeSpec\":\n case \"skippedRelationship\":\n return;\n case undefined:\n // Throws NotFound for a class missing from the current schemas. Other unhandled classes need no records.\n iModel.getClassNameFromId(ecClassId);\n return;\n }\n}\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 records the deleted instances needed to process deletions.\n * @internal\n */\nexport class ChangesetScanner {\n /**\n * Downloads the changesets in each range of an iModel.\n * @param iModel the iModel to download changesets for.\n * @param ranges inclusive ranges of changeset indices.\n * @returns one group of changeset files per range, in the order of `ranges`.\n */\n public static async download(\n iModel: IModelDb,\n ranges: readonly (readonly [number, number])[]\n ): Promise<ChangesetFileProps[][]> {\n const iModelId = iModel.iModelId;\n return Promise.all(\n ranges.map(async ([first, end]) =>\n BriefcaseManager.downloadChangesets({\n iModelId,\n range: { first, end },\n targetDir: BriefcaseManager.getChangeSetsPath(iModelId),\n })\n )\n );\n }\n\n /**\n * Scans each group of changeset files in order with one reader and unifier per file.\n * @param iModel Database used to resolve EC classes.\n * @param csFileGroups Ordered groups of changeset files. Each group produces one deletion batch.\n * @param options Where to write the changes, and whether to collect deletion records.\n * @returns One deletion batch per group, empty when deletion records aren't collected.\n */\n public static async scan(\n iModel: IModelDb,\n csFileGroups: ChangesetFileProps[][],\n { changedInstanceIds, collectDeletionRecords = true }: ScanOptions\n ): Promise<DeletionBatch[]> {\n const classKinds = collectDeletionRecords\n ? await SourceClassKinds.query(iModel)\n : undefined;\n const batches = csFileGroups.map((): DeletionBatch => ({\n elements: [],\n models: [],\n relationships: [],\n externalSourceAspects: [],\n }));\n const readChanges = function* (): Generator<ChangeInstance> {\n for (const [index, csFiles] of csFileGroups.entries()) {\n for (const change of ChangesetScanner.readFiles(iModel, csFiles)) {\n if (classKinds !== undefined && change.$meta.op === \"Deleted\")\n addDeletionRecord(\n batches[index],\n {\n ecInstanceId: change.ECInstanceId,\n ecClassId: change.ECClassId,\n federationGuid: change.FederationGuid,\n sourceECInstanceId: change.SourceECInstanceId,\n targetECInstanceId: change.TargetECInstanceId,\n elementId: change.Element?.Id,\n scopeId: change.Scope?.Id,\n kind: change.Kind,\n identifier: change.Identifier,\n },\n classKinds,\n iModel\n );\n yield change;\n }\n }\n };\n if (changedInstanceIds !== undefined)\n await changedInstanceIds.addChanges(readChanges());\n // Without an aggregate, the changes are read only to record their deletions.\n else for (const _change of readChanges());\n return batches;\n }\n\n private static *readFiles(\n iModel: IModelDb,\n csFiles: ChangesetFileProps[]\n ): Generator<ChangeInstance> {\n for (const csFile of csFiles) {\n const csReader = ChangesetReader.openFile({\n fileName: csFile.pathname,\n db: iModel,\n propFilter: PropertyFilter.InstanceKeyAndIdentifiers,\n });\n const changeUnifier = new PartialChangeUnifier();\n try {\n while (csReader.step()) changeUnifier.appendFrom(csReader);\n for (const change of changeUnifier.instances) {\n if (change.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 yield change;\n }\n } finally {\n try {\n changeUnifier[Symbol.dispose]();\n } finally {\n csReader[Symbol.dispose]();\n }\n }\n }\n }\n}\n"]}
|
|
@@ -460,6 +460,24 @@ export declare class ChangedInstanceOps {
|
|
|
460
460
|
*/
|
|
461
461
|
get isEmpty(): boolean;
|
|
462
462
|
}
|
|
463
|
+
/**
|
|
464
|
+
* A change to one EC instance, for recording changes that don't come from a changeset reader.
|
|
465
|
+
* @see [[ChangedInstanceIds.addChangeRecord]]
|
|
466
|
+
* @beta
|
|
467
|
+
*/
|
|
468
|
+
export interface ChangeRecord {
|
|
469
|
+
/** ID of the changed instance. */
|
|
470
|
+
id: Id64String;
|
|
471
|
+
/** EC class ID of the changed instance, used to tell elements, models, aspects, relationships, and CodeSpecs apart. */
|
|
472
|
+
ecClassId: Id64String;
|
|
473
|
+
/** The operation that changed the instance. */
|
|
474
|
+
op: SqliteChangeOp;
|
|
475
|
+
/**
|
|
476
|
+
* For an aspect, the element that owns it. Required for a deleted aspect, because the source iModel no longer has it.
|
|
477
|
+
* When undefined for an inserted or updated aspect, the owner is read from the source iModel.
|
|
478
|
+
*/
|
|
479
|
+
aspectOwnerElementId?: Id64String;
|
|
480
|
+
}
|
|
463
481
|
/**
|
|
464
482
|
* Class for discovering modified elements between 2 versions of an iModel.
|
|
465
483
|
* @public
|
|
@@ -471,12 +489,7 @@ export declare class ChangedInstanceIds {
|
|
|
471
489
|
aspect: ChangedInstanceOps;
|
|
472
490
|
relationship: ChangedInstanceOps;
|
|
473
491
|
font: ChangedInstanceOps;
|
|
474
|
-
private
|
|
475
|
-
private _modelSubclassIds?;
|
|
476
|
-
private _elementSubclassIds?;
|
|
477
|
-
private _aspectSubclassIds?;
|
|
478
|
-
private _relationshipSubclassIds?;
|
|
479
|
-
private _relationshipSubclassIdsToSkip?;
|
|
492
|
+
private _classKinds?;
|
|
480
493
|
private readonly _aspectOwnerElementIds;
|
|
481
494
|
/** Element IDs that own the aspects represented by `aspect` changes.
|
|
482
495
|
* @internal
|
|
@@ -484,13 +497,6 @@ export declare class ChangedInstanceIds {
|
|
|
484
497
|
get aspectOwnerElementIds(): ReadonlySet<Id64String>;
|
|
485
498
|
private _db;
|
|
486
499
|
constructor(db: IModelDb);
|
|
487
|
-
private setupECClassIds;
|
|
488
|
-
private get _ecClassIdsInitialized();
|
|
489
|
-
private isRelationship;
|
|
490
|
-
private isCodeSpec;
|
|
491
|
-
private isAspect;
|
|
492
|
-
private isModel;
|
|
493
|
-
private isElement;
|
|
494
500
|
/** Checks if there are any changes.
|
|
495
501
|
* @returns true if there are any changes in the ChangedInstanceIds object.
|
|
496
502
|
*/
|
|
@@ -502,7 +508,16 @@ export declare class ChangedInstanceIds {
|
|
|
502
508
|
* @param change Changed EC instance with the ID, operation, and EC class ID of the changed entity.
|
|
503
509
|
*/
|
|
504
510
|
addChange(change: ChangeInstance): Promise<void>;
|
|
511
|
+
/**
|
|
512
|
+
* Adds a change read from somewhere other than a changeset, such as a precomputed cache, like [[addChange]]
|
|
513
|
+
* does for a changeset reader's [ChangeInstance]($backend). Add changes in the order they were made, so that,
|
|
514
|
+
* for example, an insert followed by a delete of the same instance cancels out.
|
|
515
|
+
* @throws [ITwinError]($bentley) with key `AspectOwnerRequired` if a deleted aspect has no `aspectOwnerElementId`.
|
|
516
|
+
* @beta
|
|
517
|
+
*/
|
|
518
|
+
addChangeRecord(change: ChangeRecord): Promise<void>;
|
|
505
519
|
private recordChange;
|
|
520
|
+
private applyChangeRecord;
|
|
506
521
|
private tryGetAspectOwnerElementId;
|
|
507
522
|
/**
|
|
508
523
|
* This method should only be called inside [[IModelTransformer.addCustomChanges]].
|
|
@@ -1 +1 @@
|
|
|
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,EAEL,UAAU,EAEV,OAAO,EAEP,UAAU,EAMX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,kBAAkB,EAClB,QAAQ,EAER,oBAAoB,EAEpB,S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