appwrite-cli 14.0.1 → 15.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -146,7 +146,10 @@ const SiteSchema = z
146
146
  buildCommand: z.string().optional(),
147
147
  outputDirectory: z.string().optional(),
148
148
  fallbackFile: z.string().optional(),
149
- specification: z.string().optional(),
149
+ buildSpecification: z.string().optional(),
150
+ runtimeSpecification: z.string().optional(),
151
+ deploymentRetention: z.number().optional(),
152
+ startCommand: z.string().optional(),
150
153
  vars: z.record(z.string(), z.string()).optional(),
151
154
  ignore: z.string().optional(),
152
155
  })
@@ -161,7 +164,9 @@ const FunctionSchema = z
161
164
  enabled: z.boolean().optional(),
162
165
  logging: z.boolean().optional(),
163
166
  runtime: z.string(),
164
- specification: z.string().optional(),
167
+ buildSpecification: z.string().optional(),
168
+ runtimeSpecification: z.string().optional(),
169
+ deploymentRetention: z.number().optional(),
165
170
  scopes: z.array(z.string()).optional(),
166
171
  events: z.array(z.string()).optional(),
167
172
  schedule: z.string().optional(),
@@ -514,7 +514,8 @@ const initFunction = async (): Promise<void> => {
514
514
  $id: functionId,
515
515
  name: answers.name,
516
516
  runtime: answers.runtime.id,
517
- specification: answers.specification,
517
+ buildSpecification: answers.buildSpecification,
518
+ runtimeSpecification: answers.runtimeSpecification,
518
519
  execute: ["any"],
519
520
  events: [],
520
521
  scopes: ["users.read"],
@@ -706,7 +707,8 @@ const initSite = async (): Promise<void> => {
706
707
  buildCommand: templateDetails.frameworks[0].buildCommand || "",
707
708
  outputDirectory: templateDetails.frameworks[0].outputDirectory || "",
708
709
  fallbackFile: templateDetails.frameworks[0].fallbackFile || "",
709
- specification: answers.specification,
710
+ buildSpecification: answers.buildSpecification,
711
+ runtimeSpecification: answers.runtimeSpecification,
710
712
  enabled: true,
711
713
  timeout: 30,
712
714
  logging: true,
@@ -297,7 +297,9 @@ export class Pull {
297
297
  timeout: func.timeout,
298
298
  commands: func.commands,
299
299
  scopes: func.scopes,
300
- specification: func.specification,
300
+ buildSpecification: func.buildSpecification,
301
+ runtimeSpecification: func.runtimeSpecification,
302
+ deploymentRetention: func.deploymentRetention,
301
303
  };
302
304
 
303
305
  result.push(functionConfig);
@@ -395,7 +397,10 @@ export class Pull {
395
397
  buildCommand: site.buildCommand,
396
398
  outputDirectory: site.outputDirectory,
397
399
  fallbackFile: site.fallbackFile,
398
- specification: site.specification,
400
+ startCommand: site.startCommand,
401
+ buildSpecification: site.buildSpecification,
402
+ runtimeSpecification: site.runtimeSpecification,
403
+ deploymentRetention: site.deploymentRetention,
399
404
  };
400
405
 
401
406
  result.push(siteConfig);
@@ -749,7 +749,9 @@ export class Push {
749
749
  entrypoint: func.entrypoint,
750
750
  commands: func.commands,
751
751
  scopes: func.scopes,
752
- specification: func.specification,
752
+ buildSpecification: func.buildSpecification,
753
+ runtimeSpecification: func.runtimeSpecification,
754
+ deploymentRetention: func.deploymentRetention,
753
755
  });
754
756
  } catch (e: any) {
755
757
  if (Number(e.code) === 404) {
@@ -783,7 +785,9 @@ export class Push {
783
785
  entrypoint: func.entrypoint,
784
786
  commands: func.commands,
785
787
  scopes: func.scopes,
786
- specification: func.specification,
788
+ buildSpecification: func.buildSpecification,
789
+ runtimeSpecification: func.runtimeSpecification,
790
+ deploymentRetention: func.deploymentRetention,
787
791
  });
788
792
 
789
793
  let domain = "";
@@ -1115,7 +1119,10 @@ export class Push {
1115
1119
  outputDirectory: site.outputDirectory,
1116
1120
  buildRuntime: site.buildRuntime,
1117
1121
  adapter: site.adapter,
1118
- specification: site.specification,
1122
+ startCommand: site.startCommand,
1123
+ buildSpecification: site.buildSpecification,
1124
+ runtimeSpecification: site.runtimeSpecification,
1125
+ deploymentRetention: site.deploymentRetention,
1119
1126
  });
1120
1127
  } catch (e: any) {
1121
1128
  if (Number(e.code) === 404) {
@@ -1148,7 +1155,10 @@ export class Push {
1148
1155
  outputDirectory: site.outputDirectory,
1149
1156
  buildRuntime: site.buildRuntime,
1150
1157
  adapter: site.adapter,
1151
- specification: site.specification,
1158
+ startCommand: site.startCommand,
1159
+ buildSpecification: site.buildSpecification,
1160
+ runtimeSpecification: site.runtimeSpecification,
1161
+ deploymentRetention: site.deploymentRetention,
1152
1162
  });
1153
1163
 
1154
1164
  let domain = "";
@@ -180,7 +180,7 @@ account
180
180
  account
181
181
  .command(`list-invoices`)
182
182
  .description(`List all invoices tied to an account.`)
183
- .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: teamId, aggregationId, amount, currency, from, to, dueAt, attempts, status, grossAmount`)
183
+ .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: teamId, aggregationId, type, amount, currency, from, to, dueAt, attempts, status, grossAmount`)
184
184
  .action(
185
185
  actionRunner(
186
186
  async ({ queries }) =>
@@ -80,11 +80,13 @@ functions
80
80
  value === undefined ? true : parseBool(value),
81
81
  )
82
82
  .option(`--provider-root-directory <provider-root-directory>`, `Path to function code in the linked repo.`)
83
- .option(`--specification <specification>`, `Runtime specification for the function and builds.`)
83
+ .option(`--build-specification <build-specification>`, `Build specification for the function deployments.`)
84
+ .option(`--runtime-specification <runtime-specification>`, `Runtime specification for the function executions.`)
85
+ .option(`--deployment-retention <deployment-retention>`, `Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept.`, parseInteger)
84
86
  .action(
85
87
  actionRunner(
86
- async ({ functionId, name, runtime, execute, events, schedule, timeout, enabled, logging, entrypoint, commands, scopes, installationId, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory, specification }) =>
87
- parse(await (await getFunctionsClient()).create(functionId, name, runtime, execute, events, schedule, timeout, enabled, logging, entrypoint, commands, scopes, installationId, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory, specification)),
88
+ async ({ functionId, name, runtime, execute, events, schedule, timeout, enabled, logging, entrypoint, commands, scopes, installationId, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory, buildSpecification, runtimeSpecification, deploymentRetention }) =>
89
+ parse(await (await getFunctionsClient()).create(functionId, name, runtime, execute, events, schedule, timeout, enabled, logging, entrypoint, commands, scopes, installationId, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory, buildSpecification, runtimeSpecification, deploymentRetention)),
88
90
  ),
89
91
  );
90
92
 
@@ -194,11 +196,13 @@ functions
194
196
  value === undefined ? true : parseBool(value),
195
197
  )
196
198
  .option(`--provider-root-directory <provider-root-directory>`, `Path to function code in the linked repo.`)
197
- .option(`--specification <specification>`, `Runtime specification for the function and builds.`)
199
+ .option(`--build-specification <build-specification>`, `Build specification for the function deployments.`)
200
+ .option(`--runtime-specification <runtime-specification>`, `Runtime specification for the function executions.`)
201
+ .option(`--deployment-retention <deployment-retention>`, `Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept.`, parseInteger)
198
202
  .action(
199
203
  actionRunner(
200
- async ({ functionId, name, runtime, execute, events, schedule, timeout, enabled, logging, entrypoint, commands, scopes, installationId, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory, specification }) =>
201
- parse(await (await getFunctionsClient()).update(functionId, name, runtime, execute, events, schedule, timeout, enabled, logging, entrypoint, commands, scopes, installationId, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory, specification)),
204
+ async ({ functionId, name, runtime, execute, events, schedule, timeout, enabled, logging, entrypoint, commands, scopes, installationId, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory, buildSpecification, runtimeSpecification, deploymentRetention }) =>
205
+ parse(await (await getFunctionsClient()).update(functionId, name, runtime, execute, events, schedule, timeout, enabled, logging, entrypoint, commands, scopes, installationId, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory, buildSpecification, runtimeSpecification, deploymentRetention)),
202
206
  ),
203
207
  );
204
208
 
@@ -67,6 +67,7 @@ sites
67
67
  .option(`--timeout <timeout>`, `Maximum request time in seconds.`, parseInteger)
68
68
  .option(`--install-command <install-command>`, `Install Command.`)
69
69
  .option(`--build-command <build-command>`, `Build Command.`)
70
+ .option(`--start-command <start-command>`, `Custom start command. Leave empty to use default.`)
70
71
  .option(`--output-directory <output-directory>`, `Output Directory for site.`)
71
72
  .option(`--adapter <adapter>`, `Framework adapter defining rendering strategy. Allowed values are: static, ssr`)
72
73
  .option(`--installation-id <installation-id>`, `Appwrite Installation ID for VCS (Version Control System) deployment.`)
@@ -80,11 +81,13 @@ sites
80
81
  value === undefined ? true : parseBool(value),
81
82
  )
82
83
  .option(`--provider-root-directory <provider-root-directory>`, `Path to site code in the linked repo.`)
83
- .option(`--specification <specification>`, `Framework specification for the site and builds.`)
84
+ .option(`--build-specification <build-specification>`, `Build specification for the site deployments.`)
85
+ .option(`--runtime-specification <runtime-specification>`, `Runtime specification for the SSR executions.`)
86
+ .option(`--deployment-retention <deployment-retention>`, `Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept.`, parseInteger)
84
87
  .action(
85
88
  actionRunner(
86
- async ({ siteId, name, framework, buildRuntime, enabled, logging, timeout, installCommand, buildCommand, outputDirectory, adapter, installationId, fallbackFile, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory, specification }) =>
87
- parse(await (await getSitesClient()).create(siteId, name, framework, buildRuntime, enabled, logging, timeout, installCommand, buildCommand, outputDirectory, adapter, installationId, fallbackFile, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory, specification)),
89
+ async ({ siteId, name, framework, buildRuntime, enabled, logging, timeout, installCommand, buildCommand, startCommand, outputDirectory, adapter, installationId, fallbackFile, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory, buildSpecification, runtimeSpecification, deploymentRetention }) =>
90
+ parse(await (await getSitesClient()).create(siteId, name, framework, buildRuntime, enabled, logging, timeout, installCommand, buildCommand, startCommand, outputDirectory, adapter, installationId, fallbackFile, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory, buildSpecification, runtimeSpecification, deploymentRetention)),
88
91
  ),
89
92
  );
90
93
 
@@ -174,6 +177,7 @@ sites
174
177
  .option(`--timeout <timeout>`, `Maximum request time in seconds.`, parseInteger)
175
178
  .option(`--install-command <install-command>`, `Install Command.`)
176
179
  .option(`--build-command <build-command>`, `Build Command.`)
180
+ .option(`--start-command <start-command>`, `Custom start command. Leave empty to use default.`)
177
181
  .option(`--output-directory <output-directory>`, `Output Directory for site.`)
178
182
  .option(`--build-runtime <build-runtime>`, `Runtime to use during build step.`)
179
183
  .option(`--adapter <adapter>`, `Framework adapter defining rendering strategy. Allowed values are: static, ssr`)
@@ -188,11 +192,13 @@ sites
188
192
  value === undefined ? true : parseBool(value),
189
193
  )
190
194
  .option(`--provider-root-directory <provider-root-directory>`, `Path to site code in the linked repo.`)
191
- .option(`--specification <specification>`, `Framework specification for the site and builds.`)
195
+ .option(`--build-specification <build-specification>`, `Build specification for the site deployments.`)
196
+ .option(`--runtime-specification <runtime-specification>`, `Runtime specification for the SSR executions.`)
197
+ .option(`--deployment-retention <deployment-retention>`, `Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept.`, parseInteger)
192
198
  .action(
193
199
  actionRunner(
194
- async ({ siteId, name, framework, enabled, logging, timeout, installCommand, buildCommand, outputDirectory, buildRuntime, adapter, fallbackFile, installationId, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory, specification }) =>
195
- parse(await (await getSitesClient()).update(siteId, name, framework, enabled, logging, timeout, installCommand, buildCommand, outputDirectory, buildRuntime, adapter, fallbackFile, installationId, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory, specification)),
200
+ async ({ siteId, name, framework, enabled, logging, timeout, installCommand, buildCommand, startCommand, outputDirectory, buildRuntime, adapter, fallbackFile, installationId, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory, buildSpecification, runtimeSpecification, deploymentRetention }) =>
201
+ parse(await (await getSitesClient()).update(siteId, name, framework, enabled, logging, timeout, installCommand, buildCommand, startCommand, outputDirectory, buildRuntime, adapter, fallbackFile, installationId, providerRepositoryId, providerBranch, providerSilentMode, providerRootDirectory, buildSpecification, runtimeSpecification, deploymentRetention)),
196
202
  ),
197
203
  );
198
204
 
package/lib/constants.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  // SDK
2
2
  export const SDK_TITLE = 'Appwrite';
3
3
  export const SDK_TITLE_LOWER = 'appwrite';
4
- export const SDK_VERSION = '14.0.1';
4
+ export const SDK_VERSION = '15.0.0';
5
5
  export const SDK_NAME = 'Command Line';
6
6
  export const SDK_PLATFORM = 'console';
7
7
  export const SDK_LANGUAGE = 'cli';
package/lib/questions.ts CHANGED
@@ -457,8 +457,25 @@ export const questionsCreateFunction: Question[] = [
457
457
  },
458
458
  {
459
459
  type: "list",
460
- name: "specification",
461
- message: "What specification would you like to use?",
460
+ name: "buildSpecification",
461
+ message: "What build specification would you like to use?",
462
+ choices: async () => {
463
+ const response = await (await getFunctionsService()).listSpecifications();
464
+ const specifications = response["specifications"];
465
+ const choices = specifications.map((spec: any, _idx: number) => {
466
+ return {
467
+ name: `${spec.cpus} CPU, ${spec.memory}MB RAM`,
468
+ value: spec.slug,
469
+ disabled: spec.enabled === false ? "Upgrade to use" : false,
470
+ };
471
+ });
472
+ return choices;
473
+ },
474
+ },
475
+ {
476
+ type: "list",
477
+ name: "runtimeSpecification",
478
+ message: "What runtime specification would you like to use?",
462
479
  choices: async () => {
463
480
  const response = await (await getFunctionsService()).listSpecifications();
464
481
  const specifications = response["specifications"];
@@ -1166,8 +1183,25 @@ export const questionsCreateSite: Question[] = [
1166
1183
  },
1167
1184
  {
1168
1185
  type: "list",
1169
- name: "specification",
1170
- message: "What specification would you like to use?",
1186
+ name: "buildSpecification",
1187
+ message: "What build specification would you like to use?",
1188
+ choices: async () => {
1189
+ const response = await (await getSitesService()).listSpecifications();
1190
+ const specifications = response["specifications"];
1191
+ const choices = specifications.map((spec: any) => {
1192
+ return {
1193
+ name: `${spec.cpus} CPU, ${spec.memory}MB RAM`,
1194
+ value: spec.slug,
1195
+ disabled: spec.enabled === false ? "Upgrade to use" : false,
1196
+ };
1197
+ });
1198
+ return choices;
1199
+ },
1200
+ },
1201
+ {
1202
+ type: "list",
1203
+ name: "runtimeSpecification",
1204
+ message: "What runtime specification would you like to use?",
1171
1205
  choices: async () => {
1172
1206
  const response = await (await getSitesService()).listSpecifications();
1173
1207
  const specifications = response["specifications"];
package/lib/sdks.ts CHANGED
@@ -23,6 +23,7 @@ export const sdkForConsole = async (
23
23
  }
24
24
 
25
25
  client.headers = {
26
+ ...client.headers,
26
27
  "x-sdk-name": "Command Line",
27
28
  "x-sdk-platform": "console",
28
29
  "x-sdk-language": "cli",
@@ -61,6 +62,7 @@ export const sdkForProject = async (): Promise<Client> => {
61
62
  }
62
63
 
63
64
  client.headers = {
65
+ ...client.headers,
64
66
  "x-sdk-name": "Command Line",
65
67
  "x-sdk-platform": "console",
66
68
  "x-sdk-language": "cli",
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "type": "module",
4
4
  "homepage": "https://appwrite.io/support",
5
5
  "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",
6
- "version": "14.0.1",
6
+ "version": "15.0.0",
7
7
  "license": "BSD-3-Clause",
8
8
  "main": "dist/index.cjs",
9
9
  "module": "dist/index.js",
@@ -47,7 +47,7 @@
47
47
  "windows-arm64": "esbuild cli.ts --bundle --loader:.hbs=text --platform=node --target=node18 --format=esm --external:fsevents --outfile=dist/bundle-win-arm64.mjs && pkg dist/bundle-win-arm64.mjs -t node18-win-arm64 -o build/appwrite-cli-win-arm64.exe"
48
48
  },
49
49
  "dependencies": {
50
- "@appwrite.io/console": "^4.0.0",
50
+ "@appwrite.io/console": "^5.0.0",
51
51
  "chalk": "4.1.2",
52
52
  "chokidar": "^3.6.0",
53
53
  "cli-progress": "^3.12.0",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/ScoopInstaller/Scoop/master/schema.json",
3
- "version": "14.0.1",
3
+ "version": "15.0.0",
4
4
  "description": "The Appwrite CLI is a command-line application that allows you to interact with Appwrite and perform server-side tasks using your terminal.",
5
5
  "homepage": "https://github.com/appwrite/sdk-for-cli",
6
6
  "license": "BSD-3-Clause",
7
7
  "architecture": {
8
8
  "64bit": {
9
- "url": "https://github.com/appwrite/sdk-for-cli/releases/download/14.0.1/appwrite-cli-win-x64.exe",
9
+ "url": "https://github.com/appwrite/sdk-for-cli/releases/download/15.0.0/appwrite-cli-win-x64.exe",
10
10
  "bin": [
11
11
  [
12
12
  "appwrite-cli-win-x64.exe",
@@ -15,7 +15,7 @@
15
15
  ]
16
16
  },
17
17
  "arm64": {
18
- "url": "https://github.com/appwrite/sdk-for-cli/releases/download/14.0.1/appwrite-cli-win-arm64.exe",
18
+ "url": "https://github.com/appwrite/sdk-for-cli/releases/download/15.0.0/appwrite-cli-win-arm64.exe",
19
19
  "bin": [
20
20
  [
21
21
  "appwrite-cli-win-arm64.exe",