appwrite-cli 13.5.0 → 13.6.1

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 (111) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +2 -2
  3. package/cli.ts +7 -5
  4. package/dist/bundle-win-arm64.mjs +988 -258
  5. package/dist/cli.cjs +988 -258
  6. package/dist/index.cjs +183 -112
  7. package/dist/index.js +183 -112
  8. package/dist/lib/commands/config-validations.d.ts +1 -1
  9. package/dist/lib/commands/config-validations.d.ts.map +1 -1
  10. package/dist/lib/commands/errors.d.ts +4 -4
  11. package/dist/lib/commands/errors.d.ts.map +1 -1
  12. package/dist/lib/commands/generate.d.ts.map +1 -1
  13. package/dist/lib/commands/generators/base.d.ts +5 -0
  14. package/dist/lib/commands/generators/base.d.ts.map +1 -1
  15. package/dist/lib/commands/generic.d.ts.map +1 -1
  16. package/dist/lib/commands/init.d.ts.map +1 -1
  17. package/dist/lib/commands/run.d.ts.map +1 -1
  18. package/dist/lib/commands/schema.d.ts.map +1 -1
  19. package/dist/lib/commands/services/activities.d.ts +3 -0
  20. package/dist/lib/commands/services/activities.d.ts.map +1 -0
  21. package/dist/lib/commands/services/backups.d.ts +3 -0
  22. package/dist/lib/commands/services/backups.d.ts.map +1 -0
  23. package/dist/lib/commands/types.d.ts.map +1 -1
  24. package/dist/lib/commands/update.d.ts.map +1 -1
  25. package/dist/lib/commands/utils/change-approval.d.ts +3 -3
  26. package/dist/lib/commands/utils/change-approval.d.ts.map +1 -1
  27. package/dist/lib/commands/utils/database-sync.d.ts.map +1 -1
  28. package/dist/lib/commands/utils/deployment.d.ts +16 -4
  29. package/dist/lib/commands/utils/deployment.d.ts.map +1 -1
  30. package/dist/lib/commands/utils/pools.d.ts.map +1 -1
  31. package/dist/lib/constants.d.ts +1 -1
  32. package/dist/lib/emulation/docker.d.ts.map +1 -1
  33. package/dist/lib/json.d.ts +1 -1
  34. package/dist/lib/json.d.ts.map +1 -1
  35. package/dist/lib/paginate.d.ts +5 -6
  36. package/dist/lib/paginate.d.ts.map +1 -1
  37. package/dist/lib/parser.d.ts +5 -4
  38. package/dist/lib/parser.d.ts.map +1 -1
  39. package/dist/lib/spinner.d.ts +1 -1
  40. package/dist/lib/spinner.d.ts.map +1 -1
  41. package/dist/lib/utils.d.ts +6 -1
  42. package/dist/lib/utils.d.ts.map +1 -1
  43. package/dist/lib/validations.d.ts +1 -1
  44. package/dist/lib/validations.d.ts.map +1 -1
  45. package/docs/examples/account/create-key.md +5 -0
  46. package/docs/examples/account/delete-key.md +4 -0
  47. package/docs/examples/account/get-key.md +4 -0
  48. package/docs/examples/account/list-keys.md +3 -0
  49. package/docs/examples/account/update-key.md +6 -0
  50. package/docs/examples/activities/get-event.md +4 -0
  51. package/docs/examples/activities/list-events.md +3 -0
  52. package/docs/examples/backups/create-archive.md +4 -0
  53. package/docs/examples/backups/create-policy.md +7 -0
  54. package/docs/examples/backups/create-restoration.md +5 -0
  55. package/docs/examples/backups/delete-archive.md +4 -0
  56. package/docs/examples/backups/delete-policy.md +4 -0
  57. package/docs/examples/backups/get-archive.md +4 -0
  58. package/docs/examples/backups/get-policy.md +4 -0
  59. package/docs/examples/backups/get-restoration.md +4 -0
  60. package/docs/examples/backups/list-archives.md +3 -0
  61. package/docs/examples/backups/list-policies.md +3 -0
  62. package/docs/examples/backups/list-restorations.md +3 -0
  63. package/docs/examples/backups/update-policy.md +4 -0
  64. package/eslint.config.js +45 -0
  65. package/install.ps1 +2 -2
  66. package/install.sh +1 -1
  67. package/lib/client.ts +3 -3
  68. package/lib/commands/config-validations.ts +1 -1
  69. package/lib/commands/config.ts +2 -2
  70. package/lib/commands/errors.ts +2 -2
  71. package/lib/commands/generate.ts +8 -6
  72. package/lib/commands/generators/base.ts +6 -0
  73. package/lib/commands/generators/typescript/databases.ts +9 -9
  74. package/lib/commands/generators/typescript/templates/databases.ts.hbs +16 -16
  75. package/lib/commands/generic.ts +21 -16
  76. package/lib/commands/init.ts +147 -61
  77. package/lib/commands/pull.ts +1 -1
  78. package/lib/commands/push.ts +19 -19
  79. package/lib/commands/run.ts +15 -9
  80. package/lib/commands/schema.ts +1 -3
  81. package/lib/commands/services/account.ts +234 -0
  82. package/lib/commands/services/activities.ts +51 -0
  83. package/lib/commands/services/backups.ts +184 -0
  84. package/lib/commands/services/health.ts +55 -0
  85. package/lib/commands/services/projects.ts +1 -1
  86. package/lib/commands/services/storage.ts +2 -2
  87. package/lib/commands/types.ts +18 -8
  88. package/lib/commands/update.ts +24 -16
  89. package/lib/commands/utils/attributes.ts +6 -6
  90. package/lib/commands/utils/change-approval.ts +26 -19
  91. package/lib/commands/utils/database-sync.ts +58 -18
  92. package/lib/commands/utils/deployment.ts +22 -5
  93. package/lib/commands/utils/pools.ts +11 -5
  94. package/lib/config.ts +1 -1
  95. package/lib/constants.ts +1 -1
  96. package/lib/emulation/docker.ts +5 -6
  97. package/lib/emulation/utils.ts +2 -2
  98. package/lib/json.ts +21 -8
  99. package/lib/paginate.ts +30 -20
  100. package/lib/parser.ts +46 -15
  101. package/lib/questions.ts +38 -38
  102. package/lib/spinner.ts +5 -1
  103. package/lib/utils.ts +15 -3
  104. package/lib/validations.ts +1 -1
  105. package/package.json +8 -2
  106. package/scoop/appwrite.config.json +3 -3
  107. package/dist/lib/commands/services/console.d.ts +0 -3
  108. package/dist/lib/commands/services/console.d.ts.map +0 -1
  109. package/docs/examples/console/get-resource.md +0 -5
  110. package/docs/examples/console/variables.md +0 -3
  111. package/lib/commands/services/console.ts +0 -49
@@ -2360,7 +2360,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2360
2360
  }
2361
2361
  return positiveOption || option2;
2362
2362
  };
2363
- const getErrorMessage = (option2) => {
2363
+ const getErrorMessage2 = (option2) => {
2364
2364
  const bestOption = findBestOptionFromValue(option2);
2365
2365
  const optionKey = bestOption.attributeName();
2366
2366
  const source = this.getOptionValueSource(optionKey);
@@ -2369,7 +2369,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2369
2369
  }
2370
2370
  return `option '${bestOption.flags}'`;
2371
2371
  };
2372
- const message = `error: ${getErrorMessage(option)} cannot be used with ${getErrorMessage(conflictingOption)}`;
2372
+ const message = `error: ${getErrorMessage2(option)} cannot be used with ${getErrorMessage2(conflictingOption)}`;
2373
2373
  this.error(message, { code: "commander.conflictingOption" });
2374
2374
  }
2375
2375
  /**
@@ -4315,9 +4315,9 @@ var require_source = __commonJS({
4315
4315
  }
4316
4316
  });
4317
4317
 
4318
- // node_modules/escape-string-regexp/index.js
4318
+ // node_modules/figures/node_modules/escape-string-regexp/index.js
4319
4319
  var require_escape_string_regexp = __commonJS({
4320
- "node_modules/escape-string-regexp/index.js"(exports, module) {
4320
+ "node_modules/figures/node_modules/escape-string-regexp/index.js"(exports, module) {
4321
4321
  "use strict";
4322
4322
  var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
4323
4323
  module.exports = function(str) {
@@ -21981,6 +21981,7 @@ var require_safe_buffer = __commonJS({
21981
21981
  function SafeBuffer(arg, encodingOrOffset, length) {
21982
21982
  return Buffer2(arg, encodingOrOffset, length);
21983
21983
  }
21984
+ SafeBuffer.prototype = Object.create(Buffer2.prototype);
21984
21985
  copyProps(Buffer2, SafeBuffer);
21985
21986
  SafeBuffer.from = function(arg, encodingOrOffset, length) {
21986
21987
  if (typeof arg === "number") {
@@ -24523,16 +24524,16 @@ var require_base = __commonJS({
24523
24524
  }),
24524
24525
  share()
24525
24526
  );
24526
- const success19 = validation.pipe(
24527
+ const success20 = validation.pipe(
24527
24528
  filter((state) => state.isValid === true),
24528
24529
  take(1)
24529
24530
  );
24530
24531
  const error49 = validation.pipe(
24531
24532
  filter((state) => state.isValid !== true),
24532
- takeUntil(success19)
24533
+ takeUntil(success20)
24533
24534
  );
24534
24535
  return {
24535
- success: success19,
24536
+ success: success20,
24536
24537
  error: error49
24537
24538
  };
24538
24539
  }
@@ -61212,6 +61213,20 @@ var require_lodash = __commonJS({
61212
61213
  }
61213
61214
  });
61214
61215
 
61216
+ // node_modules/inquirer-search-list/node_modules/chalk/node_modules/escape-string-regexp/index.js
61217
+ var require_escape_string_regexp2 = __commonJS({
61218
+ "node_modules/inquirer-search-list/node_modules/chalk/node_modules/escape-string-regexp/index.js"(exports, module) {
61219
+ "use strict";
61220
+ var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
61221
+ module.exports = function(str) {
61222
+ if (typeof str !== "string") {
61223
+ throw new TypeError("Expected a string");
61224
+ }
61225
+ return str.replace(matchOperatorsRe, "\\$&");
61226
+ };
61227
+ }
61228
+ });
61229
+
61215
61230
  // node_modules/inquirer-search-list/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/node_modules/color-name/index.js
61216
61231
  var require_color_name2 = __commonJS({
61217
61232
  "node_modules/inquirer-search-list/node_modules/chalk/node_modules/ansi-styles/node_modules/color-convert/node_modules/color-name/index.js"(exports, module) {
@@ -62578,7 +62593,7 @@ var require_templates2 = __commonJS({
62578
62593
  var require_chalk = __commonJS({
62579
62594
  "node_modules/inquirer-search-list/node_modules/chalk/index.js"(exports, module) {
62580
62595
  "use strict";
62581
- var escapeStringRegexp = require_escape_string_regexp();
62596
+ var escapeStringRegexp = require_escape_string_regexp2();
62582
62597
  var ansiStyles = require_ansi_styles2();
62583
62598
  var stdoutColor = require_supports_color2().stdout;
62584
62599
  var template = require_templates2();
@@ -62741,11 +62756,25 @@ var require_chalk = __commonJS({
62741
62756
  }
62742
62757
  });
62743
62758
 
62759
+ // node_modules/inquirer-search-list/node_modules/figures/node_modules/escape-string-regexp/index.js
62760
+ var require_escape_string_regexp3 = __commonJS({
62761
+ "node_modules/inquirer-search-list/node_modules/figures/node_modules/escape-string-regexp/index.js"(exports, module) {
62762
+ "use strict";
62763
+ var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
62764
+ module.exports = function(str) {
62765
+ if (typeof str !== "string") {
62766
+ throw new TypeError("Expected a string");
62767
+ }
62768
+ return str.replace(matchOperatorsRe, "\\$&");
62769
+ };
62770
+ }
62771
+ });
62772
+
62744
62773
  // node_modules/inquirer-search-list/node_modules/figures/index.js
62745
62774
  var require_figures2 = __commonJS({
62746
62775
  "node_modules/inquirer-search-list/node_modules/figures/index.js"(exports, module) {
62747
62776
  "use strict";
62748
- var escapeStringRegexp = require_escape_string_regexp();
62777
+ var escapeStringRegexp = require_escape_string_regexp3();
62749
62778
  var platform = process.platform;
62750
62779
  var main = {
62751
62780
  tick: "\u2714",
@@ -63430,14 +63459,14 @@ var require_base2 = __commonJS({
63430
63459
  return { isValid: err };
63431
63460
  });
63432
63461
  }).share();
63433
- var success19 = validation.filter(function(state) {
63462
+ var success20 = validation.filter(function(state) {
63434
63463
  return state.isValid === true;
63435
63464
  }).take(1);
63436
63465
  var error49 = validation.filter(function(state) {
63437
63466
  return state.isValid !== true;
63438
- }).takeUntil(success19);
63467
+ }).takeUntil(success20);
63439
63468
  return {
63440
- success: success19,
63469
+ success: success20,
63441
63470
  error: error49
63442
63471
  };
63443
63472
  };
@@ -82341,9 +82370,9 @@ var require_is_glob = __commonJS({
82341
82370
  }
82342
82371
  });
82343
82372
 
82344
- // node_modules/glob-parent/index.js
82373
+ // node_modules/chokidar/node_modules/glob-parent/index.js
82345
82374
  var require_glob_parent = __commonJS({
82346
- "node_modules/glob-parent/index.js"(exports, module) {
82375
+ "node_modules/chokidar/node_modules/glob-parent/index.js"(exports, module) {
82347
82376
  "use strict";
82348
82377
  var isGlob = require_is_glob();
82349
82378
  var pathPosixDirname = __require("path").posix.dirname;
@@ -92066,7 +92095,7 @@ var package_default = {
92066
92095
  type: "module",
92067
92096
  homepage: "https://appwrite.io/support",
92068
92097
  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",
92069
- version: "13.5.0",
92098
+ version: "13.6.1",
92070
92099
  license: "BSD-3-Clause",
92071
92100
  main: "dist/index.cjs",
92072
92101
  module: "dist/index.js",
@@ -92097,6 +92126,7 @@ var package_default = {
92097
92126
  "build:lib:esm": "esbuild index.ts --bundle --platform=node --target=node18 --format=esm --loader:.hbs=text --outfile=dist/index.js",
92098
92127
  "build:lib:cjs": "esbuild index.ts --bundle --platform=node --target=node18 --format=cjs --loader:.hbs=text --outfile=dist/index.cjs",
92099
92128
  "build:cli": "esbuild cli.ts --bundle --platform=node --target=node18 --format=cjs --loader:.hbs=text --external:fsevents --outfile=dist/cli.cjs",
92129
+ lint: "eslint .",
92100
92130
  format: 'prettier --write "**/*.{js,ts,json,md}"',
92101
92131
  generate: "tsx scripts/generate-commands.ts",
92102
92132
  prepublishOnly: "npm run build",
@@ -92109,7 +92139,7 @@ var package_default = {
92109
92139
  "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"
92110
92140
  },
92111
92141
  dependencies: {
92112
- "@appwrite.io/console": "^3.0.0",
92142
+ "@appwrite.io/console": "^3.1.0",
92113
92143
  chalk: "4.1.2",
92114
92144
  chokidar: "^3.6.0",
92115
92145
  "cli-progress": "^3.12.0",
@@ -92128,7 +92158,12 @@ var package_default = {
92128
92158
  zod: "^4.3.5"
92129
92159
  },
92130
92160
  devDependencies: {
92161
+ "@typescript-eslint/eslint-plugin": "^8.0.0",
92162
+ "@typescript-eslint/parser": "^8.0.0",
92131
92163
  "@types/bun": "^1.3.5",
92164
+ eslint: "^9.0.0",
92165
+ "eslint-plugin-unused-imports": "^4.0.0",
92166
+ "typescript-eslint": "^8.0.0",
92132
92167
  "@types/cli-progress": "^3.11.5",
92133
92168
  "@types/inquirer": "^8.2.10",
92134
92169
  "@types/json-bigint": "^1.0.4",
@@ -106051,7 +106086,7 @@ var int64Schema = external_exports.preprocess(
106051
106086
  const valueOfResult = val.valueOf();
106052
106087
  const bigIntVal = BigInt(valueOfResult);
106053
106088
  return bigIntVal;
106054
- } catch (e) {
106089
+ } catch (_e) {
106055
106090
  return void 0;
106056
106091
  }
106057
106092
  }
@@ -106061,7 +106096,7 @@ var int64Schema = external_exports.preprocess(
106061
106096
  if (typeof val === "string") {
106062
106097
  try {
106063
106098
  return BigInt(val);
106064
- } catch (e) {
106099
+ } catch (_e) {
106065
106100
  return void 0;
106066
106101
  }
106067
106102
  }
@@ -106343,7 +106378,7 @@ import childProcess from "child_process";
106343
106378
  // lib/constants.ts
106344
106379
  var SDK_TITLE = "Appwrite";
106345
106380
  var SDK_TITLE_LOWER = "appwrite";
106346
- var SDK_VERSION = "13.5.0";
106381
+ var SDK_VERSION = "13.6.1";
106347
106382
  var SDK_NAME = "Command Line";
106348
106383
  var SDK_PLATFORM = "console";
106349
106384
  var SDK_LANGUAGE = "cli";
@@ -106395,6 +106430,12 @@ var createSettingsObject = (project2) => {
106395
106430
  }
106396
106431
  };
106397
106432
  };
106433
+ var getErrorMessage = (error49) => {
106434
+ if (error49 instanceof Error) {
106435
+ return error49.message;
106436
+ }
106437
+ return String(error49);
106438
+ };
106398
106439
  async function getLatestVersion() {
106399
106440
  try {
106400
106441
  const response = await (0, import_undici.fetch)(NPM_REGISTRY_URL);
@@ -106425,7 +106466,7 @@ function getAllFiles(folder) {
106425
106466
  let stats;
106426
106467
  try {
106427
106468
  stats = fs.statSync(pathAbsolute);
106428
- } catch (error49) {
106469
+ } catch (_error) {
106429
106470
  continue;
106430
106471
  }
106431
106472
  if (stats.isDirectory()) {
@@ -106470,7 +106511,7 @@ function systemHasCommand(command) {
106470
106511
  return true;
106471
106512
  }
106472
106513
  var checkDeployConditions = (localConfig2) => {
106473
- if (Object.keys(localConfig2.data).length === 0) {
106514
+ if (localConfig2.keys().length === 0) {
106474
106515
  throw new Error(
106475
106516
  "No appwrite.config.json file found in the current directory. Please run this command again in the folder containing your appwrite.config.json file, or run 'appwrite init project' to link current directory to an Appwrite project."
106476
106517
  );
@@ -106506,6 +106547,8 @@ var JSONbigParser = (0, import_json_bigint.default)({ storeAsString: false });
106506
106547
  var JSONbigSerializer = (0, import_json_bigint.default)({ useNativeBigInt: true });
106507
106548
  var MAX_SAFE = BigInt(Number.MAX_SAFE_INTEGER);
106508
106549
  var MIN_SAFE = BigInt(Number.MIN_SAFE_INTEGER);
106550
+ var MAX_INT64 = BigInt("9223372036854775807");
106551
+ var MIN_INT64 = BigInt("-9223372036854775808");
106509
106552
  function isBigNumber(value) {
106510
106553
  return value !== null && typeof value === "object" && value._isBigNumber === true && typeof value.isInteger === "function" && typeof value.toFixed === "function" && typeof value.toNumber === "function";
106511
106554
  }
@@ -106517,7 +106560,10 @@ function reviver(_key, value) {
106517
106560
  if (bi >= MIN_SAFE && bi <= MAX_SAFE) {
106518
106561
  return Number(str);
106519
106562
  }
106520
- return bi;
106563
+ if (bi >= MIN_INT64 && bi <= MAX_INT64) {
106564
+ return bi;
106565
+ }
106566
+ return value.toNumber();
106521
106567
  }
106522
106568
  return value.toNumber();
106523
106569
  }
@@ -106613,7 +106659,7 @@ var Config = class {
106613
106659
  try {
106614
106660
  const file2 = fs2.readFileSync(this.path).toString();
106615
106661
  this.data = JSONBig.parse(file2);
106616
- } catch (e) {
106662
+ } catch (_e) {
106617
106663
  this.data = {};
106618
106664
  }
106619
106665
  }
@@ -107276,6 +107322,8 @@ Query.cursorBefore = (documentId) => new Query("cursorBefore", void 0, documentI
107276
107322
  Query.limit = (limit) => new Query("limit", void 0, limit).toString();
107277
107323
  Query.offset = (offset) => new Query("offset", void 0, offset).toString();
107278
107324
  Query.contains = (attribute, value) => new Query("contains", attribute, value).toString();
107325
+ Query.containsAny = (attribute, value) => new Query("containsAny", attribute, value).toString();
107326
+ Query.containsAll = (attribute, value) => new Query("containsAll", attribute, value).toString();
107279
107327
  Query.notContains = (attribute, value) => new Query("notContains", attribute, value).toString();
107280
107328
  Query.notSearch = (attribute, value) => new Query("notSearch", attribute, value).toString();
107281
107329
  Query.notBetween = (attribute, start, end) => new Query("notBetween", attribute, [start, end]).toString();
@@ -107306,6 +107354,8 @@ var JSONbigParser2 = (0, import_json_bigint2.default)({ storeAsString: false });
107306
107354
  var JSONbigSerializer2 = (0, import_json_bigint2.default)({ useNativeBigInt: true });
107307
107355
  var MAX_SAFE2 = BigInt(Number.MAX_SAFE_INTEGER);
107308
107356
  var MIN_SAFE2 = BigInt(Number.MIN_SAFE_INTEGER);
107357
+ var MAX_INT642 = BigInt("9223372036854775807");
107358
+ var MIN_INT642 = BigInt("-9223372036854775808");
107309
107359
  function isBigNumber2(value) {
107310
107360
  return value !== null && typeof value === "object" && value._isBigNumber === true && typeof value.isInteger === "function" && typeof value.toFixed === "function" && typeof value.toNumber === "function";
107311
107361
  }
@@ -107317,7 +107367,10 @@ function reviver2(_key, value) {
107317
107367
  if (bi >= MIN_SAFE2 && bi <= MAX_SAFE2) {
107318
107368
  return Number(str);
107319
107369
  }
107320
- return bi;
107370
+ if (bi >= MIN_INT642 && bi <= MAX_INT642) {
107371
+ return bi;
107372
+ }
107373
+ return value.toNumber();
107321
107374
  }
107322
107375
  return value.toNumber();
107323
107376
  }
@@ -107364,7 +107417,7 @@ var Client = class _Client {
107364
107417
  "x-sdk-name": "Console",
107365
107418
  "x-sdk-platform": "console",
107366
107419
  "x-sdk-language": "web",
107367
- "x-sdk-version": "3.0.0",
107420
+ "x-sdk-version": "3.1.0",
107368
107421
  "X-Appwrite-Response-Format": "1.8.0"
107369
107422
  };
107370
107423
  this.realtime = {
@@ -109360,7 +109413,7 @@ var Account = class {
109360
109413
  };
109361
109414
  }
109362
109415
  const provider = params.provider;
109363
- const success19 = params.success;
109416
+ const success20 = params.success;
109364
109417
  const failure = params.failure;
109365
109418
  const scopes = params.scopes;
109366
109419
  if (typeof provider === "undefined") {
@@ -109368,8 +109421,8 @@ var Account = class {
109368
109421
  }
109369
109422
  const apiPath = "/account/sessions/oauth2/{provider}".replace("{provider}", provider);
109370
109423
  const payload = {};
109371
- if (typeof success19 !== "undefined") {
109372
- payload["success"] = success19;
109424
+ if (typeof success20 !== "undefined") {
109425
+ payload["success"] = success20;
109373
109426
  }
109374
109427
  if (typeof failure !== "undefined") {
109375
109428
  payload["failure"] = failure;
@@ -109708,7 +109761,7 @@ var Account = class {
109708
109761
  };
109709
109762
  }
109710
109763
  const provider = params.provider;
109711
- const success19 = params.success;
109764
+ const success20 = params.success;
109712
109765
  const failure = params.failure;
109713
109766
  const scopes = params.scopes;
109714
109767
  if (typeof provider === "undefined") {
@@ -109716,8 +109769,8 @@ var Account = class {
109716
109769
  }
109717
109770
  const apiPath = "/account/tokens/oauth2/{provider}".replace("{provider}", provider);
109718
109771
  const payload = {};
109719
- if (typeof success19 !== "undefined") {
109720
- payload["success"] = success19;
109772
+ if (typeof success20 !== "undefined") {
109773
+ payload["success"] = success20;
109721
109774
  }
109722
109775
  if (typeof failure !== "undefined") {
109723
109776
  payload["failure"] = failure;
@@ -109929,6 +109982,385 @@ var Account = class {
109929
109982
  return this.client.call("put", uri, apiHeaders, payload);
109930
109983
  }
109931
109984
  };
109985
+ var Activities = class {
109986
+ constructor(client2) {
109987
+ this.client = client2;
109988
+ }
109989
+ listEvents(paramsOrFirst) {
109990
+ let params;
109991
+ if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
109992
+ params = paramsOrFirst || {};
109993
+ } else {
109994
+ params = {
109995
+ queries: paramsOrFirst
109996
+ };
109997
+ }
109998
+ const queries = params.queries;
109999
+ const apiPath = "/activities/events";
110000
+ const payload = {};
110001
+ if (typeof queries !== "undefined") {
110002
+ payload["queries"] = queries;
110003
+ }
110004
+ const uri = new URL(this.client.config.endpoint + apiPath);
110005
+ const apiHeaders = {};
110006
+ return this.client.call("get", uri, apiHeaders, payload);
110007
+ }
110008
+ getEvent(paramsOrFirst) {
110009
+ let params;
110010
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
110011
+ params = paramsOrFirst || {};
110012
+ } else {
110013
+ params = {
110014
+ eventId: paramsOrFirst
110015
+ };
110016
+ }
110017
+ const eventId = params.eventId;
110018
+ if (typeof eventId === "undefined") {
110019
+ throw new AppwriteException('Missing required parameter: "eventId"');
110020
+ }
110021
+ const apiPath = "/activities/events/{eventId}".replace("{eventId}", eventId);
110022
+ const payload = {};
110023
+ const uri = new URL(this.client.config.endpoint + apiPath);
110024
+ const apiHeaders = {};
110025
+ return this.client.call("get", uri, apiHeaders, payload);
110026
+ }
110027
+ };
110028
+ var Backups = class {
110029
+ constructor(client2) {
110030
+ this.client = client2;
110031
+ }
110032
+ listArchives(paramsOrFirst) {
110033
+ let params;
110034
+ if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
110035
+ params = paramsOrFirst || {};
110036
+ } else {
110037
+ params = {
110038
+ queries: paramsOrFirst
110039
+ };
110040
+ }
110041
+ const queries = params.queries;
110042
+ const apiPath = "/backups/archives";
110043
+ const payload = {};
110044
+ if (typeof queries !== "undefined") {
110045
+ payload["queries"] = queries;
110046
+ }
110047
+ const uri = new URL(this.client.config.endpoint + apiPath);
110048
+ const apiHeaders = {};
110049
+ return this.client.call("get", uri, apiHeaders, payload);
110050
+ }
110051
+ createArchive(paramsOrFirst, ...rest) {
110052
+ let params;
110053
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst) && ("services" in paramsOrFirst || "resourceId" in paramsOrFirst)) {
110054
+ params = paramsOrFirst || {};
110055
+ } else {
110056
+ params = {
110057
+ services: paramsOrFirst,
110058
+ resourceId: rest[0]
110059
+ };
110060
+ }
110061
+ const services = params.services;
110062
+ const resourceId = params.resourceId;
110063
+ if (typeof services === "undefined") {
110064
+ throw new AppwriteException('Missing required parameter: "services"');
110065
+ }
110066
+ const apiPath = "/backups/archives";
110067
+ const payload = {};
110068
+ if (typeof services !== "undefined") {
110069
+ payload["services"] = services;
110070
+ }
110071
+ if (typeof resourceId !== "undefined") {
110072
+ payload["resourceId"] = resourceId;
110073
+ }
110074
+ const uri = new URL(this.client.config.endpoint + apiPath);
110075
+ const apiHeaders = {
110076
+ "content-type": "application/json"
110077
+ };
110078
+ return this.client.call("post", uri, apiHeaders, payload);
110079
+ }
110080
+ getArchive(paramsOrFirst) {
110081
+ let params;
110082
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
110083
+ params = paramsOrFirst || {};
110084
+ } else {
110085
+ params = {
110086
+ archiveId: paramsOrFirst
110087
+ };
110088
+ }
110089
+ const archiveId = params.archiveId;
110090
+ if (typeof archiveId === "undefined") {
110091
+ throw new AppwriteException('Missing required parameter: "archiveId"');
110092
+ }
110093
+ const apiPath = "/backups/archives/{archiveId}".replace("{archiveId}", archiveId);
110094
+ const payload = {};
110095
+ const uri = new URL(this.client.config.endpoint + apiPath);
110096
+ const apiHeaders = {};
110097
+ return this.client.call("get", uri, apiHeaders, payload);
110098
+ }
110099
+ deleteArchive(paramsOrFirst) {
110100
+ let params;
110101
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
110102
+ params = paramsOrFirst || {};
110103
+ } else {
110104
+ params = {
110105
+ archiveId: paramsOrFirst
110106
+ };
110107
+ }
110108
+ const archiveId = params.archiveId;
110109
+ if (typeof archiveId === "undefined") {
110110
+ throw new AppwriteException('Missing required parameter: "archiveId"');
110111
+ }
110112
+ const apiPath = "/backups/archives/{archiveId}".replace("{archiveId}", archiveId);
110113
+ const payload = {};
110114
+ const uri = new URL(this.client.config.endpoint + apiPath);
110115
+ const apiHeaders = {
110116
+ "content-type": "application/json"
110117
+ };
110118
+ return this.client.call("delete", uri, apiHeaders, payload);
110119
+ }
110120
+ listPolicies(paramsOrFirst) {
110121
+ let params;
110122
+ if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
110123
+ params = paramsOrFirst || {};
110124
+ } else {
110125
+ params = {
110126
+ queries: paramsOrFirst
110127
+ };
110128
+ }
110129
+ const queries = params.queries;
110130
+ const apiPath = "/backups/policies";
110131
+ const payload = {};
110132
+ if (typeof queries !== "undefined") {
110133
+ payload["queries"] = queries;
110134
+ }
110135
+ const uri = new URL(this.client.config.endpoint + apiPath);
110136
+ const apiHeaders = {};
110137
+ return this.client.call("get", uri, apiHeaders, payload);
110138
+ }
110139
+ createPolicy(paramsOrFirst, ...rest) {
110140
+ let params;
110141
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
110142
+ params = paramsOrFirst || {};
110143
+ } else {
110144
+ params = {
110145
+ policyId: paramsOrFirst,
110146
+ services: rest[0],
110147
+ retention: rest[1],
110148
+ schedule: rest[2],
110149
+ name: rest[3],
110150
+ resourceId: rest[4],
110151
+ enabled: rest[5]
110152
+ };
110153
+ }
110154
+ const policyId = params.policyId;
110155
+ const services = params.services;
110156
+ const retention = params.retention;
110157
+ const schedule = params.schedule;
110158
+ const name = params.name;
110159
+ const resourceId = params.resourceId;
110160
+ const enabled = params.enabled;
110161
+ if (typeof policyId === "undefined") {
110162
+ throw new AppwriteException('Missing required parameter: "policyId"');
110163
+ }
110164
+ if (typeof services === "undefined") {
110165
+ throw new AppwriteException('Missing required parameter: "services"');
110166
+ }
110167
+ if (typeof retention === "undefined") {
110168
+ throw new AppwriteException('Missing required parameter: "retention"');
110169
+ }
110170
+ if (typeof schedule === "undefined") {
110171
+ throw new AppwriteException('Missing required parameter: "schedule"');
110172
+ }
110173
+ const apiPath = "/backups/policies";
110174
+ const payload = {};
110175
+ if (typeof policyId !== "undefined") {
110176
+ payload["policyId"] = policyId;
110177
+ }
110178
+ if (typeof name !== "undefined") {
110179
+ payload["name"] = name;
110180
+ }
110181
+ if (typeof services !== "undefined") {
110182
+ payload["services"] = services;
110183
+ }
110184
+ if (typeof resourceId !== "undefined") {
110185
+ payload["resourceId"] = resourceId;
110186
+ }
110187
+ if (typeof enabled !== "undefined") {
110188
+ payload["enabled"] = enabled;
110189
+ }
110190
+ if (typeof retention !== "undefined") {
110191
+ payload["retention"] = retention;
110192
+ }
110193
+ if (typeof schedule !== "undefined") {
110194
+ payload["schedule"] = schedule;
110195
+ }
110196
+ const uri = new URL(this.client.config.endpoint + apiPath);
110197
+ const apiHeaders = {
110198
+ "content-type": "application/json"
110199
+ };
110200
+ return this.client.call("post", uri, apiHeaders, payload);
110201
+ }
110202
+ getPolicy(paramsOrFirst) {
110203
+ let params;
110204
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
110205
+ params = paramsOrFirst || {};
110206
+ } else {
110207
+ params = {
110208
+ policyId: paramsOrFirst
110209
+ };
110210
+ }
110211
+ const policyId = params.policyId;
110212
+ if (typeof policyId === "undefined") {
110213
+ throw new AppwriteException('Missing required parameter: "policyId"');
110214
+ }
110215
+ const apiPath = "/backups/policies/{policyId}".replace("{policyId}", policyId);
110216
+ const payload = {};
110217
+ const uri = new URL(this.client.config.endpoint + apiPath);
110218
+ const apiHeaders = {};
110219
+ return this.client.call("get", uri, apiHeaders, payload);
110220
+ }
110221
+ updatePolicy(paramsOrFirst, ...rest) {
110222
+ let params;
110223
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
110224
+ params = paramsOrFirst || {};
110225
+ } else {
110226
+ params = {
110227
+ policyId: paramsOrFirst,
110228
+ name: rest[0],
110229
+ retention: rest[1],
110230
+ schedule: rest[2],
110231
+ enabled: rest[3]
110232
+ };
110233
+ }
110234
+ const policyId = params.policyId;
110235
+ const name = params.name;
110236
+ const retention = params.retention;
110237
+ const schedule = params.schedule;
110238
+ const enabled = params.enabled;
110239
+ if (typeof policyId === "undefined") {
110240
+ throw new AppwriteException('Missing required parameter: "policyId"');
110241
+ }
110242
+ const apiPath = "/backups/policies/{policyId}".replace("{policyId}", policyId);
110243
+ const payload = {};
110244
+ if (typeof name !== "undefined") {
110245
+ payload["name"] = name;
110246
+ }
110247
+ if (typeof retention !== "undefined") {
110248
+ payload["retention"] = retention;
110249
+ }
110250
+ if (typeof schedule !== "undefined") {
110251
+ payload["schedule"] = schedule;
110252
+ }
110253
+ if (typeof enabled !== "undefined") {
110254
+ payload["enabled"] = enabled;
110255
+ }
110256
+ const uri = new URL(this.client.config.endpoint + apiPath);
110257
+ const apiHeaders = {
110258
+ "content-type": "application/json"
110259
+ };
110260
+ return this.client.call("patch", uri, apiHeaders, payload);
110261
+ }
110262
+ deletePolicy(paramsOrFirst) {
110263
+ let params;
110264
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
110265
+ params = paramsOrFirst || {};
110266
+ } else {
110267
+ params = {
110268
+ policyId: paramsOrFirst
110269
+ };
110270
+ }
110271
+ const policyId = params.policyId;
110272
+ if (typeof policyId === "undefined") {
110273
+ throw new AppwriteException('Missing required parameter: "policyId"');
110274
+ }
110275
+ const apiPath = "/backups/policies/{policyId}".replace("{policyId}", policyId);
110276
+ const payload = {};
110277
+ const uri = new URL(this.client.config.endpoint + apiPath);
110278
+ const apiHeaders = {
110279
+ "content-type": "application/json"
110280
+ };
110281
+ return this.client.call("delete", uri, apiHeaders, payload);
110282
+ }
110283
+ createRestoration(paramsOrFirst, ...rest) {
110284
+ let params;
110285
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
110286
+ params = paramsOrFirst || {};
110287
+ } else {
110288
+ params = {
110289
+ archiveId: paramsOrFirst,
110290
+ services: rest[0],
110291
+ newResourceId: rest[1],
110292
+ newResourceName: rest[2]
110293
+ };
110294
+ }
110295
+ const archiveId = params.archiveId;
110296
+ const services = params.services;
110297
+ const newResourceId = params.newResourceId;
110298
+ const newResourceName = params.newResourceName;
110299
+ if (typeof archiveId === "undefined") {
110300
+ throw new AppwriteException('Missing required parameter: "archiveId"');
110301
+ }
110302
+ if (typeof services === "undefined") {
110303
+ throw new AppwriteException('Missing required parameter: "services"');
110304
+ }
110305
+ const apiPath = "/backups/restoration";
110306
+ const payload = {};
110307
+ if (typeof archiveId !== "undefined") {
110308
+ payload["archiveId"] = archiveId;
110309
+ }
110310
+ if (typeof services !== "undefined") {
110311
+ payload["services"] = services;
110312
+ }
110313
+ if (typeof newResourceId !== "undefined") {
110314
+ payload["newResourceId"] = newResourceId;
110315
+ }
110316
+ if (typeof newResourceName !== "undefined") {
110317
+ payload["newResourceName"] = newResourceName;
110318
+ }
110319
+ const uri = new URL(this.client.config.endpoint + apiPath);
110320
+ const apiHeaders = {
110321
+ "content-type": "application/json"
110322
+ };
110323
+ return this.client.call("post", uri, apiHeaders, payload);
110324
+ }
110325
+ listRestorations(paramsOrFirst) {
110326
+ let params;
110327
+ if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
110328
+ params = paramsOrFirst || {};
110329
+ } else {
110330
+ params = {
110331
+ queries: paramsOrFirst
110332
+ };
110333
+ }
110334
+ const queries = params.queries;
110335
+ const apiPath = "/backups/restorations";
110336
+ const payload = {};
110337
+ if (typeof queries !== "undefined") {
110338
+ payload["queries"] = queries;
110339
+ }
110340
+ const uri = new URL(this.client.config.endpoint + apiPath);
110341
+ const apiHeaders = {};
110342
+ return this.client.call("get", uri, apiHeaders, payload);
110343
+ }
110344
+ getRestoration(paramsOrFirst) {
110345
+ let params;
110346
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
110347
+ params = paramsOrFirst || {};
110348
+ } else {
110349
+ params = {
110350
+ restorationId: paramsOrFirst
110351
+ };
110352
+ }
110353
+ const restorationId = params.restorationId;
110354
+ if (typeof restorationId === "undefined") {
110355
+ throw new AppwriteException('Missing required parameter: "restorationId"');
110356
+ }
110357
+ const apiPath = "/backups/restorations/{restorationId}".replace("{restorationId}", restorationId);
110358
+ const payload = {};
110359
+ const uri = new URL(this.client.config.endpoint + apiPath);
110360
+ const apiHeaders = {};
110361
+ return this.client.call("get", uri, apiHeaders, payload);
110362
+ }
110363
+ };
109932
110364
  var Console = class {
109933
110365
  constructor(client2) {
109934
110366
  this.client = client2;
@@ -119763,21 +120195,26 @@ var Organizations = class {
119763
120195
  const apiHeaders = {};
119764
120196
  return this.client.call("get", uri, apiHeaders, payload);
119765
120197
  }
119766
- getScopes(paramsOrFirst) {
120198
+ getScopes(paramsOrFirst, ...rest) {
119767
120199
  let params;
119768
120200
  if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
119769
120201
  params = paramsOrFirst || {};
119770
120202
  } else {
119771
120203
  params = {
119772
- organizationId: paramsOrFirst
120204
+ organizationId: paramsOrFirst,
120205
+ projectId: rest[0]
119773
120206
  };
119774
120207
  }
119775
120208
  const organizationId = params.organizationId;
120209
+ const projectId = params.projectId;
119776
120210
  if (typeof organizationId === "undefined") {
119777
120211
  throw new AppwriteException('Missing required parameter: "organizationId"');
119778
120212
  }
119779
120213
  const apiPath = "/organizations/{organizationId}/roles".replace("{organizationId}", organizationId);
119780
120214
  const payload = {};
120215
+ if (typeof projectId !== "undefined") {
120216
+ payload["projectId"] = projectId;
120217
+ }
119781
120218
  const uri = new URL(this.client.config.endpoint + apiPath);
119782
120219
  const apiHeaders = {};
119783
120220
  return this.client.call("get", uri, apiHeaders, payload);
@@ -131846,6 +132283,22 @@ var cliConfig = {
131846
132283
  report: false,
131847
132284
  reportData: {}
131848
132285
  };
132286
+ var toJsonObject = (value) => {
132287
+ if (value && typeof value === "object" && !Array.isArray(value)) {
132288
+ return value;
132289
+ }
132290
+ return null;
132291
+ };
132292
+ var extractReportCommandArgs = (value) => {
132293
+ if (!value || typeof value !== "object") {
132294
+ return [];
132295
+ }
132296
+ const reportData = value;
132297
+ if (!Array.isArray(reportData.data?.args)) {
132298
+ return [];
132299
+ }
132300
+ return reportData.data.args;
132301
+ };
131849
132302
  var parse3 = (data) => {
131850
132303
  if (cliConfig.json) {
131851
132304
  drawJSON(data);
@@ -131866,7 +132319,8 @@ var parse3 = (data) => {
131866
132319
  console.log(`${import_chalk.default.yellow.bold(key)} : ${data[key]}`);
131867
132320
  } else {
131868
132321
  console.log(`${import_chalk.default.yellow.bold.underline(key)}`);
131869
- drawTable([data[key]]);
132322
+ const tableRow = toJsonObject(data[key]) ?? {};
132323
+ drawTable([tableRow]);
131870
132324
  }
131871
132325
  } else {
131872
132326
  console.log(`${import_chalk.default.yellow.bold(key)} : ${data[key]}`);
@@ -131878,9 +132332,7 @@ var drawTable = (data) => {
131878
132332
  console.log("[]");
131879
132333
  return;
131880
132334
  }
131881
- const rows = data.map(
131882
- (item) => item && typeof item === "object" && !Array.isArray(item) ? item : {}
131883
- );
132335
+ const rows = data.map((item) => toJsonObject(item) ?? {});
131884
132336
  const obj = rows.reduce((res, item) => ({ ...res, ...item }), {});
131885
132337
  const keys = Object.keys(obj);
131886
132338
  if (keys.length === 0) {
@@ -131923,7 +132375,7 @@ var drawTable = (data) => {
131923
132375
  } else if (typeof row[key] === "object") {
131924
132376
  rowValues.push(JSON.stringify(row[key]));
131925
132377
  } else {
131926
- rowValues.push(row[key]);
132378
+ rowValues.push(String(row[key]));
131927
132379
  }
131928
132380
  }
131929
132381
  table.push(rowValues);
@@ -131935,7 +132387,7 @@ var drawJSON = (data) => {
131935
132387
  };
131936
132388
  var parseError = (err) => {
131937
132389
  if (cliConfig.report) {
131938
- (async () => {
132390
+ void (async () => {
131939
132391
  let appwriteVersion = "unknown";
131940
132392
  const endpoint = globalConfig2.getEndpoint();
131941
132393
  try {
@@ -131948,7 +132400,8 @@ var parseError = (err) => {
131948
132400
  } catch {
131949
132401
  }
131950
132402
  const version4 = SDK_VERSION;
131951
- const stepsToReproduce = `Running \`${EXECUTABLE_NAME} ${cliConfig.reportData.data.args.join(" ")}\``;
132403
+ const commandArgs = extractReportCommandArgs(cliConfig.reportData);
132404
+ const stepsToReproduce = `Running \`${EXECUTABLE_NAME} ${commandArgs.join(" ")}\``;
131952
132405
  const yourEnvironment = `CLI version: ${version4}
131953
132406
  Operation System: ${os2.type()}
131954
132407
  Appwrite version: ${appwriteVersion}
@@ -132000,7 +132453,7 @@ var actionRunner = (fn) => {
132000
132453
  error48(`The '--all' and '--id' flags cannot be used together.`);
132001
132454
  process.exit(1);
132002
132455
  }
132003
- return fn(...args).catch(parseError);
132456
+ return fn(...args).then(() => void 0).catch(parseError);
132004
132457
  };
132005
132458
  };
132006
132459
  var parseInteger = (value) => {
@@ -132186,19 +132639,22 @@ async function paginate(action, args = {}, limit = 100, wrapper = "", queries =
132186
132639
  ]
132187
132640
  });
132188
132641
  if (wrapper === "") {
132189
- if (response.length === 0) {
132642
+ const listResponse = response;
132643
+ if (listResponse.length === 0) {
132190
132644
  break;
132191
132645
  }
132192
- results = results.concat(response);
132646
+ results = results.concat(listResponse);
132193
132647
  } else {
132194
- if (response[wrapper].length === 0) {
132648
+ const wrappedResponse = response;
132649
+ const wrappedResults = wrappedResponse[wrapper] ?? [];
132650
+ if (wrappedResults.length === 0) {
132651
+ break;
132652
+ }
132653
+ results = results.concat(wrappedResults);
132654
+ total = wrappedResponse.total;
132655
+ if (results.length >= total) {
132195
132656
  break;
132196
132657
  }
132197
- results = results.concat(response[wrapper]);
132198
- }
132199
- total = response.total;
132200
- if (results.length >= total) {
132201
- break;
132202
132658
  }
132203
132659
  pageNumber++;
132204
132660
  }
@@ -132385,7 +132841,7 @@ var questionsInitProject = [
132385
132841
  name: "organization",
132386
132842
  message: "Choose your organization",
132387
132843
  choices: async () => {
132388
- let client2 = await sdkForConsole(true);
132844
+ const client2 = await sdkForConsole(true);
132389
132845
  const { teams: teams2 } = isCloud() ? await paginate(
132390
132846
  async (opts = {}) => (await getOrganizationsService(opts.sdk)).list(),
132391
132847
  { sdk: client2 },
@@ -132397,7 +132853,7 @@ var questionsInitProject = [
132397
132853
  100,
132398
132854
  "teams"
132399
132855
  );
132400
- let choices = teams2.map((team, idx) => {
132856
+ const choices = teams2.map((team, _idx) => {
132401
132857
  return {
132402
132858
  name: `${team.name} (${team["$id"]})`,
132403
132859
  value: team["$id"]
@@ -132446,7 +132902,7 @@ var questionsInitProject = [
132446
132902
  "projects",
132447
132903
  queries
132448
132904
  );
132449
- let choices = projects2.map((project2) => {
132905
+ const choices = projects2.map((project2) => {
132450
132906
  return {
132451
132907
  name: `${project2.name} (${project2["$id"]})`,
132452
132908
  value: {
@@ -132467,13 +132923,13 @@ var questionsInitProject = [
132467
132923
  name: "region",
132468
132924
  message: `Select your ${SDK_TITLE} Cloud region`,
132469
132925
  choices: async () => {
132470
- let client2 = await sdkForConsole(true);
132926
+ const client2 = await sdkForConsole(true);
132471
132927
  const endpoint = globalConfig2.getEndpoint() || DEFAULT_ENDPOINT;
132472
- let response = await client2.call(
132928
+ const response = await client2.call(
132473
132929
  "GET",
132474
132930
  new URL(endpoint + "/console/regions")
132475
132931
  );
132476
- let regions = response.regions || [];
132932
+ const regions = response.regions || [];
132477
132933
  if (!regions.length) {
132478
132934
  throw new Error(
132479
132935
  "No regions found. Please check your network or Appwrite Cloud availability."
@@ -132615,9 +133071,9 @@ var questionsCreateFunction = [
132615
133071
  name: "runtime",
132616
133072
  message: "What runtime would you like to use?",
132617
133073
  choices: async () => {
132618
- let response = await (await getFunctionsService()).listRuntimes();
132619
- let runtimes = response["runtimes"];
132620
- let choices = runtimes.map((runtime, idx) => {
133074
+ const response = await (await getFunctionsService()).listRuntimes();
133075
+ const runtimes = response["runtimes"];
133076
+ const choices = runtimes.map((runtime, _idx) => {
132621
133077
  return {
132622
133078
  name: `${runtime.name} (${runtime["$id"]})`,
132623
133079
  value: {
@@ -132637,9 +133093,9 @@ var questionsCreateFunction = [
132637
133093
  name: "specification",
132638
133094
  message: "What specification would you like to use?",
132639
133095
  choices: async () => {
132640
- let response = await (await getFunctionsService()).listSpecifications();
132641
- let specifications = response["specifications"];
132642
- let choices = specifications.map((spec, idx) => {
133096
+ const response = await (await getFunctionsService()).listSpecifications();
133097
+ const specifications = response["specifications"];
133098
+ const choices = specifications.map((spec, _idx) => {
132643
133099
  return {
132644
133100
  name: `${spec.cpus} CPU, ${spec.memory}MB RAM`,
132645
133101
  value: spec.slug,
@@ -132716,7 +133172,7 @@ var questionsCreateCollection = [
132716
133172
  message: "Choose the collection database",
132717
133173
  choices: async () => {
132718
133174
  const databases2 = localConfig.getDatabases();
132719
- let choices = databases2.map((database, idx) => {
133175
+ const choices = databases2.map((database, _idx) => {
132720
133176
  return {
132721
133177
  name: `${database.name} (${database.$id})`,
132722
133178
  value: database.$id
@@ -132780,7 +133236,7 @@ var questionsCreateTable = [
132780
133236
  message: "Choose the table database",
132781
133237
  choices: async () => {
132782
133238
  const databases2 = localConfig.getTablesDBs();
132783
- let choices = databases2.map((database, idx) => {
133239
+ const choices = databases2.map((database, _idx) => {
132784
133240
  return {
132785
133241
  name: `${database.name} (${database.$id})`,
132786
133242
  value: database.$id
@@ -132914,9 +133370,9 @@ var questionGetEndpoint = [
132914
133370
  if (!value) {
132915
133371
  return "Please enter a valid endpoint.";
132916
133372
  }
132917
- let client2 = new Client().setEndpoint(value);
133373
+ const client2 = new Client().setEndpoint(value);
132918
133374
  try {
132919
- let response = await client2.call(
133375
+ const response = await client2.call(
132920
133376
  "get",
132921
133377
  new URL(value + "/health/version")
132922
133378
  );
@@ -132925,7 +133381,7 @@ var questionGetEndpoint = [
132925
133381
  } else {
132926
133382
  throw new Error();
132927
133383
  }
132928
- } catch (error49) {
133384
+ } catch (_error) {
132929
133385
  return "Invalid endpoint or your Appwrite server is not running as expected.";
132930
133386
  }
132931
133387
  }
@@ -133003,9 +133459,9 @@ var questionsPushSites = [
133003
133459
  validate: (value) => validateRequired("site", value),
133004
133460
  when: () => localConfig.getSites().length > 0,
133005
133461
  choices: () => {
133006
- let sites2 = localConfig.getSites();
133462
+ const sites2 = localConfig.getSites();
133007
133463
  checkDeployConditions(localConfig);
133008
- let choices = sites2.map((site, idx) => {
133464
+ const choices = sites2.map((site, _idx) => {
133009
133465
  return {
133010
133466
  name: `${site.name} (${site.$id})`,
133011
133467
  value: site.$id
@@ -133023,9 +133479,9 @@ var questionsPushFunctions = [
133023
133479
  validate: (value) => validateRequired("function", value),
133024
133480
  when: () => localConfig.getFunctions().length > 0,
133025
133481
  choices: () => {
133026
- let functions2 = localConfig.getFunctions();
133482
+ const functions2 = localConfig.getFunctions();
133027
133483
  checkDeployConditions(localConfig);
133028
- let choices = functions2.map((func, idx) => {
133484
+ const choices = functions2.map((func, _idx) => {
133029
133485
  return {
133030
133486
  name: `${func.name} (${func.$id})`,
133031
133487
  value: func.$id
@@ -133043,7 +133499,7 @@ var questionsPushCollections = [
133043
133499
  validate: (value) => validateRequired("collection", value),
133044
133500
  when: () => localConfig.getCollections().length > 0,
133045
133501
  choices: () => {
133046
- let collections = localConfig.getCollections();
133502
+ const collections = localConfig.getCollections();
133047
133503
  checkDeployConditions(localConfig);
133048
133504
  return collections.map((collection) => {
133049
133505
  return {
@@ -133062,7 +133518,7 @@ var questionsPushTables = [
133062
133518
  validate: (value) => validateRequired("table", value),
133063
133519
  when: () => localConfig.getTables().length > 0,
133064
133520
  choices: () => {
133065
- let tables = localConfig.getTables();
133521
+ const tables = localConfig.getTables();
133066
133522
  checkDeployConditions(localConfig);
133067
133523
  return tables.map((table) => {
133068
133524
  return {
@@ -133095,7 +133551,7 @@ var questionsPushBuckets = [
133095
133551
  validate: (value) => validateRequired("bucket", value),
133096
133552
  when: () => localConfig.getBuckets().length > 0,
133097
133553
  choices: () => {
133098
- let buckets = localConfig.getBuckets();
133554
+ const buckets = localConfig.getBuckets();
133099
133555
  checkDeployConditions(localConfig);
133100
133556
  return buckets.map((bucket) => {
133101
133557
  return {
@@ -133114,7 +133570,7 @@ var questionsPushMessagingTopics = [
133114
133570
  validate: (value) => validateRequired("topics", value),
133115
133571
  when: () => localConfig.getMessagingTopics().length > 0,
133116
133572
  choices: () => {
133117
- let topics = localConfig.getMessagingTopics();
133573
+ const topics = localConfig.getMessagingTopics();
133118
133574
  return topics.map((topic) => {
133119
133575
  return {
133120
133576
  name: `${topic.name} (${topic["$id"]})`,
@@ -133145,7 +133601,7 @@ var questionsPushTeams = [
133145
133601
  validate: (value) => validateRequired("team", value),
133146
133602
  when: () => localConfig.getTeams().length > 0,
133147
133603
  choices: () => {
133148
- let teams2 = localConfig.getTeams();
133604
+ const teams2 = localConfig.getTeams();
133149
133605
  checkDeployConditions(localConfig);
133150
133606
  return teams2.map((team) => {
133151
133607
  return {
@@ -133162,7 +133618,7 @@ var questionsListFactors = [
133162
133618
  name: "factor",
133163
133619
  message: "Your account is protected by multi-factor authentication. Please choose one for verification.",
133164
133620
  choices: async () => {
133165
- let client2 = await sdkForConsole(false);
133621
+ const client2 = await sdkForConsole(false);
133166
133622
  const accountClient2 = new Account(client2);
133167
133623
  const factors = await accountClient2.listMfaFactors();
133168
133624
  const choices = [
@@ -133207,13 +133663,13 @@ var questionsRunFunctions = [
133207
133663
  message: "Which function would you like to develop locally?",
133208
133664
  validate: (value) => validateRequired("function", value),
133209
133665
  choices: () => {
133210
- let functions2 = localConfig.getFunctions();
133666
+ const functions2 = localConfig.getFunctions();
133211
133667
  if (functions2.length === 0) {
133212
133668
  throw new Error(
133213
133669
  `No functions found. Use '${EXECUTABLE_NAME} pull functions' to synchronize existing one, or use '${EXECUTABLE_NAME} init function' to create a new one.`
133214
133670
  );
133215
133671
  }
133216
- let choices = functions2.map((func, idx) => {
133672
+ const choices = functions2.map((func, _idx) => {
133217
133673
  return {
133218
133674
  name: `${func.name} (${func.$id})`,
133219
133675
  value: func.$id
@@ -133241,9 +133697,9 @@ var questionsCreateSite = [
133241
133697
  name: "framework",
133242
133698
  message: "What framework would you like to use?",
133243
133699
  choices: async () => {
133244
- let response = await (await getSitesService()).listFrameworks();
133245
- let frameworks = response["frameworks"];
133246
- let choices = frameworks.map((framework) => {
133700
+ const response = await (await getSitesService()).listFrameworks();
133701
+ const frameworks = response["frameworks"];
133702
+ const choices = frameworks.map((framework) => {
133247
133703
  return {
133248
133704
  name: `${framework.name} (${framework.key})`,
133249
133705
  value: framework
@@ -133257,9 +133713,9 @@ var questionsCreateSite = [
133257
133713
  name: "specification",
133258
133714
  message: "What specification would you like to use?",
133259
133715
  choices: async () => {
133260
- let response = await (await getSitesService()).listSpecifications();
133261
- let specifications = response["specifications"];
133262
- let choices = specifications.map((spec) => {
133716
+ const response = await (await getSitesService()).listSpecifications();
133717
+ const specifications = response["specifications"];
133718
+ const choices = specifications.map((spec) => {
133263
133719
  return {
133264
133720
  name: `${spec.cpus} CPU, ${spec.memory}MB RAM`,
133265
133721
  value: spec.slug,
@@ -133443,7 +133899,7 @@ var Client3 = class _Client {
133443
133899
  let json3 = void 0;
133444
133900
  try {
133445
133901
  json3 = JSON.parse(text2);
133446
- } catch (error49) {
133902
+ } catch (_error) {
133447
133903
  throw new AppwriteException(text2, response.status, "", text2);
133448
133904
  }
133449
133905
  if (path16 !== "/account" && json3.code === 401 && json3.type === "user_more_factors_required") {
@@ -133477,7 +133933,7 @@ var Client3 = class _Client {
133477
133933
  let json2 = void 0;
133478
133934
  try {
133479
133935
  json2 = JSONBig.parse(text);
133480
- } catch (error49) {
133936
+ } catch (_error) {
133481
133937
  return text;
133482
133938
  }
133483
133939
  return json2;
@@ -133548,11 +134004,11 @@ var completeMfaLogin = async ({
133548
134004
  };
133549
134005
  var deleteServerSession = async (sessionId) => {
133550
134006
  try {
133551
- let client2 = await sdkForConsole();
133552
- let accountClient2 = new Account(client2);
134007
+ const client2 = await sdkForConsole();
134008
+ const accountClient2 = new Account(client2);
133553
134009
  await accountClient2.deleteSession(sessionId);
133554
134010
  return true;
133555
- } catch (e) {
134011
+ } catch (_e) {
133556
134012
  return false;
133557
134013
  }
133558
134014
  };
@@ -133637,7 +134093,7 @@ var loginCommand = async ({
133637
134093
  globalConfig2.setEndpoint(configEndpoint);
133638
134094
  globalConfig2.setEmail(answers.email);
133639
134095
  const legacyClient = createLegacyConsoleClient(configEndpoint);
133640
- let client2 = await sdkForConsole(false);
134096
+ const client2 = await sdkForConsole(false);
133641
134097
  let accountClient2 = new Account(client2);
133642
134098
  let account2;
133643
134099
  try {
@@ -133687,8 +134143,8 @@ var whoami = new Command("whoami").description(commandDescriptions["whoami"]).ac
133687
134143
  error48("No user is signed in. To sign in, run 'appwrite login'");
133688
134144
  return;
133689
134145
  }
133690
- let client2 = await sdkForConsole(false);
133691
- let accountClient2 = new Account(client2);
134146
+ const client2 = await sdkForConsole(false);
134147
+ const accountClient2 = new Account(client2);
133692
134148
  let account2;
133693
134149
  try {
133694
134150
  account2 = await accountClient2.get();
@@ -133812,7 +134268,7 @@ var client = new Command("client").description(commandDescriptions["client"]).co
133812
134268
  const tail = cookieValue.length > 8 ? cookieValue.slice(-8) : cookieValue || "********";
133813
134269
  maskedCookie = `${cookieName}=...${tail}`;
133814
134270
  }
133815
- let config2 = {
134271
+ const config2 = {
133816
134272
  endpoint: globalConfig2.getEndpoint(),
133817
134273
  key: maskedKey,
133818
134274
  cookie: maskedCookie,
@@ -133825,16 +134281,16 @@ var client = new Command("client").description(commandDescriptions["client"]).co
133825
134281
  if (endpoint !== void 0) {
133826
134282
  try {
133827
134283
  const id = id_default2.unique();
133828
- let url2 = new URL(endpoint);
134284
+ const url2 = new URL(endpoint);
133829
134285
  if (url2.protocol !== "http:" && url2.protocol !== "https:") {
133830
134286
  throw new Error();
133831
134287
  }
133832
- let clientInstance = new Client().setEndpoint(endpoint);
134288
+ const clientInstance = new Client().setEndpoint(endpoint);
133833
134289
  clientInstance.setProject("console");
133834
134290
  if (selfSigned || globalConfig2.getSelfSigned()) {
133835
134291
  clientInstance.setSelfSigned(true);
133836
134292
  }
133837
- let response = await clientInstance.call(
134293
+ const response = await clientInstance.call(
133838
134294
  "GET",
133839
134295
  new URL(endpoint + "/health/version")
133840
134296
  );
@@ -133985,6 +134441,9 @@ async function downloadDeploymentCode(params) {
133985
134441
  {},
133986
134442
  "arrayBuffer"
133987
134443
  );
134444
+ if (!(downloadBuffer instanceof ArrayBuffer)) {
134445
+ throw new Error("Failed to download deployment archive as ArrayBuffer.");
134446
+ }
133988
134447
  try {
133989
134448
  fs3.writeFileSync(compressedFileName, Buffer.from(downloadBuffer));
133990
134449
  } catch (err) {
@@ -134063,7 +134522,7 @@ var getConfirmation = async () => {
134063
134522
  }
134064
134523
  return answers2.changes;
134065
134524
  }
134066
- let answers = await import_inquirer2.default.prompt(questionPushChanges);
134525
+ const answers = await import_inquirer2.default.prompt(questionPushChanges);
134067
134526
  if (answers.changes !== "YES" && answers.changes !== "NO") {
134068
134527
  answers.changes = await fixConfirmation();
134069
134528
  }
@@ -134113,7 +134572,7 @@ var approveChanges = async (resource, resourceGetFunction, keys, resourceName, r
134113
134572
  options[secondResourceName] = localResource[secondId];
134114
134573
  }
134115
134574
  const remoteResource = await resourceGetFunction(options);
134116
- for (let [key, value] of Object.entries(
134575
+ for (const [key, value] of Object.entries(
134117
134576
  whitelistKeys(remoteResource, keys)
134118
134577
  )) {
134119
134578
  if (skipKeys.includes(key)) {
@@ -134122,28 +134581,30 @@ var approveChanges = async (resource, resourceGetFunction, keys, resourceName, r
134122
134581
  if (isEmpty(value) && isEmpty(localResource[key])) {
134123
134582
  continue;
134124
134583
  }
134125
- if (Array.isArray(value) && Array.isArray(localResource[key])) {
134126
- if (JSON.stringify(value) !== JSON.stringify(localResource[key])) {
134584
+ const localValue = localResource[key];
134585
+ if (Array.isArray(value) && Array.isArray(localValue)) {
134586
+ if (JSON.stringify(value) !== JSON.stringify(localValue)) {
134127
134587
  changes.push({
134128
134588
  id: localResource["$id"],
134129
134589
  key,
134130
134590
  remote: import_chalk4.default.red(value.join("\n")),
134131
- local: import_chalk4.default.green(localResource[key].join("\n"))
134591
+ local: import_chalk4.default.green(
134592
+ localValue.map((entry) => String(entry)).join("\n")
134593
+ )
134132
134594
  });
134133
134595
  }
134134
- } else if (value !== localResource[key]) {
134596
+ } else if (value !== localValue) {
134135
134597
  changes.push({
134136
134598
  id: localResource["$id"],
134137
134599
  key,
134138
- remote: import_chalk4.default.red(value),
134139
- local: import_chalk4.default.green(localResource[key])
134600
+ remote: import_chalk4.default.red(String(value ?? "")),
134601
+ local: import_chalk4.default.green(String(localValue ?? ""))
134140
134602
  });
134141
134603
  }
134142
134604
  }
134143
134605
  } catch (e) {
134144
- if (Number(e.code) !== 404) {
134145
- throw e;
134146
- }
134606
+ const isNotFound = e instanceof AppwriteException && Number(e.code) === 404;
134607
+ if (!isNotFound) throw e;
134147
134608
  }
134148
134609
  })
134149
134610
  );
@@ -134165,8 +134626,8 @@ async function createPullInstance(options = {
134165
134626
  }) {
134166
134627
  const { silent, requiresConsoleAuth } = options;
134167
134628
  const projectClient2 = await sdkForProject();
134168
- const consoleClient2 = await sdkForConsole(requiresConsoleAuth);
134169
- const pullInstance = new Pull(projectClient2, consoleClient2, silent);
134629
+ const consoleClient = await sdkForConsole(requiresConsoleAuth);
134630
+ const pullInstance = new Pull(projectClient2, consoleClient, silent);
134170
134631
  pullInstance.setConfigDirectoryPath(localConfig.configDirectoryPath);
134171
134632
  return pullInstance;
134172
134633
  }
@@ -134175,9 +134636,9 @@ var Pull = class {
134175
134636
  consoleClient;
134176
134637
  configDirectoryPath;
134177
134638
  silent;
134178
- constructor(projectClient2, consoleClient2, silent = false) {
134639
+ constructor(projectClient2, consoleClient, silent = false) {
134179
134640
  this.projectClient = projectClient2;
134180
- this.consoleClient = consoleClient2;
134641
+ this.consoleClient = consoleClient;
134181
134642
  this.configDirectoryPath = process.cwd();
134182
134643
  this.silent = silent;
134183
134644
  }
@@ -134666,7 +135127,7 @@ var pullResources = async ({
134666
135127
  delete actions.collections;
134667
135128
  }
134668
135129
  if (cliConfig.all) {
134669
- for (let action of Object.values(actions)) {
135130
+ for (const action of Object.values(actions)) {
134670
135131
  cliConfig.all = true;
134671
135132
  await action({ returnOnZero: true });
134672
135133
  }
@@ -134905,7 +135366,6 @@ var initProject = async ({
134905
135366
  projectId,
134906
135367
  projectName
134907
135368
  } = {}) => {
134908
- let response = {};
134909
135369
  try {
134910
135370
  if (globalConfig2.getEndpoint() === "" || globalConfig2.getCookie() === "") {
134911
135371
  throw new Error(
@@ -134915,33 +135375,39 @@ var initProject = async ({
134915
135375
  const client2 = await sdkForConsole();
134916
135376
  const accountClient2 = new Account(client2);
134917
135377
  await accountClient2.get();
134918
- } catch (e) {
135378
+ } catch (_e) {
134919
135379
  error48(
134920
135380
  `Error Session not found. Please run '${EXECUTABLE_NAME} login' to create a session`
134921
135381
  );
134922
135382
  process.exit(1);
134923
135383
  }
134924
- let answers = {};
135384
+ let answers;
134925
135385
  if (!organizationId && !projectId && !projectName) {
134926
135386
  answers = await import_inquirer4.default.prompt(questionsInitProject);
134927
135387
  if (answers.override === false) {
134928
135388
  process.exit(1);
134929
135389
  }
134930
135390
  } else {
134931
- answers.start = "existing";
134932
- answers.project = {};
134933
- answers.organization = {};
134934
- answers.organization = organizationId ?? (await import_inquirer4.default.prompt([questionsInitProject[2]])).organization;
134935
- answers.project.name = projectName ?? (await import_inquirer4.default.prompt([questionsInitProject[3]])).project;
134936
- answers.project = projectId ?? (await import_inquirer4.default.prompt([questionsInitProject[4]])).id;
135391
+ const selectedOrganization = organizationId ?? (await import_inquirer4.default.prompt([questionsInitProject[2]])).organization;
135392
+ const selectedProjectName = projectName ?? (await import_inquirer4.default.prompt([questionsInitProject[3]])).project;
135393
+ const selectedProjectId = projectId ?? (await import_inquirer4.default.prompt([questionsInitProject[4]])).id;
135394
+ answers = {
135395
+ start: "existing",
135396
+ project: selectedProjectId,
135397
+ organization: selectedOrganization
135398
+ };
134937
135399
  try {
134938
135400
  const projectsService = await getProjectsService();
134939
- await projectsService.get(projectId);
135401
+ const existingProject = await projectsService.get(selectedProjectId);
135402
+ answers.project = existingProject;
134940
135403
  } catch (e) {
134941
- if (e.code === 404) {
134942
- answers.start = "new";
134943
- answers.id = answers.project;
134944
- answers.project = answers.project.name;
135404
+ if (e instanceof AppwriteException && e.code === 404) {
135405
+ answers = {
135406
+ start: "new",
135407
+ id: selectedProjectId,
135408
+ project: selectedProjectName,
135409
+ organization: selectedOrganization
135410
+ };
134945
135411
  } else {
134946
135412
  throw e;
134947
135413
  }
@@ -134950,10 +135416,26 @@ var initProject = async ({
134950
135416
  localConfig.clear();
134951
135417
  const url2 = new URL(DEFAULT_ENDPOINT);
134952
135418
  if (answers.start === "new") {
135419
+ let projectIdToCreate;
135420
+ let projectNameToCreate;
135421
+ switch (typeof answers.project) {
135422
+ case "string":
135423
+ projectIdToCreate = answers.id ?? answers.project;
135424
+ projectNameToCreate = answers.project;
135425
+ break;
135426
+ case "object":
135427
+ projectIdToCreate = answers.id ?? answers.project.$id;
135428
+ projectNameToCreate = answers.project.name ?? answers.project.$id;
135429
+ break;
135430
+ default:
135431
+ projectIdToCreate = answers.id;
135432
+ projectNameToCreate = "";
135433
+ break;
135434
+ }
134953
135435
  const projectsService = await getProjectsService();
134954
- response = await projectsService.create(
134955
- answers.id,
134956
- answers.project,
135436
+ const response = await projectsService.create(
135437
+ projectIdToCreate,
135438
+ projectNameToCreate,
134957
135439
  answers.organization,
134958
135440
  answers.region
134959
135441
  );
@@ -134964,10 +135446,22 @@ var initProject = async ({
134964
135446
  );
134965
135447
  }
134966
135448
  } else {
134967
- localConfig.setProject(answers.project["$id"]);
134968
- if (isCloud()) {
135449
+ let selectedProject;
135450
+ switch (typeof answers.project) {
135451
+ case "string":
135452
+ selectedProject = { $id: answers.project };
135453
+ break;
135454
+ case "object":
135455
+ selectedProject = answers.project;
135456
+ break;
135457
+ default:
135458
+ selectedProject = { $id: "" };
135459
+ break;
135460
+ }
135461
+ localConfig.setProject(selectedProject.$id);
135462
+ if (isCloud() && selectedProject.region) {
134969
135463
  localConfig.setEndpoint(
134970
- `https://${answers.project["region"]}.${url2.host}${url2.pathname}`
135464
+ `https://${selectedProject.region}.${url2.host}${url2.pathname}`
134971
135465
  );
134972
135466
  }
134973
135467
  }
@@ -134975,8 +135469,10 @@ var initProject = async ({
134975
135469
  `Project successfully ${answers.start === "existing" ? "linked" : "created"}. Details are now stored in appwrite.config.json file.`
134976
135470
  );
134977
135471
  if (answers.start === "existing") {
134978
- answers = await import_inquirer4.default.prompt(questionsInitProjectAutopull);
134979
- if (answers.autopull) {
135472
+ const autopullAnswers = await import_inquirer4.default.prompt(
135473
+ questionsInitProjectAutopull
135474
+ );
135475
+ if (autopullAnswers.autopull) {
134980
135476
  cliConfig.all = true;
134981
135477
  cliConfig.force = true;
134982
135478
  await pullResources({
@@ -135116,7 +135612,6 @@ var initFunction = async () => {
135116
135612
  fs5.mkdirSync(functionDir, { mode: 511 });
135117
135613
  fs5.mkdirSync(templatesDir, { mode: 511 });
135118
135614
  const repo = "https://github.com/appwrite/templates";
135119
- const api = `https://api.github.com/repos/appwrite/templates/contents/${answers.runtime.name}`;
135120
135615
  let selected = { template: "starter" };
135121
135616
  const sparse = (selected ? `${answers.runtime.name}/${selected.template}` : answers.runtime.name).toLowerCase();
135122
135617
  let gitInitCommands = `git clone --single-branch --depth 1 --sparse ${repo} .`;
@@ -135135,17 +135630,18 @@ var initFunction = async () => {
135135
135630
  cwd: templatesDir
135136
135631
  });
135137
135632
  } catch (err) {
135138
- if (err.message.includes("error: unknown option")) {
135633
+ const errorMessage = err instanceof Error ? err.message : String(err);
135634
+ if (errorMessage.includes("error: unknown option")) {
135139
135635
  throw new Error(
135140
- `${err.message}
135636
+ `${errorMessage}
135141
135637
 
135142
135638
  Suggestion: Try updating your git to the latest version, then trying to run this command again.`
135143
135639
  );
135144
- } else if (err.message.includes(
135640
+ } else if (errorMessage.includes(
135145
135641
  "is not recognized as an internal or external command,"
135146
- ) || err.message.includes("command not found")) {
135642
+ ) || errorMessage.includes("command not found")) {
135147
135643
  throw new Error(
135148
- `${err.message}
135644
+ `${errorMessage}
135149
135645
 
135150
135646
  Suggestion: It appears that git is not installed, try installing git then trying to run this command again.`
135151
135647
  );
@@ -135167,9 +135663,9 @@ Suggestion: It appears that git is not installed, try installing git then trying
135167
135663
  }
135168
135664
  }
135169
135665
  const copyRecursiveSync = (src, dest) => {
135170
- let exists = fs5.existsSync(src);
135171
- let stats = exists && fs5.statSync(src);
135172
- let isDirectory = exists && stats && stats.isDirectory();
135666
+ const exists = fs5.existsSync(src);
135667
+ const stats = exists && fs5.statSync(src);
135668
+ const isDirectory = exists && stats && stats.isDirectory();
135173
135669
  if (isDirectory) {
135174
135670
  if (!fs5.existsSync(dest)) {
135175
135671
  fs5.mkdirSync(dest);
@@ -135197,7 +135693,7 @@ Suggestion: It appears that git is not installed, try installing git then trying
135197
135693
  newReadmeFile[0] = `# ${answers.name}`;
135198
135694
  newReadmeFile.splice(1, 2);
135199
135695
  fs5.writeFileSync(readmePath, newReadmeFile.join("\n"));
135200
- let data = {
135696
+ const data = {
135201
135697
  $id: functionId,
135202
135698
  name: answers.name,
135203
135699
  runtime: answers.runtime.id,
@@ -135253,14 +135749,15 @@ var initSite = async () => {
135253
135749
  }
135254
135750
  templateDetails = response.templates[0];
135255
135751
  } catch (err) {
135752
+ const errorMessage = err instanceof Error ? err.message : String(err);
135256
135753
  throw new Error(
135257
- `Failed to fetch template for framework ${answers.framework.key}: ${err.message}`
135754
+ `Failed to fetch template for framework ${answers.framework.key}: ${errorMessage}`
135258
135755
  );
135259
135756
  }
135260
135757
  fs5.mkdirSync(siteDir, { mode: 511 });
135261
135758
  fs5.mkdirSync(templatesDir, { mode: 511 });
135262
135759
  const repo = `https://github.com/${templateDetails.providerOwner}/${templateDetails.providerRepositoryId}`;
135263
- let selected = {
135760
+ const selected = {
135264
135761
  template: templateDetails.frameworks[0].providerRootDirectory
135265
135762
  };
135266
135763
  let dirSetupCommands = "";
@@ -135285,12 +135782,12 @@ var initSite = async () => {
135285
135782
  git config remote.origin.tagopt --no-tags
135286
135783
  `.trim();
135287
135784
  }
135288
- let windowsGitCloneCommands = `
135785
+ const windowsGitCloneCommands = `
135289
135786
  $tag = (git ls-remote --tags origin "${templateDetails.providerVersion}" | Select-Object -Last 1) -replace '.*refs/tags/', ''
135290
135787
  git fetch --depth=1 origin "refs/tags/$tag"
135291
135788
  git checkout FETCH_HEAD
135292
135789
  `.trim();
135293
- let unixGitCloneCommands = `
135790
+ const unixGitCloneCommands = `
135294
135791
  git fetch --depth=1 origin refs/tags/$(git ls-remote --tags origin "${templateDetails.providerVersion}" | tail -n 1 | awk -F '/' '{print $3}')
135295
135792
  git checkout FETCH_HEAD
135296
135793
  `.trim();
@@ -135308,17 +135805,18 @@ var initSite = async () => {
135308
135805
  shell: usedShell
135309
135806
  });
135310
135807
  } catch (err) {
135311
- if (err.message.includes("error: unknown option")) {
135808
+ const errorMessage = err instanceof Error ? err.message : String(err);
135809
+ if (errorMessage.includes("error: unknown option")) {
135312
135810
  throw new Error(
135313
- `${err.message}
135811
+ `${errorMessage}
135314
135812
 
135315
135813
  Suggestion: Try updating your git to the latest version, then trying to run this command again.`
135316
135814
  );
135317
- } else if (err.message.includes(
135815
+ } else if (errorMessage.includes(
135318
135816
  "is not recognized as an internal or external command,"
135319
- ) || err.message.includes("command not found")) {
135817
+ ) || errorMessage.includes("command not found")) {
135320
135818
  throw new Error(
135321
- `${err.message}
135819
+ `${errorMessage}
135322
135820
 
135323
135821
  Suggestion: It appears that git is not installed, try installing git then trying to run this command again.`
135324
135822
  );
@@ -135339,24 +135837,22 @@ Suggestion: It appears that git is not installed, try installing git then trying
135339
135837
  newReadmeFile[0] = `# ${answers.name}`;
135340
135838
  newReadmeFile.splice(1, 2);
135341
135839
  fs5.writeFileSync(readmePath, newReadmeFile.join("\n"));
135342
- let vars = (templateDetails.variables ?? []).map((variable) => {
135343
- let value = variable.value;
135840
+ const vars = {};
135841
+ for (const variable of templateDetails.variables ?? []) {
135842
+ let value = variable.value ?? "";
135344
135843
  const replacements = {
135345
135844
  "{apiEndpoint}": globalConfig2.getEndpoint(),
135346
- "{projectId}": localConfig.getProject().projectId,
135347
- "{projectName}": localConfig.getProject().projectName
135845
+ "{projectId}": localConfig.getProject().projectId ?? "",
135846
+ "{projectName}": localConfig.getProject().projectName ?? ""
135348
135847
  };
135349
135848
  for (const placeholder in replacements) {
135350
- if (value?.includes(placeholder)) {
135849
+ if (value.includes(placeholder)) {
135351
135850
  value = value.replace(placeholder, replacements[placeholder]);
135352
135851
  }
135353
135852
  }
135354
- return {
135355
- key: variable.name,
135356
- value
135357
- };
135358
- });
135359
- let data = {
135853
+ vars[variable.name] = value;
135854
+ }
135855
+ const data = {
135360
135856
  $id: siteId,
135361
135857
  name: answers.name,
135362
135858
  framework: answers.framework.key,
@@ -136823,12 +137319,10 @@ var typesCommand = actionRunner(
136823
137319
  log(`Directory: ${outputDirectory} does not exist, creating...`);
136824
137320
  fs10.mkdirSync(outputDirectory, { recursive: true });
136825
137321
  }
136826
- let tables = localConfig.getTables();
137322
+ const tables = localConfig.getTables();
136827
137323
  let collections = [];
136828
- let dataSource = "tables";
136829
137324
  if (tables.length === 0) {
136830
137325
  collections = localConfig.getCollections();
136831
- dataSource = "collections";
136832
137326
  if (collections.length === 0) {
136833
137327
  const configFileName = path9.basename(localConfig.path);
136834
137328
  throw new Error(
@@ -137000,9 +137494,9 @@ var JwtManager = {
137000
137494
  timerWarn: null,
137001
137495
  timerError: null,
137002
137496
  async setup(userId = null, projectScopes = []) {
137003
- const consoleClient2 = await sdkForConsole();
137004
- const usersClient2 = new Users(consoleClient2);
137005
- const projectsClient2 = new Projects(consoleClient2);
137497
+ const consoleClient = await sdkForConsole();
137498
+ const usersClient2 = new Users(consoleClient);
137499
+ const projectsClient2 = new Projects(consoleClient);
137006
137500
  if (this.timerWarn) {
137007
137501
  clearTimeout(this.timerWarn);
137008
137502
  }
@@ -137283,9 +137777,8 @@ async function dockerStart(func, variables, port) {
137283
137777
  try {
137284
137778
  await waitUntilPortOpen(port);
137285
137779
  } catch (err) {
137286
- error48(
137287
- "Failed to start function with error: " + (err.message ? err.message : err.toString())
137288
- );
137780
+ const message = err instanceof Error ? err.message : String(err);
137781
+ error48(`Failed to start function with error: ${message}`);
137289
137782
  return;
137290
137783
  }
137291
137784
  success2(`Visit http://localhost:${port}/ to execute your function.`);
@@ -137452,7 +137945,7 @@ var runFunction = async ({
137452
137945
  });
137453
137946
  } catch (err) {
137454
137947
  warn(
137455
- "Remote variables not fetched. Production environment variables will not be available. Reason: " + err.message
137948
+ "Remote variables not fetched. Production environment variables will not be available. Reason: " + getErrorMessage(err)
137456
137949
  );
137457
137950
  }
137458
137951
  }
@@ -137476,7 +137969,7 @@ var runFunction = async ({
137476
137969
  await JwtManager.setup(userId, func.scopes ?? []);
137477
137970
  } catch (err) {
137478
137971
  warn(
137479
- "Dynamic API key not generated. Header x-appwrite-key will not be set. Reason: " + err.message
137972
+ "Dynamic API key not generated. Header x-appwrite-key will not be set. Reason: " + getErrorMessage(err)
137480
137973
  );
137481
137974
  }
137482
137975
  const headers = {};
@@ -137976,7 +138469,7 @@ var Spinner = class _Spinner {
137976
138469
  static stop() {
137977
138470
  _Spinner.updatesBar.stop();
137978
138471
  }
137979
- static formatter(options, params, payload) {
138472
+ static formatter(_options, _params, payload) {
137980
138473
  const status = payload.status.padEnd(12);
137981
138474
  const middle = `${payload.resource} (${payload.id})`.padEnd(40);
137982
138475
  let prefix = import_chalk8.default.cyan(payload.prefix ?? "\u29D7");
@@ -138061,7 +138554,7 @@ var Pools = class {
138061
138554
  return true;
138062
138555
  }
138063
138556
  if (this.pollMaxDebounces === this.POLL_DEFAULT_VALUE) {
138064
- let steps = Math.max(1, Math.ceil(Number(total) / this.STEP_SIZE));
138557
+ const steps = Math.max(1, Math.ceil(Number(total) / this.STEP_SIZE));
138065
138558
  if (steps > 1 && iteration === 1) {
138066
138559
  this.pollMaxDebounces *= steps;
138067
138560
  log(
@@ -138087,7 +138580,7 @@ var Pools = class {
138087
138580
  return true;
138088
138581
  }
138089
138582
  if (this.pollMaxDebounces === this.POLL_DEFAULT_VALUE) {
138090
- let steps = Math.max(1, Math.ceil(Number(total) / this.STEP_SIZE));
138583
+ const steps = Math.max(1, Math.ceil(Number(total) / this.STEP_SIZE));
138091
138584
  if (steps > 1 && iteration === 1) {
138092
138585
  this.pollMaxDebounces *= steps;
138093
138586
  log(
@@ -138103,7 +138596,10 @@ var Pools = class {
138103
138596
  return false;
138104
138597
  }
138105
138598
  if (this.pollMaxDebounces === this.POLL_DEFAULT_VALUE) {
138106
- let steps = Math.max(1, Math.ceil(attributeKeys.length / this.STEP_SIZE));
138599
+ const steps = Math.max(
138600
+ 1,
138601
+ Math.ceil(attributeKeys.length / this.STEP_SIZE)
138602
+ );
138107
138603
  if (steps > 1 && iteration === 1) {
138108
138604
  this.pollMaxDebounces *= steps;
138109
138605
  log(
@@ -138146,7 +138642,10 @@ var Pools = class {
138146
138642
  return false;
138147
138643
  }
138148
138644
  if (this.pollMaxDebounces === this.POLL_DEFAULT_VALUE) {
138149
- let steps = Math.max(1, Math.ceil(attributeKeys.length / this.STEP_SIZE));
138645
+ const steps = Math.max(
138646
+ 1,
138647
+ Math.ceil(attributeKeys.length / this.STEP_SIZE)
138648
+ );
138150
138649
  if (steps > 1 && iteration === 1) {
138151
138650
  this.pollMaxDebounces *= steps;
138152
138651
  log(
@@ -138195,7 +138694,7 @@ var Pools = class {
138195
138694
  return false;
138196
138695
  }
138197
138696
  if (this.pollMaxDebounces === this.POLL_DEFAULT_VALUE) {
138198
- let steps = Math.max(1, Math.ceil(indexKeys.length / this.STEP_SIZE));
138697
+ const steps = Math.max(1, Math.ceil(indexKeys.length / this.STEP_SIZE));
138199
138698
  if (steps > 1 && iteration === 1) {
138200
138699
  this.pollMaxDebounces *= steps;
138201
138700
  log(
@@ -138288,7 +138787,7 @@ var Attributes = class {
138288
138787
  }
138289
138788
  return answers2.changes;
138290
138789
  }
138291
- let answers = await import_inquirer6.default.prompt(questionPushChanges2);
138790
+ const answers = await import_inquirer6.default.prompt(questionPushChanges2);
138292
138791
  if (answers.changes !== "YES" && answers.changes !== "NO") {
138293
138792
  answers.changes = await fixConfirmation();
138294
138793
  }
@@ -138331,8 +138830,8 @@ var Attributes = class {
138331
138830
  const keyName = `${import_chalk9.default.yellow(local.key)} in ${collection.name} (${collection["$id"]})`;
138332
138831
  const action = import_chalk9.default.cyan(recreating ? "recreating" : "changing");
138333
138832
  let reason = "";
138334
- let attribute = recreating ? remote : local;
138335
- for (let key of Object.keys(remote)) {
138833
+ const attribute = recreating ? remote : local;
138834
+ for (const key of Object.keys(remote)) {
138336
138835
  if (!KeysAttributes.has(key)) {
138337
138836
  continue;
138338
138837
  }
@@ -138842,7 +139341,7 @@ var Attributes = class {
138842
139341
  createIndexes = async (indexes, collection) => {
138843
139342
  log(`Creating indexes ...`);
138844
139343
  const databasesService = await getDatabasesService(this.client);
138845
- for (let index of indexes) {
139344
+ for (const index of indexes) {
138846
139345
  await databasesService.createIndex({
138847
139346
  databaseId: collection["databaseId"],
138848
139347
  collectionId: collection["$id"],
@@ -138866,7 +139365,7 @@ var Attributes = class {
138866
139365
  };
138867
139366
  createAttributes = async (attributes, collection) => {
138868
139367
  log(`Creating attributes ...`);
138869
- for (let attribute of attributes) {
139368
+ for (const attribute of attributes) {
138870
139369
  if (attribute.side !== "child") {
138871
139370
  await this.createAttribute(
138872
139371
  collection["databaseId"],
@@ -138890,7 +139389,7 @@ var Attributes = class {
138890
139389
  };
138891
139390
  createColumns = async (columns, table) => {
138892
139391
  log(`Creating columns ...`);
138893
- for (let column of columns) {
139392
+ for (const column of columns) {
138894
139393
  if (column.side !== "child") {
138895
139394
  await this.createAttribute(table["databaseId"], table["$id"], column);
138896
139395
  }
@@ -138912,18 +139411,37 @@ var Attributes = class {
138912
139411
 
138913
139412
  // lib/commands/utils/database-sync.ts
138914
139413
  var import_chalk10 = __toESM(require_source(), 1);
139414
+ var isTablesDBResource = (value) => {
139415
+ if (!value || typeof value !== "object") {
139416
+ return false;
139417
+ }
139418
+ return "$id" in value && typeof value.$id === "string" && "name" in value && typeof value.name === "string" && "enabled" in value && typeof value.enabled === "boolean";
139419
+ };
139420
+ var getSyncErrorMessage = (err) => {
139421
+ if (err instanceof AppwriteException) {
139422
+ return err.message;
139423
+ }
139424
+ if (err instanceof Error) {
139425
+ return err.message;
139426
+ }
139427
+ return String(err);
139428
+ };
138915
139429
  var checkAndApplyTablesDBChanges = async () => {
138916
139430
  log("Checking for tablesDB changes ...");
138917
139431
  const localTablesDBs = localConfig.getTablesDBs();
138918
- const { databases: remoteTablesDBs } = await paginate(
139432
+ const paginatedResult = await paginate(
138919
139433
  async (args) => {
138920
139434
  const tablesDBService = await getTablesDBService();
138921
- return await tablesDBService.list(args.queries || []);
139435
+ const queries = Array.isArray(args.queries) ? args.queries.filter(
139436
+ (query) => typeof query === "string"
139437
+ ) : [];
139438
+ return await tablesDBService.list(queries);
138922
139439
  },
138923
139440
  {},
138924
139441
  100,
138925
139442
  "databases"
138926
139443
  );
139444
+ const remoteTablesDBs = Array.isArray(paginatedResult.databases) ? paginatedResult.databases.filter(isTablesDBResource) : [];
138927
139445
  if (localTablesDBs.length === 0 && remoteTablesDBs.length === 0) {
138928
139446
  return { applied: false, resyncNeeded: false };
138929
139447
  }
@@ -138945,9 +139463,7 @@ var checkAndApplyTablesDBChanges = async () => {
138945
139463
  }
138946
139464
  }
138947
139465
  for (const localDB of localTablesDBs) {
138948
- const remoteDB = remoteTablesDBs.find(
138949
- (db) => db.$id === localDB.$id
138950
- );
139466
+ const remoteDB = remoteTablesDBs.find((db) => db.$id === localDB.$id);
138951
139467
  if (!remoteDB) {
138952
139468
  toCreate.push(localDB);
138953
139469
  changes.push({
@@ -139014,7 +139530,7 @@ var checkAndApplyTablesDBChanges = async () => {
139014
139530
  needsResync = true;
139015
139531
  } catch (e) {
139016
139532
  error48(
139017
- `Failed to delete database ${db.name} ( ${db.$id} ): ${e.message}`
139533
+ `Failed to delete database ${db.name} ( ${db.$id} ): ${getSyncErrorMessage(e)}`
139018
139534
  );
139019
139535
  throw new Error(
139020
139536
  `Database sync failed during deletion of ${db.$id}. Some changes may have been applied.`
@@ -139029,7 +139545,7 @@ var checkAndApplyTablesDBChanges = async () => {
139029
139545
  success2(`Created ${db.name} ( ${db.$id} )`);
139030
139546
  } catch (e) {
139031
139547
  error48(
139032
- `Failed to create database ${db.name} ( ${db.$id} ): ${e.message}`
139548
+ `Failed to create database ${db.name} ( ${db.$id} ): ${getSyncErrorMessage(e)}`
139033
139549
  );
139034
139550
  throw new Error(
139035
139551
  `Database sync failed during creation of ${db.$id}. Some changes may have been applied.`
@@ -139044,7 +139560,7 @@ var checkAndApplyTablesDBChanges = async () => {
139044
139560
  success2(`Updated ${db.name} ( ${db.$id} )`);
139045
139561
  } catch (e) {
139046
139562
  error48(
139047
- `Failed to update database ${db.name} ( ${db.$id} ): ${e.message}`
139563
+ `Failed to update database ${db.name} ( ${db.$id} ): ${getSyncErrorMessage(e)}`
139048
139564
  );
139049
139565
  throw new Error(
139050
139566
  `Database sync failed during update of ${db.$id}. Some changes may have been applied.`
@@ -139062,9 +139578,9 @@ var Push = class {
139062
139578
  projectClient;
139063
139579
  consoleClient;
139064
139580
  silent;
139065
- constructor(projectClient2, consoleClient2, silent = false) {
139581
+ constructor(projectClient2, consoleClient, silent = false) {
139066
139582
  this.projectClient = projectClient2;
139067
- this.consoleClient = consoleClient2;
139583
+ this.consoleClient = consoleClient;
139068
139584
  this.silent = silent;
139069
139585
  }
139070
139586
  /**
@@ -139278,7 +139794,7 @@ var Push = class {
139278
139794
  }
139279
139795
  if (settings.services) {
139280
139796
  this.log("Applying service statuses ...");
139281
- for (let [service, status] of Object.entries(settings.services)) {
139797
+ for (const [service, status] of Object.entries(settings.services)) {
139282
139798
  await projectsService.updateServiceStatus({
139283
139799
  projectId,
139284
139800
  service,
@@ -139324,7 +139840,7 @@ var Push = class {
139324
139840
  }
139325
139841
  if (settings.auth.methods) {
139326
139842
  this.log("Applying auth methods statuses ...");
139327
- for (let [method, status] of Object.entries(settings.auth.methods)) {
139843
+ for (const [method, status] of Object.entries(settings.auth.methods)) {
139328
139844
  await projectsService.updateAuthStatus({
139329
139845
  projectId,
139330
139846
  method,
@@ -139628,7 +140144,7 @@ var Push = class {
139628
140144
  ([key, value]) => ({ key, value })
139629
140145
  );
139630
140146
  }
139631
- } catch (error49) {
140147
+ } catch (_error) {
139632
140148
  envVariables = [];
139633
140149
  }
139634
140150
  await Promise.all(
@@ -139925,7 +140441,7 @@ var Push = class {
139925
140441
  ([key, value]) => ({ key, value })
139926
140442
  );
139927
140443
  }
139928
- } catch (error49) {
140444
+ } catch (_error) {
139929
140445
  envVariables = [];
139930
140446
  }
139931
140447
  await Promise.all(
@@ -140092,7 +140608,7 @@ var Push = class {
140092
140608
  skipConfirmation,
140093
140609
  this.projectClient
140094
140610
  );
140095
- let tablesChanged = /* @__PURE__ */ new Set();
140611
+ const tablesChanged = /* @__PURE__ */ new Set();
140096
140612
  const errors = [];
140097
140613
  await Promise.all(
140098
140614
  tables.map(async (table) => {
@@ -140146,7 +140662,7 @@ var Push = class {
140146
140662
  }
140147
140663
  })
140148
140664
  );
140149
- for (let table of tables) {
140665
+ for (const table of tables) {
140150
140666
  let columns = table.columns;
140151
140667
  let indexes = table.indexes;
140152
140668
  let hadChanges = false;
@@ -140347,8 +140863,8 @@ async function createPushInstance(options = {
140347
140863
  }) {
140348
140864
  const { silent, requiresConsoleAuth } = options;
140349
140865
  const projectClient2 = await sdkForProject();
140350
- const consoleClient2 = await sdkForConsole(requiresConsoleAuth);
140351
- return new Push(projectClient2, consoleClient2, silent);
140866
+ const consoleClient = await sdkForConsole(requiresConsoleAuth);
140867
+ return new Push(projectClient2, consoleClient, silent);
140352
140868
  }
140353
140869
  var pushResources = async ({
140354
140870
  skipDeprecated = false
@@ -140425,7 +140941,7 @@ var pushSettings = async () => {
140425
140941
  checkDeployConditions(localConfig);
140426
140942
  try {
140427
140943
  const projectsService = await getProjectsService();
140428
- let response = await projectsService.get(
140944
+ const response = await projectsService.get(
140429
140945
  localConfig.getProject().projectId
140430
140946
  );
140431
140947
  const remoteSettings = createSettingsObject(response);
@@ -140458,7 +140974,7 @@ var pushSettings = async () => {
140458
140974
  return;
140459
140975
  }
140460
140976
  }
140461
- } catch (e) {
140977
+ } catch (_e) {
140462
140978
  }
140463
140979
  try {
140464
140980
  log("Pushing project settings ...");
@@ -140508,7 +141024,7 @@ var pushSite = async ({
140508
141024
  );
140509
141025
  return;
140510
141026
  }
140511
- let sites2 = siteIds.map((id) => {
141027
+ const sites2 = siteIds.map((id) => {
140512
141028
  const sites3 = localConfig.getSites();
140513
141029
  const site = sites3.find((s) => s.$id === id);
140514
141030
  if (!site) {
@@ -140517,7 +141033,7 @@ var pushSite = async ({
140517
141033
  return site;
140518
141034
  });
140519
141035
  log("Validating sites ...");
140520
- for (let site of sites2) {
141036
+ for (const site of sites2) {
140521
141037
  if (!site.buildCommand) {
140522
141038
  log(`Site ${site.name} is missing build command.`);
140523
141039
  const answers = await import_inquirer7.default.prompt(questionsGetEntrypoint);
@@ -140628,7 +141144,7 @@ var pushFunction = async ({
140628
141144
  );
140629
141145
  return;
140630
141146
  }
140631
- let functions2 = functionIds.map((id) => {
141147
+ const functions2 = functionIds.map((id) => {
140632
141148
  const functions3 = localConfig.getFunctions();
140633
141149
  const func = functions3.find((f) => f.$id === id);
140634
141150
  if (!func) {
@@ -140637,7 +141153,7 @@ var pushFunction = async ({
140637
141153
  return func;
140638
141154
  });
140639
141155
  log("Validating functions ...");
140640
- for (let func of functions2) {
141156
+ for (const func of functions2) {
140641
141157
  if (!func.entrypoint) {
140642
141158
  log(`Function ${func.name} is missing an entrypoint.`);
140643
141159
  const answers = await import_inquirer7.default.prompt(questionsGetEntrypoint);
@@ -140778,7 +141294,7 @@ var pushTable = async ({
140778
141294
  });
140779
141295
  }
140780
141296
  }
140781
- } catch (e) {
141297
+ } catch (_e) {
140782
141298
  }
140783
141299
  }
140784
141300
  if (tablesToDelete.length > 0) {
@@ -140925,7 +141441,7 @@ var pushCollection = async () => {
140925
141441
  }
140926
141442
  };
140927
141443
  var pushBucket = async () => {
140928
- let bucketIds = [];
141444
+ const bucketIds = [];
140929
141445
  const configBuckets = localConfig.getBuckets();
140930
141446
  if (cliConfig.all) {
140931
141447
  checkDeployConditions(localConfig);
@@ -140944,7 +141460,7 @@ var pushBucket = async () => {
140944
141460
  );
140945
141461
  return;
140946
141462
  }
140947
- let buckets = [];
141463
+ const buckets = [];
140948
141464
  for (const bucketId of bucketIds) {
140949
141465
  const idBuckets = configBuckets.filter((b) => b.$id === bucketId);
140950
141466
  buckets.push(...idBuckets);
@@ -140975,7 +141491,7 @@ var pushBucket = async () => {
140975
141491
  }
140976
141492
  };
140977
141493
  var pushTeam = async () => {
140978
- let teamIds = [];
141494
+ const teamIds = [];
140979
141495
  const configTeams = localConfig.getTeams();
140980
141496
  if (cliConfig.all) {
140981
141497
  checkDeployConditions(localConfig);
@@ -140994,7 +141510,7 @@ var pushTeam = async () => {
140994
141510
  );
140995
141511
  return;
140996
141512
  }
140997
- let teams2 = [];
141513
+ const teams2 = [];
140998
141514
  for (const teamId of teamIds) {
140999
141515
  const idTeams = configTeams.filter((t) => t.$id === teamId);
141000
141516
  teams2.push(...idTeams);
@@ -141025,7 +141541,7 @@ var pushTeam = async () => {
141025
141541
  }
141026
141542
  };
141027
141543
  var pushMessagingTopic = async () => {
141028
- let topicsIds = [];
141544
+ const topicsIds = [];
141029
141545
  const configTopics = localConfig.getMessagingTopics();
141030
141546
  if (cliConfig.all) {
141031
141547
  checkDeployConditions(localConfig);
@@ -141044,7 +141560,7 @@ var pushMessagingTopic = async () => {
141044
141560
  );
141045
141561
  return;
141046
141562
  }
141047
- let topics = [];
141563
+ const topics = [];
141048
141564
  for (const topicId of topicsIds) {
141049
141565
  const idTopic = configTopics.filter((b) => b.$id === topicId);
141050
141566
  topics.push(...idTopic);
@@ -141120,7 +141636,7 @@ var isInstalledViaNpm = () => {
141120
141636
  return true;
141121
141637
  }
141122
141638
  return false;
141123
- } catch (e) {
141639
+ } catch (_e) {
141124
141640
  return false;
141125
141641
  }
141126
141642
  };
@@ -141128,7 +141644,7 @@ var isInstalledViaHomebrew = () => {
141128
141644
  try {
141129
141645
  const scriptPath = process.argv[1];
141130
141646
  return scriptPath.includes("/opt/homebrew/") || scriptPath.includes("/usr/local/Cellar/");
141131
- } catch (e) {
141647
+ } catch (_e) {
141132
141648
  return false;
141133
141649
  }
141134
141650
  };
@@ -141158,13 +141674,14 @@ var updateViaNpm = async () => {
141158
141674
  success2("Updated to latest version via npm!");
141159
141675
  hint("Run 'appwrite --version' to verify the new version.");
141160
141676
  } catch (e) {
141161
- if (e.message.includes("EEXIST") || e.message.includes("file already exists")) {
141677
+ const message = getErrorMessage(e);
141678
+ if (message.includes("EEXIST") || message.includes("file already exists")) {
141162
141679
  console.log("");
141163
141680
  success2("Latest version is already installed via npm!");
141164
141681
  hint("The CLI is up to date. Run 'appwrite --version' to verify.");
141165
141682
  } else {
141166
141683
  console.log("");
141167
- error48(`Failed to update via npm: ${e.message}`);
141684
+ error48(`Failed to update via npm: ${message}`);
141168
141685
  hint(`Try running: npm install -g ${NPM_PACKAGE_NAME}@latest --force`);
141169
141686
  }
141170
141687
  }
@@ -141176,13 +141693,14 @@ var updateViaHomebrew = async () => {
141176
141693
  success2("Updated to latest version via Homebrew!");
141177
141694
  hint("Run 'appwrite --version' to verify the new version.");
141178
141695
  } catch (e) {
141179
- if (e.message.includes("already installed") || e.message.includes("up-to-date")) {
141696
+ const message = getErrorMessage(e);
141697
+ if (message.includes("already installed") || message.includes("up-to-date")) {
141180
141698
  console.log("");
141181
141699
  success2("Latest version is already installed via Homebrew!");
141182
141700
  hint("The CLI is up to date. Run 'appwrite --version' to verify.");
141183
141701
  } else {
141184
141702
  console.log("");
141185
- error48(`Failed to update via Homebrew: ${e.message}`);
141703
+ error48(`Failed to update via Homebrew: ${message}`);
141186
141704
  hint("Try running: brew upgrade appwrite");
141187
141705
  }
141188
141706
  }
@@ -141257,8 +141775,9 @@ var updateCli = async ({ manual } = {}) => {
141257
141775
  await chooseUpdateMethod(latestVersion);
141258
141776
  }
141259
141777
  } catch (e) {
141778
+ const message = getErrorMessage(e);
141260
141779
  console.log("");
141261
- error48(`Failed to check for updates: ${e.message}`);
141780
+ error48(`Failed to check for updates: ${message}`);
141262
141781
  hint(`You can manually check for updates at: ${GITHUB_RELEASES_URL}`);
141263
141782
  }
141264
141783
  };
@@ -141431,7 +141950,7 @@ var BaseDatabasesGenerator = class {
141431
141950
  var types_ts_default = "import { type Models } from '{{appwriteDep}}';\n\n{{{ENUMS}}}{{{TYPES}}}\ndeclare const __roleStringBrand: unique symbol;\nexport type RoleString = string & { readonly [__roleStringBrand]: never };\n\nexport type RoleBuilder = {\n any: () => RoleString;\n user: (userId: string, status?: string) => RoleString;\n users: (status?: string) => RoleString;\n guests: () => RoleString;\n team: (teamId: string, role?: string) => RoleString;\n member: (memberId: string) => RoleString;\n label: (label: string) => RoleString;\n}\n\nexport type PermissionBuilder = {\n read: (role: RoleString) => string;\n write: (role: RoleString) => string;\n create: (role: RoleString) => string;\n update: (role: RoleString) => string;\n delete: (role: RoleString) => string;\n}\n\nexport type PermissionCallback = (permission: PermissionBuilder, role: RoleBuilder) => string[];\n\nexport type QueryValue = string | number | boolean;\n\nexport type ExtractQueryValue<T> = T extends (infer U)[]\n ? U extends QueryValue ? U : never\n : T extends QueryValue | null ? NonNullable<T> : never;\n\nexport type QueryableKeys<T> = {\n [K in keyof T]: ExtractQueryValue<T[K]> extends never ? never : K;\n}[keyof T];\n\nexport type QueryBuilder<T> = {\n equal: <K extends QueryableKeys<T>>(field: K, value: ExtractQueryValue<T[K]>) => string;\n notEqual: <K extends QueryableKeys<T>>(field: K, value: ExtractQueryValue<T[K]>) => string;\n lessThan: <K extends QueryableKeys<T>>(field: K, value: ExtractQueryValue<T[K]>) => string;\n lessThanEqual: <K extends QueryableKeys<T>>(field: K, value: ExtractQueryValue<T[K]>) => string;\n greaterThan: <K extends QueryableKeys<T>>(field: K, value: ExtractQueryValue<T[K]>) => string;\n greaterThanEqual: <K extends QueryableKeys<T>>(field: K, value: ExtractQueryValue<T[K]>) => string;\n contains: <K extends QueryableKeys<T>>(field: K, value: ExtractQueryValue<T[K]>) => string;\n search: <K extends QueryableKeys<T>>(field: K, value: string) => string;\n isNull: <K extends QueryableKeys<T>>(field: K) => string;\n isNotNull: <K extends QueryableKeys<T>>(field: K) => string;\n startsWith: <K extends QueryableKeys<T>>(field: K, value: string) => string;\n endsWith: <K extends QueryableKeys<T>>(field: K, value: string) => string;\n between: <K extends QueryableKeys<T>>(field: K, start: ExtractQueryValue<T[K]>, end: ExtractQueryValue<T[K]>) => string;\n select: <K extends keyof T>(fields: K[]) => string;\n orderAsc: <K extends keyof T>(field: K) => string;\n orderDesc: <K extends keyof T>(field: K) => string;\n limit: (value: number) => string;\n offset: (value: number) => string;\n cursorAfter: (documentId: string) => string;\n cursorBefore: (documentId: string) => string;\n or: (...queries: string[]) => string;\n and: (...queries: string[]) => string;\n}\n\nexport type DatabaseId = {{{databaseIdType}}};\n\n{{{DATABASE_TABLES_TYPE}}}\n";
141432
141951
 
141433
141952
  // lib/commands/generators/typescript/templates/databases.ts.hbs
141434
- var databases_ts_default = 'import { Client, TablesDB, ID, Query, type Models, Permission, Role } from \'{{appwriteDep}}\';\nimport type { DatabaseHandle, DatabaseId, DatabaseTableMap, DatabaseTables, QueryBuilder, PermissionBuilder, RoleBuilder, RoleString } from \'./types{{importExt}}\';\n{{#if supportsServerSide}}\nimport { PROJECT_ID, ENDPOINT, API_KEY } from \'./constants{{importExt}}\';\n{{else}}\nimport { PROJECT_ID, ENDPOINT } from \'./constants{{importExt}}\';\n{{/if}}\n\nconst createQueryBuilder = <T>(): QueryBuilder<T> => ({\n equal: (field, value) => Query.equal(String(field), value as any),\n notEqual: (field, value) => Query.notEqual(String(field), value as any),\n lessThan: (field, value) => Query.lessThan(String(field), value as any),\n lessThanEqual: (field, value) => Query.lessThanEqual(String(field), value as any),\n greaterThan: (field, value) => Query.greaterThan(String(field), value as any),\n greaterThanEqual: (field, value) => Query.greaterThanEqual(String(field), value as any),\n contains: (field, value) => Query.contains(String(field), value as any),\n search: (field, value) => Query.search(String(field), value),\n isNull: (field) => Query.isNull(String(field)),\n isNotNull: (field) => Query.isNotNull(String(field)),\n startsWith: (field, value) => Query.startsWith(String(field), value),\n endsWith: (field, value) => Query.endsWith(String(field), value),\n between: (field, start, end) => Query.between(String(field), start as any, end as any),\n select: (fields) => Query.select(fields.map(String)),\n orderAsc: (field) => Query.orderAsc(String(field)),\n orderDesc: (field) => Query.orderDesc(String(field)),\n limit: (value) => Query.limit(value),\n offset: (value) => Query.offset(value),\n cursorAfter: (documentId) => Query.cursorAfter(documentId),\n cursorBefore: (documentId) => Query.cursorBefore(documentId),\n or: (...queries) => Query.or(queries),\n and: (...queries) => Query.and(queries),\n});\n\n{{{TABLE_ID_MAP}}}\n\n{{{TABLES_WITH_RELATIONSHIPS}}}\n\nconst roleBuilder: RoleBuilder = {\n any: () => Role.any() as RoleString,\n user: (userId, status?) => Role.user(userId, status) as RoleString,\n users: (status?) => Role.users(status) as RoleString,\n guests: () => Role.guests() as RoleString,\n team: (teamId, role?) => Role.team(teamId, role) as RoleString,\n member: (memberId) => Role.member(memberId) as RoleString,\n label: (label) => Role.label(label) as RoleString,\n};\n\nconst permissionBuilder: PermissionBuilder = {\n read: (role) => Permission.read(role),\n write: (role) => Permission.write(role),\n create: (role) => Permission.create(role),\n update: (role) => Permission.update(role),\n delete: (role) => Permission.delete(role),\n};\n\nconst resolvePermissions = (callback?: (permission: { read: (role: RoleString) => string; write: (role: RoleString) => string; create: (role: RoleString) => string; update: (role: RoleString) => string; delete: (role: RoleString) => string }, role: { any: () => RoleString; user: (userId: string, status?: string) => RoleString; users: (status?: string) => RoleString; guests: () => RoleString; team: (teamId: string, role?: string) => RoleString; member: (memberId: string) => RoleString; label: (label: string) => RoleString }) => string[]): string[] | undefined =>\n callback?.(permissionBuilder, roleBuilder);\n\nfunction createTableApi<T extends Models.Row>(\n tablesDB: TablesDB,\n databaseId: string,\n tableId: string,\n) {\n return {\n create: (data: any, options?: { rowId?: string; permissions?: (permission: { read: (role: RoleString) => string; write: (role: RoleString) => string; create: (role: RoleString) => string; update: (role: RoleString) => string; delete: (role: RoleString) => string }, role: { any: () => RoleString; user: (userId: string, status?: string) => RoleString; users: (status?: string) => RoleString; guests: () => RoleString; team: (teamId: string, role?: string) => RoleString; member: (memberId: string) => RoleString; label: (label: string) => RoleString }) => string[]; transactionId?: string }) =>\n tablesDB.createRow<T>({\n databaseId,\n tableId,\n rowId: options?.rowId ?? ID.unique(),\n data,\n permissions: resolvePermissions(options?.permissions),\n transactionId: options?.transactionId,\n }),\n get: (id: string) =>\n tablesDB.getRow<T>({\n databaseId,\n tableId,\n rowId: id,\n }),\n update: (id: string, data: any, options?: { permissions?: (permission: { read: (role: RoleString) => string; write: (role: RoleString) => string; create: (role: RoleString) => string; update: (role: RoleString) => string; delete: (role: RoleString) => string }, role: { any: () => RoleString; user: (userId: string, status?: string) => RoleString; users: (status?: string) => RoleString; guests: () => RoleString; team: (teamId: string, role?: string) => RoleString; member: (memberId: string) => RoleString; label: (label: string) => RoleString }) => string[]; transactionId?: string }) =>\n tablesDB.updateRow<T>({\n databaseId,\n tableId,\n rowId: id,\n data,\n ...(options?.permissions ? { permissions: resolvePermissions(options.permissions) } : {}),\n transactionId: options?.transactionId,\n }),\n delete: async (id: string, options?: { transactionId?: string }) => {\n await tablesDB.deleteRow({\n databaseId,\n tableId,\n rowId: id,\n transactionId: options?.transactionId,\n });\n },\n list: (options?: { queries?: (q: any) => string[] }) =>\n tablesDB.listRows<T>({\n databaseId,\n tableId,\n queries: options?.queries?.(createQueryBuilder<T>()),\n }),{{{BULK_METHODS}}}\n };\n}\n\n{{{BULK_CHECK}}}\nconst hasOwn = (obj: unknown, key: string): boolean =>\n obj != null && Object.prototype.hasOwnProperty.call(obj, key);\n\nfunction createDatabaseHandle<D extends DatabaseId>(\n tablesDB: TablesDB,\n databaseId: D,\n): DatabaseHandle<D> {\n const tableApiCache = new Map<string, unknown>();\n const dbMap = tableIdMap[databaseId];\n\n return {\n use: <T extends keyof DatabaseTableMap[D] & string>(tableId: T): DatabaseTableMap[D][T] => {\n if (!hasOwn(dbMap, tableId)) {\n throw new Error(`Unknown table "${tableId}" in database "${databaseId}"`);\n }\n\n if (!tableApiCache.has(tableId)) {\n const resolvedTableId = dbMap[tableId];\n const api = createTableApi(tablesDB, databaseId, resolvedTableId);\n {{{BULK_REMOVAL}}}\n tableApiCache.set(tableId, api);\n }\n return tableApiCache.get(tableId) as DatabaseTableMap[D][T];\n },\n{{#if supportsServerSide}}\n create: (tableId: string, name: string, options?: { permissions?: (permission: { read: (role: RoleString) => string; write: (role: RoleString) => string; create: (role: RoleString) => string; update: (role: RoleString) => string; delete: (role: RoleString) => string }, role: { any: () => RoleString; user: (userId: string, status?: string) => RoleString; users: (status?: string) => RoleString; guests: () => RoleString; team: (teamId: string, role?: string) => RoleString; member: (memberId: string) => RoleString; label: (label: string) => RoleString }) => string[]; rowSecurity?: boolean; enabled?: boolean; columns?: any[]; indexes?: any[] }) =>\n tablesDB.createTable({\n databaseId,\n tableId,\n name,\n permissions: resolvePermissions(options?.permissions),\n rowSecurity: options?.rowSecurity,\n enabled: options?.enabled,\n columns: options?.columns,\n indexes: options?.indexes,\n }),\n update: (tableId: string, options?: { name?: string; permissions?: (permission: { read: (role: RoleString) => string; write: (role: RoleString) => string; create: (role: RoleString) => string; update: (role: RoleString) => string; delete: (role: RoleString) => string }, role: { any: () => RoleString; user: (userId: string, status?: string) => RoleString; users: (status?: string) => RoleString; guests: () => RoleString; team: (teamId: string, role?: string) => RoleString; member: (memberId: string) => RoleString; label: (label: string) => RoleString }) => string[]; rowSecurity?: boolean; enabled?: boolean }) => {\n if (!hasOwn(dbMap, tableId)) {\n throw new Error(`Unknown table "${tableId}" in database "${databaseId}"`);\n }\n const resolvedTableId = dbMap[tableId];\n return tablesDB.updateTable({\n databaseId,\n tableId: resolvedTableId,\n name: options?.name ?? tableId, // TODO: remove this fallback once fixed in other SDKs\n permissions: resolvePermissions(options?.permissions),\n rowSecurity: options?.rowSecurity,\n enabled: options?.enabled,\n });\n },\n delete: async (tableId: string) => {\n if (!hasOwn(dbMap, tableId)) {\n throw new Error(`Unknown table "${tableId}" in database "${databaseId}"`);\n }\n const resolvedTableId = dbMap[tableId];\n await tablesDB.deleteTable({\n databaseId,\n tableId: resolvedTableId,\n });\n },\n{{/if}}\n };\n}\n\nfunction createDatabasesApi(tablesDB: TablesDB): DatabaseTables {\n const dbCache = new Map<DatabaseId, ReturnType<typeof createDatabaseHandle>>();\n\n return {\n use: (databaseId: DatabaseId) => {\n if (!hasOwn(tableIdMap, databaseId)) {\n throw new Error(`Unknown database "${databaseId}"`);\n }\n\n if (!dbCache.has(databaseId)) {\n dbCache.set(databaseId, createDatabaseHandle(tablesDB, databaseId));\n }\n return dbCache.get(databaseId);\n },\n{{#if supportsServerSide}}\n create: (databaseId: string, name: string, options?: { enabled?: boolean }) =>\n tablesDB.create({\n databaseId,\n name,\n enabled: options?.enabled,\n }),\n update: (databaseId: DatabaseId, options?: { name?: string; enabled?: boolean }) => {\n return tablesDB.update({\n databaseId,\n name: options?.name ?? databaseId,\n enabled: options?.enabled,\n });\n },\n delete: async (databaseId: DatabaseId) => {\n await tablesDB.delete({\n databaseId,\n });\n },\n{{/if}}\n } as DatabaseTables;\n}\n\n// Initialize client\nconst client = new Client()\n .setEndpoint(ENDPOINT)\n .setProject(PROJECT_ID){{#if supportsServerSide}}\n .setKey(API_KEY){{/if}};\n\nconst tablesDB = new TablesDB(client);\n\nexport const databases: DatabaseTables = createDatabasesApi(tablesDB);\n';
141953
+ var databases_ts_default = 'import { Client, TablesDB, ID, Query, type Models, Permission, Role } from \'{{appwriteDep}}\';\nimport type { DatabaseHandle, DatabaseId, DatabaseTableMap, DatabaseTables, QueryBuilder, QueryValue, PermissionBuilder, RoleBuilder, RoleString } from \'./types{{importExt}}\';\n{{#if supportsServerSide}}\nimport { PROJECT_ID, ENDPOINT, API_KEY } from \'./constants{{importExt}}\';\n{{else}}\nimport { PROJECT_ID, ENDPOINT } from \'./constants{{importExt}}\';\n{{/if}}\n\nconst createQueryBuilder = <T>(): QueryBuilder<T> => ({\n equal: (field, value) => Query.equal(String(field), value as QueryValue),\n notEqual: (field, value) => Query.notEqual(String(field), value as QueryValue),\n lessThan: (field, value) => Query.lessThan(String(field), value as QueryValue),\n lessThanEqual: (field, value) => Query.lessThanEqual(String(field), value as QueryValue),\n greaterThan: (field, value) => Query.greaterThan(String(field), value as QueryValue),\n greaterThanEqual: (field, value) => Query.greaterThanEqual(String(field), value as QueryValue),\n contains: (field, value) => Query.contains(String(field), value as string | QueryValue[]),\n search: (field, value) => Query.search(String(field), value),\n isNull: (field) => Query.isNull(String(field)),\n isNotNull: (field) => Query.isNotNull(String(field)),\n startsWith: (field, value) => Query.startsWith(String(field), value),\n endsWith: (field, value) => Query.endsWith(String(field), value),\n between: (field, start, end) => Query.between(String(field), start as string | number, end as string | number),\n select: (fields) => Query.select(fields.map(String)),\n orderAsc: (field) => Query.orderAsc(String(field)),\n orderDesc: (field) => Query.orderDesc(String(field)),\n limit: (value) => Query.limit(value),\n offset: (value) => Query.offset(value),\n cursorAfter: (documentId) => Query.cursorAfter(documentId),\n cursorBefore: (documentId) => Query.cursorBefore(documentId),\n or: (...queries) => Query.or(queries),\n and: (...queries) => Query.and(queries),\n});\n\n{{{TABLE_ID_MAP}}}\n\n{{{TABLES_WITH_RELATIONSHIPS}}}\n\nconst roleBuilder: RoleBuilder = {\n any: () => Role.any() as RoleString,\n user: (userId, status?) => Role.user(userId, status) as RoleString,\n users: (status?) => Role.users(status) as RoleString,\n guests: () => Role.guests() as RoleString,\n team: (teamId, role?) => Role.team(teamId, role) as RoleString,\n member: (memberId) => Role.member(memberId) as RoleString,\n label: (label) => Role.label(label) as RoleString,\n};\n\nconst permissionBuilder: PermissionBuilder = {\n read: (role) => Permission.read(role),\n write: (role) => Permission.write(role),\n create: (role) => Permission.create(role),\n update: (role) => Permission.update(role),\n delete: (role) => Permission.delete(role),\n};\n\nconst resolvePermissions = (callback?: (permission: { read: (role: RoleString) => string; write: (role: RoleString) => string; create: (role: RoleString) => string; update: (role: RoleString) => string; delete: (role: RoleString) => string }, role: { any: () => RoleString; user: (userId: string, status?: string) => RoleString; users: (status?: string) => RoleString; guests: () => RoleString; team: (teamId: string, role?: string) => RoleString; member: (memberId: string) => RoleString; label: (label: string) => RoleString }) => string[]): string[] | undefined =>\n callback?.(permissionBuilder, roleBuilder);\n\nfunction createTableApi<T extends Models.Row>(\n tablesDB: TablesDB,\n databaseId: string,\n tableId: string,\n) {\n return {\n create: (data: Omit<T, keyof Models.Row>, options?: { rowId?: string; permissions?: (permission: { read: (role: RoleString) => string; write: (role: RoleString) => string; create: (role: RoleString) => string; update: (role: RoleString) => string; delete: (role: RoleString) => string }, role: { any: () => RoleString; user: (userId: string, status?: string) => RoleString; users: (status?: string) => RoleString; guests: () => RoleString; team: (teamId: string, role?: string) => RoleString; member: (memberId: string) => RoleString; label: (label: string) => RoleString }) => string[]; transactionId?: string }) =>\n tablesDB.createRow<T>({\n databaseId,\n tableId,\n rowId: options?.rowId ?? ID.unique(),\n data: data as T extends Models.DefaultRow ? Partial<Models.Row> & Record<string, unknown> : Partial<Models.Row> & Omit<T, keyof Models.Row>,\n permissions: resolvePermissions(options?.permissions),\n transactionId: options?.transactionId,\n }),\n get: (id: string) =>\n tablesDB.getRow<T>({\n databaseId,\n tableId,\n rowId: id,\n }),\n update: (id: string, data: Partial<Omit<T, keyof Models.Row>>, options?: { permissions?: (permission: { read: (role: RoleString) => string; write: (role: RoleString) => string; create: (role: RoleString) => string; update: (role: RoleString) => string; delete: (role: RoleString) => string }, role: { any: () => RoleString; user: (userId: string, status?: string) => RoleString; users: (status?: string) => RoleString; guests: () => RoleString; team: (teamId: string, role?: string) => RoleString; member: (memberId: string) => RoleString; label: (label: string) => RoleString }) => string[]; transactionId?: string }) =>\n tablesDB.updateRow<T>({\n databaseId,\n tableId,\n rowId: id,\n data: data as T extends Models.DefaultRow ? Partial<Models.Row> & Record<string, unknown> : Partial<Models.Row> & Partial<Omit<T, keyof Models.Row>>,\n ...(options?.permissions ? { permissions: resolvePermissions(options.permissions) } : {}),\n transactionId: options?.transactionId,\n }),\n delete: async (id: string, options?: { transactionId?: string }) => {\n await tablesDB.deleteRow({\n databaseId,\n tableId,\n rowId: id,\n transactionId: options?.transactionId,\n });\n },\n list: (options?: { queries?: (q: QueryBuilder<T>) => string[] }) =>\n tablesDB.listRows<T>({\n databaseId,\n tableId,\n queries: options?.queries?.(createQueryBuilder<T>()),\n }),{{{BULK_METHODS}}}\n };\n}\n\n{{{BULK_CHECK}}}\nconst hasOwn = (obj: unknown, key: string): boolean =>\n obj != null && Object.prototype.hasOwnProperty.call(obj, key);\n\nfunction createDatabaseHandle<D extends DatabaseId>(\n tablesDB: TablesDB,\n databaseId: D,\n): DatabaseHandle<D> {\n const tableApiCache = new Map<string, unknown>();\n const dbMap = tableIdMap[databaseId];\n\n return {\n use: <T extends keyof DatabaseTableMap[D] & string>(tableId: T): DatabaseTableMap[D][T] => {\n if (!hasOwn(dbMap, tableId)) {\n throw new Error(`Unknown table "${tableId}" in database "${databaseId}"`);\n }\n\n if (!tableApiCache.has(tableId)) {\n const resolvedTableId = dbMap[tableId];\n const api = createTableApi(tablesDB, databaseId, resolvedTableId);\n {{{BULK_REMOVAL}}}\n tableApiCache.set(tableId, api);\n }\n return tableApiCache.get(tableId) as DatabaseTableMap[D][T];\n },\n{{#if supportsServerSide}}\n create: (tableId: string, name: string, options?: { permissions?: (permission: { read: (role: RoleString) => string; write: (role: RoleString) => string; create: (role: RoleString) => string; update: (role: RoleString) => string; delete: (role: RoleString) => string }, role: { any: () => RoleString; user: (userId: string, status?: string) => RoleString; users: (status?: string) => RoleString; guests: () => RoleString; team: (teamId: string, role?: string) => RoleString; member: (memberId: string) => RoleString; label: (label: string) => RoleString }) => string[]; rowSecurity?: boolean; enabled?: boolean; columns?: object[]; indexes?: object[] }) =>\n tablesDB.createTable({\n databaseId,\n tableId,\n name,\n permissions: resolvePermissions(options?.permissions),\n rowSecurity: options?.rowSecurity,\n enabled: options?.enabled,\n columns: options?.columns,\n indexes: options?.indexes,\n }),\n update: (tableId: string, options?: { name?: string; permissions?: (permission: { read: (role: RoleString) => string; write: (role: RoleString) => string; create: (role: RoleString) => string; update: (role: RoleString) => string; delete: (role: RoleString) => string }, role: { any: () => RoleString; user: (userId: string, status?: string) => RoleString; users: (status?: string) => RoleString; guests: () => RoleString; team: (teamId: string, role?: string) => RoleString; member: (memberId: string) => RoleString; label: (label: string) => RoleString }) => string[]; rowSecurity?: boolean; enabled?: boolean }) => {\n if (!hasOwn(dbMap, tableId)) {\n throw new Error(`Unknown table "${tableId}" in database "${databaseId}"`);\n }\n const resolvedTableId = dbMap[tableId];\n return tablesDB.updateTable({\n databaseId,\n tableId: resolvedTableId,\n name: options?.name,\n permissions: resolvePermissions(options?.permissions),\n rowSecurity: options?.rowSecurity,\n enabled: options?.enabled,\n });\n },\n delete: async (tableId: string) => {\n if (!hasOwn(dbMap, tableId)) {\n throw new Error(`Unknown table "${tableId}" in database "${databaseId}"`);\n }\n const resolvedTableId = dbMap[tableId];\n await tablesDB.deleteTable({\n databaseId,\n tableId: resolvedTableId,\n });\n },\n{{/if}}\n };\n}\n\nfunction createDatabasesApi(tablesDB: TablesDB): DatabaseTables {\n const dbCache = new Map<DatabaseId, ReturnType<typeof createDatabaseHandle>>();\n\n return {\n use: (databaseId: DatabaseId) => {\n if (!hasOwn(tableIdMap, databaseId)) {\n throw new Error(`Unknown database "${databaseId}"`);\n }\n\n if (!dbCache.has(databaseId)) {\n dbCache.set(databaseId, createDatabaseHandle(tablesDB, databaseId));\n }\n return dbCache.get(databaseId);\n },\n{{#if supportsServerSide}}\n create: (databaseId: string, name: string, options?: { enabled?: boolean }) =>\n tablesDB.create({\n databaseId,\n name,\n enabled: options?.enabled,\n }),\n update: (databaseId: DatabaseId, options?: { name?: string; enabled?: boolean }) => {\n return tablesDB.update({\n databaseId,\n name: options?.name ?? databaseId,\n enabled: options?.enabled,\n });\n },\n delete: async (databaseId: DatabaseId) => {\n await tablesDB.delete({\n databaseId,\n });\n },\n{{/if}}\n } as DatabaseTables;\n}\n\n// Initialize client\nconst client = new Client()\n .setEndpoint(ENDPOINT)\n .setProject(PROJECT_ID){{#if supportsServerSide}}\n .setKey(API_KEY){{/if}};\n\nconst tablesDB = new TablesDB(client);\n\nexport const databases: DatabaseTables = createDatabasesApi(tablesDB);\n';
141435
141954
 
141436
141955
  // lib/commands/generators/typescript/templates/index.ts.hbs
141437
141956
  var index_ts_default = '/**\n * {{sdkTitle}} Generated SDK\n *\n * This file is auto-generated. Do not edit manually.\n * Re-run `{{executableName}} generate` to regenerate.\n */\n\nexport { databases } from "./databases{{importExt}}";\nexport * from "./types{{importExt}}";\n';
@@ -141598,7 +142117,7 @@ ${dbReturnTypes}
141598
142117
 
141599
142118
  export type DatabaseHandle<D extends DatabaseId> = {
141600
142119
  use: <T extends keyof DatabaseTableMap[D] & string>(tableId: T) => DatabaseTableMap[D][T];
141601
- ${supportsServerSide ? ` create: (tableId: string, name: string, options?: { permissions?: ${PERMISSION_CALLBACK_INLINE}; rowSecurity?: boolean; enabled?: boolean; columns?: any[]; indexes?: any[] }) => Promise<Models.Table>;
142120
+ ${supportsServerSide ? ` create: (tableId: string, name: string, options?: { permissions?: ${PERMISSION_CALLBACK_INLINE}; rowSecurity?: boolean; enabled?: boolean; columns?: object[]; indexes?: object[] }) => Promise<Models.Table>;
141602
142121
  update: <T extends keyof DatabaseTableMap[D] & string>(tableId: T, options?: { name?: string; permissions?: ${PERMISSION_CALLBACK_INLINE}; rowSecurity?: boolean; enabled?: boolean }) => Promise<Models.Table>;
141603
142122
  delete: <T extends keyof DatabaseTableMap[D] & string>(tableId: T) => Promise<void>;` : ""}
141604
142123
  };
@@ -141665,26 +142184,26 @@ ${supportsServerSide ? ` create: (databaseId: string, name: string, options?: {
141665
142184
  generateBulkMethods(supportsBulk) {
141666
142185
  if (!supportsBulk) return "";
141667
142186
  return `
141668
- createMany: (rows: any[], options?: { transactionId?: string }) =>
142187
+ createMany: (rows: object[], options?: { transactionId?: string }) =>
141669
142188
  tablesDB.createRows({
141670
142189
  databaseId,
141671
142190
  tableId,
141672
142191
  rows,
141673
142192
  transactionId: options?.transactionId,
141674
142193
  }),
141675
- updateMany: (data: any, options?: { queries?: (q: any) => string[]; transactionId?: string }) =>
142194
+ updateMany: (data: object, options?: { queries?: (q: QueryBuilder<T>) => string[]; transactionId?: string }) =>
141676
142195
  tablesDB.updateRows({
141677
142196
  databaseId,
141678
142197
  tableId,
141679
142198
  data,
141680
- queries: options?.queries?.(createQueryBuilder()),
142199
+ queries: options?.queries?.(createQueryBuilder<T>()),
141681
142200
  transactionId: options?.transactionId,
141682
142201
  }),
141683
- deleteMany: (options?: { queries?: (q: any) => string[]; transactionId?: string }) =>
142202
+ deleteMany: (options?: { queries?: (q: QueryBuilder<T>) => string[]; transactionId?: string }) =>
141684
142203
  tablesDB.deleteRows({
141685
142204
  databaseId,
141686
142205
  tableId,
141687
- queries: options?.queries?.(createQueryBuilder()),
142206
+ queries: options?.queries?.(createQueryBuilder<T>()),
141688
142207
  transactionId: options?.transactionId,
141689
142208
  }),`;
141690
142209
  }
@@ -141698,9 +142217,9 @@ ${supportsServerSide ? ` create: (databaseId: string, name: string, options?: {
141698
142217
  return `
141699
142218
  // Remove bulk methods for tables with relationships
141700
142219
  if (!hasBulkMethods(databaseId, tableId)) {
141701
- delete (api as any).createMany;
141702
- delete (api as any).updateMany;
141703
- delete (api as any).deleteMany;
142220
+ delete (api as Record<string, unknown>).createMany;
142221
+ delete (api as Record<string, unknown>).updateMany;
142222
+ delete (api as Record<string, unknown>).deleteMany;
141704
142223
  }`;
141705
142224
  }
141706
142225
  generateDatabasesFile(config2, importExt) {
@@ -141847,8 +142366,9 @@ var generateAction = async (options) => {
141847
142366
  }
141848
142367
  } catch (err) {
141849
142368
  const supported = getSupportedLanguages().join(", ");
142369
+ const message = err instanceof Error ? err.message : String(err);
141850
142370
  error48(
141851
- `${err.message}
142371
+ `${message}
141852
142372
  Use --language to specify the target language. Supported: ${supported}`
141853
142373
  );
141854
142374
  process.exit(1);
@@ -141903,7 +142423,8 @@ Use --language to specify the target language. Supported: ${supported}`
141903
142423
  );
141904
142424
  }
141905
142425
  } catch (err) {
141906
- error48(`Failed to generate SDK: ${err.message}`);
142426
+ const message = err instanceof Error ? err.message : String(err);
142427
+ error48(`Failed to generate SDK: ${message}`);
141907
142428
  process.exit(1);
141908
142429
  }
141909
142430
  };
@@ -141962,6 +142483,36 @@ account.command(`delete`).description(`Delete the currently logged in user.`).ac
141962
142483
  async () => parse3(await (await getAccountClient()).delete())
141963
142484
  )
141964
142485
  );
142486
+ account.command(`list-billing-addresses`).description(`List all billing addresses for a user.`).option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, expired, failed`).action(
142487
+ actionRunner(
142488
+ async ({ queries }) => parse3(await (await getAccountClient()).listBillingAddresses(queries))
142489
+ )
142490
+ );
142491
+ account.command(`create-billing-address`).description(`Add a new billing address to a user's account.`).requiredOption(`--country <country>`, `Country`).requiredOption(`--city <city>`, `City`).requiredOption(`--street-address <street-address>`, `Street address`).option(`--address-line-2 <address-line-2>`, `Address line 2`).option(`--state <state>`, `State or province`).option(`--postal-code <postal-code>`, `Postal code`).action(
142492
+ actionRunner(
142493
+ async ({ country, city, streetAddress, addressLine2, state, postalCode }) => parse3(await (await getAccountClient()).createBillingAddress(country, city, streetAddress, addressLine2, state, postalCode))
142494
+ )
142495
+ );
142496
+ account.command(`get-billing-address`).description(`Get a specific billing address for a user using it's ID.`).requiredOption(`--billing-address-id <billing-address-id>`, `Unique ID of billing address`).action(
142497
+ actionRunner(
142498
+ async ({ billingAddressId }) => parse3(await (await getAccountClient()).getBillingAddress(billingAddressId))
142499
+ )
142500
+ );
142501
+ account.command(`update-billing-address`).description(`Update a specific billing address using it's ID.`).requiredOption(`--billing-address-id <billing-address-id>`, `Unique ID of billing address`).requiredOption(`--country <country>`, `Country`).requiredOption(`--city <city>`, `City`).requiredOption(`--street-address <street-address>`, `Street address`).option(`--address-line-2 <address-line-2>`, `Address line 2`).option(`--state <state>`, `State or province`).option(`--postal-code <postal-code>`, `Postal code`).action(
142502
+ actionRunner(
142503
+ async ({ billingAddressId, country, city, streetAddress, addressLine2, state, postalCode }) => parse3(await (await getAccountClient()).updateBillingAddress(billingAddressId, country, city, streetAddress, addressLine2, state, postalCode))
142504
+ )
142505
+ );
142506
+ account.command(`delete-billing-address`).description(`Delete a specific billing address using it's ID.`).requiredOption(`--billing-address-id <billing-address-id>`, `Billing address unique ID`).action(
142507
+ actionRunner(
142508
+ async ({ billingAddressId }) => parse3(await (await getAccountClient()).deleteBillingAddress(billingAddressId))
142509
+ )
142510
+ );
142511
+ account.command(`get-coupon`).description(`Get coupon details for an account.`).requiredOption(`--coupon-id <coupon-id>`, `ID of the coupon`).action(
142512
+ actionRunner(
142513
+ async ({ couponId }) => parse3(await (await getAccountClient()).getCoupon(couponId))
142514
+ )
142515
+ );
141965
142516
  account.command(`update-email`).description(`Update currently logged in user account email address. After changing user address, the user confirmation status will get reset. A new confirmation email is not sent automatically however you can use the send confirmation email endpoint again to send the confirmation email. For security measures, user password is required to complete this request.
141966
142517
  This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password.
141967
142518
  `).requiredOption(`--email <email>`, `User email.`).requiredOption(`--password <password>`, `User password. Must be at least 8 chars.`).action(
@@ -141983,11 +142534,45 @@ account.command(`delete-identity`).description(`Delete an identity by its unique
141983
142534
  async ({ identityId }) => parse3(await (await getAccountClient()).deleteIdentity(identityId))
141984
142535
  )
141985
142536
  );
142537
+ account.command(`list-invoices`).description(`List all invoices tied to an account.`).option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: teamId, aggregationId, amount, currency, from, to, dueAt, attempts, status, grossAmount`).action(
142538
+ actionRunner(
142539
+ async ({ queries }) => parse3(await (await getAccountClient()).listInvoices(queries))
142540
+ )
142541
+ );
141986
142542
  account.command(`create-jwt`).description(`Use this endpoint to create a JSON Web Token. You can use the resulting JWT to authenticate on behalf of the current user when working with the Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes from its creation and will be invalid if the user will logout in that time frame.`).option(`--duration <duration>`, `Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.`, parseInteger).action(
141987
142543
  actionRunner(
141988
142544
  async ({ duration: duration3 }) => parse3(await (await getAccountClient()).createJWT(duration3))
141989
142545
  )
141990
142546
  );
142547
+ account.command(`list-keys`).description(`Get a list of all API keys from the current account. `).option(
142548
+ `--total [value]`,
142549
+ `When set to false, the total count returned will be 0 and will not be calculated.`,
142550
+ (value) => value === void 0 ? true : parseBool(value)
142551
+ ).action(
142552
+ actionRunner(
142553
+ async ({ total }) => parse3(await (await getAccountClient()).listKeys(total))
142554
+ )
142555
+ );
142556
+ account.command(`create-key`).description(`Create a new account API key.`).requiredOption(`--name <name>`, `Key name. Max length: 128 chars.`).requiredOption(`--scopes [scopes...]`, `Key scopes list. Maximum of 100 scopes are allowed.`).option(`--expire <expire>`, `Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration.`).action(
142557
+ actionRunner(
142558
+ async ({ name, scopes, expire }) => parse3(await (await getAccountClient()).createKey(name, scopes, expire))
142559
+ )
142560
+ );
142561
+ account.command(`get-key`).description(`Get a key by its unique ID. This endpoint returns details about a specific API key in your account including it's scopes.`).requiredOption(`--key-id <key-id>`, `Key unique ID.`).action(
142562
+ actionRunner(
142563
+ async ({ keyId }) => parse3(await (await getAccountClient()).getKey(keyId))
142564
+ )
142565
+ );
142566
+ account.command(`update-key`).description(`Update a key by its unique ID. Use this endpoint to update the name, scopes, or expiration time of an API key.`).requiredOption(`--key-id <key-id>`, `Key unique ID.`).requiredOption(`--name <name>`, `Key name. Max length: 128 chars.`).requiredOption(`--scopes [scopes...]`, `Key scopes list. Maximum of 100 scopes are allowed.`).option(`--expire <expire>`, `Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration.`).action(
142567
+ actionRunner(
142568
+ async ({ keyId, name, scopes, expire }) => parse3(await (await getAccountClient()).updateKey(keyId, name, scopes, expire))
142569
+ )
142570
+ );
142571
+ account.command(`delete-key`).description(`Delete a key by its unique ID. Once deleted, the key can no longer be used to authenticate API calls.`).requiredOption(`--key-id <key-id>`, `Key unique ID.`).action(
142572
+ actionRunner(
142573
+ async ({ keyId }) => parse3(await (await getAccountClient()).deleteKey(keyId))
142574
+ )
142575
+ );
141991
142576
  account.command(`list-logs`).description(`Get the list of latest security activity logs for the currently logged in user. Each log returns user IP address, location and date and time of log.`).option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset`).option(
141992
142577
  `--total [value]`,
141993
142578
  `When set to false, the total count returned will be 0 and will not be calculated.`,
@@ -142057,6 +142642,41 @@ account.command(`update-password`).description(`Update currently logged in user
142057
142642
  async ({ password, oldPassword }) => parse3(await (await getAccountClient()).updatePassword(password, oldPassword))
142058
142643
  )
142059
142644
  );
142645
+ account.command(`list-payment-methods`).description(`List payment methods for this account.`).option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, expired, failed`).action(
142646
+ actionRunner(
142647
+ async ({ queries }) => parse3(await (await getAccountClient()).listPaymentMethods(queries))
142648
+ )
142649
+ );
142650
+ account.command(`create-payment-method`).description(`Create a new payment method for the current user account.`).action(
142651
+ actionRunner(
142652
+ async () => parse3(await (await getAccountClient()).createPaymentMethod())
142653
+ )
142654
+ );
142655
+ account.command(`get-payment-method`).description(`Get a specific payment method for the user.`).requiredOption(`--payment-method-id <payment-method-id>`, `Unique ID of payment method`).action(
142656
+ actionRunner(
142657
+ async ({ paymentMethodId }) => parse3(await (await getAccountClient()).getPaymentMethod(paymentMethodId))
142658
+ )
142659
+ );
142660
+ account.command(`update-payment-method`).description(`Update a new payment method for the current user account.`).requiredOption(`--payment-method-id <payment-method-id>`, `Unique ID of payment method`).requiredOption(`--expiry-month <expiry-month>`, `Payment expiry month`, parseInteger).requiredOption(`--expiry-year <expiry-year>`, `Expiry year`, parseInteger).option(`--state <state>`, `State of the payment method country`).action(
142661
+ actionRunner(
142662
+ async ({ paymentMethodId, expiryMonth, expiryYear, state }) => parse3(await (await getAccountClient()).updatePaymentMethod(paymentMethodId, expiryMonth, expiryYear, state))
142663
+ )
142664
+ );
142665
+ account.command(`delete-payment-method`).description(`Delete a specific payment method from a user's account.`).requiredOption(`--payment-method-id <payment-method-id>`, `Unique ID of payment method`).action(
142666
+ actionRunner(
142667
+ async ({ paymentMethodId }) => parse3(await (await getAccountClient()).deletePaymentMethod(paymentMethodId))
142668
+ )
142669
+ );
142670
+ account.command(`update-payment-method-provider`).description(`Update payment method provider.`).requiredOption(`--payment-method-id <payment-method-id>`, `Unique ID of payment method`).requiredOption(`--provider-method-id <provider-method-id>`, `Payment method ID from the payment provider`).requiredOption(`--name <name>`, `Name in the payment method`).option(`--state <state>`, `State of the payment method country`).action(
142671
+ actionRunner(
142672
+ async ({ paymentMethodId, providerMethodId, name, state }) => parse3(await (await getAccountClient()).updatePaymentMethodProvider(paymentMethodId, providerMethodId, name, state))
142673
+ )
142674
+ );
142675
+ account.command(`update-payment-method-mandate-options`).description(`Update payment method mandate options.`).requiredOption(`--payment-method-id <payment-method-id>`, `Unique ID of payment method`).action(
142676
+ actionRunner(
142677
+ async ({ paymentMethodId }) => parse3(await (await getAccountClient()).updatePaymentMethodMandateOptions(paymentMethodId))
142678
+ )
142679
+ );
142060
142680
  account.command(`update-phone`).description(`Update the currently logged in user's phone number. After updating the phone number, the phone verification status will be reset. A confirmation SMS is not sent automatically, however you can use the [POST /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) endpoint to send a confirmation SMS.`).requiredOption(`--phone <phone>`, `Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.`).requiredOption(`--password <password>`, `User password. Must be at least 8 chars.`).action(
142061
142681
  actionRunner(
142062
142682
  async ({ phone, password }) => parse3(await (await getAccountClient()).updatePhone(phone, password))
@@ -142118,8 +142738,8 @@ If there is already an active session, the new session will be attached to the l
142118
142738
  A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
142119
142739
  `).requiredOption(`--provider <provider>`, `OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom.`).option(`--success <success>`, `URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.`).option(`--failure <failure>`, `URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.`).option(`--scopes [scopes...]`, `A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.`).action(
142120
142740
  actionRunner(
142121
- async ({ provider, success: success19, failure, scopes }) => {
142122
- const url2 = (await getAccountClient()).createOAuth2Session(provider, success19, failure, scopes);
142741
+ async ({ provider, success: success20, failure, scopes }) => {
142742
+ const url2 = (await getAccountClient()).createOAuth2Session(provider, success20, failure, scopes);
142123
142743
  if (url2) console.log(url2);
142124
142744
  }
142125
142745
  )
@@ -142199,8 +142819,8 @@ If authentication succeeds, \`userId\` and \`secret\` of a token will be appende
142199
142819
 
142200
142820
  A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).`).requiredOption(`--provider <provider>`, `OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom.`).option(`--success <success>`, `URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.`).option(`--failure <failure>`, `URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.`).option(`--scopes [scopes...]`, `A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.`).action(
142201
142821
  actionRunner(
142202
- async ({ provider, success: success19, failure, scopes }) => {
142203
- const url2 = (await getAccountClient()).createOAuth2Token(provider, success19, failure, scopes);
142822
+ async ({ provider, success: success20, failure, scopes }) => {
142823
+ const url2 = (await getAccountClient()).createOAuth2Token(provider, success20, failure, scopes);
142204
142824
  if (url2) console.log(url2);
142205
142825
  }
142206
142826
  )
@@ -142249,26 +142869,108 @@ account.command(`update-phone-verification`).description(`Use this endpoint to c
142249
142869
  )
142250
142870
  );
142251
142871
 
142252
- // lib/commands/services/console.ts
142253
- var consoleClient = null;
142254
- var getConsoleClient = async () => {
142255
- if (!consoleClient) {
142872
+ // lib/commands/services/activities.ts
142873
+ var activitiesClient = null;
142874
+ var getActivitiesClient = async () => {
142875
+ if (!activitiesClient) {
142876
+ const sdkClient = await sdkForProject();
142877
+ activitiesClient = new Activities(sdkClient);
142878
+ }
142879
+ return activitiesClient;
142880
+ };
142881
+ var activities = new Command("activities").description(commandDescriptions["activities"] ?? "").configureHelp({
142882
+ helpWidth: process.stdout.columns || 80
142883
+ });
142884
+ activities.command(`list-events`).description(`List all events for selected filters.`).option(`--queries <queries>`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on attributes such as userId, teamId, etc.`).action(
142885
+ actionRunner(
142886
+ async ({ queries }) => parse3(await (await getActivitiesClient()).listEvents(queries))
142887
+ )
142888
+ );
142889
+ activities.command(`get-event`).description(`Get event by ID.
142890
+ `).requiredOption(`--event-id <event-id>`, `Event ID.`).action(
142891
+ actionRunner(
142892
+ async ({ eventId }) => parse3(await (await getActivitiesClient()).getEvent(eventId))
142893
+ )
142894
+ );
142895
+
142896
+ // lib/commands/services/backups.ts
142897
+ var backupsClient = null;
142898
+ var getBackupsClient = async () => {
142899
+ if (!backupsClient) {
142256
142900
  const sdkClient = await sdkForProject();
142257
- consoleClient = new Console(sdkClient);
142901
+ backupsClient = new Backups(sdkClient);
142258
142902
  }
142259
- return consoleClient;
142903
+ return backupsClient;
142260
142904
  };
142261
- var console2 = new Command("console").description(commandDescriptions["console"] ?? "").configureHelp({
142905
+ var backups = new Command("backups").description(commandDescriptions["backups"] ?? "").configureHelp({
142262
142906
  helpWidth: process.stdout.columns || 80
142263
142907
  });
142264
- console2.command(`get-resource`).description(`Check if a resource ID is available.`).requiredOption(`--value <value>`, `Resource value.`).requiredOption(`--type <type>`, `Resource type.`).action(
142908
+ backups.command(`list-archives`).description(`List all archives for a project.`).option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.`).action(
142909
+ actionRunner(
142910
+ async ({ queries }) => parse3(await (await getBackupsClient()).listArchives(queries))
142911
+ )
142912
+ );
142913
+ backups.command(`create-archive`).description(`Create a new archive asynchronously for a project.`).requiredOption(`--services [services...]`, `Array of services to backup`).option(`--resource-id <resource-id>`, `Resource ID. When set, only this single resource will be backed up.`).action(
142914
+ actionRunner(
142915
+ async ({ services, resourceId }) => parse3(await (await getBackupsClient()).createArchive(services, resourceId))
142916
+ )
142917
+ );
142918
+ backups.command(`get-archive`).description(`Get a backup archive using it's ID.`).requiredOption(`--archive-id <archive-id>`, `Archive ID. Choose a custom ID\`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`).action(
142919
+ actionRunner(
142920
+ async ({ archiveId }) => parse3(await (await getBackupsClient()).getArchive(archiveId))
142921
+ )
142922
+ );
142923
+ backups.command(`delete-archive`).description(`Delete an existing archive for a project.`).requiredOption(`--archive-id <archive-id>`, `Policy ID. Choose a custom ID or generate a random ID with \`ID.unique()\`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`).action(
142924
+ actionRunner(
142925
+ async ({ archiveId }) => parse3(await (await getBackupsClient()).deleteArchive(archiveId))
142926
+ )
142927
+ );
142928
+ backups.command(`list-policies`).description(`List all policies for a project.`).option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.`).action(
142929
+ actionRunner(
142930
+ async ({ queries }) => parse3(await (await getBackupsClient()).listPolicies(queries))
142931
+ )
142932
+ );
142933
+ backups.command(`create-policy`).description(`Create a new backup policy.`).requiredOption(`--policy-id <policy-id>`, `Policy ID. Choose a custom ID or generate a random ID with \`ID.unique()\`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`).requiredOption(`--services [services...]`, `Array of services to backup`).requiredOption(`--retention <retention>`, `Days to keep backups before deletion`, parseInteger).requiredOption(`--schedule <schedule>`, `Schedule CRON syntax.`).option(`--name <name>`, `Policy name. Max length: 128 chars.`).option(`--resource-id <resource-id>`, `Resource ID. When set, only this single resource will be backed up.`).option(
142934
+ `--enabled [value]`,
142935
+ `Is policy enabled? When set to 'disabled', no backups will be taken`,
142936
+ (value) => value === void 0 ? true : parseBool(value)
142937
+ ).action(
142938
+ actionRunner(
142939
+ async ({ policyId, services, retention, schedule, name, resourceId, enabled }) => parse3(await (await getBackupsClient()).createPolicy(policyId, services, retention, schedule, name, resourceId, enabled))
142940
+ )
142941
+ );
142942
+ backups.command(`get-policy`).description(`Get a backup policy using it's ID.`).requiredOption(`--policy-id <policy-id>`, `Policy ID. Choose a custom ID\`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`).action(
142943
+ actionRunner(
142944
+ async ({ policyId }) => parse3(await (await getBackupsClient()).getPolicy(policyId))
142945
+ )
142946
+ );
142947
+ backups.command(`update-policy`).description(`Update an existing policy using it's ID.`).requiredOption(`--policy-id <policy-id>`, `Policy ID. Choose a custom ID\`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`).option(`--name <name>`, `Policy name. Max length: 128 chars.`).option(`--retention <retention>`, `Days to keep backups before deletion`, parseInteger).option(`--schedule <schedule>`, `Cron expression`).option(
142948
+ `--enabled [value]`,
142949
+ `Is Backup enabled? When set to 'disabled', No backup will be taken`,
142950
+ (value) => value === void 0 ? true : parseBool(value)
142951
+ ).action(
142952
+ actionRunner(
142953
+ async ({ policyId, name, retention, schedule, enabled }) => parse3(await (await getBackupsClient()).updatePolicy(policyId, name, retention, schedule, enabled))
142954
+ )
142955
+ );
142956
+ backups.command(`delete-policy`).description(`Delete a policy using it's ID.`).requiredOption(`--policy-id <policy-id>`, `Policy ID. Choose a custom ID or generate a random ID with \`ID.unique()\`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`).action(
142265
142957
  actionRunner(
142266
- async ({ value, type }) => parse3(await (await getConsoleClient()).getResource(value, type))
142958
+ async ({ policyId }) => parse3(await (await getBackupsClient()).deletePolicy(policyId))
142267
142959
  )
142268
142960
  );
142269
- console2.command(`variables`).description(`Get all Environment Variables that are relevant for the console.`).action(
142961
+ backups.command(`create-restoration`).description(`Create and trigger a new restoration for a backup on a project.`).requiredOption(`--archive-id <archive-id>`, `Backup archive ID to restore`).requiredOption(`--services [services...]`, `Array of services to restore`).option(`--new-resource-id <new-resource-id>`, `Unique Id. Choose a custom ID or generate a random ID with \`ID.unique()\`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`).option(`--new-resource-name <new-resource-name>`, `Database name. Max length: 128 chars.`).action(
142270
142962
  actionRunner(
142271
- async () => parse3(await (await getConsoleClient()).variables())
142963
+ async ({ archiveId, services, newResourceId, newResourceName }) => parse3(await (await getBackupsClient()).createRestoration(archiveId, services, newResourceId, newResourceName))
142964
+ )
142965
+ );
142966
+ backups.command(`list-restorations`).description(`List all backup restorations for a project.`).option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.`).action(
142967
+ actionRunner(
142968
+ async ({ queries }) => parse3(await (await getBackupsClient()).listRestorations(queries))
142969
+ )
142970
+ );
142971
+ backups.command(`get-restoration`).description(`Get the current status of a backup restoration.`).requiredOption(`--restoration-id <restoration-id>`, `Restoration ID. Choose a custom ID\`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`).action(
142972
+ actionRunner(
142973
+ async ({ restorationId }) => parse3(await (await getBackupsClient()).getRestoration(restorationId))
142272
142974
  )
142273
142975
  );
142274
142976
 
@@ -143128,11 +143830,26 @@ health.command(`get-queue-audits`).description(`Get the number of audit logs tha
143128
143830
  async ({ threshold }) => parse3(await (await getHealthClient()).getQueueAudits(threshold))
143129
143831
  )
143130
143832
  );
143833
+ health.command(`get-queue-billing-project-aggregation`).description(`Get billing project aggregation queue.`).option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger).action(
143834
+ actionRunner(
143835
+ async ({ threshold }) => parse3(await (await getHealthClient()).getQueueBillingProjectAggregation(threshold))
143836
+ )
143837
+ );
143838
+ health.command(`get-queue-billing-team-aggregation`).description(`Get billing team aggregation queue.`).option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger).action(
143839
+ actionRunner(
143840
+ async ({ threshold }) => parse3(await (await getHealthClient()).getQueueBillingTeamAggregation(threshold))
143841
+ )
143842
+ );
143131
143843
  health.command(`get-queue-builds`).description(`Get the number of builds that are waiting to be processed in the Appwrite internal queue server.`).option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger).action(
143132
143844
  actionRunner(
143133
143845
  async ({ threshold }) => parse3(await (await getHealthClient()).getQueueBuilds(threshold))
143134
143846
  )
143135
143847
  );
143848
+ health.command(`get-queue-priority-builds`).description(`Get the priority builds queue size.`).option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 500.`, parseInteger).action(
143849
+ actionRunner(
143850
+ async ({ threshold }) => parse3(await (await getHealthClient()).getQueuePriorityBuilds(threshold))
143851
+ )
143852
+ );
143136
143853
  health.command(`get-queue-certificates`).description(`Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server.`).option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger).action(
143137
143854
  actionRunner(
143138
143855
  async ({ threshold }) => parse3(await (await getHealthClient()).getQueueCertificates(threshold))
@@ -143179,6 +143896,11 @@ health.command(`get-queue-migrations`).description(`Get the number of migrations
143179
143896
  async ({ threshold }) => parse3(await (await getHealthClient()).getQueueMigrations(threshold))
143180
143897
  )
143181
143898
  );
143899
+ health.command(`get-queue-region-manager`).description(`Get region manager queue.`).option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 100.`, parseInteger).action(
143900
+ actionRunner(
143901
+ async ({ threshold }) => parse3(await (await getHealthClient()).getQueueRegionManager(threshold))
143902
+ )
143903
+ );
143182
143904
  health.command(`get-queue-stats-resources`).description(`Get the number of metrics that are waiting to be processed in the Appwrite stats resources queue.`).option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger).action(
143183
143905
  actionRunner(
143184
143906
  async ({ threshold }) => parse3(await (await getHealthClient()).getQueueStatsResources(threshold))
@@ -143189,6 +143911,11 @@ health.command(`get-queue-usage`).description(`Get the number of metrics that ar
143189
143911
  async ({ threshold }) => parse3(await (await getHealthClient()).getQueueUsage(threshold))
143190
143912
  )
143191
143913
  );
143914
+ health.command(`get-queue-threats`).description(`Get threats queue.`).option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 100.`, parseInteger).action(
143915
+ actionRunner(
143916
+ async ({ threshold }) => parse3(await (await getHealthClient()).getQueueThreats(threshold))
143917
+ )
143918
+ );
143192
143919
  health.command(`get-queue-webhooks`).description(`Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server.`).option(`--threshold <threshold>`, `Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.`, parseInteger).action(
143193
143920
  actionRunner(
143194
143921
  async ({ threshold }) => parse3(await (await getHealthClient()).getQueueWebhooks(threshold))
@@ -144089,7 +144816,7 @@ projects.command(`list-schedules`).description(`Get a list of all the project's
144089
144816
  async ({ projectId, queries, total }) => parse3(await (await getProjectsClient()).listSchedules(projectId, queries, total))
144090
144817
  )
144091
144818
  );
144092
- projects.command(`create-schedule`).description(`Create a new schedule for a resource.`).requiredOption(`--project-id <project-id>`, `Project unique ID.`).requiredOption(`--resource-type <resource-type>`, `The resource type for the schedule. Possible values: function, execution, message.`).requiredOption(`--resource-id <resource-id>`, `The resource ID to associate with this schedule.`).requiredOption(`--schedule <schedule>`, `Schedule CRON expression.`).option(
144819
+ projects.command(`create-schedule`).description(`Create a new schedule for a resource.`).requiredOption(`--project-id <project-id>`, `Project unique ID.`).requiredOption(`--resource-type <resource-type>`, `The resource type for the schedule. Possible values: function, execution, message, backup.`).requiredOption(`--resource-id <resource-id>`, `The resource ID to associate with this schedule.`).requiredOption(`--schedule <schedule>`, `Schedule CRON expression.`).option(
144093
144820
  `--active [value]`,
144094
144821
  `Whether the schedule is active.`,
144095
144822
  (value) => value === void 0 ? true : parseBool(value)
@@ -144509,7 +145236,7 @@ storage.command(`create-bucket`).description(`Create a new storage bucket.`).req
144509
145236
  `--enabled [value]`,
144510
145237
  `Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.`,
144511
145238
  (value) => value === void 0 ? true : parseBool(value)
144512
- ).option(`--maximum-file-size <maximum-file-size>`, `Maximum file size allowed in bytes. Maximum allowed value is 30MB.`, parseInteger).option(`--allowed-file-extensions [allowed-file-extensions...]`, `Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.`).option(`--compression <compression>`, `Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled`).option(
145239
+ ).option(`--maximum-file-size <maximum-file-size>`, `Maximum file size allowed in bytes. Maximum allowed value is 5GB.`, parseInteger).option(`--allowed-file-extensions [allowed-file-extensions...]`, `Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.`).option(`--compression <compression>`, `Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled`).option(
144513
145240
  `--encryption [value]`,
144514
145241
  `Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled`,
144515
145242
  (value) => value === void 0 ? true : parseBool(value)
@@ -144539,7 +145266,7 @@ storage.command(`update-bucket`).description(`Update a storage bucket by its uni
144539
145266
  `--enabled [value]`,
144540
145267
  `Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.`,
144541
145268
  (value) => value === void 0 ? true : parseBool(value)
144542
- ).option(`--maximum-file-size <maximum-file-size>`, `Maximum file size allowed in bytes. Maximum allowed value is 30MB.`, parseInteger).option(`--allowed-file-extensions [allowed-file-extensions...]`, `Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.`).option(`--compression <compression>`, `Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled`).option(
145269
+ ).option(`--maximum-file-size <maximum-file-size>`, `Maximum file size allowed in bytes. Maximum allowed value is 5GB.`, parseInteger).option(`--allowed-file-extensions [allowed-file-extensions...]`, `Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.`).option(`--compression <compression>`, `Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled`).option(
144543
145270
  `--encryption [value]`,
144544
145271
  `Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled`,
144545
145272
  (value) => value === void 0 ? true : parseBool(value)
@@ -145685,12 +146412,12 @@ async function checkVersion() {
145685
146412
  } else {
145686
146413
  process.stdout.write(import_chalk13.default.blue("\n\u{1F680} You are running a pre-release or development version.") + "\n");
145687
146414
  }
145688
- } catch (error49) {
146415
+ } catch (_error) {
145689
146416
  process.stdout.write(import_chalk13.default.gray("\n(Unable to check for updates)") + "\n");
145690
146417
  }
145691
146418
  }
145692
146419
  if (process.argv.includes("-v") || process.argv.includes("--version")) {
145693
- (async () => {
146420
+ void (async () => {
145694
146421
  await checkVersion();
145695
146422
  process.exit(0);
145696
146423
  })();
@@ -145711,11 +146438,14 @@ if (process.argv.includes("-v") || process.argv.includes("--version")) {
145711
146438
  cliConfig.all = true;
145712
146439
  }).on("option:id", function() {
145713
146440
  cliConfig.ids = this.opts().id;
145714
- }).showSuggestionAfterError().addCommand(whoami).addCommand(register).addCommand(login).addCommand(init).addCommand(pull).addCommand(push).addCommand(types).addCommand(deploy).addCommand(run).addCommand(update).addCommand(generate).addCommand(logout).addCommand(account).addCommand(console2).addCommand(databases).addCommand(functions).addCommand(graphql).addCommand(health).addCommand(locale).addCommand(messaging).addCommand(migrations).addCommand(project).addCommand(projects).addCommand(proxy).addCommand(sites).addCommand(storage).addCommand(tablesDB).addCommand(teams).addCommand(tokens).addCommand(users).addCommand(vcs).addCommand(client).parse(process.argv);
146441
+ }).showSuggestionAfterError().addCommand(whoami).addCommand(register).addCommand(login).addCommand(init).addCommand(pull).addCommand(push).addCommand(types).addCommand(deploy).addCommand(run).addCommand(update).addCommand(generate).addCommand(logout).addCommand(account).addCommand(activities).addCommand(backups).addCommand(databases).addCommand(functions).addCommand(graphql).addCommand(health).addCommand(locale).addCommand(messaging).addCommand(migrations).addCommand(project).addCommand(projects).addCommand(proxy).addCommand(sites).addCommand(storage).addCommand(tablesDB).addCommand(teams).addCommand(tokens).addCommand(users).addCommand(vcs).addCommand(client).parse(process.argv);
145715
146442
  process.stdout.columns = oldWidth;
145716
146443
  }
145717
146444
  /*! Bundled license information:
145718
146445
 
146446
+ safe-buffer/index.js:
146447
+ (*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
146448
+
145719
146449
  undici/lib/fetch/body.js:
145720
146450
  (*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> *)
145721
146451