@axorum/client 0.0.0-stage → 1.0.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/LICENSE +202 -0
- package/README.md +530 -2
- package/dist/agent-uri.d.ts +30 -0
- package/dist/agent-uri.d.ts.map +1 -0
- package/dist/agent-uri.js +218 -0
- package/dist/agent-uri.js.map +1 -0
- package/dist/authorize.d.ts +671 -0
- package/dist/authorize.d.ts.map +1 -0
- package/dist/authorize.js +947 -0
- package/dist/authorize.js.map +1 -0
- package/dist/capabilities.d.ts +30 -0
- package/dist/capabilities.d.ts.map +1 -0
- package/dist/capabilities.js +40 -0
- package/dist/capabilities.js.map +1 -0
- package/dist/chart.d.ts +74 -0
- package/dist/chart.d.ts.map +1 -0
- package/dist/chart.js +107 -0
- package/dist/chart.js.map +1 -0
- package/dist/client.d.ts +644 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +1302 -0
- package/dist/client.js.map +1 -0
- package/dist/errors.d.ts +646 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +928 -0
- package/dist/errors.js.map +1 -0
- package/dist/failover.d.ts +197 -0
- package/dist/failover.d.ts.map +1 -0
- package/dist/failover.js +289 -0
- package/dist/failover.js.map +1 -0
- package/dist/freshness.d.ts +65 -0
- package/dist/freshness.d.ts.map +1 -0
- package/dist/freshness.js +148 -0
- package/dist/freshness.js.map +1 -0
- package/dist/generated/agent-plane.d.ts +1863 -0
- package/dist/generated/agent-plane.d.ts.map +1 -0
- package/dist/generated/agent-plane.js +19 -0
- package/dist/generated/agent-plane.js.map +1 -0
- package/dist/idempotency.d.ts +160 -0
- package/dist/idempotency.d.ts.map +1 -0
- package/dist/idempotency.js +208 -0
- package/dist/idempotency.js.map +1 -0
- package/dist/index.d.ts +89 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +87 -0
- package/dist/index.js.map +1 -0
- package/dist/intent.d.ts +163 -0
- package/dist/intent.d.ts.map +1 -0
- package/dist/intent.js +82 -0
- package/dist/intent.js.map +1 -0
- package/dist/json.d.ts +49 -0
- package/dist/json.d.ts.map +1 -0
- package/dist/json.js +259 -0
- package/dist/json.js.map +1 -0
- package/dist/key.d.ts +64 -0
- package/dist/key.d.ts.map +1 -0
- package/dist/key.js +71 -0
- package/dist/key.js.map +1 -0
- package/dist/payment.d.ts +172 -0
- package/dist/payment.d.ts.map +1 -0
- package/dist/payment.js +178 -0
- package/dist/payment.js.map +1 -0
- package/dist/refusal.d.ts +121 -0
- package/dist/refusal.d.ts.map +1 -0
- package/dist/refusal.js +176 -0
- package/dist/refusal.js.map +1 -0
- package/dist/retry.d.ts +215 -0
- package/dist/retry.d.ts.map +1 -0
- package/dist/retry.js +297 -0
- package/dist/retry.js.map +1 -0
- package/dist/typeid.d.ts +64 -0
- package/dist/typeid.d.ts.map +1 -0
- package/dist/typeid.js +119 -0
- package/dist/typeid.js.map +1 -0
- package/dist/types.d.ts +245 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +14 -0
- package/dist/types.js.map +1 -0
- package/package.json +58 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAEH,OAAO,EAAwB,eAAe,EAAE,MAAM,eAAe,CAAC;AAGtE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,wBAAwB;IACxB,oBAAoB;IACpB,kBAAkB;IAClB,0FAA0F;IAC1F,2EAA2E;IAC3E,2FAA2F;IAC3F,sDAAsD;IACtD,cAAc;IACd,eAAe;IACf,aAAa;IACb,0FAA0F;IAC1F,gEAAgE;IAChE,WAAW;IACX,qBAAqB;IACrB,iBAAiB;IACjB,eAAe;IACf,cAAc;IACd,qBAAqB;IACrB,kBAAkB;IAClB,aAAa;IACb,mBA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CAAC,SAAS,CAAC,KAAK,QAAQ,CAAC;AAC5F,CAAC"}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Failing over between the service's API URLs: a mirror of `acton-service-client`
|
|
3
|
+
* 0.2.1's endpoint failover, which the Rust SDK uses, so both SDKs fail over alike.
|
|
4
|
+
*
|
|
5
|
+
* A clustered deployment serves the agent plane on every replica, and only the primary
|
|
6
|
+
* accepts a write: a follower answers `421 not_primary`. Given every replica's API URL
|
|
7
|
+
* ({@link AxorumClientOptions.failoverUrls}), a request that retries apply to moves on to
|
|
8
|
+
* the next URL, at once, when an attempt ends in a **rotation outcome**: a status the
|
|
9
|
+
* request lists (`authorize` lists `421`),
|
|
10
|
+
* a connection that never opened, or an attempt timeout. A status that is retriable by
|
|
11
|
+
* default (`429`, `502`, `503`, `504`, and `423` with `Retry-After`) is retried on the
|
|
12
|
+
* **same** URL after the policy's pause, and anything else ends the call. After a full
|
|
13
|
+
* cycle of rotations the client pauses before the next cycle. One deadline covers every
|
|
14
|
+
* attempt on every URL, and the client never sends to an origin outside the set.
|
|
15
|
+
*
|
|
16
|
+
* Every decision here is a pure function of the attempt history, the time remaining and
|
|
17
|
+
* the jitter draw: `acton-service-client`'s `spec/fixtures/endpoint-failover-v1.json`
|
|
18
|
+
* pins it for every port.
|
|
19
|
+
*
|
|
20
|
+
* @packageDocumentation
|
|
21
|
+
*/
|
|
22
|
+
import { type RetryPolicy } from "./retry.js";
|
|
23
|
+
/**
|
|
24
|
+
* Why an attempt moved on (or would have): the same shape as the fixture's
|
|
25
|
+
* `{"kind":"status","status":N} | {"kind":"connect"} | {"kind":"timeout"}`.
|
|
26
|
+
*/
|
|
27
|
+
export type RotationReason =
|
|
28
|
+
/** The endpoint answered with this status. */
|
|
29
|
+
{
|
|
30
|
+
readonly kind: "status";
|
|
31
|
+
readonly status: number;
|
|
32
|
+
}
|
|
33
|
+
/** The connection was never established, so no byte of the request left the process. */
|
|
34
|
+
| {
|
|
35
|
+
readonly kind: "connect";
|
|
36
|
+
}
|
|
37
|
+
/** The attempt ran out of time before an answer arrived. It may have been applied. */
|
|
38
|
+
| {
|
|
39
|
+
readonly kind: "timeout";
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* The counter the Rust SDK adds one to for every rotation, labelled `reason`
|
|
43
|
+
* ({@link rotationLabel}). The TypeScript SDK takes no metrics dependency: count
|
|
44
|
+
* {@link AxorumClientOptions.onRotation} under this name to put both SDKs on one
|
|
45
|
+
* dashboard.
|
|
46
|
+
*/
|
|
47
|
+
export declare const ROTATIONS_COUNTER = "acton_service_client.endpoint.rotations";
|
|
48
|
+
/**
|
|
49
|
+
* The counter the Rust SDK adds one to for every re-send to the same endpoint, labelled
|
|
50
|
+
* `reason` like {@link ROTATIONS_COUNTER}. Count {@link AxorumClientOptions.onRetry}
|
|
51
|
+
* under it. A client with one URL only ever re-sends in place, so a deployment answering
|
|
52
|
+
* `421` to it shows up here.
|
|
53
|
+
*/
|
|
54
|
+
export declare const RETRIES_COUNTER = "acton_service_client.endpoint.retries";
|
|
55
|
+
/**
|
|
56
|
+
* A short, stable label for a reason: the status code (`"421"`), `"connect"` or
|
|
57
|
+
* `"timeout"`. The same label the Rust SDK's rotation counter carries. Pure.
|
|
58
|
+
*/
|
|
59
|
+
export declare function rotationLabel(reason: RotationReason): string;
|
|
60
|
+
/**
|
|
61
|
+
* One attempt of a request, in the order sent. A status carries the status only: the
|
|
62
|
+
* transport re-sends on the status alone and keeps no body, so a re-sent status never
|
|
63
|
+
* shows the code that would prove the attempt wrote nothing.
|
|
64
|
+
*/
|
|
65
|
+
export interface EndpointAttempt {
|
|
66
|
+
/** The origin the attempt was sent to, `scheme://host:port`. */
|
|
67
|
+
readonly endpoint: string;
|
|
68
|
+
/** How it ended. */
|
|
69
|
+
readonly outcome: RotationReason;
|
|
70
|
+
/**
|
|
71
|
+
* Whether the next attempt went to the next endpoint because of this outcome (`false`
|
|
72
|
+
* for a re-send to the same endpoint, and for the last attempt).
|
|
73
|
+
*/
|
|
74
|
+
readonly rotated: boolean;
|
|
75
|
+
}
|
|
76
|
+
/** One attempt as prose: `origin: status 421`. Pure. */
|
|
77
|
+
export declare function describeAttempt(attempt: EndpointAttempt): string;
|
|
78
|
+
/**
|
|
79
|
+
* Why a failover set was refused, by the fixture's `error` shape. The base URL is
|
|
80
|
+
* endpoint 0; failover URLs are numbered from 1.
|
|
81
|
+
*/
|
|
82
|
+
export type EndpointSetRefusal = {
|
|
83
|
+
readonly kind: "not_an_origin";
|
|
84
|
+
readonly index: number;
|
|
85
|
+
readonly url: string;
|
|
86
|
+
readonly reason: string;
|
|
87
|
+
} | {
|
|
88
|
+
readonly kind: "mixed_scheme";
|
|
89
|
+
readonly index: number;
|
|
90
|
+
readonly expected: string;
|
|
91
|
+
readonly found: string;
|
|
92
|
+
} | {
|
|
93
|
+
readonly kind: "duplicate_origin";
|
|
94
|
+
readonly origin: string;
|
|
95
|
+
readonly first: number;
|
|
96
|
+
readonly duplicate: number;
|
|
97
|
+
};
|
|
98
|
+
/** A refusal as prose. Pure. */
|
|
99
|
+
export declare function describeRefusal(refusal: EndpointSetRefusal): string;
|
|
100
|
+
/**
|
|
101
|
+
* The endpoint set: the base URL's origin, then each failover URL's, normalized to
|
|
102
|
+
* `scheme://host:port`, or why it is refused. Each failover URL is checked in order: a
|
|
103
|
+
* bare http(s) origin, then the base URL's scheme, then a new origin. Pure.
|
|
104
|
+
*/
|
|
105
|
+
export declare function endpointSet(baseUrl: string, failovers: readonly string[]): {
|
|
106
|
+
readonly endpoints: readonly string[];
|
|
107
|
+
} | {
|
|
108
|
+
readonly refusal: EndpointSetRefusal;
|
|
109
|
+
};
|
|
110
|
+
/** `url` with its origin replaced by `origin` (`scheme://host:port`). Pure. */
|
|
111
|
+
export declare function onEndpoint(url: string, origin: string): string;
|
|
112
|
+
/**
|
|
113
|
+
* How one attempt that did not succeed bears on the next: another try on the next
|
|
114
|
+
* endpoint (`rotate`), another on the same one (`retry`), or none (`final`).
|
|
115
|
+
*/
|
|
116
|
+
export type AttemptOutcome = {
|
|
117
|
+
readonly kind: "rotate";
|
|
118
|
+
readonly reason: RotationReason;
|
|
119
|
+
readonly retryAfterMs: number | undefined;
|
|
120
|
+
} | {
|
|
121
|
+
readonly kind: "retry";
|
|
122
|
+
readonly status: number;
|
|
123
|
+
readonly retryAfterMs: number | undefined;
|
|
124
|
+
} | {
|
|
125
|
+
readonly kind: "final";
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* Classifies a non-success response. A status in `retryOn` rotates (checked before
|
|
129
|
+
* `accepted`); otherwise an unaccepted status that is retriable by default retries in
|
|
130
|
+
* place. Pure.
|
|
131
|
+
*/
|
|
132
|
+
export declare function outcomeOfStatus(status: number, retryAfterMs: number | undefined, accepted: boolean, retryOn: readonly number[]): AttemptOutcome;
|
|
133
|
+
/**
|
|
134
|
+
* Classifies a transport failure: a connection that never opened, then an attempt
|
|
135
|
+
* timeout, rotate; anything else (a connection broken after the request went out) is
|
|
136
|
+
* final. Pure.
|
|
137
|
+
*/
|
|
138
|
+
export declare function outcomeOfTransport(connect: boolean, timeout: boolean): AttemptOutcome;
|
|
139
|
+
/**
|
|
140
|
+
* Why a call stopped without a success: the deadline passed before the first attempt
|
|
141
|
+
* (`nothing_sent`), the last outcome is returned as it is (`raw`), or the budget ran out
|
|
142
|
+
* after at least one rotation and the trace is returned (`exhausted`).
|
|
143
|
+
*/
|
|
144
|
+
export type Stop = "nothing_sent" | "raw" | "exhausted";
|
|
145
|
+
/**
|
|
146
|
+
* How an attempt re-sends the previous one, as the observer hears of it: to the next
|
|
147
|
+
* endpoint, leaving `from`, or to the same endpoint again.
|
|
148
|
+
*/
|
|
149
|
+
export type Resend = {
|
|
150
|
+
readonly kind: "rotation";
|
|
151
|
+
readonly from: number;
|
|
152
|
+
readonly reason: RotationReason;
|
|
153
|
+
} | {
|
|
154
|
+
readonly kind: "retry";
|
|
155
|
+
readonly reason: RotationReason;
|
|
156
|
+
};
|
|
157
|
+
/** The next attempt to send: its endpoint, its number in the call (from 1), and how it re-sends. */
|
|
158
|
+
export interface Attempt {
|
|
159
|
+
readonly endpoint: number;
|
|
160
|
+
readonly number: number;
|
|
161
|
+
readonly resend: Resend | undefined;
|
|
162
|
+
}
|
|
163
|
+
/** When the next attempt goes out: at once (a rotation within a cycle), or after a pause. */
|
|
164
|
+
export type Next = {
|
|
165
|
+
readonly kind: "now";
|
|
166
|
+
} | {
|
|
167
|
+
readonly kind: "after";
|
|
168
|
+
readonly pauseMs: number;
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* The failover state of one call: which endpoint is next, and the counts every decision
|
|
172
|
+
* depends on. Deterministic: time and randomness are passed in.
|
|
173
|
+
*
|
|
174
|
+
* With one endpoint every decision is exactly the single-endpoint retry loop's.
|
|
175
|
+
*/
|
|
176
|
+
export declare class Failover {
|
|
177
|
+
#private;
|
|
178
|
+
/** A call over `len` endpoints (at least one) starting at `start`. */
|
|
179
|
+
constructor(len: number, start: number);
|
|
180
|
+
/** Attempts sent so far. */
|
|
181
|
+
get attempts(): number;
|
|
182
|
+
/** Before each send, with the time `remainingMs` before the deadline: the attempt, or why to stop. */
|
|
183
|
+
begin(remainingMs: number | undefined): Attempt | {
|
|
184
|
+
readonly stop: Stop;
|
|
185
|
+
};
|
|
186
|
+
/**
|
|
187
|
+
* After an attempt that did not succeed: when to send the next one, or why to stop.
|
|
188
|
+
* `policy` is `undefined` when retries do not apply to the request. `draw` is called
|
|
189
|
+
* only when a computed pause needs it.
|
|
190
|
+
*/
|
|
191
|
+
after(outcome: AttemptOutcome, policy: RetryPolicy | undefined, draw: () => number, remainingMs: number | undefined): Next | {
|
|
192
|
+
readonly stop: Stop;
|
|
193
|
+
};
|
|
194
|
+
/** The trace so far, naming endpoints by `origins`. */
|
|
195
|
+
trace(origins: readonly string[]): EndpointAttempt[];
|
|
196
|
+
}
|
|
197
|
+
//# sourceMappingURL=failover.d.ts.map
|
|
@@ -0,0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AAI,CAAA;KAAE;IAczE;;;;OAIG;IACH,KAAK,CACH,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,IAAI,EAAE,MAAM,MAAM,EAClB,WAAW,EAAE,MAAM,GAAG,SAAS,GAC9B,IAAI,GAAG;QAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;KAAE;IA0BjC,uDAAuD;IACvD,KAAK,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,eAAe,EAAE;CA6DrD"}
|
package/dist/failover.js
ADDED
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Failing over between the service's API URLs: a mirror of `acton-service-client`
|
|
3
|
+
* 0.2.1's endpoint failover, which the Rust SDK uses, so both SDKs fail over alike.
|
|
4
|
+
*
|
|
5
|
+
* A clustered deployment serves the agent plane on every replica, and only the primary
|
|
6
|
+
* accepts a write: a follower answers `421 not_primary`. Given every replica's API URL
|
|
7
|
+
* ({@link AxorumClientOptions.failoverUrls}), a request that retries apply to moves on to
|
|
8
|
+
* the next URL, at once, when an attempt ends in a **rotation outcome**: a status the
|
|
9
|
+
* request lists (`authorize` lists `421`),
|
|
10
|
+
* a connection that never opened, or an attempt timeout. A status that is retriable by
|
|
11
|
+
* default (`429`, `502`, `503`, `504`, and `423` with `Retry-After`) is retried on the
|
|
12
|
+
* **same** URL after the policy's pause, and anything else ends the call. After a full
|
|
13
|
+
* cycle of rotations the client pauses before the next cycle. One deadline covers every
|
|
14
|
+
* attempt on every URL, and the client never sends to an origin outside the set.
|
|
15
|
+
*
|
|
16
|
+
* Every decision here is a pure function of the attempt history, the time remaining and
|
|
17
|
+
* the jitter draw: `acton-service-client`'s `spec/fixtures/endpoint-failover-v1.json`
|
|
18
|
+
* pins it for every port.
|
|
19
|
+
*
|
|
20
|
+
* @packageDocumentation
|
|
21
|
+
*/
|
|
22
|
+
import { fitsBefore, isRetriableStatus, pause, shouldRetry } from "./retry.js";
|
|
23
|
+
/**
|
|
24
|
+
* The counter the Rust SDK adds one to for every rotation, labelled `reason`
|
|
25
|
+
* ({@link rotationLabel}). The TypeScript SDK takes no metrics dependency: count
|
|
26
|
+
* {@link AxorumClientOptions.onRotation} under this name to put both SDKs on one
|
|
27
|
+
* dashboard.
|
|
28
|
+
*/
|
|
29
|
+
export const ROTATIONS_COUNTER = "acton_service_client.endpoint.rotations";
|
|
30
|
+
/**
|
|
31
|
+
* The counter the Rust SDK adds one to for every re-send to the same endpoint, labelled
|
|
32
|
+
* `reason` like {@link ROTATIONS_COUNTER}. Count {@link AxorumClientOptions.onRetry}
|
|
33
|
+
* under it. A client with one URL only ever re-sends in place, so a deployment answering
|
|
34
|
+
* `421` to it shows up here.
|
|
35
|
+
*/
|
|
36
|
+
export const RETRIES_COUNTER = "acton_service_client.endpoint.retries";
|
|
37
|
+
/**
|
|
38
|
+
* A short, stable label for a reason: the status code (`"421"`), `"connect"` or
|
|
39
|
+
* `"timeout"`. The same label the Rust SDK's rotation counter carries. Pure.
|
|
40
|
+
*/
|
|
41
|
+
export function rotationLabel(reason) {
|
|
42
|
+
return reason.kind === "status" ? String(reason.status) : reason.kind;
|
|
43
|
+
}
|
|
44
|
+
/** One attempt as prose: `origin: status 421`. Pure. */
|
|
45
|
+
export function describeAttempt(attempt) {
|
|
46
|
+
const { outcome } = attempt;
|
|
47
|
+
const how = outcome.kind === "status"
|
|
48
|
+
? `status ${outcome.status}`
|
|
49
|
+
: outcome.kind === "connect"
|
|
50
|
+
? "connection never opened"
|
|
51
|
+
: "attempt timed out";
|
|
52
|
+
return `${attempt.endpoint}: ${how}`;
|
|
53
|
+
}
|
|
54
|
+
/** A refusal as prose. Pure. */
|
|
55
|
+
export function describeRefusal(refusal) {
|
|
56
|
+
switch (refusal.kind) {
|
|
57
|
+
case "not_an_origin":
|
|
58
|
+
return `failover endpoint ${refusal.index} ('${refusal.url}') is not a bare http(s) origin: ${refusal.reason}`;
|
|
59
|
+
case "mixed_scheme":
|
|
60
|
+
return (`failover endpoint ${refusal.index} uses ${refusal.found}, but the base URL uses ` +
|
|
61
|
+
`${refusal.expected}; every endpoint must share one scheme`);
|
|
62
|
+
case "duplicate_origin":
|
|
63
|
+
return `endpoint ${refusal.duplicate} repeats endpoint ${refusal.first} (${refusal.origin})`;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The endpoint set: the base URL's origin, then each failover URL's, normalized to
|
|
68
|
+
* `scheme://host:port`, or why it is refused. Each failover URL is checked in order: a
|
|
69
|
+
* bare http(s) origin, then the base URL's scheme, then a new origin. Pure.
|
|
70
|
+
*/
|
|
71
|
+
export function endpointSet(baseUrl, failovers) {
|
|
72
|
+
const base = new URL(baseUrl);
|
|
73
|
+
const origins = [originOf(base)];
|
|
74
|
+
const scheme = schemeOf(base);
|
|
75
|
+
for (const [offset, raw] of failovers.entries()) {
|
|
76
|
+
const index = offset + 1;
|
|
77
|
+
const parsed = bareOrigin(raw);
|
|
78
|
+
if (typeof parsed === "string") {
|
|
79
|
+
return { refusal: { kind: "not_an_origin", index, url: raw, reason: parsed } };
|
|
80
|
+
}
|
|
81
|
+
if (schemeOf(parsed) !== scheme) {
|
|
82
|
+
return { refusal: { kind: "mixed_scheme", index, expected: scheme, found: schemeOf(parsed) } };
|
|
83
|
+
}
|
|
84
|
+
const origin = originOf(parsed);
|
|
85
|
+
const first = origins.indexOf(origin);
|
|
86
|
+
if (first !== -1) {
|
|
87
|
+
return { refusal: { kind: "duplicate_origin", origin, first, duplicate: index } };
|
|
88
|
+
}
|
|
89
|
+
origins.push(origin);
|
|
90
|
+
}
|
|
91
|
+
return { endpoints: origins };
|
|
92
|
+
}
|
|
93
|
+
/** `url` with its origin replaced by `origin` (`scheme://host:port`). Pure. */
|
|
94
|
+
export function onEndpoint(url, origin) {
|
|
95
|
+
const moved = new URL(url);
|
|
96
|
+
const target = new URL(origin);
|
|
97
|
+
moved.protocol = target.protocol;
|
|
98
|
+
moved.hostname = target.hostname;
|
|
99
|
+
moved.port = target.port;
|
|
100
|
+
return moved.toString();
|
|
101
|
+
}
|
|
102
|
+
/** `raw` parsed as a bare `http(s)://host[:port]`, or the reason it is not one. */
|
|
103
|
+
function bareOrigin(raw) {
|
|
104
|
+
let url;
|
|
105
|
+
try {
|
|
106
|
+
url = new URL(raw);
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
return "it is not a valid absolute URL";
|
|
110
|
+
}
|
|
111
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") {
|
|
112
|
+
return "its scheme must be http or https";
|
|
113
|
+
}
|
|
114
|
+
if (url.username !== "" || url.password !== "") {
|
|
115
|
+
return "it carries user info";
|
|
116
|
+
}
|
|
117
|
+
if (url.pathname !== "/" && url.pathname !== "") {
|
|
118
|
+
return "it has a path";
|
|
119
|
+
}
|
|
120
|
+
// `URL` drops an empty `?` and `#`; the raw text still carries them.
|
|
121
|
+
if (url.search !== "" || /\?/.test(raw)) {
|
|
122
|
+
return "it has a query";
|
|
123
|
+
}
|
|
124
|
+
if (url.hash !== "" || raw.includes("#")) {
|
|
125
|
+
return "it has a fragment";
|
|
126
|
+
}
|
|
127
|
+
if (url.hostname === "") {
|
|
128
|
+
return "it has no host";
|
|
129
|
+
}
|
|
130
|
+
return url;
|
|
131
|
+
}
|
|
132
|
+
function schemeOf(url) {
|
|
133
|
+
return url.protocol.replace(/:$/, "");
|
|
134
|
+
}
|
|
135
|
+
/** `scheme://host:port`, the default port filled in, the host lower-cased. */
|
|
136
|
+
function originOf(url) {
|
|
137
|
+
const port = url.port !== "" ? url.port : url.protocol === "https:" ? "443" : "80";
|
|
138
|
+
return `${schemeOf(url)}://${url.hostname}:${port}`;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Classifies a non-success response. A status in `retryOn` rotates (checked before
|
|
142
|
+
* `accepted`); otherwise an unaccepted status that is retriable by default retries in
|
|
143
|
+
* place. Pure.
|
|
144
|
+
*/
|
|
145
|
+
export function outcomeOfStatus(status, retryAfterMs, accepted, retryOn) {
|
|
146
|
+
if (retryOn.includes(status)) {
|
|
147
|
+
return { kind: "rotate", reason: { kind: "status", status }, retryAfterMs };
|
|
148
|
+
}
|
|
149
|
+
if (!accepted && isRetriableStatus(status, retryAfterMs !== undefined)) {
|
|
150
|
+
return { kind: "retry", status, retryAfterMs };
|
|
151
|
+
}
|
|
152
|
+
return { kind: "final" };
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Classifies a transport failure: a connection that never opened, then an attempt
|
|
156
|
+
* timeout, rotate; anything else (a connection broken after the request went out) is
|
|
157
|
+
* final. Pure.
|
|
158
|
+
*/
|
|
159
|
+
export function outcomeOfTransport(connect, timeout) {
|
|
160
|
+
if (connect) {
|
|
161
|
+
return { kind: "rotate", reason: { kind: "connect" }, retryAfterMs: undefined };
|
|
162
|
+
}
|
|
163
|
+
if (timeout) {
|
|
164
|
+
return { kind: "rotate", reason: { kind: "timeout" }, retryAfterMs: undefined };
|
|
165
|
+
}
|
|
166
|
+
return { kind: "final" };
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* The failover state of one call: which endpoint is next, and the counts every decision
|
|
170
|
+
* depends on. Deterministic: time and randomness are passed in.
|
|
171
|
+
*
|
|
172
|
+
* With one endpoint every decision is exactly the single-endpoint retry loop's.
|
|
173
|
+
*/
|
|
174
|
+
export class Failover {
|
|
175
|
+
#len;
|
|
176
|
+
#current;
|
|
177
|
+
#attempts = 0;
|
|
178
|
+
#pauses = 0;
|
|
179
|
+
/** Consecutive rotations since the last pause or same-endpoint retry. */
|
|
180
|
+
#streak = 0;
|
|
181
|
+
/**
|
|
182
|
+
* Over the rotations of the current cycle: `undefined` before the first, then the
|
|
183
|
+
* smallest `Retry-After` while every one carried one, and `null` once one did not.
|
|
184
|
+
*/
|
|
185
|
+
#cycleRetryAfter = undefined;
|
|
186
|
+
/** A re-send decided but not yet sent (reported when the next attempt is sent). */
|
|
187
|
+
#pending = undefined;
|
|
188
|
+
#trace = [];
|
|
189
|
+
/** A call over `len` endpoints (at least one) starting at `start`. */
|
|
190
|
+
constructor(len, start) {
|
|
191
|
+
this.#len = Math.max(len, 1);
|
|
192
|
+
this.#current = start % this.#len;
|
|
193
|
+
}
|
|
194
|
+
/** Attempts sent so far. */
|
|
195
|
+
get attempts() {
|
|
196
|
+
return this.#attempts;
|
|
197
|
+
}
|
|
198
|
+
/** Before each send, with the time `remainingMs` before the deadline: the attempt, or why to stop. */
|
|
199
|
+
begin(remainingMs) {
|
|
200
|
+
if (remainingMs === 0) {
|
|
201
|
+
return { stop: this.#attempts === 0 ? "nothing_sent" : this.#spent() };
|
|
202
|
+
}
|
|
203
|
+
const resend = this.#pending;
|
|
204
|
+
this.#pending = undefined;
|
|
205
|
+
const left = this.#trace.at(-1);
|
|
206
|
+
if (resend?.kind === "rotation" && left !== undefined) {
|
|
207
|
+
left.rotated = true;
|
|
208
|
+
}
|
|
209
|
+
this.#attempts += 1;
|
|
210
|
+
return { endpoint: this.#current, number: this.#attempts, resend };
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* After an attempt that did not succeed: when to send the next one, or why to stop.
|
|
214
|
+
* `policy` is `undefined` when retries do not apply to the request. `draw` is called
|
|
215
|
+
* only when a computed pause needs it.
|
|
216
|
+
*/
|
|
217
|
+
after(outcome, policy, draw, remainingMs) {
|
|
218
|
+
if (outcome.kind === "final") {
|
|
219
|
+
return { stop: "raw" };
|
|
220
|
+
}
|
|
221
|
+
const reason = outcome.kind === "rotate" ? outcome.reason : { kind: "status", status: outcome.status };
|
|
222
|
+
this.#trace.push({ endpoint: this.#current, outcome: reason, rotated: false });
|
|
223
|
+
if (policy === undefined) {
|
|
224
|
+
return { stop: "raw" };
|
|
225
|
+
}
|
|
226
|
+
if (!shouldRetry(policy, this.#attempts)) {
|
|
227
|
+
return { stop: this.#spent() };
|
|
228
|
+
}
|
|
229
|
+
if (this.#len > 1 && outcome.kind === "rotate") {
|
|
230
|
+
return this.#rotate(policy, reason, outcome.retryAfterMs, draw, remainingMs);
|
|
231
|
+
}
|
|
232
|
+
this.#streak = 0;
|
|
233
|
+
this.#cycleRetryAfter = undefined;
|
|
234
|
+
const pauseMs = this.#pause(policy, outcome.retryAfterMs, draw, remainingMs);
|
|
235
|
+
if (typeof pauseMs !== "number") {
|
|
236
|
+
return pauseMs;
|
|
237
|
+
}
|
|
238
|
+
this.#pending = { kind: "retry", reason };
|
|
239
|
+
return { kind: "after", pauseMs };
|
|
240
|
+
}
|
|
241
|
+
/** The trace so far, naming endpoints by `origins`. */
|
|
242
|
+
trace(origins) {
|
|
243
|
+
return this.#trace.flatMap((entry) => {
|
|
244
|
+
const endpoint = origins[entry.endpoint];
|
|
245
|
+
return endpoint === undefined ? [] : [{ endpoint, outcome: entry.outcome, rotated: entry.rotated }];
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
#rotate(policy, reason, retryAfterMs, draw, remainingMs) {
|
|
249
|
+
this.#streak += 1;
|
|
250
|
+
const carried = retryAfterMs ?? null;
|
|
251
|
+
this.#cycleRetryAfter =
|
|
252
|
+
this.#cycleRetryAfter === undefined
|
|
253
|
+
? carried
|
|
254
|
+
: this.#cycleRetryAfter === null || carried === null
|
|
255
|
+
? null
|
|
256
|
+
: Math.min(this.#cycleRetryAfter, carried);
|
|
257
|
+
let next = { kind: "now" };
|
|
258
|
+
if (this.#streak % this.#len === 0) {
|
|
259
|
+
const server = this.#cycleRetryAfter ?? undefined;
|
|
260
|
+
this.#cycleRetryAfter = undefined;
|
|
261
|
+
const pauseMs = this.#pause(policy, server, draw, remainingMs);
|
|
262
|
+
if (typeof pauseMs !== "number") {
|
|
263
|
+
return pauseMs;
|
|
264
|
+
}
|
|
265
|
+
next = { kind: "after", pauseMs };
|
|
266
|
+
}
|
|
267
|
+
this.#pending = { kind: "rotation", from: this.#current, reason };
|
|
268
|
+
this.#current = (this.#current + 1) % this.#len;
|
|
269
|
+
return next;
|
|
270
|
+
}
|
|
271
|
+
/** The server's `Retry-After` if given, else the policy's backoff, if it ends before the deadline. */
|
|
272
|
+
#pause(policy, retryAfterMs, draw, remainingMs) {
|
|
273
|
+
// Drawn only when a jittered pause needs it: with `jitter: "none"` the draw is
|
|
274
|
+
// unused, as the fixture pins.
|
|
275
|
+
const pauseMs = retryAfterMs === undefined
|
|
276
|
+
? pause(policy, this.#pauses + 1, policy.jitter === "full" ? draw() : 0, remainingMs)
|
|
277
|
+
: fitsBefore(retryAfterMs, remainingMs);
|
|
278
|
+
if (pauseMs === undefined) {
|
|
279
|
+
return { stop: this.#spent() };
|
|
280
|
+
}
|
|
281
|
+
this.#pauses += 1;
|
|
282
|
+
return pauseMs;
|
|
283
|
+
}
|
|
284
|
+
/** The budget is spent: the trace once the call has rotated, the last outcome otherwise. */
|
|
285
|
+
#spent() {
|
|
286
|
+
return this.#trace.some((entry) => entry.rotated) ? "exhausted" : "raw";
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
//# sourceMappingURL=failover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"failover.js","sourceRoot":"","sources":["../src/failover.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAoB,UAAU,EAAE,iBAAiB,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAcjG;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,yCAAyC,CAAC;AAE3E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,uCAAuC,CAAC;AAEvE;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,MAAsB;IAClD,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC;AACxE,CAAC;AAmBD,wDAAwD;AACxD,MAAM,UAAU,eAAe,CAAC,OAAwB;I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C;QACD,IAAI,CAAC,OAAO,IAAI,CAAC,CAAC;QAClB,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,4FAA4F;IAC5F,MAAM;QACJ,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC;IAC1E,CAAC;CACF"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether an attestation will still be valid for as long as a submission may take.
|
|
3
|
+
*
|
|
4
|
+
* The service checks one thing about time: `now < exp`, with no leeway. A token that
|
|
5
|
+
* expires while a submission is being re-sent is refused on the late attempt, possibly
|
|
6
|
+
* after an earlier one committed. So `authorize` bounds each submission, every send and
|
|
7
|
+
* every wait between sends, by a deadline {@link ATTESTATION_CLOCK_ALLOWANCE_MS} before
|
|
8
|
+
* the token's `exp` ({@link submissionDeadline}); a wait that would reach it ends the
|
|
9
|
+
* re-sends. The call's own budget ({@link AUTHORIZE_DEADLINE_MS}) bounds the submission
|
|
10
|
+
* too: it ends at whichever of the two comes first. Before it sends, it checks that at
|
|
11
|
+
* least {@link ATTESTATION_MIN_REMAINING_MS} is left, and asks for a fresh token when less
|
|
12
|
+
* is.
|
|
13
|
+
*
|
|
14
|
+
* The payload is read, never verified: the signature is the service's to check.
|
|
15
|
+
*
|
|
16
|
+
* @packageDocumentation
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* How long before a token's `exp` a submission stops sending: room for the clocks of
|
|
20
|
+
* the issuer, this process and the service to disagree, since the service allows none.
|
|
21
|
+
*/
|
|
22
|
+
export declare const ATTESTATION_CLOCK_ALLOWANCE_MS = 30000;
|
|
23
|
+
/**
|
|
24
|
+
* How long a token must still be valid when a submission starts (45 s): the whole
|
|
25
|
+
* {@link AUTHORIZE_DEADLINE_MS} plus the {@link ATTESTATION_CLOCK_ALLOWANCE_MS}. The
|
|
26
|
+
* submission's deadline is the earlier of the call's and the token's `exp` less the
|
|
27
|
+
* allowance ({@link submissionDeadline}), so a token that passes this check never cuts a
|
|
28
|
+
* submission shorter than the call's own budget does.
|
|
29
|
+
*/
|
|
30
|
+
export declare const ATTESTATION_MIN_REMAINING_MS: number;
|
|
31
|
+
/**
|
|
32
|
+
* The deadline of a submission whose attestation expires at `expMs` (epoch
|
|
33
|
+
* milliseconds): `expMs` less {@link ATTESTATION_CLOCK_ALLOWANCE_MS}, read against the
|
|
34
|
+
* wall clock once (`wallNowMs`) and returned on the monotonic clock `monoNowMs` is read
|
|
35
|
+
* from, so a wall-clock step does not move it. `undefined` when that point has passed,
|
|
36
|
+
* and nothing may be sent. Pure.
|
|
37
|
+
*/
|
|
38
|
+
export declare function submissionDeadline(expMs: number, wallNowMs: number, monoNowMs: number): number | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* The token's `exp` in epoch milliseconds, or why its claims cannot be read. Pure; never
|
|
41
|
+
* verifies the signature.
|
|
42
|
+
*/
|
|
43
|
+
export declare function attestationExpiryMs(token: string): number | string;
|
|
44
|
+
/** What {@link attestationFreshness} found. */
|
|
45
|
+
export type Freshness = {
|
|
46
|
+
readonly state: "fresh";
|
|
47
|
+
readonly expiresAt: string;
|
|
48
|
+
} | {
|
|
49
|
+
readonly state: "expiring";
|
|
50
|
+
readonly expiresAt: string;
|
|
51
|
+
} | {
|
|
52
|
+
readonly state: "unreadable";
|
|
53
|
+
readonly problem: string;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Whether `token` is valid for at least `minRemainingMs` after `nowMs`, compared in whole
|
|
57
|
+
* milliseconds (digits of `exp` below a millisecond truncate). Pure; the same rule as the
|
|
58
|
+
* Rust SDK, pinned by `spec/fixtures/attestation-freshness-v1.json`.
|
|
59
|
+
*/
|
|
60
|
+
export declare function attestationFreshness(token: string, nowMs: number, minRemainingMs: number): Freshness;
|
|
61
|
+
/** Milliseconds since the epoch for an RFC 3339 date-time, or `undefined`. Pure. */
|
|
62
|
+
export declare function parseRfc3339Ms(text: string): number | undefined;
|
|
63
|
+
/** `YYYY-MM-DDTHH:MM:SS[.mmm]Z`, the milliseconds only when not zero. Pure. */
|
|
64
|
+
export declare function formatUtcMs(ms: number): string;
|
|
65
|
+
//# sourceMappingURL=freshness.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"freshness.d.ts","sourceRoot":"","sources":["../src/freshness.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH;;;GAGG;AACH,eAAO,MAAM,8BAA8B,QAAS,CAAC;AAErD;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,QAAyD,CAAC;AAEnG;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAG1G;AAaD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAUlE;AAED,+CAA+C;AAC/C,MAAM,MAAM,SAAS,GACjB;IAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GACvD;IAAE,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAC1D;IAAE,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAK/D;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,SAAS,CAOpG;AA0CD,oFAAoF;AACpF,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAgC/D;AAED,+EAA+E;AAC/E,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAE9C"}
|