appwrite-utils-cli 0.0.262 → 0.0.264
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 +24 -5
- package/dist/main.js +6 -0
- package/dist/migrations/afterImportActions.d.ts +3 -1
- package/dist/migrations/afterImportActions.js +2 -2
- package/dist/migrations/appwriteToX.d.ts +109 -0
- package/dist/migrations/appwriteToX.js +110 -0
- package/dist/migrations/backup.d.ts +4 -4
- package/dist/migrations/dataLoader.d.ts +20 -27
- package/dist/migrations/dataLoader.js +49 -43
- package/dist/migrations/databases.d.ts +2 -0
- package/dist/migrations/databases.js +23 -0
- package/dist/migrations/indexes.js +7 -0
- package/dist/migrations/schema.d.ts +345 -32
- package/dist/migrations/schema.js +34 -14
- package/dist/migrations/schemaStrings.d.ts +1 -0
- package/dist/migrations/schemaStrings.js +35 -5
- package/dist/setup.js +0 -0
- package/dist/utilsController.d.ts +1 -0
- package/dist/utilsController.js +7 -0
- package/package.json +1 -1
- package/src/main.ts +6 -0
- package/src/migrations/afterImportActions.ts +2 -2
- package/src/migrations/appwriteToX.ts +156 -0
- package/src/migrations/dataLoader.ts +88 -89
- package/src/migrations/databases.ts +25 -0
- package/src/migrations/indexes.ts +8 -0
- package/src/migrations/schema.ts +40 -14
- package/src/migrations/schemaStrings.ts +48 -12
- package/src/utilsController.ts +9 -0
@@ -675,6 +675,28 @@ export declare const indexSchema: z.ZodObject<{
|
|
675
675
|
error?: string | undefined;
|
676
676
|
orders?: string[] | undefined;
|
677
677
|
}>;
|
678
|
+
export declare const indexesSchema: z.ZodArray<z.ZodObject<{
|
679
|
+
key: z.ZodString;
|
680
|
+
type: z.ZodDefault<z.ZodOptional<z.ZodEnum<["key", "unique", "fulltext"]>>>;
|
681
|
+
status: z.ZodOptional<z.ZodString>;
|
682
|
+
error: z.ZodOptional<z.ZodString>;
|
683
|
+
attributes: z.ZodArray<z.ZodString, "many">;
|
684
|
+
orders: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
685
|
+
}, "strip", z.ZodTypeAny, {
|
686
|
+
key: string;
|
687
|
+
type: "key" | "unique" | "fulltext";
|
688
|
+
attributes: string[];
|
689
|
+
status?: string | undefined;
|
690
|
+
error?: string | undefined;
|
691
|
+
orders?: string[] | undefined;
|
692
|
+
}, {
|
693
|
+
key: string;
|
694
|
+
attributes: string[];
|
695
|
+
type?: "key" | "unique" | "fulltext" | undefined;
|
696
|
+
status?: string | undefined;
|
697
|
+
error?: string | undefined;
|
698
|
+
orders?: string[] | undefined;
|
699
|
+
}>, "many">;
|
678
700
|
export type Index = z.infer<typeof indexSchema>;
|
679
701
|
export declare const AttributeMappingsSchema: z.ZodArray<z.ZodObject<{
|
680
702
|
oldKey: z.ZodOptional<z.ZodString>;
|
@@ -1098,8 +1120,302 @@ export declare const importDefSchemas: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
1098
1120
|
targetField: string;
|
1099
1121
|
} | undefined;
|
1100
1122
|
}>, "many">>;
|
1123
|
+
export declare const permissionSchema: z.ZodUnion<[z.ZodObject<{
|
1124
|
+
permission: z.ZodString;
|
1125
|
+
target: z.ZodString;
|
1126
|
+
}, "strip", z.ZodTypeAny, {
|
1127
|
+
permission: string;
|
1128
|
+
target: string;
|
1129
|
+
}, {
|
1130
|
+
permission: string;
|
1131
|
+
target: string;
|
1132
|
+
}>, z.ZodEffects<z.ZodString, {
|
1133
|
+
permission: string;
|
1134
|
+
target: string;
|
1135
|
+
}, string>]>;
|
1136
|
+
export declare const permissionsSchema: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
1137
|
+
permission: z.ZodString;
|
1138
|
+
target: z.ZodString;
|
1139
|
+
}, "strip", z.ZodTypeAny, {
|
1140
|
+
permission: string;
|
1141
|
+
target: string;
|
1142
|
+
}, {
|
1143
|
+
permission: string;
|
1144
|
+
target: string;
|
1145
|
+
}>, z.ZodEffects<z.ZodString, {
|
1146
|
+
permission: string;
|
1147
|
+
target: string;
|
1148
|
+
}, string>]>, "many">>;
|
1149
|
+
export declare const attributesSchema: z.ZodDefault<z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
|
1150
|
+
key: z.ZodString;
|
1151
|
+
type: z.ZodDefault<z.ZodLiteral<"string">>;
|
1152
|
+
error: z.ZodDefault<z.ZodString>;
|
1153
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
1154
|
+
array: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
1155
|
+
size: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
1156
|
+
xdefault: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
1157
|
+
encrypted: z.ZodOptional<z.ZodBoolean>;
|
1158
|
+
}, "strip", z.ZodTypeAny, {
|
1159
|
+
key: string;
|
1160
|
+
type: "string";
|
1161
|
+
error: string;
|
1162
|
+
required: boolean;
|
1163
|
+
array: boolean;
|
1164
|
+
size: number;
|
1165
|
+
xdefault?: string | null | undefined;
|
1166
|
+
encrypted?: boolean | undefined;
|
1167
|
+
}, {
|
1168
|
+
key: string;
|
1169
|
+
type?: "string" | undefined;
|
1170
|
+
error?: string | undefined;
|
1171
|
+
required?: boolean | undefined;
|
1172
|
+
array?: boolean | undefined;
|
1173
|
+
size?: number | undefined;
|
1174
|
+
xdefault?: string | null | undefined;
|
1175
|
+
encrypted?: boolean | undefined;
|
1176
|
+
}>, z.ZodObject<{
|
1177
|
+
key: z.ZodString;
|
1178
|
+
type: z.ZodDefault<z.ZodLiteral<"integer">>;
|
1179
|
+
error: z.ZodDefault<z.ZodString>;
|
1180
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
1181
|
+
array: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
1182
|
+
min: z.ZodOptional<z.ZodNumber>;
|
1183
|
+
max: z.ZodOptional<z.ZodNumber>;
|
1184
|
+
xdefault: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
1185
|
+
}, "strip", z.ZodTypeAny, {
|
1186
|
+
key: string;
|
1187
|
+
type: "integer";
|
1188
|
+
error: string;
|
1189
|
+
required: boolean;
|
1190
|
+
array: boolean;
|
1191
|
+
min?: number | undefined;
|
1192
|
+
max?: number | undefined;
|
1193
|
+
xdefault?: number | null | undefined;
|
1194
|
+
}, {
|
1195
|
+
key: string;
|
1196
|
+
type?: "integer" | undefined;
|
1197
|
+
error?: string | undefined;
|
1198
|
+
required?: boolean | undefined;
|
1199
|
+
array?: boolean | undefined;
|
1200
|
+
min?: number | undefined;
|
1201
|
+
max?: number | undefined;
|
1202
|
+
xdefault?: number | null | undefined;
|
1203
|
+
}>]>, z.ZodObject<{
|
1204
|
+
key: z.ZodString;
|
1205
|
+
type: z.ZodDefault<z.ZodLiteral<"float">>;
|
1206
|
+
error: z.ZodDefault<z.ZodString>;
|
1207
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
1208
|
+
array: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
1209
|
+
min: z.ZodOptional<z.ZodNumber>;
|
1210
|
+
max: z.ZodOptional<z.ZodNumber>;
|
1211
|
+
xdefault: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
1212
|
+
}, "strip", z.ZodTypeAny, {
|
1213
|
+
key: string;
|
1214
|
+
type: "float";
|
1215
|
+
error: string;
|
1216
|
+
required: boolean;
|
1217
|
+
array: boolean;
|
1218
|
+
min?: number | undefined;
|
1219
|
+
max?: number | undefined;
|
1220
|
+
xdefault?: number | null | undefined;
|
1221
|
+
}, {
|
1222
|
+
key: string;
|
1223
|
+
type?: "float" | undefined;
|
1224
|
+
error?: string | undefined;
|
1225
|
+
required?: boolean | undefined;
|
1226
|
+
array?: boolean | undefined;
|
1227
|
+
min?: number | undefined;
|
1228
|
+
max?: number | undefined;
|
1229
|
+
xdefault?: number | null | undefined;
|
1230
|
+
}>]>, z.ZodObject<{
|
1231
|
+
key: z.ZodString;
|
1232
|
+
type: z.ZodDefault<z.ZodLiteral<"boolean">>;
|
1233
|
+
error: z.ZodDefault<z.ZodString>;
|
1234
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
1235
|
+
array: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
1236
|
+
xdefault: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
1237
|
+
}, "strip", z.ZodTypeAny, {
|
1238
|
+
key: string;
|
1239
|
+
type: "boolean";
|
1240
|
+
error: string;
|
1241
|
+
required: boolean;
|
1242
|
+
array: boolean;
|
1243
|
+
xdefault?: boolean | null | undefined;
|
1244
|
+
}, {
|
1245
|
+
key: string;
|
1246
|
+
type?: "boolean" | undefined;
|
1247
|
+
error?: string | undefined;
|
1248
|
+
required?: boolean | undefined;
|
1249
|
+
array?: boolean | undefined;
|
1250
|
+
xdefault?: boolean | null | undefined;
|
1251
|
+
}>]>, z.ZodObject<{
|
1252
|
+
key: z.ZodString;
|
1253
|
+
type: z.ZodDefault<z.ZodLiteral<"datetime">>;
|
1254
|
+
error: z.ZodDefault<z.ZodString>;
|
1255
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
1256
|
+
array: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
1257
|
+
xdefault: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
1258
|
+
}, "strip", z.ZodTypeAny, {
|
1259
|
+
key: string;
|
1260
|
+
type: "datetime";
|
1261
|
+
error: string;
|
1262
|
+
required: boolean;
|
1263
|
+
array: boolean;
|
1264
|
+
xdefault?: string | null | undefined;
|
1265
|
+
}, {
|
1266
|
+
key: string;
|
1267
|
+
type?: "datetime" | undefined;
|
1268
|
+
error?: string | undefined;
|
1269
|
+
required?: boolean | undefined;
|
1270
|
+
array?: boolean | undefined;
|
1271
|
+
xdefault?: string | null | undefined;
|
1272
|
+
}>]>, z.ZodObject<{
|
1273
|
+
key: z.ZodString;
|
1274
|
+
type: z.ZodDefault<z.ZodLiteral<"email">>;
|
1275
|
+
error: z.ZodDefault<z.ZodString>;
|
1276
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
1277
|
+
array: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
1278
|
+
xdefault: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
1279
|
+
}, "strip", z.ZodTypeAny, {
|
1280
|
+
key: string;
|
1281
|
+
type: "email";
|
1282
|
+
error: string;
|
1283
|
+
required: boolean;
|
1284
|
+
array: boolean;
|
1285
|
+
xdefault?: string | null | undefined;
|
1286
|
+
}, {
|
1287
|
+
key: string;
|
1288
|
+
type?: "email" | undefined;
|
1289
|
+
error?: string | undefined;
|
1290
|
+
required?: boolean | undefined;
|
1291
|
+
array?: boolean | undefined;
|
1292
|
+
xdefault?: string | null | undefined;
|
1293
|
+
}>]>, z.ZodObject<{
|
1294
|
+
key: z.ZodString;
|
1295
|
+
type: z.ZodLiteral<"ip">;
|
1296
|
+
error: z.ZodDefault<z.ZodString>;
|
1297
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
1298
|
+
array: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
1299
|
+
xdefault: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
1300
|
+
}, "strip", z.ZodTypeAny, {
|
1301
|
+
key: string;
|
1302
|
+
type: "ip";
|
1303
|
+
error: string;
|
1304
|
+
required: boolean;
|
1305
|
+
array: boolean;
|
1306
|
+
xdefault?: string | null | undefined;
|
1307
|
+
}, {
|
1308
|
+
key: string;
|
1309
|
+
type: "ip";
|
1310
|
+
error?: string | undefined;
|
1311
|
+
required?: boolean | undefined;
|
1312
|
+
array?: boolean | undefined;
|
1313
|
+
xdefault?: string | null | undefined;
|
1314
|
+
}>]>, z.ZodObject<{
|
1315
|
+
key: z.ZodString;
|
1316
|
+
type: z.ZodDefault<z.ZodLiteral<"url">>;
|
1317
|
+
error: z.ZodDefault<z.ZodString>;
|
1318
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
1319
|
+
array: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
1320
|
+
xdefault: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
1321
|
+
}, "strip", z.ZodTypeAny, {
|
1322
|
+
key: string;
|
1323
|
+
type: "url";
|
1324
|
+
error: string;
|
1325
|
+
required: boolean;
|
1326
|
+
array: boolean;
|
1327
|
+
xdefault?: string | null | undefined;
|
1328
|
+
}, {
|
1329
|
+
key: string;
|
1330
|
+
type?: "url" | undefined;
|
1331
|
+
error?: string | undefined;
|
1332
|
+
required?: boolean | undefined;
|
1333
|
+
array?: boolean | undefined;
|
1334
|
+
xdefault?: string | null | undefined;
|
1335
|
+
}>]>, z.ZodObject<{
|
1336
|
+
key: z.ZodString;
|
1337
|
+
type: z.ZodDefault<z.ZodLiteral<"enum">>;
|
1338
|
+
error: z.ZodDefault<z.ZodString>;
|
1339
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
1340
|
+
array: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
1341
|
+
elements: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
1342
|
+
xdefault: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
1343
|
+
}, "strip", z.ZodTypeAny, {
|
1344
|
+
key: string;
|
1345
|
+
type: "enum";
|
1346
|
+
error: string;
|
1347
|
+
required: boolean;
|
1348
|
+
array: boolean;
|
1349
|
+
elements: string[];
|
1350
|
+
xdefault?: string | null | undefined;
|
1351
|
+
}, {
|
1352
|
+
key: string;
|
1353
|
+
type?: "enum" | undefined;
|
1354
|
+
error?: string | undefined;
|
1355
|
+
required?: boolean | undefined;
|
1356
|
+
array?: boolean | undefined;
|
1357
|
+
elements?: string[] | undefined;
|
1358
|
+
xdefault?: string | null | undefined;
|
1359
|
+
}>]>, z.ZodObject<{
|
1360
|
+
key: z.ZodString;
|
1361
|
+
type: z.ZodDefault<z.ZodLiteral<"relationship">>;
|
1362
|
+
error: z.ZodDefault<z.ZodString>;
|
1363
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
1364
|
+
array: z.ZodOptional<z.ZodBoolean>;
|
1365
|
+
relatedCollection: z.ZodString;
|
1366
|
+
relationType: z.ZodEnum<["oneToMany", "manyToOne", "oneToOne", "manyToMany"]>;
|
1367
|
+
twoWay: z.ZodBoolean;
|
1368
|
+
twoWayKey: z.ZodString;
|
1369
|
+
onDelete: z.ZodDefault<z.ZodEnum<["setNull", "cascade", "restrict"]>>;
|
1370
|
+
side: z.ZodEnum<["parent", "child"]>;
|
1371
|
+
importMapping: z.ZodOptional<z.ZodObject<{
|
1372
|
+
originalIdField: z.ZodString;
|
1373
|
+
targetField: z.ZodOptional<z.ZodString>;
|
1374
|
+
}, "strip", z.ZodTypeAny, {
|
1375
|
+
originalIdField: string;
|
1376
|
+
targetField?: string | undefined;
|
1377
|
+
}, {
|
1378
|
+
originalIdField: string;
|
1379
|
+
targetField?: string | undefined;
|
1380
|
+
}>>;
|
1381
|
+
}, "strip", z.ZodTypeAny, {
|
1382
|
+
key: string;
|
1383
|
+
type: "relationship";
|
1384
|
+
error: string;
|
1385
|
+
required: boolean;
|
1386
|
+
relatedCollection: string;
|
1387
|
+
relationType: "oneToMany" | "manyToOne" | "oneToOne" | "manyToMany";
|
1388
|
+
twoWay: boolean;
|
1389
|
+
twoWayKey: string;
|
1390
|
+
onDelete: "setNull" | "cascade" | "restrict";
|
1391
|
+
side: "parent" | "child";
|
1392
|
+
array?: boolean | undefined;
|
1393
|
+
importMapping?: {
|
1394
|
+
originalIdField: string;
|
1395
|
+
targetField?: string | undefined;
|
1396
|
+
} | undefined;
|
1397
|
+
}, {
|
1398
|
+
key: string;
|
1399
|
+
relatedCollection: string;
|
1400
|
+
relationType: "oneToMany" | "manyToOne" | "oneToOne" | "manyToMany";
|
1401
|
+
twoWay: boolean;
|
1402
|
+
twoWayKey: string;
|
1403
|
+
side: "parent" | "child";
|
1404
|
+
type?: "relationship" | undefined;
|
1405
|
+
error?: string | undefined;
|
1406
|
+
required?: boolean | undefined;
|
1407
|
+
array?: boolean | undefined;
|
1408
|
+
onDelete?: "setNull" | "cascade" | "restrict" | undefined;
|
1409
|
+
importMapping?: {
|
1410
|
+
originalIdField: string;
|
1411
|
+
targetField?: string | undefined;
|
1412
|
+
} | undefined;
|
1413
|
+
}>]>, "many">>;
|
1101
1414
|
export declare const collectionSchema: z.ZodObject<{
|
1415
|
+
name: z.ZodString;
|
1102
1416
|
$id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
1417
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
1418
|
+
documentSecurity: z.ZodDefault<z.ZodBoolean>;
|
1103
1419
|
$createdAt: z.ZodString;
|
1104
1420
|
$updatedAt: z.ZodString;
|
1105
1421
|
$permissions: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
@@ -1112,10 +1428,6 @@ export declare const collectionSchema: z.ZodObject<{
|
|
1112
1428
|
permission: string;
|
1113
1429
|
target: string;
|
1114
1430
|
}>, "many">>;
|
1115
|
-
databaseId: z.ZodOptional<z.ZodString>;
|
1116
|
-
name: z.ZodString;
|
1117
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
1118
|
-
documentSecurity: z.ZodDefault<z.ZodBoolean>;
|
1119
1431
|
attributes: z.ZodDefault<z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
|
1120
1432
|
key: z.ZodString;
|
1121
1433
|
type: z.ZodDefault<z.ZodLiteral<"string">>;
|
@@ -1571,6 +1883,7 @@ export declare const collectionSchema: z.ZodObject<{
|
|
1571
1883
|
targetField: string;
|
1572
1884
|
} | undefined;
|
1573
1885
|
}>, "many">>;
|
1886
|
+
databaseId: z.ZodOptional<z.ZodString>;
|
1574
1887
|
}, "strip", z.ZodTypeAny, {
|
1575
1888
|
attributes: ({
|
1576
1889
|
key: string;
|
@@ -1661,14 +1974,14 @@ export declare const collectionSchema: z.ZodObject<{
|
|
1661
1974
|
})[];
|
1662
1975
|
name: string;
|
1663
1976
|
$id: string;
|
1977
|
+
enabled: boolean;
|
1978
|
+
documentSecurity: boolean;
|
1664
1979
|
$createdAt: string;
|
1665
1980
|
$updatedAt: string;
|
1666
1981
|
$permissions: {
|
1667
1982
|
permission: string;
|
1668
1983
|
target: string;
|
1669
1984
|
}[];
|
1670
|
-
enabled: boolean;
|
1671
|
-
documentSecurity: boolean;
|
1672
1985
|
indexes: {
|
1673
1986
|
key: string;
|
1674
1987
|
type: "key" | "unique" | "fulltext";
|
@@ -1717,13 +2030,12 @@ export declare const collectionSchema: z.ZodObject<{
|
|
1717
2030
|
$createdAt: string;
|
1718
2031
|
$updatedAt: string;
|
1719
2032
|
$id?: string | undefined;
|
2033
|
+
enabled?: boolean | undefined;
|
2034
|
+
documentSecurity?: boolean | undefined;
|
1720
2035
|
$permissions?: {
|
1721
2036
|
permission: string;
|
1722
2037
|
target: string;
|
1723
2038
|
}[] | undefined;
|
1724
|
-
databaseId?: string | undefined;
|
1725
|
-
enabled?: boolean | undefined;
|
1726
|
-
documentSecurity?: boolean | undefined;
|
1727
2039
|
attributes?: ({
|
1728
2040
|
key: string;
|
1729
2041
|
type?: "string" | undefined;
|
@@ -1853,9 +2165,13 @@ export declare const collectionSchema: z.ZodObject<{
|
|
1853
2165
|
targetField: string;
|
1854
2166
|
} | undefined;
|
1855
2167
|
}[] | undefined;
|
2168
|
+
databaseId?: string | undefined;
|
1856
2169
|
}>;
|
1857
2170
|
export declare const CollectionCreateSchema: z.ZodObject<Omit<{
|
2171
|
+
name: z.ZodString;
|
1858
2172
|
$id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
2173
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
2174
|
+
documentSecurity: z.ZodDefault<z.ZodBoolean>;
|
1859
2175
|
$createdAt: z.ZodString;
|
1860
2176
|
$updatedAt: z.ZodString;
|
1861
2177
|
$permissions: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
@@ -1868,10 +2184,6 @@ export declare const CollectionCreateSchema: z.ZodObject<Omit<{
|
|
1868
2184
|
permission: string;
|
1869
2185
|
target: string;
|
1870
2186
|
}>, "many">>;
|
1871
|
-
databaseId: z.ZodOptional<z.ZodString>;
|
1872
|
-
name: z.ZodString;
|
1873
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
1874
|
-
documentSecurity: z.ZodDefault<z.ZodBoolean>;
|
1875
2187
|
attributes: z.ZodDefault<z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
|
1876
2188
|
key: z.ZodString;
|
1877
2189
|
type: z.ZodDefault<z.ZodLiteral<"string">>;
|
@@ -2327,6 +2639,7 @@ export declare const CollectionCreateSchema: z.ZodObject<Omit<{
|
|
2327
2639
|
targetField: string;
|
2328
2640
|
} | undefined;
|
2329
2641
|
}>, "many">>;
|
2642
|
+
databaseId: z.ZodOptional<z.ZodString>;
|
2330
2643
|
}, "$createdAt" | "$updatedAt">, "strip", z.ZodTypeAny, {
|
2331
2644
|
attributes: ({
|
2332
2645
|
key: string;
|
@@ -2417,12 +2730,12 @@ export declare const CollectionCreateSchema: z.ZodObject<Omit<{
|
|
2417
2730
|
})[];
|
2418
2731
|
name: string;
|
2419
2732
|
$id: string;
|
2733
|
+
enabled: boolean;
|
2734
|
+
documentSecurity: boolean;
|
2420
2735
|
$permissions: {
|
2421
2736
|
permission: string;
|
2422
2737
|
target: string;
|
2423
2738
|
}[];
|
2424
|
-
enabled: boolean;
|
2425
|
-
documentSecurity: boolean;
|
2426
2739
|
indexes: {
|
2427
2740
|
key: string;
|
2428
2741
|
type: "key" | "unique" | "fulltext";
|
@@ -2556,13 +2869,12 @@ export declare const CollectionCreateSchema: z.ZodObject<Omit<{
|
|
2556
2869
|
} | undefined;
|
2557
2870
|
})[] | undefined;
|
2558
2871
|
$id?: string | undefined;
|
2872
|
+
enabled?: boolean | undefined;
|
2873
|
+
documentSecurity?: boolean | undefined;
|
2559
2874
|
$permissions?: {
|
2560
2875
|
permission: string;
|
2561
2876
|
target: string;
|
2562
2877
|
}[] | undefined;
|
2563
|
-
databaseId?: string | undefined;
|
2564
|
-
enabled?: boolean | undefined;
|
2565
|
-
documentSecurity?: boolean | undefined;
|
2566
2878
|
indexes?: {
|
2567
2879
|
key: string;
|
2568
2880
|
attributes: string[];
|
@@ -2605,6 +2917,7 @@ export declare const CollectionCreateSchema: z.ZodObject<Omit<{
|
|
2605
2917
|
targetField: string;
|
2606
2918
|
} | undefined;
|
2607
2919
|
}[] | undefined;
|
2920
|
+
databaseId?: string | undefined;
|
2608
2921
|
}>;
|
2609
2922
|
export type Collection = z.infer<typeof collectionSchema>;
|
2610
2923
|
export type CollectionCreate = z.infer<typeof CollectionCreateSchema>;
|
@@ -2633,7 +2946,10 @@ export declare const AppwriteConfigSchema: z.ZodObject<{
|
|
2633
2946
|
$id: string;
|
2634
2947
|
}>, "many">>;
|
2635
2948
|
collections: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<Omit<{
|
2949
|
+
name: z.ZodString;
|
2636
2950
|
$id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
2951
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
2952
|
+
documentSecurity: z.ZodDefault<z.ZodBoolean>;
|
2637
2953
|
$createdAt: z.ZodString;
|
2638
2954
|
$updatedAt: z.ZodString;
|
2639
2955
|
$permissions: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
@@ -2646,10 +2962,6 @@ export declare const AppwriteConfigSchema: z.ZodObject<{
|
|
2646
2962
|
permission: string;
|
2647
2963
|
target: string;
|
2648
2964
|
}>, "many">>;
|
2649
|
-
databaseId: z.ZodOptional<z.ZodString>;
|
2650
|
-
name: z.ZodString;
|
2651
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
2652
|
-
documentSecurity: z.ZodDefault<z.ZodBoolean>;
|
2653
2965
|
attributes: z.ZodDefault<z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
|
2654
2966
|
key: z.ZodString;
|
2655
2967
|
type: z.ZodDefault<z.ZodLiteral<"string">>;
|
@@ -3105,6 +3417,7 @@ export declare const AppwriteConfigSchema: z.ZodObject<{
|
|
3105
3417
|
targetField: string;
|
3106
3418
|
} | undefined;
|
3107
3419
|
}>, "many">>;
|
3420
|
+
databaseId: z.ZodOptional<z.ZodString>;
|
3108
3421
|
}, "$createdAt" | "$updatedAt">, "strip", z.ZodTypeAny, {
|
3109
3422
|
attributes: ({
|
3110
3423
|
key: string;
|
@@ -3195,12 +3508,12 @@ export declare const AppwriteConfigSchema: z.ZodObject<{
|
|
3195
3508
|
})[];
|
3196
3509
|
name: string;
|
3197
3510
|
$id: string;
|
3511
|
+
enabled: boolean;
|
3512
|
+
documentSecurity: boolean;
|
3198
3513
|
$permissions: {
|
3199
3514
|
permission: string;
|
3200
3515
|
target: string;
|
3201
3516
|
}[];
|
3202
|
-
enabled: boolean;
|
3203
|
-
documentSecurity: boolean;
|
3204
3517
|
indexes: {
|
3205
3518
|
key: string;
|
3206
3519
|
type: "key" | "unique" | "fulltext";
|
@@ -3334,13 +3647,12 @@ export declare const AppwriteConfigSchema: z.ZodObject<{
|
|
3334
3647
|
} | undefined;
|
3335
3648
|
})[] | undefined;
|
3336
3649
|
$id?: string | undefined;
|
3650
|
+
enabled?: boolean | undefined;
|
3651
|
+
documentSecurity?: boolean | undefined;
|
3337
3652
|
$permissions?: {
|
3338
3653
|
permission: string;
|
3339
3654
|
target: string;
|
3340
3655
|
}[] | undefined;
|
3341
|
-
databaseId?: string | undefined;
|
3342
|
-
enabled?: boolean | undefined;
|
3343
|
-
documentSecurity?: boolean | undefined;
|
3344
3656
|
indexes?: {
|
3345
3657
|
key: string;
|
3346
3658
|
attributes: string[];
|
@@ -3383,6 +3695,7 @@ export declare const AppwriteConfigSchema: z.ZodObject<{
|
|
3383
3695
|
targetField: string;
|
3384
3696
|
} | undefined;
|
3385
3697
|
}[] | undefined;
|
3698
|
+
databaseId?: string | undefined;
|
3386
3699
|
}>, "many">>>;
|
3387
3700
|
}, "strip", z.ZodTypeAny, {
|
3388
3701
|
appwriteEndpoint: string;
|
@@ -3491,12 +3804,12 @@ export declare const AppwriteConfigSchema: z.ZodObject<{
|
|
3491
3804
|
})[];
|
3492
3805
|
name: string;
|
3493
3806
|
$id: string;
|
3807
|
+
enabled: boolean;
|
3808
|
+
documentSecurity: boolean;
|
3494
3809
|
$permissions: {
|
3495
3810
|
permission: string;
|
3496
3811
|
target: string;
|
3497
3812
|
}[];
|
3498
|
-
enabled: boolean;
|
3499
|
-
documentSecurity: boolean;
|
3500
3813
|
indexes: {
|
3501
3814
|
key: string;
|
3502
3815
|
type: "key" | "unique" | "fulltext";
|
@@ -3650,13 +3963,12 @@ export declare const AppwriteConfigSchema: z.ZodObject<{
|
|
3650
3963
|
} | undefined;
|
3651
3964
|
})[] | undefined;
|
3652
3965
|
$id?: string | undefined;
|
3966
|
+
enabled?: boolean | undefined;
|
3967
|
+
documentSecurity?: boolean | undefined;
|
3653
3968
|
$permissions?: {
|
3654
3969
|
permission: string;
|
3655
3970
|
target: string;
|
3656
3971
|
}[] | undefined;
|
3657
|
-
databaseId?: string | undefined;
|
3658
|
-
enabled?: boolean | undefined;
|
3659
|
-
documentSecurity?: boolean | undefined;
|
3660
3972
|
indexes?: {
|
3661
3973
|
key: string;
|
3662
3974
|
attributes: string[];
|
@@ -3699,6 +4011,7 @@ export declare const AppwriteConfigSchema: z.ZodObject<{
|
|
3699
4011
|
targetField: string;
|
3700
4012
|
} | undefined;
|
3701
4013
|
}[] | undefined;
|
4014
|
+
databaseId?: string | undefined;
|
3702
4015
|
}[] | undefined;
|
3703
4016
|
}>;
|
3704
4017
|
export type AppwriteConfig = z.infer<typeof AppwriteConfigSchema>;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ID, IndexType } from "node-appwrite";
|
1
|
+
import { ID, IndexType, Permission } from "node-appwrite";
|
2
2
|
import { z } from "zod";
|
3
3
|
const stringAttributeSchema = z.object({
|
4
4
|
key: z.string().describe("The key of the attribute"),
|
@@ -324,6 +324,7 @@ export const indexSchema = z.object({
|
|
324
324
|
attributes: z.array(z.string()),
|
325
325
|
orders: z.array(z.string()).optional(),
|
326
326
|
});
|
327
|
+
export const indexesSchema = z.array(indexSchema);
|
327
328
|
export const AttributeMappingsSchema = z.array(z.object({
|
328
329
|
oldKey: z
|
329
330
|
.string()
|
@@ -416,12 +417,40 @@ export const importDefSchemas = z
|
|
416
417
|
.array(importDefSchema)
|
417
418
|
.default([])
|
418
419
|
.describe("The import definitions for the database");
|
420
|
+
export const permissionSchema = z
|
421
|
+
.object({
|
422
|
+
permission: z.string(),
|
423
|
+
target: z.string(),
|
424
|
+
})
|
425
|
+
.or(z.string().transform((val) => {
|
426
|
+
const trimmedVal = val.trim();
|
427
|
+
// Adjusted regex to match double quotes
|
428
|
+
const match = trimmedVal.match(/^(\w+)\("([^"]+)"\)$/);
|
429
|
+
if (!match) {
|
430
|
+
throw new Error(`Invalid permission format: ${trimmedVal}`);
|
431
|
+
}
|
432
|
+
return {
|
433
|
+
permission: match[1],
|
434
|
+
target: match[2],
|
435
|
+
};
|
436
|
+
}));
|
437
|
+
export const permissionsSchema = z.array(permissionSchema).optional();
|
438
|
+
export const attributesSchema = z.array(attributeSchema).default([]);
|
419
439
|
export const collectionSchema = z.object({
|
440
|
+
name: z.string().describe("The name of the collection"),
|
420
441
|
$id: z
|
421
442
|
.string()
|
422
443
|
.optional()
|
423
444
|
.default(ID.unique())
|
424
445
|
.describe("The ID of the collection, auto generated if not provided"),
|
446
|
+
enabled: z
|
447
|
+
.boolean()
|
448
|
+
.default(true)
|
449
|
+
.describe("Whether the collection is enabled or not"),
|
450
|
+
documentSecurity: z
|
451
|
+
.boolean()
|
452
|
+
.default(false)
|
453
|
+
.describe("Whether document security is enabled or not"),
|
425
454
|
$createdAt: z.string(),
|
426
455
|
$updatedAt: z.string(),
|
427
456
|
$permissions: z
|
@@ -431,19 +460,6 @@ export const collectionSchema = z.object({
|
|
431
460
|
}))
|
432
461
|
.default([])
|
433
462
|
.describe("The permissions of the collection"),
|
434
|
-
databaseId: z
|
435
|
-
.string()
|
436
|
-
.optional()
|
437
|
-
.describe("The ID of the database the collection belongs to"),
|
438
|
-
name: z.string().describe("The name of the collection"),
|
439
|
-
enabled: z
|
440
|
-
.boolean()
|
441
|
-
.default(true)
|
442
|
-
.describe("Whether the collection is enabled or not"),
|
443
|
-
documentSecurity: z
|
444
|
-
.boolean()
|
445
|
-
.default(false)
|
446
|
-
.describe("Whether document security is enabled or not"),
|
447
463
|
attributes: z
|
448
464
|
.array(attributeSchema)
|
449
465
|
.default([])
|
@@ -453,6 +469,10 @@ export const collectionSchema = z.object({
|
|
453
469
|
.default([])
|
454
470
|
.describe("The indexes of the collection"),
|
455
471
|
importDefs: importDefSchemas,
|
472
|
+
databaseId: z
|
473
|
+
.string()
|
474
|
+
.optional()
|
475
|
+
.describe("The ID of the database the collection belongs to"),
|
456
476
|
});
|
457
477
|
export const CollectionCreateSchema = collectionSchema.omit({
|
458
478
|
$createdAt: true,
|