@pipelex/sdk 0.51.0 → 0.53.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/README.md +20 -19
- package/dist/answer-reading.d.ts +70 -0
- package/dist/answer-reading.js +106 -0
- package/dist/answer-reading.js.map +1 -0
- package/dist/artifacts.js +45 -32
- package/dist/artifacts.js.map +1 -1
- package/dist/cli/present.d.ts +11 -14
- package/dist/cli/present.js +41 -37
- package/dist/cli/present.js.map +1 -1
- package/dist/cli/run.js +8 -7
- package/dist/cli/run.js.map +1 -1
- package/dist/cli/script.d.ts +1 -1
- package/dist/cli/source.js +2 -2
- package/dist/cli/source.js.map +1 -1
- package/dist/client.d.ts +254 -213
- package/dist/client.js +542 -472
- package/dist/client.js.map +1 -1
- package/dist/codegen-check.d.ts +21 -15
- package/dist/codegen-check.js +54 -27
- package/dist/codegen-check.js.map +1 -1
- package/dist/errors.d.ts +298 -455
- package/dist/errors.js +426 -534
- package/dist/errors.js.map +1 -1
- package/dist/exact-json.d.ts +8 -12
- package/dist/exact-json.js +19 -12
- package/dist/exact-json.js.map +1 -1
- package/dist/hooks/check-core.d.ts +12 -7
- package/dist/hooks/check-core.js +20 -14
- package/dist/hooks/check-core.js.map +1 -1
- package/dist/hooks/validate-stage.js +12 -3
- package/dist/hooks/validate-stage.js.map +1 -1
- package/dist/index.d.ts +4 -5
- package/dist/index.js +7 -6
- package/dist/index.js.map +1 -1
- package/dist/method-selector.js +7 -5
- package/dist/method-selector.js.map +1 -1
- package/dist/method-trees.d.ts +6 -7
- package/dist/method-trees.js +31 -37
- package/dist/method-trees.js.map +1 -1
- package/dist/models.d.ts +33 -210
- package/dist/models.js +2 -1
- package/dist/models.js.map +1 -1
- package/dist/prepare-inputs.d.ts +2 -2
- package/dist/prepare-inputs.js +51 -54
- package/dist/prepare-inputs.js.map +1 -1
- package/dist/problem-items.d.ts +19 -0
- package/dist/problem-items.js +52 -0
- package/dist/problem-items.js.map +1 -0
- package/dist/product-models.d.ts +43 -29
- package/dist/records.d.ts +12 -0
- package/dist/records.js +23 -0
- package/dist/records.js.map +1 -0
- package/dist/runs.d.ts +49 -38
- package/dist/runs.js +45 -19
- package/dist/runs.js.map +1 -1
- package/dist/transport-reading.d.ts +18 -0
- package/dist/{run-may-have-started.js → transport-reading.js} +15 -44
- package/dist/transport-reading.js.map +1 -0
- package/dist/upload-grant.d.ts +9 -6
- package/dist/upload-grant.js +42 -29
- package/dist/upload-grant.js.map +1 -1
- package/dist/upload.js +53 -33
- package/dist/upload.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/architecture.md +19 -19
- package/docs/artifact-download.md +6 -6
- package/docs/cli.md +1 -1
- package/docs/crate-routes.md +13 -14
- package/docs/errors.md +154 -267
- package/docs/exact-integers.md +1 -1
- package/docs/files.md +13 -13
- package/docs/hook-bundle.md +15 -1
- package/docs/input-preparation.md +14 -14
- package/docs/method-copy.md +35 -33
- package/docs/method-examples.md +13 -14
- package/docs/method-trees.md +27 -28
- package/docs/organization-branding.md +14 -16
- package/docs/run-results.md +8 -8
- package/package.json +1 -1
- package/dist/error-models.d.ts +0 -302
- package/dist/error-models.js +0 -203
- package/dist/error-models.js.map +0 -1
- package/dist/error-verdicts.d.ts +0 -46
- package/dist/error-verdicts.js +0 -120
- package/dist/error-verdicts.js.map +0 -1
- package/dist/run-may-have-started.d.ts +0 -31
- package/dist/run-may-have-started.js.map +0 -1
package/dist/runs.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isProblem } from "mthds/protocol";
|
|
2
|
+
import { RequestArgumentError, RunFailedError, argumentInvalidProblem, RunLifecycleUnavailableError, RunTimeoutError, } from "./errors.js";
|
|
2
3
|
import { MAX_TIMER_DELAY_MS } from "./timers.js";
|
|
3
|
-
import { dropUnfit, isPlainObject } from "./
|
|
4
|
+
import { dropUnfit, isPlainObject } from "./records.js";
|
|
4
5
|
/** Every `RunStatus`, in the platform's declaration order. */
|
|
5
6
|
export const RUN_STATUSES = [
|
|
6
7
|
"PENDING",
|
|
@@ -16,8 +17,8 @@ export const RUN_STATUSES = [
|
|
|
16
17
|
* The statuses a run-history filter sends, deduplicated into `RUN_STATUSES` order so the same
|
|
17
18
|
* filter always builds the same query, as the Python twin builds it. `undefined` is no filter,
|
|
18
19
|
* which lists every status. An empty list names no status, and a name that is no `RunStatus`
|
|
19
|
-
* names one the platform refuses with a `422`; each is a `RequestArgumentError`,
|
|
20
|
-
*
|
|
20
|
+
* names one the platform refuses with a `422`; each is a `RequestArgumentError`, its problem
|
|
21
|
+
* `client.argument_invalid` naming `status`, before any request, rather than a query that lists every status or fails late. A
|
|
21
22
|
* value that is not an array at all is a `TypeError`, a bug in the calling code.
|
|
22
23
|
*/
|
|
23
24
|
export function runStatusFilter(status) {
|
|
@@ -27,12 +28,12 @@ export function runStatusFilter(status) {
|
|
|
27
28
|
throw new TypeError(`"status" must be an array naming one or more of ${RUN_STATUSES.join(", ")}.`);
|
|
28
29
|
}
|
|
29
30
|
if (status.length === 0) {
|
|
30
|
-
throw new RequestArgumentError(`"status" must name one or more of ${RUN_STATUSES.join(", ")}; omit it to list every status
|
|
31
|
+
throw new RequestArgumentError(`"status" must name one or more of ${RUN_STATUSES.join(", ")}; omit it to list every status.`, { problem: argumentInvalidProblem("status", "empty") });
|
|
31
32
|
}
|
|
32
33
|
const known = RUN_STATUSES;
|
|
33
34
|
const unknown = status.filter((name) => !known.includes(name));
|
|
34
35
|
if (unknown.length > 0) {
|
|
35
|
-
throw new RequestArgumentError(`Unknown run status(es) ${unknown.join(", ")}; valid statuses are: ${RUN_STATUSES.join(", ")}
|
|
36
|
+
throw new RequestArgumentError(`Unknown run status(es) ${unknown.join(", ")}; valid statuses are: ${RUN_STATUSES.join(", ")}.`, { problem: argumentInvalidProblem("status", "unknown_value") });
|
|
36
37
|
}
|
|
37
38
|
return RUN_STATUSES.filter((name) => status.includes(name));
|
|
38
39
|
}
|
|
@@ -164,16 +165,34 @@ export function runProgressFault(snapshot) {
|
|
|
164
165
|
return undefined;
|
|
165
166
|
}
|
|
166
167
|
/**
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
* `
|
|
168
|
+
* An invocation's `last_failure`, checked so that it never fails the read carrying it: a value that
|
|
169
|
+
* is not an object, or whose `problem` is not a problem document (`isProblem` in `mthds/protocol`),
|
|
170
|
+
* reads as `undefined`, since a failure without its problem cannot be branched on; `at` is kept
|
|
171
|
+
* when it is a string and dropped otherwise; members this SDK does not name are relayed as sent.
|
|
172
|
+
*
|
|
173
|
+
* Internal: `withCheckedProgressHealth` applies it.
|
|
174
|
+
*/
|
|
175
|
+
export function readProgressFailure(value) {
|
|
176
|
+
if (!isPlainObject(value) || !isProblem(value.problem))
|
|
177
|
+
return undefined;
|
|
178
|
+
const failure = { ...value };
|
|
179
|
+
if (Object.hasOwn(failure, "at") && typeof failure.at !== "string")
|
|
180
|
+
delete failure.at;
|
|
181
|
+
return failure;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* A readable snapshot with its health annotations checked, so that none ever fails the read: its
|
|
185
|
+
* own `degradation` and each invocation's by `readRunDegradation`, one whose `reason` is not a
|
|
186
|
+
* string dropped, and each invocation's `last_failure` by `readProgressFailure`, one whose
|
|
187
|
+
* `problem` is not a problem document dropped, since an optional member is absent rather than
|
|
188
|
+
* `null`.
|
|
170
189
|
*
|
|
171
190
|
* Internal: `getRunProgress` applies it to an answer `runProgressFault` passed.
|
|
172
191
|
*/
|
|
173
|
-
export function
|
|
192
|
+
export function withCheckedProgressHealth(snapshot) {
|
|
174
193
|
return {
|
|
175
194
|
...withCheckedDegradationMember(snapshot),
|
|
176
|
-
invocations: snapshot.invocations.map(withCheckedDegradationMember),
|
|
195
|
+
invocations: snapshot.invocations.map((invocation) => withCheckedFailureMember(withCheckedDegradationMember(invocation))),
|
|
177
196
|
};
|
|
178
197
|
}
|
|
179
198
|
function withCheckedDegradationMember(record) {
|
|
@@ -183,6 +202,13 @@ function withCheckedDegradationMember(record) {
|
|
|
183
202
|
const checked = readRunDegradation(degradation);
|
|
184
203
|
return (checked === null ? rest : { ...rest, degradation: checked });
|
|
185
204
|
}
|
|
205
|
+
function withCheckedFailureMember(invocation) {
|
|
206
|
+
if (!Object.hasOwn(invocation, "last_failure"))
|
|
207
|
+
return invocation;
|
|
208
|
+
const { last_failure: failure, ...rest } = invocation;
|
|
209
|
+
const checked = readProgressFailure(failure);
|
|
210
|
+
return (checked === undefined ? rest : { ...rest, last_failure: checked });
|
|
211
|
+
}
|
|
186
212
|
// ── Results artifact selection ───────────────────────────────────
|
|
187
213
|
/**
|
|
188
214
|
* The result artifacts a results read can be narrowed to, in the platform's order. Passing some
|
|
@@ -201,9 +227,9 @@ export const RUN_RESULT_ARTIFACTS = [
|
|
|
201
227
|
];
|
|
202
228
|
/**
|
|
203
229
|
* Refuse an artifact selection the platform would answer with a 400: an empty one, or one naming
|
|
204
|
-
* an artifact it does not know, each a `RequestArgumentError`,
|
|
205
|
-
* Python twin refuses it. `undefined` is no selection, which reads every artifact; a value that is
|
|
206
|
-
* not an array at all is a `TypeError`, a bug in the calling code that carries no
|
|
230
|
+
* an artifact it does not know, each a `RequestArgumentError`, its problem
|
|
231
|
+
* `client.argument_invalid` naming `artifacts`, as the Python twin refuses it. `undefined` is no selection, which reads every artifact; a value that is
|
|
232
|
+
* not an array at all is a `TypeError`, a bug in the calling code that carries no problem.
|
|
207
233
|
*/
|
|
208
234
|
export function assertArtifactSelection(artifacts) {
|
|
209
235
|
if (artifacts === undefined)
|
|
@@ -213,13 +239,13 @@ export function assertArtifactSelection(artifacts) {
|
|
|
213
239
|
}
|
|
214
240
|
if (artifacts.length === 0) {
|
|
215
241
|
throw new RequestArgumentError(`"artifacts" must name one or more of ${RUN_RESULT_ARTIFACTS.join(", ")}; omit it to read ` +
|
|
216
|
-
"every artifact.");
|
|
242
|
+
"every artifact.", { problem: argumentInvalidProblem("artifacts", "empty") });
|
|
217
243
|
}
|
|
218
244
|
const known = RUN_RESULT_ARTIFACTS;
|
|
219
245
|
const unknown = artifacts.filter((name) => !known.includes(name));
|
|
220
246
|
if (unknown.length > 0) {
|
|
221
247
|
throw new RequestArgumentError(`Unknown result artifact(s) ${unknown.join(", ")}; valid artifacts are: ` +
|
|
222
|
-
`${RUN_RESULT_ARTIFACTS.join(", ")}
|
|
248
|
+
`${RUN_RESULT_ARTIFACTS.join(", ")}.`, { problem: argumentInvalidProblem("artifacts", "unknown_value") });
|
|
223
249
|
}
|
|
224
250
|
}
|
|
225
251
|
/** Whether a results read with this selection carries `main_stuff` — no selection reads all. */
|
|
@@ -245,8 +271,8 @@ export function assertWaitOptions(options = {}) {
|
|
|
245
271
|
/**
|
|
246
272
|
* Poll a single-shot result lookup (`fetchOnce`) until the run reaches a
|
|
247
273
|
* terminal state. Returns the artifacts on `COMPLETED`, throws `RunFailedError`
|
|
248
|
-
* on any other terminal status — carrying the run's status and
|
|
249
|
-
*
|
|
274
|
+
* on any other terminal status — carrying the run's status and the `run.failed`
|
|
275
|
+
* problem, which nests the run's own — and throws `RunTimeoutError` if `timeoutMs` elapses first (the run
|
|
250
276
|
* keeps executing server-side — re-poll by id later).
|
|
251
277
|
*
|
|
252
278
|
* With `options.onProgress` and a `fetchProgress`, each poll that finds the run still running also
|
|
@@ -284,7 +310,7 @@ export async function pollUntilResult(fetchOnce, runId, options = {}, fetchProgr
|
|
|
284
310
|
return state.result;
|
|
285
311
|
}
|
|
286
312
|
if (state.state === "failed") {
|
|
287
|
-
throw new RunFailedError(state.message, runId, state.status, {
|
|
313
|
+
throw new RunFailedError(state.message, runId, state.status, { problem: state.problem });
|
|
288
314
|
}
|
|
289
315
|
if (readsProgress && onProgress !== undefined && fetchProgress !== undefined) {
|
|
290
316
|
let progress;
|
package/dist/runs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runs.js","sourceRoot":"","sources":["../src/runs.ts"],"names":[],"mappings":"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AC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a request that got no answer may have left this machine, the one reading of a transport
|
|
3
|
+
* failure the SDK cannot take from a problem. `ApiUnreachableError` reads it when the client tells
|
|
4
|
+
* it the request may create a run, a start or a blocking execute: a failure that proves nothing was
|
|
5
|
+
* sent reads as the transport's own problem (`client.unreachable`), and any other as
|
|
6
|
+
* `client.outcome_unknown`, whose `retry` says the run may exist. The Python twin, `pipelex-sdk`,
|
|
7
|
+
* reads the same failures the same way in `pipelex_sdk.transport_reading`.
|
|
8
|
+
*
|
|
9
|
+
* The reading errs on the safe side. A false "may have left" costs the person a look at the run
|
|
10
|
+
* history; a false "never left" costs a second paid run. So every failure counts as one that may
|
|
11
|
+
* have left unless it proves otherwise.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Whether a request that met a transport failure may have left this machine: every failure but one
|
|
15
|
+
* that proves nothing was sent. `cause` is the failure fetch threw, which `ApiUnreachableError`
|
|
16
|
+
* keeps as its own `cause`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function requestMayHaveLeft(cause: unknown): boolean;
|
|
@@ -1,50 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Whether a
|
|
3
|
-
*
|
|
4
|
-
* it
|
|
5
|
-
*
|
|
6
|
-
* `
|
|
2
|
+
* Whether a request that got no answer may have left this machine, the one reading of a transport
|
|
3
|
+
* failure the SDK cannot take from a problem. `ApiUnreachableError` reads it when the client tells
|
|
4
|
+
* it the request may create a run, a start or a blocking execute: a failure that proves nothing was
|
|
5
|
+
* sent reads as the transport's own problem (`client.unreachable`), and any other as
|
|
6
|
+
* `client.outcome_unknown`, whose `retry` says the run may exist. The Python twin, `pipelex-sdk`,
|
|
7
|
+
* reads the same failures the same way in `pipelex_sdk.transport_reading`.
|
|
7
8
|
*
|
|
8
|
-
* The reading errs on the safe side. A false "may have
|
|
9
|
-
* history; a false "
|
|
10
|
-
*
|
|
11
|
-
* sent, and an answer that says the request was refused before anything ran.
|
|
9
|
+
* The reading errs on the safe side. A false "may have left" costs the person a look at the run
|
|
10
|
+
* history; a false "never left" costs a second paid run. So every failure counts as one that may
|
|
11
|
+
* have left unless it proves otherwise.
|
|
12
12
|
*/
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
14
|
+
* Whether a request that met a transport failure may have left this machine: every failure but one
|
|
15
|
+
* that proves nothing was sent. `cause` is the failure fetch threw, which `ApiUnreachableError`
|
|
16
|
+
* keeps as its own `cause`.
|
|
17
17
|
*/
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Whether an answer to a request that may create a run leaves one possibly started:
|
|
21
|
-
*
|
|
22
|
-
* - any `2xx`, which the client met only because it could not read it: the server accepted the
|
|
23
|
-
* request, and only its acknowledgement was lost;
|
|
24
|
-
* - a `408`, which a proxy in front of the platform may answer for a request it forwarded;
|
|
25
|
-
* - every `5xx` but a `501`, which says the deployment does not serve the route, and a `503`
|
|
26
|
-
* carrying the platform's code `pipeline_start_unavailable`, which says the runner was never
|
|
27
|
-
* reached: the server or a gateway failed while handling the request.
|
|
28
|
-
*
|
|
29
|
-
* Any other status is the request refused before anything ran.
|
|
30
|
-
*/
|
|
31
|
-
export function answerMayHaveStartedRun(status, code) {
|
|
32
|
-
if (status >= 200 && status < 300)
|
|
33
|
-
return true;
|
|
34
|
-
if (status === 408)
|
|
35
|
-
return true;
|
|
36
|
-
if (status === 501)
|
|
37
|
-
return false;
|
|
38
|
-
if (status === 503 && code === START_UNAVAILABLE_CODE)
|
|
39
|
-
return false;
|
|
40
|
-
return status >= 500 && status < 600;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Whether a transport failure of a request that may create a run leaves one possibly started:
|
|
44
|
-
* every failure but one that proves nothing was sent. `cause` is the failure fetch threw, which
|
|
45
|
-
* `ApiUnreachableError` keeps as its own `cause`.
|
|
46
|
-
*/
|
|
47
|
-
export function transportMayHaveStartedRun(cause) {
|
|
18
|
+
export function requestMayHaveLeft(cause) {
|
|
48
19
|
return !provesNothingSent(cause);
|
|
49
20
|
}
|
|
50
21
|
/**
|
|
@@ -64,7 +35,7 @@ export function transportMayHaveStartedRun(cause) {
|
|
|
64
35
|
* the TLS handshake or after the request, and so does an `EHOSTUNREACH` met once connected, so
|
|
65
36
|
* neither proves anything; nor does another TLS failure, which may come after the handshake; nor
|
|
66
37
|
* does the SDK's own time limit (`ABORT_TIMEOUT`), which fetch cannot place before or after the
|
|
67
|
-
* connection was made
|
|
38
|
+
* connection was made. Every request that
|
|
68
39
|
* may create a run has a limit longer than undici's connect limit, so with Node's own dispatcher
|
|
69
40
|
* it runs out only once the request has left.
|
|
70
41
|
*/
|
|
@@ -135,4 +106,4 @@ const CONNECTION_SETUP_CODES = new Set([
|
|
|
135
106
|
"HOSTNAME_MISMATCH",
|
|
136
107
|
"UNSPECIFIED",
|
|
137
108
|
]);
|
|
138
|
-
//# sourceMappingURL=
|
|
109
|
+
//# sourceMappingURL=transport-reading.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport-reading.js","sourceRoot":"","sources":["../src/transport-reading.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;AACnC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAS,iBAAiB,CAAC,YAAqB;IAC9C,sEAAsE;IACtE,OAAO,YAAY,YAAY,KAAK,IAAI,wBAAwB,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;AACvF,CAAC;AAED,SAAS,wBAAwB,CAAC,OAAgB;IAChD,IAAI,OAAO,YAAY,cAAc,EAAE,CAAC;QACtC,OAAO,OAAO,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC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CHANGED
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
*
|
|
10
10
|
* **This module is the browser-safe entry, `@pipelex/sdk/upload`.** Its runtime
|
|
11
11
|
* import graph must never reach a Node builtin, `undici` or the client: a page
|
|
12
|
-
* bundles it as is, with nothing marked external. It imports the error classes,
|
|
12
|
+
* bundles it as is, with nothing marked external. It imports the error classes, the
|
|
13
|
+
* standard's problem builder,
|
|
13
14
|
* the timer bound in `timers.ts` and the wire types only, hashes with Web Crypto,
|
|
14
15
|
* and `tests/upload-grant.test.ts` bundles it for the browser with esbuild to hold
|
|
15
16
|
* it to that.
|
|
@@ -17,7 +18,7 @@
|
|
|
17
18
|
import type { UploadGrant } from "./product-models.js";
|
|
18
19
|
export type { UploadGrant, UploadGrantInput, UploadKind } from "./product-models.js";
|
|
19
20
|
export { InputPreparationError, RejectedAssetError, UploadTransportError } from "./errors.js";
|
|
20
|
-
export type {
|
|
21
|
+
export type { RejectedAssetReason, UploadTransportReason } from "./errors.js";
|
|
21
22
|
/** Per-call options for {@link describeUpload}. */
|
|
22
23
|
export interface DescribeUploadOptions {
|
|
23
24
|
/** The file's name, replacing a `File`'s own; required for a nameless `Blob`. */
|
|
@@ -138,7 +139,7 @@ export interface GrantedUpload {
|
|
|
138
139
|
* Storage's refusals map onto the input-preparation errors, so a caller that
|
|
139
140
|
* already handles `uploadFile` needs no new case:
|
|
140
141
|
*
|
|
141
|
-
* - `RejectedAssetError` (`status` is storage's, `
|
|
142
|
+
* - `RejectedAssetError` (`status` is storage's, `reason` says why) — a `412` for a
|
|
142
143
|
* grant that names no bytes, when the grant was already used (`grant_used`: such a
|
|
143
144
|
* grant writes one object, once); a `403` when the file's size, type or metadata
|
|
144
145
|
* differ from what the grant signed (`signature_mismatch`), when the request carried
|
|
@@ -147,7 +148,7 @@ export interface GrantedUpload {
|
|
|
147
148
|
* `400 BadDigest` among them, for bytes other than the ones whose SHA-256 the grant
|
|
148
149
|
* was requested with. Each asks for a new grant, or for the file the grant was
|
|
149
150
|
* requested for.
|
|
150
|
-
* - `UploadTransportError` (`status` is storage's when it answered, `
|
|
151
|
+
* - `UploadTransportError` (`status` is storage's when it answered, `reason` says
|
|
151
152
|
* which) — the time limit running out (`timeout`), storage unreachable
|
|
152
153
|
* (`unreachable`), a `5xx` (`server_error`), storage timing out on the body
|
|
153
154
|
* (`storage_timeout`, a `400 RequestTimeout`, which wrote nothing), another write of
|
|
@@ -174,8 +175,10 @@ export interface GrantedUpload {
|
|
|
174
175
|
* expires either stores it or finds it stored, and then the grant's `uri` names the
|
|
175
176
|
* file. After a `408` or a `429` the same retry applies, later, since storage refused
|
|
176
177
|
* the request for its timing. A `501` is the exception: storage does not implement the
|
|
177
|
-
* request it was sent, stored nothing, and answers a retry the same way, so its error
|
|
178
|
-
*
|
|
178
|
+
* request it was sent, stored nothing, and answers a retry the same way, so its error's
|
|
179
|
+
* problem says no retry can pass. Every error carries its problem (see `docs/errors.md`):
|
|
180
|
+
* `client.timeout` naming the time limit, `client.unreachable` naming storage's origin, and
|
|
181
|
+
* for the others the one `uploadTransportProblem` reads from the reason. The grant is a bearer capability: nothing here logs it, and no
|
|
179
182
|
* error this throws carries its URL, storage's error body or a runtime error that
|
|
180
183
|
* could hold either.
|
|
181
184
|
*/
|
package/dist/upload-grant.js
CHANGED
|
@@ -9,12 +9,14 @@
|
|
|
9
9
|
*
|
|
10
10
|
* **This module is the browser-safe entry, `@pipelex/sdk/upload`.** Its runtime
|
|
11
11
|
* import graph must never reach a Node builtin, `undici` or the client: a page
|
|
12
|
-
* bundles it as is, with nothing marked external. It imports the error classes,
|
|
12
|
+
* bundles it as is, with nothing marked external. It imports the error classes, the
|
|
13
|
+
* standard's problem builder,
|
|
13
14
|
* the timer bound in `timers.ts` and the wire types only, hashes with Web Crypto,
|
|
14
15
|
* and `tests/upload-grant.test.ts` bundles it for the browser with esbuild to hold
|
|
15
16
|
* it to that.
|
|
16
17
|
*/
|
|
17
|
-
import {
|
|
18
|
+
import { buildProblem } from "mthds/protocol";
|
|
19
|
+
import { InputPreparationError, RejectedAssetError, UploadTransportError, argumentInvalidProblem, } from "./errors.js";
|
|
18
20
|
import { MAX_TIMER_DELAY_MS, isTimerDelay } from "./timers.js";
|
|
19
21
|
// The classes `uploadWithGrant` raises, so a page can branch on them without the main entry.
|
|
20
22
|
export { InputPreparationError, RejectedAssetError, UploadTransportError } from "./errors.js";
|
|
@@ -80,11 +82,11 @@ export async function describeUpload(file, options = {}) {
|
|
|
80
82
|
const filename = options.filename ?? ownName(file);
|
|
81
83
|
if (filename === undefined || filename.length === 0) {
|
|
82
84
|
throw new InputPreparationError("The file to describe has no name: pass a File, or give a Blob its name as the " +
|
|
83
|
-
"filename option.");
|
|
85
|
+
"filename option.", { problem: argumentInvalidProblem("filename", "missing") });
|
|
84
86
|
}
|
|
85
87
|
const maxBytes = options.maxBytes ?? DEFAULT_DESCRIBE_MAX_BYTES;
|
|
86
88
|
if (!(typeof maxBytes === "number" && Number.isFinite(maxBytes) && maxBytes > 0)) {
|
|
87
|
-
throw new InputPreparationError(`"maxBytes" must be a positive number, got ${String(options.maxBytes)}
|
|
89
|
+
throw new InputPreparationError(`"maxBytes" must be a positive number, got ${String(options.maxBytes)}.`, { problem: argumentInvalidProblem("maxBytes", "not_positive") });
|
|
88
90
|
}
|
|
89
91
|
const description = { filename, content_type: file.type, size: file.size };
|
|
90
92
|
// A file past the bound is never read and goes without its hash: the grant route refuses
|
|
@@ -100,7 +102,10 @@ export async function describeUpload(file, options = {}) {
|
|
|
100
102
|
}
|
|
101
103
|
catch (error) {
|
|
102
104
|
throw new InputPreparationError(`"${filename}" could not be read to compute its SHA-256 (${describeFailureChain(error)}). ` +
|
|
103
|
-
"Pick the file again.", {
|
|
105
|
+
"Pick the file again.", {
|
|
106
|
+
problem: buildProblem("client.file_unreadable", { path: filename, reason: "unreadable" }),
|
|
107
|
+
cause: error,
|
|
108
|
+
});
|
|
104
109
|
}
|
|
105
110
|
return { ...description, sha256: hex(await digest("SHA-256", bytes)) };
|
|
106
111
|
}
|
|
@@ -144,7 +149,7 @@ function ownName(file) {
|
|
|
144
149
|
* Storage's refusals map onto the input-preparation errors, so a caller that
|
|
145
150
|
* already handles `uploadFile` needs no new case:
|
|
146
151
|
*
|
|
147
|
-
* - `RejectedAssetError` (`status` is storage's, `
|
|
152
|
+
* - `RejectedAssetError` (`status` is storage's, `reason` says why) — a `412` for a
|
|
148
153
|
* grant that names no bytes, when the grant was already used (`grant_used`: such a
|
|
149
154
|
* grant writes one object, once); a `403` when the file's size, type or metadata
|
|
150
155
|
* differ from what the grant signed (`signature_mismatch`), when the request carried
|
|
@@ -153,7 +158,7 @@ function ownName(file) {
|
|
|
153
158
|
* `400 BadDigest` among them, for bytes other than the ones whose SHA-256 the grant
|
|
154
159
|
* was requested with. Each asks for a new grant, or for the file the grant was
|
|
155
160
|
* requested for.
|
|
156
|
-
* - `UploadTransportError` (`status` is storage's when it answered, `
|
|
161
|
+
* - `UploadTransportError` (`status` is storage's when it answered, `reason` says
|
|
157
162
|
* which) — the time limit running out (`timeout`), storage unreachable
|
|
158
163
|
* (`unreachable`), a `5xx` (`server_error`), storage timing out on the body
|
|
159
164
|
* (`storage_timeout`, a `400 RequestTimeout`, which wrote nothing), another write of
|
|
@@ -180,8 +185,10 @@ function ownName(file) {
|
|
|
180
185
|
* expires either stores it or finds it stored, and then the grant's `uri` names the
|
|
181
186
|
* file. After a `408` or a `429` the same retry applies, later, since storage refused
|
|
182
187
|
* the request for its timing. A `501` is the exception: storage does not implement the
|
|
183
|
-
* request it was sent, stored nothing, and answers a retry the same way, so its error
|
|
184
|
-
*
|
|
188
|
+
* request it was sent, stored nothing, and answers a retry the same way, so its error's
|
|
189
|
+
* problem says no retry can pass. Every error carries its problem (see `docs/errors.md`):
|
|
190
|
+
* `client.timeout` naming the time limit, `client.unreachable` naming storage's origin, and
|
|
191
|
+
* for the others the one `uploadTransportProblem` reads from the reason. The grant is a bearer capability: nothing here logs it, and no
|
|
185
192
|
* error this throws carries its URL, storage's error body or a runtime error that
|
|
186
193
|
* could hold either.
|
|
187
194
|
*/
|
|
@@ -238,7 +245,10 @@ export async function uploadWithGrant(grant, file, options = {}) {
|
|
|
238
245
|
`(${describeFailureChain(error)}). In a browser, a refused cross-origin request ` +
|
|
239
246
|
"looks the same: check that the page may connect to the storage origin (its CSP " +
|
|
240
247
|
"connect-src). If the connection failed after the file went out, storage may have " +
|
|
241
|
-
`stored it anyway. ${sameGrantRetry(grant)}`, {
|
|
248
|
+
`stored it anyway. ${sameGrantRetry(grant)}`, {
|
|
249
|
+
reason: "unreachable",
|
|
250
|
+
problem: buildProblem("client.unreachable", { base_url: target.origin }),
|
|
251
|
+
});
|
|
242
252
|
}
|
|
243
253
|
// A body is cancelled, never awaited: a stream's cancel can outlive any time limit.
|
|
244
254
|
if (response.status >= 200 && response.status < 300) {
|
|
@@ -257,7 +267,7 @@ export async function uploadWithGrant(grant, file, options = {}) {
|
|
|
257
267
|
throw new UploadTransportError(`Upload of "${label}" was redirected by storage, and the redirect was refused: a ` +
|
|
258
268
|
"presigned upload is valid only at the URL it was signed for.",
|
|
259
269
|
// A refused redirect in a browser is opaque, with status 0: no status reached us.
|
|
260
|
-
{ status: response.status || undefined,
|
|
270
|
+
{ status: response.status || undefined, reason: "redirected" });
|
|
261
271
|
}
|
|
262
272
|
// Only the error's code and message are kept, never the body: S3 echoes the
|
|
263
273
|
// canonical request on a signature mismatch, and with it the grant's credential.
|
|
@@ -272,7 +282,7 @@ export async function uploadWithGrant(grant, file, options = {}) {
|
|
|
272
282
|
if (status === 400 && refusal.code === "RequestTimeout") {
|
|
273
283
|
throw new UploadTransportError(`Upload of "${label}" timed out at storage (${describeStatus(response, refusal)}): ` +
|
|
274
284
|
"storage stopped waiting for the file's bytes and wrote nothing. Retry with the " +
|
|
275
|
-
`same grant${beforeExpiry(grant)}, or with a new one.`, { status,
|
|
285
|
+
`same grant${beforeExpiry(grant)}, or with a new one.`, { status, reason: "storage_timeout" });
|
|
276
286
|
}
|
|
277
287
|
// S3 answers this while another write or a delete of the key is in flight, and documents
|
|
278
288
|
// it as retryable: it says nothing about this file, so it is no refusal of it, and the
|
|
@@ -295,14 +305,14 @@ export async function uploadWithGrant(grant, file, options = {}) {
|
|
|
295
305
|
`storage (${describeStatus(response, refusal)}) ` +
|
|
296
306
|
(attempts === 1 ? "on its one attempt" : `on each of its ${attempts} attempts`) +
|
|
297
307
|
(timedOut ? ` before the ${formatSeconds(limitMs)} s allowed ran out` : "") +
|
|
298
|
-
`, so whether the file was stored is unknown. ${sameGrantRetry(grant)}`, { status,
|
|
308
|
+
`, so whether the file was stored is unknown. ${sameGrantRetry(grant)}`, { status, reason: "conflict" });
|
|
299
309
|
}
|
|
300
310
|
// A 408 or a 429 refuses the request for its timing, never the file: storage timed it out
|
|
301
|
-
// or throttled it, so it falls through to the transport failure below, whose
|
|
302
|
-
// its status as
|
|
311
|
+
// or throttled it, so it falls through to the transport failure below, whose problem reads
|
|
312
|
+
// its status as `runtime.unavailable`.
|
|
303
313
|
if (status >= 400 && status < 500 && status !== 408 && status !== 429) {
|
|
304
|
-
const {
|
|
305
|
-
throw new RejectedAssetError(`Storage refused the upload of "${label}" (${describeStatus(response, refusal)}): ${advice}`, label, status, {
|
|
314
|
+
const { reason, advice } = classifyRefusal(status, refusal, grant);
|
|
315
|
+
throw new RejectedAssetError(`Storage refused the upload of "${label}" (${describeStatus(response, refusal)}): ${advice}`, label, status, { reason });
|
|
306
316
|
}
|
|
307
317
|
const failure = `Upload of "${label}" failed at storage (${describeStatus(response, refusal)})` +
|
|
308
318
|
(refusal.message ? `: ${withoutFinalPeriod(refusal.message)}` : "");
|
|
@@ -311,13 +321,13 @@ export async function uploadWithGrant(grant, file, options = {}) {
|
|
|
311
321
|
// the same grant nor a new one is worth a retry, and the error's verdict says so too.
|
|
312
322
|
if (status === 501) {
|
|
313
323
|
throw new UploadTransportError(`${failure}. Storage does not implement the request it was sent, so it stored ` +
|
|
314
|
-
"nothing, and sending the file again will meet the same answer.", { status,
|
|
324
|
+
"nothing, and sending the file again will meet the same answer.", { status, reason: "server_error" });
|
|
315
325
|
}
|
|
316
326
|
if (status === 408 || status === 429) {
|
|
317
327
|
throw new UploadTransportError(`${failure}. Storage ${status === 429 ? "throttled" : "timed out"} the request rather ` +
|
|
318
|
-
`than refusing the file, so a later attempt can succeed. ${sameGrantRetry(grant)}`, { status,
|
|
328
|
+
`than refusing the file, so a later attempt can succeed. ${sameGrantRetry(grant)}`, { status, reason: "unexpected" });
|
|
319
329
|
}
|
|
320
|
-
throw new UploadTransportError(`${failure}. Whether the file was stored is unknown. ${sameGrantRetry(grant)}`, { status,
|
|
330
|
+
throw new UploadTransportError(`${failure}. Whether the file was stored is unknown. ${sameGrantRetry(grant)}`, { status, reason: status >= 500 ? "server_error" : "unexpected" });
|
|
321
331
|
}
|
|
322
332
|
}
|
|
323
333
|
finally {
|
|
@@ -369,13 +379,16 @@ function defaultTimeoutMs(size) {
|
|
|
369
379
|
function requireTimeout(timeoutMs) {
|
|
370
380
|
if (!isTimerDelay(timeoutMs)) {
|
|
371
381
|
throw new InputPreparationError(`"timeoutMs" must be a positive number no larger than ${MAX_TIMER_DELAY_MS}, got ` +
|
|
372
|
-
`${String(timeoutMs)}
|
|
382
|
+
`${String(timeoutMs)}.`, { problem: argumentInvalidProblem("timeoutMs", "not_positive") });
|
|
373
383
|
}
|
|
374
384
|
}
|
|
375
385
|
function timeoutError(label, limitMs, grant) {
|
|
376
386
|
return new UploadTransportError(`Upload of "${label}" did not finish within the ${formatSeconds(limitMs)} s allowed, so ` +
|
|
377
387
|
"whether storage stored the file is unknown. On a slow link, pass a longer timeoutMs. " +
|
|
378
|
-
sameGrantRetry(grant), {
|
|
388
|
+
sameGrantRetry(grant), {
|
|
389
|
+
reason: "timeout",
|
|
390
|
+
problem: buildProblem("client.timeout", { seconds: limitMs / 1000 }),
|
|
391
|
+
});
|
|
379
392
|
}
|
|
380
393
|
/**
|
|
381
394
|
* What to do when the upload may have been stored: the grant itself tells, on a retry. A
|
|
@@ -466,7 +479,7 @@ function storageTarget(grant, label) {
|
|
|
466
479
|
target.password !== "") {
|
|
467
480
|
throw new UploadTransportError(`Upload of "${label}" was not sent: the grant says the file is not stored yet, and its ` +
|
|
468
481
|
"url is not an absolute http(s) URL free of user info, so it is not the one " +
|
|
469
|
-
"requestUploadGrant returned. Pass the grant on unchanged.", {
|
|
482
|
+
"requestUploadGrant returned. Pass the grant on unchanged.", { reason: "invalid_grant_url" });
|
|
470
483
|
}
|
|
471
484
|
return { href: grant.url, origin: target.origin };
|
|
472
485
|
}
|
|
@@ -520,7 +533,7 @@ function classifyRefusal(status, refusal, grant) {
|
|
|
520
533
|
// A grant that names its bytes never gets here with a 412: the object it names is the file.
|
|
521
534
|
if (status === 412) {
|
|
522
535
|
return {
|
|
523
|
-
|
|
536
|
+
reason: "grant_used",
|
|
524
537
|
advice: "this grant was already used. A grant that does not name the file by its bytes " +
|
|
525
538
|
"writes one object, once. If an earlier attempt with it failed at storage, that " +
|
|
526
539
|
"attempt may have stored the file under the grant's URI; otherwise request a new grant.",
|
|
@@ -528,7 +541,7 @@ function classifyRefusal(status, refusal, grant) {
|
|
|
528
541
|
}
|
|
529
542
|
if (refusal.code === "BadDigest") {
|
|
530
543
|
return {
|
|
531
|
-
|
|
544
|
+
reason: "store_refused",
|
|
532
545
|
advice: "the file's bytes differ from the ones whose SHA-256 the grant was requested with. " +
|
|
533
546
|
"Send exactly the file the grant was requested for, or describe the file again and " +
|
|
534
547
|
"request a new grant.",
|
|
@@ -536,26 +549,26 @@ function classifyRefusal(status, refusal, grant) {
|
|
|
536
549
|
}
|
|
537
550
|
if (refusal.code === "SignatureDoesNotMatch") {
|
|
538
551
|
return {
|
|
539
|
-
|
|
552
|
+
reason: "signature_mismatch",
|
|
540
553
|
advice: "the file's size, content type or metadata differ from what the grant signed. Send " +
|
|
541
554
|
"exactly the file the grant was requested for, with the grant's headers unchanged.",
|
|
542
555
|
};
|
|
543
556
|
}
|
|
544
557
|
if (refusal.message && /expired/i.test(refusal.message)) {
|
|
545
558
|
return {
|
|
546
|
-
|
|
559
|
+
reason: "grant_expired",
|
|
547
560
|
advice: `the grant expired${grant.expires_at ? ` at ${grant.expires_at}` : ""}. Request a new grant.`,
|
|
548
561
|
};
|
|
549
562
|
}
|
|
550
563
|
if (refusal.message && /not signed/i.test(refusal.message)) {
|
|
551
564
|
return {
|
|
552
|
-
|
|
565
|
+
reason: "unsigned_header",
|
|
553
566
|
advice: "the request carried a header the grant did not sign. Send the grant's headers and " +
|
|
554
567
|
"no other storage header.",
|
|
555
568
|
};
|
|
556
569
|
}
|
|
557
570
|
return {
|
|
558
|
-
|
|
571
|
+
reason: "store_refused",
|
|
559
572
|
advice: refusal.message ??
|
|
560
573
|
"request a new grant, or check the file against the one it was requested for.",
|
|
561
574
|
};
|