appwrite-utils-cli 1.7.9 → 1.8.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/CHANGELOG.md +14 -199
- package/README.md +87 -30
- package/dist/adapters/AdapterFactory.js +5 -25
- package/dist/adapters/DatabaseAdapter.d.ts +17 -2
- package/dist/adapters/LegacyAdapter.d.ts +2 -1
- package/dist/adapters/LegacyAdapter.js +212 -16
- package/dist/adapters/TablesDBAdapter.d.ts +2 -12
- package/dist/adapters/TablesDBAdapter.js +261 -57
- package/dist/cli/commands/databaseCommands.js +4 -3
- package/dist/cli/commands/functionCommands.js +17 -8
- package/dist/collections/attributes.js +447 -125
- package/dist/collections/methods.js +197 -186
- package/dist/collections/tableOperations.d.ts +86 -0
- package/dist/collections/tableOperations.js +434 -0
- package/dist/collections/transferOperations.d.ts +3 -2
- package/dist/collections/transferOperations.js +93 -12
- package/dist/config/yamlConfig.d.ts +221 -88
- package/dist/examples/yamlTerminologyExample.d.ts +1 -1
- package/dist/examples/yamlTerminologyExample.js +6 -3
- package/dist/functions/fnConfigDiscovery.d.ts +3 -0
- package/dist/functions/fnConfigDiscovery.js +108 -0
- package/dist/interactiveCLI.js +18 -15
- package/dist/main.js +211 -73
- package/dist/migrations/appwriteToX.d.ts +88 -23
- package/dist/migrations/comprehensiveTransfer.d.ts +2 -0
- package/dist/migrations/comprehensiveTransfer.js +83 -6
- package/dist/migrations/dataLoader.d.ts +227 -69
- package/dist/migrations/dataLoader.js +3 -3
- package/dist/migrations/importController.js +3 -3
- package/dist/migrations/relationships.d.ts +8 -2
- package/dist/migrations/services/ImportOrchestrator.js +3 -3
- package/dist/migrations/transfer.js +159 -37
- package/dist/shared/attributeMapper.d.ts +20 -0
- package/dist/shared/attributeMapper.js +203 -0
- package/dist/shared/selectionDialogs.js +8 -4
- package/dist/storage/schemas.d.ts +354 -92
- package/dist/utils/configDiscovery.js +4 -3
- package/dist/utils/versionDetection.d.ts +0 -4
- package/dist/utils/versionDetection.js +41 -173
- package/dist/utils/yamlConverter.js +89 -16
- package/dist/utils/yamlLoader.d.ts +1 -1
- package/dist/utils/yamlLoader.js +6 -2
- package/dist/utilsController.js +56 -19
- package/package.json +4 -4
- package/src/adapters/AdapterFactory.ts +119 -143
- package/src/adapters/DatabaseAdapter.ts +18 -3
- package/src/adapters/LegacyAdapter.ts +236 -105
- package/src/adapters/TablesDBAdapter.ts +773 -643
- package/src/cli/commands/databaseCommands.ts +13 -12
- package/src/cli/commands/functionCommands.ts +23 -14
- package/src/collections/attributes.ts +2054 -1611
- package/src/collections/methods.ts +208 -293
- package/src/collections/tableOperations.ts +506 -0
- package/src/collections/transferOperations.ts +218 -144
- package/src/examples/yamlTerminologyExample.ts +10 -5
- package/src/functions/fnConfigDiscovery.ts +103 -0
- package/src/interactiveCLI.ts +25 -20
- package/src/main.ts +549 -194
- package/src/migrations/comprehensiveTransfer.ts +126 -50
- package/src/migrations/dataLoader.ts +3 -3
- package/src/migrations/importController.ts +3 -3
- package/src/migrations/services/ImportOrchestrator.ts +3 -3
- package/src/migrations/transfer.ts +148 -131
- package/src/shared/attributeMapper.ts +229 -0
- package/src/shared/selectionDialogs.ts +29 -25
- package/src/utils/configDiscovery.ts +9 -3
- package/src/utils/versionDetection.ts +74 -228
- package/src/utils/yamlConverter.ts +94 -17
- package/src/utils/yamlLoader.ts +11 -4
- package/src/utilsController.ts +80 -30
|
@@ -6,92 +6,183 @@ import { AuthUserCreateSchema } from "../schemas/authUser.js";
|
|
|
6
6
|
export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
7
7
|
collection: z.ZodOptional<z.ZodObject<{
|
|
8
8
|
name: z.ZodString;
|
|
9
|
-
attributes: z.ZodDefault<z.ZodArray<z.
|
|
9
|
+
attributes: z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodObject<{
|
|
10
10
|
key: z.ZodString;
|
|
11
|
-
type: z.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
type: z.ZodString;
|
|
12
|
+
attributes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
13
|
+
orders: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
14
|
+
error: z.ZodOptional<z.ZodString>;
|
|
15
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
16
|
+
array: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
+
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
|
|
18
|
+
xdefault: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
|
|
19
|
+
format: z.ZodOptional<z.ZodString>;
|
|
20
|
+
size: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
21
|
+
min: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
22
|
+
max: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
23
|
+
elements: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
24
|
+
encrypted: z.ZodOptional<z.ZodBoolean>;
|
|
25
|
+
relatedCollection: z.ZodOptional<z.ZodString>;
|
|
26
|
+
relationType: z.ZodOptional<z.ZodString>;
|
|
27
|
+
twoWay: z.ZodOptional<z.ZodBoolean>;
|
|
28
|
+
twoWayKey: z.ZodOptional<z.ZodString>;
|
|
29
|
+
onDelete: z.ZodOptional<z.ZodString>;
|
|
30
|
+
side: z.ZodOptional<z.ZodString>;
|
|
31
|
+
importMapping: z.ZodOptional<z.ZodObject<{
|
|
32
|
+
originalIdField: z.ZodString;
|
|
33
|
+
targetField: z.ZodOptional<z.ZodString>;
|
|
34
|
+
}, z.core.$strip>>;
|
|
35
|
+
}, z.core.$loose>, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
36
|
+
array: z.ZodOptional<z.ZodBoolean>;
|
|
37
|
+
format: z.ZodOptional<z.ZodString>;
|
|
38
|
+
key: z.ZodString;
|
|
39
|
+
status: z.ZodOptional<z.ZodString>;
|
|
40
|
+
attributes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
41
|
+
orders: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
42
|
+
required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
43
|
+
$createdAt: z.ZodOptional<z.ZodString>;
|
|
44
|
+
$updatedAt: z.ZodOptional<z.ZodString>;
|
|
45
|
+
error: z.ZodOptional<z.ZodString>;
|
|
46
|
+
type: z.ZodLiteral<"string">;
|
|
15
47
|
size: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
16
48
|
xdefault: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
17
49
|
encrypted: z.ZodOptional<z.ZodBoolean>;
|
|
18
|
-
format: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
19
50
|
}, z.core.$strip>, z.ZodObject<{
|
|
51
|
+
array: z.ZodOptional<z.ZodBoolean>;
|
|
52
|
+
format: z.ZodOptional<z.ZodString>;
|
|
20
53
|
key: z.ZodString;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
54
|
+
status: z.ZodOptional<z.ZodString>;
|
|
55
|
+
attributes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
56
|
+
orders: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
57
|
+
required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
58
|
+
$createdAt: z.ZodOptional<z.ZodString>;
|
|
59
|
+
$updatedAt: z.ZodOptional<z.ZodString>;
|
|
60
|
+
error: z.ZodOptional<z.ZodString>;
|
|
61
|
+
type: z.ZodLiteral<"integer">;
|
|
25
62
|
min: z.ZodOptional<z.ZodNumber>;
|
|
26
63
|
max: z.ZodOptional<z.ZodNumber>;
|
|
27
64
|
xdefault: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
28
65
|
}, z.core.$strip>, z.ZodObject<{
|
|
66
|
+
array: z.ZodOptional<z.ZodBoolean>;
|
|
67
|
+
format: z.ZodOptional<z.ZodString>;
|
|
29
68
|
key: z.ZodString;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
69
|
+
status: z.ZodOptional<z.ZodString>;
|
|
70
|
+
attributes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
71
|
+
orders: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
72
|
+
required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
73
|
+
$createdAt: z.ZodOptional<z.ZodString>;
|
|
74
|
+
$updatedAt: z.ZodOptional<z.ZodString>;
|
|
75
|
+
error: z.ZodOptional<z.ZodString>;
|
|
76
|
+
type: z.ZodLiteral<"double">;
|
|
33
77
|
min: z.ZodOptional<z.ZodNumber>;
|
|
34
78
|
max: z.ZodOptional<z.ZodNumber>;
|
|
35
79
|
xdefault: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
36
|
-
type: z.ZodDefault<z.ZodLiteral<"double">>;
|
|
37
80
|
}, z.core.$strip>, z.ZodObject<{
|
|
81
|
+
array: z.ZodOptional<z.ZodBoolean>;
|
|
82
|
+
format: z.ZodOptional<z.ZodString>;
|
|
38
83
|
key: z.ZodString;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
84
|
+
status: z.ZodOptional<z.ZodString>;
|
|
85
|
+
attributes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
86
|
+
orders: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
87
|
+
required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
88
|
+
$createdAt: z.ZodOptional<z.ZodString>;
|
|
89
|
+
$updatedAt: z.ZodOptional<z.ZodString>;
|
|
90
|
+
error: z.ZodOptional<z.ZodString>;
|
|
91
|
+
type: z.ZodLiteral<"float">;
|
|
42
92
|
min: z.ZodOptional<z.ZodNumber>;
|
|
43
93
|
max: z.ZodOptional<z.ZodNumber>;
|
|
44
94
|
xdefault: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
45
|
-
type: z.ZodDefault<z.ZodLiteral<"float">>;
|
|
46
95
|
}, z.core.$strip>, z.ZodObject<{
|
|
96
|
+
array: z.ZodOptional<z.ZodBoolean>;
|
|
97
|
+
format: z.ZodOptional<z.ZodString>;
|
|
47
98
|
key: z.ZodString;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
99
|
+
status: z.ZodOptional<z.ZodString>;
|
|
100
|
+
attributes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
101
|
+
orders: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
102
|
+
required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
103
|
+
$createdAt: z.ZodOptional<z.ZodString>;
|
|
104
|
+
$updatedAt: z.ZodOptional<z.ZodString>;
|
|
105
|
+
error: z.ZodOptional<z.ZodString>;
|
|
106
|
+
type: z.ZodLiteral<"boolean">;
|
|
52
107
|
xdefault: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
53
108
|
}, z.core.$strip>, z.ZodObject<{
|
|
109
|
+
array: z.ZodOptional<z.ZodBoolean>;
|
|
110
|
+
format: z.ZodOptional<z.ZodString>;
|
|
54
111
|
key: z.ZodString;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
112
|
+
status: z.ZodOptional<z.ZodString>;
|
|
113
|
+
attributes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
114
|
+
orders: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
115
|
+
required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
116
|
+
$createdAt: z.ZodOptional<z.ZodString>;
|
|
117
|
+
$updatedAt: z.ZodOptional<z.ZodString>;
|
|
118
|
+
error: z.ZodOptional<z.ZodString>;
|
|
119
|
+
type: z.ZodLiteral<"datetime">;
|
|
59
120
|
xdefault: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
60
121
|
}, z.core.$strip>, z.ZodObject<{
|
|
122
|
+
array: z.ZodOptional<z.ZodBoolean>;
|
|
123
|
+
format: z.ZodOptional<z.ZodString>;
|
|
61
124
|
key: z.ZodString;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
125
|
+
status: z.ZodOptional<z.ZodString>;
|
|
126
|
+
attributes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
127
|
+
orders: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
128
|
+
required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
129
|
+
$createdAt: z.ZodOptional<z.ZodString>;
|
|
130
|
+
$updatedAt: z.ZodOptional<z.ZodString>;
|
|
131
|
+
error: z.ZodOptional<z.ZodString>;
|
|
132
|
+
type: z.ZodLiteral<"email">;
|
|
66
133
|
xdefault: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
67
134
|
}, z.core.$strip>, z.ZodObject<{
|
|
135
|
+
array: z.ZodOptional<z.ZodBoolean>;
|
|
136
|
+
format: z.ZodOptional<z.ZodString>;
|
|
68
137
|
key: z.ZodString;
|
|
138
|
+
status: z.ZodOptional<z.ZodString>;
|
|
139
|
+
attributes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
140
|
+
orders: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
141
|
+
required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
142
|
+
$createdAt: z.ZodOptional<z.ZodString>;
|
|
143
|
+
$updatedAt: z.ZodOptional<z.ZodString>;
|
|
144
|
+
error: z.ZodOptional<z.ZodString>;
|
|
69
145
|
type: z.ZodLiteral<"ip">;
|
|
70
|
-
error: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
71
|
-
required: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
72
|
-
array: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
73
146
|
xdefault: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
74
147
|
}, z.core.$strip>, z.ZodObject<{
|
|
148
|
+
array: z.ZodOptional<z.ZodBoolean>;
|
|
149
|
+
format: z.ZodOptional<z.ZodString>;
|
|
75
150
|
key: z.ZodString;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
151
|
+
status: z.ZodOptional<z.ZodString>;
|
|
152
|
+
attributes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
153
|
+
orders: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
154
|
+
required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
155
|
+
$createdAt: z.ZodOptional<z.ZodString>;
|
|
156
|
+
$updatedAt: z.ZodOptional<z.ZodString>;
|
|
157
|
+
error: z.ZodOptional<z.ZodString>;
|
|
158
|
+
type: z.ZodLiteral<"url">;
|
|
80
159
|
xdefault: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
81
160
|
}, z.core.$strip>, z.ZodObject<{
|
|
161
|
+
array: z.ZodOptional<z.ZodBoolean>;
|
|
162
|
+
format: z.ZodOptional<z.ZodString>;
|
|
82
163
|
key: z.ZodString;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
164
|
+
status: z.ZodOptional<z.ZodString>;
|
|
165
|
+
attributes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
166
|
+
orders: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
167
|
+
required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
168
|
+
$createdAt: z.ZodOptional<z.ZodString>;
|
|
169
|
+
$updatedAt: z.ZodOptional<z.ZodString>;
|
|
170
|
+
error: z.ZodOptional<z.ZodString>;
|
|
171
|
+
type: z.ZodLiteral<"enum">;
|
|
87
172
|
elements: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
88
173
|
xdefault: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
89
174
|
}, z.core.$strip>, z.ZodObject<{
|
|
175
|
+
array: z.ZodOptional<z.ZodBoolean>;
|
|
176
|
+
format: z.ZodOptional<z.ZodString>;
|
|
90
177
|
key: z.ZodString;
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
178
|
+
status: z.ZodOptional<z.ZodString>;
|
|
179
|
+
attributes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
180
|
+
orders: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
181
|
+
required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
182
|
+
$createdAt: z.ZodOptional<z.ZodString>;
|
|
183
|
+
$updatedAt: z.ZodOptional<z.ZodString>;
|
|
184
|
+
error: z.ZodOptional<z.ZodString>;
|
|
185
|
+
type: z.ZodLiteral<"relationship">;
|
|
95
186
|
relatedCollection: z.ZodString;
|
|
96
187
|
relationType: z.ZodEnum<{
|
|
97
188
|
oneToMany: "oneToMany";
|
|
@@ -114,7 +205,7 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
|
114
205
|
originalIdField: z.ZodString;
|
|
115
206
|
targetField: z.ZodOptional<z.ZodString>;
|
|
116
207
|
}, z.core.$strip>>;
|
|
117
|
-
}, z.core.$strip>], "type"
|
|
208
|
+
}, z.core.$strip>], "type">>>>;
|
|
118
209
|
$id: z.ZodOptional<z.ZodString>;
|
|
119
210
|
enabled: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
120
211
|
documentSecurity: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
@@ -189,6 +280,7 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
|
189
280
|
}, z.core.$strip>>;
|
|
190
281
|
}, z.core.$strip>>>>;
|
|
191
282
|
databaseId: z.ZodOptional<z.ZodString>;
|
|
283
|
+
databaseIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
192
284
|
}, z.core.$strip>>;
|
|
193
285
|
data: z.ZodArray<z.ZodObject<{
|
|
194
286
|
rawData: z.ZodAny;
|
|
@@ -290,94 +382,159 @@ export declare class DataLoader {
|
|
|
290
382
|
name: string;
|
|
291
383
|
attributes: ({
|
|
292
384
|
key: string;
|
|
385
|
+
required: boolean;
|
|
293
386
|
type: "string";
|
|
294
387
|
size: number;
|
|
295
|
-
error?: string | undefined;
|
|
296
|
-
required?: boolean | undefined;
|
|
297
388
|
array?: boolean | undefined;
|
|
389
|
+
format?: string | undefined;
|
|
390
|
+
status?: string | undefined;
|
|
391
|
+
attributes?: string[] | undefined;
|
|
392
|
+
orders?: string[] | undefined;
|
|
393
|
+
$createdAt?: string | undefined;
|
|
394
|
+
$updatedAt?: string | undefined;
|
|
395
|
+
error?: string | undefined;
|
|
298
396
|
xdefault?: string | null | undefined;
|
|
299
397
|
encrypted?: boolean | undefined;
|
|
300
|
-
format?: string | null | undefined;
|
|
301
398
|
} | {
|
|
302
399
|
key: string;
|
|
400
|
+
required: boolean;
|
|
303
401
|
type: "integer";
|
|
304
|
-
error?: string | undefined;
|
|
305
|
-
required?: boolean | undefined;
|
|
306
402
|
array?: boolean | undefined;
|
|
403
|
+
format?: string | undefined;
|
|
404
|
+
status?: string | undefined;
|
|
405
|
+
attributes?: string[] | undefined;
|
|
406
|
+
orders?: string[] | undefined;
|
|
407
|
+
$createdAt?: string | undefined;
|
|
408
|
+
$updatedAt?: string | undefined;
|
|
409
|
+
error?: string | undefined;
|
|
307
410
|
min?: number | undefined;
|
|
308
411
|
max?: number | undefined;
|
|
309
412
|
xdefault?: number | null | undefined;
|
|
310
413
|
} | {
|
|
311
414
|
key: string;
|
|
415
|
+
required: boolean;
|
|
312
416
|
type: "double";
|
|
313
|
-
error?: string | undefined;
|
|
314
|
-
required?: boolean | undefined;
|
|
315
417
|
array?: boolean | undefined;
|
|
418
|
+
format?: string | undefined;
|
|
419
|
+
status?: string | undefined;
|
|
420
|
+
attributes?: string[] | undefined;
|
|
421
|
+
orders?: string[] | undefined;
|
|
422
|
+
$createdAt?: string | undefined;
|
|
423
|
+
$updatedAt?: string | undefined;
|
|
424
|
+
error?: string | undefined;
|
|
316
425
|
min?: number | undefined;
|
|
317
426
|
max?: number | undefined;
|
|
318
427
|
xdefault?: number | null | undefined;
|
|
319
428
|
} | {
|
|
320
429
|
key: string;
|
|
430
|
+
required: boolean;
|
|
321
431
|
type: "float";
|
|
322
|
-
error?: string | undefined;
|
|
323
|
-
required?: boolean | undefined;
|
|
324
432
|
array?: boolean | undefined;
|
|
433
|
+
format?: string | undefined;
|
|
434
|
+
status?: string | undefined;
|
|
435
|
+
attributes?: string[] | undefined;
|
|
436
|
+
orders?: string[] | undefined;
|
|
437
|
+
$createdAt?: string | undefined;
|
|
438
|
+
$updatedAt?: string | undefined;
|
|
439
|
+
error?: string | undefined;
|
|
325
440
|
min?: number | undefined;
|
|
326
441
|
max?: number | undefined;
|
|
327
442
|
xdefault?: number | null | undefined;
|
|
328
443
|
} | {
|
|
329
444
|
key: string;
|
|
445
|
+
required: boolean;
|
|
330
446
|
type: "boolean";
|
|
331
|
-
error?: string | undefined;
|
|
332
|
-
required?: boolean | undefined;
|
|
333
447
|
array?: boolean | undefined;
|
|
448
|
+
format?: string | undefined;
|
|
449
|
+
status?: string | undefined;
|
|
450
|
+
attributes?: string[] | undefined;
|
|
451
|
+
orders?: string[] | undefined;
|
|
452
|
+
$createdAt?: string | undefined;
|
|
453
|
+
$updatedAt?: string | undefined;
|
|
454
|
+
error?: string | undefined;
|
|
334
455
|
xdefault?: boolean | null | undefined;
|
|
335
456
|
} | {
|
|
336
457
|
key: string;
|
|
458
|
+
required: boolean;
|
|
337
459
|
type: "datetime";
|
|
338
|
-
error?: string | undefined;
|
|
339
|
-
required?: boolean | undefined;
|
|
340
460
|
array?: boolean | undefined;
|
|
461
|
+
format?: string | undefined;
|
|
462
|
+
status?: string | undefined;
|
|
463
|
+
attributes?: string[] | undefined;
|
|
464
|
+
orders?: string[] | undefined;
|
|
465
|
+
$createdAt?: string | undefined;
|
|
466
|
+
$updatedAt?: string | undefined;
|
|
467
|
+
error?: string | undefined;
|
|
341
468
|
xdefault?: string | null | undefined;
|
|
342
469
|
} | {
|
|
343
470
|
key: string;
|
|
471
|
+
required: boolean;
|
|
344
472
|
type: "email";
|
|
345
|
-
error?: string | undefined;
|
|
346
|
-
required?: boolean | undefined;
|
|
347
473
|
array?: boolean | undefined;
|
|
474
|
+
format?: string | undefined;
|
|
475
|
+
status?: string | undefined;
|
|
476
|
+
attributes?: string[] | undefined;
|
|
477
|
+
orders?: string[] | undefined;
|
|
478
|
+
$createdAt?: string | undefined;
|
|
479
|
+
$updatedAt?: string | undefined;
|
|
480
|
+
error?: string | undefined;
|
|
348
481
|
xdefault?: string | null | undefined;
|
|
349
482
|
} | {
|
|
350
483
|
key: string;
|
|
484
|
+
required: boolean;
|
|
351
485
|
type: "ip";
|
|
352
|
-
error?: string | undefined;
|
|
353
|
-
required?: boolean | undefined;
|
|
354
486
|
array?: boolean | undefined;
|
|
487
|
+
format?: string | undefined;
|
|
488
|
+
status?: string | undefined;
|
|
489
|
+
attributes?: string[] | undefined;
|
|
490
|
+
orders?: string[] | undefined;
|
|
491
|
+
$createdAt?: string | undefined;
|
|
492
|
+
$updatedAt?: string | undefined;
|
|
493
|
+
error?: string | undefined;
|
|
355
494
|
xdefault?: string | null | undefined;
|
|
356
495
|
} | {
|
|
357
496
|
key: string;
|
|
497
|
+
required: boolean;
|
|
358
498
|
type: "url";
|
|
359
|
-
error?: string | undefined;
|
|
360
|
-
required?: boolean | undefined;
|
|
361
499
|
array?: boolean | undefined;
|
|
500
|
+
format?: string | undefined;
|
|
501
|
+
status?: string | undefined;
|
|
502
|
+
attributes?: string[] | undefined;
|
|
503
|
+
orders?: string[] | undefined;
|
|
504
|
+
$createdAt?: string | undefined;
|
|
505
|
+
$updatedAt?: string | undefined;
|
|
506
|
+
error?: string | undefined;
|
|
362
507
|
xdefault?: string | null | undefined;
|
|
363
508
|
} | {
|
|
364
509
|
key: string;
|
|
510
|
+
required: boolean;
|
|
365
511
|
type: "enum";
|
|
366
512
|
elements: string[];
|
|
367
|
-
error?: string | undefined;
|
|
368
|
-
required?: boolean | undefined;
|
|
369
513
|
array?: boolean | undefined;
|
|
514
|
+
format?: string | undefined;
|
|
515
|
+
status?: string | undefined;
|
|
516
|
+
attributes?: string[] | undefined;
|
|
517
|
+
orders?: string[] | undefined;
|
|
518
|
+
$createdAt?: string | undefined;
|
|
519
|
+
$updatedAt?: string | undefined;
|
|
520
|
+
error?: string | undefined;
|
|
370
521
|
xdefault?: string | null | undefined;
|
|
371
522
|
} | {
|
|
372
523
|
key: string;
|
|
524
|
+
required: boolean;
|
|
373
525
|
type: "relationship";
|
|
374
526
|
relatedCollection: string;
|
|
375
527
|
relationType: "oneToMany" | "manyToOne" | "oneToOne" | "manyToMany";
|
|
376
528
|
twoWay: boolean;
|
|
377
529
|
onDelete: "setNull" | "cascade" | "restrict";
|
|
378
|
-
error?: string | undefined;
|
|
379
|
-
required?: boolean | undefined;
|
|
380
530
|
array?: boolean | undefined;
|
|
531
|
+
format?: string | undefined;
|
|
532
|
+
status?: string | undefined;
|
|
533
|
+
attributes?: string[] | undefined;
|
|
534
|
+
orders?: string[] | undefined;
|
|
535
|
+
$createdAt?: string | undefined;
|
|
536
|
+
$updatedAt?: string | undefined;
|
|
537
|
+
error?: string | undefined;
|
|
381
538
|
twoWayKey?: string | undefined;
|
|
382
539
|
side?: "parent" | "child" | undefined;
|
|
383
540
|
importMapping?: {
|
|
@@ -438,6 +595,7 @@ export declare class DataLoader {
|
|
|
438
595
|
enabled?: boolean | undefined;
|
|
439
596
|
documentSecurity?: boolean | undefined;
|
|
440
597
|
databaseId?: string | undefined;
|
|
598
|
+
databaseIds?: string[] | undefined;
|
|
441
599
|
} | undefined;
|
|
442
600
|
}>;
|
|
443
601
|
private oldIdToNewIdPerCollectionMap;
|
|
@@ -251,7 +251,7 @@ export class DataLoader {
|
|
|
251
251
|
collection.$id = collectionExists.$id;
|
|
252
252
|
this.config.collections[index] = collectionConfig;
|
|
253
253
|
// Find or create an import operation for the collection
|
|
254
|
-
const adapter = new LegacyAdapter(this.database);
|
|
254
|
+
const adapter = new LegacyAdapter(this.database.client);
|
|
255
255
|
const collectionImportOperation = await findOrCreateOperation(adapter, dbId, "importData", collection.$id);
|
|
256
256
|
// Store the operation ID in the map
|
|
257
257
|
this.collectionImportOperations.set(this.getCollectionKey(collection.name), collectionImportOperation.$id);
|
|
@@ -754,7 +754,7 @@ export class DataLoader {
|
|
|
754
754
|
this.oldIdToNewIdPerCollectionMap
|
|
755
755
|
.set(this.getCollectionKey(collection.name), oldIdToNewIdMap)
|
|
756
756
|
.get(this.getCollectionKey(collection.name));
|
|
757
|
-
const adapter = new LegacyAdapter(this.database);
|
|
757
|
+
const adapter = new LegacyAdapter(this.database.client);
|
|
758
758
|
if (!operationId) {
|
|
759
759
|
const collectionImportOperation = await findOrCreateOperation(adapter, db.$id, "importData", collection.$id);
|
|
760
760
|
// Store the operation ID in the map
|
|
@@ -907,7 +907,7 @@ export class DataLoader {
|
|
|
907
907
|
// Load the raw data based on the import definition
|
|
908
908
|
const rawData = this.loadData(importDef);
|
|
909
909
|
let operationId = this.collectionImportOperations.get(this.getCollectionKey(collection.name));
|
|
910
|
-
const adapter = new LegacyAdapter(this.database);
|
|
910
|
+
const adapter = new LegacyAdapter(this.database.client);
|
|
911
911
|
if (!operationId) {
|
|
912
912
|
const collectionImportOperation = await findOrCreateOperation(adapter, db.$id, "importData", collection.$id);
|
|
913
913
|
// Store the operation ID in the map
|
|
@@ -172,7 +172,7 @@ export class ImportController {
|
|
|
172
172
|
}
|
|
173
173
|
let importOperation = null;
|
|
174
174
|
importOperation = await this.database.getDocument("migrations", "currentOperations", importOperationId);
|
|
175
|
-
const adapter = new LegacyAdapter(this.database);
|
|
175
|
+
const adapter = new LegacyAdapter(this.database.client);
|
|
176
176
|
await updateOperation(adapter, db.$id, importOperation.$id, {
|
|
177
177
|
status: "in_progress",
|
|
178
178
|
});
|
|
@@ -213,7 +213,7 @@ export class ImportController {
|
|
|
213
213
|
await Promise.all(batchPromises);
|
|
214
214
|
MessageFormatter.success(`Completed batch ${i + 1} of ${dataSplit.length}`, { prefix: "Import" });
|
|
215
215
|
if (importOperation) {
|
|
216
|
-
const adapter = new LegacyAdapter(this.database);
|
|
216
|
+
const adapter = new LegacyAdapter(this.database.client);
|
|
217
217
|
await updateOperation(adapter, db.$id, importOperation.$id, {
|
|
218
218
|
progress: processedItems,
|
|
219
219
|
});
|
|
@@ -221,7 +221,7 @@ export class ImportController {
|
|
|
221
221
|
}
|
|
222
222
|
// After all batches are processed, update the operation status to completed
|
|
223
223
|
if (importOperation) {
|
|
224
|
-
const adapter = new LegacyAdapter(this.database);
|
|
224
|
+
const adapter = new LegacyAdapter(this.database.client);
|
|
225
225
|
await updateOperation(adapter, db.$id, importOperation.$id, {
|
|
226
226
|
status: "completed",
|
|
227
227
|
});
|
|
@@ -5,14 +5,20 @@ import type { AppwriteConfig } from "appwrite-utils";
|
|
|
5
5
|
*/
|
|
6
6
|
export declare const findCollectionsWithRelationships: (config: AppwriteConfig) => Map<string, {
|
|
7
7
|
key: string;
|
|
8
|
+
required: boolean;
|
|
8
9
|
type: "relationship";
|
|
9
10
|
relatedCollection: string;
|
|
10
11
|
relationType: "oneToMany" | "manyToOne" | "oneToOne" | "manyToMany";
|
|
11
12
|
twoWay: boolean;
|
|
12
13
|
onDelete: "setNull" | "cascade" | "restrict";
|
|
13
|
-
error?: string | undefined;
|
|
14
|
-
required?: boolean | undefined;
|
|
15
14
|
array?: boolean | undefined;
|
|
15
|
+
format?: string | undefined;
|
|
16
|
+
status?: string | undefined;
|
|
17
|
+
attributes?: string[] | undefined;
|
|
18
|
+
orders?: string[] | undefined;
|
|
19
|
+
$createdAt?: string | undefined;
|
|
20
|
+
$updatedAt?: string | undefined;
|
|
21
|
+
error?: string | undefined;
|
|
16
22
|
twoWayKey?: string | undefined;
|
|
17
23
|
side?: "parent" | "child" | undefined;
|
|
18
24
|
importMapping?: {
|
|
@@ -147,7 +147,7 @@ export class ImportOrchestrator {
|
|
|
147
147
|
collection.$id = existingCollection.$id;
|
|
148
148
|
this.config.collections[index] = collectionConfig;
|
|
149
149
|
// Find or create an import operation for the collection
|
|
150
|
-
const adapter = new LegacyAdapter(this.database);
|
|
150
|
+
const adapter = new LegacyAdapter(this.database.client);
|
|
151
151
|
const collectionImportOperation = await findOrCreateOperation(adapter, dbId, "importData", collection.$id);
|
|
152
152
|
this.collectionImportOperations.set(this.getCollectionKey(collection.name), collectionImportOperation.$id);
|
|
153
153
|
// Initialize the collection in the import map
|
|
@@ -353,7 +353,7 @@ export class ImportOrchestrator {
|
|
|
353
353
|
}
|
|
354
354
|
logger.info(`Importing collection: ${collection.name} (${collectionData.data.length} items)`);
|
|
355
355
|
const operationId = this.collectionImportOperations.get(this.getCollectionKey(collection.name));
|
|
356
|
-
const adapter = new LegacyAdapter(this.database);
|
|
356
|
+
const adapter = new LegacyAdapter(this.database.client);
|
|
357
357
|
if (operationId) {
|
|
358
358
|
await updateOperation(adapter, db.$id, operationId, { status: "in_progress" });
|
|
359
359
|
}
|
|
@@ -461,7 +461,7 @@ export class ImportOrchestrator {
|
|
|
461
461
|
const operationId = this.collectionImportOperations.get(this.getCollectionKey(collection.name));
|
|
462
462
|
if (operationId) {
|
|
463
463
|
const updateData = total ? { status, total } : { status };
|
|
464
|
-
const adapter = new LegacyAdapter(this.database);
|
|
464
|
+
const adapter = new LegacyAdapter(this.database.client);
|
|
465
465
|
await updateOperation(adapter, db.$id, operationId, updateData);
|
|
466
466
|
}
|
|
467
467
|
}
|