From a6788f111a65db9e980b340b2d7475ce75da4499 Mon Sep 17 00:00:00 2001 From: lihbr Date: Wed, 11 Sep 2024 23:05:11 +0200 Subject: [PATCH] refactor: rename `_prepare` to `_resolve` --- src/WriteClient.ts | 4 ++-- src/types/migration/Asset.ts | 10 +++++----- src/types/migration/ContentRelationship.ts | 2 +- src/types/migration/Document.ts | 4 ++-- src/types/migration/Field.ts | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/WriteClient.ts b/src/WriteClient.ts index 2dc6ac16..badf149f 100644 --- a/src/WriteClient.ts +++ b/src/WriteClient.ts @@ -579,7 +579,7 @@ export class WriteClient< migrationDocument.params.masterLanguageDocument, ) - await link._prepare({ documents }) + await link._resolve({ documents }) masterLanguageDocumentID = link._field?.id } else if (migrationDocument.document.alternate_languages) { masterLanguageDocumentID = @@ -655,7 +655,7 @@ export class WriteClient< }) const { id, uid } = documents.get(migrationDocument)! - await migrationDocument._prepare({ assets, documents }) + await migrationDocument._resolve({ assets, documents }) await this.updateDocument( id, diff --git a/src/types/migration/Asset.ts b/src/types/migration/Asset.ts index 1bf3d934..98b7bd17 100644 --- a/src/types/migration/Asset.ts +++ b/src/types/migration/Asset.ts @@ -144,7 +144,7 @@ export class MigrationImage extends MigrationAsset { this.#thumbnails[name] = thumbnail } - async _prepare({ + async _resolve({ assets, documents, }: { @@ -157,7 +157,7 @@ export class MigrationImage extends MigrationAsset { this._field = assetToImage(asset, this._initialField) for (const name in this.#thumbnails) { - await this.#thumbnails[name]._prepare({ assets, documents }) + await this.#thumbnails[name]._resolve({ assets, documents }) const thumbnail = this.#thumbnails[name]._field if (thumbnail) { @@ -171,7 +171,7 @@ export class MigrationImage extends MigrationAsset { export class MigrationLinkToMedia extends MigrationAsset< LinkToMediaField<"filled"> > { - _prepare({ assets }: { assets: AssetMap }): void { + _resolve({ assets }: { assets: AssetMap }): void { const asset = assets.get(this.config.id) if (asset) { @@ -197,7 +197,7 @@ export class MigrationRTImageNode extends MigrationAsset { | FilledLinkToWebField | undefined - async _prepare({ + async _resolve({ assets, documents, }: { @@ -207,7 +207,7 @@ export class MigrationRTImageNode extends MigrationAsset { const asset = assets.get(this.config.id) if (this.linkTo instanceof MigrationField) { - await this.linkTo._prepare({ assets, documents }) + await this.linkTo._resolve({ assets, documents }) } if (asset) { diff --git a/src/types/migration/ContentRelationship.ts b/src/types/migration/ContentRelationship.ts index f9c0eff3..6ada005a 100644 --- a/src/types/migration/ContentRelationship.ts +++ b/src/types/migration/ContentRelationship.ts @@ -29,7 +29,7 @@ export class MigrationContentRelationship extends MigrationField { + async _resolve({ documents }: { documents: DocumentMap }): Promise { const config = typeof this.unresolvedConfig === "function" ? await this.unresolvedConfig() diff --git a/src/types/migration/Document.ts b/src/types/migration/Document.ts index aa381c77..e18704cd 100644 --- a/src/types/migration/Document.ts +++ b/src/types/migration/Document.ts @@ -272,12 +272,12 @@ export class MigrationDocument< /** * @internal */ - async _prepare(args: { + async _resolve(args: { assets: AssetMap documents: DocumentMap }): Promise { for (const dependency of this.dependencies) { - await dependency._prepare(args) + await dependency._resolve(args) } } } diff --git a/src/types/migration/Field.ts b/src/types/migration/Field.ts index b70926a8..edf4618c 100644 --- a/src/types/migration/Field.ts +++ b/src/types/migration/Field.ts @@ -9,7 +9,7 @@ interface Preparable { /** * @internal */ - _prepare(args: { + _resolve(args: { assets: AssetMap documents: DocumentMap }): Promise | void @@ -41,7 +41,7 @@ export abstract class MigrationField< return this._field } - abstract _prepare(args: { + abstract _resolve(args: { assets: AssetMap documents: DocumentMap }): Promise | void