@byte_fluffy/nexra-sdk 0.1.0-alpha.30 → 0.1.0-alpha.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/catalog.js CHANGED
@@ -9,8 +9,8 @@ import {
9
9
  listModelSpecs,
10
10
  projectMediaGeometry,
11
11
  resolveNexraLanguageReasoning
12
- } from "./chunk-3CF6PDT3.js";
13
- import "./chunk-DKQZWIQ7.js";
12
+ } from "./chunk-QXEDXMFI.js";
13
+ import "./chunk-QBW7OCT3.js";
14
14
  export {
15
15
  CatalogClient,
16
16
  applyMediaGeometry,
@@ -539,6 +539,12 @@ var PUBLIC_ERROR_MESSAGES = {
539
539
  "zh-CN": Object.fromEntries(PUBLIC_ERROR_CODES.map((code) => [code, PUBLIC_ERROR_CATALOG[code]["zh-CN"]])),
540
540
  en: Object.fromEntries(PUBLIC_ERROR_CODES.map((code) => [code, PUBLIC_ERROR_CATALOG[code].en]))
541
541
  };
542
+ function isPublicErrorCode(code) {
543
+ return Object.hasOwn(PUBLIC_ERROR_CATALOG, code);
544
+ }
545
+ function publicErrorMessage(code, locale = "en") {
546
+ return PUBLIC_ERROR_MESSAGES[locale][isPublicErrorCode(code) ? code : "internal_error"];
547
+ }
542
548
  function pickPublicErrorDetails(value) {
543
549
  return isRecord(value) && typeof value.param === "string" && value.param.trim() ? { param: value.param } : void 0;
544
550
  }
@@ -637,6 +643,23 @@ function identifier(value) {
637
643
  function httpStatus(value) {
638
644
  return typeof value === "number" && Number.isInteger(value) && value >= 100 && value <= 599 ? value : void 0;
639
645
  }
646
+ function resolvePublicErrorLocale(acceptLanguage) {
647
+ let chosen = "en";
648
+ let highestQuality = 0;
649
+ for (const candidate of (acceptLanguage ?? "").split(",")) {
650
+ const [tag, ...parameters] = candidate.trim().toLowerCase().split(";");
651
+ const locale = /^zh(?:-[a-z0-9]+)*$/.test(tag ?? "") ? "zh-CN" : /^en(?:-[a-z0-9]+)*$/.test(tag ?? "") ? "en" : void 0;
652
+ if (!locale) continue;
653
+ const qualityParameter = parameters.map((parameter) => parameter.trim()).find((parameter) => parameter.startsWith("q="));
654
+ const rawQuality = qualityParameter?.slice(2).trim();
655
+ const quality = rawQuality === void 0 ? 1 : /^(?:0(?:\.\d{0,3})?|1(?:\.0{0,3})?)$/.test(rawQuality) ? Number(rawQuality) : 0;
656
+ if (quality > highestQuality) {
657
+ chosen = locale;
658
+ highestQuality = quality;
659
+ }
660
+ }
661
+ return chosen;
662
+ }
640
663
  function isRecord(value) {
641
664
  return typeof value === "object" && value !== null && !Array.isArray(value);
642
665
  }
@@ -710,8 +733,11 @@ function sortRatioDisplayOrder(values) {
710
733
 
711
734
  export {
712
735
  MEDIA_KINDS,
736
+ isPublicErrorCode,
737
+ publicErrorMessage,
713
738
  pickPublicErrorFields,
714
739
  normalizePublicErrorInput,
740
+ resolvePublicErrorLocale,
715
741
  NEXRA_MEDIA_API_VERSION,
716
742
  NEXRA_GENERATION_OPERATIONS,
717
743
  NEXRA_MEDIA_OPERATIONS,
@@ -2,7 +2,7 @@ import {
2
2
  normalizePublicErrorInput,
3
3
  pickPublicErrorFields,
4
4
  sortRatioDisplayOrder
5
- } from "./chunk-DKQZWIQ7.js";
5
+ } from "./chunk-QBW7OCT3.js";
6
6
 
7
7
  // src/catalog/generated/audio.generated.json
8
8
  var audio_generated_default = [
@@ -50448,7 +50448,7 @@ var NexraWaitTimeoutError = class extends Error {
50448
50448
  };
50449
50449
 
50450
50450
  // src/generated/version.generated.ts
50451
- var SDK_VERSION = "0.1.0-alpha.30";
50451
+ var SDK_VERSION = "0.1.0-alpha.31";
50452
50452
 
50453
50453
  // src/transport.ts
50454
50454
  var DEFAULT_BASE_URL = "https://api.nexra-ai.com/v1";
@@ -50583,39 +50583,14 @@ async function* parseServerSentEvents(response, options = {}) {
50583
50583
  void reader.cancel(options.signal?.reason).catch(() => void 0);
50584
50584
  };
50585
50585
  options.signal?.addEventListener("abort", abort, { once: true });
50586
- const decoder = new TextDecoder();
50587
- let buffer = "";
50588
- let current = emptyEvent();
50586
+ const decode = createServerSentEventDecoder();
50589
50587
  try {
50590
50588
  while (true) {
50591
50589
  if (options.signal?.aborted) throw options.signal.reason ?? new Error("SSE request was aborted");
50592
50590
  const { value, done } = await reader.read();
50593
50591
  if (options.signal?.aborted) throw options.signal.reason ?? new Error("SSE request was aborted");
50594
- buffer += decoder.decode(value, { stream: !done });
50595
- const lines = buffer.split(/\r?\n/);
50596
- buffer = done ? "" : lines.pop() ?? "";
50597
- for (const line of lines) {
50598
- if (line === "") {
50599
- const event = buildEvent(current);
50600
- current = emptyEvent();
50601
- if (event) yield event;
50602
- continue;
50603
- }
50604
- if (line.startsWith(":")) continue;
50605
- const separator = line.indexOf(":");
50606
- const field2 = separator === -1 ? line : line.slice(0, separator);
50607
- let content = separator === -1 ? "" : line.slice(separator + 1);
50608
- if (content.startsWith(" ")) content = content.slice(1);
50609
- if (field2 === "data") current.data.push(content);
50610
- else if (field2 === "event") current.event = content;
50611
- else if (field2 === "id") current.id = content;
50612
- else if (field2 === "retry") current.retry = Number(content);
50613
- }
50614
- if (done) {
50615
- const event = buildEvent(current);
50616
- if (event) yield event;
50617
- return;
50618
- }
50592
+ for (const event of decode(value, done)) yield event;
50593
+ if (done) return;
50619
50594
  }
50620
50595
  } finally {
50621
50596
  options.signal?.removeEventListener("abort", abort);
@@ -50623,6 +50598,40 @@ async function* parseServerSentEvents(response, options = {}) {
50623
50598
  reader.releaseLock();
50624
50599
  }
50625
50600
  }
50601
+ function createServerSentEventDecoder() {
50602
+ const decoder = new TextDecoder();
50603
+ let buffer = "";
50604
+ let current = emptyEvent();
50605
+ return (bytes, done = false) => {
50606
+ const events = [];
50607
+ buffer += decoder.decode(bytes, { stream: !done });
50608
+ const lines = buffer.split(/\r?\n/);
50609
+ buffer = done ? "" : lines.pop() ?? "";
50610
+ for (const line of lines) {
50611
+ if (line === "") {
50612
+ const event = buildEvent(current);
50613
+ current = emptyEvent();
50614
+ if (event) events.push(event);
50615
+ continue;
50616
+ }
50617
+ if (line.startsWith(":")) continue;
50618
+ const separator = line.indexOf(":");
50619
+ const field2 = separator === -1 ? line : line.slice(0, separator);
50620
+ let content = separator === -1 ? "" : line.slice(separator + 1);
50621
+ if (content.startsWith(" ")) content = content.slice(1);
50622
+ if (field2 === "data") current.data.push(content);
50623
+ else if (field2 === "event") current.event = content;
50624
+ else if (field2 === "id") current.id = content;
50625
+ else if (field2 === "retry") current.retry = Number(content);
50626
+ }
50627
+ if (done) {
50628
+ const event = buildEvent(current);
50629
+ current = emptyEvent();
50630
+ if (event) events.push(event);
50631
+ }
50632
+ return events;
50633
+ };
50634
+ }
50626
50635
  function emptyEvent() {
50627
50636
  return { data: [] };
50628
50637
  }
@@ -50829,6 +50838,7 @@ export {
50829
50838
  applyMediaGeometry,
50830
50839
  applyNoWatermark,
50831
50840
  parseServerSentEvents,
50841
+ createServerSentEventDecoder,
50832
50842
  formatModelDisplayName,
50833
50843
  CatalogClient,
50834
50844
  getModelSpec,
@@ -0,0 +1,30 @@
1
+ import { J as JsonValue } from './json-Cz0MkWQn.js';
2
+
3
+ type PublicUpstreamUnavailableReason = "no_response" | "not_retained" | "unsupported_capture" | "error_not_emitted" | "size_limit";
4
+ /** Network errors retain unknown codes from older or newer servers. */
5
+ type NexraError = {
6
+ code: string;
7
+ message: string;
8
+ param?: string;
9
+ };
10
+ type PublicErrorContext = {
11
+ nexraRequestId?: string;
12
+ nexraHttpStatus?: number;
13
+ };
14
+ type PublicErrorFields = PublicErrorContext & {
15
+ nexraError?: NexraError;
16
+ upstreamHttpStatus?: number;
17
+ upstreamRequestId?: string;
18
+ upstreamError?: JsonValue;
19
+ upstreamRedacted?: true;
20
+ upstreamTruncated?: true;
21
+ upstreamUnavailableReason?: PublicUpstreamUnavailableReason;
22
+ upstreamFormat?: "sse" | "decoded";
23
+ upstreamEvent?: string;
24
+ };
25
+ type PublicError = PublicErrorFields & {
26
+ nexraError: NexraError;
27
+ };
28
+ type ApiErrorPayload = PublicError;
29
+
30
+ export type { ApiErrorPayload as A, NexraError as N, PublicErrorFields as P, PublicError as a, PublicErrorContext as b };
package/dist/index.d.ts CHANGED
@@ -3,8 +3,10 @@ import { H as HttpTransport, M as ModelSearchParams, T as TaskModelSummary, a as
3
3
  export { C as CreateNexraDisplayQuoteBatchRequest, d as CreateNexraQuoteRequest, F as FetchLike, e as MediaGeometryField, f as MediaGeometryProjection, g as ModelCapabilitySummary, h as ModelDateVersion, i as ModelEndpointSummary, j as ModelModality, k as ModelResourceOption, l as NexraBillingCurrency, m as NexraCatalogRevision, n as NexraDisplayQuoteBatch, o as NexraDisplayQuoteBatchEntry, p as NexraModelOperation, q as NexraModelSpec, r as NexraModelSpecFilter, s as NexraQuote, t as NexraSalePrice, u as NexraSalePriceList, v as NexraSettlement, U as UnifiedMediaGeometry, w as applyMediaGeometry, x as decodeMediaGeometry, y as encodeMediaGeometry, z as projectMediaGeometry } from './media-geometry-DAVFGry1.js';
4
4
  import { C as CursorPage, J as JsonValue } from './json-Cz0MkWQn.js';
5
5
  export { a as JsonObject, b as JsonPrimitive } from './json-Cz0MkWQn.js';
6
- import { V as Voice, C as CreateVoiceRequest, a as VoiceCreation, A as AssetsClient, T as TasksClient, R as RunTaskOptions, b as RunResult, N as NexraError, P as PublicErrorFields, c as TaskResult } from './voices-Cl4ygZHV.js';
7
- export { d as ApiErrorPayload, e as CreateTaskOptions, f as CreateTaskRequest, g as PublicError, h as PublicErrorContext, i as RequestDetails, j as TASK_STATUSES, k as TaskCost, l as TaskError, m as TaskEvent, n as TaskEventType, o as TaskListParams, p as TaskPage, q as TaskProgress, r as TaskReceipt, s as TaskStatus, t as TaskTiming, u as TaskUsage, v as TaskWebhookConfig, w as TerminalTaskStatus, x as VerifyWebhookOptions, W as WaitTaskOptions, y as WatchTaskOptions, z as isTerminalTaskStatus, B as verifyWebhook } from './voices-Cl4ygZHV.js';
6
+ import { N as NexraError, P as PublicErrorFields } from './errors-DZlSwyv8.js';
7
+ export { A as ApiErrorPayload, a as PublicError, b as PublicErrorContext } from './errors-DZlSwyv8.js';
8
+ import { V as Voice, C as CreateVoiceRequest, a as VoiceCreation, A as AssetsClient, T as TasksClient, R as RunTaskOptions, b as RunResult, c as TaskResult } from './voices-2zWJXgCq.js';
9
+ export { d as CreateTaskOptions, e as CreateTaskRequest, f as RequestDetails, g as TASK_STATUSES, h as TaskCost, i as TaskError, j as TaskEvent, k as TaskEventType, l as TaskListParams, m as TaskPage, n as TaskProgress, o as TaskReceipt, p as TaskStatus, q as TaskTiming, r as TaskUsage, s as TaskWebhookConfig, t as TerminalTaskStatus, u as VerifyWebhookOptions, W as WaitTaskOptions, v as WatchTaskOptions, w as isTerminalTaskStatus, x as verifyWebhook } from './voices-2zWJXgCq.js';
8
10
  import { CatalogClient } from './catalog.js';
9
11
  export { formatModelDisplayName, getModelSpec, listModelSpecs } from './catalog.js';
10
12
  export { ceilDecimal, multiplyDecimal } from './decimal.js';
package/dist/index.js CHANGED
@@ -20,13 +20,13 @@ import {
20
20
  projectMediaGeometry,
21
21
  queryString,
22
22
  sleep
23
- } from "./chunk-3CF6PDT3.js";
23
+ } from "./chunk-QXEDXMFI.js";
24
24
  import {
25
25
  MEDIA_KINDS,
26
26
  TASK_STATUSES,
27
27
  createTaskRequest,
28
28
  isTerminalTaskStatus
29
- } from "./chunk-DKQZWIQ7.js";
29
+ } from "./chunk-QBW7OCT3.js";
30
30
 
31
31
  // src/assets.ts
32
32
  var AssetsClient = class {
@@ -1,9 +1,31 @@
1
- import { LanguageModelV4 } from '@ai-sdk/provider';
1
+ import { APICallError, LanguageModelV4 } from '@ai-sdk/provider';
2
2
  import { NexraLanguageProtocol } from './catalog.js';
3
3
  export { NexraLanguageModelBinding } from './catalog.js';
4
4
  import { F as FetchLike } from './media-geometry-DAVFGry1.js';
5
+ import { N as NexraError } from './errors-DZlSwyv8.js';
5
6
  import './json-Cz0MkWQn.js';
6
7
 
8
+ type NativeErrorContext = {
9
+ url: string;
10
+ statusCode?: number;
11
+ headers?: HeadersInit;
12
+ body: unknown;
13
+ responseBody?: string;
14
+ acceptLanguage?: string | null;
15
+ };
16
+ /** Native response IDs may belong to the provider; only the classification header is platform-owned. */
17
+ declare class NexraNativeError extends APICallError {
18
+ readonly nexraError?: NexraError;
19
+ constructor(context: NativeErrorContext);
20
+ get code(): string | undefined;
21
+ get status(): number | undefined;
22
+ }
23
+ /** Reusable by native provider factories; native request bodies and successful response bytes remain untouched. */
24
+ declare function createNexraNativeFetch(options?: {
25
+ fetch?: FetchLike;
26
+ headers?: HeadersInit;
27
+ }): FetchLike;
28
+
7
29
  type NexraLanguageModelOptions = {
8
30
  apiKey: string;
9
31
  baseUrl?: string;
@@ -13,4 +35,4 @@ type NexraLanguageModelOptions = {
13
35
  };
14
36
  declare function createNexraLanguageModel(modelId: string, options: NexraLanguageModelOptions): LanguageModelV4;
15
37
 
16
- export { type NexraLanguageModelOptions, NexraLanguageProtocol, createNexraLanguageModel };
38
+ export { type NexraLanguageModelOptions, NexraLanguageProtocol, NexraNativeError, createNexraLanguageModel, createNexraNativeFetch };
package/dist/language.js CHANGED
@@ -1,12 +1,17 @@
1
1
  import {
2
2
  HttpTransport,
3
3
  SDK_VERSION,
4
+ createServerSentEventDecoder,
4
5
  getLanguageModelBinding,
5
6
  jsonBody,
6
7
  parseServerSentEvents,
7
8
  resolveNexraLanguageReasoning
8
- } from "./chunk-3CF6PDT3.js";
9
- import "./chunk-DKQZWIQ7.js";
9
+ } from "./chunk-QXEDXMFI.js";
10
+ import {
11
+ isPublicErrorCode,
12
+ publicErrorMessage,
13
+ resolvePublicErrorLocale
14
+ } from "./chunk-QBW7OCT3.js";
10
15
 
11
16
  // src/language/index.ts
12
17
  import { createAnthropic } from "@ai-sdk/anthropic";
@@ -194,6 +199,94 @@ function chatRequest(binding, options, stream) {
194
199
  };
195
200
  }
196
201
 
202
+ // src/language/native-errors.ts
203
+ import { APICallError } from "@ai-sdk/provider";
204
+ function record(value) {
205
+ return value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
206
+ }
207
+ var NexraNativeError = class extends APICallError {
208
+ nexraError;
209
+ constructor(context) {
210
+ const headers = new Headers(context.headers);
211
+ const code = headers.get("x-nexra-error-code");
212
+ const locale = resolvePublicErrorLocale(context.acceptLanguage ?? headers.get("content-language"));
213
+ const nexraError = code && isPublicErrorCode(code) ? { code, message: publicErrorMessage(code, locale) } : void 0;
214
+ const body = record(context.body);
215
+ const originalMessage = record(body.error).message ?? body.message;
216
+ const message = nexraError?.message ?? (typeof originalMessage === "string" ? originalMessage : typeof context.body === "string" ? context.body : "The native model request failed.");
217
+ super({
218
+ message,
219
+ url: context.url,
220
+ requestBodyValues: void 0,
221
+ statusCode: context.statusCode,
222
+ responseHeaders: Object.fromEntries(headers),
223
+ responseBody: context.responseBody,
224
+ data: context.body
225
+ });
226
+ this.name = "NexraNativeError";
227
+ this.nexraError = nexraError;
228
+ }
229
+ get code() {
230
+ return this.nexraError?.code;
231
+ }
232
+ get status() {
233
+ return this.statusCode;
234
+ }
235
+ };
236
+ function createNexraNativeFetch(options = {}) {
237
+ const fetch = options.fetch ?? globalThis.fetch.bind(globalThis);
238
+ return async (input, init) => {
239
+ const headers = new Headers(options.headers);
240
+ if (input instanceof Request) input.headers.forEach((value, key) => headers.set(key, value));
241
+ new Headers(init?.headers).forEach((value, key) => headers.set(key, value));
242
+ const response = await fetch(input, { ...init, headers });
243
+ const context = {
244
+ url: input instanceof Request ? input.url : String(input),
245
+ statusCode: response.status,
246
+ headers: response.headers,
247
+ acceptLanguage: headers.get("accept-language")
248
+ };
249
+ const eventStream = response.headers.get("content-type")?.includes("text/event-stream");
250
+ if (response.ok && (eventStream || !response.headers.has("x-nexra-error-code"))) return guardNativeErrorFrames(response, context);
251
+ const text = await response.text();
252
+ let body = text;
253
+ try {
254
+ body = JSON.parse(text);
255
+ } catch {
256
+ }
257
+ throw new NexraNativeError({ ...context, body, responseBody: text });
258
+ };
259
+ }
260
+ function guardNativeErrorFrames(response, context) {
261
+ if (!response.body || !response.headers.get("content-type")?.includes("text/event-stream")) return response;
262
+ const decode = createServerSentEventDecoder();
263
+ const inspect = (events) => {
264
+ for (const event of events) {
265
+ let body;
266
+ try {
267
+ body = JSON.parse(event.data);
268
+ } catch {
269
+ if (event.event === "error") throw new NexraNativeError({ ...context, body: event.data, responseBody: event.data });
270
+ continue;
271
+ }
272
+ const payload = record(body);
273
+ if (event.event === "error" || payload.type === "error" || payload.type === "response.failed" || payload.error) {
274
+ throw new NexraNativeError({ ...context, body, responseBody: event.data });
275
+ }
276
+ }
277
+ };
278
+ const stream = response.body.pipeThrough(new TransformStream({
279
+ transform(bytes, controller) {
280
+ inspect(decode(bytes));
281
+ controller.enqueue(bytes);
282
+ },
283
+ flush() {
284
+ inspect(decode(void 0, true));
285
+ }
286
+ }));
287
+ return new Response(stream, { status: response.status, statusText: response.statusText, headers: response.headers });
288
+ }
289
+
197
290
  // src/language/chat-model.ts
198
291
  function object2(value) {
199
292
  return value && typeof value === "object" && !Array.isArray(value) ? value : {};
@@ -222,8 +315,14 @@ function finishReason(raw) {
222
315
  function invalid(data, message) {
223
316
  throw new InvalidResponseDataError({ data, message });
224
317
  }
225
- function choices(payload) {
226
- if (payload.error) invalid(payload.error, "Nexra returned a language error");
318
+ function choices(payload, response, headers) {
319
+ if (payload.error) throw new NexraNativeError({
320
+ url: response.url,
321
+ statusCode: response.status,
322
+ headers: response.headers,
323
+ body: payload,
324
+ acceptLanguage: headers?.["accept-language"] ?? headers?.["Accept-Language"]
325
+ });
227
326
  if (!Array.isArray(payload.choices)) invalid(payload, "Chat Completions response is missing choices");
228
327
  if (payload.choices.length > 1) invalid(payload, "Multiple Chat Completions choices are unsupported");
229
328
  return payload.choices.map(object2);
@@ -241,7 +340,7 @@ function createChatLanguageModel(binding, transport) {
241
340
  const body = chatRequest(binding, options, false);
242
341
  const response = await transport.response("/chat/completions", { method: "POST", ...jsonBody(body), headers: combineHeaders(options), signal: options.abortSignal }, { retryable: false });
243
342
  const payload = object2(await response.json());
244
- const choice = choices(payload)[0];
343
+ const choice = choices(payload, response, options.headers)[0];
245
344
  if (!choice || typeof choice.finish_reason !== "string") invalid(payload, "Chat Completions response is incomplete");
246
345
  const message = object2(choice.message);
247
346
  const content = [];
@@ -305,7 +404,7 @@ function createChatLanguageModel(binding, transport) {
305
404
  controller.enqueue({ type: "response-metadata", id: typeof payload.id === "string" ? payload.id : void 0, modelId: typeof payload.model === "string" ? payload.model : void 0 });
306
405
  metadataSent = true;
307
406
  }
308
- const choice = choices(payload)[0];
407
+ const choice = choices(payload, response, options.headers)[0];
309
408
  if (payload.usage) rawUsage = payload.usage;
310
409
  if (!choice) continue;
311
410
  if (choice.finish_reason != null) reason = choice.finish_reason;
@@ -389,13 +488,14 @@ function createNexraLanguageModel(modelId, options) {
389
488
  const binding = getLanguageModelBinding(modelId, options);
390
489
  const apiKey = options.apiKey.trim();
391
490
  if (!apiKey) throw new Error("Nexra language model requires an API key");
491
+ const fetch = createNexraNativeFetch(options);
392
492
  const transport = new HttpTransport({ ...options, baseUrl: options.baseUrl?.trim().replace(/\/+$/, ""), apiKey, maxRetries: 0 });
393
493
  const root = transport.baseUrl.replace(/\/(?:v1|v1beta)(?:\/models)?$/, "");
394
- if (binding.endpoint.protocol === "openai-chat-completions") return createChatLanguageModel(binding, new HttpTransport({ ...options, baseUrl: `${root}/v1`, apiKey, maxRetries: 0 }));
494
+ if (binding.endpoint.protocol === "openai-chat-completions") return createChatLanguageModel(binding, new HttpTransport({ ...options, fetch, baseUrl: `${root}/v1`, apiKey, maxRetries: 0 }));
395
495
  const headers = new Headers(options.headers);
396
496
  if (!headers.has("authorization")) headers.set("authorization", `Bearer ${apiKey}`);
397
497
  headers.set("x-nexra-sdk", `typescript/${SDK_VERSION}`);
398
- const common = { apiKey, headers: Object.fromEntries(headers), fetch: options.fetch };
498
+ const common = { apiKey, headers: Object.fromEntries(headers), fetch };
399
499
  let model;
400
500
  if (binding.endpoint.protocol === "gemini-generate-content") {
401
501
  model = createGoogleGenerativeAI({ ...common, name: "nexra.google", baseURL: `${root}/v1beta/models` })(binding.spec.id);
@@ -525,5 +625,7 @@ function withNativeUsage(model, binding) {
525
625
  };
526
626
  }
527
627
  export {
528
- createNexraLanguageModel
628
+ NexraNativeError,
629
+ createNexraLanguageModel,
630
+ createNexraNativeFetch
529
631
  };
package/dist/media.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  nexraMediaInputSchema,
11
11
  nexraMediaInputSchemaForMode,
12
12
  nexraMediaOperationForMode
13
- } from "./chunk-DKQZWIQ7.js";
13
+ } from "./chunk-QBW7OCT3.js";
14
14
  export {
15
15
  NEXRA_GENERATION_OPERATIONS,
16
16
  NEXRA_MEDIA_API_VERSION,
package/dist/types.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { A as AssetImportRequest, a as AssetInput, b as AssetReference, c as AssetUploadOptions, d as MediaAsset, e as MediaAssetStatus, f as MediaKind } from './assets-Cusrjj7_.js';
2
2
  export { C as CreateNexraDisplayQuoteBatchRequest, d as CreateNexraQuoteRequest, F as FetchLike, e as MediaGeometryField, f as MediaGeometryProjection, g as ModelCapabilitySummary, h as ModelDateVersion, i as ModelEndpointSummary, j as ModelModality, c as ModelResourceList, k as ModelResourceOption, b as ModelSchema, M as ModelSearchParams, l as NexraBillingCurrency, m as NexraCatalogRevision, N as NexraClientOptions, n as NexraDisplayQuoteBatch, o as NexraDisplayQuoteBatchEntry, p as NexraModelOperation, q as NexraModelSpec, r as NexraModelSpecFilter, s as NexraQuote, t as NexraSalePrice, u as NexraSalePriceList, v as NexraSettlement, a as TaskModel, T as TaskModelSummary, U as UnifiedMediaGeometry } from './media-geometry-DAVFGry1.js';
3
3
  export { C as CursorPage, a as JsonObject, b as JsonPrimitive, J as JsonValue } from './json-Cz0MkWQn.js';
4
- export { d as ApiErrorPayload, e as CreateTaskOptions, f as CreateTaskRequest, C as CreateVoiceRequest, N as NexraError, g as PublicError, h as PublicErrorContext, P as PublicErrorFields, i as RequestDetails, b as RunResult, R as RunTaskOptions, c as Task, k as TaskCost, l as TaskError, m as TaskEvent, n as TaskEventType, o as TaskListParams, p as TaskPage, q as TaskProgress, r as TaskReceipt, c as TaskResult, s as TaskStatus, t as TaskTiming, u as TaskUsage, v as TaskWebhookConfig, w as TerminalTaskStatus, x as VerifyWebhookOptions, V as Voice, a as VoiceCreation, W as WaitTaskOptions, y as WatchTaskOptions } from './voices-Cl4ygZHV.js';
4
+ export { A as ApiErrorPayload, N as NexraError, a as PublicError, b as PublicErrorContext, P as PublicErrorFields } from './errors-DZlSwyv8.js';
5
+ export { d as CreateTaskOptions, e as CreateTaskRequest, C as CreateVoiceRequest, f as RequestDetails, b as RunResult, R as RunTaskOptions, c as Task, h as TaskCost, i as TaskError, j as TaskEvent, k as TaskEventType, l as TaskListParams, m as TaskPage, n as TaskProgress, o as TaskReceipt, c as TaskResult, p as TaskStatus, q as TaskTiming, r as TaskUsage, s as TaskWebhookConfig, t as TerminalTaskStatus, u as VerifyWebhookOptions, V as Voice, a as VoiceCreation, W as WaitTaskOptions, v as WatchTaskOptions } from './voices-2zWJXgCq.js';
@@ -1,33 +1,7 @@
1
1
  import { c as AssetUploadOptions, d as MediaAsset, A as AssetImportRequest, g as AssetCertificationRequest, h as AssetCertification, i as AssetCertificationWaitOptions } from './assets-Cusrjj7_.js';
2
2
  import { H as HttpTransport, v as NexraSettlement } from './media-geometry-DAVFGry1.js';
3
- import { J as JsonValue, a as JsonObject, C as CursorPage } from './json-Cz0MkWQn.js';
4
-
5
- type PublicUpstreamUnavailableReason = "no_response" | "not_retained" | "unsupported_capture" | "error_not_emitted" | "size_limit";
6
- /** Network errors retain unknown codes from older or newer servers. */
7
- type NexraError = {
8
- code: string;
9
- message: string;
10
- param?: string;
11
- };
12
- type PublicErrorContext = {
13
- nexraRequestId?: string;
14
- nexraHttpStatus?: number;
15
- };
16
- type PublicErrorFields = PublicErrorContext & {
17
- nexraError?: NexraError;
18
- upstreamHttpStatus?: number;
19
- upstreamRequestId?: string;
20
- upstreamError?: JsonValue;
21
- upstreamRedacted?: true;
22
- upstreamTruncated?: true;
23
- upstreamUnavailableReason?: PublicUpstreamUnavailableReason;
24
- upstreamFormat?: "sse" | "decoded";
25
- upstreamEvent?: string;
26
- };
27
- type PublicError = PublicErrorFields & {
28
- nexraError: NexraError;
29
- };
30
- type ApiErrorPayload = PublicError;
3
+ import { a as JsonObject, J as JsonValue, C as CursorPage } from './json-Cz0MkWQn.js';
4
+ import { P as PublicErrorFields, a as PublicError, b as PublicErrorContext, N as NexraError } from './errors-DZlSwyv8.js';
31
5
 
32
6
  declare class AssetsClient {
33
7
  private readonly transport;
@@ -342,4 +316,4 @@ type VoiceCreation = Readonly<{
342
316
  voice: Voice;
343
317
  }>;
344
318
 
345
- export { AssetsClient as A, verifyWebhook as B, type CreateVoiceRequest as C, type NexraError as N, type PublicErrorFields as P, type RunTaskOptions as R, TasksClient as T, type Voice as V, type WaitTaskOptions as W, type VoiceCreation as a, type RunResult as b, type TaskResult as c, type ApiErrorPayload as d, type CreateTaskOptions as e, type CreateTaskRequest as f, type PublicError as g, type PublicErrorContext as h, type RequestDetails as i, TASK_STATUSES as j, type TaskCost as k, type TaskError as l, type TaskEvent as m, type TaskEventType as n, type TaskListParams as o, type TaskPage as p, type TaskProgress as q, type TaskReceipt as r, type TaskStatus as s, type TaskTiming as t, type TaskUsage as u, type TaskWebhookConfig as v, type TerminalTaskStatus as w, type VerifyWebhookOptions as x, type WatchTaskOptions as y, isTerminalTaskStatus as z };
319
+ export { AssetsClient as A, type CreateVoiceRequest as C, type RunTaskOptions as R, TasksClient as T, type Voice as V, type WaitTaskOptions as W, type VoiceCreation as a, type RunResult as b, type TaskResult as c, type CreateTaskOptions as d, type CreateTaskRequest as e, type RequestDetails as f, TASK_STATUSES as g, type TaskCost as h, type TaskError as i, type TaskEvent as j, type TaskEventType as k, type TaskListParams as l, type TaskPage as m, type TaskProgress as n, type TaskReceipt as o, type TaskStatus as p, type TaskTiming as q, type TaskUsage as r, type TaskWebhookConfig as s, type TerminalTaskStatus as t, type VerifyWebhookOptions as u, type WatchTaskOptions as v, isTerminalTaskStatus as w, verifyWebhook as x };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byte_fluffy/nexra-sdk",
3
- "version": "0.1.0-alpha.30",
3
+ "version": "0.1.0-alpha.31",
4
4
  "type": "module",
5
5
  "types": "./dist/index.d.ts",
6
6
  "sideEffects": false,