@cleanslop/cli 0.1.0-beta.39 → 0.1.0-beta.40
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/config.d.ts +2 -2
- package/dist/config.js +1 -1
- package/dist/token-rotation.js +7 -3
- package/dist/token-rotation.js.map +1 -1
- package/package.json +1 -1
package/dist/config.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export declare const PACKAGE_NAME = "@cleanslop/cli";
|
|
2
|
-
export declare const PACKAGE_VERSION = "0.1.0-beta.
|
|
2
|
+
export declare const PACKAGE_VERSION = "0.1.0-beta.40";
|
|
3
3
|
export declare const CLIENT_ID = "cleanslop-cli";
|
|
4
4
|
export declare const DEFAULT_ORIGIN = "https://cleanslop.com";
|
|
5
5
|
export declare const DEFAULT_WAIT_MS: number;
|
|
6
6
|
export declare const MIN_POLL_MS = 3000;
|
|
7
7
|
export declare const LONGPOLL_MAX_SEC = 45;
|
|
8
8
|
export declare const DEVICE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code";
|
|
9
|
-
export declare const USER_AGENT = "cleanslop-cli/0.1.0-beta.
|
|
9
|
+
export declare const USER_AGENT = "cleanslop-cli/0.1.0-beta.40";
|
|
10
10
|
export declare const CREDENTIALS_FILE = "credentials.json";
|
|
11
11
|
export declare const PENDING_LOGIN_FILE = "pending-login.json";
|
|
12
12
|
export declare const PENDING_SPEND_FILE = "pending-spend-request.json";
|
package/dist/config.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const PACKAGE_NAME = "@cleanslop/cli";
|
|
2
|
-
export const PACKAGE_VERSION = "0.1.0-beta.
|
|
2
|
+
export const PACKAGE_VERSION = "0.1.0-beta.40";
|
|
3
3
|
export const CLIENT_ID = "cleanslop-cli";
|
|
4
4
|
export const DEFAULT_ORIGIN = "https://cleanslop.com";
|
|
5
5
|
export const DEFAULT_WAIT_MS = 8 * 60 * 1000;
|
package/dist/token-rotation.js
CHANGED
|
@@ -8,8 +8,8 @@ import { httpRequest } from "./http.js";
|
|
|
8
8
|
export async function storeLoginToken(deps, origin, creds) {
|
|
9
9
|
const prior = peekStoredCreds(deps, origin);
|
|
10
10
|
await storeToken(deps, origin, creds);
|
|
11
|
+
let revoked = false;
|
|
11
12
|
if (prior?.token && prior.token !== creds.token) {
|
|
12
|
-
let revoked = false;
|
|
13
13
|
try {
|
|
14
14
|
const res = await httpRequest(deps, origin, "POST", "/oauth/revoke", {
|
|
15
15
|
token: prior.token,
|
|
@@ -18,13 +18,17 @@ export async function storeLoginToken(deps, origin, creds) {
|
|
|
18
18
|
revoked = res.status >= 200 && res.status < 300;
|
|
19
19
|
}
|
|
20
20
|
catch {
|
|
21
|
-
|
|
21
|
+
// Transport failure: reported below.
|
|
22
22
|
}
|
|
23
23
|
if (!revoked) {
|
|
24
24
|
deps.io.stderr("Could not revoke the previous CleanSlop token; it still works. Revoke it from the security email sent when it was created, or under Account → Connected agents.\n");
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
const envToken = deps.env.get("CLEANSLOP_TOKEN")?.trim();
|
|
28
|
+
if (envToken && revoked && envToken === prior?.token) {
|
|
29
|
+
deps.io.stderr("CLEANSLOP_TOKEN holds the token this login just revoked, so commands will fail until you unset it (or set it to the new token).\n");
|
|
30
|
+
}
|
|
31
|
+
else if (envToken) {
|
|
28
32
|
deps.io.stderr("CLEANSLOP_TOKEN is set, so commands keep using that token instead of this login. Unset it to use the new one.\n");
|
|
29
33
|
}
|
|
30
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token-rotation.js","sourceRoot":"","sources":["../src/token-rotation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE/D,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,eAA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