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

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-MNRDMPUS.js";
13
+ import "./chunk-QBW7OCT3.js";
14
14
  export {
15
15
  CatalogClient,
16
16
  applyMediaGeometry,
@@ -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 = [
@@ -30539,6 +30539,452 @@ var video_generated_default = [
30539
30539
  ],
30540
30540
  endpoints: []
30541
30541
  },
30542
+ {
30543
+ id: "minimax/minimax-h3-local-reference",
30544
+ contractVersion: 1,
30545
+ developer: "minimax",
30546
+ displayName: "MiniMax H3 Local Reference",
30547
+ summary: "Generate video from a prompt with reference images, videos and audio.",
30548
+ kind: "video",
30549
+ family: "H3 Local",
30550
+ versionLabel: "H3 Local Reference",
30551
+ aliases: [],
30552
+ capabilities: {
30553
+ inputModalities: [
30554
+ "text",
30555
+ "image",
30556
+ "video",
30557
+ "audio"
30558
+ ],
30559
+ outputModalities: [
30560
+ "video"
30561
+ ],
30562
+ inputModes: [
30563
+ "image-to-video",
30564
+ "video-to-video",
30565
+ "audio-to-video"
30566
+ ],
30567
+ features: [
30568
+ "reference-image",
30569
+ "reference-video",
30570
+ "reference-audio",
30571
+ "omni-reference"
30572
+ ]
30573
+ },
30574
+ operations: [
30575
+ {
30576
+ operation: "video.generate",
30577
+ inputModalities: [
30578
+ "text",
30579
+ "image",
30580
+ "video",
30581
+ "audio"
30582
+ ],
30583
+ outputModalities: [
30584
+ "video"
30585
+ ],
30586
+ inputSchema: {
30587
+ $schema: "https://json-schema.org/draft/2020-12/schema",
30588
+ type: "object",
30589
+ properties: {
30590
+ content: {
30591
+ type: "array",
30592
+ minItems: 2,
30593
+ items: {
30594
+ oneOf: [
30595
+ {
30596
+ type: "object",
30597
+ properties: {
30598
+ type: {
30599
+ const: "text"
30600
+ },
30601
+ text: {
30602
+ type: "string",
30603
+ minLength: 1
30604
+ },
30605
+ role: {
30606
+ type: "string",
30607
+ enum: [
30608
+ "prompt",
30609
+ "negative_prompt"
30610
+ ]
30611
+ }
30612
+ },
30613
+ required: [
30614
+ "type",
30615
+ "text",
30616
+ "role"
30617
+ ],
30618
+ additionalProperties: false,
30619
+ allOf: [
30620
+ {
30621
+ if: {
30622
+ type: "object",
30623
+ properties: {
30624
+ role: {
30625
+ const: "prompt"
30626
+ }
30627
+ },
30628
+ required: [
30629
+ "role"
30630
+ ]
30631
+ },
30632
+ then: {
30633
+ type: "object",
30634
+ properties: {
30635
+ text: {
30636
+ type: "string",
30637
+ maxLength: 2e4,
30638
+ minLength: 1,
30639
+ title: "Prompt"
30640
+ }
30641
+ }
30642
+ }
30643
+ },
30644
+ {
30645
+ if: {
30646
+ type: "object",
30647
+ properties: {
30648
+ role: {
30649
+ const: "negative_prompt"
30650
+ }
30651
+ },
30652
+ required: [
30653
+ "role"
30654
+ ]
30655
+ },
30656
+ then: {
30657
+ type: "object",
30658
+ properties: {
30659
+ text: {
30660
+ type: "string",
30661
+ maxLength: 1e4,
30662
+ title: "Negative Prompt",
30663
+ default: ""
30664
+ }
30665
+ }
30666
+ }
30667
+ }
30668
+ ]
30669
+ },
30670
+ {
30671
+ type: "object",
30672
+ properties: {
30673
+ type: {
30674
+ const: "image"
30675
+ },
30676
+ source: {
30677
+ oneOf: [
30678
+ {
30679
+ type: "string",
30680
+ minLength: 1
30681
+ },
30682
+ {
30683
+ type: "object",
30684
+ properties: {
30685
+ assetId: {
30686
+ type: "string",
30687
+ minLength: 1
30688
+ }
30689
+ },
30690
+ required: [
30691
+ "assetId"
30692
+ ],
30693
+ additionalProperties: false
30694
+ }
30695
+ ]
30696
+ },
30697
+ role: {
30698
+ type: "string",
30699
+ const: "reference"
30700
+ }
30701
+ },
30702
+ required: [
30703
+ "type",
30704
+ "source",
30705
+ "role"
30706
+ ],
30707
+ additionalProperties: false
30708
+ },
30709
+ {
30710
+ type: "object",
30711
+ properties: {
30712
+ type: {
30713
+ const: "video"
30714
+ },
30715
+ source: {
30716
+ oneOf: [
30717
+ {
30718
+ type: "string",
30719
+ minLength: 1
30720
+ },
30721
+ {
30722
+ type: "object",
30723
+ properties: {
30724
+ assetId: {
30725
+ type: "string",
30726
+ minLength: 1
30727
+ }
30728
+ },
30729
+ required: [
30730
+ "assetId"
30731
+ ],
30732
+ additionalProperties: false
30733
+ }
30734
+ ]
30735
+ },
30736
+ role: {
30737
+ type: "string",
30738
+ const: "reference"
30739
+ }
30740
+ },
30741
+ required: [
30742
+ "type",
30743
+ "source",
30744
+ "role"
30745
+ ],
30746
+ additionalProperties: false
30747
+ },
30748
+ {
30749
+ type: "object",
30750
+ properties: {
30751
+ type: {
30752
+ const: "audio"
30753
+ },
30754
+ source: {
30755
+ oneOf: [
30756
+ {
30757
+ type: "string",
30758
+ minLength: 1
30759
+ },
30760
+ {
30761
+ type: "object",
30762
+ properties: {
30763
+ assetId: {
30764
+ type: "string",
30765
+ minLength: 1
30766
+ }
30767
+ },
30768
+ required: [
30769
+ "assetId"
30770
+ ],
30771
+ additionalProperties: false
30772
+ }
30773
+ ]
30774
+ },
30775
+ role: {
30776
+ type: "string",
30777
+ const: "reference"
30778
+ }
30779
+ },
30780
+ required: [
30781
+ "type",
30782
+ "source",
30783
+ "role"
30784
+ ],
30785
+ additionalProperties: false
30786
+ }
30787
+ ]
30788
+ },
30789
+ "x-ui": {
30790
+ control: "content-parts",
30791
+ order: 0
30792
+ },
30793
+ maxItems: 17,
30794
+ description: "Provide a prompt and at least one image, video or audio reference.",
30795
+ allOf: [
30796
+ {
30797
+ contains: {
30798
+ type: "object",
30799
+ properties: {
30800
+ type: {
30801
+ const: "text"
30802
+ },
30803
+ role: {
30804
+ const: "prompt"
30805
+ }
30806
+ },
30807
+ required: [
30808
+ "type",
30809
+ "role"
30810
+ ]
30811
+ },
30812
+ minContains: 1,
30813
+ maxContains: 1
30814
+ },
30815
+ {
30816
+ contains: {
30817
+ type: "object",
30818
+ properties: {
30819
+ type: {
30820
+ const: "text"
30821
+ },
30822
+ role: {
30823
+ const: "negative_prompt"
30824
+ }
30825
+ },
30826
+ required: [
30827
+ "type",
30828
+ "role"
30829
+ ]
30830
+ },
30831
+ minContains: 0,
30832
+ maxContains: 1
30833
+ },
30834
+ {
30835
+ contains: {
30836
+ type: "object",
30837
+ properties: {
30838
+ type: {
30839
+ const: "image"
30840
+ },
30841
+ role: {
30842
+ const: "reference"
30843
+ }
30844
+ },
30845
+ required: [
30846
+ "type",
30847
+ "role"
30848
+ ]
30849
+ },
30850
+ minContains: 0,
30851
+ maxContains: 9
30852
+ },
30853
+ {
30854
+ contains: {
30855
+ type: "object",
30856
+ properties: {
30857
+ type: {
30858
+ const: "video"
30859
+ },
30860
+ role: {
30861
+ const: "reference"
30862
+ }
30863
+ },
30864
+ required: [
30865
+ "type",
30866
+ "role"
30867
+ ]
30868
+ },
30869
+ minContains: 0,
30870
+ maxContains: 3
30871
+ },
30872
+ {
30873
+ contains: {
30874
+ type: "object",
30875
+ properties: {
30876
+ type: {
30877
+ const: "audio"
30878
+ },
30879
+ role: {
30880
+ const: "reference"
30881
+ }
30882
+ },
30883
+ required: [
30884
+ "type",
30885
+ "role"
30886
+ ]
30887
+ },
30888
+ minContains: 0,
30889
+ maxContains: 3
30890
+ },
30891
+ {
30892
+ contains: {
30893
+ type: "object",
30894
+ properties: {
30895
+ type: {
30896
+ enum: [
30897
+ "image",
30898
+ "video",
30899
+ "audio"
30900
+ ]
30901
+ }
30902
+ },
30903
+ required: [
30904
+ "type"
30905
+ ]
30906
+ },
30907
+ minContains: 1
30908
+ }
30909
+ ]
30910
+ },
30911
+ aspect_ratio: {
30912
+ type: "string",
30913
+ title: "Aspect Ratio",
30914
+ default: "16:9",
30915
+ pattern: "^(?:1:1|2:3|3:2|3:4|4:3|9:16|16:9|21:9)(?: \\([^)]+\\))?$",
30916
+ "x-ui": {
30917
+ order: 10
30918
+ },
30919
+ enum: [
30920
+ "1:1",
30921
+ "2:3",
30922
+ "3:2",
30923
+ "3:4",
30924
+ "4:3",
30925
+ "9:16",
30926
+ "16:9",
30927
+ "21:9"
30928
+ ]
30929
+ },
30930
+ duration: {
30931
+ type: "number",
30932
+ maximum: 15,
30933
+ title: "\u89C6\u9891\u65F6\u957F",
30934
+ default: 5,
30935
+ minimum: 0.2,
30936
+ "x-ui": {
30937
+ order: 12,
30938
+ control: "range",
30939
+ unit: "\u79D2"
30940
+ }
30941
+ },
30942
+ seed: {
30943
+ type: "integer",
30944
+ minimum: 0,
30945
+ title: "\u968F\u673A\u79CD\u5B50",
30946
+ "x-ui": {
30947
+ order: 13,
30948
+ control: "number"
30949
+ }
30950
+ },
30951
+ resolution: {
30952
+ type: "string",
30953
+ title: "\u5206\u8FA8\u7387",
30954
+ enum: [
30955
+ "480P",
30956
+ "768P"
30957
+ ],
30958
+ "x-ui": {
30959
+ order: 11,
30960
+ control: "segmented"
30961
+ }
30962
+ }
30963
+ },
30964
+ required: [
30965
+ "content"
30966
+ ],
30967
+ additionalProperties: false
30968
+ },
30969
+ outputSchema: {},
30970
+ metering: {
30971
+ schemaVersion: 1,
30972
+ kind: "non_token",
30973
+ metrics: [
30974
+ {
30975
+ metric: "requests",
30976
+ requirement: "required"
30977
+ },
30978
+ {
30979
+ metric: "output_video_seconds",
30980
+ requirement: "required"
30981
+ }
30982
+ ]
30983
+ }
30984
+ }
30985
+ ],
30986
+ endpoints: []
30987
+ },
30542
30988
  {
30543
30989
  id: "agnes/agnes-video-v2-0",
30544
30990
  contractVersion: 1,
@@ -50448,7 +50894,7 @@ var NexraWaitTimeoutError = class extends Error {
50448
50894
  };
50449
50895
 
50450
50896
  // src/generated/version.generated.ts
50451
- var SDK_VERSION = "0.1.0-alpha.30";
50897
+ var SDK_VERSION = "0.1.0-alpha.32";
50452
50898
 
50453
50899
  // src/transport.ts
50454
50900
  var DEFAULT_BASE_URL = "https://api.nexra-ai.com/v1";
@@ -50583,39 +51029,14 @@ async function* parseServerSentEvents(response, options = {}) {
50583
51029
  void reader.cancel(options.signal?.reason).catch(() => void 0);
50584
51030
  };
50585
51031
  options.signal?.addEventListener("abort", abort, { once: true });
50586
- const decoder = new TextDecoder();
50587
- let buffer = "";
50588
- let current = emptyEvent();
51032
+ const decode = createServerSentEventDecoder();
50589
51033
  try {
50590
51034
  while (true) {
50591
51035
  if (options.signal?.aborted) throw options.signal.reason ?? new Error("SSE request was aborted");
50592
51036
  const { value, done } = await reader.read();
50593
51037
  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
- }
51038
+ for (const event of decode(value, done)) yield event;
51039
+ if (done) return;
50619
51040
  }
50620
51041
  } finally {
50621
51042
  options.signal?.removeEventListener("abort", abort);
@@ -50623,6 +51044,59 @@ async function* parseServerSentEvents(response, options = {}) {
50623
51044
  reader.releaseLock();
50624
51045
  }
50625
51046
  }
51047
+ function createServerSentEventDecoder() {
51048
+ const decode = createServerSentEventFrameDecoder();
51049
+ return (bytes, done) => decode(bytes, done).flatMap((frame) => frame.event ? [frame.event] : []);
51050
+ }
51051
+ function createServerSentEventFrameDecoder() {
51052
+ const decoder = new TextDecoder();
51053
+ let buffer = new Uint8Array();
51054
+ let cursor = 0;
51055
+ let lineStart = 0;
51056
+ let current = emptyEvent();
51057
+ const line = (value) => {
51058
+ if (value.startsWith(":")) return;
51059
+ const separator = value.indexOf(":");
51060
+ const field2 = separator === -1 ? value : value.slice(0, separator);
51061
+ let content = separator === -1 ? "" : value.slice(separator + 1);
51062
+ if (content.startsWith(" ")) content = content.slice(1);
51063
+ if (field2 === "data") current.data.push(content);
51064
+ else if (field2 === "event") current.event = content;
51065
+ else if (field2 === "id") current.id = content;
51066
+ else if (field2 === "retry") current.retry = Number(content);
51067
+ };
51068
+ return (bytes, done = false) => {
51069
+ const frames = [];
51070
+ if (bytes?.length) {
51071
+ const joined = new Uint8Array(buffer.length + bytes.length);
51072
+ joined.set(buffer);
51073
+ joined.set(bytes, buffer.length);
51074
+ buffer = joined;
51075
+ }
51076
+ let frameStart = 0;
51077
+ for (; cursor < buffer.length; cursor++) {
51078
+ if (buffer[cursor] !== 10) continue;
51079
+ const lineEnd = buffer[cursor - 1] === 13 ? cursor - 1 : cursor;
51080
+ if (lineEnd === lineStart) {
51081
+ frames.push({ event: buildEvent(current), bytes: buffer.slice(frameStart, cursor + 1) });
51082
+ current = emptyEvent();
51083
+ frameStart = cursor + 1;
51084
+ } else line(decoder.decode(buffer.subarray(lineStart, lineEnd)));
51085
+ lineStart = cursor + 1;
51086
+ }
51087
+ buffer = buffer.slice(frameStart);
51088
+ cursor -= frameStart;
51089
+ lineStart -= frameStart;
51090
+ if (done) {
51091
+ if (lineStart < buffer.length) line(decoder.decode(buffer.subarray(lineStart)));
51092
+ if (buffer.length) frames.push({ event: buildEvent(current), bytes: buffer });
51093
+ buffer = new Uint8Array();
51094
+ cursor = lineStart = 0;
51095
+ current = emptyEvent();
51096
+ }
51097
+ return frames;
51098
+ };
51099
+ }
50626
51100
  function emptyEvent() {
50627
51101
  return { data: [] };
50628
51102
  }
@@ -50829,6 +51303,7 @@ export {
50829
51303
  applyMediaGeometry,
50830
51304
  applyNoWatermark,
50831
51305
  parseServerSentEvents,
51306
+ createServerSentEventFrameDecoder,
50832
51307
  formatModelDisplayName,
50833
51308
  CatalogClient,
50834
51309
  getModelSpec,
@@ -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,
@@ -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-MNRDMPUS.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
+ createServerSentEventFrameDecoder,
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-MNRDMPUS.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,131 @@ 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 ?? record(record(body.response).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 = createServerSentEventFrameDecoder();
263
+ const reader = response.body.getReader();
264
+ const pending = [];
265
+ let finished = false;
266
+ let released = false;
267
+ let failure;
268
+ const release = () => {
269
+ if (!released) {
270
+ reader.releaseLock();
271
+ released = true;
272
+ }
273
+ };
274
+ const inspect = (event) => {
275
+ if (!event) return;
276
+ let body;
277
+ try {
278
+ body = JSON.parse(event.data);
279
+ } catch {
280
+ return event.event === "error" ? new NexraNativeError({ ...context, body: event.data, responseBody: event.data }) : void 0;
281
+ }
282
+ const payload = record(body);
283
+ if (event.event === "error" || payload.type === "error" || payload.type === "response.failed" || payload.error) {
284
+ return new NexraNativeError({ ...context, body, responseBody: event.data });
285
+ }
286
+ };
287
+ const stream = new ReadableStream({
288
+ async pull(controller) {
289
+ try {
290
+ while (!pending.length && !finished) {
291
+ const { value, done } = await reader.read();
292
+ for (const frame of decode(value, done)) {
293
+ failure = inspect(frame.event);
294
+ if (failure) {
295
+ finished = true;
296
+ await reader.cancel(failure).catch(() => void 0);
297
+ release();
298
+ break;
299
+ }
300
+ pending.push(frame.bytes);
301
+ }
302
+ if (done) {
303
+ finished = true;
304
+ release();
305
+ }
306
+ }
307
+ if (pending.length) controller.enqueue(pending.shift());
308
+ else if (failure) controller.error(failure);
309
+ else controller.close();
310
+ } catch (error) {
311
+ await reader.cancel(error).catch(() => void 0);
312
+ release();
313
+ controller.error(error);
314
+ }
315
+ },
316
+ async cancel(reason) {
317
+ pending.length = 0;
318
+ if (!released) {
319
+ await reader.cancel(reason);
320
+ release();
321
+ }
322
+ }
323
+ }, { highWaterMark: 0 });
324
+ return new Response(stream, { status: response.status, statusText: response.statusText, headers: response.headers });
325
+ }
326
+
197
327
  // src/language/chat-model.ts
198
328
  function object2(value) {
199
329
  return value && typeof value === "object" && !Array.isArray(value) ? value : {};
@@ -222,8 +352,14 @@ function finishReason(raw) {
222
352
  function invalid(data, message) {
223
353
  throw new InvalidResponseDataError({ data, message });
224
354
  }
225
- function choices(payload) {
226
- if (payload.error) invalid(payload.error, "Nexra returned a language error");
355
+ function choices(payload, response, headers) {
356
+ if (payload.error) throw new NexraNativeError({
357
+ url: response.url,
358
+ statusCode: response.status,
359
+ headers: response.headers,
360
+ body: payload,
361
+ acceptLanguage: headers?.["accept-language"] ?? headers?.["Accept-Language"]
362
+ });
227
363
  if (!Array.isArray(payload.choices)) invalid(payload, "Chat Completions response is missing choices");
228
364
  if (payload.choices.length > 1) invalid(payload, "Multiple Chat Completions choices are unsupported");
229
365
  return payload.choices.map(object2);
@@ -241,7 +377,7 @@ function createChatLanguageModel(binding, transport) {
241
377
  const body = chatRequest(binding, options, false);
242
378
  const response = await transport.response("/chat/completions", { method: "POST", ...jsonBody(body), headers: combineHeaders(options), signal: options.abortSignal }, { retryable: false });
243
379
  const payload = object2(await response.json());
244
- const choice = choices(payload)[0];
380
+ const choice = choices(payload, response, options.headers)[0];
245
381
  if (!choice || typeof choice.finish_reason !== "string") invalid(payload, "Chat Completions response is incomplete");
246
382
  const message = object2(choice.message);
247
383
  const content = [];
@@ -305,7 +441,7 @@ function createChatLanguageModel(binding, transport) {
305
441
  controller.enqueue({ type: "response-metadata", id: typeof payload.id === "string" ? payload.id : void 0, modelId: typeof payload.model === "string" ? payload.model : void 0 });
306
442
  metadataSent = true;
307
443
  }
308
- const choice = choices(payload)[0];
444
+ const choice = choices(payload, response, options.headers)[0];
309
445
  if (payload.usage) rawUsage = payload.usage;
310
446
  if (!choice) continue;
311
447
  if (choice.finish_reason != null) reason = choice.finish_reason;
@@ -389,26 +525,45 @@ function createNexraLanguageModel(modelId, options) {
389
525
  const binding = getLanguageModelBinding(modelId, options);
390
526
  const apiKey = options.apiKey.trim();
391
527
  if (!apiKey) throw new Error("Nexra language model requires an API key");
528
+ const fetch = createNexraNativeFetch(options);
392
529
  const transport = new HttpTransport({ ...options, baseUrl: options.baseUrl?.trim().replace(/\/+$/, ""), apiKey, maxRetries: 0 });
393
530
  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 }));
531
+ if (binding.endpoint.protocol === "openai-chat-completions") return createChatLanguageModel(binding, new HttpTransport({ ...options, fetch, baseUrl: `${root}/v1`, apiKey, maxRetries: 0 }));
395
532
  const headers = new Headers(options.headers);
396
533
  if (!headers.has("authorization")) headers.set("authorization", `Bearer ${apiKey}`);
397
534
  headers.set("x-nexra-sdk", `typescript/${SDK_VERSION}`);
398
- const common = { apiKey, headers: Object.fromEntries(headers), fetch: options.fetch };
535
+ const common = { apiKey, headers: Object.fromEntries(headers), fetch };
399
536
  let model;
400
537
  if (binding.endpoint.protocol === "gemini-generate-content") {
401
538
  model = createGoogleGenerativeAI({ ...common, name: "nexra.google", baseURL: `${root}/v1beta/models` })(binding.spec.id);
402
539
  } else if (binding.endpoint.protocol === "openai-responses") {
403
- model = createOpenAI({ ...common, name: "nexra.openai", baseURL: `${root}/v1` }).responses(binding.spec.id);
540
+ const responsesFetch = (input, init) => fetch(
541
+ input,
542
+ typeof init?.body === "string" ? { ...init, body: JSON.stringify(explicitResponsesMessages(JSON.parse(init.body))) } : init
543
+ );
544
+ model = createOpenAI({ ...common, name: "nexra.openai", baseURL: `${root}/v1`, fetch: responsesFetch }).responses(binding.spec.id);
404
545
  } else {
405
546
  model = createAnthropic({ ...common, name: "nexra.anthropic", baseURL: `${root}/v1` })(binding.spec.id);
406
547
  }
407
- return withNativeUsage(model, binding);
548
+ return withNativeContract(model, binding);
408
549
  }
409
550
  function object3(value) {
410
551
  return value && typeof value === "object" && !Array.isArray(value) ? value : {};
411
552
  }
553
+ function explicitResponsesMessages(value) {
554
+ const body = object3(value);
555
+ if (!Array.isArray(body.input)) return value;
556
+ return { ...body, input: body.input.map((value2) => {
557
+ const item = object3(value2);
558
+ return item.type === void 0 && ["system", "developer", "user", "assistant"].includes(String(item.role)) && (typeof item.content === "string" || Array.isArray(item.content)) ? { ...item, type: "message" } : value2;
559
+ }) };
560
+ }
561
+ function nativeRequest(protocol, request, stream = false) {
562
+ return protocol === "openai-responses" && request ? {
563
+ ...request,
564
+ body: explicitResponsesMessages(stream ? { ...object3(request.body), stream: true } : request.body)
565
+ } : request;
566
+ }
412
567
  function prepare(options, binding, stream) {
413
568
  options = prepareLanguageReasoning(options, binding);
414
569
  const properties = object3(binding.endpoint.inputSchema?.properties);
@@ -472,7 +627,7 @@ function mergeRecords(previous, next) {
472
627
  }
473
628
  return merged;
474
629
  }
475
- function withNativeUsage(model, binding) {
630
+ function withNativeContract(model, binding) {
476
631
  return {
477
632
  specificationVersion: "v4",
478
633
  provider: model.provider,
@@ -481,7 +636,11 @@ function withNativeUsage(model, binding) {
481
636
  async doGenerate(options) {
482
637
  const result = await model.doGenerate(prepare(options, binding, false));
483
638
  const raw = nativeUsage(binding.endpoint.protocol, result.response?.body);
484
- return raw ? { ...result, usage: { ...result.usage, raw } } : result;
639
+ return {
640
+ ...result,
641
+ request: nativeRequest(binding.endpoint.protocol, result.request),
642
+ ...raw ? { usage: { ...result.usage, raw } } : {}
643
+ };
485
644
  },
486
645
  async doStream(options) {
487
646
  if (!binding.supportsStreaming) throw new Error(`Nexra model does not support streaming: ${binding.spec.id}`);
@@ -492,38 +651,44 @@ function withNativeUsage(model, binding) {
492
651
  let finish;
493
652
  const textMetadata = /* @__PURE__ */ new Map();
494
653
  const reasoningMetadata2 = /* @__PURE__ */ new Map();
495
- return { ...result, stream: result.stream.pipeThrough(new TransformStream({
496
- transform(part, controller) {
497
- if (part.type === "raw") {
498
- const payload = object3(part.rawValue);
499
- terminal ||= binding.endpoint.protocol === "anthropic-messages" ? payload.type === "message_stop" : binding.endpoint.protocol === "openai-responses" ? ["response.completed", "response.incomplete", "response.failed"].includes(String(payload.type)) : Array.isArray(payload.candidates) && payload.candidates.some((candidate) => typeof object3(candidate).finishReason === "string");
500
- const next = nativeUsage(binding.endpoint.protocol, part.rawValue);
501
- if (next) raw = mergeRecords(raw, next);
502
- if (options.includeRawChunks) controller.enqueue(part);
503
- } else if (part.type === "finish") finish = part;
504
- else {
505
- if (part.type === "error") failed = true;
506
- if (part.type === "text-start" || part.type === "text-delta" || part.type === "text-end" || part.type === "reasoning-start" || part.type === "reasoning-delta" || part.type === "reasoning-end") {
507
- const metadata = part.type.startsWith("text-") ? textMetadata : reasoningMetadata2;
508
- if (part.providerMetadata) metadata.set(part.id, mergeRecords(metadata.get(part.id), part.providerMetadata));
509
- if (part.type === "text-end" || part.type === "reasoning-end") {
510
- const retained = metadata.get(part.id);
511
- metadata.delete(part.id);
512
- if (retained) part = { ...part, providerMetadata: retained };
654
+ return {
655
+ ...result,
656
+ request: nativeRequest(binding.endpoint.protocol, result.request, true),
657
+ stream: result.stream.pipeThrough(new TransformStream({
658
+ transform(part, controller) {
659
+ if (part.type === "raw") {
660
+ const payload = object3(part.rawValue);
661
+ terminal ||= binding.endpoint.protocol === "anthropic-messages" ? payload.type === "message_stop" : binding.endpoint.protocol === "openai-responses" ? ["response.completed", "response.incomplete", "response.failed"].includes(String(payload.type)) : Array.isArray(payload.candidates) && payload.candidates.some((candidate) => typeof object3(candidate).finishReason === "string");
662
+ const next = nativeUsage(binding.endpoint.protocol, part.rawValue);
663
+ if (next) raw = mergeRecords(raw, next);
664
+ if (options.includeRawChunks) controller.enqueue(part);
665
+ } else if (part.type === "finish") finish = part;
666
+ else {
667
+ if (part.type === "error") failed = true;
668
+ if (part.type === "text-start" || part.type === "text-delta" || part.type === "text-end" || part.type === "reasoning-start" || part.type === "reasoning-delta" || part.type === "reasoning-end") {
669
+ const metadata = part.type.startsWith("text-") ? textMetadata : reasoningMetadata2;
670
+ if (part.providerMetadata) metadata.set(part.id, mergeRecords(metadata.get(part.id), part.providerMetadata));
671
+ if (part.type === "text-end" || part.type === "reasoning-end") {
672
+ const retained = metadata.get(part.id);
673
+ metadata.delete(part.id);
674
+ if (retained) part = { ...part, providerMetadata: retained };
675
+ }
513
676
  }
677
+ controller.enqueue(part);
514
678
  }
515
- controller.enqueue(part);
679
+ },
680
+ flush(controller) {
681
+ if (failed) return;
682
+ if (!terminal || !finish) controller.enqueue({ type: "error", error: new Error(`Nexra ${binding.endpoint.protocol} stream ended before its terminal response`) });
683
+ else controller.enqueue(raw ? { ...finish, usage: { ...finish.usage, raw } } : finish);
516
684
  }
517
- },
518
- flush(controller) {
519
- if (failed) return;
520
- if (!terminal || !finish) controller.enqueue({ type: "error", error: new Error(`Nexra ${binding.endpoint.protocol} stream ended before its terminal response`) });
521
- else controller.enqueue(raw ? { ...finish, usage: { ...finish.usage, raw } } : finish);
522
- }
523
- })) };
685
+ }))
686
+ };
524
687
  }
525
688
  };
526
689
  }
527
690
  export {
528
- createNexraLanguageModel
691
+ NexraNativeError,
692
+ createNexraLanguageModel,
693
+ createNexraNativeFetch
529
694
  };
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.32",
4
4
  "type": "module",
5
5
  "types": "./dist/index.d.ts",
6
6
  "sideEffects": false,