appwrite-utils-cli 0.0.286 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/README.md +122 -96
  2. package/dist/collections/attributes.d.ts +4 -0
  3. package/dist/collections/attributes.js +224 -0
  4. package/dist/collections/indexes.d.ts +4 -0
  5. package/dist/collections/indexes.js +27 -0
  6. package/dist/collections/methods.d.ts +16 -0
  7. package/dist/collections/methods.js +216 -0
  8. package/dist/databases/methods.d.ts +6 -0
  9. package/dist/databases/methods.js +33 -0
  10. package/dist/interactiveCLI.d.ts +19 -0
  11. package/dist/interactiveCLI.js +555 -0
  12. package/dist/main.js +227 -62
  13. package/dist/migrations/afterImportActions.js +37 -40
  14. package/dist/migrations/appwriteToX.d.ts +26 -25
  15. package/dist/migrations/appwriteToX.js +42 -6
  16. package/dist/migrations/attributes.js +21 -20
  17. package/dist/migrations/backup.d.ts +93 -87
  18. package/dist/migrations/collections.d.ts +6 -0
  19. package/dist/migrations/collections.js +149 -20
  20. package/dist/migrations/converters.d.ts +2 -18
  21. package/dist/migrations/converters.js +13 -2
  22. package/dist/migrations/dataLoader.d.ts +276 -161
  23. package/dist/migrations/dataLoader.js +535 -292
  24. package/dist/migrations/databases.js +8 -2
  25. package/dist/migrations/helper.d.ts +3 -0
  26. package/dist/migrations/helper.js +21 -0
  27. package/dist/migrations/importController.d.ts +5 -2
  28. package/dist/migrations/importController.js +125 -88
  29. package/dist/migrations/importDataActions.d.ts +9 -1
  30. package/dist/migrations/importDataActions.js +15 -3
  31. package/dist/migrations/indexes.js +3 -2
  32. package/dist/migrations/logging.js +20 -8
  33. package/dist/migrations/migrationHelper.d.ts +9 -4
  34. package/dist/migrations/migrationHelper.js +6 -5
  35. package/dist/migrations/openapi.d.ts +1 -1
  36. package/dist/migrations/openapi.js +33 -18
  37. package/dist/migrations/queue.js +3 -2
  38. package/dist/migrations/relationships.d.ts +2 -2
  39. package/dist/migrations/schemaStrings.js +53 -41
  40. package/dist/migrations/setupDatabase.d.ts +2 -4
  41. package/dist/migrations/setupDatabase.js +24 -105
  42. package/dist/migrations/storage.d.ts +3 -1
  43. package/dist/migrations/storage.js +110 -16
  44. package/dist/migrations/transfer.d.ts +30 -0
  45. package/dist/migrations/transfer.js +337 -0
  46. package/dist/migrations/users.d.ts +2 -1
  47. package/dist/migrations/users.js +78 -43
  48. package/dist/schemas/authUser.d.ts +2 -2
  49. package/dist/storage/methods.d.ts +15 -0
  50. package/dist/storage/methods.js +207 -0
  51. package/dist/storage/schemas.d.ts +687 -0
  52. package/dist/storage/schemas.js +175 -0
  53. package/dist/utils/getClientFromConfig.d.ts +4 -0
  54. package/dist/utils/getClientFromConfig.js +16 -0
  55. package/dist/utils/helperFunctions.d.ts +11 -1
  56. package/dist/utils/helperFunctions.js +38 -0
  57. package/dist/utils/retryFailedPromises.d.ts +2 -0
  58. package/dist/utils/retryFailedPromises.js +21 -0
  59. package/dist/utils/schemaStrings.d.ts +13 -0
  60. package/dist/utils/schemaStrings.js +403 -0
  61. package/dist/utils/setupFiles.js +110 -61
  62. package/dist/utilsController.d.ts +40 -22
  63. package/dist/utilsController.js +164 -84
  64. package/package.json +13 -15
  65. package/src/collections/attributes.ts +483 -0
  66. package/src/collections/indexes.ts +53 -0
  67. package/src/collections/methods.ts +331 -0
  68. package/src/databases/methods.ts +47 -0
  69. package/src/init.ts +64 -64
  70. package/src/interactiveCLI.ts +767 -0
  71. package/src/main.ts +292 -83
  72. package/src/migrations/afterImportActions.ts +553 -490
  73. package/src/migrations/appwriteToX.ts +237 -174
  74. package/src/migrations/attributes.ts +483 -422
  75. package/src/migrations/backup.ts +205 -205
  76. package/src/migrations/collections.ts +545 -300
  77. package/src/migrations/converters.ts +161 -150
  78. package/src/migrations/dataLoader.ts +1615 -1304
  79. package/src/migrations/databases.ts +44 -25
  80. package/src/migrations/dbHelpers.ts +92 -92
  81. package/src/migrations/helper.ts +40 -0
  82. package/src/migrations/importController.ts +448 -384
  83. package/src/migrations/importDataActions.ts +315 -307
  84. package/src/migrations/indexes.ts +40 -37
  85. package/src/migrations/logging.ts +29 -16
  86. package/src/migrations/migrationHelper.ts +207 -201
  87. package/src/migrations/openapi.ts +83 -70
  88. package/src/migrations/queue.ts +118 -119
  89. package/src/migrations/relationships.ts +324 -324
  90. package/src/migrations/schemaStrings.ts +472 -460
  91. package/src/migrations/setupDatabase.ts +118 -219
  92. package/src/migrations/storage.ts +538 -358
  93. package/src/migrations/transfer.ts +608 -0
  94. package/src/migrations/users.ts +362 -285
  95. package/src/migrations/validationRules.ts +63 -63
  96. package/src/schemas/authUser.ts +23 -23
  97. package/src/setup.ts +8 -8
  98. package/src/storage/methods.ts +371 -0
  99. package/src/storage/schemas.ts +205 -0
  100. package/src/types.ts +9 -9
  101. package/src/utils/getClientFromConfig.ts +17 -0
  102. package/src/utils/helperFunctions.ts +181 -127
  103. package/src/utils/index.ts +2 -2
  104. package/src/utils/loadConfigs.ts +59 -59
  105. package/src/utils/retryFailedPromises.ts +27 -0
  106. package/src/utils/schemaStrings.ts +473 -0
  107. package/src/utils/setupFiles.ts +228 -182
  108. package/src/utilsController.ts +325 -194
  109. package/tsconfig.json +37 -37
@@ -0,0 +1,687 @@
1
+ import { z } from "zod";
2
+ export declare const BackupSchema: z.ZodObject<{
3
+ $id: z.ZodString;
4
+ $createdAt: z.ZodString;
5
+ $updatedAt: z.ZodString;
6
+ database: z.ZodString;
7
+ collections: z.ZodArray<z.ZodString, "many">;
8
+ documents: z.ZodDefault<z.ZodArray<z.ZodObject<{
9
+ collectionId: z.ZodString;
10
+ data: z.ZodString;
11
+ }, "strip", z.ZodTypeAny, {
12
+ collectionId: string;
13
+ data: string;
14
+ }, {
15
+ collectionId: string;
16
+ data: string;
17
+ }>, "many">>;
18
+ }, "strip", z.ZodTypeAny, {
19
+ collections: string[];
20
+ documents: {
21
+ collectionId: string;
22
+ data: string;
23
+ }[];
24
+ $id: string;
25
+ $createdAt: string;
26
+ $updatedAt: string;
27
+ database: string;
28
+ }, {
29
+ collections: string[];
30
+ $id: string;
31
+ $createdAt: string;
32
+ $updatedAt: string;
33
+ database: string;
34
+ documents?: {
35
+ collectionId: string;
36
+ data: string;
37
+ }[] | undefined;
38
+ }>;
39
+ export type Backup = z.infer<typeof BackupSchema>;
40
+ export declare const BackupCreateSchema: z.ZodObject<Omit<{
41
+ $id: z.ZodString;
42
+ $createdAt: z.ZodString;
43
+ $updatedAt: z.ZodString;
44
+ database: z.ZodString;
45
+ collections: z.ZodArray<z.ZodString, "many">;
46
+ documents: z.ZodDefault<z.ZodArray<z.ZodObject<{
47
+ collectionId: z.ZodString;
48
+ data: z.ZodString;
49
+ }, "strip", z.ZodTypeAny, {
50
+ collectionId: string;
51
+ data: string;
52
+ }, {
53
+ collectionId: string;
54
+ data: string;
55
+ }>, "many">>;
56
+ }, "$id" | "$createdAt" | "$updatedAt">, "strip", z.ZodTypeAny, {
57
+ collections: string[];
58
+ documents: {
59
+ collectionId: string;
60
+ data: string;
61
+ }[];
62
+ database: string;
63
+ }, {
64
+ collections: string[];
65
+ database: string;
66
+ documents?: {
67
+ collectionId: string;
68
+ data: string;
69
+ }[] | undefined;
70
+ }>;
71
+ export type BackupCreate = z.infer<typeof BackupCreateSchema>;
72
+ export declare const BatchSchema: z.ZodObject<{
73
+ $id: z.ZodString;
74
+ $createdAt: z.ZodString;
75
+ $updatedAt: z.ZodString;
76
+ data: z.ZodString;
77
+ processed: z.ZodDefault<z.ZodBoolean>;
78
+ }, "strip", z.ZodTypeAny, {
79
+ $id: string;
80
+ $createdAt: string;
81
+ $updatedAt: string;
82
+ data: string;
83
+ processed: boolean;
84
+ }, {
85
+ $id: string;
86
+ $createdAt: string;
87
+ $updatedAt: string;
88
+ data: string;
89
+ processed?: boolean | undefined;
90
+ }>;
91
+ export type Batch = z.infer<typeof BatchSchema>;
92
+ export declare const BatchCreateSchema: z.ZodObject<Omit<{
93
+ $id: z.ZodString;
94
+ $createdAt: z.ZodString;
95
+ $updatedAt: z.ZodString;
96
+ data: z.ZodString;
97
+ processed: z.ZodDefault<z.ZodBoolean>;
98
+ }, "$id" | "$createdAt" | "$updatedAt">, "strip", z.ZodTypeAny, {
99
+ data: string;
100
+ processed: boolean;
101
+ }, {
102
+ data: string;
103
+ processed?: boolean | undefined;
104
+ }>;
105
+ export type BatchCreate = z.infer<typeof BatchCreateSchema>;
106
+ export declare const OperationSchema: z.ZodObject<{
107
+ $id: z.ZodString;
108
+ $createdAt: z.ZodString;
109
+ $updatedAt: z.ZodString;
110
+ operationType: z.ZodString;
111
+ collectionId: z.ZodString;
112
+ data: z.ZodAny;
113
+ batches: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
114
+ progress: z.ZodNumber;
115
+ total: z.ZodNumber;
116
+ error: z.ZodString;
117
+ status: z.ZodDefault<z.ZodEnum<["pending", "ready", "in_progress", "completed", "error", "cancelled"]>>;
118
+ }, "strip", z.ZodTypeAny, {
119
+ $id: string;
120
+ $createdAt: string;
121
+ $updatedAt: string;
122
+ status: "error" | "pending" | "ready" | "in_progress" | "completed" | "cancelled";
123
+ error: string;
124
+ collectionId: string;
125
+ operationType: string;
126
+ progress: number;
127
+ total: number;
128
+ data?: any;
129
+ batches?: string[] | undefined;
130
+ }, {
131
+ $id: string;
132
+ $createdAt: string;
133
+ $updatedAt: string;
134
+ error: string;
135
+ collectionId: string;
136
+ operationType: string;
137
+ progress: number;
138
+ total: number;
139
+ status?: "error" | "pending" | "ready" | "in_progress" | "completed" | "cancelled" | undefined;
140
+ data?: any;
141
+ batches?: string[] | undefined;
142
+ }>;
143
+ export type Operation = z.infer<typeof OperationSchema>;
144
+ export declare const OperationCreateSchema: z.ZodObject<Omit<{
145
+ $id: z.ZodString;
146
+ $createdAt: z.ZodString;
147
+ $updatedAt: z.ZodString;
148
+ operationType: z.ZodString;
149
+ collectionId: z.ZodString;
150
+ data: z.ZodAny;
151
+ batches: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
152
+ progress: z.ZodNumber;
153
+ total: z.ZodNumber;
154
+ error: z.ZodString;
155
+ status: z.ZodDefault<z.ZodEnum<["pending", "ready", "in_progress", "completed", "error", "cancelled"]>>;
156
+ }, "$id" | "$createdAt" | "$updatedAt">, "strip", z.ZodTypeAny, {
157
+ status: "error" | "pending" | "ready" | "in_progress" | "completed" | "cancelled";
158
+ error: string;
159
+ collectionId: string;
160
+ operationType: string;
161
+ progress: number;
162
+ total: number;
163
+ data?: any;
164
+ batches?: string[] | undefined;
165
+ }, {
166
+ error: string;
167
+ collectionId: string;
168
+ operationType: string;
169
+ progress: number;
170
+ total: number;
171
+ status?: "error" | "pending" | "ready" | "in_progress" | "completed" | "cancelled" | undefined;
172
+ data?: any;
173
+ batches?: string[] | undefined;
174
+ }>;
175
+ export type OperationCreate = z.infer<typeof OperationCreateSchema>;
176
+ export declare const getMigrationCollectionSchemas: () => {
177
+ CurrentOperations: {
178
+ collection: {
179
+ name: string;
180
+ attributes: ({
181
+ type: "string";
182
+ key: string;
183
+ size: number;
184
+ format?: string | null | undefined;
185
+ description?: string | Record<string, string> | undefined;
186
+ required?: boolean | undefined;
187
+ array?: boolean | undefined;
188
+ error?: string | undefined;
189
+ xdefault?: string | null | undefined;
190
+ encrypted?: boolean | undefined;
191
+ } | {
192
+ type: "integer";
193
+ key: string;
194
+ description?: string | Record<string, string> | null | undefined;
195
+ required?: boolean | undefined;
196
+ array?: boolean | undefined;
197
+ error?: string | undefined;
198
+ xdefault?: number | null | undefined;
199
+ min?: number | undefined;
200
+ max?: number | undefined;
201
+ } | {
202
+ type: "float";
203
+ key: string;
204
+ description?: string | Record<string, string> | null | undefined;
205
+ required?: boolean | undefined;
206
+ array?: boolean | undefined;
207
+ error?: string | undefined;
208
+ xdefault?: number | null | undefined;
209
+ min?: number | undefined;
210
+ max?: number | undefined;
211
+ } | {
212
+ type: "boolean";
213
+ key: string;
214
+ description?: string | Record<string, string> | null | undefined;
215
+ required?: boolean | undefined;
216
+ array?: boolean | undefined;
217
+ error?: string | undefined;
218
+ xdefault?: boolean | null | undefined;
219
+ } | {
220
+ type: "datetime";
221
+ key: string;
222
+ description?: string | Record<string, string> | null | undefined;
223
+ required?: boolean | undefined;
224
+ array?: boolean | undefined;
225
+ error?: string | undefined;
226
+ xdefault?: string | null | undefined;
227
+ } | {
228
+ type: "email";
229
+ key: string;
230
+ description?: string | Record<string, string> | null | undefined;
231
+ required?: boolean | undefined;
232
+ array?: boolean | undefined;
233
+ error?: string | undefined;
234
+ xdefault?: string | null | undefined;
235
+ } | {
236
+ type: "ip";
237
+ key: string;
238
+ description?: string | Record<string, string> | null | undefined;
239
+ required?: boolean | undefined;
240
+ array?: boolean | undefined;
241
+ error?: string | undefined;
242
+ xdefault?: string | null | undefined;
243
+ } | {
244
+ type: "url";
245
+ key: string;
246
+ description?: string | Record<string, string> | null | undefined;
247
+ required?: boolean | undefined;
248
+ array?: boolean | undefined;
249
+ error?: string | undefined;
250
+ xdefault?: string | null | undefined;
251
+ } | {
252
+ type: "enum";
253
+ key: string;
254
+ elements: string[];
255
+ description?: string | Record<string, string> | null | undefined;
256
+ required?: boolean | undefined;
257
+ array?: boolean | undefined;
258
+ error?: string | undefined;
259
+ xdefault?: string | null | undefined;
260
+ } | {
261
+ type: "relationship";
262
+ key: string;
263
+ relatedCollection: string;
264
+ relationType: "oneToMany" | "manyToOne" | "oneToOne" | "manyToMany";
265
+ twoWay: boolean;
266
+ twoWayKey: string;
267
+ onDelete: "setNull" | "cascade" | "restrict";
268
+ side: "parent" | "child";
269
+ description?: string | Record<string, string> | null | undefined;
270
+ required?: boolean | undefined;
271
+ array?: boolean | undefined;
272
+ error?: string | undefined;
273
+ importMapping?: {
274
+ originalIdField: string;
275
+ targetField?: string | undefined;
276
+ } | undefined;
277
+ })[];
278
+ $id: string;
279
+ $permissions: {
280
+ permission: string;
281
+ target: string;
282
+ }[];
283
+ indexes: {
284
+ type: "key" | "unique" | "fulltext";
285
+ key: string;
286
+ attributes: string[];
287
+ status?: string | undefined;
288
+ error?: string | undefined;
289
+ orders?: string[] | undefined;
290
+ }[];
291
+ importDefs: {
292
+ filePath: string;
293
+ primaryKeyField: string;
294
+ attributeMappings: {
295
+ targetKey: string;
296
+ oldKey?: string | undefined;
297
+ oldKeys?: string[] | undefined;
298
+ valueToSet?: any;
299
+ fileData?: {
300
+ path: string;
301
+ name: string;
302
+ } | undefined;
303
+ converters?: string[] | undefined;
304
+ validationActions?: {
305
+ params: string[];
306
+ action: string;
307
+ }[] | undefined;
308
+ postImportActions?: {
309
+ params: (string | Record<string, any>)[];
310
+ action: string;
311
+ }[] | undefined;
312
+ }[];
313
+ type?: "create" | "update" | undefined;
314
+ basePath?: string | undefined;
315
+ idMappings?: {
316
+ sourceField: string;
317
+ targetField: string;
318
+ targetCollection: string;
319
+ fieldToSet?: string | undefined;
320
+ targetFieldToMatch?: string | undefined;
321
+ }[] | undefined;
322
+ createUsers?: boolean | null | undefined;
323
+ updateMapping?: {
324
+ targetField: string;
325
+ originalIdField: string;
326
+ } | undefined;
327
+ }[];
328
+ description?: string | undefined;
329
+ enabled?: boolean | undefined;
330
+ documentSecurity?: boolean | undefined;
331
+ databaseId?: string | undefined;
332
+ };
333
+ attributes: ({
334
+ type: "string";
335
+ key: string;
336
+ size: number;
337
+ format?: string | null | undefined;
338
+ description?: string | Record<string, string> | undefined;
339
+ required?: boolean | undefined;
340
+ array?: boolean | undefined;
341
+ error?: string | undefined;
342
+ xdefault?: string | null | undefined;
343
+ encrypted?: boolean | undefined;
344
+ } | {
345
+ type: "integer";
346
+ key: string;
347
+ description?: string | Record<string, string> | null | undefined;
348
+ required?: boolean | undefined;
349
+ array?: boolean | undefined;
350
+ error?: string | undefined;
351
+ xdefault?: number | null | undefined;
352
+ min?: number | undefined;
353
+ max?: number | undefined;
354
+ } | {
355
+ type: "float";
356
+ key: string;
357
+ description?: string | Record<string, string> | null | undefined;
358
+ required?: boolean | undefined;
359
+ array?: boolean | undefined;
360
+ error?: string | undefined;
361
+ xdefault?: number | null | undefined;
362
+ min?: number | undefined;
363
+ max?: number | undefined;
364
+ } | {
365
+ type: "boolean";
366
+ key: string;
367
+ description?: string | Record<string, string> | null | undefined;
368
+ required?: boolean | undefined;
369
+ array?: boolean | undefined;
370
+ error?: string | undefined;
371
+ xdefault?: boolean | null | undefined;
372
+ } | {
373
+ type: "datetime";
374
+ key: string;
375
+ description?: string | Record<string, string> | null | undefined;
376
+ required?: boolean | undefined;
377
+ array?: boolean | undefined;
378
+ error?: string | undefined;
379
+ xdefault?: string | null | undefined;
380
+ } | {
381
+ type: "email";
382
+ key: string;
383
+ description?: string | Record<string, string> | null | undefined;
384
+ required?: boolean | undefined;
385
+ array?: boolean | undefined;
386
+ error?: string | undefined;
387
+ xdefault?: string | null | undefined;
388
+ } | {
389
+ type: "ip";
390
+ key: string;
391
+ description?: string | Record<string, string> | null | undefined;
392
+ required?: boolean | undefined;
393
+ array?: boolean | undefined;
394
+ error?: string | undefined;
395
+ xdefault?: string | null | undefined;
396
+ } | {
397
+ type: "url";
398
+ key: string;
399
+ description?: string | Record<string, string> | null | undefined;
400
+ required?: boolean | undefined;
401
+ array?: boolean | undefined;
402
+ error?: string | undefined;
403
+ xdefault?: string | null | undefined;
404
+ } | {
405
+ type: "enum";
406
+ key: string;
407
+ elements: string[];
408
+ description?: string | Record<string, string> | null | undefined;
409
+ required?: boolean | undefined;
410
+ array?: boolean | undefined;
411
+ error?: string | undefined;
412
+ xdefault?: string | null | undefined;
413
+ } | {
414
+ type: "relationship";
415
+ key: string;
416
+ relatedCollection: string;
417
+ relationType: "oneToMany" | "manyToOne" | "oneToOne" | "manyToMany";
418
+ twoWay: boolean;
419
+ twoWayKey: string;
420
+ onDelete: "setNull" | "cascade" | "restrict";
421
+ side: "parent" | "child";
422
+ description?: string | Record<string, string> | null | undefined;
423
+ required?: boolean | undefined;
424
+ array?: boolean | undefined;
425
+ error?: string | undefined;
426
+ importMapping?: {
427
+ originalIdField: string;
428
+ targetField?: string | undefined;
429
+ } | undefined;
430
+ })[];
431
+ };
432
+ Batches: {
433
+ collection: {
434
+ name: string;
435
+ attributes: ({
436
+ type: "string";
437
+ key: string;
438
+ size: number;
439
+ format?: string | null | undefined;
440
+ description?: string | Record<string, string> | undefined;
441
+ required?: boolean | undefined;
442
+ array?: boolean | undefined;
443
+ error?: string | undefined;
444
+ xdefault?: string | null | undefined;
445
+ encrypted?: boolean | undefined;
446
+ } | {
447
+ type: "integer";
448
+ key: string;
449
+ description?: string | Record<string, string> | null | undefined;
450
+ required?: boolean | undefined;
451
+ array?: boolean | undefined;
452
+ error?: string | undefined;
453
+ xdefault?: number | null | undefined;
454
+ min?: number | undefined;
455
+ max?: number | undefined;
456
+ } | {
457
+ type: "float";
458
+ key: string;
459
+ description?: string | Record<string, string> | null | undefined;
460
+ required?: boolean | undefined;
461
+ array?: boolean | undefined;
462
+ error?: string | undefined;
463
+ xdefault?: number | null | undefined;
464
+ min?: number | undefined;
465
+ max?: number | undefined;
466
+ } | {
467
+ type: "boolean";
468
+ key: string;
469
+ description?: string | Record<string, string> | null | undefined;
470
+ required?: boolean | undefined;
471
+ array?: boolean | undefined;
472
+ error?: string | undefined;
473
+ xdefault?: boolean | null | undefined;
474
+ } | {
475
+ type: "datetime";
476
+ key: string;
477
+ description?: string | Record<string, string> | null | undefined;
478
+ required?: boolean | undefined;
479
+ array?: boolean | undefined;
480
+ error?: string | undefined;
481
+ xdefault?: string | null | undefined;
482
+ } | {
483
+ type: "email";
484
+ key: string;
485
+ description?: string | Record<string, string> | null | undefined;
486
+ required?: boolean | undefined;
487
+ array?: boolean | undefined;
488
+ error?: string | undefined;
489
+ xdefault?: string | null | undefined;
490
+ } | {
491
+ type: "ip";
492
+ key: string;
493
+ description?: string | Record<string, string> | null | undefined;
494
+ required?: boolean | undefined;
495
+ array?: boolean | undefined;
496
+ error?: string | undefined;
497
+ xdefault?: string | null | undefined;
498
+ } | {
499
+ type: "url";
500
+ key: string;
501
+ description?: string | Record<string, string> | null | undefined;
502
+ required?: boolean | undefined;
503
+ array?: boolean | undefined;
504
+ error?: string | undefined;
505
+ xdefault?: string | null | undefined;
506
+ } | {
507
+ type: "enum";
508
+ key: string;
509
+ elements: string[];
510
+ description?: string | Record<string, string> | null | undefined;
511
+ required?: boolean | undefined;
512
+ array?: boolean | undefined;
513
+ error?: string | undefined;
514
+ xdefault?: string | null | undefined;
515
+ } | {
516
+ type: "relationship";
517
+ key: string;
518
+ relatedCollection: string;
519
+ relationType: "oneToMany" | "manyToOne" | "oneToOne" | "manyToMany";
520
+ twoWay: boolean;
521
+ twoWayKey: string;
522
+ onDelete: "setNull" | "cascade" | "restrict";
523
+ side: "parent" | "child";
524
+ description?: string | Record<string, string> | null | undefined;
525
+ required?: boolean | undefined;
526
+ array?: boolean | undefined;
527
+ error?: string | undefined;
528
+ importMapping?: {
529
+ originalIdField: string;
530
+ targetField?: string | undefined;
531
+ } | undefined;
532
+ })[];
533
+ $id: string;
534
+ $permissions: {
535
+ permission: string;
536
+ target: string;
537
+ }[];
538
+ indexes: {
539
+ type: "key" | "unique" | "fulltext";
540
+ key: string;
541
+ attributes: string[];
542
+ status?: string | undefined;
543
+ error?: string | undefined;
544
+ orders?: string[] | undefined;
545
+ }[];
546
+ importDefs: {
547
+ filePath: string;
548
+ primaryKeyField: string;
549
+ attributeMappings: {
550
+ targetKey: string;
551
+ oldKey?: string | undefined;
552
+ oldKeys?: string[] | undefined;
553
+ valueToSet?: any;
554
+ fileData?: {
555
+ path: string;
556
+ name: string;
557
+ } | undefined;
558
+ converters?: string[] | undefined;
559
+ validationActions?: {
560
+ params: string[];
561
+ action: string;
562
+ }[] | undefined;
563
+ postImportActions?: {
564
+ params: (string | Record<string, any>)[];
565
+ action: string;
566
+ }[] | undefined;
567
+ }[];
568
+ type?: "create" | "update" | undefined;
569
+ basePath?: string | undefined;
570
+ idMappings?: {
571
+ sourceField: string;
572
+ targetField: string;
573
+ targetCollection: string;
574
+ fieldToSet?: string | undefined;
575
+ targetFieldToMatch?: string | undefined;
576
+ }[] | undefined;
577
+ createUsers?: boolean | null | undefined;
578
+ updateMapping?: {
579
+ targetField: string;
580
+ originalIdField: string;
581
+ } | undefined;
582
+ }[];
583
+ description?: string | undefined;
584
+ enabled?: boolean | undefined;
585
+ documentSecurity?: boolean | undefined;
586
+ databaseId?: string | undefined;
587
+ };
588
+ attributes: ({
589
+ type: "string";
590
+ key: string;
591
+ size: number;
592
+ format?: string | null | undefined;
593
+ description?: string | Record<string, string> | undefined;
594
+ required?: boolean | undefined;
595
+ array?: boolean | undefined;
596
+ error?: string | undefined;
597
+ xdefault?: string | null | undefined;
598
+ encrypted?: boolean | undefined;
599
+ } | {
600
+ type: "integer";
601
+ key: string;
602
+ description?: string | Record<string, string> | null | undefined;
603
+ required?: boolean | undefined;
604
+ array?: boolean | undefined;
605
+ error?: string | undefined;
606
+ xdefault?: number | null | undefined;
607
+ min?: number | undefined;
608
+ max?: number | undefined;
609
+ } | {
610
+ type: "float";
611
+ key: string;
612
+ description?: string | Record<string, string> | null | undefined;
613
+ required?: boolean | undefined;
614
+ array?: boolean | undefined;
615
+ error?: string | undefined;
616
+ xdefault?: number | null | undefined;
617
+ min?: number | undefined;
618
+ max?: number | undefined;
619
+ } | {
620
+ type: "boolean";
621
+ key: string;
622
+ description?: string | Record<string, string> | null | undefined;
623
+ required?: boolean | undefined;
624
+ array?: boolean | undefined;
625
+ error?: string | undefined;
626
+ xdefault?: boolean | null | undefined;
627
+ } | {
628
+ type: "datetime";
629
+ key: string;
630
+ description?: string | Record<string, string> | null | undefined;
631
+ required?: boolean | undefined;
632
+ array?: boolean | undefined;
633
+ error?: string | undefined;
634
+ xdefault?: string | null | undefined;
635
+ } | {
636
+ type: "email";
637
+ key: string;
638
+ description?: string | Record<string, string> | null | undefined;
639
+ required?: boolean | undefined;
640
+ array?: boolean | undefined;
641
+ error?: string | undefined;
642
+ xdefault?: string | null | undefined;
643
+ } | {
644
+ type: "ip";
645
+ key: string;
646
+ description?: string | Record<string, string> | null | undefined;
647
+ required?: boolean | undefined;
648
+ array?: boolean | undefined;
649
+ error?: string | undefined;
650
+ xdefault?: string | null | undefined;
651
+ } | {
652
+ type: "url";
653
+ key: string;
654
+ description?: string | Record<string, string> | null | undefined;
655
+ required?: boolean | undefined;
656
+ array?: boolean | undefined;
657
+ error?: string | undefined;
658
+ xdefault?: string | null | undefined;
659
+ } | {
660
+ type: "enum";
661
+ key: string;
662
+ elements: string[];
663
+ description?: string | Record<string, string> | null | undefined;
664
+ required?: boolean | undefined;
665
+ array?: boolean | undefined;
666
+ error?: string | undefined;
667
+ xdefault?: string | null | undefined;
668
+ } | {
669
+ type: "relationship";
670
+ key: string;
671
+ relatedCollection: string;
672
+ relationType: "oneToMany" | "manyToOne" | "oneToOne" | "manyToMany";
673
+ twoWay: boolean;
674
+ twoWayKey: string;
675
+ onDelete: "setNull" | "cascade" | "restrict";
676
+ side: "parent" | "child";
677
+ description?: string | Record<string, string> | null | undefined;
678
+ required?: boolean | undefined;
679
+ array?: boolean | undefined;
680
+ error?: string | undefined;
681
+ importMapping?: {
682
+ originalIdField: string;
683
+ targetField?: string | undefined;
684
+ } | undefined;
685
+ })[];
686
+ };
687
+ };