Skip to content

Commit

Permalink
initial changes to support transforms without changesets
Browse files Browse the repository at this point in the history
  • Loading branch information
nick4598 committed Dec 10, 2024
1 parent 4383d00 commit 8d7c6b7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/transformer/src/IModelExporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ export class IModelExporter {
await this.initialize(initOpts);
// _sourceDbChanges are initialized in this.initialize
nodeAssert(
this._sourceDbChanges !== undefined,
this._sourceDbChanges !== undefined, // TODO: Should this say that sourceDbChanges must not be empty?
"sourceDbChanges must be initialized."
);

Expand Down Expand Up @@ -586,7 +586,7 @@ export class IModelExporter {
public async exportCodeSpecByName(codeSpecName: string): Promise<void> {
const codeSpec: CodeSpec = this.sourceDb.codeSpecs.getByName(codeSpecName);
let isUpdate: boolean | undefined;
if (undefined !== this._sourceDbChanges) {
if (this._sourceDbChanges !== undefined && !this._sourceDbChanges.isEmpty) {
// is changeset information available?
if (this._sourceDbChanges.codeSpec.insertIds.has(codeSpec.id)) {
isUpdate = false;
Expand Down Expand Up @@ -686,7 +686,7 @@ export class IModelExporter {
/** Export the model (the container only) from the source iModel. */
private async exportModelContainer(model: Model): Promise<void> {
let isUpdate: boolean | undefined;
if (undefined !== this._sourceDbChanges) {
if (this._sourceDbChanges !== undefined && !this._sourceDbChanges.isEmpty) {
// is changeset information available?
if (this._sourceDbChanges.model.insertIds.has(model.id)) {
isUpdate = false;
Expand Down Expand Up @@ -725,7 +725,7 @@ export class IModelExporter {
);
return;
}
if (undefined !== this._sourceDbChanges) {
if (this._sourceDbChanges !== undefined && !this._sourceDbChanges.isEmpty) {
// is changeset information available?
if (
!this._sourceDbChanges.model.insertIds.has(modelId) &&
Expand Down Expand Up @@ -956,7 +956,7 @@ export class IModelExporter {
return;
}
let isUpdate: boolean | undefined;
if (undefined !== this._sourceDbChanges) {
if (this._sourceDbChanges !== undefined && !this._sourceDbChanges.isEmpty) {
// is changeset information available?
if (this._sourceDbChanges.relationship.insertIds.has(relInstanceId)) {
isUpdate = false;
Expand Down Expand Up @@ -1399,7 +1399,7 @@ export class ChangedInstanceIds {
: undefined;

// TODO: should we do this in this PR?
if (csFileProps === undefined) return undefined; // return new ChangedInstanceIds(opts.iModel); // i think we probably need to return sourcedbchanges here even if empty. that sets us up for a transform with nothing
if (csFileProps === undefined) return new ChangedInstanceIds(opts.iModel); // i think we probably need to return sourcedbchanges here even if empty. that sets us up for a transform with nothing

const changedInstanceIds = new ChangedInstanceIds(opts.iModel);

Expand Down
1 change: 1 addition & 0 deletions packages/transformer/src/IModelTransformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2790,6 +2790,7 @@ export class IModelTransformer extends IModelExportHandler {
this.context.remapElement(sourceElementId, targetElementId);
}
);
// hmm if we do transforms without changesets this may be a problem for hasElementChangedCache? and maybe others
if (this._csFileProps === undefined || this._csFileProps.length === 0)
return;
const hasElementChangedCache = new Set<string>();
Expand Down

0 comments on commit 8d7c6b7

Please sign in to comment.