@byte_fluffy/nexra-sdk 0.1.0-alpha.21 → 0.1.0-alpha.22
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/README.md +11 -12
- package/dist/catalog.d.ts +2 -3
- package/dist/catalog.js +1 -2
- package/dist/{chunk-WU62FGYW.js → chunk-2DKVYO26.js} +16414 -11152
- package/dist/index.d.ts +5 -8
- package/dist/index.js +23 -16
- package/dist/{media-geometry-Bo6ukeIQ.d.ts → media-geometry-Ckr1-Mh3.d.ts} +21 -34
- package/dist/{types-DPLgTh8D.d.ts → types-CcYROaH1.d.ts} +76 -29
- package/dist/types.d.ts +2 -4
- package/package.json +1 -5
- package/dist/assets-dUJMQNJD.d.ts +0 -61
- package/dist/chunk-TA3YGQQY.js +0 -386
- package/dist/json-Drjj1OKl.d.ts +0 -11
- package/dist/media.d.ts +0 -200
- package/dist/media.js +0 -26
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export { J as JsonObject, b as JsonPrimitive } from './json-Drjj1OKl.js';
|
|
6
|
-
import { A as AssetsClient, T as TasksClient, R as RunTaskOptions, a as RunResult, b as ApiErrorPayload, c as TaskResult } from './types-DPLgTh8D.js';
|
|
7
|
-
export { C as CreateTaskOptions, d as CreateTaskRequest, e as RequestDetails, f as TASK_STATUSES, g 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, p as TaskStatus, q as TaskTiming, r as TaskUsage, s as TaskWebhookConfig, t as TerminalTaskStatus, V as VerifyWebhookOptions, W as WaitTaskOptions, u as WatchTaskOptions, v as isTerminalTaskStatus, w as verifyWebhook } from './types-DPLgTh8D.js';
|
|
1
|
+
import { A as AssetsClient, T as TasksClient, R as RunTaskOptions, a as RunResult, b as ApiErrorPayload, c as TaskResult } from './types-CcYROaH1.js';
|
|
2
|
+
export { d as AssetImportRequest, e as AssetInput, f as AssetReference, g as AssetUploadOptions, C as CreateTaskOptions, h as CreateTaskRequest, M as MEDIA_KINDS, i as MediaAsset, j as MediaAssetStatus, k as MediaKind, l as RequestDetails, m as TASK_STATUSES, n as Task, o as TaskCost, p as TaskError, q as TaskEvent, r as TaskEventType, s as TaskListParams, t as TaskPage, u as TaskProgress, v as TaskReceipt, w as TaskStatus, x as TaskTiming, y as TaskUsage, z as TaskWebhookConfig, B as TerminalTaskStatus, V as VerifyWebhookOptions, W as WaitTaskOptions, D as WatchTaskOptions, E as isTerminalTaskStatus, F as verifyWebhook } from './types-CcYROaH1.js';
|
|
3
|
+
import { H as HttpTransport, q as ModelSearchParams, r as CursorPage, T as TaskModelSummary, s as TaskModel, t as ModelSchema, u as NexraClientOptions, J as JsonValue } from './media-geometry-Ckr1-Mh3.js';
|
|
4
|
+
export { b as CreateNexraDisplayQuoteBatchRequest, C as CreateNexraQuoteRequest, F as FetchLike, v as JsonObject, w as JsonPrimitive, M as MediaGeometryField, g as MediaGeometryProjection, x as ModelCapabilitySummary, y as ModelDateVersion, z as ModelEndpointSummary, A as ModelModality, B as ModelResourceList, D as ModelResourceOption, h as NexraBillingCurrency, d as NexraCatalogRevision, c as NexraDisplayQuoteBatch, E 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-Ckr1-Mh3.js';
|
|
8
5
|
import { CatalogClient } from './catalog.js';
|
|
9
6
|
export { getModelSpec, listModelSpecs } from './catalog.js';
|
|
10
7
|
export { ceilDecimal, multiplyDecimal } from './decimal.js';
|
|
@@ -23,7 +20,7 @@ declare class NexraClient {
|
|
|
23
20
|
readonly models: ModelsClient;
|
|
24
21
|
readonly tasks: TasksClient;
|
|
25
22
|
constructor(options?: NexraClientOptions);
|
|
26
|
-
run<TOutput = JsonValue, TInput = Record<string, unknown>>(model: string,
|
|
23
|
+
run<TOutput = JsonValue, TInput = Record<string, unknown>>(model: string, options: RunTaskOptions<TInput>): Promise<RunResult<TOutput>>;
|
|
27
24
|
}
|
|
28
25
|
declare function createNexra(options?: NexraClientOptions): NexraClient;
|
|
29
26
|
|
package/dist/index.js
CHANGED
|
@@ -1,30 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CatalogClient,
|
|
3
3
|
HttpTransport,
|
|
4
|
+
MEDIA_KINDS,
|
|
4
5
|
NexraApiError,
|
|
5
6
|
NexraTaskError,
|
|
6
7
|
NexraWaitTimeoutError,
|
|
8
|
+
TASK_STATUSES,
|
|
7
9
|
applyMediaGeometry,
|
|
8
10
|
applyNoWatermark,
|
|
9
11
|
decodeMediaGeometry,
|
|
10
12
|
encodeMediaGeometry,
|
|
11
13
|
getModelSpec,
|
|
14
|
+
isTerminalTaskStatus,
|
|
12
15
|
jsonBody,
|
|
13
16
|
listModelSpecs,
|
|
14
17
|
projectMediaGeometry,
|
|
15
18
|
queryString,
|
|
16
19
|
sleep
|
|
17
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-2DKVYO26.js";
|
|
18
21
|
import {
|
|
19
22
|
ceilDecimal,
|
|
20
23
|
multiplyDecimal
|
|
21
24
|
} from "./chunk-FCH5IQP5.js";
|
|
22
|
-
import {
|
|
23
|
-
MEDIA_KINDS,
|
|
24
|
-
TASK_STATUSES,
|
|
25
|
-
createTaskRequest,
|
|
26
|
-
isTerminalTaskStatus
|
|
27
|
-
} from "./chunk-TA3YGQQY.js";
|
|
28
25
|
|
|
29
26
|
// src/assets.ts
|
|
30
27
|
var AssetsClient = class {
|
|
@@ -282,18 +279,28 @@ var TasksClient = class {
|
|
|
282
279
|
}
|
|
283
280
|
transport;
|
|
284
281
|
assets;
|
|
285
|
-
async create(model,
|
|
282
|
+
async create(model, options) {
|
|
286
283
|
const schema = getModelSpec(model)?.operations[0]?.inputSchema;
|
|
287
|
-
const mapped = schema && input && typeof input === "object" && !Array.isArray(input) ? applyNoWatermark(schema, applyMediaGeometry(schema, input)) : input;
|
|
288
|
-
const
|
|
289
|
-
|
|
284
|
+
const mapped = schema && options.input && typeof options.input === "object" && !Array.isArray(options.input) ? applyNoWatermark(schema, applyMediaGeometry(schema, options.input)) : options.input;
|
|
285
|
+
const input = await normalizeTaskInput(mapped, this.assets, options.signal);
|
|
286
|
+
if (input.model !== void 0 && input.model !== model) {
|
|
287
|
+
throw new TypeError(`Task input model ${String(input.model)} does not match ${model}`);
|
|
288
|
+
}
|
|
289
|
+
const parameters = { ...input };
|
|
290
|
+
delete parameters.model;
|
|
291
|
+
for (const field of ["quoteToken", "submittedAt", "metadata", "callback_url", "webhook", "schemaVersion"]) {
|
|
292
|
+
if (Object.hasOwn(parameters, field)) throw new TypeError(`Task input cannot use reserved field: ${field}`);
|
|
293
|
+
}
|
|
294
|
+
const body = {
|
|
295
|
+
...parameters,
|
|
296
|
+
model,
|
|
290
297
|
quoteToken: options.quoteToken,
|
|
291
298
|
submittedAt: options.submittedAt,
|
|
292
299
|
metadata: options.metadata,
|
|
293
300
|
callback_url: options.callback_url,
|
|
294
301
|
webhook: options.webhook,
|
|
295
302
|
schemaVersion: options.schemaVersion
|
|
296
|
-
}
|
|
303
|
+
};
|
|
297
304
|
const idempotencyKey = options.idempotencyKey ?? crypto.randomUUID();
|
|
298
305
|
return this.transport.json(
|
|
299
306
|
"/tasks",
|
|
@@ -399,8 +406,8 @@ var TasksClient = class {
|
|
|
399
406
|
if (timeout) clearTimeout(timeout);
|
|
400
407
|
}
|
|
401
408
|
}
|
|
402
|
-
async run(model,
|
|
403
|
-
const task = await this.create(model,
|
|
409
|
+
async run(model, options) {
|
|
410
|
+
const task = await this.create(model, options);
|
|
404
411
|
let completed;
|
|
405
412
|
try {
|
|
406
413
|
completed = await this.wait(task.id, options);
|
|
@@ -441,8 +448,8 @@ var NexraClient = class {
|
|
|
441
448
|
this.models = new ModelsClient(transport);
|
|
442
449
|
this.tasks = new TasksClient(transport, this.assets);
|
|
443
450
|
}
|
|
444
|
-
run(model,
|
|
445
|
-
return this.tasks.run(model,
|
|
451
|
+
run(model, options) {
|
|
452
|
+
return this.tasks.run(model, options);
|
|
446
453
|
}
|
|
447
454
|
};
|
|
448
455
|
function createNexra(options = {}) {
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
type JsonPrimitive = boolean | number | string | null;
|
|
2
|
+
type JsonValue = JsonPrimitive | JsonObject | JsonValue[];
|
|
3
|
+
interface JsonObject {
|
|
4
|
+
[key: string]: JsonValue;
|
|
5
|
+
}
|
|
6
|
+
interface CursorPage<T> {
|
|
7
|
+
data: T[];
|
|
8
|
+
nextCursor?: string;
|
|
9
|
+
}
|
|
2
10
|
|
|
3
11
|
declare const BILLING_METRICS: readonly ["requests", "input_tokens", "cached_input_tokens", "cache_write_tokens", "cache_creation_5m_input_tokens", "cache_creation_1h_input_tokens", "cache_read_input_tokens", "output_tokens", "input_characters", "input_utf8_bytes", "input_images", "output_images", "input_audio_seconds", "output_audio_seconds", "input_video_seconds", "output_video_seconds", "provider_credits", "web_search_requests"];
|
|
4
12
|
type BillingMetric = (typeof BILLING_METRICS)[number];
|
|
@@ -29,27 +37,6 @@ interface MeteringContract {
|
|
|
29
37
|
}
|
|
30
38
|
|
|
31
39
|
type ModelModality = "language" | "embedding" | "reranker" | "image" | "video" | "audio" | "world" | "multimodal" | "other";
|
|
32
|
-
/** A concrete operation of a code-owned endpoint contract, shared by API and UI. */
|
|
33
|
-
type ModelHttpOperation = Readonly<{
|
|
34
|
-
key: string;
|
|
35
|
-
kind: "request" | "create" | "query" | "cancel" | "delete" | "stream" | "generate" | "edit";
|
|
36
|
-
httpMethod: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
37
|
-
pathTemplate: string;
|
|
38
|
-
schemaProjection: "request" | "bearer-request" | "managed-task-create" | "managed-task-query" | "managed-task-cancel" | "native-task-create" | "native-task-query" | "native-task-delete";
|
|
39
|
-
responseStatus?: number;
|
|
40
|
-
idempotencyKey?: boolean;
|
|
41
|
-
queryParameters?: Readonly<JsonObject>;
|
|
42
|
-
headerParameters?: Readonly<JsonObject>;
|
|
43
|
-
pathParameters?: Readonly<JsonObject>;
|
|
44
|
-
/** Operation-specific body; binary fields describe multipart file parts. */
|
|
45
|
-
bodyParameters?: Readonly<JsonObject>;
|
|
46
|
-
responseBody?: Readonly<JsonObject>;
|
|
47
|
-
requestBody?: Readonly<{
|
|
48
|
-
properties: readonly string[];
|
|
49
|
-
required: readonly string[];
|
|
50
|
-
oneOfRequired?: readonly (readonly string[])[];
|
|
51
|
-
}>;
|
|
52
|
-
}>;
|
|
53
40
|
interface ModelEndpointSummary {
|
|
54
41
|
key: string;
|
|
55
42
|
label: string;
|
|
@@ -60,8 +47,6 @@ interface ModelEndpointSummary {
|
|
|
60
47
|
capabilities: string[];
|
|
61
48
|
/** Task execution of this native endpoint, not a second model parameter definition. */
|
|
62
49
|
sourceEndpointKey?: string | null;
|
|
63
|
-
documentationUrl?: string;
|
|
64
|
-
httpOperations?: readonly ModelHttpOperation[];
|
|
65
50
|
}
|
|
66
51
|
interface ModelCapabilitySummary {
|
|
67
52
|
inputModalities: string[];
|
|
@@ -133,8 +118,6 @@ interface TaskModel extends TaskModelSummary {
|
|
|
133
118
|
interface ModelSchema {
|
|
134
119
|
model: string;
|
|
135
120
|
version: number;
|
|
136
|
-
/** Contract owner for the returned schema. Defaults to nexra for older servers. */
|
|
137
|
-
contract?: "nexra" | "native";
|
|
138
121
|
dialect: "https://json-schema.org/draft/2020-12/schema" | string;
|
|
139
122
|
inputSchema: JsonObject;
|
|
140
123
|
outputSchema: JsonObject;
|
|
@@ -301,7 +284,7 @@ declare class HttpTransport {
|
|
|
301
284
|
response(path: string, init?: RequestInit, options?: RequestOptions): Promise<Response>;
|
|
302
285
|
}
|
|
303
286
|
|
|
304
|
-
/**
|
|
287
|
+
/** Unified canvas vocabulary: resolution 1K/2K/4K, ratio X:X. */
|
|
305
288
|
type UnifiedMediaGeometry = {
|
|
306
289
|
resolution?: string;
|
|
307
290
|
ratio?: string;
|
|
@@ -309,23 +292,27 @@ type UnifiedMediaGeometry = {
|
|
|
309
292
|
};
|
|
310
293
|
type MediaGeometryField = {
|
|
311
294
|
field: string;
|
|
295
|
+
nest?: string;
|
|
312
296
|
options: readonly string[];
|
|
313
297
|
default?: string;
|
|
314
298
|
optionLabels: Readonly<Record<string, string>>;
|
|
315
299
|
};
|
|
316
300
|
type MediaGeometryProjection = {
|
|
317
|
-
kind: "resolution-ratio" | "ratio-only" | "none";
|
|
301
|
+
kind: "pixel-size" | "tier-size" | "resolution-ratio" | "ratio-only" | "none";
|
|
318
302
|
resolution?: MediaGeometryField;
|
|
319
303
|
ratio?: MediaGeometryField;
|
|
320
304
|
quality?: MediaGeometryField;
|
|
321
305
|
};
|
|
322
|
-
/**
|
|
306
|
+
/** Schema → unified resolution/ratio/quality controls for app UIs. */
|
|
323
307
|
declare function projectMediaGeometry(inputSchema: JsonObject): MediaGeometryProjection;
|
|
324
|
-
/**
|
|
308
|
+
/** Unified geometry → the model's native catalog fields (channel original params). */
|
|
325
309
|
declare function encodeMediaGeometry(inputSchema: JsonObject, geometry: UnifiedMediaGeometry): JsonObject;
|
|
326
|
-
/**
|
|
327
|
-
declare function decodeMediaGeometry(
|
|
328
|
-
/**
|
|
310
|
+
/** Native catalog fields → unified resolution/ratio/quality. */
|
|
311
|
+
declare function decodeMediaGeometry(inputSchema: JsonObject, nativeInput: JsonObject): UnifiedMediaGeometry;
|
|
312
|
+
/**
|
|
313
|
+
* Rewrite a Task/quote body: unified keys become native catalog fields.
|
|
314
|
+
* Native size/ratio already present is left alone (existing callers keep working).
|
|
315
|
+
*/
|
|
329
316
|
declare function applyMediaGeometry(inputSchema: JsonObject, input: JsonObject): JsonObject;
|
|
330
317
|
|
|
331
|
-
export { type
|
|
318
|
+
export { type ModelModality as A, type ModelResourceList as B, type CreateNexraQuoteRequest as C, type ModelResourceOption as D, type NexraDisplayQuoteBatchEntry as E, type FetchLike as F, HttpTransport as H, type JsonValue as J, type MediaGeometryField as M, type NexraSalePriceList as N, type TaskModelSummary as T, type UnifiedMediaGeometry as U, type NexraQuote as a, type CreateNexraDisplayQuoteBatchRequest as b, type NexraDisplayQuoteBatch as c, type NexraCatalogRevision as d, type NexraModelSpec as e, type NexraModelSpecFilter as f, type MediaGeometryProjection as g, type NexraBillingCurrency as h, type NexraModelEndpointSpec as i, type NexraModelOperation as j, type NexraSalePrice as k, type NexraSettlement as l, applyMediaGeometry as m, decodeMediaGeometry as n, encodeMediaGeometry as o, projectMediaGeometry as p, type ModelSearchParams as q, type CursorPage as r, type TaskModel as s, type ModelSchema as t, type NexraClientOptions as u, type JsonObject as v, type JsonPrimitive as w, type ModelCapabilitySummary as x, type ModelDateVersion as y, type ModelEndpointSummary as z };
|
|
@@ -1,6 +1,62 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { v as JsonObject, J as JsonValue, l as NexraSettlement, r as CursorPage, H as HttpTransport } from './media-geometry-Ckr1-Mh3.js';
|
|
2
|
+
|
|
3
|
+
declare const MEDIA_KINDS: readonly ["image", "video", "audio", "document", "archive", "other"];
|
|
4
|
+
type MediaKind = (typeof MEDIA_KINDS)[number];
|
|
5
|
+
type MediaAssetStatus = "pending" | "ready" | "failed" | "deleted";
|
|
6
|
+
interface MediaAsset {
|
|
7
|
+
id: string;
|
|
8
|
+
kind: MediaKind;
|
|
9
|
+
status: MediaAssetStatus;
|
|
10
|
+
source: "upload" | "generated" | "provider" | "imported";
|
|
11
|
+
name?: string;
|
|
12
|
+
mimeType?: string;
|
|
13
|
+
sizeBytes?: number;
|
|
14
|
+
width?: number;
|
|
15
|
+
height?: number;
|
|
16
|
+
durationMs?: number;
|
|
17
|
+
checksumSha256?: string;
|
|
18
|
+
url?: string;
|
|
19
|
+
downloadUrl?: string;
|
|
20
|
+
expiresAt?: string;
|
|
21
|
+
metadata?: JsonObject;
|
|
22
|
+
createdAt: string;
|
|
23
|
+
}
|
|
24
|
+
interface AssetReference {
|
|
25
|
+
assetId: string;
|
|
26
|
+
}
|
|
27
|
+
type AssetInput = AssetReference | Blob | File | MediaAsset | string | URL;
|
|
28
|
+
interface AssetUploadOptions {
|
|
29
|
+
kind?: MediaKind;
|
|
30
|
+
name?: string;
|
|
31
|
+
signal?: AbortSignal;
|
|
32
|
+
}
|
|
33
|
+
interface AssetImportRequest {
|
|
34
|
+
url: string;
|
|
35
|
+
kind?: MediaKind;
|
|
36
|
+
name?: string;
|
|
37
|
+
}
|
|
38
|
+
type AssetCertificationProvider = "seedance";
|
|
39
|
+
type AssetCertificationStatus = "processing" | "ready" | "failed";
|
|
40
|
+
interface AssetCertification {
|
|
41
|
+
assetId: string;
|
|
42
|
+
provider: AssetCertificationProvider;
|
|
43
|
+
status: AssetCertificationStatus;
|
|
44
|
+
providerAssetId?: string;
|
|
45
|
+
assetUri?: string;
|
|
46
|
+
groupId?: string;
|
|
47
|
+
library: "general" | "liveness";
|
|
48
|
+
error?: string;
|
|
49
|
+
createdAt: string;
|
|
50
|
+
updatedAt: string;
|
|
51
|
+
}
|
|
52
|
+
interface AssetCertificationRequest {
|
|
53
|
+
library?: "general" | "liveness";
|
|
54
|
+
}
|
|
55
|
+
interface AssetCertificationWaitOptions {
|
|
56
|
+
pollIntervalMs?: number;
|
|
57
|
+
timeoutMs?: number;
|
|
58
|
+
signal?: AbortSignal;
|
|
59
|
+
}
|
|
4
60
|
|
|
5
61
|
interface ApiErrorPayload {
|
|
6
62
|
error: {
|
|
@@ -187,31 +243,12 @@ interface TaskEvent {
|
|
|
187
243
|
occurredAt: string;
|
|
188
244
|
}
|
|
189
245
|
/** @deprecated Use CreateTaskRequest.callback_url. Kept for existing callers. */
|
|
190
|
-
|
|
246
|
+
interface TaskWebhookConfig {
|
|
191
247
|
url: string;
|
|
192
248
|
/** Shared HMAC secret used to verify Nexra callback signatures. */
|
|
193
249
|
secret: string;
|
|
194
250
|
events?: Array<"completed">;
|
|
195
|
-
}
|
|
196
|
-
type CreateTaskControls = Readonly<{
|
|
197
|
-
/** @internal Console telemetry only: browser send time before uploads, not execution time. */
|
|
198
|
-
submittedAt?: string;
|
|
199
|
-
model: string;
|
|
200
|
-
/** Signed Nexra quote used to lock this input to a sale-price revision. */
|
|
201
|
-
quoteToken?: string;
|
|
202
|
-
/** Optional business identifiers such as orderId, available in request details. Do not include secrets. */
|
|
203
|
-
metadata?: JsonObject;
|
|
204
|
-
/** Platform completion callback, independent of provider callback support. Never sent upstream. */
|
|
205
|
-
callback_url?: string;
|
|
206
|
-
/** @deprecated Use callback_url; do not supply both. */
|
|
207
|
-
webhook?: TaskWebhookConfig;
|
|
208
|
-
/** @deprecated Compatibility check only; the server resolves the current contract. */
|
|
209
|
-
schemaVersion?: number;
|
|
210
|
-
}>;
|
|
211
|
-
/** Public Nexra Task request. Category parameters are top-level fields; `input`
|
|
212
|
-
* is deliberately not an envelope. Persistent Task records still retain their
|
|
213
|
-
* own `input` snapshot after the HTTP boundary separates control fields. */
|
|
214
|
-
type CreateTaskRequest<TInput extends JsonObject = JsonObject> = TInput & CreateTaskControls;
|
|
251
|
+
}
|
|
215
252
|
interface TaskListParams {
|
|
216
253
|
status?: TaskStatus;
|
|
217
254
|
model?: string;
|
|
@@ -242,7 +279,8 @@ declare class AssetsClient {
|
|
|
242
279
|
stream(asset: MediaAsset | string, signal?: AbortSignal): Promise<ReadableStream<Uint8Array>>;
|
|
243
280
|
}
|
|
244
281
|
|
|
245
|
-
interface CreateTaskOptions {
|
|
282
|
+
interface CreateTaskOptions<TInput = Record<string, unknown>> {
|
|
283
|
+
input: TInput;
|
|
246
284
|
quoteToken?: string;
|
|
247
285
|
submittedAt?: string;
|
|
248
286
|
metadata?: JsonObject;
|
|
@@ -253,6 +291,15 @@ interface CreateTaskOptions {
|
|
|
253
291
|
idempotencyKey?: string;
|
|
254
292
|
signal?: AbortSignal;
|
|
255
293
|
}
|
|
294
|
+
type CreateTaskRequest<TInput extends Record<string, unknown> = Record<string, unknown>> = TInput & {
|
|
295
|
+
model: string;
|
|
296
|
+
quoteToken?: string;
|
|
297
|
+
submittedAt?: string;
|
|
298
|
+
metadata?: JsonObject;
|
|
299
|
+
callback_url?: string;
|
|
300
|
+
webhook?: TaskWebhookConfig;
|
|
301
|
+
schemaVersion?: number;
|
|
302
|
+
};
|
|
256
303
|
interface WatchTaskOptions {
|
|
257
304
|
signal?: AbortSignal;
|
|
258
305
|
lastEventId?: string;
|
|
@@ -263,20 +310,20 @@ interface WaitTaskOptions extends WatchTaskOptions {
|
|
|
263
310
|
pollIntervalMs?: number;
|
|
264
311
|
onEvent?: (event: TaskEvent) => void | Promise<void>;
|
|
265
312
|
}
|
|
266
|
-
interface RunTaskOptions extends CreateTaskOptions
|
|
313
|
+
interface RunTaskOptions<TInput = Record<string, unknown>> extends CreateTaskOptions<TInput>, WaitTaskOptions {
|
|
267
314
|
cancelOnAbort?: boolean;
|
|
268
315
|
}
|
|
269
316
|
declare class TasksClient {
|
|
270
317
|
private readonly transport;
|
|
271
318
|
private readonly assets;
|
|
272
319
|
constructor(transport: HttpTransport, assets: AssetsClient);
|
|
273
|
-
create<TOutput = JsonValue, TInput = Record<string, unknown>>(model: string,
|
|
320
|
+
create<TOutput = JsonValue, TInput = Record<string, unknown>>(model: string, options: CreateTaskOptions<TInput>): Promise<TaskReceipt>;
|
|
274
321
|
get<TOutput = JsonValue>(taskId: string, signal?: AbortSignal): Promise<TaskResult<TOutput>>;
|
|
275
322
|
list<TOutput = JsonValue>(params?: TaskListParams, signal?: AbortSignal): Promise<CursorPage<TaskResult<TOutput>>>;
|
|
276
323
|
cancel<TOutput = JsonValue>(taskId: string, signal?: AbortSignal): Promise<TaskReceipt>;
|
|
277
324
|
watch(taskId: string, options?: WatchTaskOptions): AsyncGenerator<TaskEvent>;
|
|
278
325
|
wait<TOutput = JsonValue>(taskId: string, options?: WaitTaskOptions): Promise<TaskResult<TOutput>>;
|
|
279
|
-
run<TOutput = JsonValue, TInput = Record<string, unknown>>(model: string,
|
|
326
|
+
run<TOutput = JsonValue, TInput = Record<string, unknown>>(model: string, options: RunTaskOptions<TInput>): Promise<RunResult<TOutput>>;
|
|
280
327
|
}
|
|
281
328
|
|
|
282
329
|
interface VerifyWebhookOptions {
|
|
@@ -286,4 +333,4 @@ interface VerifyWebhookOptions {
|
|
|
286
333
|
/** @deprecated Only verifies legacy signed webhooks, not callback_url notifications. */
|
|
287
334
|
declare function verifyWebhook(request: Request, secret: string, options?: VerifyWebhookOptions): Promise<boolean>;
|
|
288
335
|
|
|
289
|
-
export { AssetsClient as A, type CreateTaskOptions as C, type RunTaskOptions as R, TasksClient as T, type VerifyWebhookOptions as V, type WaitTaskOptions as W, type RunResult as a, type ApiErrorPayload as b, type TaskResult as c, type
|
|
336
|
+
export { AssetsClient as A, type TerminalTaskStatus as B, type CreateTaskOptions as C, type WatchTaskOptions as D, isTerminalTaskStatus as E, verifyWebhook as F, MEDIA_KINDS as M, type RunTaskOptions as R, TasksClient as T, type VerifyWebhookOptions as V, type WaitTaskOptions as W, type RunResult as a, type ApiErrorPayload as b, type TaskResult as c, type AssetImportRequest as d, type AssetInput as e, type AssetReference as f, type AssetUploadOptions as g, type CreateTaskRequest as h, type MediaAsset as i, type MediaAssetStatus as j, type MediaKind as k, type RequestDetails as l, TASK_STATUSES as m, type Task as n, type TaskCost as o, type TaskError as p, type TaskEvent as q, type TaskEventType as r, type TaskListParams as s, type TaskPage as t, type TaskProgress as u, type TaskReceipt as v, type TaskStatus as w, type TaskTiming as x, type TaskUsage as y, type TaskWebhookConfig as z };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { b as CreateNexraDisplayQuoteBatchRequest, C as CreateNexraQuoteRequest, F as FetchLike, M as MediaGeometryField, g as MediaGeometryProjection,
|
|
3
|
-
export { C as CursorPage, J as JsonObject, b as JsonPrimitive, a as JsonValue } from './json-Drjj1OKl.js';
|
|
4
|
-
export { b as ApiErrorPayload, C as CreateTaskOptions, d as CreateTaskRequest, e as RequestDetails, a as RunResult, R as RunTaskOptions, g 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, V as VerifyWebhookOptions, W as WaitTaskOptions, u as WatchTaskOptions } from './types-DPLgTh8D.js';
|
|
1
|
+
export { b as ApiErrorPayload, d as AssetImportRequest, e as AssetInput, f as AssetReference, g as AssetUploadOptions, C as CreateTaskOptions, h as CreateTaskRequest, i as MediaAsset, j as MediaAssetStatus, k as MediaKind, l as RequestDetails, a as RunResult, R as RunTaskOptions, n as Task, o as TaskCost, p as TaskError, q as TaskEvent, r as TaskEventType, s as TaskListParams, t as TaskPage, u as TaskProgress, v as TaskReceipt, c as TaskResult, w as TaskStatus, x as TaskTiming, y as TaskUsage, z as TaskWebhookConfig, B as TerminalTaskStatus, V as VerifyWebhookOptions, W as WaitTaskOptions, D as WatchTaskOptions } from './types-CcYROaH1.js';
|
|
2
|
+
export { b as CreateNexraDisplayQuoteBatchRequest, C as CreateNexraQuoteRequest, r as CursorPage, F as FetchLike, v as JsonObject, w as JsonPrimitive, J as JsonValue, M as MediaGeometryField, g as MediaGeometryProjection, x as ModelCapabilitySummary, y as ModelDateVersion, z as ModelEndpointSummary, A as ModelModality, B as ModelResourceList, D as ModelResourceOption, t as ModelSchema, q as ModelSearchParams, h as NexraBillingCurrency, d as NexraCatalogRevision, u as NexraClientOptions, c as NexraDisplayQuoteBatch, E as NexraDisplayQuoteBatchEntry, j as NexraModelOperation, e as NexraModelSpec, f as NexraModelSpecFilter, a as NexraQuote, k as NexraSalePrice, N as NexraSalePriceList, l as NexraSettlement, s as TaskModel, T as TaskModelSummary, U as UnifiedMediaGeometry } from './media-geometry-Ckr1-Mh3.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@byte_fluffy/nexra-sdk",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.22",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -32,10 +32,6 @@
|
|
|
32
32
|
"./types": {
|
|
33
33
|
"types": "./dist/types.d.ts",
|
|
34
34
|
"import": "./dist/types.js"
|
|
35
|
-
},
|
|
36
|
-
"./media": {
|
|
37
|
-
"types": "./dist/media.d.ts",
|
|
38
|
-
"import": "./dist/media.js"
|
|
39
35
|
}
|
|
40
36
|
},
|
|
41
37
|
"publishConfig": {
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { J as JsonObject } from './json-Drjj1OKl.js';
|
|
2
|
-
|
|
3
|
-
declare const MEDIA_KINDS: readonly ["image", "video", "audio", "document", "archive", "other"];
|
|
4
|
-
type MediaKind = (typeof MEDIA_KINDS)[number];
|
|
5
|
-
type MediaAssetStatus = "pending" | "ready" | "failed" | "deleted";
|
|
6
|
-
interface MediaAsset {
|
|
7
|
-
id: string;
|
|
8
|
-
kind: MediaKind;
|
|
9
|
-
status: MediaAssetStatus;
|
|
10
|
-
source: "upload" | "generated" | "provider" | "imported";
|
|
11
|
-
name?: string;
|
|
12
|
-
mimeType?: string;
|
|
13
|
-
sizeBytes?: number;
|
|
14
|
-
width?: number;
|
|
15
|
-
height?: number;
|
|
16
|
-
durationMs?: number;
|
|
17
|
-
checksumSha256?: string;
|
|
18
|
-
url?: string;
|
|
19
|
-
downloadUrl?: string;
|
|
20
|
-
expiresAt?: string;
|
|
21
|
-
metadata?: JsonObject;
|
|
22
|
-
createdAt: string;
|
|
23
|
-
}
|
|
24
|
-
interface AssetReference {
|
|
25
|
-
assetId: string;
|
|
26
|
-
}
|
|
27
|
-
type AssetInput = AssetReference | Blob | File | MediaAsset | string | URL;
|
|
28
|
-
interface AssetUploadOptions {
|
|
29
|
-
kind?: MediaKind;
|
|
30
|
-
name?: string;
|
|
31
|
-
signal?: AbortSignal;
|
|
32
|
-
}
|
|
33
|
-
interface AssetImportRequest {
|
|
34
|
-
url: string;
|
|
35
|
-
kind?: MediaKind;
|
|
36
|
-
name?: string;
|
|
37
|
-
}
|
|
38
|
-
type AssetCertificationProvider = "seedance";
|
|
39
|
-
type AssetCertificationStatus = "processing" | "ready" | "failed";
|
|
40
|
-
interface AssetCertification {
|
|
41
|
-
assetId: string;
|
|
42
|
-
provider: AssetCertificationProvider;
|
|
43
|
-
status: AssetCertificationStatus;
|
|
44
|
-
providerAssetId?: string;
|
|
45
|
-
assetUri?: string;
|
|
46
|
-
groupId?: string;
|
|
47
|
-
library: "general" | "liveness";
|
|
48
|
-
error?: string;
|
|
49
|
-
createdAt: string;
|
|
50
|
-
updatedAt: string;
|
|
51
|
-
}
|
|
52
|
-
interface AssetCertificationRequest {
|
|
53
|
-
library?: "general" | "liveness";
|
|
54
|
-
}
|
|
55
|
-
interface AssetCertificationWaitOptions {
|
|
56
|
-
pollIntervalMs?: number;
|
|
57
|
-
timeoutMs?: number;
|
|
58
|
-
signal?: AbortSignal;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export { type AssetReference as A, MEDIA_KINDS as M, type AssetImportRequest as a, type AssetInput as b, type AssetUploadOptions as c, type MediaAsset as d, type MediaAssetStatus as e, type MediaKind as f, type AssetCertificationRequest as g, type AssetCertification as h, type AssetCertificationWaitOptions as i };
|