@microwiseai/snapshot 0.8.0 → 0.9.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/dist/build-info.json +1 -0
- package/dist/commands/access.d.ts +25 -9
- package/dist/commands/access.d.ts.map +1 -1
- package/dist/commands/access.js +101 -47
- package/dist/commands/access.js.map +1 -1
- package/dist/commands/config.d.ts +3 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +37 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/install.d.ts +54 -0
- package/dist/commands/install.d.ts.map +1 -1
- package/dist/commands/install.js +480 -65
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/publish.d.ts +10 -0
- package/dist/commands/publish.d.ts.map +1 -1
- package/dist/commands/publish.js +94 -12
- package/dist/commands/publish.js.map +1 -1
- package/dist/index.js +45 -8
- package/dist/index.js.map +1 -1
- package/dist/lib/access-index.d.ts +81 -0
- package/dist/lib/access-index.d.ts.map +1 -0
- package/dist/lib/access-index.js +175 -0
- package/dist/lib/access-index.js.map +1 -0
- package/dist/lib/access-sync.d.ts +66 -17
- package/dist/lib/access-sync.d.ts.map +1 -1
- package/dist/lib/access-sync.js +391 -217
- package/dist/lib/access-sync.js.map +1 -1
- package/dist/lib/extends-access.d.ts +34 -0
- package/dist/lib/extends-access.d.ts.map +1 -0
- package/dist/lib/extends-access.js +82 -0
- package/dist/lib/extends-access.js.map +1 -0
- package/dist/lib/gitlab-publisher.d.ts +70 -0
- package/dist/lib/gitlab-publisher.d.ts.map +1 -0
- package/dist/lib/gitlab-publisher.js +165 -0
- package/dist/lib/gitlab-publisher.js.map +1 -0
- package/dist/lib/gitlab.d.ts +4 -0
- package/dist/lib/gitlab.d.ts.map +1 -1
- package/dist/lib/gitlab.js +1 -1
- package/dist/lib/gitlab.js.map +1 -1
- package/dist/lib/grant.d.ts +157 -0
- package/dist/lib/grant.d.ts.map +1 -0
- package/dist/lib/grant.js +352 -0
- package/dist/lib/grant.js.map +1 -0
- package/dist/lib/install-verify.d.ts +16 -2
- package/dist/lib/install-verify.d.ts.map +1 -1
- package/dist/lib/install-verify.js +24 -3
- package/dist/lib/install-verify.js.map +1 -1
- package/dist/lib/ledger.d.ts +13 -0
- package/dist/lib/ledger.d.ts.map +1 -1
- package/dist/lib/ledger.js.map +1 -1
- package/dist/lib/prerequisites.d.ts.map +1 -1
- package/dist/lib/prerequisites.js +4 -1
- package/dist/lib/prerequisites.js.map +1 -1
- package/dist/lib/proxy-auth-globalconfig.d.ts +55 -0
- package/dist/lib/proxy-auth-globalconfig.d.ts.map +1 -0
- package/dist/lib/proxy-auth-globalconfig.js +110 -0
- package/dist/lib/proxy-auth-globalconfig.js.map +1 -0
- package/dist/lib/semver-range.d.ts +32 -0
- package/dist/lib/semver-range.d.ts.map +1 -0
- package/dist/lib/semver-range.js +243 -0
- package/dist/lib/semver-range.js.map +1 -0
- package/dist/lib/session.d.ts +5 -0
- package/dist/lib/session.d.ts.map +1 -1
- package/dist/lib/session.js +9 -0
- package/dist/lib/session.js.map +1 -1
- package/dist/lib/skit-adapter.d.ts.map +1 -1
- package/dist/lib/skit-adapter.js +26 -3
- package/dist/lib/skit-adapter.js.map +1 -1
- package/dist/lib/timing.d.ts +7 -0
- package/dist/lib/timing.d.ts.map +1 -0
- package/dist/lib/timing.js +14 -0
- package/dist/lib/timing.js.map +1 -0
- package/dist/lib/types.d.ts +3 -0
- package/dist/lib/types.d.ts.map +1 -1
- package/node_modules/@microwiseai/snapshot-downgrade-guard/dist/command-specs.d.ts +25 -0
- package/node_modules/@microwiseai/snapshot-downgrade-guard/dist/command-specs.d.ts.map +1 -0
- package/node_modules/@microwiseai/snapshot-downgrade-guard/dist/command-specs.js +55 -0
- package/node_modules/@microwiseai/snapshot-downgrade-guard/dist/command-specs.js.map +1 -0
- package/node_modules/@microwiseai/snapshot-downgrade-guard/dist/config.d.ts +52 -0
- package/node_modules/@microwiseai/snapshot-downgrade-guard/dist/config.d.ts.map +1 -0
- package/node_modules/@microwiseai/snapshot-downgrade-guard/dist/config.js +62 -0
- package/node_modules/@microwiseai/snapshot-downgrade-guard/dist/config.js.map +1 -0
- package/node_modules/@microwiseai/snapshot-downgrade-guard/dist/detect.d.ts +30 -0
- package/node_modules/@microwiseai/snapshot-downgrade-guard/dist/detect.d.ts.map +1 -0
- package/node_modules/@microwiseai/snapshot-downgrade-guard/dist/detect.js +39 -0
- package/node_modules/@microwiseai/snapshot-downgrade-guard/dist/detect.js.map +1 -0
- package/node_modules/@microwiseai/snapshot-downgrade-guard/dist/index.d.ts +35 -0
- package/node_modules/@microwiseai/snapshot-downgrade-guard/dist/index.d.ts.map +1 -0
- package/node_modules/@microwiseai/snapshot-downgrade-guard/dist/index.js +31 -0
- package/node_modules/@microwiseai/snapshot-downgrade-guard/dist/index.js.map +1 -0
- package/node_modules/@microwiseai/snapshot-downgrade-guard/dist/policy.d.ts +42 -0
- package/node_modules/@microwiseai/snapshot-downgrade-guard/dist/policy.d.ts.map +1 -0
- package/node_modules/@microwiseai/snapshot-downgrade-guard/dist/policy.js +36 -0
- package/node_modules/@microwiseai/snapshot-downgrade-guard/dist/policy.js.map +1 -0
- package/node_modules/@microwiseai/snapshot-downgrade-guard/dist/report.d.ts +11 -0
- package/node_modules/@microwiseai/snapshot-downgrade-guard/dist/report.d.ts.map +1 -0
- package/node_modules/@microwiseai/snapshot-downgrade-guard/dist/report.js +46 -0
- package/node_modules/@microwiseai/snapshot-downgrade-guard/dist/report.js.map +1 -0
- package/node_modules/@microwiseai/snapshot-downgrade-guard/dist/semver.d.ts +11 -0
- package/node_modules/@microwiseai/snapshot-downgrade-guard/dist/semver.d.ts.map +1 -0
- package/node_modules/@microwiseai/snapshot-downgrade-guard/dist/semver.js +81 -0
- package/node_modules/@microwiseai/snapshot-downgrade-guard/dist/semver.js.map +1 -0
- package/node_modules/@microwiseai/snapshot-downgrade-guard/dist/types.d.ts +29 -0
- package/node_modules/@microwiseai/snapshot-downgrade-guard/dist/types.d.ts.map +1 -0
- package/node_modules/@microwiseai/snapshot-downgrade-guard/dist/types.js +6 -0
- package/node_modules/@microwiseai/snapshot-downgrade-guard/dist/types.js.map +1 -0
- package/node_modules/@microwiseai/snapshot-downgrade-guard/package.json +55 -0
- package/package.json +5 -2
- package/dist/lib/transitive-resolver.d.ts +0 -89
- package/dist/lib/transitive-resolver.d.ts.map +0 -1
- package/dist/lib/transitive-resolver.js +0 -447
- package/dist/lib/transitive-resolver.js.map +0 -1
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Snapshot grant (istsg_) installer support — Plan A (grant-unify P1).
|
|
3
|
+
*
|
|
4
|
+
* Every install can obtain ONE short-lived `istsg_` grant from license-api
|
|
5
|
+
* (`POST /api/snapshot-grant`) that authorizes the snapshot's frozen closure at
|
|
6
|
+
* the registry-proxy. The grant token becomes the single proxy transport token
|
|
7
|
+
* (IST_SESSION_TOKEN) for the snapshot fetch, the npm batch, skit kit npm deps
|
|
8
|
+
* and converge. The closure `members[]` is used as the ALLOWED set only — the
|
|
9
|
+
* installer still installs the manifest top-level packages (no global install of
|
|
10
|
+
* transitive members).
|
|
11
|
+
*
|
|
12
|
+
* Gate: env SNAPSHOT_GRANT_MODE
|
|
13
|
+
* off (default / unset) — no grant code runs; install is byte-identical to the
|
|
14
|
+
* legacy path (authorizeSession / anonymous npmrc).
|
|
15
|
+
* prefer — request a grant; on any grant failure warn and run the
|
|
16
|
+
* WHOLE install on the legacy path (no path mixing).
|
|
17
|
+
* require — request a grant; any grant failure is fail-loud.
|
|
18
|
+
*
|
|
19
|
+
* Secrets: the grant token is never logged or put in an error message. Logs use
|
|
20
|
+
* maskToken() (first 4 chars + …, same rule as maskSessionId).
|
|
21
|
+
*/
|
|
22
|
+
export type GrantMode = 'off' | 'prefer' | 'require';
|
|
23
|
+
export declare const GRANT_MODE_ENV = "SNAPSHOT_GRANT_MODE";
|
|
24
|
+
export declare const GRANT_TIMEOUT_ENV = "SNAPSHOT_GRANT_TIMEOUT_MS";
|
|
25
|
+
export declare const DEFAULT_GRANT_TIMEOUT_MS = 15000;
|
|
26
|
+
/**
|
|
27
|
+
* Resolve the grant mode from the environment. Unset / empty / 'off' → 'off'.
|
|
28
|
+
* An unknown value is reported via `warn` and treated as 'off' (never silently
|
|
29
|
+
* enables a new path).
|
|
30
|
+
*/
|
|
31
|
+
export declare function readGrantMode(env?: NodeJS.ProcessEnv, warn?: (msg: string) => void): GrantMode;
|
|
32
|
+
export declare function readGrantTimeoutMs(env?: NodeJS.ProcessEnv): number;
|
|
33
|
+
/** Mask a secret for logs: first 4 chars + '…' (same rule as maskSessionId). */
|
|
34
|
+
export declare function maskToken(token: string | undefined | null): string;
|
|
35
|
+
export interface GrantMember {
|
|
36
|
+
/** npm-canonical name ('@scope/name'); generic members use '@scope/name' too. */
|
|
37
|
+
name: string;
|
|
38
|
+
version: string;
|
|
39
|
+
/** Present when license-api builds the closure from access-index.json. */
|
|
40
|
+
kind?: 'npm' | 'generic';
|
|
41
|
+
}
|
|
42
|
+
export interface SnapshotGrant {
|
|
43
|
+
token: string;
|
|
44
|
+
members: GrantMember[];
|
|
45
|
+
closureHash: string;
|
|
46
|
+
/** Grant TTL in seconds. */
|
|
47
|
+
expiresIn: number;
|
|
48
|
+
}
|
|
49
|
+
export type GrantErrorCode = 'unauthorized' | 'not-found' | 'closure-resolve' | 'timeout' | 'network' | 'invalid-response' | 'http' | 'closure-changed' | 'version-mismatch' | 'version-resolve';
|
|
50
|
+
export declare class GrantError extends Error {
|
|
51
|
+
readonly code: GrantErrorCode;
|
|
52
|
+
readonly status?: number | undefined;
|
|
53
|
+
constructor(code: GrantErrorCode, message: string, status?: number | undefined);
|
|
54
|
+
}
|
|
55
|
+
export interface GrantRequest {
|
|
56
|
+
/** Snapshot name, e.g. '@ist/beta' (no version). */
|
|
57
|
+
snapshot: string;
|
|
58
|
+
/** Exact version or 'latest'. */
|
|
59
|
+
version: string;
|
|
60
|
+
/** Optional IST JWT — sent as Bearer to license-api only. */
|
|
61
|
+
authToken?: string | null;
|
|
62
|
+
}
|
|
63
|
+
export interface GrantRequestDeps {
|
|
64
|
+
/** license-api base incl. '/api', e.g. https://license-api…/api */
|
|
65
|
+
licenseApiUrl: string;
|
|
66
|
+
fetchImpl?: typeof fetch;
|
|
67
|
+
timeoutMs?: number;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* POST {licenseApiUrl}/snapshot-grant {snapshot, version} (+ Bearer when logged
|
|
71
|
+
* in). Anonymous requests are valid (public roots). Throws GrantError; messages
|
|
72
|
+
* never contain the token or the Authorization header.
|
|
73
|
+
*/
|
|
74
|
+
export declare function requestSnapshotGrant(req: GrantRequest, deps: GrantRequestDeps): Promise<SnapshotGrant>;
|
|
75
|
+
/**
|
|
76
|
+
* The proxy's `latest` rule (registry-proxy version.ts resolveLatest): the
|
|
77
|
+
* highest STABLE version; the highest prerelease only when no stable exists.
|
|
78
|
+
* Non-semver entries are ignored.
|
|
79
|
+
*/
|
|
80
|
+
export declare function resolveLatestStable(versions: string[]): string | undefined;
|
|
81
|
+
/** '@ist/beta' → 'ist__beta' (proxy generic path form). */
|
|
82
|
+
export declare function snapshotGenericName(snapshotName: string): string;
|
|
83
|
+
export interface VersionResolveDeps {
|
|
84
|
+
registryUrl: string;
|
|
85
|
+
fetchImpl?: typeof fetch;
|
|
86
|
+
timeoutMs?: number;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Resolve the snapshot version to grant/install. An explicit exact version is
|
|
90
|
+
* used as-is; none / 'latest' → GET {proxy}/generic/<name>/versions (no auth)
|
|
91
|
+
* and pick resolveLatestStable over the returned list. Throws GrantError
|
|
92
|
+
* ('version-resolve') on any failure.
|
|
93
|
+
*/
|
|
94
|
+
export declare function resolveInstallVersion(snapshotName: string, requested: string | undefined, deps: VersionResolveDeps): Promise<string>;
|
|
95
|
+
/** '@ist/beta@0.2.0' → {name:'@ist/beta', version:'0.2.0'}; no version → undefined. */
|
|
96
|
+
export declare function splitSnapshotSpec(spec: string): {
|
|
97
|
+
name: string;
|
|
98
|
+
version?: string;
|
|
99
|
+
};
|
|
100
|
+
/** Canonical member name: lowercase, generic path form `ist__x` → `@ist/x`. */
|
|
101
|
+
export declare function canonicalMemberName(name: string): string;
|
|
102
|
+
/** The root snapshot's own version as frozen in the closure, if present. */
|
|
103
|
+
export declare function findRootMemberVersion(members: GrantMember[], snapshotName: string): string | null;
|
|
104
|
+
export interface CoverageResult {
|
|
105
|
+
ok: boolean;
|
|
106
|
+
/** 'name@version' specs not in the closure. */
|
|
107
|
+
missing: string[];
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Check that every expected exact pin is a closure member (name@version, name
|
|
111
|
+
* case-insensitive). Kind is not compared in v1 (canonical key = @scope/name@ver).
|
|
112
|
+
*/
|
|
113
|
+
export declare function checkGrantCoverage(expected: Record<string, string> | Array<{
|
|
114
|
+
name: string;
|
|
115
|
+
version: string;
|
|
116
|
+
}>, members: GrantMember[]): CoverageResult;
|
|
117
|
+
/** Re-issue when remaining lifetime falls below max(120s, 25% of TTL). */
|
|
118
|
+
export declare function reissueThresholdSec(expiresIn: number): number;
|
|
119
|
+
export interface GrantStateDeps {
|
|
120
|
+
request: (req: GrantRequest) => Promise<SnapshotGrant>;
|
|
121
|
+
/** ms clock (injectable for tests). */
|
|
122
|
+
now?: () => number;
|
|
123
|
+
/** Called with every new token (initial issue and each re-issue). */
|
|
124
|
+
onToken?: (token: string) => void;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Holds the active grant for ONE snapshot@exact-version and re-issues it before
|
|
128
|
+
* a long phase when the remaining lifetime is low. A re-issue whose closureHash
|
|
129
|
+
* differs from the original is a GrantError('closure-changed') — the caller
|
|
130
|
+
* decides (require: fail-loud; prefer: fall back).
|
|
131
|
+
*/
|
|
132
|
+
export declare class GrantState {
|
|
133
|
+
private req;
|
|
134
|
+
private readonly deps;
|
|
135
|
+
private grant;
|
|
136
|
+
private issuedAtMs;
|
|
137
|
+
private reissueCount;
|
|
138
|
+
private readonly now;
|
|
139
|
+
constructor(req: GrantRequest, deps: GrantStateDeps);
|
|
140
|
+
issue(): Promise<SnapshotGrant>;
|
|
141
|
+
/** Pin subsequent re-issues to the exact version (after 'latest' resolution). */
|
|
142
|
+
pinVersion(version: string): void;
|
|
143
|
+
get current(): SnapshotGrant;
|
|
144
|
+
get reissues(): number;
|
|
145
|
+
get version(): string;
|
|
146
|
+
/** Seconds of lifetime left (0 when TTL unknown/expired). */
|
|
147
|
+
remainingSec(): number;
|
|
148
|
+
/**
|
|
149
|
+
* Re-issue if the remaining lifetime is below the threshold. A grant with an
|
|
150
|
+
* unknown TTL (expiresIn 0) is never re-issued. Returns true when re-issued.
|
|
151
|
+
*/
|
|
152
|
+
ensureFresh(): Promise<boolean>;
|
|
153
|
+
private set;
|
|
154
|
+
}
|
|
155
|
+
/** The single grant log line: mode, member count, TTL, closure prefix, masked token. */
|
|
156
|
+
export declare function formatGrantLog(mode: GrantMode, grant: SnapshotGrant): string;
|
|
157
|
+
//# sourceMappingURL=grant.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grant.d.ts","sourceRoot":"","sources":["../../src/lib/grant.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,SAAS,CAAC;AAErD,eAAO,MAAM,cAAc,wBAAwB,CAAC;AACpD,eAAO,MAAM,iBAAiB,8BAA8B,CAAC;AAC7D,eAAO,MAAM,wBAAwB,QAAS,CAAC;AAE/C;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,GAAG,GAAE,MAAM,CAAC,UAAwB,EACpC,IAAI,GAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAe,GACrC,SAAS,CAMX;AAED,wBAAgB,kBAAkB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,M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AMD,0EAA0E;AAC1E,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,CAAC,GAAG,EAAE,YAAY,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;IACvD,uCAAuC;IACvC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB,qEAAqE;IACrE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED;;;;;GAKG;AACH,qBAAa,UAAU;IAOnB,OAAO,CAAC,GAAG;IACX,OAAO,CAAC,QAAQ,CAAC,IAAI;IAPvB,OAAO,CAAC,KAAK,CAA8B;IAC3C,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;gBAGzB,GAAG,EAAE,YAAY,EACR,IAAI,EAAE,cAAc;IAKjC,KAAK,IAAI,OAAO,CAAC,aAAa,CAAC;IAMrC,iFAAiF;IACjF,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIjC,IAAI,OAAO,IAAI,aAAa,CAG3B;IAED,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,6DAA6D;IAC7D,YAAY,IAAI,MAAM;IAMtB;;;OAGG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAiBrC,OAAO,CAAC,GAAG;CAKZ;AAED,wFAAwF;AACxF,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,aAAa,GAAG,MAAM,CAM5E"}
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Snapshot grant (istsg_) installer support — Plan A (grant-unify P1).
|
|
3
|
+
*
|
|
4
|
+
* Every install can obtain ONE short-lived `istsg_` grant from license-api
|
|
5
|
+
* (`POST /api/snapshot-grant`) that authorizes the snapshot's frozen closure at
|
|
6
|
+
* the registry-proxy. The grant token becomes the single proxy transport token
|
|
7
|
+
* (IST_SESSION_TOKEN) for the snapshot fetch, the npm batch, skit kit npm deps
|
|
8
|
+
* and converge. The closure `members[]` is used as the ALLOWED set only — the
|
|
9
|
+
* installer still installs the manifest top-level packages (no global install of
|
|
10
|
+
* transitive members).
|
|
11
|
+
*
|
|
12
|
+
* Gate: env SNAPSHOT_GRANT_MODE
|
|
13
|
+
* off (default / unset) — no grant code runs; install is byte-identical to the
|
|
14
|
+
* legacy path (authorizeSession / anonymous npmrc).
|
|
15
|
+
* prefer — request a grant; on any grant failure warn and run the
|
|
16
|
+
* WHOLE install on the legacy path (no path mixing).
|
|
17
|
+
* require — request a grant; any grant failure is fail-loud.
|
|
18
|
+
*
|
|
19
|
+
* Secrets: the grant token is never logged or put in an error message. Logs use
|
|
20
|
+
* maskToken() (first 4 chars + …, same rule as maskSessionId).
|
|
21
|
+
*/
|
|
22
|
+
export const GRANT_MODE_ENV = 'SNAPSHOT_GRANT_MODE';
|
|
23
|
+
export const GRANT_TIMEOUT_ENV = 'SNAPSHOT_GRANT_TIMEOUT_MS';
|
|
24
|
+
export const DEFAULT_GRANT_TIMEOUT_MS = 15_000;
|
|
25
|
+
/**
|
|
26
|
+
* Resolve the grant mode from the environment. Unset / empty / 'off' → 'off'.
|
|
27
|
+
* An unknown value is reported via `warn` and treated as 'off' (never silently
|
|
28
|
+
* enables a new path).
|
|
29
|
+
*/
|
|
30
|
+
export function readGrantMode(env = process.env, warn = () => { }) {
|
|
31
|
+
const raw = (env[GRANT_MODE_ENV] ?? '').trim().toLowerCase();
|
|
32
|
+
if (raw === '' || raw === 'off')
|
|
33
|
+
return 'off';
|
|
34
|
+
if (raw === 'prefer' || raw === 'require')
|
|
35
|
+
return raw;
|
|
36
|
+
warn(`${GRANT_MODE_ENV}=${raw} is not one of off|prefer|require — treating as off`);
|
|
37
|
+
return 'off';
|
|
38
|
+
}
|
|
39
|
+
export function readGrantTimeoutMs(env = process.env) {
|
|
40
|
+
const n = Number(env[GRANT_TIMEOUT_ENV]);
|
|
41
|
+
return Number.isFinite(n) && n > 0 ? n : DEFAULT_GRANT_TIMEOUT_MS;
|
|
42
|
+
}
|
|
43
|
+
/** Mask a secret for logs: first 4 chars + '…' (same rule as maskSessionId). */
|
|
44
|
+
export function maskToken(token) {
|
|
45
|
+
if (!token)
|
|
46
|
+
return '(none)';
|
|
47
|
+
return token.length <= 4 ? '…' : `${token.slice(0, 4)}…`;
|
|
48
|
+
}
|
|
49
|
+
export class GrantError extends Error {
|
|
50
|
+
code;
|
|
51
|
+
status;
|
|
52
|
+
constructor(code, message, status) {
|
|
53
|
+
super(message);
|
|
54
|
+
this.code = code;
|
|
55
|
+
this.status = status;
|
|
56
|
+
this.name = 'GrantError';
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* POST {licenseApiUrl}/snapshot-grant {snapshot, version} (+ Bearer when logged
|
|
61
|
+
* in). Anonymous requests are valid (public roots). Throws GrantError; messages
|
|
62
|
+
* never contain the token or the Authorization header.
|
|
63
|
+
*/
|
|
64
|
+
export async function requestSnapshotGrant(req, deps) {
|
|
65
|
+
const fetchImpl = deps.fetchImpl ?? fetch;
|
|
66
|
+
const timeoutMs = deps.timeoutMs ?? DEFAULT_GRANT_TIMEOUT_MS;
|
|
67
|
+
const spec = `${req.snapshot}@${req.version}`;
|
|
68
|
+
const controller = new AbortController();
|
|
69
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
70
|
+
let res;
|
|
71
|
+
try {
|
|
72
|
+
res = await fetchImpl(`${deps.licenseApiUrl}/snapshot-grant`, {
|
|
73
|
+
method: 'POST',
|
|
74
|
+
headers: {
|
|
75
|
+
'Content-Type': 'application/json',
|
|
76
|
+
...(req.authToken ? { Authorization: `Bearer ${req.authToken}` } : {}),
|
|
77
|
+
},
|
|
78
|
+
body: JSON.stringify({ snapshot: req.snapshot, version: req.version }),
|
|
79
|
+
signal: controller.signal,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
catch (err) {
|
|
83
|
+
if (controller.signal.aborted) {
|
|
84
|
+
throw new GrantError('timeout', `snapshot grant for ${spec} timed out after ${timeoutMs}ms`);
|
|
85
|
+
}
|
|
86
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
87
|
+
throw new GrantError('network', `snapshot grant for ${spec} failed: ${msg}`);
|
|
88
|
+
}
|
|
89
|
+
finally {
|
|
90
|
+
clearTimeout(timer);
|
|
91
|
+
}
|
|
92
|
+
if (!res.ok) {
|
|
93
|
+
const body = (await res.json().catch(() => ({})));
|
|
94
|
+
const code = typeof body.code === 'string' ? body.code : '';
|
|
95
|
+
const detail = [code, typeof body.error === 'string' ? body.error : ''].filter(Boolean).join(': ') || res.statusText;
|
|
96
|
+
if (res.status === 401 || res.status === 403) {
|
|
97
|
+
throw new GrantError('unauthorized', `not authorized for ${spec} (${res.status} ${detail}). A non-public snapshot requires sign-in / entitlement.`, res.status);
|
|
98
|
+
}
|
|
99
|
+
if (res.status === 404) {
|
|
100
|
+
throw new GrantError('not-found', `snapshot ${spec} not found (${detail})`, 404);
|
|
101
|
+
}
|
|
102
|
+
if (res.status === 502 || code === 'CLOSURE_RESOLVE_FAILED') {
|
|
103
|
+
throw new GrantError('closure-resolve', `server could not resolve the full closure for ${spec} (${res.status} ${detail})`, res.status);
|
|
104
|
+
}
|
|
105
|
+
throw new GrantError('http', `snapshot grant for ${spec} failed: ${res.status} ${detail}`, res.status);
|
|
106
|
+
}
|
|
107
|
+
const body = (await res.json().catch(() => null));
|
|
108
|
+
if (!body || typeof body.token !== 'string' || !body.token) {
|
|
109
|
+
throw new GrantError('invalid-response', `invalid grant response for ${spec}: missing token`);
|
|
110
|
+
}
|
|
111
|
+
if (!Array.isArray(body.members)) {
|
|
112
|
+
throw new GrantError('invalid-response', `grant response for ${spec} has no members[] (license-api without the closure contract)`);
|
|
113
|
+
}
|
|
114
|
+
const members = [];
|
|
115
|
+
for (const m of body.members) {
|
|
116
|
+
const mm = m;
|
|
117
|
+
if (!mm || typeof mm.name !== 'string' || typeof mm.version !== 'string') {
|
|
118
|
+
throw new GrantError('invalid-response', `invalid grant response for ${spec}: malformed member`);
|
|
119
|
+
}
|
|
120
|
+
members.push({ name: mm.name, version: mm.version, ...(mm.kind ? { kind: mm.kind } : {}) });
|
|
121
|
+
}
|
|
122
|
+
return {
|
|
123
|
+
token: body.token,
|
|
124
|
+
members,
|
|
125
|
+
closureHash: typeof body.closureHash === 'string' ? body.closureHash : '',
|
|
126
|
+
expiresIn: typeof body.expiresIn === 'number' && body.expiresIn > 0 ? body.expiresIn : 0,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
// ============================================================
|
|
130
|
+
// Exact version resolution (before the grant request)
|
|
131
|
+
// ============================================================
|
|
132
|
+
// license-api resolves a grant for version 'latest' to the most recent UPLOAD
|
|
133
|
+
// (prereleases included), while the legacy install path's 'latest' (proxy
|
|
134
|
+
// generic latest) is the highest STABLE version. Grant mode therefore never asks
|
|
135
|
+
// for 'latest': core resolves the exact version first with the proxy rule.
|
|
136
|
+
const SEMVER_RE = /^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
137
|
+
function semverKey(v) {
|
|
138
|
+
const m = SEMVER_RE.exec(v.trim());
|
|
139
|
+
if (!m)
|
|
140
|
+
return null;
|
|
141
|
+
return { rel: [Number(m[1]), Number(m[2]), Number(m[3])], pre: m[4] ? m[4].split('.') : [] };
|
|
142
|
+
}
|
|
143
|
+
function compareSemver(a, b) {
|
|
144
|
+
const x = semverKey(a);
|
|
145
|
+
const y = semverKey(b);
|
|
146
|
+
for (let i = 0; i < 3; i++)
|
|
147
|
+
if (x.rel[i] !== y.rel[i])
|
|
148
|
+
return x.rel[i] < y.rel[i] ? -1 : 1;
|
|
149
|
+
if (x.pre.length === 0 || y.pre.length === 0)
|
|
150
|
+
return x.pre.length === y.pre.length ? 0 : x.pre.length === 0 ? 1 : -1;
|
|
151
|
+
for (let i = 0; i < Math.max(x.pre.length, y.pre.length); i++) {
|
|
152
|
+
if (i >= x.pre.length)
|
|
153
|
+
return -1;
|
|
154
|
+
if (i >= y.pre.length)
|
|
155
|
+
return 1;
|
|
156
|
+
const p = x.pre[i];
|
|
157
|
+
const q = y.pre[i];
|
|
158
|
+
if (p === q)
|
|
159
|
+
continue;
|
|
160
|
+
const pn = /^\d+$/.test(p);
|
|
161
|
+
const qn = /^\d+$/.test(q);
|
|
162
|
+
if (pn && qn)
|
|
163
|
+
return BigInt(p) < BigInt(q) ? -1 : 1;
|
|
164
|
+
if (pn)
|
|
165
|
+
return -1;
|
|
166
|
+
if (qn)
|
|
167
|
+
return 1;
|
|
168
|
+
return p < q ? -1 : 1;
|
|
169
|
+
}
|
|
170
|
+
return 0;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* The proxy's `latest` rule (registry-proxy version.ts resolveLatest): the
|
|
174
|
+
* highest STABLE version; the highest prerelease only when no stable exists.
|
|
175
|
+
* Non-semver entries are ignored.
|
|
176
|
+
*/
|
|
177
|
+
export function resolveLatestStable(versions) {
|
|
178
|
+
const valid = versions.filter((v) => semverKey(v) !== null);
|
|
179
|
+
if (valid.length === 0)
|
|
180
|
+
return undefined;
|
|
181
|
+
const stable = valid.filter((v) => semverKey(v).pre.length === 0);
|
|
182
|
+
const pool = stable.length > 0 ? stable : valid;
|
|
183
|
+
return pool.reduce((best, v) => (compareSemver(v, best) > 0 ? v : best));
|
|
184
|
+
}
|
|
185
|
+
/** '@ist/beta' → 'ist__beta' (proxy generic path form). */
|
|
186
|
+
export function snapshotGenericName(snapshotName) {
|
|
187
|
+
const m = /^@([^/]+)\/(.+)$/.exec(snapshotName.trim());
|
|
188
|
+
return m ? `${m[1]}__${m[2]}` : snapshotName.trim();
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Resolve the snapshot version to grant/install. An explicit exact version is
|
|
192
|
+
* used as-is; none / 'latest' → GET {proxy}/generic/<name>/versions (no auth)
|
|
193
|
+
* and pick resolveLatestStable over the returned list. Throws GrantError
|
|
194
|
+
* ('version-resolve') on any failure.
|
|
195
|
+
*/
|
|
196
|
+
export async function resolveInstallVersion(snapshotName, requested, deps) {
|
|
197
|
+
if (requested && requested !== 'latest')
|
|
198
|
+
return requested;
|
|
199
|
+
const fetchImpl = deps.fetchImpl ?? fetch;
|
|
200
|
+
const generic = snapshotGenericName(snapshotName);
|
|
201
|
+
const controller = new AbortController();
|
|
202
|
+
const timer = setTimeout(() => controller.abort(), deps.timeoutMs ?? DEFAULT_GRANT_TIMEOUT_MS);
|
|
203
|
+
let body = null;
|
|
204
|
+
try {
|
|
205
|
+
const res = await fetchImpl(`${deps.registryUrl}/generic/${generic}/versions`, { signal: controller.signal });
|
|
206
|
+
if (!res.ok) {
|
|
207
|
+
throw new GrantError('version-resolve', `cannot list versions of ${snapshotName} (HTTP ${res.status})`, res.status);
|
|
208
|
+
}
|
|
209
|
+
body = (await res.json().catch(() => null));
|
|
210
|
+
}
|
|
211
|
+
catch (err) {
|
|
212
|
+
if (err instanceof GrantError)
|
|
213
|
+
throw err;
|
|
214
|
+
const msg = controller.signal.aborted ? 'timed out' : err instanceof Error ? err.message : String(err);
|
|
215
|
+
throw new GrantError('version-resolve', `cannot list versions of ${snapshotName}: ${msg}`);
|
|
216
|
+
}
|
|
217
|
+
finally {
|
|
218
|
+
clearTimeout(timer);
|
|
219
|
+
}
|
|
220
|
+
const list = Array.isArray(body?.versions) ? body.versions.filter((v) => typeof v === 'string') : [];
|
|
221
|
+
const latest = resolveLatestStable(list);
|
|
222
|
+
if (!latest)
|
|
223
|
+
throw new GrantError('version-resolve', `no published versions of ${snapshotName}`);
|
|
224
|
+
return latest;
|
|
225
|
+
}
|
|
226
|
+
// ============================================================
|
|
227
|
+
// Member helpers
|
|
228
|
+
// ============================================================
|
|
229
|
+
/** '@ist/beta@0.2.0' → {name:'@ist/beta', version:'0.2.0'}; no version → undefined. */
|
|
230
|
+
export function splitSnapshotSpec(spec) {
|
|
231
|
+
const at = spec.lastIndexOf('@');
|
|
232
|
+
if (at > 0)
|
|
233
|
+
return { name: spec.slice(0, at), version: spec.slice(at + 1) || undefined };
|
|
234
|
+
return { name: spec };
|
|
235
|
+
}
|
|
236
|
+
/** Canonical member name: lowercase, generic path form `ist__x` → `@ist/x`. */
|
|
237
|
+
export function canonicalMemberName(name) {
|
|
238
|
+
const n = name.trim().toLowerCase();
|
|
239
|
+
if (!n.startsWith('@')) {
|
|
240
|
+
const i = n.indexOf('__');
|
|
241
|
+
if (i > 0)
|
|
242
|
+
return `@${n.slice(0, i)}/${n.slice(i + 2)}`;
|
|
243
|
+
}
|
|
244
|
+
return n;
|
|
245
|
+
}
|
|
246
|
+
function memberKey(name, version) {
|
|
247
|
+
return `${canonicalMemberName(name)}@${version.trim()}`;
|
|
248
|
+
}
|
|
249
|
+
/** The root snapshot's own version as frozen in the closure, if present. */
|
|
250
|
+
export function findRootMemberVersion(members, snapshotName) {
|
|
251
|
+
const root = canonicalMemberName(snapshotName);
|
|
252
|
+
const hit = members.filter((m) => canonicalMemberName(m.name) === root && m.kind !== 'npm');
|
|
253
|
+
return hit.length === 1 ? hit[0].version : null;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Check that every expected exact pin is a closure member (name@version, name
|
|
257
|
+
* case-insensitive). Kind is not compared in v1 (canonical key = @scope/name@ver).
|
|
258
|
+
*/
|
|
259
|
+
export function checkGrantCoverage(expected, members) {
|
|
260
|
+
const allowed = new Set(members.map((m) => memberKey(m.name, m.version)));
|
|
261
|
+
const entries = Array.isArray(expected) ? expected.map((e) => [e.name, e.version]) : Object.entries(expected);
|
|
262
|
+
const missing = [];
|
|
263
|
+
for (const [name, version] of entries) {
|
|
264
|
+
if (!allowed.has(memberKey(name, version)))
|
|
265
|
+
missing.push(`${name}@${version}`);
|
|
266
|
+
}
|
|
267
|
+
return { ok: missing.length === 0, missing };
|
|
268
|
+
}
|
|
269
|
+
// ============================================================
|
|
270
|
+
// Grant state + TTL re-issue
|
|
271
|
+
// ============================================================
|
|
272
|
+
/** Re-issue when remaining lifetime falls below max(120s, 25% of TTL). */
|
|
273
|
+
export function reissueThresholdSec(expiresIn) {
|
|
274
|
+
return Math.max(120, Math.floor(expiresIn * 0.25));
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Holds the active grant for ONE snapshot@exact-version and re-issues it before
|
|
278
|
+
* a long phase when the remaining lifetime is low. A re-issue whose closureHash
|
|
279
|
+
* differs from the original is a GrantError('closure-changed') — the caller
|
|
280
|
+
* decides (require: fail-loud; prefer: fall back).
|
|
281
|
+
*/
|
|
282
|
+
export class GrantState {
|
|
283
|
+
req;
|
|
284
|
+
deps;
|
|
285
|
+
grant = null;
|
|
286
|
+
issuedAtMs = 0;
|
|
287
|
+
reissueCount = 0;
|
|
288
|
+
now;
|
|
289
|
+
constructor(req, deps) {
|
|
290
|
+
this.req = req;
|
|
291
|
+
this.deps = deps;
|
|
292
|
+
this.now = deps.now ?? Date.now;
|
|
293
|
+
}
|
|
294
|
+
async issue() {
|
|
295
|
+
const g = await this.deps.request(this.req);
|
|
296
|
+
this.set(g);
|
|
297
|
+
return g;
|
|
298
|
+
}
|
|
299
|
+
/** Pin subsequent re-issues to the exact version (after 'latest' resolution). */
|
|
300
|
+
pinVersion(version) {
|
|
301
|
+
this.req = { ...this.req, version };
|
|
302
|
+
}
|
|
303
|
+
get current() {
|
|
304
|
+
if (!this.grant)
|
|
305
|
+
throw new Error('GrantState: no grant issued');
|
|
306
|
+
return this.grant;
|
|
307
|
+
}
|
|
308
|
+
get reissues() {
|
|
309
|
+
return this.reissueCount;
|
|
310
|
+
}
|
|
311
|
+
get version() {
|
|
312
|
+
return this.req.version;
|
|
313
|
+
}
|
|
314
|
+
/** Seconds of lifetime left (0 when TTL unknown/expired). */
|
|
315
|
+
remainingSec() {
|
|
316
|
+
if (!this.grant || this.grant.expiresIn <= 0)
|
|
317
|
+
return 0;
|
|
318
|
+
const elapsed = (this.now() - this.issuedAtMs) / 1000;
|
|
319
|
+
return Math.max(0, this.grant.expiresIn - elapsed);
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Re-issue if the remaining lifetime is below the threshold. A grant with an
|
|
323
|
+
* unknown TTL (expiresIn 0) is never re-issued. Returns true when re-issued.
|
|
324
|
+
*/
|
|
325
|
+
async ensureFresh() {
|
|
326
|
+
const g = this.current;
|
|
327
|
+
if (g.expiresIn <= 0)
|
|
328
|
+
return false;
|
|
329
|
+
if (this.remainingSec() >= reissueThresholdSec(g.expiresIn))
|
|
330
|
+
return false;
|
|
331
|
+
const next = await this.deps.request(this.req);
|
|
332
|
+
if (g.closureHash && next.closureHash && next.closureHash !== g.closureHash) {
|
|
333
|
+
throw new GrantError('closure-changed', `re-issued grant for ${this.req.snapshot}@${this.req.version} has a different closure ` +
|
|
334
|
+
`(${g.closureHash.slice(0, 8)} → ${next.closureHash.slice(0, 8)})`);
|
|
335
|
+
}
|
|
336
|
+
this.set(next);
|
|
337
|
+
this.reissueCount++;
|
|
338
|
+
return true;
|
|
339
|
+
}
|
|
340
|
+
set(g) {
|
|
341
|
+
this.grant = g;
|
|
342
|
+
this.issuedAtMs = this.now();
|
|
343
|
+
this.deps.onToken?.(g.token);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
/** The single grant log line: mode, member count, TTL, closure prefix, masked token. */
|
|
347
|
+
export function formatGrantLog(mode, grant) {
|
|
348
|
+
const hash = grant.closureHash ? grant.closureHash.slice(0, 8) : '-';
|
|
349
|
+
return (`Grant: mode=${mode} members=${grant.members.length} expiresIn=${grant.expiresIn}s ` +
|
|
350
|
+
`closure=${hash} token=${maskToken(grant.token)}`);
|
|
351
|
+
}
|
|
352
|
+
//# sourceMappingURL=grant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grant.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C,KAAK,CAAC,CAAC;IAC/B,CAAC;CACF;AAED,wFAAwF;AACxF,MAAM,UAAU,cAAc,CAAC,IAAe,EAAE,KAAoB;IAClE,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IACrE,OAAO,CACL,eAAe,IAAI,YAAY,KAAK,CAAC,OAAO,CAAC,MAAM,cAAc,KAAK,CAAC,SAAS,IAAI;QACpF,WAAW,IAAI,UAAU,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAClD,CAAC;AACJ,CAAC"}
|
|
@@ -65,14 +65,28 @@ export declare function verifyInstallMap(installMap: Record<string, string>, opt
|
|
|
65
65
|
* Returns the FINAL VerificationResult (ok=true iff the disk converged). The
|
|
66
66
|
* integrator decides how to react (exit non-zero, log, fold into the ledger).
|
|
67
67
|
*
|
|
68
|
+
* Re-pinning is BATCHED: every mismatch in a round is repaired in a single
|
|
69
|
+
* `installMany([...])` call (which maps to one `npm install -g A@vA B@vB ...`),
|
|
70
|
+
* instead of one npm spawn per package. This collapses N sequential global
|
|
71
|
+
* installs per round into one, the dominant cost of a slow converge phase.
|
|
72
|
+
*
|
|
73
|
+
* `installMany` is preferred; the legacy per-package `install(name, version)`
|
|
74
|
+
* hook is still accepted for backward compatibility (used when `installMany`
|
|
75
|
+
* is not supplied — each mismatch is then installed individually).
|
|
76
|
+
*
|
|
68
77
|
* @param installMap manifest npm pins (name → exact version)
|
|
69
78
|
* @param overrides FB pin overrides (name → version); {} for none
|
|
70
|
-
* @param deps.
|
|
79
|
+
* @param deps.installMany batch re-pin ALL mismatches at once (preferred)
|
|
80
|
+
* @param deps.install legacy single re-pin (fallback when no installMany)
|
|
71
81
|
* @param deps.readVersion disk reader (defaults to readInstalledNpmVersion)
|
|
72
82
|
* @param deps.maxRounds max convergence rounds (default 3)
|
|
73
83
|
*/
|
|
74
84
|
export declare function runConverge(installMap: Record<string, string>, overrides: Record<string, string>, deps: {
|
|
75
|
-
install
|
|
85
|
+
install?: (name: string, version: string) => void;
|
|
86
|
+
installMany?: (pkgs: Array<{
|
|
87
|
+
name: string;
|
|
88
|
+
version: string;
|
|
89
|
+
}>) => void;
|
|
76
90
|
readVersion?: VersionReader;
|
|
77
91
|
maxRounds?: number;
|
|
78
92
|
}): VerificationResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install-verify.d.ts","sourceRoot":"","sources":["../../src/lib/install-verify.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;GAWG;AAEH,MAAM,WAAW,eAAe;IAC9B,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,QAAQ,EAAE,MAAM,CAAC;IACjB,2EAA2E;IAC3E,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CACpB;AAED,MAAM,WAAW,kBAAkB;IACjC,iEAAiE;IACjE,EAAE,EAAE,OAAO,CAAC;IACZ,+DAA+D;IAC/D,UAAU,EAAE,eAAe,EAAE,CAAC;IAC9B,mDAAmD;IACnD,aAAa,EAAE,MAAM,CAAC;IACtB,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;CACf;AAED,oFAAoF;AACpF,MAAM,MAAM,aAAa,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;AAmB5D,wEAAwE;AACxE,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAYnE;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAClC,IAAI,GAAE;IAAE,WAAW,CAAC,EAAE,aAAa,CAAA;CAAO,GACzC,kBAAkB,CAsBpB;AAED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C,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,KAAK,IAAI,CAAC;IACvE,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GACA,kBAAkB,CAuBpB;AAED;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,CAAC,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CAC1D;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAUnG;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,eAAe,EAAE,GAAG,MAAM,CAU/E"}
|
|
@@ -90,20 +90,41 @@ export function verifyInstallMap(installMap, opts = {}) {
|
|
|
90
90
|
* Returns the FINAL VerificationResult (ok=true iff the disk converged). The
|
|
91
91
|
* integrator decides how to react (exit non-zero, log, fold into the ledger).
|
|
92
92
|
*
|
|
93
|
+
* Re-pinning is BATCHED: every mismatch in a round is repaired in a single
|
|
94
|
+
* `installMany([...])` call (which maps to one `npm install -g A@vA B@vB ...`),
|
|
95
|
+
* instead of one npm spawn per package. This collapses N sequential global
|
|
96
|
+
* installs per round into one, the dominant cost of a slow converge phase.
|
|
97
|
+
*
|
|
98
|
+
* `installMany` is preferred; the legacy per-package `install(name, version)`
|
|
99
|
+
* hook is still accepted for backward compatibility (used when `installMany`
|
|
100
|
+
* is not supplied — each mismatch is then installed individually).
|
|
101
|
+
*
|
|
93
102
|
* @param installMap manifest npm pins (name → exact version)
|
|
94
103
|
* @param overrides FB pin overrides (name → version); {} for none
|
|
95
|
-
* @param deps.
|
|
104
|
+
* @param deps.installMany batch re-pin ALL mismatches at once (preferred)
|
|
105
|
+
* @param deps.install legacy single re-pin (fallback when no installMany)
|
|
96
106
|
* @param deps.readVersion disk reader (defaults to readInstalledNpmVersion)
|
|
97
107
|
* @param deps.maxRounds max convergence rounds (default 3)
|
|
98
108
|
*/
|
|
99
109
|
export function runConverge(installMap, overrides, deps) {
|
|
110
|
+
if (!deps.installMany && !deps.install) {
|
|
111
|
+
throw new Error('runConverge requires either deps.installMany or deps.install');
|
|
112
|
+
}
|
|
100
113
|
const effectiveMap = applyPinOverrides(installMap, overrides);
|
|
101
114
|
const readVersion = deps.readVersion ?? readInstalledNpmVersion;
|
|
102
115
|
const maxRounds = deps.maxRounds ?? 3;
|
|
103
116
|
let verification = verifyInstallMap(effectiveMap, { readVersion });
|
|
104
117
|
for (let round = 1; round <= maxRounds && !verification.ok; round++) {
|
|
105
|
-
|
|
106
|
-
|
|
118
|
+
const pkgs = verification.mismatches.map((m) => ({ name: m.name, version: m.expected }));
|
|
119
|
+
if (deps.installMany) {
|
|
120
|
+
// Batch: one npm invocation repairs the whole round.
|
|
121
|
+
deps.installMany(pkgs);
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
// Legacy fallback: one install per mismatched package.
|
|
125
|
+
for (const p of pkgs) {
|
|
126
|
+
deps.install(p.name, p.version);
|
|
127
|
+
}
|
|
107
128
|
}
|
|
108
129
|
verification = verifyInstallMap(effectiveMap, { readVersion });
|
|
109
130
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install-verify.js","sourceRoot":"","sources":["../../src/lib/install-verify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAsCtD,I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