diff --git a/src/Migration.ts b/src/Migration.ts index bbd78244..303ca967 100644 --- a/src/Migration.ts +++ b/src/Migration.ts @@ -1,4 +1,4 @@ -import { prepareMigrationRecord } from "./lib/prepareMigrationRecord" +import { prepareMigrationDocumentData } from "./lib/prepareMigrationDocumentData" import { validateAssetMetadata } from "./lib/validateAssetMetadata" import type { Asset } from "./types/api/asset/asset" @@ -6,10 +6,10 @@ import type { MigrationAssetConfig } from "./types/migration/Asset" import { MigrationImage } from "./types/migration/Asset" import type { UnresolvedMigrationContentRelationshipConfig } from "./types/migration/ContentRelationship" import { MigrationContentRelationship } from "./types/migration/ContentRelationship" -import { MigrationDocument } from "./types/migration/Document" +import { PrismicMigrationDocument } from "./types/migration/Document" import type { - MigrationDocumentParams, - MigrationDocumentValue, + ExistingPrismicDocument, + PendingPrismicDocument, } from "./types/migration/Document" import type { PrismicDocument } from "./types/value/document" import type { FilledImageFieldImage } from "./types/value/image" @@ -24,29 +24,20 @@ import type { FilledLinkToMediaField } from "./types/value/linkToMedia" * @typeParam TDocumentType - Type(s) to match `TDocuments` against. */ type ExtractDocumentType< - TDocuments extends PrismicDocument | MigrationDocumentValue, + TDocuments extends { type: string }, TDocumentType extends TDocuments["type"], > = Extract extends never ? TDocuments : Extract -/** - * The symbol used to index documents that are singletons. - */ -const SINGLE_INDEX = "__SINGLE__" - /** * A helper that allows preparing your migration to Prismic. * * @typeParam TDocuments - Document types that are registered for the Prismic * repository. Query methods will automatically be typed based on this type. */ -export class Migration< - TDocuments extends PrismicDocument = PrismicDocument, - TMigrationDocuments extends - MigrationDocumentValue = MigrationDocumentValue, -> { +export class Migration { /** * Assets registered in the migration. * @@ -59,16 +50,7 @@ export class Migration< * * @internal */ - _documents: MigrationDocument[] = [] - - /** - * A map indexing documents by their type and UID used for quick lookups by - * the {@link getByUID} and {@link getSingle} methods. - */ - #indexedDocuments: Record< - string, - Record> - > = {} + _documents: PrismicMigrationDocument[] = [] /** * Registers an asset to be created in the migration from an asset object. @@ -248,43 +230,33 @@ export class Migration< * registers it in your migration. The document will be created when the * migration is executed through the `writeClient.migrate()` method. * - * @typeParam TType - Type of Prismic documents to create. + * @typeParam TType - Type of the Prismic document to create. * * @param document - The document to create. - * @param documentTitle - The title of the document to create which will be - * displayed in the editor. - * @param params - Document master language document ID. + * @param title - The title of the document to create which will be displayed + * in the editor. + * @param options - Document master language document ID. * * @returns A migration document instance. */ - createDocument( - document: ExtractDocumentType, - documentTitle: string, - params: Omit = {}, - ): MigrationDocument> { - const { record: data, dependencies } = prepareMigrationRecord( - document.data, + createDocument( + document: ExtractDocumentType, TType>, + title: string, + options?: { + masterLanguageDocument?: MigrationContentRelationship + }, + ): PrismicMigrationDocument> { + const { record: data, dependencies } = prepareMigrationDocumentData( + document.data!, this.createAsset.bind(this), ) - const migrationDocument = new MigrationDocument( - { ...document, data }, - { - documentTitle, - ...params, - }, - dependencies, - ) + const migrationDocument = new PrismicMigrationDocument< + ExtractDocumentType + >({ ...document, data }, title, { ...options, dependencies }) this._documents.push(migrationDocument) - // Index document - if (!(document.type in this.#indexedDocuments)) { - this.#indexedDocuments[document.type] = {} - } - this.#indexedDocuments[document.type][document.uid || SINGLE_INDEX] = - migrationDocument - return migrationDocument } @@ -304,18 +276,63 @@ export class Migration< * * @returns A migration document instance. */ - updateDocument( - document: Omit, "id"> & { - id: string - }, - documentTitle: string, - ): MigrationDocument> { - const migrationDocument = this.createDocument( - document as ExtractDocumentType, - documentTitle, + updateDocument( + document: ExtractDocumentType, TType>, + title: string, + ): PrismicMigrationDocument> { + const { record: data, dependencies } = prepareMigrationDocumentData( + document.data, + this.createAsset.bind(this), ) - migrationDocument._mode = "update" + const migrationDocument = new PrismicMigrationDocument< + ExtractDocumentType + >({ ...document, data }, title, { dependencies }) + + this._documents.push(migrationDocument) + + return migrationDocument + } + + /** + * Registers a document to be created in the migration. + * + * @remarks + * This method does not create the document in Prismic right away. Instead it + * registers it in your migration. The document will be created when the + * migration is executed through the `writeClient.migrate()` method. + * + * @param document - The document to create. + * @param title - The title of the document to create which will be displayed + * in the editor. + * @param options - Document master language document ID. + * + * @returns A migration document instance. + */ + createDocumentFromPrismic( + document: ExtractDocumentType, TType>, + title: string, + ): PrismicMigrationDocument> { + const { record: data, dependencies } = prepareMigrationDocumentData( + document.data, + this.createAsset.bind(this), + ) + + const migrationDocument = new PrismicMigrationDocument( + { + type: document.type, + lang: document.lang, + uid: document.uid, + tags: document.tags, + data: data, + } as unknown as PendingPrismicDocument< + ExtractDocumentType + >, + title, + { originalPrismicDocument: document, dependencies }, + ) + + this._documents.push(migrationDocument) return migrationDocument } @@ -352,19 +369,25 @@ export class Migration< * * @typeParam TType - Type of the Prismic document returned. * - * @param documentType - The API ID of the document's custom type. + * @param type - The API ID of the document's custom type. * @param uid - The UID of the document. * * @returns The migration document instance with a UID matching the `uid` * parameter, if a matching document is found. */ - getByUID( - documentType: TType, + getByUID( + type: TType, uid: string, - ): MigrationDocument> | undefined { - return this.#indexedDocuments[documentType]?.[uid] as - | MigrationDocument - | undefined + ): + | PrismicMigrationDocument> + | undefined { + return this._documents.find( + ( + doc, + ): doc is PrismicMigrationDocument< + ExtractDocumentType + > => doc.document.type === type && doc.document.uid === uid, + ) } /** @@ -381,16 +404,54 @@ export class Migration< * * @typeParam TType - Type of the Prismic document returned. * - * @param documentType - The API ID of the singleton custom type. + * @param type - The API ID of the singleton custom type. * * @returns The migration document instance for the custom type, if a matching * document is found. */ - getSingle( - documentType: TType, - ): MigrationDocument> | undefined { - return this.#indexedDocuments[documentType]?.[SINGLE_INDEX] as - | MigrationDocument - | undefined + getSingle( + type: TType, + ): + | PrismicMigrationDocument> + | undefined { + return this._documents.find( + ( + doc, + ): doc is PrismicMigrationDocument< + ExtractDocumentType + > => doc.document.type === type, + ) } + + /** + * Queries a document from the migration instance for a specific original ID. + * + * @example + * + * ```ts + * const contentRelationship = migration.createContentRelationship(() => + * migration.getByOriginalID("YhdrDxIAACgAcp_b"), + * ) + * ``` + * + * @typeParam TType - Type of the Prismic document returned. + * + * @param id - The original ID of the Prismic document. + * + * @returns The migration document instance for the original ID, if a matching + * document is found. + */ + // getByOriginalID( + // id: string, + // ): + // | PrismicMigrationDocument> + // | undefined { + // return this._documents.find( + // ( + // doc, + // ): doc is PrismicMigrationDocument< + // ExtractDocumentType + // > => doc.originalPrismicDocument?.id === id, + // ) + // } } diff --git a/src/WriteClient.ts b/src/WriteClient.ts index 451b25f5..c46c6fd0 100644 --- a/src/WriteClient.ts +++ b/src/WriteClient.ts @@ -26,7 +26,8 @@ import type { AssetMap, MigrationAssetConfig } from "./types/migration/Asset" import type { DocumentMap, MigrationDocument, - MigrationDocumentValue, + PendingPrismicDocument, + PrismicMigrationDocument, } from "./types/migration/Document" import type { PrismicDocument } from "./types/value/document" @@ -115,13 +116,13 @@ type MigrateReporterEventMap = { current: number remaining: number total: number - document: MigrationDocument + document: PrismicMigrationDocument } "documents:creating": { current: number remaining: number total: number - document: MigrationDocument + document: PrismicMigrationDocument } "documents:created": { created: number @@ -131,7 +132,7 @@ type MigrateReporterEventMap = { current: number remaining: number total: number - document: MigrationDocument + document: PrismicMigrationDocument } "documents:updated": { updated: number @@ -517,12 +518,12 @@ export class WriteClient< documents.set(document.id, document) } - const sortedMigrationDocuments: MigrationDocument[] = [] + const sortedMigrationDocuments: PrismicMigrationDocument[] = [] // We create an array with non-master locale documents last because // we need their master locale document to be created first. for (const migrationDocument of migration._documents) { - if (migrationDocument.value.lang === masterLocale) { + if (migrationDocument.document.lang === masterLocale) { sortedMigrationDocuments.unshift(migrationDocument) } else { sortedMigrationDocuments.push(migrationDocument) @@ -531,24 +532,24 @@ export class WriteClient< let i = 0 let created = 0 - for (const document of sortedMigrationDocuments) { - if ( - document.value.id && - (document._mode === "update" || documents.has(document.value.id)) - ) { + for (const migrationDocument of sortedMigrationDocuments) { + if (migrationDocument.document.id) { reporter?.({ type: "documents:skipping", data: { - reason: "already exists", + reason: "exists", current: ++i, remaining: sortedMigrationDocuments.length - i, total: sortedMigrationDocuments.length, - document: document, + document: migrationDocument, }, }) // Index the migration document - documents.set(document, documents.get(document.value.id)!) + documents.set( + migrationDocument, + documents.get(migrationDocument.document.id)!, + ) } else { created++ reporter?.({ @@ -557,29 +558,28 @@ export class WriteClient< current: ++i, remaining: sortedMigrationDocuments.length - i, total: sortedMigrationDocuments.length, - document: document, + document: migrationDocument, }, }) // Resolve master language document ID for non-master locale documents let masterLanguageDocumentID: string | undefined - if (document.value.lang !== masterLocale) { - if (document.params.masterLanguageDocument) { - const link = document.params.masterLanguageDocument - - await link._resolve({ documents, assets: new Map() }) - masterLanguageDocumentID = link._field?.id - } else if (document.value.alternate_languages) { - masterLanguageDocumentID = document.value.alternate_languages.find( + if (migrationDocument.masterLanguageDocument) { + const link = migrationDocument.masterLanguageDocument + + await link._resolve({ documents, assets: new Map() }) + masterLanguageDocumentID = link._field?.id + } else if (migrationDocument.originalPrismicDocument) { + masterLanguageDocumentID = + migrationDocument.originalPrismicDocument.alternate_languages.find( ({ lang }) => lang === masterLocale, )?.id - } } const { id } = await this.createDocument( // We'll upload docuements data later on. - { ...document.value, data: {} }, - document.params.documentTitle, + { ...migrationDocument.document, data: {} }, + migrationDocument.title, { masterLanguageDocumentID, ...fetchParams, @@ -587,13 +587,13 @@ export class WriteClient< ) // Index old ID for Prismic to Prismic migration - if (document.value.id) { - documents.set(document.value.id, { - ...document.value, + if (migrationDocument.originalPrismicDocument) { + documents.set(migrationDocument.originalPrismicDocument.id, { + ...migrationDocument.document, id, }) } - documents.set(document, { ...document.value, id }) + documents.set(migrationDocument, { ...migrationDocument.document, id }) } } @@ -629,30 +629,25 @@ export class WriteClient< }: { reporter?: (event: MigrateReporterEvents) => void } & FetchParams = {}, ): Promise { let i = 0 - for (const document of migration._documents) { + for (const migrationDocument of migration._documents) { reporter?.({ type: "documents:updating", data: { current: ++i, remaining: migration._documents.length - i, total: migration._documents.length, - document: document, + document: migrationDocument, }, }) - const { id, uid } = documents.get(document)! - await document._resolve({ assets, documents }) + const { id } = documents.get(migrationDocument)! + await migrationDocument._resolve({ assets, documents }) await this.updateDocument( id, // We need to forward again document name and tags to update them // in case the document already existed during the previous step. - { - documentTitle: document.params.documentTitle, - uid, - tags: document.value.tags, - data: document.value.data, - }, + migrationDocument.document, fetchParams, ) } @@ -1032,7 +1027,7 @@ export class WriteClient< * @see Prismic Migration API technical reference: {@link https://prismic.io/docs/migration-api-technical-reference} */ private async createDocument( - document: MigrationDocumentValue>, + document: PendingPrismicDocument>, documentTitle: string, { masterLanguageDocumentID, @@ -1074,10 +1069,7 @@ export class WriteClient< */ private async updateDocument( id: string, - document: Pick< - MigrationDocumentValue>, - "uid" | "tags" | "data" - > & { + document: MigrationDocument> & { documentTitle?: string }, params?: FetchParams, diff --git a/src/index.ts b/src/index.ts index 68187114..6750f34a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -327,9 +327,10 @@ export type { // Migrations - Types representing Prismic Migration API content values. export type { - MigrationDocument, - MigrationDocumentValue, - RichTextFieldWithMigrationField, + PrismicMigrationDocument, + PendingPrismicDocument, + ExistingPrismicDocument, + InjectMigrationSpecificTypes, } from "./types/migration/Document" export type { diff --git a/src/lib/isValue.ts b/src/lib/isValue.ts index 805ac593..90b72cbc 100644 --- a/src/lib/isValue.ts +++ b/src/lib/isValue.ts @@ -1,13 +1,24 @@ -import type { - FieldWithMigrationField, - RichTextBlockNodeWithMigrationField, -} from "../types/migration/Document" +import type { InjectMigrationSpecificTypes } from "../types/migration/Document" import type { FilledContentRelationshipField } from "../types/value/contentRelationship" import type { PrismicDocument } from "../types/value/document" +import type { GroupField } from "../types/value/group" import type { ImageField } from "../types/value/image" import { LinkType } from "../types/value/link" import type { FilledLinkToMediaField } from "../types/value/linkToMedia" import { type RTImageNode, RichTextNodeType } from "../types/value/richText" +import type { SliceZone } from "../types/value/sliceZone" +import type { AnyRegularField } from "../types/value/types" + +/** + * Unknown value to check if it's a specific field type. + * + * @remarks + * Explicit types are added to help ensure narrowing is done effectively. + */ +type UnknownValue = + | PrismicDocument + | InjectMigrationSpecificTypes + | unknown /** * Checks if a value is a link to media field. @@ -20,11 +31,7 @@ import { type RTImageNode, RichTextNodeType } from "../types/value/richText" * This is not an official helper function and it's only designed to work with internal processes. */ export const linkToMedia = ( - value: - | PrismicDocument - | FieldWithMigrationField - | RichTextBlockNodeWithMigrationField - | unknown, + value: UnknownValue, ): value is FilledLinkToMediaField => { if (value && typeof value === "object" && !("version" in value)) { if ( @@ -36,6 +43,8 @@ export const linkToMedia = ( "url" in value && "size" in value ) { + value + return true } } @@ -54,11 +63,7 @@ export const linkToMedia = ( * This is not an official helper function and it's only designed to work with internal processes. */ const imageLike = ( - value: - | PrismicDocument - | FieldWithMigrationField - | RichTextBlockNodeWithMigrationField - | unknown, + value: UnknownValue, ): value is ImageField | RTImageNode => { if ( value && @@ -92,11 +97,7 @@ const imageLike = ( * This is not an official helper function and it's only designed to work with internal processes. */ export const image = ( - value: - | PrismicDocument - | FieldWithMigrationField - | RichTextBlockNodeWithMigrationField - | unknown, + value: UnknownValue, ): value is ImageField => { if ( imageLike(value) && @@ -120,13 +121,7 @@ export const image = ( * @internal * This is not an official helper function and it's only designed to work with internal processes. */ -export const rtImageNode = ( - value: - | PrismicDocument - | FieldWithMigrationField - | RichTextBlockNodeWithMigrationField - | unknown, -): value is RTImageNode => { +export const rtImageNode = (value: UnknownValue): value is RTImageNode => { if ( imageLike(value) && "type" in value && @@ -151,11 +146,7 @@ export const rtImageNode = ( * This is not an official helper function and it's only designed to work with internal processes. */ export const contentRelationship = ( - value: - | PrismicDocument - | FieldWithMigrationField - | RichTextBlockNodeWithMigrationField - | unknown, + value: UnknownValue, ): value is FilledContentRelationshipField => { if (value && typeof value === "object" && !("version" in value)) { if ( diff --git a/src/lib/prepareMigrationRecord.ts b/src/lib/prepareMigrationDocumentData.ts similarity index 91% rename from src/lib/prepareMigrationRecord.ts rename to src/lib/prepareMigrationDocumentData.ts index 64055503..4bfd01de 100644 --- a/src/lib/prepareMigrationRecord.ts +++ b/src/lib/prepareMigrationDocumentData.ts @@ -22,7 +22,10 @@ import * as is from "./isValue" * @returns An object containing the record with replaced assets and links and a * list of dependencies found and/or created. */ -export const prepareMigrationRecord = >( +export const prepareMigrationDocumentData = < + // eslint-disable-next-line @typescript-eslint/no-explicit-any + TRecord extends Record, +>( record: TRecord, onAsset: ( asset: FilledImageFieldImage | FilledLinkToMediaField, @@ -52,7 +55,7 @@ export const prepareMigrationRecord = >( if (field.linkTo) { // Node `linkTo` dependency is tracked internally - rtImageNode.linkTo = prepareMigrationRecord( + rtImageNode.linkTo = prepareMigrationDocumentData( { linkTo: field.linkTo }, onAsset, ).record.linkTo as @@ -103,7 +106,7 @@ export const prepareMigrationRecord = >( for (const item of field) { const { record, dependencies: itemDependencies } = - prepareMigrationRecord({ item }, onAsset) + prepareMigrationDocumentData({ item }, onAsset) array.push(record.item) dependencies.push(...itemDependencies) @@ -113,7 +116,7 @@ export const prepareMigrationRecord = >( } else if (field && typeof field === "object") { // Traverse objects const { record, dependencies: fieldDependencies } = - prepareMigrationRecord({ ...field }, onAsset) + prepareMigrationDocumentData({ ...field }, onAsset) dependencies.push(...fieldDependencies) result[key] = record diff --git a/src/types/migration/ContentRelationship.ts b/src/types/migration/ContentRelationship.ts index cc56c1ae..33abf26a 100644 --- a/src/types/migration/ContentRelationship.ts +++ b/src/types/migration/ContentRelationship.ts @@ -2,7 +2,7 @@ import type { FilledContentRelationshipField } from "../value/contentRelationshi import type { PrismicDocument } from "../value/document" import { LinkType } from "../value/link" -import type { MigrationDocument } from "./Document" +import type { PrismicMigrationDocument } from "./Document" import type { ResolveArgs } from "./Field" import { MigrationField } from "./Field" @@ -13,7 +13,7 @@ type MigrationContentRelationshipConfig< TDocuments extends PrismicDocument = PrismicDocument, > = | TDocuments - | MigrationDocument + | PrismicMigrationDocument | FilledContentRelationshipField | undefined diff --git a/src/types/migration/Document.ts b/src/types/migration/Document.ts index c109bcbe..54df4497 100644 --- a/src/types/migration/Document.ts +++ b/src/types/migration/Document.ts @@ -1,21 +1,8 @@ -import type { AnyRegularField } from "../value/types" - import type { FilledContentRelationshipField } from "../value/contentRelationship" -import type { PrismicDocument } from "../value/document" -import type { GroupField } from "../value/group" +import type { PrismicDocument, PrismicDocumentWithUID } from "../value/document" import type { FilledImageFieldImage } from "../value/image" import type { FilledLinkToMediaField } from "../value/linkToMedia" -import type { - RTBlockNode, - RTImageNode, - RTInlineNode, - RTLinkNode, - RTTextNode, - RichTextField, -} from "../value/richText" -import type { SharedSlice } from "../value/sharedSlice" -import type { Slice } from "../value/slice" -import type { SliceZone } from "../value/sliceZone" +import type { RTImageNode } from "../value/richText" import type { MigrationImage, @@ -26,261 +13,122 @@ import type { MigrationContentRelationship } from "./ContentRelationship" import type { MigrationField, ResolveArgs } from "./Field" /** - * A utility type that extends Rich text field node's spans with their migration - * node equivalent. - * - * @typeParam TRTNode - Rich text text node type to convert. - */ -type RichTextTextNodeWithMigrationField< - TRTNode extends RTTextNode = RTTextNode, -> = Omit & { - spans: ( - | RTInlineNode - | (Omit & { - data: MigrationLinkToMedia | MigrationContentRelationship - }) - )[] -} - -/** - * A utility type that extends a Rich text field node with their migration node - * equivalent. - * - * @typeParam TRTNode - Rich text block node type to convert. - */ -export type RichTextBlockNodeWithMigrationField< - TRTNode extends RTBlockNode = RTBlockNode, -> = TRTNode extends RTImageNode - ? RTImageNode | MigrationRTImageNode - : TRTNode extends RTTextNode - ? RichTextTextNodeWithMigrationField - : TRTNode - -/** - * A utility type that extends a Rich text field's nodes with their migration - * node equivalent. - * - * @typeParam TField - Rich text field type to convert. - */ -export type RichTextFieldWithMigrationField< - TField extends RichTextField = RichTextField, -> = { - [Index in keyof TField]: RichTextBlockNodeWithMigrationField -} - -/** - * A utility type that extends a regular field with their migration field - * equivalent. - * - * @typeParam TField - Regular field type to convert. - */ -type RegularFieldWithMigrationField< - TField extends AnyRegularField = AnyRegularField, -> = - | (TField extends FilledImageFieldImage - ? MigrationImage | undefined - : TField extends FilledLinkToMediaField - ? MigrationLinkToMedia | undefined - : TField extends FilledContentRelationshipField - ? MigrationContentRelationship | undefined - : TField extends RichTextField - ? RichTextFieldWithMigrationField - : never) - | TField - -/** - * A utility type that extends a group's fields with their migration fields - * equivalent. - * - * @typeParam TField - Group field type to convert. - */ -type GroupFieldWithMigrationField< - TField extends GroupField | Slice["items"] | SharedSlice["items"] = - | GroupField - | Slice["items"] - | SharedSlice["items"], -> = FieldsWithMigrationFields[] - -type SliceWithMigrationField< - TField extends Slice | SharedSlice = Slice | SharedSlice, -> = Omit & { - primary: FieldsWithMigrationFields - items: GroupFieldWithMigrationField -} - -/** - * A utility type that extends a SliceZone's slices fields with their migration + * A utility type that extends any fields in a record with their migration * fields equivalent. * - * @typeParam TField - Field type to convert. + * @typeParam T - Type of the record to extend. */ -type SliceZoneWithMigrationField = - SliceWithMigrationField[] +export type InjectMigrationSpecificTypes = T extends RTImageNode + ? T | MigrationRTImageNode | undefined + : T extends FilledImageFieldImage + ? T | MigrationImage | undefined + : T extends FilledLinkToMediaField + ? T | MigrationLinkToMedia | undefined + : T extends FilledContentRelationshipField + ? T | MigrationContentRelationship | undefined + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + T extends Record + ? { [P in keyof T]: InjectMigrationSpecificTypes } + : T extends Array + ? Array> + : T /** - * A utility type that extends any field with their migration field equivalent. - * - * @typeParam TField - Field type to convert. + * A utility type that ties the type and data of a Prismic document, creating a + * strict union. */ -export type FieldWithMigrationField< - TField extends AnyRegularField | GroupField | SliceZone = - | AnyRegularField - | GroupField - | SliceZone, -> = TField extends AnyRegularField - ? RegularFieldWithMigrationField - : TField extends GroupField - ? GroupFieldWithMigrationField - : TField extends SliceZone - ? SliceZoneWithMigrationField - : never +type TiedDocumentTypeAndData = + TDocument extends PrismicDocument + ? { + /** + * Type of the document. + */ + type: TType + + /** + * Data contained in the document. + */ + data: InjectMigrationSpecificTypes + } & (TDocument extends PrismicDocumentWithUID + ? Pick + : Partial>) + : never /** - * A utility type that extends a record of fields with their migration fields - * equivalent. + * A pending Prismic document to be created with the Migration API. * - * @typeParam TFields - Type of the record of Prismic fields. + * @typeParam TDocument - Type of the Prismic document. */ -export type FieldsWithMigrationFields< - TFields extends Record< - string, - AnyRegularField | GroupField | SliceZone - > = Record, -> = { - [Key in keyof TFields]: FieldWithMigrationField -} +export type PendingPrismicDocument< + TDocument extends PrismicDocument = PrismicDocument, +> = Pick & + Partial> & + TiedDocumentTypeAndData /** - * Makes the UID of {@link MigrationDocumentValue} optional on custom types - * without UID. TypeScript fails to infer correct types if done with a type - * intersection. + * An existing Prismic document to be updated with the Migration API. * - * @internal + * @typeParam TDocument - Type of the Prismic document. */ -type MakeUIDOptional = - TMigrationDocument["uid"] extends string - ? TMigrationDocument - : Omit & Partial> +export type ExistingPrismicDocument< + TDocument extends PrismicDocument = PrismicDocument, +> = Omit & + TiedDocumentTypeAndData /** - * A Prismic document value compatible with the Migration API. + * A Prismic document to be sent to the Migration API. * - * @see More details on the Migration API: {@link https://prismic.io/docs/migration-api-technical-reference} + * @typeParam TDocument - Type of the Prismic document. */ -export type MigrationDocumentValue< +export type MigrationDocument< TDocument extends PrismicDocument = PrismicDocument, -> = - TDocument extends PrismicDocument - ? MakeUIDOptional<{ - /** - * Type of the document. - */ - type: TType - - /** - * The unique identifier for the document. Guaranteed to be unique among - * all Prismic documents of the same type. - */ - uid: TDocument["uid"] - - /** - * Language of document. - */ - lang: TLang - - /** - * The identifier for the document. Used for compatibily with the - * content API. - * - * @internal - */ - // Made optional compared to the original type. - id?: TDocument["id"] - - /** - * Alternate language documents from Prismic content API. Used as a - * substitute to the `masterLanguageDocument` options when the latter is - * not available. - * - * @internal - */ - // Made optional compared to the original type. - alternate_languages?: TDocument["alternate_languages"] - - /** - * Tags associated with document. - */ - // Made optional compared to the original type. - tags?: TDocument["tags"] - - /** - * Data contained in the document. - */ - data: FieldsWithMigrationFields - }> - : never +> = PendingPrismicDocument | ExistingPrismicDocument /** - * Parameters used when creating a Prismic document with the Migration API. + * A Prismic migration document instance. * - * @see More details on the Migration API: {@link https://prismic.io/docs/migration-api-technical-reference} + * @typeParam TDocument - Type of the Prismic document. */ -export type MigrationDocumentParams = { +export class PrismicMigrationDocument< + TDocument extends PrismicDocument = PrismicDocument, +> { /** - * Name of the document displayed in the editor. + * The document to be sent to the Migration API. */ - documentTitle: string + document: MigrationDocument & Partial> /** - * A link to the master language document. + * The name of the document displayed in the editor. */ + title: string + // We're forced to inline `ContentRelationshipMigrationField` here, otherwise // it creates a circular reference to itself which makes TypeScript unhappy. // (but I think it's weird and it doesn't make sense :thinking:) masterLanguageDocument?: MigrationContentRelationship -} -/** - * A Prismic migration document instance. - * - * @see More details on the Migration API: {@link https://prismic.io/docs/migration-api-technical-reference} - */ -export class MigrationDocument< - TDocument extends PrismicDocument = PrismicDocument, -> { /** - * The document value to be sent to the Migration API. - */ - value: MigrationDocumentValue - - /** - * Parameters to create/update the document with on the Migration API. + * Original Prismic document when the migration document came from another + * Prismic repository. + * + * @remarks + * When migrating a document from another repository, one might want to alter + * it with migration specific types, hence accepting an + * `ExistingPrismicDocument` instead of a regular `PrismicDocument`. */ - params: MigrationDocumentParams + originalPrismicDocument?: ExistingPrismicDocument /** * Asset and content relationship fields that this document depends on. */ #dependencies: MigrationField[] - /** - * The mode to use when creating or updating the document. - * - * - `auto`: Automatically determines if the document should be created or - * updated on the document's existence on the repository's Document API. - * - `update`: Forces the document to only be updated. This is useful when the - * document only exists within the migration release which cannot be - * queried. - * - * @internal - */ - _mode: "auto" | "update" = "auto" - /** * Creates a Prismic migration document instance. * - * @param value - The document value to be sent to the Migration API. - * @param params - Parameters to create/update the document with on the + * @param document - The document to be sent to the Migration API. + * @param title - The name of the document displayed in the editor. + * @param options - Parameters to create/update the document with on the * Migration API. * @param dependencies - Asset and content relationship fields that this * document depends on. @@ -288,13 +136,19 @@ export class MigrationDocument< * @returns A Prismic migration document instance. */ constructor( - value: MigrationDocumentValue, - params: MigrationDocumentParams, - dependencies: MigrationField[] = [], + document: MigrationDocument, + title: string, + options: { + masterLanguageDocument?: MigrationContentRelationship + originalPrismicDocument?: ExistingPrismicDocument + dependencies: MigrationField[] + }, ) { - this.value = value - this.params = params - this.#dependencies = dependencies + this.document = document + this.title = title + this.masterLanguageDocument = options.masterLanguageDocument + this.originalPrismicDocument = options.originalPrismicDocument + this.#dependencies = options.dependencies } /** @@ -323,7 +177,6 @@ export class MigrationDocument< */ export type DocumentMap = Map< - string | MigrationDocument | MigrationDocument, - | PrismicDocument - | (Omit, "id"> & { id: string }) + string | PrismicMigrationDocument, + PrismicDocument | (MigrationDocument & Pick) > diff --git a/test/__snapshots__/writeClient-migrate-patch-contentRelationship.test.ts.snap b/test/__snapshots__/writeClient-migrate-patch-contentRelationship.test.ts.snap index 739bcda2..c15c15c2 100644 --- a/test/__snapshots__/writeClient-migrate-patch-contentRelationship.test.ts.snap +++ b/test/__snapshots__/writeClient-migrate-patch-contentRelationship.test.ts.snap @@ -12,7 +12,7 @@ exports[`patches link fields > brokenLink > shared slice 1`] = ` { "slices": [ { - "id": "2ff58c741ba", + "id": "b9dd0f2c3f8", "items": [ {}, ], @@ -22,9 +22,9 @@ exports[`patches link fields > brokenLink > shared slice 1`] = ` ], }, "slice_label": null, - "slice_type": "at", - "variation": "tortor", - "version": "a79b9dd", + "slice_type": "dignissim", + "variation": "vitae", + "version": "bfc9053", }, ], } @@ -34,13 +34,13 @@ exports[`patches link fields > brokenLink > slice 1`] = ` { "slices": [ { - "id": "e93cc3e4f28", + "id": "306297c5eda", "items": [ {}, ], "primary": {}, - "slice_label": "Pellentesque", - "slice_type": "nulla_posuere", + "slice_label": "Aliquet", + "slice_type": "vel", }, ], } @@ -69,7 +69,7 @@ exports[`patches link fields > existing > shared slice 1`] = ` { "slices": [ { - "id": "2ff58c741ba", + "id": "b9dd0f2c3f8", "items": [ { "field": { @@ -111,9 +111,9 @@ exports[`patches link fields > existing > shared slice 1`] = ` ], }, "slice_label": null, - "slice_type": "at", - "variation": "tortor", - "version": "a79b9dd", + "slice_type": "dignissim", + "variation": "vitae", + "version": "bfc9053", }, ], } @@ -123,7 +123,7 @@ exports[`patches link fields > existing > slice 1`] = ` { "slices": [ { - "id": "e93cc3e4f28", + "id": "306297c5eda", "items": [ { "field": { @@ -150,8 +150,8 @@ exports[`patches link fields > existing > slice 1`] = ` "type": "amet", }, }, - "slice_label": "Pellentesque", - "slice_type": "nulla_posuere", + "slice_label": "Aliquet", + "slice_type": "vel", }, ], } @@ -191,7 +191,7 @@ exports[`patches link fields > lazyExisting > shared slice 1`] = ` { "slices": [ { - "id": "2ff58c741ba", + "id": "b9dd0f2c3f8", "items": [ { "field": { @@ -233,9 +233,9 @@ exports[`patches link fields > lazyExisting > shared slice 1`] = ` ], }, "slice_label": null, - "slice_type": "at", - "variation": "tortor", - "version": "a79b9dd", + "slice_type": "dignissim", + "variation": "vitae", + "version": "bfc9053", }, ], } @@ -245,7 +245,7 @@ exports[`patches link fields > lazyExisting > slice 1`] = ` { "slices": [ { - "id": "e93cc3e4f28", + "id": "306297c5eda", "items": [ { "field": { @@ -272,8 +272,8 @@ exports[`patches link fields > lazyExisting > slice 1`] = ` "type": "amet", }, }, - "slice_label": "Pellentesque", - "slice_type": "nulla_posuere", + "slice_label": "Aliquet", + "slice_type": "vel", }, ], } @@ -297,7 +297,7 @@ exports[`patches link fields > lazyMigration > group 1`] = ` "group": [ { "field": { - "id": "id-migration", + "id": "id-other", "isBroken": false, "lang": "a", "link_type": "Document", @@ -316,11 +316,11 @@ exports[`patches link fields > lazyMigration > shared slice 1`] = ` { "slices": [ { - "id": "2ff58c741ba", + "id": "b9dd0f2c3f8", "items": [ { "field": { - "id": "id-migration", + "id": "id-other", "isBroken": false, "lang": "gravida", "link_type": "Document", @@ -332,7 +332,7 @@ exports[`patches link fields > lazyMigration > shared slice 1`] = ` ], "primary": { "field": { - "id": "id-migration", + "id": "id-other", "isBroken": false, "lang": "gravida", "link_type": "Document", @@ -343,7 +343,7 @@ exports[`patches link fields > lazyMigration > shared slice 1`] = ` "group": [ { "field": { - "id": "id-migration", + "id": "id-other", "isBroken": false, "lang": "gravida", "link_type": "Document", @@ -355,9 +355,9 @@ exports[`patches link fields > lazyMigration > shared slice 1`] = ` ], }, "slice_label": null, - "slice_type": "at", - "variation": "tortor", - "version": "a79b9dd", + "slice_type": "dignissim", + "variation": "vitae", + "version": "bfc9053", }, ], } @@ -367,11 +367,11 @@ exports[`patches link fields > lazyMigration > slice 1`] = ` { "slices": [ { - "id": "e93cc3e4f28", + "id": "306297c5eda", "items": [ { "field": { - "id": "id-migration", + "id": "id-other", "isBroken": false, "lang": "ultrices", "link_type": "Document", @@ -385,7 +385,7 @@ exports[`patches link fields > lazyMigration > slice 1`] = ` ], "primary": { "field": { - "id": "id-migration", + "id": "id-other", "isBroken": false, "lang": "ultrices", "link_type": "Document", @@ -396,8 +396,8 @@ exports[`patches link fields > lazyMigration > slice 1`] = ` "uid": "Amet dictum sit", }, }, - "slice_label": "Pellentesque", - "slice_type": "nulla_posuere", + "slice_label": "Aliquet", + "slice_type": "vel", }, ], } @@ -406,7 +406,7 @@ exports[`patches link fields > lazyMigration > slice 1`] = ` exports[`patches link fields > lazyMigration > static zone 1`] = ` { "field": { - "id": "id-migration", + "id": "id-other", "isBroken": false, "lang": "nisi,", "link_type": "Document", @@ -422,7 +422,7 @@ exports[`patches link fields > migration > group 1`] = ` "group": [ { "field": { - "id": "id-migration", + "id": "id-other", "isBroken": false, "lang": "a", "link_type": "Document", @@ -441,11 +441,11 @@ exports[`patches link fields > migration > shared slice 1`] = ` { "slices": [ { - "id": "2ff58c741ba", + "id": "b9dd0f2c3f8", "items": [ { "field": { - "id": "id-migration", + "id": "id-other", "isBroken": false, "lang": "gravida", "link_type": "Document", @@ -457,7 +457,7 @@ exports[`patches link fields > migration > shared slice 1`] = ` ], "primary": { "field": { - "id": "id-migration", + "id": "id-other", "isBroken": false, "lang": "gravida", "link_type": "Document", @@ -468,7 +468,7 @@ exports[`patches link fields > migration > shared slice 1`] = ` "group": [ { "field": { - "id": "id-migration", + "id": "id-other", "isBroken": false, "lang": "gravida", "link_type": "Document", @@ -480,9 +480,9 @@ exports[`patches link fields > migration > shared slice 1`] = ` ], }, "slice_label": null, - "slice_type": "at", - "variation": "tortor", - "version": "a79b9dd", + "slice_type": "dignissim", + "variation": "vitae", + "version": "bfc9053", }, ], } @@ -492,11 +492,11 @@ exports[`patches link fields > migration > slice 1`] = ` { "slices": [ { - "id": "e93cc3e4f28", + "id": "306297c5eda", "items": [ { "field": { - "id": "id-migration", + "id": "id-other", "isBroken": false, "lang": "ultrices", "link_type": "Document", @@ -510,7 +510,7 @@ exports[`patches link fields > migration > slice 1`] = ` ], "primary": { "field": { - "id": "id-migration", + "id": "id-other", "isBroken": false, "lang": "ultrices", "link_type": "Document", @@ -521,8 +521,8 @@ exports[`patches link fields > migration > slice 1`] = ` "uid": "Amet dictum sit", }, }, - "slice_label": "Pellentesque", - "slice_type": "nulla_posuere", + "slice_label": "Aliquet", + "slice_type": "vel", }, ], } @@ -531,7 +531,7 @@ exports[`patches link fields > migration > slice 1`] = ` exports[`patches link fields > migration > static zone 1`] = ` { "field": { - "id": "id-migration", + "id": "id-other", "isBroken": false, "lang": "nisi,", "link_type": "Document", @@ -547,7 +547,7 @@ exports[`patches link fields > migrationNoTags > group 1`] = ` "group": [ { "field": { - "id": "id-migration", + "id": "id-other", "isBroken": false, "lang": "a", "link_type": "Document", @@ -564,11 +564,11 @@ exports[`patches link fields > migrationNoTags > shared slice 1`] = ` { "slices": [ { - "id": "2ff58c741ba", + "id": "b9dd0f2c3f8", "items": [ { "field": { - "id": "id-migration", + "id": "id-other", "isBroken": false, "lang": "gravida", "link_type": "Document", @@ -580,7 +580,7 @@ exports[`patches link fields > migrationNoTags > shared slice 1`] = ` ], "primary": { "field": { - "id": "id-migration", + "id": "id-other", "isBroken": false, "lang": "gravida", "link_type": "Document", @@ -591,7 +591,7 @@ exports[`patches link fields > migrationNoTags > shared slice 1`] = ` "group": [ { "field": { - "id": "id-migration", + "id": "id-other", "isBroken": false, "lang": "gravida", "link_type": "Document", @@ -603,9 +603,9 @@ exports[`patches link fields > migrationNoTags > shared slice 1`] = ` ], }, "slice_label": null, - "slice_type": "at", - "variation": "tortor", - "version": "a79b9dd", + "slice_type": "dignissim", + "variation": "vitae", + "version": "bfc9053", }, ], } @@ -615,11 +615,11 @@ exports[`patches link fields > migrationNoTags > slice 1`] = ` { "slices": [ { - "id": "e93cc3e4f28", + "id": "306297c5eda", "items": [ { "field": { - "id": "id-migration", + "id": "id-other", "isBroken": false, "lang": "ultrices", "link_type": "Document", @@ -631,7 +631,7 @@ exports[`patches link fields > migrationNoTags > slice 1`] = ` ], "primary": { "field": { - "id": "id-migration", + "id": "id-other", "isBroken": false, "lang": "ultrices", "link_type": "Document", @@ -640,8 +640,8 @@ exports[`patches link fields > migrationNoTags > slice 1`] = ` "uid": "Amet dictum sit", }, }, - "slice_label": "Pellentesque", - "slice_type": "nulla_posuere", + "slice_label": "Aliquet", + "slice_type": "vel", }, ], } @@ -650,7 +650,7 @@ exports[`patches link fields > migrationNoTags > slice 1`] = ` exports[`patches link fields > migrationNoTags > static zone 1`] = ` { "field": { - "id": "id-migration", + "id": "id-other", "isBroken": false, "lang": "nisi,", "link_type": "Document", @@ -666,15 +666,13 @@ exports[`patches link fields > otherRepositoryContentRelationship > group 1`] = "group": [ { "field": { - "id": "id-migration", + "id": "id-other-repository", "isBroken": false, - "lang": "a", + "lang": "faucibus", "link_type": "Document", - "tags": [ - "Odio Eu", - ], - "type": "amet", - "uid": "Non sodales neque", + "tags": [], + "type": "lorem", + "uid": "Pharetra et ultrices", }, }, ], @@ -685,48 +683,54 @@ exports[`patches link fields > otherRepositoryContentRelationship > shared slice { "slices": [ { - "id": "2ff58c741ba", + "id": "b9dd0f2c3f8", "items": [ { "field": { - "id": "id-migration", + "id": "id-other-repository", "isBroken": false, - "lang": "gravida", + "lang": "eu", "link_type": "Document", - "tags": [], - "type": "leo", - "uid": "Blandit volutpat maecenas", + "tags": [ + "Pharetra", + ], + "type": "pellentesque", + "uid": "Volutpat ac tincidunt", }, }, ], "primary": { "field": { - "id": "id-migration", + "id": "id-other-repository", "isBroken": false, - "lang": "gravida", + "lang": "eu", "link_type": "Document", - "tags": [], - "type": "leo", - "uid": "Blandit volutpat maecenas", + "tags": [ + "Pharetra", + ], + "type": "pellentesque", + "uid": "Volutpat ac tincidunt", }, "group": [ { "field": { - "id": "id-migration", + "id": "id-other-repository", "isBroken": false, - "lang": "gravida", + "lang": "eu", "link_type": "Document", - "tags": [], - "type": "leo", - "uid": "Blandit volutpat maecenas", + "tags": [ + "Pharetra", + ], + "type": "pellentesque", + "uid": "Volutpat ac tincidunt", }, }, ], }, "slice_label": null, - "slice_type": "at", - "variation": "tortor", - "version": "a79b9dd", + "slice_type": "dignissim", + "variation": "vitae", + "version": "bfc9053", }, ], } @@ -736,37 +740,37 @@ exports[`patches link fields > otherRepositoryContentRelationship > slice 1`] = { "slices": [ { - "id": "e93cc3e4f28", + "id": "306297c5eda", "items": [ { "field": { - "id": "id-migration", + "id": "id-other-repository", "isBroken": false, - "lang": "ultrices", + "lang": "dignissim", "link_type": "Document", "tags": [ - "Ipsum Consequat", + "Arcu Vitae", ], - "type": "eget", - "uid": "Amet dictum sit", + "type": "a", + "uid": "Tristique senectus et", }, }, ], "primary": { "field": { - "id": "id-migration", + "id": "id-other-repository", "isBroken": false, - "lang": "ultrices", + "lang": "dignissim", "link_type": "Document", "tags": [ - "Ipsum Consequat", + "Arcu Vitae", ], - "type": "eget", - "uid": "Amet dictum sit", + "type": "a", + "uid": "Tristique senectus et", }, }, - "slice_label": "Pellentesque", - "slice_type": "nulla_posuere", + "slice_label": "Aliquet", + "slice_type": "vel", }, ], } @@ -775,13 +779,13 @@ exports[`patches link fields > otherRepositoryContentRelationship > slice 1`] = exports[`patches link fields > otherRepositoryContentRelationship > static zone 1`] = ` { "field": { - "id": "id-migration", + "id": "id-other-repository", "isBroken": false, - "lang": "nisi,", + "lang": "quam", "link_type": "Document", "tags": [], - "type": "eros", - "uid": "Scelerisque mauris pellentesque", + "type": "semper", + "uid": "Sed viverra ipsum", }, } `; @@ -825,7 +829,7 @@ exports[`patches link fields > richTextLinkNode > shared slice 1`] = ` { "slices": [ { - "id": "2ff58c741ba", + "id": "b9dd0f2c3f8", "items": [ { "field": [ @@ -921,9 +925,9 @@ exports[`patches link fields > richTextLinkNode > shared slice 1`] = ` ], }, "slice_label": null, - "slice_type": "at", - "variation": "tortor", - "version": "a79b9dd", + "slice_type": "dignissim", + "variation": "vitae", + "version": "bfc9053", }, ], } @@ -933,7 +937,7 @@ exports[`patches link fields > richTextLinkNode > slice 1`] = ` { "slices": [ { - "id": "e93cc3e4f28", + "id": "306297c5eda", "items": [ { "field": [ @@ -996,8 +1000,8 @@ exports[`patches link fields > richTextLinkNode > slice 1`] = ` }, ], }, - "slice_label": "Pellentesque", - "slice_type": "nulla_posuere", + "slice_label": "Aliquet", + "slice_type": "vel", }, ], } diff --git a/test/__snapshots__/writeClient-migrate-patch-image.test.ts.snap b/test/__snapshots__/writeClient-migrate-patch-image.test.ts.snap index 1a477d27..98f4ebb3 100644 --- a/test/__snapshots__/writeClient-migrate-patch-image.test.ts.snap +++ b/test/__snapshots__/writeClient-migrate-patch-image.test.ts.snap @@ -18,7 +18,7 @@ exports[`patches image fields > existing > group 1`] = ` "zoom": 1, }, "id": "id-existing", - "url": "https://images.unsplash.com/photo-1497436072909-60f360e1d4b1?w=2560&h=1440&fit=crop", + "url": "https://images.unsplash.com/reserve/HgZuGu3gSD6db21T3lxm_San%20Zenone.jpg?w=6373&h=4253&fit=crop", }, }, ], @@ -29,7 +29,7 @@ exports[`patches image fields > existing > shared slice 1`] = ` { "slices": [ { - "id": "2ff58c741ba", + "id": "b9dd0f2c3f8", "items": [ { "field": { @@ -46,7 +46,7 @@ exports[`patches image fields > existing > shared slice 1`] = ` "zoom": 1, }, "id": "id-existing", - "url": "https://images.unsplash.com/photo-1604537466608-109fa2f16c3b?w=4240&h=2832&fit=crop", + "url": "https://images.unsplash.com/photo-1426604966848-d7adac402bff?w=5616&h=3744&fit=crop", }, }, ], @@ -65,7 +65,7 @@ exports[`patches image fields > existing > shared slice 1`] = ` "zoom": 1, }, "id": "id-existing", - "url": "https://images.unsplash.com/photo-1604537466608-109fa2f16c3b?w=4240&h=2832&fit=crop", + "url": "https://images.unsplash.com/photo-1426604966848-d7adac402bff?w=5616&h=3744&fit=crop", }, "group": [ { @@ -83,15 +83,15 @@ exports[`patches image fields > existing > shared slice 1`] = ` "zoom": 1, }, "id": "id-existing", - "url": "https://images.unsplash.com/photo-1604537466608-109fa2f16c3b?w=4240&h=2832&fit=crop", + "url": "https://images.unsplash.com/photo-1426604966848-d7adac402bff?w=5616&h=3744&fit=crop", }, }, ], }, "slice_label": null, - "slice_type": "at", - "variation": "tortor", - "version": "a79b9dd", + "slice_type": "dignissim", + "variation": "vitae", + "version": "bfc9053", }, ], } @@ -101,7 +101,7 @@ exports[`patches image fields > existing > slice 1`] = ` { "slices": [ { - "id": "e93cc3e4f28", + "id": "306297c5eda", "items": [ { "field": { @@ -140,8 +140,8 @@ exports[`patches image fields > existing > slice 1`] = ` "url": "https://images.unsplash.com/photo-1604537529428-15bcbeecfe4d?w=4240&h=2832&fit=crop", }, }, - "slice_label": "Pellentesque", - "slice_type": "nulla_posuere", + "slice_label": "Aliquet", + "slice_type": "vel", }, ], } @@ -163,7 +163,7 @@ exports[`patches image fields > existing > static zone 1`] = ` "zoom": 1, }, "id": "id-existing", - "url": "https://images.unsplash.com/photo-1553531384-397c80973a0b?w=4335&h=6502&fit=crop", + "url": "https://images.unsplash.com/photo-1587502537745-84b86da1204f?w=6550&h=4367&fit=crop", }, } `; @@ -185,8 +185,8 @@ exports[`patches image fields > new > group 1`] = ` "y": 0, "zoom": 1, }, - "id": "ef95d5daa4d", - "url": "https://images.unsplash.com/photo-1441974231531-c6227db76b6e?w=2560&h=1705&fit=crop", + "id": "dfdd322ca9d", + "url": "https://images.unsplash.com/reserve/HgZuGu3gSD6db21T3lxm_San%20Zenone.jpg?w=6373&h=4253&fit=crop", }, }, ], @@ -197,7 +197,7 @@ exports[`patches image fields > new > shared slice 1`] = ` { "slices": [ { - "id": "2ff58c741ba", + "id": "b9dd0f2c3f8", "items": [ { "field": { @@ -213,8 +213,8 @@ exports[`patches image fields > new > shared slice 1`] = ` "y": 0, "zoom": 1, }, - "id": "f2c3f8bfc90", - "url": "https://images.unsplash.com/photo-1604537529428-15bcbeecfe4d?w=4240&h=2832&fit=crop", + "id": "0eddbd0255b", + "url": "https://images.unsplash.com/reserve/HgZuGu3gSD6db21T3lxm_San%20Zenone.jpg?w=6373&h=4253&fit=crop", }, }, ], @@ -232,8 +232,8 @@ exports[`patches image fields > new > shared slice 1`] = ` "y": 0, "zoom": 1, }, - "id": "f2c3f8bfc90", - "url": "https://images.unsplash.com/photo-1604537529428-15bcbeecfe4d?w=4240&h=2832&fit=crop", + "id": "0eddbd0255b", + "url": "https://images.unsplash.com/reserve/HgZuGu3gSD6db21T3lxm_San%20Zenone.jpg?w=6373&h=4253&fit=crop", }, "group": [ { @@ -250,16 +250,16 @@ exports[`patches image fields > new > shared slice 1`] = ` "y": 0, "zoom": 1, }, - "id": "f2c3f8bfc90", - "url": "https://images.unsplash.com/photo-1604537529428-15bcbeecfe4d?w=4240&h=2832&fit=crop", + "id": "0eddbd0255b", + "url": "https://images.unsplash.com/reserve/HgZuGu3gSD6db21T3lxm_San%20Zenone.jpg?w=6373&h=4253&fit=crop", }, }, ], }, "slice_label": null, - "slice_type": "at", - "variation": "tortor", - "version": "a79b9dd", + "slice_type": "dignissim", + "variation": "vitae", + "version": "bfc9053", }, ], } @@ -269,7 +269,7 @@ exports[`patches image fields > new > slice 1`] = ` { "slices": [ { - "id": "e93cc3e4f28", + "id": "306297c5eda", "items": [ { "field": { @@ -285,8 +285,8 @@ exports[`patches image fields > new > slice 1`] = ` "y": 0, "zoom": 1, }, - "id": "45306297c5e", - "url": "https://images.unsplash.com/photo-1604537466608-109fa2f16c3b?w=4240&h=2832&fit=crop", + "id": "2beb55ec2f4", + "url": "https://images.unsplash.com/photo-1444464666168-49d633b86797?w=4844&h=3234&fit=crop", }, }, ], @@ -304,12 +304,12 @@ exports[`patches image fields > new > slice 1`] = ` "y": 0, "zoom": 1, }, - "id": "45306297c5e", - "url": "https://images.unsplash.com/photo-1604537466608-109fa2f16c3b?w=4240&h=2832&fit=crop", + "id": "2beb55ec2f4", + "url": "https://images.unsplash.com/photo-1444464666168-49d633b86797?w=4844&h=3234&fit=crop", }, }, - "slice_label": "Pellentesque", - "slice_type": "nulla_posuere", + "slice_label": "Aliquet", + "slice_type": "vel", }, ], } @@ -330,8 +330,8 @@ exports[`patches image fields > new > static zone 1`] = ` "y": 0, "zoom": 1, }, - "id": "c5c95f8d3ac", - "url": "https://images.unsplash.com/photo-1604537466608-109fa2f16c3b?w=4240&h=2832&fit=crop", + "id": "bbad670dad7", + "url": "https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05?w=7372&h=4392&fit=crop", }, } `; @@ -341,20 +341,20 @@ exports[`patches image fields > otherRepository > group 1`] = ` "group": [ { "field": { - "alt": "Odio ut enim blandit volutpat maecenas volutpat blandit", + "alt": "Massa id neque aliquam vestibulum morbi blandit cursus risus", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#fdb338", - "x": 349, - "y": 115, - "zoom": 1.5951464943576479, + "background": "#cfc26f", + "x": -2885, + "y": -2419, + "zoom": 1.7509753524211642, }, - "id": "4dcf07cfc26", - "url": "https://images.unsplash.com/photo-1553531384-397c80973a0b", + "id": "8d0985c0990", + "url": "https://images.unsplash.com/photo-1446329813274-7c9036bd9a1f", }, }, ], @@ -365,69 +365,69 @@ exports[`patches image fields > otherRepository > shared slice 1`] = ` { "slices": [ { - "id": "2ff58c741ba", + "id": "b9dd0f2c3f8", "items": [ { "field": { - "alt": "Vitae et leo duis ut diam quam nulla porttitor massa id neque aliquam vestibulum", + "alt": "Fermentum odio eu feugiat pretium nibh ipsum consequat", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#61adcf", - "x": -1586, - "y": -2819, - "zoom": 1.9393723758262054, + "background": "#9ed252", + "x": -1720, + "y": -191, + "zoom": 1.6165685319845957, }, - "id": "f5dbf0d9ed2", - "url": "https://images.unsplash.com/photo-1441974231531-c6227db76b6e", + "id": "35eaa8ebee4", + "url": "https://images.unsplash.com/photo-1418065460487-3e41a6c84dc5", }, }, ], "primary": { "field": { - "alt": "Ut consequat semper viverra nam libero justo laoreet", + "alt": "Pellentesque pulvinar pellentesque habitant morbi tristique senectus et netus et malesuada fames ac", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#8efd5a", - "x": 466, - "y": -571, - "zoom": 1.394663850868741, + "background": "#4f4f59", + "x": 3094, + "y": -2976, + "zoom": 1.0855120641844143, }, - "id": "f5dbf0d9ed2", - "url": "https://images.unsplash.com/photo-1441974231531-c6227db76b6e", + "id": "35eaa8ebee4", + "url": "https://images.unsplash.com/photo-1418065460487-3e41a6c84dc5", }, "group": [ { "field": { - "alt": "Porttitor massa id neque aliquam vestibulum morbi blandit", + "alt": "Id aliquet risus feugiat in", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#bc3178", - "x": 1156, - "y": -2223, - "zoom": 1.602826201962965, + "background": "#42f5cf", + "x": 427, + "y": 731, + "zoom": 1.6417661415510265, }, - "id": "f5dbf0d9ed2", - "url": "https://images.unsplash.com/photo-1441974231531-c6227db76b6e", + "id": "35eaa8ebee4", + "url": "https://images.unsplash.com/photo-1418065460487-3e41a6c84dc5", }, }, ], }, "slice_label": null, - "slice_type": "at", - "variation": "tortor", - "version": "a79b9dd", + "slice_type": "dignissim", + "variation": "vitae", + "version": "bfc9053", }, ], } @@ -437,47 +437,47 @@ exports[`patches image fields > otherRepository > slice 1`] = ` { "slices": [ { - "id": "e93cc3e4f28", + "id": "306297c5eda", "items": [ { "field": { - "alt": "Vitae sapien pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis", + "alt": "Pellentesque nec nam aliquam sem", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#c361cc", - "x": -751, - "y": -404, - "zoom": 1.6465649620272602, + "background": "#f72dec", + "x": 2027, + "y": 7, + "zoom": 1.9216652845315787, }, - "id": "4f4a69ff72d", - "url": "https://images.unsplash.com/photo-1470770903676-69b98201ea1c", + "id": "7a35bc5aa2f", + "url": "https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05", }, }, ], "primary": { "field": { - "alt": "Nunc pulvinar sapien et ligula ullamcorper malesuada proin libero nunc consequat interdum varius sit", + "alt": "Quam nulla porttitor massa id neque aliquam vestibulum morbi blandit", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#55e3be", - "x": -762, - "y": 991, - "zoom": 1.0207384987782544, + "background": "#60cbac", + "x": -484, + "y": -2038, + "zoom": 1.8400009569805118, }, - "id": "4f4a69ff72d", - "url": "https://images.unsplash.com/photo-1470770903676-69b98201ea1c", + "id": "7a35bc5aa2f", + "url": "https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05", }, }, - "slice_label": "Pellentesque", - "slice_type": "nulla_posuere", + "slice_label": "Aliquet", + "slice_type": "vel", }, ], } @@ -486,20 +486,20 @@ exports[`patches image fields > otherRepository > slice 1`] = ` exports[`patches image fields > otherRepository > static zone 1`] = ` { "field": { - "alt": "Vulputate sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur vitae nunc sed", + "alt": "Gravida rutrum quisque non tellus orci", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#97acc6", - "x": 1922, - "y": -967, - "zoom": 1.9765406541937358, + "background": "#b1d17b", + "x": 3291, + "y": -730, + "zoom": 1.061566393836766, }, - "id": "9abffab1d17", - "url": "https://images.unsplash.com/photo-1446329813274-7c9036bd9a1f", + "id": "4a95cc61c37", + "url": "https://images.unsplash.com/photo-1604537529428-15bcbeecfe4d", }, } `; @@ -524,7 +524,7 @@ exports[`patches image fields > otherRepositoryEmpty > shared slice 1`] = ` { "slices": [ { - "id": "2ff58c741ba", + "id": "b9dd0f2c3f8", "items": [ { "field": { @@ -557,9 +557,9 @@ exports[`patches image fields > otherRepositoryEmpty > shared slice 1`] = ` ], }, "slice_label": null, - "slice_type": "at", - "variation": "tortor", - "version": "a79b9dd", + "slice_type": "dignissim", + "variation": "vitae", + "version": "bfc9053", }, ], } @@ -569,7 +569,7 @@ exports[`patches image fields > otherRepositoryEmpty > slice 1`] = ` { "slices": [ { - "id": "e93cc3e4f28", + "id": "306297c5eda", "items": [ { "field": { @@ -590,8 +590,8 @@ exports[`patches image fields > otherRepositoryEmpty > slice 1`] = ` "url": null, }, }, - "slice_label": "Pellentesque", - "slice_type": "nulla_posuere", + "slice_label": "Aliquet", + "slice_type": "vel", }, ], } @@ -614,36 +614,36 @@ exports[`patches image fields > otherRepositoryWithThumbnails > group 1`] = ` "group": [ { "field": { - "alt": "Odio ut enim blandit volutpat maecenas volutpat blandit", + "alt": "Massa id neque aliquam vestibulum morbi blandit cursus risus", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#fdb338", - "x": 349, - "y": 115, - "zoom": 1.5951464943576479, + "background": "#cfc26f", + "x": -2885, + "y": -2419, + "zoom": 1.7509753524211642, }, - "id": "4dcf07cfc26", + "id": "8d0985c0990", "square": { - "alt": "Odio ut enim blandit volutpat maecenas volutpat blandit", + "alt": "Massa id neque aliquam vestibulum morbi blandit cursus risus", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#fdb338", - "x": 349, - "y": 115, - "zoom": 1.5951464943576479, + "background": "#cfc26f", + "x": -2885, + "y": -2419, + "zoom": 1.7509753524211642, }, - "id": "4dcf07cfc26", - "url": "https://images.unsplash.com/photo-1553531384-397c80973a0b?some=other&query=params", + "id": "8d0985c0990", + "url": "https://images.unsplash.com/photo-1446329813274-7c9036bd9a1f?some=other&query=params", }, - "url": "https://images.unsplash.com/photo-1553531384-397c80973a0b?some=query", + "url": "https://images.unsplash.com/photo-1446329813274-7c9036bd9a1f?some=query", }, }, ], @@ -654,117 +654,117 @@ exports[`patches image fields > otherRepositoryWithThumbnails > shared slice 1`] { "slices": [ { - "id": "2ff58c741ba", + "id": "b9dd0f2c3f8", "items": [ { "field": { - "alt": "Vitae et leo duis ut diam quam nulla porttitor massa id neque aliquam vestibulum", + "alt": "Fermentum odio eu feugiat pretium nibh ipsum consequat", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#61adcf", - "x": -1586, - "y": -2819, - "zoom": 1.9393723758262054, + "background": "#9ed252", + "x": -1720, + "y": -191, + "zoom": 1.6165685319845957, }, - "id": "f5dbf0d9ed2", + "id": "35eaa8ebee4", "square": { - "alt": "Vitae et leo duis ut diam quam nulla porttitor massa id neque aliquam vestibulum", + "alt": "Fermentum odio eu feugiat pretium nibh ipsum consequat", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#61adcf", - "x": -1586, - "y": -2819, - "zoom": 1.9393723758262054, + "background": "#9ed252", + "x": -1720, + "y": -191, + "zoom": 1.6165685319845957, }, - "id": "f5dbf0d9ed2", - "url": "https://images.unsplash.com/photo-1441974231531-c6227db76b6e?some=other&query=params", + "id": "35eaa8ebee4", + "url": "https://images.unsplash.com/photo-1418065460487-3e41a6c84dc5?some=other&query=params", }, - "url": "https://images.unsplash.com/photo-1441974231531-c6227db76b6e?some=query", + "url": "https://images.unsplash.com/photo-1418065460487-3e41a6c84dc5?some=query", }, }, ], "primary": { "field": { - "alt": "Ut consequat semper viverra nam libero justo laoreet", + "alt": "Pellentesque pulvinar pellentesque habitant morbi tristique senectus et netus et malesuada fames ac", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#8efd5a", - "x": 466, - "y": -571, - "zoom": 1.394663850868741, + "background": "#4f4f59", + "x": 3094, + "y": -2976, + "zoom": 1.0855120641844143, }, - "id": "f5dbf0d9ed2", + "id": "35eaa8ebee4", "square": { - "alt": "Ut consequat semper viverra nam libero justo laoreet", + "alt": "Pellentesque pulvinar pellentesque habitant morbi tristique senectus et netus et malesuada fames ac", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#8efd5a", - "x": 466, - "y": -571, - "zoom": 1.394663850868741, + "background": "#4f4f59", + "x": 3094, + "y": -2976, + "zoom": 1.0855120641844143, }, - "id": "f5dbf0d9ed2", - "url": "https://images.unsplash.com/photo-1441974231531-c6227db76b6e?some=other&query=params", + "id": "35eaa8ebee4", + "url": "https://images.unsplash.com/photo-1418065460487-3e41a6c84dc5?some=other&query=params", }, - "url": "https://images.unsplash.com/photo-1441974231531-c6227db76b6e?some=query", + "url": "https://images.unsplash.com/photo-1418065460487-3e41a6c84dc5?some=query", }, "group": [ { "field": { - "alt": "Porttitor massa id neque aliquam vestibulum morbi blandit", + "alt": "Id aliquet risus feugiat in", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#bc3178", - "x": 1156, - "y": -2223, - "zoom": 1.602826201962965, + "background": "#42f5cf", + "x": 427, + "y": 731, + "zoom": 1.6417661415510265, }, - "id": "f5dbf0d9ed2", + "id": "35eaa8ebee4", "square": { - "alt": "Porttitor massa id neque aliquam vestibulum morbi blandit", + "alt": "Id aliquet risus feugiat in", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#bc3178", - "x": 1156, - "y": -2223, - "zoom": 1.602826201962965, + "background": "#42f5cf", + "x": 427, + "y": 731, + "zoom": 1.6417661415510265, }, - "id": "f5dbf0d9ed2", - "url": "https://images.unsplash.com/photo-1441974231531-c6227db76b6e?some=other&query=params", + "id": "35eaa8ebee4", + "url": "https://images.unsplash.com/photo-1418065460487-3e41a6c84dc5?some=other&query=params", }, - "url": "https://images.unsplash.com/photo-1441974231531-c6227db76b6e?some=query", + "url": "https://images.unsplash.com/photo-1418065460487-3e41a6c84dc5?some=query", }, }, ], }, "slice_label": null, - "slice_type": "at", - "variation": "tortor", - "version": "a79b9dd", + "slice_type": "dignissim", + "variation": "vitae", + "version": "bfc9053", }, ], } @@ -774,79 +774,79 @@ exports[`patches image fields > otherRepositoryWithThumbnails > slice 1`] = ` { "slices": [ { - "id": "e93cc3e4f28", + "id": "306297c5eda", "items": [ { "field": { - "alt": "Vitae sapien pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis", + "alt": "Pellentesque nec nam aliquam sem", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#c361cc", - "x": -751, - "y": -404, - "zoom": 1.6465649620272602, + "background": "#f72dec", + "x": 2027, + "y": 7, + "zoom": 1.9216652845315787, }, - "id": "4f4a69ff72d", + "id": "7a35bc5aa2f", "square": { - "alt": "Vitae sapien pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis", + "alt": "Pellentesque nec nam aliquam sem", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#c361cc", - "x": -751, - "y": -404, - "zoom": 1.6465649620272602, + "background": "#f72dec", + "x": 2027, + "y": 7, + "zoom": 1.9216652845315787, }, - "id": "4f4a69ff72d", - "url": "https://images.unsplash.com/photo-1470770903676-69b98201ea1c?some=other&query=params", + "id": "7a35bc5aa2f", + "url": "https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05?some=other&query=params", }, - "url": "https://images.unsplash.com/photo-1470770903676-69b98201ea1c?some=query", + "url": "https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05?some=query", }, }, ], "primary": { "field": { - "alt": "Nunc pulvinar sapien et ligula ullamcorper malesuada proin libero nunc consequat interdum varius sit", + "alt": "Quam nulla porttitor massa id neque aliquam vestibulum morbi blandit", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#55e3be", - "x": -762, - "y": 991, - "zoom": 1.0207384987782544, + "background": "#60cbac", + "x": -484, + "y": -2038, + "zoom": 1.8400009569805118, }, - "id": "4f4a69ff72d", + "id": "7a35bc5aa2f", "square": { - "alt": "Nunc pulvinar sapien et ligula ullamcorper malesuada proin libero nunc consequat interdum varius sit", + "alt": "Quam nulla porttitor massa id neque aliquam vestibulum morbi blandit", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#55e3be", - "x": -762, - "y": 991, - "zoom": 1.0207384987782544, + "background": "#60cbac", + "x": -484, + "y": -2038, + "zoom": 1.8400009569805118, }, - "id": "4f4a69ff72d", - "url": "https://images.unsplash.com/photo-1470770903676-69b98201ea1c?some=other&query=params", + "id": "7a35bc5aa2f", + "url": "https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05?some=other&query=params", }, - "url": "https://images.unsplash.com/photo-1470770903676-69b98201ea1c?some=query", + "url": "https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05?some=query", }, }, - "slice_label": "Pellentesque", - "slice_type": "nulla_posuere", + "slice_label": "Aliquet", + "slice_type": "vel", }, ], } @@ -855,36 +855,36 @@ exports[`patches image fields > otherRepositoryWithThumbnails > slice 1`] = ` exports[`patches image fields > otherRepositoryWithThumbnails > static zone 1`] = ` { "field": { - "alt": "Vulputate sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur vitae nunc sed", + "alt": "Gravida rutrum quisque non tellus orci", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#97acc6", - "x": 1922, - "y": -967, - "zoom": 1.9765406541937358, + "background": "#b1d17b", + "x": 3291, + "y": -730, + "zoom": 1.061566393836766, }, - "id": "9abffab1d17", + "id": "4a95cc61c37", "square": { - "alt": "Vulputate sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur vitae nunc sed", + "alt": "Gravida rutrum quisque non tellus orci", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#97acc6", - "x": 1922, - "y": -967, - "zoom": 1.9765406541937358, + "background": "#b1d17b", + "x": 3291, + "y": -730, + "zoom": 1.061566393836766, }, - "id": "9abffab1d17", - "url": "https://images.unsplash.com/photo-1446329813274-7c9036bd9a1f?some=other&query=params", + "id": "4a95cc61c37", + "url": "https://images.unsplash.com/photo-1604537529428-15bcbeecfe4d?some=other&query=params", }, - "url": "https://images.unsplash.com/photo-1446329813274-7c9036bd9a1f?some=query", + "url": "https://images.unsplash.com/photo-1604537529428-15bcbeecfe4d?some=query", }, } `; @@ -901,12 +901,12 @@ exports[`patches image fields > otherRepositoryWithThumbnailsNoAlt > group 1`] = "width": 1, }, "edit": { - "background": "#fdb338", - "x": 349, - "y": 115, - "zoom": 1.5951464943576479, + "background": "#cfc26f", + "x": -2885, + "y": -2419, + "zoom": 1.7509753524211642, }, - "id": "4dcf07cfc26", + "id": "8d0985c0990", "square": { "alt": null, "copyright": null, @@ -915,15 +915,15 @@ exports[`patches image fields > otherRepositoryWithThumbnailsNoAlt > group 1`] = "width": 1, }, "edit": { - "background": "#fdb338", - "x": 349, - "y": 115, - "zoom": 1.5951464943576479, + "background": "#cfc26f", + "x": -2885, + "y": -2419, + "zoom": 1.7509753524211642, }, - "id": "4dcf07cfc26", - "url": "https://images.unsplash.com/photo-1553531384-397c80973a0b?some=other&query=params", + "id": "8d0985c0990", + "url": "https://images.unsplash.com/photo-1446329813274-7c9036bd9a1f?some=other&query=params", }, - "url": "https://images.unsplash.com/photo-1553531384-397c80973a0b?some=query", + "url": "https://images.unsplash.com/photo-1446329813274-7c9036bd9a1f?some=query", }, }, ], @@ -934,7 +934,7 @@ exports[`patches image fields > otherRepositoryWithThumbnailsNoAlt > shared slic { "slices": [ { - "id": "2ff58c741ba", + "id": "b9dd0f2c3f8", "items": [ { "field": { @@ -945,12 +945,12 @@ exports[`patches image fields > otherRepositoryWithThumbnailsNoAlt > shared slic "width": 1, }, "edit": { - "background": "#61adcf", - "x": -1586, - "y": -2819, - "zoom": 1.9393723758262054, + "background": "#9ed252", + "x": -1720, + "y": -191, + "zoom": 1.6165685319845957, }, - "id": "f5dbf0d9ed2", + "id": "35eaa8ebee4", "square": { "alt": null, "copyright": null, @@ -959,15 +959,15 @@ exports[`patches image fields > otherRepositoryWithThumbnailsNoAlt > shared slic "width": 1, }, "edit": { - "background": "#61adcf", - "x": -1586, - "y": -2819, - "zoom": 1.9393723758262054, + "background": "#9ed252", + "x": -1720, + "y": -191, + "zoom": 1.6165685319845957, }, - "id": "f5dbf0d9ed2", - "url": "https://images.unsplash.com/photo-1441974231531-c6227db76b6e?some=other&query=params", + "id": "35eaa8ebee4", + "url": "https://images.unsplash.com/photo-1418065460487-3e41a6c84dc5?some=other&query=params", }, - "url": "https://images.unsplash.com/photo-1441974231531-c6227db76b6e?some=query", + "url": "https://images.unsplash.com/photo-1418065460487-3e41a6c84dc5?some=query", }, }, ], @@ -980,12 +980,12 @@ exports[`patches image fields > otherRepositoryWithThumbnailsNoAlt > shared slic "width": 1, }, "edit": { - "background": "#8efd5a", - "x": 466, - "y": -571, - "zoom": 1.394663850868741, + "background": "#4f4f59", + "x": 3094, + "y": -2976, + "zoom": 1.0855120641844143, }, - "id": "f5dbf0d9ed2", + "id": "35eaa8ebee4", "square": { "alt": null, "copyright": null, @@ -994,15 +994,15 @@ exports[`patches image fields > otherRepositoryWithThumbnailsNoAlt > shared slic "width": 1, }, "edit": { - "background": "#8efd5a", - "x": 466, - "y": -571, - "zoom": 1.394663850868741, + "background": "#4f4f59", + "x": 3094, + "y": -2976, + "zoom": 1.0855120641844143, }, - "id": "f5dbf0d9ed2", - "url": "https://images.unsplash.com/photo-1441974231531-c6227db76b6e?some=other&query=params", + "id": "35eaa8ebee4", + "url": "https://images.unsplash.com/photo-1418065460487-3e41a6c84dc5?some=other&query=params", }, - "url": "https://images.unsplash.com/photo-1441974231531-c6227db76b6e?some=query", + "url": "https://images.unsplash.com/photo-1418065460487-3e41a6c84dc5?some=query", }, "group": [ { @@ -1014,12 +1014,12 @@ exports[`patches image fields > otherRepositoryWithThumbnailsNoAlt > shared slic "width": 1, }, "edit": { - "background": "#bc3178", - "x": 1156, - "y": -2223, - "zoom": 1.602826201962965, + "background": "#42f5cf", + "x": 427, + "y": 731, + "zoom": 1.6417661415510265, }, - "id": "f5dbf0d9ed2", + "id": "35eaa8ebee4", "square": { "alt": null, "copyright": null, @@ -1028,23 +1028,23 @@ exports[`patches image fields > otherRepositoryWithThumbnailsNoAlt > shared slic "width": 1, }, "edit": { - "background": "#bc3178", - "x": 1156, - "y": -2223, - "zoom": 1.602826201962965, + "background": "#42f5cf", + "x": 427, + "y": 731, + "zoom": 1.6417661415510265, }, - "id": "f5dbf0d9ed2", - "url": "https://images.unsplash.com/photo-1441974231531-c6227db76b6e?some=other&query=params", + "id": "35eaa8ebee4", + "url": "https://images.unsplash.com/photo-1418065460487-3e41a6c84dc5?some=other&query=params", }, - "url": "https://images.unsplash.com/photo-1441974231531-c6227db76b6e?some=query", + "url": "https://images.unsplash.com/photo-1418065460487-3e41a6c84dc5?some=query", }, }, ], }, "slice_label": null, - "slice_type": "at", - "variation": "tortor", - "version": "a79b9dd", + "slice_type": "dignissim", + "variation": "vitae", + "version": "bfc9053", }, ], } @@ -1054,7 +1054,7 @@ exports[`patches image fields > otherRepositoryWithThumbnailsNoAlt > slice 1`] = { "slices": [ { - "id": "e93cc3e4f28", + "id": "306297c5eda", "items": [ { "field": { @@ -1065,12 +1065,12 @@ exports[`patches image fields > otherRepositoryWithThumbnailsNoAlt > slice 1`] = "width": 1, }, "edit": { - "background": "#c361cc", - "x": -751, - "y": -404, - "zoom": 1.6465649620272602, + "background": "#f72dec", + "x": 2027, + "y": 7, + "zoom": 1.9216652845315787, }, - "id": "4f4a69ff72d", + "id": "7a35bc5aa2f", "square": { "alt": null, "copyright": null, @@ -1079,15 +1079,15 @@ exports[`patches image fields > otherRepositoryWithThumbnailsNoAlt > slice 1`] = "width": 1, }, "edit": { - "background": "#c361cc", - "x": -751, - "y": -404, - "zoom": 1.6465649620272602, + "background": "#f72dec", + "x": 2027, + "y": 7, + "zoom": 1.9216652845315787, }, - "id": "4f4a69ff72d", - "url": "https://images.unsplash.com/photo-1470770903676-69b98201ea1c?some=other&query=params", + "id": "7a35bc5aa2f", + "url": "https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05?some=other&query=params", }, - "url": "https://images.unsplash.com/photo-1470770903676-69b98201ea1c?some=query", + "url": "https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05?some=query", }, }, ], @@ -1100,12 +1100,12 @@ exports[`patches image fields > otherRepositoryWithThumbnailsNoAlt > slice 1`] = "width": 1, }, "edit": { - "background": "#55e3be", - "x": -762, - "y": 991, - "zoom": 1.0207384987782544, + "background": "#60cbac", + "x": -484, + "y": -2038, + "zoom": 1.8400009569805118, }, - "id": "4f4a69ff72d", + "id": "7a35bc5aa2f", "square": { "alt": null, "copyright": null, @@ -1114,19 +1114,19 @@ exports[`patches image fields > otherRepositoryWithThumbnailsNoAlt > slice 1`] = "width": 1, }, "edit": { - "background": "#55e3be", - "x": -762, - "y": 991, - "zoom": 1.0207384987782544, + "background": "#60cbac", + "x": -484, + "y": -2038, + "zoom": 1.8400009569805118, }, - "id": "4f4a69ff72d", - "url": "https://images.unsplash.com/photo-1470770903676-69b98201ea1c?some=other&query=params", + "id": "7a35bc5aa2f", + "url": "https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05?some=other&query=params", }, - "url": "https://images.unsplash.com/photo-1470770903676-69b98201ea1c?some=query", + "url": "https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05?some=query", }, }, - "slice_label": "Pellentesque", - "slice_type": "nulla_posuere", + "slice_label": "Aliquet", + "slice_type": "vel", }, ], } @@ -1142,12 +1142,12 @@ exports[`patches image fields > otherRepositoryWithThumbnailsNoAlt > static zone "width": 1, }, "edit": { - "background": "#97acc6", - "x": 1922, - "y": -967, - "zoom": 1.9765406541937358, + "background": "#b1d17b", + "x": 3291, + "y": -730, + "zoom": 1.061566393836766, }, - "id": "9abffab1d17", + "id": "4a95cc61c37", "square": { "alt": null, "copyright": null, @@ -1156,15 +1156,15 @@ exports[`patches image fields > otherRepositoryWithThumbnailsNoAlt > static zone "width": 1, }, "edit": { - "background": "#97acc6", - "x": 1922, - "y": -967, - "zoom": 1.9765406541937358, + "background": "#b1d17b", + "x": 3291, + "y": -730, + "zoom": 1.061566393836766, }, - "id": "9abffab1d17", - "url": "https://images.unsplash.com/photo-1446329813274-7c9036bd9a1f?some=other&query=params", + "id": "4a95cc61c37", + "url": "https://images.unsplash.com/photo-1604537529428-15bcbeecfe4d?some=other&query=params", }, - "url": "https://images.unsplash.com/photo-1446329813274-7c9036bd9a1f?some=query", + "url": "https://images.unsplash.com/photo-1604537529428-15bcbeecfe4d?some=query", }, } `; @@ -1174,36 +1174,36 @@ exports[`patches image fields > otherRepositoryWithTypeThumbnail > group 1`] = ` "group": [ { "field": { - "alt": "Odio ut enim blandit volutpat maecenas volutpat blandit", + "alt": "Massa id neque aliquam vestibulum morbi blandit cursus risus", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#fdb338", - "x": 349, - "y": 115, - "zoom": 1.5951464943576479, + "background": "#cfc26f", + "x": -2885, + "y": -2419, + "zoom": 1.7509753524211642, }, - "id": "4dcf07cfc26", + "id": "8d0985c0990", "type": { - "alt": "Odio ut enim blandit volutpat maecenas volutpat blandit", + "alt": "Massa id neque aliquam vestibulum morbi blandit cursus risus", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#fdb338", - "x": 349, - "y": 115, - "zoom": 1.5951464943576479, + "background": "#cfc26f", + "x": -2885, + "y": -2419, + "zoom": 1.7509753524211642, }, - "id": "4dcf07cfc26", - "url": "https://images.unsplash.com/photo-1553531384-397c80973a0b?some=other&query=params", + "id": "8d0985c0990", + "url": "https://images.unsplash.com/photo-1446329813274-7c9036bd9a1f?some=other&query=params", }, - "url": "https://images.unsplash.com/photo-1553531384-397c80973a0b?some=query", + "url": "https://images.unsplash.com/photo-1446329813274-7c9036bd9a1f?some=query", }, }, ], @@ -1214,117 +1214,117 @@ exports[`patches image fields > otherRepositoryWithTypeThumbnail > shared slice { "slices": [ { - "id": "2ff58c741ba", + "id": "b9dd0f2c3f8", "items": [ { "field": { - "alt": "Vitae et leo duis ut diam quam nulla porttitor massa id neque aliquam vestibulum", + "alt": "Fermentum odio eu feugiat pretium nibh ipsum consequat", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#61adcf", - "x": -1586, - "y": -2819, - "zoom": 1.9393723758262054, + "background": "#9ed252", + "x": -1720, + "y": -191, + "zoom": 1.6165685319845957, }, - "id": "f5dbf0d9ed2", + "id": "35eaa8ebee4", "type": { - "alt": "Vitae et leo duis ut diam quam nulla porttitor massa id neque aliquam vestibulum", + "alt": "Fermentum odio eu feugiat pretium nibh ipsum consequat", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#61adcf", - "x": -1586, - "y": -2819, - "zoom": 1.9393723758262054, + "background": "#9ed252", + "x": -1720, + "y": -191, + "zoom": 1.6165685319845957, }, - "id": "f5dbf0d9ed2", - "url": "https://images.unsplash.com/photo-1441974231531-c6227db76b6e?some=other&query=params", + "id": "35eaa8ebee4", + "url": "https://images.unsplash.com/photo-1418065460487-3e41a6c84dc5?some=other&query=params", }, - "url": "https://images.unsplash.com/photo-1441974231531-c6227db76b6e?some=query", + "url": "https://images.unsplash.com/photo-1418065460487-3e41a6c84dc5?some=query", }, }, ], "primary": { "field": { - "alt": "Ut consequat semper viverra nam libero justo laoreet", + "alt": "Pellentesque pulvinar pellentesque habitant morbi tristique senectus et netus et malesuada fames ac", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#8efd5a", - "x": 466, - "y": -571, - "zoom": 1.394663850868741, + "background": "#4f4f59", + "x": 3094, + "y": -2976, + "zoom": 1.0855120641844143, }, - "id": "f5dbf0d9ed2", + "id": "35eaa8ebee4", "type": { - "alt": "Ut consequat semper viverra nam libero justo laoreet", + "alt": "Pellentesque pulvinar pellentesque habitant morbi tristique senectus et netus et malesuada fames ac", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#8efd5a", - "x": 466, - "y": -571, - "zoom": 1.394663850868741, + "background": "#4f4f59", + "x": 3094, + "y": -2976, + "zoom": 1.0855120641844143, }, - "id": "f5dbf0d9ed2", - "url": "https://images.unsplash.com/photo-1441974231531-c6227db76b6e?some=other&query=params", + "id": "35eaa8ebee4", + "url": "https://images.unsplash.com/photo-1418065460487-3e41a6c84dc5?some=other&query=params", }, - "url": "https://images.unsplash.com/photo-1441974231531-c6227db76b6e?some=query", + "url": "https://images.unsplash.com/photo-1418065460487-3e41a6c84dc5?some=query", }, "group": [ { "field": { - "alt": "Porttitor massa id neque aliquam vestibulum morbi blandit", + "alt": "Id aliquet risus feugiat in", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#bc3178", - "x": 1156, - "y": -2223, - "zoom": 1.602826201962965, + "background": "#42f5cf", + "x": 427, + "y": 731, + "zoom": 1.6417661415510265, }, - "id": "f5dbf0d9ed2", + "id": "35eaa8ebee4", "type": { - "alt": "Porttitor massa id neque aliquam vestibulum morbi blandit", + "alt": "Id aliquet risus feugiat in", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#bc3178", - "x": 1156, - "y": -2223, - "zoom": 1.602826201962965, + "background": "#42f5cf", + "x": 427, + "y": 731, + "zoom": 1.6417661415510265, }, - "id": "f5dbf0d9ed2", - "url": "https://images.unsplash.com/photo-1441974231531-c6227db76b6e?some=other&query=params", + "id": "35eaa8ebee4", + "url": "https://images.unsplash.com/photo-1418065460487-3e41a6c84dc5?some=other&query=params", }, - "url": "https://images.unsplash.com/photo-1441974231531-c6227db76b6e?some=query", + "url": "https://images.unsplash.com/photo-1418065460487-3e41a6c84dc5?some=query", }, }, ], }, "slice_label": null, - "slice_type": "at", - "variation": "tortor", - "version": "a79b9dd", + "slice_type": "dignissim", + "variation": "vitae", + "version": "bfc9053", }, ], } @@ -1334,79 +1334,79 @@ exports[`patches image fields > otherRepositoryWithTypeThumbnail > slice 1`] = ` { "slices": [ { - "id": "e93cc3e4f28", + "id": "306297c5eda", "items": [ { "field": { - "alt": "Vitae sapien pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis", + "alt": "Pellentesque nec nam aliquam sem", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#c361cc", - "x": -751, - "y": -404, - "zoom": 1.6465649620272602, + "background": "#f72dec", + "x": 2027, + "y": 7, + "zoom": 1.9216652845315787, }, - "id": "4f4a69ff72d", + "id": "7a35bc5aa2f", "type": { - "alt": "Vitae sapien pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis", + "alt": "Pellentesque nec nam aliquam sem", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#c361cc", - "x": -751, - "y": -404, - "zoom": 1.6465649620272602, + "background": "#f72dec", + "x": 2027, + "y": 7, + "zoom": 1.9216652845315787, }, - "id": "4f4a69ff72d", - "url": "https://images.unsplash.com/photo-1470770903676-69b98201ea1c?some=other&query=params", + "id": "7a35bc5aa2f", + "url": "https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05?some=other&query=params", }, - "url": "https://images.unsplash.com/photo-1470770903676-69b98201ea1c?some=query", + "url": "https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05?some=query", }, }, ], "primary": { "field": { - "alt": "Nunc pulvinar sapien et ligula ullamcorper malesuada proin libero nunc consequat interdum varius sit", + "alt": "Quam nulla porttitor massa id neque aliquam vestibulum morbi blandit", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#55e3be", - "x": -762, - "y": 991, - "zoom": 1.0207384987782544, + "background": "#60cbac", + "x": -484, + "y": -2038, + "zoom": 1.8400009569805118, }, - "id": "4f4a69ff72d", + "id": "7a35bc5aa2f", "type": { - "alt": "Nunc pulvinar sapien et ligula ullamcorper malesuada proin libero nunc consequat interdum varius sit", + "alt": "Quam nulla porttitor massa id neque aliquam vestibulum morbi blandit", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#55e3be", - "x": -762, - "y": 991, - "zoom": 1.0207384987782544, + "background": "#60cbac", + "x": -484, + "y": -2038, + "zoom": 1.8400009569805118, }, - "id": "4f4a69ff72d", - "url": "https://images.unsplash.com/photo-1470770903676-69b98201ea1c?some=other&query=params", + "id": "7a35bc5aa2f", + "url": "https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05?some=other&query=params", }, - "url": "https://images.unsplash.com/photo-1470770903676-69b98201ea1c?some=query", + "url": "https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05?some=query", }, }, - "slice_label": "Pellentesque", - "slice_type": "nulla_posuere", + "slice_label": "Aliquet", + "slice_type": "vel", }, ], } @@ -1415,36 +1415,36 @@ exports[`patches image fields > otherRepositoryWithTypeThumbnail > slice 1`] = ` exports[`patches image fields > otherRepositoryWithTypeThumbnail > static zone 1`] = ` { "field": { - "alt": "Vulputate sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur vitae nunc sed", + "alt": "Gravida rutrum quisque non tellus orci", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#97acc6", - "x": 1922, - "y": -967, - "zoom": 1.9765406541937358, + "background": "#b1d17b", + "x": 3291, + "y": -730, + "zoom": 1.061566393836766, }, - "id": "9abffab1d17", + "id": "4a95cc61c37", "type": { - "alt": "Vulputate sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur vitae nunc sed", + "alt": "Gravida rutrum quisque non tellus orci", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#97acc6", - "x": 1922, - "y": -967, - "zoom": 1.9765406541937358, + "background": "#b1d17b", + "x": 3291, + "y": -730, + "zoom": 1.061566393836766, }, - "id": "9abffab1d17", - "url": "https://images.unsplash.com/photo-1446329813274-7c9036bd9a1f?some=other&query=params", + "id": "4a95cc61c37", + "url": "https://images.unsplash.com/photo-1604537529428-15bcbeecfe4d?some=other&query=params", }, - "url": "https://images.unsplash.com/photo-1446329813274-7c9036bd9a1f?some=query", + "url": "https://images.unsplash.com/photo-1604537529428-15bcbeecfe4d?some=query", }, } `; diff --git a/test/__snapshots__/writeClient-migrate-patch-linkToMedia.test.ts.snap b/test/__snapshots__/writeClient-migrate-patch-linkToMedia.test.ts.snap index 2624fb3a..a6d213fd 100644 --- a/test/__snapshots__/writeClient-migrate-patch-linkToMedia.test.ts.snap +++ b/test/__snapshots__/writeClient-migrate-patch-linkToMedia.test.ts.snap @@ -11,7 +11,7 @@ exports[`patches link to media fields > existing > group 1`] = ` "link_type": "Media", "name": "default.jpg", "size": "1", - "url": "https://images.unsplash.com/photo-1497436072909-60f360e1d4b1?w=2560&h=1440&fit=crop", + "url": "https://images.unsplash.com/reserve/HgZuGu3gSD6db21T3lxm_San%20Zenone.jpg?w=6373&h=4253&fit=crop", "width": "1", }, }, @@ -23,7 +23,7 @@ exports[`patches link to media fields > existing > shared slice 1`] = ` { "slices": [ { - "id": "2ff58c741ba", + "id": "b9dd0f2c3f8", "items": [ { "field": { @@ -33,7 +33,7 @@ exports[`patches link to media fields > existing > shared slice 1`] = ` "link_type": "Media", "name": "default.jpg", "size": "1", - "url": "https://images.unsplash.com/photo-1604537466608-109fa2f16c3b?w=4240&h=2832&fit=crop", + "url": "https://images.unsplash.com/photo-1426604966848-d7adac402bff?w=5616&h=3744&fit=crop", "width": "1", }, }, @@ -46,7 +46,7 @@ exports[`patches link to media fields > existing > shared slice 1`] = ` "link_type": "Media", "name": "default.jpg", "size": "1", - "url": "https://images.unsplash.com/photo-1604537466608-109fa2f16c3b?w=4240&h=2832&fit=crop", + "url": "https://images.unsplash.com/photo-1426604966848-d7adac402bff?w=5616&h=3744&fit=crop", "width": "1", }, "group": [ @@ -58,16 +58,16 @@ exports[`patches link to media fields > existing > shared slice 1`] = ` "link_type": "Media", "name": "default.jpg", "size": "1", - "url": "https://images.unsplash.com/photo-1604537466608-109fa2f16c3b?w=4240&h=2832&fit=crop", + "url": "https://images.unsplash.com/photo-1426604966848-d7adac402bff?w=5616&h=3744&fit=crop", "width": "1", }, }, ], }, "slice_label": null, - "slice_type": "at", - "variation": "tortor", - "version": "a79b9dd", + "slice_type": "dignissim", + "variation": "vitae", + "version": "bfc9053", }, ], } @@ -77,7 +77,7 @@ exports[`patches link to media fields > existing > slice 1`] = ` { "slices": [ { - "id": "e93cc3e4f28", + "id": "306297c5eda", "items": [ { "field": { @@ -104,8 +104,8 @@ exports[`patches link to media fields > existing > slice 1`] = ` "width": "1", }, }, - "slice_label": "Pellentesque", - "slice_type": "nulla_posuere", + "slice_label": "Aliquet", + "slice_type": "vel", }, ], } @@ -120,7 +120,7 @@ exports[`patches link to media fields > existing > static zone 1`] = ` "link_type": "Media", "name": "default.jpg", "size": "1", - "url": "https://images.unsplash.com/photo-1553531384-397c80973a0b?w=4335&h=6502&fit=crop", + "url": "https://images.unsplash.com/photo-1587502537745-84b86da1204f?w=6550&h=4367&fit=crop", "width": "1", }, } @@ -136,7 +136,7 @@ exports[`patches link to media fields > existingNonImage > group 1`] = ` "link_type": "Media", "name": "foo.pdf", "size": "1", - "url": "https://images.unsplash.com/photo-1497436072909-60f360e1d4b1?w=2560&h=1440&fit=crop", + "url": "https://images.unsplash.com/reserve/HgZuGu3gSD6db21T3lxm_San%20Zenone.jpg?w=6373&h=4253&fit=crop", }, }, ], @@ -147,7 +147,7 @@ exports[`patches link to media fields > existingNonImage > shared slice 1`] = ` { "slices": [ { - "id": "2ff58c741ba", + "id": "b9dd0f2c3f8", "items": [ { "field": { @@ -156,7 +156,7 @@ exports[`patches link to media fields > existingNonImage > shared slice 1`] = ` "link_type": "Media", "name": "foo.pdf", "size": "1", - "url": "https://images.unsplash.com/photo-1604537466608-109fa2f16c3b?w=4240&h=2832&fit=crop", + "url": "https://images.unsplash.com/photo-1426604966848-d7adac402bff?w=5616&h=3744&fit=crop", }, }, ], @@ -167,7 +167,7 @@ exports[`patches link to media fields > existingNonImage > shared slice 1`] = ` "link_type": "Media", "name": "foo.pdf", "size": "1", - "url": "https://images.unsplash.com/photo-1604537466608-109fa2f16c3b?w=4240&h=2832&fit=crop", + "url": "https://images.unsplash.com/photo-1426604966848-d7adac402bff?w=5616&h=3744&fit=crop", }, "group": [ { @@ -177,15 +177,15 @@ exports[`patches link to media fields > existingNonImage > shared slice 1`] = ` "link_type": "Media", "name": "foo.pdf", "size": "1", - "url": "https://images.unsplash.com/photo-1604537466608-109fa2f16c3b?w=4240&h=2832&fit=crop", + "url": "https://images.unsplash.com/photo-1426604966848-d7adac402bff?w=5616&h=3744&fit=crop", }, }, ], }, "slice_label": null, - "slice_type": "at", - "variation": "tortor", - "version": "a79b9dd", + "slice_type": "dignissim", + "variation": "vitae", + "version": "bfc9053", }, ], } @@ -195,7 +195,7 @@ exports[`patches link to media fields > existingNonImage > slice 1`] = ` { "slices": [ { - "id": "e93cc3e4f28", + "id": "306297c5eda", "items": [ { "field": { @@ -218,8 +218,8 @@ exports[`patches link to media fields > existingNonImage > slice 1`] = ` "url": "https://images.unsplash.com/photo-1604537529428-15bcbeecfe4d?w=4240&h=2832&fit=crop", }, }, - "slice_label": "Pellentesque", - "slice_type": "nulla_posuere", + "slice_label": "Aliquet", + "slice_type": "vel", }, ], } @@ -233,7 +233,7 @@ exports[`patches link to media fields > existingNonImage > static zone 1`] = ` "link_type": "Media", "name": "foo.pdf", "size": "1", - "url": "https://images.unsplash.com/photo-1553531384-397c80973a0b?w=4335&h=6502&fit=crop", + "url": "https://images.unsplash.com/photo-1587502537745-84b86da1204f?w=6550&h=4367&fit=crop", }, } `; @@ -244,12 +244,12 @@ exports[`patches link to media fields > new > group 1`] = ` { "field": { "height": "1", - "id": "ef95d5daa4d", + "id": "dfdd322ca9d", "kind": "image", "link_type": "Media", "name": "default.jpg", "size": "1", - "url": "https://images.unsplash.com/photo-1441974231531-c6227db76b6e?w=2560&h=1705&fit=crop", + "url": "https://images.unsplash.com/reserve/HgZuGu3gSD6db21T3lxm_San%20Zenone.jpg?w=6373&h=4253&fit=crop", "width": "1", }, }, @@ -261,17 +261,17 @@ exports[`patches link to media fields > new > shared slice 1`] = ` { "slices": [ { - "id": "2ff58c741ba", + "id": "b9dd0f2c3f8", "items": [ { "field": { "height": "1", - "id": "f2c3f8bfc90", + "id": "0eddbd0255b", "kind": "image", "link_type": "Media", "name": "default.jpg", "size": "1", - "url": "https://images.unsplash.com/photo-1604537529428-15bcbeecfe4d?w=4240&h=2832&fit=crop", + "url": "https://images.unsplash.com/reserve/HgZuGu3gSD6db21T3lxm_San%20Zenone.jpg?w=6373&h=4253&fit=crop", "width": "1", }, }, @@ -279,33 +279,33 @@ exports[`patches link to media fields > new > shared slice 1`] = ` "primary": { "field": { "height": "1", - "id": "f2c3f8bfc90", + "id": "0eddbd0255b", "kind": "image", "link_type": "Media", "name": "default.jpg", "size": "1", - "url": "https://images.unsplash.com/photo-1604537529428-15bcbeecfe4d?w=4240&h=2832&fit=crop", + "url": "https://images.unsplash.com/reserve/HgZuGu3gSD6db21T3lxm_San%20Zenone.jpg?w=6373&h=4253&fit=crop", "width": "1", }, "group": [ { "field": { "height": "1", - "id": "f2c3f8bfc90", + "id": "0eddbd0255b", "kind": "image", "link_type": "Media", "name": "default.jpg", "size": "1", - "url": "https://images.unsplash.com/photo-1604537529428-15bcbeecfe4d?w=4240&h=2832&fit=crop", + "url": "https://images.unsplash.com/reserve/HgZuGu3gSD6db21T3lxm_San%20Zenone.jpg?w=6373&h=4253&fit=crop", "width": "1", }, }, ], }, "slice_label": null, - "slice_type": "at", - "variation": "tortor", - "version": "a79b9dd", + "slice_type": "dignissim", + "variation": "vitae", + "version": "bfc9053", }, ], } @@ -315,17 +315,17 @@ exports[`patches link to media fields > new > slice 1`] = ` { "slices": [ { - "id": "e93cc3e4f28", + "id": "306297c5eda", "items": [ { "field": { "height": "1", - "id": "45306297c5e", + "id": "2beb55ec2f4", "kind": "image", "link_type": "Media", "name": "default.jpg", "size": "1", - "url": "https://images.unsplash.com/photo-1604537466608-109fa2f16c3b?w=4240&h=2832&fit=crop", + "url": "https://images.unsplash.com/photo-1444464666168-49d633b86797?w=4844&h=3234&fit=crop", "width": "1", }, }, @@ -333,17 +333,17 @@ exports[`patches link to media fields > new > slice 1`] = ` "primary": { "field": { "height": "1", - "id": "45306297c5e", + "id": "2beb55ec2f4", "kind": "image", "link_type": "Media", "name": "default.jpg", "size": "1", - "url": "https://images.unsplash.com/photo-1604537466608-109fa2f16c3b?w=4240&h=2832&fit=crop", + "url": "https://images.unsplash.com/photo-1444464666168-49d633b86797?w=4844&h=3234&fit=crop", "width": "1", }, }, - "slice_label": "Pellentesque", - "slice_type": "nulla_posuere", + "slice_label": "Aliquet", + "slice_type": "vel", }, ], } @@ -353,12 +353,12 @@ exports[`patches link to media fields > new > static zone 1`] = ` { "field": { "height": "1", - "id": "c5c95f8d3ac", + "id": "bbad670dad7", "kind": "image", "link_type": "Media", "name": "default.jpg", "size": "1", - "url": "https://images.unsplash.com/photo-1604537466608-109fa2f16c3b?w=4240&h=2832&fit=crop", + "url": "https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05?w=7372&h=4392&fit=crop", "width": "1", }, } @@ -370,12 +370,12 @@ exports[`patches link to media fields > otherRepository > group 1`] = ` { "field": { "height": "1", - "id": "fdb33894dcf", + "id": "cfc26fe8d09", "kind": "image", "link_type": "Media", "name": "default.jpg", "size": "1", - "url": "https://images.unsplash.com/photo-1470770903676-69b98201ea1c?w=4554&h=3036&fit=crop", + "url": "https://images.unsplash.com/photo-1446329813274-7c9036bd9a1f?w=6000&h=4000&fit=crop", "width": "1", }, }, @@ -387,17 +387,17 @@ exports[`patches link to media fields > otherRepository > shared slice 1`] = ` { "slices": [ { - "id": "2ff58c741ba", + "id": "b9dd0f2c3f8", "items": [ { "field": { "height": "1", - "id": "ba97bfb16bf", + "id": "61adcf1f5db", "kind": "image", "link_type": "Media", "name": "default.jpg", "size": "1", - "url": "https://images.unsplash.com/reserve/HgZuGu3gSD6db21T3lxm_San%20Zenone.jpg?w=6373&h=4253&fit=crop", + "url": "https://images.unsplash.com/photo-1553531384-397c80973a0b?w=4335&h=6502&fit=crop", "width": "1", }, }, @@ -405,33 +405,33 @@ exports[`patches link to media fields > otherRepository > shared slice 1`] = ` "primary": { "field": { "height": "1", - "id": "ba97bfb16bf", + "id": "61adcf1f5db", "kind": "image", "link_type": "Media", "name": "default.jpg", "size": "1", - "url": "https://images.unsplash.com/reserve/HgZuGu3gSD6db21T3lxm_San%20Zenone.jpg?w=6373&h=4253&fit=crop", + "url": "https://images.unsplash.com/photo-1553531384-397c80973a0b?w=4335&h=6502&fit=crop", "width": "1", }, "group": [ { "field": { "height": "1", - "id": "ba97bfb16bf", + "id": "61adcf1f5db", "kind": "image", "link_type": "Media", "name": "default.jpg", "size": "1", - "url": "https://images.unsplash.com/reserve/HgZuGu3gSD6db21T3lxm_San%20Zenone.jpg?w=6373&h=4253&fit=crop", + "url": "https://images.unsplash.com/photo-1553531384-397c80973a0b?w=4335&h=6502&fit=crop", "width": "1", }, }, ], }, "slice_label": null, - "slice_type": "at", - "variation": "tortor", - "version": "a79b9dd", + "slice_type": "dignissim", + "variation": "vitae", + "version": "bfc9053", }, ], } @@ -441,17 +441,17 @@ exports[`patches link to media fields > otherRepository > slice 1`] = ` { "slices": [ { - "id": "e93cc3e4f28", + "id": "306297c5eda", "items": [ { "field": { "height": "1", - "id": "a57963dc361", + "id": "4f4a69ff72d", "kind": "image", "link_type": "Media", "name": "default.jpg", "size": "1", - "url": "https://images.unsplash.com/photo-1426604966848-d7adac402bff?w=5616&h=3744&fit=crop", + "url": "https://images.unsplash.com/photo-1470770903676-69b98201ea1c?w=4554&h=3036&fit=crop", "width": "1", }, }, @@ -459,17 +459,17 @@ exports[`patches link to media fields > otherRepository > slice 1`] = ` "primary": { "field": { "height": "1", - "id": "a57963dc361", + "id": "4f4a69ff72d", "kind": "image", "link_type": "Media", "name": "default.jpg", "size": "1", - "url": "https://images.unsplash.com/photo-1426604966848-d7adac402bff?w=5616&h=3744&fit=crop", + "url": "https://images.unsplash.com/photo-1470770903676-69b98201ea1c?w=4554&h=3036&fit=crop", "width": "1", }, }, - "slice_label": "Pellentesque", - "slice_type": "nulla_posuere", + "slice_label": "Aliquet", + "slice_type": "vel", }, ], } @@ -479,12 +479,12 @@ exports[`patches link to media fields > otherRepository > static zone 1`] = ` { "field": { "height": "1", - "id": "97acc6e9abf", + "id": "b1d17b04a95", "kind": "image", "link_type": "Media", "name": "default.jpg", "size": "1", - "url": "https://images.unsplash.com/photo-1553531384-397c80973a0b?w=4335&h=6502&fit=crop", + "url": "https://images.unsplash.com/photo-1604537529428-15bcbeecfe4d?w=4240&h=2832&fit=crop", "width": "1", }, } @@ -510,7 +510,7 @@ exports[`patches link to media fields > richTextExisting > group 1`] = ` "link_type": "Media", "name": "default.jpg", "size": "1", - "url": "https://images.unsplash.com/photo-1497436072909-60f360e1d4b1?w=2560&h=1440&fit=crop", + "url": "https://images.unsplash.com/reserve/HgZuGu3gSD6db21T3lxm_San%20Zenone.jpg?w=6373&h=4253&fit=crop", "width": "1", }, "end": 5, @@ -531,7 +531,7 @@ exports[`patches link to media fields > richTextExisting > shared slice 1`] = ` { "slices": [ { - "id": "2ff58c741ba", + "id": "b9dd0f2c3f8", "items": [ { "field": [ @@ -550,7 +550,7 @@ exports[`patches link to media fields > richTextExisting > shared slice 1`] = ` "link_type": "Media", "name": "default.jpg", "size": "1", - "url": "https://images.unsplash.com/photo-1604537466608-109fa2f16c3b?w=4240&h=2832&fit=crop", + "url": "https://images.unsplash.com/photo-1426604966848-d7adac402bff?w=5616&h=3744&fit=crop", "width": "1", }, "end": 5, @@ -581,7 +581,7 @@ exports[`patches link to media fields > richTextExisting > shared slice 1`] = ` "link_type": "Media", "name": "default.jpg", "size": "1", - "url": "https://images.unsplash.com/photo-1604537466608-109fa2f16c3b?w=4240&h=2832&fit=crop", + "url": "https://images.unsplash.com/photo-1426604966848-d7adac402bff?w=5616&h=3744&fit=crop", "width": "1", }, "end": 5, @@ -611,7 +611,7 @@ exports[`patches link to media fields > richTextExisting > shared slice 1`] = ` "link_type": "Media", "name": "default.jpg", "size": "1", - "url": "https://images.unsplash.com/photo-1604537466608-109fa2f16c3b?w=4240&h=2832&fit=crop", + "url": "https://images.unsplash.com/photo-1426604966848-d7adac402bff?w=5616&h=3744&fit=crop", "width": "1", }, "end": 5, @@ -627,9 +627,9 @@ exports[`patches link to media fields > richTextExisting > shared slice 1`] = ` ], }, "slice_label": null, - "slice_type": "at", - "variation": "tortor", - "version": "a79b9dd", + "slice_type": "dignissim", + "variation": "vitae", + "version": "bfc9053", }, ], } @@ -639,7 +639,7 @@ exports[`patches link to media fields > richTextExisting > slice 1`] = ` { "slices": [ { - "id": "e93cc3e4f28", + "id": "306297c5eda", "items": [ { "field": [ @@ -702,8 +702,8 @@ exports[`patches link to media fields > richTextExisting > slice 1`] = ` }, ], }, - "slice_label": "Pellentesque", - "slice_type": "nulla_posuere", + "slice_label": "Aliquet", + "slice_type": "vel", }, ], } @@ -727,7 +727,7 @@ exports[`patches link to media fields > richTextExisting > static zone 1`] = ` "link_type": "Media", "name": "default.jpg", "size": "1", - "url": "https://images.unsplash.com/photo-1553531384-397c80973a0b?w=4335&h=6502&fit=crop", + "url": "https://images.unsplash.com/photo-1587502537745-84b86da1204f?w=6550&h=4367&fit=crop", "width": "1", }, "end": 5, @@ -757,12 +757,12 @@ exports[`patches link to media fields > richTextNew > group 1`] = ` { "data": { "height": "1", - "id": "ef95d5daa4d", + "id": "dfdd322ca9d", "kind": "image", "link_type": "Media", "name": "default.jpg", "size": "1", - "url": "https://images.unsplash.com/photo-1441974231531-c6227db76b6e?w=2560&h=1705&fit=crop", + "url": "https://images.unsplash.com/reserve/HgZuGu3gSD6db21T3lxm_San%20Zenone.jpg?w=6373&h=4253&fit=crop", "width": "1", }, "end": 5, @@ -783,7 +783,7 @@ exports[`patches link to media fields > richTextNew > shared slice 1`] = ` { "slices": [ { - "id": "2ff58c741ba", + "id": "b9dd0f2c3f8", "items": [ { "field": [ @@ -797,12 +797,12 @@ exports[`patches link to media fields > richTextNew > shared slice 1`] = ` { "data": { "height": "1", - "id": "f2c3f8bfc90", + "id": "0eddbd0255b", "kind": "image", "link_type": "Media", "name": "default.jpg", "size": "1", - "url": "https://images.unsplash.com/photo-1604537529428-15bcbeecfe4d?w=4240&h=2832&fit=crop", + "url": "https://images.unsplash.com/reserve/HgZuGu3gSD6db21T3lxm_San%20Zenone.jpg?w=6373&h=4253&fit=crop", "width": "1", }, "end": 5, @@ -828,12 +828,12 @@ exports[`patches link to media fields > richTextNew > shared slice 1`] = ` { "data": { "height": "1", - "id": "f2c3f8bfc90", + "id": "0eddbd0255b", "kind": "image", "link_type": "Media", "name": "default.jpg", "size": "1", - "url": "https://images.unsplash.com/photo-1604537529428-15bcbeecfe4d?w=4240&h=2832&fit=crop", + "url": "https://images.unsplash.com/reserve/HgZuGu3gSD6db21T3lxm_San%20Zenone.jpg?w=6373&h=4253&fit=crop", "width": "1", }, "end": 5, @@ -858,12 +858,12 @@ exports[`patches link to media fields > richTextNew > shared slice 1`] = ` { "data": { "height": "1", - "id": "f2c3f8bfc90", + "id": "0eddbd0255b", "kind": "image", "link_type": "Media", "name": "default.jpg", "size": "1", - "url": "https://images.unsplash.com/photo-1604537529428-15bcbeecfe4d?w=4240&h=2832&fit=crop", + "url": "https://images.unsplash.com/reserve/HgZuGu3gSD6db21T3lxm_San%20Zenone.jpg?w=6373&h=4253&fit=crop", "width": "1", }, "end": 5, @@ -879,9 +879,9 @@ exports[`patches link to media fields > richTextNew > shared slice 1`] = ` ], }, "slice_label": null, - "slice_type": "at", - "variation": "tortor", - "version": "a79b9dd", + "slice_type": "dignissim", + "variation": "vitae", + "version": "bfc9053", }, ], } @@ -891,7 +891,7 @@ exports[`patches link to media fields > richTextNew > slice 1`] = ` { "slices": [ { - "id": "e93cc3e4f28", + "id": "306297c5eda", "items": [ { "field": [ @@ -905,12 +905,12 @@ exports[`patches link to media fields > richTextNew > slice 1`] = ` { "data": { "height": "1", - "id": "45306297c5e", + "id": "2beb55ec2f4", "kind": "image", "link_type": "Media", "name": "default.jpg", "size": "1", - "url": "https://images.unsplash.com/photo-1604537466608-109fa2f16c3b?w=4240&h=2832&fit=crop", + "url": "https://images.unsplash.com/photo-1444464666168-49d633b86797?w=4844&h=3234&fit=crop", "width": "1", }, "end": 5, @@ -936,12 +936,12 @@ exports[`patches link to media fields > richTextNew > slice 1`] = ` { "data": { "height": "1", - "id": "45306297c5e", + "id": "2beb55ec2f4", "kind": "image", "link_type": "Media", "name": "default.jpg", "size": "1", - "url": "https://images.unsplash.com/photo-1604537466608-109fa2f16c3b?w=4240&h=2832&fit=crop", + "url": "https://images.unsplash.com/photo-1444464666168-49d633b86797?w=4844&h=3234&fit=crop", "width": "1", }, "end": 5, @@ -954,8 +954,8 @@ exports[`patches link to media fields > richTextNew > slice 1`] = ` }, ], }, - "slice_label": "Pellentesque", - "slice_type": "nulla_posuere", + "slice_label": "Aliquet", + "slice_type": "vel", }, ], } @@ -974,12 +974,12 @@ exports[`patches link to media fields > richTextNew > static zone 1`] = ` { "data": { "height": "1", - "id": "c5c95f8d3ac", + "id": "bbad670dad7", "kind": "image", "link_type": "Media", "name": "default.jpg", "size": "1", - "url": "https://images.unsplash.com/photo-1604537466608-109fa2f16c3b?w=4240&h=2832&fit=crop", + "url": "https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05?w=7372&h=4392&fit=crop", "width": "1", }, "end": 5, @@ -1009,12 +1009,12 @@ exports[`patches link to media fields > richTextOtherRepository > group 1`] = ` { "data": { "height": "1", - "id": "fdb33894dcf", + "id": "cfc26fe8d09", "kind": "image", "link_type": "Media", "name": "default.jpg", "size": "1", - "url": "https://images.unsplash.com/photo-1470770903676-69b98201ea1c?w=4554&h=3036&fit=crop", + "url": "https://images.unsplash.com/photo-1446329813274-7c9036bd9a1f?w=6000&h=4000&fit=crop", "width": "1", }, "end": 5, @@ -1035,7 +1035,7 @@ exports[`patches link to media fields > richTextOtherRepository > shared slice 1 { "slices": [ { - "id": "2ff58c741ba", + "id": "b9dd0f2c3f8", "items": [ { "field": [ @@ -1049,12 +1049,12 @@ exports[`patches link to media fields > richTextOtherRepository > shared slice 1 { "data": { "height": "1", - "id": "ba97bfb16bf", + "id": "61adcf1f5db", "kind": "image", "link_type": "Media", "name": "default.jpg", "size": "1", - "url": "https://images.unsplash.com/reserve/HgZuGu3gSD6db21T3lxm_San%20Zenone.jpg?w=6373&h=4253&fit=crop", + "url": "https://images.unsplash.com/photo-1553531384-397c80973a0b?w=4335&h=6502&fit=crop", "width": "1", }, "end": 5, @@ -1080,12 +1080,12 @@ exports[`patches link to media fields > richTextOtherRepository > shared slice 1 { "data": { "height": "1", - "id": "ba97bfb16bf", + "id": "61adcf1f5db", "kind": "image", "link_type": "Media", "name": "default.jpg", "size": "1", - "url": "https://images.unsplash.com/reserve/HgZuGu3gSD6db21T3lxm_San%20Zenone.jpg?w=6373&h=4253&fit=crop", + "url": "https://images.unsplash.com/photo-1553531384-397c80973a0b?w=4335&h=6502&fit=crop", "width": "1", }, "end": 5, @@ -1110,12 +1110,12 @@ exports[`patches link to media fields > richTextOtherRepository > shared slice 1 { "data": { "height": "1", - "id": "ba97bfb16bf", + "id": "61adcf1f5db", "kind": "image", "link_type": "Media", "name": "default.jpg", "size": "1", - "url": "https://images.unsplash.com/reserve/HgZuGu3gSD6db21T3lxm_San%20Zenone.jpg?w=6373&h=4253&fit=crop", + "url": "https://images.unsplash.com/photo-1553531384-397c80973a0b?w=4335&h=6502&fit=crop", "width": "1", }, "end": 5, @@ -1131,9 +1131,9 @@ exports[`patches link to media fields > richTextOtherRepository > shared slice 1 ], }, "slice_label": null, - "slice_type": "at", - "variation": "tortor", - "version": "a79b9dd", + "slice_type": "dignissim", + "variation": "vitae", + "version": "bfc9053", }, ], } @@ -1143,7 +1143,7 @@ exports[`patches link to media fields > richTextOtherRepository > slice 1`] = ` { "slices": [ { - "id": "e93cc3e4f28", + "id": "306297c5eda", "items": [ { "field": [ @@ -1157,12 +1157,12 @@ exports[`patches link to media fields > richTextOtherRepository > slice 1`] = ` { "data": { "height": "1", - "id": "a57963dc361", + "id": "4f4a69ff72d", "kind": "image", "link_type": "Media", "name": "default.jpg", "size": "1", - "url": "https://images.unsplash.com/photo-1426604966848-d7adac402bff?w=5616&h=3744&fit=crop", + "url": "https://images.unsplash.com/photo-1470770903676-69b98201ea1c?w=4554&h=3036&fit=crop", "width": "1", }, "end": 5, @@ -1188,12 +1188,12 @@ exports[`patches link to media fields > richTextOtherRepository > slice 1`] = ` { "data": { "height": "1", - "id": "a57963dc361", + "id": "4f4a69ff72d", "kind": "image", "link_type": "Media", "name": "default.jpg", "size": "1", - "url": "https://images.unsplash.com/photo-1426604966848-d7adac402bff?w=5616&h=3744&fit=crop", + "url": "https://images.unsplash.com/photo-1470770903676-69b98201ea1c?w=4554&h=3036&fit=crop", "width": "1", }, "end": 5, @@ -1206,8 +1206,8 @@ exports[`patches link to media fields > richTextOtherRepository > slice 1`] = ` }, ], }, - "slice_label": "Pellentesque", - "slice_type": "nulla_posuere", + "slice_label": "Aliquet", + "slice_type": "vel", }, ], } @@ -1226,12 +1226,12 @@ exports[`patches link to media fields > richTextOtherRepository > static zone 1` { "data": { "height": "1", - "id": "97acc6e9abf", + "id": "b1d17b04a95", "kind": "image", "link_type": "Media", "name": "default.jpg", "size": "1", - "url": "https://images.unsplash.com/photo-1553531384-397c80973a0b?w=4335&h=6502&fit=crop", + "url": "https://images.unsplash.com/photo-1604537529428-15bcbeecfe4d?w=4240&h=2832&fit=crop", "width": "1", }, "end": 5, diff --git a/test/__snapshots__/writeClient-migrate-patch-rtImageNode.test.ts.snap b/test/__snapshots__/writeClient-migrate-patch-rtImageNode.test.ts.snap index 28421765..6e445ca2 100644 --- a/test/__snapshots__/writeClient-migrate-patch-rtImageNode.test.ts.snap +++ b/test/__snapshots__/writeClient-migrate-patch-rtImageNode.test.ts.snap @@ -7,8 +7,8 @@ exports[`patches rich text image nodes > existing > group 1`] = ` "field": [ { "spans": [], - "text": "Nulla Aliquet Porttitor Lacus Luctus", - "type": "heading2", + "text": "Donec Enim Diam Vulputate Ut Pharetra Sit Amet Aliquam", + "type": "heading4", }, { "alt": null, @@ -25,7 +25,7 @@ exports[`patches rich text image nodes > existing > group 1`] = ` }, "id": "id-existing", "type": "image", - "url": "https://images.unsplash.com/photo-1497436072909-60f360e1d4b1?w=2560&h=1440&fit=crop", + "url": "https://images.unsplash.com/reserve/HgZuGu3gSD6db21T3lxm_San%20Zenone.jpg?w=6373&h=4253&fit=crop", }, ], }, @@ -37,14 +37,14 @@ exports[`patches rich text image nodes > existing > shared slice 1`] = ` { "slices": [ { - "id": "2ff58c741ba", + "id": "b9dd0f2c3f8", "items": [ { "field": [ { "spans": [], - "text": "Eu Mi", - "type": "heading3", + "text": "A molestie lorem ipsum dolor sit amet consectetur adipiscing elit ut", + "type": "list-item", }, { "alt": null, @@ -61,7 +61,7 @@ exports[`patches rich text image nodes > existing > shared slice 1`] = ` }, "id": "id-existing", "type": "image", - "url": "https://images.unsplash.com/photo-1604537466608-109fa2f16c3b?w=4240&h=2832&fit=crop", + "url": "https://images.unsplash.com/photo-1426604966848-d7adac402bff?w=5616&h=3744&fit=crop", }, ], }, @@ -70,8 +70,8 @@ exports[`patches rich text image nodes > existing > shared slice 1`] = ` "field": [ { "spans": [], - "text": "Fringilla Phasellus Faucibus Scelerisque Eleifend Donec Pretium", - "type": "heading3", + "text": "Egestas maecenas pharetra convallis posuere morbi leo urna molestie at. Cras fermentum odio eu feugiat pretium.", + "type": "preformatted", }, { "alt": null, @@ -88,7 +88,7 @@ exports[`patches rich text image nodes > existing > shared slice 1`] = ` }, "id": "id-existing", "type": "image", - "url": "https://images.unsplash.com/photo-1604537466608-109fa2f16c3b?w=4240&h=2832&fit=crop", + "url": "https://images.unsplash.com/photo-1426604966848-d7adac402bff?w=5616&h=3744&fit=crop", }, ], "group": [ @@ -96,8 +96,8 @@ exports[`patches rich text image nodes > existing > shared slice 1`] = ` "field": [ { "spans": [], - "text": "Arcu", - "type": "heading1", + "text": "Vel Elit Scelerisque Mauris Pellentesque Pulvinar Pellentesque", + "type": "heading3", }, { "alt": null, @@ -114,16 +114,16 @@ exports[`patches rich text image nodes > existing > shared slice 1`] = ` }, "id": "id-existing", "type": "image", - "url": "https://images.unsplash.com/photo-1604537466608-109fa2f16c3b?w=4240&h=2832&fit=crop", + "url": "https://images.unsplash.com/photo-1426604966848-d7adac402bff?w=5616&h=3744&fit=crop", }, ], }, ], }, "slice_label": null, - "slice_type": "at", - "variation": "tortor", - "version": "a79b9dd", + "slice_type": "dignissim", + "variation": "vitae", + "version": "bfc9053", }, ], } @@ -133,14 +133,14 @@ exports[`patches rich text image nodes > existing > slice 1`] = ` { "slices": [ { - "id": "e93cc3e4f28", + "id": "306297c5eda", "items": [ { "field": [ { "spans": [], - "text": "Habitasse platea dictumst quisque sagittis purus sit", - "type": "o-list-item", + "text": "Diam Ut Venenatis Tellus", + "type": "heading6", }, { "alt": null, @@ -166,8 +166,8 @@ exports[`patches rich text image nodes > existing > slice 1`] = ` "field": [ { "spans": [], - "text": "Ac Orci Phasellus Egestas Tellus", - "type": "heading5", + "text": "Tincidunt Vitae Semper Quis Lectus Nulla", + "type": "heading4", }, { "alt": null, @@ -188,8 +188,8 @@ exports[`patches rich text image nodes > existing > slice 1`] = ` }, ], }, - "slice_label": "Pellentesque", - "slice_type": "nulla_posuere", + "slice_label": "Aliquet", + "slice_type": "vel", }, ], } @@ -200,8 +200,8 @@ exports[`patches rich text image nodes > existing > static zone 1`] = ` "field": [ { "spans": [], - "text": "Elementum Integer", - "type": "heading6", + "text": "Interdum Velit Euismod", + "type": "heading5", }, { "alt": null, @@ -218,7 +218,7 @@ exports[`patches rich text image nodes > existing > static zone 1`] = ` }, "id": "id-existing", "type": "image", - "url": "https://images.unsplash.com/photo-1553531384-397c80973a0b?w=4335&h=6502&fit=crop", + "url": "https://images.unsplash.com/photo-1587502537745-84b86da1204f?w=6550&h=4367&fit=crop", }, ], } @@ -231,8 +231,8 @@ exports[`patches rich text image nodes > new > group 1`] = ` "field": [ { "spans": [], - "text": "Nulla Aliquet Porttitor Lacus Luctus", - "type": "heading2", + "text": "Donec Enim Diam Vulputate Ut Pharetra Sit Amet Aliquam", + "type": "heading4", }, { "alt": null, @@ -247,9 +247,9 @@ exports[`patches rich text image nodes > new > group 1`] = ` "y": 0, "zoom": 1, }, - "id": "cdfdd322ca9", + "id": "c1d5d24feae", "type": "image", - "url": "https://images.unsplash.com/photo-1431794062232-2a99a5431c6c?w=6000&h=4000&fit=crop", + "url": "https://images.unsplash.com/photo-1504198266287-1659872e6590?w=4272&h=2848&fit=crop", }, ], }, @@ -261,14 +261,14 @@ exports[`patches rich text image nodes > new > shared slice 1`] = ` { "slices": [ { - "id": "2ff58c741ba", + "id": "b9dd0f2c3f8", "items": [ { "field": [ { "spans": [], - "text": "Eu Mi", - "type": "heading3", + "text": "A molestie lorem ipsum dolor sit amet consectetur adipiscing elit ut", + "type": "list-item", }, { "alt": null, @@ -283,9 +283,9 @@ exports[`patches rich text image nodes > new > shared slice 1`] = ` "y": 0, "zoom": 1, }, - "id": "bc31787853a", + "id": "961adcf1f5d", "type": "image", - "url": "https://images.unsplash.com/photo-1470770903676-69b98201ea1c?w=4554&h=3036&fit=crop", + "url": "https://images.unsplash.com/photo-1418065460487-3e41a6c84dc5?w=2200&h=1467&fit=crop", }, ], }, @@ -294,8 +294,8 @@ exports[`patches rich text image nodes > new > shared slice 1`] = ` "field": [ { "spans": [], - "text": "Fringilla Phasellus Faucibus Scelerisque Eleifend Donec Pretium", - "type": "heading3", + "text": "Egestas maecenas pharetra convallis posuere morbi leo urna molestie at. Cras fermentum odio eu feugiat pretium.", + "type": "preformatted", }, { "alt": null, @@ -310,9 +310,9 @@ exports[`patches rich text image nodes > new > shared slice 1`] = ` "y": 0, "zoom": 1, }, - "id": "bc31787853a", + "id": "961adcf1f5d", "type": "image", - "url": "https://images.unsplash.com/photo-1470770903676-69b98201ea1c?w=4554&h=3036&fit=crop", + "url": "https://images.unsplash.com/photo-1418065460487-3e41a6c84dc5?w=2200&h=1467&fit=crop", }, ], "group": [ @@ -320,8 +320,8 @@ exports[`patches rich text image nodes > new > shared slice 1`] = ` "field": [ { "spans": [], - "text": "Arcu", - "type": "heading1", + "text": "Vel Elit Scelerisque Mauris Pellentesque Pulvinar Pellentesque", + "type": "heading3", }, { "alt": null, @@ -336,18 +336,18 @@ exports[`patches rich text image nodes > new > shared slice 1`] = ` "y": 0, "zoom": 1, }, - "id": "bc31787853a", + "id": "961adcf1f5d", "type": "image", - "url": "https://images.unsplash.com/photo-1470770903676-69b98201ea1c?w=4554&h=3036&fit=crop", + "url": "https://images.unsplash.com/photo-1418065460487-3e41a6c84dc5?w=2200&h=1467&fit=crop", }, ], }, ], }, "slice_label": null, - "slice_type": "at", - "variation": "tortor", - "version": "a79b9dd", + "slice_type": "dignissim", + "variation": "vitae", + "version": "bfc9053", }, ], } @@ -357,14 +357,14 @@ exports[`patches rich text image nodes > new > slice 1`] = ` { "slices": [ { - "id": "e93cc3e4f28", + "id": "306297c5eda", "items": [ { "field": [ { "spans": [], - "text": "Habitasse platea dictumst quisque sagittis purus sit", - "type": "o-list-item", + "text": "Diam Ut Venenatis Tellus", + "type": "heading6", }, { "alt": null, @@ -379,9 +379,9 @@ exports[`patches rich text image nodes > new > slice 1`] = ` "y": 0, "zoom": 1, }, - "id": "7963dc361cc", + "id": "61cc54f4a69", "type": "image", - "url": "https://images.unsplash.com/photo-1470770903676-69b98201ea1c?w=4554&h=3036&fit=crop", + "url": "https://images.unsplash.com/photo-1604537466608-109fa2f16c3b?w=4240&h=2832&fit=crop", }, ], }, @@ -390,8 +390,8 @@ exports[`patches rich text image nodes > new > slice 1`] = ` "field": [ { "spans": [], - "text": "Ac Orci Phasellus Egestas Tellus", - "type": "heading5", + "text": "Tincidunt Vitae Semper Quis Lectus Nulla", + "type": "heading4", }, { "alt": null, @@ -406,14 +406,14 @@ exports[`patches rich text image nodes > new > slice 1`] = ` "y": 0, "zoom": 1, }, - "id": "7963dc361cc", + "id": "61cc54f4a69", "type": "image", - "url": "https://images.unsplash.com/photo-1470770903676-69b98201ea1c?w=4554&h=3036&fit=crop", + "url": "https://images.unsplash.com/photo-1604537466608-109fa2f16c3b?w=4240&h=2832&fit=crop", }, ], }, - "slice_label": "Pellentesque", - "slice_type": "nulla_posuere", + "slice_label": "Aliquet", + "slice_type": "vel", }, ], } @@ -424,8 +424,8 @@ exports[`patches rich text image nodes > new > static zone 1`] = ` "field": [ { "spans": [], - "text": "Elementum Integer", - "type": "heading6", + "text": "Interdum Velit Euismod", + "type": "heading5", }, { "alt": null, @@ -440,9 +440,9 @@ exports[`patches rich text image nodes > new > static zone 1`] = ` "y": 0, "zoom": 1, }, - "id": "0bbad670dad", + "id": "ed908b1e225", "type": "image", - "url": "https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05?w=7372&h=4392&fit=crop", + "url": "https://images.unsplash.com/photo-1446329813274-7c9036bd9a1f?w=6000&h=4000&fit=crop", }, ], } @@ -455,8 +455,8 @@ exports[`patches rich text image nodes > newLinkTo > group 1`] = ` "field": [ { "spans": [], - "text": "Nulla Aliquet Porttitor Lacus Luctus", - "type": "heading2", + "text": "Donec Enim Diam Vulputate Ut Pharetra Sit Amet Aliquam", + "type": "heading4", }, { "alt": null, @@ -471,7 +471,7 @@ exports[`patches rich text image nodes > newLinkTo > group 1`] = ` "y": 0, "zoom": 1, }, - "id": "cdfdd322ca9", + "id": "c1d5d24feae", "linkTo": { "id": "id-existing", "isBroken": false, @@ -481,7 +481,7 @@ exports[`patches rich text image nodes > newLinkTo > group 1`] = ` "type": "orci", }, "type": "image", - "url": "https://images.unsplash.com/photo-1431794062232-2a99a5431c6c?w=6000&h=4000&fit=crop", + "url": "https://images.unsplash.com/photo-1504198266287-1659872e6590?w=4272&h=2848&fit=crop", }, ], }, @@ -493,14 +493,14 @@ exports[`patches rich text image nodes > newLinkTo > shared slice 1`] = ` { "slices": [ { - "id": "2ff58c741ba", + "id": "b9dd0f2c3f8", "items": [ { "field": [ { "spans": [], - "text": "Eu Mi", - "type": "heading3", + "text": "A molestie lorem ipsum dolor sit amet consectetur adipiscing elit ut", + "type": "list-item", }, { "alt": null, @@ -515,7 +515,7 @@ exports[`patches rich text image nodes > newLinkTo > shared slice 1`] = ` "y": 0, "zoom": 1, }, - "id": "bc31787853a", + "id": "961adcf1f5d", "linkTo": { "id": "id-existing", "isBroken": false, @@ -527,7 +527,7 @@ exports[`patches rich text image nodes > newLinkTo > shared slice 1`] = ` "type": "dui", }, "type": "image", - "url": "https://images.unsplash.com/photo-1470770903676-69b98201ea1c?w=4554&h=3036&fit=crop", + "url": "https://images.unsplash.com/photo-1418065460487-3e41a6c84dc5?w=2200&h=1467&fit=crop", }, ], }, @@ -536,8 +536,8 @@ exports[`patches rich text image nodes > newLinkTo > shared slice 1`] = ` "field": [ { "spans": [], - "text": "Fringilla Phasellus Faucibus Scelerisque Eleifend Donec Pretium", - "type": "heading3", + "text": "Egestas maecenas pharetra convallis posuere morbi leo urna molestie at. Cras fermentum odio eu feugiat pretium.", + "type": "preformatted", }, { "alt": null, @@ -552,7 +552,7 @@ exports[`patches rich text image nodes > newLinkTo > shared slice 1`] = ` "y": 0, "zoom": 1, }, - "id": "bc31787853a", + "id": "961adcf1f5d", "linkTo": { "id": "id-existing", "isBroken": false, @@ -564,7 +564,7 @@ exports[`patches rich text image nodes > newLinkTo > shared slice 1`] = ` "type": "dui", }, "type": "image", - "url": "https://images.unsplash.com/photo-1470770903676-69b98201ea1c?w=4554&h=3036&fit=crop", + "url": "https://images.unsplash.com/photo-1418065460487-3e41a6c84dc5?w=2200&h=1467&fit=crop", }, ], "group": [ @@ -572,8 +572,8 @@ exports[`patches rich text image nodes > newLinkTo > shared slice 1`] = ` "field": [ { "spans": [], - "text": "Arcu", - "type": "heading1", + "text": "Vel Elit Scelerisque Mauris Pellentesque Pulvinar Pellentesque", + "type": "heading3", }, { "alt": null, @@ -588,7 +588,7 @@ exports[`patches rich text image nodes > newLinkTo > shared slice 1`] = ` "y": 0, "zoom": 1, }, - "id": "bc31787853a", + "id": "961adcf1f5d", "linkTo": { "id": "id-existing", "isBroken": false, @@ -600,16 +600,16 @@ exports[`patches rich text image nodes > newLinkTo > shared slice 1`] = ` "type": "dui", }, "type": "image", - "url": "https://images.unsplash.com/photo-1470770903676-69b98201ea1c?w=4554&h=3036&fit=crop", + "url": "https://images.unsplash.com/photo-1418065460487-3e41a6c84dc5?w=2200&h=1467&fit=crop", }, ], }, ], }, "slice_label": null, - "slice_type": "at", - "variation": "tortor", - "version": "a79b9dd", + "slice_type": "dignissim", + "variation": "vitae", + "version": "bfc9053", }, ], } @@ -619,14 +619,14 @@ exports[`patches rich text image nodes > newLinkTo > slice 1`] = ` { "slices": [ { - "id": "e93cc3e4f28", + "id": "306297c5eda", "items": [ { "field": [ { "spans": [], - "text": "Habitasse platea dictumst quisque sagittis purus sit", - "type": "o-list-item", + "text": "Diam Ut Venenatis Tellus", + "type": "heading6", }, { "alt": null, @@ -641,7 +641,7 @@ exports[`patches rich text image nodes > newLinkTo > slice 1`] = ` "y": 0, "zoom": 1, }, - "id": "7963dc361cc", + "id": "61cc54f4a69", "linkTo": { "id": "id-existing", "isBroken": false, @@ -653,7 +653,7 @@ exports[`patches rich text image nodes > newLinkTo > slice 1`] = ` "type": "amet", }, "type": "image", - "url": "https://images.unsplash.com/photo-1470770903676-69b98201ea1c?w=4554&h=3036&fit=crop", + "url": "https://images.unsplash.com/photo-1604537466608-109fa2f16c3b?w=4240&h=2832&fit=crop", }, ], }, @@ -662,8 +662,8 @@ exports[`patches rich text image nodes > newLinkTo > slice 1`] = ` "field": [ { "spans": [], - "text": "Ac Orci Phasellus Egestas Tellus", - "type": "heading5", + "text": "Tincidunt Vitae Semper Quis Lectus Nulla", + "type": "heading4", }, { "alt": null, @@ -678,7 +678,7 @@ exports[`patches rich text image nodes > newLinkTo > slice 1`] = ` "y": 0, "zoom": 1, }, - "id": "7963dc361cc", + "id": "61cc54f4a69", "linkTo": { "id": "id-existing", "isBroken": false, @@ -690,12 +690,12 @@ exports[`patches rich text image nodes > newLinkTo > slice 1`] = ` "type": "amet", }, "type": "image", - "url": "https://images.unsplash.com/photo-1470770903676-69b98201ea1c?w=4554&h=3036&fit=crop", + "url": "https://images.unsplash.com/photo-1604537466608-109fa2f16c3b?w=4240&h=2832&fit=crop", }, ], }, - "slice_label": "Pellentesque", - "slice_type": "nulla_posuere", + "slice_label": "Aliquet", + "slice_type": "vel", }, ], } @@ -706,8 +706,8 @@ exports[`patches rich text image nodes > newLinkTo > static zone 1`] = ` "field": [ { "spans": [], - "text": "Elementum Integer", - "type": "heading6", + "text": "Interdum Velit Euismod", + "type": "heading5", }, { "alt": null, @@ -722,7 +722,7 @@ exports[`patches rich text image nodes > newLinkTo > static zone 1`] = ` "y": 0, "zoom": 1, }, - "id": "0bbad670dad", + "id": "ed908b1e225", "linkTo": { "id": "id-existing", "isBroken": false, @@ -732,7 +732,7 @@ exports[`patches rich text image nodes > newLinkTo > static zone 1`] = ` "type": "phasellus", }, "type": "image", - "url": "https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05?w=7372&h=4392&fit=crop", + "url": "https://images.unsplash.com/photo-1446329813274-7c9036bd9a1f?w=6000&h=4000&fit=crop", }, ], } @@ -745,25 +745,25 @@ exports[`patches rich text image nodes > otherRepository > group 1`] = ` "field": [ { "spans": [], - "text": "Nulla Aliquet Porttitor Lacus Luctus", - "type": "heading2", + "text": "Donec Enim Diam Vulputate Ut Pharetra Sit Amet Aliquam", + "type": "heading4", }, { - "alt": "Donec enim diam vulputate ut pharetra sit amet aliquam id diam", + "alt": "Feugiat sed lectus vestibulum mattis ullamcorper velit sed ullamcorper morbi", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#7cfc26", - "x": 2977, - "y": -1163, - "zoom": 1.0472585898934068, + "background": "#5c0990", + "x": 2090, + "y": -1492, + "zoom": 1.854310159304717, }, - "id": "e8d0985c099", + "id": "6442e21ad60", "type": "image", - "url": "https://images.unsplash.com/photo-1553531384-397c80973a0b", + "url": "https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05", }, ], }, @@ -775,29 +775,40 @@ exports[`patches rich text image nodes > otherRepository > shared slice 1`] = ` { "slices": [ { - "id": "2ff58c741ba", + "id": "b9dd0f2c3f8", "items": [ { "field": [ { - "spans": [], - "text": "Facilisis", - "type": "heading3", + "oembed": { + "embed_url": "https://twitter.com/prismicio/status/1354835716430319617", + "height": 113, + "html": " + +", + "thumbnail_height": null, + "thumbnail_url": null, + "thumbnail_width": null, + "type": "rich", + "version": "1.0", + "width": 200, + }, + "type": "embed", }, { - "alt": "Nullam vehicula ipsum a arcu cursus vitae congue mauris rhoncus aenean vel elit scelerisque", + "alt": "Eros donec ac odio tempor orci dapibus", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#37ae3f", - "x": -1505, - "y": 902, - "zoom": 1.8328975606320652, + "background": "#1eeca0", + "x": 1722, + "y": 1820, + "zoom": 1.8326837750693512, }, - "id": "3fc0dfa9fe9", + "id": "3a8ec9378bc", "type": "image", "url": "https://images.unsplash.com/photo-1431794062232-2a99a5431c6c", }, @@ -808,23 +819,23 @@ exports[`patches rich text image nodes > otherRepository > shared slice 1`] = ` "field": [ { "spans": [], - "text": "Fringilla Phasellus Faucibus Scelerisque Eleifend Donec Pretium", - "type": "heading3", + "text": "Egestas maecenas pharetra convallis posuere morbi leo urna molestie at. Cras fermentum odio eu feugiat pretium.", + "type": "preformatted", }, { - "alt": "Proin libero nunc consequat interdum varius", + "alt": "Aliquet lectus proin nibh nisl condimentum id venenatis a", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#904f4f", - "x": 1462, - "y": 1324, - "zoom": 1.504938844941775, + "background": "#87853a", + "x": -1429, + "y": -2019, + "zoom": 1.75840565859303, }, - "id": "3fc0dfa9fe9", + "id": "3a8ec9378bc", "type": "image", "url": "https://images.unsplash.com/photo-1431794062232-2a99a5431c6c", }, @@ -834,23 +845,23 @@ exports[`patches rich text image nodes > otherRepository > shared slice 1`] = ` "field": [ { "spans": [], - "text": "Egestas Integer Eget Aliquet Nibh", + "text": "Nunc Non Blandit Massa Enim", "type": "heading5", }, { - "alt": "Arcu cursus vitae congue mauris", + "alt": "Id faucibus nisl tincidunt eget nullam non nisi est sit amet", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#5f7a9b", - "x": -119, - "y": -2667, - "zoom": 1.9681315715350518, + "background": "#252b35", + "x": 855, + "y": 1518, + "zoom": 1.5250952426635416, }, - "id": "3fc0dfa9fe9", + "id": "3a8ec9378bc", "type": "image", "url": "https://images.unsplash.com/photo-1431794062232-2a99a5431c6c", }, @@ -859,9 +870,9 @@ exports[`patches rich text image nodes > otherRepository > shared slice 1`] = ` ], }, "slice_label": null, - "slice_type": "at", - "variation": "tortor", - "version": "a79b9dd", + "slice_type": "dignissim", + "variation": "vitae", + "version": "bfc9053", }, ], } @@ -871,29 +882,29 @@ exports[`patches rich text image nodes > otherRepository > slice 1`] = ` { "slices": [ { - "id": "e93cc3e4f28", + "id": "306297c5eda", "items": [ { "field": [ { "spans": [], - "text": "Amet", - "type": "heading5", + "text": "At Ultrices Mi Tempus Imperdiet", + "type": "heading2", }, { - "alt": "Auctor neque vitae tempus quam", + "alt": "Sed id semper risus in hendrerit gravida rutrum", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#5bc5aa", - "x": -1072, - "y": -281, - "zoom": 1.3767766101231744, + "background": "#104dde", + "x": -1621, + "y": -870, + "zoom": 1.7278759511485409, }, - "id": "f70ca27104d", + "id": "2003a644c30", "type": "image", "url": "https://images.unsplash.com/photo-1426604966848-d7adac402bff", }, @@ -904,30 +915,30 @@ exports[`patches rich text image nodes > otherRepository > slice 1`] = ` "field": [ { "spans": [], - "text": "Ac Orci Phasellus Egestas Tellus", - "type": "heading5", + "text": "Tincidunt Vitae Semper Quis Lectus Nulla", + "type": "heading4", }, { - "alt": "Urna id volutpat lacus laoreet non curabitur gravida arcu ac tortor", + "alt": "Sed nisi lacus sed viverra tellus in hac habitasse", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#4860cb", - "x": 280, - "y": -379, - "zoom": 1.2389796902982004, + "background": "#63a6c9", + "x": -1609, + "y": -1609, + "zoom": 1.7054690955452316, }, - "id": "f70ca27104d", + "id": "2003a644c30", "type": "image", "url": "https://images.unsplash.com/photo-1426604966848-d7adac402bff", }, ], }, - "slice_label": "Pellentesque", - "slice_type": "nulla_posuere", + "slice_label": "Aliquet", + "slice_type": "vel", }, ], } @@ -938,25 +949,25 @@ exports[`patches rich text image nodes > otherRepository > static zone 1`] = ` "field": [ { "spans": [], - "text": "Elementum Integer", - "type": "heading6", + "text": "Interdum Velit Euismod", + "type": "heading5", }, { - "alt": "Interdum velit euismod in pellentesque", + "alt": "Tortor consequat id porta nibh", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#ab1d17", - "x": 3605, - "y": 860, - "zoom": 1.9465488211593005, + "background": "#c61c37", + "x": 349, + "y": -429, + "zoom": 1.4911347686990943, }, - "id": "04a95cc61c3", + "id": "ff1efb2b271", "type": "image", - "url": "https://images.unsplash.com/photo-1418065460487-3e41a6c84dc5", + "url": "https://images.unsplash.com/photo-1497436072909-60f360e1d4b1", }, ], } @@ -969,23 +980,23 @@ exports[`patches rich text image nodes > otherRepositoryLinkTo > group 1`] = ` "field": [ { "spans": [], - "text": "Nulla Aliquet Porttitor Lacus Luctus", - "type": "heading2", + "text": "Donec Enim Diam Vulputate Ut Pharetra Sit Amet Aliquam", + "type": "heading4", }, { - "alt": "Donec enim diam vulputate ut pharetra sit amet aliquam id diam", + "alt": "Feugiat sed lectus vestibulum mattis ullamcorper velit sed ullamcorper morbi", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#7cfc26", - "x": 2977, - "y": -1163, - "zoom": 1.0472585898934068, + "background": "#5c0990", + "x": 2090, + "y": -1492, + "zoom": 1.854310159304717, }, - "id": "e8d0985c099", + "id": "6442e21ad60", "linkTo": { "id": "id-existing", "isBroken": false, @@ -995,7 +1006,7 @@ exports[`patches rich text image nodes > otherRepositoryLinkTo > group 1`] = ` "type": "orci", }, "type": "image", - "url": "https://images.unsplash.com/photo-1553531384-397c80973a0b", + "url": "https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05", }, ], }, @@ -1007,29 +1018,40 @@ exports[`patches rich text image nodes > otherRepositoryLinkTo > shared slice 1` { "slices": [ { - "id": "2ff58c741ba", + "id": "b9dd0f2c3f8", "items": [ { "field": [ { - "spans": [], - "text": "Facilisis", - "type": "heading3", + "oembed": { + "embed_url": "https://twitter.com/prismicio/status/1354835716430319617", + "height": 113, + "html": " + +", + "thumbnail_height": null, + "thumbnail_url": null, + "thumbnail_width": null, + "type": "rich", + "version": "1.0", + "width": 200, + }, + "type": "embed", }, { - "alt": "Nullam vehicula ipsum a arcu cursus vitae congue mauris rhoncus aenean vel elit scelerisque", + "alt": "Eros donec ac odio tempor orci dapibus", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#37ae3f", - "x": -1505, - "y": 902, - "zoom": 1.8328975606320652, + "background": "#1eeca0", + "x": 1722, + "y": 1820, + "zoom": 1.8326837750693512, }, - "id": "3fc0dfa9fe9", + "id": "3a8ec9378bc", "linkTo": { "id": "id-existing", "isBroken": false, @@ -1050,23 +1072,23 @@ exports[`patches rich text image nodes > otherRepositoryLinkTo > shared slice 1` "field": [ { "spans": [], - "text": "Fringilla Phasellus Faucibus Scelerisque Eleifend Donec Pretium", - "type": "heading3", + "text": "Egestas maecenas pharetra convallis posuere morbi leo urna molestie at. Cras fermentum odio eu feugiat pretium.", + "type": "preformatted", }, { - "alt": "Proin libero nunc consequat interdum varius", + "alt": "Aliquet lectus proin nibh nisl condimentum id venenatis a", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#904f4f", - "x": 1462, - "y": 1324, - "zoom": 1.504938844941775, + "background": "#87853a", + "x": -1429, + "y": -2019, + "zoom": 1.75840565859303, }, - "id": "3fc0dfa9fe9", + "id": "3a8ec9378bc", "linkTo": { "id": "id-existing", "isBroken": false, @@ -1086,23 +1108,23 @@ exports[`patches rich text image nodes > otherRepositoryLinkTo > shared slice 1` "field": [ { "spans": [], - "text": "Egestas Integer Eget Aliquet Nibh", + "text": "Nunc Non Blandit Massa Enim", "type": "heading5", }, { - "alt": "Arcu cursus vitae congue mauris", + "alt": "Id faucibus nisl tincidunt eget nullam non nisi est sit amet", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#5f7a9b", - "x": -119, - "y": -2667, - "zoom": 1.9681315715350518, + "background": "#252b35", + "x": 855, + "y": 1518, + "zoom": 1.5250952426635416, }, - "id": "3fc0dfa9fe9", + "id": "3a8ec9378bc", "linkTo": { "id": "id-existing", "isBroken": false, @@ -1121,9 +1143,9 @@ exports[`patches rich text image nodes > otherRepositoryLinkTo > shared slice 1` ], }, "slice_label": null, - "slice_type": "at", - "variation": "tortor", - "version": "a79b9dd", + "slice_type": "dignissim", + "variation": "vitae", + "version": "bfc9053", }, ], } @@ -1133,29 +1155,29 @@ exports[`patches rich text image nodes > otherRepositoryLinkTo > slice 1`] = ` { "slices": [ { - "id": "e93cc3e4f28", + "id": "306297c5eda", "items": [ { "field": [ { "spans": [], - "text": "Amet", - "type": "heading5", + "text": "At Ultrices Mi Tempus Imperdiet", + "type": "heading2", }, { - "alt": "Auctor neque vitae tempus quam", + "alt": "Sed id semper risus in hendrerit gravida rutrum", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#5bc5aa", - "x": -1072, - "y": -281, - "zoom": 1.3767766101231744, + "background": "#104dde", + "x": -1621, + "y": -870, + "zoom": 1.7278759511485409, }, - "id": "f70ca27104d", + "id": "2003a644c30", "linkTo": { "id": "id-existing", "isBroken": false, @@ -1176,23 +1198,23 @@ exports[`patches rich text image nodes > otherRepositoryLinkTo > slice 1`] = ` "field": [ { "spans": [], - "text": "Ac Orci Phasellus Egestas Tellus", - "type": "heading5", + "text": "Tincidunt Vitae Semper Quis Lectus Nulla", + "type": "heading4", }, { - "alt": "Urna id volutpat lacus laoreet non curabitur gravida arcu ac tortor", + "alt": "Sed nisi lacus sed viverra tellus in hac habitasse", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#4860cb", - "x": 280, - "y": -379, - "zoom": 1.2389796902982004, + "background": "#63a6c9", + "x": -1609, + "y": -1609, + "zoom": 1.7054690955452316, }, - "id": "f70ca27104d", + "id": "2003a644c30", "linkTo": { "id": "id-existing", "isBroken": false, @@ -1208,8 +1230,8 @@ exports[`patches rich text image nodes > otherRepositoryLinkTo > slice 1`] = ` }, ], }, - "slice_label": "Pellentesque", - "slice_type": "nulla_posuere", + "slice_label": "Aliquet", + "slice_type": "vel", }, ], } @@ -1220,23 +1242,23 @@ exports[`patches rich text image nodes > otherRepositoryLinkTo > static zone 1`] "field": [ { "spans": [], - "text": "Elementum Integer", - "type": "heading6", + "text": "Interdum Velit Euismod", + "type": "heading5", }, { - "alt": "Interdum velit euismod in pellentesque", + "alt": "Tortor consequat id porta nibh", "copyright": null, "dimensions": { "height": 1, "width": 1, }, "edit": { - "background": "#ab1d17", - "x": 3605, - "y": 860, - "zoom": 1.9465488211593005, + "background": "#c61c37", + "x": 349, + "y": -429, + "zoom": 1.4911347686990943, }, - "id": "04a95cc61c3", + "id": "ff1efb2b271", "linkTo": { "id": "id-existing", "isBroken": false, @@ -1246,7 +1268,7 @@ exports[`patches rich text image nodes > otherRepositoryLinkTo > static zone 1`] "type": "phasellus", }, "type": "image", - "url": "https://images.unsplash.com/photo-1418065460487-3e41a6c84dc5", + "url": "https://images.unsplash.com/photo-1497436072909-60f360e1d4b1", }, ], } diff --git a/test/__testutils__/testMigrationFieldPatching.ts b/test/__testutils__/testMigrationFieldPatching.ts index e9650ea5..3dd88d58 100644 --- a/test/__testutils__/testMigrationFieldPatching.ts +++ b/test/__testutils__/testMigrationFieldPatching.ts @@ -22,12 +22,15 @@ type GetDataArgs = { migration: prismic.Migration existingAssets: Asset[] existingDocuments: prismic.PrismicDocument[] - migrationDocuments: prismic.MigrationDocument[] + migrationDocuments: { + other: prismic.PrismicMigrationDocument + otherRepository: prismic.PrismicMigrationDocument + } mockedDomain: string } type InternalTestMigrationFieldPatchingArgs = { - getData: (args: GetDataArgs) => prismic.MigrationDocumentValue["data"] + getData: (args: GetDataArgs) => prismic.ExistingPrismicDocument["data"] expectStrictEqual?: boolean } @@ -51,11 +54,15 @@ const internalTestMigrationFieldPatching = ( }) queryResponse[0].results[0].id = "id-existing" - const otherDocument = { + const { id: _id, ...otherDocument } = { ...ctx.mock.value.document(), uid: ctx.mock.value.keyText(), } - const newDocument = ctx.mock.value.document() + const otherRepositoryDocument = { + ...ctx.mock.value.document(), + uid: ctx.mock.value.keyText(), + } + const { id: __id, ...newDocument } = ctx.mock.value.document() const newID = "id-new" @@ -68,7 +75,11 @@ const internalTestMigrationFieldPatching = ( const { documentsDatabase } = mockPrismicMigrationAPI({ ctx, client, - newDocuments: [{ id: "id-migration" }, { id: newID }], + newDocuments: [ + { id: "id-other" }, + { id: "id-other-repository" }, + { id: newID }, + ], }) const mockedDomain = `https://${client.repositoryName}.example.com` @@ -85,12 +96,21 @@ const internalTestMigrationFieldPatching = ( "other", ) + const migrationOtherRepositoryDocument = + migration.createDocumentFromPrismic( + otherRepositoryDocument, + "other-repository", + ) + newDocument.data = args.getData({ ctx, migration, existingAssets: assetsDatabase.flat(), existingDocuments: queryResponse[0].results, - migrationDocuments: [migrationOtherDocument], + migrationDocuments: { + other: migrationOtherDocument, + otherRepository: migrationOtherRepositoryDocument, + }, mockedDomain, }) @@ -115,7 +135,7 @@ const internalTestMigrationFieldPatching = ( type TestMigrationFieldPatchingFactoryCases = Record< string, - (args: GetDataArgs) => prismic.MigrationDocumentValue["data"][string] + (args: GetDataArgs) => prismic.ExistingPrismicDocument["data"][string] > export const testMigrationFieldPatching = ( diff --git a/test/migration-createDocument.test.ts b/test/migration-createDocument.test.ts index 0877330b..7affcaca 100644 --- a/test/migration-createDocument.test.ts +++ b/test/migration-createDocument.test.ts @@ -4,12 +4,12 @@ import type { MockFactory } from "@prismicio/mock" import * as prismic from "../src" import type { MigrationAssetConfig } from "../src/types/migration/Asset" -import { MigrationDocument } from "../src/types/migration/Document" +import { PrismicMigrationDocument } from "../src/types/migration/Document" it("creates a document", () => { const migration = prismic.createMigration() - const document: prismic.MigrationDocumentValue = { + const document: prismic.PendingPrismicDocument = { type: "type", uid: "uid", lang: "lang", @@ -20,7 +20,7 @@ it("creates a document", () => { migration.createDocument(document, documentTitle) expect(migration._documents[0]).toStrictEqual( - new MigrationDocument(document, { documentTitle }), + new PrismicMigrationDocument(document, documentTitle, { dependencies: [] }), ) }) @@ -33,7 +33,7 @@ it("creates a document from an existing Prismic document", (ctx) => { migration.createDocument(document, documentTitle) expect(migration._documents[0]).toStrictEqual( - new MigrationDocument(document, { documentTitle }), + new PrismicMigrationDocument(document, documentTitle, { dependencies: [] }), ) }) @@ -184,7 +184,7 @@ describe.each<{ const { id, field, expected } = getField(mock) - const document: prismic.MigrationDocumentValue = { + const document: prismic.PendingPrismicDocument = { type: "type", uid: "uid", lang: "lang", @@ -204,7 +204,7 @@ describe.each<{ const { id, field, expected } = getField(mock) - const document: prismic.MigrationDocumentValue = { + const document: prismic.PendingPrismicDocument = { type: "type", uid: "uid", lang: "lang", @@ -234,7 +234,7 @@ describe.each<{ }, ] - const document: prismic.MigrationDocumentValue = { + const document: prismic.PendingPrismicDocument = { type: "type", uid: "uid", lang: "lang", @@ -264,7 +264,7 @@ describe.each<{ }, ] - const document: prismic.MigrationDocumentValue = { + const document: prismic.PendingPrismicDocument = { type: "type", uid: "uid", lang: "lang", diff --git a/test/migration-updateDocument.test.ts b/test/migration-updateDocument.test.ts index d48aaf58..ea93fcdb 100644 --- a/test/migration-updateDocument.test.ts +++ b/test/migration-updateDocument.test.ts @@ -1,7 +1,7 @@ import { expect, it } from "vitest" import * as prismic from "../src" -import { MigrationDocument } from "../src/types/migration/Document" +import { PrismicMigrationDocument } from "../src/types/migration/Document" it("updates a document", (ctx) => { const migration = prismic.createMigration() @@ -11,7 +11,7 @@ it("updates a document", (ctx) => { migration.updateDocument(document, documentTitle) - const expectedDocument = new MigrationDocument(document, { documentTitle }) - expectedDocument._mode = "update" - expect(migration._documents[0]).toStrictEqual(expectedDocument) + expect(migration._documents[0]).toStrictEqual( + new PrismicMigrationDocument(document, documentTitle, { dependencies: [] }), + ) }) diff --git a/test/types/migration-document.types.ts b/test/types/migration-document.types.ts index e43626a3..afe5ccea 100644 --- a/test/types/migration-document.types.ts +++ b/test/types/migration-document.types.ts @@ -3,7 +3,7 @@ import { expectNever, expectType } from "ts-expect" import type * as prismic from "../../src" -;(value: prismic.MigrationDocumentValue): true => { +;(value: prismic.PendingPrismicDocument): true => { switch (typeof value) { case "object": { if (value === null) { @@ -19,7 +19,7 @@ import type * as prismic from "../../src" } } -expectType({ +expectType({ uid: "", type: "", lang: "", @@ -29,7 +29,7 @@ expectType({ /** * Supports any field when generic. */ -expectType({ +expectType({ uid: "", type: "", lang: "", @@ -39,12 +39,12 @@ expectType({ }) /** - * `PrismicDocument` is assignable to `MigrationDocumentValue` with added + * `PrismicDocument` is assignable to `PendingPrismicDocument` with added * `title`. */ expectType< TypeOf< - prismic.MigrationDocumentValue, + prismic.PendingPrismicDocument, prismic.PrismicDocument & { title: string } > >(true) @@ -55,7 +55,7 @@ type BarDocument = prismic.PrismicDocument<{ bar: prismic.KeyTextField }, "bar"> type BazDocument = prismic.PrismicDocument, "baz"> type Documents = FooDocument | BarDocument | BazDocument -type MigrationDocuments = prismic.MigrationDocumentValue +type MigrationDocuments = prismic.PendingPrismicDocument /** * Infers data type from document type. @@ -128,7 +128,7 @@ type SliceDocument = prismic.PrismicDocument< > type AdvancedDocuments = StaticDocument | GroupDocument | SliceDocument type MigrationAdvancedDocuments = - prismic.MigrationDocumentValue + prismic.PendingPrismicDocument // Static expectType({ diff --git a/test/types/migration.types.ts b/test/types/migration.types.ts index f3c3bd2d..ca79adab 100644 --- a/test/types/migration.types.ts +++ b/test/types/migration.types.ts @@ -7,9 +7,18 @@ import * as prismic from "../../src" const defaultMigration = prismic.createMigration() // Migration Documents -type FooDocument = prismic.PrismicDocument, "foo"> -type BarDocument = prismic.PrismicDocument, "bar"> -type BazDocument = prismic.PrismicDocument, "baz"> +type FooDocument = prismic.PrismicDocumentWithUID< + { foo: prismic.KeyTextField }, + "foo" +> +type BarDocument = prismic.PrismicDocumentWithUID< + { bar: prismic.KeyTextField }, + "bar" +> +type BazDocument = prismic.PrismicDocumentWithoutUID< + { baz: prismic.KeyTextField }, + "baz" +> type Documents = FooDocument | BarDocument | BazDocument const documentsMigration = prismic.createMigration() @@ -123,7 +132,7 @@ expectType< >(true) /** - * createDocument - basic + * createDocument */ // Default @@ -136,9 +145,9 @@ const defaultCreateDocument = defaultMigration.createDocument( }, "", ) -expectType>( - true, -) +expectType< + TypeEqual +>(true) // Documents const documentsCreateDocument = documentsMigration.createDocument( @@ -146,13 +155,404 @@ const documentsCreateDocument = documentsMigration.createDocument( type: "foo", uid: "", lang: "", - data: {}, + data: { + foo: "", + }, }, "", ) expectType< TypeEqual< typeof documentsCreateDocument, - prismic.MigrationDocument + prismic.PrismicMigrationDocument + > +>(true) + +documentsMigration.createDocument( + { + type: "baz", + lang: "", + data: { + baz: "", + }, + }, + "", +) + +documentsMigration.createDocument( + { + type: "baz", + // @ts-expect-error - Type 'string' is not assignable to type 'null | undefined'. + uid: "", + lang: "", + data: { + baz: "", + }, + }, + "", +) + +documentsMigration.createDocument( + { + type: "foo", + uid: "", + lang: "", + // @ts-expect-error - Property 'foo' is missing + data: {}, + }, + "", +) + +documentsMigration.createDocument( + { + type: "foo", + uid: "", + lang: "", + data: { + // @ts-expect-error - Type 'number' is not assignable to type 'KeyTextField' + foo: 1, + }, + }, + "", +) + +documentsMigration.createDocument( + { + type: "foo", + uid: "", + lang: "", + data: { + foo: "", + // @ts-expect-error - Object literal may only specify known properties + bar: "", + }, + }, + "", +) +/** + * updateDocument + */ + +// Default +const defaultUpdateDocument = defaultMigration.updateDocument( + { + id: "", + type: "", + lang: "", + data: {}, + tags: [], + href: "", + url: "", + last_publication_date: `0-0-0T0:0:0+0`, + first_publication_date: `0-0-0T0:0:0+0`, + slugs: [], + alternate_languages: [], + linked_documents: [], + }, + "", +) +expectType< + TypeEqual +>(true) + +// Documents +const documentsUpdateDocument = documentsMigration.updateDocument( + { + id: "", + type: "foo", + uid: "", + lang: "", + data: { + foo: "", + }, + tags: [], + href: "", + url: "", + last_publication_date: `0-0-0T0:0:0+0`, + first_publication_date: `0-0-0T0:0:0+0`, + slugs: [], + alternate_languages: [], + linked_documents: [], + }, + "", +) +expectType< + TypeEqual< + typeof documentsUpdateDocument, + prismic.PrismicMigrationDocument > >(true) + +documentsMigration.updateDocument( + { + id: "", + type: "baz", + lang: "", + data: { + baz: "", + }, + tags: [], + href: "", + url: "", + last_publication_date: `0-0-0T0:0:0+0`, + first_publication_date: `0-0-0T0:0:0+0`, + slugs: [], + alternate_languages: [], + linked_documents: [], + }, + "", +) + +documentsMigration.updateDocument( + { + id: "", + type: "baz", + // @ts-expect-error - Type 'string' is not assignable to type 'null | undefined'. + uid: "", + lang: "", + data: { + baz: "", + }, + tags: [], + href: "", + url: "", + last_publication_date: `0-0-0T0:0:0+0`, + first_publication_date: `0-0-0T0:0:0+0`, + slugs: [], + alternate_languages: [], + linked_documents: [], + }, + "", +) + +documentsMigration.updateDocument( + { + id: "", + type: "foo", + uid: "", + lang: "", + // @ts-expect-error - Property 'foo' is missing + data: {}, + tags: [], + href: "", + url: "", + last_publication_date: `0-0-0T0:0:0+0`, + first_publication_date: `0-0-0T0:0:0+0`, + slugs: [], + alternate_languages: [], + linked_documents: [], + }, + "", +) + +documentsMigration.updateDocument( + { + id: "", + type: "foo", + uid: "", + lang: "", + data: { + // @ts-expect-error - Type 'number' is not assignable to type 'KeyTextField' + foo: 1, + }, + tags: [], + href: "", + url: "", + last_publication_date: `0-0-0T0:0:0+0`, + first_publication_date: `0-0-0T0:0:0+0`, + slugs: [], + alternate_languages: [], + linked_documents: [], + }, + "", +) + +documentsMigration.updateDocument( + { + id: "", + type: "foo", + uid: "", + lang: "", + data: { + foo: "", + // @ts-expect-error - Object literal may only specify known properties + bar: "", + }, + tags: [], + href: "", + url: "", + last_publication_date: `0-0-0T0:0:0+0`, + first_publication_date: `0-0-0T0:0:0+0`, + slugs: [], + alternate_languages: [], + linked_documents: [], + }, + "", +) + +/** + * createDocumentFromPrismic + */ + +// Default +const defaultCreateFromPrismicDocument = + defaultMigration.createDocumentFromPrismic( + { + id: "", + type: "", + uid: "", + lang: "", + data: {}, + tags: [], + href: "", + url: "", + last_publication_date: `0-0-0T0:0:0+0`, + first_publication_date: `0-0-0T0:0:0+0`, + slugs: [], + alternate_languages: [], + linked_documents: [], + }, + "", + ) +expectType< + TypeEqual< + typeof defaultCreateFromPrismicDocument, + prismic.PrismicMigrationDocument + > +>(true) + +// Documents +const documentsCreateFromPrismicDocument = + documentsMigration.createDocumentFromPrismic( + { + id: "", + type: "foo", + uid: "", + lang: "", + data: { + foo: "", + }, + tags: [], + href: "", + url: "", + last_publication_date: `0-0-0T0:0:0+0`, + first_publication_date: `0-0-0T0:0:0+0`, + slugs: [], + alternate_languages: [], + linked_documents: [], + }, + "", + ) +expectType< + TypeEqual< + typeof documentsCreateFromPrismicDocument, + prismic.PrismicMigrationDocument + > +>(true) + +documentsMigration.createDocumentFromPrismic( + { + id: "", + type: "baz", + lang: "", + data: { + baz: "", + }, + tags: [], + href: "", + url: "", + last_publication_date: `0-0-0T0:0:0+0`, + first_publication_date: `0-0-0T0:0:0+0`, + slugs: [], + alternate_languages: [], + linked_documents: [], + }, + "", +) + +documentsMigration.createDocumentFromPrismic( + { + id: "", + type: "baz", + // @ts-expect-error - Type 'string' is not assignable to type 'null | undefined'. + uid: "", + lang: "", + data: { + baz: "", + }, + tags: [], + href: "", + url: "", + last_publication_date: `0-0-0T0:0:0+0`, + first_publication_date: `0-0-0T0:0:0+0`, + slugs: [], + alternate_languages: [], + linked_documents: [], + }, + "", +) + +documentsMigration.createDocumentFromPrismic( + { + id: "", + type: "foo", + uid: "", + lang: "", + // @ts-expect-error - Property 'foo' is missing + data: {}, + tags: [], + href: "", + url: "", + last_publication_date: `0-0-0T0:0:0+0`, + first_publication_date: `0-0-0T0:0:0+0`, + slugs: [], + alternate_languages: [], + linked_documents: [], + }, + "", +) + +documentsMigration.createDocumentFromPrismic( + { + id: "", + type: "foo", + uid: "", + lang: "", + data: { + // @ts-expect-error - Type 'number' is not assignable to type 'KeyTextField' + foo: 1, + }, + tags: [], + href: "", + url: "", + last_publication_date: `0-0-0T0:0:0+0`, + first_publication_date: `0-0-0T0:0:0+0`, + slugs: [], + alternate_languages: [], + linked_documents: [], + }, + "", +) + +documentsMigration.createDocumentFromPrismic( + { + id: "", + type: "foo", + uid: "", + lang: "", + data: { + foo: "", + // @ts-expect-error - Object literal may only specify known properties + bar: "", + }, + tags: [], + href: "", + url: "", + last_publication_date: `0-0-0T0:0:0+0`, + first_publication_date: `0-0-0T0:0:0+0`, + slugs: [], + alternate_languages: [], + linked_documents: [], + }, + "", +) diff --git a/test/writeClient-migrate-documents.test.ts b/test/writeClient-migrate-documents.test.ts index a16c6028..73e25803 100644 --- a/test/writeClient-migrate-documents.test.ts +++ b/test/writeClient-migrate-documents.test.ts @@ -77,7 +77,7 @@ it.concurrent("discovers existing documents", async (ctx) => { }) }) -it.concurrent("skips creating existing documents (update)", async (ctx) => { +it.concurrent("skips creating existing documents", async (ctx) => { const client = createTestWriteClient({ ctx }) const queryResponse = createPagedQueryResponses({ @@ -102,48 +102,7 @@ it.concurrent("skips creating existing documents (update)", async (ctx) => { expect(reporter).toHaveBeenCalledWith({ type: "documents:skipping", data: { - reason: "already exists", - current: 1, - remaining: 0, - total: 1, - document: migrationDocument, - }, - }) - expect(reporter).toHaveBeenCalledWith({ - type: "documents:created", - data: { - created: 0, - documents: expect.anything(), - }, - }) -}) - -it.concurrent("skips creating existing documents (auto)", async (ctx) => { - const client = createTestWriteClient({ ctx }) - - const queryResponse = createPagedQueryResponses({ - ctx, - pages: 1, - pageSize: 1, - }) - const document = queryResponse[0].results[0] - - mockPrismicRestAPIV2({ ctx, queryResponse }) - mockPrismicAssetAPI({ ctx, client }) - mockPrismicMigrationAPI({ ctx, client, existingDocuments: [document] }) - - const migration = prismic.createMigration() - - const migrationDocument = migration.createDocument(document, "foo") - - const reporter = vi.fn() - - await client.migrate(migration, { reporter }) - - expect(reporter).toHaveBeenCalledWith({ - type: "documents:skipping", - data: { - reason: "already exists", + reason: "exists", current: 1, remaining: 0, total: 1, @@ -162,7 +121,7 @@ it.concurrent("skips creating existing documents (auto)", async (ctx) => { it.concurrent("creates new documents", async (ctx) => { const client = createTestWriteClient({ ctx }) - const document = ctx.mock.value.document() + const { id: _id, ...document } = ctx.mock.value.document() const newDocument = { id: "foo" } mockPrismicRestAPIV2({ ctx }) @@ -212,7 +171,7 @@ it.concurrent( }) const masterLanguageDocument = queryResponse[0].results[0] - const document = ctx.mock.value.document() + const { id: _id, ...document } = ctx.mock.value.document() const newDocument = { id: "foo", masterLanguageDocumentID: masterLanguageDocument.id, @@ -260,22 +219,19 @@ it.concurrent( async (ctx) => { const client = createTestWriteClient({ ctx }) - const masterLanguageDocument = - ctx.mock.value.document() as prismic.MigrationDocumentValue - const document = ctx.mock.value.document() as prismic.MigrationDocumentValue + const { id: masterLanguageDocumentID, ...masterLanguageDocument } = + ctx.mock.value.document() + const { id: documentID, ...document } = ctx.mock.value.document() const newDocuments = [ { - id: masterLanguageDocument.id!, + id: masterLanguageDocumentID, }, { - id: document.id!, - masterLanguageDocumentID: masterLanguageDocument.id!, + id: documentID, + masterLanguageDocumentID: masterLanguageDocumentID, }, ] - delete masterLanguageDocument.id - delete document.id - mockPrismicRestAPIV2({ ctx }) mockPrismicAssetAPI({ ctx, client }) mockPrismicMigrationAPI({ ctx, client, newDocuments: [...newDocuments] }) @@ -323,7 +279,7 @@ it.concurrent( }) const masterLanguageDocument = queryResponse[0].results[0] - const document = ctx.mock.value.document() + const { id: _id, ...document } = ctx.mock.value.document() const newDocument = { id: "foo", masterLanguageDocumentID: masterLanguageDocument.id, @@ -371,22 +327,19 @@ it.concurrent( async (ctx) => { const client = createTestWriteClient({ ctx }) - const masterLanguageDocument = - ctx.mock.value.document() as prismic.MigrationDocumentValue - const document = ctx.mock.value.document() as prismic.MigrationDocumentValue + const { id: masterLanguageDocumentID, ...masterLanguageDocument } = + ctx.mock.value.document() + const { id: documentID, ...document } = ctx.mock.value.document() const newDocuments = [ { - id: masterLanguageDocument.id!, + id: masterLanguageDocumentID, }, { - id: document.id!, - masterLanguageDocumentID: masterLanguageDocument.id!, + id: documentID, + masterLanguageDocumentID: masterLanguageDocumentID, }, ] - delete masterLanguageDocument.id - delete document.id - mockPrismicRestAPIV2({ ctx }) mockPrismicAssetAPI({ ctx, client }) mockPrismicMigrationAPI({ ctx, client, newDocuments: [...newDocuments] }) @@ -450,7 +403,10 @@ it.concurrent( const migration = prismic.createMigration() - const migrationDocument = migration.createDocument(document, "foo") + const migrationDocument = migration.createDocumentFromPrismic( + document, + "foo", + ) let documents: DocumentMap | undefined const reporter = vi.fn<(event: prismic.MigrateReporterEvents) => void>( @@ -482,15 +438,16 @@ it.concurrent("creates master locale documents first", async (ctx) => { const { repository, masterLocale } = createRepository(ctx) - const masterLanguageDocument = ctx.mock.value.document() + const { id: masterLanguageDocumentID, ...masterLanguageDocument } = + ctx.mock.value.document() masterLanguageDocument.lang = masterLocale - const document = ctx.mock.value.document() + const { id: documentID, ...document } = ctx.mock.value.document() const newDocuments = [ { - id: masterLanguageDocument.id, + id: masterLanguageDocumentID, }, { - id: document.id, + id: documentID, }, ] diff --git a/test/writeClient-migrate-patch-contentRelationship.test.ts b/test/writeClient-migrate-patch-contentRelationship.test.ts index 98713761..0bfc830d 100644 --- a/test/writeClient-migrate-patch-contentRelationship.test.ts +++ b/test/writeClient-migrate-patch-contentRelationship.test.ts @@ -6,37 +6,38 @@ testMigrationFieldPatching("patches link fields", { existing: ({ migration, existingDocuments }) => migration.createContentRelationship(existingDocuments[0]), migration: ({ migration, migrationDocuments }) => { - delete migrationDocuments[0].value.id + delete migrationDocuments.other.document.id - return migration.createContentRelationship(migrationDocuments[0]) + return migration.createContentRelationship(migrationDocuments.other) }, lazyExisting: ({ migration, existingDocuments }) => { return migration.createContentRelationship(() => existingDocuments[0]) }, lazyMigration: ({ migration, migrationDocuments }) => { - delete migrationDocuments[0].value.id + delete migrationDocuments.other.document.id return migration.createContentRelationship(() => migration.getByUID( - migrationDocuments[0].value.type, - migrationDocuments[0].value.uid!, + migrationDocuments.other.document.type, + migrationDocuments.other.document.uid!, ), ) }, migrationNoTags: ({ migration, migrationDocuments }) => { - migrationDocuments[0].value.tags = undefined + migrationDocuments.other.document.tags = undefined return migration.createContentRelationship(() => migration.getByUID( - migrationDocuments[0].value.type, - migrationDocuments[0].value.uid!, + migrationDocuments.other.document.type, + migrationDocuments.other.document.uid!, ), ) }, otherRepositoryContentRelationship: ({ ctx, migrationDocuments }) => { const contentRelationship = ctx.mock.value.link({ type: "Document" }) // `migrationDocuments` contains documents from "another repository" - contentRelationship.id = migrationDocuments[0].value.id! + contentRelationship.id = + migrationDocuments.otherRepository.originalPrismicDocument!.id return contentRelationship }, diff --git a/test/writeClient-migrate-patch-simpleField.test.ts b/test/writeClient-migrate-patch-simpleField.test.ts index d21619f3..0e6268cc 100644 --- a/test/writeClient-migrate-patch-simpleField.test.ts +++ b/test/writeClient-migrate-patch-simpleField.test.ts @@ -1,5 +1,7 @@ import { testMigrationFieldPatching } from "./__testutils__/testMigrationFieldPatching" +import { RichTextNodeType } from "../src" + testMigrationFieldPatching( "does not patch simple fields", { @@ -10,7 +12,9 @@ testMigrationFieldPatching( number: ({ ctx }) => ctx.mock.value.number({ state: "filled" }), keyText: ({ ctx }) => ctx.mock.value.keyText({ state: "filled" }), richTextSimple: ({ ctx }) => - ctx.mock.value.richText({ state: "filled", pattern: "long" }), + ctx.mock.value + .richText({ state: "filled", pattern: "long" }) + .filter((node) => node.type !== RichTextNodeType.image), select: ({ ctx }) => ctx.mock.value.select({ model: ctx.mock.model.select({ options: ["foo", "bar"] }), diff --git a/test/writeClient-migrate.test.ts b/test/writeClient-migrate.test.ts index 4d70c967..d9e024f9 100644 --- a/test/writeClient-migrate.test.ts +++ b/test/writeClient-migrate.test.ts @@ -37,13 +37,14 @@ it.concurrent("performs migration", async (ctx) => { const migration = prismic.createMigration() - const documentFoo: prismic.MigrationDocumentValue = ctx.mock.value.document() + const { id: _id, ...documentFoo } = + ctx.mock.value.document() as prismic.ExistingPrismicDocument documentFoo.data = { image: migration.createAsset("foo", "foo.png"), link: () => migration.getByUID("bar", "bar"), } - const documentBar = ctx.mock.value.document() + const { id: __id, ...documentBar } = ctx.mock.value.document() documentBar.type = "bar" documentBar.uid = "bar" @@ -66,8 +67,7 @@ it.concurrent("performs migration", async (ctx) => { expect(assets?.size).toBe(1) expect(assetsDatabase.flat()).toHaveLength(1) - // Documents are indexed twice, on ID, and on reference - expect(documents?.size).toBe(4) + expect(documents?.size).toBe(2) expect(Object.keys(documentsDatabase)).toHaveLength(2) expect(reporter).toHaveBeenCalledWith({ diff --git a/test/writeClient-updateDocument.test.ts b/test/writeClient-updateDocument.test.ts index 4ac07452..6e6ee357 100644 --- a/test/writeClient-updateDocument.test.ts +++ b/test/writeClient-updateDocument.test.ts @@ -107,6 +107,7 @@ it.skip("is abortable with an AbortController", async (ctx) => { client.updateDocument( document.id, { + ...document, uid: "uid", data: {}, }, @@ -135,6 +136,7 @@ it.concurrent("supports custom headers", async (ctx) => { client.updateDocument( document.id, { + ...document, uid: "uid", data: {}, },