@byte_fluffy/nexra-sdk 0.1.0-alpha.27 → 0.1.0-alpha.29

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/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  export { a as AssetImportRequest, b as AssetInput, A as AssetReference, c as AssetUploadOptions, M as MEDIA_KINDS, d as MediaAsset, e as MediaAssetStatus, f as MediaKind } from './assets-dUJMQNJD.js';
2
- import { H as HttpTransport, q as ModelSearchParams, T as TaskModelSummary, r as TaskModel, s as ModelSchema, t as ModelResourceList, u as NexraClientOptions } from './media-geometry-B7ip-nrA.js';
3
- export { b as CreateNexraDisplayQuoteBatchRequest, C as CreateNexraQuoteRequest, F as FetchLike, M as MediaGeometryField, g as MediaGeometryProjection, v as ModelCapabilitySummary, w as ModelDateVersion, x as ModelEndpointSummary, y as ModelModality, z as ModelResourceOption, h as NexraBillingCurrency, d as NexraCatalogRevision, c as NexraDisplayQuoteBatch, A as NexraDisplayQuoteBatchEntry, j as NexraModelOperation, e as NexraModelSpec, f as NexraModelSpecFilter, a as NexraQuote, k as NexraSalePrice, N as NexraSalePriceList, l as NexraSettlement, U as UnifiedMediaGeometry, m as applyMediaGeometry, n as decodeMediaGeometry, o as encodeMediaGeometry, p as projectMediaGeometry } from './media-geometry-B7ip-nrA.js';
2
+ import { H as HttpTransport, u as ModelSearchParams, T as TaskModelSummary, v as TaskModel, w as ModelSchema, x as ModelResourceList, y as NexraClientOptions } from './media-geometry-nJ7I7ohO.js';
3
+ export { e as CreateNexraDisplayQuoteBatchRequest, C as CreateNexraQuoteRequest, F as FetchLike, M as MediaGeometryField, k as MediaGeometryProjection, z as ModelCapabilitySummary, A as ModelDateVersion, B as ModelEndpointSummary, D as ModelModality, E as ModelResourceOption, l as NexraBillingCurrency, g as NexraCatalogRevision, f as NexraDisplayQuoteBatch, G as NexraDisplayQuoteBatchEntry, n as NexraModelOperation, h as NexraModelSpec, j as NexraModelSpecFilter, d as NexraQuote, o as NexraSalePrice, c as NexraSalePriceList, p as NexraSettlement, U as UnifiedMediaGeometry, q as applyMediaGeometry, r as decodeMediaGeometry, s as encodeMediaGeometry, t as projectMediaGeometry } from './media-geometry-nJ7I7ohO.js';
4
4
  import { C as CursorPage, a as JsonValue } from './json-Drjj1OKl.js';
5
5
  export { J as JsonObject, b as JsonPrimitive } from './json-Drjj1OKl.js';
6
- import { V as Voice, C as CreateVoiceRequest, a as VoiceCreation, A as AssetsClient, T as TasksClient, R as RunTaskOptions, b as RunResult, c as ApiErrorPayload, d as TaskResult } from './types-CGOhwG87.js';
7
- export { e as CreateTaskOptions, f as CreateTaskRequest, g as RequestDetails, h as TASK_STATUSES, i as Task, j as TaskCost, k as TaskError, l as TaskEvent, m as TaskEventType, n as TaskListParams, o as TaskPage, p as TaskProgress, q as TaskReceipt, r as TaskStatus, s as TaskTiming, t as TaskUsage, u as TaskWebhookConfig, v as TerminalTaskStatus, w as VerifyWebhookOptions, W as WaitTaskOptions, x as WatchTaskOptions, y as isTerminalTaskStatus, z as verifyWebhook } from './types-CGOhwG87.js';
6
+ import { V as Voice, C as CreateVoiceRequest, a as VoiceCreation, A as AssetsClient, T as TasksClient, R as RunTaskOptions, b as RunResult, c as ApiErrorPayload, d as TaskResult } from './types-B3Xee2AJ.js';
7
+ export { e as CreateTaskOptions, f as CreateTaskRequest, g as RequestDetails, h as TASK_STATUSES, i as Task, j as TaskCost, k as TaskError, l as TaskEvent, m as TaskEventType, n as TaskListParams, o as TaskPage, p as TaskProgress, q as TaskReceipt, r as TaskStatus, s as TaskTiming, t as TaskUsage, u as TaskWebhookConfig, v as TerminalTaskStatus, w as VerifyWebhookOptions, W as WaitTaskOptions, x as WatchTaskOptions, y as isTerminalTaskStatus, z as verifyWebhook } from './types-B3Xee2AJ.js';
8
8
  import { CatalogClient } from './catalog.js';
9
- export { getModelSpec, listModelSpecs } from './catalog.js';
9
+ export { formatModelDisplayName, getModelSpec, listModelSpecs } from './catalog.js';
10
10
  export { ceilDecimal, multiplyDecimal } from './decimal.js';
11
11
 
12
12
  declare class ModelsClient {
package/dist/index.js CHANGED
@@ -1,3 +1,7 @@
1
+ import {
2
+ ceilDecimal,
3
+ multiplyDecimal
4
+ } from "./chunk-FCH5IQP5.js";
1
5
  import {
2
6
  CatalogClient,
3
7
  HttpTransport,
@@ -8,23 +12,21 @@ import {
8
12
  applyNoWatermark,
9
13
  decodeMediaGeometry,
10
14
  encodeMediaGeometry,
15
+ formatModelDisplayName,
11
16
  getModelSpec,
12
17
  jsonBody,
13
18
  listModelSpecs,
19
+ parseServerSentEvents,
14
20
  projectMediaGeometry,
15
21
  queryString,
16
22
  sleep
17
- } from "./chunk-N622DGTD.js";
18
- import {
19
- ceilDecimal,
20
- multiplyDecimal
21
- } from "./chunk-FCH5IQP5.js";
23
+ } from "./chunk-ESV6ODRA.js";
22
24
  import {
23
25
  MEDIA_KINDS,
24
26
  TASK_STATUSES,
25
27
  createTaskRequest,
26
28
  isTerminalTaskStatus
27
- } from "./chunk-YQXMWTSV.js";
29
+ } from "./chunk-IEBCNRT4.js";
28
30
 
29
31
  // src/assets.ts
30
32
  var AssetsClient = class {
@@ -133,13 +135,16 @@ function isFile(value) {
133
135
  }
134
136
 
135
137
  // src/models.ts
138
+ function withModelDisplayName(model) {
139
+ return { ...model, displayName: formatModelDisplayName(model.displayName) };
140
+ }
136
141
  var ModelsClient = class {
137
142
  constructor(transport) {
138
143
  this.transport = transport;
139
144
  }
140
145
  transport;
141
- search(params = {}, signal) {
142
- return this.transport.json(
146
+ async search(params = {}, signal) {
147
+ const page = await this.transport.json(
143
148
  `/models${queryString({
144
149
  q: params.query,
145
150
  modality: params.modality,
@@ -150,11 +155,16 @@ var ModelsClient = class {
150
155
  })}`,
151
156
  { signal }
152
157
  );
158
+ return { ...page, data: page.data.map(withModelDisplayName) };
153
159
  }
154
- get(model, signal) {
155
- return this.transport.json(`/models/${encodeURIComponent(model)}`, {
160
+ async get(model, signal) {
161
+ const detail = await this.transport.json(`/models/${encodeURIComponent(model)}`, {
156
162
  signal
157
163
  });
164
+ return {
165
+ ...withModelDisplayName(detail),
166
+ ...detail.familyVersions ? { familyVersions: detail.familyVersions.map(withModelDisplayName) } : {}
167
+ };
158
168
  }
159
169
  schema(model, signal) {
160
170
  return this.transport.json(
@@ -255,55 +265,6 @@ function isMediaAsset(value) {
255
265
  return isPlainObject(value) && typeof value.id === "string" && typeof value.kind === "string" && typeof value.status === "string" && typeof value.source === "string";
256
266
  }
257
267
 
258
- // src/sse.ts
259
- async function* parseServerSentEvents(response) {
260
- if (!response.body) throw new Error("SSE response did not contain a body");
261
- const reader = response.body.getReader();
262
- const decoder = new TextDecoder();
263
- let buffer = "";
264
- let current = emptyEvent();
265
- while (true) {
266
- const { value, done } = await reader.read();
267
- buffer += decoder.decode(value, { stream: !done });
268
- const lines = buffer.split(/\r?\n/);
269
- buffer = done ? "" : lines.pop() ?? "";
270
- for (const line of lines) {
271
- if (line === "") {
272
- const event = buildEvent(current);
273
- current = emptyEvent();
274
- if (event) yield event;
275
- continue;
276
- }
277
- if (line.startsWith(":")) continue;
278
- const separator = line.indexOf(":");
279
- const field = separator === -1 ? line : line.slice(0, separator);
280
- let content = separator === -1 ? "" : line.slice(separator + 1);
281
- if (content.startsWith(" ")) content = content.slice(1);
282
- if (field === "data") current.data.push(content);
283
- else if (field === "event") current.event = content;
284
- else if (field === "id") current.id = content;
285
- else if (field === "retry") current.retry = Number(content);
286
- }
287
- if (done) {
288
- const event = buildEvent(current);
289
- if (event) yield event;
290
- return;
291
- }
292
- }
293
- }
294
- function emptyEvent() {
295
- return { data: [] };
296
- }
297
- function buildEvent(pending) {
298
- if (pending.data.length === 0) return void 0;
299
- return {
300
- id: pending.id,
301
- event: pending.event,
302
- retry: Number.isFinite(pending.retry) ? pending.retry : void 0,
303
- data: pending.data.join("\n")
304
- };
305
- }
306
-
307
268
  // src/tasks.ts
308
269
  var TasksClient = class {
309
270
  constructor(transport, assets) {
@@ -539,6 +500,7 @@ export {
539
500
  createNexra,
540
501
  decodeMediaGeometry,
541
502
  encodeMediaGeometry,
503
+ formatModelDisplayName,
542
504
  getModelSpec,
543
505
  isTerminalTaskStatus,
544
506
  listModelSpecs,
@@ -0,0 +1,16 @@
1
+ import { LanguageModelV4 } from '@ai-sdk/provider';
2
+ import { NexraLanguageProtocol } from './catalog.js';
3
+ export { NexraLanguageModelBinding } from './catalog.js';
4
+ import { F as FetchLike } from './media-geometry-nJ7I7ohO.js';
5
+ import './json-Drjj1OKl.js';
6
+
7
+ type NexraLanguageModelOptions = {
8
+ apiKey: string;
9
+ baseUrl?: string;
10
+ fetch?: FetchLike;
11
+ headers?: HeadersInit;
12
+ protocol?: NexraLanguageProtocol;
13
+ };
14
+ declare function createNexraLanguageModel(modelId: string, options: NexraLanguageModelOptions): LanguageModelV4;
15
+
16
+ export { type NexraLanguageModelOptions, NexraLanguageProtocol, createNexraLanguageModel };