para-cli 1.23.3 → 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.
- package/index.js +464 -335
- package/package.json +11 -2
- package/para-cli.js +57 -34
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "para-cli",
|
|
3
|
-
"version": "1.
|
|
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,6 +26,7 @@
|
|
|
26
26
|
"api"
|
|
27
27
|
],
|
|
28
28
|
"devDependencies": {
|
|
29
|
+
"@biomejs/biome": "2.4.10",
|
|
29
30
|
"eslint": "^10.1.0",
|
|
30
31
|
"release-it": "^19.2.4"
|
|
31
32
|
},
|
|
@@ -34,13 +35,15 @@
|
|
|
34
35
|
"url": "git+https://github.com/Erudika/para-cli.git"
|
|
35
36
|
},
|
|
36
37
|
"dependencies": {
|
|
38
|
+
"@inquirer/input": "^5.0.10",
|
|
39
|
+
"@inquirer/password": "^5.0.10",
|
|
37
40
|
"brace-expansion": "^5.0.5",
|
|
38
41
|
"chalk": "^5.6.2",
|
|
39
42
|
"conf": "^15.1.0",
|
|
40
43
|
"exit": "^0.1.2",
|
|
41
44
|
"figlet": "^1.11.0",
|
|
42
45
|
"get-stdin": "^10.0.0",
|
|
43
|
-
"globby": "^16.
|
|
46
|
+
"globby": "^16.2.0",
|
|
44
47
|
"htmlparser2": "^12.0.0",
|
|
45
48
|
"jsonwebtoken": "^9.0.3",
|
|
46
49
|
"meow": "^14.1.0",
|
|
@@ -52,6 +55,12 @@
|
|
|
52
55
|
"yargs-parser": "^22.0.0"
|
|
53
56
|
},
|
|
54
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",
|
|
55
64
|
"release": "release-it"
|
|
56
65
|
},
|
|
57
66
|
"release-it": {
|
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
|
|
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
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' }))
|
|
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
|
|
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(
|
|
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,
|
|
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(
|
|
184
|
+
createAll(input, config, flags);
|
|
162
185
|
}
|
|
163
186
|
|
|
164
187
|
if (input[0] === 'read') {
|
|
165
|
-
readAll(
|
|
188
|
+
readAll(config, flags);
|
|
166
189
|
}
|
|
167
190
|
|
|
168
191
|
if (input[0] === 'update') {
|
|
169
|
-
updateAll(
|
|
192
|
+
updateAll(input, config, flags);
|
|
170
193
|
}
|
|
171
194
|
|
|
172
195
|
if (input[0] === 'delete') {
|
|
173
|
-
deleteAll(
|
|
196
|
+
deleteAll(input, config, flags);
|
|
174
197
|
}
|
|
175
198
|
|
|
176
199
|
if (input[0] === 'search') {
|
|
177
|
-
search(
|
|
200
|
+
search(input, config, flags);
|
|
178
201
|
}
|
|
179
202
|
|
|
180
203
|
if (input[0] === 'new-key') {
|
|
181
|
-
newKeys(
|
|
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(
|
|
212
|
+
newApp(input, config, flags);
|
|
190
213
|
}
|
|
191
214
|
|
|
192
215
|
if (input[0] === 'delete-app') {
|
|
193
|
-
deleteApp(
|
|
216
|
+
deleteApp(input, config, flags);
|
|
194
217
|
}
|
|
195
218
|
|
|
196
219
|
if (input[0] === 'ping') {
|
|
197
|
-
ping(
|
|
220
|
+
ping(config, flags);
|
|
198
221
|
}
|
|
199
222
|
|
|
200
223
|
if (input[0] === 'me') {
|
|
201
|
-
me(
|
|
224
|
+
me(config, flags);
|
|
202
225
|
}
|
|
203
226
|
|
|
204
227
|
if (input[0] === 'app-settings') {
|
|
205
|
-
appSettings(
|
|
228
|
+
appSettings(config, flags);
|
|
206
229
|
}
|
|
207
230
|
|
|
208
231
|
if (input[0] === 'rebuild-index') {
|
|
209
|
-
rebuildIndex(
|
|
232
|
+
rebuildIndex(config, flags);
|
|
210
233
|
}
|
|
211
234
|
|
|
212
235
|
if (input[0] === 'export') {
|
|
213
|
-
exportData(
|
|
236
|
+
exportData(config, flags);
|
|
214
237
|
}
|
|
215
238
|
|
|
216
239
|
if (input[0] === 'import') {
|
|
217
|
-
importData(
|
|
240
|
+
importData(input, config, flags);
|
|
218
241
|
}
|
|
219
242
|
|
|
220
243
|
if (input[0] === 'types') {
|
|
221
|
-
types(
|
|
244
|
+
types(config, flags);
|
|
222
245
|
}
|
|
223
246
|
}
|