@topolo/cli 0.12.22 → 0.12.23
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/README.md +5 -0
- package/dist/index.js +34 -34
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -49,6 +49,11 @@ is decided by their permissions. `--client-id doac_...` (or
|
|
|
49
49
|
`TOPOLO_CLI_CLIENT_ID` / `TOPOLO_<ENV>_CLI_CLIENT_ID`) is only for advanced /
|
|
50
50
|
self-hosted setups. Headless installs use `--api-key`.
|
|
51
51
|
|
|
52
|
+
While approval is pending, the CLI retains the same device request across temporary
|
|
53
|
+
transport failures and doubles the polling interval after each failure. It honors
|
|
54
|
+
the server polling interval and `slow_down` responses, stops on denial or other
|
|
55
|
+
OAuth errors, and never extends the original device-code expiry.
|
|
56
|
+
|
|
52
57
|
### Contexts
|
|
53
58
|
|
|
54
59
|
A user can act in their personal space or any organization they belong to. Each
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { platform as platform2 } from "os";
|
|
|
9
9
|
import { createInterface } from "readline/promises";
|
|
10
10
|
import { stdin as input } from "process";
|
|
11
11
|
|
|
12
|
-
// node_modules/@topolo/sdk/dist/index.js
|
|
12
|
+
// node_modules/.pnpm/@topolo+sdk@0.23.10/node_modules/@topolo/sdk/dist/index.js
|
|
13
13
|
function record(value) {
|
|
14
14
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
15
15
|
}
|
|
@@ -3571,7 +3571,39 @@ function createTopolo(options) {
|
|
|
3571
3571
|
};
|
|
3572
3572
|
}
|
|
3573
3573
|
|
|
3574
|
-
//
|
|
3574
|
+
// src/commands/device-login-poll.ts
|
|
3575
|
+
async function pollUntilApproved(params) {
|
|
3576
|
+
let interval = Math.max(params.intervalSeconds ?? 5, 1);
|
|
3577
|
+
while (Date.now() < params.expiresAtMs) {
|
|
3578
|
+
await new Promise((resolve3) => setTimeout(resolve3, Math.min(interval * 1e3, params.expiresAtMs - Date.now())));
|
|
3579
|
+
if (Date.now() >= params.expiresAtMs) break;
|
|
3580
|
+
try {
|
|
3581
|
+
return await params.oauth.pollDeviceToken({
|
|
3582
|
+
clientId: params.clientId,
|
|
3583
|
+
deviceCode: params.deviceCode
|
|
3584
|
+
});
|
|
3585
|
+
} catch (err) {
|
|
3586
|
+
if (err instanceof TopoloAuthError) {
|
|
3587
|
+
if (err.code === "authorization_pending") continue;
|
|
3588
|
+
if (err.code === "slow_down") {
|
|
3589
|
+
interval += 5;
|
|
3590
|
+
continue;
|
|
3591
|
+
}
|
|
3592
|
+
if (err.code === "access_denied") throw new Error("Authorization was denied.");
|
|
3593
|
+
if (err.code === "expired_token") throw new Error("Device code expired. Run `topolo auth login` again.");
|
|
3594
|
+
throw err;
|
|
3595
|
+
}
|
|
3596
|
+
if (err instanceof TopoloSdkError && err.code === "network_error" || err instanceof TypeError && err.message === "fetch failed") {
|
|
3597
|
+
interval *= 2;
|
|
3598
|
+
continue;
|
|
3599
|
+
}
|
|
3600
|
+
throw err;
|
|
3601
|
+
}
|
|
3602
|
+
}
|
|
3603
|
+
throw new Error("Device code expired. Run `topolo auth login` again.");
|
|
3604
|
+
}
|
|
3605
|
+
|
|
3606
|
+
// node_modules/.pnpm/@topolo+sdk@0.23.10/node_modules/@topolo/sdk/dist/node/credential-store.js
|
|
3575
3607
|
import { mkdir as mkdir2, readFile as readFile2, writeFile as writeFile2, chmod as chmod2, rm as rm2, stat } from "fs/promises";
|
|
3576
3608
|
import { existsSync as existsSync2 } from "fs";
|
|
3577
3609
|
import { homedir as homedir2, platform } from "os";
|
|
@@ -4973,38 +5005,6 @@ function startSpinner() {
|
|
|
4973
5005
|
}
|
|
4974
5006
|
};
|
|
4975
5007
|
}
|
|
4976
|
-
async function pollUntilApproved(params) {
|
|
4977
|
-
let interval = Math.max(params.intervalSeconds, 1);
|
|
4978
|
-
while (Date.now() < params.expiresAtMs) {
|
|
4979
|
-
await sleep(interval * 1e3);
|
|
4980
|
-
try {
|
|
4981
|
-
const token = await params.oauth.pollDeviceToken({
|
|
4982
|
-
clientId: params.clientId,
|
|
4983
|
-
deviceCode: params.deviceCode
|
|
4984
|
-
});
|
|
4985
|
-
return token;
|
|
4986
|
-
} catch (err) {
|
|
4987
|
-
if (err instanceof TopoloAuthError) {
|
|
4988
|
-
if (err.code === "authorization_pending") continue;
|
|
4989
|
-
if (err.code === "slow_down") {
|
|
4990
|
-
interval += 2;
|
|
4991
|
-
continue;
|
|
4992
|
-
}
|
|
4993
|
-
if (err.code === "access_denied") {
|
|
4994
|
-
throw new Error("Authorization was denied.");
|
|
4995
|
-
}
|
|
4996
|
-
if (err.code === "expired_token") {
|
|
4997
|
-
throw new Error("Device code expired. Run `topolo auth login` again.");
|
|
4998
|
-
}
|
|
4999
|
-
}
|
|
5000
|
-
throw err;
|
|
5001
|
-
}
|
|
5002
|
-
}
|
|
5003
|
-
throw new Error("Device code expired. Run `topolo auth login` again.");
|
|
5004
|
-
}
|
|
5005
|
-
function sleep(ms) {
|
|
5006
|
-
return new Promise((resolve3) => setTimeout(resolve3, ms));
|
|
5007
|
-
}
|
|
5008
5008
|
|
|
5009
5009
|
// src/client.ts
|
|
5010
5010
|
async function buildClient(options) {
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topolo/cli",
|
|
3
3
|
"packageManager": "pnpm@10.17.1",
|
|
4
|
-
"version": "0.12.
|
|
5
|
-
"topoloPublishedVersion": "0.12.
|
|
4
|
+
"version": "0.12.23",
|
|
5
|
+
"topoloPublishedVersion": "0.12.23",
|
|
6
6
|
"description": "Public command-line interface for Topolo customer organizations, developers, and agents.",
|
|
7
7
|
"license": "UNLICENSED",
|
|
8
8
|
"author": "Topolo",
|