Skip to content

Commit

Permalink
remove deprecated for 3.x, 0.1.x, 0.1.0 (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
derbynn authored Aug 26, 2024
1 parent ff2c3ad commit 4053938
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 50 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "remove deprecated for 3.x, 0.1.x, 0.1.0",
"packageName": "@itwin/imodel-transformer",
"email": "Daniel.Erbynn@bentley.com",
"dependentChangeType": "patch"
}
25 changes: 7 additions & 18 deletions packages/transformer/src/IModelExporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import {
SqliteChangesetReader,
} from "@itwin/core-backend";
import {
AccessToken,
assert,
DbResult,
Id64String,
Expand Down Expand Up @@ -425,17 +424,7 @@ export class IModelExporter {
* @note the changedInstanceIds are just for this call to exportChanges, so you must continue to pass it in
* for consecutive calls
*/
public async exportChanges(args?: ExportChangesOptions): Promise<void>;
/** @deprecated in 0.1.x, use a single [[ExportChangesOptions]] object instead */
public async exportChanges(
accessToken?: AccessToken,
startChangesetId?: string,
args?: ExportChangesOptions
): Promise<void>;
public async exportChanges(
accessTokenOrOpts?: AccessToken | ExportChangesOptions,
startChangesetId?: string
): Promise<void> {
public async exportChanges(args?: ExportChangesOptions): Promise<void> {
if (!this.sourceDb.isBriefcaseDb())
throw new IModelError(
IModelStatus.BadRequest,
Expand All @@ -447,12 +436,12 @@ export class IModelExporter {
return;
}

const initOpts: ExporterInitOptions =
typeof accessTokenOrOpts === "object"
? accessTokenOrOpts
: {
startChangeset: { id: startChangesetId },
};
const startChangeset =
args && "startChangeset" in args ? args.startChangeset : undefined;

const initOpts: ExporterInitOptions = {
startChangeset: { id: startChangeset?.id },
};

await this.initialize(initOpts);
// _sourceDbChanges are initialized in this.initialize
Expand Down
28 changes: 1 addition & 27 deletions packages/transformer/src/IModelTransformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,11 +379,6 @@ type ChangeDataState =
| "no-changes"
| "unconnected";

/** Arguments you can pass to [[IModelTransformer.initExternalSourceAspects]]
* @deprecated in 0.1.0. Use [[InitOptions]] (and [[IModelTransformer.initialize]]) instead.
*/
export type InitFromExternalSourceAspectsArgs = InitOptions;

export interface RelationshipPropsForDelete {
id: Id64String;
classFullName: string;
Expand Down Expand Up @@ -1552,16 +1547,6 @@ export class IModelTransformer extends IModelExportHandler {
});
}

/**
* @deprecated in 3.x, this no longer has any effect except emitting a warning
*/
protected skipElement(_sourceElement: Element): void {
Logger.logWarning(
loggerCategory,
"Tried to defer/skip an element, which is no longer necessary"
);
}

/** Transform the specified sourceElement into ElementProps for the target iModel.
* @param sourceElement The Element from the source iModel to transform.
* @returns ElementProps for the target iModel.
Expand Down Expand Up @@ -2227,13 +2212,6 @@ export class IModelTransformer extends IModelExportHandler {
return targetModelProps;
}

/** Import elements that were deferred in a prior pass.
* @deprecated in 3.x. This method is no longer necessary since the transformer no longer needs to defer elements
*/
public async processDeferredElements(
_numRetries: number = 3
): Promise<void> {}

/** called at the end of a transformation,
* updates the target scope element to say that transformation up through the
* source's changeset has been performed. Also stores all changesets that occurred
Expand Down Expand Up @@ -2842,7 +2820,6 @@ export class IModelTransformer extends IModelExportHandler {
this.context.remapElement(sourceSubjectId, targetSubjectId);
await this.processChildElements(sourceSubjectId);
await this.processSubjectSubModels(sourceSubjectId);
return this.processDeferredElements(); // eslint-disable-line deprecation/deprecation
}

/** state to prevent reinitialization, @see [[initialize]] */
Expand Down Expand Up @@ -3283,7 +3260,6 @@ export class IModelTransformer extends IModelExportHandler {
await this.exporter.exportRelationships(
ElementRefersToElements.classFullName
);
await this.processDeferredElements(); // eslint-disable-line deprecation/deprecation
if (
this._options.forceExternalSourceAspectProvenance &&
this.shouldDetectDeletes()
Expand Down Expand Up @@ -3334,7 +3310,6 @@ export class IModelTransformer extends IModelExportHandler {
private async processChanges(options: ProcessChangesOptions): Promise<void> {
// must wait for initialization of synchronization provenance data
await this.exporter.exportChanges(this.getExportInitOpts(options));
await this.processDeferredElements(); // eslint-disable-line deprecation/deprecation

if (this._options.optimizeGeometry)
this.importer.optimizeGeometry(this._options.optimizeGeometry);
Expand Down Expand Up @@ -3469,8 +3444,7 @@ export class TemplateModelCloner extends IModelTransformer {

/** Cloning from a template requires this override of onTransformElement. */
public override onTransformElement(sourceElement: Element): ElementProps {
// eslint-disable-next-line deprecation/deprecation
const referenceIds = sourceElement.getReferenceConcreteIds();
const referenceIds = sourceElement.getReferenceIds();
referenceIds.forEach((referenceId) => {
// TODO: consider going through all definition elements at once and remapping them to themselves
if (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1137,7 +1137,6 @@ describe("IModelTransformer", () => {
await transformerS2C.processModel(definitionB);
await transformerS2C.processModel(physicalA);
await transformerS2C.processModel(physicalB);
await transformerS2C.processDeferredElements(); // eslint-disable-line deprecation/deprecation
await transformerS2C.processRelationships(
ElementRefersToElements.classFullName
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ describe("IModelTransformerHub", () => {
sourceExportFileName
);
sourceExporter.exporter["_resetChangeDataOnExport"] = false;
await sourceExporter.exportChanges(accessToken);
await sourceExporter.exportChanges({});
assert.isTrue(IModelJsFs.existsSync(sourceExportFileName));
const sourceDbChanges = (sourceExporter.exporter as any)
._sourceDbChanges; // access private member for testing purposes
Expand Down Expand Up @@ -285,7 +285,7 @@ describe("IModelTransformerHub", () => {
targetExportFileName
);
targetExporter.exporter["_resetChangeDataOnExport"] = false;
await targetExporter.exportChanges(accessToken);
await targetExporter.exportChanges({});
assert.isTrue(IModelJsFs.existsSync(targetExportFileName));
const targetDbChanges: any = (targetExporter.exporter as any)
._sourceDbChanges; // access private member for testing purposes
Expand Down Expand Up @@ -396,7 +396,7 @@ describe("IModelTransformerHub", () => {
sourceExportFileName
);
sourceExporter.exporter["_resetChangeDataOnExport"] = false;
await sourceExporter.exportChanges(accessToken);
await sourceExporter.exportChanges({});
assert.isTrue(IModelJsFs.existsSync(sourceExportFileName));
const sourceDbChanges: any = (sourceExporter.exporter as any)
._sourceDbChanges; // access private member for testing purposes
Expand Down Expand Up @@ -442,7 +442,7 @@ describe("IModelTransformerHub", () => {
targetExportFileName
);
targetExporter.exporter["_resetChangeDataOnExport"] = false;
await targetExporter.exportChanges(accessToken);
await targetExporter.exportChanges({});
assert.isTrue(IModelJsFs.existsSync(targetExportFileName));
const targetDbChanges: any = (targetExporter.exporter as any)
._sourceDbChanges; // access private member for testing purposes
Expand Down

0 comments on commit 4053938

Please sign in to comment.