@localess/cli 0.0.6-dev.20260307163319 → 3.0.0-dev.20260313083500
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/dist/index.js +29 -27
- package/dist/index.mjs +29 -27
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -28,13 +28,14 @@ var import_commander8 = require("commander");
|
|
|
28
28
|
|
|
29
29
|
// src/commands/login/index.ts
|
|
30
30
|
var import_commander = require("commander");
|
|
31
|
+
var import_prompts = require("@inquirer/prompts");
|
|
31
32
|
|
|
32
33
|
// src/utils.ts
|
|
33
34
|
var RESET = "\x1B[0m";
|
|
34
35
|
var FG_BLUE = "\x1B[34m";
|
|
35
|
-
function dotToNestedObject(
|
|
36
|
+
function dotToNestedObject(input2) {
|
|
36
37
|
const result = {};
|
|
37
|
-
for (const [key, value] of Object.entries(
|
|
38
|
+
for (const [key, value] of Object.entries(input2)) {
|
|
38
39
|
const parts = key.split(".");
|
|
39
40
|
let current = result;
|
|
40
41
|
for (let i = 0; i < parts.length; i++) {
|
|
@@ -466,35 +467,36 @@ async function clearSession() {
|
|
|
466
467
|
}
|
|
467
468
|
|
|
468
469
|
// src/commands/login/index.ts
|
|
469
|
-
var loginCommand = new import_commander.Command("login").description("Login to Localess CLI").option("-
|
|
470
|
+
var loginCommand = new import_commander.Command("login").description("Login to Localess CLI").option("-o, --origin <origin>", "Origin of the Localess instance").option("-s, --space <space>", "Space ID to login to").option("-t, --token <token>", "Token to login to Localess CLI").action(async (options) => {
|
|
470
471
|
const session = await getSession();
|
|
471
472
|
if (session.isLoggedIn && session.method === "file") {
|
|
472
|
-
console.log(
|
|
473
|
+
console.log("Already logged in.");
|
|
474
|
+
console.log('If you want to log in with different credentials, please log out first using "localess logout" command.');
|
|
473
475
|
return;
|
|
474
476
|
}
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
console.log(
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
console.
|
|
477
|
+
const origin = options.origin ?? await (0, import_prompts.input)({
|
|
478
|
+
message: "Origin of the Localess instance:",
|
|
479
|
+
required: true
|
|
480
|
+
});
|
|
481
|
+
const space = options.space ?? await (0, import_prompts.input)({
|
|
482
|
+
message: "Space ID:",
|
|
483
|
+
required: true
|
|
484
|
+
});
|
|
485
|
+
const token = options.token ?? await (0, import_prompts.password)({
|
|
486
|
+
message: "Token:",
|
|
487
|
+
mask: true
|
|
488
|
+
});
|
|
489
|
+
const client = localessClient({
|
|
490
|
+
origin,
|
|
491
|
+
spaceId: space,
|
|
492
|
+
token
|
|
493
|
+
});
|
|
494
|
+
try {
|
|
495
|
+
const spaceData = await client.getSpace();
|
|
496
|
+
console.log(`Successfully logged in to space: ${spaceData.name} (${spaceData.id})`);
|
|
497
|
+
await persistSession({ origin, space, token });
|
|
498
|
+
} catch (e) {
|
|
499
|
+
console.error("Login failed");
|
|
498
500
|
}
|
|
499
501
|
});
|
|
500
502
|
|
package/dist/index.mjs
CHANGED
|
@@ -5,13 +5,14 @@ import { Command as Command8 } from "commander";
|
|
|
5
5
|
|
|
6
6
|
// src/commands/login/index.ts
|
|
7
7
|
import { Command } from "commander";
|
|
8
|
+
import { input, password } from "@inquirer/prompts";
|
|
8
9
|
|
|
9
10
|
// src/utils.ts
|
|
10
11
|
var RESET = "\x1B[0m";
|
|
11
12
|
var FG_BLUE = "\x1B[34m";
|
|
12
|
-
function dotToNestedObject(
|
|
13
|
+
function dotToNestedObject(input2) {
|
|
13
14
|
const result = {};
|
|
14
|
-
for (const [key, value] of Object.entries(
|
|
15
|
+
for (const [key, value] of Object.entries(input2)) {
|
|
15
16
|
const parts = key.split(".");
|
|
16
17
|
let current = result;
|
|
17
18
|
for (let i = 0; i < parts.length; i++) {
|
|
@@ -443,35 +444,36 @@ async function clearSession() {
|
|
|
443
444
|
}
|
|
444
445
|
|
|
445
446
|
// src/commands/login/index.ts
|
|
446
|
-
var loginCommand = new Command("login").description("Login to Localess CLI").option("-
|
|
447
|
+
var loginCommand = new Command("login").description("Login to Localess CLI").option("-o, --origin <origin>", "Origin of the Localess instance").option("-s, --space <space>", "Space ID to login to").option("-t, --token <token>", "Token to login to Localess CLI").action(async (options) => {
|
|
447
448
|
const session = await getSession();
|
|
448
449
|
if (session.isLoggedIn && session.method === "file") {
|
|
449
|
-
console.log(
|
|
450
|
+
console.log("Already logged in.");
|
|
451
|
+
console.log('If you want to log in with different credentials, please log out first using "localess logout" command.');
|
|
450
452
|
return;
|
|
451
453
|
}
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
console.log(
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
console.
|
|
454
|
+
const origin = options.origin ?? await input({
|
|
455
|
+
message: "Origin of the Localess instance:",
|
|
456
|
+
required: true
|
|
457
|
+
});
|
|
458
|
+
const space = options.space ?? await input({
|
|
459
|
+
message: "Space ID:",
|
|
460
|
+
required: true
|
|
461
|
+
});
|
|
462
|
+
const token = options.token ?? await password({
|
|
463
|
+
message: "Token:",
|
|
464
|
+
mask: true
|
|
465
|
+
});
|
|
466
|
+
const client = localessClient({
|
|
467
|
+
origin,
|
|
468
|
+
spaceId: space,
|
|
469
|
+
token
|
|
470
|
+
});
|
|
471
|
+
try {
|
|
472
|
+
const spaceData = await client.getSpace();
|
|
473
|
+
console.log(`Successfully logged in to space: ${spaceData.name} (${spaceData.id})`);
|
|
474
|
+
await persistSession({ origin, space, token });
|
|
475
|
+
} catch (e) {
|
|
476
|
+
console.error("Login failed");
|
|
475
477
|
}
|
|
476
478
|
});
|
|
477
479
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@localess/cli",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "3.0.0-dev.20260313083500",
|
|
4
4
|
"description": "Localess Command Line.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"localess",
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"license": "MIT",
|
|
42
42
|
"dependencies": {
|
|
43
|
+
"@inquirer/prompts": "^8.3.0",
|
|
43
44
|
"commander": "^14.0.3",
|
|
44
45
|
"chalk": "^5.6.2",
|
|
45
46
|
"openapi-typescript": "^7.12.0",
|