appwrite-cli 22.2.2 → 22.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.cjs CHANGED
@@ -86539,7 +86539,7 @@ var package_default = {
86539
86539
  type: "module",
86540
86540
  homepage: "https://appwrite.io/support",
86541
86541
  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",
86542
- version: "22.2.2",
86542
+ version: "22.4.0",
86543
86543
  license: "BSD-3-Clause",
86544
86544
  main: "dist/index.cjs",
86545
86545
  module: "dist/index.js",
@@ -101271,7 +101271,7 @@ var validateCrossDatabase = (data, ctx) => {
101271
101271
  // lib/constants.ts
101272
101272
  var SDK_TITLE = "Appwrite";
101273
101273
  var SDK_TITLE_LOWER = "appwrite";
101274
- var SDK_VERSION = "22.2.2";
101274
+ var SDK_VERSION = "22.4.0";
101275
101275
  var SDK_NAME = "Command Line";
101276
101276
  var SDK_PLATFORM = "console";
101277
101277
  var SDK_LANGUAGE = "cli";
@@ -101286,7 +101286,7 @@ var GITHUB_REPO = "appwrite/sdk-for-cli";
101286
101286
  var GITHUB_RELEASES_URL = `https://github.com/${GITHUB_REPO}/releases`;
101287
101287
  var DEFAULT_ENDPOINT = "https://cloud.appwrite.io/v1";
101288
101288
  var OAUTH2_CLIENT_ID = "appwrite-cli";
101289
- var OAUTH2_SCOPES = "openid email profile account.admin";
101289
+ var OAUTH2_SCOPES = "openid email profile all";
101290
101290
  var CONFIG_RESOURCE_KEYS = [
101291
101291
  "databases",
101292
101292
  "functions",
@@ -101383,9 +101383,9 @@ var SettingsSchema = external_exports.object({
101383
101383
  }).strict().optional(),
101384
101384
  security: external_exports.object({
101385
101385
  duration: external_exports.union([external_exports.number(), external_exports.bigint()]).optional(),
101386
- limit: external_exports.union([external_exports.number(), external_exports.bigint()]).optional(),
101387
- sessionsLimit: external_exports.union([external_exports.number(), external_exports.bigint()]).optional(),
101388
- passwordHistory: external_exports.union([external_exports.number(), external_exports.bigint()]).optional(),
101386
+ limit: external_exports.union([external_exports.number(), external_exports.bigint()]).nullable().optional(),
101387
+ sessionsLimit: external_exports.union([external_exports.number(), external_exports.bigint()]).nullable().optional(),
101388
+ passwordHistory: external_exports.union([external_exports.number(), external_exports.bigint()]).nullable().optional(),
101389
101389
  passwordDictionary: external_exports.boolean().optional(),
101390
101390
  personalDataCheck: external_exports.boolean().optional(),
101391
101391
  sessionAlerts: external_exports.boolean().optional(),
@@ -131622,7 +131622,10 @@ var createSettingsObject = (project2, policies, mockNumbers) => {
131622
131622
  }
131623
131623
  const policyTotal = (id) => {
131624
131624
  const policy = policyById.get(id);
131625
- return policy && "total" in policy ? policy.total : void 0;
131625
+ if (!policy || !("total" in policy)) {
131626
+ return void 0;
131627
+ }
131628
+ return policy.total === 0 ? null : policy.total;
131626
131629
  };
131627
131630
  const policyEnabled = (id) => {
131628
131631
  const policy = policyById.get(id);
@@ -131690,7 +131693,15 @@ var siteRequiresBuildCommand = (site) => {
131690
131693
  };
131691
131694
  var getErrorMessage = (error52) => {
131692
131695
  if (error52 instanceof Error) {
131693
- return error52.message;
131696
+ const message = typeof error52.message === "string" ? error52.message.trim() : "";
131697
+ if (message) {
131698
+ return message;
131699
+ }
131700
+ const response = error52.response;
131701
+ if (typeof response === "string" && response.trim() !== "") {
131702
+ return response.trim();
131703
+ }
131704
+ return "An unknown error occurred.";
131694
131705
  }
131695
131706
  return String(error52);
131696
131707
  };
@@ -131857,8 +131868,40 @@ var isRegionalCloudEndpoint = (endpoint) => {
131857
131868
  return false;
131858
131869
  }
131859
131870
  };
131871
+ var getCloudEndpointRegion = (endpoint) => {
131872
+ try {
131873
+ const hostname3 = new URL(endpoint).hostname;
131874
+ if (!isCloudHostname(hostname3) || hostname3 === "cloud.appwrite.io") {
131875
+ return null;
131876
+ }
131877
+ const region = hostname3.split(".")[0];
131878
+ return CLOUD_REGION_CODES.has(region) ? region : null;
131879
+ } catch (_error) {
131880
+ return null;
131881
+ }
131882
+ };
131860
131883
  var isLocalhostHostname = (hostname3) => hostname3 === "localhost" || hostname3 === "127.0.0.1" || hostname3 === "[::1]";
131861
131884
  var isCloudEnvironmentHostname = (hostname3) => hostname3.endsWith(".cloud.appwrite.io") && CLOUD_LOGIN_ENVIRONMENTS.has(hostname3.split(".")[0]);
131885
+ var getCloudConsoleHostname = (hostname3) => {
131886
+ if (hostname3 === "cloud.appwrite.io") {
131887
+ return hostname3;
131888
+ }
131889
+ const labels = hostname3.split(".");
131890
+ if (labels.length < 4 || labels.slice(-3).join(".") !== "cloud.appwrite.io") {
131891
+ return null;
131892
+ }
131893
+ if (CLOUD_REGION_CODES.has(labels[0])) {
131894
+ const environment = labels[1];
131895
+ if (environment && CLOUD_LOGIN_ENVIRONMENTS.has(environment)) {
131896
+ return `${environment}.cloud.appwrite.io`;
131897
+ }
131898
+ return "cloud.appwrite.io";
131899
+ }
131900
+ if (CLOUD_LOGIN_ENVIRONMENTS.has(labels[0])) {
131901
+ return hostname3;
131902
+ }
131903
+ return null;
131904
+ };
131862
131905
  var isCloudLoginEndpoint = (endpoint) => {
131863
131906
  try {
131864
131907
  const hostname3 = new URL(endpoint).hostname;
@@ -131870,8 +131913,9 @@ var isCloudLoginEndpoint = (endpoint) => {
131870
131913
  var getConsoleBaseUrl = (endpoint) => {
131871
131914
  try {
131872
131915
  const url2 = new URL(endpoint);
131873
- if (isCloudHostname(url2.hostname)) {
131874
- url2.hostname = "cloud.appwrite.io";
131916
+ const consoleHostname = getCloudConsoleHostname(url2.hostname);
131917
+ if (consoleHostname) {
131918
+ url2.hostname = consoleHostname;
131875
131919
  }
131876
131920
  url2.pathname = url2.pathname.replace(/\/v1\/?$/, "");
131877
131921
  url2.search = "";
@@ -132182,7 +132226,7 @@ function isCloud() {
132182
132226
  const hostname3 = new URL(endpoint).hostname;
132183
132227
  return hostname3.endsWith("appwrite.io");
132184
132228
  }
132185
- var SKILLS_REPO = "https://github.com/appwrite/agent-skills";
132229
+ var SKILLS_REPO = "https://github.com/appwrite/skills";
132186
132230
  var LANGUAGE_MARKERS = {
132187
132231
  typescript: [
132188
132232
  "package.json",
@@ -132745,10 +132789,7 @@ var Config = class {
132745
132789
  }
132746
132790
  _addDBEntity(entityType, props, keysSet, nestedKeys = {}) {
132747
132791
  props = whitelistKeys(props, keysSet, nestedKeys);
132748
- if (!this.has(entityType)) {
132749
- this.set(entityType, []);
132750
- }
132751
- const entities = this.get(entityType);
132792
+ const entities = this.has(entityType) ? [...this.get(entityType) ?? []] : [];
132752
132793
  for (let i = 0; i < entities.length; i++) {
132753
132794
  if (entities[i]["$id"] == props["$id"]) {
132754
132795
  entities[i] = props;
@@ -134476,6 +134517,53 @@ var printQueryErrorHint = (err) => {
134476
134517
  `For common list filters, use flags like --limit 25, --sort-desc '$createdAt', or --filter 'status=active'. Raw --queries values must be Appwrite JSON query strings, for example: ${EXECUTABLE_NAME} tables-db list-rows --queries '{"method":"limit","values":[25]}'`
134477
134518
  );
134478
134519
  };
134520
+ var ERROR_DETAIL_KEYS = ["code", "type", "response"];
134521
+ var ERROR_DETAIL_INDENT = " ";
134522
+ var ERROR_DETAIL_LABEL_WIDTH = Math.max(...ERROR_DETAIL_KEYS.map((key) => key.length)) + 2;
134523
+ var formatErrorDetail = (value) => {
134524
+ if (typeof value === "string") {
134525
+ const text = value;
134526
+ try {
134527
+ const parsed = JSON.parse(text);
134528
+ if (parsed && typeof parsed === "object") {
134529
+ value = parsed;
134530
+ }
134531
+ } catch {
134532
+ return text;
134533
+ }
134534
+ }
134535
+ try {
134536
+ const json2 = JSON.stringify(value, null, 2) ?? String(value);
134537
+ return json2.split("\n").map((line, index) => index === 0 ? line : ERROR_DETAIL_INDENT + line).join("\n");
134538
+ } catch {
134539
+ return String(value);
134540
+ }
134541
+ };
134542
+ var formatErrorForLog = (err) => {
134543
+ const lines = [
134544
+ `${import_chalk2.default.red.bold(err.name || "Error")}${import_chalk2.default.red(`: ${getErrorMessage(err)}`)}`
134545
+ ];
134546
+ for (const key of ERROR_DETAIL_KEYS) {
134547
+ if (!Object.prototype.hasOwnProperty.call(err, key)) {
134548
+ continue;
134549
+ }
134550
+ const value = err[key];
134551
+ lines.push(
134552
+ `${ERROR_DETAIL_INDENT}${import_chalk2.default.cyan(`${key}:`.padEnd(ERROR_DETAIL_LABEL_WIDTH))}${formatErrorDetail(value)}`
134553
+ );
134554
+ }
134555
+ const frames = (err.stack ?? "").split("\n").filter((line) => line.trim().startsWith("at "));
134556
+ if (frames.length > 0) {
134557
+ lines.push(
134558
+ "",
134559
+ import_chalk2.default.dim(`${ERROR_DETAIL_INDENT}Stack trace:`),
134560
+ ...frames.map(
134561
+ (frame) => import_chalk2.default.dim(`${ERROR_DETAIL_INDENT.repeat(2)}${frame.trim()}`)
134562
+ )
134563
+ );
134564
+ }
134565
+ return lines.join("\n");
134566
+ };
134479
134567
  var parseError = (err) => {
134480
134568
  if (cliConfig.report) {
134481
134569
  void (async () => {
@@ -134505,7 +134593,7 @@ Is Cloud: ${isCloud()}`;
134505
134593
  githubIssueUrl.searchParams.append("template", "bug.yaml");
134506
134594
  githubIssueUrl.searchParams.append(
134507
134595
  "title",
134508
- `\u{1F41B} Bug Report: ${err.message}`
134596
+ `\u{1F41B} Bug Report: ${getErrorMessage(err)}`
134509
134597
  );
134510
134598
  githubIssueUrl.searchParams.append(
134511
134599
  "actual-behavior",
@@ -134526,16 +134614,16 @@ ${stack}`
134526
134614
  );
134527
134615
  printQueryErrorHint(err);
134528
134616
  error51("\n Stack Trace: \n");
134529
- console.error(err);
134617
+ console.error(formatErrorForLog(err));
134530
134618
  process.exit(1);
134531
134619
  })();
134532
134620
  } else {
134533
134621
  if (cliConfig.verbose) {
134534
- console.error(err);
134622
+ console.error(formatErrorForLog(err));
134535
134623
  printQueryErrorHint(err);
134536
134624
  } else {
134537
134625
  log("For detailed error pass the --verbose or --report flag");
134538
- error51(err.message);
134626
+ error51(getErrorMessage(err));
134539
134627
  printQueryErrorHint(err);
134540
134628
  }
134541
134629
  process.exit(1);
@@ -134604,7 +134692,7 @@ var commandDescriptions = {
134604
134692
  avatars: `The avatars command aims to help you complete everyday tasks related to your app image, icons, and avatars.`,
134605
134693
  databases: `(Legacy) The databases command allows you to create structured collections of documents and query and filter lists of documents.`,
134606
134694
  "tables-db": `The tables-db command allows you to create structured tables of columns and query and filter lists of rows.`,
134607
- 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}.`,
134695
+ init: `The init command provides a convenient wrapper for creating and initializing projects, functions, collections, buckets, teams, messaging-topics, and skills in ${SDK_TITLE}.`,
134608
134696
  push: `The push command provides a convenient wrapper for pushing your functions, collections, buckets, teams, and messaging-topics.`,
134609
134697
  run: `The run command allows you to run the project locally to allow easy development and quick debugging.`,
134610
134698
  functions: `The functions command allows you to view, create, and manage your Cloud Functions.`,
@@ -135164,12 +135252,12 @@ var deleteStoredRefreshToken = (sessionId) => {
135164
135252
  };
135165
135253
 
135166
135254
  // lib/sdks.ts
135167
- var getValidAccessToken = async (endpoint) => {
135255
+ var getValidAccessToken = async (endpoint, options = {}) => {
135168
135256
  const accessToken = globalConfig2.getAccessToken();
135169
135257
  const tokenExpiry = globalConfig2.getTokenExpiry();
135170
135258
  const clientId = globalConfig2.getClientId() || OAUTH2_CLIENT_ID;
135171
135259
  const currentSession = globalConfig2.getCurrentSession();
135172
- if (accessToken && tokenExpiry > Date.now() + 6e4) {
135260
+ if (!options.forceRefresh && accessToken && tokenExpiry > Date.now() + 6e4) {
135173
135261
  return accessToken;
135174
135262
  }
135175
135263
  const refreshToken = currentSession ? getStoredRefreshToken(currentSession) : "";
@@ -136960,7 +137048,7 @@ var deleteServerSession = async (sessionId) => {
136960
137048
  } catch (e) {
136961
137049
  return {
136962
137050
  deleted: false,
136963
- error: e instanceof Error ? e.message : String(e)
137051
+ error: getErrorMessage(e)
136964
137052
  };
136965
137053
  }
136966
137054
  };
@@ -137097,6 +137185,16 @@ var getCurrentAccount = async () => {
137097
137185
  return account2;
137098
137186
  } catch (err) {
137099
137187
  if (isGuestUnauthorizedError(err)) {
137188
+ try {
137189
+ await getValidAccessToken(globalConfig2.getEndpoint(), {
137190
+ forceRefresh: true
137191
+ });
137192
+ const refreshedClient = await sdkForConsole();
137193
+ const refreshedAccount = await new Account(refreshedClient).get();
137194
+ globalConfig2.setEmail(refreshedAccount.email);
137195
+ return refreshedAccount;
137196
+ } catch (_refreshError) {
137197
+ }
137100
137198
  removeCurrentSession();
137101
137199
  }
137102
137200
  return null;
@@ -137500,10 +137598,8 @@ var logout = new Command("logout").description(commandDescriptions["logout"]).co
137500
137598
  } else if (remainingSessions.length > 0) {
137501
137599
  const nextSession = remainingSessions.find((session) => session.email) ?? remainingSessions[0];
137502
137600
  globalConfig2.setCurrentSession(nextSession.id);
137503
- if (!logoutFailed) {
137504
- success2(
137505
- nextSession.email ? `Switched to ${nextSession.email}` : `Switched to session at ${nextSession.endpoint}`
137506
- );
137601
+ if (!logoutFailed && nextSession.email) {
137602
+ success2(`Switched to ${nextSession.email}`);
137507
137603
  }
137508
137604
  } else if (remainingSessions.length === 0) {
137509
137605
  globalConfig2.setCurrentSession("");
@@ -141141,7 +141237,7 @@ async function downloadDeploymentCode(params) {
141141
141237
  }
141142
141238
  } catch (e) {
141143
141239
  if (e instanceof AppwriteException) {
141144
- error51(e.message);
141240
+ error51(getErrorMessage(e));
141145
141241
  return;
141146
141242
  } else {
141147
141243
  throw e;
@@ -142185,6 +142281,11 @@ var getExistingProjectSummary = async (organizationId, projectId) => {
142185
142281
  region: project2.region || ""
142186
142282
  };
142187
142283
  };
142284
+ var getRegionalCloudEndpoint = (region) => {
142285
+ const url2 = new URL(globalConfig2.getEndpoint() || DEFAULT_ENDPOINT);
142286
+ url2.hostname = `${region}.${url2.hostname}`;
142287
+ return url2.toString().replace(/\/$/, "");
142288
+ };
142188
142289
  var printInitProjectSuccess = (message) => {
142189
142290
  console.log(`${import_chalk9.default.green.bold("\u2713")} ${import_chalk9.default.green(message)}`);
142190
142291
  };
@@ -142283,7 +142384,7 @@ var installInitProjectSkills = async () => {
142283
142384
  }
142284
142385
  } catch (e) {
142285
142386
  const msg = e instanceof Error ? e.message : String(e);
142286
- error51(`Failed to install agent skills: ${msg}`);
142387
+ error51(`Failed to install skills: ${msg}`);
142287
142388
  hint(`You can install them later with '${EXECUTABLE_NAME} init skill'.`);
142288
142389
  }
142289
142390
  };
@@ -142371,7 +142472,6 @@ var initProject = async ({
142371
142472
  );
142372
142473
  }
142373
142474
  localConfig.clear();
142374
- const url2 = new URL(DEFAULT_ENDPOINT);
142375
142475
  if (answers.start === "new") {
142376
142476
  let projectIdToCreate;
142377
142477
  let projectNameToCreate;
@@ -142402,9 +142502,7 @@ var initProject = async ({
142402
142502
  localConfig.setProject(response["$id"], response.name ?? "");
142403
142503
  localConfig.setOrganizationId(answers.organization);
142404
142504
  if (answers.region) {
142405
- localConfig.setEndpoint(
142406
- `https://${answers.region}.${url2.host}${url2.pathname}`
142407
- );
142505
+ localConfig.setEndpoint(getRegionalCloudEndpoint(answers.region));
142408
142506
  }
142409
142507
  } else {
142410
142508
  let selectedProject;
@@ -142422,9 +142520,7 @@ var initProject = async ({
142422
142520
  localConfig.setProject(selectedProject.$id, selectedProject.name ?? "");
142423
142521
  localConfig.setOrganizationId(answers.organization);
142424
142522
  if (isCloud() && selectedProject.region) {
142425
- localConfig.setEndpoint(
142426
- `https://${selectedProject.region}.${url2.host}${url2.pathname}`
142427
- );
142523
+ localConfig.setEndpoint(getRegionalCloudEndpoint(selectedProject.region));
142428
142524
  }
142429
142525
  }
142430
142526
  let autoPulled = false;
@@ -142550,7 +142646,7 @@ var initTopic = async () => {
142550
142646
  var initSkill = async () => {
142551
142647
  process.chdir(localConfig.configDirectoryPath);
142552
142648
  const cwd = process.cwd();
142553
- log("Fetching available Appwrite agent skills ...");
142649
+ log("Fetching available Appwrite skills ...");
142554
142650
  const { skills, tempDir } = fetchAvailableSkills();
142555
142651
  try {
142556
142652
  const { selectedSkills } = await import_inquirer5.default.prompt([
@@ -142965,7 +143061,7 @@ var init = new Command("init").description(commandDescriptions["init"]).action(a
142965
143061
  init.command("project").description("Init a new Appwrite project").option("--organization-id <organization-id>", "Appwrite organization ID").option("--project-id <project-id>", "Appwrite project ID").option("--project-name <project-name>", "Appwrite project ID").action(actionRunner(initProject));
142966
143062
  init.command("function").alias("functions").description("Init a new Appwrite function").action(actionRunner(initFunction));
142967
143063
  init.command("site").alias("sites").description("Init a new Appwrite site").action(actionRunner(initSite));
142968
- init.command("skill").alias("skills").description("Install Appwrite agent skills for AI coding agents").action(actionRunner(initSkill));
143064
+ init.command("skill").alias("skills").description("Install Appwrite skills for AI coding agents").action(actionRunner(initSkill));
142969
143065
  init.command("bucket").alias("buckets").description("Init a new Appwrite bucket").action(actionRunner(initBucket));
142970
143066
  init.command("team").alias("teams").description("Init a new Appwrite team").action(actionRunner(initTeam));
142971
143067
  init.command("collection").alias("collections").description("Init a new Appwrite collection").action(actionRunner(initCollection));
@@ -147045,6 +147141,44 @@ function createDeploymentLogsController(enabled) {
147045
147141
  close: cleanup
147046
147142
  };
147047
147143
  }
147144
+ var getPushErrorMessage = (error52) => {
147145
+ if (error52 instanceof Error) {
147146
+ return error52.message;
147147
+ }
147148
+ if (typeof error52 === "object" && error52 !== null && "message" in error52 && typeof error52.message === "string") {
147149
+ return error52.message;
147150
+ }
147151
+ return String(error52);
147152
+ };
147153
+ var getPushResultErrors = (result) => {
147154
+ if (typeof result !== "object" || result === null) {
147155
+ return [];
147156
+ }
147157
+ if ("errors" in result && Array.isArray(result.errors) && result.errors.length > 0) {
147158
+ return result.errors.map(getPushErrorMessage).filter((message) => message.trim() !== "");
147159
+ }
147160
+ if ("error" in result && typeof result.error === "string" && result.error.trim() !== "") {
147161
+ return [result.error];
147162
+ }
147163
+ return [];
147164
+ };
147165
+ var formatPushResourceErrors = (results) => {
147166
+ const failed = Object.entries(results).map(([resourceGroup, result]) => ({
147167
+ resourceGroup,
147168
+ messages: getPushResultErrors(result)
147169
+ })).filter(({ messages }) => messages.length > 0);
147170
+ if (failed.length === 0) {
147171
+ return "Failed to push resource groups.";
147172
+ }
147173
+ return [
147174
+ `Failed to push ${failed.length} resource group${failed.length === 1 ? "" : "s"}:`,
147175
+ ...failed.flatMap(({ resourceGroup, messages }) => [
147176
+ `- ${resourceGroup}:`,
147177
+ ...messages.map((message) => ` - ${message}`)
147178
+ ])
147179
+ ].join("\n");
147180
+ };
147181
+ var nullablePolicyTotal = (value) => value === null || Number(value) === 0 ? null : Number(value);
147048
147182
  var normalizeIgnoreRules = (value) => {
147049
147183
  if (Array.isArray(value)) {
147050
147184
  return value.filter(
@@ -147090,6 +147224,53 @@ var Push = class {
147090
147224
  warn(message);
147091
147225
  }
147092
147226
  }
147227
+ getFunctionRuleDomain(domain2) {
147228
+ const region = getCloudEndpointRegion(this.projectClient.config.endpoint);
147229
+ if (!region) {
147230
+ return domain2;
147231
+ }
147232
+ const parts = domain2.split(".");
147233
+ if (parts.length < 3) {
147234
+ return domain2;
147235
+ }
147236
+ parts[0] = region;
147237
+ return parts.join(".");
147238
+ }
147239
+ async createDefaultFunctionRule(functionId) {
147240
+ let domain2 = "";
147241
+ try {
147242
+ const consoleService = await getConsoleService(this.consoleClient);
147243
+ const variables = await consoleService.variables();
147244
+ const domains = variables["_APP_DOMAIN_FUNCTIONS"].split(",").map((value) => value.trim()).filter((value) => value.length > 0);
147245
+ if (domains.length === 0) {
147246
+ throw new Error("_APP_DOMAIN_FUNCTIONS is not configured.");
147247
+ }
147248
+ domain2 = id_default2.unique() + "." + this.getFunctionRuleDomain(domains[0]);
147249
+ } catch (err) {
147250
+ this.error("Error fetching console variables.");
147251
+ throw err;
147252
+ }
147253
+ try {
147254
+ const proxyService = await getProxyService(this.projectClient);
147255
+ this.log(`Creating function proxy rule for ${domain2} ...`);
147256
+ await proxyService.createFunctionRule(domain2, functionId);
147257
+ } catch (err) {
147258
+ this.error("Error creating function rule.");
147259
+ throw err;
147260
+ }
147261
+ }
147262
+ async hasDefaultFunctionRule(functionId) {
147263
+ const proxyService = await getProxyService(this.projectClient);
147264
+ const { rules } = await proxyService.listRules({
147265
+ queries: [
147266
+ Query.limit(1),
147267
+ Query.equal("deploymentResourceType", "function"),
147268
+ Query.equal("deploymentResourceId", functionId),
147269
+ Query.equal("trigger", "manual")
147270
+ ]
147271
+ });
147272
+ return rules.length > 0;
147273
+ }
147093
147274
  /**
147094
147275
  * Log an error message (respects silent mode)
147095
147276
  */
@@ -147153,7 +147334,11 @@ var Push = class {
147153
147334
  results.settings = { success: true };
147154
147335
  } catch (e) {
147155
147336
  allErrors.push(e);
147156
- results.settings = { success: false, error: e.message };
147337
+ results.settings = {
147338
+ success: false,
147339
+ error: getPushErrorMessage(e),
147340
+ errors: [e]
147341
+ };
147157
147342
  }
147158
147343
  }
147159
147344
  if ((shouldPushAll || options.buckets) && config2.buckets && config2.buckets.length > 0) {
@@ -147236,10 +147421,28 @@ var Push = class {
147236
147421
  }
147237
147422
  if ((shouldPushAll || options.sites) && config2.sites && config2.sites.length > 0) {
147238
147423
  try {
147424
+ let siteOptions = options.siteOptions;
147425
+ if (siteOptions?.code === void 0) {
147426
+ let allowSitesCodePush = cliConfig.force === true ? true : null;
147427
+ if (allowSitesCodePush === null) {
147428
+ const codeAnswer = await import_inquirer8.default.prompt(questionsPushSitesCode);
147429
+ allowSitesCodePush = codeAnswer.override;
147430
+ }
147431
+ siteOptions = {
147432
+ ...siteOptions,
147433
+ code: allowSitesCodePush === true
147434
+ };
147435
+ }
147436
+ if (siteOptions.code === true && siteOptions.activate === void 0) {
147437
+ siteOptions = {
147438
+ ...siteOptions,
147439
+ activate: cliConfig.force === true ? true : (await import_inquirer8.default.prompt(questionsPushSitesActivate)).activate
147440
+ };
147441
+ }
147239
147442
  this.log("Pushing sites ...");
147240
147443
  const result = await this.pushSites(
147241
147444
  config2.sites,
147242
- options.siteOptions
147445
+ siteOptions
147243
147446
  );
147244
147447
  this.success(
147245
147448
  `Successfully pushed ${import_chalk14.default.bold(result.successfullyPushed)} sites.`
@@ -147258,6 +147461,12 @@ var Push = class {
147258
147461
  }
147259
147462
  if ((shouldPushAll || options.tables) && config2.tables && config2.tables.length > 0) {
147260
147463
  try {
147464
+ const { resyncNeeded } = await checkAndApplyTablesDBChanges();
147465
+ if (resyncNeeded) {
147466
+ throw new Error(
147467
+ "Configuration changed after applying tablesDB deletions. Re-run the push command to continue."
147468
+ );
147469
+ }
147261
147470
  this.log("Pushing tables ...");
147262
147471
  const result = await this.pushTables(config2.tables, {
147263
147472
  attempts: options.tableOptions?.attempts,
@@ -147329,46 +147538,80 @@ var Push = class {
147329
147538
  }
147330
147539
  if (settings.services) {
147331
147540
  this.log("Applying service statuses ...");
147332
- for (const [service, status] of Object.entries(settings.services)) {
147333
- await projectService.updateService({
147334
- serviceId: service,
147335
- enabled: status
147336
- });
147337
- }
147541
+ await Promise.all(
147542
+ Object.entries(settings.services).map(
147543
+ ([service, status]) => projectService.updateService({
147544
+ serviceId: service,
147545
+ enabled: status
147546
+ })
147547
+ )
147548
+ );
147338
147549
  }
147339
147550
  if (settings.protocols) {
147340
147551
  this.log("Applying protocol statuses ...");
147341
- for (const [protocol, status] of Object.entries(settings.protocols)) {
147342
- await projectService.updateProtocol({
147343
- protocolId: protocol,
147344
- enabled: status
147345
- });
147346
- }
147552
+ await Promise.all(
147553
+ Object.entries(settings.protocols).map(
147554
+ ([protocol, status]) => projectService.updateProtocol({
147555
+ protocolId: protocol,
147556
+ enabled: status
147557
+ })
147558
+ )
147559
+ );
147347
147560
  }
147348
147561
  if (settings.auth) {
147349
147562
  if (settings.auth.security) {
147350
147563
  this.log("Applying auth security settings ...");
147351
- await projectService.updateSessionDurationPolicy({
147352
- duration: Number(settings.auth.security.duration)
147353
- });
147354
- await projectService.updateUserLimitPolicy({
147355
- total: Number(settings.auth.security.limit)
147356
- });
147357
- await projectService.updateSessionLimitPolicy({
147358
- total: Number(settings.auth.security.sessionsLimit)
147359
- });
147360
- await projectService.updatePasswordDictionaryPolicy({
147361
- enabled: settings.auth.security.passwordDictionary
147362
- });
147363
- await projectService.updatePasswordHistoryPolicy({
147364
- total: Number(settings.auth.security.passwordHistory)
147365
- });
147366
- await projectService.updatePasswordPersonalDataPolicy({
147367
- enabled: settings.auth.security.personalDataCheck
147368
- });
147369
- await projectService.updateSessionAlertPolicy({
147370
- enabled: settings.auth.security.sessionAlerts
147371
- });
147564
+ const securityUpdates = [];
147565
+ if (settings.auth.security.duration !== void 0) {
147566
+ securityUpdates.push(
147567
+ projectService.updateSessionDurationPolicy({
147568
+ duration: Number(settings.auth.security.duration)
147569
+ })
147570
+ );
147571
+ }
147572
+ if (settings.auth.security.limit !== void 0) {
147573
+ securityUpdates.push(
147574
+ projectService.updateUserLimitPolicy({
147575
+ total: nullablePolicyTotal(settings.auth.security.limit)
147576
+ })
147577
+ );
147578
+ }
147579
+ if (settings.auth.security.sessionsLimit !== void 0) {
147580
+ securityUpdates.push(
147581
+ projectService.updateSessionLimitPolicy({
147582
+ total: nullablePolicyTotal(settings.auth.security.sessionsLimit)
147583
+ })
147584
+ );
147585
+ }
147586
+ if (settings.auth.security.passwordDictionary !== void 0) {
147587
+ securityUpdates.push(
147588
+ projectService.updatePasswordDictionaryPolicy({
147589
+ enabled: settings.auth.security.passwordDictionary
147590
+ })
147591
+ );
147592
+ }
147593
+ if (settings.auth.security.passwordHistory !== void 0) {
147594
+ securityUpdates.push(
147595
+ projectService.updatePasswordHistoryPolicy({
147596
+ total: nullablePolicyTotal(settings.auth.security.passwordHistory)
147597
+ })
147598
+ );
147599
+ }
147600
+ if (settings.auth.security.personalDataCheck !== void 0) {
147601
+ securityUpdates.push(
147602
+ projectService.updatePasswordPersonalDataPolicy({
147603
+ enabled: settings.auth.security.personalDataCheck
147604
+ })
147605
+ );
147606
+ }
147607
+ if (settings.auth.security.sessionAlerts !== void 0) {
147608
+ securityUpdates.push(
147609
+ projectService.updateSessionAlertPolicy({
147610
+ enabled: settings.auth.security.sessionAlerts
147611
+ })
147612
+ );
147613
+ }
147614
+ await Promise.all(securityUpdates);
147372
147615
  if (settings.auth.security.mockNumbers !== void 0) {
147373
147616
  const remoteMockNumbers = [];
147374
147617
  const limit = 100;
@@ -147391,40 +147634,50 @@ var Push = class {
147391
147634
  mockNumber.otp
147392
147635
  ])
147393
147636
  );
147637
+ const mockNumberUpdates = [];
147394
147638
  for (const remoteMockNumber of remoteMockNumbers) {
147395
147639
  const desiredOtp = desiredMockNumbersByPhone.get(
147396
147640
  remoteMockNumber.number
147397
147641
  );
147398
147642
  if (desiredOtp === void 0) {
147399
- await projectService.deleteMockPhone({
147400
- number: remoteMockNumber.number
147401
- });
147643
+ mockNumberUpdates.push(
147644
+ projectService.deleteMockPhone({
147645
+ number: remoteMockNumber.number
147646
+ })
147647
+ );
147402
147648
  continue;
147403
147649
  }
147404
147650
  if (remoteMockNumber.otp !== desiredOtp) {
147405
- await projectService.updateMockPhone({
147406
- number: remoteMockNumber.number,
147407
- otp: desiredOtp
147408
- });
147651
+ mockNumberUpdates.push(
147652
+ projectService.updateMockPhone({
147653
+ number: remoteMockNumber.number,
147654
+ otp: desiredOtp
147655
+ })
147656
+ );
147409
147657
  }
147410
147658
  desiredMockNumbersByPhone.delete(remoteMockNumber.number);
147411
147659
  }
147412
147660
  for (const [phone, otp] of desiredMockNumbersByPhone) {
147413
- await projectService.createMockPhone({
147414
- number: phone,
147415
- otp
147416
- });
147661
+ mockNumberUpdates.push(
147662
+ projectService.createMockPhone({
147663
+ number: phone,
147664
+ otp
147665
+ })
147666
+ );
147417
147667
  }
147668
+ await Promise.all(mockNumberUpdates);
147418
147669
  }
147419
147670
  }
147420
147671
  if (settings.auth.methods) {
147421
147672
  this.log("Applying auth methods statuses ...");
147422
- for (const [method, status] of Object.entries(settings.auth.methods)) {
147423
- await projectService.updateAuthMethod({
147424
- methodId: method,
147425
- enabled: status
147426
- });
147427
- }
147673
+ await Promise.all(
147674
+ Object.entries(settings.auth.methods).map(
147675
+ ([method, status]) => projectService.updateAuthMethod({
147676
+ methodId: method,
147677
+ enabled: status
147678
+ })
147679
+ )
147680
+ );
147428
147681
  }
147429
147682
  }
147430
147683
  }
@@ -147715,24 +147968,7 @@ var Push = class {
147715
147968
  runtimeSpecification: func.runtimeSpecification,
147716
147969
  deploymentRetention: func.deploymentRetention
147717
147970
  });
147718
- let domain2 = "";
147719
- try {
147720
- const consoleService = await getConsoleService(
147721
- this.consoleClient
147722
- );
147723
- const variables = await consoleService.variables();
147724
- domain2 = id_default2.unique() + "." + variables["_APP_DOMAIN_FUNCTIONS"];
147725
- } catch (err) {
147726
- this.error("Error fetching console variables.");
147727
- throw err;
147728
- }
147729
- try {
147730
- const proxyService = await getProxyService(this.projectClient);
147731
- await proxyService.createFunctionRule(domain2, func.$id);
147732
- } catch (err) {
147733
- this.error("Error creating function rule.");
147734
- throw err;
147735
- }
147971
+ await this.createDefaultFunctionRule(func.$id);
147736
147972
  updaterRow.update({ status: "Created" });
147737
147973
  } catch (e) {
147738
147974
  errors.push(e);
@@ -147741,6 +147977,18 @@ var Push = class {
147741
147977
  });
147742
147978
  return;
147743
147979
  }
147980
+ } else {
147981
+ try {
147982
+ if (!await this.hasDefaultFunctionRule(func.$id)) {
147983
+ await this.createDefaultFunctionRule(func.$id);
147984
+ }
147985
+ } catch (e) {
147986
+ errors.push(e);
147987
+ updaterRow.fail({
147988
+ errorMessage: e.message ?? "General error occurs please try again"
147989
+ });
147990
+ return;
147991
+ }
147744
147992
  }
147745
147993
  if (withVariables) {
147746
147994
  updaterRow.update({ status: "Updating variables" }).replaceSpinner(SPINNER_DOTS);
@@ -148842,10 +149090,11 @@ async function createPushInstance(options = {
148842
149090
  silent: false,
148843
149091
  requiresConsoleAuth: false
148844
149092
  }) {
148845
- const { silent, requiresConsoleAuth } = options;
149093
+ const { silent, requiresConsoleAuth, organizationId } = options;
148846
149094
  const projectClient2 = await sdkForProject();
148847
149095
  const consoleClient = await sdkForConsole({
148848
- requiresAuth: requiresConsoleAuth
149096
+ requiresAuth: requiresConsoleAuth,
149097
+ organizationId
148849
149098
  });
148850
149099
  return new Push(projectClient2, consoleClient, silent);
148851
149100
  }
@@ -148876,20 +149125,11 @@ var pushResources = async ({
148876
149125
  activateFunctionsDeployment = activateAnswer.activate;
148877
149126
  }
148878
149127
  const sites2 = localConfig.getSites();
148879
- let allowSitesCodePush = cliConfig.force === true ? true : null;
148880
- let activateSitesDeployment = cliConfig.force === true ? true : void 0;
148881
- if (sites2.length > 0 && allowSitesCodePush === null) {
148882
- const codeAnswer = await import_inquirer8.default.prompt(questionsPushSitesCode);
148883
- allowSitesCodePush = codeAnswer.override;
148884
- }
148885
- if (sites2.length > 0 && allowSitesCodePush === true && activateSitesDeployment === void 0) {
148886
- const activateAnswer = await import_inquirer8.default.prompt(questionsPushSitesActivate);
148887
- activateSitesDeployment = activateAnswer.activate;
148888
- }
149128
+ const project2 = localConfig.getProject();
148889
149129
  const pushInstance = await createPushInstance({
148890
- requiresConsoleAuth: true
149130
+ requiresConsoleAuth: true,
149131
+ organizationId: project2.organizationId
148891
149132
  });
148892
- const project2 = localConfig.getProject();
148893
149133
  const config2 = {
148894
149134
  organizationId: project2.organizationId,
148895
149135
  projectId: project2.projectId ?? "",
@@ -148912,7 +149152,7 @@ var pushResources = async ({
148912
149152
  "Configuration validation failed",
148913
149153
  config2
148914
149154
  );
148915
- await pushInstance.pushResources(config2, {
149155
+ const result = await pushInstance.pushResources(config2, {
148916
149156
  all: cliConfig.all,
148917
149157
  skipDeprecated,
148918
149158
  functionOptions: {
@@ -148922,12 +149162,13 @@ var pushResources = async ({
148922
149162
  logs: functionOptions?.logs
148923
149163
  },
148924
149164
  siteOptions: {
148925
- code: allowSitesCodePush === true,
148926
- activate: activateSitesDeployment ?? true,
148927
149165
  withVariables: false,
148928
149166
  logs: siteOptions?.logs
148929
149167
  }
148930
149168
  });
149169
+ if (result.errors.length > 0) {
149170
+ throw new Error(formatPushResourceErrors(result.results));
149171
+ }
148931
149172
  } else {
148932
149173
  const actions = {
148933
149174
  settings: pushSettings,
@@ -149006,10 +149247,11 @@ var pushSettings = async () => {
149006
149247
  }
149007
149248
  try {
149008
149249
  log("Pushing project settings ...");
149250
+ const config2 = localConfig.getProject();
149009
149251
  const pushInstance = await createPushInstance({
149010
- requiresConsoleAuth: true
149252
+ requiresConsoleAuth: true,
149253
+ organizationId: config2.organizationId ?? resolvedOrganizationId
149011
149254
  });
149012
- const config2 = localConfig.getProject();
149013
149255
  await pushInstance.pushSettings({
149014
149256
  projectId: config2.projectId,
149015
149257
  organizationId: config2.organizationId ?? resolvedOrganizationId,
@@ -149098,7 +149340,10 @@ var pushSite = async ({
149098
149340
  }
149099
149341
  log("Pushing sites ...");
149100
149342
  const pushStartTime = Date.now();
149101
- const pushInstance = await createPushInstance();
149343
+ const pushInstance = await createPushInstance({
149344
+ requiresConsoleAuth: true,
149345
+ organizationId: localConfig.getProject().organizationId
149346
+ });
149102
149347
  const result = await pushInstance.pushSites(
149103
149348
  withResolvedResourcePaths("sites", sites2),
149104
149349
  {
@@ -149153,7 +149398,7 @@ var pushSite = async ({
149153
149398
  }
149154
149399
  if (cliConfig.verbose) {
149155
149400
  errors.forEach((e) => {
149156
- console.error(e);
149401
+ console.error(formatErrorForLog(e));
149157
149402
  });
149158
149403
  }
149159
149404
  };
@@ -149236,7 +149481,10 @@ var pushFunction = async ({
149236
149481
  }
149237
149482
  log("Pushing functions ...");
149238
149483
  const pushStartTime = Date.now();
149239
- const pushInstance = await createPushInstance();
149484
+ const pushInstance = await createPushInstance({
149485
+ requiresConsoleAuth: true,
149486
+ organizationId: localConfig.getProject().organizationId
149487
+ });
149240
149488
  const result = await pushInstance.pushFunctions(
149241
149489
  withResolvedResourcePaths("functions", functions2),
149242
149490
  {
@@ -149291,7 +149539,7 @@ var pushFunction = async ({
149291
149539
  }
149292
149540
  if (cliConfig.verbose) {
149293
149541
  errors.forEach((e) => {
149294
- console.error(e);
149542
+ console.error(formatErrorForLog(e));
149295
149543
  });
149296
149544
  }
149297
149545
  };
@@ -149436,7 +149684,7 @@ var pushTable = async ({
149436
149684
  success2(`Successfully pushed ${successfullyPushed} tables.`);
149437
149685
  }
149438
149686
  if (cliConfig.verbose) {
149439
- errors.forEach((e) => console.error(e));
149687
+ errors.forEach((e) => console.error(formatErrorForLog(e)));
149440
149688
  }
149441
149689
  };
149442
149690
  var pushCollection = async () => {
@@ -149500,7 +149748,7 @@ var pushCollection = async () => {
149500
149748
  success2(`Successfully pushed ${successfullyPushed} collections.`);
149501
149749
  }
149502
149750
  if (cliConfig.verbose) {
149503
- errors.forEach((e) => console.error(e));
149751
+ errors.forEach((e) => console.error(formatErrorForLog(e)));
149504
149752
  }
149505
149753
  };
149506
149754
  var pushBucket = async () => {
@@ -149550,7 +149798,7 @@ var pushBucket = async () => {
149550
149798
  success2(`Successfully pushed ${successfullyPushed} buckets.`);
149551
149799
  }
149552
149800
  if (cliConfig.verbose) {
149553
- errors.forEach((e) => console.error(e));
149801
+ errors.forEach((e) => console.error(formatErrorForLog(e)));
149554
149802
  }
149555
149803
  };
149556
149804
  var pushTeam = async () => {
@@ -149600,7 +149848,7 @@ var pushTeam = async () => {
149600
149848
  success2(`Successfully pushed ${successfullyPushed} teams.`);
149601
149849
  }
149602
149850
  if (cliConfig.verbose) {
149603
- errors.forEach((e) => console.error(e));
149851
+ errors.forEach((e) => console.error(formatErrorForLog(e)));
149604
149852
  }
149605
149853
  };
149606
149854
  var pushWebhook = async () => {
@@ -149650,7 +149898,7 @@ var pushWebhook = async () => {
149650
149898
  success2(`Successfully pushed ${successfullyPushed} webhooks.`);
149651
149899
  }
149652
149900
  if (cliConfig.verbose) {
149653
- errors.forEach((e) => console.error(e));
149901
+ errors.forEach((e) => console.error(formatErrorForLog(e)));
149654
149902
  }
149655
149903
  };
149656
149904
  var pushMessagingTopic = async () => {
@@ -149700,7 +149948,7 @@ var pushMessagingTopic = async () => {
149700
149948
  success2(`Successfully pushed ${successfullyPushed} topics.`);
149701
149949
  }
149702
149950
  if (cliConfig.verbose) {
149703
- errors.forEach((e) => console.error(e));
149951
+ errors.forEach((e) => console.error(formatErrorForLog(e)));
149704
149952
  }
149705
149953
  };
149706
149954
  var push = new Command("push").description(commandDescriptions["push"]).action(actionRunner(() => pushResources({ skipDeprecated: true })));
@@ -150989,7 +151237,7 @@ var accountListKeysCommand = account.command(`list-keys`).description(`Get a lis
150989
151237
  async ({ total }) => parse3(await (await getAccountClient()).listKeys(total))
150990
151238
  )
150991
151239
  );
150992
- var accountCreateKeyCommand = 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(
151240
+ var accountCreateKeyCommand = 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 200 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(
150993
151241
  actionRunner(
150994
151242
  async ({ name, scopes, expire }) => parse3(await (await getAccountClient()).createKey(name, scopes, expire))
150995
151243
  )
@@ -150999,7 +151247,7 @@ var accountGetKeyCommand = account.command(`get-key`).description(`Get a key by
150999
151247
  async ({ keyId }) => parse3(await (await getAccountClient()).getKey(keyId))
151000
151248
  )
151001
151249
  );
151002
- var accountUpdateKeyCommand = 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(
151250
+ var accountUpdateKeyCommand = 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 200 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(
151003
151251
  actionRunner(
151004
151252
  async ({ keyId, name, scopes, expire }) => parse3(await (await getAccountClient()).updateKey(keyId, name, scopes, expire))
151005
151253
  )
@@ -151009,15 +151257,6 @@ var accountDeleteKeyCommand = account.command(`delete-key`).description(`Delete
151009
151257
  async ({ keyId }) => parse3(await (await getAccountClient()).deleteKey(keyId))
151010
151258
  )
151011
151259
  );
151012
- var accountListLogsCommand = 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...]`, `Raw Appwrite JSON query strings (legacy). Use this for advanced queries or automation; for common pagination prefer --limit and --offset. When mixed, raw --queries are sent before generated flag 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(
151013
- `--total [value]`,
151014
- `When set to false, the total count returned will be 0 and will not be calculated.`,
151015
- (value) => value === void 0 ? true : parseBool(value)
151016
- ).option(`--limit <limit>`, `Maximum number of results to return.`, parseInteger).option(`--offset <offset>`, `Number of results to skip.`, parseInteger).action(
151017
- actionRunner(
151018
- async ({ queries, total, limit, offset }) => parse3(await (await getAccountClient()).listLogs(buildQueries({ queries, limit, offset }), total))
151019
- )
151020
- );
151021
151260
  var accountUpdateMFACommand = account.command(`update-mfa`).description(`Enable or disable MFA on an account.`).requiredOption(`--mfa <mfa>`, `Enable or disable MFA.`, parseBool).action(
151022
151261
  actionRunner(
151023
151262
  async ({ mfa }) => parse3(await (await getAccountClient()).updateMFA(mfa))
@@ -151882,11 +152121,6 @@ var databasesDeleteDocumentCommand = databases.command(`delete-document`).descri
151882
152121
  async ({ databaseId, collectionId, documentId, transactionId }) => parse3(await (await getDatabasesClient()).deleteDocument(databaseId, collectionId, documentId, transactionId))
151883
152122
  )
151884
152123
  );
151885
- var databasesListDocumentLogsCommand = databases.command(`list-document-logs`).description(`Get the document activity logs list by its unique ID.`).requiredOption(`--database-id <database-id>`, `Database ID.`).requiredOption(`--collection-id <collection-id>`, `Collection ID.`).requiredOption(`--document-id <document-id>`, `Document ID.`).option(`--queries [queries...]`, `Raw Appwrite JSON query strings (legacy). Use this for advanced queries or automation; for common pagination prefer --limit and --offset. When mixed, raw --queries are sent before generated flag 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(`--limit <limit>`, `Maximum number of results to return.`, parseInteger).option(`--offset <offset>`, `Number of results to skip.`, parseInteger).action(
151886
- actionRunner(
151887
- async ({ databaseId, collectionId, documentId, queries, limit, offset }) => parse3(await (await getDatabasesClient()).listDocumentLogs(databaseId, collectionId, documentId, buildQueries({ queries, limit, offset })))
151888
- )
151889
- );
151890
152124
  var databasesDecrementDocumentAttributeCommand = databases.command(`decrement-document-attribute`).description(`Decrement a specific attribute of a document by a given value.`).requiredOption(`--database-id <database-id>`, `Database ID.`).requiredOption(`--collection-id <collection-id>`, `Collection ID.`).requiredOption(`--document-id <document-id>`, `Document ID.`).requiredOption(`--attribute <attribute>`, `Attribute key.`).option(`--value <value>`, `Value to increment the attribute by. The value must be a number.`, parseInteger).option(`--min <min>`, `Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown.`, parseInteger).option(`--transaction-id <transaction-id>`, `Transaction ID for staging the operation.`).action(
151891
152125
  actionRunner(
151892
152126
  async ({ databaseId, collectionId, documentId, attribute, value, min, transactionId }) => parse3(await (await getDatabasesClient()).decrementDocumentAttribute(databaseId, collectionId, documentId, attribute, value, min, transactionId))
@@ -151922,21 +152156,11 @@ var databasesDeleteIndexCommand = databases.command(`delete-index`).description(
151922
152156
  async ({ databaseId, collectionId, key }) => parse3(await (await getDatabasesClient()).deleteIndex(databaseId, collectionId, key))
151923
152157
  )
151924
152158
  );
151925
- var databasesListCollectionLogsCommand = databases.command(`list-collection-logs`).description(`Get the collection activity logs list by its unique ID.`).requiredOption(`--database-id <database-id>`, `Database ID.`).requiredOption(`--collection-id <collection-id>`, `Collection ID.`).option(`--queries [queries...]`, `Raw Appwrite JSON query strings (legacy). Use this for advanced queries or automation; for common pagination prefer --limit and --offset. When mixed, raw --queries are sent before generated flag 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(`--limit <limit>`, `Maximum number of results to return.`, parseInteger).option(`--offset <offset>`, `Number of results to skip.`, parseInteger).action(
151926
- actionRunner(
151927
- async ({ databaseId, collectionId, queries, limit, offset }) => parse3(await (await getDatabasesClient()).listCollectionLogs(databaseId, collectionId, buildQueries({ queries, limit, offset })))
151928
- )
151929
- );
151930
152159
  var databasesGetCollectionUsageCommand = databases.command(`get-collection-usage`).description(`Get usage metrics and statistics for a collection. Returning the total number of documents. The response includes both current totals and historical data over time. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, range defaults to 30 days.`).requiredOption(`--database-id <database-id>`, `Database ID.`).requiredOption(`--collection-id <collection-id>`, `Collection ID.`).option(`--range <range>`, `Date range.`).action(
151931
152160
  actionRunner(
151932
152161
  async ({ databaseId, collectionId, range }) => parse3(await (await getDatabasesClient()).getCollectionUsage(databaseId, collectionId, range))
151933
152162
  )
151934
152163
  );
151935
- var databasesListLogsCommand = databases.command(`list-logs`).description(`Get the database activity logs list by its unique ID.`).requiredOption(`--database-id <database-id>`, `Database ID.`).option(`--queries [queries...]`, `Raw Appwrite JSON query strings (legacy). Use this for advanced queries or automation; for common pagination prefer --limit and --offset. When mixed, raw --queries are sent before generated flag 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(`--limit <limit>`, `Maximum number of results to return.`, parseInteger).option(`--offset <offset>`, `Number of results to skip.`, parseInteger).action(
151936
- actionRunner(
151937
- async ({ databaseId, queries, limit, offset }) => parse3(await (await getDatabasesClient()).listLogs(databaseId, buildQueries({ queries, limit, offset })))
151938
- )
151939
- );
151940
152164
  var databasesGetUsageCommand = databases.command(`get-usage`).description(`Get usage metrics and statistics for a database. You can view the total number of collections, documents, and storage usage. The response includes both current totals and historical data over time. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, range defaults to 30 days.`).requiredOption(`--database-id <database-id>`, `Database ID.`).option(`--range <range>`, `Date range.`).action(
151941
152165
  actionRunner(
151942
152166
  async ({ databaseId, range }) => parse3(await (await getDatabasesClient()).getUsage(databaseId, range))
@@ -151973,7 +152197,7 @@ var functionsCreateCommand = functions.command(`create`).description(`Create a n
151973
152197
  `--logging [value]`,
151974
152198
  `When disabled, executions will exclude logs and errors, and will be slightly faster.`,
151975
152199
  (value) => value === void 0 ? true : parseBool(value)
151976
- ).option(`--entrypoint <entrypoint>`, `Entrypoint File. This path is relative to the "providerRootDirectory".`).option(`--commands <commands>`, `Build Commands.`).option(`--scopes [scopes...]`, `List of scopes allowed for API key auto-generated for every execution. Maximum of 100 scopes are allowed.`).option(`--installation-id <installation-id>`, `Appwrite Installation ID for VCS (Version Control System) deployment.`).option(`--provider-repository-id <provider-repository-id>`, `Repository ID of the repo linked to the function.`).option(`--provider-branch <provider-branch>`, `Production branch for the repo linked to the function.`).option(
152200
+ ).option(`--entrypoint <entrypoint>`, `Entrypoint File. This path is relative to the "providerRootDirectory".`).option(`--commands <commands>`, `Build Commands.`).option(`--scopes [scopes...]`, `List of scopes allowed for API key auto-generated for every execution. Maximum of 200 scopes are allowed.`).option(`--installation-id <installation-id>`, `Appwrite Installation ID for VCS (Version Control System) deployment.`).option(`--provider-repository-id <provider-repository-id>`, `Repository ID of the repo linked to the function.`).option(`--provider-branch <provider-branch>`, `Production branch for the repo linked to the function.`).option(
151977
152201
  `--provider-silent-mode [value]`,
151978
152202
  `Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests.`,
151979
152203
  (value) => value === void 0 ? true : parseBool(value)
@@ -152024,7 +152248,7 @@ var functionsUpdateCommand = functions.command(`update`).description(`Update fun
152024
152248
  `--logging [value]`,
152025
152249
  `When disabled, executions will exclude logs and errors, and will be slightly faster.`,
152026
152250
  (value) => value === void 0 ? true : parseBool(value)
152027
- ).option(`--entrypoint <entrypoint>`, `Entrypoint File. This path is relative to the "providerRootDirectory".`).option(`--commands <commands>`, `Build Commands.`).option(`--scopes [scopes...]`, `List of scopes allowed for API Key auto-generated for every execution. Maximum of 100 scopes are allowed.`).option(`--installation-id <installation-id>`, `Appwrite Installation ID for VCS (Version Controle System) deployment.`).option(`--provider-repository-id <provider-repository-id>`, `Repository ID of the repo linked to the function`).option(`--provider-branch <provider-branch>`, `Production branch for the repo linked to the function`).option(
152251
+ ).option(`--entrypoint <entrypoint>`, `Entrypoint File. This path is relative to the "providerRootDirectory".`).option(`--commands <commands>`, `Build Commands.`).option(`--scopes [scopes...]`, `List of scopes allowed for API Key auto-generated for every execution. Maximum of 200 scopes are allowed.`).option(`--installation-id <installation-id>`, `Appwrite Installation ID for VCS (Version Controle System) deployment.`).option(`--provider-repository-id <provider-repository-id>`, `Repository ID of the repo linked to the function`).option(`--provider-branch <provider-branch>`, `Production branch for the repo linked to the function`).option(
152028
152252
  `--provider-silent-mode [value]`,
152029
152253
  `Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests.`,
152030
152254
  (value) => value === void 0 ? true : parseBool(value)
@@ -152509,15 +152733,6 @@ var messagingDeleteCommand = messaging.command(`delete`).description(`Delete a m
152509
152733
  async ({ messageId }) => parse3(await (await getMessagingClient()).delete(messageId))
152510
152734
  )
152511
152735
  );
152512
- var messagingListMessageLogsCommand = messaging.command(`list-message-logs`).description(`Get the message activity logs listed by its unique ID.`).requiredOption(`--message-id <message-id>`, `Message ID.`).option(`--queries [queries...]`, `Raw Appwrite JSON query strings (legacy). Use this for advanced queries or automation; for common pagination prefer --limit and --offset. When mixed, raw --queries are sent before generated flag 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(
152513
- `--total [value]`,
152514
- `When set to false, the total count returned will be 0 and will not be calculated.`,
152515
- (value) => value === void 0 ? true : parseBool(value)
152516
- ).option(`--limit <limit>`, `Maximum number of results to return.`, parseInteger).option(`--offset <offset>`, `Number of results to skip.`, parseInteger).action(
152517
- actionRunner(
152518
- async ({ messageId, queries, total, limit, offset }) => parse3(await (await getMessagingClient()).listMessageLogs(messageId, buildQueries({ queries, limit, offset }), total))
152519
- )
152520
- );
152521
152736
  var messagingListTargetsCommand = messaging.command(`list-targets`).description(`Get a list of the targets associated with a message.`).requiredOption(`--message-id <message-id>`, `Message ID.`).option(`--queries [queries...]`, `Raw Appwrite JSON query strings (legacy). Use this for advanced queries or automation; for common filtering, sorting, and pagination prefer --filter, --sort-asc, --sort-desc, --limit, and --offset. When mixed, raw --queries are sent before generated flag 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. You may filter on the following attributes: userId, providerId, identifier, providerType`).option(
152522
152737
  `--total [value]`,
152523
152738
  `When set to false, the total count returned will be 0 and will not be calculated.`,
@@ -152787,24 +153002,6 @@ var messagingDeleteProviderCommand = messaging.command(`delete-provider`).descri
152787
153002
  async ({ providerId }) => parse3(await (await getMessagingClient()).deleteProvider(providerId))
152788
153003
  )
152789
153004
  );
152790
- var messagingListProviderLogsCommand = messaging.command(`list-provider-logs`).description(`Get the provider activity logs listed by its unique ID.`).requiredOption(`--provider-id <provider-id>`, `Provider ID.`).option(`--queries [queries...]`, `Raw Appwrite JSON query strings (legacy). Use this for advanced queries or automation; for common pagination prefer --limit and --offset. When mixed, raw --queries are sent before generated flag 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(
152791
- `--total [value]`,
152792
- `When set to false, the total count returned will be 0 and will not be calculated.`,
152793
- (value) => value === void 0 ? true : parseBool(value)
152794
- ).option(`--limit <limit>`, `Maximum number of results to return.`, parseInteger).option(`--offset <offset>`, `Number of results to skip.`, parseInteger).action(
152795
- actionRunner(
152796
- async ({ providerId, queries, total, limit, offset }) => parse3(await (await getMessagingClient()).listProviderLogs(providerId, buildQueries({ queries, limit, offset }), total))
152797
- )
152798
- );
152799
- var messagingListSubscriberLogsCommand = messaging.command(`list-subscriber-logs`).description(`Get the subscriber activity logs listed by its unique ID.`).requiredOption(`--subscriber-id <subscriber-id>`, `Subscriber ID.`).option(`--queries [queries...]`, `Raw Appwrite JSON query strings (legacy). Use this for advanced queries or automation; for common pagination prefer --limit and --offset. When mixed, raw --queries are sent before generated flag 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(
152800
- `--total [value]`,
152801
- `When set to false, the total count returned will be 0 and will not be calculated.`,
152802
- (value) => value === void 0 ? true : parseBool(value)
152803
- ).option(`--limit <limit>`, `Maximum number of results to return.`, parseInteger).option(`--offset <offset>`, `Number of results to skip.`, parseInteger).action(
152804
- actionRunner(
152805
- async ({ subscriberId, queries, total, limit, offset }) => parse3(await (await getMessagingClient()).listSubscriberLogs(subscriberId, buildQueries({ queries, limit, offset }), total))
152806
- )
152807
- );
152808
153005
  var messagingListTopicsCommand = messaging.command(`list-topics`).description(`Get a list of all topics from the current Appwrite project.`).option(`--queries [queries...]`, `Raw Appwrite JSON query strings (legacy). Use this for advanced queries or automation; for common filtering, sorting, and pagination prefer --filter, --sort-asc, --sort-desc, --limit, and --offset. When mixed, raw --queries are sent before generated flag 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. You may filter on the following attributes: name, description, emailTotal, smsTotal, pushTotal`).option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`).option(
152809
153006
  `--total [value]`,
152810
153007
  `When set to false, the total count returned will be 0 and will not be calculated.`,
@@ -152836,15 +153033,6 @@ var messagingDeleteTopicCommand = messaging.command(`delete-topic`).description(
152836
153033
  async ({ topicId }) => parse3(await (await getMessagingClient()).deleteTopic(topicId))
152837
153034
  )
152838
153035
  );
152839
- var messagingListTopicLogsCommand = messaging.command(`list-topic-logs`).description(`Get the topic activity logs listed by its unique ID.`).requiredOption(`--topic-id <topic-id>`, `Topic ID.`).option(`--queries [queries...]`, `Raw Appwrite JSON query strings (legacy). Use this for advanced queries or automation; for common pagination prefer --limit and --offset. When mixed, raw --queries are sent before generated flag 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(
152840
- `--total [value]`,
152841
- `When set to false, the total count returned will be 0 and will not be calculated.`,
152842
- (value) => value === void 0 ? true : parseBool(value)
152843
- ).option(`--limit <limit>`, `Maximum number of results to return.`, parseInteger).option(`--offset <offset>`, `Number of results to skip.`, parseInteger).action(
152844
- actionRunner(
152845
- async ({ topicId, queries, total, limit, offset }) => parse3(await (await getMessagingClient()).listTopicLogs(topicId, buildQueries({ queries, limit, offset }), total))
152846
- )
152847
- );
152848
153036
  var messagingListSubscribersCommand = messaging.command(`list-subscribers`).description(`Get a list of all subscribers from the current Appwrite project.`).requiredOption(`--topic-id <topic-id>`, `Topic ID. The topic ID subscribed to.`).option(`--queries [queries...]`, `Raw Appwrite JSON query strings (legacy). Use this for advanced queries or automation; for common filtering, sorting, and pagination prefer --filter, --sort-asc, --sort-desc, --limit, and --offset. When mixed, raw --queries are sent before generated flag 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. You may filter on the following attributes: targetId, topicId, userId, providerType`).option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`).option(
152849
153037
  `--total [value]`,
152850
153038
  `When set to false, the total count returned will be 0 and will not be calculated.`,
@@ -153002,12 +153190,7 @@ var getOauth2Client = async () => {
153002
153190
  var oauth2 = new Command("oauth-2").description(commandDescriptions["oauth2"] ?? "").configureHelp({
153003
153191
  helpWidth: process.stdout.columns || 80
153004
153192
  });
153005
- var oauth2ApproveCommand = oauth2.command(`approve`).description(`Approve an OAuth2 grant after the user gives consent. Returns the \`redirectUrl\` the end user should be sent to. The consent screen may optionally pass enriched \`authorization_details\` to record the concrete resources the user selected. You can pass Accept header of \`application/json\` to receive a JSON response instead of a redirect.`).requiredOption(`--grant-_id <grant-_id>`, `Grant ID made during authorization, provided to consent screen in URL search params.`).option(`--authorization-_details <authorization-_details>`, `Enriched \`authorization_details\` the user consented to, replacing what the client requested. Each entry must use a \`type\` the project accepts. Optional; omit to keep the originally requested details.`).action(
153006
- actionRunner(
153007
- async ({ grant_id, authorization_details }) => parse3(await (await getOauth2Client()).approve(grant_id, authorization_details))
153008
- )
153009
- );
153010
- var oauth2AuthorizeCommand = oauth2.command(`authorize`).description(`Begin the OAuth2 authorization flow. When called without a session, the user is redirected to the consent screen without grant ID. When called with a session, the redirect URL includes param for grant ID. You can pass Accept header of \`application/json\` to receive a JSON response instead of a redirect.`).requiredOption(`--client-_id <client-_id>`, `OAuth2 client ID.`).requiredOption(`--redirect-_uri <redirect-_uri>`, `Redirect URI where visitor will be redirected after authorization, whether successful or not.`).requiredOption(`--response-_type <response-_type>`, `OAuth2 / OIDC response type. One of \`code\` (Authorization Code Flow), \`id_token\` (Implicit Flow, OIDC login only), or \`code id_token\` (Hybrid Flow).`).requiredOption(`--scope <scope>`, `Space-separated OAuth2 scopes. Can include project scopes, and built-in scopes: \`openid\`, \`email\`, \`profile\`.`).option(`--state <state>`, `OAuth2 state. You receive this back in the redirect URI.`).option(`--nonce <nonce>`, `OIDC nonce parameter to prevent replay attacks. Required when response_type includes \`id_token\`.`).option(`--code-_challenge <code-_challenge>`, `PKCE code challenge. Required when OAuth2 app is public.`).option(`--code-_challenge-_method <code-_challenge-_method>`, `PKCE code challenge method. Required when OAuth2 app is public.`).option(`--prompt <prompt>`, `OIDC prompt parameter for customization of consent screen. Space-separated list of: none, login, consent, select_account.`).option(`--max-_age <max-_age>`, `OIDC max_age paraleter for customization of consent screen. Maximum allowable elapsed time in seconds since the user last authenticated. If exceeded, re-authentication is required.`, parseInteger).option(`--authorization-_details <authorization-_details>`, `Rich authorization request. JSON array of objects, each with a \`type\` and project-defined fields`).option(`--resource <resource>`, `RFC 8707 resource indicator URI or URI list. Each value must be an absolute URI without a fragment.`).action(
153193
+ var oauth2AuthorizeCommand = oauth2.command(`authorize`).description(`Begin the OAuth2 authorization flow. When called without a session, the user is redirected to the consent screen without grant ID. When called with a session, the redirect URL includes param for grant ID. You can pass Accept header of \`application/json\` to receive a JSON response instead of a redirect.`).requiredOption(`--client-_id <client-_id>`, `OAuth2 client ID.`).requiredOption(`--redirect-_uri <redirect-_uri>`, `Redirect URI where visitor will be redirected after authorization, whether successful or not.`).requiredOption(`--response-_type <response-_type>`, `OAuth2 / OIDC response type. One of \`code\` (Authorization Code Flow), \`id_token\` (Implicit Flow, OIDC login only), or \`code id_token\` (Hybrid Flow).`).option(`--scope <scope>`, `Space-separated OAuth2 scopes. Can include project scopes, and built-in scopes: \`openid\`, \`email\`, \`profile\`, \`phone\`.`).option(`--state <state>`, `OAuth2 state. You receive this back in the redirect URI.`).option(`--nonce <nonce>`, `OIDC nonce parameter to prevent replay attacks. Required when response_type includes \`id_token\`.`).option(`--code-_challenge <code-_challenge>`, `PKCE code challenge. Required when OAuth2 app is public.`).option(`--code-_challenge-_method <code-_challenge-_method>`, `PKCE code challenge method. Required when OAuth2 app is public.`).option(`--prompt <prompt>`, `OIDC prompt parameter for customization of consent screen. Space-separated list of: none, login, consent, select_account.`).option(`--max-_age <max-_age>`, `OIDC max_age paraleter for customization of consent screen. Maximum allowable elapsed time in seconds since the user last authenticated. If exceeded, re-authentication is required.`, parseInteger).option(`--authorization-_details <authorization-_details>`, `Rich authorization request. JSON array of objects, each with a \`type\` and project-defined fields`).option(`--resource <resource>`, `RFC 8707 resource indicator URI or URI list. Each value must be an absolute URI without a fragment.`).action(
153011
153194
  actionRunner(
153012
153195
  async ({ client_id, redirect_uri, response_type, scope, state, nonce, code_challenge, code_challenge_method, prompt, max_age, authorization_details, resource }) => parse3(await (await getOauth2Client()).authorize(client_id, redirect_uri, response_type, scope, state, nonce, code_challenge, code_challenge_method, prompt, max_age, authorization_details, resource))
153013
153196
  )
@@ -153069,7 +153252,7 @@ var organizationListKeysCommand = organization.command(`list-keys`).description(
153069
153252
  async ({ queries, total, filter, where, sortAsc, sortDesc, cursorAfter, cursorBefore, limit, offset }) => parse3(await (await getOrganizationClient()).listKeys(buildQueries({ queries, filter, where, sortAsc, sortDesc, cursorAfter, cursorBefore, limit, offset }), total))
153070
153253
  )
153071
153254
  );
153072
- var organizationCreateKeyCommand = organization.command(`create-key`).description(`Create a new organization API key.`).requiredOption(`--key-id <key-id>`, `Key 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(`--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(
153255
+ var organizationCreateKeyCommand = organization.command(`create-key`).description(`Create a new organization API key.`).requiredOption(`--key-id <key-id>`, `Key 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(`--name <name>`, `Key name. Max length: 128 chars.`).requiredOption(`--scopes [scopes...]`, `Key scopes list. Maximum of 200 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(
153073
153256
  actionRunner(
153074
153257
  async ({ keyId, name, scopes, expire }) => parse3(await (await getOrganizationClient()).createKey(keyId, name, scopes, expire))
153075
153258
  )
@@ -153079,7 +153262,7 @@ var organizationGetKeyCommand = organization.command(`get-key`).description(`Get
153079
153262
  async ({ keyId }) => parse3(await (await getOrganizationClient()).getKey(keyId))
153080
153263
  )
153081
153264
  );
153082
- var organizationUpdateKeyCommand = organization.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(
153265
+ var organizationUpdateKeyCommand = organization.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 200 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(
153083
153266
  actionRunner(
153084
153267
  async ({ keyId, name, scopes, expire }) => parse3(await (await getOrganizationClient()).updateKey(keyId, name, scopes, expire))
153085
153268
  )
@@ -153089,7 +153272,7 @@ var organizationDeleteKeyCommand = organization.command(`delete-key`).descriptio
153089
153272
  async ({ keyId }) => parse3(await (await getOrganizationClient()).deleteKey(keyId))
153090
153273
  )
153091
153274
  );
153092
- var organizationListProjectsCommand = organization.command(`list-projects`).description(`Get a list of all projects. You can use the query params to filter your results.`).option(`--queries [queries...]`, `Raw Appwrite JSON query strings (legacy). Use this for advanced queries or automation; for common filtering, sorting, and pagination prefer --filter, --sort-asc, --sort-desc, --limit, and --offset. When mixed, raw --queries are sent before generated flag 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. You may filter on the following attributes: name, teamId, labels, search`).option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`).option(
153275
+ var organizationListProjectsCommand = organization.command(`list-projects`).description(`Get a list of all projects. You can use the query params to filter your results.`).option(`--queries [queries...]`, `Raw Appwrite JSON query strings (legacy). Use this for advanced queries or automation; for common filtering, sorting, and pagination prefer --filter, --sort-asc, --sort-desc, --limit, and --offset. When mixed, raw --queries are sent before generated flag 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. You may filter on the following attributes: name, teamId, labels, search, accessedAt`).option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`).option(
153093
153276
  `--total [value]`,
153094
153277
  `When set to false, the total count returned will be 0 and will not be calculated.`,
153095
153278
  (value) => value === void 0 ? true : parseBool(value)
@@ -153451,14 +153634,14 @@ var projectListKeysCommand = project.command(`list-keys`).description(`Get a lis
153451
153634
  );
153452
153635
  var projectCreateKeyCommand = project.command(`create-key`).description(`Create a new API key. It's recommended to have multiple API keys with strict scopes for separate functions within your project.
153453
153636
 
153454
- You can also create an ephemeral API key if you need a short-lived key instead.`).requiredOption(`--key-id <key-id>`, `Key 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(`--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(
153637
+ You can also create an ephemeral API key if you need a short-lived key instead.`).requiredOption(`--key-id <key-id>`, `Key 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(`--name <name>`, `Key name. Max length: 128 chars.`).requiredOption(`--scopes [scopes...]`, `Key scopes list. Maximum of 200 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(
153455
153638
  actionRunner(
153456
153639
  async ({ keyId, name, scopes, expire }) => parse3(await (await getProjectClient()).createKey(keyId, name, scopes, expire))
153457
153640
  )
153458
153641
  );
153459
153642
  var projectCreateEphemeralKeyCommand = project.command(`create-ephemeral-key`).description(`Create a new ephemeral API key. It's recommended to have multiple API keys with strict scopes for separate functions within your project.
153460
153643
 
153461
- You can also create a standard API key if you need a longer-lived key instead.`).requiredOption(`--scopes [scopes...]`, `Key scopes list. Maximum of 100 scopes are allowed.`).requiredOption(`--duration <duration>`, `Time in seconds before ephemeral key expires. Maximum duration is 3600 seconds.`, parseInteger).action(
153644
+ You can also create a standard API key if you need a longer-lived key instead.`).requiredOption(`--scopes [scopes...]`, `Key scopes list. Maximum of 200 scopes are allowed.`).requiredOption(`--duration <duration>`, `Time in seconds before ephemeral key expires. Maximum duration is 3600 seconds.`, parseInteger).action(
153462
153645
  actionRunner(
153463
153646
  async ({ scopes, duration: duration3 }) => parse3(await (await getProjectClient()).createEphemeralKey(scopes, duration3))
153464
153647
  )
@@ -153468,7 +153651,7 @@ var projectGetKeyCommand = project.command(`get-key`).description(`Get a key by
153468
153651
  async ({ keyId }) => parse3(await (await getProjectClient()).getKey(keyId))
153469
153652
  )
153470
153653
  );
153471
- var projectUpdateKeyCommand = project.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 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(
153654
+ var projectUpdateKeyCommand = project.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 ID.`).requiredOption(`--name <name>`, `Key name. Max length: 128 chars.`).requiredOption(`--scopes [scopes...]`, `Key scopes list. Maximum of 200 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(
153472
153655
  actionRunner(
153473
153656
  async ({ keyId, name, scopes, expire }) => parse3(await (await getProjectClient()).updateKey(keyId, name, scopes, expire))
153474
153657
  )
@@ -154762,7 +154945,7 @@ var tablesDBCreateCommand = tablesDB.command(`create`).description(`Create a new
154762
154945
  `--enabled [value]`,
154763
154946
  `Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.`,
154764
154947
  (value) => value === void 0 ? true : parseBool(value)
154765
- ).option(`--dedicated-database-id <dedicated-database-id>`, `Optional dedicated database (compute) ID to attach this database to. Leave empty to create a database on the shared pool.`).action(
154948
+ ).option(`--dedicated-database-id <dedicated-database-id>`, `Optional dedicated database ID to attach this database to. Leave empty to create a database on the shared pool.`).action(
154766
154949
  actionRunner(
154767
154950
  async ({ databaseId, name, enabled, dedicatedDatabaseId }) => parse3(await (await getTablesDBClient()).create(databaseId, name, enabled, dedicatedDatabaseId))
154768
154951
  )
@@ -155212,11 +155395,6 @@ var tablesDBDeleteIndexCommand = tablesDB.command(`delete-index`).description(`D
155212
155395
  async ({ databaseId, tableId, key }) => parse3(await (await getTablesDBClient()).deleteIndex(databaseId, tableId, key))
155213
155396
  )
155214
155397
  );
155215
- var tablesDBListTableLogsCommand = tablesDB.command(`list-table-logs`).description(`Get the table activity logs list by its unique ID.`).requiredOption(`--database-id <database-id>`, `Database ID.`).requiredOption(`--table-id <table-id>`, `Table ID.`).option(`--queries [queries...]`, `Raw Appwrite JSON query strings (legacy). Use this for advanced queries or automation; for common pagination prefer --limit and --offset. When mixed, raw --queries are sent before generated flag 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(`--limit <limit>`, `Maximum number of results to return.`, parseInteger).option(`--offset <offset>`, `Number of results to skip.`, parseInteger).action(
155216
- actionRunner(
155217
- async ({ databaseId, tableId, queries, limit, offset }) => parse3(await (await getTablesDBClient()).listTableLogs(databaseId, tableId, buildQueries({ queries, limit, offset })))
155218
- )
155219
- );
155220
155398
  var tablesDBListRowsCommand = tablesDB.command(`list-rows`).description(`Get a list of all the user's rows in a given table. You can use the query params to filter your results.`).requiredOption(`--database-id <database-id>`, `Database ID.`).requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the TablesDB service server integration (https://appwrite.io/docs/products/databases/tables#create-table).`).option(`--queries [queries...]`, `Raw Appwrite JSON query strings (legacy). Use this for advanced queries or automation; for common filtering, sorting, pagination, and selection prefer --filter, --sort-asc, --sort-desc, --limit, --offset, and --select. When mixed, raw --queries are sent before generated flag 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.`).option(`--transaction-id <transaction-id>`, `Transaction ID to read uncommitted changes within the transaction.`).option(
155221
155399
  `--total [value]`,
155222
155400
  `When set to false, the total count returned will be 0 and will not be calculated.`,
@@ -155272,11 +155450,6 @@ var tablesDBDeleteRowCommand = tablesDB.command(`delete-row`).description(`Delet
155272
155450
  async ({ databaseId, tableId, rowId, transactionId }) => parse3(await (await getTablesDBClient()).deleteRow(databaseId, tableId, rowId, transactionId))
155273
155451
  )
155274
155452
  );
155275
- var tablesDBListRowLogsCommand = tablesDB.command(`list-row-logs`).description(`Get the row activity logs list by its unique ID.`).requiredOption(`--database-id <database-id>`, `Database ID.`).requiredOption(`--table-id <table-id>`, `Table ID.`).requiredOption(`--row-id <row-id>`, `Row ID.`).option(`--queries [queries...]`, `Raw Appwrite JSON query strings (legacy). Use this for advanced queries or automation; for common pagination prefer --limit and --offset. When mixed, raw --queries are sent before generated flag 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(`--limit <limit>`, `Maximum number of results to return.`, parseInteger).option(`--offset <offset>`, `Number of results to skip.`, parseInteger).action(
155276
- actionRunner(
155277
- async ({ databaseId, tableId, rowId, queries, limit, offset }) => parse3(await (await getTablesDBClient()).listRowLogs(databaseId, tableId, rowId, buildQueries({ queries, limit, offset })))
155278
- )
155279
- );
155280
155453
  var tablesDBDecrementRowColumnCommand = tablesDB.command(`decrement-row-column`).description(`Decrement a specific column of a row by a given value.`).requiredOption(`--database-id <database-id>`, `Database ID.`).requiredOption(`--table-id <table-id>`, `Table ID.`).requiredOption(`--row-id <row-id>`, `Row ID.`).requiredOption(`--column <column>`, `Column key.`).option(`--value <value>`, `Value to increment the column by. The value must be a number.`, parseInteger).option(`--min <min>`, `Minimum value for the column. If the current value is lesser than this value, an exception will be thrown.`, parseInteger).option(`--transaction-id <transaction-id>`, `Transaction ID for staging the operation.`).action(
155281
155454
  actionRunner(
155282
155455
  async ({ databaseId, tableId, rowId, column, value, min, transactionId }) => parse3(await (await getTablesDBClient()).decrementRowColumn(databaseId, tableId, rowId, column, value, min, transactionId))
@@ -155347,15 +155520,6 @@ var teamsDeleteCommand = teams.command(`delete`).description(`Delete a team usin
155347
155520
  async ({ teamId }) => parse3(await (await getTeamsClient()).delete(teamId))
155348
155521
  )
155349
155522
  );
155350
- var teamsListLogsCommand = teams.command(`list-logs`).description(`Get the team activity logs list by its unique ID.`).requiredOption(`--team-id <team-id>`, `Team ID.`).option(`--queries [queries...]`, `Raw Appwrite JSON query strings (legacy). Use this for advanced queries or automation; for common pagination prefer --limit and --offset. When mixed, raw --queries are sent before generated flag 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(
155351
- `--total [value]`,
155352
- `When set to false, the total count returned will be 0 and will not be calculated.`,
155353
- (value) => value === void 0 ? true : parseBool(value)
155354
- ).option(`--limit <limit>`, `Maximum number of results to return.`, parseInteger).option(`--offset <offset>`, `Number of results to skip.`, parseInteger).action(
155355
- actionRunner(
155356
- async ({ teamId, queries, total, limit, offset }) => parse3(await (await getTeamsClient()).listLogs(teamId, buildQueries({ queries, limit, offset }), total))
155357
- )
155358
- );
155359
155523
  var teamsListMembershipsCommand = teams.command(`list-memberships`).description(`Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint. Hide sensitive attributes from the response by toggling membership privacy in the Console.`).requiredOption(`--team-id <team-id>`, `Team ID.`).option(`--queries [queries...]`, `Raw Appwrite JSON query strings (legacy). Use this for advanced queries or automation; for common filtering, sorting, and pagination prefer --filter, --sort-asc, --sort-desc, --limit, and --offset. When mixed, raw --queries are sent before generated flag 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. You may filter on the following attributes: userId, teamId, invited, joined, confirm, roles`).option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`).option(
155360
155524
  `--total [value]`,
155361
155525
  `When set to false, the total count returned will be 0 and will not be calculated.`,
@@ -155466,7 +155630,7 @@ var getUsersClient = async () => {
155466
155630
  var users = new Command("users").description(commandDescriptions["users"] ?? "").configureHelp({
155467
155631
  helpWidth: process.stdout.columns || 80
155468
155632
  });
155469
- var usersListCommand = users.command(`list`).description(`Get a list of all the project's users. You can use the query params to filter your results.`).option(`--queries [queries...]`, `Raw Appwrite JSON query strings (legacy). Use this for advanced queries or automation; for common filtering, sorting, and pagination prefer --filter, --sort-asc, --sort-desc, --limit, and --offset. When mixed, raw --queries are sent before generated flag 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. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels, impersonator`).option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`).option(
155633
+ var usersListCommand = users.command(`list`).description(`Get a list of all the project's users. You can use the query params to filter your results.`).option(`--queries [queries...]`, `Raw Appwrite JSON query strings (legacy). Use this for advanced queries or automation; for common filtering, sorting, and pagination prefer --filter, --sort-asc, --sort-desc, --limit, and --offset. When mixed, raw --queries are sent before generated flag 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. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels, impersonator, accessedAt`).option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`).option(
155470
155634
  `--total [value]`,
155471
155635
  `When set to false, the total count returned will be 0 and will not be calculated.`,
155472
155636
  (value) => value === void 0 ? true : parseBool(value)
@@ -155568,15 +155732,6 @@ Labels can be used to grant access to resources. While teams are a way for user'
155568
155732
  async ({ userId, labels }) => parse3(await (await getUsersClient()).updateLabels(userId, labels))
155569
155733
  )
155570
155734
  );
155571
- var usersListLogsCommand = users.command(`list-logs`).description(`Get the user activity logs list by its unique ID.`).requiredOption(`--user-id <user-id>`, `User ID.`).option(`--queries [queries...]`, `Raw Appwrite JSON query strings (legacy). Use this for advanced queries or automation; for common pagination prefer --limit and --offset. When mixed, raw --queries are sent before generated flag 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(
155572
- `--total [value]`,
155573
- `When set to false, the total count returned will be 0 and will not be calculated.`,
155574
- (value) => value === void 0 ? true : parseBool(value)
155575
- ).option(`--limit <limit>`, `Maximum number of results to return.`, parseInteger).option(`--offset <offset>`, `Number of results to skip.`, parseInteger).action(
155576
- actionRunner(
155577
- async ({ userId, queries, total, limit, offset }) => parse3(await (await getUsersClient()).listLogs(userId, buildQueries({ queries, limit, offset }), total))
155578
- )
155579
- );
155580
155735
  var usersListMembershipsCommand = users.command(`list-memberships`).description(`Get the user membership list by its unique ID.`).requiredOption(`--user-id <user-id>`, `User ID.`).option(`--queries [queries...]`, `Raw Appwrite JSON query strings (legacy). Use this for advanced queries or automation; for common filtering, sorting, and pagination prefer --filter, --sort-asc, --sort-desc, --limit, and --offset. When mixed, raw --queries are sent before generated flag 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. You may filter on the following attributes: userId, teamId, invited, joined, confirm, roles`).option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`).option(
155581
155736
  `--total [value]`,
155582
155737
  `When set to false, the total count returned will be 0 and will not be calculated.`,