@qodalis/cli 2.5.1 → 2.5.2
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/package.json +2 -2
- package/public-api.d.mts +1 -1
- package/public-api.d.ts +1 -1
- package/public-api.js +39 -3
- package/public-api.js.map +1 -1
- package/public-api.mjs +39 -3
- package/public-api.mjs.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qodalis/cli",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.2",
|
|
4
4
|
"description": "Framework-agnostic CLI engine for @qodalis terminal applications.",
|
|
5
5
|
"author": "Nicolae Lupei, Qodalis Solutions",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"./assets/*": "./assets/*"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@qodalis/cli-core": "2.5.
|
|
33
|
+
"@qodalis/cli-core": "2.5.2",
|
|
34
34
|
"@xterm/xterm": "^6.0.0",
|
|
35
35
|
"@xterm/addon-fit": "^0.11.0",
|
|
36
36
|
"@xterm/addon-web-links": "^0.12.0",
|
package/public-api.d.mts
CHANGED
|
@@ -165,7 +165,7 @@ declare const CliKeyValueStore_TOKEN: any;
|
|
|
165
165
|
*/
|
|
166
166
|
declare const SyntaxHighlighterRegistry_TOKEN: any;
|
|
167
167
|
|
|
168
|
-
declare const LIBRARY_VERSION = "2.5.
|
|
168
|
+
declare const LIBRARY_VERSION = "2.5.2";
|
|
169
169
|
declare const API_VERSION = 2;
|
|
170
170
|
|
|
171
171
|
declare class CliAliasCommandProcessor implements ICliCommandProcessor {
|
package/public-api.d.ts
CHANGED
|
@@ -165,7 +165,7 @@ declare const CliKeyValueStore_TOKEN: any;
|
|
|
165
165
|
*/
|
|
166
166
|
declare const SyntaxHighlighterRegistry_TOKEN: any;
|
|
167
167
|
|
|
168
|
-
declare const LIBRARY_VERSION = "2.5.
|
|
168
|
+
declare const LIBRARY_VERSION = "2.5.2";
|
|
169
169
|
declare const API_VERSION = 2;
|
|
170
170
|
|
|
171
171
|
declare class CliAliasCommandProcessor implements ICliCommandProcessor {
|
package/public-api.js
CHANGED
|
@@ -519,7 +519,7 @@ var CliKeyValueStore_TOKEN = cliCore.createCliToken("cli-key-value-store");
|
|
|
519
519
|
var SyntaxHighlighterRegistry_TOKEN = cliCore.createCliToken("syntax-highlighter-registry");
|
|
520
520
|
|
|
521
521
|
// src/lib/version.ts
|
|
522
|
-
var LIBRARY_VERSION = "2.5.
|
|
522
|
+
var LIBRARY_VERSION = "2.5.2";
|
|
523
523
|
var API_VERSION = 2;
|
|
524
524
|
var ANONYMOUS = "\0anonymous";
|
|
525
525
|
function aliasOwner(context2) {
|
|
@@ -21611,6 +21611,27 @@ function parseAddArgs(value) {
|
|
|
21611
21611
|
}
|
|
21612
21612
|
return {};
|
|
21613
21613
|
}
|
|
21614
|
+
function sameServerUrl(a, b) {
|
|
21615
|
+
const key = (url) => normalizeServerUrl(absoluteUrl(url))?.toLowerCase();
|
|
21616
|
+
const left = key(a);
|
|
21617
|
+
return !!left && left === key(b);
|
|
21618
|
+
}
|
|
21619
|
+
function absoluteUrl(url) {
|
|
21620
|
+
const origin = globalThis.location?.origin;
|
|
21621
|
+
if (!origin || /^[a-z][a-z0-9+.-]*:\/\//i.test(url.trim())) return url;
|
|
21622
|
+
try {
|
|
21623
|
+
return new URL(url.trim() || "/", origin).href;
|
|
21624
|
+
} catch {
|
|
21625
|
+
return url;
|
|
21626
|
+
}
|
|
21627
|
+
}
|
|
21628
|
+
async function serverAt(manager, linked, url) {
|
|
21629
|
+
for (const [name, connection] of manager.connections) {
|
|
21630
|
+
if (!manager.isLinked(name) && sameServerUrl(connection.config.url, url)) return { name, byApp: true };
|
|
21631
|
+
}
|
|
21632
|
+
const saved = (await linked.list()).find((server) => sameServerUrl(server.url, url));
|
|
21633
|
+
return saved ? { name: saved.name, byApp: false } : void 0;
|
|
21634
|
+
}
|
|
21614
21635
|
async function replaceConnection(manager, config) {
|
|
21615
21636
|
const current = [...manager.connections.keys()].find((n) => n.toLowerCase() === config.name.toLowerCase());
|
|
21616
21637
|
const wasDefault = !!current && manager.defaultServer === current;
|
|
@@ -21655,6 +21676,17 @@ var ServerAddProcessor = class {
|
|
|
21655
21676
|
if (checked.mixedContent) {
|
|
21656
21677
|
writer.writeWarning(t.t("cli.server.link.mixed_content", "This page is served over https: the browser may block requests to an http server."));
|
|
21657
21678
|
}
|
|
21679
|
+
const same = await serverAt(manager, linked, url);
|
|
21680
|
+
if (same?.byApp) {
|
|
21681
|
+
writer.writeError(t.t("cli.server.link.same_as_app_server", "{url} is already configured by the app as '{name}'.", { url, name: same.name }));
|
|
21682
|
+
return;
|
|
21683
|
+
}
|
|
21684
|
+
if (same) {
|
|
21685
|
+
writer.writeWarning(t.t("cli.server.link.already_linked", "{url} is already linked as '{name}'.", { url, name: same.name }));
|
|
21686
|
+
const again = await reader.readConfirm(t.t("cli.server.link.link_again", "Link it again? It replaces '{name}' (a new token)", { name: same.name }), false);
|
|
21687
|
+
if (!again) return;
|
|
21688
|
+
}
|
|
21689
|
+
const replacing = same?.name;
|
|
21658
21690
|
let probe;
|
|
21659
21691
|
context2.spinner?.show(t.t("cli.server.link.checking", "Checking {url}\u2026", { url }));
|
|
21660
21692
|
try {
|
|
@@ -21671,8 +21703,8 @@ var ServerAddProcessor = class {
|
|
|
21671
21703
|
const go = await reader.readConfirm(t.t("cli.server.link.http_confirm", "Link it anyway?"), false);
|
|
21672
21704
|
if (!go) return;
|
|
21673
21705
|
}
|
|
21674
|
-
let name = args.name;
|
|
21675
|
-
if (name) {
|
|
21706
|
+
let name = args.name ?? replacing;
|
|
21707
|
+
if (name && name !== replacing) {
|
|
21676
21708
|
if (!await this.nameAvailable(context2, manager, linked, name)) return;
|
|
21677
21709
|
}
|
|
21678
21710
|
const tokenFlag = command2.args?.["token"];
|
|
@@ -21720,6 +21752,10 @@ var ServerAddProcessor = class {
|
|
|
21720
21752
|
const server = { name, url, addedAt: Date.now() };
|
|
21721
21753
|
const previous = (await linked.get(name))?.name;
|
|
21722
21754
|
if (previous && previous !== name) await linked.remove(previous);
|
|
21755
|
+
if (replacing && replacing.toLowerCase() !== name.toLowerCase()) {
|
|
21756
|
+
await linked.remove(replacing);
|
|
21757
|
+
if (manager.isLinked(replacing)) manager.removeServer(replacing);
|
|
21758
|
+
}
|
|
21723
21759
|
await linked.save(server, token);
|
|
21724
21760
|
const connection = await replaceConnection(manager, linkedServerConfig(server, token));
|
|
21725
21761
|
if (connection.connected) {
|