@getbrevo/cli 2.0.2 → 2.1.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/CHANGELOG.md +209 -0
- package/README.md +8 -5
- package/agent-context/AGENTS.md +59 -15
- package/agent-context/SKILL.md +70 -14
- package/dist/{templates → bin}/files/AGENTS.md.tmpl +11 -1
- package/dist/{templates → bin}/files/CLAUDE.md.tmpl +8 -0
- package/dist/{templates → bin}/files/README.md.tmpl +11 -14
- package/dist/bin/files/app-config.json.tmpl +16 -0
- package/dist/{templates → bin}/files/src/oauth/.env.example.tmpl +8 -0
- package/dist/{templates → bin}/files/src/oauth/.env.local.tmpl +2 -0
- package/dist/{templates → bin}/files/src/oauth/handler.js.tmpl +49 -7
- package/dist/{templates → bin}/files/src/oauth/server.js.tmpl +20 -14
- package/dist/{templates → bin}/files/src/oauth/token-store.js.tmpl +19 -0
- package/dist/bin/index.js +660 -235
- package/dist/bin/index.js.map +7 -1
- package/package.json +6 -4
- package/dist/api/client.d.ts +0 -25
- package/dist/api/client.d.ts.map +0 -1
- package/dist/api/client.js +0 -205
- package/dist/api/client.js.map +0 -1
- package/dist/bin/index.d.ts +0 -3
- package/dist/bin/index.d.ts.map +0 -1
- package/dist/commands/app/create.d.ts +0 -8
- package/dist/commands/app/create.d.ts.map +0 -1
- package/dist/commands/app/create.js +0 -325
- package/dist/commands/app/create.js.map +0 -1
- package/dist/commands/app/credentials.d.ts +0 -6
- package/dist/commands/app/credentials.d.ts.map +0 -1
- package/dist/commands/app/credentials.js +0 -114
- package/dist/commands/app/credentials.js.map +0 -1
- package/dist/commands/app/delete.d.ts +0 -6
- package/dist/commands/app/delete.d.ts.map +0 -1
- package/dist/commands/app/delete.js +0 -167
- package/dist/commands/app/delete.js.map +0 -1
- package/dist/commands/app/list.d.ts +0 -4
- package/dist/commands/app/list.d.ts.map +0 -1
- package/dist/commands/app/list.js +0 -71
- package/dist/commands/app/list.js.map +0 -1
- package/dist/commands/app/scaffold.d.ts +0 -5
- package/dist/commands/app/scaffold.d.ts.map +0 -1
- package/dist/commands/app/scaffold.js +0 -213
- package/dist/commands/app/scaffold.js.map +0 -1
- package/dist/commands/app/scopes.d.ts +0 -2
- package/dist/commands/app/scopes.d.ts.map +0 -1
- package/dist/commands/app/scopes.js +0 -81
- package/dist/commands/app/scopes.js.map +0 -1
- package/dist/commands/app/start.d.ts +0 -5
- package/dist/commands/app/start.d.ts.map +0 -1
- package/dist/commands/app/start.js +0 -220
- package/dist/commands/app/start.js.map +0 -1
- package/dist/commands/app/update.d.ts +0 -2
- package/dist/commands/app/update.d.ts.map +0 -1
- package/dist/commands/app/update.js +0 -444
- package/dist/commands/app/update.js.map +0 -1
- package/dist/commands/definitions.d.ts +0 -5
- package/dist/commands/definitions.d.ts.map +0 -1
- package/dist/commands/definitions.js +0 -262
- package/dist/commands/definitions.js.map +0 -1
- package/dist/commands/init.d.ts +0 -2
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js +0 -138
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/login.d.ts +0 -6
- package/dist/commands/login.d.ts.map +0 -1
- package/dist/commands/login.js +0 -251
- package/dist/commands/login.js.map +0 -1
- package/dist/commands/logout.d.ts +0 -5
- package/dist/commands/logout.d.ts.map +0 -1
- package/dist/commands/logout.js +0 -54
- package/dist/commands/logout.js.map +0 -1
- package/dist/commands/skill/install.d.ts +0 -4
- package/dist/commands/skill/install.d.ts.map +0 -1
- package/dist/commands/skill/install.js +0 -29
- package/dist/commands/skill/install.js.map +0 -1
- package/dist/commands/skill/uninstall.d.ts +0 -4
- package/dist/commands/skill/uninstall.d.ts.map +0 -1
- package/dist/commands/skill/uninstall.js +0 -23
- package/dist/commands/skill/uninstall.js.map +0 -1
- package/dist/commands/whoami.d.ts +0 -4
- package/dist/commands/whoami.d.ts.map +0 -1
- package/dist/commands/whoami.js +0 -85
- package/dist/commands/whoami.js.map +0 -1
- package/dist/container.d.ts +0 -7
- package/dist/container.d.ts.map +0 -1
- package/dist/container.js +0 -28
- package/dist/container.js.map +0 -1
- package/dist/lang/en.d.ts +0 -162
- package/dist/lang/en.d.ts.map +0 -1
- package/dist/lang/en.js +0 -189
- package/dist/lang/en.js.map +0 -1
- package/dist/lib/abort.d.ts +0 -3
- package/dist/lib/abort.d.ts.map +0 -1
- package/dist/lib/abort.js +0 -30
- package/dist/lib/abort.js.map +0 -1
- package/dist/lib/auth-guard.d.ts +0 -13
- package/dist/lib/auth-guard.d.ts.map +0 -1
- package/dist/lib/auth-guard.js +0 -60
- package/dist/lib/auth-guard.js.map +0 -1
- package/dist/lib/browser.d.ts +0 -2
- package/dist/lib/browser.d.ts.map +0 -1
- package/dist/lib/browser.js +0 -16
- package/dist/lib/browser.js.map +0 -1
- package/dist/lib/cli-version.d.ts +0 -2
- package/dist/lib/cli-version.d.ts.map +0 -1
- package/dist/lib/cli-version.js +0 -59
- package/dist/lib/cli-version.js.map +0 -1
- package/dist/lib/command-handler.d.ts +0 -10
- package/dist/lib/command-handler.d.ts.map +0 -1
- package/dist/lib/command-handler.js +0 -16
- package/dist/lib/command-handler.js.map +0 -1
- package/dist/lib/command-registry.d.ts +0 -28
- package/dist/lib/command-registry.d.ts.map +0 -1
- package/dist/lib/command-registry.js +0 -54
- package/dist/lib/command-registry.js.map +0 -1
- package/dist/lib/config.d.ts +0 -83
- package/dist/lib/config.d.ts.map +0 -1
- package/dist/lib/config.js +0 -430
- package/dist/lib/config.js.map +0 -1
- package/dist/lib/constants.d.ts +0 -48
- package/dist/lib/constants.d.ts.map +0 -1
- package/dist/lib/constants.js +0 -121
- package/dist/lib/constants.js.map +0 -1
- package/dist/lib/errors.d.ts +0 -30
- package/dist/lib/errors.d.ts.map +0 -1
- package/dist/lib/errors.js +0 -66
- package/dist/lib/errors.js.map +0 -1
- package/dist/lib/exit-codes.d.ts +0 -9
- package/dist/lib/exit-codes.d.ts.map +0 -1
- package/dist/lib/exit-codes.js +0 -12
- package/dist/lib/exit-codes.js.map +0 -1
- package/dist/lib/hidden-input.d.ts +0 -2
- package/dist/lib/hidden-input.d.ts.map +0 -1
- package/dist/lib/hidden-input.js +0 -78
- package/dist/lib/hidden-input.js.map +0 -1
- package/dist/lib/json-output.d.ts +0 -6
- package/dist/lib/json-output.d.ts.map +0 -1
- package/dist/lib/json-output.js +0 -11
- package/dist/lib/json-output.js.map +0 -1
- package/dist/lib/logger.d.ts +0 -11
- package/dist/lib/logger.d.ts.map +0 -1
- package/dist/lib/logger.js +0 -110
- package/dist/lib/logger.js.map +0 -1
- package/dist/lib/oauth-freshness.d.ts +0 -30
- package/dist/lib/oauth-freshness.d.ts.map +0 -1
- package/dist/lib/oauth-freshness.js +0 -61
- package/dist/lib/oauth-freshness.js.map +0 -1
- package/dist/lib/port.d.ts +0 -25
- package/dist/lib/port.d.ts.map +0 -1
- package/dist/lib/port.js +0 -103
- package/dist/lib/port.js.map +0 -1
- package/dist/lib/telemetry.d.ts +0 -9
- package/dist/lib/telemetry.d.ts.map +0 -1
- package/dist/lib/telemetry.js +0 -57
- package/dist/lib/telemetry.js.map +0 -1
- package/dist/lib/ui.d.ts +0 -14
- package/dist/lib/ui.d.ts.map +0 -1
- package/dist/lib/ui.js +0 -75
- package/dist/lib/ui.js.map +0 -1
- package/dist/lib/update-notifier.d.ts +0 -37
- package/dist/lib/update-notifier.d.ts.map +0 -1
- package/dist/lib/update-notifier.js +0 -298
- package/dist/lib/update-notifier.js.map +0 -1
- package/dist/lib/validators.d.ts +0 -55
- package/dist/lib/validators.d.ts.map +0 -1
- package/dist/lib/validators.js +0 -166
- package/dist/lib/validators.js.map +0 -1
- package/dist/services/account.d.ts +0 -8
- package/dist/services/account.d.ts.map +0 -1
- package/dist/services/account.js +0 -15
- package/dist/services/account.js.map +0 -1
- package/dist/services/app.d.ts +0 -38
- package/dist/services/app.d.ts.map +0 -1
- package/dist/services/app.js +0 -145
- package/dist/services/app.js.map +0 -1
- package/dist/services/browser-auth.d.ts +0 -15
- package/dist/services/browser-auth.d.ts.map +0 -1
- package/dist/services/browser-auth.js +0 -188
- package/dist/services/browser-auth.js.map +0 -1
- package/dist/services/normalize-app-id.d.ts +0 -12
- package/dist/services/normalize-app-id.d.ts.map +0 -1
- package/dist/services/normalize-app-id.js +0 -38
- package/dist/services/normalize-app-id.js.map +0 -1
- package/dist/services/oauth-metadata.d.ts +0 -7
- package/dist/services/oauth-metadata.d.ts.map +0 -1
- package/dist/services/oauth-metadata.js +0 -43
- package/dist/services/oauth-metadata.js.map +0 -1
- package/dist/services/oauth-refresh.d.ts +0 -14
- package/dist/services/oauth-refresh.d.ts.map +0 -1
- package/dist/services/oauth-refresh.js +0 -70
- package/dist/services/oauth-refresh.js.map +0 -1
- package/dist/services/scopes-html.d.ts +0 -3
- package/dist/services/scopes-html.d.ts.map +0 -1
- package/dist/services/scopes-html.js +0 -516
- package/dist/services/scopes-html.js.map +0 -1
- package/dist/services/scopes-web.d.ts +0 -12
- package/dist/services/scopes-web.d.ts.map +0 -1
- package/dist/services/scopes-web.js +0 -95
- package/dist/services/scopes-web.js.map +0 -1
- package/dist/services/skill.d.ts +0 -48
- package/dist/services/skill.d.ts.map +0 -1
- package/dist/services/skill.js +0 -223
- package/dist/services/skill.js.map +0 -1
- package/dist/skills/index.d.ts +0 -47
- package/dist/skills/index.d.ts.map +0 -1
- package/dist/skills/index.js +0 -61
- package/dist/skills/index.js.map +0 -1
- package/dist/templates/files/app-config.json.tmpl +0 -25
- package/dist/templates/index.d.ts +0 -36
- package/dist/templates/index.d.ts.map +0 -1
- package/dist/templates/index.js +0 -105
- package/dist/templates/index.js.map +0 -1
- package/dist/types.d.ts +0 -32
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -3
- package/dist/types.js.map +0 -1
- /package/dist/{templates → bin}/files/gitignore.tmpl +0 -0
- /package/dist/{templates → bin}/files/src/oauth/package.json.tmpl +0 -0
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OAUTH_REFRESH_SKEW_MS = void 0;
|
|
4
|
-
exports.shouldRefreshOauth = shouldRefreshOauth;
|
|
5
|
-
exports.ensureFreshOauthToken = ensureFreshOauthToken;
|
|
6
|
-
exports.installProactiveOauthRefresh = installProactiveOauthRefresh;
|
|
7
|
-
const auth_guard_1 = require("./auth-guard");
|
|
8
|
-
// Refresh this far ahead of `expiresAt`. Covers clock skew between the CLI host
|
|
9
|
-
// and the IdP plus the round-trip of the request the token is about to be used
|
|
10
|
-
// for, so a token that would expire mid-flight is replaced first.
|
|
11
|
-
exports.OAUTH_REFRESH_SKEW_MS = 60_000;
|
|
12
|
-
// True when `auth` is an OAuth credential whose access token is expired or
|
|
13
|
-
// about to be. Doubles as a type guard so callers get the narrowed credential
|
|
14
|
-
// (and its `refreshToken`) without a cast.
|
|
15
|
-
function shouldRefreshOauth(auth, now, skewMs = exports.OAUTH_REFRESH_SKEW_MS) {
|
|
16
|
-
if (auth?.kind !== 'oauth')
|
|
17
|
-
return false;
|
|
18
|
-
if (!auth.refreshToken)
|
|
19
|
-
return false;
|
|
20
|
-
if (!Number.isFinite(auth.expiresAt))
|
|
21
|
-
return false;
|
|
22
|
-
return auth.expiresAt - skewMs <= now;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Proactively swap a near-expiry OAuth access token for a fresh one.
|
|
26
|
-
*
|
|
27
|
-
* Best-effort by design: every failure is swallowed (and handed to `onError`
|
|
28
|
-
* for debug logging) so a transient network blip or an unwritable credentials
|
|
29
|
-
* file never blocks the command the user actually asked for. The reactive
|
|
30
|
-
* `onAuthFailure` handler in `bin/index.ts` remains the single source of truth
|
|
31
|
-
* for clearing credentials when the refresh token is genuinely dead.
|
|
32
|
-
*
|
|
33
|
-
* Returns true only when a new token was fetched and persisted.
|
|
34
|
-
*/
|
|
35
|
-
async function ensureFreshOauthToken(deps) {
|
|
36
|
-
const auth = deps.getAuthCred();
|
|
37
|
-
const now = deps.now ? deps.now() : Date.now();
|
|
38
|
-
if (!shouldRefreshOauth(auth, now, deps.skewMs))
|
|
39
|
-
return false;
|
|
40
|
-
try {
|
|
41
|
-
deps.persist(await deps.refresh(auth.refreshToken));
|
|
42
|
-
return true;
|
|
43
|
-
}
|
|
44
|
-
catch (err) {
|
|
45
|
-
deps.onError?.(err);
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
// Registers the proactive refresh as a `preAction` hook, gated to exactly the
|
|
50
|
-
// commands the auth guard protects — local-only commands (`login`, `logout`,
|
|
51
|
-
// `skill:cli …`) must keep working offline, so they never trigger a network
|
|
52
|
-
// call. Register after `installAuthGuard` so an unauthenticated invocation
|
|
53
|
-
// still fails fast on the guard.
|
|
54
|
-
function installProactiveOauthRefresh(program, deps) {
|
|
55
|
-
program.hook('preAction', async (thisCommand, actionCommand) => {
|
|
56
|
-
if (!(0, auth_guard_1.commandRequiresAuth)(thisCommand, actionCommand))
|
|
57
|
-
return;
|
|
58
|
-
await ensureFreshOauthToken(deps);
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
//# sourceMappingURL=oauth-freshness.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-freshness.js","sourceRoot":"","sources":["../../src/lib/oauth-freshness.ts"],"names":[],"mappings":";;;AAuBA,gDASC;AAaD,sDAaC;AAOD,oEAKC;AArED,6CAAmD;AAKnD,gFAAgF;AAChF,+EAA+E;AAC/E,kEAAkE;AACrD,QAAA,qBAAqB,GAAG,MAAM,CAAC;AAW5C,2EAA2E;AAC3E,8EAA8E;AAC9E,2CAA2C;AAC3C,SAAgB,kBAAkB,CAChC,IAA0B,EAC1B,GAAW,EACX,SAAiB,6BAAqB;IAEtC,IAAI,IAAI,EAAE,IAAI,KAAK,OAAO;QAAE,OAAO,KAAK,CAAC;IACzC,IAAI,CAAC,IAAI,CAAC,YAAY;QAAE,OAAO,KAAK,CAAC;IACrC,IAA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check whether a TCP port is available.
|
|
3
|
-
* Resolves true if the port is free, false if in use.
|
|
4
|
-
* Rejects on unexpected errors (e.g. EACCES, invalid port).
|
|
5
|
-
*
|
|
6
|
-
* Probes 0.0.0.0 (IPv4 wildcard) and 127.0.0.1 (loopback) sequentially.
|
|
7
|
-
* A single-host probe misses real conflicts: a loopback-only probe doesn't
|
|
8
|
-
* catch wildcard owners (e.g. Mockoon on `*:3009`), and a wildcard-only
|
|
9
|
-
* probe doesn't catch loopback-bound owners. Reporting "in use" if either
|
|
10
|
-
* probe sees EADDRINUSE matches what an OAuth server bound to 127.0.0.1
|
|
11
|
-
* would actually hit at start time or runtime.
|
|
12
|
-
*
|
|
13
|
-
* Probes run sequentially (not Promise.all) because parallel binds to
|
|
14
|
-
* 0.0.0.0:N and 127.0.0.1:N race against each other — whichever the
|
|
15
|
-
* kernel grants first triggers EADDRINUSE on the other, even when the
|
|
16
|
-
* port is genuinely free. Sequential probes with proper close-between
|
|
17
|
-
* avoid the self-collision.
|
|
18
|
-
*/
|
|
19
|
-
export declare function isPortAvailable(port: number): Promise<boolean>;
|
|
20
|
-
/**
|
|
21
|
-
* Find the first available port starting from `startPort`.
|
|
22
|
-
* Scans up to MAX_SCAN ports. Returns `null` if no free port is found.
|
|
23
|
-
*/
|
|
24
|
-
export declare function findAvailablePort(startPort: number): Promise<number | null>;
|
|
25
|
-
//# sourceMappingURL=port.d.ts.map
|
package/dist/lib/port.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"port.d.ts","sourceRoot":"","sources":["../../src/lib/port.ts"],"names":[],"mappings":"AA2BA;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAIpE;AAKD;;;GAGG;AACH,wBAAsB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAKjF"}
|
package/dist/lib/port.js
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.isPortAvailable = isPortAvailable;
|
|
37
|
-
exports.findAvailablePort = findAvailablePort;
|
|
38
|
-
const net = __importStar(require("node:net"));
|
|
39
|
-
/**
|
|
40
|
-
* Try to bind a fresh listener to `port` on `host`. Resolves true if the
|
|
41
|
-
* bind succeeds (port free), false on EADDRINUSE, rejects on other errors.
|
|
42
|
-
*/
|
|
43
|
-
function tryBind(port, host) {
|
|
44
|
-
return new Promise((resolve, reject) => {
|
|
45
|
-
const server = net.createServer();
|
|
46
|
-
server.once('error', (err) => {
|
|
47
|
-
if (err.code === 'EADDRINUSE') {
|
|
48
|
-
resolve(false);
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
reject(err);
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
server.once('listening', () => {
|
|
55
|
-
server.close(() => resolve(true));
|
|
56
|
-
});
|
|
57
|
-
try {
|
|
58
|
-
server.listen(port, host);
|
|
59
|
-
}
|
|
60
|
-
catch (err) {
|
|
61
|
-
reject(err);
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Check whether a TCP port is available.
|
|
67
|
-
* Resolves true if the port is free, false if in use.
|
|
68
|
-
* Rejects on unexpected errors (e.g. EACCES, invalid port).
|
|
69
|
-
*
|
|
70
|
-
* Probes 0.0.0.0 (IPv4 wildcard) and 127.0.0.1 (loopback) sequentially.
|
|
71
|
-
* A single-host probe misses real conflicts: a loopback-only probe doesn't
|
|
72
|
-
* catch wildcard owners (e.g. Mockoon on `*:3009`), and a wildcard-only
|
|
73
|
-
* probe doesn't catch loopback-bound owners. Reporting "in use" if either
|
|
74
|
-
* probe sees EADDRINUSE matches what an OAuth server bound to 127.0.0.1
|
|
75
|
-
* would actually hit at start time or runtime.
|
|
76
|
-
*
|
|
77
|
-
* Probes run sequentially (not Promise.all) because parallel binds to
|
|
78
|
-
* 0.0.0.0:N and 127.0.0.1:N race against each other — whichever the
|
|
79
|
-
* kernel grants first triggers EADDRINUSE on the other, even when the
|
|
80
|
-
* port is genuinely free. Sequential probes with proper close-between
|
|
81
|
-
* avoid the self-collision.
|
|
82
|
-
*/
|
|
83
|
-
async function isPortAvailable(port) {
|
|
84
|
-
if (!(await tryBind(port, '0.0.0.0')))
|
|
85
|
-
return false;
|
|
86
|
-
if (!(await tryBind(port, '127.0.0.1')))
|
|
87
|
-
return false;
|
|
88
|
-
return true;
|
|
89
|
-
}
|
|
90
|
-
/** Maximum number of ports to scan before giving up. */
|
|
91
|
-
const MAX_SCAN = 20;
|
|
92
|
-
/**
|
|
93
|
-
* Find the first available port starting from `startPort`.
|
|
94
|
-
* Scans up to MAX_SCAN ports. Returns `null` if no free port is found.
|
|
95
|
-
*/
|
|
96
|
-
async function findAvailablePort(startPort) {
|
|
97
|
-
for (let port = startPort; port < startPort + MAX_SCAN; port++) {
|
|
98
|
-
if (await isPortAvailable(port))
|
|
99
|
-
return port;
|
|
100
|
-
}
|
|
101
|
-
return null;
|
|
102
|
-
}
|
|
103
|
-
//# sourceMappingURL=port.js.map
|
package/dist/lib/port.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"port.js","sourceRoot":"","sources":["../../src/lib/port.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,0CAIC;AASD,8CAKC;AA/DD,8CAAgC;AAEhC;;;GAGG;AACH,SAAS,OAAO,CAAC,IAAY,EAAE,IAAY;IACzC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,MAAM,GAAG,GAAG,CAAC,YAAY,EAAE,CAAC;QAClC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,GAA0B,EAAE,EAAE;YAClD,IAAI,GAAG,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;gBAC9B,OAAO,CAAC,KAAK,CAAC,CAAC;YACjB,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,GAAG,CAAC,CAAC;YACd,CAAC;QACH,CAAC,CAAC,CAAC;QACH,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,EAAE;YAC5B,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;QACH,IAAI,CAAC;YACH,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC5B,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,CAAC,GAAG,CAAC,CAAC;QACd,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACI,KAAK,UAAU,eAAe,CAAC,IAAY;IAChD,IAAI,CAAC,CAAC,MAAM,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IACpD,IAAI,CAAC,CAAC,MAAM,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IACtD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,wDAAwD;AACxD,MAAM,QAAQ,GAAG,EAAE,CAAC;AAEpB;;;GAGG;AACI,KAAK,UAAU,iBAAiB,CAAC,SAAiB;IACvD,KAAK,IAAI,IAAI,GAAG,SAAS,EAAE,IAAI,GAAG,SAAS,GAAG,QAAQ,EAAE,IAAI,EAAE,EAAE,CAAC;QAC/D,IAAI,MAAM,eAAe,CAAC,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;IAC/C,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/lib/telemetry.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { CLI_AUTH_METHODS } from './constants';
|
|
2
|
-
export declare function getCliOs(): string;
|
|
3
|
-
export declare function sanitizeHeaderValue(value: string, fallback: string): string;
|
|
4
|
-
type CliAuthMethod = (typeof CLI_AUTH_METHODS)[keyof typeof CLI_AUTH_METHODS];
|
|
5
|
-
export declare function getAuthMethod(authHeader: Record<string, string> | undefined): CliAuthMethod | undefined;
|
|
6
|
-
export declare function getCliUserAgent(authHeader?: Record<string, string>): string;
|
|
7
|
-
export declare function buildCliHeaders(authHeader?: Record<string, string>): Record<string, string>;
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=telemetry.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"telemetry.d.ts","sourceRoot":"","sources":["../../src/lib/telemetry.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAuBlE,wBAAgB,QAAQ,IAAI,MAAM,CAEjC;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAG3E;AAMD,KAAK,aAAa,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC;AAK9E,wBAAgB,aAAa,CAC3B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,GAC7C,aAAa,GAAG,SAAS,CAI3B;AAED,wBAAgB,eAAe,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAI3E;AAED,wBAAgB,eAAe,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAE3F"}
|
package/dist/lib/telemetry.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCliOs = getCliOs;
|
|
4
|
-
exports.sanitizeHeaderValue = sanitizeHeaderValue;
|
|
5
|
-
exports.getAuthMethod = getAuthMethod;
|
|
6
|
-
exports.getCliUserAgent = getCliUserAgent;
|
|
7
|
-
exports.buildCliHeaders = buildCliHeaders;
|
|
8
|
-
const cli_version_1 = require("./cli-version");
|
|
9
|
-
const constants_1 = require("./constants");
|
|
10
|
-
/**
|
|
11
|
-
* CLI identification sent as a single `User-Agent` header on every API
|
|
12
|
-
* request so the backend can emit product-tracking events (taxonomy card
|
|
13
|
-
* "CLI installed", Kafka topic `cli`) without a dedicated telemetry endpoint.
|
|
14
|
-
*
|
|
15
|
-
* Format: `brevo-cli/<version> (<os>)`, extended with `; auth=<method>` when
|
|
16
|
-
* the request carries credentials — e.g. `brevo-cli/1.2.0 (macos; auth=oauth)`.
|
|
17
|
-
*
|
|
18
|
-
* Values are sanitized to printable ASCII: undici throws a TypeError on
|
|
19
|
-
* header values containing control characters, which would fail every
|
|
20
|
-
* request — sanitizing here removes that failure mode entirely.
|
|
21
|
-
*/
|
|
22
|
-
const OS_BY_PLATFORM = {
|
|
23
|
-
darwin: 'macos',
|
|
24
|
-
win32: 'windows',
|
|
25
|
-
linux: 'linux',
|
|
26
|
-
};
|
|
27
|
-
// The taxonomy card only allows known values to reach Amplitude, so anything
|
|
28
|
-
// outside the mapped platforms is reported as `other` rather than passed raw.
|
|
29
|
-
function getCliOs() {
|
|
30
|
-
return OS_BY_PLATFORM[process.platform] ?? 'other';
|
|
31
|
-
}
|
|
32
|
-
function sanitizeHeaderValue(value, fallback) {
|
|
33
|
-
const sanitized = value.replace(/[^\x20-\x7E]/g, '');
|
|
34
|
-
return sanitized || fallback;
|
|
35
|
-
}
|
|
36
|
-
// CLI_VERSION is fixed at module init, so sanitize it once rather than on
|
|
37
|
-
// every request. Falls back to the same default as cli-version.ts.
|
|
38
|
-
const SAFE_CLI_VERSION = sanitizeHeaderValue(cli_version_1.CLI_VERSION, '0.0.0');
|
|
39
|
-
// Derived from the auth header about to be sent rather than from stored
|
|
40
|
-
// credentials, so login-time validation calls (explicit key/bearer) report
|
|
41
|
-
// the right method without coupling telemetry to credential storage.
|
|
42
|
-
function getAuthMethod(authHeader) {
|
|
43
|
-
if (authHeader && 'api-key' in authHeader)
|
|
44
|
-
return constants_1.CLI_AUTH_METHODS.API_KEY;
|
|
45
|
-
if (authHeader && 'Authorization' in authHeader)
|
|
46
|
-
return constants_1.CLI_AUTH_METHODS.OAUTH;
|
|
47
|
-
return undefined;
|
|
48
|
-
}
|
|
49
|
-
function getCliUserAgent(authHeader) {
|
|
50
|
-
const method = getAuthMethod(authHeader);
|
|
51
|
-
const comment = method ? `${getCliOs()}; auth=${method}` : getCliOs();
|
|
52
|
-
return `brevo-cli/${SAFE_CLI_VERSION} (${comment})`;
|
|
53
|
-
}
|
|
54
|
-
function buildCliHeaders(authHeader) {
|
|
55
|
-
return { [constants_1.USER_AGENT_HEADER]: getCliUserAgent(authHeader) };
|
|
56
|
-
}
|
|
57
|
-
//# sourceMappingURL=telemetry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"telemetry.js","sourceRoot":"","sources":["../../src/lib/telemetry.ts"],"names":[],"mappings":";;AAwBA,4BAEC;AAED,kDAGC;AAWD,sCAMC;AAED,0CAIC;AAED,0CAEC;AA1DD,+CAA4C;AAC5C,2CAAkE;AAElE;;;;;;;;;;;GAWG;AAEH,MAAM,cAAc,GAA2B;IAC7C,MAAM,EAAE,OAAO;IACf,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,OAAO;CACf,CAAC;AAEF,6EAA6E;AAC7E,8EAA8E;AAC9E,SAAgB,QAAQ;IACtB,OAAO,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,OAAO,CAAC;AACrD,CAAC;AAED,SAAgB,mBAAmB,CAAC,KAAa,EAAE,QAAgB;IACjE,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;IACrD,OAAO,SAAS,IAAI,QAAQ,CAAC;AAC/B,CAAC;AAED,0EAA0E;AAC1E,mEAAmE;AACnE,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,yBAAW,EAAE,OAAO,CAAC,CAAC;AAInE,wEAAwE;AACxE,2EAA2E;AAC3E,qEAAqE;AACrE,SAAgB,aAAa,CAC3B,UAA8C;IAE9C,IAAI,UAAU,IAAI,SAAS,IAAI,UAAU;QAAE,OAAO,4BAAgB,CAAC,OAAO,CAAC;IAC3E,IAAI,UAAU,IAAI,eAAe,IAAI,UAAU;QAAE,OAAO,4BAAgB,CAAC,KAAK,CAAC;IAC/E,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAgB,eAAe,CAAC,UAAmC;IACjE,MAAM,MAAM,GAAG,aAAa,CAAC,UAAU,CAAC,CAAC;IACzC,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,QAAQ,EAAE,UAAU,MAAM,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;IACtE,OAAO,aAAa,gBAAgB,KAAK,OAAO,GAAG,CAAC;AACtD,CAAC;AAED,SAAgB,eAAe,CAAC,UAAmC;IACjE,OAAO,EAAE,CAAC,6BAAiB,CAAC,EAAE,eAAe,CAAC,UAAU,CAAC,EAAE,CAAC;AAC9D,CAAC"}
|
package/dist/lib/ui.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export interface Spinner {
|
|
2
|
-
update(text: string): void;
|
|
3
|
-
stop(finalText?: string): void;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* Stop the currently active spinner (if any).
|
|
7
|
-
* Used by the re-auth handler to clear the spinner before prompting.
|
|
8
|
-
*/
|
|
9
|
-
export declare function stopActiveSpinner(): void;
|
|
10
|
-
export declare function createSpinner(text: string, options?: {
|
|
11
|
-
silent?: boolean;
|
|
12
|
-
}): Spinner;
|
|
13
|
-
export declare function printBox(title: string, lines: string[]): void;
|
|
14
|
-
//# sourceMappingURL=ui.d.ts.map
|
package/dist/lib/ui.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../src/lib/ui.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,OAAO;IACtB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAID;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAKxC;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAyCnF;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAY7D"}
|
package/dist/lib/ui.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.stopActiveSpinner = stopActiveSpinner;
|
|
4
|
-
exports.createSpinner = createSpinner;
|
|
5
|
-
exports.printBox = printBox;
|
|
6
|
-
const SPINNER_FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
7
|
-
let activeSpinner = null;
|
|
8
|
-
/**
|
|
9
|
-
* Stop the currently active spinner (if any).
|
|
10
|
-
* Used by the re-auth handler to clear the spinner before prompting.
|
|
11
|
-
*/
|
|
12
|
-
function stopActiveSpinner() {
|
|
13
|
-
if (activeSpinner) {
|
|
14
|
-
activeSpinner.stop();
|
|
15
|
-
activeSpinner = null;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
function createSpinner(text, options) {
|
|
19
|
-
stopActiveSpinner();
|
|
20
|
-
const isTTY = process.stdout.isTTY === true;
|
|
21
|
-
if (options?.silent || !isTTY) {
|
|
22
|
-
if (!options?.silent) {
|
|
23
|
-
process.stderr.write(` ${text}\n`);
|
|
24
|
-
}
|
|
25
|
-
return {
|
|
26
|
-
update(t) {
|
|
27
|
-
if (!options?.silent)
|
|
28
|
-
process.stderr.write(` ${t}\n`);
|
|
29
|
-
},
|
|
30
|
-
stop(t) {
|
|
31
|
-
if (t && !options?.silent)
|
|
32
|
-
process.stderr.write(` ${t}\n`);
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
let frame = 0;
|
|
37
|
-
let currentText = text;
|
|
38
|
-
const interval = setInterval(() => {
|
|
39
|
-
const spinner = SPINNER_FRAMES[frame % SPINNER_FRAMES.length];
|
|
40
|
-
process.stdout.write(`\r \x1b[36m${spinner}\x1b[0m ${currentText}`);
|
|
41
|
-
frame++;
|
|
42
|
-
}, 80);
|
|
43
|
-
const spinner = {
|
|
44
|
-
update(t) {
|
|
45
|
-
currentText = t;
|
|
46
|
-
},
|
|
47
|
-
stop(finalText) {
|
|
48
|
-
clearInterval(interval);
|
|
49
|
-
process.stdout.write('\r\x1b[K');
|
|
50
|
-
if (finalText)
|
|
51
|
-
process.stdout.write(` ${finalText}\n`);
|
|
52
|
-
if (activeSpinner === spinner)
|
|
53
|
-
activeSpinner = null;
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
activeSpinner = spinner;
|
|
57
|
-
return spinner;
|
|
58
|
-
}
|
|
59
|
-
function printBox(title, lines) {
|
|
60
|
-
const maxLen = Math.max(title.length, ...lines.map((l) => stripAnsi(l).length));
|
|
61
|
-
const border = '─'.repeat(maxLen + 2);
|
|
62
|
-
process.stdout.write(`\n ┌${border}┐\n`);
|
|
63
|
-
process.stdout.write(` │ \x1b[1m${title.padEnd(maxLen)}\x1b[0m │\n`);
|
|
64
|
-
process.stdout.write(` ├${border}┤\n`);
|
|
65
|
-
for (const line of lines) {
|
|
66
|
-
const pad = maxLen - stripAnsi(line).length;
|
|
67
|
-
process.stdout.write(` │ ${line}${' '.repeat(pad)} │\n`);
|
|
68
|
-
}
|
|
69
|
-
process.stdout.write(` └${border}┘\n\n`);
|
|
70
|
-
}
|
|
71
|
-
function stripAnsi(str) {
|
|
72
|
-
// eslint-disable-next-line no-control-regex
|
|
73
|
-
return str.replace(/\x1b\[[0-9;]*m/g, '');
|
|
74
|
-
}
|
|
75
|
-
//# sourceMappingURL=ui.js.map
|
package/dist/lib/ui.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../../src/lib/ui.ts"],"names":[],"mappings":";;AAaA,8CAKC;AAED,sCAyCC;AAED,4BAYC;AA3ED,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAO1E,IAAI,aAAa,GAAmB,IAAI,CAAC;AAEzC;;;GAGG;AACH,SAAgB,iBAAiB;IAC/B,IAAI,aAAa,EAAE,CAAC;QAClB,aAAa,CAAC,IAAI,EAAE,CAAC;QACrB,aAAa,GAAG,IAAI,CAAC;IACvB,CAAC;AACH,CAAC;AAED,SAAgB,aAAa,CAAC,IAAY,EAAE,OAA8B;IACxE,iBAAiB,EAAE,CAAC;IACpB,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,KAAK,IAAI,CAAC;IAE5C,IAAI,OAAO,EAAE,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;QAC9B,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;YACrB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC;QACtC,CAAC;QACD,OAAO;YACL,MAAM,CAAC,CAAS;gBACd,IAAI,CAAC,OAAO,EAAE,MAAM;oBAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACzD,CAAC;YACD,IAAI,CAAC,CAAU;gBACb,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM;oBAAE,OAAO,CAAC,MA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C,QAAQ,MAAM,KAAK,CAAC,CAAC;IAC1C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,cAAc,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IACtE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,MAAM,KAAK,CAAC,CAAC;IACxC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,GAAG,GAAG,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;QAC5C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,MAAM,OAAO,CAAC,CAAC;AAC5C,CAAC;AAED,SAAS,SAAS,CAAC,GAAW;IAC5B,4CAA4C;IAC5C,OAAO,GAAG,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export interface PkgInfo {
|
|
2
|
-
name: string;
|
|
3
|
-
version: string;
|
|
4
|
-
}
|
|
5
|
-
export interface UpdateCheckCache {
|
|
6
|
-
latest: string;
|
|
7
|
-
lastChecked: number;
|
|
8
|
-
}
|
|
9
|
-
export interface UpdateNotifierOptions {
|
|
10
|
-
pkg: PkgInfo;
|
|
11
|
-
argv?: readonly string[];
|
|
12
|
-
env?: NodeJS.ProcessEnv;
|
|
13
|
-
isTTY?: boolean;
|
|
14
|
-
cachePath?: string;
|
|
15
|
-
fetchImpl?: typeof fetch;
|
|
16
|
-
now?: () => number;
|
|
17
|
-
ttlMs?: number;
|
|
18
|
-
fetchTimeoutMs?: number;
|
|
19
|
-
}
|
|
20
|
-
export declare function shouldShowBannerBefore(argv: readonly string[]): boolean;
|
|
21
|
-
export declare function shouldSkipCheck(opts: UpdateNotifierOptions): boolean;
|
|
22
|
-
export declare function compareVersions(current: string, latest: string): number;
|
|
23
|
-
export declare function isNewer(current: string, latest: string): boolean;
|
|
24
|
-
export declare function isMajorBehind(current: string, latest: string): boolean;
|
|
25
|
-
export declare function readCache(cachePath: string): UpdateCheckCache | undefined;
|
|
26
|
-
export declare function writeCache(cachePath: string, cache: UpdateCheckCache): void;
|
|
27
|
-
export declare function fetchLatestVersion(name: string, opts?: UpdateNotifierOptions): Promise<string | undefined>;
|
|
28
|
-
export declare function formatBanner(current: string, latest: string, name: string): string;
|
|
29
|
-
export declare function formatForceUpdateBanner(current: string, latest: string, name: string): string;
|
|
30
|
-
export interface UpdateCheckHandle {
|
|
31
|
-
cachedLatest?: string;
|
|
32
|
-
pending: Promise<void>;
|
|
33
|
-
}
|
|
34
|
-
export declare function startUpdateCheck(opts: UpdateNotifierOptions): UpdateCheckHandle;
|
|
35
|
-
export declare function notifyUpdate(handle: UpdateCheckHandle, pkg: PkgInfo, output?: NodeJS.WriteStream, waitMs?: number): Promise<void>;
|
|
36
|
-
export declare function enforceMinVersion(handle: UpdateCheckHandle, pkg: PkgInfo, output?: NodeJS.WriteStream, waitMs?: number): Promise<boolean>;
|
|
37
|
-
//# sourceMappingURL=update-notifier.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-notifier.d.ts","sourceRoot":"","sources":["../../src/lib/update-notifier.ts"],"names":[],"mappings":"AAcA,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,OAAO,CAAC;IACb,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC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