appwrite-cli 17.0.0 → 17.2.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 (98) hide show
  1. package/.github/workflows/ci.yml +1 -1
  2. package/.github/workflows/publish.yml +1 -1
  3. package/CHANGELOG.md +20 -0
  4. package/README.md +2 -2
  5. package/bun.lock +783 -0
  6. package/cli.ts +19 -1
  7. package/dist/bundle-win-arm64.mjs +1515 -744
  8. package/dist/cli.cjs +1515 -744
  9. package/dist/index.cjs +322 -118
  10. package/dist/index.js +322 -118
  11. package/dist/lib/client.d.ts +9 -0
  12. package/dist/lib/client.d.ts.map +1 -1
  13. package/dist/lib/commands/init.d.ts.map +1 -1
  14. package/dist/lib/commands/services/organizations.d.ts +3 -0
  15. package/dist/lib/commands/services/organizations.d.ts.map +1 -0
  16. package/dist/lib/commands/services/teams.d.ts.map +1 -1
  17. package/dist/lib/constants.d.ts +1 -1
  18. package/dist/lib/emulation/docker.d.ts.map +1 -1
  19. package/dist/lib/emulation/utils.d.ts.map +1 -1
  20. package/dist/lib/parser.d.ts.map +1 -1
  21. package/dist/lib/questions.d.ts.map +1 -1
  22. package/dist/lib/types.d.ts +3 -0
  23. package/dist/lib/types.d.ts.map +1 -1
  24. package/dist/lib/utils.d.ts +12 -0
  25. package/dist/lib/utils.d.ts.map +1 -1
  26. package/docs/examples/organizations/add-credit.md +5 -0
  27. package/docs/examples/organizations/cancel-downgrade.md +4 -0
  28. package/docs/examples/organizations/create-downgrade-feedback.md +8 -0
  29. package/docs/examples/organizations/create-invoice-payment.md +6 -0
  30. package/docs/examples/organizations/create-key.md +6 -0
  31. package/docs/examples/organizations/create.md +6 -0
  32. package/docs/examples/organizations/delete-backup-payment-method.md +4 -0
  33. package/docs/examples/organizations/delete-default-payment-method.md +4 -0
  34. package/docs/examples/organizations/delete-key.md +5 -0
  35. package/docs/examples/organizations/delete.md +4 -0
  36. package/docs/examples/organizations/estimation-create-organization.md +4 -0
  37. package/docs/examples/organizations/estimation-delete-organization.md +4 -0
  38. package/docs/examples/organizations/estimation-update-plan.md +5 -0
  39. package/docs/examples/organizations/get-aggregation.md +5 -0
  40. package/docs/examples/organizations/get-available-credits.md +4 -0
  41. package/docs/examples/organizations/get-credit.md +5 -0
  42. package/docs/examples/organizations/get-invoice-download.md +5 -0
  43. package/docs/examples/organizations/get-invoice-view.md +5 -0
  44. package/docs/examples/organizations/get-invoice.md +5 -0
  45. package/docs/examples/organizations/get-key.md +5 -0
  46. package/docs/examples/organizations/get-plan.md +4 -0
  47. package/docs/examples/organizations/get-scopes.md +4 -0
  48. package/docs/examples/organizations/get-usage.md +4 -0
  49. package/docs/examples/organizations/list-aggregations.md +4 -0
  50. package/docs/examples/organizations/list-credits.md +4 -0
  51. package/docs/examples/organizations/list-keys.md +4 -0
  52. package/docs/examples/organizations/list-regions.md +4 -0
  53. package/docs/examples/organizations/list.md +3 -0
  54. package/docs/examples/organizations/set-backup-payment-method.md +5 -0
  55. package/docs/examples/organizations/set-billing-address.md +5 -0
  56. package/docs/examples/organizations/set-billing-email.md +5 -0
  57. package/docs/examples/organizations/set-billing-tax-id.md +5 -0
  58. package/docs/examples/organizations/set-default-payment-method.md +5 -0
  59. package/docs/examples/organizations/update-budget.md +5 -0
  60. package/docs/examples/organizations/update-key.md +7 -0
  61. package/docs/examples/organizations/update-plan.md +5 -0
  62. package/docs/examples/organizations/validate-invoice.md +5 -0
  63. package/docs/examples/organizations/validate-payment.md +4 -0
  64. package/install.ps1 +2 -2
  65. package/install.sh +1 -1
  66. package/lib/client.ts +12 -0
  67. package/lib/commands/init.ts +109 -2
  68. package/lib/commands/services/account.ts +110 -55
  69. package/lib/commands/services/activities.ts +4 -2
  70. package/lib/commands/services/backups.ts +24 -12
  71. package/lib/commands/services/databases.ts +150 -75
  72. package/lib/commands/services/functions.ts +60 -30
  73. package/lib/commands/services/graphql.ts +4 -2
  74. package/lib/commands/services/health.ts +46 -23
  75. package/lib/commands/services/locale.ts +16 -8
  76. package/lib/commands/services/messaging.ts +96 -48
  77. package/lib/commands/services/migrations.ts +30 -16
  78. package/lib/commands/services/organizations.ts +555 -0
  79. package/lib/commands/services/project.ts +12 -6
  80. package/lib/commands/services/projects.ts +105 -53
  81. package/lib/commands/services/proxy.ts +18 -10
  82. package/lib/commands/services/sites.ts +58 -29
  83. package/lib/commands/services/storage.ts +30 -15
  84. package/lib/commands/services/tables-db.ts +148 -74
  85. package/lib/commands/services/teams.ts +38 -15
  86. package/lib/commands/services/tokens.ts +10 -5
  87. package/lib/commands/services/users.ts +88 -44
  88. package/lib/commands/services/vcs.ts +22 -12
  89. package/lib/commands/services/webhooks.ts +12 -6
  90. package/lib/constants.ts +1 -1
  91. package/lib/emulation/docker.ts +1 -0
  92. package/lib/emulation/utils.ts +3 -2
  93. package/lib/parser.ts +356 -77
  94. package/lib/questions.ts +8 -3
  95. package/lib/types.ts +3 -0
  96. package/lib/utils.ts +234 -0
  97. package/package.json +1 -1
  98. package/scoop/appwrite.config.json +3 -3
package/dist/index.js CHANGED
@@ -19586,9 +19586,9 @@ var require_stream_duplex = __commonJS({
19586
19586
  }
19587
19587
  });
19588
19588
 
19589
- // node_modules/string_decoder/node_modules/safe-buffer/index.js
19589
+ // node_modules/safe-buffer/index.js
19590
19590
  var require_safe_buffer = __commonJS({
19591
- "node_modules/string_decoder/node_modules/safe-buffer/index.js"(exports, module) {
19591
+ "node_modules/safe-buffer/index.js"(exports, module) {
19592
19592
  var buffer = __require("buffer");
19593
19593
  var Buffer2 = buffer.Buffer;
19594
19594
  function copyProps(src, dst) {
@@ -57287,7 +57287,7 @@ var require_helpers = __commonJS({
57287
57287
  if (instance.helpers[helperName]) {
57288
57288
  instance.hooks[helperName] = instance.helpers[helperName];
57289
57289
  if (!keepHelper) {
57290
- delete instance.helpers[helperName];
57290
+ instance.helpers[helperName] = void 0;
57291
57291
  }
57292
57292
  }
57293
57293
  }
@@ -57379,22 +57379,6 @@ var require_logger = __commonJS({
57379
57379
  }
57380
57380
  });
57381
57381
 
57382
- // node_modules/handlebars/dist/cjs/handlebars/internal/create-new-lookup-object.js
57383
- var require_create_new_lookup_object = __commonJS({
57384
- "node_modules/handlebars/dist/cjs/handlebars/internal/create-new-lookup-object.js"(exports) {
57385
- "use strict";
57386
- exports.__esModule = true;
57387
- exports.createNewLookupObject = createNewLookupObject;
57388
- var _utils = require_utils5();
57389
- function createNewLookupObject() {
57390
- for (var _len = arguments.length, sources = Array(_len), _key = 0; _key < _len; _key++) {
57391
- sources[_key] = arguments[_key];
57392
- }
57393
- return _utils.extend.apply(void 0, [/* @__PURE__ */ Object.create(null)].concat(sources));
57394
- }
57395
- }
57396
- });
57397
-
57398
57382
  // node_modules/handlebars/dist/cjs/handlebars/internal/proto-access.js
57399
57383
  var require_proto_access = __commonJS({
57400
57384
  "node_modules/handlebars/dist/cjs/handlebars/internal/proto-access.js"(exports) {
@@ -57406,25 +57390,28 @@ var require_proto_access = __commonJS({
57406
57390
  function _interopRequireDefault(obj) {
57407
57391
  return obj && obj.__esModule ? obj : { "default": obj };
57408
57392
  }
57409
- var _createNewLookupObject = require_create_new_lookup_object();
57393
+ var _utils = require_utils5();
57410
57394
  var _logger = require_logger();
57411
57395
  var _logger2 = _interopRequireDefault(_logger);
57412
57396
  var loggedProperties = /* @__PURE__ */ Object.create(null);
57413
57397
  function createProtoAccessControl(runtimeOptions) {
57414
- var defaultMethodWhiteList = /* @__PURE__ */ Object.create(null);
57415
- defaultMethodWhiteList["constructor"] = false;
57416
- defaultMethodWhiteList["__defineGetter__"] = false;
57417
- defaultMethodWhiteList["__defineSetter__"] = false;
57418
- defaultMethodWhiteList["__lookupGetter__"] = false;
57419
- var defaultPropertyWhiteList = /* @__PURE__ */ Object.create(null);
57420
- defaultPropertyWhiteList["__proto__"] = false;
57398
+ var propertyWhiteList = /* @__PURE__ */ Object.create(null);
57399
+ propertyWhiteList["__proto__"] = false;
57400
+ _utils.extend(propertyWhiteList, runtimeOptions.allowedProtoProperties);
57401
+ var methodWhiteList = /* @__PURE__ */ Object.create(null);
57402
+ methodWhiteList["constructor"] = false;
57403
+ methodWhiteList["__defineGetter__"] = false;
57404
+ methodWhiteList["__defineSetter__"] = false;
57405
+ methodWhiteList["__lookupGetter__"] = false;
57406
+ methodWhiteList["__lookupSetter__"] = false;
57407
+ _utils.extend(methodWhiteList, runtimeOptions.allowedProtoMethods);
57421
57408
  return {
57422
57409
  properties: {
57423
- whitelist: _createNewLookupObject.createNewLookupObject(defaultPropertyWhiteList, runtimeOptions.allowedProtoProperties),
57410
+ whitelist: propertyWhiteList,
57424
57411
  defaultValue: runtimeOptions.allowProtoPropertiesByDefault
57425
57412
  },
57426
57413
  methods: {
57427
- whitelist: _createNewLookupObject.createNewLookupObject(defaultMethodWhiteList, runtimeOptions.allowedProtoMethods),
57414
+ whitelist: methodWhiteList,
57428
57415
  defaultValue: runtimeOptions.allowProtoMethodsByDefault
57429
57416
  }
57430
57417
  };
@@ -57477,7 +57464,7 @@ var require_base2 = __commonJS({
57477
57464
  var _logger = require_logger();
57478
57465
  var _logger2 = _interopRequireDefault(_logger);
57479
57466
  var _internalProtoAccess = require_proto_access();
57480
- var VERSION = "4.7.8";
57467
+ var VERSION = "4.7.9";
57481
57468
  exports.VERSION = VERSION;
57482
57469
  var COMPILER_REVISION = 8;
57483
57470
  exports.COMPILER_REVISION = COMPILER_REVISION;
@@ -57663,14 +57650,12 @@ var require_runtime = __commonJS({
57663
57650
  }
57664
57651
  }
57665
57652
  partial2 = env.VM.resolvePartial.call(this, partial2, context, options);
57666
- var extendedOptions = Utils.extend({}, options, {
57667
- hooks: this.hooks,
57668
- protoAccessControl: this.protoAccessControl
57669
- });
57670
- var result = env.VM.invokePartial.call(this, partial2, context, extendedOptions);
57653
+ options.hooks = this.hooks;
57654
+ options.protoAccessControl = this.protoAccessControl;
57655
+ var result = env.VM.invokePartial.call(this, partial2, context, options);
57671
57656
  if (result == null && env.compile) {
57672
57657
  options.partials[options.name] = env.compile(partial2, templateSpec.compilerOptions, env);
57673
- result = options.partials[options.name](context, extendedOptions);
57658
+ result = options.partials[options.name](context, options);
57674
57659
  }
57675
57660
  if (result != null) {
57676
57661
  if (options.indent) {
@@ -57715,7 +57700,7 @@ var require_runtime = __commonJS({
57715
57700
  for (var i = 0; i < len; i++) {
57716
57701
  var result = depths[i] && container.lookupProperty(depths[i], name);
57717
57702
  if (result != null) {
57718
- return depths[i][name];
57703
+ return result;
57719
57704
  }
57720
57705
  }
57721
57706
  },
@@ -57781,8 +57766,9 @@ var require_runtime = __commonJS({
57781
57766
  ret.isTop = true;
57782
57767
  ret._setup = function(options) {
57783
57768
  if (!options.partial) {
57784
- var mergedHelpers = Utils.extend({}, env.helpers, options.helpers);
57785
- wrapHelpersToPassLookupProperty(mergedHelpers, container);
57769
+ var mergedHelpers = {};
57770
+ addHelpers(mergedHelpers, env.helpers, container);
57771
+ addHelpers(mergedHelpers, options.helpers, container);
57786
57772
  container.helpers = mergedHelpers;
57787
57773
  if (templateSpec.usePartial) {
57788
57774
  container.partials = container.mergeIfNeeded(options.partials, env.partials);
@@ -57832,18 +57818,18 @@ var require_runtime = __commonJS({
57832
57818
  function resolvePartial(partial2, context, options) {
57833
57819
  if (!partial2) {
57834
57820
  if (options.name === "@partial-block") {
57835
- partial2 = options.data["partial-block"];
57821
+ partial2 = lookupOwnProperty(options.data, "partial-block");
57836
57822
  } else {
57837
- partial2 = options.partials[options.name];
57823
+ partial2 = lookupOwnProperty(options.partials, options.name);
57838
57824
  }
57839
57825
  } else if (!partial2.call && !options.name) {
57840
57826
  options.name = partial2;
57841
- partial2 = options.partials[partial2];
57827
+ partial2 = lookupOwnProperty(options.partials, partial2);
57842
57828
  }
57843
57829
  return partial2;
57844
57830
  }
57845
57831
  function invokePartial(partial2, context, options) {
57846
- var currentPartialBlock = options.data && options.data["partial-block"];
57832
+ var currentPartialBlock = lookupOwnProperty(options.data, "partial-block");
57847
57833
  options.partial = true;
57848
57834
  if (options.ids) {
57849
57835
  options.data.contextPath = options.ids[0] || options.data.contextPath;
@@ -57876,6 +57862,11 @@ var require_runtime = __commonJS({
57876
57862
  function noop() {
57877
57863
  return "";
57878
57864
  }
57865
+ function lookupOwnProperty(obj, name) {
57866
+ if (obj && Object.prototype.hasOwnProperty.call(obj, name)) {
57867
+ return obj[name];
57868
+ }
57869
+ }
57879
57870
  function initData(context, data) {
57880
57871
  if (!data || !("root" in data)) {
57881
57872
  data = data ? _base.createFrame(data) : {};
@@ -57891,16 +57882,18 @@ var require_runtime = __commonJS({
57891
57882
  }
57892
57883
  return prog;
57893
57884
  }
57894
- function wrapHelpersToPassLookupProperty(mergedHelpers, container) {
57895
- Object.keys(mergedHelpers).forEach(function(helperName) {
57896
- var helper = mergedHelpers[helperName];
57885
+ function addHelpers(mergedHelpers, helpers, container) {
57886
+ if (!helpers) return;
57887
+ Object.keys(helpers).forEach(function(helperName) {
57888
+ var helper = helpers[helperName];
57897
57889
  mergedHelpers[helperName] = passLookupPropertyOption(helper, container);
57898
57890
  });
57899
57891
  }
57900
57892
  function passLookupPropertyOption(helper, container) {
57901
57893
  var lookupProperty = container.lookupProperty;
57902
57894
  return _internalWrapHelper.wrapHelper(helper, function(options) {
57903
- return Utils.extend({ lookupProperty }, options);
57895
+ options.lookupProperty = lookupProperty;
57896
+ return options;
57904
57897
  });
57905
57898
  }
57906
57899
  }
@@ -58710,7 +58703,7 @@ var require_parser = __commonJS({
58710
58703
  break;
58711
58704
  }
58712
58705
  };
58713
- lexer2.rules = [/^(?:[^\x00]*?(?=(\{\{)))/, /^(?:[^\x00]+)/, /^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/, /^(?:\{\{\{\{(?=[^/]))/, /^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/, /^(?:[^\x00]+?(?=(\{\{\{\{)))/, /^(?:[\s\S]*?--(~)?\}\})/, /^(?:\()/, /^(?:\))/, /^(?:\{\{\{\{)/, /^(?:\}\}\}\})/, /^(?:\{\{(~)?>)/, /^(?:\{\{(~)?#>)/, /^(?:\{\{(~)?#\*?)/, /^(?:\{\{(~)?\/)/, /^(?:\{\{(~)?\^\s*(~)?\}\})/, /^(?:\{\{(~)?\s*else\s*(~)?\}\})/, /^(?:\{\{(~)?\^)/, /^(?:\{\{(~)?\s*else\b)/, /^(?:\{\{(~)?\{)/, /^(?:\{\{(~)?&)/, /^(?:\{\{(~)?!--)/, /^(?:\{\{(~)?![\s\S]*?\}\})/, /^(?:\{\{(~)?\*?)/, /^(?:=)/, /^(?:\.\.)/, /^(?:\.(?=([=~}\s\/.)|])))/, /^(?:[\/.])/, /^(?:\s+)/, /^(?:\}(~)?\}\})/, /^(?:(~)?\}\})/, /^(?:"(\\["]|[^"])*")/, /^(?:'(\\[']|[^'])*')/, /^(?:@)/, /^(?:true(?=([~}\s)])))/, /^(?:false(?=([~}\s)])))/, /^(?:undefined(?=([~}\s)])))/, /^(?:null(?=([~}\s)])))/, /^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/, /^(?:as\s+\|)/, /^(?:\|)/, /^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/, /^(?:\[(\\\]|[^\]])*\])/, /^(?:.)/, /^(?:$)/];
58706
+ lexer2.rules = [/^(?:[^\x00]*?(?=(\{\{)))/, /^(?:[^\x00]+)/, /^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/, /^(?:\{\{\{\{(?=[^\/]))/, /^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/, /^(?:[^\x00]+?(?=(\{\{\{\{)))/, /^(?:[\s\S]*?--(~)?\}\})/, /^(?:\()/, /^(?:\))/, /^(?:\{\{\{\{)/, /^(?:\}\}\}\})/, /^(?:\{\{(~)?>)/, /^(?:\{\{(~)?#>)/, /^(?:\{\{(~)?#\*?)/, /^(?:\{\{(~)?\/)/, /^(?:\{\{(~)?\^\s*(~)?\}\})/, /^(?:\{\{(~)?\s*else\s*(~)?\}\})/, /^(?:\{\{(~)?\^)/, /^(?:\{\{(~)?\s*else\b)/, /^(?:\{\{(~)?\{)/, /^(?:\{\{(~)?&)/, /^(?:\{\{(~)?!--)/, /^(?:\{\{(~)?![\s\S]*?\}\})/, /^(?:\{\{(~)?\*?)/, /^(?:=)/, /^(?:\.\.)/, /^(?:\.(?=([=~}\s\/.)|])))/, /^(?:[\/.])/, /^(?:\s+)/, /^(?:\}(~)?\}\})/, /^(?:(~)?\}\})/, /^(?:"(\\["]|[^"])*")/, /^(?:'(\\[']|[^'])*')/, /^(?:@)/, /^(?:true(?=([~}\s)])))/, /^(?:false(?=([~}\s)])))/, /^(?:undefined(?=([~}\s)])))/, /^(?:null(?=([~}\s)])))/, /^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/, /^(?:as\s+\|)/, /^(?:\|)/, /^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/, /^(?:\[(\\\]|[^\]])*\])/, /^(?:.)/, /^(?:$)/];
58714
58707
  lexer2.conditions = { "mu": { "rules": [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44], "inclusive": false }, "emu": { "rules": [2], "inclusive": false }, "com": { "rules": [6], "inclusive": false }, "raw": { "rules": [3, 4, 5], "inclusive": false }, "INITIAL": { "rules": [0, 1, 44], "inclusive": true } };
58715
58708
  return lexer2;
58716
58709
  })();
@@ -59217,12 +59210,15 @@ var require_base3 = __commonJS({
59217
59210
  var _whitespaceControl2 = _interopRequireDefault(_whitespaceControl);
59218
59211
  var _helpers = require_helpers2();
59219
59212
  var Helpers = _interopRequireWildcard(_helpers);
59213
+ var _exception = require_exception();
59214
+ var _exception2 = _interopRequireDefault(_exception);
59220
59215
  var _utils = require_utils5();
59221
59216
  exports.parser = _parser2["default"];
59222
59217
  var yy = {};
59223
59218
  _utils.extend(yy, Helpers);
59224
59219
  function parseWithoutProcessing(input, options) {
59225
59220
  if (input.type === "Program") {
59221
+ validateInputAst(input);
59226
59222
  return input;
59227
59223
  }
59228
59224
  _parser2["default"].yy = yy;
@@ -59237,6 +59233,51 @@ var require_base3 = __commonJS({
59237
59233
  var strip = new _whitespaceControl2["default"](options);
59238
59234
  return strip.accept(ast);
59239
59235
  }
59236
+ function validateInputAst(ast) {
59237
+ validateAstNode(ast);
59238
+ }
59239
+ function validateAstNode(node) {
59240
+ if (node == null) {
59241
+ return;
59242
+ }
59243
+ if (Array.isArray(node)) {
59244
+ node.forEach(validateAstNode);
59245
+ return;
59246
+ }
59247
+ if (typeof node !== "object") {
59248
+ return;
59249
+ }
59250
+ if (node.type === "PathExpression") {
59251
+ if (!isValidDepth(node.depth)) {
59252
+ throw new _exception2["default"]("Invalid AST: PathExpression.depth must be an integer");
59253
+ }
59254
+ if (!Array.isArray(node.parts)) {
59255
+ throw new _exception2["default"]("Invalid AST: PathExpression.parts must be an array");
59256
+ }
59257
+ for (var i = 0; i < node.parts.length; i++) {
59258
+ if (typeof node.parts[i] !== "string") {
59259
+ throw new _exception2["default"]("Invalid AST: PathExpression.parts must only contain strings");
59260
+ }
59261
+ }
59262
+ } else if (node.type === "NumberLiteral") {
59263
+ if (typeof node.value !== "number" || !isFinite(node.value)) {
59264
+ throw new _exception2["default"]("Invalid AST: NumberLiteral.value must be a number");
59265
+ }
59266
+ } else if (node.type === "BooleanLiteral") {
59267
+ if (typeof node.value !== "boolean") {
59268
+ throw new _exception2["default"]("Invalid AST: BooleanLiteral.value must be a boolean");
59269
+ }
59270
+ }
59271
+ Object.keys(node).forEach(function(propertyName) {
59272
+ if (propertyName === "loc") {
59273
+ return;
59274
+ }
59275
+ validateAstNode(node[propertyName]);
59276
+ });
59277
+ }
59278
+ function isValidDepth(depth) {
59279
+ return typeof depth === "number" && isFinite(depth) && Math.floor(depth) === depth && depth >= 0;
59280
+ }
59240
59281
  }
59241
59282
  });
59242
59283
 
@@ -61665,12 +61706,10 @@ var require_javascript_compiler = __commonJS({
61665
61706
  var programs = _context.programs;
61666
61707
  var decorators = _context.decorators;
61667
61708
  for (i = 0, l = programs.length; i < l; i++) {
61668
- if (programs[i]) {
61669
- ret[i] = programs[i];
61670
- if (decorators[i]) {
61671
- ret[i + "_d"] = decorators[i];
61672
- ret.useDecorators = true;
61673
- }
61709
+ ret[i] = programs[i];
61710
+ if (decorators[i]) {
61711
+ ret[i + "_d"] = decorators[i];
61712
+ ret.useDecorators = true;
61674
61713
  }
61675
61714
  }
61676
61715
  if (this.environment.usePartial) {
@@ -61931,22 +61970,25 @@ var require_javascript_compiler = __commonJS({
61931
61970
  }
61932
61971
  this.resolvePath("data", parts, 0, true, strict);
61933
61972
  },
61934
- resolvePath: function resolvePath(type, parts, i, falsy, strict) {
61973
+ resolvePath: function resolvePath(type, parts, startPartIndex, falsy, strict) {
61935
61974
  var _this2 = this;
61936
61975
  if (this.options.strict || this.options.assumeObjects) {
61937
- this.push(strictLookup(this.options.strict && strict, this, parts, i, type));
61976
+ this.push(strictLookup(this.options.strict && strict, this, parts, startPartIndex, type));
61938
61977
  return;
61939
61978
  }
61940
61979
  var len = parts.length;
61941
- for (; i < len; i++) {
61942
- this.replaceStack(function(current) {
61943
- var lookup = _this2.nameLookup(current, parts[i], type);
61980
+ var _loop = function(i2) {
61981
+ _this2.replaceStack(function(current) {
61982
+ var lookup = _this2.nameLookup(current, parts[i2], type);
61944
61983
  if (!falsy) {
61945
61984
  return [" != null ? ", lookup, " : ", current];
61946
61985
  } else {
61947
61986
  return [" && ", lookup];
61948
61987
  }
61949
61988
  });
61989
+ };
61990
+ for (var i = startPartIndex; i < len; i++) {
61991
+ _loop(i);
61950
61992
  }
61951
61993
  },
61952
61994
  // [resolvePossibleLambda]
@@ -62050,7 +62092,9 @@ var require_javascript_compiler = __commonJS({
62050
62092
  // and inserts the decorator into the decorators list.
62051
62093
  registerDecorator: function registerDecorator(paramSize, name) {
62052
62094
  var foundDecorator = this.nameLookup("decorators", name, "decorator"), options = this.setupHelperArgs(name, paramSize);
62053
- this.decorators.push(["fn = ", this.decorators.functionCall(foundDecorator, "", ["fn", "props", "container", options]), " || fn;"]);
62095
+ this.decorators.push(["var decorator = ", foundDecorator, ";"]);
62096
+ this.decorators.push(['if (typeof decorator !== "function") { throw new Error(', this.quotedString('Missing decorator: "' + name + '"'), "); }"]);
62097
+ this.decorators.push(["fn = ", this.decorators.functionCall("decorator", "", ["fn", "props", "container", options]), " || fn;"]);
62054
62098
  },
62055
62099
  // [invokeHelper]
62056
62100
  //
@@ -62197,8 +62241,7 @@ var require_javascript_compiler = __commonJS({
62197
62241
  compiler = new this.compiler();
62198
62242
  var existing = this.matchExistingProgram(child);
62199
62243
  if (existing == null) {
62200
- this.context.programs.push("");
62201
- var index = this.context.programs.length;
62244
+ var index = this.context.programs.push("") - 1;
62202
62245
  child.index = index;
62203
62246
  child.name = "program" + index;
62204
62247
  this.context.programs[index] = compiler.compile(child, options, this.context, !this.precompile);
@@ -62442,16 +62485,16 @@ var require_javascript_compiler = __commonJS({
62442
62485
  JavaScriptCompiler.isValidJavaScriptVariableName = function(name) {
62443
62486
  return !JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name);
62444
62487
  };
62445
- function strictLookup(requireTerminal, compiler, parts, i, type) {
62488
+ function strictLookup(requireTerminal, compiler, parts, startPartIndex, type) {
62446
62489
  var stack = compiler.popStack(), len = parts.length;
62447
62490
  if (requireTerminal) {
62448
62491
  len--;
62449
62492
  }
62450
- for (; i < len; i++) {
62493
+ for (var i = startPartIndex; i < len; i++) {
62451
62494
  stack = compiler.nameLookup(stack, parts[i], type);
62452
62495
  }
62453
62496
  if (requireTerminal) {
62454
- return [compiler.aliasable("container.strict"), "(", stack, ", ", compiler.quotedString(parts[i]), ", ", JSON.stringify(compiler.source.currentLocation), " )"];
62497
+ return [compiler.aliasable("container.strict"), "(", stack, ", ", compiler.quotedString(parts[len]), ", ", JSON.stringify(compiler.source.currentLocation), " )"];
62455
62498
  } else {
62456
62499
  return stack;
62457
62500
  }
@@ -62727,7 +62770,7 @@ var id_default = ID;
62727
62770
  // lib/constants.ts
62728
62771
  var SDK_TITLE = "Appwrite";
62729
62772
  var SDK_TITLE_LOWER = "appwrite";
62730
- var SDK_VERSION = "17.0.0";
62773
+ var SDK_VERSION = "17.2.1";
62731
62774
  var SDK_LOGO = "\n _ _ _ ___ __ _____\n /_\\ _ __ _ ____ ___ __(_) |_ ___ / __\\ / / \\_ \\\n //_\\\\| '_ \\| '_ \\ \\ /\\ / / '__| | __/ _ \\ / / / / / /\\/\n / _ \\ |_) | |_) \\ V V /| | | | || __/ / /___/ /___/\\/ /_\n \\_/ \\_/ .__/| .__/ \\_/\\_/ |_| |_|\\__\\___| \\____/\\____/\\____/\n |_| |_|\n\n";
62732
62775
  var EXECUTABLE_NAME = "appwrite";
62733
62776
  var NPM_PACKAGE_NAME = "appwrite-cli";
@@ -100274,7 +100317,7 @@ var package_default = {
100274
100317
  type: "module",
100275
100318
  homepage: "https://appwrite.io/support",
100276
100319
  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",
100277
- version: "17.0.0",
100320
+ version: "17.2.1",
100278
100321
  license: "BSD-3-Clause",
100279
100322
  main: "dist/index.cjs",
100280
100323
  module: "dist/index.js",
@@ -100364,16 +100407,36 @@ var package_default = {
100364
100407
 
100365
100408
  // lib/parser.ts
100366
100409
  import os3 from "os";
100410
+ BigInt.prototype.toJSON = function() {
100411
+ return this.toString();
100412
+ };
100367
100413
  var { description } = package_default;
100368
100414
  var cliConfig = {
100369
100415
  verbose: false,
100370
100416
  json: false,
100417
+ raw: false,
100418
+ showSecrets: false,
100371
100419
  force: false,
100372
100420
  all: false,
100373
100421
  ids: [],
100374
100422
  report: false,
100375
- reportData: {}
100423
+ reportData: {},
100424
+ displayFields: []
100376
100425
  };
100426
+ var HIDDEN_VALUE = "[hidden]";
100427
+ var SENSITIVE_KEYS = /* @__PURE__ */ new Set([
100428
+ "secret",
100429
+ "apikey",
100430
+ "accesstoken",
100431
+ "refreshtoken",
100432
+ "password",
100433
+ "jwt",
100434
+ "clientsecret",
100435
+ "secretkey",
100436
+ "sessionsecret"
100437
+ ]);
100438
+ var renderDepth = 0;
100439
+ var redactionApplied = false;
100377
100440
  var toJsonObject = (value) => {
100378
100441
  if (value && typeof value === "object" && !Array.isArray(value)) {
100379
100442
  return value;
@@ -100390,60 +100453,200 @@ var extractReportCommandArgs = (value) => {
100390
100453
  }
100391
100454
  return reportData.data.args;
100392
100455
  };
100393
- var drawTable = (data) => {
100394
- if (data.length == 0) {
100395
- console.log("[]");
100396
- return;
100456
+ var beginRender = () => {
100457
+ if (renderDepth === 0) {
100458
+ redactionApplied = false;
100397
100459
  }
100398
- const rows = data.map((item) => toJsonObject(item) ?? {});
100399
- const obj = rows.reduce((res, item) => ({ ...res, ...item }), {});
100400
- const keys = Object.keys(obj);
100401
- if (keys.length === 0) {
100402
- drawJSON(data);
100403
- return;
100460
+ renderDepth++;
100461
+ };
100462
+ var endRender = () => {
100463
+ renderDepth = Math.max(0, renderDepth - 1);
100464
+ if (renderDepth === 0 && redactionApplied && !cliConfig.showSecrets) {
100465
+ const message = "Sensitive values were redacted. Pass --show-secrets to display them.";
100466
+ if (cliConfig.json || cliConfig.raw) {
100467
+ console.error(`${import_chalk2.default.cyan.bold("\u2665 Hint:")} ${import_chalk2.default.cyan(message)}`);
100468
+ } else {
100469
+ hint(message);
100470
+ }
100471
+ }
100472
+ };
100473
+ var withRender = (callback) => {
100474
+ beginRender();
100475
+ try {
100476
+ return callback();
100477
+ } finally {
100478
+ endRender();
100404
100479
  }
100405
- const def = keys.reduce((result, key) => {
100406
- result[key] = "-";
100480
+ };
100481
+ var isSensitiveKey = (key) => {
100482
+ const normalizedKey = key.toLowerCase().replace(/[^a-z0-9]/g, "");
100483
+ return SENSITIVE_KEYS.has(normalizedKey);
100484
+ };
100485
+ var maskSensitiveString = (value) => {
100486
+ if (value.length <= 16) {
100487
+ return HIDDEN_VALUE;
100488
+ }
100489
+ const separatorIndex = value.indexOf("_");
100490
+ if (separatorIndex > 0 && separatorIndex < value.length - 9) {
100491
+ const prefix = value.slice(0, separatorIndex + 1);
100492
+ const tail = value.slice(-4);
100493
+ return `${prefix}${HIDDEN_VALUE}${tail}`;
100494
+ }
100495
+ return `${HIDDEN_VALUE}${value.slice(-4)}`;
100496
+ };
100497
+ var maskSensitiveData = (value, key) => {
100498
+ if (key && isSensitiveKey(key) && !cliConfig.showSecrets) {
100499
+ redactionApplied = true;
100500
+ if (typeof value === "string") {
100501
+ return maskSensitiveString(value);
100502
+ }
100503
+ if (value == null) {
100504
+ return value;
100505
+ }
100506
+ return HIDDEN_VALUE;
100507
+ }
100508
+ if (Array.isArray(value)) {
100509
+ return value.map((item) => maskSensitiveData(item));
100510
+ }
100511
+ if (value && typeof value === "object") {
100512
+ if (value?.constructor?.name === "BigNumber") {
100513
+ return String(value);
100514
+ }
100515
+ const result = {};
100516
+ for (const childKey of Object.keys(value)) {
100517
+ const childValue = value[childKey];
100518
+ if (typeof childValue === "function") continue;
100519
+ result[childKey] = maskSensitiveData(childValue, childKey);
100520
+ }
100407
100521
  return result;
100408
- }, {});
100409
- const normalizedData = rows.map((item) => ({ ...def, ...item }));
100410
- const columns = Object.keys(normalizedData[0]);
100411
- const table = new import_cli_table3.default({
100412
- head: columns.map((c) => import_chalk2.default.cyan.italic.bold(c)),
100413
- chars: {
100414
- top: " ",
100415
- "top-mid": " ",
100416
- "top-left": " ",
100417
- "top-right": " ",
100418
- bottom: " ",
100419
- "bottom-mid": " ",
100420
- "bottom-left": " ",
100421
- "bottom-right": " ",
100422
- left: " ",
100423
- "left-mid": " ",
100424
- mid: import_chalk2.default.cyan("\u2500"),
100425
- "mid-mid": import_chalk2.default.cyan("\u253C"),
100426
- right: " ",
100427
- "right-mid": " ",
100428
- middle: import_chalk2.default.cyan("\u2502")
100522
+ }
100523
+ return value;
100524
+ };
100525
+ var applyDisplayFilter = (rows) => {
100526
+ if (cliConfig.displayFields.length === 0) {
100527
+ return rows;
100528
+ }
100529
+ return rows.map((row) => {
100530
+ const filtered = {};
100531
+ for (const key of cliConfig.displayFields) {
100532
+ if (Object.prototype.hasOwnProperty.call(row, key)) {
100533
+ filtered[key] = row[key];
100534
+ }
100429
100535
  }
100536
+ return Object.keys(filtered).length > 0 ? filtered : row;
100430
100537
  });
100431
- normalizedData.forEach((row) => {
100432
- const rowValues = [];
100433
- for (const key of columns) {
100434
- if (row[key] == null) {
100435
- rowValues.push("-");
100436
- } else if (Array.isArray(row[key])) {
100437
- rowValues.push(JSON.stringify(row[key]));
100438
- } else if (typeof row[key] === "object") {
100439
- rowValues.push(JSON.stringify(row[key]));
100440
- } else {
100441
- rowValues.push(String(row[key]));
100538
+ };
100539
+ var MAX_COL_WIDTH = 40;
100540
+ var formatCellValue = (value) => {
100541
+ if (value == null) return "-";
100542
+ if (Array.isArray(value)) {
100543
+ if (value.length === 0) return "[]";
100544
+ return `[${value.length} items]`;
100545
+ }
100546
+ if (typeof value === "object") {
100547
+ if (value?.constructor?.name === "BigNumber") return String(value);
100548
+ const keys = Object.keys(value);
100549
+ if (keys.length === 0) return "{}";
100550
+ return `{${keys.length} keys}`;
100551
+ }
100552
+ const str = String(value);
100553
+ if (str.length > MAX_COL_WIDTH) {
100554
+ return str.slice(0, MAX_COL_WIDTH - 1) + "\u2026";
100555
+ }
100556
+ return str;
100557
+ };
100558
+ var drawTable = (data) => {
100559
+ withRender(() => {
100560
+ if (data.length == 0) {
100561
+ console.log("[]");
100562
+ return;
100563
+ }
100564
+ const rows = applyDisplayFilter(
100565
+ data.map((item) => {
100566
+ const maskedItem = maskSensitiveData(item);
100567
+ return toJsonObject(maskedItem) ?? {};
100568
+ })
100569
+ );
100570
+ const obj = rows.reduce((res, item) => ({ ...res, ...item }), {});
100571
+ const allKeys = Object.keys(obj);
100572
+ if (allKeys.length === 0) {
100573
+ drawJSON(data);
100574
+ return;
100575
+ }
100576
+ const maxColumns = 6;
100577
+ if (allKeys.length > maxColumns) {
100578
+ const rowEntries = rows.map((row) => {
100579
+ const entries = [];
100580
+ for (const key of Object.keys(row)) {
100581
+ const value = row[key];
100582
+ if (typeof value === "function") continue;
100583
+ if (value == null) continue;
100584
+ if (value?.constructor?.name === "BigNumber") {
100585
+ entries.push([key, String(value)]);
100586
+ continue;
100587
+ }
100588
+ if (typeof value === "object") continue;
100589
+ if (typeof value === "string" && value.trim() === "") continue;
100590
+ entries.push([key, String(value)]);
100591
+ }
100592
+ return entries;
100593
+ });
100594
+ const flatEntries = rowEntries.flat();
100595
+ if (flatEntries.length === 0) {
100596
+ drawJSON(data);
100597
+ return;
100442
100598
  }
100599
+ const maxKeyLen = Math.max(...flatEntries.map(([key]) => key.length));
100600
+ const separatorLen = Math.min(
100601
+ maxKeyLen + 2 + MAX_COL_WIDTH,
100602
+ process.stdout.columns || 80
100603
+ );
100604
+ rowEntries.forEach((entries, idx) => {
100605
+ if (idx > 0) console.log(import_chalk2.default.cyan("\u2500".repeat(separatorLen)));
100606
+ for (const [key, value] of entries) {
100607
+ const paddedKey = key.padEnd(maxKeyLen);
100608
+ console.log(`${import_chalk2.default.yellow.bold(paddedKey)} ${value}`);
100609
+ }
100610
+ });
100611
+ return;
100443
100612
  }
100444
- table.push(rowValues);
100613
+ const columns = allKeys;
100614
+ const def = allKeys.reduce((result, key) => {
100615
+ result[key] = "-";
100616
+ return result;
100617
+ }, {});
100618
+ const normalizedData = rows.map((item) => ({ ...def, ...item }));
100619
+ const table = new import_cli_table3.default({
100620
+ head: columns.map((c) => import_chalk2.default.cyan.italic.bold(c)),
100621
+ colWidths: columns.map(() => null),
100622
+ wordWrap: false,
100623
+ chars: {
100624
+ "top": " ",
100625
+ "top-mid": " ",
100626
+ "top-left": " ",
100627
+ "top-right": " ",
100628
+ "bottom": " ",
100629
+ "bottom-mid": " ",
100630
+ "bottom-left": " ",
100631
+ "bottom-right": " ",
100632
+ "left": " ",
100633
+ "left-mid": " ",
100634
+ "mid": import_chalk2.default.cyan("\u2500"),
100635
+ "mid-mid": import_chalk2.default.cyan("\u253C"),
100636
+ "right": " ",
100637
+ "right-mid": " ",
100638
+ "middle": import_chalk2.default.cyan("\u2502")
100639
+ }
100640
+ });
100641
+ normalizedData.forEach((row) => {
100642
+ const rowValues = [];
100643
+ for (const key of columns) {
100644
+ rowValues.push(formatCellValue(row[key]));
100645
+ }
100646
+ table.push(rowValues);
100647
+ });
100648
+ console.log(table.toString());
100445
100649
  });
100446
- console.log(table.toString());
100447
100650
  };
100448
100651
  var drawJSON = (data) => {
100449
100652
  console.log(JSON.stringify(data, null, 2));
@@ -100545,7 +100748,7 @@ var commandDescriptions = {
100545
100748
  avatars: `The avatars command aims to help you complete everyday tasks related to your app image, icons, and avatars.`,
100546
100749
  databases: `(Legacy) The databases command allows you to create structured collections of documents and query and filter lists of documents.`,
100547
100750
  "tables-db": `The tables-db command allows you to create structured tables of columns and query and filter lists of rows.`,
100548
- init: `The init command provides a convenient wrapper for creating and initializing projects, functions, collections, buckets, teams, and messaging-topics in ${SDK_TITLE}.`,
100751
+ init: `The init command provides a convenient wrapper for creating and initializing projects, functions, collections, buckets, teams, messaging-topics, and agent skills in ${SDK_TITLE}.`,
100549
100752
  push: `The push command provides a convenient wrapper for pushing your functions, collections, buckets, teams, and messaging-topics.`,
100550
100753
  run: `The run command allows you to run the project locally to allow easy development and quick debugging.`,
100551
100754
  functions: `The functions command allows you to view, create, and manage your Cloud Functions.`,
@@ -100555,7 +100758,7 @@ var commandDescriptions = {
100555
100758
  locale: `The locale command allows you to customize your app based on your users' location.`,
100556
100759
  sites: `The sites command allows you to view, create and manage your Appwrite Sites.`,
100557
100760
  storage: `The storage command allows you to manage your project files.`,
100558
- teams: `The teams command allows you to group users of your project to enable them to share read and write access to your project resources.`,
100761
+ teams: `The teams command allows you to group users of your project to enable them to share read and write access to your project resources. Requires a linked project. To manage console-level teams, use the 'organizations' command instead.`,
100559
100762
  update: `The update command allows you to update the ${SDK_TITLE} CLI to the latest version.`,
100560
100763
  users: `The users command allows you to manage your project users.`,
100561
100764
  projects: `The projects command allows you to manage your projects, add platforms, manage API keys, Dev Keys etc.`,
@@ -100890,14 +101093,14 @@ var questionsInitProject = [
100890
101093
  name: "project",
100891
101094
  message: "What would you like to name your project?",
100892
101095
  default: "My Awesome Project",
100893
- when: (answer) => answer.start !== "existing"
101096
+ when: (answer) => whenOverride(answer) && answer.start !== "existing"
100894
101097
  },
100895
101098
  {
100896
101099
  type: "input",
100897
101100
  name: "id",
100898
101101
  message: "What ID would you like to have for your project?",
100899
101102
  default: "unique()",
100900
- when: (answer) => answer.start !== "existing"
101103
+ when: (answer) => whenOverride(answer) && answer.start !== "existing"
100901
101104
  },
100902
101105
  {
100903
101106
  type: "search-list",
@@ -100958,6 +101161,7 @@ var questionsInitProject = [
100958
101161
  }));
100959
101162
  },
100960
101163
  when: (answer) => {
101164
+ if (!whenOverride(answer)) return false;
100961
101165
  if (answer.start === "existing") return false;
100962
101166
  return isCloud();
100963
101167
  }