appwrite-utils-cli 0.0.286 → 0.9.2
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/README.md +162 -96
- package/dist/collections/attributes.d.ts +4 -0
- package/dist/collections/attributes.js +224 -0
- package/dist/collections/indexes.d.ts +4 -0
- package/dist/collections/indexes.js +27 -0
- package/dist/collections/methods.d.ts +16 -0
- package/dist/collections/methods.js +216 -0
- package/dist/databases/methods.d.ts +6 -0
- package/dist/databases/methods.js +33 -0
- package/dist/interactiveCLI.d.ts +19 -0
- package/dist/interactiveCLI.js +555 -0
- package/dist/main.js +224 -62
- package/dist/migrations/afterImportActions.js +37 -40
- package/dist/migrations/appwriteToX.d.ts +26 -25
- package/dist/migrations/appwriteToX.js +42 -6
- package/dist/migrations/attributes.js +21 -20
- package/dist/migrations/backup.d.ts +93 -87
- package/dist/migrations/collections.d.ts +6 -0
- package/dist/migrations/collections.js +149 -20
- package/dist/migrations/converters.d.ts +2 -18
- package/dist/migrations/converters.js +13 -2
- package/dist/migrations/dataLoader.d.ts +276 -161
- package/dist/migrations/dataLoader.js +535 -292
- package/dist/migrations/databases.js +8 -2
- package/dist/migrations/helper.d.ts +3 -0
- package/dist/migrations/helper.js +21 -0
- package/dist/migrations/importController.d.ts +5 -2
- package/dist/migrations/importController.js +125 -88
- package/dist/migrations/importDataActions.d.ts +9 -1
- package/dist/migrations/importDataActions.js +15 -3
- package/dist/migrations/indexes.js +3 -2
- package/dist/migrations/logging.js +20 -8
- package/dist/migrations/migrationHelper.d.ts +9 -4
- package/dist/migrations/migrationHelper.js +6 -5
- package/dist/migrations/openapi.d.ts +1 -1
- package/dist/migrations/openapi.js +33 -18
- package/dist/migrations/queue.js +3 -2
- package/dist/migrations/relationships.d.ts +2 -2
- package/dist/migrations/schemaStrings.js +53 -41
- package/dist/migrations/setupDatabase.d.ts +2 -4
- package/dist/migrations/setupDatabase.js +24 -105
- package/dist/migrations/storage.d.ts +3 -1
- package/dist/migrations/storage.js +110 -16
- package/dist/migrations/transfer.d.ts +30 -0
- package/dist/migrations/transfer.js +337 -0
- package/dist/migrations/users.d.ts +2 -1
- package/dist/migrations/users.js +78 -43
- package/dist/schemas/authUser.d.ts +2 -2
- package/dist/storage/methods.d.ts +15 -0
- package/dist/storage/methods.js +207 -0
- package/dist/storage/schemas.d.ts +687 -0
- package/dist/storage/schemas.js +175 -0
- package/dist/utils/getClientFromConfig.d.ts +4 -0
- package/dist/utils/getClientFromConfig.js +16 -0
- package/dist/utils/helperFunctions.d.ts +11 -1
- package/dist/utils/helperFunctions.js +38 -0
- package/dist/utils/retryFailedPromises.d.ts +2 -0
- package/dist/utils/retryFailedPromises.js +21 -0
- package/dist/utils/schemaStrings.d.ts +13 -0
- package/dist/utils/schemaStrings.js +403 -0
- package/dist/utils/setupFiles.js +110 -61
- package/dist/utilsController.d.ts +40 -22
- package/dist/utilsController.js +164 -84
- package/package.json +13 -15
- package/src/collections/attributes.ts +483 -0
- package/src/collections/indexes.ts +53 -0
- package/src/collections/methods.ts +331 -0
- package/src/databases/methods.ts +47 -0
- package/src/init.ts +64 -64
- package/src/interactiveCLI.ts +767 -0
- package/src/main.ts +289 -83
- package/src/migrations/afterImportActions.ts +553 -490
- package/src/migrations/appwriteToX.ts +237 -174
- package/src/migrations/attributes.ts +483 -422
- package/src/migrations/backup.ts +205 -205
- package/src/migrations/collections.ts +545 -300
- package/src/migrations/converters.ts +161 -150
- package/src/migrations/dataLoader.ts +1615 -1304
- package/src/migrations/databases.ts +44 -25
- package/src/migrations/dbHelpers.ts +92 -92
- package/src/migrations/helper.ts +40 -0
- package/src/migrations/importController.ts +448 -384
- package/src/migrations/importDataActions.ts +315 -307
- package/src/migrations/indexes.ts +40 -37
- package/src/migrations/logging.ts +29 -16
- package/src/migrations/migrationHelper.ts +207 -201
- package/src/migrations/openapi.ts +83 -70
- package/src/migrations/queue.ts +118 -119
- package/src/migrations/relationships.ts +324 -324
- package/src/migrations/schemaStrings.ts +472 -460
- package/src/migrations/setupDatabase.ts +118 -219
- package/src/migrations/storage.ts +538 -358
- package/src/migrations/transfer.ts +608 -0
- package/src/migrations/users.ts +362 -285
- package/src/migrations/validationRules.ts +63 -63
- package/src/schemas/authUser.ts +23 -23
- package/src/setup.ts +8 -8
- package/src/storage/methods.ts +371 -0
- package/src/storage/schemas.ts +205 -0
- package/src/types.ts +9 -9
- package/src/utils/getClientFromConfig.ts +17 -0
- package/src/utils/helperFunctions.ts +181 -127
- package/src/utils/index.ts +2 -2
- package/src/utils/loadConfigs.ts +59 -59
- package/src/utils/retryFailedPromises.ts +27 -0
- package/src/utils/schemaStrings.ts +473 -0
- package/src/utils/setupFiles.ts +228 -182
- package/src/utilsController.ts +325 -194
- package/tsconfig.json +37 -37
@@ -1,7 +1,8 @@
|
|
1
1
|
import type { ImportDataActions } from "./importDataActions.js";
|
2
|
-
import { type AppwriteConfig, type AttributeMappings, type CollectionCreate, type ConfigDatabase, type
|
2
|
+
import { type AppwriteConfig, type AttributeMappings, type CollectionCreate, type ConfigDatabase, type ImportDef } from "appwrite-utils";
|
3
3
|
import { z } from "zod";
|
4
4
|
import { type Databases } from "node-appwrite";
|
5
|
+
import { AuthUserCreateSchema } from "../schemas/authUser.js";
|
5
6
|
export declare const CollectionImportDataSchema: z.ZodObject<{
|
6
7
|
collection: z.ZodOptional<z.ZodObject<Omit<{
|
7
8
|
name: z.ZodString;
|
@@ -36,24 +37,24 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
36
37
|
type: "string";
|
37
38
|
key: string;
|
38
39
|
size: number;
|
40
|
+
format?: string | null | undefined;
|
41
|
+
description?: string | Record<string, string> | undefined;
|
42
|
+
required?: boolean | undefined;
|
39
43
|
array?: boolean | undefined;
|
40
44
|
error?: string | undefined;
|
41
|
-
required?: boolean | undefined;
|
42
45
|
xdefault?: string | null | undefined;
|
43
46
|
encrypted?: boolean | undefined;
|
44
|
-
format?: string | null | undefined;
|
45
|
-
description?: string | Record<string, string> | undefined;
|
46
47
|
}, {
|
47
48
|
key: string;
|
48
49
|
type?: "string" | undefined;
|
50
|
+
format?: string | null | undefined;
|
51
|
+
description?: string | Record<string, string> | undefined;
|
52
|
+
required?: boolean | undefined;
|
49
53
|
array?: boolean | undefined;
|
50
54
|
error?: string | undefined;
|
51
|
-
required?: boolean | undefined;
|
52
55
|
size?: number | undefined;
|
53
56
|
xdefault?: string | null | undefined;
|
54
57
|
encrypted?: boolean | undefined;
|
55
|
-
format?: string | null | undefined;
|
56
|
-
description?: string | Record<string, string> | undefined;
|
57
58
|
}>, z.ZodObject<{
|
58
59
|
key: z.ZodString;
|
59
60
|
type: z.ZodDefault<z.ZodLiteral<"integer">>;
|
@@ -67,21 +68,21 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
67
68
|
}, "strip", z.ZodTypeAny, {
|
68
69
|
type: "integer";
|
69
70
|
key: string;
|
71
|
+
description?: string | Record<string, string> | null | undefined;
|
72
|
+
required?: boolean | undefined;
|
70
73
|
array?: boolean | undefined;
|
71
74
|
error?: string | undefined;
|
72
|
-
required?: boolean | undefined;
|
73
75
|
xdefault?: number | null | undefined;
|
74
|
-
description?: string | Record<string, string> | null | undefined;
|
75
76
|
min?: number | undefined;
|
76
77
|
max?: number | undefined;
|
77
78
|
}, {
|
78
79
|
key: string;
|
79
80
|
type?: "integer" | undefined;
|
81
|
+
description?: string | Record<string, string> | null | undefined;
|
82
|
+
required?: boolean | undefined;
|
80
83
|
array?: boolean | undefined;
|
81
84
|
error?: string | undefined;
|
82
|
-
required?: boolean | undefined;
|
83
85
|
xdefault?: number | null | undefined;
|
84
|
-
description?: string | Record<string, string> | null | undefined;
|
85
86
|
min?: number | undefined;
|
86
87
|
max?: number | undefined;
|
87
88
|
}>, z.ZodObject<{
|
@@ -97,21 +98,21 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
97
98
|
}, "strip", z.ZodTypeAny, {
|
98
99
|
type: "float";
|
99
100
|
key: string;
|
101
|
+
description?: string | Record<string, string> | null | undefined;
|
102
|
+
required?: boolean | undefined;
|
100
103
|
array?: boolean | undefined;
|
101
104
|
error?: string | undefined;
|
102
|
-
required?: boolean | undefined;
|
103
105
|
xdefault?: number | null | undefined;
|
104
|
-
description?: string | Record<string, string> | null | undefined;
|
105
106
|
min?: number | undefined;
|
106
107
|
max?: number | undefined;
|
107
108
|
}, {
|
108
109
|
key: string;
|
109
110
|
type?: "float" | undefined;
|
111
|
+
description?: string | Record<string, string> | null | undefined;
|
112
|
+
required?: boolean | undefined;
|
110
113
|
array?: boolean | undefined;
|
111
114
|
error?: string | undefined;
|
112
|
-
required?: boolean | undefined;
|
113
115
|
xdefault?: number | null | undefined;
|
114
|
-
description?: string | Record<string, string> | null | undefined;
|
115
116
|
min?: number | undefined;
|
116
117
|
max?: number | undefined;
|
117
118
|
}>, z.ZodObject<{
|
@@ -125,19 +126,19 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
125
126
|
}, "strip", z.ZodTypeAny, {
|
126
127
|
type: "boolean";
|
127
128
|
key: string;
|
129
|
+
description?: string | Record<string, string> | null | undefined;
|
130
|
+
required?: boolean | undefined;
|
128
131
|
array?: boolean | undefined;
|
129
132
|
error?: string | undefined;
|
130
|
-
required?: boolean | undefined;
|
131
133
|
xdefault?: boolean | null | undefined;
|
132
|
-
description?: string | Record<string, string> | null | undefined;
|
133
134
|
}, {
|
134
135
|
key: string;
|
135
136
|
type?: "boolean" | undefined;
|
137
|
+
description?: string | Record<string, string> | null | undefined;
|
138
|
+
required?: boolean | undefined;
|
136
139
|
array?: boolean | undefined;
|
137
140
|
error?: string | undefined;
|
138
|
-
required?: boolean | undefined;
|
139
141
|
xdefault?: boolean | null | undefined;
|
140
|
-
description?: string | Record<string, string> | null | undefined;
|
141
142
|
}>, z.ZodObject<{
|
142
143
|
key: z.ZodString;
|
143
144
|
type: z.ZodDefault<z.ZodLiteral<"datetime">>;
|
@@ -149,19 +150,19 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
149
150
|
}, "strip", z.ZodTypeAny, {
|
150
151
|
type: "datetime";
|
151
152
|
key: string;
|
153
|
+
description?: string | Record<string, string> | null | undefined;
|
154
|
+
required?: boolean | undefined;
|
152
155
|
array?: boolean | undefined;
|
153
156
|
error?: string | undefined;
|
154
|
-
required?: boolean | undefined;
|
155
157
|
xdefault?: string | null | undefined;
|
156
|
-
description?: string | Record<string, string> | null | undefined;
|
157
158
|
}, {
|
158
159
|
key: string;
|
159
160
|
type?: "datetime" | undefined;
|
161
|
+
description?: string | Record<string, string> | null | undefined;
|
162
|
+
required?: boolean | undefined;
|
160
163
|
array?: boolean | undefined;
|
161
164
|
error?: string | undefined;
|
162
|
-
required?: boolean | undefined;
|
163
165
|
xdefault?: string | null | undefined;
|
164
|
-
description?: string | Record<string, string> | null | undefined;
|
165
166
|
}>, z.ZodObject<{
|
166
167
|
key: z.ZodString;
|
167
168
|
type: z.ZodDefault<z.ZodLiteral<"email">>;
|
@@ -173,19 +174,19 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
173
174
|
}, "strip", z.ZodTypeAny, {
|
174
175
|
type: "email";
|
175
176
|
key: string;
|
177
|
+
description?: string | Record<string, string> | null | undefined;
|
178
|
+
required?: boolean | undefined;
|
176
179
|
array?: boolean | undefined;
|
177
180
|
error?: string | undefined;
|
178
|
-
required?: boolean | undefined;
|
179
181
|
xdefault?: string | null | undefined;
|
180
|
-
description?: string | Record<string, string> | null | undefined;
|
181
182
|
}, {
|
182
183
|
key: string;
|
183
184
|
type?: "email" | undefined;
|
185
|
+
description?: string | Record<string, string> | null | undefined;
|
186
|
+
required?: boolean | undefined;
|
184
187
|
array?: boolean | undefined;
|
185
188
|
error?: string | undefined;
|
186
|
-
required?: boolean | undefined;
|
187
189
|
xdefault?: string | null | undefined;
|
188
|
-
description?: string | Record<string, string> | null | undefined;
|
189
190
|
}>, z.ZodObject<{
|
190
191
|
key: z.ZodString;
|
191
192
|
type: z.ZodLiteral<"ip">;
|
@@ -197,19 +198,19 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
197
198
|
}, "strip", z.ZodTypeAny, {
|
198
199
|
type: "ip";
|
199
200
|
key: string;
|
201
|
+
description?: string | Record<string, string> | null | undefined;
|
202
|
+
required?: boolean | undefined;
|
200
203
|
array?: boolean | undefined;
|
201
204
|
error?: string | undefined;
|
202
|
-
required?: boolean | undefined;
|
203
205
|
xdefault?: string | null | undefined;
|
204
|
-
description?: string | Record<string, string> | null | undefined;
|
205
206
|
}, {
|
206
207
|
type: "ip";
|
207
208
|
key: string;
|
209
|
+
description?: string | Record<string, string> | null | undefined;
|
210
|
+
required?: boolean | undefined;
|
208
211
|
array?: boolean | undefined;
|
209
212
|
error?: string | undefined;
|
210
|
-
required?: boolean | undefined;
|
211
213
|
xdefault?: string | null | undefined;
|
212
|
-
description?: string | Record<string, string> | null | undefined;
|
213
214
|
}>, z.ZodObject<{
|
214
215
|
key: z.ZodString;
|
215
216
|
type: z.ZodDefault<z.ZodLiteral<"url">>;
|
@@ -221,19 +222,19 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
221
222
|
}, "strip", z.ZodTypeAny, {
|
222
223
|
type: "url";
|
223
224
|
key: string;
|
225
|
+
description?: string | Record<string, string> | null | undefined;
|
226
|
+
required?: boolean | undefined;
|
224
227
|
array?: boolean | undefined;
|
225
228
|
error?: string | undefined;
|
226
|
-
required?: boolean | undefined;
|
227
229
|
xdefault?: string | null | undefined;
|
228
|
-
description?: string | Record<string, string> | null | undefined;
|
229
230
|
}, {
|
230
231
|
key: string;
|
231
232
|
type?: "url" | undefined;
|
233
|
+
description?: string | Record<string, string> | null | undefined;
|
234
|
+
required?: boolean | undefined;
|
232
235
|
array?: boolean | undefined;
|
233
236
|
error?: string | undefined;
|
234
|
-
required?: boolean | undefined;
|
235
237
|
xdefault?: string | null | undefined;
|
236
|
-
description?: string | Record<string, string> | null | undefined;
|
237
238
|
}>, z.ZodObject<{
|
238
239
|
key: z.ZodString;
|
239
240
|
type: z.ZodDefault<z.ZodLiteral<"enum">>;
|
@@ -247,19 +248,19 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
247
248
|
type: "enum";
|
248
249
|
key: string;
|
249
250
|
elements: string[];
|
251
|
+
description?: string | Record<string, string> | null | undefined;
|
252
|
+
required?: boolean | undefined;
|
250
253
|
array?: boolean | undefined;
|
251
254
|
error?: string | undefined;
|
252
|
-
required?: boolean | undefined;
|
253
255
|
xdefault?: string | null | undefined;
|
254
|
-
description?: string | Record<string, string> | null | undefined;
|
255
256
|
}, {
|
256
257
|
key: string;
|
257
258
|
type?: "enum" | undefined;
|
259
|
+
description?: string | Record<string, string> | null | undefined;
|
260
|
+
required?: boolean | undefined;
|
258
261
|
array?: boolean | undefined;
|
259
262
|
error?: string | undefined;
|
260
|
-
required?: boolean | undefined;
|
261
263
|
xdefault?: string | null | undefined;
|
262
|
-
description?: string | Record<string, string> | null | undefined;
|
263
264
|
elements?: string[] | undefined;
|
264
265
|
}>, z.ZodObject<{
|
265
266
|
key: z.ZodString;
|
@@ -293,10 +294,10 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
293
294
|
twoWayKey: string;
|
294
295
|
onDelete: "setNull" | "cascade" | "restrict";
|
295
296
|
side: "parent" | "child";
|
297
|
+
description?: string | Record<string, string> | null | undefined;
|
298
|
+
required?: boolean | undefined;
|
296
299
|
array?: boolean | undefined;
|
297
300
|
error?: string | undefined;
|
298
|
-
required?: boolean | undefined;
|
299
|
-
description?: string | Record<string, string> | null | undefined;
|
300
301
|
importMapping?: {
|
301
302
|
originalIdField: string;
|
302
303
|
targetField?: string | undefined;
|
@@ -309,10 +310,10 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
309
310
|
twoWayKey: string;
|
310
311
|
side: "parent" | "child";
|
311
312
|
type?: "relationship" | undefined;
|
313
|
+
description?: string | Record<string, string> | null | undefined;
|
314
|
+
required?: boolean | undefined;
|
312
315
|
array?: boolean | undefined;
|
313
316
|
error?: string | undefined;
|
314
|
-
required?: boolean | undefined;
|
315
|
-
description?: string | Record<string, string> | null | undefined;
|
316
317
|
onDelete?: "setNull" | "cascade" | "restrict" | undefined;
|
317
318
|
importMapping?: {
|
318
319
|
originalIdField: string;
|
@@ -363,6 +364,7 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
363
364
|
idMappings: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
364
365
|
sourceField: z.ZodString;
|
365
366
|
fieldToSet: z.ZodOptional<z.ZodString>;
|
367
|
+
targetFieldToMatch: z.ZodOptional<z.ZodString>;
|
366
368
|
targetField: z.ZodString;
|
367
369
|
targetCollection: z.ZodString;
|
368
370
|
}, "strip", z.ZodTypeAny, {
|
@@ -370,12 +372,15 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
370
372
|
targetField: string;
|
371
373
|
targetCollection: string;
|
372
374
|
fieldToSet?: string | undefined;
|
375
|
+
targetFieldToMatch?: string | undefined;
|
373
376
|
}, {
|
374
377
|
sourceField: string;
|
375
378
|
targetField: string;
|
376
379
|
targetCollection: string;
|
377
380
|
fieldToSet?: string | undefined;
|
381
|
+
targetFieldToMatch?: string | undefined;
|
378
382
|
}>, "many">>;
|
383
|
+
createUsers: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodBoolean>>>;
|
379
384
|
updateMapping: z.ZodOptional<z.ZodObject<{
|
380
385
|
originalIdField: z.ZodString;
|
381
386
|
targetField: z.ZodString;
|
@@ -390,6 +395,7 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
390
395
|
oldKey: z.ZodOptional<z.ZodString>;
|
391
396
|
oldKeys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
392
397
|
targetKey: z.ZodString;
|
398
|
+
valueToSet: z.ZodOptional<z.ZodAny>;
|
393
399
|
fileData: z.ZodOptional<z.ZodObject<{
|
394
400
|
name: z.ZodString;
|
395
401
|
path: z.ZodString;
|
@@ -425,6 +431,7 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
425
431
|
targetKey: string;
|
426
432
|
oldKey?: string | undefined;
|
427
433
|
oldKeys?: string[] | undefined;
|
434
|
+
valueToSet?: any;
|
428
435
|
fileData?: {
|
429
436
|
path: string;
|
430
437
|
name: string;
|
@@ -442,6 +449,7 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
442
449
|
targetKey: string;
|
443
450
|
oldKey?: string | undefined;
|
444
451
|
oldKeys?: string[] | undefined;
|
452
|
+
valueToSet?: any;
|
445
453
|
fileData?: {
|
446
454
|
path: string;
|
447
455
|
name: string;
|
@@ -463,6 +471,7 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
463
471
|
targetKey: string;
|
464
472
|
oldKey?: string | undefined;
|
465
473
|
oldKeys?: string[] | undefined;
|
474
|
+
valueToSet?: any;
|
466
475
|
fileData?: {
|
467
476
|
path: string;
|
468
477
|
name: string;
|
@@ -484,7 +493,9 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
484
493
|
targetField: string;
|
485
494
|
targetCollection: string;
|
486
495
|
fieldToSet?: string | undefined;
|
496
|
+
targetFieldToMatch?: string | undefined;
|
487
497
|
}[] | undefined;
|
498
|
+
createUsers?: boolean | null | undefined;
|
488
499
|
updateMapping?: {
|
489
500
|
targetField: string;
|
490
501
|
originalIdField: string;
|
@@ -495,6 +506,7 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
495
506
|
targetKey: string;
|
496
507
|
oldKey?: string | undefined;
|
497
508
|
oldKeys?: string[] | undefined;
|
509
|
+
valueToSet?: any;
|
498
510
|
fileData?: {
|
499
511
|
path: string;
|
500
512
|
name: string;
|
@@ -517,7 +529,9 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
517
529
|
targetField: string;
|
518
530
|
targetCollection: string;
|
519
531
|
fieldToSet?: string | undefined;
|
532
|
+
targetFieldToMatch?: string | undefined;
|
520
533
|
}[] | undefined;
|
534
|
+
createUsers?: boolean | null | undefined;
|
521
535
|
updateMapping?: {
|
522
536
|
targetField: string;
|
523
537
|
originalIdField: string;
|
@@ -530,82 +544,82 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
530
544
|
type: "string";
|
531
545
|
key: string;
|
532
546
|
size: number;
|
547
|
+
format?: string | null | undefined;
|
548
|
+
description?: string | Record<string, string> | undefined;
|
549
|
+
required?: boolean | undefined;
|
533
550
|
array?: boolean | undefined;
|
534
551
|
error?: string | undefined;
|
535
|
-
required?: boolean | undefined;
|
536
552
|
xdefault?: string | null | undefined;
|
537
553
|
encrypted?: boolean | undefined;
|
538
|
-
format?: string | null | undefined;
|
539
|
-
description?: string | Record<string, string> | undefined;
|
540
554
|
} | {
|
541
555
|
type: "integer";
|
542
556
|
key: string;
|
557
|
+
description?: string | Record<string, string> | null | undefined;
|
558
|
+
required?: boolean | undefined;
|
543
559
|
array?: boolean | undefined;
|
544
560
|
error?: string | undefined;
|
545
|
-
required?: boolean | undefined;
|
546
561
|
xdefault?: number | null | undefined;
|
547
|
-
description?: string | Record<string, string> | null | undefined;
|
548
562
|
min?: number | undefined;
|
549
563
|
max?: number | undefined;
|
550
564
|
} | {
|
551
565
|
type: "float";
|
552
566
|
key: string;
|
567
|
+
description?: string | Record<string, string> | null | undefined;
|
568
|
+
required?: boolean | undefined;
|
553
569
|
array?: boolean | undefined;
|
554
570
|
error?: string | undefined;
|
555
|
-
required?: boolean | undefined;
|
556
571
|
xdefault?: number | null | undefined;
|
557
|
-
description?: string | Record<string, string> | null | undefined;
|
558
572
|
min?: number | undefined;
|
559
573
|
max?: number | undefined;
|
560
574
|
} | {
|
561
575
|
type: "boolean";
|
562
576
|
key: string;
|
577
|
+
description?: string | Record<string, string> | null | undefined;
|
578
|
+
required?: boolean | undefined;
|
563
579
|
array?: boolean | undefined;
|
564
580
|
error?: string | undefined;
|
565
|
-
required?: boolean | undefined;
|
566
581
|
xdefault?: boolean | null | undefined;
|
567
|
-
description?: string | Record<string, string> | null | undefined;
|
568
582
|
} | {
|
569
583
|
type: "datetime";
|
570
584
|
key: string;
|
585
|
+
description?: string | Record<string, string> | null | undefined;
|
586
|
+
required?: boolean | undefined;
|
571
587
|
array?: boolean | undefined;
|
572
588
|
error?: string | undefined;
|
573
|
-
required?: boolean | undefined;
|
574
589
|
xdefault?: string | null | undefined;
|
575
|
-
description?: string | Record<string, string> | null | undefined;
|
576
590
|
} | {
|
577
591
|
type: "email";
|
578
592
|
key: string;
|
593
|
+
description?: string | Record<string, string> | null | undefined;
|
594
|
+
required?: boolean | undefined;
|
579
595
|
array?: boolean | undefined;
|
580
596
|
error?: string | undefined;
|
581
|
-
required?: boolean | undefined;
|
582
597
|
xdefault?: string | null | undefined;
|
583
|
-
description?: string | Record<string, string> | null | undefined;
|
584
598
|
} | {
|
585
599
|
type: "ip";
|
586
600
|
key: string;
|
601
|
+
description?: string | Record<string, string> | null | undefined;
|
602
|
+
required?: boolean | undefined;
|
587
603
|
array?: boolean | undefined;
|
588
604
|
error?: string | undefined;
|
589
|
-
required?: boolean | undefined;
|
590
605
|
xdefault?: string | null | undefined;
|
591
|
-
description?: string | Record<string, string> | null | undefined;
|
592
606
|
} | {
|
593
607
|
type: "url";
|
594
608
|
key: string;
|
609
|
+
description?: string | Record<string, string> | null | undefined;
|
610
|
+
required?: boolean | undefined;
|
595
611
|
array?: boolean | undefined;
|
596
612
|
error?: string | undefined;
|
597
|
-
required?: boolean | undefined;
|
598
613
|
xdefault?: string | null | undefined;
|
599
|
-
description?: string | Record<string, string> | null | undefined;
|
600
614
|
} | {
|
601
615
|
type: "enum";
|
602
616
|
key: string;
|
603
617
|
elements: string[];
|
618
|
+
description?: string | Record<string, string> | null | undefined;
|
619
|
+
required?: boolean | undefined;
|
604
620
|
array?: boolean | undefined;
|
605
621
|
error?: string | undefined;
|
606
|
-
required?: boolean | undefined;
|
607
622
|
xdefault?: string | null | undefined;
|
608
|
-
description?: string | Record<string, string> | null | undefined;
|
609
623
|
} | {
|
610
624
|
type: "relationship";
|
611
625
|
key: string;
|
@@ -615,10 +629,10 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
615
629
|
twoWayKey: string;
|
616
630
|
onDelete: "setNull" | "cascade" | "restrict";
|
617
631
|
side: "parent" | "child";
|
632
|
+
description?: string | Record<string, string> | null | undefined;
|
633
|
+
required?: boolean | undefined;
|
618
634
|
array?: boolean | undefined;
|
619
635
|
error?: string | undefined;
|
620
|
-
required?: boolean | undefined;
|
621
|
-
description?: string | Record<string, string> | null | undefined;
|
622
636
|
importMapping?: {
|
623
637
|
originalIdField: string;
|
624
638
|
targetField?: string | undefined;
|
@@ -644,6 +658,7 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
644
658
|
targetKey: string;
|
645
659
|
oldKey?: string | undefined;
|
646
660
|
oldKeys?: string[] | undefined;
|
661
|
+
valueToSet?: any;
|
647
662
|
fileData?: {
|
648
663
|
path: string;
|
649
664
|
name: string;
|
@@ -659,13 +674,26 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
659
674
|
}[] | undefined;
|
660
675
|
}[];
|
661
676
|
type?: "create" | "update" | undefined;
|
662
|
-
basePath
|
677
|
+
basePath
|
678
|
+
/**
|
679
|
+
* Generates attribute mappings with post-import actions based on the provided attribute mappings.
|
680
|
+
* This method checks each mapping for a fileData attribute and adds a post-import action to create a file
|
681
|
+
* and update the field with the file's ID if necessary.
|
682
|
+
*
|
683
|
+
* @param attributeMappings - The attribute mappings from the import definition.
|
684
|
+
* @param context - The context object containing information about the database, collection, and document.
|
685
|
+
* @param item - The item being imported, used for resolving template paths in fileData mappings.
|
686
|
+
* @returns The attribute mappings updated with any necessary post-import actions.
|
687
|
+
*/
|
688
|
+
?: string | undefined;
|
663
689
|
idMappings?: {
|
664
690
|
sourceField: string;
|
665
691
|
targetField: string;
|
666
692
|
targetCollection: string;
|
667
693
|
fieldToSet?: string | undefined;
|
694
|
+
targetFieldToMatch?: string | undefined;
|
668
695
|
}[] | undefined;
|
696
|
+
createUsers?: boolean | null | undefined;
|
669
697
|
updateMapping?: {
|
670
698
|
targetField: string;
|
671
699
|
originalIdField: string;
|
@@ -681,82 +709,82 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
681
709
|
attributes?: ({
|
682
710
|
key: string;
|
683
711
|
type?: "string" | undefined;
|
712
|
+
format?: string | null | undefined;
|
713
|
+
description?: string | Record<string, string> | undefined;
|
714
|
+
required?: boolean | undefined;
|
684
715
|
array?: boolean | undefined;
|
685
716
|
error?: string | undefined;
|
686
|
-
required?: boolean | undefined;
|
687
717
|
size?: number | undefined;
|
688
718
|
xdefault?: string | null | undefined;
|
689
719
|
encrypted?: boolean | undefined;
|
690
|
-
format?: string | null | undefined;
|
691
|
-
description?: string | Record<string, string> | undefined;
|
692
720
|
} | {
|
693
721
|
key: string;
|
694
722
|
type?: "integer" | undefined;
|
723
|
+
description?: string | Record<string, string> | null | undefined;
|
724
|
+
required?: boolean | undefined;
|
695
725
|
array?: boolean | undefined;
|
696
726
|
error?: string | undefined;
|
697
|
-
required?: boolean | undefined;
|
698
727
|
xdefault?: number | null | undefined;
|
699
|
-
description?: string | Record<string, string> | null | undefined;
|
700
728
|
min?: number | undefined;
|
701
729
|
max?: number | undefined;
|
702
730
|
} | {
|
703
731
|
key: string;
|
704
732
|
type?: "float" | undefined;
|
733
|
+
description?: string | Record<string, string> | null | undefined;
|
734
|
+
required?: boolean | undefined;
|
705
735
|
array?: boolean | undefined;
|
706
736
|
error?: string | undefined;
|
707
|
-
required?: boolean | undefined;
|
708
737
|
xdefault?: number | null | undefined;
|
709
|
-
description?: string | Record<string, string> | null | undefined;
|
710
738
|
min?: number | undefined;
|
711
739
|
max?: number | undefined;
|
712
740
|
} | {
|
713
741
|
key: string;
|
714
742
|
type?: "boolean" | undefined;
|
743
|
+
description?: string | Record<string, string> | null | undefined;
|
744
|
+
required?: boolean | undefined;
|
715
745
|
array?: boolean | undefined;
|
716
746
|
error?: string | undefined;
|
717
|
-
required?: boolean | undefined;
|
718
747
|
xdefault?: boolean | null | undefined;
|
719
|
-
description?: string | Record<string, string> | null | undefined;
|
720
748
|
} | {
|
721
749
|
key: string;
|
722
750
|
type?: "datetime" | undefined;
|
751
|
+
description?: string | Record<string, string> | null | undefined;
|
752
|
+
required?: boolean | undefined;
|
723
753
|
array?: boolean | undefined;
|
724
754
|
error?: string | undefined;
|
725
|
-
required?: boolean | undefined;
|
726
755
|
xdefault?: string | null | undefined;
|
727
|
-
description?: string | Record<string, string> | null | undefined;
|
728
756
|
} | {
|
729
757
|
key: string;
|
730
758
|
type?: "email" | undefined;
|
759
|
+
description?: string | Record<string, string> | null | undefined;
|
760
|
+
required?: boolean | undefined;
|
731
761
|
array?: boolean | undefined;
|
732
762
|
error?: string | undefined;
|
733
|
-
required?: boolean | undefined;
|
734
763
|
xdefault?: string | null | undefined;
|
735
|
-
description?: string | Record<string, string> | null | undefined;
|
736
764
|
} | {
|
737
765
|
type: "ip";
|
738
766
|
key: string;
|
767
|
+
description?: string | Record<string, string> | null | undefined;
|
768
|
+
required?: boolean | undefined;
|
739
769
|
array?: boolean | undefined;
|
740
770
|
error?: string | undefined;
|
741
|
-
required?: boolean | undefined;
|
742
771
|
xdefault?: string | null | undefined;
|
743
|
-
description?: string | Record<string, string> | null | undefined;
|
744
772
|
} | {
|
745
773
|
key: string;
|
746
774
|
type?: "url" | undefined;
|
775
|
+
description?: string | Record<string, string> | null | undefined;
|
776
|
+
required?: boolean | undefined;
|
747
777
|
array?: boolean | undefined;
|
748
778
|
error?: string | undefined;
|
749
|
-
required?: boolean | undefined;
|
750
779
|
xdefault?: string | null | undefined;
|
751
|
-
description?: string | Record<string, string> | null | undefined;
|
752
780
|
} | {
|
753
781
|
key: string;
|
754
782
|
type?: "enum" | undefined;
|
783
|
+
description?: string | Record<string, string> | null | undefined;
|
784
|
+
required?: boolean | undefined;
|
755
785
|
array?: boolean | undefined;
|
756
786
|
error?: string | undefined;
|
757
|
-
required?: boolean | undefined;
|
758
787
|
xdefault?: string | null | undefined;
|
759
|
-
description?: string | Record<string, string> | null | undefined;
|
760
788
|
elements?: string[] | undefined;
|
761
789
|
} | {
|
762
790
|
key: string;
|
@@ -766,10 +794,10 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
766
794
|
twoWayKey: string;
|
767
795
|
side: "parent" | "child";
|
768
796
|
type?: "relationship" | undefined;
|
797
|
+
description?: string | Record<string, string> | null | undefined;
|
798
|
+
required?: boolean | undefined;
|
769
799
|
array?: boolean | undefined;
|
770
800
|
error?: string | undefined;
|
771
|
-
required?: boolean | undefined;
|
772
|
-
description?: string | Record<string, string> | null | undefined;
|
773
801
|
onDelete?: "setNull" | "cascade" | "restrict" | undefined;
|
774
802
|
importMapping?: {
|
775
803
|
originalIdField: string;
|
@@ -797,6 +825,7 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
797
825
|
targetKey: string;
|
798
826
|
oldKey?: string | undefined;
|
799
827
|
oldKeys?: string[] | undefined;
|
828
|
+
valueToSet?: any;
|
800
829
|
fileData?: {
|
801
830
|
path: string;
|
802
831
|
name: string;
|
@@ -819,7 +848,9 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
819
848
|
targetField: string;
|
820
849
|
targetCollection: string;
|
821
850
|
fieldToSet?: string | undefined;
|
851
|
+
targetFieldToMatch?: string | undefined;
|
822
852
|
}[] | undefined;
|
853
|
+
createUsers?: boolean | null | undefined;
|
823
854
|
updateMapping?: {
|
824
855
|
targetField: string;
|
825
856
|
originalIdField: string;
|
@@ -839,6 +870,7 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
839
870
|
idMappings: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
840
871
|
sourceField: z.ZodString;
|
841
872
|
fieldToSet: z.ZodOptional<z.ZodString>;
|
873
|
+
targetFieldToMatch: z.ZodOptional<z.ZodString>;
|
842
874
|
targetField: z.ZodString;
|
843
875
|
targetCollection: z.ZodString;
|
844
876
|
}, "strip", z.ZodTypeAny, {
|
@@ -846,12 +878,15 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
846
878
|
targetField: string;
|
847
879
|
targetCollection: string;
|
848
880
|
fieldToSet?: string | undefined;
|
881
|
+
targetFieldToMatch?: string | undefined;
|
849
882
|
}, {
|
850
883
|
sourceField: string;
|
851
884
|
targetField: string;
|
852
885
|
targetCollection: string;
|
853
886
|
fieldToSet?: string | undefined;
|
887
|
+
targetFieldToMatch?: string | undefined;
|
854
888
|
}>, "many">>;
|
889
|
+
createUsers: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodBoolean>>>;
|
855
890
|
updateMapping: z.ZodOptional<z.ZodObject<{
|
856
891
|
originalIdField: z.ZodString;
|
857
892
|
targetField: z.ZodString;
|
@@ -866,6 +901,7 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
866
901
|
oldKey: z.ZodOptional<z.ZodString>;
|
867
902
|
oldKeys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
868
903
|
targetKey: z.ZodString;
|
904
|
+
valueToSet: z.ZodOptional<z.ZodAny>;
|
869
905
|
fileData: z.ZodOptional<z.ZodObject<{
|
870
906
|
name: z.ZodString;
|
871
907
|
path: z.ZodString;
|
@@ -901,6 +937,7 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
901
937
|
targetKey: string;
|
902
938
|
oldKey?: string | undefined;
|
903
939
|
oldKeys?: string[] | undefined;
|
940
|
+
valueToSet?: any;
|
904
941
|
fileData?: {
|
905
942
|
path: string;
|
906
943
|
name: string;
|
@@ -918,6 +955,7 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
918
955
|
targetKey: string;
|
919
956
|
oldKey?: string | undefined;
|
920
957
|
oldKeys?: string[] | undefined;
|
958
|
+
valueToSet?: any;
|
921
959
|
fileData?: {
|
922
960
|
path: string;
|
923
961
|
name: string;
|
@@ -939,6 +977,7 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
939
977
|
targetKey: string;
|
940
978
|
oldKey?: string | undefined;
|
941
979
|
oldKeys?: string[] | undefined;
|
980
|
+
valueToSet?: any;
|
942
981
|
fileData?: {
|
943
982
|
path: string;
|
944
983
|
name: string;
|
@@ -960,7 +999,9 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
960
999
|
targetField: string;
|
961
1000
|
targetCollection: string;
|
962
1001
|
fieldToSet?: string | undefined;
|
1002
|
+
targetFieldToMatch?: string | undefined;
|
963
1003
|
}[] | undefined;
|
1004
|
+
createUsers?: boolean | null | undefined;
|
964
1005
|
updateMapping?: {
|
965
1006
|
targetField: string;
|
966
1007
|
originalIdField: string;
|
@@ -971,6 +1012,7 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
971
1012
|
targetKey: string;
|
972
1013
|
oldKey?: string | undefined;
|
973
1014
|
oldKeys?: string[] | undefined;
|
1015
|
+
valueToSet?: any;
|
974
1016
|
fileData?: {
|
975
1017
|
path: string;
|
976
1018
|
name: string;
|
@@ -993,16 +1035,18 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
993
1035
|
targetField: string;
|
994
1036
|
targetCollection: string;
|
995
1037
|
fieldToSet?: string | undefined;
|
1038
|
+
targetFieldToMatch?: string | undefined;
|
996
1039
|
}[] | undefined;
|
1040
|
+
createUsers?: boolean | null | undefined;
|
997
1041
|
updateMapping?: {
|
998
1042
|
targetField: string;
|
999
1043
|
originalIdField: string;
|
1000
1044
|
} | undefined;
|
1001
1045
|
}>>;
|
1002
1046
|
}, "strip", z.ZodTypeAny, {
|
1003
|
-
context?: any;
|
1004
1047
|
rawData?: any;
|
1005
1048
|
finalData?: any;
|
1049
|
+
context?: any;
|
1006
1050
|
importDef?: {
|
1007
1051
|
filePath: string;
|
1008
1052
|
primaryKeyField: string;
|
@@ -1010,6 +1054,7 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
1010
1054
|
targetKey: string;
|
1011
1055
|
oldKey?: string | undefined;
|
1012
1056
|
oldKeys?: string[] | undefined;
|
1057
|
+
valueToSet?: any;
|
1013
1058
|
fileData?: {
|
1014
1059
|
path: string;
|
1015
1060
|
name: string;
|
@@ -1031,22 +1076,25 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
1031
1076
|
targetField: string;
|
1032
1077
|
targetCollection: string;
|
1033
1078
|
fieldToSet?: string | undefined;
|
1079
|
+
targetFieldToMatch?: string | undefined;
|
1034
1080
|
}[] | undefined;
|
1081
|
+
createUsers?: boolean | null | undefined;
|
1035
1082
|
updateMapping?: {
|
1036
1083
|
targetField: string;
|
1037
1084
|
originalIdField: string;
|
1038
1085
|
} | undefined;
|
1039
1086
|
} | undefined;
|
1040
1087
|
}, {
|
1041
|
-
context?: any;
|
1042
1088
|
rawData?: any;
|
1043
1089
|
finalData?: any;
|
1090
|
+
context?: any;
|
1044
1091
|
importDef?: {
|
1045
1092
|
filePath: string;
|
1046
1093
|
attributeMappings: {
|
1047
1094
|
targetKey: string;
|
1048
1095
|
oldKey?: string | undefined;
|
1049
1096
|
oldKeys?: string[] | undefined;
|
1097
|
+
valueToSet?: any;
|
1050
1098
|
fileData?: {
|
1051
1099
|
path: string;
|
1052
1100
|
name: string;
|
@@ -1069,7 +1117,9 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
1069
1117
|
targetField: string;
|
1070
1118
|
targetCollection: string;
|
1071
1119
|
fieldToSet?: string | undefined;
|
1120
|
+
targetFieldToMatch?: string | undefined;
|
1072
1121
|
}[] | undefined;
|
1122
|
+
createUsers?: boolean | null | undefined;
|
1073
1123
|
updateMapping?: {
|
1074
1124
|
targetField: string;
|
1075
1125
|
originalIdField: string;
|
@@ -1078,9 +1128,9 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
1078
1128
|
}>, "many">;
|
1079
1129
|
}, "strip", z.ZodTypeAny, {
|
1080
1130
|
data: {
|
1081
|
-
context?: any;
|
1082
1131
|
rawData?: any;
|
1083
1132
|
finalData?: any;
|
1133
|
+
context?: any;
|
1084
1134
|
importDef?: {
|
1085
1135
|
filePath: string;
|
1086
1136
|
primaryKeyField: string;
|
@@ -1088,6 +1138,7 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
1088
1138
|
targetKey: string;
|
1089
1139
|
oldKey?: string | undefined;
|
1090
1140
|
oldKeys?: string[] | undefined;
|
1141
|
+
valueToSet?: any;
|
1091
1142
|
fileData?: {
|
1092
1143
|
path: string;
|
1093
1144
|
name: string;
|
@@ -1109,7 +1160,9 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
1109
1160
|
targetField: string;
|
1110
1161
|
targetCollection: string;
|
1111
1162
|
fieldToSet?: string | undefined;
|
1163
|
+
targetFieldToMatch?: string | undefined;
|
1112
1164
|
}[] | undefined;
|
1165
|
+
createUsers?: boolean | null | undefined;
|
1113
1166
|
updateMapping?: {
|
1114
1167
|
targetField: string;
|
1115
1168
|
originalIdField: string;
|
@@ -1122,82 +1175,82 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
1122
1175
|
type: "string";
|
1123
1176
|
key: string;
|
1124
1177
|
size: number;
|
1178
|
+
format?: string | null | undefined;
|
1179
|
+
description?: string | Record<string, string> | undefined;
|
1180
|
+
required?: boolean | undefined;
|
1125
1181
|
array?: boolean | undefined;
|
1126
1182
|
error?: string | undefined;
|
1127
|
-
required?: boolean | undefined;
|
1128
1183
|
xdefault?: string | null | undefined;
|
1129
1184
|
encrypted?: boolean | undefined;
|
1130
|
-
format?: string | null | undefined;
|
1131
|
-
description?: string | Record<string, string> | undefined;
|
1132
1185
|
} | {
|
1133
1186
|
type: "integer";
|
1134
1187
|
key: string;
|
1188
|
+
description?: string | Record<string, string> | null | undefined;
|
1189
|
+
required?: boolean | undefined;
|
1135
1190
|
array?: boolean | undefined;
|
1136
1191
|
error?: string | undefined;
|
1137
|
-
required?: boolean | undefined;
|
1138
1192
|
xdefault?: number | null | undefined;
|
1139
|
-
description?: string | Record<string, string> | null | undefined;
|
1140
1193
|
min?: number | undefined;
|
1141
1194
|
max?: number | undefined;
|
1142
1195
|
} | {
|
1143
1196
|
type: "float";
|
1144
1197
|
key: string;
|
1198
|
+
description?: string | Record<string, string> | null | undefined;
|
1199
|
+
required?: boolean | undefined;
|
1145
1200
|
array?: boolean | undefined;
|
1146
1201
|
error?: string | undefined;
|
1147
|
-
required?: boolean | undefined;
|
1148
1202
|
xdefault?: number | null | undefined;
|
1149
|
-
description?: string | Record<string, string> | null | undefined;
|
1150
1203
|
min?: number | undefined;
|
1151
1204
|
max?: number | undefined;
|
1152
1205
|
} | {
|
1153
1206
|
type: "boolean";
|
1154
1207
|
key: string;
|
1208
|
+
description?: string | Record<string, string> | null | undefined;
|
1209
|
+
required?: boolean | undefined;
|
1155
1210
|
array?: boolean | undefined;
|
1156
1211
|
error?: string | undefined;
|
1157
|
-
required?: boolean | undefined;
|
1158
1212
|
xdefault?: boolean | null | undefined;
|
1159
|
-
description?: string | Record<string, string> | null | undefined;
|
1160
1213
|
} | {
|
1161
1214
|
type: "datetime";
|
1162
1215
|
key: string;
|
1216
|
+
description?: string | Record<string, string> | null | undefined;
|
1217
|
+
required?: boolean | undefined;
|
1163
1218
|
array?: boolean | undefined;
|
1164
1219
|
error?: string | undefined;
|
1165
|
-
required?: boolean | undefined;
|
1166
1220
|
xdefault?: string | null | undefined;
|
1167
|
-
description?: string | Record<string, string> | null | undefined;
|
1168
1221
|
} | {
|
1169
1222
|
type: "email";
|
1170
1223
|
key: string;
|
1224
|
+
description?: string | Record<string, string> | null | undefined;
|
1225
|
+
required?: boolean | undefined;
|
1171
1226
|
array?: boolean | undefined;
|
1172
1227
|
error?: string | undefined;
|
1173
|
-
required?: boolean | undefined;
|
1174
1228
|
xdefault?: string | null | undefined;
|
1175
|
-
description?: string | Record<string, string> | null | undefined;
|
1176
1229
|
} | {
|
1177
1230
|
type: "ip";
|
1178
1231
|
key: string;
|
1232
|
+
description?: string | Record<string, string> | null | undefined;
|
1233
|
+
required?: boolean | undefined;
|
1179
1234
|
array?: boolean | undefined;
|
1180
1235
|
error?: string | undefined;
|
1181
|
-
required?: boolean | undefined;
|
1182
1236
|
xdefault?: string | null | undefined;
|
1183
|
-
description?: string | Record<string, string> | null | undefined;
|
1184
1237
|
} | {
|
1185
1238
|
type: "url";
|
1186
1239
|
key: string;
|
1240
|
+
description?: string | Record<string, string> | null | undefined;
|
1241
|
+
required?: boolean | undefined;
|
1187
1242
|
array?: boolean | undefined;
|
1188
1243
|
error?: string | undefined;
|
1189
|
-
required?: boolean | undefined;
|
1190
1244
|
xdefault?: string | null | undefined;
|
1191
|
-
description?: string | Record<string, string> | null | undefined;
|
1192
1245
|
} | {
|
1193
1246
|
type: "enum";
|
1194
1247
|
key: string;
|
1195
1248
|
elements: string[];
|
1249
|
+
description?: string | Record<string, string> | null | undefined;
|
1250
|
+
required?: boolean | undefined;
|
1196
1251
|
array?: boolean | undefined;
|
1197
1252
|
error?: string | undefined;
|
1198
|
-
required?: boolean | undefined;
|
1199
1253
|
xdefault?: string | null | undefined;
|
1200
|
-
description?: string | Record<string, string> | null | undefined;
|
1201
1254
|
} | {
|
1202
1255
|
type: "relationship";
|
1203
1256
|
key: string;
|
@@ -1207,10 +1260,10 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
1207
1260
|
twoWayKey: string;
|
1208
1261
|
onDelete: "setNull" | "cascade" | "restrict";
|
1209
1262
|
side: "parent" | "child";
|
1263
|
+
description?: string | Record<string, string> | null | undefined;
|
1264
|
+
required?: boolean | undefined;
|
1210
1265
|
array?: boolean | undefined;
|
1211
1266
|
error?: string | undefined;
|
1212
|
-
required?: boolean | undefined;
|
1213
|
-
description?: string | Record<string, string> | null | undefined;
|
1214
1267
|
importMapping?: {
|
1215
1268
|
originalIdField: string;
|
1216
1269
|
targetField?: string | undefined;
|
@@ -1236,6 +1289,7 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
1236
1289
|
targetKey: string;
|
1237
1290
|
oldKey?: string | undefined;
|
1238
1291
|
oldKeys?: string[] | undefined;
|
1292
|
+
valueToSet?: any;
|
1239
1293
|
fileData?: {
|
1240
1294
|
path: string;
|
1241
1295
|
name: string;
|
@@ -1251,13 +1305,26 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
1251
1305
|
}[] | undefined;
|
1252
1306
|
}[];
|
1253
1307
|
type?: "create" | "update" | undefined;
|
1254
|
-
basePath
|
1308
|
+
basePath
|
1309
|
+
/**
|
1310
|
+
* Generates attribute mappings with post-import actions based on the provided attribute mappings.
|
1311
|
+
* This method checks each mapping for a fileData attribute and adds a post-import action to create a file
|
1312
|
+
* and update the field with the file's ID if necessary.
|
1313
|
+
*
|
1314
|
+
* @param attributeMappings - The attribute mappings from the import definition.
|
1315
|
+
* @param context - The context object containing information about the database, collection, and document.
|
1316
|
+
* @param item - The item being imported, used for resolving template paths in fileData mappings.
|
1317
|
+
* @returns The attribute mappings updated with any necessary post-import actions.
|
1318
|
+
*/
|
1319
|
+
?: string | undefined;
|
1255
1320
|
idMappings?: {
|
1256
1321
|
sourceField: string;
|
1257
1322
|
targetField: string;
|
1258
1323
|
targetCollection: string;
|
1259
1324
|
fieldToSet?: string | undefined;
|
1325
|
+
targetFieldToMatch?: string | undefined;
|
1260
1326
|
}[] | undefined;
|
1327
|
+
createUsers?: boolean | null | undefined;
|
1261
1328
|
updateMapping?: {
|
1262
1329
|
targetField: string;
|
1263
1330
|
originalIdField: string;
|
@@ -1270,15 +1337,16 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
1270
1337
|
} | undefined;
|
1271
1338
|
}, {
|
1272
1339
|
data: {
|
1273
|
-
context?: any;
|
1274
1340
|
rawData?: any;
|
1275
1341
|
finalData?: any;
|
1342
|
+
context?: any;
|
1276
1343
|
importDef?: {
|
1277
1344
|
filePath: string;
|
1278
1345
|
attributeMappings: {
|
1279
1346
|
targetKey: string;
|
1280
1347
|
oldKey?: string | undefined;
|
1281
1348
|
oldKeys?: string[] | undefined;
|
1349
|
+
valueToSet?: any;
|
1282
1350
|
fileData?: {
|
1283
1351
|
path: string;
|
1284
1352
|
name: string;
|
@@ -1301,7 +1369,9 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
1301
1369
|
targetField: string;
|
1302
1370
|
targetCollection: string;
|
1303
1371
|
fieldToSet?: string | undefined;
|
1372
|
+
targetFieldToMatch?: string | undefined;
|
1304
1373
|
}[] | undefined;
|
1374
|
+
createUsers?: boolean | null | undefined;
|
1305
1375
|
updateMapping?: {
|
1306
1376
|
targetField: string;
|
1307
1377
|
originalIdField: string;
|
@@ -1314,82 +1384,82 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
1314
1384
|
attributes?: ({
|
1315
1385
|
key: string;
|
1316
1386
|
type?: "string" | undefined;
|
1387
|
+
format?: string | null | undefined;
|
1388
|
+
description?: string | Record<string, string> | undefined;
|
1389
|
+
required?: boolean | undefined;
|
1317
1390
|
array?: boolean | undefined;
|
1318
1391
|
error?: string | undefined;
|
1319
|
-
required?: boolean | undefined;
|
1320
1392
|
size?: number | undefined;
|
1321
1393
|
xdefault?: string | null | undefined;
|
1322
1394
|
encrypted?: boolean | undefined;
|
1323
|
-
format?: string | null | undefined;
|
1324
|
-
description?: string | Record<string, string> | undefined;
|
1325
1395
|
} | {
|
1326
1396
|
key: string;
|
1327
1397
|
type?: "integer" | undefined;
|
1398
|
+
description?: string | Record<string, string> | null | undefined;
|
1399
|
+
required?: boolean | undefined;
|
1328
1400
|
array?: boolean | undefined;
|
1329
1401
|
error?: string | undefined;
|
1330
|
-
required?: boolean | undefined;
|
1331
1402
|
xdefault?: number | null | undefined;
|
1332
|
-
description?: string | Record<string, string> | null | undefined;
|
1333
1403
|
min?: number | undefined;
|
1334
1404
|
max?: number | undefined;
|
1335
1405
|
} | {
|
1336
1406
|
key: string;
|
1337
1407
|
type?: "float" | undefined;
|
1408
|
+
description?: string | Record<string, string> | null | undefined;
|
1409
|
+
required?: boolean | undefined;
|
1338
1410
|
array?: boolean | undefined;
|
1339
1411
|
error?: string | undefined;
|
1340
|
-
required?: boolean | undefined;
|
1341
1412
|
xdefault?: number | null | undefined;
|
1342
|
-
description?: string | Record<string, string> | null | undefined;
|
1343
1413
|
min?: number | undefined;
|
1344
1414
|
max?: number | undefined;
|
1345
1415
|
} | {
|
1346
1416
|
key: string;
|
1347
1417
|
type?: "boolean" | undefined;
|
1418
|
+
description?: string | Record<string, string> | null | undefined;
|
1419
|
+
required?: boolean | undefined;
|
1348
1420
|
array?: boolean | undefined;
|
1349
1421
|
error?: string | undefined;
|
1350
|
-
required?: boolean | undefined;
|
1351
1422
|
xdefault?: boolean | null | undefined;
|
1352
|
-
description?: string | Record<string, string> | null | undefined;
|
1353
1423
|
} | {
|
1354
1424
|
key: string;
|
1355
1425
|
type?: "datetime" | undefined;
|
1426
|
+
description?: string | Record<string, string> | null | undefined;
|
1427
|
+
required?: boolean | undefined;
|
1356
1428
|
array?: boolean | undefined;
|
1357
1429
|
error?: string | undefined;
|
1358
|
-
required?: boolean | undefined;
|
1359
1430
|
xdefault?: string | null | undefined;
|
1360
|
-
description?: string | Record<string, string> | null | undefined;
|
1361
1431
|
} | {
|
1362
1432
|
key: string;
|
1363
1433
|
type?: "email" | undefined;
|
1434
|
+
description?: string | Record<string, string> | null | undefined;
|
1435
|
+
required?: boolean | undefined;
|
1364
1436
|
array?: boolean | undefined;
|
1365
1437
|
error?: string | undefined;
|
1366
|
-
required?: boolean | undefined;
|
1367
1438
|
xdefault?: string | null | undefined;
|
1368
|
-
description?: string | Record<string, string> | null | undefined;
|
1369
1439
|
} | {
|
1370
1440
|
type: "ip";
|
1371
1441
|
key: string;
|
1442
|
+
description?: string | Record<string, string> | null | undefined;
|
1443
|
+
required?: boolean | undefined;
|
1372
1444
|
array?: boolean | undefined;
|
1373
1445
|
error?: string | undefined;
|
1374
|
-
required?: boolean | undefined;
|
1375
1446
|
xdefault?: string | null | undefined;
|
1376
|
-
description?: string | Record<string, string> | null | undefined;
|
1377
1447
|
} | {
|
1378
1448
|
key: string;
|
1379
1449
|
type?: "url" | undefined;
|
1450
|
+
description?: string | Record<string, string> | null | undefined;
|
1451
|
+
required?: boolean | undefined;
|
1380
1452
|
array?: boolean | undefined;
|
1381
1453
|
error?: string | undefined;
|
1382
|
-
required?: boolean | undefined;
|
1383
1454
|
xdefault?: string | null | undefined;
|
1384
|
-
description?: string | Record<string, string> | null | undefined;
|
1385
1455
|
} | {
|
1386
1456
|
key: string;
|
1387
1457
|
type?: "enum" | undefined;
|
1458
|
+
description?: string | Record<string, string> | null | undefined;
|
1459
|
+
required?: boolean | undefined;
|
1388
1460
|
array?: boolean | undefined;
|
1389
1461
|
error?: string | undefined;
|
1390
|
-
required?: boolean | undefined;
|
1391
1462
|
xdefault?: string | null | undefined;
|
1392
|
-
description?: string | Record<string, string> | null | undefined;
|
1393
1463
|
elements?: string[] | undefined;
|
1394
1464
|
} | {
|
1395
1465
|
key: string;
|
@@ -1399,10 +1469,10 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
1399
1469
|
twoWayKey: string;
|
1400
1470
|
side: "parent" | "child";
|
1401
1471
|
type?: "relationship" | undefined;
|
1472
|
+
description?: string | Record<string, string> | null | undefined;
|
1473
|
+
required?: boolean | undefined;
|
1402
1474
|
array?: boolean | undefined;
|
1403
1475
|
error?: string | undefined;
|
1404
|
-
required?: boolean | undefined;
|
1405
|
-
description?: string | Record<string, string> | null | undefined;
|
1406
1476
|
onDelete?: "setNull" | "cascade" | "restrict" | undefined;
|
1407
1477
|
importMapping?: {
|
1408
1478
|
originalIdField: string;
|
@@ -1430,6 +1500,7 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
1430
1500
|
targetKey: string;
|
1431
1501
|
oldKey?: string | undefined;
|
1432
1502
|
oldKeys?: string[] | undefined;
|
1503
|
+
valueToSet?: any;
|
1433
1504
|
fileData?: {
|
1434
1505
|
path: string;
|
1435
1506
|
name: string;
|
@@ -1452,7 +1523,9 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
1452
1523
|
targetField: string;
|
1453
1524
|
targetCollection: string;
|
1454
1525
|
fieldToSet?: string | undefined;
|
1526
|
+
targetFieldToMatch?: string | undefined;
|
1455
1527
|
}[] | undefined;
|
1528
|
+
createUsers?: boolean | null | undefined;
|
1456
1529
|
updateMapping?: {
|
1457
1530
|
targetField: string;
|
1458
1531
|
originalIdField: string;
|
@@ -1470,9 +1543,9 @@ export declare class DataLoader {
|
|
1470
1543
|
private config;
|
1471
1544
|
importMap: Map<string, {
|
1472
1545
|
data: {
|
1473
|
-
context?: any;
|
1474
1546
|
rawData?: any;
|
1475
1547
|
finalData?: any;
|
1548
|
+
context?: any;
|
1476
1549
|
importDef?: {
|
1477
1550
|
filePath: string;
|
1478
1551
|
primaryKeyField: string;
|
@@ -1480,6 +1553,7 @@ export declare class DataLoader {
|
|
1480
1553
|
targetKey: string;
|
1481
1554
|
oldKey?: string | undefined;
|
1482
1555
|
oldKeys?: string[] | undefined;
|
1556
|
+
valueToSet?: any;
|
1483
1557
|
fileData?: {
|
1484
1558
|
path: string;
|
1485
1559
|
name: string;
|
@@ -1501,7 +1575,9 @@ export declare class DataLoader {
|
|
1501
1575
|
targetField: string;
|
1502
1576
|
targetCollection: string;
|
1503
1577
|
fieldToSet?: string | undefined;
|
1578
|
+
targetFieldToMatch?: string | undefined;
|
1504
1579
|
}[] | undefined;
|
1580
|
+
createUsers?: boolean | null | undefined;
|
1505
1581
|
updateMapping?: {
|
1506
1582
|
targetField: string;
|
1507
1583
|
originalIdField: string;
|
@@ -1514,82 +1590,82 @@ export declare class DataLoader {
|
|
1514
1590
|
type: "string";
|
1515
1591
|
key: string;
|
1516
1592
|
size: number;
|
1593
|
+
format?: string | null | undefined;
|
1594
|
+
description?: string | Record<string, string> | undefined;
|
1595
|
+
required?: boolean | undefined;
|
1517
1596
|
array?: boolean | undefined;
|
1518
1597
|
error?: string | undefined;
|
1519
|
-
required?: boolean | undefined;
|
1520
1598
|
xdefault?: string | null | undefined;
|
1521
1599
|
encrypted?: boolean | undefined;
|
1522
|
-
format?: string | null | undefined;
|
1523
|
-
description?: string | Record<string, string> | undefined;
|
1524
1600
|
} | {
|
1525
1601
|
type: "integer";
|
1526
1602
|
key: string;
|
1603
|
+
description?: string | Record<string, string> | null | undefined;
|
1604
|
+
required?: boolean | undefined;
|
1527
1605
|
array?: boolean | undefined;
|
1528
1606
|
error?: string | undefined;
|
1529
|
-
required?: boolean | undefined;
|
1530
1607
|
xdefault?: number | null | undefined;
|
1531
|
-
description?: string | Record<string, string> | null | undefined;
|
1532
1608
|
min?: number | undefined;
|
1533
1609
|
max?: number | undefined;
|
1534
1610
|
} | {
|
1535
1611
|
type: "float";
|
1536
1612
|
key: string;
|
1613
|
+
description?: string | Record<string, string> | null | undefined;
|
1614
|
+
required?: boolean | undefined;
|
1537
1615
|
array?: boolean | undefined;
|
1538
1616
|
error?: string | undefined;
|
1539
|
-
required?: boolean | undefined;
|
1540
1617
|
xdefault?: number | null | undefined;
|
1541
|
-
description?: string | Record<string, string> | null | undefined;
|
1542
1618
|
min?: number | undefined;
|
1543
1619
|
max?: number | undefined;
|
1544
1620
|
} | {
|
1545
1621
|
type: "boolean";
|
1546
1622
|
key: string;
|
1623
|
+
description?: string | Record<string, string> | null | undefined;
|
1624
|
+
required?: boolean | undefined;
|
1547
1625
|
array?: boolean | undefined;
|
1548
1626
|
error?: string | undefined;
|
1549
|
-
required?: boolean | undefined;
|
1550
1627
|
xdefault?: boolean | null | undefined;
|
1551
|
-
description?: string | Record<string, string> | null | undefined;
|
1552
1628
|
} | {
|
1553
1629
|
type: "datetime";
|
1554
1630
|
key: string;
|
1631
|
+
description?: string | Record<string, string> | null | undefined;
|
1632
|
+
required?: boolean | undefined;
|
1555
1633
|
array?: boolean | undefined;
|
1556
1634
|
error?: string | undefined;
|
1557
|
-
required?: boolean | undefined;
|
1558
1635
|
xdefault?: string | null | undefined;
|
1559
|
-
description?: string | Record<string, string> | null | undefined;
|
1560
1636
|
} | {
|
1561
1637
|
type: "email";
|
1562
1638
|
key: string;
|
1639
|
+
description?: string | Record<string, string> | null | undefined;
|
1640
|
+
required?: boolean | undefined;
|
1563
1641
|
array?: boolean | undefined;
|
1564
1642
|
error?: string | undefined;
|
1565
|
-
required?: boolean | undefined;
|
1566
1643
|
xdefault?: string | null | undefined;
|
1567
|
-
description?: string | Record<string, string> | null | undefined;
|
1568
1644
|
} | {
|
1569
1645
|
type: "ip";
|
1570
1646
|
key: string;
|
1647
|
+
description?: string | Record<string, string> | null | undefined;
|
1648
|
+
required?: boolean | undefined;
|
1571
1649
|
array?: boolean | undefined;
|
1572
1650
|
error?: string | undefined;
|
1573
|
-
required?: boolean | undefined;
|
1574
1651
|
xdefault?: string | null | undefined;
|
1575
|
-
description?: string | Record<string, string> | null | undefined;
|
1576
1652
|
} | {
|
1577
1653
|
type: "url";
|
1578
1654
|
key: string;
|
1655
|
+
description?: string | Record<string, string> | null | undefined;
|
1656
|
+
required?: boolean | undefined;
|
1579
1657
|
array?: boolean | undefined;
|
1580
1658
|
error?: string | undefined;
|
1581
|
-
required?: boolean | undefined;
|
1582
1659
|
xdefault?: string | null | undefined;
|
1583
|
-
description?: string | Record<string, string> | null | undefined;
|
1584
1660
|
} | {
|
1585
1661
|
type: "enum";
|
1586
1662
|
key: string;
|
1587
1663
|
elements: string[];
|
1664
|
+
description?: string | Record<string, string> | null | undefined;
|
1665
|
+
required?: boolean | undefined;
|
1588
1666
|
array?: boolean | undefined;
|
1589
1667
|
error?: string | undefined;
|
1590
|
-
required?: boolean | undefined;
|
1591
1668
|
xdefault?: string | null | undefined;
|
1592
|
-
description?: string | Record<string, string> | null | undefined;
|
1593
1669
|
} | {
|
1594
1670
|
type: "relationship";
|
1595
1671
|
key: string;
|
@@ -1599,10 +1675,10 @@ export declare class DataLoader {
|
|
1599
1675
|
twoWayKey: string;
|
1600
1676
|
onDelete: "setNull" | "cascade" | "restrict";
|
1601
1677
|
side: "parent" | "child";
|
1678
|
+
description?: string | Record<string, string> | null | undefined;
|
1679
|
+
required?: boolean | undefined;
|
1602
1680
|
array?: boolean | undefined;
|
1603
1681
|
error?: string | undefined;
|
1604
|
-
required?: boolean | undefined;
|
1605
|
-
description?: string | Record<string, string> | null | undefined;
|
1606
1682
|
importMapping?: {
|
1607
1683
|
originalIdField: string;
|
1608
1684
|
targetField?: string | undefined;
|
@@ -1628,6 +1704,7 @@ export declare class DataLoader {
|
|
1628
1704
|
targetKey: string;
|
1629
1705
|
oldKey?: string | undefined;
|
1630
1706
|
oldKeys?: string[] | undefined;
|
1707
|
+
valueToSet?: any;
|
1631
1708
|
fileData?: {
|
1632
1709
|
path: string;
|
1633
1710
|
name: string;
|
@@ -1643,13 +1720,26 @@ export declare class DataLoader {
|
|
1643
1720
|
}[] | undefined;
|
1644
1721
|
}[];
|
1645
1722
|
type?: "create" | "update" | undefined;
|
1646
|
-
basePath
|
1723
|
+
basePath
|
1724
|
+
/**
|
1725
|
+
* Generates attribute mappings with post-import actions based on the provided attribute mappings.
|
1726
|
+
* This method checks each mapping for a fileData attribute and adds a post-import action to create a file
|
1727
|
+
* and update the field with the file's ID if necessary.
|
1728
|
+
*
|
1729
|
+
* @param attributeMappings - The attribute mappings from the import definition.
|
1730
|
+
* @param context - The context object containing information about the database, collection, and document.
|
1731
|
+
* @param item - The item being imported, used for resolving template paths in fileData mappings.
|
1732
|
+
* @returns The attribute mappings updated with any necessary post-import actions.
|
1733
|
+
*/
|
1734
|
+
?: string | undefined;
|
1647
1735
|
idMappings?: {
|
1648
1736
|
sourceField: string;
|
1649
1737
|
targetField: string;
|
1650
1738
|
targetCollection: string;
|
1651
1739
|
fieldToSet?: string | undefined;
|
1740
|
+
targetFieldToMatch?: string | undefined;
|
1652
1741
|
}[] | undefined;
|
1742
|
+
createUsers?: boolean | null | undefined;
|
1653
1743
|
updateMapping?: {
|
1654
1744
|
targetField: string;
|
1655
1745
|
originalIdField: string;
|
@@ -1666,6 +1756,7 @@ export declare class DataLoader {
|
|
1666
1756
|
private mergedUserMap;
|
1667
1757
|
private emailToUserIdMap;
|
1668
1758
|
private phoneToUserIdMap;
|
1759
|
+
private userIdSet;
|
1669
1760
|
userExistsMap: Map<string, boolean>;
|
1670
1761
|
private shouldWriteFile;
|
1671
1762
|
constructor(appwriteFolderPath: string, importDataActions: ImportDataActions, database: Databases, config: AppwriteConfig, shouldWriteFile?: boolean);
|
@@ -1675,6 +1766,7 @@ export declare class DataLoader {
|
|
1675
1766
|
* It iterates through the target object's keys and updates the source object if:
|
1676
1767
|
* - The source object has the key.
|
1677
1768
|
* - The target object's value for that key is not null, undefined, or an empty string.
|
1769
|
+
* - If the target object has an array value, it concatenates the values and removes duplicates.
|
1678
1770
|
*
|
1679
1771
|
* @param source - The source object to be updated.
|
1680
1772
|
* @param target - The target object with values to update the source object.
|
@@ -1697,10 +1789,24 @@ export declare class DataLoader {
|
|
1697
1789
|
setupMaps(dbId: string): Promise<void>;
|
1698
1790
|
getAllUsers(): Promise<import("node-appwrite").Models.User<import("node-appwrite").Models.Preferences>[]>;
|
1699
1791
|
start(dbId: string): Promise<void>;
|
1700
|
-
|
1701
|
-
|
1702
|
-
|
1703
|
-
|
1792
|
+
/**
|
1793
|
+
* Deals with merged users by iterating through all collections in the configuration.
|
1794
|
+
* We have merged users if there are duplicate emails or phones in the import data.
|
1795
|
+
* This function will iterate through all collections that are the same name as the
|
1796
|
+
* users collection and pull out their primaryKeyField's. It will then loop through
|
1797
|
+
* each collection and find any documents that have a
|
1798
|
+
*
|
1799
|
+
* @return {void} This function does not return anything.
|
1800
|
+
*/
|
1801
|
+
/**
|
1802
|
+
* Gets the value to match for a given key in the final data or context.
|
1803
|
+
* @param finalData - The final data object.
|
1804
|
+
* @param context - The context object.
|
1805
|
+
* @param key - The key to get the value for.
|
1806
|
+
* @returns The value to match for from finalData or Context
|
1807
|
+
*/
|
1808
|
+
getValueFromData(finalData: any, context: any, key: string): any;
|
1809
|
+
updateOldReferencesForNew(): void;
|
1704
1810
|
private writeMapsToJsonFile;
|
1705
1811
|
/**
|
1706
1812
|
* Prepares user data by checking for duplicates based on email or phone, adding to a duplicate map if found,
|
@@ -1710,7 +1816,14 @@ export declare class DataLoader {
|
|
1710
1816
|
* @param attributeMappings - The attribute mappings for the item.
|
1711
1817
|
* @returns The transformed item with user-specific keys removed.
|
1712
1818
|
*/
|
1713
|
-
prepareUserData(item: any, attributeMappings: AttributeMappings, primaryKeyField: string, newId: string):
|
1819
|
+
prepareUserData(item: any, attributeMappings: AttributeMappings, primaryKeyField: string, newId: string): {
|
1820
|
+
transformedItem: any;
|
1821
|
+
existingId: string | undefined;
|
1822
|
+
userData: {
|
1823
|
+
rawData: any;
|
1824
|
+
finalData: z.infer<typeof AuthUserCreateSchema>;
|
1825
|
+
};
|
1826
|
+
};
|
1714
1827
|
/**
|
1715
1828
|
* Prepares the data for creating user collection documents.
|
1716
1829
|
* This involves loading the data, transforming it according to the import definition,
|
@@ -1757,6 +1870,7 @@ export declare class DataLoader {
|
|
1757
1870
|
targetKey: string;
|
1758
1871
|
oldKey?: string | undefined;
|
1759
1872
|
oldKeys?: string[] | undefined;
|
1873
|
+
valueToSet?: any;
|
1760
1874
|
fileData?: {
|
1761
1875
|
path: string;
|
1762
1876
|
name: string;
|
@@ -1778,6 +1892,7 @@ export declare class DataLoader {
|
|
1778
1892
|
targetKey: string;
|
1779
1893
|
oldKey?: string | undefined;
|
1780
1894
|
oldKeys?: string[] | undefined;
|
1895
|
+
valueToSet?: any;
|
1781
1896
|
fileData?: {
|
1782
1897
|
path: string;
|
1783
1898
|
name: string;
|