appwrite-utils-cli 0.0.2 → 0.0.4

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.
@@ -0,0 +1,667 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "appwriteEndpoint": {
6
+ "type": "string",
7
+ "default": "https://cloud.appwrite.io/v1"
8
+ },
9
+ "appwriteProject": {
10
+ "type": "string"
11
+ },
12
+ "appwriteKey": {
13
+ "type": "string"
14
+ },
15
+ "appwriteClient": {
16
+ "type": [
17
+ "object",
18
+ "null"
19
+ ],
20
+ "default": null
21
+ },
22
+ "enableDevDatabase": {
23
+ "type": "boolean",
24
+ "default": true,
25
+ "description": "Enable development database alongside production database"
26
+ },
27
+ "enableBackups": {
28
+ "type": "boolean",
29
+ "default": true,
30
+ "description": "Enable backups"
31
+ },
32
+ "backupInterval": {
33
+ "type": "number",
34
+ "default": 3600,
35
+ "description": "Backup interval in seconds"
36
+ },
37
+ "backupRetention": {
38
+ "type": "number",
39
+ "default": 30,
40
+ "description": "Backup retention in days"
41
+ },
42
+ "enableBackupCleanup": {
43
+ "type": "boolean",
44
+ "default": true,
45
+ "description": "Enable backup cleanup"
46
+ },
47
+ "enableLocalImport": {
48
+ "type": "boolean",
49
+ "default": false,
50
+ "description": "Enable local import"
51
+ },
52
+ "enableMockData": {
53
+ "type": "boolean",
54
+ "default": false,
55
+ "description": "Enable mock data"
56
+ },
57
+ "enableWipeOtherDatabases": {
58
+ "type": "boolean",
59
+ "default": true,
60
+ "description": "Enable wiping other databases"
61
+ },
62
+ "databases": {
63
+ "type": "array",
64
+ "items": {
65
+ "type": "object",
66
+ "properties": {
67
+ "$id": {
68
+ "type": "string"
69
+ },
70
+ "name": {
71
+ "type": "string"
72
+ }
73
+ },
74
+ "required": [
75
+ "$id",
76
+ "name"
77
+ ]
78
+ },
79
+ "default": [
80
+ {
81
+ "$id": "dev",
82
+ "name": "Development"
83
+ },
84
+ {
85
+ "$id": "main",
86
+ "name": "Main"
87
+ },
88
+ {
89
+ "$id": "migrations",
90
+ "name": "Migrations"
91
+ }
92
+ ],
93
+ "description": "Databases to create, $id is the id of the database"
94
+ },
95
+ "collections": {
96
+ "type": "array",
97
+ "items": {
98
+ "type": "object",
99
+ "properties": {
100
+ "name": {
101
+ "type": "string"
102
+ },
103
+ "attributes": {
104
+ "type": "array",
105
+ "items": {
106
+ "oneOf": [
107
+ {
108
+ "type": "object",
109
+ "properties": {
110
+ "key": {
111
+ "type": "string"
112
+ },
113
+ "type": {
114
+ "type": "string",
115
+ "enum": [
116
+ "string"
117
+ ]
118
+ },
119
+ "required": {
120
+ "type": "boolean",
121
+ "default": false
122
+ },
123
+ "array": {
124
+ "type": "boolean",
125
+ "default": false
126
+ },
127
+ "size": {
128
+ "type": "number",
129
+ "default": 50
130
+ },
131
+ "xdefault": {
132
+ "type": [
133
+ "string",
134
+ "null"
135
+ ]
136
+ },
137
+ "encrypted": {
138
+ "type": "boolean",
139
+ "default": false
140
+ }
141
+ },
142
+ "required": [
143
+ "key",
144
+ "type"
145
+ ]
146
+ },
147
+ {
148
+ "type": "object",
149
+ "properties": {
150
+ "key": {
151
+ "type": "string"
152
+ },
153
+ "type": {
154
+ "type": "string",
155
+ "enum": [
156
+ "integer"
157
+ ]
158
+ },
159
+ "required": {
160
+ "type": "boolean",
161
+ "default": false
162
+ },
163
+ "array": {
164
+ "type": "boolean",
165
+ "default": false
166
+ },
167
+ "min": {
168
+ "type": "number"
169
+ },
170
+ "max": {
171
+ "type": "number"
172
+ },
173
+ "xdefault": {
174
+ "type": [
175
+ "number",
176
+ "null"
177
+ ]
178
+ }
179
+ },
180
+ "required": [
181
+ "key",
182
+ "type"
183
+ ]
184
+ },
185
+ {
186
+ "type": "object",
187
+ "properties": {
188
+ "key": {
189
+ "type": "string"
190
+ },
191
+ "type": {
192
+ "type": "string",
193
+ "enum": [
194
+ "float"
195
+ ]
196
+ },
197
+ "required": {
198
+ "type": "boolean",
199
+ "default": false
200
+ },
201
+ "array": {
202
+ "type": "boolean",
203
+ "default": false
204
+ },
205
+ "min": {
206
+ "type": "number"
207
+ },
208
+ "max": {
209
+ "type": "number"
210
+ },
211
+ "xdefault": {
212
+ "type": [
213
+ "number",
214
+ "null"
215
+ ]
216
+ }
217
+ },
218
+ "required": [
219
+ "key",
220
+ "type"
221
+ ]
222
+ },
223
+ {
224
+ "type": "object",
225
+ "properties": {
226
+ "key": {
227
+ "type": "string"
228
+ },
229
+ "type": {
230
+ "type": "string",
231
+ "enum": [
232
+ "boolean"
233
+ ]
234
+ },
235
+ "required": {
236
+ "type": "boolean",
237
+ "default": false
238
+ },
239
+ "array": {
240
+ "type": "boolean",
241
+ "default": false
242
+ },
243
+ "xdefault": {
244
+ "type": [
245
+ "boolean",
246
+ "null"
247
+ ]
248
+ }
249
+ },
250
+ "required": [
251
+ "key",
252
+ "type"
253
+ ]
254
+ },
255
+ {
256
+ "type": "object",
257
+ "properties": {
258
+ "key": {
259
+ "type": "string"
260
+ },
261
+ "type": {
262
+ "type": "string",
263
+ "enum": [
264
+ "datetime"
265
+ ]
266
+ },
267
+ "required": {
268
+ "type": "boolean",
269
+ "default": false
270
+ },
271
+ "array": {
272
+ "type": "boolean",
273
+ "default": false
274
+ },
275
+ "xdefault": {
276
+ "type": [
277
+ "string",
278
+ "null"
279
+ ]
280
+ }
281
+ },
282
+ "required": [
283
+ "key",
284
+ "type"
285
+ ]
286
+ },
287
+ {
288
+ "type": "object",
289
+ "properties": {
290
+ "key": {
291
+ "type": "string"
292
+ },
293
+ "type": {
294
+ "type": "string",
295
+ "enum": [
296
+ "email"
297
+ ]
298
+ },
299
+ "required": {
300
+ "type": "boolean",
301
+ "default": false
302
+ },
303
+ "array": {
304
+ "type": "boolean",
305
+ "default": false
306
+ },
307
+ "xdefault": {
308
+ "type": [
309
+ "string",
310
+ "null"
311
+ ]
312
+ }
313
+ },
314
+ "required": [
315
+ "key",
316
+ "type"
317
+ ]
318
+ },
319
+ {
320
+ "type": "object",
321
+ "properties": {
322
+ "key": {
323
+ "type": "string"
324
+ },
325
+ "type": {
326
+ "type": "string",
327
+ "enum": [
328
+ "ip"
329
+ ]
330
+ },
331
+ "required": {
332
+ "type": "boolean",
333
+ "default": false
334
+ },
335
+ "array": {
336
+ "type": "boolean",
337
+ "default": false
338
+ },
339
+ "xdefault": {
340
+ "type": [
341
+ "string",
342
+ "null"
343
+ ]
344
+ }
345
+ },
346
+ "required": [
347
+ "key",
348
+ "type"
349
+ ]
350
+ },
351
+ {
352
+ "type": "object",
353
+ "properties": {
354
+ "key": {
355
+ "type": "string"
356
+ },
357
+ "type": {
358
+ "type": "string",
359
+ "enum": [
360
+ "url"
361
+ ]
362
+ },
363
+ "required": {
364
+ "type": "boolean",
365
+ "default": false
366
+ },
367
+ "array": {
368
+ "type": "boolean",
369
+ "default": false
370
+ },
371
+ "xdefault": {
372
+ "type": [
373
+ "string",
374
+ "null"
375
+ ]
376
+ }
377
+ },
378
+ "required": [
379
+ "key",
380
+ "type"
381
+ ]
382
+ },
383
+ {
384
+ "type": "object",
385
+ "properties": {
386
+ "key": {
387
+ "type": "string"
388
+ },
389
+ "type": {
390
+ "type": "string",
391
+ "enum": [
392
+ "enum"
393
+ ]
394
+ },
395
+ "required": {
396
+ "type": "boolean",
397
+ "default": false
398
+ },
399
+ "array": {
400
+ "type": "boolean",
401
+ "default": false
402
+ },
403
+ "values": {
404
+ "type": "array",
405
+ "items": {
406
+ "type": "string"
407
+ }
408
+ },
409
+ "xdefault": {
410
+ "type": [
411
+ "string",
412
+ "null"
413
+ ]
414
+ }
415
+ },
416
+ "required": [
417
+ "key",
418
+ "type",
419
+ "values"
420
+ ]
421
+ },
422
+ {
423
+ "type": "object",
424
+ "properties": {
425
+ "key": {
426
+ "type": "string"
427
+ },
428
+ "type": {
429
+ "type": "string",
430
+ "enum": [
431
+ "relationship"
432
+ ]
433
+ },
434
+ "required": {
435
+ "type": "boolean",
436
+ "default": false
437
+ },
438
+ "array": {
439
+ "type": "boolean",
440
+ "default": false
441
+ },
442
+ "relatedCollection": {
443
+ "type": "string"
444
+ },
445
+ "relationType": {
446
+ "type": "string",
447
+ "enum": [
448
+ "oneToOne",
449
+ "oneToMany",
450
+ "manyToOne",
451
+ "manyToMany"
452
+ ]
453
+ },
454
+ "twoWay": {
455
+ "type": "boolean",
456
+ "default": false
457
+ },
458
+ "twoWayKey": {
459
+ "type": "string",
460
+ "nullable": true
461
+ },
462
+ "onDelete": {
463
+ "type": "string",
464
+ "enum": [
465
+ "cascade",
466
+ "setNull",
467
+ "restrict"
468
+ ],
469
+ "default": "restrict"
470
+ },
471
+ "side": {
472
+ "type": "string",
473
+ "enum": [
474
+ "parent",
475
+ "child"
476
+ ],
477
+ "nullable": true
478
+ },
479
+ "importMapping": {
480
+ "type": "object",
481
+ "nullable": true,
482
+ "properties": {
483
+ "originalIdField": {
484
+ "type": "string",
485
+ "description": "The field in the import data representing the original ID to match"
486
+ },
487
+ "targetField": {
488
+ "type": "string",
489
+ "description": "The field in the target collection that matches the original ID. Optional, defaults to the same as originalIdField if not provided",
490
+ "default": ""
491
+ }
492
+ },
493
+ "required": [
494
+ "originalIdField"
495
+ ],
496
+ "description": "Configuration for mapping and resolving relationships during data import"
497
+ }
498
+ },
499
+ "required": [
500
+ "key",
501
+ "type",
502
+ "relatedCollection",
503
+ "relationType"
504
+ ]
505
+ }
506
+ ]
507
+ },
508
+ "default": []
509
+ },
510
+ "indexes": {
511
+ "type": "array",
512
+ "items": {
513
+ "type": "object",
514
+ "properties": {
515
+ "key": {
516
+ "type": "string"
517
+ },
518
+ "type": {
519
+ "type": "string",
520
+ "enum": [
521
+ "key",
522
+ "unique",
523
+ "fulltext"
524
+ ],
525
+ "default": "key"
526
+ },
527
+ "status": {
528
+ "type": "string"
529
+ },
530
+ "error": {
531
+ "type": "string",
532
+ "nullable": true
533
+ },
534
+ "attributes": {
535
+ "type": "array",
536
+ "items": {
537
+ "type": "string"
538
+ }
539
+ },
540
+ "orders": {
541
+ "type": "array",
542
+ "items": {
543
+ "type": "string"
544
+ },
545
+ "nullable": true
546
+ }
547
+ },
548
+ "required": [
549
+ "key",
550
+ "type",
551
+ "attributes"
552
+ ]
553
+ }
554
+ }
555
+ },
556
+ "required": [
557
+ "name",
558
+ "attributes"
559
+ ]
560
+ },
561
+ "default": [],
562
+ "description": "Collections to create, $id is the id of the collection, it'll always check by collection name and $id for existing before creating another"
563
+ },
564
+ "importDefs": {
565
+ "type": "array",
566
+ "items": {
567
+ "type": "object",
568
+ "properties": {
569
+ "filePath": {
570
+ "type": "string",
571
+ "description": "The file path of the data to import"
572
+ },
573
+ "basePath": {
574
+ "type": "string",
575
+ "description": "The base path of the import e.g. if you have JSON, and the array is in the RECORDS object, then this would be RECORDS"
576
+ },
577
+ "attributeMappings": {
578
+ "type": "array",
579
+ "items": {
580
+ "type": "object",
581
+ "properties": {
582
+ "oldKey": {
583
+ "type": "string",
584
+ "description": "The key of the attribute in the old document"
585
+ },
586
+ "targetKey": {
587
+ "type": "string",
588
+ "description": "The key of the attribute in the new document"
589
+ },
590
+ "converters": {
591
+ "type": "array",
592
+ "items": {
593
+ "type": "string"
594
+ },
595
+ "description": "The converters to use for the import",
596
+ "default": []
597
+ },
598
+ "validationActions": {
599
+ "type": "array",
600
+ "items": {
601
+ "type": "object",
602
+ "properties": {
603
+ "action": {
604
+ "type": "string"
605
+ },
606
+ "params": {
607
+ "type": "array",
608
+ "items": {
609
+ "type": "string",
610
+ "pattern": "^\\{.*\\}$"
611
+ }
612
+ }
613
+ },
614
+ "required": [
615
+ "action",
616
+ "params"
617
+ ]
618
+ },
619
+ "description": "The after import actions and parameter placeholders (they'll be replaced with the actual data) to use for the import",
620
+ "default": []
621
+ },
622
+ "postImportActions": {
623
+ "type": "array",
624
+ "items": {
625
+ "type": "object",
626
+ "properties": {
627
+ "action": {
628
+ "type": "string"
629
+ },
630
+ "params": {
631
+ "type": "array",
632
+ "items": {
633
+ "type": "string",
634
+ "pattern": "^\\{.*\\}$"
635
+ }
636
+ }
637
+ },
638
+ "required": [
639
+ "action",
640
+ "params"
641
+ ]
642
+ },
643
+ "description": "The after import actions and parameter placeholders (they'll be replaced with the actual data) to use for the import",
644
+ "default": []
645
+ }
646
+ },
647
+ "required": [
648
+ "oldKey",
649
+ "targetKey"
650
+ ]
651
+ }
652
+ }
653
+ },
654
+ "required": [
655
+ "filePath",
656
+ "basePath",
657
+ "attributeMappings"
658
+ ]
659
+ }
660
+ }
661
+ },
662
+ "required": [
663
+ "appwriteEndpoint",
664
+ "appwriteProject",
665
+ "appwriteKey"
666
+ ]
667
+ }
@@ -0,0 +1,11 @@
1
+ import type { ConverterFunctions, ValidationRules, AfterImportActions } from "appwrite-utils";
2
+
3
+ export const customConverterFunctions: ConverterFunctions = {
4
+ // Add your custom converter functions here
5
+ }
6
+ export const customValidationRules: ValidationRules = {
7
+ // Add your custom validation rules here
8
+ }
9
+ export const customAfterImportActions: AfterImportActions = {
10
+ // Add your custom after import actions here
11
+ }