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.cjs CHANGED
@@ -19581,9 +19581,9 @@ var require_stream_duplex = __commonJS({
19581
19581
  }
19582
19582
  });
19583
19583
 
19584
- // node_modules/string_decoder/node_modules/safe-buffer/index.js
19584
+ // node_modules/safe-buffer/index.js
19585
19585
  var require_safe_buffer = __commonJS({
19586
- "node_modules/string_decoder/node_modules/safe-buffer/index.js"(exports2, module2) {
19586
+ "node_modules/safe-buffer/index.js"(exports2, module2) {
19587
19587
  var buffer = require("buffer");
19588
19588
  var Buffer2 = buffer.Buffer;
19589
19589
  function copyProps(src, dst) {
@@ -57282,7 +57282,7 @@ var require_helpers = __commonJS({
57282
57282
  if (instance.helpers[helperName]) {
57283
57283
  instance.hooks[helperName] = instance.helpers[helperName];
57284
57284
  if (!keepHelper) {
57285
- delete instance.helpers[helperName];
57285
+ instance.helpers[helperName] = void 0;
57286
57286
  }
57287
57287
  }
57288
57288
  }
@@ -57374,22 +57374,6 @@ var require_logger = __commonJS({
57374
57374
  }
57375
57375
  });
57376
57376
 
57377
- // node_modules/handlebars/dist/cjs/handlebars/internal/create-new-lookup-object.js
57378
- var require_create_new_lookup_object = __commonJS({
57379
- "node_modules/handlebars/dist/cjs/handlebars/internal/create-new-lookup-object.js"(exports2) {
57380
- "use strict";
57381
- exports2.__esModule = true;
57382
- exports2.createNewLookupObject = createNewLookupObject;
57383
- var _utils = require_utils5();
57384
- function createNewLookupObject() {
57385
- for (var _len = arguments.length, sources = Array(_len), _key = 0; _key < _len; _key++) {
57386
- sources[_key] = arguments[_key];
57387
- }
57388
- return _utils.extend.apply(void 0, [/* @__PURE__ */ Object.create(null)].concat(sources));
57389
- }
57390
- }
57391
- });
57392
-
57393
57377
  // node_modules/handlebars/dist/cjs/handlebars/internal/proto-access.js
57394
57378
  var require_proto_access = __commonJS({
57395
57379
  "node_modules/handlebars/dist/cjs/handlebars/internal/proto-access.js"(exports2) {
@@ -57401,25 +57385,28 @@ var require_proto_access = __commonJS({
57401
57385
  function _interopRequireDefault(obj) {
57402
57386
  return obj && obj.__esModule ? obj : { "default": obj };
57403
57387
  }
57404
- var _createNewLookupObject = require_create_new_lookup_object();
57388
+ var _utils = require_utils5();
57405
57389
  var _logger = require_logger();
57406
57390
  var _logger2 = _interopRequireDefault(_logger);
57407
57391
  var loggedProperties = /* @__PURE__ */ Object.create(null);
57408
57392
  function createProtoAccessControl(runtimeOptions) {
57409
- var defaultMethodWhiteList = /* @__PURE__ */ Object.create(null);
57410
- defaultMethodWhiteList["constructor"] = false;
57411
- defaultMethodWhiteList["__defineGetter__"] = false;
57412
- defaultMethodWhiteList["__defineSetter__"] = false;
57413
- defaultMethodWhiteList["__lookupGetter__"] = false;
57414
- var defaultPropertyWhiteList = /* @__PURE__ */ Object.create(null);
57415
- defaultPropertyWhiteList["__proto__"] = false;
57393
+ var propertyWhiteList = /* @__PURE__ */ Object.create(null);
57394
+ propertyWhiteList["__proto__"] = false;
57395
+ _utils.extend(propertyWhiteList, runtimeOptions.allowedProtoProperties);
57396
+ var methodWhiteList = /* @__PURE__ */ Object.create(null);
57397
+ methodWhiteList["constructor"] = false;
57398
+ methodWhiteList["__defineGetter__"] = false;
57399
+ methodWhiteList["__defineSetter__"] = false;
57400
+ methodWhiteList["__lookupGetter__"] = false;
57401
+ methodWhiteList["__lookupSetter__"] = false;
57402
+ _utils.extend(methodWhiteList, runtimeOptions.allowedProtoMethods);
57416
57403
  return {
57417
57404
  properties: {
57418
- whitelist: _createNewLookupObject.createNewLookupObject(defaultPropertyWhiteList, runtimeOptions.allowedProtoProperties),
57405
+ whitelist: propertyWhiteList,
57419
57406
  defaultValue: runtimeOptions.allowProtoPropertiesByDefault
57420
57407
  },
57421
57408
  methods: {
57422
- whitelist: _createNewLookupObject.createNewLookupObject(defaultMethodWhiteList, runtimeOptions.allowedProtoMethods),
57409
+ whitelist: methodWhiteList,
57423
57410
  defaultValue: runtimeOptions.allowProtoMethodsByDefault
57424
57411
  }
57425
57412
  };
@@ -57472,7 +57459,7 @@ var require_base2 = __commonJS({
57472
57459
  var _logger = require_logger();
57473
57460
  var _logger2 = _interopRequireDefault(_logger);
57474
57461
  var _internalProtoAccess = require_proto_access();
57475
- var VERSION = "4.7.8";
57462
+ var VERSION = "4.7.9";
57476
57463
  exports2.VERSION = VERSION;
57477
57464
  var COMPILER_REVISION = 8;
57478
57465
  exports2.COMPILER_REVISION = COMPILER_REVISION;
@@ -57658,14 +57645,12 @@ var require_runtime = __commonJS({
57658
57645
  }
57659
57646
  }
57660
57647
  partial2 = env.VM.resolvePartial.call(this, partial2, context, options);
57661
- var extendedOptions = Utils.extend({}, options, {
57662
- hooks: this.hooks,
57663
- protoAccessControl: this.protoAccessControl
57664
- });
57665
- var result = env.VM.invokePartial.call(this, partial2, context, extendedOptions);
57648
+ options.hooks = this.hooks;
57649
+ options.protoAccessControl = this.protoAccessControl;
57650
+ var result = env.VM.invokePartial.call(this, partial2, context, options);
57666
57651
  if (result == null && env.compile) {
57667
57652
  options.partials[options.name] = env.compile(partial2, templateSpec.compilerOptions, env);
57668
- result = options.partials[options.name](context, extendedOptions);
57653
+ result = options.partials[options.name](context, options);
57669
57654
  }
57670
57655
  if (result != null) {
57671
57656
  if (options.indent) {
@@ -57710,7 +57695,7 @@ var require_runtime = __commonJS({
57710
57695
  for (var i = 0; i < len; i++) {
57711
57696
  var result = depths[i] && container.lookupProperty(depths[i], name);
57712
57697
  if (result != null) {
57713
- return depths[i][name];
57698
+ return result;
57714
57699
  }
57715
57700
  }
57716
57701
  },
@@ -57776,8 +57761,9 @@ var require_runtime = __commonJS({
57776
57761
  ret.isTop = true;
57777
57762
  ret._setup = function(options) {
57778
57763
  if (!options.partial) {
57779
- var mergedHelpers = Utils.extend({}, env.helpers, options.helpers);
57780
- wrapHelpersToPassLookupProperty(mergedHelpers, container);
57764
+ var mergedHelpers = {};
57765
+ addHelpers(mergedHelpers, env.helpers, container);
57766
+ addHelpers(mergedHelpers, options.helpers, container);
57781
57767
  container.helpers = mergedHelpers;
57782
57768
  if (templateSpec.usePartial) {
57783
57769
  container.partials = container.mergeIfNeeded(options.partials, env.partials);
@@ -57827,18 +57813,18 @@ var require_runtime = __commonJS({
57827
57813
  function resolvePartial(partial2, context, options) {
57828
57814
  if (!partial2) {
57829
57815
  if (options.name === "@partial-block") {
57830
- partial2 = options.data["partial-block"];
57816
+ partial2 = lookupOwnProperty(options.data, "partial-block");
57831
57817
  } else {
57832
- partial2 = options.partials[options.name];
57818
+ partial2 = lookupOwnProperty(options.partials, options.name);
57833
57819
  }
57834
57820
  } else if (!partial2.call && !options.name) {
57835
57821
  options.name = partial2;
57836
- partial2 = options.partials[partial2];
57822
+ partial2 = lookupOwnProperty(options.partials, partial2);
57837
57823
  }
57838
57824
  return partial2;
57839
57825
  }
57840
57826
  function invokePartial(partial2, context, options) {
57841
- var currentPartialBlock = options.data && options.data["partial-block"];
57827
+ var currentPartialBlock = lookupOwnProperty(options.data, "partial-block");
57842
57828
  options.partial = true;
57843
57829
  if (options.ids) {
57844
57830
  options.data.contextPath = options.ids[0] || options.data.contextPath;
@@ -57871,6 +57857,11 @@ var require_runtime = __commonJS({
57871
57857
  function noop() {
57872
57858
  return "";
57873
57859
  }
57860
+ function lookupOwnProperty(obj, name) {
57861
+ if (obj && Object.prototype.hasOwnProperty.call(obj, name)) {
57862
+ return obj[name];
57863
+ }
57864
+ }
57874
57865
  function initData(context, data) {
57875
57866
  if (!data || !("root" in data)) {
57876
57867
  data = data ? _base.createFrame(data) : {};
@@ -57886,16 +57877,18 @@ var require_runtime = __commonJS({
57886
57877
  }
57887
57878
  return prog;
57888
57879
  }
57889
- function wrapHelpersToPassLookupProperty(mergedHelpers, container) {
57890
- Object.keys(mergedHelpers).forEach(function(helperName) {
57891
- var helper = mergedHelpers[helperName];
57880
+ function addHelpers(mergedHelpers, helpers, container) {
57881
+ if (!helpers) return;
57882
+ Object.keys(helpers).forEach(function(helperName) {
57883
+ var helper = helpers[helperName];
57892
57884
  mergedHelpers[helperName] = passLookupPropertyOption(helper, container);
57893
57885
  });
57894
57886
  }
57895
57887
  function passLookupPropertyOption(helper, container) {
57896
57888
  var lookupProperty = container.lookupProperty;
57897
57889
  return _internalWrapHelper.wrapHelper(helper, function(options) {
57898
- return Utils.extend({ lookupProperty }, options);
57890
+ options.lookupProperty = lookupProperty;
57891
+ return options;
57899
57892
  });
57900
57893
  }
57901
57894
  }
@@ -58705,7 +58698,7 @@ var require_parser = __commonJS({
58705
58698
  break;
58706
58699
  }
58707
58700
  };
58708
- 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\/.)|]))))/, /^(?:\[(\\\]|[^\]])*\])/, /^(?:.)/, /^(?:$)/];
58701
+ 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\/.)|]))))/, /^(?:\[(\\\]|[^\]])*\])/, /^(?:.)/, /^(?:$)/];
58709
58702
  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 } };
58710
58703
  return lexer2;
58711
58704
  })();
@@ -59212,12 +59205,15 @@ var require_base3 = __commonJS({
59212
59205
  var _whitespaceControl2 = _interopRequireDefault(_whitespaceControl);
59213
59206
  var _helpers = require_helpers2();
59214
59207
  var Helpers = _interopRequireWildcard(_helpers);
59208
+ var _exception = require_exception();
59209
+ var _exception2 = _interopRequireDefault(_exception);
59215
59210
  var _utils = require_utils5();
59216
59211
  exports2.parser = _parser2["default"];
59217
59212
  var yy = {};
59218
59213
  _utils.extend(yy, Helpers);
59219
59214
  function parseWithoutProcessing(input, options) {
59220
59215
  if (input.type === "Program") {
59216
+ validateInputAst(input);
59221
59217
  return input;
59222
59218
  }
59223
59219
  _parser2["default"].yy = yy;
@@ -59232,6 +59228,51 @@ var require_base3 = __commonJS({
59232
59228
  var strip = new _whitespaceControl2["default"](options);
59233
59229
  return strip.accept(ast);
59234
59230
  }
59231
+ function validateInputAst(ast) {
59232
+ validateAstNode(ast);
59233
+ }
59234
+ function validateAstNode(node) {
59235
+ if (node == null) {
59236
+ return;
59237
+ }
59238
+ if (Array.isArray(node)) {
59239
+ node.forEach(validateAstNode);
59240
+ return;
59241
+ }
59242
+ if (typeof node !== "object") {
59243
+ return;
59244
+ }
59245
+ if (node.type === "PathExpression") {
59246
+ if (!isValidDepth(node.depth)) {
59247
+ throw new _exception2["default"]("Invalid AST: PathExpression.depth must be an integer");
59248
+ }
59249
+ if (!Array.isArray(node.parts)) {
59250
+ throw new _exception2["default"]("Invalid AST: PathExpression.parts must be an array");
59251
+ }
59252
+ for (var i = 0; i < node.parts.length; i++) {
59253
+ if (typeof node.parts[i] !== "string") {
59254
+ throw new _exception2["default"]("Invalid AST: PathExpression.parts must only contain strings");
59255
+ }
59256
+ }
59257
+ } else if (node.type === "NumberLiteral") {
59258
+ if (typeof node.value !== "number" || !isFinite(node.value)) {
59259
+ throw new _exception2["default"]("Invalid AST: NumberLiteral.value must be a number");
59260
+ }
59261
+ } else if (node.type === "BooleanLiteral") {
59262
+ if (typeof node.value !== "boolean") {
59263
+ throw new _exception2["default"]("Invalid AST: BooleanLiteral.value must be a boolean");
59264
+ }
59265
+ }
59266
+ Object.keys(node).forEach(function(propertyName) {
59267
+ if (propertyName === "loc") {
59268
+ return;
59269
+ }
59270
+ validateAstNode(node[propertyName]);
59271
+ });
59272
+ }
59273
+ function isValidDepth(depth) {
59274
+ return typeof depth === "number" && isFinite(depth) && Math.floor(depth) === depth && depth >= 0;
59275
+ }
59235
59276
  }
59236
59277
  });
59237
59278
 
@@ -61660,12 +61701,10 @@ var require_javascript_compiler = __commonJS({
61660
61701
  var programs = _context.programs;
61661
61702
  var decorators = _context.decorators;
61662
61703
  for (i = 0, l = programs.length; i < l; i++) {
61663
- if (programs[i]) {
61664
- ret[i] = programs[i];
61665
- if (decorators[i]) {
61666
- ret[i + "_d"] = decorators[i];
61667
- ret.useDecorators = true;
61668
- }
61704
+ ret[i] = programs[i];
61705
+ if (decorators[i]) {
61706
+ ret[i + "_d"] = decorators[i];
61707
+ ret.useDecorators = true;
61669
61708
  }
61670
61709
  }
61671
61710
  if (this.environment.usePartial) {
@@ -61926,22 +61965,25 @@ var require_javascript_compiler = __commonJS({
61926
61965
  }
61927
61966
  this.resolvePath("data", parts, 0, true, strict);
61928
61967
  },
61929
- resolvePath: function resolvePath(type, parts, i, falsy, strict) {
61968
+ resolvePath: function resolvePath(type, parts, startPartIndex, falsy, strict) {
61930
61969
  var _this2 = this;
61931
61970
  if (this.options.strict || this.options.assumeObjects) {
61932
- this.push(strictLookup(this.options.strict && strict, this, parts, i, type));
61971
+ this.push(strictLookup(this.options.strict && strict, this, parts, startPartIndex, type));
61933
61972
  return;
61934
61973
  }
61935
61974
  var len = parts.length;
61936
- for (; i < len; i++) {
61937
- this.replaceStack(function(current) {
61938
- var lookup = _this2.nameLookup(current, parts[i], type);
61975
+ var _loop = function(i2) {
61976
+ _this2.replaceStack(function(current) {
61977
+ var lookup = _this2.nameLookup(current, parts[i2], type);
61939
61978
  if (!falsy) {
61940
61979
  return [" != null ? ", lookup, " : ", current];
61941
61980
  } else {
61942
61981
  return [" && ", lookup];
61943
61982
  }
61944
61983
  });
61984
+ };
61985
+ for (var i = startPartIndex; i < len; i++) {
61986
+ _loop(i);
61945
61987
  }
61946
61988
  },
61947
61989
  // [resolvePossibleLambda]
@@ -62045,7 +62087,9 @@ var require_javascript_compiler = __commonJS({
62045
62087
  // and inserts the decorator into the decorators list.
62046
62088
  registerDecorator: function registerDecorator(paramSize, name) {
62047
62089
  var foundDecorator = this.nameLookup("decorators", name, "decorator"), options = this.setupHelperArgs(name, paramSize);
62048
- this.decorators.push(["fn = ", this.decorators.functionCall(foundDecorator, "", ["fn", "props", "container", options]), " || fn;"]);
62090
+ this.decorators.push(["var decorator = ", foundDecorator, ";"]);
62091
+ this.decorators.push(['if (typeof decorator !== "function") { throw new Error(', this.quotedString('Missing decorator: "' + name + '"'), "); }"]);
62092
+ this.decorators.push(["fn = ", this.decorators.functionCall("decorator", "", ["fn", "props", "container", options]), " || fn;"]);
62049
62093
  },
62050
62094
  // [invokeHelper]
62051
62095
  //
@@ -62192,8 +62236,7 @@ var require_javascript_compiler = __commonJS({
62192
62236
  compiler = new this.compiler();
62193
62237
  var existing = this.matchExistingProgram(child);
62194
62238
  if (existing == null) {
62195
- this.context.programs.push("");
62196
- var index = this.context.programs.length;
62239
+ var index = this.context.programs.push("") - 1;
62197
62240
  child.index = index;
62198
62241
  child.name = "program" + index;
62199
62242
  this.context.programs[index] = compiler.compile(child, options, this.context, !this.precompile);
@@ -62437,16 +62480,16 @@ var require_javascript_compiler = __commonJS({
62437
62480
  JavaScriptCompiler.isValidJavaScriptVariableName = function(name) {
62438
62481
  return !JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name);
62439
62482
  };
62440
- function strictLookup(requireTerminal, compiler, parts, i, type) {
62483
+ function strictLookup(requireTerminal, compiler, parts, startPartIndex, type) {
62441
62484
  var stack = compiler.popStack(), len = parts.length;
62442
62485
  if (requireTerminal) {
62443
62486
  len--;
62444
62487
  }
62445
- for (; i < len; i++) {
62488
+ for (var i = startPartIndex; i < len; i++) {
62446
62489
  stack = compiler.nameLookup(stack, parts[i], type);
62447
62490
  }
62448
62491
  if (requireTerminal) {
62449
- return [compiler.aliasable("container.strict"), "(", stack, ", ", compiler.quotedString(parts[i]), ", ", JSON.stringify(compiler.source.currentLocation), " )"];
62492
+ return [compiler.aliasable("container.strict"), "(", stack, ", ", compiler.quotedString(parts[len]), ", ", JSON.stringify(compiler.source.currentLocation), " )"];
62450
62493
  } else {
62451
62494
  return stack;
62452
62495
  }
@@ -62747,7 +62790,7 @@ var id_default = ID;
62747
62790
  // lib/constants.ts
62748
62791
  var SDK_TITLE = "Appwrite";
62749
62792
  var SDK_TITLE_LOWER = "appwrite";
62750
- var SDK_VERSION = "17.0.0";
62793
+ var SDK_VERSION = "17.2.1";
62751
62794
  var SDK_LOGO = "\n _ _ _ ___ __ _____\n /_\\ _ __ _ ____ ___ __(_) |_ ___ / __\\ / / \\_ \\\n //_\\\\| '_ \\| '_ \\ \\ /\\ / / '__| | __/ _ \\ / / / / / /\\/\n / _ \\ |_) | |_) \\ V V /| | | | || __/ / /___/ /___/\\/ /_\n \\_/ \\_/ .__/| .__/ \\_/\\_/ |_| |_|\\__\\___| \\____/\\____/\\____/\n |_| |_|\n\n";
62752
62795
  var EXECUTABLE_NAME = "appwrite";
62753
62796
  var NPM_PACKAGE_NAME = "appwrite-cli";
@@ -100294,7 +100337,7 @@ var package_default = {
100294
100337
  type: "module",
100295
100338
  homepage: "https://appwrite.io/support",
100296
100339
  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",
100297
- version: "17.0.0",
100340
+ version: "17.2.1",
100298
100341
  license: "BSD-3-Clause",
100299
100342
  main: "dist/index.cjs",
100300
100343
  module: "dist/index.js",
@@ -100384,16 +100427,36 @@ var package_default = {
100384
100427
 
100385
100428
  // lib/parser.ts
100386
100429
  var import_os2 = __toESM(require("os"), 1);
100430
+ BigInt.prototype.toJSON = function() {
100431
+ return this.toString();
100432
+ };
100387
100433
  var { description } = package_default;
100388
100434
  var cliConfig = {
100389
100435
  verbose: false,
100390
100436
  json: false,
100437
+ raw: false,
100438
+ showSecrets: false,
100391
100439
  force: false,
100392
100440
  all: false,
100393
100441
  ids: [],
100394
100442
  report: false,
100395
- reportData: {}
100443
+ reportData: {},
100444
+ displayFields: []
100396
100445
  };
100446
+ var HIDDEN_VALUE = "[hidden]";
100447
+ var SENSITIVE_KEYS = /* @__PURE__ */ new Set([
100448
+ "secret",
100449
+ "apikey",
100450
+ "accesstoken",
100451
+ "refreshtoken",
100452
+ "password",
100453
+ "jwt",
100454
+ "clientsecret",
100455
+ "secretkey",
100456
+ "sessionsecret"
100457
+ ]);
100458
+ var renderDepth = 0;
100459
+ var redactionApplied = false;
100397
100460
  var toJsonObject = (value) => {
100398
100461
  if (value && typeof value === "object" && !Array.isArray(value)) {
100399
100462
  return value;
@@ -100410,60 +100473,200 @@ var extractReportCommandArgs = (value) => {
100410
100473
  }
100411
100474
  return reportData.data.args;
100412
100475
  };
100413
- var drawTable = (data) => {
100414
- if (data.length == 0) {
100415
- console.log("[]");
100416
- return;
100476
+ var beginRender = () => {
100477
+ if (renderDepth === 0) {
100478
+ redactionApplied = false;
100417
100479
  }
100418
- const rows = data.map((item) => toJsonObject(item) ?? {});
100419
- const obj = rows.reduce((res, item) => ({ ...res, ...item }), {});
100420
- const keys = Object.keys(obj);
100421
- if (keys.length === 0) {
100422
- drawJSON(data);
100423
- return;
100480
+ renderDepth++;
100481
+ };
100482
+ var endRender = () => {
100483
+ renderDepth = Math.max(0, renderDepth - 1);
100484
+ if (renderDepth === 0 && redactionApplied && !cliConfig.showSecrets) {
100485
+ const message = "Sensitive values were redacted. Pass --show-secrets to display them.";
100486
+ if (cliConfig.json || cliConfig.raw) {
100487
+ console.error(`${import_chalk2.default.cyan.bold("\u2665 Hint:")} ${import_chalk2.default.cyan(message)}`);
100488
+ } else {
100489
+ hint(message);
100490
+ }
100491
+ }
100492
+ };
100493
+ var withRender = (callback) => {
100494
+ beginRender();
100495
+ try {
100496
+ return callback();
100497
+ } finally {
100498
+ endRender();
100424
100499
  }
100425
- const def = keys.reduce((result, key) => {
100426
- result[key] = "-";
100500
+ };
100501
+ var isSensitiveKey = (key) => {
100502
+ const normalizedKey = key.toLowerCase().replace(/[^a-z0-9]/g, "");
100503
+ return SENSITIVE_KEYS.has(normalizedKey);
100504
+ };
100505
+ var maskSensitiveString = (value) => {
100506
+ if (value.length <= 16) {
100507
+ return HIDDEN_VALUE;
100508
+ }
100509
+ const separatorIndex = value.indexOf("_");
100510
+ if (separatorIndex > 0 && separatorIndex < value.length - 9) {
100511
+ const prefix = value.slice(0, separatorIndex + 1);
100512
+ const tail = value.slice(-4);
100513
+ return `${prefix}${HIDDEN_VALUE}${tail}`;
100514
+ }
100515
+ return `${HIDDEN_VALUE}${value.slice(-4)}`;
100516
+ };
100517
+ var maskSensitiveData = (value, key) => {
100518
+ if (key && isSensitiveKey(key) && !cliConfig.showSecrets) {
100519
+ redactionApplied = true;
100520
+ if (typeof value === "string") {
100521
+ return maskSensitiveString(value);
100522
+ }
100523
+ if (value == null) {
100524
+ return value;
100525
+ }
100526
+ return HIDDEN_VALUE;
100527
+ }
100528
+ if (Array.isArray(value)) {
100529
+ return value.map((item) => maskSensitiveData(item));
100530
+ }
100531
+ if (value && typeof value === "object") {
100532
+ if (value?.constructor?.name === "BigNumber") {
100533
+ return String(value);
100534
+ }
100535
+ const result = {};
100536
+ for (const childKey of Object.keys(value)) {
100537
+ const childValue = value[childKey];
100538
+ if (typeof childValue === "function") continue;
100539
+ result[childKey] = maskSensitiveData(childValue, childKey);
100540
+ }
100427
100541
  return result;
100428
- }, {});
100429
- const normalizedData = rows.map((item) => ({ ...def, ...item }));
100430
- const columns = Object.keys(normalizedData[0]);
100431
- const table = new import_cli_table3.default({
100432
- head: columns.map((c) => import_chalk2.default.cyan.italic.bold(c)),
100433
- chars: {
100434
- top: " ",
100435
- "top-mid": " ",
100436
- "top-left": " ",
100437
- "top-right": " ",
100438
- bottom: " ",
100439
- "bottom-mid": " ",
100440
- "bottom-left": " ",
100441
- "bottom-right": " ",
100442
- left: " ",
100443
- "left-mid": " ",
100444
- mid: import_chalk2.default.cyan("\u2500"),
100445
- "mid-mid": import_chalk2.default.cyan("\u253C"),
100446
- right: " ",
100447
- "right-mid": " ",
100448
- middle: import_chalk2.default.cyan("\u2502")
100542
+ }
100543
+ return value;
100544
+ };
100545
+ var applyDisplayFilter = (rows) => {
100546
+ if (cliConfig.displayFields.length === 0) {
100547
+ return rows;
100548
+ }
100549
+ return rows.map((row) => {
100550
+ const filtered = {};
100551
+ for (const key of cliConfig.displayFields) {
100552
+ if (Object.prototype.hasOwnProperty.call(row, key)) {
100553
+ filtered[key] = row[key];
100554
+ }
100449
100555
  }
100556
+ return Object.keys(filtered).length > 0 ? filtered : row;
100450
100557
  });
100451
- normalizedData.forEach((row) => {
100452
- const rowValues = [];
100453
- for (const key of columns) {
100454
- if (row[key] == null) {
100455
- rowValues.push("-");
100456
- } else if (Array.isArray(row[key])) {
100457
- rowValues.push(JSON.stringify(row[key]));
100458
- } else if (typeof row[key] === "object") {
100459
- rowValues.push(JSON.stringify(row[key]));
100460
- } else {
100461
- rowValues.push(String(row[key]));
100558
+ };
100559
+ var MAX_COL_WIDTH = 40;
100560
+ var formatCellValue = (value) => {
100561
+ if (value == null) return "-";
100562
+ if (Array.isArray(value)) {
100563
+ if (value.length === 0) return "[]";
100564
+ return `[${value.length} items]`;
100565
+ }
100566
+ if (typeof value === "object") {
100567
+ if (value?.constructor?.name === "BigNumber") return String(value);
100568
+ const keys = Object.keys(value);
100569
+ if (keys.length === 0) return "{}";
100570
+ return `{${keys.length} keys}`;
100571
+ }
100572
+ const str = String(value);
100573
+ if (str.length > MAX_COL_WIDTH) {
100574
+ return str.slice(0, MAX_COL_WIDTH - 1) + "\u2026";
100575
+ }
100576
+ return str;
100577
+ };
100578
+ var drawTable = (data) => {
100579
+ withRender(() => {
100580
+ if (data.length == 0) {
100581
+ console.log("[]");
100582
+ return;
100583
+ }
100584
+ const rows = applyDisplayFilter(
100585
+ data.map((item) => {
100586
+ const maskedItem = maskSensitiveData(item);
100587
+ return toJsonObject(maskedItem) ?? {};
100588
+ })
100589
+ );
100590
+ const obj = rows.reduce((res, item) => ({ ...res, ...item }), {});
100591
+ const allKeys = Object.keys(obj);
100592
+ if (allKeys.length === 0) {
100593
+ drawJSON(data);
100594
+ return;
100595
+ }
100596
+ const maxColumns = 6;
100597
+ if (allKeys.length > maxColumns) {
100598
+ const rowEntries = rows.map((row) => {
100599
+ const entries = [];
100600
+ for (const key of Object.keys(row)) {
100601
+ const value = row[key];
100602
+ if (typeof value === "function") continue;
100603
+ if (value == null) continue;
100604
+ if (value?.constructor?.name === "BigNumber") {
100605
+ entries.push([key, String(value)]);
100606
+ continue;
100607
+ }
100608
+ if (typeof value === "object") continue;
100609
+ if (typeof value === "string" && value.trim() === "") continue;
100610
+ entries.push([key, String(value)]);
100611
+ }
100612
+ return entries;
100613
+ });
100614
+ const flatEntries = rowEntries.flat();
100615
+ if (flatEntries.length === 0) {
100616
+ drawJSON(data);
100617
+ return;
100462
100618
  }
100619
+ const maxKeyLen = Math.max(...flatEntries.map(([key]) => key.length));
100620
+ const separatorLen = Math.min(
100621
+ maxKeyLen + 2 + MAX_COL_WIDTH,
100622
+ process.stdout.columns || 80
100623
+ );
100624
+ rowEntries.forEach((entries, idx) => {
100625
+ if (idx > 0) console.log(import_chalk2.default.cyan("\u2500".repeat(separatorLen)));
100626
+ for (const [key, value] of entries) {
100627
+ const paddedKey = key.padEnd(maxKeyLen);
100628
+ console.log(`${import_chalk2.default.yellow.bold(paddedKey)} ${value}`);
100629
+ }
100630
+ });
100631
+ return;
100463
100632
  }
100464
- table.push(rowValues);
100633
+ const columns = allKeys;
100634
+ const def = allKeys.reduce((result, key) => {
100635
+ result[key] = "-";
100636
+ return result;
100637
+ }, {});
100638
+ const normalizedData = rows.map((item) => ({ ...def, ...item }));
100639
+ const table = new import_cli_table3.default({
100640
+ head: columns.map((c) => import_chalk2.default.cyan.italic.bold(c)),
100641
+ colWidths: columns.map(() => null),
100642
+ wordWrap: false,
100643
+ chars: {
100644
+ "top": " ",
100645
+ "top-mid": " ",
100646
+ "top-left": " ",
100647
+ "top-right": " ",
100648
+ "bottom": " ",
100649
+ "bottom-mid": " ",
100650
+ "bottom-left": " ",
100651
+ "bottom-right": " ",
100652
+ "left": " ",
100653
+ "left-mid": " ",
100654
+ "mid": import_chalk2.default.cyan("\u2500"),
100655
+ "mid-mid": import_chalk2.default.cyan("\u253C"),
100656
+ "right": " ",
100657
+ "right-mid": " ",
100658
+ "middle": import_chalk2.default.cyan("\u2502")
100659
+ }
100660
+ });
100661
+ normalizedData.forEach((row) => {
100662
+ const rowValues = [];
100663
+ for (const key of columns) {
100664
+ rowValues.push(formatCellValue(row[key]));
100665
+ }
100666
+ table.push(rowValues);
100667
+ });
100668
+ console.log(table.toString());
100465
100669
  });
100466
- console.log(table.toString());
100467
100670
  };
100468
100671
  var drawJSON = (data) => {
100469
100672
  console.log(JSON.stringify(data, null, 2));
@@ -100565,7 +100768,7 @@ var commandDescriptions = {
100565
100768
  avatars: `The avatars command aims to help you complete everyday tasks related to your app image, icons, and avatars.`,
100566
100769
  databases: `(Legacy) The databases command allows you to create structured collections of documents and query and filter lists of documents.`,
100567
100770
  "tables-db": `The tables-db command allows you to create structured tables of columns and query and filter lists of rows.`,
100568
- init: `The init command provides a convenient wrapper for creating and initializing projects, functions, collections, buckets, teams, and messaging-topics in ${SDK_TITLE}.`,
100771
+ 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}.`,
100569
100772
  push: `The push command provides a convenient wrapper for pushing your functions, collections, buckets, teams, and messaging-topics.`,
100570
100773
  run: `The run command allows you to run the project locally to allow easy development and quick debugging.`,
100571
100774
  functions: `The functions command allows you to view, create, and manage your Cloud Functions.`,
@@ -100575,7 +100778,7 @@ var commandDescriptions = {
100575
100778
  locale: `The locale command allows you to customize your app based on your users' location.`,
100576
100779
  sites: `The sites command allows you to view, create and manage your Appwrite Sites.`,
100577
100780
  storage: `The storage command allows you to manage your project files.`,
100578
- 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.`,
100781
+ 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.`,
100579
100782
  update: `The update command allows you to update the ${SDK_TITLE} CLI to the latest version.`,
100580
100783
  users: `The users command allows you to manage your project users.`,
100581
100784
  projects: `The projects command allows you to manage your projects, add platforms, manage API keys, Dev Keys etc.`,
@@ -100910,14 +101113,14 @@ var questionsInitProject = [
100910
101113
  name: "project",
100911
101114
  message: "What would you like to name your project?",
100912
101115
  default: "My Awesome Project",
100913
- when: (answer) => answer.start !== "existing"
101116
+ when: (answer) => whenOverride(answer) && answer.start !== "existing"
100914
101117
  },
100915
101118
  {
100916
101119
  type: "input",
100917
101120
  name: "id",
100918
101121
  message: "What ID would you like to have for your project?",
100919
101122
  default: "unique()",
100920
- when: (answer) => answer.start !== "existing"
101123
+ when: (answer) => whenOverride(answer) && answer.start !== "existing"
100921
101124
  },
100922
101125
  {
100923
101126
  type: "search-list",
@@ -100978,6 +101181,7 @@ var questionsInitProject = [
100978
101181
  }));
100979
101182
  },
100980
101183
  when: (answer) => {
101184
+ if (!whenOverride(answer)) return false;
100981
101185
  if (answer.start === "existing") return false;
100982
101186
  return isCloud();
100983
101187
  }