@payloadcms/plugin-import-export 4.0.0-internal.43ccea7 → 4.0.0-internal.442e8b6
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 +0 -3
- package/dist/components/ExportPreview/index.d.ts.map +1 -1
- package/dist/components/ExportPreview/index.js +11 -1
- 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.map +1 -1
- package/dist/components/FieldsToExport/reduceFields.d.ts.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.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 +0 -3
- package/dist/components/ImportPreview/index.d.ts.map +1 -1
- package/dist/components/ImportPreview/index.js +27 -8
- 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 +3 -2
- package/dist/components/Page/index.d.ts.map +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.d.ts +3 -2
- package/dist/components/SortBy/index.d.ts.map +1 -1
- package/dist/components/SortBy/index.js.map +1 -1
- package/dist/components/SortOrder/index.d.ts +3 -2
- package/dist/components/SortOrder/index.d.ts.map +1 -1
- package/dist/components/SortOrder/index.js.map +1 -1
- package/dist/export/batchProcessor.d.ts +2 -1
- 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 +2 -0
- package/dist/export/createExport.d.ts.map +1 -1
- package/dist/export/createExport.js +6 -1
- 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 +5 -0
- 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 +2 -1
- 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 +2 -0
- 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/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/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/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/package.json +9 -9
- package/dist/components/FieldsToExport/reduceFields.spec.js +0 -239
- package/dist/components/FieldsToExport/reduceFields.spec.js.map +0 -1
- 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
|
@@ -1,308 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { processRichTextField } from './processRichTextField.js';
|
|
3
|
-
// Minimal helpers to keep assertions readable
|
|
4
|
-
const asRecord = (v)=>v;
|
|
5
|
-
const asArray = (v)=>v;
|
|
6
|
-
// ─── Fixtures ────────────────────────────────────────────────────────────────
|
|
7
|
-
const textNode = (overrides = {})=>({
|
|
8
|
-
detail: 0,
|
|
9
|
-
format: 0,
|
|
10
|
-
mode: 'normal',
|
|
11
|
-
text: 'Hello',
|
|
12
|
-
type: 'text',
|
|
13
|
-
version: 1,
|
|
14
|
-
...overrides
|
|
15
|
-
});
|
|
16
|
-
const paragraphNode = (children = [
|
|
17
|
-
textNode()
|
|
18
|
-
])=>({
|
|
19
|
-
children,
|
|
20
|
-
direction: 'ltr',
|
|
21
|
-
format: '',
|
|
22
|
-
indent: 0,
|
|
23
|
-
type: 'paragraph',
|
|
24
|
-
version: 1
|
|
25
|
-
});
|
|
26
|
-
const lexicalDoc = (children = [
|
|
27
|
-
paragraphNode()
|
|
28
|
-
])=>({
|
|
29
|
-
children,
|
|
30
|
-
direction: 'ltr',
|
|
31
|
-
format: '',
|
|
32
|
-
indent: 0,
|
|
33
|
-
type: 'root',
|
|
34
|
-
version: 1
|
|
35
|
-
});
|
|
36
|
-
// ─── Primitive pass-through ──────────────────────────────────────────────────
|
|
37
|
-
describe('processRichTextField — primitive pass-through', ()=>{
|
|
38
|
-
it('should return null unchanged', ()=>{
|
|
39
|
-
expect(processRichTextField(null)).toBeNull();
|
|
40
|
-
});
|
|
41
|
-
it('should return undefined unchanged', ()=>{
|
|
42
|
-
expect(processRichTextField(undefined)).toBeUndefined();
|
|
43
|
-
});
|
|
44
|
-
it('should return a number unchanged', ()=>{
|
|
45
|
-
expect(processRichTextField(42)).toBe(42);
|
|
46
|
-
});
|
|
47
|
-
it('should return false unchanged', ()=>{
|
|
48
|
-
expect(processRichTextField(false)).toBe(false);
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
// ─── String input (the recovered-from-missed-hook path) ─────────────────────
|
|
52
|
-
describe('processRichTextField — JSON string input', ()=>{
|
|
53
|
-
it('should parse a valid JSON string into an object', ()=>{
|
|
54
|
-
const doc = lexicalDoc();
|
|
55
|
-
expect(processRichTextField(JSON.stringify(doc))).toEqual(doc);
|
|
56
|
-
});
|
|
57
|
-
it('should return an unparseable string unchanged', ()=>{
|
|
58
|
-
expect(processRichTextField('not json')).toBe('not json');
|
|
59
|
-
});
|
|
60
|
-
it('should return an empty string unchanged', ()=>{
|
|
61
|
-
expect(processRichTextField('')).toBe('');
|
|
62
|
-
});
|
|
63
|
-
it('should parse a string and still convert numeric string properties', ()=>{
|
|
64
|
-
const node = {
|
|
65
|
-
type: 'text',
|
|
66
|
-
detail: '0',
|
|
67
|
-
format: '3',
|
|
68
|
-
indent: '0',
|
|
69
|
-
version: '1',
|
|
70
|
-
text: 'hi'
|
|
71
|
-
};
|
|
72
|
-
const result = asRecord(processRichTextField(JSON.stringify(node)));
|
|
73
|
-
expect(result.detail).toBe(0);
|
|
74
|
-
expect(result.format).toBe(3);
|
|
75
|
-
expect(result.indent).toBe(0);
|
|
76
|
-
expect(result.version).toBe(1);
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
// ─── Numeric property coercion ───────────────────────────────────────────────
|
|
80
|
-
describe('processRichTextField — numeric property coercion', ()=>{
|
|
81
|
-
it('should convert detail, format, indent, version from strings to numbers', ()=>{
|
|
82
|
-
const input = textNode({
|
|
83
|
-
detail: '0',
|
|
84
|
-
format: '0',
|
|
85
|
-
indent: '0',
|
|
86
|
-
version: '1'
|
|
87
|
-
});
|
|
88
|
-
const result = asRecord(processRichTextField(input));
|
|
89
|
-
expect(result.detail).toBe(0);
|
|
90
|
-
expect(result.format).toBe(0);
|
|
91
|
-
expect(result.indent).toBe(0);
|
|
92
|
-
expect(result.version).toBe(1);
|
|
93
|
-
});
|
|
94
|
-
it('should convert start and value from strings to numbers (list/listitem nodes)', ()=>{
|
|
95
|
-
const listItemNode = {
|
|
96
|
-
type: 'listitem',
|
|
97
|
-
start: '1',
|
|
98
|
-
value: '2',
|
|
99
|
-
version: '1'
|
|
100
|
-
};
|
|
101
|
-
const result = asRecord(processRichTextField(listItemNode));
|
|
102
|
-
expect(result.start).toBe(1);
|
|
103
|
-
expect(result.value).toBe(2);
|
|
104
|
-
});
|
|
105
|
-
it('should convert textFormat and textStyle from strings to numbers', ()=>{
|
|
106
|
-
const input = {
|
|
107
|
-
type: 'text',
|
|
108
|
-
textFormat: '4',
|
|
109
|
-
textStyle: '0',
|
|
110
|
-
version: '1',
|
|
111
|
-
text: 'x'
|
|
112
|
-
};
|
|
113
|
-
const result = asRecord(processRichTextField(input));
|
|
114
|
-
expect(result.textFormat).toBe(4);
|
|
115
|
-
expect(result.textStyle).toBe(0);
|
|
116
|
-
});
|
|
117
|
-
it('should leave a non-numeric string in a numeric-property slot unchanged', ()=>{
|
|
118
|
-
// Lexical paragraph format can be "" (empty) or alignment strings
|
|
119
|
-
const input = paragraphNode();
|
|
120
|
-
const result = asRecord(processRichTextField(input));
|
|
121
|
-
expect(result.format).toBe('');
|
|
122
|
-
});
|
|
123
|
-
it('should leave already-numeric values unchanged', ()=>{
|
|
124
|
-
const input = textNode({
|
|
125
|
-
detail: 0,
|
|
126
|
-
format: 3,
|
|
127
|
-
version: 1
|
|
128
|
-
});
|
|
129
|
-
const result = asRecord(processRichTextField(input));
|
|
130
|
-
expect(result.detail).toBe(0);
|
|
131
|
-
expect(result.format).toBe(3);
|
|
132
|
-
expect(result.version).toBe(1);
|
|
133
|
-
});
|
|
134
|
-
it('should not convert boolean values on numeric-property keys', ()=>{
|
|
135
|
-
const input = {
|
|
136
|
-
type: 'custom',
|
|
137
|
-
format: true,
|
|
138
|
-
version: '1'
|
|
139
|
-
};
|
|
140
|
-
const result = asRecord(processRichTextField(input));
|
|
141
|
-
expect(result.format).toBe(true);
|
|
142
|
-
expect(result.version).toBe(1);
|
|
143
|
-
});
|
|
144
|
-
});
|
|
145
|
-
// ─── Recursive children processing ──────────────────────────────────────────
|
|
146
|
-
describe('processRichTextField — recursive children', ()=>{
|
|
147
|
-
it('should recursively convert numeric strings inside children arrays', ()=>{
|
|
148
|
-
const input = paragraphNode([
|
|
149
|
-
textNode({
|
|
150
|
-
detail: '0',
|
|
151
|
-
format: '0',
|
|
152
|
-
version: '1'
|
|
153
|
-
})
|
|
154
|
-
]);
|
|
155
|
-
const result = asRecord(processRichTextField(input));
|
|
156
|
-
const child = asRecord(asArray(result.children)[0]);
|
|
157
|
-
expect(child.detail).toBe(0);
|
|
158
|
-
expect(child.format).toBe(0);
|
|
159
|
-
expect(child.version).toBe(1);
|
|
160
|
-
});
|
|
161
|
-
it('should handle three levels of nesting (root → paragraph → text)', ()=>{
|
|
162
|
-
const input = lexicalDoc([
|
|
163
|
-
paragraphNode([
|
|
164
|
-
textNode({
|
|
165
|
-
version: '1',
|
|
166
|
-
format: '2'
|
|
167
|
-
})
|
|
168
|
-
])
|
|
169
|
-
]);
|
|
170
|
-
const result = asRecord(processRichTextField(input));
|
|
171
|
-
const paragraph = asRecord(asArray(result.children)[0]);
|
|
172
|
-
const text = asRecord(asArray(paragraph.children)[0]);
|
|
173
|
-
expect(text.version).toBe(1);
|
|
174
|
-
expect(text.format).toBe(2);
|
|
175
|
-
});
|
|
176
|
-
it('should handle multiple children at the same level', ()=>{
|
|
177
|
-
const input = lexicalDoc([
|
|
178
|
-
paragraphNode([
|
|
179
|
-
textNode({
|
|
180
|
-
text: 'Bold',
|
|
181
|
-
format: '1'
|
|
182
|
-
}),
|
|
183
|
-
textNode({
|
|
184
|
-
text: ' normal',
|
|
185
|
-
format: '0'
|
|
186
|
-
})
|
|
187
|
-
]),
|
|
188
|
-
paragraphNode([
|
|
189
|
-
textNode({
|
|
190
|
-
text: 'Second para',
|
|
191
|
-
version: '1'
|
|
192
|
-
})
|
|
193
|
-
])
|
|
194
|
-
]);
|
|
195
|
-
const result = asRecord(processRichTextField(input));
|
|
196
|
-
const firstPara = asRecord(asArray(result.children)[0]);
|
|
197
|
-
const secondPara = asRecord(asArray(result.children)[1]);
|
|
198
|
-
const bold = asRecord(asArray(firstPara.children)[0]);
|
|
199
|
-
const normal = asRecord(asArray(firstPara.children)[1]);
|
|
200
|
-
const secondText = asRecord(asArray(secondPara.children)[0]);
|
|
201
|
-
expect(bold.format).toBe(1);
|
|
202
|
-
expect(normal.format).toBe(0);
|
|
203
|
-
expect(secondText.version).toBe(1);
|
|
204
|
-
});
|
|
205
|
-
it('should skip null and non-object entries in children without throwing', ()=>{
|
|
206
|
-
const input = {
|
|
207
|
-
type: 'root',
|
|
208
|
-
version: 1,
|
|
209
|
-
children: [
|
|
210
|
-
null,
|
|
211
|
-
undefined,
|
|
212
|
-
'stray',
|
|
213
|
-
textNode()
|
|
214
|
-
]
|
|
215
|
-
};
|
|
216
|
-
const result = asRecord(processRichTextField(input));
|
|
217
|
-
const children = asArray(result.children);
|
|
218
|
-
expect(children[0]).toBeNull();
|
|
219
|
-
expect(children[1]).toBeUndefined();
|
|
220
|
-
expect(children[2]).toBe('stray');
|
|
221
|
-
expect(asRecord(children[3]).type).toBe('text');
|
|
222
|
-
});
|
|
223
|
-
});
|
|
224
|
-
// ─── Nested non-children objects ─────────────────────────────────────────────
|
|
225
|
-
describe('processRichTextField — nested non-children objects', ()=>{
|
|
226
|
-
it('should recurse into plain nested objects (e.g. decorator node data)', ()=>{
|
|
227
|
-
const input = {
|
|
228
|
-
type: 'decorator',
|
|
229
|
-
version: '1',
|
|
230
|
-
data: {
|
|
231
|
-
detail: '2',
|
|
232
|
-
label: 'keep me'
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
const result = asRecord(processRichTextField(input));
|
|
236
|
-
const data = asRecord(result.data);
|
|
237
|
-
expect(result.version).toBe(1);
|
|
238
|
-
expect(data.detail).toBe(2);
|
|
239
|
-
expect(data.label).toBe('keep me');
|
|
240
|
-
});
|
|
241
|
-
});
|
|
242
|
-
// ─── Full Lexical document round-trips ───────────────────────────────────────
|
|
243
|
-
describe('processRichTextField — full document', ()=>{
|
|
244
|
-
it('should produce a stable result when called on an already-processed object', ()=>{
|
|
245
|
-
const doc = lexicalDoc();
|
|
246
|
-
const firstPass = processRichTextField(doc);
|
|
247
|
-
const secondPass = processRichTextField(firstPass);
|
|
248
|
-
expect(secondPass).toEqual(firstPass);
|
|
249
|
-
});
|
|
250
|
-
it('should fully round-trip a complex Lexical document serialised to JSON', ()=>{
|
|
251
|
-
const doc = lexicalDoc([
|
|
252
|
-
paragraphNode([
|
|
253
|
-
textNode({
|
|
254
|
-
text: 'Bold',
|
|
255
|
-
format: '1',
|
|
256
|
-
detail: '0',
|
|
257
|
-
indent: '0',
|
|
258
|
-
version: '1'
|
|
259
|
-
}),
|
|
260
|
-
textNode({
|
|
261
|
-
text: ' normal',
|
|
262
|
-
format: '0',
|
|
263
|
-
version: '1'
|
|
264
|
-
})
|
|
265
|
-
]),
|
|
266
|
-
{
|
|
267
|
-
type: 'list',
|
|
268
|
-
listType: 'number',
|
|
269
|
-
start: '1',
|
|
270
|
-
version: '1',
|
|
271
|
-
indent: '0',
|
|
272
|
-
direction: 'ltr',
|
|
273
|
-
children: [
|
|
274
|
-
{
|
|
275
|
-
type: 'listitem',
|
|
276
|
-
value: '1',
|
|
277
|
-
detail: '0',
|
|
278
|
-
format: '0',
|
|
279
|
-
version: '1',
|
|
280
|
-
text: 'Item A'
|
|
281
|
-
},
|
|
282
|
-
{
|
|
283
|
-
type: 'listitem',
|
|
284
|
-
value: '2',
|
|
285
|
-
detail: '0',
|
|
286
|
-
format: '0',
|
|
287
|
-
version: '1',
|
|
288
|
-
text: 'Item B'
|
|
289
|
-
}
|
|
290
|
-
]
|
|
291
|
-
}
|
|
292
|
-
]);
|
|
293
|
-
const result = asRecord(processRichTextField(JSON.stringify(doc)));
|
|
294
|
-
const para = asRecord(asArray(result.children)[0]);
|
|
295
|
-
const boldText = asRecord(asArray(para.children)[0]);
|
|
296
|
-
expect(boldText.format).toBe(1);
|
|
297
|
-
expect(boldText.detail).toBe(0);
|
|
298
|
-
const list = asRecord(asArray(result.children)[1]);
|
|
299
|
-
expect(list.start).toBe(1);
|
|
300
|
-
expect(list.indent).toBe(0);
|
|
301
|
-
const itemA = asRecord(asArray(list.children)[0]);
|
|
302
|
-
const itemB = asRecord(asArray(list.children)[1]);
|
|
303
|
-
expect(itemA.value).toBe(1);
|
|
304
|
-
expect(itemB.value).toBe(2);
|
|
305
|
-
});
|
|
306
|
-
});
|
|
307
|
-
|
|
308
|
-
//# sourceMappingURL=processRichTextField.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/processRichTextField.spec.ts"],"sourcesContent":["import { describe, expect, it } from 'vitest'\n\nimport { processRichTextField } from './processRichTextField.js'\n\n// Minimal helpers to keep assertions readable\nconst asRecord = (v: unknown) => v as Record<string, unknown>\nconst asArray = (v: unknown) => v as unknown[]\n\n// ─── Fixtures ────────────────────────────────────────────────────────────────\n\nconst textNode = (overrides: Record<string, unknown> = {}) => ({\n detail: 0,\n format: 0,\n mode: 'normal',\n text: 'Hello',\n type: 'text',\n version: 1,\n ...overrides,\n})\n\nconst paragraphNode = (children: unknown[] = [textNode()]) => ({\n children,\n direction: 'ltr',\n format: '',\n indent: 0,\n type: 'paragraph',\n version: 1,\n})\n\nconst lexicalDoc = (children: unknown[] = [paragraphNode()]) => ({\n children,\n direction: 'ltr',\n format: '',\n indent: 0,\n type: 'root',\n version: 1,\n})\n\n// ─── Primitive pass-through ──────────────────────────────────────────────────\n\ndescribe('processRichTextField — primitive pass-through', () => {\n it('should return null unchanged', () => {\n expect(processRichTextField(null)).toBeNull()\n })\n\n it('should return undefined unchanged', () => {\n expect(processRichTextField(undefined)).toBeUndefined()\n })\n\n it('should return a number unchanged', () => {\n expect(processRichTextField(42)).toBe(42)\n })\n\n it('should return false unchanged', () => {\n expect(processRichTextField(false)).toBe(false)\n })\n})\n\n// ─── String input (the recovered-from-missed-hook path) ─────────────────────\n\ndescribe('processRichTextField — JSON string input', () => {\n it('should parse a valid JSON string into an object', () => {\n const doc = lexicalDoc()\n expect(processRichTextField(JSON.stringify(doc))).toEqual(doc)\n })\n\n it('should return an unparseable string unchanged', () => {\n expect(processRichTextField('not json')).toBe('not json')\n })\n\n it('should return an empty string unchanged', () => {\n expect(processRichTextField('')).toBe('')\n })\n\n it('should parse a string and still convert numeric string properties', () => {\n const node = { type: 'text', detail: '0', format: '3', indent: '0', version: '1', text: 'hi' }\n const result = asRecord(processRichTextField(JSON.stringify(node)))\n expect(result.detail).toBe(0)\n expect(result.format).toBe(3)\n expect(result.indent).toBe(0)\n expect(result.version).toBe(1)\n })\n})\n\n// ─── Numeric property coercion ───────────────────────────────────────────────\n\ndescribe('processRichTextField — numeric property coercion', () => {\n it('should convert detail, format, indent, version from strings to numbers', () => {\n const input = textNode({ detail: '0', format: '0', indent: '0', version: '1' })\n const result = asRecord(processRichTextField(input))\n expect(result.detail).toBe(0)\n expect(result.format).toBe(0)\n expect(result.indent).toBe(0)\n expect(result.version).toBe(1)\n })\n\n it('should convert start and value from strings to numbers (list/listitem nodes)', () => {\n const listItemNode = { type: 'listitem', start: '1', value: '2', version: '1' }\n const result = asRecord(processRichTextField(listItemNode))\n expect(result.start).toBe(1)\n expect(result.value).toBe(2)\n })\n\n it('should convert textFormat and textStyle from strings to numbers', () => {\n const input = { type: 'text', textFormat: '4', textStyle: '0', version: '1', text: 'x' }\n const result = asRecord(processRichTextField(input))\n expect(result.textFormat).toBe(4)\n expect(result.textStyle).toBe(0)\n })\n\n it('should leave a non-numeric string in a numeric-property slot unchanged', () => {\n // Lexical paragraph format can be \"\" (empty) or alignment strings\n const input = paragraphNode()\n const result = asRecord(processRichTextField(input))\n expect(result.format).toBe('')\n })\n\n it('should leave already-numeric values unchanged', () => {\n const input = textNode({ detail: 0, format: 3, version: 1 })\n const result = asRecord(processRichTextField(input))\n expect(result.detail).toBe(0)\n expect(result.format).toBe(3)\n expect(result.version).toBe(1)\n })\n\n it('should not convert boolean values on numeric-property keys', () => {\n const input = { type: 'custom', format: true, version: '1' }\n const result = asRecord(processRichTextField(input))\n expect(result.format).toBe(true)\n expect(result.version).toBe(1)\n })\n})\n\n// ─── Recursive children processing ──────────────────────────────────────────\n\ndescribe('processRichTextField — recursive children', () => {\n it('should recursively convert numeric strings inside children arrays', () => {\n const input = paragraphNode([textNode({ detail: '0', format: '0', version: '1' })])\n const result = asRecord(processRichTextField(input))\n const child = asRecord(asArray(result.children)[0])\n expect(child.detail).toBe(0)\n expect(child.format).toBe(0)\n expect(child.version).toBe(1)\n })\n\n it('should handle three levels of nesting (root → paragraph → text)', () => {\n const input = lexicalDoc([paragraphNode([textNode({ version: '1', format: '2' })])])\n const result = asRecord(processRichTextField(input))\n const paragraph = asRecord(asArray(result.children)[0])\n const text = asRecord(asArray(paragraph.children)[0])\n expect(text.version).toBe(1)\n expect(text.format).toBe(2)\n })\n\n it('should handle multiple children at the same level', () => {\n const input = lexicalDoc([\n paragraphNode([\n textNode({ text: 'Bold', format: '1' }),\n textNode({ text: ' normal', format: '0' }),\n ]),\n paragraphNode([textNode({ text: 'Second para', version: '1' })]),\n ])\n const result = asRecord(processRichTextField(input))\n const firstPara = asRecord(asArray(result.children)[0])\n const secondPara = asRecord(asArray(result.children)[1])\n const bold = asRecord(asArray(firstPara.children)[0])\n const normal = asRecord(asArray(firstPara.children)[1])\n const secondText = asRecord(asArray(secondPara.children)[0])\n expect(bold.format).toBe(1)\n expect(normal.format).toBe(0)\n expect(secondText.version).toBe(1)\n })\n\n it('should skip null and non-object entries in children without throwing', () => {\n const input = { type: 'root', version: 1, children: [null, undefined, 'stray', textNode()] }\n const result = asRecord(processRichTextField(input))\n const children = asArray(result.children)\n expect(children[0]).toBeNull()\n expect(children[1]).toBeUndefined()\n expect(children[2]).toBe('stray')\n expect(asRecord(children[3]).type).toBe('text')\n })\n})\n\n// ─── Nested non-children objects ─────────────────────────────────────────────\n\ndescribe('processRichTextField — nested non-children objects', () => {\n it('should recurse into plain nested objects (e.g. decorator node data)', () => {\n const input = {\n type: 'decorator',\n version: '1',\n data: { detail: '2', label: 'keep me' },\n }\n const result = asRecord(processRichTextField(input))\n const data = asRecord(result.data)\n expect(result.version).toBe(1)\n expect(data.detail).toBe(2)\n expect(data.label).toBe('keep me')\n })\n})\n\n// ─── Full Lexical document round-trips ───────────────────────────────────────\n\ndescribe('processRichTextField — full document', () => {\n it('should produce a stable result when called on an already-processed object', () => {\n const doc = lexicalDoc()\n const firstPass = processRichTextField(doc)\n const secondPass = processRichTextField(firstPass)\n expect(secondPass).toEqual(firstPass)\n })\n\n it('should fully round-trip a complex Lexical document serialised to JSON', () => {\n const doc = lexicalDoc([\n paragraphNode([\n textNode({ text: 'Bold', format: '1', detail: '0', indent: '0', version: '1' }),\n textNode({ text: ' normal', format: '0', version: '1' }),\n ]),\n {\n type: 'list',\n listType: 'number',\n start: '1',\n version: '1',\n indent: '0',\n direction: 'ltr',\n children: [\n { type: 'listitem', value: '1', detail: '0', format: '0', version: '1', text: 'Item A' },\n { type: 'listitem', value: '2', detail: '0', format: '0', version: '1', text: 'Item B' },\n ],\n },\n ])\n\n const result = asRecord(processRichTextField(JSON.stringify(doc)))\n\n const para = asRecord(asArray(result.children)[0])\n const boldText = asRecord(asArray(para.children)[0])\n expect(boldText.format).toBe(1)\n expect(boldText.detail).toBe(0)\n\n const list = asRecord(asArray(result.children)[1])\n expect(list.start).toBe(1)\n expect(list.indent).toBe(0)\n\n const itemA = asRecord(asArray(list.children)[0])\n const itemB = asRecord(asArray(list.children)[1])\n expect(itemA.value).toBe(1)\n expect(itemB.value).toBe(2)\n })\n})\n"],"names":["describe","expect","it","processRichTextField","asRecord","v","asArray","textNode","overrides","detail","format","mode","text","type","version","paragraphNode","children","direction","indent","lexicalDoc","toBeNull","undefined","toBeUndefined","toBe","doc","JSON","stringify","toEqual","node","result","input","listItemNode","start","value","textFormat","textStyle","child","paragraph","firstPara","secondPara","bold","normal","secondText","data","label","firstPass","secondPass","listType","para","boldText","list","itemA","itemB"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,SAAQ;AAE7C,SAASC,oBAAoB,QAAQ,4BAA2B;AAEhE,8CAA8C;AAC9C,MAAMC,WAAW,CAACC,IAAeA;AACjC,MAAMC,UAAU,CAACD,IAAeA;AAEhC,gFAAgF;AAEhF,MAAME,WAAW,CAACC,YAAqC,CAAC,CAAC,GAAM,CAAA;QAC7DC,QAAQ;QACRC,QAAQ;QACRC,MAAM;QACNC,MAAM;QACNC,MAAM;QACNC,SAAS;QACT,GAAGN,SAAS;IACd,CAAA;AAEA,MAAMO,gBAAgB,CAACC,WAAsB;IAACT;CAAW,GAAM,CAAA;QAC7DS;QACAC,WAAW;QACXP,QAAQ;QACRQ,QAAQ;QACRL,MAAM;QACNC,SAAS;IACX,CAAA;AAEA,MAAMK,aAAa,CAACH,WAAsB;IAACD;CAAgB,GAAM,CAAA;QAC/D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AOgD,SAASvC,MAAM,EAAEa,IAAI,CAAC;QAC7BtB,OAAOgD,SAASxC,MAAM,EAAEc,IAAI,CAAC;QAE7B,MAAM2B,OAAO9C,SAASE,QAAQuB,OAAOb,QAAQ,CAAC,CAAC,EAAE;QACjDf,OAAOiD,KAAKlB,KAAK,EAAET,IAAI,CAAC;QACxBtB,OAAOiD,KAAKhC,MAAM,EAAEK,IAAI,CAAC;QAEzB,MAAM4B,QAAQ/C,SAASE,QAAQ4C,KAAKlC,QAAQ,CAAC,CAAC,EAAE;QAChD,MAAMoC,QAAQhD,SAASE,QAAQ4C,KAAKlC,QAAQ,CAAC,CAAC,EAAE;QAChDf,OAAOkD,MAAMlB,KAAK,EAAEV,IAAI,CAAC;QACzBtB,OAAOmD,MAAMnB,KAAK,EAAEV,IAAI,CAAC;IAC3B;AACF"}
|
|
@@ -1,278 +0,0 @@
|
|
|
1
|
-
import { applyFieldHooks } from './applyFieldHooks.js';
|
|
2
|
-
import { flattenObject } from './flattenObject.js';
|
|
3
|
-
import { getExportFieldFunctions } from './getExportFieldFunctions.js';
|
|
4
|
-
import { getImportFieldFunctions } from './getImportFieldFunctions.js';
|
|
5
|
-
import { unflattenObject } from './unflattenObject.js';
|
|
6
|
-
import { describe, expect, it, vi } from 'vitest';
|
|
7
|
-
const mockReq = {
|
|
8
|
-
payload: {
|
|
9
|
-
logger: {
|
|
10
|
-
error: vi.fn()
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
describe('beforeExport / beforeImport siblingDoc arg', ()=>{
|
|
15
|
-
describe('CSV export (flattenObject)', ()=>{
|
|
16
|
-
it('passes the source doc at the current nesting level as siblingDoc', ()=>{
|
|
17
|
-
const received = [];
|
|
18
|
-
const fields = [
|
|
19
|
-
{
|
|
20
|
-
name: 'title',
|
|
21
|
-
type: 'text'
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
name: 'group',
|
|
25
|
-
type: 'group',
|
|
26
|
-
flattenedFields: [
|
|
27
|
-
{
|
|
28
|
-
name: 'inner',
|
|
29
|
-
type: 'text',
|
|
30
|
-
custom: {
|
|
31
|
-
'plugin-import-export': {
|
|
32
|
-
hooks: {
|
|
33
|
-
beforeExport: ({ columnName, siblingData, siblingDoc, value })=>{
|
|
34
|
-
received.push({
|
|
35
|
-
columnName,
|
|
36
|
-
isSiblingDocSource: siblingDoc && typeof siblingDoc === 'object' && siblingDoc.inner === value,
|
|
37
|
-
isSiblingDocRow: siblingDoc === siblingData
|
|
38
|
-
});
|
|
39
|
-
return value;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
]
|
|
46
|
-
}
|
|
47
|
-
];
|
|
48
|
-
const exportFieldHooks = getExportFieldFunctions({
|
|
49
|
-
fields
|
|
50
|
-
});
|
|
51
|
-
flattenObject({
|
|
52
|
-
data: {
|
|
53
|
-
group: {
|
|
54
|
-
inner: 'deep'
|
|
55
|
-
},
|
|
56
|
-
title: 'Top'
|
|
57
|
-
},
|
|
58
|
-
exportFieldHooks,
|
|
59
|
-
format: 'csv',
|
|
60
|
-
req: mockReq
|
|
61
|
-
});
|
|
62
|
-
expect(received).toEqual([
|
|
63
|
-
{
|
|
64
|
-
columnName: 'group_inner',
|
|
65
|
-
isSiblingDocSource: true,
|
|
66
|
-
isSiblingDocRow: false
|
|
67
|
-
}
|
|
68
|
-
]);
|
|
69
|
-
});
|
|
70
|
-
it('lets a hook read another sibling by reading siblingDoc', ()=>{
|
|
71
|
-
const fields = [
|
|
72
|
-
{
|
|
73
|
-
name: 'firstName',
|
|
74
|
-
type: 'text'
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
name: 'fullName',
|
|
78
|
-
type: 'text',
|
|
79
|
-
custom: {
|
|
80
|
-
'plugin-import-export': {
|
|
81
|
-
hooks: {
|
|
82
|
-
beforeExport: ({ siblingDoc, value })=>{
|
|
83
|
-
const last = siblingDoc.lastName;
|
|
84
|
-
const first = siblingDoc.firstName;
|
|
85
|
-
if (first && last) {
|
|
86
|
-
return `${first} ${last}`;
|
|
87
|
-
}
|
|
88
|
-
return value;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
name: 'lastName',
|
|
96
|
-
type: 'text'
|
|
97
|
-
}
|
|
98
|
-
];
|
|
99
|
-
const exportFieldHooks = getExportFieldFunctions({
|
|
100
|
-
fields
|
|
101
|
-
});
|
|
102
|
-
const result = flattenObject({
|
|
103
|
-
data: {
|
|
104
|
-
firstName: 'Ada',
|
|
105
|
-
fullName: '(computed)',
|
|
106
|
-
lastName: 'Lovelace'
|
|
107
|
-
},
|
|
108
|
-
exportFieldHooks,
|
|
109
|
-
format: 'csv',
|
|
110
|
-
req: mockReq
|
|
111
|
-
});
|
|
112
|
-
expect(result.fullName).toBe('Ada Lovelace');
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
describe('JSON export (applyFieldHooks)', ()=>{
|
|
116
|
-
it('passes the untouched source sibling as siblingDoc and the mutable output as siblingData', ()=>{
|
|
117
|
-
let capturedSiblingDoc = null;
|
|
118
|
-
let capturedSiblingData = null;
|
|
119
|
-
const fields = [
|
|
120
|
-
{
|
|
121
|
-
name: 'outer',
|
|
122
|
-
type: 'group',
|
|
123
|
-
flattenedFields: [
|
|
124
|
-
{
|
|
125
|
-
name: 'tracked',
|
|
126
|
-
type: 'text',
|
|
127
|
-
custom: {
|
|
128
|
-
'plugin-import-export': {
|
|
129
|
-
hooks: {
|
|
130
|
-
beforeExport: ({ siblingData, siblingDoc, value })=>{
|
|
131
|
-
capturedSiblingDoc = siblingDoc;
|
|
132
|
-
capturedSiblingData = siblingData;
|
|
133
|
-
siblingData.injected = 'written-into-output';
|
|
134
|
-
return String(value) + '_changed';
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
]
|
|
141
|
-
}
|
|
142
|
-
];
|
|
143
|
-
const exportFieldHooks = getExportFieldFunctions({
|
|
144
|
-
fields
|
|
145
|
-
});
|
|
146
|
-
const source = {
|
|
147
|
-
outer: {
|
|
148
|
-
tracked: 'original'
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
applyFieldHooks({
|
|
152
|
-
data: source,
|
|
153
|
-
fieldHooks: exportFieldHooks,
|
|
154
|
-
fields,
|
|
155
|
-
format: 'json',
|
|
156
|
-
operation: 'export',
|
|
157
|
-
req: mockReq,
|
|
158
|
-
type: 'beforeExport'
|
|
159
|
-
});
|
|
160
|
-
expect(capturedSiblingDoc).toEqual({
|
|
161
|
-
tracked: 'original'
|
|
162
|
-
});
|
|
163
|
-
// The hook's mutation lives on siblingData, not siblingDoc
|
|
164
|
-
expect(capturedSiblingData?.injected).toBe('written-into-output');
|
|
165
|
-
expect(capturedSiblingDoc?.injected).toBeUndefined();
|
|
166
|
-
// And the source object itself is not mutated
|
|
167
|
-
expect(source).toEqual({
|
|
168
|
-
outer: {
|
|
169
|
-
tracked: 'original'
|
|
170
|
-
}
|
|
171
|
-
});
|
|
172
|
-
});
|
|
173
|
-
});
|
|
174
|
-
describe('CSV import (unflattenObject)', ()=>{
|
|
175
|
-
it('passes the full flat row as siblingDoc (equal to data)', ()=>{
|
|
176
|
-
const received = [];
|
|
177
|
-
const fields = [
|
|
178
|
-
{
|
|
179
|
-
name: 'title',
|
|
180
|
-
type: 'text'
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
name: 'note',
|
|
184
|
-
type: 'text',
|
|
185
|
-
custom: {
|
|
186
|
-
'plugin-import-export': {
|
|
187
|
-
hooks: {
|
|
188
|
-
beforeImport: ({ data, siblingDoc, value })=>{
|
|
189
|
-
received.push({
|
|
190
|
-
siblingDocIsData: siblingDoc === data
|
|
191
|
-
});
|
|
192
|
-
return value;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
];
|
|
199
|
-
const importFieldHooks = getImportFieldFunctions({
|
|
200
|
-
fields
|
|
201
|
-
});
|
|
202
|
-
unflattenObject({
|
|
203
|
-
data: {
|
|
204
|
-
note: 'hello',
|
|
205
|
-
title: 'Top'
|
|
206
|
-
},
|
|
207
|
-
fields,
|
|
208
|
-
format: 'csv',
|
|
209
|
-
importFieldHooks,
|
|
210
|
-
req: mockReq
|
|
211
|
-
});
|
|
212
|
-
expect(received).toEqual([
|
|
213
|
-
{
|
|
214
|
-
siblingDocIsData: true
|
|
215
|
-
}
|
|
216
|
-
]);
|
|
217
|
-
});
|
|
218
|
-
});
|
|
219
|
-
describe('JSON import (applyFieldHooks)', ()=>{
|
|
220
|
-
it('passes the untouched source sibling as siblingDoc and the mutable output as siblingData', ()=>{
|
|
221
|
-
let capturedSiblingDoc = null;
|
|
222
|
-
let capturedSiblingData = null;
|
|
223
|
-
const fields = [
|
|
224
|
-
{
|
|
225
|
-
name: 'outer',
|
|
226
|
-
type: 'group',
|
|
227
|
-
flattenedFields: [
|
|
228
|
-
{
|
|
229
|
-
name: 'tracked',
|
|
230
|
-
type: 'text',
|
|
231
|
-
custom: {
|
|
232
|
-
'plugin-import-export': {
|
|
233
|
-
hooks: {
|
|
234
|
-
beforeImport: ({ siblingData, siblingDoc, value })=>{
|
|
235
|
-
capturedSiblingDoc = siblingDoc;
|
|
236
|
-
capturedSiblingData = siblingData;
|
|
237
|
-
siblingData.injected = 'written-into-output';
|
|
238
|
-
return value;
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
]
|
|
245
|
-
}
|
|
246
|
-
];
|
|
247
|
-
const importFieldHooks = getImportFieldFunctions({
|
|
248
|
-
fields
|
|
249
|
-
});
|
|
250
|
-
const source = {
|
|
251
|
-
outer: {
|
|
252
|
-
tracked: 'original'
|
|
253
|
-
}
|
|
254
|
-
};
|
|
255
|
-
applyFieldHooks({
|
|
256
|
-
data: source,
|
|
257
|
-
fieldHooks: importFieldHooks,
|
|
258
|
-
fields,
|
|
259
|
-
format: 'json',
|
|
260
|
-
operation: 'import',
|
|
261
|
-
req: mockReq,
|
|
262
|
-
type: 'beforeImport'
|
|
263
|
-
});
|
|
264
|
-
expect(capturedSiblingDoc).toEqual({
|
|
265
|
-
tracked: 'original'
|
|
266
|
-
});
|
|
267
|
-
expect(capturedSiblingData?.injected).toBe('written-into-output');
|
|
268
|
-
expect(capturedSiblingDoc?.injected).toBeUndefined();
|
|
269
|
-
expect(source).toEqual({
|
|
270
|
-
outer: {
|
|
271
|
-
tracked: 'original'
|
|
272
|
-
}
|
|
273
|
-
});
|
|
274
|
-
});
|
|
275
|
-
});
|
|
276
|
-
});
|
|
277
|
-
|
|
278
|
-
//# sourceMappingURL=siblingDoc.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/siblingDoc.spec.ts"],"sourcesContent":["import { FlattenedField, PayloadRequest } from 'payload'\n\nimport type { FieldBeforeExportHook, FieldBeforeImportHook } from '../types.js'\n\nimport { applyFieldHooks } from './applyFieldHooks.js'\nimport { flattenObject } from './flattenObject.js'\nimport { getExportFieldFunctions } from './getExportFieldFunctions.js'\nimport { getImportFieldFunctions } from './getImportFieldFunctions.js'\nimport { unflattenObject } from './unflattenObject.js'\n\nimport { describe, expect, it, vi } from 'vitest'\n\nconst mockReq = {\n payload: {\n logger: {\n error: vi.fn(),\n },\n },\n} as unknown as PayloadRequest\n\ndescribe('beforeExport / beforeImport siblingDoc arg', () => {\n describe('CSV export (flattenObject)', () => {\n it('passes the source doc at the current nesting level as siblingDoc', () => {\n const received: Array<{\n columnName: string\n isSiblingDocSource: boolean\n isSiblingDocRow: boolean\n }> = []\n\n const fields: FlattenedField[] = [\n { name: 'title', type: 'text' } as FlattenedField,\n {\n name: 'group',\n type: 'group',\n flattenedFields: [\n {\n name: 'inner',\n type: 'text',\n custom: {\n 'plugin-import-export': {\n hooks: {\n beforeExport: (({ columnName, siblingData, siblingDoc, value }) => {\n received.push({\n columnName,\n isSiblingDocSource:\n siblingDoc &&\n typeof siblingDoc === 'object' &&\n siblingDoc.inner === value,\n isSiblingDocRow: siblingDoc === siblingData,\n })\n return value\n }) satisfies FieldBeforeExportHook,\n },\n },\n },\n },\n ],\n } as unknown as FlattenedField,\n ]\n\n const exportFieldHooks = getExportFieldFunctions({ fields })\n\n flattenObject({\n data: { group: { inner: 'deep' }, title: 'Top' },\n exportFieldHooks,\n format: 'csv',\n req: mockReq,\n })\n\n expect(received).toEqual([\n {\n columnName: 'group_inner',\n isSiblingDocSource: true,\n isSiblingDocRow: false,\n },\n ])\n })\n\n it('lets a hook read another sibling by reading siblingDoc', () => {\n const fields: FlattenedField[] = [\n { name: 'firstName', type: 'text' } as FlattenedField,\n {\n name: 'fullName',\n type: 'text',\n custom: {\n 'plugin-import-export': {\n hooks: {\n beforeExport: (({ siblingDoc, value }) => {\n const last = siblingDoc.lastName as string | undefined\n const first = siblingDoc.firstName as string | undefined\n if (first && last) {\n return `${first} ${last}`\n }\n return value\n }) satisfies FieldBeforeExportHook,\n },\n },\n },\n } as FlattenedField,\n { name: 'lastName', type: 'text' } as FlattenedField,\n ]\n\n const exportFieldHooks = getExportFieldFunctions({ fields })\n\n const result = flattenObject({\n data: { firstName: 'Ada', fullName: '(computed)', lastName: 'Lovelace' },\n exportFieldHooks,\n format: 'csv',\n req: mockReq,\n })\n\n expect(result.fullName).toBe('Ada Lovelace')\n })\n })\n\n describe('JSON export (applyFieldHooks)', () => {\n it('passes the untouched source sibling as siblingDoc and the mutable output as siblingData', () => {\n let capturedSiblingDoc: Record<string, unknown> | null = null\n let capturedSiblingData: Record<string, unknown> | null = null\n\n const fields: FlattenedField[] = [\n {\n name: 'outer',\n type: 'group',\n flattenedFields: [\n {\n name: 'tracked',\n type: 'text',\n custom: {\n 'plugin-import-export': {\n hooks: {\n beforeExport: (({ siblingData, siblingDoc, value }) => {\n capturedSiblingDoc = siblingDoc\n capturedSiblingData = siblingData\n siblingData.injected = 'written-into-output'\n return String(value) + '_changed'\n }) satisfies FieldBeforeExportHook,\n },\n },\n },\n },\n ],\n } as unknown as FlattenedField,\n ]\n\n const exportFieldHooks = getExportFieldFunctions({ fields })\n\n const source = { outer: { tracked: 'original' } }\n\n applyFieldHooks({\n data: source,\n fieldHooks: exportFieldHooks,\n fields,\n format: 'json',\n operation: 'export',\n req: mockReq,\n type: 'beforeExport',\n })\n\n expect(capturedSiblingDoc).toEqual({ tracked: 'original' })\n // The hook's mutation lives on siblingData, not siblingDoc\n expect((capturedSiblingData as unknown as Record<string, unknown>)?.injected).toBe(\n 'written-into-output',\n )\n expect((capturedSiblingDoc as unknown as Record<string, unknown>)?.injected).toBeUndefined()\n // And the source object itself is not mutated\n expect(source).toEqual({ outer: { tracked: 'original' } })\n })\n })\n\n describe('CSV import (unflattenObject)', () => {\n it('passes the full flat row as siblingDoc (equal to data)', () => {\n const received: Array<{ siblingDocIsData: boolean }> = []\n\n const fields: FlattenedField[] = [\n { name: 'title', type: 'text' } as FlattenedField,\n {\n name: 'note',\n type: 'text',\n custom: {\n 'plugin-import-export': {\n hooks: {\n beforeImport: (({ data, siblingDoc, value }) => {\n received.push({ siblingDocIsData: siblingDoc === data })\n return value\n }) satisfies FieldBeforeImportHook,\n },\n },\n },\n } as FlattenedField,\n ]\n\n const importFieldHooks = getImportFieldFunctions({ fields })\n\n unflattenObject({\n data: { note: 'hello', title: 'Top' },\n fields,\n format: 'csv',\n importFieldHooks,\n req: mockReq,\n })\n\n expect(received).toEqual([{ siblingDocIsData: true }])\n })\n })\n\n describe('JSON import (applyFieldHooks)', () => {\n it('passes the untouched source sibling as siblingDoc and the mutable output as siblingData', () => {\n let capturedSiblingDoc: Record<string, unknown> | null = null\n let capturedSiblingData: Record<string, unknown> | null = null\n\n const fields: FlattenedField[] = [\n {\n name: 'outer',\n type: 'group',\n flattenedFields: [\n {\n name: 'tracked',\n type: 'text',\n custom: {\n 'plugin-import-export': {\n hooks: {\n beforeImport: (({ siblingData, siblingDoc, value }) => {\n capturedSiblingDoc = siblingDoc\n capturedSiblingData = siblingData\n siblingData.injected = 'written-into-output'\n return value\n }) satisfies FieldBeforeImportHook,\n },\n },\n },\n },\n ],\n } as unknown as FlattenedField,\n ]\n\n const importFieldHooks = getImportFieldFunctions({ fields })\n\n const source = { outer: { tracked: 'original' } }\n\n applyFieldHooks({\n data: source,\n fieldHooks: importFieldHooks,\n fields,\n format: 'json',\n operation: 'import',\n req: mockReq,\n type: 'beforeImport',\n })\n\n expect(capturedSiblingDoc).toEqual({ tracked: 'original' })\n expect((capturedSiblingData as unknown as Record<string, unknown>)?.injected).toBe(\n 'written-into-output',\n )\n expect((capturedSiblingDoc as unknown as Record<string, unknown>)?.injected).toBeUndefined()\n expect(source).toEqual({ outer: { tracked: 'original' } })\n })\n })\n})\n"],"names":["applyFieldHooks","flattenObject","getExportFieldFunctions","getImportFieldFunctions","unflattenObject","describe","expect","it","vi","mockReq","payload","logger","error","fn","received","fields","name","type","flattenedFields","custom","hooks","beforeExport","columnName","siblingData","siblingDoc","value","push","isSiblingDocSource","inner","isSiblingDocRow","exportFieldHooks","data","group","title","format","req","toEqual","last","lastName","first","firstName","result","fullName","toBe","capturedSiblingDoc","capturedSiblingData","injected","String","source","outer","tracked","fieldHooks","operation","toBeUndefined","beforeImport","siblingDocIsData","importFieldHooks","note"],"mappings":"AAIA,SAASA,eAAe,QAAQ,uBAAsB;AACtD,SAASC,aAAa,QAAQ,qBAAoB;AAClD,SAASC,uBAAuB,QAAQ,+BAA8B;AACtE,SAASC,uBAAuB,QAAQ,+BAA8B;AACtE,SAASC,eAAe,QAAQ,uBAAsB;AAEtD,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,EAAEC,EAAE,QAAQ,SAAQ;AAEjD,MAAMC,UAAU;IACdC,SAAS;QACPC,QAAQ;YACNC,OAAOJ,GAAGK,EAAE;QACd;IACF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