appwrite-cli 6.0.0-rc.6 → 6.0.0-rc.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +3 -3
  2. package/docs/examples/functions/create.md +1 -0
  3. package/docs/examples/functions/{download-deployment.md → get-deployment-download.md} +1 -1
  4. package/docs/examples/functions/get-template.md +2 -0
  5. package/docs/examples/functions/list-specifications.md +1 -0
  6. package/docs/examples/functions/list-templates.md +5 -0
  7. package/docs/examples/functions/update.md +1 -0
  8. package/index.js +4 -3
  9. package/install.ps1 +2 -2
  10. package/install.sh +1 -1
  11. package/lib/client.js +3 -3
  12. package/lib/commands/account.js +1 -49
  13. package/lib/commands/assistant.js +1 -2
  14. package/lib/commands/avatars.js +1 -8
  15. package/lib/commands/console.js +1 -2
  16. package/lib/commands/databases.js +1 -49
  17. package/lib/commands/functions.js +182 -45
  18. package/lib/commands/generic.js +11 -11
  19. package/lib/commands/graphql.js +1 -3
  20. package/lib/commands/health.js +1 -24
  21. package/lib/commands/init.js +14 -24
  22. package/lib/commands/locale.js +1 -9
  23. package/lib/commands/messaging.js +1 -47
  24. package/lib/commands/migrations.js +1 -17
  25. package/lib/commands/project.js +1 -7
  26. package/lib/commands/projects.js +1 -46
  27. package/lib/commands/proxy.js +1 -6
  28. package/lib/commands/pull.js +81 -41
  29. package/lib/commands/push.js +134 -60
  30. package/lib/commands/run.js +10 -12
  31. package/lib/commands/storage.js +1 -16
  32. package/lib/commands/teams.js +1 -15
  33. package/lib/commands/users.js +1 -44
  34. package/lib/commands/vcs.js +1 -11
  35. package/lib/config.js +28 -8
  36. package/lib/emulation/docker.js +1 -3
  37. package/lib/paginate.js +3 -1
  38. package/lib/parser.js +12 -15
  39. package/lib/questions.js +16 -31
  40. package/package.json +2 -2
  41. package/scoop/appwrite.json +3 -3
@@ -2,10 +2,10 @@ const chalk = require('chalk');
2
2
  const inquirer = require("inquirer");
3
3
  const JSONbig = require("json-bigint")({ storeAsString: false });
4
4
  const { Command } = require("commander");
5
- const { localConfig, globalConfig, KeysAttributes, KeysFunction, whitelistKeys, KeysTopics, KeysStorage, KeysTeams, } = require("../config");
5
+ const { localConfig, globalConfig, KeysAttributes, KeysFunction, whitelistKeys, KeysTopics, KeysStorage, KeysTeams, KeysCollection } = require("../config");
6
6
  const { Spinner, SPINNER_ARC, SPINNER_DOTS } = require('../spinner');
7
7
  const { paginate } = require('../paginate');
8
- const { questionsPushBuckets, questionsPushTeams, questionsPushFunctions, questionsGetEntrypoint, questionsPushCollections, questionPushChanges, questionsPushMessagingTopics, questionsPushResources } = require("../questions");
8
+ const { questionsPushBuckets, questionsPushTeams, questionsPushFunctions, questionsGetEntrypoint, questionsPushCollections, questionPushChanges, questionPushChangesConfirmation, questionsPushMessagingTopics, questionsPushResources } = require("../questions");
9
9
  const { cliConfig, actionRunner, success, warn, log, hint, error, commandDescriptions, drawTable } = require("../parser");
10
10
  const { proxyListRules } = require('./proxy');
11
11
  const { functionsGet, functionsCreate, functionsUpdate, functionsCreateDeployment, functionsGetDeployment, functionsListVariables, functionsDeleteVariable, functionsCreateVariable } = require('./functions');
@@ -340,18 +340,62 @@ const awaitPools = {
340
340
  },
341
341
  }
342
342
 
343
- const approveChanges = async (resource, resourceGetFunction, keys, resourceName, resourcePlural) => {
343
+ const getConfirmation = async () => {
344
+ if (cliConfig.force) {
345
+ return true;
346
+ }
347
+
348
+ async function fixConfirmation() {
349
+ const answers = await inquirer.prompt(questionPushChangesConfirmation);
350
+ if (answers.changes !== 'YES' && answers.changes !== 'NO') {
351
+ return await fixConfirmation();
352
+ }
353
+
354
+ return answers.changes;
355
+ }
356
+
357
+ let answers = await inquirer.prompt(questionPushChanges);
358
+
359
+ if (answers.changes !== 'YES' && answers.changes !== 'NO') {
360
+ answers.changes = await fixConfirmation();
361
+ }
362
+
363
+ if (answers.changes === 'YES') {
364
+ return true;
365
+ }
366
+
367
+ warn('Skipping push action. Changes were not applied.');
368
+ return false;
369
+
370
+ };
371
+ const isEmpty = (value) => (value === null || value === undefined || (typeof value === "string" && value.trim().length === 0) || (Array.isArray(value) && value.length === 0));
372
+
373
+ const approveChanges = async (resource, resourceGetFunction, keys, resourceName, resourcePlural, skipKeys = [], secondId = '', secondResourceName = '') => {
344
374
  log('Checking for changes ...');
345
375
  const changes = [];
346
376
 
347
377
  await Promise.all(resource.map(async (localResource) => {
348
378
  try {
349
- const remoteResource = await resourceGetFunction({
379
+ const options = {
350
380
  [resourceName]: localResource['$id'],
351
381
  parseOutput: false,
352
- });
382
+ };
383
+
384
+ if (secondId !== '' && secondResourceName !== '') {
385
+ options[secondResourceName] = localResource[secondId]
386
+ }
387
+
388
+ const remoteResource = await resourceGetFunction(options);
353
389
 
354
390
  for (let [key, value] of Object.entries(whitelistKeys(remoteResource, keys))) {
391
+ if (skipKeys.includes(key)) {
392
+ continue;
393
+ }
394
+
395
+ if (isEmpty(value) && isEmpty(localResource[key])) {
396
+ continue;
397
+ }
398
+
355
399
  if (Array.isArray(value) && Array.isArray(localResource[key])) {
356
400
  if (JSON.stringify(value) !== JSON.stringify(localResource[key])) {
357
401
  changes.push({
@@ -382,11 +426,8 @@ const approveChanges = async (resource, resourceGetFunction, keys, resourceName,
382
426
  }
383
427
 
384
428
  drawTable(changes);
385
- if (!cliConfig.force) {
386
- const answers = await inquirer.prompt(questionPushChanges);
387
- if (answers.changes.toLowerCase() === 'yes') {
388
- return true;
389
- }
429
+ if ((await getConfirmation()) === true) {
430
+ return true;
390
431
  }
391
432
 
392
433
  success(`Successfully pushed 0 ${resourcePlural}.`);
@@ -399,7 +440,7 @@ const getObjectChanges = (remote, local, index, what) => {
399
440
  if (remote[index] && local[index]) {
400
441
  for (let [service, status] of Object.entries(remote[index])) {
401
442
  if (status !== local[index][service]) {
402
- changes.push({ group: what,setting: service, remote: chalk.red(status), local: chalk.green(local[index][service]) })
443
+ changes.push({ group: what, setting: service, remote: chalk.red(status), local: chalk.green(local[index][service]) })
403
444
  }
404
445
  }
405
446
  }
@@ -661,6 +702,24 @@ const deleteAttribute = async (collection, attribute, isIndex = false) => {
661
702
  });
662
703
  }
663
704
 
705
+ const compareAttribute = (remote, local, reason, key) => {
706
+ if (isEmpty(remote) && isEmpty(local)) {
707
+ return reason;
708
+ }
709
+
710
+ if (Array.isArray(remote) && Array.isArray(local)) {
711
+ if (JSON.stringify(remote) !== JSON.stringify(local)) {
712
+ const bol = reason === '' ? '' : '\n';
713
+ reason += `${bol}${key} changed from ${chalk.red(remote)} to ${chalk.green(local)}`;
714
+ }
715
+ } else if (remote !== local) {
716
+ const bol = reason === '' ? '' : '\n';
717
+ reason += `${bol}${key} changed from ${chalk.red(remote)} to ${chalk.green(local)}`;
718
+ }
719
+
720
+ return reason
721
+ }
722
+
664
723
 
665
724
  /**
666
725
  * Check if attribute non-changeable fields has been changed
@@ -688,11 +747,7 @@ const checkAttributeChanges = (remote, local, collection, recraeting = true) =>
688
747
 
689
748
  if (changeableKeys.includes(key)) {
690
749
  if (!recraeting) {
691
- if (remote[key] !== local[key]) {
692
- const bol = reason === '' ? '' : '\n';
693
- reason += `${bol}${key} changed from ${chalk.red(remote[key])} to ${chalk.green(local[key])}`;
694
- attribute = local;
695
- }
750
+ reason += compareAttribute(remote[key], local[key], reason, key)
696
751
  }
697
752
  continue;
698
753
  }
@@ -701,15 +756,7 @@ const checkAttributeChanges = (remote, local, collection, recraeting = true) =>
701
756
  continue;
702
757
  }
703
758
 
704
- if (Array.isArray(remote[key]) && Array.isArray(local[key])) {
705
- if (JSON.stringify(remote[key]) !== JSON.stringify(local[key])) {
706
- const bol = reason === '' ? '' : '\n';
707
- reason += `${bol}${key} changed from ${chalk.red(remote[key])} to ${chalk.green(local[key])}`;
708
- }
709
- } else if (remote[key] !== local[key]) {
710
- const bol = reason === '' ? '' : '\n';
711
- reason += `${bol}${key} changed from ${chalk.red(remote[key])} to ${chalk.green(local[key])}`;
712
- }
759
+ reason += compareAttribute(remote[key], local[key], reason, key)
713
760
  }
714
761
 
715
762
  return reason === '' ? undefined : { key: keyName, attribute, reason, action };
@@ -766,9 +813,7 @@ const attributesToCreate = async (remoteAttributes, localAttributes, collection,
766
813
  log(`Attribute recreation will cause ${chalk.red('loss of data')}`);
767
814
  }
768
815
 
769
- const answers = await inquirer.prompt(questionPushChanges);
770
-
771
- if (answers.changes.toLowerCase() !== 'yes') {
816
+ if ((await getConfirmation()) !== true) {
772
817
  return changedAttributes;
773
818
  }
774
819
  }
@@ -890,12 +935,9 @@ const pushSettings = async () => {
890
935
 
891
936
  if (changes.length > 0) {
892
937
  drawTable(changes);
893
- if (!cliConfig.force) {
894
- const answers = await inquirer.prompt(questionPushChanges);
895
- if (answers.changes.toLowerCase() !== 'yes') {
896
- success(`Successfully pushed 0 project settings.`);
897
- return;
898
- }
938
+ if ((await getConfirmation()) !== true) {
939
+ success(`Successfully pushed 0 project settings.`);
940
+ return;
899
941
  }
900
942
  }
901
943
  } catch (e) {
@@ -960,7 +1002,9 @@ const pushSettings = async () => {
960
1002
  }
961
1003
  }
962
1004
 
963
- const pushFunction = async ({ functionId, async, code } = { returnOnZero: false }) => {
1005
+ const pushFunction = async ({ functionId, async, code, withVariables } = { returnOnZero: false }) => {
1006
+ process.chdir(localConfig.configDirectoryPath)
1007
+
964
1008
  const functionIds = [];
965
1009
 
966
1010
  if (functionId) {
@@ -1009,7 +1053,7 @@ const pushFunction = async ({ functionId, async, code } = { returnOnZero: false
1009
1053
  }
1010
1054
  }
1011
1055
 
1012
- if (!(await approveChanges(functions, functionsGet, KeysFunction, 'functionId', 'functions'))) {
1056
+ if (!(await approveChanges(functions, functionsGet, KeysFunction, 'functionId', 'functions', ['vars']))) {
1013
1057
  return;
1014
1058
  }
1015
1059
 
@@ -1019,6 +1063,7 @@ const pushFunction = async ({ functionId, async, code } = { returnOnZero: false
1019
1063
  let successfullyPushed = 0;
1020
1064
  let successfullyDeployed = 0;
1021
1065
  const failedDeployments = [];
1066
+ const errors = [];
1022
1067
 
1023
1068
  await Promise.all(functions.map(async (func) => {
1024
1069
  let response = {};
@@ -1055,11 +1100,6 @@ const pushFunction = async ({ functionId, async, code } = { returnOnZero: false
1055
1100
  entrypoint: func.entrypoint,
1056
1101
  commands: func.commands,
1057
1102
  scopes: func.scopes,
1058
- providerRepositoryId: func.providerRepositoryId ?? "",
1059
- installationId: func.installationId ?? '',
1060
- providerBranch: func.providerBranch ?? '',
1061
- providerRootDirectory: func.providerRootDirectory ?? '',
1062
- providerSilentMode: func.providerSilentMode ?? false,
1063
1103
  vars: JSON.stringify(response.vars),
1064
1104
  parseOutput: false
1065
1105
  });
@@ -1068,6 +1108,7 @@ const pushFunction = async ({ functionId, async, code } = { returnOnZero: false
1068
1108
  if (Number(e.code) === 404) {
1069
1109
  functionExists = false;
1070
1110
  } else {
1111
+ errors.push(e);
1071
1112
  updaterRow.fail({ errorMessage: e.message ?? 'General error occurs please try again' });
1072
1113
  return;
1073
1114
  }
@@ -1095,11 +1136,45 @@ const pushFunction = async ({ functionId, async, code } = { returnOnZero: false
1095
1136
 
1096
1137
  updaterRow.update({ status: 'Created' });
1097
1138
  } catch (e) {
1139
+ errors.push(e)
1098
1140
  updaterRow.fail({ errorMessage: e.message ?? 'General error occurs please try again' });
1099
1141
  return;
1100
1142
  }
1101
1143
  }
1102
1144
 
1145
+ if (withVariables) {
1146
+ updaterRow.update({ status: 'Updating variables' }).replaceSpinner(SPINNER_ARC);
1147
+
1148
+ const { variables } = await paginate(functionsListVariables, {
1149
+ functionId: func['$id'],
1150
+ parseOutput: false
1151
+ }, 100, 'variables');
1152
+
1153
+ await Promise.all(variables.map(async variable => {
1154
+ await functionsDeleteVariable({
1155
+ functionId: func['$id'],
1156
+ variableId: variable['$id'],
1157
+ parseOutput: false
1158
+ });
1159
+ }));
1160
+
1161
+ let result = await awaitPools.wipeVariables(func['$id']);
1162
+ if (!result) {
1163
+ updaterRow.fail({ errorMessage: `Variable deletion timed out.` })
1164
+ return;
1165
+ }
1166
+
1167
+ // Deploy local variables
1168
+ await Promise.all((func['vars'] ?? []).map(async variable => {
1169
+ await functionsCreateVariable({
1170
+ functionId: func['$id'],
1171
+ key: variable['key'],
1172
+ value: variable['value'],
1173
+ parseOutput: false
1174
+ });
1175
+ }));
1176
+ }
1177
+
1103
1178
  if (code === false) {
1104
1179
  successfullyPushed++;
1105
1180
  successfullyDeployed++;
@@ -1123,6 +1198,8 @@ const pushFunction = async ({ functionId, async, code } = { returnOnZero: false
1123
1198
  deploymentCreated = true;
1124
1199
  successfullyPushed++;
1125
1200
  } catch (e) {
1201
+ errors.push(e);
1202
+
1126
1203
  switch (e.code) {
1127
1204
  case 'ENOENT':
1128
1205
  updaterRow.fail({ errorMessage: 'Not found in the current directory. Skipping...' })
@@ -1180,6 +1257,7 @@ const pushFunction = async ({ functionId, async, code } = { returnOnZero: false
1180
1257
  await new Promise(resolve => setTimeout(resolve, POLL_DEBOUNCE * 1.5));
1181
1258
  }
1182
1259
  } catch (e) {
1260
+ errors.push(e);
1183
1261
  updaterRow.fail({ errorMessage: e.message ?? 'Unknown error occurred. Please try again' })
1184
1262
  }
1185
1263
  }
@@ -1207,6 +1285,12 @@ const pushFunction = async ({ functionId, async, code } = { returnOnZero: false
1207
1285
  } else {
1208
1286
  success(`Successfully pushed ${successfullyPushed} functions.`);
1209
1287
  }
1288
+
1289
+ if (cliConfig.verbose) {
1290
+ errors.forEach(e => {
1291
+ console.error(e);
1292
+ })
1293
+ }
1210
1294
  }
1211
1295
 
1212
1296
  const pushCollection = async ({ returnOnZero, attempts } = { returnOnZero: false }) => {
@@ -1241,8 +1325,6 @@ const pushCollection = async ({ returnOnZero, attempts } = { returnOnZero: false
1241
1325
 
1242
1326
  const databases = Array.from(new Set(collections.map(collection => collection['databaseId'])));
1243
1327
 
1244
- log('Checking for changes ...');
1245
-
1246
1328
  // Parallel db actions
1247
1329
  await Promise.all(databases.map(async (databaseId) => {
1248
1330
  const localDatabase = localConfig.getDatabase(databaseId);
@@ -1273,6 +1355,10 @@ const pushCollection = async ({ returnOnZero, attempts } = { returnOnZero: false
1273
1355
  }
1274
1356
  }));
1275
1357
 
1358
+
1359
+ if (!(await approveChanges(collections, databasesGetCollection, KeysCollection, 'collectionId', 'collections', ['attributes', 'indexes'], 'databaseId', 'databaseId',))) {
1360
+ return;
1361
+ }
1276
1362
  // Parallel collection actions
1277
1363
  await Promise.all(collections.map(async (collection) => {
1278
1364
  try {
@@ -1343,10 +1429,10 @@ const pushCollection = async ({ returnOnZero, attempts } = { returnOnZero: false
1343
1429
  throw e;
1344
1430
  }
1345
1431
  numberOfCollections++;
1346
- success(`Pushed ${collection.name} ( ${collection['$id']} )`);
1432
+ success(`Successfully pushed ${collection.name} ( ${collection['$id']} )`);
1347
1433
  }
1348
1434
 
1349
- success(`Pushed ${numberOfCollections} collections`);
1435
+ success(`Successfully pushed ${numberOfCollections} collections`);
1350
1436
  }
1351
1437
 
1352
1438
  const pushBucket = async ({ returnOnZero } = { returnOnZero: false }) => {
@@ -1509,7 +1595,6 @@ const pushMessagingTopic = async ({ returnOnZero } = { returnOnZero: false }) =>
1509
1595
 
1510
1596
  let topicsIds = [];
1511
1597
  const configTopics = localConfig.getMessagingTopics();
1512
- let overrideExisting = cliConfig.force;
1513
1598
 
1514
1599
  if (cliConfig.all) {
1515
1600
  checkDeployConditions(localConfig);
@@ -1536,13 +1621,6 @@ const pushMessagingTopic = async ({ returnOnZero } = { returnOnZero: false }) =>
1536
1621
  topics.push(...idTopic);
1537
1622
  }
1538
1623
 
1539
- if (!cliConfig.force) {
1540
- const answers = await inquirer.prompt(questionsPushMessagingTopics[1])
1541
- if (answers.override.toLowerCase() === "yes") {
1542
- overrideExisting = true;
1543
- }
1544
- }
1545
-
1546
1624
  if (!(await approveChanges(topics, messagingGetTopic, KeysTopics, 'topicId', 'topics'))) {
1547
1625
  return;
1548
1626
  }
@@ -1559,11 +1637,6 @@ const pushMessagingTopic = async ({ returnOnZero } = { returnOnZero: false }) =>
1559
1637
  })
1560
1638
  log(`Topic ${topic.name} ( ${topic['$id']} ) already exists.`);
1561
1639
 
1562
- if (!overrideExisting) {
1563
- log(`Skipping ${topic.name} ( ${topic['$id']} )`);
1564
- continue;
1565
- }
1566
-
1567
1640
  await messagingUpdateTopic({
1568
1641
  topicId: topic['$id'],
1569
1642
  name: topic.name,
@@ -1615,6 +1688,7 @@ push
1615
1688
  .option(`-f, --function-id <function-id>`, `ID of function to run`)
1616
1689
  .option(`-A, --async`, `Don't wait for functions deployments status`)
1617
1690
  .option("--no-code", "Don't push the function's code")
1691
+ .option("--with-variables", `Push function variables.`)
1618
1692
  .action(actionRunner(pushFunction));
1619
1693
 
1620
1694
  push
@@ -1643,9 +1717,9 @@ push
1643
1717
  .action(actionRunner(pushMessagingTopic));
1644
1718
 
1645
1719
  const deploy = new Command("deploy")
1646
- .description(commandDescriptions['push'])
1720
+ .description('Removed. Use appwrite push instead')
1647
1721
  .action(actionRunner(async () => {
1648
- warn("Did you mean to run 'appwrite push' command?");
1722
+ warn("appwrite deploy has been removed. Please use 'appwrite push' instead");
1649
1723
  }));
1650
1724
 
1651
1725
  module.exports = {
@@ -17,9 +17,7 @@ const { systemHasCommand, isPortTaken, getAllFiles } = require('../utils');
17
17
  const { runtimeNames, systemTools, JwtManager, Queue } = require('../emulation/utils');
18
18
  const { dockerStop, dockerCleanup, dockerStart, dockerBuild, dockerPull } = require('../emulation/docker');
19
19
 
20
- const runFunction = async ({ port, functionId, variables, reload, userId } = {}) => {
21
- console.log(variables);
22
- console.log(reload);
20
+ const runFunction = async ({ port, functionId, withVariables, reload, userId } = {}) => {
23
21
  // Selection
24
22
  if(!functionId) {
25
23
  const answers = await inquirer.prompt(questionsRunFunctions[0]);
@@ -117,7 +115,7 @@ const runFunction = async ({ port, functionId, variables, reload, userId } = {})
117
115
  const userVariables = {};
118
116
  const allVariables = {};
119
117
 
120
- if(variables) {
118
+ if(withVariables) {
121
119
  try {
122
120
  const { variables: remoteVariables } = await paginate(functionsListVariables, {
123
121
  functionId: func['$id'],
@@ -129,7 +127,7 @@ const runFunction = async ({ port, functionId, variables, reload, userId } = {})
129
127
  userVariables[v.key] = v.value;
130
128
  });
131
129
  } catch(err) {
132
- warn("Remote variables not fetched. Production environment variables will not be avaiable. Reason: " + err.message);
130
+ warn("Remote variables not fetched. Production environment variables will not be available. Reason: " + err.message);
133
131
  }
134
132
  }
135
133
 
@@ -186,7 +184,7 @@ const runFunction = async ({ port, functionId, variables, reload, userId } = {})
186
184
  const ignorer = ignore();
187
185
  ignorer.add('.appwrite');
188
186
  ignorer.add('code.tar.gz');
189
-
187
+
190
188
  if (func.ignore) {
191
189
  ignorer.add(func.ignore);
192
190
  } else if (fs.existsSync(path.join(functionPath, '.gitignore'))) {
@@ -218,14 +216,14 @@ const runFunction = async ({ port, functionId, variables, reload, userId } = {})
218
216
  const dependencyFile = files.find((filePath) => tool.dependencyFiles.includes(filePath));
219
217
  if(tool.isCompiled || dependencyFile) {
220
218
  log(`Rebuilding the function due to file changes ...`);
221
- await dockerBuild(func, variables);
219
+ await dockerBuild(func, allVariables);
222
220
 
223
221
  if(!Queue.isEmpty()) {
224
222
  Queue.unlock();
225
223
  return;
226
224
  }
227
225
 
228
- await dockerStart(func, variables, port);
226
+ await dockerStart(func, allVariables, port);
229
227
  } else {
230
228
  log('Hot-swapping function.. Files with change are ' + files.join(', '));
231
229
 
@@ -281,7 +279,7 @@ const runFunction = async ({ port, functionId, variables, reload, userId } = {})
281
279
  file: buildPath
282
280
  }, ['.']);
283
281
 
284
- await dockerStart(func, variables, port);
282
+ await dockerStart(func, allVariables, port);
285
283
  }
286
284
  } catch(err) {
287
285
  console.error(err);
@@ -293,7 +291,7 @@ const runFunction = async ({ port, functionId, variables, reload, userId } = {})
293
291
  Queue.lock();
294
292
 
295
293
  log('Building function using Docker ...');
296
- await dockerBuild(func, variables);
294
+ await dockerBuild(func, allVariables);
297
295
 
298
296
  if(!Queue.isEmpty()) {
299
297
  Queue.unlock();
@@ -302,7 +300,7 @@ const runFunction = async ({ port, functionId, variables, reload, userId } = {})
302
300
 
303
301
  log('Starting function using Docker ...');
304
302
  hint('Function automatically restarts when you edit your code.');
305
- await dockerStart(func, variables, port);
303
+ await dockerStart(func, allVariables, port);
306
304
 
307
305
  Queue.unlock();
308
306
  }
@@ -323,7 +321,7 @@ run
323
321
  .option(`--function-id <function-id>`, `ID of function to run`)
324
322
  .option(`--port <port>`, `Local port`)
325
323
  .option(`--user-id <user-id>`, `ID of user to impersonate`)
326
- .option(`--no-variables`, `Prevent pulling variables from function settings`)
324
+ .option(`--with-variables`, `Run with function variables from function settings`)
327
325
  .option(`--no-reload`, `Prevent live reloading of server when changes are made to function files`)
328
326
  .action(actionRunner(runFunction));
329
327
 
@@ -35,7 +35,7 @@ function convertReadStreamToReadableStream(readStream) {
35
35
  });
36
36
  }
37
37
 
38
- const storage = new Command("storage").description(commandDescriptions['storage']).configureHelp({
38
+ const storage = new Command("storage").description(commandDescriptions['storage'] ?? '').configureHelp({
39
39
  helpWidth: process.stdout.columns || 80
40
40
  })
41
41
 
@@ -74,7 +74,6 @@ const storageListBuckets = async ({queries,search,parseOutput = true, overrideFo
74
74
  showConsoleLink('storage', 'listBuckets');
75
75
  } else {
76
76
  parse(response)
77
- success()
78
77
  }
79
78
  }
80
79
 
@@ -148,7 +147,6 @@ const storageCreateBucket = async ({bucketId,name,permissions,fileSecurity,enabl
148
147
 
149
148
  if (parseOutput) {
150
149
  parse(response)
151
- success()
152
150
  }
153
151
 
154
152
  return response;
@@ -183,7 +181,6 @@ const storageGetBucket = async ({bucketId,parseOutput = true, overrideForCli = f
183
181
  showConsoleLink('storage', 'getBucket', bucketId);
184
182
  } else {
185
183
  parse(response)
186
- success()
187
184
  }
188
185
  }
189
186
 
@@ -254,7 +251,6 @@ const storageUpdateBucket = async ({bucketId,name,permissions,fileSecurity,enabl
254
251
 
255
252
  if (parseOutput) {
256
253
  parse(response)
257
- success()
258
254
  }
259
255
 
260
256
  return response;
@@ -286,7 +282,6 @@ const storageDeleteBucket = async ({bucketId,parseOutput = true, overrideForCli
286
282
 
287
283
  if (parseOutput) {
288
284
  parse(response)
289
- success()
290
285
  }
291
286
 
292
287
  return response;
@@ -329,7 +324,6 @@ const storageListFiles = async ({bucketId,queries,search,parseOutput = true, ove
329
324
  showConsoleLink('storage', 'listFiles', bucketId);
330
325
  } else {
331
326
  parse(response)
332
- success()
333
327
  }
334
328
  }
335
329
 
@@ -465,7 +459,6 @@ const storageCreateFile = async ({bucketId,fileId,file,permissions,parseOutput =
465
459
 
466
460
  if (parseOutput) {
467
461
  parse(response)
468
- success()
469
462
  }
470
463
 
471
464
  return response;
@@ -500,7 +493,6 @@ const storageGetFile = async ({bucketId,fileId,parseOutput = true, overrideForCl
500
493
  showConsoleLink('storage', 'getFile', bucketId, fileId);
501
494
  } else {
502
495
  parse(response)
503
- success()
504
496
  }
505
497
  }
506
498
 
@@ -543,7 +535,6 @@ const storageUpdateFile = async ({bucketId,fileId,name,permissions,parseOutput =
543
535
 
544
536
  if (parseOutput) {
545
537
  parse(response)
546
- success()
547
538
  }
548
539
 
549
540
  return response;
@@ -576,7 +567,6 @@ const storageDeleteFile = async ({bucketId,fileId,parseOutput = true, overrideFo
576
567
 
577
568
  if (parseOutput) {
578
569
  parse(response)
579
- success()
580
570
  }
581
571
 
582
572
  return response;
@@ -621,7 +611,6 @@ const storageGetFileDownload = async ({bucketId,fileId,parseOutput = true, overr
621
611
  fs.writeFileSync(destination, response);
622
612
  if (parseOutput) {
623
613
  parse(response)
624
- success()
625
614
  }
626
615
 
627
616
  return response;
@@ -710,7 +699,6 @@ const storageGetFilePreview = async ({bucketId,fileId,width,height,gravity,quali
710
699
  fs.writeFileSync(destination, response);
711
700
  if (parseOutput) {
712
701
  parse(response)
713
- success()
714
702
  }
715
703
 
716
704
  return response;
@@ -755,7 +743,6 @@ const storageGetFileView = async ({bucketId,fileId,parseOutput = true, overrideF
755
743
  fs.writeFileSync(destination, response);
756
744
  if (parseOutput) {
757
745
  parse(response)
758
- success()
759
746
  }
760
747
 
761
748
  return response;
@@ -790,7 +777,6 @@ const storageGetUsage = async ({range,parseOutput = true, overrideForCli = false
790
777
 
791
778
  if (parseOutput) {
792
779
  parse(response)
793
- success()
794
780
  }
795
781
 
796
782
  return response;
@@ -829,7 +815,6 @@ const storageGetBucketUsage = async ({bucketId,range,parseOutput = true, overrid
829
815
  showConsoleLink('storage', 'getBucketUsage', bucketId);
830
816
  } else {
831
817
  parse(response)
832
- success()
833
818
  }
834
819
  }
835
820