payload 3.0.0-beta.104 → 3.0.0-beta.106
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.
- package/dist/admin/forms/Description.d.ts +1 -1
- package/dist/admin/forms/Description.d.ts.map +1 -1
- package/dist/admin/forms/Description.js.map +1 -1
- package/dist/admin/forms/Error.d.ts +1 -1
- package/dist/admin/forms/Error.d.ts.map +1 -1
- package/dist/admin/forms/Error.js.map +1 -1
- package/dist/admin/forms/Label.d.ts +3 -3
- package/dist/admin/forms/Label.d.ts.map +1 -1
- package/dist/admin/forms/Label.js.map +1 -1
- package/dist/collections/operations/duplicate.d.ts.map +1 -1
- package/dist/collections/operations/duplicate.js +10 -2
- package/dist/collections/operations/duplicate.js.map +1 -1
- package/dist/fields/baseFields/baseIDField.d.ts.map +1 -1
- package/dist/fields/baseFields/baseIDField.js +5 -0
- package/dist/fields/baseFields/baseIDField.js.map +1 -1
- package/dist/fields/config/sanitize.d.ts.map +1 -1
- package/dist/fields/config/sanitize.js +0 -19
- package/dist/fields/config/sanitize.js.map +1 -1
- package/dist/fields/hooks/afterChange/promise.js +4 -4
- package/dist/fields/hooks/afterChange/promise.js.map +1 -1
- package/dist/fields/hooks/beforeChange/index.d.ts +1 -3
- package/dist/fields/hooks/beforeChange/index.d.ts.map +1 -1
- package/dist/fields/hooks/beforeChange/index.js +1 -3
- package/dist/fields/hooks/beforeChange/index.js.map +1 -1
- package/dist/fields/hooks/beforeChange/promise.d.ts +1 -2
- package/dist/fields/hooks/beforeChange/promise.d.ts.map +1 -1
- package/dist/fields/hooks/beforeChange/promise.js +2 -18
- package/dist/fields/hooks/beforeChange/promise.js.map +1 -1
- package/dist/fields/hooks/beforeChange/traverseFields.d.ts +1 -2
- package/dist/fields/hooks/beforeChange/traverseFields.d.ts.map +1 -1
- package/dist/fields/hooks/beforeChange/traverseFields.js +1 -2
- package/dist/fields/hooks/beforeChange/traverseFields.js.map +1 -1
- package/dist/fields/hooks/beforeDuplicate/index.d.ts +19 -0
- package/dist/fields/hooks/beforeDuplicate/index.d.ts.map +1 -0
- package/dist/fields/hooks/beforeDuplicate/index.js +25 -0
- package/dist/fields/hooks/beforeDuplicate/index.js.map +1 -0
- package/dist/fields/hooks/beforeDuplicate/promise.d.ts +18 -0
- package/dist/fields/hooks/beforeDuplicate/promise.d.ts.map +1 -0
- package/dist/fields/hooks/beforeDuplicate/promise.js +299 -0
- package/dist/fields/hooks/beforeDuplicate/promise.js.map +1 -0
- package/dist/fields/hooks/beforeDuplicate/runHook.d.ts +3 -0
- package/dist/fields/hooks/beforeDuplicate/runHook.d.ts.map +1 -0
- package/dist/fields/hooks/beforeDuplicate/runHook.js +6 -0
- package/dist/fields/hooks/beforeDuplicate/runHook.js.map +1 -0
- package/dist/fields/hooks/beforeDuplicate/traverseFields.d.ts +18 -0
- package/dist/fields/hooks/beforeDuplicate/traverseFields.d.ts.map +1 -0
- package/dist/fields/hooks/beforeDuplicate/traverseFields.js +21 -0
- package/dist/fields/hooks/beforeDuplicate/traverseFields.js.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/package.json +6 -6
- package/dist/fields/baseFields/baseBeforeDuplicateArrays.d.ts +0 -6
- package/dist/fields/baseFields/baseBeforeDuplicateArrays.d.ts.map +0 -1
- package/dist/fields/baseFields/baseBeforeDuplicateArrays.js +0 -15
- package/dist/fields/baseFields/baseBeforeDuplicateArrays.js.map +0 -1
- package/dist/fields/hooks/beforeChange/beforeDuplicate.d.ts +0 -3
- package/dist/fields/hooks/beforeChange/beforeDuplicate.d.ts.map +0 -1
- package/dist/fields/hooks/beforeChange/beforeDuplicate.js +0 -6
- package/dist/fields/hooks/beforeChange/beforeDuplicate.js.map +0 -1
|
@@ -8,7 +8,6 @@ type Args = {
|
|
|
8
8
|
data: JsonObject;
|
|
9
9
|
doc: JsonObject;
|
|
10
10
|
docWithLocales: JsonObject;
|
|
11
|
-
duplicate: boolean;
|
|
12
11
|
errors: {
|
|
13
12
|
field: string;
|
|
14
13
|
message: string;
|
|
@@ -32,6 +31,6 @@ type Args = {
|
|
|
32
31
|
siblingDocWithLocales?: JsonObject;
|
|
33
32
|
skipValidation: boolean;
|
|
34
33
|
};
|
|
35
|
-
export declare const promise: ({ id, collection, context, data, doc, docWithLocales,
|
|
34
|
+
export declare const promise: ({ id, collection, context, data, doc, docWithLocales, errors, field, global, mergeLocaleActions, operation, parentPath, parentSchemaPath, req, siblingData, siblingDoc, siblingDocWithLocales, skipValidation, }: Args) => Promise<void>;
|
|
36
35
|
export {};
|
|
37
36
|
//# sourceMappingURL=promise.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promise.d.ts","sourceRoot":"","sources":["../../../../src/fields/hooks/beforeChange/promise.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAA;AACrF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAA;AAC7E,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACpG,OAAO,KAAK,EAAE,KAAK,EAAiB,UAAU,EAAmB,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"promise.d.ts","sourceRoot":"","sources":["../../../../src/fields/hooks/beforeChange/promise.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAA;AACrF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAA;AAC7E,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACpG,OAAO,KAAK,EAAE,KAAK,EAAiB,UAAU,EAAmB,MAAM,uBAAuB,CAAA;AAS9F,KAAK,IAAI,GAAG;IACV,UAAU,EAAE,IAAI,GAAG,yBAAyB,CAAA;IAC5C,OAAO,EAAE,cAAc,CAAA;IACvB,IAAI,EAAE,UAAU,CAAA;IAChB,GAAG,EAAE,UAAU,CAAA;IACf,cAAc,EAAE,UAAU,CAAA;IAC1B,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IAC5C,KAAK,EAAE,KAAK,GAAG,UAAU,CAAA;IACzB,MAAM,EAAE,IAAI,GAAG,qBAAqB,CAAA;IACpC,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACpB,kBAAkB,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAA;IAC3C,SAAS,EAAE,SAAS,CAAA;IACpB;;OAEG;IACH,UAAU,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;IAC/B;;OAEG;IACH,gBAAgB,EAAE,MAAM,EAAE,CAAA;IAC1B,GAAG,EAAE,cAAc,CAAA;IACnB,WAAW,EAAE,UAAU,CAAA;IACvB,UAAU,EAAE,UAAU,CAAA;IACtB,qBAAqB,CAAC,EAAE,UAAU,CAAA;IAClC,cAAc,EAAE,OAAO,CAAA;CACxB,CAAA;AAUD,eAAO,MAAM,OAAO,qNAmBjB,IAAI,KAAG,OAAO,CAAC,IAAI,CAqarB,CAAA"}
|
|
@@ -2,7 +2,6 @@ import { MissingEditorProp } from '../../../errors/index.js';
|
|
|
2
2
|
import { deepMergeWithSourceArrays } from '../../../utilities/deepMerge.js';
|
|
3
3
|
import { fieldAffectsData, tabHasName } from '../../config/types.js';
|
|
4
4
|
import { getFieldPaths } from '../../getFieldPaths.js';
|
|
5
|
-
import { beforeDuplicate } from './beforeDuplicate.js';
|
|
6
5
|
import { getExistingRowDoc } from './getExistingRowDoc.js';
|
|
7
6
|
import { traverseFields } from './traverseFields.js';
|
|
8
7
|
// This function is responsible for the following actions, in order:
|
|
@@ -12,7 +11,7 @@ import { traverseFields } from './traverseFields.js';
|
|
|
12
11
|
// - Transform data for storage
|
|
13
12
|
// - beforeDuplicate hooks (if duplicate)
|
|
14
13
|
// - Unflatten locales
|
|
15
|
-
export const promise = async ({ id, collection, context, data, doc, docWithLocales,
|
|
14
|
+
export const promise = async ({ id, collection, context, data, doc, docWithLocales, errors, field, global, mergeLocaleActions, operation, parentPath, parentSchemaPath, req, siblingData, siblingDoc, siblingDocWithLocales, skipValidation })=>{
|
|
16
15
|
const passesCondition = field.admin?.condition ? Boolean(field.admin.condition(data, siblingData, {
|
|
17
16
|
user: req.user
|
|
18
17
|
})) : true;
|
|
@@ -113,11 +112,7 @@ export const promise = async ({ id, collection, context, data, doc, docWithLocal
|
|
|
113
112
|
mergeLocaleActions.push(async ()=>{
|
|
114
113
|
const localeData = await localization.localeCodes.reduce(async (localizedValuesPromise, locale)=>{
|
|
115
114
|
const localizedValues = await localizedValuesPromise;
|
|
116
|
-
|
|
117
|
-
if (duplicate && field.hooks?.beforeDuplicate?.length) {
|
|
118
|
-
beforeDuplicateArgs.value = fieldValue;
|
|
119
|
-
fieldValue = await beforeDuplicate(beforeDuplicateArgs);
|
|
120
|
-
}
|
|
115
|
+
const fieldValue = locale === req.locale ? siblingData[field.name] : siblingDocWithLocales?.[field.name]?.[locale];
|
|
121
116
|
// const result = await localizedValues
|
|
122
117
|
// update locale value if it's not undefined
|
|
123
118
|
if (typeof fieldValue !== 'undefined') {
|
|
@@ -133,10 +128,6 @@ export const promise = async ({ id, collection, context, data, doc, docWithLocal
|
|
|
133
128
|
siblingData[field.name] = localeData;
|
|
134
129
|
}
|
|
135
130
|
});
|
|
136
|
-
} else if (duplicate && field.hooks?.beforeDuplicate?.length) {
|
|
137
|
-
mergeLocaleActions.push(async ()=>{
|
|
138
|
-
siblingData[field.name] = await beforeDuplicate(beforeDuplicateArgs);
|
|
139
|
-
});
|
|
140
131
|
}
|
|
141
132
|
}
|
|
142
133
|
switch(field.type){
|
|
@@ -172,7 +163,6 @@ export const promise = async ({ id, collection, context, data, doc, docWithLocal
|
|
|
172
163
|
data,
|
|
173
164
|
doc,
|
|
174
165
|
docWithLocales,
|
|
175
|
-
duplicate,
|
|
176
166
|
errors,
|
|
177
167
|
fields: field.fields,
|
|
178
168
|
global,
|
|
@@ -201,7 +191,6 @@ export const promise = async ({ id, collection, context, data, doc, docWithLocal
|
|
|
201
191
|
data,
|
|
202
192
|
doc,
|
|
203
193
|
docWithLocales,
|
|
204
|
-
duplicate,
|
|
205
194
|
errors,
|
|
206
195
|
fields: field.fields,
|
|
207
196
|
global,
|
|
@@ -241,7 +230,6 @@ export const promise = async ({ id, collection, context, data, doc, docWithLocal
|
|
|
241
230
|
data,
|
|
242
231
|
doc,
|
|
243
232
|
docWithLocales,
|
|
244
|
-
duplicate,
|
|
245
233
|
errors,
|
|
246
234
|
fields: block.fields,
|
|
247
235
|
global,
|
|
@@ -274,7 +262,6 @@ export const promise = async ({ id, collection, context, data, doc, docWithLocal
|
|
|
274
262
|
data,
|
|
275
263
|
doc,
|
|
276
264
|
docWithLocales,
|
|
277
|
-
duplicate,
|
|
278
265
|
errors,
|
|
279
266
|
fields: field.fields,
|
|
280
267
|
global,
|
|
@@ -316,7 +303,6 @@ export const promise = async ({ id, collection, context, data, doc, docWithLocal
|
|
|
316
303
|
data,
|
|
317
304
|
doc,
|
|
318
305
|
docWithLocales,
|
|
319
|
-
duplicate,
|
|
320
306
|
errors,
|
|
321
307
|
fields: field.fields,
|
|
322
308
|
global,
|
|
@@ -341,7 +327,6 @@ export const promise = async ({ id, collection, context, data, doc, docWithLocal
|
|
|
341
327
|
data,
|
|
342
328
|
doc,
|
|
343
329
|
docWithLocales,
|
|
344
|
-
duplicate,
|
|
345
330
|
errors,
|
|
346
331
|
fields: field.tabs.map((tab)=>({
|
|
347
332
|
...tab,
|
|
@@ -378,7 +363,6 @@ export const promise = async ({ id, collection, context, data, doc, docWithLocal
|
|
|
378
363
|
context,
|
|
379
364
|
data,
|
|
380
365
|
docWithLocales,
|
|
381
|
-
duplicate,
|
|
382
366
|
errors,
|
|
383
367
|
field,
|
|
384
368
|
global,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/fields/hooks/beforeChange/promise.ts"],"sourcesContent":["import type { RichTextAdapter } from '../../../admin/RichText.js'\nimport type { SanitizedCollectionConfig } from '../../../collections/config/types.js'\nimport type { SanitizedGlobalConfig } from '../../../globals/config/types.js'\nimport type { JsonObject, Operation, PayloadRequest, RequestContext } from '../../../types/index.js'\nimport type { Field, FieldHookArgs, TabAsField, ValidateOptions } from '../../config/types.js'\n\nimport { MissingEditorProp } from '../../../errors/index.js'\nimport { deepMergeWithSourceArrays } from '../../../utilities/deepMerge.js'\nimport { fieldAffectsData, tabHasName } from '../../config/types.js'\nimport { getFieldPaths } from '../../getFieldPaths.js'\nimport { beforeDuplicate } from './beforeDuplicate.js'\nimport { getExistingRowDoc } from './getExistingRowDoc.js'\nimport { traverseFields } from './traverseFields.js'\n\ntype Args = {\n collection: null | SanitizedCollectionConfig\n context: RequestContext\n data: JsonObject\n doc: JsonObject\n docWithLocales: JsonObject\n duplicate: boolean\n errors: { field: string; message: string }[]\n field: Field | TabAsField\n global: null | SanitizedGlobalConfig\n id?: number | string\n mergeLocaleActions: (() => Promise<void>)[]\n operation: Operation\n /**\n * The parent's path.\n */\n parentPath: (number | string)[]\n /**\n * The parent's schemaPath (path without indexes).\n */\n parentSchemaPath: string[]\n req: PayloadRequest\n siblingData: JsonObject\n siblingDoc: JsonObject\n siblingDocWithLocales?: JsonObject\n skipValidation: boolean\n}\n\n// This function is responsible for the following actions, in order:\n// - Run condition\n// - Execute field hooks\n// - Validate data\n// - Transform data for storage\n// - beforeDuplicate hooks (if duplicate)\n// - Unflatten locales\n\nexport const promise = async ({\n id,\n collection,\n context,\n data,\n doc,\n docWithLocales,\n duplicate,\n errors,\n field,\n global,\n mergeLocaleActions,\n operation,\n parentPath,\n parentSchemaPath,\n req,\n siblingData,\n siblingDoc,\n siblingDocWithLocales,\n skipValidation,\n}: Args): Promise<void> => {\n const passesCondition = field.admin?.condition\n ? Boolean(field.admin.condition(data, siblingData, { user: req.user }))\n : true\n let skipValidationFromHere = skipValidation || !passesCondition\n const { localization } = req.payload.config\n const defaultLocale = localization ? localization?.defaultLocale : 'en'\n const operationLocale = req.locale || defaultLocale\n\n const { path: fieldPath, schemaPath: fieldSchemaPath } = getFieldPaths({\n field,\n parentPath,\n parentSchemaPath,\n })\n\n if (fieldAffectsData(field)) {\n // skip validation if the field is localized and the incoming data is null\n if (field.localized && operationLocale !== defaultLocale) {\n if (['array', 'blocks'].includes(field.type) && siblingData[field.name] === null) {\n skipValidationFromHere = true\n }\n }\n\n // Execute hooks\n if (field.hooks?.beforeChange) {\n await field.hooks.beforeChange.reduce(async (priorHook, currentHook) => {\n await priorHook\n\n const hookedValue = await currentHook({\n collection,\n context,\n data,\n field,\n global,\n operation,\n originalDoc: doc,\n path: fieldPath,\n previousSiblingDoc: siblingDoc,\n previousValue: siblingDoc[field.name],\n req,\n schemaPath: parentSchemaPath,\n siblingData,\n siblingDocWithLocales,\n value: siblingData[field.name],\n })\n\n if (hookedValue !== undefined) {\n siblingData[field.name] = hookedValue\n }\n }, Promise.resolve())\n }\n\n // Validate\n if (!skipValidationFromHere && 'validate' in field && field.validate) {\n const valueToValidate = siblingData[field.name]\n let jsonError: object\n\n if (field.type === 'json' && typeof siblingData[field.name] === 'string') {\n try {\n JSON.parse(siblingData[field.name] as string)\n } catch (e) {\n jsonError = e\n }\n }\n\n const validationResult = await field.validate(valueToValidate, {\n ...field,\n id,\n collectionSlug: collection?.slug,\n data: deepMergeWithSourceArrays(doc, data),\n jsonError,\n operation,\n preferences: { fields: {} },\n previousValue: siblingDoc[field.name],\n req,\n siblingData: deepMergeWithSourceArrays(siblingDoc, siblingData),\n } as ValidateOptions<any, any, { jsonError: object }, any>)\n\n if (typeof validationResult === 'string') {\n errors.push({\n field: fieldPath.join('.'),\n message: validationResult,\n })\n }\n }\n\n const beforeDuplicateArgs: FieldHookArgs = {\n collection,\n context,\n data,\n field,\n global: undefined,\n path: fieldPath,\n previousSiblingDoc: siblingDoc,\n previousValue: siblingDoc[field.name],\n req,\n schemaPath: parentSchemaPath,\n siblingData,\n siblingDocWithLocales,\n value: siblingData[field.name],\n }\n\n // Push merge locale action if applicable\n if (localization && field.localized) {\n mergeLocaleActions.push(async () => {\n const localeData = await localization.localeCodes.reduce(\n async (localizedValuesPromise: Promise<JsonObject>, locale) => {\n const localizedValues = await localizedValuesPromise\n let fieldValue =\n locale === req.locale\n ? siblingData[field.name]\n : siblingDocWithLocales?.[field.name]?.[locale]\n\n if (duplicate && field.hooks?.beforeDuplicate?.length) {\n beforeDuplicateArgs.value = fieldValue\n fieldValue = await beforeDuplicate(beforeDuplicateArgs)\n }\n\n // const result = await localizedValues\n // update locale value if it's not undefined\n if (typeof fieldValue !== 'undefined') {\n return {\n ...localizedValues,\n [locale]: fieldValue,\n }\n }\n\n return localizedValuesPromise\n },\n Promise.resolve({}),\n )\n\n // If there are locales with data, set the data\n if (Object.keys(localeData).length > 0) {\n siblingData[field.name] = localeData\n }\n })\n } else if (duplicate && field.hooks?.beforeDuplicate?.length) {\n mergeLocaleActions.push(async () => {\n siblingData[field.name] = await beforeDuplicate(beforeDuplicateArgs)\n })\n }\n }\n\n switch (field.type) {\n case 'point': {\n // Transform point data for storage\n if (\n Array.isArray(siblingData[field.name]) &&\n siblingData[field.name][0] !== null &&\n siblingData[field.name][1] !== null\n ) {\n siblingData[field.name] = {\n type: 'Point',\n coordinates: [\n parseFloat(siblingData[field.name][0]),\n parseFloat(siblingData[field.name][1]),\n ],\n }\n }\n\n break\n }\n\n case 'group': {\n if (typeof siblingData[field.name] !== 'object') {\n siblingData[field.name] = {}\n }\n if (typeof siblingDoc[field.name] !== 'object') {\n siblingDoc[field.name] = {}\n }\n if (typeof siblingDocWithLocales[field.name] !== 'object') {\n siblingDocWithLocales[field.name] = {}\n }\n\n await traverseFields({\n id,\n collection,\n context,\n data,\n doc,\n docWithLocales,\n duplicate,\n errors,\n fields: field.fields,\n global,\n mergeLocaleActions,\n operation,\n path: fieldPath,\n req,\n schemaPath: fieldSchemaPath,\n siblingData: siblingData[field.name] as JsonObject,\n siblingDoc: siblingDoc[field.name] as JsonObject,\n siblingDocWithLocales: siblingDocWithLocales[field.name] as JsonObject,\n skipValidation: skipValidationFromHere,\n })\n\n break\n }\n\n case 'array': {\n const rows = siblingData[field.name]\n\n if (Array.isArray(rows)) {\n const promises = []\n rows.forEach((row, i) => {\n promises.push(\n traverseFields({\n id,\n collection,\n context,\n data,\n doc,\n docWithLocales,\n duplicate,\n errors,\n fields: field.fields,\n global,\n mergeLocaleActions,\n operation,\n path: [...fieldPath, i],\n req,\n schemaPath: fieldSchemaPath,\n siblingData: row as JsonObject,\n siblingDoc: getExistingRowDoc(row as JsonObject, siblingDoc[field.name]),\n siblingDocWithLocales: getExistingRowDoc(\n row as JsonObject,\n siblingDocWithLocales[field.name],\n ),\n skipValidation: skipValidationFromHere,\n }),\n )\n })\n\n await Promise.all(promises)\n }\n\n break\n }\n\n case 'blocks': {\n const rows = siblingData[field.name]\n\n if (Array.isArray(rows)) {\n const promises = []\n rows.forEach((row, i) => {\n const rowSiblingDoc = getExistingRowDoc(row as JsonObject, siblingDoc[field.name])\n const rowSiblingDocWithLocales = getExistingRowDoc(\n row as JsonObject,\n siblingDocWithLocales[field.name],\n )\n\n const blockTypeToMatch = (row as JsonObject).blockType || rowSiblingDoc.blockType\n const block = field.blocks.find((blockType) => blockType.slug === blockTypeToMatch)\n\n if (block) {\n promises.push(\n traverseFields({\n id,\n collection,\n context,\n data,\n doc,\n docWithLocales,\n duplicate,\n errors,\n fields: block.fields,\n global,\n mergeLocaleActions,\n operation,\n path: [...fieldPath, i],\n req,\n schemaPath: fieldSchemaPath,\n siblingData: row as JsonObject,\n siblingDoc: rowSiblingDoc,\n siblingDocWithLocales: rowSiblingDocWithLocales,\n skipValidation: skipValidationFromHere,\n }),\n )\n }\n })\n\n await Promise.all(promises)\n }\n\n break\n }\n\n case 'row':\n case 'collapsible': {\n await traverseFields({\n id,\n collection,\n context,\n data,\n doc,\n docWithLocales,\n duplicate,\n errors,\n fields: field.fields,\n global,\n mergeLocaleActions,\n operation,\n path: fieldPath,\n req,\n schemaPath: fieldSchemaPath,\n siblingData,\n siblingDoc,\n siblingDocWithLocales,\n skipValidation: skipValidationFromHere,\n })\n\n break\n }\n\n case 'tab': {\n let tabSiblingData = siblingData\n let tabSiblingDoc = siblingDoc\n let tabSiblingDocWithLocales = siblingDocWithLocales\n\n if (tabHasName(field)) {\n if (typeof siblingData[field.name] !== 'object') {\n siblingData[field.name] = {}\n }\n if (typeof siblingDoc[field.name] !== 'object') {\n siblingDoc[field.name] = {}\n }\n if (typeof siblingDocWithLocales[field.name] !== 'object') {\n siblingDocWithLocales[field.name] = {}\n }\n\n tabSiblingData = siblingData[field.name] as JsonObject\n tabSiblingDoc = siblingDoc[field.name] as JsonObject\n tabSiblingDocWithLocales = siblingDocWithLocales[field.name] as JsonObject\n }\n\n await traverseFields({\n id,\n collection,\n context,\n data,\n doc,\n docWithLocales,\n duplicate,\n errors,\n fields: field.fields,\n global,\n mergeLocaleActions,\n operation,\n path: fieldPath,\n req,\n schemaPath: fieldSchemaPath,\n siblingData: tabSiblingData,\n siblingDoc: tabSiblingDoc,\n siblingDocWithLocales: tabSiblingDocWithLocales,\n skipValidation: skipValidationFromHere,\n })\n\n break\n }\n\n case 'tabs': {\n await traverseFields({\n id,\n collection,\n context,\n data,\n doc,\n docWithLocales,\n duplicate,\n errors,\n fields: field.tabs.map((tab) => ({ ...tab, type: 'tab' })),\n global,\n mergeLocaleActions,\n operation,\n path: fieldPath,\n req,\n schemaPath: fieldSchemaPath,\n siblingData,\n siblingDoc,\n siblingDocWithLocales,\n skipValidation: skipValidationFromHere,\n })\n\n break\n }\n\n case 'richText': {\n if (!field?.editor) {\n throw new MissingEditorProp(field) // while we allow disabling editor functionality, you should not have any richText fields defined if you do not have an editor\n }\n if (typeof field?.editor === 'function') {\n throw new Error('Attempted to access unsanitized rich text editor.')\n }\n\n const editor: RichTextAdapter = field?.editor\n\n if (editor?.hooks?.beforeChange?.length) {\n await editor.hooks.beforeChange.reduce(async (priorHook, currentHook) => {\n await priorHook\n\n const hookedValue = await currentHook({\n collection,\n context,\n data,\n docWithLocales,\n duplicate,\n errors,\n field,\n global,\n mergeLocaleActions,\n operation,\n originalDoc: doc,\n path: fieldPath,\n previousSiblingDoc: siblingDoc,\n previousValue: siblingDoc[field.name],\n req,\n schemaPath: parentSchemaPath,\n siblingData,\n siblingDocWithLocales,\n skipValidation,\n value: siblingData[field.name],\n })\n\n if (hookedValue !== undefined) {\n siblingData[field.name] = hookedValue\n }\n }, Promise.resolve())\n }\n\n break\n }\n\n default: {\n break\n }\n }\n}\n"],"names":["MissingEditorProp","deepMergeWithSourceArrays","fieldAffectsData","tabHasName","getFieldPaths","beforeDuplicate","getExistingRowDoc","traverseFields","promise","id","collection","context","data","doc","docWithLocales","duplicate","errors","field","global","mergeLocaleActions","operation","parentPath","parentSchemaPath","req","siblingData","siblingDoc","siblingDocWithLocales","skipValidation","passesCondition","admin","condition","Boolean","user","skipValidationFromHere","localization","payload","config","defaultLocale","operationLocale","locale","path","fieldPath","schemaPath","fieldSchemaPath","localized","includes","type","name","hooks","beforeChange","reduce","priorHook","currentHook","hookedValue","originalDoc","previousSiblingDoc","previousValue","value","undefined","Promise","resolve","validate","valueToValidate","jsonError","JSON","parse","e","validationResult","collectionSlug","slug","preferences","fields","push","join","message","beforeDuplicateArgs","localeData","localeCodes","localizedValuesPromise","localizedValues","fieldValue","length","Object","keys","Array","isArray","coordinates","parseFloat","rows","promises","forEach","row","i","all","rowSiblingDoc","rowSiblingDocWithLocales","blockTypeToMatch","blockType","block","blocks","find","tabSiblingData","tabSiblingDoc","tabSiblingDocWithLocales","tabs","map","tab","editor","Error"],"mappings":"AAMA,SAASA,iBAAiB,QAAQ,2BAA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BACpC1C;4BACAC;4BACAC;4BACAE;4BACAC;4BACAC;4BACAC;4BACAC;4BACAC;4BACAC;4BACAkC,aAAazC;4BACb2B,MAAMC;4BACNc,oBAAoB9B;4BACpB+B,eAAe/B,UAAU,CAACR,MAAM8B,IAAI,CAAC;4BACrCxB;4BACAmB,YAAYpB;4BACZE;4BACAE;4BACAC;4BACA8B,OAAOjC,WAAW,CAACP,MAAM8B,IAAI,CAAC;wBAChC;wBAEA,IAAIM,gBAAgBK,WAAW;4BAC7BlC,WAAW,CAACP,MAAM8B,IAAI,CAAC,GAAGM;wBAC5B;oBACF,GAAGM,QAAQC,OAAO;gBACpB;gBAEA;YACF;QAEA;YAAS;gBACP;YACF;IACF;AACF,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/fields/hooks/beforeChange/promise.ts"],"sourcesContent":["import type { RichTextAdapter } from '../../../admin/RichText.js'\nimport type { SanitizedCollectionConfig } from '../../../collections/config/types.js'\nimport type { SanitizedGlobalConfig } from '../../../globals/config/types.js'\nimport type { JsonObject, Operation, PayloadRequest, RequestContext } from '../../../types/index.js'\nimport type { Field, FieldHookArgs, TabAsField, ValidateOptions } from '../../config/types.js'\n\nimport { MissingEditorProp } from '../../../errors/index.js'\nimport { deepMergeWithSourceArrays } from '../../../utilities/deepMerge.js'\nimport { fieldAffectsData, tabHasName } from '../../config/types.js'\nimport { getFieldPaths } from '../../getFieldPaths.js'\nimport { getExistingRowDoc } from './getExistingRowDoc.js'\nimport { traverseFields } from './traverseFields.js'\n\ntype Args = {\n collection: null | SanitizedCollectionConfig\n context: RequestContext\n data: JsonObject\n doc: JsonObject\n docWithLocales: JsonObject\n errors: { field: string; message: string }[]\n field: Field | TabAsField\n global: null | SanitizedGlobalConfig\n id?: number | string\n mergeLocaleActions: (() => Promise<void>)[]\n operation: Operation\n /**\n * The parent's path.\n */\n parentPath: (number | string)[]\n /**\n * The parent's schemaPath (path without indexes).\n */\n parentSchemaPath: string[]\n req: PayloadRequest\n siblingData: JsonObject\n siblingDoc: JsonObject\n siblingDocWithLocales?: JsonObject\n skipValidation: boolean\n}\n\n// This function is responsible for the following actions, in order:\n// - Run condition\n// - Execute field hooks\n// - Validate data\n// - Transform data for storage\n// - beforeDuplicate hooks (if duplicate)\n// - Unflatten locales\n\nexport const promise = async ({\n id,\n collection,\n context,\n data,\n doc,\n docWithLocales,\n errors,\n field,\n global,\n mergeLocaleActions,\n operation,\n parentPath,\n parentSchemaPath,\n req,\n siblingData,\n siblingDoc,\n siblingDocWithLocales,\n skipValidation,\n}: Args): Promise<void> => {\n const passesCondition = field.admin?.condition\n ? Boolean(field.admin.condition(data, siblingData, { user: req.user }))\n : true\n let skipValidationFromHere = skipValidation || !passesCondition\n const { localization } = req.payload.config\n const defaultLocale = localization ? localization?.defaultLocale : 'en'\n const operationLocale = req.locale || defaultLocale\n\n const { path: fieldPath, schemaPath: fieldSchemaPath } = getFieldPaths({\n field,\n parentPath,\n parentSchemaPath,\n })\n\n if (fieldAffectsData(field)) {\n // skip validation if the field is localized and the incoming data is null\n if (field.localized && operationLocale !== defaultLocale) {\n if (['array', 'blocks'].includes(field.type) && siblingData[field.name] === null) {\n skipValidationFromHere = true\n }\n }\n\n // Execute hooks\n if (field.hooks?.beforeChange) {\n await field.hooks.beforeChange.reduce(async (priorHook, currentHook) => {\n await priorHook\n\n const hookedValue = await currentHook({\n collection,\n context,\n data,\n field,\n global,\n operation,\n originalDoc: doc,\n path: fieldPath,\n previousSiblingDoc: siblingDoc,\n previousValue: siblingDoc[field.name],\n req,\n schemaPath: parentSchemaPath,\n siblingData,\n siblingDocWithLocales,\n value: siblingData[field.name],\n })\n\n if (hookedValue !== undefined) {\n siblingData[field.name] = hookedValue\n }\n }, Promise.resolve())\n }\n\n // Validate\n if (!skipValidationFromHere && 'validate' in field && field.validate) {\n const valueToValidate = siblingData[field.name]\n let jsonError: object\n\n if (field.type === 'json' && typeof siblingData[field.name] === 'string') {\n try {\n JSON.parse(siblingData[field.name] as string)\n } catch (e) {\n jsonError = e\n }\n }\n\n const validationResult = await field.validate(valueToValidate, {\n ...field,\n id,\n collectionSlug: collection?.slug,\n data: deepMergeWithSourceArrays(doc, data),\n jsonError,\n operation,\n preferences: { fields: {} },\n previousValue: siblingDoc[field.name],\n req,\n siblingData: deepMergeWithSourceArrays(siblingDoc, siblingData),\n } as ValidateOptions<any, any, { jsonError: object }, any>)\n\n if (typeof validationResult === 'string') {\n errors.push({\n field: fieldPath.join('.'),\n message: validationResult,\n })\n }\n }\n\n const beforeDuplicateArgs: FieldHookArgs = {\n collection,\n context,\n data,\n field,\n global: undefined,\n path: fieldPath,\n previousSiblingDoc: siblingDoc,\n previousValue: siblingDoc[field.name],\n req,\n schemaPath: parentSchemaPath,\n siblingData,\n siblingDocWithLocales,\n value: siblingData[field.name],\n }\n\n // Push merge locale action if applicable\n if (localization && field.localized) {\n mergeLocaleActions.push(async () => {\n const localeData = await localization.localeCodes.reduce(\n async (localizedValuesPromise: Promise<JsonObject>, locale) => {\n const localizedValues = await localizedValuesPromise\n const fieldValue =\n locale === req.locale\n ? siblingData[field.name]\n : siblingDocWithLocales?.[field.name]?.[locale]\n\n // const result = await localizedValues\n // update locale value if it's not undefined\n if (typeof fieldValue !== 'undefined') {\n return {\n ...localizedValues,\n [locale]: fieldValue,\n }\n }\n\n return localizedValuesPromise\n },\n Promise.resolve({}),\n )\n\n // If there are locales with data, set the data\n if (Object.keys(localeData).length > 0) {\n siblingData[field.name] = localeData\n }\n })\n }\n }\n\n switch (field.type) {\n case 'point': {\n // Transform point data for storage\n if (\n Array.isArray(siblingData[field.name]) &&\n siblingData[field.name][0] !== null &&\n siblingData[field.name][1] !== null\n ) {\n siblingData[field.name] = {\n type: 'Point',\n coordinates: [\n parseFloat(siblingData[field.name][0]),\n parseFloat(siblingData[field.name][1]),\n ],\n }\n }\n\n break\n }\n\n case 'group': {\n if (typeof siblingData[field.name] !== 'object') {\n siblingData[field.name] = {}\n }\n if (typeof siblingDoc[field.name] !== 'object') {\n siblingDoc[field.name] = {}\n }\n if (typeof siblingDocWithLocales[field.name] !== 'object') {\n siblingDocWithLocales[field.name] = {}\n }\n\n await traverseFields({\n id,\n collection,\n context,\n data,\n doc,\n docWithLocales,\n errors,\n fields: field.fields,\n global,\n mergeLocaleActions,\n operation,\n path: fieldPath,\n req,\n schemaPath: fieldSchemaPath,\n siblingData: siblingData[field.name] as JsonObject,\n siblingDoc: siblingDoc[field.name] as JsonObject,\n siblingDocWithLocales: siblingDocWithLocales[field.name] as JsonObject,\n skipValidation: skipValidationFromHere,\n })\n\n break\n }\n\n case 'array': {\n const rows = siblingData[field.name]\n\n if (Array.isArray(rows)) {\n const promises = []\n rows.forEach((row, i) => {\n promises.push(\n traverseFields({\n id,\n collection,\n context,\n data,\n doc,\n docWithLocales,\n errors,\n fields: field.fields,\n global,\n mergeLocaleActions,\n operation,\n path: [...fieldPath, i],\n req,\n schemaPath: fieldSchemaPath,\n siblingData: row as JsonObject,\n siblingDoc: getExistingRowDoc(row as JsonObject, siblingDoc[field.name]),\n siblingDocWithLocales: getExistingRowDoc(\n row as JsonObject,\n siblingDocWithLocales[field.name],\n ),\n skipValidation: skipValidationFromHere,\n }),\n )\n })\n\n await Promise.all(promises)\n }\n\n break\n }\n\n case 'blocks': {\n const rows = siblingData[field.name]\n\n if (Array.isArray(rows)) {\n const promises = []\n rows.forEach((row, i) => {\n const rowSiblingDoc = getExistingRowDoc(row as JsonObject, siblingDoc[field.name])\n const rowSiblingDocWithLocales = getExistingRowDoc(\n row as JsonObject,\n siblingDocWithLocales[field.name],\n )\n\n const blockTypeToMatch = (row as JsonObject).blockType || rowSiblingDoc.blockType\n const block = field.blocks.find((blockType) => blockType.slug === blockTypeToMatch)\n\n if (block) {\n promises.push(\n traverseFields({\n id,\n collection,\n context,\n data,\n doc,\n docWithLocales,\n errors,\n fields: block.fields,\n global,\n mergeLocaleActions,\n operation,\n path: [...fieldPath, i],\n req,\n schemaPath: fieldSchemaPath,\n siblingData: row as JsonObject,\n siblingDoc: rowSiblingDoc,\n siblingDocWithLocales: rowSiblingDocWithLocales,\n skipValidation: skipValidationFromHere,\n }),\n )\n }\n })\n\n await Promise.all(promises)\n }\n\n break\n }\n\n case 'row':\n case 'collapsible': {\n await traverseFields({\n id,\n collection,\n context,\n data,\n doc,\n docWithLocales,\n errors,\n fields: field.fields,\n global,\n mergeLocaleActions,\n operation,\n path: fieldPath,\n req,\n schemaPath: fieldSchemaPath,\n siblingData,\n siblingDoc,\n siblingDocWithLocales,\n skipValidation: skipValidationFromHere,\n })\n\n break\n }\n\n case 'tab': {\n let tabSiblingData = siblingData\n let tabSiblingDoc = siblingDoc\n let tabSiblingDocWithLocales = siblingDocWithLocales\n\n if (tabHasName(field)) {\n if (typeof siblingData[field.name] !== 'object') {\n siblingData[field.name] = {}\n }\n if (typeof siblingDoc[field.name] !== 'object') {\n siblingDoc[field.name] = {}\n }\n if (typeof siblingDocWithLocales[field.name] !== 'object') {\n siblingDocWithLocales[field.name] = {}\n }\n\n tabSiblingData = siblingData[field.name] as JsonObject\n tabSiblingDoc = siblingDoc[field.name] as JsonObject\n tabSiblingDocWithLocales = siblingDocWithLocales[field.name] as JsonObject\n }\n\n await traverseFields({\n id,\n collection,\n context,\n data,\n doc,\n docWithLocales,\n errors,\n fields: field.fields,\n global,\n mergeLocaleActions,\n operation,\n path: fieldPath,\n req,\n schemaPath: fieldSchemaPath,\n siblingData: tabSiblingData,\n siblingDoc: tabSiblingDoc,\n siblingDocWithLocales: tabSiblingDocWithLocales,\n skipValidation: skipValidationFromHere,\n })\n\n break\n }\n\n case 'tabs': {\n await traverseFields({\n id,\n collection,\n context,\n data,\n doc,\n docWithLocales,\n errors,\n fields: field.tabs.map((tab) => ({ ...tab, type: 'tab' })),\n global,\n mergeLocaleActions,\n operation,\n path: fieldPath,\n req,\n schemaPath: fieldSchemaPath,\n siblingData,\n siblingDoc,\n siblingDocWithLocales,\n skipValidation: skipValidationFromHere,\n })\n\n break\n }\n\n case 'richText': {\n if (!field?.editor) {\n throw new MissingEditorProp(field) // while we allow disabling editor functionality, you should not have any richText fields defined if you do not have an editor\n }\n if (typeof field?.editor === 'function') {\n throw new Error('Attempted to access unsanitized rich text editor.')\n }\n\n const editor: RichTextAdapter = field?.editor\n\n if (editor?.hooks?.beforeChange?.length) {\n await editor.hooks.beforeChange.reduce(async (priorHook, currentHook) => {\n await priorHook\n\n const hookedValue = await currentHook({\n collection,\n context,\n data,\n docWithLocales,\n errors,\n field,\n global,\n mergeLocaleActions,\n operation,\n originalDoc: doc,\n path: fieldPath,\n previousSiblingDoc: siblingDoc,\n previousValue: siblingDoc[field.name],\n req,\n schemaPath: parentSchemaPath,\n siblingData,\n siblingDocWithLocales,\n skipValidation,\n value: siblingData[field.name],\n })\n\n if (hookedValue !== undefined) {\n siblingData[field.name] = hookedValue\n }\n }, Promise.resolve())\n }\n\n break\n }\n\n default: {\n break\n }\n }\n}\n"],"names":["MissingEditorProp","deepMergeWithSourceArrays","fieldAffectsData","tabHasName","getFieldPaths","getExistingRowDoc","traverseFields","promise","id","collection","context","data","doc","docWithLocales","errors","field","global","mergeLocaleActions","operation","parentPath","parentSchemaPath","req","siblingData","siblingDoc","siblingDocWithLocales","skipValidation","passesCondition","admin","condition","Boolean","user","skipValidationFromHere","localization","payload","config","defaultLocale","operationLocale","locale","path","fieldPath","schemaPath","fieldSchemaPath","localized","includes","type","name","hooks","beforeChange","reduce","priorHook","currentHook","hookedValue","originalDoc","previousSiblingDoc","previousValue","value","undefined","Promise","resolve","validate","valueToValidate","jsonError","JSON","parse","e","validationResult","collectionSlug","slug","preferences","fields","push","join","message","beforeDuplicateArgs","localeData","localeCodes","localizedValuesPromise","localizedValues","fieldValue","Object","keys","length","Array","isArray","coordinates","parseFloat","rows","promises","forEach","row","i","all","rowSiblingDoc","rowSiblingDocWithLocales","blockTypeToMatch","blockType","block","blocks","find","tabSiblingData","tabSiblingDoc","tabSiblingDocWithLocales","tabs","map","tab","editor","Error"],"mappings":"AAMA,SAASA,iBA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gBACpB;gBAEA;YACF;QAEA;YAAS;gBACP;YACF;IACF;AACF,EAAC"}
|
|
@@ -14,7 +14,6 @@ type Args = {
|
|
|
14
14
|
* The original data with locales (not modified by any hooks)
|
|
15
15
|
*/
|
|
16
16
|
docWithLocales: JsonObject;
|
|
17
|
-
duplicate: boolean;
|
|
18
17
|
errors: {
|
|
19
18
|
field: string;
|
|
20
19
|
message: string;
|
|
@@ -46,6 +45,6 @@ type Args = {
|
|
|
46
45
|
* - Transform data for storage
|
|
47
46
|
* - Unflatten locales. The input `data` is the normal document for one locale. The output result will become the document with locales.
|
|
48
47
|
*/
|
|
49
|
-
export declare const traverseFields: ({ id, collection, context, data, doc, docWithLocales,
|
|
48
|
+
export declare const traverseFields: ({ id, collection, context, data, doc, docWithLocales, errors, fields, global, mergeLocaleActions, operation, path, req, schemaPath, siblingData, siblingDoc, siblingDocWithLocales, skipValidation, }: Args) => Promise<void>;
|
|
50
49
|
export {};
|
|
51
50
|
//# sourceMappingURL=traverseFields.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"traverseFields.d.ts","sourceRoot":"","sources":["../../../../src/fields/hooks/beforeChange/traverseFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAA;AACrF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAA;AAC7E,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACpG,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAI9D,KAAK,IAAI,GAAG;IACV,UAAU,EAAE,IAAI,GAAG,yBAAyB,CAAA;IAC5C,OAAO,EAAE,cAAc,CAAA;IACvB,IAAI,EAAE,UAAU,CAAA;IAChB;;OAEG;IACH,GAAG,EAAE,UAAU,CAAA;IACf;;OAEG;IACH,cAAc,EAAE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AC,EAAE,OAAO,CAAA;CACzB,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,0MAmBxB,IAAI,KAAG,OAAO,CAAC,IAAI,CA6BrB,CAAA"}
|
|
@@ -6,7 +6,7 @@ import { promise } from './promise.js';
|
|
|
6
6
|
* - Validate data
|
|
7
7
|
* - Transform data for storage
|
|
8
8
|
* - Unflatten locales. The input `data` is the normal document for one locale. The output result will become the document with locales.
|
|
9
|
-
*/ export const traverseFields = async ({ id, collection, context, data, doc, docWithLocales,
|
|
9
|
+
*/ export const traverseFields = async ({ id, collection, context, data, doc, docWithLocales, errors, fields, global, mergeLocaleActions, operation, path, req, schemaPath, siblingData, siblingDoc, siblingDocWithLocales, skipValidation })=>{
|
|
10
10
|
const promises = [];
|
|
11
11
|
fields.forEach((field)=>{
|
|
12
12
|
promises.push(promise({
|
|
@@ -16,7 +16,6 @@ import { promise } from './promise.js';
|
|
|
16
16
|
data,
|
|
17
17
|
doc,
|
|
18
18
|
docWithLocales,
|
|
19
|
-
duplicate,
|
|
20
19
|
errors,
|
|
21
20
|
field,
|
|
22
21
|
global,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/fields/hooks/beforeChange/traverseFields.ts"],"sourcesContent":["import type { SanitizedCollectionConfig } from '../../../collections/config/types.js'\nimport type { SanitizedGlobalConfig } from '../../../globals/config/types.js'\nimport type { JsonObject, Operation, PayloadRequest, RequestContext } from '../../../types/index.js'\nimport type { Field, TabAsField } from '../../config/types.js'\n\nimport { promise } from './promise.js'\n\ntype Args = {\n collection: null | SanitizedCollectionConfig\n context: RequestContext\n data: JsonObject\n /**\n * The original data (not modified by any hooks)\n */\n doc: JsonObject\n /**\n * The original data with locales (not modified by any hooks)\n */\n docWithLocales: JsonObject\n
|
|
1
|
+
{"version":3,"sources":["../../../../src/fields/hooks/beforeChange/traverseFields.ts"],"sourcesContent":["import type { SanitizedCollectionConfig } from '../../../collections/config/types.js'\nimport type { SanitizedGlobalConfig } from '../../../globals/config/types.js'\nimport type { JsonObject, Operation, PayloadRequest, RequestContext } from '../../../types/index.js'\nimport type { Field, TabAsField } from '../../config/types.js'\n\nimport { promise } from './promise.js'\n\ntype Args = {\n collection: null | SanitizedCollectionConfig\n context: RequestContext\n data: JsonObject\n /**\n * The original data (not modified by any hooks)\n */\n doc: JsonObject\n /**\n * The original data with locales (not modified by any hooks)\n */\n docWithLocales: JsonObject\n errors: { field: string; message: string }[]\n fields: (Field | TabAsField)[]\n global: null | SanitizedGlobalConfig\n id?: number | string\n mergeLocaleActions: (() => Promise<void>)[]\n operation: Operation\n path: (number | string)[]\n req: PayloadRequest\n schemaPath: string[]\n siblingData: JsonObject\n /**\n * The original siblingData (not modified by any hooks)\n */\n siblingDoc: JsonObject\n /**\n * The original siblingData with locales (not modified by any hooks)\n */\n siblingDocWithLocales: JsonObject\n skipValidation?: boolean\n}\n\n/**\n * This function is responsible for the following actions, in order:\n * - Run condition\n * - Execute field hooks\n * - Validate data\n * - Transform data for storage\n * - Unflatten locales. The input `data` is the normal document for one locale. The output result will become the document with locales.\n */\nexport const traverseFields = async ({\n id,\n collection,\n context,\n data,\n doc,\n docWithLocales,\n errors,\n fields,\n global,\n mergeLocaleActions,\n operation,\n path,\n req,\n schemaPath,\n siblingData,\n siblingDoc,\n siblingDocWithLocales,\n skipValidation,\n}: Args): Promise<void> => {\n const promises = []\n\n fields.forEach((field) => {\n promises.push(\n promise({\n id,\n collection,\n context,\n data,\n doc,\n docWithLocales,\n errors,\n field,\n global,\n mergeLocaleActions,\n operation,\n parentPath: path,\n parentSchemaPath: schemaPath,\n req,\n siblingData,\n siblingDoc,\n siblingDocWithLocales,\n skipValidation,\n }),\n )\n })\n\n await Promise.all(promises)\n}\n"],"names":["promise","traverseFields","id","collection","context","data","doc","docWithLocales","errors","fields","global","mergeLocaleActions","operation","path","req","schemaPath","siblingData","siblingDoc","siblingDocWithLocales","skipValidation","promises","forEach","field","push","parentPath","parentSchemaPath","Promise","all"],"mappings":"AAKA,SAASA,OAAO,QAAQ,eAAc;AAmCtC;;;;;;;CAOC,GACD,OAAO,MAAMC,iBAAiB,OAAO,EACnCC,EAAE,EACFC,UAAU,EACVC,OAAO,EACPC,IAAI,EACJC,GAAG,EACHC,cAAc,EACdC,MAAM,EACNC,MAAM,EACNC,MAAM,EACNC,kBAAkB,EAClBC,SAAS,EACTC,IAAI,EACJC,GAAG,EACHC,UAAU,EACVC,WAAW,EACXC,UAAU,EACVC,qBAAqB,EACrBC,cAAc,EACT;IACL,MAAMC,WAAW,EAAE;IAEnBX,OAAOY,OAAO,CAAC,CAACC;QACdF,SAASG,IAAI,CACXvB,QAAQ;YACNE;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAc;YACAZ;YACAC;YACAC;YACAY,YAAYX;YACZY,kBAAkBV;YAClBD;YACAE;YACAC;YACAC;YACAC;QACF;IAEJ;IAEA,MAAMO,QAAQC,GAAG,CAACP;AACpB,EAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { SanitizedCollectionConfig } from '../../../collections/config/types.js';
|
|
2
|
+
import type { JsonObject, PayloadRequest, RequestContext } from '../../../types/index.js';
|
|
3
|
+
type Args<T extends JsonObject> = {
|
|
4
|
+
collection: null | SanitizedCollectionConfig;
|
|
5
|
+
context: RequestContext;
|
|
6
|
+
doc?: T;
|
|
7
|
+
id?: number | string;
|
|
8
|
+
overrideAccess: boolean;
|
|
9
|
+
req: PayloadRequest;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* This function is responsible for running beforeDuplicate hooks
|
|
13
|
+
* against a document including all locale data.
|
|
14
|
+
* It will run each field's beforeDuplicate hook
|
|
15
|
+
* and return the resulting docWithLocales.
|
|
16
|
+
*/
|
|
17
|
+
export declare const beforeDuplicate: <T extends JsonObject>({ id, collection, context, doc, overrideAccess, req, }: Args<T>) => Promise<T>;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/fields/hooks/beforeDuplicate/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAA;AACrF,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAKzF,KAAK,IAAI,CAAC,CAAC,SAAS,UAAU,IAAI;IAChC,UAAU,EAAE,IAAI,GAAG,yBAAyB,CAAA;IAC5C,OAAO,EAAE,cAAc,CAAA;IACvB,GAAG,CAAC,EAAE,CAAC,CAAA;IACP,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACpB,cAAc,EAAE,OAAO,CAAA;IACvB,GAAG,EAAE,cAAc,CAAA;CACpB,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAU,CAAC,SAAS,UAAU,0DAOvD,IAAI,CAAC,CAAC,CAAC,KAAG,OAAO,CAAC,CAAC,CAiBrB,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { deepCopyObjectSimple } from '../../../utilities/deepCopyObject.js';
|
|
2
|
+
import { traverseFields } from './traverseFields.js';
|
|
3
|
+
/**
|
|
4
|
+
* This function is responsible for running beforeDuplicate hooks
|
|
5
|
+
* against a document including all locale data.
|
|
6
|
+
* It will run each field's beforeDuplicate hook
|
|
7
|
+
* and return the resulting docWithLocales.
|
|
8
|
+
*/ export const beforeDuplicate = async ({ id, collection, context, doc, overrideAccess, req })=>{
|
|
9
|
+
const newDoc = deepCopyObjectSimple(doc);
|
|
10
|
+
await traverseFields({
|
|
11
|
+
id,
|
|
12
|
+
collection,
|
|
13
|
+
context,
|
|
14
|
+
doc: newDoc,
|
|
15
|
+
fields: collection?.fields,
|
|
16
|
+
overrideAccess,
|
|
17
|
+
path: [],
|
|
18
|
+
req,
|
|
19
|
+
schemaPath: [],
|
|
20
|
+
siblingDoc: newDoc
|
|
21
|
+
});
|
|
22
|
+
return newDoc;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/fields/hooks/beforeDuplicate/index.ts"],"sourcesContent":["import type { SanitizedCollectionConfig } from '../../../collections/config/types.js'\nimport type { JsonObject, PayloadRequest, RequestContext } from '../../../types/index.js'\n\nimport { deepCopyObjectSimple } from '../../../utilities/deepCopyObject.js'\nimport { traverseFields } from './traverseFields.js'\n\ntype Args<T extends JsonObject> = {\n collection: null | SanitizedCollectionConfig\n context: RequestContext\n doc?: T\n id?: number | string\n overrideAccess: boolean\n req: PayloadRequest\n}\n\n/**\n * This function is responsible for running beforeDuplicate hooks\n * against a document including all locale data.\n * It will run each field's beforeDuplicate hook\n * and return the resulting docWithLocales.\n */\nexport const beforeDuplicate = async <T extends JsonObject>({\n id,\n collection,\n context,\n doc,\n overrideAccess,\n req,\n}: Args<T>): Promise<T> => {\n const newDoc = deepCopyObjectSimple(doc)\n\n await traverseFields({\n id,\n collection,\n context,\n doc: newDoc,\n fields: collection?.fields,\n overrideAccess,\n path: [],\n req,\n schemaPath: [],\n siblingDoc: newDoc,\n })\n\n return newDoc\n}\n"],"names":["deepCopyObjectSimple","traverseFields","beforeDuplicate","id","collection","context","doc","overrideAccess","req","newDoc","fields","path","schemaPath","siblingDoc"],"mappings":"AAGA,SAASA,oBAAoB,QAAQ,uCAAsC;AAC3E,SAASC,cAAc,QAAQ,sBAAqB;AAWpD;;;;;CAKC,GACD,OAAO,MAAMC,kBAAkB,OAA6B,EAC1DC,EAAE,EACFC,UAAU,EACVC,OAAO,EACPC,GAAG,EACHC,cAAc,EACdC,GAAG,EACK;IACR,MAAMC,SAAST,qBAAqBM;IAEpC,MAAML,eAAe;QACnBE;QACAC;QACAC;QACAC,KAAKG;QACLC,QAAQN,YAAYM;QACpBH;QACAI,MAAM,EAAE;QACRH;QACAI,YAAY,EAAE;QACdC,YAAYJ;IACd;IAEA,OAAOA;AACT,EAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { SanitizedCollectionConfig } from '../../../collections/config/types.js';
|
|
2
|
+
import type { JsonObject, PayloadRequest, RequestContext } from '../../../types/index.js';
|
|
3
|
+
import type { Field, TabAsField } from '../../config/types.js';
|
|
4
|
+
type Args<T> = {
|
|
5
|
+
collection: null | SanitizedCollectionConfig;
|
|
6
|
+
context: RequestContext;
|
|
7
|
+
doc: T;
|
|
8
|
+
field: Field | TabAsField;
|
|
9
|
+
id?: number | string;
|
|
10
|
+
overrideAccess: boolean;
|
|
11
|
+
parentPath: (number | string)[];
|
|
12
|
+
parentSchemaPath: string[];
|
|
13
|
+
req: PayloadRequest;
|
|
14
|
+
siblingDoc: JsonObject;
|
|
15
|
+
};
|
|
16
|
+
export declare const promise: <T>({ id, collection, context, doc, field, overrideAccess, parentPath, parentSchemaPath, req, siblingDoc, }: Args<T>) => Promise<void>;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=promise.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promise.d.ts","sourceRoot":"","sources":["../../../../src/fields/hooks/beforeDuplicate/promise.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAA;AACrF,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACzF,OAAO,KAAK,EAAE,KAAK,EAAiB,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAO7E,KAAK,IAAI,CAAC,CAAC,IAAI;IACb,UAAU,EAAE,IAAI,GAAG,yBAAyB,CAAA;IAC5C,OAAO,EAAE,cAAc,CAAA;IACvB,GAAG,EAAE,CAAC,CAAA;IACN,KAAK,EAAE,KAAK,GAAG,UAAU,CAAA;IACzB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACpB,cAAc,EAAE,OAAO,CAAA;IACvB,UAAU,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;IAC/B,gBAAgB,EAAE,MAAM,EAAE,CAAA;IAC1B,GAAG,EAAE,cAAc,CAAA;IACnB,UAAU,EAAE,UAAU,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,OAAO,GAAU,CAAC,2GAW5B,IAAI,CAAC,CAAC,CAAC,KAAG,OAAO,CAAC,IAAI,CA6TxB,CAAA"}
|