appwrite-cli 13.6.1 → 14.0.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 (35) hide show
  1. package/.github/workflows/ci.yml +66 -0
  2. package/CHANGELOG.md +10 -0
  3. package/README.md +2 -2
  4. package/dist/bundle-win-arm64.mjs +274 -100
  5. package/dist/cli.cjs +274 -100
  6. package/dist/index.cjs +200 -81
  7. package/dist/index.js +200 -81
  8. package/dist/lib/commands/generate.d.ts +2 -0
  9. package/dist/lib/commands/generate.d.ts.map +1 -1
  10. package/dist/lib/commands/generators/base.d.ts +20 -2
  11. package/dist/lib/commands/generators/base.d.ts.map +1 -1
  12. package/dist/lib/commands/generators/index.d.ts +1 -1
  13. package/dist/lib/commands/generators/index.d.ts.map +1 -1
  14. package/dist/lib/commands/generators/typescript/databases.d.ts +2 -2
  15. package/dist/lib/commands/generators/typescript/databases.d.ts.map +1 -1
  16. package/dist/lib/constants.d.ts +1 -1
  17. package/docs/examples/projects/update-status.md +5 -0
  18. package/docs/examples/sites/create-deployment.md +1 -2
  19. package/install.ps1 +2 -2
  20. package/install.sh +1 -1
  21. package/lib/commands/generate.ts +15 -2
  22. package/lib/commands/generators/base.ts +27 -2
  23. package/lib/commands/generators/index.ts +1 -0
  24. package/lib/commands/generators/typescript/databases.ts +22 -12
  25. package/lib/commands/services/account.ts +1 -1
  26. package/lib/commands/services/databases.ts +20 -19
  27. package/lib/commands/services/health.ts +13 -0
  28. package/lib/commands/services/messaging.ts +1 -1
  29. package/lib/commands/services/projects.ts +25 -0
  30. package/lib/commands/services/sites.ts +8 -3
  31. package/lib/commands/services/tables-db.ts +3 -2
  32. package/lib/commands/services/teams.ts +2 -2
  33. package/lib/constants.ts +1 -1
  34. package/package.json +2 -2
  35. package/scoop/appwrite.config.json +3 -3
package/dist/index.cjs CHANGED
@@ -69377,7 +69377,7 @@ var id_default = ID;
69377
69377
  // lib/constants.ts
69378
69378
  var SDK_TITLE = "Appwrite";
69379
69379
  var SDK_TITLE_LOWER = "appwrite";
69380
- var SDK_VERSION = "13.6.1";
69380
+ var SDK_VERSION = "14.0.0";
69381
69381
  var SDK_LOGO = "\n _ _ _ ___ __ _____\n /_\\ _ __ _ ____ ___ __(_) |_ ___ / __\\ / / \\_ \\\n //_\\\\| '_ \\| '_ \\ \\ /\\ / / '__| | __/ _ \\ / / / / / /\\/\n / _ \\ |_) | |_) \\ V V /| | | | || __/ / /___/ /___/\\/ /_\n \\_/ \\_/ .__/| .__/ \\_/\\_/ |_| |_|\\__\\___| \\____/\\____/\\____/\n |_| |_|\n\n";
69382
69382
  var EXECUTABLE_NAME = "appwrite";
69383
69383
  var NPM_PACKAGE_NAME = "appwrite-cli";
@@ -84958,7 +84958,7 @@ var Client = class _Client {
84958
84958
  "x-sdk-name": "Console",
84959
84959
  "x-sdk-platform": "console",
84960
84960
  "x-sdk-language": "web",
84961
- "x-sdk-version": "3.1.0",
84961
+ "x-sdk-version": "4.0.0",
84962
84962
  "X-Appwrite-Response-Format": "1.8.0"
84963
84963
  };
84964
84964
  this.realtime = {
@@ -87696,6 +87696,47 @@ var Databases = class {
87696
87696
  };
87697
87697
  return this.client.call("post", uri, apiHeaders, payload);
87698
87698
  }
87699
+ updateRelationshipAttribute(paramsOrFirst, ...rest) {
87700
+ let params;
87701
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
87702
+ params = paramsOrFirst || {};
87703
+ } else {
87704
+ params = {
87705
+ databaseId: paramsOrFirst,
87706
+ collectionId: rest[0],
87707
+ key: rest[1],
87708
+ onDelete: rest[2],
87709
+ newKey: rest[3]
87710
+ };
87711
+ }
87712
+ const databaseId = params.databaseId;
87713
+ const collectionId = params.collectionId;
87714
+ const key = params.key;
87715
+ const onDelete = params.onDelete;
87716
+ const newKey = params.newKey;
87717
+ if (typeof databaseId === "undefined") {
87718
+ throw new AppwriteException('Missing required parameter: "databaseId"');
87719
+ }
87720
+ if (typeof collectionId === "undefined") {
87721
+ throw new AppwriteException('Missing required parameter: "collectionId"');
87722
+ }
87723
+ if (typeof key === "undefined") {
87724
+ throw new AppwriteException('Missing required parameter: "key"');
87725
+ }
87726
+ const apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/relationship/{key}".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId).replace("{key}", key);
87727
+ const payload = {};
87728
+ if (typeof onDelete !== "undefined") {
87729
+ payload["onDelete"] = onDelete;
87730
+ }
87731
+ if (typeof newKey !== "undefined") {
87732
+ payload["newKey"] = newKey;
87733
+ }
87734
+ const uri = new URL(this.client.config.endpoint + apiPath);
87735
+ const apiHeaders = {
87736
+ "content-type": "application/json"
87737
+ };
87738
+ return this.client.call("patch", uri, apiHeaders, payload);
87739
+ }
87699
87740
  createStringAttribute(paramsOrFirst, ...rest) {
87700
87741
  let params;
87701
87742
  if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
@@ -88213,47 +88254,6 @@ var Databases = class {
88213
88254
  };
88214
88255
  return this.client.call("delete", uri, apiHeaders, payload);
88215
88256
  }
88216
- updateRelationshipAttribute(paramsOrFirst, ...rest) {
88217
- let params;
88218
- if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
88219
- params = paramsOrFirst || {};
88220
- } else {
88221
- params = {
88222
- databaseId: paramsOrFirst,
88223
- collectionId: rest[0],
88224
- key: rest[1],
88225
- onDelete: rest[2],
88226
- newKey: rest[3]
88227
- };
88228
- }
88229
- const databaseId = params.databaseId;
88230
- const collectionId = params.collectionId;
88231
- const key = params.key;
88232
- const onDelete = params.onDelete;
88233
- const newKey = params.newKey;
88234
- if (typeof databaseId === "undefined") {
88235
- throw new AppwriteException('Missing required parameter: "databaseId"');
88236
- }
88237
- if (typeof collectionId === "undefined") {
88238
- throw new AppwriteException('Missing required parameter: "collectionId"');
88239
- }
88240
- if (typeof key === "undefined") {
88241
- throw new AppwriteException('Missing required parameter: "key"');
88242
- }
88243
- const apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId).replace("{key}", key);
88244
- const payload = {};
88245
- if (typeof onDelete !== "undefined") {
88246
- payload["onDelete"] = onDelete;
88247
- }
88248
- if (typeof newKey !== "undefined") {
88249
- payload["newKey"] = newKey;
88250
- }
88251
- const uri = new URL(this.client.config.endpoint + apiPath);
88252
- const apiHeaders = {
88253
- "content-type": "application/json"
88254
- };
88255
- return this.client.call("patch", uri, apiHeaders, payload);
88256
- }
88257
88257
  listDocuments(paramsOrFirst, ...rest) {
88258
88258
  let params;
88259
88259
  if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
@@ -88264,7 +88264,8 @@ var Databases = class {
88264
88264
  collectionId: rest[0],
88265
88265
  queries: rest[1],
88266
88266
  transactionId: rest[2],
88267
- total: rest[3]
88267
+ total: rest[3],
88268
+ ttl: rest[4]
88268
88269
  };
88269
88270
  }
88270
88271
  const databaseId = params.databaseId;
@@ -88272,6 +88273,7 @@ var Databases = class {
88272
88273
  const queries = params.queries;
88273
88274
  const transactionId = params.transactionId;
88274
88275
  const total = params.total;
88276
+ const ttl = params.ttl;
88275
88277
  if (typeof databaseId === "undefined") {
88276
88278
  throw new AppwriteException('Missing required parameter: "databaseId"');
88277
88279
  }
@@ -88289,6 +88291,9 @@ var Databases = class {
88289
88291
  if (typeof total !== "undefined") {
88290
88292
  payload["total"] = total;
88291
88293
  }
88294
+ if (typeof ttl !== "undefined") {
88295
+ payload["ttl"] = ttl;
88296
+ }
88292
88297
  const uri = new URL(this.client.config.endpoint + apiPath);
88293
88298
  const apiHeaders = {};
88294
88299
  return this.client.call("get", uri, apiHeaders, payload);
@@ -94854,6 +94859,27 @@ var Projects = class {
94854
94859
  };
94855
94860
  return this.client.call("patch", uri, apiHeaders, payload);
94856
94861
  }
94862
+ updateConsoleAccess(paramsOrFirst) {
94863
+ let params;
94864
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
94865
+ params = paramsOrFirst || {};
94866
+ } else {
94867
+ params = {
94868
+ projectId: paramsOrFirst
94869
+ };
94870
+ }
94871
+ const projectId = params.projectId;
94872
+ if (typeof projectId === "undefined") {
94873
+ throw new AppwriteException('Missing required parameter: "projectId"');
94874
+ }
94875
+ const apiPath = "/projects/{projectId}/console-access".replace("{projectId}", projectId);
94876
+ const payload = {};
94877
+ const uri = new URL(this.client.config.endpoint + apiPath);
94878
+ const apiHeaders = {
94879
+ "content-type": "application/json"
94880
+ };
94881
+ return this.client.call("patch", uri, apiHeaders, payload);
94882
+ }
94857
94883
  listDevKeys(paramsOrFirst, ...rest) {
94858
94884
  let params;
94859
94885
  if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
@@ -95930,6 +95956,35 @@ var Projects = class {
95930
95956
  };
95931
95957
  return this.client.call("post", uri, apiHeaders, payload);
95932
95958
  }
95959
+ updateStatus(paramsOrFirst, ...rest) {
95960
+ let params;
95961
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
95962
+ params = paramsOrFirst || {};
95963
+ } else {
95964
+ params = {
95965
+ projectId: paramsOrFirst,
95966
+ status: rest[0]
95967
+ };
95968
+ }
95969
+ const projectId = params.projectId;
95970
+ const status = params.status;
95971
+ if (typeof projectId === "undefined") {
95972
+ throw new AppwriteException('Missing required parameter: "projectId"');
95973
+ }
95974
+ if (typeof status === "undefined") {
95975
+ throw new AppwriteException('Missing required parameter: "status"');
95976
+ }
95977
+ const apiPath = "/projects/{projectId}/status".replace("{projectId}", projectId);
95978
+ const payload = {};
95979
+ if (typeof status !== "undefined") {
95980
+ payload["status"] = status;
95981
+ }
95982
+ const uri = new URL(this.client.config.endpoint + apiPath);
95983
+ const apiHeaders = {
95984
+ "content-type": "application/json"
95985
+ };
95986
+ return this.client.call("patch", uri, apiHeaders, payload);
95987
+ }
95933
95988
  updateTeam(paramsOrFirst, ...rest) {
95934
95989
  let params;
95935
95990
  if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
@@ -97244,28 +97299,25 @@ var Sites = class {
97244
97299
  params = {
97245
97300
  siteId: paramsOrFirst,
97246
97301
  code: rest[0],
97247
- activate: rest[1],
97248
- installCommand: rest[2],
97249
- buildCommand: rest[3],
97250
- outputDirectory: rest[4]
97302
+ installCommand: rest[1],
97303
+ buildCommand: rest[2],
97304
+ outputDirectory: rest[3],
97305
+ activate: rest[4]
97251
97306
  };
97252
97307
  onProgress = rest[5];
97253
97308
  }
97254
97309
  const siteId = params.siteId;
97255
97310
  const code = params.code;
97256
- const activate = params.activate;
97257
97311
  const installCommand = params.installCommand;
97258
97312
  const buildCommand = params.buildCommand;
97259
97313
  const outputDirectory = params.outputDirectory;
97314
+ const activate = params.activate;
97260
97315
  if (typeof siteId === "undefined") {
97261
97316
  throw new AppwriteException('Missing required parameter: "siteId"');
97262
97317
  }
97263
97318
  if (typeof code === "undefined") {
97264
97319
  throw new AppwriteException('Missing required parameter: "code"');
97265
97320
  }
97266
- if (typeof activate === "undefined") {
97267
- throw new AppwriteException('Missing required parameter: "activate"');
97268
- }
97269
97321
  const apiPath = "/sites/{siteId}/deployments".replace("{siteId}", siteId);
97270
97322
  const payload = {};
97271
97323
  if (typeof installCommand !== "undefined") {
@@ -101003,7 +101055,8 @@ var TablesDB = class {
101003
101055
  tableId: rest[0],
101004
101056
  queries: rest[1],
101005
101057
  transactionId: rest[2],
101006
- total: rest[3]
101058
+ total: rest[3],
101059
+ ttl: rest[4]
101007
101060
  };
101008
101061
  }
101009
101062
  const databaseId = params.databaseId;
@@ -101011,6 +101064,7 @@ var TablesDB = class {
101011
101064
  const queries = params.queries;
101012
101065
  const transactionId = params.transactionId;
101013
101066
  const total = params.total;
101067
+ const ttl = params.ttl;
101014
101068
  if (typeof databaseId === "undefined") {
101015
101069
  throw new AppwriteException('Missing required parameter: "databaseId"');
101016
101070
  }
@@ -101028,6 +101082,9 @@ var TablesDB = class {
101028
101082
  if (typeof total !== "undefined") {
101029
101083
  payload["total"] = total;
101030
101084
  }
101085
+ if (typeof ttl !== "undefined") {
101086
+ payload["ttl"] = ttl;
101087
+ }
101031
101088
  const uri = new URL(this.client.config.endpoint + apiPath);
101032
101089
  const apiHeaders = {};
101033
101090
  return this.client.call("get", uri, apiHeaders, payload);
@@ -103339,20 +103396,69 @@ var SmtpEncryption;
103339
103396
  SmtpEncryption2["Ssl"] = "ssl";
103340
103397
  SmtpEncryption2["Tls"] = "tls";
103341
103398
  })(SmtpEncryption || (SmtpEncryption = {}));
103342
- var Resources;
103343
- (function(Resources2) {
103344
- Resources2["User"] = "user";
103345
- Resources2["Database"] = "database";
103346
- Resources2["Table"] = "table";
103347
- Resources2["Column"] = "column";
103348
- Resources2["Index"] = "index";
103349
- Resources2["Row"] = "row";
103350
- Resources2["Document"] = "document";
103351
- Resources2["Attribute"] = "attribute";
103352
- Resources2["Collection"] = "collection";
103353
- Resources2["Bucket"] = "bucket";
103354
- Resources2["File"] = "file";
103355
- })(Resources || (Resources = {}));
103399
+ var AppwriteMigrationResource;
103400
+ (function(AppwriteMigrationResource2) {
103401
+ AppwriteMigrationResource2["User"] = "user";
103402
+ AppwriteMigrationResource2["Team"] = "team";
103403
+ AppwriteMigrationResource2["Membership"] = "membership";
103404
+ AppwriteMigrationResource2["Database"] = "database";
103405
+ AppwriteMigrationResource2["Table"] = "table";
103406
+ AppwriteMigrationResource2["Column"] = "column";
103407
+ AppwriteMigrationResource2["Index"] = "index";
103408
+ AppwriteMigrationResource2["Row"] = "row";
103409
+ AppwriteMigrationResource2["Document"] = "document";
103410
+ AppwriteMigrationResource2["Attribute"] = "attribute";
103411
+ AppwriteMigrationResource2["Collection"] = "collection";
103412
+ AppwriteMigrationResource2["Bucket"] = "bucket";
103413
+ AppwriteMigrationResource2["File"] = "file";
103414
+ AppwriteMigrationResource2["Function"] = "function";
103415
+ AppwriteMigrationResource2["Deployment"] = "deployment";
103416
+ AppwriteMigrationResource2["Environmentvariable"] = "environment-variable";
103417
+ AppwriteMigrationResource2["Site"] = "site";
103418
+ AppwriteMigrationResource2["Sitedeployment"] = "site-deployment";
103419
+ AppwriteMigrationResource2["Sitevariable"] = "site-variable";
103420
+ })(AppwriteMigrationResource || (AppwriteMigrationResource = {}));
103421
+ var FirebaseMigrationResource;
103422
+ (function(FirebaseMigrationResource2) {
103423
+ FirebaseMigrationResource2["User"] = "user";
103424
+ FirebaseMigrationResource2["Database"] = "database";
103425
+ FirebaseMigrationResource2["Table"] = "table";
103426
+ FirebaseMigrationResource2["Column"] = "column";
103427
+ FirebaseMigrationResource2["Row"] = "row";
103428
+ FirebaseMigrationResource2["Document"] = "document";
103429
+ FirebaseMigrationResource2["Attribute"] = "attribute";
103430
+ FirebaseMigrationResource2["Collection"] = "collection";
103431
+ FirebaseMigrationResource2["Bucket"] = "bucket";
103432
+ FirebaseMigrationResource2["File"] = "file";
103433
+ })(FirebaseMigrationResource || (FirebaseMigrationResource = {}));
103434
+ var NHostMigrationResource;
103435
+ (function(NHostMigrationResource2) {
103436
+ NHostMigrationResource2["User"] = "user";
103437
+ NHostMigrationResource2["Database"] = "database";
103438
+ NHostMigrationResource2["Table"] = "table";
103439
+ NHostMigrationResource2["Column"] = "column";
103440
+ NHostMigrationResource2["Index"] = "index";
103441
+ NHostMigrationResource2["Row"] = "row";
103442
+ NHostMigrationResource2["Document"] = "document";
103443
+ NHostMigrationResource2["Attribute"] = "attribute";
103444
+ NHostMigrationResource2["Collection"] = "collection";
103445
+ NHostMigrationResource2["Bucket"] = "bucket";
103446
+ NHostMigrationResource2["File"] = "file";
103447
+ })(NHostMigrationResource || (NHostMigrationResource = {}));
103448
+ var SupabaseMigrationResource;
103449
+ (function(SupabaseMigrationResource2) {
103450
+ SupabaseMigrationResource2["User"] = "user";
103451
+ SupabaseMigrationResource2["Database"] = "database";
103452
+ SupabaseMigrationResource2["Table"] = "table";
103453
+ SupabaseMigrationResource2["Column"] = "column";
103454
+ SupabaseMigrationResource2["Index"] = "index";
103455
+ SupabaseMigrationResource2["Row"] = "row";
103456
+ SupabaseMigrationResource2["Document"] = "document";
103457
+ SupabaseMigrationResource2["Attribute"] = "attribute";
103458
+ SupabaseMigrationResource2["Collection"] = "collection";
103459
+ SupabaseMigrationResource2["Bucket"] = "bucket";
103460
+ SupabaseMigrationResource2["File"] = "file";
103461
+ })(SupabaseMigrationResource || (SupabaseMigrationResource = {}));
103356
103462
  var ProjectUsageRange;
103357
103463
  (function(ProjectUsageRange2) {
103358
103464
  ProjectUsageRange2["OneHour"] = "1h";
@@ -103429,6 +103535,10 @@ var SMTPSecure;
103429
103535
  SMTPSecure2["Tls"] = "tls";
103430
103536
  SMTPSecure2["Ssl"] = "ssl";
103431
103537
  })(SMTPSecure || (SMTPSecure = {}));
103538
+ var Status;
103539
+ (function(Status2) {
103540
+ Status2["Active"] = "active";
103541
+ })(Status || (Status = {}));
103432
103542
  var EmailTemplateType;
103433
103543
  (function(EmailTemplateType2) {
103434
103544
  EmailTemplateType2["Verification"] = "verification";
@@ -103988,6 +104098,17 @@ var BillingPlanGroup;
103988
104098
  BillingPlanGroup2["Pro"] = "pro";
103989
104099
  BillingPlanGroup2["Scale"] = "scale";
103990
104100
  })(BillingPlanGroup || (BillingPlanGroup = {}));
104101
+ var DomainTransferStatusStatus;
104102
+ (function(DomainTransferStatusStatus2) {
104103
+ DomainTransferStatusStatus2["Transferrable"] = "transferrable";
104104
+ DomainTransferStatusStatus2["NotTransferrable"] = "not_transferrable";
104105
+ DomainTransferStatusStatus2["PendingOwner"] = "pending_owner";
104106
+ DomainTransferStatusStatus2["PendingAdmin"] = "pending_admin";
104107
+ DomainTransferStatusStatus2["PendingRegistry"] = "pending_registry";
104108
+ DomainTransferStatusStatus2["Completed"] = "completed";
104109
+ DomainTransferStatusStatus2["Cancelled"] = "cancelled";
104110
+ DomainTransferStatusStatus2["ServiceUnavailable"] = "service_unavailable";
104111
+ })(DomainTransferStatusStatus || (DomainTransferStatusStatus = {}));
103991
104112
 
103992
104113
  // lib/parser.ts
103993
104114
  var import_chalk2 = __toESM(require_source(), 1);
@@ -103999,7 +104120,7 @@ var package_default = {
103999
104120
  type: "module",
104000
104121
  homepage: "https://appwrite.io/support",
104001
104122
  description: "Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API",
104002
- version: "13.6.1",
104123
+ version: "14.0.0",
104003
104124
  license: "BSD-3-Clause",
104004
104125
  main: "dist/index.cjs",
104005
104126
  module: "dist/index.js",
@@ -104043,7 +104164,7 @@ var package_default = {
104043
104164
  "windows-arm64": "esbuild cli.ts --bundle --loader:.hbs=text --platform=node --target=node18 --format=esm --external:fsevents --outfile=dist/bundle-win-arm64.mjs && pkg dist/bundle-win-arm64.mjs -t node18-win-arm64 -o build/appwrite-cli-win-arm64.exe"
104044
104165
  },
104045
104166
  dependencies: {
104046
- "@appwrite.io/console": "^3.1.0",
104167
+ "@appwrite.io/console": "^4.0.0",
104047
104168
  chalk: "4.1.2",
104048
104169
  chokidar: "^3.6.0",
104049
104170
  "cli-progress": "^3.12.0",
@@ -109413,12 +109534,11 @@ ${supportsServerSide ? ` create: (databaseId: string, name: string, options?: {
109413
109534
  delete: <D extends DatabaseId>(databaseId: D) => Promise<void>;` : ""}
109414
109535
  };`;
109415
109536
  }
109416
- generateTypesFile(config2) {
109537
+ generateTypesFile(config2, appwriteDep) {
109417
109538
  const entities = config2.tables?.length ? config2.tables : config2.collections;
109418
109539
  if (!entities || entities.length === 0) {
109419
109540
  return "// No tables or collections found in configuration\n";
109420
109541
  }
109421
- const appwriteDep = getAppwriteDependency();
109422
109542
  const enums = this.generateEnums(entities);
109423
109543
  const types = entities.map((entity) => this.generateTableType(entity, entities)).join("\n\n");
109424
109544
  const entitiesByDb = this.groupEntitiesByDb(entities);
@@ -109506,13 +109626,12 @@ ${supportsServerSide ? ` create: (databaseId: string, name: string, options?: {
109506
109626
  delete (api as Record<string, unknown>).deleteMany;
109507
109627
  }`;
109508
109628
  }
109509
- generateDatabasesFile(config2, importExt) {
109629
+ generateDatabasesFile(config2, importExt, appwriteDep) {
109510
109630
  const entities = config2.tables?.length ? config2.tables : config2.collections;
109511
109631
  if (!entities || entities.length === 0) {
109512
109632
  return "// No tables or collections found in configuration\n";
109513
109633
  }
109514
109634
  const entitiesByDb = this.groupEntitiesByDb(entities);
109515
- const appwriteDep = getAppwriteDependency();
109516
109635
  const supportsServerSide = supportsServerSideMethods(
109517
109636
  appwriteDep,
109518
109637
  this.serverSideOverride
@@ -109535,8 +109654,7 @@ ${supportsServerSide ? ` create: (databaseId: string, name: string, options?: {
109535
109654
  importExt
109536
109655
  });
109537
109656
  }
109538
- generateConstantsFile(config2) {
109539
- const appwriteDep = getAppwriteDependency();
109657
+ generateConstantsFile(config2, appwriteDep) {
109540
109658
  const supportsServerSide = supportsServerSideMethods(
109541
109659
  appwriteDep,
109542
109660
  this.serverSideOverride
@@ -109548,11 +109666,12 @@ ${supportsServerSide ? ` create: (databaseId: string, name: string, options?: {
109548
109666
  requiresApiKey: supportsServerSide
109549
109667
  });
109550
109668
  }
109551
- async generate(config2) {
109669
+ async generate(config2, options) {
109552
109670
  if (!config2.projectId) {
109553
109671
  throw new Error("Project ID is required in configuration");
109554
109672
  }
109555
- const importExt = detectImportExtension();
109673
+ const appwriteDep = options?.appwriteImportSource ?? getAppwriteDependency();
109674
+ const importExt = options?.importExtension ?? detectImportExtension();
109556
109675
  const hasEntities = config2.tables && config2.tables.length > 0 || config2.collections && config2.collections.length > 0;
109557
109676
  if (!hasEntities) {
109558
109677
  console.log(
@@ -109562,14 +109681,14 @@ ${supportsServerSide ? ` create: (databaseId: string, name: string, options?: {
109562
109681
  dbContent: "// No tables or collections found in configuration\n",
109563
109682
  typesContent: "// No tables or collections found in configuration\n",
109564
109683
  indexContent: this.generateIndexFile(importExt),
109565
- constantsContent: this.generateConstantsFile(config2)
109684
+ constantsContent: this.generateConstantsFile(config2, appwriteDep)
109566
109685
  };
109567
109686
  }
109568
109687
  return {
109569
- dbContent: this.generateDatabasesFile(config2, importExt),
109570
- typesContent: this.generateTypesFile(config2),
109688
+ dbContent: this.generateDatabasesFile(config2, importExt, appwriteDep),
109689
+ typesContent: this.generateTypesFile(config2, appwriteDep),
109571
109690
  indexContent: this.generateIndexFile(importExt),
109572
- constantsContent: this.generateConstantsFile(config2)
109691
+ constantsContent: this.generateConstantsFile(config2, appwriteDep)
109573
109692
  };
109574
109693
  }
109575
109694
  };