appwrite-cli 1.0.0-RC2 → 1.1.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/README.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # Appwrite Command Line SDK
2
2
 
3
3
  ![License](https://img.shields.io/github/license/appwrite/sdk-for-cli.svg?style=flat-square)
4
- ![Version](https://img.shields.io/badge/api%20version-1.0.0-RC1-blue.svg?style=flat-square)
4
+ ![Version](https://img.shields.io/badge/api%20version-1.0.0-blue.svg?style=flat-square)
5
5
  [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
6
6
  [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
7
7
  [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
8
8
 
9
- **This SDK is compatible with Appwrite server version 1.0.0-RC1. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-cli/releases).**
9
+ **This SDK is compatible with Appwrite server version 1.0.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-cli/releases).**
10
10
 
11
11
  Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Command Line SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
12
12
 
@@ -29,7 +29,7 @@ Once the installation is complete, you can verify the install using
29
29
 
30
30
  ```sh
31
31
  $ appwrite -v
32
- 1.0.0-RC2
32
+ 1.1.0
33
33
  ```
34
34
 
35
35
  ### Install using prebuilt binaries
@@ -58,7 +58,7 @@ $ iwr -useb https://appwrite.io/cli/install.ps1 | iex
58
58
  Once the installation completes, you can verify your install using
59
59
  ```
60
60
  $ appwrite -v
61
- 1.0.0-RC2
61
+ 1.1.0
62
62
  ```
63
63
 
64
64
  ## Getting Started
@@ -161,7 +161,7 @@ $ appwrite users list
161
161
 
162
162
  To create a document you can use the following command
163
163
  ```sh
164
- $ appwrite database createDocument --collectionId <ID> --documentId 'unique()' --data '{ "Name": "Iron Man" }' --read role:all team:abc
164
+ $ appwrite database createDocument --collectionId <ID> --documentId 'unique()' --data '{ "Name": "Iron Man" }' --permissions 'read("any")' 'read("team:abc")'
165
165
  ```
166
166
 
167
167
  ### Some Gotchas
@@ -0,0 +1,2 @@
1
+ appwrite account listLogs \
2
+
@@ -0,0 +1 @@
1
+ appwrite account listSessions
@@ -6,3 +6,4 @@ appwrite functions create \
6
6
 
7
7
 
8
8
 
9
+
@@ -1,4 +1,2 @@
1
1
  appwrite functions listVariables \
2
- --functionId [FUNCTION_ID] \
3
-
4
-
2
+ --functionId [FUNCTION_ID]
@@ -5,3 +5,4 @@ appwrite functions update \
5
5
 
6
6
 
7
7
 
8
+
@@ -0,0 +1 @@
1
+ appwrite locale listContinents
@@ -0,0 +1 @@
1
+ appwrite locale listCountriesEU
@@ -0,0 +1 @@
1
+ appwrite locale listCountriesPhones
@@ -0,0 +1 @@
1
+ appwrite locale listCountries
@@ -0,0 +1 @@
1
+ appwrite locale listCurrencies
@@ -0,0 +1 @@
1
+ appwrite locale listLanguages
@@ -0,0 +1,4 @@
1
+ appwrite teams listMemberships \
2
+ --teamId [TEAM_ID] \
3
+
4
+
@@ -0,0 +1,3 @@
1
+ appwrite users listLogs \
2
+ --userId [USER_ID] \
3
+
@@ -0,0 +1,2 @@
1
+ appwrite users listMemberships \
2
+ --userId [USER_ID]
@@ -0,0 +1,2 @@
1
+ appwrite users listSessions \
2
+ --userId [USER_ID]
package/install.ps1 CHANGED
@@ -13,8 +13,8 @@
13
13
  # You can use "View source" of this page to see the full script.
14
14
 
15
15
  # REPO
16
- $GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/1.0.0-RC2/appwrite-cli-win-x64.exe"
17
- $GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/1.0.0-RC2/appwrite-cli-win-arm64.exe"
16
+ $GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/1.1.0/appwrite-cli-win-x64.exe"
17
+ $GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/1.1.0/appwrite-cli-win-arm64.exe"
18
18
 
19
19
  $APPWRITE_BINARY_NAME = "appwrite.exe"
20
20
 
package/install.sh CHANGED
@@ -97,7 +97,7 @@ printSuccess() {
97
97
  downloadBinary() {
98
98
  echo "[2/4] Downloading executable for $OS ($ARCH) ..."
99
99
 
100
- GITHUB_LATEST_VERSION="1.0.0-RC2"
100
+ GITHUB_LATEST_VERSION="1.1.0"
101
101
  GITHUB_FILE="appwrite-cli-${OS}-${ARCH}"
102
102
  GITHUB_URL="https://github.com/$GITHUB_REPOSITORY_NAME/releases/download/$GITHUB_LATEST_VERSION/$GITHUB_FILE"
103
103
 
package/lib/client.js CHANGED
@@ -15,9 +15,9 @@ class Client {
15
15
  'x-sdk-name': 'Command Line',
16
16
  'x-sdk-platform': 'console',
17
17
  'x-sdk-language': 'cli',
18
- 'x-sdk-version': '1.0.0-RC2',
19
- 'user-agent' : `AppwriteCLI/1.0.0-RC2 (${os.type()} ${os.version()}; ${os.arch()})`,
20
- 'X-Appwrite-Response-Format' : '1.0.0-RC1',
18
+ 'x-sdk-version': '1.1.0',
19
+ 'user-agent' : `AppwriteCLI/1.1.0 (${os.type()} ${os.version()}; ${os.arch()})`,
20
+ 'X-Appwrite-Response-Format' : '1.0.0',
21
21
  };
22
22
  }
23
23
 
@@ -187,6 +187,7 @@ class Client {
187
187
  method.toUpperCase() === "GET" || contentType.startsWith("multipart/form-data") ? formData : params,
188
188
  json: contentType.startsWith("application/json"),
189
189
  transformRequest: method.toUpperCase() === "GET" || contentType.startsWith("multipart/form-data") ? undefined : (data) => JSONbig.stringify(data),
190
+ transformResponse: [ (data) => data ? JSONbig.parse(data) : data ],
190
191
  responseType: responseType,
191
192
  };
192
193
  try {
@@ -114,7 +114,7 @@ const accountCreateJWT = async ({ parseOutput = true, sdk = undefined}) => {
114
114
  return response;
115
115
  }
116
116
 
117
- const accountGetLogs = async ({ queries, parseOutput = true, sdk = undefined}) => {
117
+ const accountListLogs = async ({ queries, parseOutput = true, sdk = undefined}) => {
118
118
  /* @param {string[]} queries */
119
119
 
120
120
  let client = !sdk ? await sdkForProject() : sdk;
@@ -328,7 +328,7 @@ const accountUpdateRecovery = async ({ userId, secret, password, passwordAgain,
328
328
  return response;
329
329
  }
330
330
 
331
- const accountGetSessions = async ({ parseOutput = true, sdk = undefined}) => {
331
+ const accountListSessions = async ({ parseOutput = true, sdk = undefined}) => {
332
332
 
333
333
  let client = !sdk ? await sdkForProject() : sdk;
334
334
  let path = '/account/sessions';
@@ -759,10 +759,10 @@ account
759
759
  .action(actionRunner(accountCreateJWT))
760
760
 
761
761
  account
762
- .command(`getLogs`)
762
+ .command(`listLogs`)
763
763
  .description(`Get currently logged in user list of latest security activity logs. Each log returns user IP address, location and date and time of log.`)
764
764
  .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). Only supported methods are limit and offset`)
765
- .action(actionRunner(accountGetLogs))
765
+ .action(actionRunner(accountListLogs))
766
766
 
767
767
  account
768
768
  .command(`updateName`)
@@ -812,9 +812,9 @@ account
812
812
  .action(actionRunner(accountUpdateRecovery))
813
813
 
814
814
  account
815
- .command(`getSessions`)
815
+ .command(`listSessions`)
816
816
  .description(`Get currently logged in user list of active sessions across different devices.`)
817
- .action(actionRunner(accountGetSessions))
817
+ .action(actionRunner(accountListSessions))
818
818
 
819
819
  account
820
820
  .command(`deleteSessions`)
@@ -926,7 +926,7 @@ module.exports = {
926
926
  accountCreate,
927
927
  accountUpdateEmail,
928
928
  accountCreateJWT,
929
- accountGetLogs,
929
+ accountListLogs,
930
930
  accountUpdateName,
931
931
  accountUpdatePassword,
932
932
  accountUpdatePhone,
@@ -934,7 +934,7 @@ module.exports = {
934
934
  accountUpdatePrefs,
935
935
  accountCreateRecovery,
936
936
  accountUpdateRecovery,
937
- accountGetSessions,
937
+ accountListSessions,
938
938
  accountDeleteSessions,
939
939
  accountCreateAnonymousSession,
940
940
  accountCreateEmailSession,
@@ -2,9 +2,9 @@ const inquirer = require("inquirer");
2
2
  const JSONbig = require("json-bigint")({ storeAsString: false });
3
3
  const { Command } = require("commander");
4
4
  const { localConfig } = require("../config");
5
- const { questionsDeployFunctions, questionsGetEntrypoint, questionsDeployCollections } = require("../questions");
5
+ const { questionsDeployFunctions, questionsGetEntrypoint, questionsDeployCollections, questionsConfirmDeployCollections } = require("../questions");
6
6
  const { actionRunner, success, log, error, commandDescriptions } = require("../parser");
7
- const { functionsGet, functionsCreate, functionsUpdate, functionsCreateDeployment, functionsUpdateDeployment } = require('./functions');
7
+ const { functionsGet, functionsCreate, functionsUpdate, functionsCreateDeployment, functionsUpdateDeployment, functionsListVariables, functionsDeleteVariable, functionsCreateVariable } = require('./functions');
8
8
  const {
9
9
  databasesGet,
10
10
  databasesCreate,
@@ -15,6 +15,7 @@ const {
15
15
  databasesCreateIntegerAttribute,
16
16
  databasesCreateFloatAttribute,
17
17
  databasesCreateEmailAttribute,
18
+ databasesCreateDatetimeAttribute,
18
19
  databasesCreateIndex,
19
20
  databasesCreateUrlAttribute,
20
21
  databasesCreateIpAttribute,
@@ -38,7 +39,7 @@ const awaitPools = {
38
39
  const { attributes: remoteAttributes } = await databasesListAttributes({
39
40
  databaseId,
40
41
  collectionId,
41
- limit: 100,
42
+ queries: [ 'limit(100)' ],
42
43
  parseOutput: false
43
44
  });
44
45
 
@@ -58,7 +59,7 @@ const awaitPools = {
58
59
  const { indexes: remoteIndexes } = await databasesListIndexes({
59
60
  databaseId,
60
61
  collectionId,
61
- limit: 100,
62
+ queries: [ 'limit(100)' ],
62
63
  parseOutput: false
63
64
  });
64
65
 
@@ -78,7 +79,7 @@ const awaitPools = {
78
79
  const { attributes: remoteAttributes } = await databasesListAttributes({
79
80
  databaseId,
80
81
  collectionId,
81
- limit: 100,
82
+ queries: [ 'limit(100)' ],
82
83
  parseOutput: false
83
84
  });
84
85
 
@@ -110,7 +111,7 @@ const awaitPools = {
110
111
  const { indexes: remoteIndexes } = await databasesListIndexes({
111
112
  databaseId,
112
113
  collectionId,
113
- limit: 100,
114
+ queries: [ 'limit(100)' ],
114
115
  parseOutput: false
115
116
  });
116
117
 
@@ -141,7 +142,7 @@ const deploy = new Command("deploy")
141
142
  command.help()
142
143
  }));
143
144
 
144
- const deployFunction = async ({ functionId, all } = {}) => {
145
+ const deployFunction = async ({ functionId, all, yes } = {}) => {
145
146
  let response = {};
146
147
 
147
148
  const functionIds = [];
@@ -159,7 +160,7 @@ const deployFunction = async ({ functionId, all } = {}) => {
159
160
  }
160
161
 
161
162
  if(functionIds.length <= 0) {
162
- const answers = await inquirer.prompt(questionsDeployFunctions);
163
+ const answers = await inquirer.prompt(questionsDeployFunctions[0]);
163
164
  functionIds.push(...answers.functions);
164
165
  }
165
166
 
@@ -187,6 +188,46 @@ const deployFunction = async ({ functionId, all } = {}) => {
187
188
  throw new Error(`Runtime missmatch! (local=${func.runtime},remote=${response.runtime}) Please delete remote function or update your appwrite.json`);
188
189
  }
189
190
 
191
+ if(func.variables) {
192
+ // Delete existing variables
193
+
194
+ // TODO: Pagination?
195
+ const { variables: remoteVariables } = await functionsListVariables({
196
+ functionId: func['$id'],
197
+ queries: [ 'limit(100)' ],
198
+ parseOutput: false
199
+ });
200
+
201
+ if(remoteVariables.length > 0) {
202
+ if(!yes) {
203
+ const variableAnswers = await inquirer.prompt(questionsDeployFunctions[1])
204
+
205
+ if (variableAnswers.override !== "YES") {
206
+ log(`Received "${variableAnswers.override}". Skipping ${func.name} ( ${func['$id']} )`);
207
+ continue;
208
+ }
209
+ }
210
+
211
+ await Promise.all(remoteVariables.map(async remoteVariable => {
212
+ await functionsDeleteVariable({
213
+ functionId: func['$id'],
214
+ variableId: remoteVariable['$id'],
215
+ parseOutput: false
216
+ });
217
+ }));
218
+ }
219
+
220
+ // Deploy local variables
221
+ await Promise.all(Object.keys(func.variables).map(async localVariableKey => {
222
+ await functionsCreateVariable({
223
+ functionId: func['$id'],
224
+ key: localVariableKey,
225
+ value: func.variables[localVariableKey],
226
+ parseOutput: false
227
+ });
228
+ }));
229
+ }
230
+
190
231
  response = await functionsUpdate({
191
232
  functionId: func['$id'],
192
233
  name: func.name,
@@ -338,6 +379,15 @@ const createAttribute = async (databaseId, collectionId, attribute) => {
338
379
  case 'boolean':
339
380
  return databasesCreateBooleanAttribute({
340
381
  databaseId,
382
+ collectionId,
383
+ key: attribute.key,
384
+ required: attribute.required,
385
+ xdefault: attribute.default,
386
+ array: attribute.array,
387
+ parseOutput: false
388
+ })
389
+ case 'datetime':
390
+ return databasesCreateDatetimeAttribute({
341
391
  databaseId,
342
392
  collectionId,
343
393
  key: attribute.key,
@@ -349,7 +399,7 @@ const createAttribute = async (databaseId, collectionId, attribute) => {
349
399
  }
350
400
  }
351
401
 
352
- const deployCollection = async ({ all } = {}) => {
402
+ const deployCollection = async ({ all, yes } = {}) => {
353
403
  let response = {};
354
404
 
355
405
  let collectionIds = [];
@@ -403,10 +453,12 @@ const deployCollection = async ({ all } = {}) => {
403
453
  })
404
454
  log(`Collection ${collection.name} ( ${collection['$id']} ) already exists.`);
405
455
 
406
- answers = await inquirer.prompt(questionsDeployCollections[1])
407
- if (answers.override !== "YES") {
408
- log(`Received "${answers.override}". Skipping ${collection.name} ( ${collection['$id']} )`);
409
- continue;
456
+ if(!yes) {
457
+ answers = await inquirer.prompt(questionsDeployCollections[1])
458
+ if (answers.override !== "YES") {
459
+ log(`Received "${answers.override}". Skipping ${collection.name} ( ${collection['$id']} )`);
460
+ continue;
461
+ }
410
462
  }
411
463
 
412
464
  log(`Updating attributes ... `);
@@ -415,7 +467,7 @@ const deployCollection = async ({ all } = {}) => {
415
467
  const { indexes: remoteIndexes } = await databasesListIndexes({
416
468
  databaseId,
417
469
  collectionId: collection['$id'],
418
- limit: 100,
470
+ queries: [ 'limit(100)' ],
419
471
  parseOutput: false
420
472
  });
421
473
 
@@ -437,7 +489,7 @@ const deployCollection = async ({ all } = {}) => {
437
489
  const { attributes: remoteAttributes } = await databasesListAttributes({
438
490
  databaseId,
439
491
  collectionId: collection['$id'],
440
- limit: 100,
492
+ queries: [ 'limit(100)' ],
441
493
  parseOutput: false
442
494
  });
443
495
 
@@ -494,9 +546,8 @@ const deployCollection = async ({ all } = {}) => {
494
546
  databaseId,
495
547
  collectionId: collection['$id'],
496
548
  name: collection.name,
497
- permission: collection.permission,
498
- read: collection['$read'],
499
- write: collection['$write'],
549
+ documentSecurity: collection.documentSecurity,
550
+ permissions: collection['$permissions'],
500
551
  parseOutput: false
501
552
  })
502
553
 
@@ -547,12 +598,14 @@ deploy
547
598
  .description("Deploy functions in the current directory.")
548
599
  .option(`--functionId <functionId>`, `Function ID`)
549
600
  .option(`--all`, `Flag to deploy all functions`)
601
+ .option(`--yes`, `Flag to confirm all warnings`)
550
602
  .action(actionRunner(deployFunction));
551
603
 
552
604
  deploy
553
605
  .command("collection")
554
606
  .description("Deploy collections in the current project.")
555
607
  .option(`--all`, `Flag to deploy all functions`)
608
+ .option(`--yes`, `Flag to confirm all warnings`)
556
609
  .action(actionRunner(deployCollection));
557
610
 
558
611
  module.exports = {
@@ -39,7 +39,7 @@ const functionsList = async ({ queries, search, parseOutput = true, sdk = undefi
39
39
  return response;
40
40
  }
41
41
 
42
- const functionsCreate = async ({ functionId, name, execute, runtime, events, schedule, timeout, parseOutput = true, sdk = undefined}) => {
42
+ const functionsCreate = async ({ functionId, name, execute, runtime, events, schedule, timeout, enabled, parseOutput = true, sdk = undefined}) => {
43
43
  /* @param {string} functionId */
44
44
  /* @param {string} name */
45
45
  /* @param {string[]} execute */
@@ -47,6 +47,7 @@ const functionsCreate = async ({ functionId, name, execute, runtime, events, sch
47
47
  /* @param {string[]} events */
48
48
  /* @param {string} schedule */
49
49
  /* @param {number} timeout */
50
+ /* @param {boolean} enabled */
50
51
 
51
52
  let client = !sdk ? await sdkForProject() : sdk;
52
53
  let path = '/functions';
@@ -81,6 +82,10 @@ const functionsCreate = async ({ functionId, name, execute, runtime, events, sch
81
82
  payload['timeout'] = timeout;
82
83
  }
83
84
 
85
+ if (typeof enabled !== 'undefined') {
86
+ payload['enabled'] = enabled;
87
+ }
88
+
84
89
  let response = undefined;
85
90
  response = await client.call('post', path, {
86
91
  'content-type': 'application/json',
@@ -151,13 +156,14 @@ const functionsGet = async ({ functionId, parseOutput = true, sdk = undefined})
151
156
  return response;
152
157
  }
153
158
 
154
- const functionsUpdate = async ({ functionId, name, execute, events, schedule, timeout, parseOutput = true, sdk = undefined}) => {
159
+ const functionsUpdate = async ({ functionId, name, execute, events, schedule, timeout, enabled, parseOutput = true, sdk = undefined}) => {
155
160
  /* @param {string} functionId */
156
161
  /* @param {string} name */
157
162
  /* @param {string[]} execute */
158
163
  /* @param {string[]} events */
159
164
  /* @param {string} schedule */
160
165
  /* @param {number} timeout */
166
+ /* @param {boolean} enabled */
161
167
 
162
168
  let client = !sdk ? await sdkForProject() : sdk;
163
169
  let path = '/functions/{functionId}'.replace('{functionId}', functionId);
@@ -184,6 +190,10 @@ const functionsUpdate = async ({ functionId, name, execute, events, schedule, ti
184
190
  payload['timeout'] = timeout;
185
191
  }
186
192
 
193
+ if (typeof enabled !== 'undefined') {
194
+ payload['enabled'] = enabled;
195
+ }
196
+
187
197
  let response = undefined;
188
198
  response = await client.call('put', path, {
189
199
  'content-type': 'application/json',
@@ -537,22 +547,12 @@ const functionsGetFunctionUsage = async ({ functionId, range, parseOutput = true
537
547
  return response;
538
548
  }
539
549
 
540
- const functionsListVariables = async ({ functionId, queries, search, parseOutput = true, sdk = undefined}) => {
550
+ const functionsListVariables = async ({ functionId, parseOutput = true, sdk = undefined}) => {
541
551
  /* @param {string} functionId */
542
- /* @param {string[]} queries */
543
- /* @param {string} search */
544
552
 
545
553
  let client = !sdk ? await sdkForProject() : sdk;
546
554
  let path = '/functions/{functionId}/variables'.replace('{functionId}', functionId);
547
555
  let payload = {};
548
-
549
- /** Query Params */
550
- if (typeof queries !== 'undefined') {
551
- payload['queries'] = queries;
552
- }
553
- if (typeof search !== 'undefined') {
554
- payload['search'] = search;
555
- }
556
556
  let response = undefined;
557
557
  response = await client.call('get', path, {
558
558
  'content-type': 'application/json',
@@ -668,7 +668,7 @@ const functionsDeleteVariable = async ({ functionId, variableId, parseOutput = t
668
668
  functions
669
669
  .command(`list`)
670
670
  .description(`Get a list of all the project's functions. You can use the query params to filter your results.`)
671
- .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: name, status, runtime, deployment, schedule, scheduleNext, schedulePrevious, timeout`)
671
+ .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: name, enabled, runtime, deployment, schedule, scheduleNext, schedulePrevious, timeout`)
672
672
  .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
673
673
  .action(actionRunner(functionsList))
674
674
 
@@ -682,6 +682,7 @@ functions
682
682
  .option(`--events <events...>`, `Events list. Maximum of 100 events are allowed.`)
683
683
  .option(`--schedule <schedule>`, `Schedule CRON syntax.`)
684
684
  .option(`--timeout <timeout>`, `Function maximum execution time in seconds.`, parseInteger)
685
+ .option(`--enabled <enabled>`, `Is function enabled?`, parseBool)
685
686
  .action(actionRunner(functionsCreate))
686
687
 
687
688
  functions
@@ -710,6 +711,7 @@ functions
710
711
  .option(`--events <events...>`, `Events list. Maximum of 100 events are allowed.`)
711
712
  .option(`--schedule <schedule>`, `Schedule CRON syntax.`)
712
713
  .option(`--timeout <timeout>`, `Maximum execution time in seconds.`, parseInteger)
714
+ .option(`--enabled <enabled>`, `Is function enabled?`, parseBool)
713
715
  .action(actionRunner(functionsUpdate))
714
716
 
715
717
  functions
@@ -768,7 +770,7 @@ functions
768
770
  .command(`listExecutions`)
769
771
  .description(`Get a list of all the current user function execution logs. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project's executions. [Learn more about different API modes](/docs/admin).`)
770
772
  .requiredOption(`--functionId <functionId>`, `Function ID.`)
771
- .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: trigger, status, statusCode, time`)
773
+ .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: trigger, status, statusCode, duration`)
772
774
  .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
773
775
  .action(actionRunner(functionsListExecutions))
774
776
 
@@ -777,7 +779,7 @@ functions
777
779
  .description(`Trigger a function execution. The returned object will return you the current execution status. You can ping the 'Get Execution' endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously.`)
778
780
  .requiredOption(`--functionId <functionId>`, `Function ID.`)
779
781
  .option(`--data <data>`, `String of custom data to send to function.`)
780
- .option(`--async <async>`, `Execute code asynchronously. Default value is true.`, parseBool)
782
+ .option(`--async <async>`, `Execute code in the background. Default value is false.`, parseBool)
781
783
  .action(actionRunner(functionsCreateExecution))
782
784
 
783
785
  functions
@@ -798,8 +800,6 @@ functions
798
800
  .command(`listVariables`)
799
801
  .description(`Get a list of all variables of a specific function.`)
800
802
  .requiredOption(`--functionId <functionId>`, `Function unique ID.`)
801
- .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: key`)
802
- .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
803
803
  .action(actionRunner(functionsListVariables))
804
804
 
805
805
  functions
@@ -170,7 +170,7 @@ const initCollection = async ({ all, databaseId } = {}) => {
170
170
  // TODO: Pagination?
171
171
  let response = await databasesListCollections({
172
172
  databaseId,
173
- limit: 100,
173
+ queries: [ 'limit(100)' ],
174
174
  parseOutput: false
175
175
  })
176
176
 
@@ -29,7 +29,7 @@ const localeGet = async ({ parseOutput = true, sdk = undefined}) => {
29
29
  return response;
30
30
  }
31
31
 
32
- const localeGetContinents = async ({ parseOutput = true, sdk = undefined}) => {
32
+ const localeListContinents = async ({ parseOutput = true, sdk = undefined}) => {
33
33
 
34
34
  let client = !sdk ? await sdkForProject() : sdk;
35
35
  let path = '/locale/continents';
@@ -46,7 +46,7 @@ const localeGetContinents = async ({ parseOutput = true, sdk = undefined}) => {
46
46
  return response;
47
47
  }
48
48
 
49
- const localeGetCountries = async ({ parseOutput = true, sdk = undefined}) => {
49
+ const localeListCountries = async ({ parseOutput = true, sdk = undefined}) => {
50
50
 
51
51
  let client = !sdk ? await sdkForProject() : sdk;
52
52
  let path = '/locale/countries';
@@ -63,7 +63,7 @@ const localeGetCountries = async ({ parseOutput = true, sdk = undefined}) => {
63
63
  return response;
64
64
  }
65
65
 
66
- const localeGetCountriesEU = async ({ parseOutput = true, sdk = undefined}) => {
66
+ const localeListCountriesEU = async ({ parseOutput = true, sdk = undefined}) => {
67
67
 
68
68
  let client = !sdk ? await sdkForProject() : sdk;
69
69
  let path = '/locale/countries/eu';
@@ -80,7 +80,7 @@ const localeGetCountriesEU = async ({ parseOutput = true, sdk = undefined}) => {
80
80
  return response;
81
81
  }
82
82
 
83
- const localeGetCountriesPhones = async ({ parseOutput = true, sdk = undefined}) => {
83
+ const localeListCountriesPhones = async ({ parseOutput = true, sdk = undefined}) => {
84
84
 
85
85
  let client = !sdk ? await sdkForProject() : sdk;
86
86
  let path = '/locale/countries/phones';
@@ -97,7 +97,7 @@ const localeGetCountriesPhones = async ({ parseOutput = true, sdk = undefined})
97
97
  return response;
98
98
  }
99
99
 
100
- const localeGetCurrencies = async ({ parseOutput = true, sdk = undefined}) => {
100
+ const localeListCurrencies = async ({ parseOutput = true, sdk = undefined}) => {
101
101
 
102
102
  let client = !sdk ? await sdkForProject() : sdk;
103
103
  let path = '/locale/currencies';
@@ -114,7 +114,7 @@ const localeGetCurrencies = async ({ parseOutput = true, sdk = undefined}) => {
114
114
  return response;
115
115
  }
116
116
 
117
- const localeGetLanguages = async ({ parseOutput = true, sdk = undefined}) => {
117
+ const localeListLanguages = async ({ parseOutput = true, sdk = undefined}) => {
118
118
 
119
119
  let client = !sdk ? await sdkForProject() : sdk;
120
120
  let path = '/locale/languages';
@@ -138,43 +138,43 @@ locale
138
138
  .action(actionRunner(localeGet))
139
139
 
140
140
  locale
141
- .command(`getContinents`)
141
+ .command(`listContinents`)
142
142
  .description(`List of all continents. You can use the locale header to get the data in a supported language.`)
143
- .action(actionRunner(localeGetContinents))
143
+ .action(actionRunner(localeListContinents))
144
144
 
145
145
  locale
146
- .command(`getCountries`)
146
+ .command(`listCountries`)
147
147
  .description(`List of all countries. You can use the locale header to get the data in a supported language.`)
148
- .action(actionRunner(localeGetCountries))
148
+ .action(actionRunner(localeListCountries))
149
149
 
150
150
  locale
151
- .command(`getCountriesEU`)
151
+ .command(`listCountriesEU`)
152
152
  .description(`List of all countries that are currently members of the EU. You can use the locale header to get the data in a supported language.`)
153
- .action(actionRunner(localeGetCountriesEU))
153
+ .action(actionRunner(localeListCountriesEU))
154
154
 
155
155
  locale
156
- .command(`getCountriesPhones`)
156
+ .command(`listCountriesPhones`)
157
157
  .description(`List of all countries phone codes. You can use the locale header to get the data in a supported language.`)
158
- .action(actionRunner(localeGetCountriesPhones))
158
+ .action(actionRunner(localeListCountriesPhones))
159
159
 
160
160
  locale
161
- .command(`getCurrencies`)
161
+ .command(`listCurrencies`)
162
162
  .description(`List of all currencies, including currency symbol, name, plural, and decimal digits for all major and minor currencies. You can use the locale header to get the data in a supported language.`)
163
- .action(actionRunner(localeGetCurrencies))
163
+ .action(actionRunner(localeListCurrencies))
164
164
 
165
165
  locale
166
- .command(`getLanguages`)
166
+ .command(`listLanguages`)
167
167
  .description(`List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language.`)
168
- .action(actionRunner(localeGetLanguages))
168
+ .action(actionRunner(localeListLanguages))
169
169
 
170
170
 
171
171
  module.exports = {
172
172
  locale,
173
173
  localeGet,
174
- localeGetContinents,
175
- localeGetCountries,
176
- localeGetCountriesEU,
177
- localeGetCountriesPhones,
178
- localeGetCurrencies,
179
- localeGetLanguages
174
+ localeListContinents,
175
+ localeListCountries,
176
+ localeListCountriesEU,
177
+ localeListCountriesPhones,
178
+ localeListCurrencies,
179
+ localeListLanguages
180
180
  };
@@ -158,7 +158,7 @@ const teamsListLogs = async ({ teamId, queries, parseOutput = true, sdk = undefi
158
158
  return response;
159
159
  }
160
160
 
161
- const teamsGetMemberships = async ({ teamId, queries, search, parseOutput = true, sdk = undefined}) => {
161
+ const teamsListMemberships = async ({ teamId, queries, search, parseOutput = true, sdk = undefined}) => {
162
162
  /* @param {string} teamId */
163
163
  /* @param {string[]} queries */
164
164
  /* @param {string} search */
@@ -364,12 +364,12 @@ teams
364
364
  .action(actionRunner(teamsListLogs))
365
365
 
366
366
  teams
367
- .command(`getMemberships`)
367
+ .command(`listMemberships`)
368
368
  .description(`Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint.`)
369
369
  .requiredOption(`--teamId <teamId>`, `Team ID.`)
370
370
  .option(`--queries <queries...>`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, teamId, invited, joined, confirm`)
371
371
  .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
372
- .action(actionRunner(teamsGetMemberships))
372
+ .action(actionRunner(teamsListMemberships))
373
373
 
374
374
  teams
375
375
  .command(`createMembership`)
@@ -421,7 +421,7 @@ module.exports = {
421
421
  teamsUpdate,
422
422
  teamsDelete,
423
423
  teamsListLogs,
424
- teamsGetMemberships,
424
+ teamsListMemberships,
425
425
  teamsCreateMembership,
426
426
  teamsGetMembership,
427
427
  teamsUpdateMembershipRoles,
@@ -489,7 +489,7 @@ const usersUpdateEmail = async ({ userId, email, parseOutput = true, sdk = undef
489
489
  return response;
490
490
  }
491
491
 
492
- const usersGetLogs = async ({ userId, queries, parseOutput = true, sdk = undefined}) => {
492
+ const usersListLogs = async ({ userId, queries, parseOutput = true, sdk = undefined}) => {
493
493
  /* @param {string} userId */
494
494
  /* @param {string[]} queries */
495
495
 
@@ -513,7 +513,7 @@ const usersGetLogs = async ({ userId, queries, parseOutput = true, sdk = undefin
513
513
  return response;
514
514
  }
515
515
 
516
- const usersGetMemberships = async ({ userId, parseOutput = true, sdk = undefined}) => {
516
+ const usersListMemberships = async ({ userId, parseOutput = true, sdk = undefined}) => {
517
517
  /* @param {string} userId */
518
518
 
519
519
  let client = !sdk ? await sdkForProject() : sdk;
@@ -649,7 +649,7 @@ const usersUpdatePrefs = async ({ userId, prefs, parseOutput = true, sdk = undef
649
649
  return response;
650
650
  }
651
651
 
652
- const usersGetSessions = async ({ userId, parseOutput = true, sdk = undefined}) => {
652
+ const usersListSessions = async ({ userId, parseOutput = true, sdk = undefined}) => {
653
653
  /* @param {string} userId */
654
654
 
655
655
  let client = !sdk ? await sdkForProject() : sdk;
@@ -896,17 +896,17 @@ users
896
896
  .action(actionRunner(usersUpdateEmail))
897
897
 
898
898
  users
899
- .command(`getLogs`)
899
+ .command(`listLogs`)
900
900
  .description(`Get the user activity logs list by its unique ID.`)
901
901
  .requiredOption(`--userId <userId>`, `User ID.`)
902
902
  .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). Only supported methods are limit and offset`)
903
- .action(actionRunner(usersGetLogs))
903
+ .action(actionRunner(usersListLogs))
904
904
 
905
905
  users
906
- .command(`getMemberships`)
906
+ .command(`listMemberships`)
907
907
  .description(`Get the user membership list by its unique ID.`)
908
908
  .requiredOption(`--userId <userId>`, `User ID.`)
909
- .action(actionRunner(usersGetMemberships))
909
+ .action(actionRunner(usersListMemberships))
910
910
 
911
911
  users
912
912
  .command(`updateName`)
@@ -943,10 +943,10 @@ users
943
943
  .action(actionRunner(usersUpdatePrefs))
944
944
 
945
945
  users
946
- .command(`getSessions`)
946
+ .command(`listSessions`)
947
947
  .description(`Get the user sessions list by its unique ID.`)
948
948
  .requiredOption(`--userId <userId>`, `User ID.`)
949
- .action(actionRunner(usersGetSessions))
949
+ .action(actionRunner(usersListSessions))
950
950
 
951
951
  users
952
952
  .command(`deleteSessions`)
@@ -998,14 +998,14 @@ module.exports = {
998
998
  usersGet,
999
999
  usersDelete,
1000
1000
  usersUpdateEmail,
1001
- usersGetLogs,
1002
- usersGetMemberships,
1001
+ usersListLogs,
1002
+ usersListMemberships,
1003
1003
  usersUpdateName,
1004
1004
  usersUpdatePassword,
1005
1005
  usersUpdatePhone,
1006
1006
  usersGetPrefs,
1007
1007
  usersUpdatePrefs,
1008
- usersGetSessions,
1008
+ usersListSessions,
1009
1009
  usersDeleteSessions,
1010
1010
  usersDeleteSession,
1011
1011
  usersUpdateStatus,
package/lib/questions.js CHANGED
@@ -113,7 +113,7 @@ const questionsInitProject = [
113
113
  type: "input",
114
114
  name: "id",
115
115
  message: "What ID would you like to have for your project?",
116
- default: "myAwesomeProject",
116
+ default: "unique()",
117
117
  when(answers) {
118
118
  return answers.start == "new";
119
119
  },
@@ -251,7 +251,12 @@ const questionsDeployFunctions = [
251
251
  })
252
252
  return choices;
253
253
  }
254
- }
254
+ },
255
+ {
256
+ type: "input",
257
+ name: "override",
258
+ message: 'Are you sure you want to override this function's variables? This can lead to loss of secrets! Type "YES" to confirm.'
259
+ },
255
260
  ]
256
261
 
257
262
  const questionsDeployCollections = [
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "appwrite-cli",
3
3
  "homepage": "https://appwrite.io/support",
4
4
  "description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API",
5
- "version": "1.0.0-RC2",
5
+ "version": "1.1.0",
6
6
  "license": "BSD-3-Clause",
7
7
  "main": "index.js",
8
8
  "bin": {