appwrite-cli 0.14.0 → 0.17.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.
@@ -1,7 +1,10 @@
1
1
  const fs = require('fs');
2
+ const pathLib = require('path');
3
+ const tar = require("tar");
4
+ const ignore = require("ignore");
2
5
  const { promisify } = require('util');
3
6
  const libClient = require('../client.js');
4
- const childProcess = require('child_process');
7
+ const { getAllFiles } = require('../utils.js');
5
8
  const { Command } = require('commander');
6
9
  const { sdkForProject, sdkForConsole } = require('../sdks')
7
10
  const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log } = require('../parser')
@@ -648,7 +651,7 @@ const databaseCreateDocument = async ({ collectionId, documentId, data, read, wr
648
651
  }
649
652
 
650
653
  if (typeof data !== 'undefined') {
651
- payload['data'] = data;
654
+ payload['data'] = JSON.parse(data);
652
655
  }
653
656
 
654
657
  if (typeof read !== 'undefined') {
@@ -703,7 +706,7 @@ const databaseUpdateDocument = async ({ collectionId, documentId, data, read, wr
703
706
 
704
707
  /** Body Params */
705
708
  if (typeof data !== 'undefined') {
706
- payload['data'] = data;
709
+ payload['data'] = JSON.parse(data);
707
710
  }
708
711
 
709
712
  if (typeof read !== 'undefined') {
@@ -962,7 +965,7 @@ database
962
965
  .description(`Create a new Collection.`)
963
966
  .requiredOption(`--collectionId <collectionId>`, `Unique Id. Choose your own unique ID or pass the string "unique()" to auto generate it. 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.`)
964
967
  .requiredOption(`--name <name>`, `Collection name. Max length: 128 chars.`)
965
- .requiredOption(`--permission <permission>`, `Permissions type model to use for reading documents in this collection. You can use collection-level permission set once on the collection using the 'read' and 'write' params, or you can set document-level permission where each document read and write params will decide who has access to read and write to each document individually. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.`)
968
+ .requiredOption(`--permission <permission>`, `Specifies the permissions model used in this collection, which accepts either 'collection' or 'document'. For 'collection' level permission, the permissions specified in read and write params are applied to all documents in the collection. For 'document' level permissions, read and write permissions are specified in each document. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.`)
966
969
  .requiredOption(`--read <read...>`, `An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.`)
967
970
  .requiredOption(`--write <write...>`, `An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.`)
968
971
  .action(actionRunner(databaseCreateCollection))
@@ -1021,7 +1024,7 @@ database
1021
1024
  .description(``)
1022
1025
  .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/database#createCollection).`)
1023
1026
  .requiredOption(`--key <key>`, `Attribute Key.`)
1024
- .requiredOption(`--elements <elements...>`, `Array of elements in enumerated type. Uses length of longest element to determine size.`)
1027
+ .requiredOption(`--elements <elements...>`, `Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 1024 characters long.`)
1025
1028
  .requiredOption(`--required <required>`, `Is attribute required?`, parseBool)
1026
1029
  .option(`--xdefault <xdefault>`, `Default value for attribute when not provided. Cannot be set when attribute is required.`)
1027
1030
  .option(`--array <array>`, `Is attribute an array?`, parseBool)
@@ -1100,13 +1103,13 @@ database
1100
1103
  .command(`listDocuments`)
1101
1104
  .description(`Get a list of all the user documents. 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 documents. [Learn more about different API modes](/docs/admin).`)
1102
1105
  .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/database#createCollection).`)
1103
- .option(`--queries <queries...>`, `Array of query strings.`)
1106
+ .option(`--queries <queries...>`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/database#querying-documents). Maximum of 100 queries are allowed, each 128 characters long.`)
1104
1107
  .option(`--limit <limit>`, `Maximum number of documents to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.`, parseInteger)
1105
1108
  .option(`--offset <offset>`, `Offset value. The default value is 0. Use this value to manage pagination. [learn more about pagination](https://appwrite.io/docs/pagination)`, parseInteger)
1106
1109
  .option(`--cursor <cursor>`, `ID of the document used as the starting point for the query, excluding the document itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https://appwrite.io/docs/pagination)`)
1107
1110
  .option(`--cursorDirection <cursorDirection>`, `Direction of the cursor.`)
1108
- .option(`--orderAttributes <orderAttributes...>`, `Array of attributes used to sort results.`)
1109
- .option(`--orderTypes <orderTypes...>`, `Array of order directions for sorting attribtues. Possible values are DESC for descending order, or ASC for ascending order.`)
1111
+ .option(`--orderAttributes <orderAttributes...>`, `Array of attributes used to sort results. Maximum of 100 order attributes are allowed, each 128 characters long.`)
1112
+ .option(`--orderTypes <orderTypes...>`, `Array of order directions for sorting attribtues. Possible values are DESC for descending order, or ASC for ascending order. Maximum of 100 order types are allowed.`)
1110
1113
  .action(actionRunner(databaseListDocuments))
1111
1114
 
1112
1115
  database
@@ -1131,14 +1134,14 @@ database
1131
1134
  .description(`Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.`)
1132
1135
  .requiredOption(`--collectionId <collectionId>`, `Collection ID.`)
1133
1136
  .requiredOption(`--documentId <documentId>`, `Document ID.`)
1134
- .requiredOption(`--data <data>`, `Document data as JSON object.`)
1137
+ .requiredOption(`--data <data>`, `Document data as JSON object. Include only attribute and value pairs to be updated.`)
1135
1138
  .option(`--read <read...>`, `An array of strings with read permissions. By default inherits the existing read permissions. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.`)
1136
1139
  .option(`--write <write...>`, `An array of strings with write permissions. By default inherits the existing write permissions. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.`)
1137
1140
  .action(actionRunner(databaseUpdateDocument))
1138
1141
 
1139
1142
  database
1140
1143
  .command(`deleteDocument`)
1141
- .description(`Delete a document by its unique ID. This endpoint deletes only the parent documents, its attributes and relations to other documents. Child documents **will not** be deleted.`)
1144
+ .description(`Delete a document by its unique ID.`)
1142
1145
  .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/database#createCollection).`)
1143
1146
  .requiredOption(`--documentId <documentId>`, `Document ID.`)
1144
1147
  .action(actionRunner(databaseDeleteDocument))
@@ -1164,8 +1167,8 @@ database
1164
1167
  .requiredOption(`--collectionId <collectionId>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/database#createCollection).`)
1165
1168
  .requiredOption(`--key <key>`, `Index Key.`)
1166
1169
  .requiredOption(`--type <type>`, `Index type.`)
1167
- .requiredOption(`--attributes <attributes...>`, `Array of attributes to index.`)
1168
- .option(`--orders <orders...>`, `Array of index orders.`)
1170
+ .requiredOption(`--attributes <attributes...>`, `Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long.`)
1171
+ .option(`--orders <orders...>`, `Array of index orders. Maximum of 100 orders are allowed.`)
1169
1172
  .action(actionRunner(databaseCreateIndex))
1170
1173
 
1171
1174
  database
@@ -1235,4 +1238,4 @@ module.exports = {
1235
1238
  databaseListCollectionLogs,
1236
1239
  databaseGetUsage,
1237
1240
  databaseGetCollectionUsage
1238
- };
1241
+ };
@@ -1,4 +1,5 @@
1
1
  const inquirer = require("inquirer");
2
+ const JSONbig = require("json-bigint")({ storeAsString: false });
2
3
  const { Command } = require("commander");
3
4
  const { localConfig } = require("../config");
4
5
  const { questionsDeployFunctions, questionsGetEntrypoint, questionsDeployCollections } = require("../questions");
@@ -167,7 +168,7 @@ const deployFunction = async () => {
167
168
  functionId: func['$id'],
168
169
  name: func.name,
169
170
  execute: func.execute,
170
- vars: func.vars,
171
+ vars: JSON.stringify(response.vars),
171
172
  events: func.events,
172
173
  schedule: func.schedule,
173
174
  timeout: func.timeout,
@@ -181,7 +182,7 @@ const deployFunction = async () => {
181
182
  name: func.name,
182
183
  runtime: func.runtime,
183
184
  execute: func.execute,
184
- vars: func.vars,
185
+ vars: JSON.stringify(func.vars),
185
186
  events: func.events,
186
187
  schedule: func.schedule,
187
188
  timeout: func.timeout,
@@ -319,7 +320,7 @@ const createAttribute = async (collectionId, attribute) => {
319
320
  const deployCollection = async () => {
320
321
  let response = {};
321
322
  let answers = await inquirer.prompt(questionsDeployCollections[0])
322
- let collections = answers.collections
323
+ let collections = answers.collections.map((collection) => JSONbig.parse(collection));
323
324
 
324
325
  for (let collection of collections) {
325
326
  log(`Deploying collection ${collection.name} ( ${collection['$id']} )`)
@@ -1,7 +1,10 @@
1
1
  const fs = require('fs');
2
+ const pathLib = require('path');
3
+ const tar = require("tar");
4
+ const ignore = require("ignore");
2
5
  const { promisify } = require('util');
3
6
  const libClient = require('../client.js');
4
- const childProcess = require('child_process');
7
+ const { getAllFiles } = require('../utils.js');
5
8
  const { Command } = require('commander');
6
9
  const { sdkForProject, sdkForConsole } = require('../sdks')
7
10
  const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log } = require('../parser')
@@ -84,7 +87,7 @@ const functionsCreate = async ({ functionId, name, execute, runtime, vars, event
84
87
  }
85
88
 
86
89
  if (typeof vars !== 'undefined') {
87
- payload['vars'] = vars;
90
+ payload['vars'] = JSON.parse(vars);
88
91
  }
89
92
 
90
93
  if (typeof events !== 'undefined') {
@@ -169,7 +172,7 @@ const functionsUpdate = async ({ functionId, name, execute, vars, events, schedu
169
172
  }
170
173
 
171
174
  if (typeof vars !== 'undefined') {
172
- payload['vars'] = vars;
175
+ payload['vars'] = JSON.parse(vars);
173
176
  }
174
177
 
175
178
  if (typeof events !== 'undefined') {
@@ -261,7 +264,7 @@ const functionsListDeployments = async ({ functionId, search, limit, offset, cur
261
264
  const functionsCreateDeployment = async ({ functionId, entrypoint, code, activate, parseOutput = true, sdk = undefined, onProgress = () => {}}) => {
262
265
  /* @param {string} functionId */
263
266
  /* @param {string} entrypoint */
264
- /* @param {File} code */
267
+ /* @param {string} code */
265
268
  /* @param {boolean} activate */
266
269
 
267
270
  let client = !sdk ? await sdkForProject() : sdk;
@@ -276,10 +279,32 @@ const functionsCreateDeployment = async ({ functionId, entrypoint, code, activat
276
279
  let folderPath = fs.realpathSync(code);
277
280
  if (!fs.lstatSync(folderPath).isDirectory())
278
281
  throw new Error('The path is not a directory.');
279
- childProcess.execSync(`tar --cd '${folderPath}' -zcvf code.tar.gz .`, { stdio: 'pipe' });
282
+
283
+ const ignorer = ignore();
284
+
285
+ const func = localConfig.getFunction(functionId);
286
+
287
+ if(func.ignore) {
288
+ ignorer.add(func.ignore);
289
+ log('Ignoring files using configuration from appwrite.json');
290
+ } else if(fs.existsSync(pathLib.join(code, '.gitignore'))) {
291
+ ignorer.add(fs.readFileSync(pathLib.join(code, '.gitignore')).toString());
292
+ log('Ignoring files in .gitignore');
293
+ }
294
+
295
+ const files = getAllFiles(code).map((file) => pathLib.relative(code, file)).filter((file) => !ignorer.ignores(file));
296
+
297
+ await tar
298
+ .create({
299
+ gzip: true,
300
+ sync: true,
301
+ cwd: folderPath,
302
+ file: 'code.tar.gz'
303
+ }, files);
280
304
  let archivePath = fs.realpathSync('code.tar.gz')
281
305
  if (typeof archivePath !== 'undefined') {
282
306
  payload['code'] = archivePath;
307
+ code = archivePath;
283
308
  }
284
309
 
285
310
  if (typeof activate !== 'undefined') {
@@ -294,40 +319,53 @@ const functionsCreateDeployment = async ({ functionId, entrypoint, code, activat
294
319
 
295
320
  response = await client.call('post', path, {
296
321
  'content-type': 'multipart/form-data',
297
- }, payload);
322
+ }, payload).catch(err => {
323
+ fs.unlinkSync(archivePath);
324
+ throw err
325
+ });
298
326
  } else {
299
327
  const streamFilePath = payload['code'];
300
328
  let id = undefined;
301
329
 
330
+ let counter = 0;
302
331
  const totalCounters = Math.ceil(size / libClient.CHUNK_SIZE);
303
332
 
304
- for (let counter = 0; counter < totalCounters; counter++) {
305
- const start = (counter * libClient.CHUNK_SIZE);
306
- const end = Math.min((((counter * libClient.CHUNK_SIZE) + libClient.CHUNK_SIZE) - 1), size);
307
- const headers = {
308
- 'content-type': 'multipart/form-data',
309
- 'content-range': 'bytes ' + start + '-' + end + '/' + size
310
- };
311
-
312
- if (id) {
313
- headers['x-appwrite-id'] = id;
314
- }
315
-
316
- const stream = fs.createReadStream(streamFilePath, {
317
- start,
318
- end
319
- });
320
- payload['code'] = stream;
333
+ const headers = {
334
+ 'content-type': 'multipart/form-data',
335
+ };
321
336
 
322
- response = await client.call('post', path, headers, payload);
323
337
 
324
- if (!id) {
325
- id = response['$id'];
326
- }
338
+ for (counter; counter < totalCounters; counter++) {
339
+ const start = (counter * libClient.CHUNK_SIZE);
340
+ const end = Math.min((((counter * libClient.CHUNK_SIZE) + libClient.CHUNK_SIZE) - 1), size);
327
341
 
328
- if (onProgress !== null) {
329
- onProgress(Math.min((counter+1) * libClient.CHUNK_SIZE, size) / size * 100);
330
- }
342
+ headers['content-range'] = 'bytes ' + start + '-' + end + '/' + size;
343
+
344
+ if (id) {
345
+ headers['x-appwrite-id'] = id;
346
+ }
347
+
348
+ const stream = fs.createReadStream(streamFilePath, {
349
+ start,
350
+ end
351
+ });
352
+ payload['code'] = stream;
353
+
354
+ response = await client.call('post', path, headers, payload);
355
+
356
+ if (!id) {
357
+ id = response['$id'];
358
+ }
359
+
360
+ if (onProgress !== null) {
361
+ onProgress({
362
+ $id: response['$id'],
363
+ progress: Math.min((counter+1) * libClient.CHUNK_SIZE, size) / size * 100,
364
+ sizeUploaded: end+1,
365
+ chunksTotal: response['chunksTotal'],
366
+ chunksUploaded: response['chunksUploaded']
367
+ });
368
+ }
331
369
  }
332
370
  }
333
371
 
@@ -547,17 +585,17 @@ functions
547
585
  .description(`Create a new function. You can pass a list of [permissions](/docs/permissions) to allow different project users or team with access to execute the function using the client API.`)
548
586
  .requiredOption(`--functionId <functionId>`, `Function ID. Choose your own unique ID or pass the string "unique()" to auto generate it. 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.`)
549
587
  .requiredOption(`--name <name>`, `Function name. Max length: 128 chars.`)
550
- .requiredOption(`--execute <execute...>`, `An array of strings with execution permissions. By default no user is granted with any execute permissions. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.`)
588
+ .requiredOption(`--execute <execute...>`, `An array of strings with execution permissions. By default no user is granted with any execute permissions. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions. Maximum of 100 scopes are allowed, each 64 characters long.`)
551
589
  .requiredOption(`--runtime <runtime>`, `Execution runtime.`)
552
590
  .option(`--vars <vars>`, `Key-value JSON object that will be passed to the function as environment variables.`)
553
- .option(`--events <events...>`, `Events list.`)
591
+ .option(`--events <events...>`, `Events list. Maximum of 100 events are allowed.`)
554
592
  .option(`--schedule <schedule>`, `Schedule CRON syntax.`)
555
593
  .option(`--timeout <timeout>`, `Function maximum execution time in seconds.`, parseInteger)
556
594
  .action(actionRunner(functionsCreate))
557
595
 
558
596
  functions
559
597
  .command(`listRuntimes`)
560
- .description(`Get a list of all runtimes that are currently active in your project.`)
598
+ .description(`Get a list of all runtimes that are currently active on your instance.`)
561
599
  .action(actionRunner(functionsListRuntimes))
562
600
 
563
601
  functions
@@ -571,9 +609,9 @@ functions
571
609
  .description(`Update function by its unique ID.`)
572
610
  .requiredOption(`--functionId <functionId>`, `Function ID.`)
573
611
  .requiredOption(`--name <name>`, `Function name. Max length: 128 chars.`)
574
- .requiredOption(`--execute <execute...>`, `An array of strings with execution permissions. By default no user is granted with any execute permissions. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.`)
612
+ .requiredOption(`--execute <execute...>`, `An array of strings with execution permissions. By default no user is granted with any execute permissions. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions. Maximum of 100 scopes are allowed, each 64 characters long.`)
575
613
  .option(`--vars <vars>`, `Key-value JSON object that will be passed to the function as environment variables.`)
576
- .option(`--events <events...>`, `Events list.`)
614
+ .option(`--events <events...>`, `Events list. Maximum of 100 events are allowed.`)
577
615
  .option(`--schedule <schedule>`, `Schedule CRON syntax.`)
578
616
  .option(`--timeout <timeout>`, `Maximum execution time in seconds.`, parseInteger)
579
617
  .action(actionRunner(functionsUpdate))
@@ -686,4 +724,4 @@ module.exports = {
686
724
  functionsCreateExecution,
687
725
  functionsGetExecution,
688
726
  functionsGetUsage
689
- };
727
+ };
@@ -1,5 +1,6 @@
1
1
  const inquirer = require("inquirer");
2
2
  const { Command } = require("commander");
3
+ const Client = require("../client");
3
4
  const { sdkForConsole } = require("../sdks");
4
5
  const { globalConfig, localConfig } = require("../config");
5
6
  const { actionRunner, success, parseBool, commandDescriptions, log, parse } = require("../parser");
@@ -65,13 +66,19 @@ const client = new Command("client")
65
66
  if (endpoint !== undefined) {
66
67
  try {
67
68
  let url = new URL(endpoint);
68
- if (url.protocol === "http:" || url.protocol === "https:") {
69
- globalConfig.setEndpoint(endpoint);
70
- } else {
69
+ if (url.protocol !== "http:" && url.protocol !== "https:") {
71
70
  throw new Error();
72
71
  }
72
+
73
+ let client = new Client().setEndpoint(endpoint);
74
+ let response = await client.call('GET', '/health/version');
75
+ if(!response.version) {
76
+ throw new Error();
77
+ }
78
+
79
+ globalConfig.setEndpoint(endpoint);
73
80
  } catch (_) {
74
- throw new Error("Invalid endpoint");
81
+ throw new Error("Invalid endpoint or your Appwrite server is not running as expected.");
75
82
  }
76
83
  }
77
84
 
@@ -1,7 +1,10 @@
1
1
  const fs = require('fs');
2
+ const pathLib = require('path');
3
+ const tar = require("tar");
4
+ const ignore = require("ignore");
2
5
  const { promisify } = require('util');
3
6
  const libClient = require('../client.js');
4
- const childProcess = require('child_process');
7
+ const { getAllFiles } = require('../utils.js');
5
8
  const { Command } = require('commander');
6
9
  const { sdkForProject, sdkForConsole } = require('../sdks')
7
10
  const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log } = require('../parser')
@@ -128,23 +131,6 @@ const healthGetQueueLogs = async ({ parseOutput = true, sdk = undefined}) => {
128
131
  return response;
129
132
  }
130
133
 
131
- const healthGetQueueUsage = async ({ parseOutput = true, sdk = undefined}) => {
132
-
133
- let client = !sdk ? await sdkForProject() : sdk;
134
- let path = '/health/queue/usage';
135
- let payload = {};
136
- let response = undefined;
137
- response = await client.call('get', path, {
138
- 'content-type': 'application/json',
139
- }, payload);
140
-
141
- if (parseOutput) {
142
- parse(response)
143
- success()
144
- }
145
- return response;
146
- }
147
-
148
134
  const healthGetQueueWebhooks = async ({ parseOutput = true, sdk = undefined}) => {
149
135
 
150
136
  let client = !sdk ? await sdkForProject() : sdk;
@@ -232,11 +218,6 @@ health
232
218
  .description(`Get the number of logs that are waiting to be processed in the Appwrite internal queue server.`)
233
219
  .action(actionRunner(healthGetQueueLogs))
234
220
 
235
- health
236
- .command(`getQueueUsage`)
237
- .description(`Get the number of usage stats that are waiting to be processed in the Appwrite internal queue server.`)
238
- .action(actionRunner(healthGetQueueUsage))
239
-
240
221
  health
241
222
  .command(`getQueueWebhooks`)
242
223
  .description(`Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server.`)
@@ -262,8 +243,7 @@ module.exports = {
262
243
  healthGetQueueCertificates,
263
244
  healthGetQueueFunctions,
264
245
  healthGetQueueLogs,
265
- healthGetQueueUsage,
266
246
  healthGetQueueWebhooks,
267
247
  healthGetStorageLocal,
268
248
  healthGetTime
269
- };
249
+ };
@@ -99,8 +99,8 @@ const initFunction = async () => {
99
99
  runtime: response.runtime,
100
100
  path: `functions/${answers.name}`,
101
101
  entrypoint: answers.runtime.entrypoint || '',
102
+ ignore: answers.runtime.ignore || null,
102
103
  execute: response.execute,
103
- vars: response.vars,
104
104
  events: response.events,
105
105
  schedule: response.schedule,
106
106
  timeout: response.timeout,
@@ -1,7 +1,10 @@
1
1
  const fs = require('fs');
2
+ const pathLib = require('path');
3
+ const tar = require("tar");
4
+ const ignore = require("ignore");
2
5
  const { promisify } = require('util');
3
6
  const libClient = require('../client.js');
4
- const childProcess = require('child_process');
7
+ const { getAllFiles } = require('../utils.js');
5
8
  const { Command } = require('commander');
6
9
  const { sdkForProject, sdkForConsole } = require('../sdks')
7
10
  const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log } = require('../parser')
@@ -174,4 +177,4 @@ module.exports = {
174
177
  localeGetCountriesPhones,
175
178
  localeGetCurrencies,
176
179
  localeGetLanguages
177
- };
180
+ };
@@ -1,7 +1,10 @@
1
1
  const fs = require('fs');
2
+ const pathLib = require('path');
3
+ const tar = require("tar");
4
+ const ignore = require("ignore");
2
5
  const { promisify } = require('util');
3
6
  const libClient = require('../client.js');
4
- const childProcess = require('child_process');
7
+ const { getAllFiles } = require('../utils.js');
5
8
  const { Command } = require('commander');
6
9
  const { sdkForProject, sdkForConsole } = require('../sdks')
7
10
  const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log } = require('../parser')
@@ -1018,7 +1021,7 @@ projects
1018
1021
  .description(``)
1019
1022
  .requiredOption(`--projectId <projectId>`, `Project unique ID.`)
1020
1023
  .requiredOption(`--name <name>`, `Key name. Max length: 128 chars.`)
1021
- .requiredOption(`--scopes <scopes...>`, `Key scopes list.`)
1024
+ .requiredOption(`--scopes <scopes...>`, `Key scopes list. Maximum of 100 scopes are allowed.`)
1022
1025
  .action(actionRunner(projectsCreateKey))
1023
1026
 
1024
1027
  projects
@@ -1034,7 +1037,7 @@ projects
1034
1037
  .requiredOption(`--projectId <projectId>`, `Project unique ID.`)
1035
1038
  .requiredOption(`--keyId <keyId>`, `Key unique ID.`)
1036
1039
  .requiredOption(`--name <name>`, `Key name. Max length: 128 chars.`)
1037
- .requiredOption(`--scopes <scopes...>`, `Key scopes list`)
1040
+ .requiredOption(`--scopes <scopes...>`, `Key scopes list. Maximum of 100 events are allowed.`)
1038
1041
  .action(actionRunner(projectsUpdateKey))
1039
1042
 
1040
1043
  projects
@@ -1121,7 +1124,7 @@ projects
1121
1124
  .description(``)
1122
1125
  .requiredOption(`--projectId <projectId>`, `Project unique ID.`)
1123
1126
  .requiredOption(`--name <name>`, `Webhook name. Max length: 128 chars.`)
1124
- .requiredOption(`--events <events...>`, `Events list.`)
1127
+ .requiredOption(`--events <events...>`, `Events list. Maximum of 100 events are allowed.`)
1125
1128
  .requiredOption(`--url <url>`, `Webhook URL.`)
1126
1129
  .requiredOption(`--security <security>`, `Certificate verification, false for disabled or true for enabled.`, parseBool)
1127
1130
  .option(`--httpUser <httpUser>`, `Webhook HTTP user. Max length: 256 chars.`)
@@ -1141,7 +1144,7 @@ projects
1141
1144
  .requiredOption(`--projectId <projectId>`, `Project unique ID.`)
1142
1145
  .requiredOption(`--webhookId <webhookId>`, `Webhook unique ID.`)
1143
1146
  .requiredOption(`--name <name>`, `Webhook name. Max length: 128 chars.`)
1144
- .requiredOption(`--events <events...>`, `Events list.`)
1147
+ .requiredOption(`--events <events...>`, `Events list. Maximum of 100 events are allowed.`)
1145
1148
  .requiredOption(`--url <url>`, `Webhook URL.`)
1146
1149
  .requiredOption(`--security <security>`, `Certificate verification, false for disabled or true for enabled.`, parseBool)
1147
1150
  .option(`--httpUser <httpUser>`, `Webhook HTTP user. Max length: 256 chars.`)
@@ -1188,4 +1191,4 @@ module.exports = {
1188
1191
  projectsGetWebhook,
1189
1192
  projectsUpdateWebhook,
1190
1193
  projectsDeleteWebhook
1191
- };
1194
+ };