@payloadcms/plugin-import-export 4.0.0-internal.5d5a2b2 → 4.0.0-internal.5e065b3
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/components/CollectionField/index.d.ts +3 -2
- package/dist/components/CollectionField/index.d.ts.map +1 -1
- package/dist/components/CollectionField/index.js.map +1 -1
- package/dist/components/ExportListMenuItem/index.d.ts.map +1 -1
- package/dist/components/ExportListMenuItem/index.js +14 -12
- package/dist/components/ExportListMenuItem/index.js.map +1 -1
- package/dist/components/ExportPreview/index.css +52 -0
- package/dist/components/ExportPreview/index.d.ts +1 -1
- package/dist/components/ExportPreview/index.d.ts.map +1 -1
- package/dist/components/ExportPreview/index.js +12 -2
- package/dist/components/ExportPreview/index.js.map +1 -1
- package/dist/components/FieldsToExport/index.d.ts +3 -2
- package/dist/components/FieldsToExport/index.d.ts.map +1 -1
- package/dist/components/FieldsToExport/index.js +18 -15
- package/dist/components/FieldsToExport/index.js.map +1 -1
- package/dist/components/FieldsToExport/reduceFields.d.ts +6 -0
- package/dist/components/FieldsToExport/reduceFields.d.ts.map +1 -1
- package/dist/components/FieldsToExport/reduceFields.js +4 -0
- package/dist/components/FieldsToExport/reduceFields.js.map +1 -1
- package/dist/components/FormatField/index.d.ts +3 -2
- package/dist/components/FormatField/index.d.ts.map +1 -1
- package/dist/components/FormatField/index.js +6 -3
- package/dist/components/FormatField/index.js.map +1 -1
- package/dist/components/ImportListMenuItem/index.d.ts.map +1 -1
- package/dist/components/ImportListMenuItem/index.js +14 -12
- package/dist/components/ImportListMenuItem/index.js.map +1 -1
- package/dist/components/ImportPreview/index.css +45 -0
- package/dist/components/ImportPreview/index.d.ts +1 -1
- package/dist/components/ImportPreview/index.d.ts.map +1 -1
- package/dist/components/ImportPreview/index.js +44 -11
- package/dist/components/ImportPreview/index.js.map +1 -1
- package/dist/components/LimitField/index.d.ts +3 -2
- package/dist/components/LimitField/index.d.ts.map +1 -1
- package/dist/components/LimitField/index.js.map +1 -1
- package/dist/components/LocaleField/index.d.ts +3 -2
- package/dist/components/LocaleField/index.d.ts.map +1 -1
- package/dist/components/LocaleField/index.js.map +1 -1
- package/dist/components/Page/index.d.ts +4 -3
- package/dist/components/Page/index.d.ts.map +1 -1
- package/dist/components/Page/index.js +1 -1
- package/dist/components/Page/index.js.map +1 -1
- package/dist/components/RelationshipCell/getRelationshipGroupKey.d.ts +7 -0
- package/dist/components/RelationshipCell/getRelationshipGroupKey.d.ts.map +1 -0
- package/dist/components/RelationshipCell/getRelationshipGroupKey.js +3 -0
- package/dist/components/RelationshipCell/getRelationshipGroupKey.js.map +1 -0
- package/dist/components/RelationshipCell/getRelationshipGroups.d.ts +43 -0
- package/dist/components/RelationshipCell/getRelationshipGroups.d.ts.map +1 -0
- package/dist/components/RelationshipCell/getRelationshipGroups.js +109 -0
- package/dist/components/RelationshipCell/getRelationshipGroups.js.map +1 -0
- package/dist/components/RelationshipCell/index.css +30 -0
- package/dist/components/RelationshipCell/index.d.ts +15 -0
- package/dist/components/RelationshipCell/index.d.ts.map +1 -0
- package/dist/components/RelationshipCell/index.js +57 -0
- package/dist/components/RelationshipCell/index.js.map +1 -0
- package/dist/components/SortBy/index.css +9 -0
- package/dist/components/SortBy/index.d.ts +4 -3
- package/dist/components/SortBy/index.d.ts.map +1 -1
- package/dist/components/SortBy/index.js +1 -2
- package/dist/components/SortBy/index.js.map +1 -1
- package/dist/components/SortOrder/index.css +9 -0
- package/dist/components/SortOrder/index.d.ts +4 -3
- package/dist/components/SortOrder/index.d.ts.map +1 -1
- package/dist/components/SortOrder/index.js +1 -2
- package/dist/components/SortOrder/index.js.map +1 -1
- package/dist/export/batchProcessor.d.ts +4 -3
- package/dist/export/batchProcessor.d.ts.map +1 -1
- package/dist/export/batchProcessor.js +6 -2
- package/dist/export/batchProcessor.js.map +1 -1
- package/dist/export/createExport.d.ts +4 -2
- package/dist/export/createExport.d.ts.map +1 -1
- package/dist/export/createExport.js +7 -2
- package/dist/export/createExport.js.map +1 -1
- package/dist/export/getCreateExportCollectionTask.d.ts.map +1 -1
- package/dist/export/getCreateExportCollectionTask.js +11 -0
- package/dist/export/getCreateExportCollectionTask.js.map +1 -1
- package/dist/export/getExportCollection.d.ts.map +1 -1
- package/dist/export/getExportCollection.js +9 -4
- package/dist/export/getExportCollection.js.map +1 -1
- package/dist/export/getFields.d.ts.map +1 -1
- package/dist/export/handleDownload.d.ts.map +1 -1
- package/dist/export/handleDownload.js +7 -3
- package/dist/export/handleDownload.js.map +1 -1
- package/dist/export/handlePreview.d.ts.map +1 -1
- package/dist/export/handlePreview.js +24 -5
- package/dist/export/handlePreview.js.map +1 -1
- package/dist/exports/types.d.ts +1 -1
- package/dist/exports/types.d.ts.map +1 -1
- package/dist/exports/types.js.map +1 -1
- package/dist/import/batchProcessor.d.ts +4 -3
- package/dist/import/batchProcessor.d.ts.map +1 -1
- package/dist/import/batchProcessor.js +15 -8
- package/dist/import/batchProcessor.js.map +1 -1
- package/dist/import/createImport.d.ts +3 -2
- package/dist/import/createImport.d.ts.map +1 -1
- package/dist/import/createImport.js +8 -1
- package/dist/import/createImport.js.map +1 -1
- package/dist/import/getCreateImportCollectionTask.d.ts.map +1 -1
- package/dist/import/getCreateImportCollectionTask.js +5 -2
- package/dist/import/getCreateImportCollectionTask.js.map +1 -1
- package/dist/import/getFields.d.ts.map +1 -1
- package/dist/import/getImportCollection.d.ts.map +1 -1
- package/dist/import/getImportCollection.js +6 -4
- package/dist/import/getImportCollection.js.map +1 -1
- package/dist/import/handlePreview.d.ts.map +1 -1
- package/dist/import/handlePreview.js +5 -1
- package/dist/import/handlePreview.js.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/translations/languages/en.d.ts.map +1 -1
- package/dist/types.d.ts +17 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utilities/applyFieldHooks.d.ts.map +1 -1
- package/dist/utilities/applyFieldHooks.js +1 -1
- package/dist/utilities/applyFieldHooks.js.map +1 -1
- package/dist/utilities/buildDisabledFieldRegex.d.ts.map +1 -1
- package/dist/utilities/collectDisabledFieldPaths.d.ts.map +1 -1
- package/dist/utilities/fieldToRegex.d.ts.map +1 -1
- package/dist/utilities/flattenObject.d.ts.map +1 -1
- package/dist/utilities/flattenedFields.d.ts.map +1 -1
- package/dist/utilities/flattenedFields.js +3 -0
- package/dist/utilities/flattenedFields.js.map +1 -1
- package/dist/utilities/getExportFieldFunctions.d.ts.map +1 -1
- package/dist/utilities/getExportFieldFunctions.js +64 -27
- package/dist/utilities/getExportFieldFunctions.js.map +1 -1
- package/dist/utilities/getFileFromDoc.d.ts.map +1 -1
- package/dist/utilities/getFileFromDoc.js +3 -3
- package/dist/utilities/getFileFromDoc.js.map +1 -1
- package/dist/utilities/getFlattenedFieldKeys.d.ts.map +1 -1
- package/dist/utilities/getImportFieldFunctions.d.ts.map +1 -1
- package/dist/utilities/getPluginCollections.d.ts.map +1 -1
- package/dist/utilities/getSchemaColumns.d.ts.map +1 -1
- package/dist/utilities/getSelect.d.ts.map +1 -1
- package/dist/utilities/getSelect.js +11 -3
- package/dist/utilities/getSelect.js.map +1 -1
- package/dist/utilities/getSubmittedFormValues.d.ts +12 -0
- package/dist/utilities/getSubmittedFormValues.d.ts.map +1 -0
- package/dist/utilities/getSubmittedFormValues.js +24 -0
- package/dist/utilities/getSubmittedFormValues.js.map +1 -0
- package/dist/utilities/isPlainObject.d.ts.map +1 -1
- package/dist/utilities/parseCSV.d.ts.map +1 -1
- package/dist/utilities/parseJSON.d.ts.map +1 -1
- package/dist/utilities/polymorphicRel.d.ts.map +1 -1
- package/dist/utilities/processRichTextField.d.ts.map +1 -1
- package/dist/utilities/removeDisabledFields.d.ts.map +1 -1
- package/dist/utilities/setNestedValue.d.ts +2 -1
- package/dist/utilities/setNestedValue.d.ts.map +1 -1
- package/dist/utilities/setNestedValue.js +65 -34
- package/dist/utilities/setNestedValue.js.map +1 -1
- package/dist/utilities/sortHelpers.d.ts +1 -1
- package/dist/utilities/sortHelpers.d.ts.map +1 -1
- package/dist/utilities/unflattenObject.d.ts.map +1 -1
- package/dist/utilities/unflattenPostProcess.d.ts.map +1 -1
- package/dist/utilities/validateLimitValue.d.ts.map +1 -1
- package/license.md +1 -1
- package/package.json +9 -9
- package/dist/@types/assets.d.js +0 -2
- package/dist/@types/assets.d.js.map +0 -1
- package/dist/components/ExportPreview/index.scss +0 -48
- package/dist/components/FieldsToExport/index.scss +0 -0
- package/dist/components/FieldsToExport/reduceFields.spec.js +0 -239
- package/dist/components/FieldsToExport/reduceFields.spec.js.map +0 -1
- package/dist/components/ImportPreview/index.scss +0 -41
- package/dist/components/SortBy/index.scss +0 -3
- package/dist/components/SortOrder/index.scss +0 -3
- package/dist/utilities/applyFieldHooks.spec.js +0 -205
- package/dist/utilities/applyFieldHooks.spec.js.map +0 -1
- package/dist/utilities/buildDisabledFieldRegex.spec.js +0 -64
- package/dist/utilities/buildDisabledFieldRegex.spec.js.map +0 -1
- package/dist/utilities/fieldToRegex.spec.js +0 -151
- package/dist/utilities/fieldToRegex.spec.js.map +0 -1
- package/dist/utilities/filterToSelectedFields.spec.js +0 -204
- package/dist/utilities/filterToSelectedFields.spec.js.map +0 -1
- package/dist/utilities/flattenObject.spec.js +0 -158
- package/dist/utilities/flattenObject.spec.js.map +0 -1
- package/dist/utilities/getExportFieldFunctions.spec.js +0 -50
- package/dist/utilities/getExportFieldFunctions.spec.js.map +0 -1
- package/dist/utilities/getImportFieldFunctions.spec.js +0 -167
- package/dist/utilities/getImportFieldFunctions.spec.js.map +0 -1
- package/dist/utilities/getSchemaColumns.spec.js +0 -157
- package/dist/utilities/getSchemaColumns.spec.js.map +0 -1
- package/dist/utilities/parseCSV.spec.js +0 -195
- package/dist/utilities/parseCSV.spec.js.map +0 -1
- package/dist/utilities/processRichTextField.spec.js +0 -308
- package/dist/utilities/processRichTextField.spec.js.map +0 -1
- package/dist/utilities/siblingDoc.spec.js +0 -278
- package/dist/utilities/siblingDoc.spec.js.map +0 -1
- package/dist/utilities/unflattenObject.spec.js +0 -819
- package/dist/utilities/unflattenObject.spec.js.map +0 -1
- /package/dist/components/Page/{index.scss → index.css} +0 -0
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* @param obj - The target object to mutate.
|
|
15
15
|
* @param path - A dot-separated string path indicating where to assign the value.
|
|
16
16
|
* @param value - The value to set at the specified path.
|
|
17
|
+
* @param source - The source object used to validate array boundaries.
|
|
17
18
|
*/
|
|
18
|
-
export declare const setNestedValue: (obj: Record<string, unknown>, path: string, value: unknown) => void;
|
|
19
|
+
export declare const setNestedValue: (obj: Record<string, unknown>, path: string, value: unknown, source?: Record<string, unknown>) => void;
|
|
19
20
|
//# sourceMappingURL=setNestedValue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setNestedValue.d.ts","sourceRoot":"","sources":["../../src/utilities/setNestedValue.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"setNestedValue.d.ts","sourceRoot":"","sources":["../../src/utilities/setNestedValue.ts"],"names":[],"mappings":"AAoDA;;;;;;;;;;;;;;;;;GAiBG;AAEH,eAAO,MAAM,cAAc,QACpB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,QACtB,MAAM,SACL,OAAO,WACL,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC/B,IAyCF,CAAA"}
|
|
@@ -1,3 +1,34 @@
|
|
|
1
|
+
import { APIError } from 'payload';
|
|
2
|
+
import { hasUnsupportedFieldPathSegment, setOwnProperty } from 'payload/shared';
|
|
3
|
+
const MAX_UNVERIFIED_SPARSE_ARRAY_GAP = 1;
|
|
4
|
+
const createObject = ()=>Object.create(null);
|
|
5
|
+
const isArrayIndex = (part)=>{
|
|
6
|
+
if (!/^(?:0|[1-9]\d*)$/.test(part)) {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
const index = Number(part);
|
|
10
|
+
return Number.isSafeInteger(index) && index >= 0;
|
|
11
|
+
};
|
|
12
|
+
const getPathKey = (target, part, source)=>{
|
|
13
|
+
if (!Array.isArray(target) || !isArrayIndex(part)) {
|
|
14
|
+
return part;
|
|
15
|
+
}
|
|
16
|
+
const index = Number(part);
|
|
17
|
+
if (Array.isArray(source) && index >= source.length || !Array.isArray(source) && index > target.length + MAX_UNVERIFIED_SPARSE_ARRAY_GAP) {
|
|
18
|
+
throw new APIError('Invalid field path.', 400, null, true);
|
|
19
|
+
}
|
|
20
|
+
return index;
|
|
21
|
+
};
|
|
22
|
+
const getSourceValue = (source, part)=>{
|
|
23
|
+
if (source === null || typeof source !== 'object') {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
const key = Array.isArray(source) && isArrayIndex(part) ? Number(part) : part;
|
|
27
|
+
if (!Object.hasOwn(source, key)) {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
return source[key];
|
|
31
|
+
};
|
|
1
32
|
/**
|
|
2
33
|
* Sets a value deeply into a nested object or array, based on a dot-notation path.
|
|
3
34
|
*
|
|
@@ -14,44 +45,44 @@
|
|
|
14
45
|
* @param obj - The target object to mutate.
|
|
15
46
|
* @param path - A dot-separated string path indicating where to assign the value.
|
|
16
47
|
* @param value - The value to set at the specified path.
|
|
17
|
-
|
|
48
|
+
* @param source - The source object used to validate array boundaries.
|
|
49
|
+
*/ export const setNestedValue = (obj, path, value, source)=>{
|
|
18
50
|
const parts = path.split('.');
|
|
51
|
+
if (hasUnsupportedFieldPathSegment({
|
|
52
|
+
segments: parts
|
|
53
|
+
})) {
|
|
54
|
+
throw new APIError('Invalid field path.', 400, null, true);
|
|
55
|
+
}
|
|
56
|
+
const lastPart = parts.pop();
|
|
57
|
+
if (lastPart === undefined) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
19
60
|
let current = obj;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
if (isLast) {
|
|
36
|
-
currentArray[index] = value;
|
|
37
|
-
} else {
|
|
38
|
-
current = currentArray[index];
|
|
39
|
-
}
|
|
40
|
-
} else {
|
|
41
|
-
const currentObj = current;
|
|
42
|
-
// Ensure the object key exists
|
|
43
|
-
if (isLast) {
|
|
44
|
-
if (typeof part === 'string') {
|
|
45
|
-
currentObj[part] = value;
|
|
46
|
-
}
|
|
47
|
-
} else {
|
|
48
|
-
if (typeof currentObj[part] !== 'object' || currentObj[part] === null) {
|
|
49
|
-
currentObj[part] = {};
|
|
50
|
-
}
|
|
51
|
-
current = currentObj[part];
|
|
52
|
-
}
|
|
61
|
+
let sourceCurrent = source;
|
|
62
|
+
for (const [i, part] of parts.entries()){
|
|
63
|
+
const key = getPathKey(current, part, sourceCurrent);
|
|
64
|
+
const currentRecord = current;
|
|
65
|
+
const nextPart = parts[i + 1] ?? lastPart;
|
|
66
|
+
const nextSource = getSourceValue(sourceCurrent, part);
|
|
67
|
+
const hasOwnNextValue = Object.hasOwn(currentRecord, key);
|
|
68
|
+
const nextValue = hasOwnNextValue ? currentRecord[key] : undefined;
|
|
69
|
+
if (!hasOwnNextValue || typeof nextValue !== 'object' || nextValue === null) {
|
|
70
|
+
setOwnProperty({
|
|
71
|
+
key,
|
|
72
|
+
target: currentRecord,
|
|
73
|
+
value: isArrayIndex(nextPart) ? [] : createObject()
|
|
74
|
+
});
|
|
53
75
|
}
|
|
76
|
+
current = currentRecord[key];
|
|
77
|
+
sourceCurrent = nextSource;
|
|
54
78
|
}
|
|
79
|
+
const lastKey = getPathKey(current, lastPart, sourceCurrent);
|
|
80
|
+
const finalRecord = current;
|
|
81
|
+
setOwnProperty({
|
|
82
|
+
key: lastKey,
|
|
83
|
+
target: finalRecord,
|
|
84
|
+
value
|
|
85
|
+
});
|
|
55
86
|
};
|
|
56
87
|
|
|
57
88
|
//# sourceMappingURL=setNestedValue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/setNestedValue.ts"],"sourcesContent":["/**\n * Sets a value deeply into a nested object or array, based on a dot-notation path.\n *\n * This function:\n * - Supports array indexing (e.g., \"array.0.field1\")\n * - Creates intermediate arrays/objects as needed\n * - Mutates the target object directly\n *\n * @example\n * const obj = {}\n * setNestedValue(obj, 'group.array.0.field1', 'hello')\n * // Result: { group: { array: [ { field1: 'hello' } ] } }\n *\n * @param obj - The target object to mutate.\n * @param path - A dot-separated string path indicating where to assign the value.\n * @param value - The value to set at the specified path.\n */\n\nexport const setNestedValue = (\n obj: Record<string, unknown>,\n path: string,\n value: unknown,\n): void => {\n const parts = path.split('.')\n
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/setNestedValue.ts"],"sourcesContent":["import { APIError } from 'payload'\nimport { hasUnsupportedFieldPathSegment, setOwnProperty } from 'payload/shared'\n\nconst MAX_UNVERIFIED_SPARSE_ARRAY_GAP = 1\n\nconst createObject = (): Record<string, unknown> => Object.create(null) as Record<string, unknown>\n\nconst isArrayIndex = (part: string): boolean => {\n if (!/^(?:0|[1-9]\\d*)$/.test(part)) {\n return false\n }\n\n const index = Number(part)\n\n return Number.isSafeInteger(index) && index >= 0\n}\n\nconst getPathKey = (\n target: Record<string, unknown> | unknown[],\n part: string,\n source: unknown,\n): number | string => {\n if (!Array.isArray(target) || !isArrayIndex(part)) {\n return part\n }\n\n const index = Number(part)\n\n if (\n (Array.isArray(source) && index >= source.length) ||\n (!Array.isArray(source) && index > target.length + MAX_UNVERIFIED_SPARSE_ARRAY_GAP)\n ) {\n throw new APIError('Invalid field path.', 400, null, true)\n }\n\n return index\n}\n\nconst getSourceValue = (source: unknown, part: string): unknown => {\n if (source === null || typeof source !== 'object') {\n return undefined\n }\n\n const key = Array.isArray(source) && isArrayIndex(part) ? Number(part) : part\n\n if (!Object.hasOwn(source, key)) {\n return undefined\n }\n\n return (source as Record<number | string, unknown>)[key]\n}\n\n/**\n * Sets a value deeply into a nested object or array, based on a dot-notation path.\n *\n * This function:\n * - Supports array indexing (e.g., \"array.0.field1\")\n * - Creates intermediate arrays/objects as needed\n * - Mutates the target object directly\n *\n * @example\n * const obj = {}\n * setNestedValue(obj, 'group.array.0.field1', 'hello')\n * // Result: { group: { array: [ { field1: 'hello' } ] } }\n *\n * @param obj - The target object to mutate.\n * @param path - A dot-separated string path indicating where to assign the value.\n * @param value - The value to set at the specified path.\n * @param source - The source object used to validate array boundaries.\n */\n\nexport const setNestedValue = (\n obj: Record<string, unknown>,\n path: string,\n value: unknown,\n source?: Record<string, unknown>,\n): void => {\n const parts = path.split('.')\n\n if (hasUnsupportedFieldPathSegment({ segments: parts })) {\n throw new APIError('Invalid field path.', 400, null, true)\n }\n\n const lastPart = parts.pop()\n\n if (lastPart === undefined) {\n return\n }\n\n let current: Record<string, unknown> | unknown[] = obj\n let sourceCurrent: unknown = source\n\n for (const [i, part] of parts.entries()) {\n const key = getPathKey(current, part, sourceCurrent)\n const currentRecord = current as Record<number | string, unknown>\n const nextPart = parts[i + 1] ?? lastPart\n const nextSource = getSourceValue(sourceCurrent, part)\n\n const hasOwnNextValue = Object.hasOwn(currentRecord, key)\n const nextValue = hasOwnNextValue ? currentRecord[key] : undefined\n\n if (!hasOwnNextValue || typeof nextValue !== 'object' || nextValue === null) {\n setOwnProperty({\n key,\n target: currentRecord,\n value: isArrayIndex(nextPart) ? [] : createObject(),\n })\n }\n\n current = currentRecord[key] as Record<string, unknown> | unknown[]\n sourceCurrent = nextSource\n }\n\n const lastKey = getPathKey(current, lastPart, sourceCurrent)\n const finalRecord = current as Record<number | string, unknown>\n\n setOwnProperty({ key: lastKey, target: finalRecord, value })\n}\n"],"names":["APIError","hasUnsupportedFieldPathSegment","setOwnProperty","MAX_UNVERIFIED_SPARSE_ARRAY_GAP","createObject","Object","create","isArrayIndex","part","test","index","Number","isSafeInteger","getPathKey","target","source","Array","isArray","length","getSourceValue","undefined","key","hasOwn","setNestedValue","obj","path","value","parts","split","segments","lastPart","pop","current","sourceCurrent","i","entries","currentRecord","nextPart","nextSource","hasOwnNextValue","nextValue","lastKey","finalRecord"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,UAAS;AAClC,SAASC,8BAA8B,EAAEC,cAAc,QAAQ,iBAAgB;AAE/E,MAAMC,kCAAkC;AAExC,MAAMC,eAAe,IAA+BC,OAAOC,MAAM,CAAC;AAElE,MAAMC,eAAe,CAACC;IACpB,IAAI,CAAC,mBAAmBC,IAAI,CAACD,OAAO;QAClC,OAAO;IACT;IAEA,MAAME,QAAQC,OAAOH;IAErB,OAAOG,OAAOC,aAAa,CAACF,UAAUA,SAAS;AACjD;AAEA,MAAMG,aAAa,CACjBC,QACAN,MACAO;IAEA,IAAI,CAACC,MAAMC,OAAO,CAACH,WAAW,CAACP,aAAaC,OAAO;QACjD,OAAOA;IACT;IAEA,MAAME,QAAQC,OAAOH;IAErB,IACE,AAACQ,MAAMC,OAAO,CAACF,WAAWL,SAASK,OAAOG,MAAM,IAC/C,CAACF,MAAMC,OAAO,CAACF,WAAWL,QAAQI,OAAOI,MAAM,GAAGf,iCACnD;QACA,MAAM,IAAIH,SAAS,uBAAuB,KAAK,MAAM;IACvD;IAEA,OAAOU;AACT;AAEA,MAAMS,iBAAiB,CAACJ,QAAiBP;IACvC,IAAIO,WAAW,QAAQ,OAAOA,WAAW,UAAU;QACjD,OAAOK;IACT;IAEA,MAAMC,MAAML,MAAMC,OAAO,CAACF,WAAWR,aAAaC,QAAQG,OAAOH,QAAQA;IAEzE,IAAI,CAACH,OAAOiB,MAAM,CAACP,QAAQM,MAAM;QAC/B,OAAOD;IACT;IAEA,OAAO,AAACL,MAA2C,CAACM,IAAI;AAC1D;AAEA;;;;;;;;;;;;;;;;;CAiBC,GAED,OAAO,MAAME,iBAAiB,CAC5BC,KACAC,MACAC,OACAX;IAEA,MAAMY,QAAQF,KAAKG,KAAK,CAAC;IAEzB,IAAI3B,+BAA+B;QAAE4B,UAAUF;IAAM,IAAI;QACvD,MAAM,IAAI3B,SAAS,uBAAuB,KAAK,MAAM;IACvD;IAEA,MAAM8B,WAAWH,MAAMI,GAAG;IAE1B,IAAID,aAAaV,WAAW;QAC1B;IACF;IAEA,IAAIY,UAA+CR;IACnD,IAAIS,gBAAyBlB;IAE7B,KAAK,MAAM,CAACmB,GAAG1B,KAAK,IAAImB,MAAMQ,OAAO,GAAI;QACvC,MAAMd,MAAMR,WAAWmB,SAASxB,MAAMyB;QACtC,MAAMG,gBAAgBJ;QACtB,MAAMK,WAAWV,KAAK,CAACO,IAAI,EAAE,IAAIJ;QACjC,MAAMQ,aAAanB,eAAec,eAAezB;QAEjD,MAAM+B,kBAAkBlC,OAAOiB,MAAM,CAACc,eAAef;QACrD,MAAMmB,YAAYD,kBAAkBH,aAAa,CAACf,IAAI,GAAGD;QAEzD,IAAI,CAACmB,mBAAmB,OAAOC,cAAc,YAAYA,cAAc,MAAM;YAC3EtC,eAAe;gBACbmB;gBACAP,QAAQsB;gBACRV,OAAOnB,aAAa8B,YAAY,EAAE,GAAGjC;YACvC;QACF;QAEA4B,UAAUI,aAAa,CAACf,IAAI;QAC5BY,gBAAgBK;IAClB;IAEA,MAAMG,UAAU5B,WAAWmB,SAASF,UAAUG;IAC9C,MAAMS,cAAcV;IAEpB9B,eAAe;QAAEmB,KAAKoB;QAAS3B,QAAQ4B;QAAahB;IAAM;AAC5D,EAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Remove a leading '-' from a sort value (e.g. "-title" -> "title") */
|
|
2
2
|
export declare const stripSortDash: (v?: null | string) => string;
|
|
3
3
|
/** Apply order to a base field (("title","desc") -> "-title") */
|
|
4
|
-
export declare const applySortOrder: (field: string, order:
|
|
4
|
+
export declare const applySortOrder: (field: string, order: 'asc' | 'desc') => string;
|
|
5
5
|
export declare const normalizeQueryParam: (v: unknown) => string | undefined;
|
|
6
6
|
//# sourceMappingURL=sortHelpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sortHelpers.d.ts","sourceRoot":"","sources":["../../src/utilities/sortHelpers.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"sortHelpers.d.ts","sourceRoot":"","sources":["../../src/utilities/sortHelpers.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,eAAO,MAAM,aAAa,OAAQ,IAAI,GAAG,MAAM,KAAG,MAAwC,CAAA;AAE1F,iEAAiE;AACjE,eAAO,MAAM,cAAc,UAAW,MAAM,SAAS,KAAK,GAAG,MAAM,KAAG,MAC9B,CAAA;AAGxC,eAAO,MAAM,mBAAmB,MAAO,OAAO,KAAG,MAAM,GAAG,SAQzD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unflattenObject.d.ts","sourceRoot":"","sources":["../../src/utilities/unflattenObject.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAKvD,KAAK,aAAa,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC7B,MAAM,EAAE,cAAc,EAAE,CAAA;IACxB,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,CAAC,EAAE,GAAG,MAAM,CAAC,CAAA;IACvC,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAA;IACvD,GAAG,EAAE,cAAc,CAAA;CACpB,CAAA;AAuCD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"unflattenObject.d.ts","sourceRoot":"","sources":["../../src/utilities/unflattenObject.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAKvD,KAAK,aAAa,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC7B,MAAM,EAAE,cAAc,EAAE,CAAA;IACxB,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,CAAC,EAAE,GAAG,MAAM,CAAC,CAAA;IACvC,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAA;IACvD,GAAG,EAAE,cAAc,CAAA;CACpB,CAAA;AAuCD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,eAAe,qDAMzB,aAAa,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAyUxC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unflattenPostProcess.d.ts","sourceRoot":"","sources":["../../src/utilities/unflattenPostProcess.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAuM7C;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"unflattenPostProcess.d.ts","sourceRoot":"","sources":["../../src/utilities/unflattenPostProcess.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAuM7C;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,QACzB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,UACpB,cAAc,EAAE,KACvB,IAMF,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateLimitValue.d.ts","sourceRoot":"","sources":["../../src/utilities/validateLimitValue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAEzD,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"validateLimitValue.d.ts","sourceRoot":"","sources":["../../src/utilities/validateLimitValue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAEzD,eAAO,MAAM,kBAAkB,UACtB,IAAI,GAAG,MAAM,GAAG,SAAS,KAC7B,SAAS,KACX,MAAM,GAAG,SAMX,CAAA"}
|
package/license.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2018-
|
|
3
|
+
Copyright (c) 2018-2026 Payload CMS, LLC <info@payloadcms.com>
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
6
|
a copy of this software and associated documentation files (the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/plugin-import-export",
|
|
3
|
-
"version": "4.0.0-internal.
|
|
3
|
+
"version": "4.0.0-internal.5e065b3",
|
|
4
4
|
"description": "Import-Export plugin for Payload",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"payload",
|
|
@@ -60,21 +60,21 @@
|
|
|
60
60
|
"dist"
|
|
61
61
|
],
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@faceless-ui/modal": "3.0.
|
|
63
|
+
"@faceless-ui/modal": "3.0.2",
|
|
64
64
|
"csv-parse": "5.6.0",
|
|
65
65
|
"csv-stringify": "6.5.2",
|
|
66
66
|
"qs-esm": "8.0.1",
|
|
67
|
-
"@payloadcms/translations": "4.0.0-internal.
|
|
68
|
-
"@payloadcms/ui": "4.0.0-internal.
|
|
67
|
+
"@payloadcms/translations": "4.0.0-internal.5e065b3",
|
|
68
|
+
"@payloadcms/ui": "4.0.0-internal.5e065b3"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@payloadcms/eslint-config": "3.28.0",
|
|
72
|
-
"@payloadcms/ui": "4.0.0-internal.
|
|
73
|
-
"payload": "4.0.0-internal.
|
|
72
|
+
"@payloadcms/ui": "4.0.0-internal.5e065b3",
|
|
73
|
+
"payload": "4.0.0-internal.5e065b3"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
|
-
"@payloadcms/ui": "4.0.0-internal.
|
|
77
|
-
"payload": "4.0.0-internal.
|
|
76
|
+
"@payloadcms/ui": "4.0.0-internal.5e065b3",
|
|
77
|
+
"payload": "4.0.0-internal.5e065b3"
|
|
78
78
|
},
|
|
79
79
|
"homepage:": "https://payloadcms.com",
|
|
80
80
|
"scripts": {
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"build:swc": "swc ./src -d ./dist --config-file .swcrc --strip-leading-paths",
|
|
84
84
|
"build:types": "tsc --emitDeclarationOnly --outDir dist",
|
|
85
85
|
"clean": "rimraf {dist,*.tsbuildinfo}",
|
|
86
|
-
"copyfiles": "copyfiles -u 1 \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png,json}\" dist/",
|
|
86
|
+
"copyfiles": "copyfiles -u 1 -e \"**/*.spec.*\" \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png,json}\" dist/",
|
|
87
87
|
"lint": "eslint .",
|
|
88
88
|
"lint:fix": "eslint . --fix"
|
|
89
89
|
}
|
package/dist/@types/assets.d.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/@types/assets.d.ts"],"names":[],"mappings":""}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
@layer payload-default {
|
|
2
|
-
.export-preview {
|
|
3
|
-
&__header {
|
|
4
|
-
display: flex;
|
|
5
|
-
justify-content: space-between;
|
|
6
|
-
align-items: flex-end;
|
|
7
|
-
margin-bottom: 10px;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
&__export-info {
|
|
11
|
-
display: flex;
|
|
12
|
-
flex-direction: column;
|
|
13
|
-
align-items: flex-end;
|
|
14
|
-
gap: 2px;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
&__export-count {
|
|
18
|
-
font-size: var(--font-size-small);
|
|
19
|
-
color: var(--theme-elevation-500);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
&__limit-capped {
|
|
23
|
-
font-size: var(--font-size-small);
|
|
24
|
-
color: var(--theme-warning-500);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
&__pagination {
|
|
28
|
-
display: flex;
|
|
29
|
-
align-items: center;
|
|
30
|
-
justify-content: space-between;
|
|
31
|
-
gap: var(--base);
|
|
32
|
-
margin-top: var(--base);
|
|
33
|
-
padding-top: var(--base);
|
|
34
|
-
border-top: 1px solid var(--theme-elevation-100);
|
|
35
|
-
|
|
36
|
-
// When only PerPage is present (no Pagination), keep it on the right
|
|
37
|
-
.per-page:only-child {
|
|
38
|
-
margin-left: auto;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
&__page-info {
|
|
43
|
-
font-size: var(--font-size-small);
|
|
44
|
-
color: var(--theme-elevation-500);
|
|
45
|
-
white-space: nowrap;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
File without changes
|
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { reduceFields } from './reduceFields.js';
|
|
3
|
-
const values = (result)=>result.map((f)=>f.value);
|
|
4
|
-
describe('reduceFields', ()=>{
|
|
5
|
-
describe('excludeUnsortable', ()=>{
|
|
6
|
-
it('should include array and blocks fields by default', ()=>{
|
|
7
|
-
const fields = [
|
|
8
|
-
{
|
|
9
|
-
name: 'title',
|
|
10
|
-
type: 'text'
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
name: 'items',
|
|
14
|
-
type: 'array',
|
|
15
|
-
fields: [
|
|
16
|
-
{
|
|
17
|
-
name: 'text',
|
|
18
|
-
type: 'text'
|
|
19
|
-
}
|
|
20
|
-
]
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
name: 'layout',
|
|
24
|
-
type: 'blocks',
|
|
25
|
-
blocks: []
|
|
26
|
-
}
|
|
27
|
-
];
|
|
28
|
-
const result = values(reduceFields({
|
|
29
|
-
fields
|
|
30
|
-
}));
|
|
31
|
-
expect(result).toContain('title');
|
|
32
|
-
expect(result).toContain('items');
|
|
33
|
-
expect(result).toContain('layout');
|
|
34
|
-
});
|
|
35
|
-
it('should exclude array fields when excludeUnsortable is true', ()=>{
|
|
36
|
-
const fields = [
|
|
37
|
-
{
|
|
38
|
-
name: 'title',
|
|
39
|
-
type: 'text'
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
name: 'items',
|
|
43
|
-
type: 'array',
|
|
44
|
-
fields: [
|
|
45
|
-
{
|
|
46
|
-
name: 'text',
|
|
47
|
-
type: 'text'
|
|
48
|
-
}
|
|
49
|
-
]
|
|
50
|
-
}
|
|
51
|
-
];
|
|
52
|
-
const result = values(reduceFields({
|
|
53
|
-
excludeUnsortable: true,
|
|
54
|
-
fields
|
|
55
|
-
}));
|
|
56
|
-
expect(result).toContain('title');
|
|
57
|
-
expect(result).not.toContain('items');
|
|
58
|
-
});
|
|
59
|
-
it('should exclude blocks fields when excludeUnsortable is true', ()=>{
|
|
60
|
-
const fields = [
|
|
61
|
-
{
|
|
62
|
-
name: 'title',
|
|
63
|
-
type: 'text'
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
name: 'layout',
|
|
67
|
-
type: 'blocks',
|
|
68
|
-
blocks: []
|
|
69
|
-
}
|
|
70
|
-
];
|
|
71
|
-
const result = values(reduceFields({
|
|
72
|
-
excludeUnsortable: true,
|
|
73
|
-
fields
|
|
74
|
-
}));
|
|
75
|
-
expect(result).toContain('title');
|
|
76
|
-
expect(result).not.toContain('layout');
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
describe('disabledFields', ()=>{
|
|
80
|
-
it('should include all fields when disabledFields is empty', ()=>{
|
|
81
|
-
const fields = [
|
|
82
|
-
{
|
|
83
|
-
name: 'title',
|
|
84
|
-
type: 'text'
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
name: 'slug',
|
|
88
|
-
type: 'text'
|
|
89
|
-
}
|
|
90
|
-
];
|
|
91
|
-
const result = values(reduceFields({
|
|
92
|
-
disabledFields: [],
|
|
93
|
-
fields
|
|
94
|
-
}));
|
|
95
|
-
expect(result).toContain('title');
|
|
96
|
-
expect(result).toContain('slug');
|
|
97
|
-
});
|
|
98
|
-
it('should exclude a field whose path is in disabledFields', ()=>{
|
|
99
|
-
const fields = [
|
|
100
|
-
{
|
|
101
|
-
name: 'title',
|
|
102
|
-
type: 'text'
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
name: 'slug',
|
|
106
|
-
type: 'text'
|
|
107
|
-
}
|
|
108
|
-
];
|
|
109
|
-
const result = values(reduceFields({
|
|
110
|
-
disabledFields: [
|
|
111
|
-
'slug'
|
|
112
|
-
],
|
|
113
|
-
fields
|
|
114
|
-
}));
|
|
115
|
-
expect(result).toContain('title');
|
|
116
|
-
expect(result).not.toContain('slug');
|
|
117
|
-
});
|
|
118
|
-
it('should exclude nested fields whose paths start with a disabled parent path', ()=>{
|
|
119
|
-
const fields = [
|
|
120
|
-
{
|
|
121
|
-
name: 'meta',
|
|
122
|
-
type: 'group',
|
|
123
|
-
fields: [
|
|
124
|
-
{
|
|
125
|
-
name: 'title',
|
|
126
|
-
type: 'text'
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
name: 'description',
|
|
130
|
-
type: 'text'
|
|
131
|
-
}
|
|
132
|
-
]
|
|
133
|
-
}
|
|
134
|
-
];
|
|
135
|
-
const result = values(reduceFields({
|
|
136
|
-
disabledFields: [
|
|
137
|
-
'meta.description'
|
|
138
|
-
],
|
|
139
|
-
fields
|
|
140
|
-
}));
|
|
141
|
-
expect(result).toContain('meta.title');
|
|
142
|
-
expect(result).not.toContain('meta.description');
|
|
143
|
-
});
|
|
144
|
-
});
|
|
145
|
-
describe('combined excludeUnsortable and disabledFields', ()=>{
|
|
146
|
-
it('should apply both filters simultaneously', ()=>{
|
|
147
|
-
const fields = [
|
|
148
|
-
{
|
|
149
|
-
name: 'title',
|
|
150
|
-
type: 'text'
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
name: 'slug',
|
|
154
|
-
type: 'text'
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
name: 'items',
|
|
158
|
-
type: 'array',
|
|
159
|
-
fields: [
|
|
160
|
-
{
|
|
161
|
-
name: 'text',
|
|
162
|
-
type: 'text'
|
|
163
|
-
}
|
|
164
|
-
]
|
|
165
|
-
}
|
|
166
|
-
];
|
|
167
|
-
const result = values(reduceFields({
|
|
168
|
-
disabledFields: [
|
|
169
|
-
'slug'
|
|
170
|
-
],
|
|
171
|
-
excludeUnsortable: true,
|
|
172
|
-
fields
|
|
173
|
-
}));
|
|
174
|
-
expect(result).toContain('title');
|
|
175
|
-
expect(result).not.toContain('slug');
|
|
176
|
-
expect(result).not.toContain('items');
|
|
177
|
-
});
|
|
178
|
-
});
|
|
179
|
-
describe('recursive propagation through group sub-fields', ()=>{
|
|
180
|
-
it('should propagate excludeUnsortable into group sub-fields', ()=>{
|
|
181
|
-
const fields = [
|
|
182
|
-
{
|
|
183
|
-
name: 'meta',
|
|
184
|
-
type: 'group',
|
|
185
|
-
fields: [
|
|
186
|
-
{
|
|
187
|
-
name: 'title',
|
|
188
|
-
type: 'text'
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
name: 'tags',
|
|
192
|
-
type: 'array',
|
|
193
|
-
fields: [
|
|
194
|
-
{
|
|
195
|
-
name: 'tag',
|
|
196
|
-
type: 'text'
|
|
197
|
-
}
|
|
198
|
-
]
|
|
199
|
-
}
|
|
200
|
-
]
|
|
201
|
-
}
|
|
202
|
-
];
|
|
203
|
-
const result = values(reduceFields({
|
|
204
|
-
excludeUnsortable: true,
|
|
205
|
-
fields
|
|
206
|
-
}));
|
|
207
|
-
expect(result).toContain('meta.title');
|
|
208
|
-
expect(result).not.toContain('meta.tags');
|
|
209
|
-
});
|
|
210
|
-
it('should propagate disabledFields into group sub-fields', ()=>{
|
|
211
|
-
const fields = [
|
|
212
|
-
{
|
|
213
|
-
name: 'meta',
|
|
214
|
-
type: 'group',
|
|
215
|
-
fields: [
|
|
216
|
-
{
|
|
217
|
-
name: 'title',
|
|
218
|
-
type: 'text'
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
name: 'description',
|
|
222
|
-
type: 'text'
|
|
223
|
-
}
|
|
224
|
-
]
|
|
225
|
-
}
|
|
226
|
-
];
|
|
227
|
-
const result = values(reduceFields({
|
|
228
|
-
disabledFields: [
|
|
229
|
-
'meta.description'
|
|
230
|
-
],
|
|
231
|
-
fields
|
|
232
|
-
}));
|
|
233
|
-
expect(result).toContain('meta.title');
|
|
234
|
-
expect(result).not.toContain('meta.description');
|
|
235
|
-
});
|
|
236
|
-
});
|
|
237
|
-
});
|
|
238
|
-
|
|
239
|
-
//# sourceMappingURL=reduceFields.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/FieldsToExport/reduceFields.spec.ts"],"sourcesContent":["import type { ClientField } from 'payload'\n\nimport { describe, expect, it } from 'vitest'\n\nimport { reduceFields } from './reduceFields.js'\n\nconst values = (result: ReturnType<typeof reduceFields>) => result.map((f) => f.value)\n\ndescribe('reduceFields', () => {\n describe('excludeUnsortable', () => {\n it('should include array and blocks fields by default', () => {\n const fields: ClientField[] = [\n { name: 'title', type: 'text' },\n { name: 'items', type: 'array', fields: [{ name: 'text', type: 'text' }] },\n { name: 'layout', type: 'blocks', blocks: [] },\n ]\n\n const result = values(reduceFields({ fields }))\n\n expect(result).toContain('title')\n expect(result).toContain('items')\n expect(result).toContain('layout')\n })\n\n it('should exclude array fields when excludeUnsortable is true', () => {\n const fields: ClientField[] = [\n { name: 'title', type: 'text' },\n { name: 'items', type: 'array', fields: [{ name: 'text', type: 'text' }] },\n ]\n\n const result = values(reduceFields({ excludeUnsortable: true, fields }))\n\n expect(result).toContain('title')\n expect(result).not.toContain('items')\n })\n\n it('should exclude blocks fields when excludeUnsortable is true', () => {\n const fields: ClientField[] = [\n { name: 'title', type: 'text' },\n { name: 'layout', type: 'blocks', blocks: [] },\n ]\n\n const result = values(reduceFields({ excludeUnsortable: true, fields }))\n\n expect(result).toContain('title')\n expect(result).not.toContain('layout')\n })\n })\n\n describe('disabledFields', () => {\n it('should include all fields when disabledFields is empty', () => {\n const fields: ClientField[] = [\n { name: 'title', type: 'text' },\n { name: 'slug', type: 'text' },\n ]\n\n const result = values(reduceFields({ disabledFields: [], fields }))\n\n expect(result).toContain('title')\n expect(result).toContain('slug')\n })\n\n it('should exclude a field whose path is in disabledFields', () => {\n const fields: ClientField[] = [\n { name: 'title', type: 'text' },\n { name: 'slug', type: 'text' },\n ]\n\n const result = values(reduceFields({ disabledFields: ['slug'], fields }))\n\n expect(result).toContain('title')\n expect(result).not.toContain('slug')\n })\n\n it('should exclude nested fields whose paths start with a disabled parent path', () => {\n const fields: ClientField[] = [\n {\n name: 'meta',\n type: 'group',\n fields: [\n { name: 'title', type: 'text' },\n { name: 'description', type: 'text' },\n ],\n },\n ]\n\n const result = values(reduceFields({ disabledFields: ['meta.description'], fields }))\n\n expect(result).toContain('meta.title')\n expect(result).not.toContain('meta.description')\n })\n })\n\n describe('combined excludeUnsortable and disabledFields', () => {\n it('should apply both filters simultaneously', () => {\n const fields: ClientField[] = [\n { name: 'title', type: 'text' },\n { name: 'slug', type: 'text' },\n { name: 'items', type: 'array', fields: [{ name: 'text', type: 'text' }] },\n ]\n\n const result = values(\n reduceFields({ disabledFields: ['slug'], excludeUnsortable: true, fields }),\n )\n\n expect(result).toContain('title')\n expect(result).not.toContain('slug')\n expect(result).not.toContain('items')\n })\n })\n\n describe('recursive propagation through group sub-fields', () => {\n it('should propagate excludeUnsortable into group sub-fields', () => {\n const fields: ClientField[] = [\n {\n name: 'meta',\n type: 'group',\n fields: [\n { name: 'title', type: 'text' },\n { name: 'tags', type: 'array', fields: [{ name: 'tag', type: 'text' }] },\n ],\n },\n ]\n\n const result = values(reduceFields({ excludeUnsortable: true, fields }))\n\n expect(result).toContain('meta.title')\n expect(result).not.toContain('meta.tags')\n })\n\n it('should propagate disabledFields into group sub-fields', () => {\n const fields: ClientField[] = [\n {\n name: 'meta',\n type: 'group',\n fields: [\n { name: 'title', type: 'text' },\n { name: 'description', type: 'text' },\n ],\n },\n ]\n\n const result = values(reduceFields({ disabledFields: ['meta.description'], fields }))\n\n expect(result).toContain('meta.title')\n expect(result).not.toContain('meta.description')\n })\n })\n})\n"],"names":["describe","expect","it","reduceFields","values","result","map","f","value","fields","name","type","blocks","toContain","excludeUnsortable","not","disabledFields"],"mappings":"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"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
@layer payload-default {
|
|
2
|
-
.import-preview {
|
|
3
|
-
&__header {
|
|
4
|
-
display: flex;
|
|
5
|
-
justify-content: space-between;
|
|
6
|
-
align-items: flex-end;
|
|
7
|
-
margin-bottom: 10px;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
&__info {
|
|
11
|
-
font-size: var(--font-size-small);
|
|
12
|
-
color: var(--theme-elevation-500);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
&__import-count {
|
|
16
|
-
font-size: var(--font-size-small);
|
|
17
|
-
color: var(--theme-elevation-500);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
&__pagination {
|
|
21
|
-
display: flex;
|
|
22
|
-
align-items: center;
|
|
23
|
-
justify-content: space-between;
|
|
24
|
-
gap: var(--base);
|
|
25
|
-
margin-top: var(--base);
|
|
26
|
-
padding-top: var(--base);
|
|
27
|
-
border-top: 1px solid var(--theme-elevation-100);
|
|
28
|
-
|
|
29
|
-
// When only PerPage is present (no Pagination), keep it on the right
|
|
30
|
-
.per-page:only-child {
|
|
31
|
-
margin-left: auto;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
&__page-info {
|
|
36
|
-
font-size: var(--font-size-small);
|
|
37
|
-
color: var(--theme-elevation-500);
|
|
38
|
-
white-space: nowrap;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|