@iicp/client 0.7.56 → 0.7.58
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/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +91 -2
- package/dist/cli.js.map +1 -1
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +0 -0
- package/dist/node.js.map +1 -1
- package/dist/relay_session.d.ts +7 -0
- package/dist/relay_session.d.ts.map +1 -1
- package/dist/relay_session.js +25 -1
- package/dist/relay_session.js.map +1 -1
- package/dist/tunnel.d.ts +50 -0
- package/dist/tunnel.d.ts.map +1 -0
- package/dist/tunnel.js +179 -0
- package/dist/tunnel.js.map +1 -0
- package/dist/updater.d.ts +22 -0
- package/dist/updater.d.ts.map +1 -0
- package/dist/updater.js +67 -0
- package/dist/updater.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Self-updater P1 — read-only version check (#521 WQ-089).
|
|
3
|
+
* TypeScript parity with iicp-client-python/updater.py.
|
|
4
|
+
*
|
|
5
|
+
* Inert by design: reports whether a newer release exists and prints the
|
|
6
|
+
* upgrade command. No download/install/restart (P2/P3). Zero risk surface.
|
|
7
|
+
*/
|
|
8
|
+
/** Parse a dotted version into a comparable tuple; truncate at the first
|
|
9
|
+
* non-numeric segment ('1.2.3-rc1' → [1,2,3]). */
|
|
10
|
+
export declare function parseVersion(v: string): number[];
|
|
11
|
+
/** True when `latest` is strictly newer than `current` (numeric, not lex). */
|
|
12
|
+
export declare function isOutdated(current: string, latest: string): boolean;
|
|
13
|
+
/** Fetch @iicp/client's latest published version, or null on any error. */
|
|
14
|
+
export declare function latestNpmVersion(timeoutMs?: number): Promise<string | null>;
|
|
15
|
+
export interface UpdateVerdict {
|
|
16
|
+
current: string;
|
|
17
|
+
latest: string | null;
|
|
18
|
+
outdated: boolean;
|
|
19
|
+
command: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function checkUpdate(current: string, latest: string | null): UpdateVerdict;
|
|
22
|
+
//# sourceMappingURL=updater.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updater.d.ts","sourceRoot":"","sources":["../src/updater.ts"],"names":[],"mappings":"AACA;;;;;;GAMG;AAIH;kDACkD;AAClD,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAQhD;AAED,8EAA8E;AAC9E,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAWnE;AAED,2EAA2E;AAC3E,wBAAsB,gBAAgB,CAAC,SAAS,SAAO,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAY/E;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,aAAa,CAOjF"}
|
package/dist/updater.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
/**
|
|
4
|
+
* Self-updater P1 — read-only version check (#521 WQ-089).
|
|
5
|
+
* TypeScript parity with iicp-client-python/updater.py.
|
|
6
|
+
*
|
|
7
|
+
* Inert by design: reports whether a newer release exists and prints the
|
|
8
|
+
* upgrade command. No download/install/restart (P2/P3). Zero risk surface.
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.parseVersion = parseVersion;
|
|
12
|
+
exports.isOutdated = isOutdated;
|
|
13
|
+
exports.latestNpmVersion = latestNpmVersion;
|
|
14
|
+
exports.checkUpdate = checkUpdate;
|
|
15
|
+
const NPM_URL = "https://registry.npmjs.org/@iicp/client/latest";
|
|
16
|
+
/** Parse a dotted version into a comparable tuple; truncate at the first
|
|
17
|
+
* non-numeric segment ('1.2.3-rc1' → [1,2,3]). */
|
|
18
|
+
function parseVersion(v) {
|
|
19
|
+
const out = [];
|
|
20
|
+
for (const part of v.trim().replace(/^[vV]/, "").split(".")) {
|
|
21
|
+
const m = /^\d+/.exec(part);
|
|
22
|
+
if (!m)
|
|
23
|
+
break;
|
|
24
|
+
out.push(parseInt(m[0], 10));
|
|
25
|
+
}
|
|
26
|
+
return out;
|
|
27
|
+
}
|
|
28
|
+
/** True when `latest` is strictly newer than `current` (numeric, not lex). */
|
|
29
|
+
function isOutdated(current, latest) {
|
|
30
|
+
const a = parseVersion(current);
|
|
31
|
+
const b = parseVersion(latest);
|
|
32
|
+
const n = Math.max(a.length, b.length);
|
|
33
|
+
for (let i = 0; i < n; i++) {
|
|
34
|
+
const x = a[i] ?? 0;
|
|
35
|
+
const y = b[i] ?? 0;
|
|
36
|
+
if (y > x)
|
|
37
|
+
return true;
|
|
38
|
+
if (y < x)
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
/** Fetch @iicp/client's latest published version, or null on any error. */
|
|
44
|
+
async function latestNpmVersion(timeoutMs = 5000) {
|
|
45
|
+
try {
|
|
46
|
+
const ctrl = new AbortController();
|
|
47
|
+
const t = setTimeout(() => ctrl.abort(), timeoutMs);
|
|
48
|
+
const resp = await fetch(NPM_URL, { signal: ctrl.signal });
|
|
49
|
+
clearTimeout(t);
|
|
50
|
+
if (!resp.ok)
|
|
51
|
+
return null;
|
|
52
|
+
const data = (await resp.json());
|
|
53
|
+
return data.version ?? null;
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function checkUpdate(current, latest) {
|
|
60
|
+
return {
|
|
61
|
+
current,
|
|
62
|
+
latest,
|
|
63
|
+
outdated: latest !== null && isOutdated(current, latest),
|
|
64
|
+
command: "npm install -g @iicp/client@latest",
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=updater.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updater.js","sourceRoot":"","sources":["../src/updater.ts"],"names":[],"mappings":";AAAA,sCAAsC;AACtC;;;;;;GAMG;;AAMH,oCAQC;AAGD,gCAWC;AAGD,4CAYC;AASD,kCAOC;AAzDD,MAAM,OAAO,GAAG,gDAAgD,CAAC;AAEjE;kDACkD;AAClD,SAAgB,YAAY,CAAC,CAAS;IACpC,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,KAAK,MAAM,IAAI,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QAC5D,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC5B,IAAI,CAAC,CAAC;YAAE,MAAM;QACd,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,8EAA8E;AAC9E,SAAgB,UAAU,CAAC,OAAe,EAAE,MAAc;IACxD,MAAM,CAAC,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;IAChC,MAAM,CAAC,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IAC/B,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;IACvC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3B,MAAM,CAAC,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