para-cli 1.23.2 → 1.24.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.
Files changed (3) hide show
  1. package/index.js +464 -335
  2. package/package.json +30 -8
  3. package/para-cli.js +57 -34
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "para-cli",
3
- "version": "1.23.2",
3
+ "version": "1.24.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Command-line tool for Para backend servers",
6
6
  "homepage": "https://paraio.org",
@@ -26,28 +26,50 @@
26
26
  "api"
27
27
  ],
28
28
  "devDependencies": {
29
- "eslint": "^10.0.0"
29
+ "@biomejs/biome": "2.4.10",
30
+ "eslint": "^10.1.0",
31
+ "release-it": "^19.2.4"
30
32
  },
31
33
  "repository": {
32
34
  "type": "git",
33
35
  "url": "git+https://github.com/Erudika/para-cli.git"
34
36
  },
35
37
  "dependencies": {
36
- "brace-expansion": "^5.0.2",
38
+ "@inquirer/input": "^5.0.10",
39
+ "@inquirer/password": "^5.0.10",
40
+ "brace-expansion": "^5.0.5",
37
41
  "chalk": "^5.6.2",
38
42
  "conf": "^15.1.0",
39
43
  "exit": "^0.1.2",
40
- "figlet": "^1.10.0",
44
+ "figlet": "^1.11.0",
41
45
  "get-stdin": "^10.0.0",
42
- "globby": "^16.1.0",
43
- "htmlparser2": "^10.1.0",
46
+ "globby": "^16.2.0",
47
+ "htmlparser2": "^12.0.0",
44
48
  "jsonwebtoken": "^9.0.3",
45
- "meow": "^14.0.0",
49
+ "meow": "^14.1.0",
46
50
  "mime-types": "^3.0.2",
47
- "para-client-js": "^1.40.4",
51
+ "para-client-js": "^1.40.6",
48
52
  "resolve": "^1.22.11",
49
53
  "striptags": "^3.2.0",
50
54
  "update-notifier": "^7.3.1",
51
55
  "yargs-parser": "^22.0.0"
56
+ },
57
+ "scripts": {
58
+ "lint": "biome lint *.js",
59
+ "lint:fix": "biome lint --write *.js",
60
+ "format": "biome format --write *.js",
61
+ "format:check": "biome format *.js",
62
+ "check": "biome check *.js",
63
+ "check:fix": "biome check --write *.js",
64
+ "release": "release-it"
65
+ },
66
+ "release-it": {
67
+ "$schema": "https://unpkg.com/release-it/schema/release-it.json",
68
+ "github": {
69
+ "release": true
70
+ },
71
+ "npm": {
72
+ "publish": true
73
+ }
52
74
  }
53
75
  }
package/para-cli.js CHANGED
@@ -20,23 +20,44 @@
20
20
 
21
21
  /* eslint indent: ["error", "tab"] */
22
22
  /* eslint object-curly-spacing: ["error", "always"] */
23
+ /* global console, process */
23
24
 
24
- import updateNotifier from 'update-notifier';
25
- import ParaClient from 'para-client-js';
25
+ import chalk from 'chalk';
26
26
  import Conf from 'conf';
27
27
  import figlet from 'figlet';
28
- import chalk from 'chalk';
29
28
  import meow from 'meow';
29
+ import updateNotifier from 'update-notifier';
30
30
  import {
31
- defaultConfig, setup, listApps, parseEndpoint, selectEndpoint, addEndpoint, removeEndpoint,
32
- selectApp, createAll, readAll, updateAll, deleteAll, search, newKeys, newJWT, newApp, deleteApp,
33
- ping, me, appSettings, rebuildIndex, exportData, importData, types
31
+ addEndpoint,
32
+ appSettings,
33
+ createAll,
34
+ defaultConfig,
35
+ deleteAll,
36
+ deleteApp,
37
+ exportData,
38
+ importData,
39
+ listApps,
40
+ me,
41
+ newApp,
42
+ newJWT,
43
+ newKeys,
44
+ ping,
45
+ readAll,
46
+ rebuildIndex,
47
+ removeEndpoint,
48
+ search,
49
+ selectApp,
50
+ selectEndpoint,
51
+ setup,
52
+ types,
53
+ updateAll
34
54
  } from './index.js';
35
55
 
36
56
  const { red, green, blue } = chalk;
37
57
  const { textSync } = figlet;
38
58
 
39
- var cli = meow(`
59
+ var cli = meow(
60
+ `
40
61
  Usage:
41
62
  $ para-cli [command] [file]
42
63
 
@@ -94,14 +115,16 @@ var cli = meow(`
94
115
  $ para-cli types
95
116
  $ para-cli select scoold
96
117
  $ para-cli endpoints
97
- `, {
98
- importMeta: import.meta,
99
- flags: {
100
- id: {
101
- type: 'string'
118
+ `,
119
+ {
120
+ importMeta: import.meta,
121
+ flags: {
122
+ id: {
123
+ type: 'string'
124
+ }
102
125
  }
103
126
  }
104
- });
127
+ );
105
128
 
106
129
  updateNotifier({ pkg: cli.pkg }).notify();
107
130
 
@@ -110,7 +133,7 @@ var config = new Conf({
110
133
  defaults: defaultConfig
111
134
  });
112
135
 
113
- var logo = blue(textSync(' para CLI', { font: 'Slant' })) + '\n';
136
+ var logo = `${blue(textSync(' para CLI', { font: 'Slant' }))}\n`;
114
137
  var help = logo + cli.help;
115
138
  var input = cli.input;
116
139
  var flags = cli.flags;
@@ -119,7 +142,7 @@ var secretKey = flags.secretKey || process.env.PARA_SECRET_KEY || config.get('se
119
142
  var endpoint = flags.endpoint || process.env.PARA_ENDPOINT || config.get('endpoint');
120
143
  var selectedApp = config.get('selectedApp');
121
144
 
122
- if (!flags.accessKey && !flags.secretKey && selectedApp && selectedApp.accessKey && selectedApp.accessKey.indexOf("app:") === 0) {
145
+ if (!flags.accessKey && !flags.secretKey && selectedApp?.accessKey && selectedApp.accessKey.indexOf('app:') === 0) {
123
146
  accessKey = selectedApp.accessKey;
124
147
  secretKey = selectedApp.secretKey;
125
148
  endpoint = selectedApp.endpoint || endpoint;
@@ -128,19 +151,19 @@ if (!flags.accessKey && !flags.secretKey && selectedApp && selectedApp.accessKey
128
151
  if (!input[0]) {
129
152
  console.log(help);
130
153
  } else if ((!accessKey || !secretKey) && input[0] !== 'setup') {
131
- console.error(red('Command ' + input[0] + ' failed! Blank credentials, running setup first...'));
154
+ console.error(red(`Command ${input[0]} failed! Blank credentials, running setup first...`));
132
155
  console.log("Please enter the access key and secret key for the root app 'app:para' first.");
133
156
  process.exitCode = 1;
134
157
  await setup(config);
135
158
  } else {
136
- var pc = new ParaClient(accessKey, secretKey, parseEndpoint(endpoint));
137
-
138
159
  if (input[0] === 'setup') {
139
160
  await setup(config);
140
161
  }
141
162
 
142
163
  if (input[0] === 'apps') {
143
- listApps(config, flags, accessKey, function () {console.log('No apps found within', green(accessKey));});
164
+ listApps(config, flags, accessKey, () => {
165
+ console.log('No apps found within', green(accessKey));
166
+ });
144
167
  }
145
168
 
146
169
  if (input[0] === 'endpoints') {
@@ -158,27 +181,27 @@ if (!input[0]) {
158
181
  }
159
182
 
160
183
  if (input[0] === 'create') {
161
- createAll(pc, input, flags);
184
+ createAll(input, config, flags);
162
185
  }
163
186
 
164
187
  if (input[0] === 'read') {
165
- readAll(pc, flags);
188
+ readAll(config, flags);
166
189
  }
167
190
 
168
191
  if (input[0] === 'update') {
169
- updateAll(pc, input, flags);
192
+ updateAll(input, config, flags);
170
193
  }
171
194
 
172
195
  if (input[0] === 'delete') {
173
- deleteAll(pc, input, flags);
196
+ deleteAll(input, config, flags);
174
197
  }
175
198
 
176
199
  if (input[0] === 'search') {
177
- search(pc, input, flags);
200
+ search(input, config, flags);
178
201
  }
179
202
 
180
203
  if (input[0] === 'new-key') {
181
- newKeys(pc, config);
204
+ newKeys(config, flags);
182
205
  }
183
206
 
184
207
  if (input[0] === 'new-jwt') {
@@ -186,38 +209,38 @@ if (!input[0]) {
186
209
  }
187
210
 
188
211
  if (input[0] === 'new-app') {
189
- newApp(pc, input, flags);
212
+ newApp(input, config, flags);
190
213
  }
191
214
 
192
215
  if (input[0] === 'delete-app') {
193
- deleteApp(pc, input, flags);
216
+ deleteApp(input, config, flags);
194
217
  }
195
218
 
196
219
  if (input[0] === 'ping') {
197
- ping(pc, config);
220
+ ping(config, flags);
198
221
  }
199
222
 
200
223
  if (input[0] === 'me') {
201
- me(pc, config);
224
+ me(config, flags);
202
225
  }
203
226
 
204
227
  if (input[0] === 'app-settings') {
205
- appSettings(pc, config);
228
+ appSettings(config, flags);
206
229
  }
207
230
 
208
231
  if (input[0] === 'rebuild-index') {
209
- rebuildIndex(pc, config, flags);
232
+ rebuildIndex(config, flags);
210
233
  }
211
234
 
212
235
  if (input[0] === 'export') {
213
- exportData(pc, config, flags);
236
+ exportData(config, flags);
214
237
  }
215
238
 
216
239
  if (input[0] === 'import') {
217
- importData(pc, input, config);
240
+ importData(input, config, flags);
218
241
  }
219
242
 
220
243
  if (input[0] === 'types') {
221
- types(pc, config);
244
+ types(config, flags);
222
245
  }
223
246
  }