para-cli 1.19.1 → 1.20.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
@@ -52,6 +52,7 @@ para-cli ping
52
52
  new-key Generates a new secret key and saves it to config.json
53
53
  new-jwt Generates a new JWT super token to be used for app authentication
54
54
  new-app <name> --name --shared Creates a new Para app. Only works if you have the keys for the "root" app
55
+ delete-app <id> Deletes an existing Para app. Only works for child apps, not the "root" app
55
56
  export Exports all data from the app's table
56
57
  import <file> Imports data from a previously exported ZIP archive
57
58
  ping Tests the connection to the Para server
package/index.js CHANGED
@@ -303,6 +303,36 @@ export function newApp(pc, input, flags) {
303
303
  });
304
304
  }
305
305
 
306
+ export function deleteApp(pc, input, flags) {
307
+ if (!input[1]) {
308
+ fail('App id not specified.');
309
+ return;
310
+ }
311
+ var appid = input[1];
312
+ if (appid.indexOf('app:') < 0) {
313
+ appid = 'app:' + appid;
314
+ }
315
+ var rl = createInterface({
316
+ input: process.stdin,
317
+ output: process.stdout
318
+ });
319
+ rl.question(red.bold('Are you sure you want to delete ' + appid +
320
+ '? ALL DATA FOR THAT APP WILL BE LOST! ') + 'yes/No ', function (confirm) {
321
+ if (confirm === "yes") {
322
+ pc.invokeDelete('apps/' + appid, {}).then(function (resp) {
323
+ if (resp && resp.ok) {
324
+ console.log(green('✔'), 'App ' + red.bold(appid) + ' was deleted!');
325
+ } else {
326
+ console.log(green('✔'), yellow('App "' + appid + '" could not be deleted.'));
327
+ }
328
+ }).catch(function (err) {
329
+ fail('Failed to delete app:', err);
330
+ });
331
+ }
332
+ rl.close();
333
+ });
334
+ }
335
+
306
336
  export function ping(pc, config) {
307
337
  pc.me().then(function (mee) {
308
338
  pc.getServerVersion().then(function (ver) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "para-cli",
3
- "version": "1.19.1",
3
+ "version": "1.20.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Command-line tool for Para backend servers",
6
6
  "homepage": "https://paraio.org",
@@ -24,7 +24,7 @@
24
24
  "api"
25
25
  ],
26
26
  "devDependencies": {
27
- "eslint": "^8.28.0"
27
+ "eslint": "^8.29.0"
28
28
  },
29
29
  "repository": "Erudika/para-cli",
30
30
  "dependencies": {
package/para-cli.js CHANGED
@@ -29,7 +29,7 @@ import chalk from 'chalk';
29
29
  import meow from 'meow';
30
30
  import {
31
31
  defaultConfig, setup, listApps, selectEndpoint, addEndpoint, removeEndpoint, selectApp, createAll, readAll,
32
- updateAll, deleteAll, search, newKeys, newJWT, newApp, ping, me, appSettings, rebuildIndex, exportData, importData
32
+ updateAll, deleteAll, search, newKeys, newJWT, newApp, deleteApp, ping, me, appSettings, rebuildIndex, exportData, importData
33
33
  } from './index.js';
34
34
 
35
35
  const { red, green, blue } = chalk;
@@ -54,6 +54,7 @@ var cli = meow(`
54
54
  new-key Generates a new secret key and saves it to config.json
55
55
  new-jwt Generates a new JWT super token to be used for app authentication
56
56
  new-app <name> --name --shared Creates a new Para app. Only works if you have the keys for the "root" app
57
+ delete-app <id> Deletes an existing Para app. Only works for child apps, not the "root" app
57
58
  export Exports all data from the app's table
58
59
  import <file> Imports data from a previously exported ZIP archive
59
60
  ping Tests the connection to the Para server
@@ -184,6 +185,10 @@ if (!input[0]) {
184
185
  newApp(pc, input, flags);
185
186
  }
186
187
 
188
+ if (input[0] === 'delete-app') {
189
+ deleteApp(pc, input, flags);
190
+ }
191
+
187
192
  if (input[0] === 'ping') {
188
193
  ping(pc, config);
189
194
  }