@vertesia/client 1.6.0-dev.20261022.120426Z → 1.7.0-dev.20261120.100641Z
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/lib/AccountApi.d.ts +2 -0
- package/lib/AccountApi.d.ts.map +1 -1
- package/lib/AccountApi.js +3 -0
- package/lib/AccountApi.js.map +1 -1
- package/lib/AccountRolesApi.d.ts +11 -0
- package/lib/AccountRolesApi.d.ts.map +1 -0
- package/lib/AccountRolesApi.js +22 -0
- package/lib/AccountRolesApi.js.map +1 -0
- package/lib/AppsApi.d.ts +18 -3
- package/lib/AppsApi.d.ts.map +1 -1
- package/lib/AppsApi.js +34 -4
- package/lib/AppsApi.js.map +1 -1
- package/lib/AuditTrailApi.d.ts +6 -1
- package/lib/AuditTrailApi.d.ts.map +1 -1
- package/lib/AuditTrailApi.js +8 -0
- package/lib/AuditTrailApi.js.map +1 -1
- package/lib/EnvironmentsApi.d.ts +2 -2
- package/lib/EnvironmentsApi.d.ts.map +1 -1
- package/lib/IamApi.d.ts +1 -1
- package/lib/IamApi.js +1 -1
- package/lib/InteractionCatalogApi.d.ts +19 -1
- package/lib/InteractionCatalogApi.d.ts.map +1 -1
- package/lib/InteractionCatalogApi.js +30 -0
- package/lib/InteractionCatalogApi.js.map +1 -1
- package/lib/InteractionsApi.d.ts +3 -12
- package/lib/InteractionsApi.d.ts.map +1 -1
- package/lib/InteractionsApi.js +2 -23
- package/lib/InteractionsApi.js.map +1 -1
- package/lib/OAuthClientsApi.d.ts +3 -1
- package/lib/OAuthClientsApi.d.ts.map +1 -1
- package/lib/OAuthClientsApi.js +4 -0
- package/lib/OAuthClientsApi.js.map +1 -1
- package/lib/OAuthProvidersApi.d.ts +6 -2
- package/lib/OAuthProvidersApi.d.ts.map +1 -1
- package/lib/OAuthProvidersApi.js +6 -2
- package/lib/OAuthProvidersApi.js.map +1 -1
- package/lib/RemoteMcpConnectionsApi.d.ts +5 -1
- package/lib/RemoteMcpConnectionsApi.d.ts.map +1 -1
- package/lib/RemoteMcpConnectionsApi.js +6 -2
- package/lib/RemoteMcpConnectionsApi.js.map +1 -1
- package/lib/StreamSource.d.ts +19 -1
- package/lib/StreamSource.d.ts.map +1 -1
- package/lib/StreamSource.js +31 -1
- package/lib/StreamSource.js.map +1 -1
- package/lib/UsersApi.d.ts +7 -1
- package/lib/UsersApi.d.ts.map +1 -1
- package/lib/UsersApi.js +8 -0
- package/lib/UsersApi.js.map +1 -1
- package/lib/client.d.ts +14 -2
- package/lib/client.d.ts.map +1 -1
- package/lib/client.js +57 -8
- package/lib/client.js.map +1 -1
- package/lib/execute.d.ts.map +1 -1
- package/lib/execute.js +4 -2
- package/lib/execute.js.map +1 -1
- package/lib/idempotency-key.d.ts +19 -0
- package/lib/idempotency-key.d.ts.map +1 -0
- package/lib/idempotency-key.js +34 -0
- package/lib/idempotency-key.js.map +1 -0
- package/lib/nodejs/NodeStreamSource.d.ts +10 -1
- package/lib/nodejs/NodeStreamSource.d.ts.map +1 -1
- package/lib/nodejs/NodeStreamSource.js +40 -2
- package/lib/nodejs/NodeStreamSource.js.map +1 -1
- package/lib/store/AgentsApi.d.ts.map +1 -1
- package/lib/store/AgentsApi.js +5 -2
- package/lib/store/AgentsApi.js.map +1 -1
- package/lib/store/ContentSourcesApi.d.ts +57 -0
- package/lib/store/ContentSourcesApi.d.ts.map +1 -0
- package/lib/store/ContentSourcesApi.js +92 -0
- package/lib/store/ContentSourcesApi.js.map +1 -0
- package/lib/store/CostApi.d.ts +9 -1
- package/lib/store/CostApi.d.ts.map +1 -1
- package/lib/store/CostApi.js +16 -0
- package/lib/store/CostApi.js.map +1 -1
- package/lib/store/DashboardApi.d.ts +61 -19
- package/lib/store/DashboardApi.d.ts.map +1 -1
- package/lib/store/DashboardApi.js +75 -19
- package/lib/store/DashboardApi.js.map +1 -1
- package/lib/store/DataApi.d.ts +9 -9
- package/lib/store/DataApi.d.ts.map +1 -1
- package/lib/store/DataApi.js +14 -10
- package/lib/store/DataApi.js.map +1 -1
- package/lib/store/FilesApi.d.ts +15 -1
- package/lib/store/FilesApi.d.ts.map +1 -1
- package/lib/store/FilesApi.js +54 -75
- package/lib/store/FilesApi.js.map +1 -1
- package/lib/store/NotificationsApi.d.ts +39 -0
- package/lib/store/NotificationsApi.d.ts.map +1 -0
- package/lib/store/NotificationsApi.js +68 -0
- package/lib/store/NotificationsApi.js.map +1 -0
- package/lib/store/ObjectsApi.d.ts +6 -1
- package/lib/store/ObjectsApi.d.ts.map +1 -1
- package/lib/store/ObjectsApi.js +23 -30
- package/lib/store/ObjectsApi.js.map +1 -1
- package/lib/store/RenderingApi.d.ts.map +1 -1
- package/lib/store/RenderingApi.js +1 -0
- package/lib/store/RenderingApi.js.map +1 -1
- package/lib/store/WorkflowsApi.d.ts +19 -1
- package/lib/store/WorkflowsApi.d.ts.map +1 -1
- package/lib/store/WorkflowsApi.js +21 -0
- package/lib/store/WorkflowsApi.js.map +1 -1
- package/lib/store/chunked-upload.d.ts +71 -0
- package/lib/store/chunked-upload.d.ts.map +1 -0
- package/lib/store/chunked-upload.js +206 -0
- package/lib/store/chunked-upload.js.map +1 -0
- package/lib/store/client.d.ts +9 -1
- package/lib/store/client.d.ts.map +1 -1
- package/lib/store/client.js +17 -1
- package/lib/store/client.js.map +1 -1
- package/lib/store/index.d.ts +3 -0
- package/lib/store/index.d.ts.map +1 -1
- package/lib/store/index.js +3 -0
- package/lib/store/index.js.map +1 -1
- package/lib/store/node-request.browser.d.ts +14 -0
- package/lib/store/node-request.browser.d.ts.map +1 -0
- package/lib/store/node-request.browser.js +20 -0
- package/lib/store/node-request.browser.js.map +1 -0
- package/lib/store/node-request.d.ts +20 -0
- package/lib/store/node-request.d.ts.map +1 -0
- package/lib/store/node-request.js +116 -0
- package/lib/store/node-request.js.map +1 -0
- package/lib/store/node-sessions.browser.d.ts +3 -0
- package/lib/store/node-sessions.browser.d.ts.map +1 -0
- package/lib/store/node-sessions.browser.js +15 -0
- package/lib/store/node-sessions.browser.js.map +1 -0
- package/lib/store/node-sessions.d.ts +14 -0
- package/lib/store/node-sessions.d.ts.map +1 -0
- package/lib/store/node-sessions.js +88 -0
- package/lib/store/node-sessions.js.map +1 -0
- package/lib/store/signed-url.d.ts +12 -16
- package/lib/store/signed-url.d.ts.map +1 -1
- package/lib/store/signed-url.js +111 -71
- package/lib/store/signed-url.js.map +1 -1
- package/lib/store/stream-bytes.d.ts +16 -0
- package/lib/store/stream-bytes.d.ts.map +1 -0
- package/lib/store/stream-bytes.js +70 -0
- package/lib/store/stream-bytes.js.map +1 -0
- package/lib/store/stream-termination.d.ts.map +1 -1
- package/lib/store/stream-termination.js +17 -16
- package/lib/store/stream-termination.js.map +1 -1
- package/lib/store/upload-body.d.ts +21 -0
- package/lib/store/upload-body.d.ts.map +1 -0
- package/lib/store/upload-body.js +32 -0
- package/lib/store/upload-body.js.map +1 -0
- package/lib/store/upload-content.d.ts +21 -0
- package/lib/store/upload-content.d.ts.map +1 -0
- package/lib/store/upload-content.js +113 -0
- package/lib/store/upload-content.js.map +1 -0
- package/lib/store/upload-runtime.d.ts +21 -0
- package/lib/store/upload-runtime.d.ts.map +1 -0
- package/lib/store/upload-runtime.js +40 -0
- package/lib/store/upload-runtime.js.map +1 -0
- package/lib/user-agent.d.ts +11 -0
- package/lib/user-agent.d.ts.map +1 -0
- package/lib/user-agent.js +35 -0
- package/lib/user-agent.js.map +1 -0
- package/lib/vertesia-client.js +10 -9
- package/lib/vertesia-client.js.map +1 -1
- package/package.json +35 -11
- package/src/AccountApi.ts +3 -0
- package/src/AccountRolesApi.ts +29 -0
- package/src/AppsApi.ts +58 -4
- package/src/AuditTrailApi.ts +11 -0
- package/src/EnvironmentsApi.ts +2 -2
- package/src/IamApi.ts +1 -1
- package/src/InteractionCatalogApi.ts +44 -1
- package/src/InteractionsApi.ts +2 -31
- package/src/OAuthClientsApi.ts +6 -0
- package/src/OAuthProvidersApi.ts +7 -2
- package/src/RemoteMcpConnectionsApi.ts +7 -3
- package/src/StreamSource.ts +29 -0
- package/src/UsersApi.ts +10 -1
- package/src/client.ts +74 -8
- package/src/execute.ts +4 -2
- package/src/idempotency-key.ts +34 -0
- package/src/nodejs/NodeStreamSource.ts +37 -2
- package/src/store/AgentsApi.ts +5 -2
- package/src/store/ContentSourcesApi.ts +135 -0
- package/src/store/CostApi.ts +24 -0
- package/src/store/DashboardApi.ts +93 -18
- package/src/store/DataApi.ts +14 -10
- package/src/store/FilesApi.ts +84 -78
- package/src/store/NotificationsApi.ts +103 -0
- package/src/store/ObjectsApi.ts +30 -34
- package/src/store/RenderingApi.ts +1 -0
- package/src/store/WorkflowsApi.ts +25 -0
- package/src/store/chunked-upload.ts +272 -0
- package/src/store/client.ts +23 -1
- package/src/store/index.ts +3 -0
- package/src/store/node-request.browser.ts +22 -0
- package/src/store/node-request.ts +120 -0
- package/src/store/node-sessions.browser.ts +16 -0
- package/src/store/node-sessions.ts +109 -0
- package/src/store/signed-url.ts +126 -72
- package/src/store/stream-bytes.ts +79 -0
- package/src/store/stream-termination.ts +24 -24
- package/src/store/upload-body.ts +37 -0
- package/src/store/upload-content.ts +129 -0
- package/src/store/upload-runtime.ts +42 -0
- package/src/user-agent.ts +41 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signed-url.d.ts","sourceRoot":"","sources":["../../src/store/signed-url.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"signed-url.d.ts","sourceRoot":"","sources":["../../src/store/signed-url.ts"],"names":[],"mappings":"AAsCA,2EAA2E;AAC3E,eAAO,MAAM,yBAAyB,QAAmB,CAAC;AAE1D,MAAM,WAAW,qBAAqB;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,IAAI,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IACvB,oEAAoE;IACpE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4EAA4E;IAC5E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4GAA4G;IAC5G,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,sEAAsE;IACtE,iBAAiB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC3C;AAKD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAOnD;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAClC,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACjC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAIpC;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAO1D;AAkGD;;;;;;;;;;;;GAYG;AACH,wBAAsB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,qBAA0B,GAAG,OAAO,CAAC,QAAQ,CAAC,CA+DxG"}
|
package/lib/store/signed-url.js
CHANGED
|
@@ -9,21 +9,42 @@
|
|
|
9
9
|
* restores retry behaviour for those storage hops.
|
|
10
10
|
*
|
|
11
11
|
* Note on streamed bodies: a `ReadableStream` body cannot be replayed once it has
|
|
12
|
-
* been consumed
|
|
13
|
-
* retries
|
|
14
|
-
* memory
|
|
12
|
+
* been consumed. Up to {@link MAX_BUFFERED_STREAM_BYTES} of it is buffered so that
|
|
13
|
+
* small bodies keep their retries. In Node.js, a longer stream is never held whole in
|
|
14
|
+
* memory: where the storage service accepts a body of unknown length it is sent once,
|
|
15
|
+
* as a stream, without retries (see {@link acceptsStreamedUpload}). Send a `Blob` backed
|
|
16
|
+
* by a local file (Node's `fs.openAsBlob`) to keep retries for large files without a
|
|
17
|
+
* copy in memory. A browser buffers a stream whole, as most browsers cannot send one.
|
|
18
|
+
*
|
|
19
|
+
* A stream whose length the caller declares in a `Content-Length` header is, in Node.js,
|
|
20
|
+
* streamed with that length to any service, and fails if it ends short of it or runs
|
|
21
|
+
* past it.
|
|
22
|
+
*
|
|
23
|
+
* In Node.js, a body over that size, or a streamed one, is sent with Node's `http`
|
|
24
|
+
* client rather than `fetch`, which holds a streamed request body in memory until the
|
|
25
|
+
* request completes (see {@link nodeRequest}).
|
|
15
26
|
*/
|
|
27
|
+
import { hasNodeHttp, nodeRequest } from './node-request.js';
|
|
28
|
+
import { chunkToBlobPart, continueStream } from './stream-bytes.js';
|
|
29
|
+
import { ContentLengthMismatchError, contentLengthHeader } from './upload-runtime.js';
|
|
16
30
|
/** HTTP statuses that storage backends return for transient, retryable conditions. */
|
|
17
31
|
const DEFAULT_RETRYABLE_STATUSES = new Set([429, 500, 502, 503, 504]);
|
|
18
32
|
const DEFAULT_ATTEMPTS = 4;
|
|
19
33
|
const DEFAULT_BASE_DELAY_MS = 500;
|
|
20
34
|
const DEFAULT_MAX_DELAY_MS = 8_000;
|
|
21
35
|
const MAX_RETRY_AFTER_MS = 60_000;
|
|
22
|
-
|
|
23
|
-
|
|
36
|
+
/** The most of a stream body that is buffered to allow retries: 16 MiB. */
|
|
37
|
+
export const MAX_BUFFERED_STREAM_BYTES = 16 * 1024 * 1024;
|
|
38
|
+
/** Blob Storage host suffixes of the public Azure cloud and Azure Government. */
|
|
39
|
+
const AZURE_BLOB_HOST_SUFFIXES = ['.blob.core.windows.net', '.blob.core.usgovcloudapi.net'];
|
|
40
|
+
/**
|
|
41
|
+
* Whether a signed URL points at Azure Blob Storage: a SAS URL on `<account>.blob.core.windows.net`, or
|
|
42
|
+
* `<account>.blob.core.usgovcloudapi.net` in Azure Government.
|
|
43
|
+
*/
|
|
24
44
|
export function isAzureBlobUrl(url) {
|
|
25
45
|
try {
|
|
26
|
-
|
|
46
|
+
const hostname = new URL(url).hostname.toLowerCase();
|
|
47
|
+
return AZURE_BLOB_HOST_SUFFIXES.some((suffix) => hostname.endsWith(suffix));
|
|
27
48
|
}
|
|
28
49
|
catch {
|
|
29
50
|
return false;
|
|
@@ -43,6 +64,28 @@ export function signedUrlUploadHeaders(url, headers) {
|
|
|
43
64
|
return headers;
|
|
44
65
|
return { ...headers, 'x-ms-blob-type': 'BlockBlob' };
|
|
45
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Whether a signed URL's storage service accepts an upload of unknown length, sent with chunked transfer encoding
|
|
69
|
+
* and no `Content-Length`. Google Cloud Storage does; Amazon S3 (`MissingContentLength`) and Azure Blob Storage
|
|
70
|
+
* (411 Length Required) need the length up front.
|
|
71
|
+
*/
|
|
72
|
+
export function acceptsStreamedUpload(url) {
|
|
73
|
+
try {
|
|
74
|
+
const hostname = new URL(url).hostname.toLowerCase();
|
|
75
|
+
return hostname === 'storage.googleapis.com' || hostname.endsWith('.storage.googleapis.com');
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function isStream(body) {
|
|
82
|
+
return typeof ReadableStream !== 'undefined' && body instanceof ReadableStream;
|
|
83
|
+
}
|
|
84
|
+
function withoutContentLength(headers) {
|
|
85
|
+
if (!headers)
|
|
86
|
+
return headers;
|
|
87
|
+
return Object.fromEntries(Object.entries(headers).filter(([name]) => name.toLowerCase() !== 'content-length'));
|
|
88
|
+
}
|
|
46
89
|
function sleep(ms) {
|
|
47
90
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
48
91
|
}
|
|
@@ -70,75 +113,52 @@ function backoffMs(attempt, baseDelayMs, maxDelayMs, res) {
|
|
|
70
113
|
const capped = Math.min(maxDelayMs, baseDelayMs * 2 ** attempt);
|
|
71
114
|
return Math.floor(Math.random() * capped);
|
|
72
115
|
}
|
|
73
|
-
const textEncoder = new TextEncoder();
|
|
74
116
|
/**
|
|
75
|
-
*
|
|
117
|
+
* Make a body safe to send. Bodies other than a `ReadableStream` (`Blob`/`File`, `ArrayBuffer`, typed arrays,
|
|
118
|
+
* strings, `URLSearchParams`) are already replayable and pass through unchanged.
|
|
76
119
|
*
|
|
77
|
-
* A
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
* "TypeError: Received non-Uint8Array chunk", which breaks every signed-URL upload of
|
|
81
|
-
* a text/JSON body (extracted text previews, agent artifacts, tool storage). Encoding
|
|
82
|
-
* chunks ourselves keeps both string and binary bodies uploadable.
|
|
83
|
-
*/
|
|
84
|
-
function chunkToBlobPart(chunk) {
|
|
85
|
-
if (typeof chunk === 'string') {
|
|
86
|
-
return textEncoder.encode(chunk);
|
|
87
|
-
}
|
|
88
|
-
if (chunk instanceof Blob) {
|
|
89
|
-
return chunk;
|
|
90
|
-
}
|
|
91
|
-
if (chunk instanceof ArrayBuffer) {
|
|
92
|
-
return new Uint8Array(chunk);
|
|
93
|
-
}
|
|
94
|
-
// Covers Uint8Array and every other typed-array / DataView view.
|
|
95
|
-
if (ArrayBuffer.isView(chunk)) {
|
|
96
|
-
return new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength);
|
|
97
|
-
}
|
|
98
|
-
// Fail loud rather than uploading e.g. "[object Object]" from an accidental
|
|
99
|
-
// object-mode stream — silently corrupting the stored content is worse than a clear error.
|
|
100
|
-
throw new TypeError(`Unsupported signed-URL upload chunk of type "${typeof chunk}"; ` +
|
|
101
|
-
`body streams must yield string or binary (Uint8Array/ArrayBuffer/DataView/Blob) chunks.`);
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Buffer a `ReadableStream` body into a `Blob` so the request can be safely
|
|
105
|
-
* replayed across retries. Other body types (`Blob`/`File`, `ArrayBuffer`,
|
|
106
|
-
* typed arrays, strings, `URLSearchParams`) are already replayable and pass
|
|
107
|
-
* through unchanged.
|
|
120
|
+
* A stream is read until it ends or passes `maxBufferedBytes`. A stream that ends first is returned as a `Blob`, so
|
|
121
|
+
* it can be retried. A longer one is returned as a stream that yields the bytes read so far and then the rest,
|
|
122
|
+
* unless `bufferWhole` is set, in which case the rest is buffered too.
|
|
108
123
|
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
124
|
+
* Chunks are normalized one by one (rather than `new Response(stream).blob()`) so that string chunks are encoded to
|
|
125
|
+
* bytes — see {@link chunkToBlobPart}.
|
|
111
126
|
*/
|
|
112
|
-
async function
|
|
127
|
+
async function prepareBody(body, maxBufferedBytes, bufferWhole) {
|
|
113
128
|
if (body == null) {
|
|
114
|
-
return undefined;
|
|
129
|
+
return { body: undefined, replayable: true };
|
|
115
130
|
}
|
|
116
|
-
if (typeof ReadableStream
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
// chunkToBlobPart) so a malformed stream fails loudly instead of
|
|
127
|
-
// silently uploading a truncated body.
|
|
128
|
-
parts.push(chunkToBlobPart(value));
|
|
131
|
+
if (typeof ReadableStream === 'undefined' || !(body instanceof ReadableStream)) {
|
|
132
|
+
return { body, replayable: true };
|
|
133
|
+
}
|
|
134
|
+
const reader = body.getReader();
|
|
135
|
+
const parts = [];
|
|
136
|
+
let buffered = 0;
|
|
137
|
+
try {
|
|
138
|
+
for (;;) {
|
|
139
|
+
if (!bufferWhole && buffered > maxBufferedBytes) {
|
|
140
|
+
return { body: continueStream(parts, reader), replayable: false };
|
|
129
141
|
}
|
|
142
|
+
const { done, value } = await reader.read();
|
|
143
|
+
if (done) {
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
// Normalize every chunk (a stray null/undefined is rejected by
|
|
147
|
+
// chunkToBlobPart) so a malformed stream fails loudly instead of
|
|
148
|
+
// silently uploading a truncated body.
|
|
149
|
+
const part = chunkToBlobPart(value);
|
|
150
|
+
parts.push(part);
|
|
151
|
+
buffered += part instanceof Blob ? part.size : part.byteLength;
|
|
130
152
|
}
|
|
131
|
-
catch (err) {
|
|
132
|
-
// Signal the producer to stop and release its resources before propagating.
|
|
133
|
-
await reader.cancel(err).catch(() => undefined);
|
|
134
|
-
throw err;
|
|
135
|
-
}
|
|
136
|
-
finally {
|
|
137
|
-
reader.releaseLock();
|
|
138
|
-
}
|
|
139
|
-
return new Blob(parts);
|
|
140
153
|
}
|
|
141
|
-
|
|
154
|
+
catch (err) {
|
|
155
|
+
// Signal the producer to stop and release its resources before propagating.
|
|
156
|
+
await reader.cancel(err).catch(() => undefined);
|
|
157
|
+
reader.releaseLock();
|
|
158
|
+
throw err;
|
|
159
|
+
}
|
|
160
|
+
reader.releaseLock();
|
|
161
|
+
return { body: new Blob(parts), replayable: true };
|
|
142
162
|
}
|
|
143
163
|
/**
|
|
144
164
|
* `fetch()` a cloud-storage signed URL, retrying transient failures (connection
|
|
@@ -155,13 +175,33 @@ async function toReplayableBody(body) {
|
|
|
155
175
|
*/
|
|
156
176
|
export async function fetchSignedUrl(url, options = {}) {
|
|
157
177
|
const { method = 'GET', headers, attempts = DEFAULT_ATTEMPTS, baseDelayMs = DEFAULT_BASE_DELAY_MS, maxDelayMs = DEFAULT_MAX_DELAY_MS, retryableStatuses = DEFAULT_RETRYABLE_STATUSES, } = options;
|
|
158
|
-
|
|
159
|
-
|
|
178
|
+
// In Node.js, a stream longer than the buffer is sent once as a stream where that works: to a service that
|
|
179
|
+
// accepts a body of unknown length, or with the length the caller declared. Elsewhere it is still buffered
|
|
180
|
+
// whole: S3 and Azure reject a body without a length, and browsers can neither set one nor, in most of them,
|
|
181
|
+
// send a stream at all.
|
|
182
|
+
const declaredLength = isStream(options.body) ? contentLengthHeader(headers) : undefined;
|
|
183
|
+
const streamable = hasNodeHttp() && (acceptsStreamedUpload(url) || declaredLength !== undefined);
|
|
184
|
+
const { body, replayable } = await prepareBody(options.body, MAX_BUFFERED_STREAM_BYTES, !streamable);
|
|
185
|
+
let sendHeaders = headers;
|
|
186
|
+
if (declaredLength !== undefined && body instanceof Blob) {
|
|
187
|
+
if (body.size !== declaredLength) {
|
|
188
|
+
throw new ContentLengthMismatchError(declaredLength, body.size, body.size < declaredLength ? 'short' : 'long');
|
|
189
|
+
}
|
|
190
|
+
// the buffered body sets its own length
|
|
191
|
+
sendHeaders = withoutContentLength(headers);
|
|
192
|
+
}
|
|
193
|
+
const requestHeaders = method.toUpperCase() === 'PUT' ? signedUrlUploadHeaders(url, sendHeaders) : sendHeaders;
|
|
194
|
+
const maxAttempts = replayable ? attempts : 1;
|
|
195
|
+
// Only Node.js streams a body (`streamable`), and always with Node's http client, so fetch only gets buffered ones.
|
|
196
|
+
const large = !replayable || (body instanceof Blob && body.size > MAX_BUFFERED_STREAM_BYTES);
|
|
197
|
+
const send = large && hasNodeHttp()
|
|
198
|
+
? () => nodeRequest(url, { method, headers: requestHeaders, body: body })
|
|
199
|
+
: () => fetch(url, { method, headers: requestHeaders, body });
|
|
160
200
|
let lastError;
|
|
161
|
-
for (let attempt = 0; attempt <
|
|
162
|
-
const isLastAttempt = attempt ===
|
|
201
|
+
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
202
|
+
const isLastAttempt = attempt === maxAttempts - 1;
|
|
163
203
|
try {
|
|
164
|
-
const res = await
|
|
204
|
+
const res = await send();
|
|
165
205
|
if (res.ok || !retryableStatuses.has(res.status) || isLastAttempt) {
|
|
166
206
|
return res;
|
|
167
207
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signed-url.js","sourceRoot":"","sources":["../../src/store/signed-url.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"signed-url.js","sourceRoot":"","sources":["../../src/store/signed-url.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAEtF,sFAAsF;AACtF,MAAM,0BAA0B,GAAwB,IAAI,GAAG,CAA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AAC;IACL,CAAC;IAED,iFAAiF;IACjF,MAAM,SAAS,YAAY,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,+BAA+B,GAAG,EAAE,CAAC,CAAC;AACnG,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Byte handling for upload bodies read from a `ReadableStream`. Internal: not exported from the package. */
|
|
2
|
+
/**
|
|
3
|
+
* Normalize one `ReadableStream` chunk to a byte-backed `BlobPart`.
|
|
4
|
+
*
|
|
5
|
+
* A web stream produced from a Node `Readable.from(<string>)` (e.g. via
|
|
6
|
+
* `Readable.toWeb`, which `NodeStreamSource` uses) yields *string* chunks. Buffering
|
|
7
|
+
* such a stream with `new Response(stream).blob()` throws under undici with
|
|
8
|
+
* "TypeError: Received non-Uint8Array chunk", which breaks every signed-URL upload of
|
|
9
|
+
* a text/JSON body (extracted text previews, agent artifacts, tool storage). Encoding
|
|
10
|
+
* chunks ourselves keeps both string and binary bodies uploadable.
|
|
11
|
+
*/
|
|
12
|
+
export declare function chunkToBlobPart(chunk: unknown): BlobPart;
|
|
13
|
+
/** A byte stream of `head`, the parts already read, then what is left in `reader`. */
|
|
14
|
+
export declare function continueStream(head: BlobPart[], reader: ReadableStreamDefaultReader<unknown>): ReadableStream<Uint8Array>;
|
|
15
|
+
export declare function partToBytes(part: BlobPart): Promise<Uint8Array>;
|
|
16
|
+
//# sourceMappingURL=stream-bytes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream-bytes.d.ts","sourceRoot":"","sources":["../../src/store/stream-bytes.ts"],"names":[],"mappings":"AAAA,6GAA6G;AAI7G;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,CAoBxD;AAED,sFAAsF;AACtF,wBAAgB,cAAc,CAC1B,IAAI,EAAE,QAAQ,EAAE,EAChB,MAAM,EAAE,2BAA2B,CAAC,OAAO,CAAC,GAC7C,cAAc,CAAC,UAAU,CAAC,CAkC5B;AAED,wBAAsB,WAAW,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAErE"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/** Byte handling for upload bodies read from a `ReadableStream`. Internal: not exported from the package. */
|
|
2
|
+
const textEncoder = new TextEncoder();
|
|
3
|
+
/**
|
|
4
|
+
* Normalize one `ReadableStream` chunk to a byte-backed `BlobPart`.
|
|
5
|
+
*
|
|
6
|
+
* A web stream produced from a Node `Readable.from(<string>)` (e.g. via
|
|
7
|
+
* `Readable.toWeb`, which `NodeStreamSource` uses) yields *string* chunks. Buffering
|
|
8
|
+
* such a stream with `new Response(stream).blob()` throws under undici with
|
|
9
|
+
* "TypeError: Received non-Uint8Array chunk", which breaks every signed-URL upload of
|
|
10
|
+
* a text/JSON body (extracted text previews, agent artifacts, tool storage). Encoding
|
|
11
|
+
* chunks ourselves keeps both string and binary bodies uploadable.
|
|
12
|
+
*/
|
|
13
|
+
export function chunkToBlobPart(chunk) {
|
|
14
|
+
if (typeof chunk === 'string') {
|
|
15
|
+
return textEncoder.encode(chunk);
|
|
16
|
+
}
|
|
17
|
+
if (chunk instanceof Blob) {
|
|
18
|
+
return chunk;
|
|
19
|
+
}
|
|
20
|
+
if (chunk instanceof ArrayBuffer) {
|
|
21
|
+
return new Uint8Array(chunk);
|
|
22
|
+
}
|
|
23
|
+
// Covers Uint8Array and every other typed-array / DataView view.
|
|
24
|
+
if (ArrayBuffer.isView(chunk)) {
|
|
25
|
+
return new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength);
|
|
26
|
+
}
|
|
27
|
+
// Fail loud rather than uploading e.g. "[object Object]" from an accidental
|
|
28
|
+
// object-mode stream — silently corrupting the stored content is worse than a clear error.
|
|
29
|
+
throw new TypeError(`Unsupported signed-URL upload chunk of type "${typeof chunk}"; ` +
|
|
30
|
+
`body streams must yield string or binary (Uint8Array/ArrayBuffer/DataView/Blob) chunks.`);
|
|
31
|
+
}
|
|
32
|
+
/** A byte stream of `head`, the parts already read, then what is left in `reader`. */
|
|
33
|
+
export function continueStream(head, reader) {
|
|
34
|
+
const pending = [...head];
|
|
35
|
+
return new ReadableStream({
|
|
36
|
+
async pull(controller) {
|
|
37
|
+
const next = pending.shift();
|
|
38
|
+
if (next !== undefined) {
|
|
39
|
+
controller.enqueue(await partToBytes(next));
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
const { done, value } = await reader.read();
|
|
44
|
+
if (done) {
|
|
45
|
+
reader.releaseLock();
|
|
46
|
+
controller.close();
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
controller.enqueue(await partToBytes(chunkToBlobPart(value)));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
// An error in pull errors this stream without calling cancel, so the source is cancelled here.
|
|
54
|
+
pending.length = 0;
|
|
55
|
+
await reader.cancel(err).catch(() => undefined);
|
|
56
|
+
reader.releaseLock();
|
|
57
|
+
throw err;
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
async cancel(reason) {
|
|
61
|
+
pending.length = 0;
|
|
62
|
+
await reader.cancel(reason);
|
|
63
|
+
reader.releaseLock();
|
|
64
|
+
},
|
|
65
|
+
}, { highWaterMark: 0 });
|
|
66
|
+
}
|
|
67
|
+
export async function partToBytes(part) {
|
|
68
|
+
return part instanceof Blob ? new Uint8Array(await part.arrayBuffer()) : part;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=stream-bytes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream-bytes.js","sourceRoot":"","sources":["../../src/store/stream-bytes.ts"],"names":[],"mappings":"AAAA,6GAA6G;AAE7G,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;AAEtC;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAAC,KAAc;IAC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BACJ,UAAU,CAAC,OAAO,CAAC,MAAM,WAAW,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBAClE,CAAC;YACL,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACX,+FAA+F;gBAC/F,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;gBACnB,MAAM,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;gBAChD,MAAM,CAAC,WAAW,EAAE,CAAC;gBACrB,MAAM,GAAG,CAAC;YACd,CAAC;QACL,CAAC;QACD,KAAK,CAAC,MAAM,CAAC,MAAM;YACf,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;YACnB,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAC5B,MAAM,CAAC,WAAW,EAAE,CAAC;QACzB,CAAC;KACJ,EACD,EAAE,aAAa,EAAE,CAAC,EAAE,CACvB,CAAC;AACN,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,IAAc;IAC5C,OAAO,IAAI,YAAY,IAAI,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAE,IAAmB,CAAC;AAClG,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream-termination.d.ts","sourceRoot":"","sources":["../../src/store/stream-termination.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAoB,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"stream-termination.d.ts","sourceRoot":"","sources":["../../src/store/stream-termination.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAoB,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AA+B5F,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,UAAQ,GAAG,OAAO,CAMhH;AAED,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,UAAQ,GAAG,OAAO,CAMpH"}
|
|
@@ -10,24 +10,25 @@ function isRootProcessMessage(details, rootRunId) {
|
|
|
10
10
|
const processRunId = readProcessRunId(details);
|
|
11
11
|
return !processRunId || processRunId === rootRunId;
|
|
12
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Only the main workstream's COMPLETE or TERMINATED ends the run (and IDLE when `closeOnIdle` is set).
|
|
15
|
+
* Sub-agents publish their own COMPLETE and TERMINATED on the parent's channel under their own
|
|
16
|
+
* workstream id, and child process runs publish theirs with a different `process_run_id`; neither
|
|
17
|
+
* ends the root run.
|
|
18
|
+
*/
|
|
19
|
+
function isRunEndType(type, closeOnIdle) {
|
|
20
|
+
return (type === AgentMessageType.COMPLETE ||
|
|
21
|
+
type === AgentMessageType.TERMINATED ||
|
|
22
|
+
(closeOnIdle && type === AgentMessageType.IDLE));
|
|
23
|
+
}
|
|
13
24
|
export function shouldCloseAgentRunStream(message, rootRunId, closeOnIdle = false) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
if ((message.type === AgentMessageType.COMPLETE || (closeOnIdle && message.type === AgentMessageType.IDLE)) &&
|
|
18
|
-
(message.workstream_id ?? 'main') === 'main') {
|
|
19
|
-
return isRootProcessMessage(message.details, rootRunId);
|
|
20
|
-
}
|
|
21
|
-
return false;
|
|
25
|
+
return (isRunEndType(message.type, closeOnIdle) &&
|
|
26
|
+
(message.workstream_id ?? 'main') === 'main' &&
|
|
27
|
+
isRootProcessMessage(message.details, rootRunId));
|
|
22
28
|
}
|
|
23
29
|
export function shouldCloseCompactRunStream(message, rootRunId, closeOnIdle = false) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
if ((message.t === AgentMessageType.COMPLETE || (closeOnIdle && message.t === AgentMessageType.IDLE)) &&
|
|
28
|
-
(message.w ?? 'main') === 'main') {
|
|
29
|
-
return isRootProcessMessage(message.d, rootRunId);
|
|
30
|
-
}
|
|
31
|
-
return false;
|
|
30
|
+
return (isRunEndType(message.t, closeOnIdle) &&
|
|
31
|
+
(message.w ?? 'main') === 'main' &&
|
|
32
|
+
isRootProcessMessage(message.d, rootRunId));
|
|
32
33
|
}
|
|
33
34
|
//# sourceMappingURL=stream-termination.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream-termination.js","sourceRoot":"","sources":["../../src/store/stream-termination.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,gBAAgB,EAAuB,MAAM,kBAAkB,CAAC;AAI5F,SAAS,gBAAgB,CAAC,OAAuB;IAC7C,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC1C,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,MAAM,KAAK,GAAI,OAAwC,CAAC,cAAc,CAAC;IACvE,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACzD,CAAC;AAED,SAAS,oBAAoB,CAAC,OAAuB,EAAE,SAAiB;IACpE,MAAM,YAAY,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAC/C,OAAO,CAAC,YAAY,IAAI,YAAY,KAAK,SAAS,CAAC;AACvD,CAAC;AAED,
|
|
1
|
+
{"version":3,"file":"stream-termination.js","sourceRoot":"","sources":["../../src/store/stream-termination.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,gBAAgB,EAAuB,MAAM,kBAAkB,CAAC;AAI5F,SAAS,gBAAgB,CAAC,OAAuB;IAC7C,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC1C,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,MAAM,KAAK,GAAI,OAAwC,CAAC,cAAc,CAAC;IACvE,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACzD,CAAC;AAED,SAAS,oBAAoB,CAAC,OAAuB,EAAE,SAAiB;IACpE,MAAM,YAAY,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAC/C,OAAO,CAAC,YAAY,IAAI,YAAY,KAAK,SAAS,CAAC;AACvD,CAAC;AAED;;;;;GAKG;AACH,SAAS,YAAY,CAAC,IAAsB,EAAE,WAAoB;IAC9D,OAAO,CACH,IAAI,KAAK,gBAAgB,CAAC,QAAQ;QAClC,IAAI,KAAK,gBAAgB,CAAC,UAAU;QACpC,CAAC,WAAW,IAAI,IAAI,KAAK,gBAAgB,CAAC,IAAI,CAAC,CAClD,CAAC;AACN,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,OAAqB,EAAE,SAAiB,EAAE,WAAW,GAAG,KAAK;IACnG,OAAO,CACH,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC;QACvC,CAAC,OAAO,CAAC,aAAa,IAAI,MAAM,CAAC,KAAK,MAAM;QAC5C,oBAAoB,CAAC,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,CACnD,CAAC;AACN,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,OAAuB,EAAE,SAAiB,EAAE,WAAW,GAAG,KAAK;IACvG,OAAO,CACH,YAAY,CAAC,OAAO,CAAC,CAAC,EAAE,WAAW,CAAC;QACpC,CAAC,OAAO,CAAC,CAAC,IAAI,MAAM,CAAC,KAAK,MAAM;QAChC,oBAAoB,CAAC,OAAO,CAAC,CAAC,EAAE,SAAS,CAAC,CAC7C,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { StreamSource } from '../StreamSource.js';
|
|
2
|
+
/** What to send to upload a source: the body, and the declared length of a stream body. */
|
|
3
|
+
export interface UploadBody {
|
|
4
|
+
body: Blob | ReadableStream;
|
|
5
|
+
/** Sent as `Content-Length` with a stream body whose length is known; a `Blob` carries its own. */
|
|
6
|
+
contentLength?: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The request body for uploading a source to a signed URL.
|
|
10
|
+
*
|
|
11
|
+
* A `File` is sent as it is. A stream source with a {@link StreamSource.replayableBody} (e.g. a local file) sends
|
|
12
|
+
* that instead, so a retry re-reads it rather than needing a buffered copy; its stream is cancelled, which releases
|
|
13
|
+
* what the stream holds, such as a file descriptor. Any other stream source sends its stream, with its
|
|
14
|
+
* {@link StreamSource.size} when known.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getUploadBody(source: StreamSource | File): Promise<UploadBody>;
|
|
17
|
+
/** Headers for an upload: the content type, and `Content-Length` when the body declares one. */
|
|
18
|
+
export declare function uploadHeaders(upload: UploadBody, contentType: string | undefined): Record<string, string> | undefined;
|
|
19
|
+
/** An ETag without the quotes HTTP puts around it (RFC 9110), as the upload methods return it. */
|
|
20
|
+
export declare function unquoteEtag(etag: string | undefined): string | undefined;
|
|
21
|
+
//# sourceMappingURL=upload-body.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-body.d.ts","sourceRoot":"","sources":["../../src/store/upload-body.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,2FAA2F;AAC3F,MAAM,WAAW,UAAU;IACvB,IAAI,EAAE,IAAI,GAAG,cAAc,CAAC;IAC5B,mGAAmG;IACnG,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;GAOG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC,CAMpF;AAED,gGAAgG;AAChG,wBAAgB,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAKrH;AAED,kGAAkG;AAClG,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAExE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { StreamSource } from '../StreamSource.js';
|
|
2
|
+
/**
|
|
3
|
+
* The request body for uploading a source to a signed URL.
|
|
4
|
+
*
|
|
5
|
+
* A `File` is sent as it is. A stream source with a {@link StreamSource.replayableBody} (e.g. a local file) sends
|
|
6
|
+
* that instead, so a retry re-reads it rather than needing a buffered copy; its stream is cancelled, which releases
|
|
7
|
+
* what the stream holds, such as a file descriptor. Any other stream source sends its stream, with its
|
|
8
|
+
* {@link StreamSource.size} when known.
|
|
9
|
+
*/
|
|
10
|
+
export async function getUploadBody(source) {
|
|
11
|
+
if (!(source instanceof StreamSource))
|
|
12
|
+
return { body: source };
|
|
13
|
+
const body = await source.replayableBody();
|
|
14
|
+
if (!body)
|
|
15
|
+
return { body: source.stream, contentLength: source.size };
|
|
16
|
+
await source.stream.cancel().catch(() => undefined);
|
|
17
|
+
return { body };
|
|
18
|
+
}
|
|
19
|
+
/** Headers for an upload: the content type, and `Content-Length` when the body declares one. */
|
|
20
|
+
export function uploadHeaders(upload, contentType) {
|
|
21
|
+
const headers = {};
|
|
22
|
+
if (contentType)
|
|
23
|
+
headers['Content-Type'] = contentType;
|
|
24
|
+
if (upload.contentLength !== undefined)
|
|
25
|
+
headers['Content-Length'] = String(upload.contentLength);
|
|
26
|
+
return Object.keys(headers).length > 0 ? headers : undefined;
|
|
27
|
+
}
|
|
28
|
+
/** An ETag without the quotes HTTP puts around it (RFC 9110), as the upload methods return it. */
|
|
29
|
+
export function unquoteEtag(etag) {
|
|
30
|
+
return etag?.replace(/^"(.*)"$/, '$1');
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=upload-body.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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lResponse } from '@vertesia/common';
|
|
2
|
+
import type { StreamSource } from '../StreamSource.js';
|
|
3
|
+
import type { FilesApi } from './FilesApi.js';
|
|
4
|
+
/** A location without its query string or fragment, which hold a signed URL's credentials. */
|
|
5
|
+
export declare function fileLocationForError(location: string): string;
|
|
6
|
+
/** A copy of an error safe to log: every URL in its message is cut to its location. */
|
|
7
|
+
export declare function sanitizedErrorCause(error: unknown): Error | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Upload a source to the file `request` names: in one signed PUT, or, for a stream source longer than one part in
|
|
10
|
+
* Node.js, in parts through an upload session (see `chunked-upload.ts`). On failure the source's stream is cancelled.
|
|
11
|
+
*
|
|
12
|
+
* @param signUpload the signed PUT URL to use, when the caller already has one or signs it another way
|
|
13
|
+
* @param fallbackMimeType the content type when neither the source nor the server names one
|
|
14
|
+
*/
|
|
15
|
+
export declare function uploadContent(files: FilesApi, source: StreamSource | File, request: CreateUploadSessionPayload, signUpload?: () => Promise<GetFileUrlResponse>, fallbackMimeType?: string): Promise<{
|
|
16
|
+
id: string;
|
|
17
|
+
path: string;
|
|
18
|
+
mime_type?: string;
|
|
19
|
+
etag?: string;
|
|
20
|
+
}>;
|
|
21
|
+
//# sourceMappingURL=upload-content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-content.d.ts","sourceRoot":"","sources":["../../src/store/upload-content.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACvF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAM9C,8FAA8F;AAC9F,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAO7D;AAED,uFAAuF;AACvF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,GAAG,SAAS,CAQrE;AAcD;;;;;;GAMG;AACH,wBAAsB,aAAa,CAC/B,KAAK,EAAE,QAAQ,EACf,MAAM,EAAE,YAAY,GAAG,IAAI,EAC3B,OAAO,EAAE,0BAA0B,EACnC,UAAU,GAAE,MAAM,OAAO,CAAC,kBAAkB,CAAqC,EACjF,gBAAgB,CAAC,EAAE,MAAM,GAC1B,OAAO,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAW1E"}
|