@polymorfa/sdk 0.1.0-dev.20260923132258 → 0.1.0-dev.20260923144429

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.
@@ -0,0 +1,564 @@
1
+ import { PolymorfaAuthorizationError, PolymorfaConfigurationError, PolymorfaNotFoundError, PolymorfaTimeoutError, PolymorfaValidationError, } from "../errors.js";
2
+ import { CursorPage } from "../pagination.js";
3
+ import { RawClient } from "../raw.js";
4
+ import { HttpTransport } from "../transport/http.js";
5
+ import { defaultSleep } from "../transport/retry.js";
6
+ import { decodeCursorPage, unwrapResponse, } from "./response.js";
7
+ // Response enums preserve values returned by the API. Request fields use
8
+ // the closed known-value unions accepted by the pinned API.
9
+ export const VOICE_AUDIO_STATUSES = [
10
+ "pending_upload",
11
+ "uploaded",
12
+ "transcoding",
13
+ "ready",
14
+ "failed",
15
+ ];
16
+ export const VOICE_AUDIO_SOURCES = ["upload", "tts"];
17
+ export const VOICE_AUDIO_FAILURE_REASONS = [
18
+ "unsupported_format",
19
+ "too_large",
20
+ "too_long",
21
+ "decode_failed",
22
+ "silent",
23
+ "tts_failed",
24
+ "processing_failed",
25
+ ];
26
+ /** Container of the original upload. */
27
+ export const VOICE_AUDIO_FORMATS = ["mp3", "wav", "ogg", "m4a"];
28
+ export const VOICE_PROVIDERS = ["elevenlabs", "openai"];
29
+ /** Whose provider key produced a TTS asset. */
30
+ export const VOICE_KEY_SOURCES = ["managed", "customer"];
31
+ export const VOICE_PROVIDER_CREDENTIAL_STATUSES = [
32
+ "unverified",
33
+ "valid",
34
+ "invalid",
35
+ ];
36
+ export const VOICE_PROVIDER_CREDENTIAL_ERRORS = [
37
+ "unauthorized",
38
+ "quota_exceeded",
39
+ "forbidden_scope",
40
+ "provider_unavailable",
41
+ ];
42
+ export const VOICE_AUDIO_UPLOAD_CONTENT_TYPES = [
43
+ "audio/mpeg",
44
+ "audio/wav",
45
+ "audio/x-wav",
46
+ "audio/ogg",
47
+ "audio/mp4",
48
+ "audio/x-m4a",
49
+ ];
50
+ /** ElevenLabs models. `eleven_multilingual_v2` is the default. */
51
+ export const ELEVENLABS_TTS_MODELS = [
52
+ "eleven_multilingual_v2",
53
+ "eleven_flash_v2_5",
54
+ "eleven_turbo_v2_5",
55
+ ];
56
+ /** OpenAI models. `gpt-4o-mini-tts` is the default. */
57
+ export const OPENAI_TTS_MODELS = [
58
+ "gpt-4o-mini-tts",
59
+ "tts-1",
60
+ "tts-1-hd",
61
+ ];
62
+ export const OPENAI_TTS_VOICES = [
63
+ "alloy",
64
+ "ash",
65
+ "ballad",
66
+ "coral",
67
+ "echo",
68
+ "fable",
69
+ "nova",
70
+ "onyx",
71
+ "sage",
72
+ "shimmer",
73
+ "verse",
74
+ ];
75
+ /** Largest upload the API accepts: 16 MiB. */
76
+ export const VOICE_AUDIO_MAX_UPLOAD_BYTES = 16_777_216;
77
+ /**
78
+ * Follows the merged Voice Automation API contract. Writes require the
79
+ * `calls.voice-automation` beta; other teams get `voice_not_enabled`.
80
+ * Reads, previews and deletes keep working after withdrawal. An installed
81
+ * resource does not grant access or establish an enabled audience.
82
+ */
83
+ export class VoiceResource {
84
+ audio;
85
+ providerCredentials;
86
+ constructor(transport, projectId, confineById) {
87
+ this.audio = new VoiceAudioResource(transport, projectId, confineById);
88
+ this.providerCredentials = new VoiceProviderCredentialsResource(transport, projectId, confineById);
89
+ }
90
+ }
91
+ /**
92
+ * The project's audio library: uploaded recordings and text-to-speech
93
+ * renders, transcoded to 16 kHz mono for calls. Team clients name the project
94
+ * on `list`, `createUpload`, `upload` and `synthesize`; project clients use
95
+ * their own project.
96
+ */
97
+ export class VoiceAudioResource {
98
+ transport;
99
+ projectId;
100
+ confineById;
101
+ #raw;
102
+ constructor(transport, projectId,
103
+ /**
104
+ * Team keys reach every asset of the team by ID, so a project client
105
+ * built from one checks an asset's project before acting on it.
106
+ */
107
+ confineById) {
108
+ this.transport = transport;
109
+ this.projectId = projectId;
110
+ this.confineById = confineById;
111
+ this.#raw = new RawClient(transport);
112
+ }
113
+ list(...args) {
114
+ const [projectId, rest] = this.#project(args);
115
+ const params = rest[0] ?? {};
116
+ const options = rest[1] ?? {};
117
+ return this.#raw.paginate({
118
+ method: "GET",
119
+ path: AUDIO_PATH,
120
+ query: {
121
+ projectId,
122
+ ...(params.status === undefined ? {} : { status: params.status }),
123
+ ...(params.cursor === undefined ? {} : { cursor: params.cursor }),
124
+ ...(params.limit === undefined ? {} : { limit: params.limit }),
125
+ },
126
+ ...options,
127
+ }, (decodeCursorPage));
128
+ }
129
+ /**
130
+ * Creates an asset in `pending_upload` and returns where to send the file.
131
+ * Send it with `POST upload.url`, only the `upload.headers`, and no
132
+ * `Authorization` header, then call `complete`. `upload` does all three.
133
+ */
134
+ createUpload(...args) {
135
+ const [projectId, rest] = this.#project(args);
136
+ const input = rest[0];
137
+ const options = rest[1] ?? {};
138
+ return this.#createUpload(projectId, input, options);
139
+ }
140
+ /**
141
+ * Uploads a file into the library: creates the asset, sends the bytes to
142
+ * the upload URL without your credential, and completes it. Resolves with
143
+ * the asset in `transcoding`; wait for `voice.asset_ready` or use
144
+ * `waitUntilReady`. If sending fails, the asset stays in `pending_upload`.
145
+ * `options` apply to the API requests, not to the upload URL, except
146
+ * `signal` and `timeoutMs`.
147
+ */
148
+ async upload(...args) {
149
+ const [projectId, rest] = this.#project(args);
150
+ const input = rest[0];
151
+ const options = rest[1] ?? {};
152
+ const contentType = input.contentType ??
153
+ (input.body instanceof Blob && input.body.type !== ""
154
+ ? input.body.type
155
+ : undefined);
156
+ if (contentType === undefined) {
157
+ throw new PolymorfaConfigurationError("A contentType is required to upload audio.", "contentType");
158
+ }
159
+ if (!VOICE_AUDIO_UPLOAD_CONTENT_TYPES.includes(contentType)) {
160
+ throw new PolymorfaValidationError("The upload content type must be MP3, WAV, OGG or M4A audio.");
161
+ }
162
+ const { body, sizeBytes } = uploadBody(input);
163
+ const created = await this.#createUpload(projectId, {
164
+ name: input.name,
165
+ contentType: contentType,
166
+ sizeBytes,
167
+ ...(input.retentionDays === undefined
168
+ ? {}
169
+ : { retentionDays: input.retentionDays }),
170
+ }, options);
171
+ const { asset, upload } = created.data;
172
+ await this.transport.sendToUploadUrl({
173
+ url: upload.url,
174
+ method: upload.method,
175
+ headers: upload.headers,
176
+ body,
177
+ ...(options.signal === undefined ? {} : { signal: options.signal }),
178
+ ...(options.timeoutMs === undefined
179
+ ? {}
180
+ : { timeoutMs: options.timeoutMs }),
181
+ });
182
+ return this.#complete(asset.id, withoutIdempotencyKey(options));
183
+ }
184
+ /** Starts transcoding after the upload. Fails with `state_conflict` if the file was not received. */
185
+ async complete(assetId, options = {}) {
186
+ await this.#confine(assetId, options);
187
+ return this.#complete(assetId, options);
188
+ }
189
+ /** Renders text to speech into a new asset, returned in `transcoding`. */
190
+ synthesize(...args) {
191
+ const [projectId, rest] = this.#project(args);
192
+ const input = rest[0];
193
+ const options = rest[1] ?? {};
194
+ return this.transport
195
+ .request({
196
+ method: "POST",
197
+ path: `${AUDIO_PATH}/tts`,
198
+ body: { ...input, projectId },
199
+ ...options,
200
+ })
201
+ .then(unwrapResponse);
202
+ }
203
+ retrieve(assetId, options = {}) {
204
+ return this.#retrieve(assetId, options).then((response) => {
205
+ this.#assertProject(assetId, response.data);
206
+ return response;
207
+ });
208
+ }
209
+ async update(assetId, input, options = {}) {
210
+ await this.#confine(assetId, options);
211
+ return this.transport
212
+ .request({
213
+ method: "PATCH",
214
+ path: assetPath(assetId),
215
+ body: input,
216
+ ...options,
217
+ })
218
+ .then(unwrapResponse);
219
+ }
220
+ /** Fails with `voice_asset_in_use` while a campaign or flow uses the asset. */
221
+ async delete(assetId, options = {}) {
222
+ await this.#confine(assetId, options);
223
+ return this.transport
224
+ .request({
225
+ method: "DELETE",
226
+ path: assetPath(assetId),
227
+ ...options,
228
+ })
229
+ .then(unwrapResponse);
230
+ }
231
+ /** A 5-minute link to the transcoded audio. Fails with `asset_not_ready` before `ready`. */
232
+ async previewUrl(assetId, options = {}) {
233
+ await this.#confine(assetId, options);
234
+ return this.transport
235
+ .request({
236
+ method: "GET",
237
+ path: `${assetPath(assetId)}/preview`,
238
+ ...options,
239
+ })
240
+ .then(unwrapResponse);
241
+ }
242
+ /**
243
+ * Reads the asset until it is `ready` or `failed` and returns it; check
244
+ * `status` and `failureReason`. Throws `PolymorfaTimeoutError` (code
245
+ * `request_timeout`) once `timeoutMs` has elapsed: a read still in flight
246
+ * at the deadline is cancelled, and a result that arrives after it is not
247
+ * returned. Prefer the `voice.asset_ready` and `voice.asset_failed`
248
+ * webhooks in production.
249
+ */
250
+ async waitUntilReady(assetId, wait = {}, options = {}) {
251
+ const timeoutMs = wait.timeoutMs ?? 120_000;
252
+ const intervalMs = wait.intervalMs ?? 2_000;
253
+ const deadline = Date.now() + timeoutMs;
254
+ const callerSignals = [options.signal, wait.signal].filter((signal) => signal !== undefined);
255
+ const timedOut = () => new PolymorfaTimeoutError(`The audio asset was not processed within ${timeoutMs}ms.`, { code: "request_timeout", details: { assetId } });
256
+ while (true) {
257
+ const remaining = deadline - Date.now();
258
+ if (remaining <= 0)
259
+ throw timedOut();
260
+ // Each read is bounded by the time left, including the transport's own
261
+ // retries, and still honours the caller's signals.
262
+ const expiry = new AbortController();
263
+ const timer = setTimeout(() => expiry.abort(), remaining);
264
+ const read = linkSignals([...callerSignals, expiry.signal]);
265
+ let response;
266
+ try {
267
+ response = await this.retrieve(assetId, {
268
+ ...options,
269
+ ...(read.signal === undefined ? {} : { signal: read.signal }),
270
+ });
271
+ }
272
+ catch (error) {
273
+ if (expiry.signal.aborted &&
274
+ !callerSignals.some((caller) => caller.aborted)) {
275
+ throw timedOut();
276
+ }
277
+ throw error;
278
+ }
279
+ finally {
280
+ clearTimeout(timer);
281
+ read.dispose();
282
+ }
283
+ if (Date.now() >= deadline)
284
+ throw timedOut();
285
+ if (response.data.status === "ready" ||
286
+ response.data.status === "failed") {
287
+ return response;
288
+ }
289
+ const left = deadline - Date.now();
290
+ if (left <= 0)
291
+ throw timedOut();
292
+ const pause = linkSignals(callerSignals);
293
+ try {
294
+ await defaultSleep(Math.min(intervalMs, left), pause.signal);
295
+ }
296
+ finally {
297
+ pause.dispose();
298
+ }
299
+ }
300
+ }
301
+ #createUpload(projectId, input, options) {
302
+ return this.transport
303
+ .request({
304
+ method: "POST",
305
+ path: AUDIO_PATH,
306
+ body: { ...input, projectId },
307
+ ...options,
308
+ })
309
+ .then(unwrapResponse);
310
+ }
311
+ #complete(assetId, options) {
312
+ return this.transport
313
+ .request({
314
+ method: "POST",
315
+ path: `${assetPath(assetId)}/complete`,
316
+ ...options,
317
+ })
318
+ .then(unwrapResponse);
319
+ }
320
+ #retrieve(assetId, options) {
321
+ return this.transport
322
+ .request({
323
+ method: "GET",
324
+ path: assetPath(assetId),
325
+ ...options,
326
+ })
327
+ .then(unwrapResponse);
328
+ }
329
+ #project(args) {
330
+ if (this.projectId !== null)
331
+ return [this.projectId, args];
332
+ return [requireProjectId(args[0]), args.slice(1)];
333
+ }
334
+ async #confine(assetId, options) {
335
+ if (!this.confineById)
336
+ return;
337
+ const response = await this.#retrieve(assetId, withoutIdempotencyKey(options));
338
+ this.#assertProject(assetId, response.data);
339
+ }
340
+ #assertProject(assetId, asset) {
341
+ if (this.projectId !== null &&
342
+ asset.projectId.toLowerCase() !== this.projectId.toLowerCase()) {
343
+ throw new PolymorfaNotFoundError("Audio asset not found.", {
344
+ code: "resource_not_found",
345
+ status: 404,
346
+ details: { assetId },
347
+ });
348
+ }
349
+ }
350
+ }
351
+ /**
352
+ * Your own ElevenLabs or OpenAI keys for text-to-speech. A credential belongs
353
+ * to one project or, when created by a team key without a project, to every
354
+ * project of the team. The key is write-only: responses carry only its
355
+ * fingerprint, and the SDK never logs it or includes it in errors.
356
+ */
357
+ export class VoiceProviderCredentialsResource {
358
+ transport;
359
+ projectId;
360
+ confineById;
361
+ constructor(transport, projectId,
362
+ /**
363
+ * A project client built from a team key checks a credential's project
364
+ * before acting on it. It can read team-wide credentials but manages only
365
+ * its own project's.
366
+ */
367
+ confineById) {
368
+ this.transport = transport;
369
+ this.projectId = projectId;
370
+ this.confineById = confineById;
371
+ }
372
+ /** Team-wide credentials plus, when a project is named, that project's. */
373
+ list(...args) {
374
+ const values = args;
375
+ let projectId;
376
+ let options;
377
+ if (this.projectId !== null) {
378
+ projectId = this.projectId;
379
+ options = values[0] ?? {};
380
+ }
381
+ else {
382
+ const params = values[0] ?? {};
383
+ projectId = params.projectId;
384
+ options = values[1] ?? {};
385
+ }
386
+ return this.transport
387
+ .request({
388
+ method: "GET",
389
+ path: CREDENTIALS_PATH,
390
+ query: projectId === undefined ? {} : { projectId },
391
+ ...options,
392
+ })
393
+ .then(unwrapResponse);
394
+ }
395
+ /** Stores and checks a provider key. Fails with `provider_credential_invalid` if the provider rejects it. */
396
+ create(input, options = {}) {
397
+ const fields = input;
398
+ if (typeof fields.apiKey !== "string" || fields.apiKey.length === 0) {
399
+ throw new PolymorfaConfigurationError("An apiKey is required.", "apiKey");
400
+ }
401
+ const body = {
402
+ provider: fields.provider,
403
+ label: fields.label,
404
+ apiKey: fields.apiKey,
405
+ };
406
+ if (this.projectId !== null)
407
+ body.projectId = this.projectId;
408
+ else if (fields.projectId !== undefined)
409
+ body.projectId = fields.projectId;
410
+ return this.transport
411
+ .request({
412
+ method: "POST",
413
+ path: CREDENTIALS_PATH,
414
+ body,
415
+ ...options,
416
+ })
417
+ .then(unwrapResponse);
418
+ }
419
+ retrieve(credentialId, options = {}) {
420
+ return this.#retrieve(credentialId, options).then((response) => {
421
+ this.#assertVisible(credentialId, response.data);
422
+ return response;
423
+ });
424
+ }
425
+ /** Checks the stored key with the provider again and returns the updated status. */
426
+ async verify(credentialId, options = {}) {
427
+ await this.#confine(credentialId, options);
428
+ return this.transport
429
+ .request({
430
+ method: "POST",
431
+ path: `${credentialPath(credentialId)}/verify`,
432
+ ...options,
433
+ })
434
+ .then(unwrapResponse);
435
+ }
436
+ async delete(credentialId, options = {}) {
437
+ await this.#confine(credentialId, options);
438
+ return this.transport
439
+ .request({
440
+ method: "DELETE",
441
+ path: credentialPath(credentialId),
442
+ ...options,
443
+ })
444
+ .then(unwrapResponse);
445
+ }
446
+ #retrieve(credentialId, options) {
447
+ return this.transport
448
+ .request({
449
+ method: "GET",
450
+ path: credentialPath(credentialId),
451
+ ...options,
452
+ })
453
+ .then(unwrapResponse);
454
+ }
455
+ async #confine(credentialId, options) {
456
+ if (!this.confineById)
457
+ return;
458
+ const response = await this.#retrieve(credentialId, withoutIdempotencyKey(options));
459
+ const credential = response.data;
460
+ this.#assertVisible(credentialId, credential);
461
+ if (credential.projectId === null) {
462
+ throw new PolymorfaAuthorizationError("Manage team-wide provider credentials from the team client.", { code: "permission_denied", status: 403, details: { credentialId } });
463
+ }
464
+ }
465
+ #assertVisible(credentialId, credential) {
466
+ if (this.projectId !== null &&
467
+ credential.projectId !== null &&
468
+ credential.projectId.toLowerCase() !== this.projectId.toLowerCase()) {
469
+ throw new PolymorfaNotFoundError("Provider credential not found.", {
470
+ code: "resource_not_found",
471
+ status: 404,
472
+ details: { credentialId },
473
+ });
474
+ }
475
+ }
476
+ }
477
+ const AUDIO_PATH = "/platform/voice/audio";
478
+ const CREDENTIALS_PATH = "/platform/voice/provider-credentials";
479
+ function assetPath(assetId) {
480
+ return `${AUDIO_PATH}/${encodeURIComponent(requireId(assetId, "assetId"))}`;
481
+ }
482
+ function credentialPath(credentialId) {
483
+ return `${CREDENTIALS_PATH}/${encodeURIComponent(requireId(credentialId, "credentialId"))}`;
484
+ }
485
+ function requireId(value, field) {
486
+ if (typeof value !== "string" || value.trim().length === 0) {
487
+ throw new PolymorfaConfigurationError(`A ${field} is required.`, field);
488
+ }
489
+ return value;
490
+ }
491
+ function requireProjectId(value) {
492
+ if (typeof value !== "string" || value.trim().length === 0) {
493
+ throw new PolymorfaConfigurationError("A projectId is required for team clients.", "projectId");
494
+ }
495
+ return value;
496
+ }
497
+ function withoutIdempotencyKey(options) {
498
+ // Reads and follow-up steps keep the caller's options; the idempotency key
499
+ // belongs to the change the caller asked for.
500
+ const copy = {
501
+ ...options,
502
+ };
503
+ delete copy.idempotencyKey;
504
+ return copy;
505
+ }
506
+ function uploadBody(input) {
507
+ const value = input.body;
508
+ if (value instanceof ReadableStream) {
509
+ if (input.sizeBytes === undefined) {
510
+ throw new PolymorfaConfigurationError("sizeBytes is required when the body is a stream.", "sizeBytes");
511
+ }
512
+ return { body: value, sizeBytes: input.sizeBytes };
513
+ }
514
+ if (value instanceof Blob) {
515
+ return { body: value, sizeBytes: knownSize(input, value.size) };
516
+ }
517
+ if (value instanceof ArrayBuffer) {
518
+ return { body: value, sizeBytes: knownSize(input, value.byteLength) };
519
+ }
520
+ if (ArrayBuffer.isView(value)) {
521
+ // Copy into an ArrayBuffer of exactly the view's bytes; a Buffer can be a
522
+ // window into a larger shared pool.
523
+ const bytes = new Uint8Array(value.buffer, value.byteOffset, value.byteLength).slice();
524
+ return { body: bytes.buffer, sizeBytes: knownSize(input, bytes.length) };
525
+ }
526
+ throw new PolymorfaConfigurationError("body must be bytes, a Blob, or a ReadableStream.", "body");
527
+ }
528
+ /**
529
+ * The size of a body whose length is known is its byte length. A `sizeBytes`
530
+ * that disagrees is refused before any request, so no asset is created for
531
+ * an upload the storage would reject.
532
+ */
533
+ function knownSize(input, byteLength) {
534
+ if (input.sizeBytes !== undefined && input.sizeBytes !== byteLength) {
535
+ throw new PolymorfaValidationError(`sizeBytes (${input.sizeBytes}) does not match the body's ${byteLength} bytes. Omit sizeBytes for byte and Blob bodies.`, {
536
+ code: "invalid_parameter",
537
+ details: { field: "sizeBytes", sizeBytes: input.sizeBytes, byteLength },
538
+ });
539
+ }
540
+ return byteLength;
541
+ }
542
+ /**
543
+ * A signal that aborts, with the same reason, when any of `signals` aborts.
544
+ * `dispose` detaches it so a long-lived caller signal does not collect
545
+ * listeners across reads.
546
+ */
547
+ function linkSignals(signals) {
548
+ if (signals.length <= 1)
549
+ return { signal: signals[0], dispose: () => { } };
550
+ const controller = new AbortController();
551
+ const detach = new AbortController();
552
+ for (const signal of signals) {
553
+ if (signal.aborted) {
554
+ controller.abort(signal.reason);
555
+ break;
556
+ }
557
+ signal.addEventListener("abort", () => controller.abort(signal.reason), {
558
+ once: true,
559
+ signal: detach.signal,
560
+ });
561
+ }
562
+ return { signal: controller.signal, dispose: () => detach.abort() };
563
+ }
564
+ //# sourceMappingURL=voice.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voice.js","sourceRoot":"","sources":["../../src/platform/voice.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,sBAAsB,EACtB,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGrD,OAAO,EAEL,gBAAgB,EAChB,cAAc,GACf,MAAM,eAAe,CAAC;AAEvB,yEAAyE;AACzE,4DAA4D;AAE5D,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,gBAAgB;IAChB,UAAU;IACV,aAAa;IACb,OAAO;IACP,QAAQ;CACA,CAAC;AAIX,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAU,CAAC;AAI9D,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,oBAAoB;IACpB,WAAW;IACX,UAAU;IACV,eAAe;IACf,QAAQ;IACR,YAAY;IACZ,mBAAmB;CACX,CAAC;AAMX,wCAAwC;AACxC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAU,CAAC;AAIzE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,YAAY,EAAE,QAAQ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1E,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;IACzC,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;IACrC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAChC,MAAM;QACR,CAAC;QACD,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE;YACtE,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,MAAM,CAAC,MAAM;SACtB,CAAC,CAAC;IACL,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC;AACtE,CAAC"}
@@ -4,6 +4,14 @@ export declare class HttpTransport {
4
4
  constructor(options: TransportOptions);
5
5
  request<T>(request: RawRequest): Promise<ApiResponse<T>>;
6
6
  requestBinary(request: RawRequest): Promise<ApiResponse<ArrayBuffer>>;
7
+ /**
8
+ * Sends a body to an upload URL the API returned. The URL is the
9
+ * capability: the request carries only the given headers, never the
10
+ * client's `Authorization`, API version or idempotency key, and it is not
11
+ * retried (a stream body cannot be replayed). Redirects are refused.
12
+ * Errors never retain the URL, including in an underlying cause.
13
+ */
14
+ sendToUploadUrl(request: UploadUrlRequest): Promise<ApiResponse<unknown>>;
7
15
  /**
8
16
  * Returns a successful response body as text. Error responses are decoded
9
17
  * and raised like JSON requests. `accept` is sent unless the caller set it.
@@ -37,4 +45,13 @@ export declare class HttpTransport {
37
45
  readonly metadata: ResponseMetadata;
38
46
  }>;
39
47
  }
48
+ export interface UploadUrlRequest {
49
+ /** Absolute URL, or a path relative to the client's base URL. */
50
+ readonly url: string;
51
+ readonly method: "POST" | "PUT";
52
+ readonly headers: Readonly<Record<string, string>>;
53
+ readonly body: BodyInit;
54
+ readonly signal?: AbortSignal;
55
+ readonly timeoutMs?: number;
56
+ }
40
57
  //# sourceMappingURL=http.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/transport/http.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAEpB,qBAAa,aAAa;;gBAaZ,OAAO,EAAE,gBAAgB;IAmB/B,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAIxD,aAAa,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IAS3E;;;OAGG;IACG,WAAW,CACf,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAS/B;;;;;;;OAOG;IACG,aAAa,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,cAAc,CAAC;IAQjE;;;OAGG;IACG,uBAAuB,CAC3B,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,cAAc,GAAG,cAAc,CAAC;IAkV3C;;;;;;OAMG;IACG,UAAU,CAAC,OAAO,EAAE,UAAU,GAAG;QAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC;QAC3E,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;QAC5B,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;KACrC,CAAC;CAsGH"}
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/transport/http.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,gBAAgB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