@payloadcms/plugin-import-export 3.89.0-internal.95c9cba → 3.90.0
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/utilities/getSelect.d.ts.map +1 -1
- package/dist/utilities/getSelect.js +4 -2
- package/dist/utilities/getSelect.js.map +1 -1
- package/dist/utilities/getSelect.spec.js +24 -37
- package/dist/utilities/getSelect.spec.js.map +1 -1
- package/dist/utilities/setNestedValue.d.ts.map +1 -1
- package/dist/utilities/setNestedValue.js +20 -6
- package/dist/utilities/setNestedValue.js.map +1 -1
- package/dist/utilities/setNestedValue.spec.js +53 -3
- package/dist/utilities/setNestedValue.spec.js.map +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSelect.d.ts","sourceRoot":"","sources":["../../src/utilities/getSelect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"getSelect.d.ts","sourceRoot":"","sources":["../../src/utilities/getSelect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAOhD;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,WAAY,MAAM,EAAE,KAAG,iBAyB5C,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { APIError } from 'payload';
|
|
2
|
-
import { hasUnsupportedFieldPathSegment } from '
|
|
2
|
+
import { hasUnsupportedFieldPathSegment } from 'payload/shared';
|
|
3
3
|
const createSelect = ()=>Object.create(null);
|
|
4
4
|
/**
|
|
5
5
|
* Takes an input of array of string paths in dot notation and returns a select object.
|
|
@@ -12,7 +12,9 @@ const createSelect = ()=>Object.create(null);
|
|
|
12
12
|
const select = createSelect();
|
|
13
13
|
fields.forEach((field)=>{
|
|
14
14
|
const segments = field.split('.');
|
|
15
|
-
if (hasUnsupportedFieldPathSegment(
|
|
15
|
+
if (hasUnsupportedFieldPathSegment({
|
|
16
|
+
segments
|
|
17
|
+
})) {
|
|
16
18
|
throw new APIError('Invalid field path.', 400, null, true);
|
|
17
19
|
}
|
|
18
20
|
let selectRef = select;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/getSelect.ts"],"sourcesContent":["import type { SelectIncludeType } from 'payload'\n\nimport { APIError } from 'payload'\
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/getSelect.ts"],"sourcesContent":["import type { SelectIncludeType } from 'payload'\n\nimport { APIError } from 'payload'\nimport { hasUnsupportedFieldPathSegment } from 'payload/shared'\n\nconst createSelect = (): SelectIncludeType => Object.create(null) as SelectIncludeType\n\n/**\n * Takes an input of array of string paths in dot notation and returns a select object.\n * Used for both export and import to build Payload's select query format.\n *\n * @example\n * getSelect(['id', 'title', 'group.value', 'createdAt', 'updatedAt'])\n * // Returns: { id: true, title: true, group: { value: true }, createdAt: true, updatedAt: true }\n */\nexport const getSelect = (fields: string[]): SelectIncludeType => {\n const select = createSelect()\n\n fields.forEach((field) => {\n const segments = field.split('.')\n\n if (hasUnsupportedFieldPathSegment({ segments })) {\n throw new APIError('Invalid field path.', 400, null, true)\n }\n\n let selectRef = select\n\n segments.forEach((segment, i) => {\n if (i === segments.length - 1) {\n selectRef[segment] = true\n } else {\n if (!Object.prototype.hasOwnProperty.call(selectRef, segment)) {\n selectRef[segment] = createSelect()\n }\n selectRef = selectRef[segment] as SelectIncludeType\n }\n })\n })\n\n return select\n}\n"],"names":["APIError","hasUnsupportedFieldPathSegment","createSelect","Object","create","getSelect","fields","select","forEach","field","segments","split","selectRef","segment","i","length","prototype","hasOwnProperty","call"],"mappings":"AAEA,SAASA,QAAQ,QAAQ,UAAS;AAClC,SAASC,8BAA8B,QAAQ,iBAAgB;AAE/D,MAAMC,eAAe,IAAyBC,OAAOC,MAAM,CAAC;AAE5D;;;;;;;CAOC,GACD,OAAO,MAAMC,YAAY,CAACC;IACxB,MAAMC,SAASL;IAEfI,OAAOE,OAAO,CAAC,CAACC;QACd,MAAMC,WAAWD,MAAME,KAAK,CAAC;QAE7B,IAAIV,+BAA+B;YAAES;QAAS,IAAI;YAChD,MAAM,IAAIV,SAAS,uBAAuB,KAAK,MAAM;QACvD;QAEA,IAAIY,YAAYL;QAEhBG,SAASF,OAAO,CAAC,CAACK,SAASC;YACzB,IAAIA,MAAMJ,SAASK,MAAM,GAAG,GAAG;gBAC7BH,SAAS,CAACC,QAAQ,GAAG;YACvB,OAAO;gBACL,IAAI,CAACV,OAAOa,SAAS,CAACC,cAAc,CAACC,IAAI,CAACN,WAAWC,UAAU;oBAC7DD,SAAS,CAACC,QAAQ,GAAGX;gBACvB;gBACAU,YAAYA,SAAS,CAACC,QAAQ;YAChC;QACF;IACF;IAEA,OAAON;AACT,EAAC"}
|
|
@@ -1,29 +1,13 @@
|
|
|
1
1
|
import { APIError } from 'payload';
|
|
2
2
|
import { describe, expect, it } from 'vitest';
|
|
3
3
|
import { getSelect } from './getSelect.js';
|
|
4
|
-
const unsupportedSegments = [
|
|
5
|
-
'__proto__',
|
|
6
|
-
'constructor',
|
|
7
|
-
'prototype'
|
|
8
|
-
];
|
|
9
4
|
describe('getSelect', ()=>{
|
|
10
|
-
it.each(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
[
|
|
17
|
-
`group.${segment}.field`,
|
|
18
|
-
segment,
|
|
19
|
-
'middle'
|
|
20
|
-
],
|
|
21
|
-
[
|
|
22
|
-
`group.${segment}`,
|
|
23
|
-
segment,
|
|
24
|
-
'leaf'
|
|
25
|
-
]
|
|
26
|
-
]))('rejects invalid field path %s', (path)=>{
|
|
5
|
+
it.each([
|
|
6
|
+
'__proto__.field',
|
|
7
|
+
'group.__proto__.field',
|
|
8
|
+
'group.__proto__'
|
|
9
|
+
])('should reject invalid field path %s', (path)=>{
|
|
10
|
+
const objectPrototypeBefore = Object.getOwnPropertyDescriptors(Object.prototype);
|
|
27
11
|
try {
|
|
28
12
|
getSelect([
|
|
29
13
|
path
|
|
@@ -36,34 +20,37 @@ describe('getSelect', ()=>{
|
|
|
36
20
|
expect(error.isPublic).toBe(true);
|
|
37
21
|
}
|
|
38
22
|
}
|
|
23
|
+
expect(Object.getOwnPropertyDescriptors(Object.prototype)).toEqual(objectPrototypeBefore);
|
|
39
24
|
});
|
|
40
|
-
it('
|
|
41
|
-
|
|
42
|
-
for (const path of [
|
|
43
|
-
'__proto__.syntheticMarker',
|
|
44
|
-
'constructor.prototype.syntheticMarker'
|
|
45
|
-
]){
|
|
46
|
-
expect(()=>getSelect([
|
|
47
|
-
path
|
|
48
|
-
])).toThrow(APIError);
|
|
49
|
-
}
|
|
50
|
-
expect(Object.prototype).not.toHaveProperty('syntheticMarker');
|
|
51
|
-
});
|
|
52
|
-
it('builds select objects and merges nested siblings', ()=>{
|
|
25
|
+
it('should build select objects with compatible field names', ()=>{
|
|
26
|
+
const objectPrototypeBefore = Object.getOwnPropertyDescriptors(Object.prototype);
|
|
53
27
|
const select = getSelect([
|
|
54
28
|
'id',
|
|
55
29
|
'group.title',
|
|
56
|
-
'group.description'
|
|
30
|
+
'group.description',
|
|
31
|
+
'constructor.prototype.value',
|
|
32
|
+
'prototype.value'
|
|
57
33
|
]);
|
|
34
|
+
expect(Object.hasOwn(select, 'constructor')).toBe(true);
|
|
35
|
+
expect(Object.hasOwn(select, 'prototype')).toBe(true);
|
|
58
36
|
expect(select).toEqual({
|
|
37
|
+
constructor: {
|
|
38
|
+
prototype: {
|
|
39
|
+
value: true
|
|
40
|
+
}
|
|
41
|
+
},
|
|
59
42
|
group: {
|
|
60
43
|
description: true,
|
|
61
44
|
title: true
|
|
62
45
|
},
|
|
63
|
-
id: true
|
|
46
|
+
id: true,
|
|
47
|
+
prototype: {
|
|
48
|
+
value: true
|
|
49
|
+
}
|
|
64
50
|
});
|
|
65
51
|
expect(Object.getPrototypeOf(select)).toBeNull();
|
|
66
52
|
expect(Object.getPrototypeOf(select.group)).toBeNull();
|
|
53
|
+
expect(Object.getOwnPropertyDescriptors(Object.prototype)).toEqual(objectPrototypeBefore);
|
|
67
54
|
});
|
|
68
55
|
});
|
|
69
56
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/getSelect.spec.ts"],"sourcesContent":["import { APIError } from 'payload'\nimport { describe, expect, it } from 'vitest'\n\nimport { getSelect } from './getSelect.js'\n\
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/getSelect.spec.ts"],"sourcesContent":["import { APIError } from 'payload'\nimport { describe, expect, it } from 'vitest'\n\nimport { getSelect } from './getSelect.js'\n\ndescribe('getSelect', () => {\n it.each(['__proto__.field', 'group.__proto__.field', 'group.__proto__'])(\n 'should reject invalid field path %s',\n (path) => {\n const objectPrototypeBefore = Object.getOwnPropertyDescriptors(Object.prototype)\n\n try {\n getSelect([path])\n expect.fail('Expected getSelect to reject the invalid field path')\n } catch (error) {\n expect(error).toBeInstanceOf(APIError)\n\n if (error instanceof APIError) {\n expect(error.status).toBe(400)\n expect(error.isPublic).toBe(true)\n }\n }\n\n expect(Object.getOwnPropertyDescriptors(Object.prototype)).toEqual(objectPrototypeBefore)\n },\n )\n\n it('should build select objects with compatible field names', () => {\n const objectPrototypeBefore = Object.getOwnPropertyDescriptors(Object.prototype)\n const select = getSelect([\n 'id',\n 'group.title',\n 'group.description',\n 'constructor.prototype.value',\n 'prototype.value',\n ])\n\n expect(Object.hasOwn(select, 'constructor')).toBe(true)\n expect(Object.hasOwn(select, 'prototype')).toBe(true)\n expect(select).toEqual({\n constructor: {\n prototype: {\n value: true,\n },\n },\n group: {\n description: true,\n title: true,\n },\n id: true,\n prototype: {\n value: true,\n },\n })\n expect(Object.getPrototypeOf(select)).toBeNull()\n expect(Object.getPrototypeOf(select.group)).toBeNull()\n expect(Object.getOwnPropertyDescriptors(Object.prototype)).toEqual(objectPrototypeBefore)\n })\n})\n"],"names":["APIError","describe","expect","it","getSelect","each","path","objectPrototypeBefore","Object","getOwnPropertyDescriptors","prototype","fail","error","toBeInstanceOf","status","toBe","isPublic","toEqual","select","hasOwn","value","group","description","title","id","getPrototypeOf","toBeNull"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,UAAS;AAClC,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,SAAQ;AAE7C,SAASC,SAAS,QAAQ,iBAAgB;AAE1CH,SAAS,aAAa;IACpBE,GAAGE,IAAI,CAAC;QAAC;QAAmB;QAAyB;KAAkB,EACrE,uCACA,CAACC;QACC,MAAMC,wBAAwBC,OAAOC,yBAAyB,CAACD,OAAOE,SAAS;QAE/E,IAAI;YACFN,UAAU;gBAACE;aAAK;YAChBJ,OAAOS,IAAI,CAAC;QACd,EAAE,OAAOC,OAAO;YACdV,OAAOU,OAAOC,cAAc,CAACb;YAE7B,IAAIY,iBAAiBZ,UAAU;gBAC7BE,OAAOU,MAAME,MAAM,EAAEC,IAAI,CAAC;gBAC1Bb,OAAOU,MAAMI,QAAQ,EAAED,IAAI,CAAC;YAC9B;QACF;QAEAb,OAAOM,OAAOC,yBAAyB,CAACD,OAAOE,SAAS,GAAGO,OAAO,CAACV;IACrE;IAGFJ,GAAG,2DAA2D;QAC5D,MAAMI,wBAAwBC,OAAOC,yBAAyB,CAACD,OAAOE,SAAS;QAC/E,MAAMQ,SAASd,UAAU;YACvB;YACA;YACA;YACA;YACA;SACD;QAEDF,OAAOM,OAAOW,MAAM,CAACD,QAAQ,gBAAgBH,IAAI,CAAC;QAClDb,OAAOM,OAAOW,MAAM,CAACD,QAAQ,cAAcH,IAAI,CAAC;QAChDb,OAAOgB,QAAQD,OAAO,CAAC;YACrB,aAAa;gBACXP,WAAW;oBACTU,OAAO;gBACT;YACF;YACAC,OAAO;gBACLC,aAAa;gBACbC,OAAO;YACT;YACAC,IAAI;YACJd,WAAW;gBACTU,OAAO;YACT;QACF;QACAlB,OAAOM,OAAOiB,cAAc,CAACP,SAASQ,QAAQ;QAC9CxB,OAAOM,OAAOiB,cAAc,CAACP,OAAOG,KAAK,GAAGK,QAAQ;QACpDxB,OAAOM,OAAOC,yBAAyB,CAACD,OAAOE,SAAS,GAAGO,OAAO,CAACV;IACrE;AACF"}
|
|
@@ -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,5 +1,5 @@
|
|
|
1
1
|
import { APIError } from 'payload';
|
|
2
|
-
import { hasUnsupportedFieldPathSegment } from '
|
|
2
|
+
import { hasUnsupportedFieldPathSegment, setOwnProperty } from 'payload/shared';
|
|
3
3
|
const MAX_UNVERIFIED_SPARSE_ARRAY_GAP = 1;
|
|
4
4
|
const createObject = ()=>Object.create(null);
|
|
5
5
|
const isArrayIndex = (part)=>{
|
|
@@ -24,6 +24,9 @@ const getSourceValue = (source, part)=>{
|
|
|
24
24
|
return undefined;
|
|
25
25
|
}
|
|
26
26
|
const key = Array.isArray(source) && isArrayIndex(part) ? Number(part) : part;
|
|
27
|
+
if (!Object.hasOwn(source, key)) {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
27
30
|
return source[key];
|
|
28
31
|
};
|
|
29
32
|
/**
|
|
@@ -45,7 +48,9 @@ const getSourceValue = (source, part)=>{
|
|
|
45
48
|
* @param source - The source object used to validate array boundaries.
|
|
46
49
|
*/ export const setNestedValue = (obj, path, value, source)=>{
|
|
47
50
|
const parts = path.split('.');
|
|
48
|
-
if (hasUnsupportedFieldPathSegment(
|
|
51
|
+
if (hasUnsupportedFieldPathSegment({
|
|
52
|
+
segments: parts
|
|
53
|
+
})) {
|
|
49
54
|
throw new APIError('Invalid field path.', 400, null, true);
|
|
50
55
|
}
|
|
51
56
|
const lastPart = parts.pop();
|
|
@@ -59,16 +64,25 @@ const getSourceValue = (source, part)=>{
|
|
|
59
64
|
const currentRecord = current;
|
|
60
65
|
const nextPart = parts[i + 1] ?? lastPart;
|
|
61
66
|
const nextSource = getSourceValue(sourceCurrent, part);
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
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
|
+
});
|
|
65
75
|
}
|
|
66
76
|
current = currentRecord[key];
|
|
67
77
|
sourceCurrent = nextSource;
|
|
68
78
|
}
|
|
69
79
|
const lastKey = getPathKey(current, lastPart, sourceCurrent);
|
|
70
80
|
const finalRecord = current;
|
|
71
|
-
|
|
81
|
+
setOwnProperty({
|
|
82
|
+
key: lastKey,
|
|
83
|
+
target: finalRecord,
|
|
84
|
+
value
|
|
85
|
+
});
|
|
72
86
|
};
|
|
73
87
|
|
|
74
88
|
//# sourceMappingURL=setNestedValue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/setNestedValue.ts"],"sourcesContent":["import { APIError } from 'payload'\
|
|
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,OAA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RV,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"}
|
|
@@ -2,9 +2,7 @@ import { APIError } from 'payload';
|
|
|
2
2
|
import { describe, expect, it } from 'vitest';
|
|
3
3
|
import { setNestedValue } from './setNestedValue.js';
|
|
4
4
|
const unsupportedSegments = [
|
|
5
|
-
'__proto__'
|
|
6
|
-
'constructor',
|
|
7
|
-
'prototype'
|
|
5
|
+
'__proto__'
|
|
8
6
|
];
|
|
9
7
|
const unsupportedPaths = unsupportedSegments.flatMap((segment)=>[
|
|
10
8
|
`${segment}.value`,
|
|
@@ -41,6 +39,58 @@ describe('setNestedValue', ()=>{
|
|
|
41
39
|
expect(Object.getPrototypeOf(target)).toBe(targetPrototypeBefore);
|
|
42
40
|
expect(Object.getOwnPropertyDescriptors(Object.prototype)).toEqual(objectPrototypeBefore);
|
|
43
41
|
});
|
|
42
|
+
it('should build nested values from owned data', ()=>{
|
|
43
|
+
const inheritedContainer = 'constrainedNestedContainer';
|
|
44
|
+
const target = {};
|
|
45
|
+
const source = {};
|
|
46
|
+
const objectPrototypeBefore = Object.getOwnPropertyDescriptors(Object.prototype);
|
|
47
|
+
const originalContainerDescriptor = Object.getOwnPropertyDescriptor(Object.prototype, inheritedContainer);
|
|
48
|
+
let inheritedGetterCalls = 0;
|
|
49
|
+
let inheritedSetterCalls = 0;
|
|
50
|
+
try {
|
|
51
|
+
Object.defineProperty(Object.prototype, inheritedContainer, {
|
|
52
|
+
configurable: true,
|
|
53
|
+
get: ()=>{
|
|
54
|
+
inheritedGetterCalls += 1;
|
|
55
|
+
return {
|
|
56
|
+
value: 'inherited'
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
set: ()=>{
|
|
60
|
+
inheritedSetterCalls += 1;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
setNestedValue(target, 'constructor.prototype.value', 'example');
|
|
64
|
+
setNestedValue(target, 'prototype.value', 'example');
|
|
65
|
+
setNestedValue(target, `${inheritedContainer}.value`, 'local', source);
|
|
66
|
+
} finally{
|
|
67
|
+
if (originalContainerDescriptor) {
|
|
68
|
+
Object.defineProperty(Object.prototype, inheritedContainer, originalContainerDescriptor);
|
|
69
|
+
} else {
|
|
70
|
+
delete Object.prototype[inheritedContainer];
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
expect(inheritedGetterCalls).toBe(0);
|
|
74
|
+
expect(inheritedSetterCalls).toBe(0);
|
|
75
|
+
expect(Object.hasOwn(target, 'constructor')).toBe(true);
|
|
76
|
+
expect(Object.hasOwn(target, 'prototype')).toBe(true);
|
|
77
|
+
expect(target).toEqual({
|
|
78
|
+
[inheritedContainer]: {
|
|
79
|
+
value: 'local'
|
|
80
|
+
},
|
|
81
|
+
constructor: {
|
|
82
|
+
prototype: {
|
|
83
|
+
value: 'example'
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
prototype: {
|
|
87
|
+
value: 'example'
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
expect(Object.getPrototypeOf(target.constructor)).toBeNull();
|
|
91
|
+
expect(Object.getPrototypeOf(target.prototype)).toBeNull();
|
|
92
|
+
expect(Object.getOwnPropertyDescriptors(Object.prototype)).toEqual(objectPrototypeBefore);
|
|
93
|
+
});
|
|
44
94
|
it('rejects field paths with out-of-range array indexes', ()=>{
|
|
45
95
|
const source = {
|
|
46
96
|
items: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/setNestedValue.spec.ts"],"sourcesContent":["import { APIError } from 'payload'\nimport { describe, expect, it } from 'vitest'\n\nimport { setNestedValue } from './setNestedValue.js'\n\nconst unsupportedSegments = ['__proto__', 'constructor', 'prototype']\nconst unsupportedPaths = unsupportedSegments.flatMap((segment) => [\n `${segment}.value`,\n `group.${segment}.value`,\n `group.${segment}`,\n `items.${segment}.0.value`,\n `items.0.${segment}.value`,\n `items.0.${segment}`,\n])\n\ndescribe('setNestedValue', () => {\n it.each(unsupportedPaths)('rejects invalid field path %s without changing the target', (path) => {\n const target = { stable: { value: true } }\n const objectPrototypeBefore = Object.getOwnPropertyDescriptors(Object.prototype)\n const targetPrototypeBefore = Object.getPrototypeOf(target)\n\n try {\n setNestedValue(target, path, true)\n expect.fail('Expected setNestedValue to reject the invalid field path')\n } catch (error) {\n expect(error).toBeInstanceOf(APIError)\n\n if (error instanceof APIError) {\n expect(error.status).toBe(400)\n expect(error.isPublic).toBe(true)\n }\n }\n\n expect(target).toEqual({ stable: { value: true } })\n expect(Object.getPrototypeOf(target)).toBe(targetPrototypeBefore)\n expect(Object.getOwnPropertyDescriptors(Object.prototype)).toEqual(objectPrototypeBefore)\n })\n\n it('rejects field paths with out-of-range array indexes', () => {\n const source = { items: [{ value: true }] }\n const target: Record<string, unknown> = {}\n\n expect(() => setNestedValue(target, 'items.4294967294.value', true, source)).toThrow(APIError)\n expect(target).toEqual({ items: [] })\n })\n\n it('supports out-of-order array indexes that exist in the source document', () => {\n const source = { items: [{ value: 'first' }, { value: 'second' }, { value: 'third' }] }\n const target: Record<string, unknown> = {}\n\n setNestedValue(target, 'items.2.value', 'third', source)\n\n expect(target).toEqual({ items: [undefined, undefined, { value: 'third' }] })\n })\n\n it.each(['-1', '+1', '01', ' 1', '1 ', '1e2', '0x10', 'Infinity', '9007199254740992'])(\n 'treats noncanonical numeric segment %s as an object key',\n (segment) => {\n const target: Record<string, unknown> = {}\n\n setNestedValue(target, `items.${segment}.value`, 'example')\n\n expect(Array.isArray(target.items)).toBe(false)\n expect(target).toEqual({ items: { [segment]: { value: 'example' } } })\n },\n )\n\n it('builds nested objects and arrays', () => {\n const target: Record<string, unknown> = {}\n\n setNestedValue(target, 'group.items.0.title', 'first')\n setNestedValue(target, 'group.items.0.description', 'description')\n setNestedValue(target, 'group.items.1.title', 'second')\n\n expect(target).toEqual({\n group: {\n items: [{ description: 'description', title: 'first' }, { title: 'second' }],\n },\n })\n\n const group = target.group as Record<string, unknown>\n const items = group.items as Record<string, unknown>[]\n\n expect(Object.getPrototypeOf(group)).toBeNull()\n expect(Array.isArray(items)).toBe(true)\n expect(Object.getPrototypeOf(items[0])).toBeNull()\n expect(Object.getPrototypeOf(items[1])).toBeNull()\n })\n\n it('supports nested arrays using numeric lookahead', () => {\n const target: Record<string, unknown> = {}\n\n setNestedValue(target, 'matrix.0.1.value', 'nested')\n\n expect(target).toEqual({\n matrix: [[undefined, { value: 'nested' }]],\n })\n })\n\n it('creates own containers instead of traversing inherited properties', () => {\n const inheritedGroup = { inherited: true }\n const target = Object.create({ group: inheritedGroup }) as Record<string, unknown>\n\n setNestedValue(target, 'group.value', 'own')\n\n expect(Object.prototype.hasOwnProperty.call(target, 'group')).toBe(true)\n expect(target.group).toEqual({ value: 'own' })\n expect(Object.getPrototypeOf(target.group)).toBeNull()\n expect(inheritedGroup).toEqual({ inherited: true })\n })\n})\n"],"names":["APIError","describe","expect","it","setNestedValue","unsupportedSegments","unsupportedPaths","flatMap","segment","each","path","target","stable","value","objectPrototypeBefore","Object","getOwnPropertyDescriptors","prototype","targetPrototypeBefore","getPrototypeOf","fail","error","toBeInstanceOf","status","toBe","isPublic","toEqual","source","items","toThrow","undefined","Array","isArray","group","description","title","toBeNull","matrix","inheritedGroup","inherited","create","hasOwnProperty","call"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,UAAS;AAClC,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,SAAQ;AAE7C,SAASC,cAAc,QAAQ,sBAAqB;AAEpD,MAAMC,sBAAsB;IAAC;IAAa;IAAe;CAAY;AACrE,MAAMC,mBAAmBD,oBAAoBE,OAAO,CAAC,CAACC,UAAY;QAChE,GAAGA,QAAQ,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AChDlC,OAAOa,OAAOI,cAAc,CAACS,KAAK,CAAC,EAAE,GAAGQ,QAAQ;IAClD;IAEAjC,GAAG,kDAAkD;QACnD,MAAMQ,SAAkC,CAAC;QAEzCP,eAAeO,QAAQ,oBAAoB;QAE3CT,OAAOS,QAAQe,OAAO,CAAC;YACrBW,QAAQ;gBAAC;oBAACP;oBAAW;wBAAEjB,OAAO;oBAAS;iBAAE;aAAC;QAC5C;IACF;IAEAV,GAAG,qEAAqE;QACtE,MAAMmC,iBAAiB;YAAEC,WAAW;QAAK;QACzC,MAAM5B,SAASI,OAAOyB,MAAM,CAAC;YAAEP,OAAOK;QAAe;QAErDlC,eAAeO,QAAQ,eAAe;QAEtCT,OAAOa,OAAOE,SAAS,CAACwB,cAAc,CAACC,IAAI,CAAC/B,QAAQ,UAAUa,IAAI,CAAC;QACnEtB,OAAOS,OAAOsB,KAAK,EAAEP,OAAO,CAAC;YAAEb,OAAO;QAAM;QAC5CX,OAAOa,OAAOI,cAAc,CAACR,OAAOsB,KAAK,GAAGG,QAAQ;QACpDlC,OAAOoC,gBAAgBZ,OAAO,CAAC;YAAEa,WAAW;QAAK;IACnD;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/setNestedValue.spec.ts"],"sourcesContent":["import { APIError } from 'payload'\nimport { describe, expect, it } from 'vitest'\n\nimport { setNestedValue } from './setNestedValue.js'\n\nconst unsupportedSegments = ['__proto__']\nconst unsupportedPaths = unsupportedSegments.flatMap((segment) => [\n `${segment}.value`,\n `group.${segment}.value`,\n `group.${segment}`,\n `items.${segment}.0.value`,\n `items.0.${segment}.value`,\n `items.0.${segment}`,\n])\n\ndescribe('setNestedValue', () => {\n it.each(unsupportedPaths)('rejects invalid field path %s without changing the target', (path) => {\n const target = { stable: { value: true } }\n const objectPrototypeBefore = Object.getOwnPropertyDescriptors(Object.prototype)\n const targetPrototypeBefore = Object.getPrototypeOf(target)\n\n try {\n setNestedValue(target, path, true)\n expect.fail('Expected setNestedValue to reject the invalid field path')\n } catch (error) {\n expect(error).toBeInstanceOf(APIError)\n\n if (error instanceof APIError) {\n expect(error.status).toBe(400)\n expect(error.isPublic).toBe(true)\n }\n }\n\n expect(target).toEqual({ stable: { value: true } })\n expect(Object.getPrototypeOf(target)).toBe(targetPrototypeBefore)\n expect(Object.getOwnPropertyDescriptors(Object.prototype)).toEqual(objectPrototypeBefore)\n })\n\n it('should build nested values from owned data', () => {\n const inheritedContainer = 'constrainedNestedContainer'\n const target: Record<string, unknown> = {}\n const source: Record<string, unknown> = {}\n const objectPrototypeBefore = Object.getOwnPropertyDescriptors(Object.prototype)\n const originalContainerDescriptor = Object.getOwnPropertyDescriptor(\n Object.prototype,\n inheritedContainer,\n )\n let inheritedGetterCalls = 0\n let inheritedSetterCalls = 0\n\n try {\n Object.defineProperty(Object.prototype, inheritedContainer, {\n configurable: true,\n get: () => {\n inheritedGetterCalls += 1\n return { value: 'inherited' }\n },\n set: () => {\n inheritedSetterCalls += 1\n },\n })\n\n setNestedValue(target, 'constructor.prototype.value', 'example')\n setNestedValue(target, 'prototype.value', 'example')\n setNestedValue(target, `${inheritedContainer}.value`, 'local', source)\n } finally {\n if (originalContainerDescriptor) {\n Object.defineProperty(Object.prototype, inheritedContainer, originalContainerDescriptor)\n } else {\n delete (Object.prototype as Record<string, unknown>)[inheritedContainer]\n }\n }\n\n expect(inheritedGetterCalls).toBe(0)\n expect(inheritedSetterCalls).toBe(0)\n expect(Object.hasOwn(target, 'constructor')).toBe(true)\n expect(Object.hasOwn(target, 'prototype')).toBe(true)\n expect(target).toEqual({\n [inheritedContainer]: {\n value: 'local',\n },\n constructor: {\n prototype: {\n value: 'example',\n },\n },\n prototype: {\n value: 'example',\n },\n })\n expect(Object.getPrototypeOf(target.constructor)).toBeNull()\n expect(Object.getPrototypeOf(target.prototype)).toBeNull()\n expect(Object.getOwnPropertyDescriptors(Object.prototype)).toEqual(objectPrototypeBefore)\n })\n\n it('rejects field paths with out-of-range array indexes', () => {\n const source = { items: [{ value: true }] }\n const target: Record<string, unknown> = {}\n\n expect(() => setNestedValue(target, 'items.4294967294.value', true, source)).toThrow(APIError)\n expect(target).toEqual({ items: [] })\n })\n\n it('supports out-of-order array indexes that exist in the source document', () => {\n const source = { items: [{ value: 'first' }, { value: 'second' }, { value: 'third' }] }\n const target: Record<string, unknown> = {}\n\n setNestedValue(target, 'items.2.value', 'third', source)\n\n expect(target).toEqual({ items: [undefined, undefined, { value: 'third' }] })\n })\n\n it.each(['-1', '+1', '01', ' 1', '1 ', '1e2', '0x10', 'Infinity', '9007199254740992'])(\n 'treats noncanonical numeric segment %s as an object key',\n (segment) => {\n const target: Record<string, unknown> = {}\n\n setNestedValue(target, `items.${segment}.value`, 'example')\n\n expect(Array.isArray(target.items)).toBe(false)\n expect(target).toEqual({ items: { [segment]: { value: 'example' } } })\n },\n )\n\n it('builds nested objects and arrays', () => {\n const target: Record<string, unknown> = {}\n\n setNestedValue(target, 'group.items.0.title', 'first')\n setNestedValue(target, 'group.items.0.description', 'description')\n setNestedValue(target, 'group.items.1.title', 'second')\n\n expect(target).toEqual({\n group: {\n items: [{ description: 'description', title: 'first' }, { title: 'second' }],\n },\n })\n\n const group = target.group as Record<string, unknown>\n const items = group.items as Record<string, unknown>[]\n\n expect(Object.getPrototypeOf(group)).toBeNull()\n expect(Array.isArray(items)).toBe(true)\n expect(Object.getPrototypeOf(items[0])).toBeNull()\n expect(Object.getPrototypeOf(items[1])).toBeNull()\n })\n\n it('supports nested arrays using numeric lookahead', () => {\n const target: Record<string, unknown> = {}\n\n setNestedValue(target, 'matrix.0.1.value', 'nested')\n\n expect(target).toEqual({\n matrix: [[undefined, { value: 'nested' }]],\n })\n })\n\n it('creates own containers instead of traversing inherited properties', () => {\n const inheritedGroup = { inherited: true }\n const target = Object.create({ group: inheritedGroup }) as Record<string, unknown>\n\n setNestedValue(target, 'group.value', 'own')\n\n expect(Object.prototype.hasOwnProperty.call(target, 'group')).toBe(true)\n expect(target.group).toEqual({ value: 'own' })\n expect(Object.getPrototypeOf(target.group)).toBeNull()\n expect(inheritedGroup).toEqual({ inherited: true })\n })\n})\n"],"names":["APIError","describe","expect","it","setNestedValue","unsupportedSegments","unsupportedPaths","flatMap","segment","each","path","target","stable","value","objectPrototypeBefore","Object","getOwnPropertyDescriptors","prototype","targetPrototypeBefore","getPrototypeOf","fail","error","toBeInstanceOf","status","toBe","isPublic","toEqual","inheritedContainer","source","originalContainerDescriptor","getOwnPropertyDescriptor","inheritedGetterCalls","inheritedSetterCalls","defineProperty","configurable","get","set","hasOwn","toBeNull","items","toThrow","undefined","Array","isArray","group","description","title","matrix","inheritedGroup","inherited","create","hasOwnProperty","call"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,UAAS;AAClC,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,SAAQ;AAE7C,SAASC,cAAc,QAAQ,sBAAqB;AAEpD,MAAMC,sBAAsB;IAAC;CAAY;AACzC,MAAMC,mBAAmBD,oBAAoBE,OAAO,CAAC,CAACC,UAAY;QAChE,GAAGA,QAAQ,MAAM,CAAC;QAClB,CAAC,MAAM,EAAEA,QAAQ,MAAM,CAAC;QACxB,CAAC,MAAM,EAAEA,SAAS;QAClB,CAAC,MAAM,EAAEA,QAAQ,QAAQ,CAAC;QAC1B,CAAC,QAAQ,EAAEA,QAAQ,MAAM,CAAC;QAC1B,CAAC,QAAQ,EAAEA,SAAS;KACrB;AAEDP,SAAS,kBAAkB;IACzBE,GAAGM,IAAI,CAACH,kBAAkB,6DAA6D,CAACI;QACtF,MAAMC,SAAS;YAAEC,QAAQ;gBAAEC,OAAO;YAAK;QAAE;QACzC,MAAMC,wBAAwBC,OAAOC,yBAAyB,CAACD,OAAOE,SAAS;QAC/E,MAAMC,wBAAwBH,OAAOI,cAAc,CAACR;QAEpD,IAAI;YACFP,eAAeO,QAAQD,MAAM;YAC7BR,OAAOkB,IAAI,CAAC;QACd,EAAE,OAAOC,OAAO;YACdnB,OAAOmB,OAAOC,cAAc,CA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S,CAACkC,cAAc,CAACC,IAAI,CAACzC,QAAQ,UAAUa,IAAI,CAAC;QACnEtB,OAAOS,OAAOiC,KAAK,EAAElB,OAAO,CAAC;YAAEb,OAAO;QAAM;QAC5CX,OAAOa,OAAOI,cAAc,CAACR,OAAOiC,KAAK,GAAGN,QAAQ;QACpDpC,OAAO8C,gBAAgBtB,OAAO,CAAC;YAAEuB,WAAW;QAAK;IACnD;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/plugin-import-export",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.90.0",
|
|
4
4
|
"description": "Import-Export plugin for Payload",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"payload",
|
|
@@ -64,17 +64,17 @@
|
|
|
64
64
|
"csv-parse": "5.6.0",
|
|
65
65
|
"csv-stringify": "6.5.2",
|
|
66
66
|
"qs-esm": "8.0.1",
|
|
67
|
-
"@payloadcms/translations": "3.
|
|
68
|
-
"@payloadcms/ui": "3.
|
|
67
|
+
"@payloadcms/translations": "3.90.0",
|
|
68
|
+
"@payloadcms/ui": "3.90.0"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
+
"payload": "3.90.0",
|
|
71
72
|
"@payloadcms/eslint-config": "3.28.0",
|
|
72
|
-
"@payloadcms/ui": "3.
|
|
73
|
-
"payload": "3.89.0-internal.95c9cba"
|
|
73
|
+
"@payloadcms/ui": "3.90.0"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
|
-
"@payloadcms/ui": "3.
|
|
77
|
-
"payload": "3.
|
|
76
|
+
"@payloadcms/ui": "3.90.0",
|
|
77
|
+
"payload": "3.90.0"
|
|
78
78
|
},
|
|
79
79
|
"homepage:": "https://payloadcms.com",
|
|
80
80
|
"scripts": {
|