para-cli 1.22.2 → 1.22.3
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 +7 -2
- package/package.json +2 -2
- package/para-cli.js +8 -7
package/index.js
CHANGED
|
@@ -262,7 +262,7 @@ export function newKeys(pc, config) {
|
|
|
262
262
|
});
|
|
263
263
|
}
|
|
264
264
|
|
|
265
|
-
export function newJWT(accessKey, secretKey, endpoint, config) {
|
|
265
|
+
export function newJWT(accessKey, secretKey, endpoint, config, flags) {
|
|
266
266
|
if (!accessKey || accessKey.length < 3 || !secretKey || secretKey.length < 6) {
|
|
267
267
|
fail('Invalid credentials.');
|
|
268
268
|
return;
|
|
@@ -279,7 +279,11 @@ export function newJWT(accessKey, secretKey, endpoint, config) {
|
|
|
279
279
|
config.set('secretKey', secretKey);
|
|
280
280
|
config.set('endpoint', endpoint || config.get('endpoint'));
|
|
281
281
|
config.set('jwt', sign(sClaim, secretKey, { algorithm: 'HS256' }));
|
|
282
|
-
|
|
282
|
+
if (flags.print) {
|
|
283
|
+
console.log(yellow(config.get('jwt')));
|
|
284
|
+
} else {
|
|
285
|
+
console.log(green('✔'), 'New JWT generated and saved in', yellow(config.path));
|
|
286
|
+
}
|
|
283
287
|
}
|
|
284
288
|
|
|
285
289
|
export function newApp(pc, input, flags) {
|
|
@@ -507,6 +511,7 @@ export function selectApp(input, config, flags) {
|
|
|
507
511
|
var jwt = sign(JSON.stringify({
|
|
508
512
|
iat: now,
|
|
509
513
|
exp: now + 10,
|
|
514
|
+
nbf: now - 5, // allow for 5 seconds time difference in clocks
|
|
510
515
|
appid: accessKey,
|
|
511
516
|
getCredentials: selectedApp
|
|
512
517
|
}), secretKey, { algorithm: 'HS256' });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "para-cli",
|
|
3
|
-
"version": "1.22.
|
|
3
|
+
"version": "1.22.3",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Command-line tool for Para backend servers",
|
|
6
6
|
"homepage": "https://paraio.org",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"jsonwebtoken": "^9.0.3",
|
|
45
45
|
"meow": "^14.0.0",
|
|
46
46
|
"mime-types": "^3.0.2",
|
|
47
|
-
"para-client-js": "^1.40.
|
|
47
|
+
"para-client-js": "^1.40.3",
|
|
48
48
|
"resolve": "^1.22.11",
|
|
49
49
|
"striptags": "^3.2.0",
|
|
50
50
|
"update-notifier": "^7.3.1",
|
package/para-cli.js
CHANGED
|
@@ -44,8 +44,8 @@ var cli = meow(`
|
|
|
44
44
|
setup Initial setup, prompts you to enter your Para API keys and endpoint
|
|
45
45
|
apps Returns a list of all Para apps
|
|
46
46
|
types Returns an object containing all currently defined data types in Para
|
|
47
|
-
select <appid> Selects a Para app as a target for all subsequent read/write requests
|
|
48
|
-
endpoints [add|remove] List and select Para server endpoints, add new or remove an exiting one
|
|
47
|
+
select <appid> Selects a Para app as a target for all subsequent read/write requests
|
|
48
|
+
endpoints [add|remove] List and select Para server endpoints, add new or remove an exiting one
|
|
49
49
|
create <file|glob> [--id] [--type] Persists files as Para objects and makes them searchable
|
|
50
50
|
read --id 123 [--id 345 ...] Fetches objects with the given ids
|
|
51
51
|
update <file.json|glob> ... Updates Para objects with the data from a JSON file (must contain id field)
|
|
@@ -54,9 +54,9 @@ var cli = meow(`
|
|
|
54
54
|
rebuild-index Rebuilds the entire search index
|
|
55
55
|
app-settings Returns all settings for the authenticated app
|
|
56
56
|
new-key Generates a new secret key and saves it to config.json
|
|
57
|
-
new-jwt Generates a new JWT super token to be used for app authentication
|
|
58
|
-
new-app <name> --name --shared Creates a new Para app
|
|
59
|
-
delete-app <id> Deletes an existing Para app
|
|
57
|
+
new-jwt Generates a new JWT super token to be used for app authentication (use --print for console output)
|
|
58
|
+
new-app <name> --name --shared Creates a new Para app (only works if you have the keys for the "root" app)
|
|
59
|
+
delete-app <id> Deletes an existing Para app (only works for child apps, not the "root" app)
|
|
60
60
|
export Exports all data from the app's table
|
|
61
61
|
import <file> Imports data from a previously exported ZIP archive
|
|
62
62
|
ping Tests the connection to the Para server
|
|
@@ -75,7 +75,7 @@ var cli = meow(`
|
|
|
75
75
|
--limit Limits the number of search results
|
|
76
76
|
--lastKey Sets the last id for search-after pagination
|
|
77
77
|
--cwd Sets the current directory - used for resolving file paths
|
|
78
|
-
--encodeId By default all ids are Base64 encoded, unless this is 'false'
|
|
78
|
+
--encodeId By default all ids are Base64 encoded, unless this is set to 'false'
|
|
79
79
|
--help Prints the list of commands
|
|
80
80
|
--version Prints the version of the program
|
|
81
81
|
|
|
@@ -89,6 +89,7 @@ var cli = meow(`
|
|
|
89
89
|
$ para-cli search "*" --type article --page all
|
|
90
90
|
$ para-cli new-key
|
|
91
91
|
$ para-cli new-app "mynewapp" --name "Full app name"
|
|
92
|
+
$ para-cli new-jwt --print
|
|
92
93
|
$ para-cli apps
|
|
93
94
|
$ para-cli types
|
|
94
95
|
$ para-cli select scoold
|
|
@@ -181,7 +182,7 @@ if (!input[0]) {
|
|
|
181
182
|
}
|
|
182
183
|
|
|
183
184
|
if (input[0] === 'new-jwt') {
|
|
184
|
-
newJWT(accessKey, secretKey, endpoint, config);
|
|
185
|
+
newJWT(accessKey, secretKey, endpoint, config, flags);
|
|
185
186
|
}
|
|
186
187
|
|
|
187
188
|
if (input[0] === 'new-app') {
|