@north-light/sdk 0.3.458 → 0.3.460
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/crtr.d.ts +4 -1
- package/dist/crtr.js +1 -1
- package/dist/keygen-command.js +13 -3
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
package/dist/crtr.d.ts
CHANGED
|
@@ -12,9 +12,12 @@ export type CrtrOutcome = {
|
|
|
12
12
|
| {
|
|
13
13
|
kind: 'not_joined';
|
|
14
14
|
joinStep: string;
|
|
15
|
-
}
|
|
15
|
+
}
|
|
16
|
+
/** `unsettled`: crtr may have acted before it failed (it timed out), so the caller cannot assume nothing changed. */
|
|
17
|
+
| {
|
|
16
18
|
kind: 'failed';
|
|
17
19
|
message: string;
|
|
20
|
+
unsettled?: true;
|
|
18
21
|
};
|
|
19
22
|
export declare const parseJson: (text: string) => unknown;
|
|
20
23
|
/** Runs `crtr <argv>` once: execFile, no shell, the caller's environment. */
|
package/dist/crtr.js
CHANGED
|
@@ -32,7 +32,7 @@ export function runCrtr(argv, timeoutMs) {
|
|
|
32
32
|
if (!err)
|
|
33
33
|
return resolve({ kind: 'ok', stdout });
|
|
34
34
|
if (err.killed)
|
|
35
|
-
return resolve({ kind: 'failed', message: `crtr did not answer within ${seconds(timeoutMs)}
|
|
35
|
+
return resolve({ kind: 'failed', message: `crtr did not answer within ${seconds(timeoutMs)}.`, unsettled: true });
|
|
36
36
|
const bodies = [errorBody(stdout), errorBody(stderr)];
|
|
37
37
|
const notJoined = bodies.find((body) => (text(body?.error) ?? text(body?.code)) === 'not_joined');
|
|
38
38
|
if (notJoined)
|
package/dist/keygen-command.js
CHANGED
|
@@ -64,10 +64,13 @@ async function addKey(app, publicJwk, timeoutMs) {
|
|
|
64
64
|
const answer = parseJson(outcome.stdout);
|
|
65
65
|
if (typeof answer?.kid !== 'string') {
|
|
66
66
|
const last = outcome.stdout.split('\n').map((line) => line.trim()).filter(Boolean).at(-1);
|
|
67
|
-
return { kind: 'failed', message: `crtr answered without the added key: ${last ?? '(no output)'}
|
|
67
|
+
return { kind: 'failed', message: `crtr answered without the added key: ${last ?? '(no output)'}`, unsettled: true };
|
|
68
68
|
}
|
|
69
69
|
return { kind: 'added', kid: answer.kid, created: answer.created !== false };
|
|
70
70
|
}
|
|
71
|
+
/** Removes a key file keygen wrote for a key that no app holds, so a rerun is not refused over it. */
|
|
72
|
+
const discardKey = (path) => unlink(path).catch(() => undefined);
|
|
73
|
+
const discarded = (path) => `Removed ${path}, and the public key printed above is not on any app, so don't add it. Fix the above and run keygen again.`;
|
|
71
74
|
/** The `crouter-sdk keygen` command. Returns the process exit code. */
|
|
72
75
|
export async function runKeygen(argv, options = {}) {
|
|
73
76
|
const { path, app, yes } = parseArgs(argv);
|
|
@@ -114,11 +117,18 @@ export async function runKeygen(argv, options = {}) {
|
|
|
114
117
|
return 0;
|
|
115
118
|
}
|
|
116
119
|
if (outcome.kind === 'not_joined') {
|
|
117
|
-
|
|
120
|
+
await discardKey(path);
|
|
121
|
+
say([...notJoinedLines('the key was not added', outcome.joinStep), discarded(path)]);
|
|
118
122
|
return 2;
|
|
119
123
|
}
|
|
120
124
|
if (outcome.kind === 'failed') {
|
|
121
|
-
|
|
125
|
+
// A timeout may have landed the key, so keep the file; any other refusal means no app holds this key.
|
|
126
|
+
if (outcome.unsettled) {
|
|
127
|
+
say([`Couldn't add the key: ${outcome.message}`, ...manualSteps(path)]);
|
|
128
|
+
return 2;
|
|
129
|
+
}
|
|
130
|
+
await discardKey(path);
|
|
131
|
+
say([`Couldn't add the key: ${outcome.message}`, discarded(path)]);
|
|
122
132
|
return 2;
|
|
123
133
|
}
|
|
124
134
|
say([
|
package/dist/version.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** This SDK's release version. Informational only: compatibility is the contract level, not this number. */
|
|
2
|
-
export declare const SDK_VERSION = "0.3.
|
|
2
|
+
export declare const SDK_VERSION = "0.3.460";
|
|
3
3
|
/** The release sent in `Crouter-Minimum-Runtime-Version` on every request. It is frozen, so a runtime from before the
|
|
4
4
|
* contract level existed (which only knows this header) refuses this SDK, while every later runtime accepts it. */
|
|
5
5
|
export declare const LEGACY_FLOOR = "0.3.423";
|
package/dist/version.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// SDK_VERSION is written by scripts/release-version.mjs on every release; do not edit by hand.
|
|
2
2
|
/** This SDK's release version. Informational only: compatibility is the contract level, not this number. */
|
|
3
|
-
export const SDK_VERSION = '0.3.
|
|
3
|
+
export const SDK_VERSION = '0.3.460';
|
|
4
4
|
// LEGACY_FLOOR is written once by `scripts/contract.mjs release`, at the first release that carries the contract level
|
|
5
5
|
// (the `0.0.0` placeholder is replaced there and never again); do not edit by hand.
|
|
6
6
|
/** The release sent in `Crouter-Minimum-Runtime-Version` on every request. It is frozen, so a runtime from before the
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/sdk",
|
|
3
|
-
"version": "0.3.
|
|
4
|
-
"crouterContract": "1.
|
|
3
|
+
"version": "0.3.460",
|
|
4
|
+
"crouterContract": "1.5",
|
|
5
5
|
"description": "Typed Node and browser client for running crouter agents through the crtrd /v1 API.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"prepublishOnly": "node -e \"if (process.env.npm_config_tag !== 'next') { console.error('@north-light/sdk publishes only with --tag next; scripts/promote-sdk.mjs is the only mover of latest.'); process.exit(1); }\""
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@north-light/api": "0.3.
|
|
45
|
-
"@north-light/identity": "0.3.
|
|
44
|
+
"@north-light/api": "0.3.460",
|
|
45
|
+
"@north-light/identity": "0.3.460",
|
|
46
46
|
"jose": "^6.2.1"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|