appwrite-utils-cli 1.2.10 → 1.2.12
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.
@@ -244,7 +244,7 @@ declare const YamlConfigSchema: z.ZodObject<{
|
|
244
244
|
logging: z.ZodOptional<z.ZodBoolean>;
|
245
245
|
entrypoint: z.ZodOptional<z.ZodString>;
|
246
246
|
commands: z.ZodOptional<z.ZodString>;
|
247
|
-
scopes: z.ZodOptional<z.ZodArray<z.ZodEnum<["users.read", "users.write", "teams.read", "teams.write", "databases.read", "databases.write", "collections.read", "collections.write", "attributes.read", "attributes.write", "indexes.read", "indexes.write", "documents.read", "documents.write", "files.read", "files.write", "buckets.read", "buckets.write", "functions.read", "functions.write", "execution.read", "execution.write", "locale.read", "avatars.read", "health.read", "rules.read", "rules.write", "migrations.read", "migrations.write", "vcs.read", "vcs.write", "assistant.read", "messages.read", "messages.write", "targets.read", "targets.write", "providers.read", "providers.write", "topics.read", "topics.write", "subscribers.read", "subscribers.write"]>, "many">>;
|
247
|
+
scopes: z.ZodOptional<z.ZodArray<z.ZodEnum<["users.read", "users.write", "sessions.read", "sessions.write", "teams.read", "teams.write", "databases.read", "databases.write", "collections.read", "collections.write", "attributes.read", "attributes.write", "indexes.read", "indexes.write", "documents.read", "documents.write", "files.read", "files.write", "buckets.read", "buckets.write", "functions.read", "functions.write", "execution.read", "execution.write", "locale.read", "avatars.read", "health.read", "rules.read", "rules.write", "migrations.read", "migrations.write", "sites.read", "sites.write", "log.read", "log.write", "tokens.read", "tokens.write", "vcs.read", "vcs.write", "assistant.read", "messages.read", "messages.write", "targets.read", "targets.write", "providers.read", "providers.write", "topics.read", "topics.write", "subscribers.read", "subscribers.write"]>, "many">>;
|
248
248
|
installationId: z.ZodOptional<z.ZodString>;
|
249
249
|
providerRepositoryId: z.ZodOptional<z.ZodString>;
|
250
250
|
providerBranch: z.ZodOptional<z.ZodString>;
|
@@ -267,7 +267,7 @@ declare const YamlConfigSchema: z.ZodObject<{
|
|
267
267
|
timeout?: number | undefined;
|
268
268
|
entrypoint?: string | undefined;
|
269
269
|
commands?: string | undefined;
|
270
|
-
scopes?: ("users.read" | "users.write" | "teams.read" | "teams.write" | "databases.read" | "databases.write" | "collections.read" | "collections.write" | "attributes.read" | "attributes.write" | "indexes.read" | "indexes.write" | "documents.read" | "documents.write" | "files.read" | "files.write" | "buckets.read" | "buckets.write" | "functions.read" | "functions.write" | "execution.read" | "execution.write" | "locale.read" | "avatars.read" | "health.read" | "rules.read" | "rules.write" | "migrations.read" | "migrations.write" | "vcs.read" | "vcs.write" | "assistant.read" | "messages.read" | "messages.write" | "targets.read" | "targets.write" | "providers.read" | "providers.write" | "topics.read" | "topics.write" | "subscribers.read" | "subscribers.write")[] | undefined;
|
270
|
+
scopes?: ("users.read" | "users.write" | "sessions.read" | "sessions.write" | "teams.read" | "teams.write" | "databases.read" | "databases.write" | "collections.read" | "collections.write" | "attributes.read" | "attributes.write" | "indexes.read" | "indexes.write" | "documents.read" | "documents.write" | "files.read" | "files.write" | "buckets.read" | "buckets.write" | "functions.read" | "functions.write" | "execution.read" | "execution.write" | "locale.read" | "avatars.read" | "health.read" | "rules.read" | "rules.write" | "migrations.read" | "migrations.write" | "sites.read" | "sites.write" | "log.read" | "log.write" | "tokens.read" | "tokens.write" | "vcs.read" | "vcs.write" | "assistant.read" | "messages.read" | "messages.write" | "targets.read" | "targets.write" | "providers.read" | "providers.write" | "topics.read" | "topics.write" | "subscribers.read" | "subscribers.write")[] | undefined;
|
271
271
|
installationId?: string | undefined;
|
272
272
|
providerRepositoryId?: string | undefined;
|
273
273
|
providerBranch?: string | undefined;
|
@@ -290,7 +290,7 @@ declare const YamlConfigSchema: z.ZodObject<{
|
|
290
290
|
timeout?: number | undefined;
|
291
291
|
entrypoint?: string | undefined;
|
292
292
|
commands?: string | undefined;
|
293
|
-
scopes?: ("users.read" | "users.write" | "teams.read" | "teams.write" | "databases.read" | "databases.write" | "collections.read" | "collections.write" | "attributes.read" | "attributes.write" | "indexes.read" | "indexes.write" | "documents.read" | "documents.write" | "files.read" | "files.write" | "buckets.read" | "buckets.write" | "functions.read" | "functions.write" | "execution.read" | "execution.write" | "locale.read" | "avatars.read" | "health.read" | "rules.read" | "rules.write" | "migrations.read" | "migrations.write" | "vcs.read" | "vcs.write" | "assistant.read" | "messages.read" | "messages.write" | "targets.read" | "targets.write" | "providers.read" | "providers.write" | "topics.read" | "topics.write" | "subscribers.read" | "subscribers.write")[] | undefined;
|
293
|
+
scopes?: ("users.read" | "users.write" | "sessions.read" | "sessions.write" | "teams.read" | "teams.write" | "databases.read" | "databases.write" | "collections.read" | "collections.write" | "attributes.read" | "attributes.write" | "indexes.read" | "indexes.write" | "documents.read" | "documents.write" | "files.read" | "files.write" | "buckets.read" | "buckets.write" | "functions.read" | "functions.write" | "execution.read" | "execution.write" | "locale.read" | "avatars.read" | "health.read" | "rules.read" | "rules.write" | "migrations.read" | "migrations.write" | "sites.read" | "sites.write" | "log.read" | "log.write" | "tokens.read" | "tokens.write" | "vcs.read" | "vcs.write" | "assistant.read" | "messages.read" | "messages.write" | "targets.read" | "targets.write" | "providers.read" | "providers.write" | "topics.read" | "topics.write" | "subscribers.read" | "subscribers.write")[] | undefined;
|
294
294
|
installationId?: string | undefined;
|
295
295
|
providerRepositoryId?: string | undefined;
|
296
296
|
providerBranch?: string | undefined;
|
@@ -385,7 +385,7 @@ declare const YamlConfigSchema: z.ZodObject<{
|
|
385
385
|
timeout?: number | undefined;
|
386
386
|
entrypoint?: string | undefined;
|
387
387
|
commands?: string | undefined;
|
388
|
-
scopes?: ("users.read" | "users.write" | "teams.read" | "teams.write" | "databases.read" | "databases.write" | "collections.read" | "collections.write" | "attributes.read" | "attributes.write" | "indexes.read" | "indexes.write" | "documents.read" | "documents.write" | "files.read" | "files.write" | "buckets.read" | "buckets.write" | "functions.read" | "functions.write" | "execution.read" | "execution.write" | "locale.read" | "avatars.read" | "health.read" | "rules.read" | "rules.write" | "migrations.read" | "migrations.write" | "vcs.read" | "vcs.write" | "assistant.read" | "messages.read" | "messages.write" | "targets.read" | "targets.write" | "providers.read" | "providers.write" | "topics.read" | "topics.write" | "subscribers.read" | "subscribers.write")[] | undefined;
|
388
|
+
scopes?: ("users.read" | "users.write" | "sessions.read" | "sessions.write" | "teams.read" | "teams.write" | "databases.read" | "databases.write" | "collections.read" | "collections.write" | "attributes.read" | "attributes.write" | "indexes.read" | "indexes.write" | "documents.read" | "documents.write" | "files.read" | "files.write" | "buckets.read" | "buckets.write" | "functions.read" | "functions.write" | "execution.read" | "execution.write" | "locale.read" | "avatars.read" | "health.read" | "rules.read" | "rules.write" | "migrations.read" | "migrations.write" | "sites.read" | "sites.write" | "log.read" | "log.write" | "tokens.read" | "tokens.write" | "vcs.read" | "vcs.write" | "assistant.read" | "messages.read" | "messages.write" | "targets.read" | "targets.write" | "providers.read" | "providers.write" | "topics.read" | "topics.write" | "subscribers.read" | "subscribers.write")[] | undefined;
|
389
389
|
installationId?: string | undefined;
|
390
390
|
providerRepositoryId?: string | undefined;
|
391
391
|
providerBranch?: string | undefined;
|
@@ -474,7 +474,7 @@ declare const YamlConfigSchema: z.ZodObject<{
|
|
474
474
|
timeout?: number | undefined;
|
475
475
|
entrypoint?: string | undefined;
|
476
476
|
commands?: string | undefined;
|
477
|
-
scopes?: ("users.read" | "users.write" | "teams.read" | "teams.write" | "databases.read" | "databases.write" | "collections.read" | "collections.write" | "attributes.read" | "attributes.write" | "indexes.read" | "indexes.write" | "documents.read" | "documents.write" | "files.read" | "files.write" | "buckets.read" | "buckets.write" | "functions.read" | "functions.write" | "execution.read" | "execution.write" | "locale.read" | "avatars.read" | "health.read" | "rules.read" | "rules.write" | "migrations.read" | "migrations.write" | "vcs.read" | "vcs.write" | "assistant.read" | "messages.read" | "messages.write" | "targets.read" | "targets.write" | "providers.read" | "providers.write" | "topics.read" | "topics.write" | "subscribers.read" | "subscribers.write")[] | undefined;
|
477
|
+
scopes?: ("users.read" | "users.write" | "sessions.read" | "sessions.write" | "teams.read" | "teams.write" | "databases.read" | "databases.write" | "collections.read" | "collections.write" | "attributes.read" | "attributes.write" | "indexes.read" | "indexes.write" | "documents.read" | "documents.write" | "files.read" | "files.write" | "buckets.read" | "buckets.write" | "functions.read" | "functions.write" | "execution.read" | "execution.write" | "locale.read" | "avatars.read" | "health.read" | "rules.read" | "rules.write" | "migrations.read" | "migrations.write" | "sites.read" | "sites.write" | "log.read" | "log.write" | "tokens.read" | "tokens.write" | "vcs.read" | "vcs.write" | "assistant.read" | "messages.read" | "messages.write" | "targets.read" | "targets.write" | "providers.read" | "providers.write" | "topics.read" | "topics.write" | "subscribers.read" | "subscribers.write")[] | undefined;
|
478
478
|
installationId?: string | undefined;
|
479
479
|
providerRepositoryId?: string | undefined;
|
480
480
|
providerBranch?: string | undefined;
|
package/dist/interactiveCLI.js
CHANGED
@@ -879,19 +879,22 @@ export class InteractiveCLI {
|
|
879
879
|
async synchronizeConfigurations() {
|
880
880
|
console.log(chalk.blue("Synchronizing configurations..."));
|
881
881
|
await this.controller.init();
|
882
|
-
// Sync databases and buckets
|
882
|
+
// Sync databases, collections, and buckets
|
883
883
|
const { syncDatabases } = await inquirer.prompt([
|
884
884
|
{
|
885
885
|
type: "confirm",
|
886
886
|
name: "syncDatabases",
|
887
|
-
message: "Do you want to synchronize databases and their buckets?",
|
887
|
+
message: "Do you want to synchronize databases, collections, and their buckets?",
|
888
888
|
default: true,
|
889
889
|
},
|
890
890
|
]);
|
891
891
|
if (syncDatabases) {
|
892
892
|
const remoteDatabases = await fetchAllDatabases(this.controller.database);
|
893
|
+
// Use the controller's synchronizeConfigurations method which handles collections properly
|
894
|
+
console.log(chalk.blue("Pulling collections and generating collection files..."));
|
895
|
+
await this.controller.synchronizeConfigurations(remoteDatabases);
|
896
|
+
// Also configure buckets for any new databases
|
893
897
|
const localDatabases = this.controller.config?.databases || [];
|
894
|
-
// Update config with remote databases that don't exist locally
|
895
898
|
const updatedConfig = await this.configureBuckets({
|
896
899
|
...this.controller.config,
|
897
900
|
databases: [
|
@@ -1065,9 +1068,7 @@ export class InteractiveCLI {
|
|
1065
1068
|
}
|
1066
1069
|
}
|
1067
1070
|
}
|
1068
|
-
//
|
1069
|
-
const schemaGenerator = new SchemaGenerator(this.controller.config, this.controller.getAppwriteFolderPath());
|
1070
|
-
await schemaGenerator.updateConfig(this.controller.config, !this.isUsingTypeScriptConfig);
|
1071
|
+
// Schema generation and collection file writing is handled by controller.synchronizeConfigurations()
|
1071
1072
|
}
|
1072
1073
|
console.log(chalk.green("✨ Configurations synchronized successfully!"));
|
1073
1074
|
}
|
package/dist/utilsController.js
CHANGED
@@ -396,6 +396,8 @@ export class UtilsController {
|
|
396
396
|
}
|
397
397
|
const appwriteToX = new AppwriteToX(configToUse, this.appwriteFolderPath, this.storage);
|
398
398
|
await appwriteToX.toSchemas(databases);
|
399
|
+
// Update the controller's config with the synchronized collections
|
400
|
+
this.config = appwriteToX.updatedConfig;
|
399
401
|
}
|
400
402
|
async syncDb(databases = [], collections = []) {
|
401
403
|
await this.init();
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "appwrite-utils-cli",
|
3
3
|
"description": "Appwrite Utility Functions to help with database management, data conversion, data import, migrations, and much more. Meant to be used as a CLI tool, I do not recommend installing this in frontend environments.",
|
4
|
-
"version": "1.2.
|
4
|
+
"version": "1.2.12",
|
5
5
|
"main": "src/main.ts",
|
6
6
|
"type": "module",
|
7
7
|
"repository": {
|
@@ -33,7 +33,7 @@
|
|
33
33
|
"@types/inquirer": "^9.0.8",
|
34
34
|
"@types/json-schema": "^7.0.15",
|
35
35
|
"@types/yargs": "^17.0.33",
|
36
|
-
"appwrite-utils": "^1.2.
|
36
|
+
"appwrite-utils": "^1.2.1",
|
37
37
|
"chalk": "^5.4.1",
|
38
38
|
"cli-progress": "^3.12.0",
|
39
39
|
"commander": "^12.1.0",
|
package/src/interactiveCLI.ts
CHANGED
@@ -1186,12 +1186,13 @@ export class InteractiveCLI {
|
|
1186
1186
|
private async synchronizeConfigurations(): Promise<void> {
|
1187
1187
|
console.log(chalk.blue("Synchronizing configurations..."));
|
1188
1188
|
await this.controller!.init();
|
1189
|
-
|
1189
|
+
|
1190
|
+
// Sync databases, collections, and buckets
|
1190
1191
|
const { syncDatabases } = await inquirer.prompt([
|
1191
1192
|
{
|
1192
1193
|
type: "confirm",
|
1193
1194
|
name: "syncDatabases",
|
1194
|
-
message: "Do you want to synchronize databases and their buckets?",
|
1195
|
+
message: "Do you want to synchronize databases, collections, and their buckets?",
|
1195
1196
|
default: true,
|
1196
1197
|
},
|
1197
1198
|
]);
|
@@ -1200,9 +1201,13 @@ export class InteractiveCLI {
|
|
1200
1201
|
const remoteDatabases = await fetchAllDatabases(
|
1201
1202
|
this.controller!.database!
|
1202
1203
|
);
|
1204
|
+
|
1205
|
+
// Use the controller's synchronizeConfigurations method which handles collections properly
|
1206
|
+
console.log(chalk.blue("Pulling collections and generating collection files..."));
|
1207
|
+
await this.controller!.synchronizeConfigurations(remoteDatabases);
|
1208
|
+
|
1209
|
+
// Also configure buckets for any new databases
|
1203
1210
|
const localDatabases = this.controller!.config?.databases || [];
|
1204
|
-
|
1205
|
-
// Update config with remote databases that don't exist locally
|
1206
1211
|
const updatedConfig = await this.configureBuckets({
|
1207
1212
|
...this.controller!.config!,
|
1208
1213
|
databases: [
|
@@ -1437,12 +1442,7 @@ export class InteractiveCLI {
|
|
1437
1442
|
}
|
1438
1443
|
}
|
1439
1444
|
|
1440
|
-
//
|
1441
|
-
const schemaGenerator = new SchemaGenerator(
|
1442
|
-
this.controller!.config!,
|
1443
|
-
this.controller!.getAppwriteFolderPath()!
|
1444
|
-
);
|
1445
|
-
await schemaGenerator.updateConfig(this.controller!.config!, !this.isUsingTypeScriptConfig);
|
1445
|
+
// Schema generation and collection file writing is handled by controller.synchronizeConfigurations()
|
1446
1446
|
}
|
1447
1447
|
|
1448
1448
|
console.log(chalk.green("✨ Configurations synchronized successfully!"));
|
package/src/utilsController.ts
CHANGED