@prismicio/client 7.10.0-alpha.0 → 7.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/dist/BaseClient.cjs +108 -0
  2. package/dist/BaseClient.cjs.map +1 -0
  3. package/dist/BaseClient.d.ts +152 -0
  4. package/dist/BaseClient.js +108 -0
  5. package/dist/BaseClient.js.map +1 -0
  6. package/dist/Client.cjs +1217 -0
  7. package/dist/Client.cjs.map +1 -0
  8. package/dist/Client.d.ts +924 -0
  9. package/dist/Client.js +1217 -0
  10. package/dist/Client.js.map +1 -0
  11. package/dist/Migration.cjs +318 -0
  12. package/dist/Migration.cjs.map +1 -0
  13. package/dist/Migration.d.ts +213 -0
  14. package/dist/Migration.js +318 -0
  15. package/dist/Migration.js.map +1 -0
  16. package/dist/WriteClient.cjs +515 -0
  17. package/dist/WriteClient.cjs.map +1 -0
  18. package/dist/WriteClient.d.ts +314 -0
  19. package/dist/WriteClient.js +515 -0
  20. package/dist/WriteClient.js.map +1 -0
  21. package/dist/createClient.cjs +2 -1215
  22. package/dist/createClient.cjs.map +1 -1
  23. package/dist/createClient.d.ts +2 -1003
  24. package/dist/createClient.js +1 -1214
  25. package/dist/createClient.js.map +1 -1
  26. package/dist/createMigration.cjs +6 -0
  27. package/dist/createMigration.cjs.map +1 -0
  28. package/dist/createMigration.d.ts +24 -0
  29. package/dist/createMigration.js +6 -0
  30. package/dist/createMigration.js.map +1 -0
  31. package/dist/createWriteClient.cjs +6 -0
  32. package/dist/createWriteClient.cjs.map +1 -0
  33. package/dist/createWriteClient.d.ts +32 -0
  34. package/dist/createWriteClient.js +6 -0
  35. package/dist/createWriteClient.js.map +1 -0
  36. package/dist/getRepositoryName.cjs +7 -2
  37. package/dist/getRepositoryName.cjs.map +1 -1
  38. package/dist/getRepositoryName.d.ts +3 -6
  39. package/dist/getRepositoryName.js +7 -2
  40. package/dist/getRepositoryName.js.map +1 -1
  41. package/dist/index.cjs +14 -1
  42. package/dist/index.cjs.map +1 -1
  43. package/dist/index.d.ts +17 -2
  44. package/dist/index.js +14 -1
  45. package/dist/index.js.map +1 -1
  46. package/dist/lib/isMigrationValue.cjs +24 -0
  47. package/dist/lib/isMigrationValue.cjs.map +1 -0
  48. package/dist/lib/isMigrationValue.d.ts +62 -0
  49. package/dist/lib/isMigrationValue.js +24 -0
  50. package/dist/lib/isMigrationValue.js.map +1 -0
  51. package/dist/lib/isValue.cjs +53 -0
  52. package/dist/lib/isValue.cjs.map +1 -0
  53. package/dist/lib/isValue.d.ts +72 -0
  54. package/dist/lib/isValue.js +53 -0
  55. package/dist/lib/isValue.js.map +1 -0
  56. package/dist/lib/pLimit.cjs +49 -0
  57. package/dist/lib/pLimit.cjs.map +1 -0
  58. package/dist/lib/pLimit.d.ts +22 -0
  59. package/dist/lib/pLimit.js +49 -0
  60. package/dist/lib/pLimit.js.map +1 -0
  61. package/dist/lib/resolveMigrationDocumentData.cjs +123 -0
  62. package/dist/lib/resolveMigrationDocumentData.cjs.map +1 -0
  63. package/dist/lib/resolveMigrationDocumentData.d.ts +52 -0
  64. package/dist/lib/resolveMigrationDocumentData.js +123 -0
  65. package/dist/lib/resolveMigrationDocumentData.js.map +1 -0
  66. package/dist/lib/validateAssetMetadata.cjs +28 -0
  67. package/dist/lib/validateAssetMetadata.cjs.map +1 -0
  68. package/dist/lib/validateAssetMetadata.d.ts +10 -0
  69. package/dist/lib/validateAssetMetadata.js +28 -0
  70. package/dist/lib/validateAssetMetadata.js.map +1 -0
  71. package/dist/package.json.cjs +1 -1
  72. package/dist/package.json.js +1 -1
  73. package/dist/types/api/asset/asset.d.ts +177 -0
  74. package/dist/types/api/asset/tag.d.ts +53 -0
  75. package/dist/types/api/migration/document.d.ts +60 -0
  76. package/dist/types/migration/Asset.cjs +33 -0
  77. package/dist/types/migration/Asset.cjs.map +1 -0
  78. package/dist/types/migration/Asset.d.ts +109 -0
  79. package/dist/types/migration/Asset.js +33 -0
  80. package/dist/types/migration/Asset.js.map +1 -0
  81. package/dist/types/migration/ContentRelationship.d.ts +17 -0
  82. package/dist/types/migration/Document.cjs +47 -0
  83. package/dist/types/migration/Document.cjs.map +1 -0
  84. package/dist/types/migration/Document.d.ts +94 -0
  85. package/dist/types/migration/Document.js +47 -0
  86. package/dist/types/migration/Document.js.map +1 -0
  87. package/dist/types/model/link.cjs.map +1 -1
  88. package/dist/types/model/link.d.ts +0 -1
  89. package/dist/types/model/link.js.map +1 -1
  90. package/dist/types/model/linkToMedia.d.ts +0 -1
  91. package/dist/types/value/contentRelationship.d.ts +0 -1
  92. package/dist/types/value/link.cjs.map +1 -1
  93. package/dist/types/value/link.d.ts +0 -2
  94. package/dist/types/value/link.js.map +1 -1
  95. package/dist/types/value/linkToMedia.d.ts +0 -1
  96. package/package.json +2 -2
  97. package/src/BaseClient.ts +330 -0
  98. package/src/Client.ts +1787 -0
  99. package/src/Migration.ts +531 -0
  100. package/src/WriteClient.ts +916 -0
  101. package/src/createClient.ts +3 -1931
  102. package/src/createMigration.ts +31 -0
  103. package/src/createWriteClient.ts +43 -0
  104. package/src/getRepositoryName.ts +19 -14
  105. package/src/index.ts +32 -4
  106. package/src/lib/isMigrationValue.ts +126 -0
  107. package/src/lib/isValue.ts +196 -0
  108. package/src/lib/pLimit.ts +106 -0
  109. package/src/lib/resolveMigrationDocumentData.ts +233 -0
  110. package/src/lib/validateAssetMetadata.ts +82 -0
  111. package/src/types/api/asset/asset.ts +211 -0
  112. package/src/types/api/asset/tag.ts +59 -0
  113. package/src/types/api/migration/document.ts +84 -0
  114. package/src/types/migration/Asset.ts +156 -0
  115. package/src/types/migration/ContentRelationship.ts +36 -0
  116. package/src/types/migration/Document.ts +157 -0
  117. package/src/types/model/link.ts +0 -1
  118. package/src/types/model/linkToMedia.ts +0 -1
  119. package/src/types/value/contentRelationship.ts +0 -1
  120. package/src/types/value/link.ts +0 -2
  121. package/src/types/value/linkToMedia.ts +0 -1
@@ -0,0 +1,213 @@
1
+ import type { Asset } from "./types/api/asset/asset";
2
+ import type { MigrationAssetConfig } from "./types/migration/Asset";
3
+ import { PrismicMigrationAsset } from "./types/migration/Asset";
4
+ import type { MigrationContentRelationship } from "./types/migration/ContentRelationship";
5
+ import { PrismicMigrationDocument } from "./types/migration/Document";
6
+ import type { ExistingPrismicDocument, PendingPrismicDocument } from "./types/migration/Document";
7
+ import type { PrismicDocument } from "./types/value/document";
8
+ import type { FilledImageFieldImage } from "./types/value/image";
9
+ import type { FilledLinkToMediaField } from "./types/value/linkToMedia";
10
+ /**
11
+ * Extracts one or more Prismic document types that match a given Prismic
12
+ * document type. If no matches are found, no extraction is performed and the
13
+ * union of all provided Prismic document types are returned.
14
+ *
15
+ * @typeParam TDocuments - Prismic document types from which to extract.
16
+ * @typeParam TDocumentType - Type(s) to match `TDocuments` against.
17
+ */
18
+ type ExtractDocumentType<TDocuments extends {
19
+ type: string;
20
+ }, TDocumentType extends TDocuments["type"]> = Extract<TDocuments, {
21
+ type: TDocumentType;
22
+ }> extends never ? TDocuments : Extract<TDocuments, {
23
+ type: TDocumentType;
24
+ }>;
25
+ /**
26
+ * A helper that allows preparing your migration to Prismic.
27
+ *
28
+ * @typeParam TDocuments - Document types that are registered for the Prismic
29
+ * repository. Query methods will automatically be typed based on this type.
30
+ */
31
+ export declare class Migration<TDocuments extends PrismicDocument = PrismicDocument> {
32
+ #private;
33
+ /**
34
+ * Assets registered in the migration.
35
+ *
36
+ * @internal
37
+ */
38
+ _assets: Map<MigrationAssetConfig["file"], PrismicMigrationAsset>;
39
+ /**
40
+ * Documents registered in the migration.
41
+ *
42
+ * @internal
43
+ */
44
+ _documents: PrismicMigrationDocument<TDocuments>[];
45
+ /**
46
+ * Registers an asset to be created in the migration from an asset object.
47
+ *
48
+ * @remarks
49
+ * This method does not create the asset in Prismic media library right away.
50
+ * Instead, it registers it in your migration. The asset will be created when
51
+ * the migration is executed through the `writeClient.migrate()` method.
52
+ *
53
+ * @param asset - An asset object from Prismic Asset API.
54
+ *
55
+ * @returns A migration asset field instance.
56
+ *
57
+ * @internal
58
+ */
59
+ createAsset(asset: Asset): PrismicMigrationAsset;
60
+ /**
61
+ * Registers an asset to be created in the migration from an image or link to
62
+ * media field.
63
+ *
64
+ * @remarks
65
+ * This method does not create the asset in Prismic media library right away.
66
+ * Instead, it registers it in your migration. The asset will be created when
67
+ * the migration is executed through the `writeClient.migrate()` method.
68
+ *
69
+ * @param imageOrLinkToMediaField - An image or link to media field from
70
+ * Prismic Document API.
71
+ *
72
+ * @returns A migration asset field instance.
73
+ *
74
+ * @internal
75
+ */
76
+ createAsset(imageOrLinkToMediaField: FilledImageFieldImage | FilledLinkToMediaField): PrismicMigrationAsset;
77
+ /**
78
+ * Registers an asset to be created in the migration from a file.
79
+ *
80
+ * @remarks
81
+ * This method does not create the asset in Prismic media library right away.
82
+ * Instead, it registers it in your migration. The asset will be created when
83
+ * the migration is executed through the `writeClient.migrate()` method.
84
+ *
85
+ * @param file - The URL or content of the file to be created.
86
+ * @param filename - The filename of the asset.
87
+ * @param params - Additional asset data.
88
+ *
89
+ * @returns A migration asset field instance.
90
+ */
91
+ createAsset(file: MigrationAssetConfig["file"], filename: MigrationAssetConfig["filename"], params?: {
92
+ notes?: string;
93
+ credits?: string;
94
+ alt?: string;
95
+ tags?: string[];
96
+ }): PrismicMigrationAsset;
97
+ /**
98
+ * Registers a document to be created in the migration.
99
+ *
100
+ * @remarks
101
+ * This method does not create the document in Prismic right away. Instead, it
102
+ * registers it in your migration. The document will be created when the
103
+ * migration is executed through the `writeClient.migrate()` method.
104
+ *
105
+ * @typeParam TType - Type of the Prismic document to create.
106
+ *
107
+ * @param document - The document to create.
108
+ * @param title - The title of the document to create which will be displayed
109
+ * in the editor.
110
+ * @param params - Document master language document ID.
111
+ *
112
+ * @returns A migration document instance.
113
+ */
114
+ createDocument<TType extends TDocuments["type"]>(document: ExtractDocumentType<PendingPrismicDocument<TDocuments>, TType>, title: string, params?: {
115
+ masterLanguageDocument?: MigrationContentRelationship;
116
+ }): PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>>;
117
+ /**
118
+ * Registers an existing document to be updated in the migration.
119
+ *
120
+ * @remarks
121
+ * This method does not update the document in Prismic right away. Instead, it
122
+ * registers it in your migration. The document will be updated when the
123
+ * migration is executed through the `writeClient.migrate()` method.
124
+ *
125
+ * @typeParam TType - Type of Prismic documents to update.
126
+ *
127
+ * @param document - The document to update.
128
+ * @param title - The title of the document to update which will be displayed
129
+ * in the editor.
130
+ *
131
+ * @returns A migration document instance.
132
+ */
133
+ updateDocument<TType extends TDocuments["type"]>(document: ExtractDocumentType<ExistingPrismicDocument<TDocuments>, TType>, title?: string): PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>>;
134
+ /**
135
+ * Registers a document from another Prismic repository to be created in the
136
+ * migration.
137
+ *
138
+ * @remarks
139
+ * This method does not create the document in Prismic right away. Instead, it
140
+ * registers it in your migration. The document will be created when the
141
+ * migration is executed through the `writeClient.migrate()` method.
142
+ *
143
+ * @param document - The document from Prismic to create.
144
+ * @param title - The title of the document to create which will be displayed
145
+ * in the editor.
146
+ *
147
+ * @returns A migration document instance.
148
+ */
149
+ createDocumentFromPrismic<TType extends TDocuments["type"]>(document: ExtractDocumentType<ExistingPrismicDocument<TDocuments>, TType>, title: string): PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>>;
150
+ /**
151
+ * Queries a document from the migration instance with a specific UID and
152
+ * custom type.
153
+ *
154
+ * @example
155
+ *
156
+ * ```ts
157
+ * const contentRelationship = migration.createContentRelationship(() =>
158
+ * migration.getByUID("blog_post", "my-first-post"),
159
+ * )
160
+ * ```
161
+ *
162
+ * @typeParam TType - Type of the Prismic document returned.
163
+ *
164
+ * @param type - The API ID of the document's custom type.
165
+ * @param uid - The UID of the document.
166
+ *
167
+ * @returns The migration document instance with a UID matching the `uid`
168
+ * parameter, if a matching document is found.
169
+ */
170
+ getByUID<TType extends TDocuments["type"]>(type: TType, uid: string): PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>> | undefined;
171
+ /**
172
+ * Queries a singleton document from the migration instance for a specific
173
+ * custom type.
174
+ *
175
+ * @example
176
+ *
177
+ * ```ts
178
+ * const contentRelationship = migration.createContentRelationship(() =>
179
+ * migration.getSingle("settings"),
180
+ * )
181
+ * ```
182
+ *
183
+ * @typeParam TType - Type of the Prismic document returned.
184
+ *
185
+ * @param type - The API ID of the singleton custom type.
186
+ *
187
+ * @returns The migration document instance for the custom type, if a matching
188
+ * document is found.
189
+ */
190
+ getSingle<TType extends TDocuments["type"]>(type: TType): PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>> | undefined;
191
+ /**
192
+ * Queries a document from the migration instance for a specific original ID.
193
+ *
194
+ * @example
195
+ *
196
+ * ```ts
197
+ * const contentRelationship = migration.createContentRelationship(() =>
198
+ * migration._getByOriginalID("YhdrDxIAACgAcp_b"),
199
+ * )
200
+ * ```
201
+ *
202
+ * @typeParam TType - Type of the Prismic document returned.
203
+ *
204
+ * @param id - The original ID of the Prismic document.
205
+ *
206
+ * @returns The migration document instance for the original ID, if a matching
207
+ * document is found.
208
+ *
209
+ * @internal
210
+ */
211
+ _getByOriginalID<TType extends TDocuments["type"]>(id: string): PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>> | undefined;
212
+ }
213
+ export {};
@@ -0,0 +1,318 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __typeError = (msg) => {
3
+ throw TypeError(msg);
4
+ };
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
8
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
9
+ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
10
+ var _Migration_instances, migratePrismicDocumentData_fn;
11
+ import { filledContentRelationship, filledLinkToMedia, rtImageNode, filledImage } from "./lib/isValue.js";
12
+ import { validateAssetMetadata } from "./lib/validateAssetMetadata.js";
13
+ import { PrismicMigrationAsset } from "./types/migration/Asset.js";
14
+ import { PrismicMigrationDocument } from "./types/migration/Document.js";
15
+ import { LinkType } from "./types/value/link.js";
16
+ import { RichTextNodeType } from "./types/value/richText.js";
17
+ class Migration {
18
+ constructor() {
19
+ __privateAdd(this, _Migration_instances);
20
+ /**
21
+ * Assets registered in the migration.
22
+ *
23
+ * @internal
24
+ */
25
+ __publicField(this, "_assets", /* @__PURE__ */ new Map());
26
+ /**
27
+ * Documents registered in the migration.
28
+ *
29
+ * @internal
30
+ */
31
+ __publicField(this, "_documents", []);
32
+ }
33
+ /**
34
+ * Registers an asset to be created in the migration from a file, an asset
35
+ * object, or an image or link to media field.
36
+ *
37
+ * @remarks
38
+ * This method does not create the asset in Prismic media library right away.
39
+ * Instead, it registers it in your migration. The asset will be created when
40
+ * the migration is executed through the `writeClient.migrate()` method.
41
+ *
42
+ * @returns A migration asset field instance.
43
+ */
44
+ createAsset(fileOrAssetOrField, filename, { notes, credits, alt, tags } = {}) {
45
+ var _a;
46
+ let config;
47
+ let maybeInitialField;
48
+ if (typeof fileOrAssetOrField === "object" && "url" in fileOrAssetOrField) {
49
+ if ("dimensions" in fileOrAssetOrField || "link_type" in fileOrAssetOrField) {
50
+ const url = fileOrAssetOrField.url.split("?")[0];
51
+ const filename2 = "name" in fileOrAssetOrField ? fileOrAssetOrField.name : url.split("/").pop().split("_").pop();
52
+ const credits2 = "copyright" in fileOrAssetOrField && fileOrAssetOrField.copyright ? fileOrAssetOrField.copyright : void 0;
53
+ const alt2 = "alt" in fileOrAssetOrField && fileOrAssetOrField.alt ? fileOrAssetOrField.alt : void 0;
54
+ if ("dimensions" in fileOrAssetOrField) {
55
+ maybeInitialField = fileOrAssetOrField;
56
+ }
57
+ config = {
58
+ id: fileOrAssetOrField.id,
59
+ file: url,
60
+ filename: filename2,
61
+ notes: void 0,
62
+ credits: credits2,
63
+ alt: alt2,
64
+ tags: void 0
65
+ };
66
+ } else {
67
+ config = {
68
+ id: fileOrAssetOrField.id,
69
+ file: fileOrAssetOrField.url,
70
+ filename: fileOrAssetOrField.filename,
71
+ notes: fileOrAssetOrField.notes,
72
+ credits: fileOrAssetOrField.credits,
73
+ alt: fileOrAssetOrField.alt,
74
+ tags: (_a = fileOrAssetOrField.tags) == null ? void 0 : _a.map(({ name }) => name)
75
+ };
76
+ }
77
+ } else {
78
+ config = {
79
+ id: fileOrAssetOrField,
80
+ file: fileOrAssetOrField,
81
+ filename,
82
+ notes,
83
+ credits,
84
+ alt,
85
+ tags
86
+ };
87
+ }
88
+ validateAssetMetadata(config);
89
+ const migrationAsset = new PrismicMigrationAsset(config, maybeInitialField);
90
+ const maybeAsset = this._assets.get(config.id);
91
+ if (maybeAsset) {
92
+ maybeAsset.config.notes = maybeAsset.config.notes || config.notes;
93
+ maybeAsset.config.credits = maybeAsset.config.credits || config.credits;
94
+ maybeAsset.config.alt = maybeAsset.config.alt || config.alt;
95
+ maybeAsset.config.tags = Array.from(/* @__PURE__ */ new Set([...maybeAsset.config.tags || [], ...config.tags || []]));
96
+ } else {
97
+ this._assets.set(config.id, migrationAsset);
98
+ }
99
+ return migrationAsset;
100
+ }
101
+ /**
102
+ * Registers a document to be created in the migration.
103
+ *
104
+ * @remarks
105
+ * This method does not create the document in Prismic right away. Instead, it
106
+ * registers it in your migration. The document will be created when the
107
+ * migration is executed through the `writeClient.migrate()` method.
108
+ *
109
+ * @typeParam TType - Type of the Prismic document to create.
110
+ *
111
+ * @param document - The document to create.
112
+ * @param title - The title of the document to create which will be displayed
113
+ * in the editor.
114
+ * @param params - Document master language document ID.
115
+ *
116
+ * @returns A migration document instance.
117
+ */
118
+ createDocument(document, title, params) {
119
+ const doc = new PrismicMigrationDocument(document, title, params);
120
+ this._documents.push(doc);
121
+ return doc;
122
+ }
123
+ /**
124
+ * Registers an existing document to be updated in the migration.
125
+ *
126
+ * @remarks
127
+ * This method does not update the document in Prismic right away. Instead, it
128
+ * registers it in your migration. The document will be updated when the
129
+ * migration is executed through the `writeClient.migrate()` method.
130
+ *
131
+ * @typeParam TType - Type of Prismic documents to update.
132
+ *
133
+ * @param document - The document to update.
134
+ * @param title - The title of the document to update which will be displayed
135
+ * in the editor.
136
+ *
137
+ * @returns A migration document instance.
138
+ */
139
+ updateDocument(document, title) {
140
+ const doc = new PrismicMigrationDocument(document, title);
141
+ this._documents.push(doc);
142
+ return doc;
143
+ }
144
+ /**
145
+ * Registers a document from another Prismic repository to be created in the
146
+ * migration.
147
+ *
148
+ * @remarks
149
+ * This method does not create the document in Prismic right away. Instead, it
150
+ * registers it in your migration. The document will be created when the
151
+ * migration is executed through the `writeClient.migrate()` method.
152
+ *
153
+ * @param document - The document from Prismic to create.
154
+ * @param title - The title of the document to create which will be displayed
155
+ * in the editor.
156
+ *
157
+ * @returns A migration document instance.
158
+ */
159
+ createDocumentFromPrismic(document, title) {
160
+ const doc = new PrismicMigrationDocument(__privateMethod(this, _Migration_instances, migratePrismicDocumentData_fn).call(this, {
161
+ type: document.type,
162
+ lang: document.lang,
163
+ uid: document.uid,
164
+ tags: document.tags,
165
+ data: document.data
166
+ }), title, { originalPrismicDocument: document });
167
+ this._documents.push(doc);
168
+ return doc;
169
+ }
170
+ /**
171
+ * Queries a document from the migration instance with a specific UID and
172
+ * custom type.
173
+ *
174
+ * @example
175
+ *
176
+ * ```ts
177
+ * const contentRelationship = migration.createContentRelationship(() =>
178
+ * migration.getByUID("blog_post", "my-first-post"),
179
+ * )
180
+ * ```
181
+ *
182
+ * @typeParam TType - Type of the Prismic document returned.
183
+ *
184
+ * @param type - The API ID of the document's custom type.
185
+ * @param uid - The UID of the document.
186
+ *
187
+ * @returns The migration document instance with a UID matching the `uid`
188
+ * parameter, if a matching document is found.
189
+ */
190
+ getByUID(type, uid) {
191
+ return this._documents.find((doc) => doc.document.type === type && doc.document.uid === uid);
192
+ }
193
+ /**
194
+ * Queries a singleton document from the migration instance for a specific
195
+ * custom type.
196
+ *
197
+ * @example
198
+ *
199
+ * ```ts
200
+ * const contentRelationship = migration.createContentRelationship(() =>
201
+ * migration.getSingle("settings"),
202
+ * )
203
+ * ```
204
+ *
205
+ * @typeParam TType - Type of the Prismic document returned.
206
+ *
207
+ * @param type - The API ID of the singleton custom type.
208
+ *
209
+ * @returns The migration document instance for the custom type, if a matching
210
+ * document is found.
211
+ */
212
+ getSingle(type) {
213
+ return this._documents.find((doc) => doc.document.type === type);
214
+ }
215
+ /**
216
+ * Queries a document from the migration instance for a specific original ID.
217
+ *
218
+ * @example
219
+ *
220
+ * ```ts
221
+ * const contentRelationship = migration.createContentRelationship(() =>
222
+ * migration._getByOriginalID("YhdrDxIAACgAcp_b"),
223
+ * )
224
+ * ```
225
+ *
226
+ * @typeParam TType - Type of the Prismic document returned.
227
+ *
228
+ * @param id - The original ID of the Prismic document.
229
+ *
230
+ * @returns The migration document instance for the original ID, if a matching
231
+ * document is found.
232
+ *
233
+ * @internal
234
+ */
235
+ _getByOriginalID(id) {
236
+ return this._documents.find((doc) => {
237
+ var _a;
238
+ return ((_a = doc.originalPrismicDocument) == null ? void 0 : _a.id) === id;
239
+ });
240
+ }
241
+ }
242
+ _Migration_instances = new WeakSet();
243
+ /**
244
+ * Migrates a Prismic document data from another repository so that it can be
245
+ * created through the current repository's Migration API.
246
+ *
247
+ * @param input - The Prismic document data to migrate.
248
+ *
249
+ * @returns The migrated Prismic document data.
250
+ */
251
+ migratePrismicDocumentData_fn = function(input) {
252
+ if (filledContentRelationship(input)) {
253
+ if (input.isBroken) {
254
+ return {
255
+ link_type: LinkType.Document,
256
+ // ID needs to be 16 characters long to be considered valid by the API
257
+ id: "_____broken_____",
258
+ isBroken: true,
259
+ // TODO: Remove when link text PR is merged
260
+ // @ts-expect-error - Future-proofing for link text
261
+ text: input.text
262
+ };
263
+ }
264
+ return {
265
+ link_type: LinkType.Document,
266
+ id: () => this._getByOriginalID(input.id),
267
+ // TODO: Remove when link text PR is merged
268
+ // @ts-expect-error - Future-proofing for link text
269
+ text: input.text
270
+ };
271
+ }
272
+ if (filledLinkToMedia(input)) {
273
+ return {
274
+ link_type: LinkType.Media,
275
+ id: this.createAsset(input),
276
+ // TODO: Remove when link text PR is merged
277
+ // @ts-expect-error - Future-proofing for link text
278
+ text: input.text
279
+ };
280
+ }
281
+ if (rtImageNode(input)) {
282
+ const rtImageNode2 = {
283
+ type: RichTextNodeType.image,
284
+ id: this.createAsset(input)
285
+ };
286
+ if (input.linkTo) {
287
+ rtImageNode2.linkTo = __privateMethod(this, _Migration_instances, migratePrismicDocumentData_fn).call(this, input.linkTo);
288
+ }
289
+ return rtImageNode2;
290
+ }
291
+ if (filledImage(input)) {
292
+ const image = {
293
+ id: this.createAsset(input)
294
+ };
295
+ const { id: _id, url: _url, dimensions: _dimensions, edit: _edit, alt: _alt, copyright: _copyright, ...thumbnails } = input;
296
+ for (const name in thumbnails) {
297
+ if (filledImage(thumbnails[name])) {
298
+ image[name] = this.createAsset(thumbnails[name]);
299
+ }
300
+ }
301
+ return image;
302
+ }
303
+ if (Array.isArray(input)) {
304
+ return input.map((element) => __privateMethod(this, _Migration_instances, migratePrismicDocumentData_fn).call(this, element));
305
+ }
306
+ if (input && typeof input === "object") {
307
+ const res = {};
308
+ for (const key in input) {
309
+ res[key] = __privateMethod(this, _Migration_instances, migratePrismicDocumentData_fn).call(this, input[key]);
310
+ }
311
+ return res;
312
+ }
313
+ return input;
314
+ };
315
+ export {
316
+ Migration
317
+ };
318
+ //# sourceMappingURL=Migration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration.js","sources":["../../src/Migration.ts"],"sourcesContent":["import * as is from \"./lib/isValue\"\nimport { validateAssetMetadata } from \"./lib/validateAssetMetadata\"\n\nimport type { Asset } from \"./types/api/asset/asset\"\nimport type {\n\tMigrationAssetConfig,\n\tMigrationImage,\n\tMigrationLinkToMedia,\n\tMigrationRTImageNode,\n} from \"./types/migration/Asset\"\nimport { PrismicMigrationAsset } from \"./types/migration/Asset\"\nimport type { MigrationContentRelationship } from \"./types/migration/ContentRelationship\"\nimport { PrismicMigrationDocument } from \"./types/migration/Document\"\nimport type {\n\tExistingPrismicDocument,\n\tPendingPrismicDocument,\n} from \"./types/migration/Document\"\nimport type { PrismicDocument } from \"./types/value/document\"\nimport type { FilledImageFieldImage } from \"./types/value/image\"\nimport { type FilledLinkToWebField, LinkType } from \"./types/value/link\"\nimport type { FilledLinkToMediaField } from \"./types/value/linkToMedia\"\nimport { RichTextNodeType } from \"./types/value/richText\"\n\n/**\n * Extracts one or more Prismic document types that match a given Prismic\n * document type. If no matches are found, no extraction is performed and the\n * union of all provided Prismic document types are returned.\n *\n * @typeParam TDocuments - Prismic document types from which to extract.\n * @typeParam TDocumentType - Type(s) to match `TDocuments` against.\n */\ntype ExtractDocumentType<\n\tTDocuments extends { type: string },\n\tTDocumentType extends TDocuments[\"type\"],\n> =\n\tExtract<TDocuments, { type: TDocumentType }> extends never\n\t\t? TDocuments\n\t\t: Extract<TDocuments, { type: TDocumentType }>\n\n/**\n * A helper that allows preparing your migration to Prismic.\n *\n * @typeParam TDocuments - Document types that are registered for the Prismic\n * repository. Query methods will automatically be typed based on this type.\n */\nexport class Migration<TDocuments extends PrismicDocument = PrismicDocument> {\n\t/**\n\t * Assets registered in the migration.\n\t *\n\t * @internal\n\t */\n\t_assets: Map<MigrationAssetConfig[\"file\"], PrismicMigrationAsset> = new Map()\n\n\t/**\n\t * Documents registered in the migration.\n\t *\n\t * @internal\n\t */\n\t_documents: PrismicMigrationDocument<TDocuments>[] = []\n\n\t/**\n\t * Registers an asset to be created in the migration from an asset object.\n\t *\n\t * @remarks\n\t * This method does not create the asset in Prismic media library right away.\n\t * Instead, it registers it in your migration. The asset will be created when\n\t * the migration is executed through the `writeClient.migrate()` method.\n\t *\n\t * @param asset - An asset object from Prismic Asset API.\n\t *\n\t * @returns A migration asset field instance.\n\t *\n\t * @internal\n\t */\n\tcreateAsset(asset: Asset): PrismicMigrationAsset\n\n\t/**\n\t * Registers an asset to be created in the migration from an image or link to\n\t * media field.\n\t *\n\t * @remarks\n\t * This method does not create the asset in Prismic media library right away.\n\t * Instead, it registers it in your migration. The asset will be created when\n\t * the migration is executed through the `writeClient.migrate()` method.\n\t *\n\t * @param imageOrLinkToMediaField - An image or link to media field from\n\t * Prismic Document API.\n\t *\n\t * @returns A migration asset field instance.\n\t *\n\t * @internal\n\t */\n\tcreateAsset(\n\t\timageOrLinkToMediaField: FilledImageFieldImage | FilledLinkToMediaField,\n\t): PrismicMigrationAsset\n\n\t/**\n\t * Registers an asset to be created in the migration from a file.\n\t *\n\t * @remarks\n\t * This method does not create the asset in Prismic media library right away.\n\t * Instead, it registers it in your migration. The asset will be created when\n\t * the migration is executed through the `writeClient.migrate()` method.\n\t *\n\t * @param file - The URL or content of the file to be created.\n\t * @param filename - The filename of the asset.\n\t * @param params - Additional asset data.\n\t *\n\t * @returns A migration asset field instance.\n\t */\n\tcreateAsset(\n\t\tfile: MigrationAssetConfig[\"file\"],\n\t\tfilename: MigrationAssetConfig[\"filename\"],\n\t\tparams?: {\n\t\t\tnotes?: string\n\t\t\tcredits?: string\n\t\t\talt?: string\n\t\t\ttags?: string[]\n\t\t},\n\t): PrismicMigrationAsset\n\n\t/**\n\t * Registers an asset to be created in the migration from a file, an asset\n\t * object, or an image or link to media field.\n\t *\n\t * @remarks\n\t * This method does not create the asset in Prismic media library right away.\n\t * Instead, it registers it in your migration. The asset will be created when\n\t * the migration is executed through the `writeClient.migrate()` method.\n\t *\n\t * @returns A migration asset field instance.\n\t */\n\tcreateAsset(\n\t\tfileOrAssetOrField:\n\t\t\t| MigrationAssetConfig[\"file\"]\n\t\t\t| Asset\n\t\t\t| FilledImageFieldImage\n\t\t\t| FilledLinkToMediaField,\n\t\tfilename?: MigrationAssetConfig[\"filename\"],\n\t\t{\n\t\t\tnotes,\n\t\t\tcredits,\n\t\t\talt,\n\t\t\ttags,\n\t\t}: {\n\t\t\tnotes?: string\n\t\t\tcredits?: string\n\t\t\talt?: string\n\t\t\ttags?: string[]\n\t\t} = {},\n\t): PrismicMigrationAsset {\n\t\tlet config: MigrationAssetConfig\n\t\tlet maybeInitialField: FilledImageFieldImage | undefined\n\t\tif (typeof fileOrAssetOrField === \"object\" && \"url\" in fileOrAssetOrField) {\n\t\t\tif (\n\t\t\t\t\"dimensions\" in fileOrAssetOrField ||\n\t\t\t\t\"link_type\" in fileOrAssetOrField\n\t\t\t) {\n\t\t\t\tconst url = fileOrAssetOrField.url.split(\"?\")[0]\n\t\t\t\tconst filename =\n\t\t\t\t\t\"name\" in fileOrAssetOrField\n\t\t\t\t\t\t? fileOrAssetOrField.name\n\t\t\t\t\t\t: url.split(\"/\").pop()!.split(\"_\").pop()!\n\t\t\t\tconst credits =\n\t\t\t\t\t\"copyright\" in fileOrAssetOrField && fileOrAssetOrField.copyright\n\t\t\t\t\t\t? fileOrAssetOrField.copyright\n\t\t\t\t\t\t: undefined\n\t\t\t\tconst alt =\n\t\t\t\t\t\"alt\" in fileOrAssetOrField && fileOrAssetOrField.alt\n\t\t\t\t\t\t? fileOrAssetOrField.alt\n\t\t\t\t\t\t: undefined\n\n\t\t\t\tif (\"dimensions\" in fileOrAssetOrField) {\n\t\t\t\t\tmaybeInitialField = fileOrAssetOrField\n\t\t\t\t}\n\n\t\t\t\tconfig = {\n\t\t\t\t\tid: fileOrAssetOrField.id,\n\t\t\t\t\tfile: url,\n\t\t\t\t\tfilename,\n\t\t\t\t\tnotes: undefined,\n\t\t\t\t\tcredits,\n\t\t\t\t\talt,\n\t\t\t\t\ttags: undefined,\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconfig = {\n\t\t\t\t\tid: fileOrAssetOrField.id,\n\t\t\t\t\tfile: fileOrAssetOrField.url,\n\t\t\t\t\tfilename: fileOrAssetOrField.filename,\n\t\t\t\t\tnotes: fileOrAssetOrField.notes,\n\t\t\t\t\tcredits: fileOrAssetOrField.credits,\n\t\t\t\t\talt: fileOrAssetOrField.alt,\n\t\t\t\t\ttags: fileOrAssetOrField.tags?.map(({ name }) => name),\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tconfig = {\n\t\t\t\tid: fileOrAssetOrField,\n\t\t\t\tfile: fileOrAssetOrField,\n\t\t\t\tfilename: filename!,\n\t\t\t\tnotes,\n\t\t\t\tcredits,\n\t\t\t\talt,\n\t\t\t\ttags,\n\t\t\t}\n\t\t}\n\n\t\tvalidateAssetMetadata(config)\n\n\t\t// We create a detached instance of the asset each time to serialize it properly\n\t\tconst migrationAsset = new PrismicMigrationAsset(config, maybeInitialField)\n\n\t\tconst maybeAsset = this._assets.get(config.id)\n\t\tif (maybeAsset) {\n\t\t\t// Consolidate existing asset with new asset value if possible\n\t\t\tmaybeAsset.config.notes = maybeAsset.config.notes || config.notes\n\t\t\tmaybeAsset.config.credits = maybeAsset.config.credits || config.credits\n\t\t\tmaybeAsset.config.alt = maybeAsset.config.alt || config.alt\n\t\t\tmaybeAsset.config.tags = Array.from(\n\t\t\t\tnew Set([...(maybeAsset.config.tags || []), ...(config.tags || [])]),\n\t\t\t)\n\t\t} else {\n\t\t\tthis._assets.set(config.id, migrationAsset)\n\t\t}\n\n\t\treturn migrationAsset\n\t}\n\n\t/**\n\t * Registers a document to be created in the migration.\n\t *\n\t * @remarks\n\t * This method does not create the document in Prismic right away. Instead, it\n\t * registers it in your migration. The document will be created when the\n\t * migration is executed through the `writeClient.migrate()` method.\n\t *\n\t * @typeParam TType - Type of the Prismic document to create.\n\t *\n\t * @param document - The document to create.\n\t * @param title - The title of the document to create which will be displayed\n\t * in the editor.\n\t * @param params - Document master language document ID.\n\t *\n\t * @returns A migration document instance.\n\t */\n\tcreateDocument<TType extends TDocuments[\"type\"]>(\n\t\tdocument: ExtractDocumentType<PendingPrismicDocument<TDocuments>, TType>,\n\t\ttitle: string,\n\t\tparams?: {\n\t\t\tmasterLanguageDocument?: MigrationContentRelationship\n\t\t},\n\t): PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>> {\n\t\tconst doc = new PrismicMigrationDocument<\n\t\t\tExtractDocumentType<TDocuments, TType>\n\t\t>(document, title, params)\n\n\t\tthis._documents.push(doc)\n\n\t\treturn doc\n\t}\n\n\t/**\n\t * Registers an existing document to be updated in the migration.\n\t *\n\t * @remarks\n\t * This method does not update the document in Prismic right away. Instead, it\n\t * registers it in your migration. The document will be updated when the\n\t * migration is executed through the `writeClient.migrate()` method.\n\t *\n\t * @typeParam TType - Type of Prismic documents to update.\n\t *\n\t * @param document - The document to update.\n\t * @param title - The title of the document to update which will be displayed\n\t * in the editor.\n\t *\n\t * @returns A migration document instance.\n\t */\n\tupdateDocument<TType extends TDocuments[\"type\"]>(\n\t\tdocument: ExtractDocumentType<ExistingPrismicDocument<TDocuments>, TType>,\n\t\t// Title is optional for existing documents as we might not want to update it.\n\t\ttitle?: string,\n\t): PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>> {\n\t\tconst doc = new PrismicMigrationDocument<\n\t\t\tExtractDocumentType<TDocuments, TType>\n\t\t>(document, title)\n\n\t\tthis._documents.push(doc)\n\n\t\treturn doc\n\t}\n\n\t/**\n\t * Registers a document from another Prismic repository to be created in the\n\t * migration.\n\t *\n\t * @remarks\n\t * This method does not create the document in Prismic right away. Instead, it\n\t * registers it in your migration. The document will be created when the\n\t * migration is executed through the `writeClient.migrate()` method.\n\t *\n\t * @param document - The document from Prismic to create.\n\t * @param title - The title of the document to create which will be displayed\n\t * in the editor.\n\t *\n\t * @returns A migration document instance.\n\t */\n\tcreateDocumentFromPrismic<TType extends TDocuments[\"type\"]>(\n\t\tdocument: ExtractDocumentType<ExistingPrismicDocument<TDocuments>, TType>,\n\t\ttitle: string,\n\t): PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>> {\n\t\tconst doc = new PrismicMigrationDocument(\n\t\t\tthis.#migratePrismicDocumentData({\n\t\t\t\ttype: document.type,\n\t\t\t\tlang: document.lang,\n\t\t\t\tuid: document.uid,\n\t\t\t\ttags: document.tags,\n\t\t\t\tdata: document.data,\n\t\t\t}) as PendingPrismicDocument<ExtractDocumentType<TDocuments, TType>>,\n\t\t\ttitle,\n\t\t\t{ originalPrismicDocument: document },\n\t\t)\n\n\t\tthis._documents.push(doc)\n\n\t\treturn doc\n\t}\n\n\t/**\n\t * Queries a document from the migration instance with a specific UID and\n\t * custom type.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * const contentRelationship = migration.createContentRelationship(() =>\n\t * \tmigration.getByUID(\"blog_post\", \"my-first-post\"),\n\t * )\n\t * ```\n\t *\n\t * @typeParam TType - Type of the Prismic document returned.\n\t *\n\t * @param type - The API ID of the document's custom type.\n\t * @param uid - The UID of the document.\n\t *\n\t * @returns The migration document instance with a UID matching the `uid`\n\t * parameter, if a matching document is found.\n\t */\n\tgetByUID<TType extends TDocuments[\"type\"]>(\n\t\ttype: TType,\n\t\tuid: string,\n\t):\n\t\t| PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>>\n\t\t| undefined {\n\t\treturn this._documents.find(\n\t\t\t(\n\t\t\t\tdoc,\n\t\t\t): doc is PrismicMigrationDocument<\n\t\t\t\tExtractDocumentType<TDocuments, TType>\n\t\t\t> => doc.document.type === type && doc.document.uid === uid,\n\t\t)\n\t}\n\n\t/**\n\t * Queries a singleton document from the migration instance for a specific\n\t * custom type.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * const contentRelationship = migration.createContentRelationship(() =>\n\t * \tmigration.getSingle(\"settings\"),\n\t * )\n\t * ```\n\t *\n\t * @typeParam TType - Type of the Prismic document returned.\n\t *\n\t * @param type - The API ID of the singleton custom type.\n\t *\n\t * @returns The migration document instance for the custom type, if a matching\n\t * document is found.\n\t */\n\tgetSingle<TType extends TDocuments[\"type\"]>(\n\t\ttype: TType,\n\t):\n\t\t| PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>>\n\t\t| undefined {\n\t\treturn this._documents.find(\n\t\t\t(\n\t\t\t\tdoc,\n\t\t\t): doc is PrismicMigrationDocument<\n\t\t\t\tExtractDocumentType<TDocuments, TType>\n\t\t\t> => doc.document.type === type,\n\t\t)\n\t}\n\n\t/**\n\t * Migrates a Prismic document data from another repository so that it can be\n\t * created through the current repository's Migration API.\n\t *\n\t * @param input - The Prismic document data to migrate.\n\t *\n\t * @returns The migrated Prismic document data.\n\t */\n\t#migratePrismicDocumentData(input: unknown): unknown {\n\t\tif (is.filledContentRelationship(input)) {\n\t\t\tif (input.isBroken) {\n\t\t\t\treturn {\n\t\t\t\t\tlink_type: LinkType.Document,\n\t\t\t\t\t// ID needs to be 16 characters long to be considered valid by the API\n\t\t\t\t\tid: \"_____broken_____\",\n\t\t\t\t\tisBroken: true,\n\t\t\t\t\t// TODO: Remove when link text PR is merged\n\t\t\t\t\t// @ts-expect-error - Future-proofing for link text\n\t\t\t\t\ttext: input.text,\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tlink_type: LinkType.Document,\n\t\t\t\tid: () => this._getByOriginalID(input.id),\n\t\t\t\t// TODO: Remove when link text PR is merged\n\t\t\t\t// @ts-expect-error - Future-proofing for link text\n\t\t\t\ttext: input.text,\n\t\t\t}\n\t\t}\n\n\t\tif (is.filledLinkToMedia(input)) {\n\t\t\treturn {\n\t\t\t\tlink_type: LinkType.Media,\n\t\t\t\tid: this.createAsset(input),\n\t\t\t\t// TODO: Remove when link text PR is merged\n\t\t\t\t// @ts-expect-error - Future-proofing for link text\n\t\t\t\ttext: input.text,\n\t\t\t}\n\t\t}\n\n\t\tif (is.rtImageNode(input)) {\n\t\t\t// Rich text image nodes\n\t\t\tconst rtImageNode: MigrationRTImageNode = {\n\t\t\t\ttype: RichTextNodeType.image,\n\t\t\t\tid: this.createAsset(input),\n\t\t\t}\n\n\t\t\tif (input.linkTo) {\n\t\t\t\trtImageNode.linkTo = this.#migratePrismicDocumentData(input.linkTo) as\n\t\t\t\t\t| MigrationContentRelationship\n\t\t\t\t\t| MigrationLinkToMedia\n\t\t\t\t\t| FilledLinkToWebField\n\t\t\t}\n\n\t\t\treturn rtImageNode\n\t\t}\n\n\t\tif (is.filledImage(input)) {\n\t\t\tconst image: MigrationImage = {\n\t\t\t\tid: this.createAsset(input),\n\t\t\t}\n\n\t\t\tconst {\n\t\t\t\tid: _id,\n\t\t\t\turl: _url,\n\t\t\t\tdimensions: _dimensions,\n\t\t\t\tedit: _edit,\n\t\t\t\talt: _alt,\n\t\t\t\tcopyright: _copyright,\n\t\t\t\t...thumbnails\n\t\t\t} = input\n\n\t\t\tfor (const name in thumbnails) {\n\t\t\t\tif (is.filledImage(thumbnails[name])) {\n\t\t\t\t\timage[name] = this.createAsset(thumbnails[name])\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn image\n\t\t}\n\n\t\tif (Array.isArray(input)) {\n\t\t\treturn input.map((element) => this.#migratePrismicDocumentData(element))\n\t\t}\n\n\t\tif (input && typeof input === \"object\") {\n\t\t\tconst res: Record<PropertyKey, unknown> = {}\n\n\t\t\tfor (const key in input) {\n\t\t\t\tres[key] = this.#migratePrismicDocumentData(\n\t\t\t\t\tinput[key as keyof typeof input],\n\t\t\t\t)\n\t\t\t}\n\n\t\t\treturn res\n\t\t}\n\n\t\treturn input\n\t}\n\n\t/**\n\t * Queries a document from the migration instance for a specific original ID.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * const contentRelationship = migration.createContentRelationship(() =>\n\t * \tmigration._getByOriginalID(\"YhdrDxIAACgAcp_b\"),\n\t * )\n\t * ```\n\t *\n\t * @typeParam TType - Type of the Prismic document returned.\n\t *\n\t * @param id - The original ID of the Prismic document.\n\t *\n\t * @returns The migration document instance for the original ID, if a matching\n\t * document is found.\n\t *\n\t * @internal\n\t */\n\t_getByOriginalID<TType extends TDocuments[\"type\"]>(\n\t\tid: string,\n\t):\n\t\t| PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>>\n\t\t| undefined {\n\t\treturn this._documents.find(\n\t\t\t(\n\t\t\t\tdoc,\n\t\t\t): doc is PrismicMigrationDocument<\n\t\t\t\tExtractDocumentType<TDocuments, TType>\n\t\t\t> => doc.originalPrismicDocument?.id === id,\n\t\t)\n\t}\n}\n"],"names":["filename","credits","alt","is.filledContentRelationship","is.filledLinkToMedia","is.rtImageNode","rtImageNode","is.filledImage"],"mappings":";;;;;;;;;;;;;;;;MA6Ca,UAAS;AAAA;;AAMrB;AAAA;AAAA;AAAA;AAAA;AAAA,uDAAwE;AAOxE;AAAA;AAAA;AAAA;AAAA;AAAA,sCAAqD,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA0ErD,YACC,oBAKA,UACA,EACC,OACA,SACA,KACA,KAMG,IAAA,IAAE;;AAEF,QAAA;AACA,QAAA;AACJ,QAAI,OAAO,uBAAuB,YAAY,SAAS,oBAAoB;AAEzE,UAAA,gBAAgB,sBAChB,eAAe,oBACd;AACD,cAAM,MAAM,mBAAmB,IAAI,MAAM,GAAG,EAAE,CAAC;AAC/C,cAAMA,YACL,UAAU,qBACP,mBAAmB,OACnB,IAAI,MAAM,GAAG,EAAE,IAAM,EAAC,MAAM,GAAG,EAAE;AACrC,cAAMC,WACL,eAAe,sBAAsB,mBAAmB,YACrD,mBAAmB,YACnB;AACJ,cAAMC,OACL,SAAS,sBAAsB,mBAAmB,MAC/C,mBAAmB,MACnB;AAEJ,YAAI,gBAAgB,oBAAoB;AACnB,8BAAA;AAAA,QACrB;AAES,iBAAA;AAAA,UACR,IAAI,mBAAmB;AAAA,UACvB,MAAM;AAAA,UACN,UAAAF;AAAAA,UACA,OAAO;AAAA,UACP,SAAAC;AAAAA,UACA,KAAAC;AAAAA,UACA,MAAM;AAAA,QAAA;AAAA,aAED;AACG,iBAAA;AAAA,UACR,IAAI,mBAAmB;AAAA,UACvB,MAAM,mBAAmB;AAAA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