Skip to content

Commit

Permalink
support bulk adds per operationtype? is this good enough?
Browse files Browse the repository at this point in the history
  • Loading branch information
nick4598 committed Jan 3, 2025
1 parent e5d2614 commit a0834ec
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions packages/transformer/src/IModelExporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ import {
import {
assert,
DbResult,
Id64,
Id64Arg,
Id64String,
IModelStatus,
Logger,
Expand Down Expand Up @@ -1238,11 +1240,13 @@ export class ChangedInstanceIds {
*/
public addCustomElementChange(
changeType: SqliteChangeOp,
id: Id64String // TODO: Support bulk adds
ids: Id64Arg
): void {
// if delete unnecessary?
this.addModelToUpdated(id);
this.handleChange(this.element, changeType, id);
for (const id of Id64.iterable(ids)) {
this.addModelToUpdated(id);
this.handleChange(this.element, changeType, id);
}
}

/**
Expand All @@ -1254,9 +1258,11 @@ export class ChangedInstanceIds {
*/
public addCustomCodeSpecChange(
changeType: SqliteChangeOp,
id: Id64String
ids: Id64Arg
): void {
this.handleChange(this.codeSpec, changeType, id);
for (const id of Id64.iterable(ids)) {
this.handleChange(this.codeSpec, changeType, id);
}
}

/**
Expand All @@ -1267,13 +1273,12 @@ export class ChangedInstanceIds {
* @note It is the responsibility of the caller to ensure that the provided id is, in fact a model.
* @note In most cases, this method does not need to be called. Its only for consumers to mimic changes as if they were found in a changeset, which should only be useful in certain cases such as the changing of filter criteria for a preexisting master branch relationship.
*/
public addCustomModelChange(
changeType: SqliteChangeOp,
id: Id64String
): void {
this.handleChange(this.model, changeType, id);
// Also add the model's modeledElement to the element changes. The modeledElement and model go hand in hand.
this.handleChange(this.element, changeType, id);
public addCustomModelChange(changeType: SqliteChangeOp, ids: Id64Arg): void {
for (const id of Id64.iterable(ids)) {
this.handleChange(this.model, changeType, id);
// Also add the model's modeledElement to the element changes. The modeledElement and model go hand in hand.
this.handleChange(this.element, changeType, id);
}
}

/**
Expand All @@ -1283,11 +1288,10 @@ export class ChangedInstanceIds {
* @note It is the responsibility of the caller to ensure that the provided id is, in fact an aspect.
* @note In most cases, this method does not need to be called. Its only for consumers to mimic changes as if they were found in a changeset, which should only be useful in certain cases such as the changing of filter criteria for a preexisting master branch relationship.
*/
public addCustomAspectChange(
changeType: SqliteChangeOp,
id: Id64String
): void {
this.handleChange(this.aspect, changeType, id);
public addCustomAspectChange(changeType: SqliteChangeOp, ids: Id64Arg): void {
for (const id of Id64.iterable(ids)) {
this.handleChange(this.aspect, changeType, id);
}
}

/**
Expand Down

0 comments on commit a0834ec

Please sign in to comment.