@payloadcms/plugin-import-export 4.0.0-internal.b8e7c89 → 4.0.0-internal.bf4bcce

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/dist/components/CollectionField/index.d.ts +3 -2
  2. package/dist/components/CollectionField/index.d.ts.map +1 -1
  3. package/dist/components/CollectionField/index.js.map +1 -1
  4. package/dist/components/ExportListMenuItem/index.d.ts.map +1 -1
  5. package/dist/components/ExportListMenuItem/index.js +14 -12
  6. package/dist/components/ExportListMenuItem/index.js.map +1 -1
  7. package/dist/components/ExportPreview/index.css +0 -3
  8. package/dist/components/ExportPreview/index.d.ts.map +1 -1
  9. package/dist/components/ExportPreview/index.js +11 -1
  10. package/dist/components/ExportPreview/index.js.map +1 -1
  11. package/dist/components/FieldsToExport/index.d.ts +3 -2
  12. package/dist/components/FieldsToExport/index.d.ts.map +1 -1
  13. package/dist/components/FieldsToExport/index.js +18 -15
  14. package/dist/components/FieldsToExport/index.js.map +1 -1
  15. package/dist/components/FieldsToExport/reduceFields.d.ts +6 -0
  16. package/dist/components/FieldsToExport/reduceFields.d.ts.map +1 -1
  17. package/dist/components/FieldsToExport/reduceFields.js +4 -0
  18. package/dist/components/FieldsToExport/reduceFields.js.map +1 -1
  19. package/dist/components/FormatField/index.d.ts +3 -2
  20. package/dist/components/FormatField/index.d.ts.map +1 -1
  21. package/dist/components/FormatField/index.js.map +1 -1
  22. package/dist/components/ImportListMenuItem/index.d.ts.map +1 -1
  23. package/dist/components/ImportListMenuItem/index.js +14 -12
  24. package/dist/components/ImportListMenuItem/index.js.map +1 -1
  25. package/dist/components/ImportPreview/index.css +0 -3
  26. package/dist/components/ImportPreview/index.d.ts.map +1 -1
  27. package/dist/components/ImportPreview/index.js +27 -8
  28. package/dist/components/ImportPreview/index.js.map +1 -1
  29. package/dist/components/LimitField/index.d.ts +3 -2
  30. package/dist/components/LimitField/index.d.ts.map +1 -1
  31. package/dist/components/LimitField/index.js.map +1 -1
  32. package/dist/components/LocaleField/index.d.ts +3 -2
  33. package/dist/components/LocaleField/index.d.ts.map +1 -1
  34. package/dist/components/LocaleField/index.js.map +1 -1
  35. package/dist/components/Page/index.d.ts +3 -2
  36. package/dist/components/Page/index.d.ts.map +1 -1
  37. package/dist/components/Page/index.js.map +1 -1
  38. package/dist/components/RelationshipCell/getRelationshipGroupKey.d.ts +7 -0
  39. package/dist/components/RelationshipCell/getRelationshipGroupKey.d.ts.map +1 -0
  40. package/dist/components/RelationshipCell/getRelationshipGroupKey.js +3 -0
  41. package/dist/components/RelationshipCell/getRelationshipGroupKey.js.map +1 -0
  42. package/dist/components/RelationshipCell/getRelationshipGroups.d.ts +43 -0
  43. package/dist/components/RelationshipCell/getRelationshipGroups.d.ts.map +1 -0
  44. package/dist/components/RelationshipCell/getRelationshipGroups.js +109 -0
  45. package/dist/components/RelationshipCell/getRelationshipGroups.js.map +1 -0
  46. package/dist/components/RelationshipCell/index.css +30 -0
  47. package/dist/components/RelationshipCell/index.d.ts +15 -0
  48. package/dist/components/RelationshipCell/index.d.ts.map +1 -0
  49. package/dist/components/RelationshipCell/index.js +57 -0
  50. package/dist/components/RelationshipCell/index.js.map +1 -0
  51. package/dist/components/SortBy/index.d.ts +3 -2
  52. package/dist/components/SortBy/index.d.ts.map +1 -1
  53. package/dist/components/SortBy/index.js.map +1 -1
  54. package/dist/components/SortOrder/index.d.ts +3 -2
  55. package/dist/components/SortOrder/index.d.ts.map +1 -1
  56. package/dist/components/SortOrder/index.js.map +1 -1
  57. package/dist/export/batchProcessor.d.ts +2 -1
  58. package/dist/export/batchProcessor.d.ts.map +1 -1
  59. package/dist/export/batchProcessor.js +6 -2
  60. package/dist/export/batchProcessor.js.map +1 -1
  61. package/dist/export/createExport.d.ts +2 -0
  62. package/dist/export/createExport.d.ts.map +1 -1
  63. package/dist/export/createExport.js +6 -1
  64. package/dist/export/createExport.js.map +1 -1
  65. package/dist/export/getCreateExportCollectionTask.d.ts.map +1 -1
  66. package/dist/export/getCreateExportCollectionTask.js +11 -0
  67. package/dist/export/getCreateExportCollectionTask.js.map +1 -1
  68. package/dist/export/getExportCollection.d.ts.map +1 -1
  69. package/dist/export/getExportCollection.js +5 -0
  70. package/dist/export/getExportCollection.js.map +1 -1
  71. package/dist/export/handleDownload.d.ts.map +1 -1
  72. package/dist/export/handleDownload.js +7 -3
  73. package/dist/export/handleDownload.js.map +1 -1
  74. package/dist/export/handlePreview.d.ts.map +1 -1
  75. package/dist/export/handlePreview.js +23 -4
  76. package/dist/export/handlePreview.js.map +1 -1
  77. package/dist/exports/types.d.ts +1 -1
  78. package/dist/exports/types.d.ts.map +1 -1
  79. package/dist/exports/types.js.map +1 -1
  80. package/dist/import/batchProcessor.d.ts +2 -1
  81. package/dist/import/batchProcessor.d.ts.map +1 -1
  82. package/dist/import/batchProcessor.js +15 -8
  83. package/dist/import/batchProcessor.js.map +1 -1
  84. package/dist/import/createImport.d.ts +3 -2
  85. package/dist/import/createImport.d.ts.map +1 -1
  86. package/dist/import/createImport.js +8 -1
  87. package/dist/import/createImport.js.map +1 -1
  88. package/dist/import/getCreateImportCollectionTask.d.ts.map +1 -1
  89. package/dist/import/getCreateImportCollectionTask.js +5 -2
  90. package/dist/import/getCreateImportCollectionTask.js.map +1 -1
  91. package/dist/import/getImportCollection.d.ts.map +1 -1
  92. package/dist/import/getImportCollection.js +2 -0
  93. package/dist/import/getImportCollection.js.map +1 -1
  94. package/dist/import/handlePreview.d.ts.map +1 -1
  95. package/dist/import/handlePreview.js +5 -1
  96. package/dist/import/handlePreview.js.map +1 -1
  97. package/dist/types.d.ts +17 -1
  98. package/dist/types.d.ts.map +1 -1
  99. package/dist/types.js.map +1 -1
  100. package/dist/utilities/getExportFieldFunctions.js +64 -27
  101. package/dist/utilities/getExportFieldFunctions.js.map +1 -1
  102. package/dist/utilities/getSelect.d.ts.map +1 -1
  103. package/dist/utilities/getSelect.js +4 -2
  104. package/dist/utilities/getSelect.js.map +1 -1
  105. package/dist/utilities/getSubmittedFormValues.d.ts +12 -0
  106. package/dist/utilities/getSubmittedFormValues.d.ts.map +1 -0
  107. package/dist/utilities/getSubmittedFormValues.js +24 -0
  108. package/dist/utilities/getSubmittedFormValues.js.map +1 -0
  109. package/dist/utilities/setNestedValue.d.ts.map +1 -1
  110. package/dist/utilities/setNestedValue.js +20 -6
  111. package/dist/utilities/setNestedValue.js.map +1 -1
  112. package/package.json +10 -10
  113. package/dist/components/FieldsToExport/reduceFields.spec.js +0 -239
  114. package/dist/components/FieldsToExport/reduceFields.spec.js.map +0 -1
  115. package/dist/utilities/applyFieldHooks.spec.js +0 -205
  116. package/dist/utilities/applyFieldHooks.spec.js.map +0 -1
  117. package/dist/utilities/buildDisabledFieldRegex.spec.js +0 -64
  118. package/dist/utilities/buildDisabledFieldRegex.spec.js.map +0 -1
  119. package/dist/utilities/fieldPath.d.ts +0 -2
  120. package/dist/utilities/fieldPath.d.ts.map +0 -1
  121. package/dist/utilities/fieldPath.js +0 -8
  122. package/dist/utilities/fieldPath.js.map +0 -1
  123. package/dist/utilities/fieldToRegex.spec.js +0 -151
  124. package/dist/utilities/fieldToRegex.spec.js.map +0 -1
  125. package/dist/utilities/filterToSelectedFields.spec.js +0 -204
  126. package/dist/utilities/filterToSelectedFields.spec.js.map +0 -1
  127. package/dist/utilities/flattenObject.spec.js +0 -158
  128. package/dist/utilities/flattenObject.spec.js.map +0 -1
  129. package/dist/utilities/getExportFieldFunctions.spec.js +0 -50
  130. package/dist/utilities/getExportFieldFunctions.spec.js.map +0 -1
  131. package/dist/utilities/getImportFieldFunctions.spec.js +0 -167
  132. package/dist/utilities/getImportFieldFunctions.spec.js.map +0 -1
  133. package/dist/utilities/getSchemaColumns.spec.js +0 -157
  134. package/dist/utilities/getSchemaColumns.spec.js.map +0 -1
  135. package/dist/utilities/getSelect.spec.js +0 -70
  136. package/dist/utilities/getSelect.spec.js.map +0 -1
  137. package/dist/utilities/parseCSV.spec.js +0 -195
  138. package/dist/utilities/parseCSV.spec.js.map +0 -1
  139. package/dist/utilities/processRichTextField.spec.js +0 -308
  140. package/dist/utilities/processRichTextField.spec.js.map +0 -1
  141. package/dist/utilities/setNestedValue.spec.js +0 -164
  142. package/dist/utilities/setNestedValue.spec.js.map +0 -1
  143. package/dist/utilities/siblingDoc.spec.js +0 -278
  144. package/dist/utilities/siblingDoc.spec.js.map +0 -1
  145. package/dist/utilities/unflattenObject.spec.js +0 -819
  146. package/dist/utilities/unflattenObject.spec.js.map +0 -1
@@ -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;AACF;AAEAR,SAAS,8CAA8C;IACrDA,SAAS,8BAA8B;QACrCE,GAAG,oEAAoE;YACrE,MAAMO,W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