@byte_fluffy/nexra-sdk 0.1.0-alpha.1 → 0.1.0-alpha.10
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 +37 -3
- package/dist/catalog.d.ts +15 -1
- package/dist/catalog.js +11 -3
- package/dist/chunk-ULMZMJUL.js +33076 -0
- package/dist/index.d.ts +7 -962
- package/dist/index.js +15 -978
- package/dist/{catalog-mytCeh5t.d.ts → media-geometry-Ckr1-Mh3.d.ts} +83 -78
- package/dist/types-CPMdhb6o.d.ts +280 -0
- package/dist/types.d.ts +2 -0
- package/dist/types.js +0 -0
- package/package.json +10 -2
- package/dist/chunk-ADKRTC6X.js +0 -1512
|
@@ -10,28 +10,6 @@ interface CursorPage<T> {
|
|
|
10
10
|
|
|
11
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"];
|
|
12
12
|
type BillingMetric = (typeof BILLING_METRICS)[number];
|
|
13
|
-
declare const BILLING_EXPORT_DIMENSIONS: readonly ["resolution", "duration", "layer_decomposition", "with_audio", "has_input_video", "hd", "prompt_extend", "modality", "tier", "quality", "image_count", "input_token_tier", "input_modality", "service_tier", "inference_geo", "speed", "region_scope", "has_reference_image", "mode"];
|
|
14
|
-
type UsageComponentEvidence = {
|
|
15
|
-
source: "provider_native" | "request_derived" | "response_derived" | "tariff_equivalent" | "unknown";
|
|
16
|
-
paths?: string[];
|
|
17
|
-
calculation?: string;
|
|
18
|
-
};
|
|
19
|
-
interface MeteredUsageComponent {
|
|
20
|
-
metric: BillingMetric;
|
|
21
|
-
quantity: number;
|
|
22
|
-
dimensions?: Record<string, JsonPrimitive>;
|
|
23
|
-
evidence?: UsageComponentEvidence;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Provider evidence is normalized into independent metered components instead
|
|
27
|
-
* of one canonical model response. This keeps protocol conversion separate
|
|
28
|
-
* from billing and allows one request to carry differently-dimensioned usage.
|
|
29
|
-
*/
|
|
30
|
-
interface NormalizedUsageV1 {
|
|
31
|
-
schemaVersion: 1;
|
|
32
|
-
components: MeteredUsageComponent[];
|
|
33
|
-
billingEvidenceComplete?: boolean;
|
|
34
|
-
}
|
|
35
13
|
interface MeteredPriceRate {
|
|
36
14
|
metric: BillingMetric;
|
|
37
15
|
unitSize: number;
|
|
@@ -46,42 +24,8 @@ interface MeteredPriceRuleV1 {
|
|
|
46
24
|
rates: MeteredPriceRate[];
|
|
47
25
|
}
|
|
48
26
|
type PriceRule = MeteredPriceRuleV1;
|
|
49
|
-
interface PriceEvaluationLine {
|
|
50
|
-
evidence?: UsageComponentEvidence;
|
|
51
|
-
metric: BillingMetric;
|
|
52
|
-
quantity: number;
|
|
53
|
-
unitSize: number;
|
|
54
|
-
unitPrice: string;
|
|
55
|
-
rounding: "proportional" | "ceil";
|
|
56
|
-
includedQuantity: number;
|
|
57
|
-
dimensions?: Record<string, JsonPrimitive>;
|
|
58
|
-
amount: string;
|
|
59
|
-
discountedAmount?: string;
|
|
60
|
-
}
|
|
61
|
-
/** Preserve frozen row order when distributing the eight-decimal remainder. */
|
|
62
|
-
declare function allocateDiscountedPriceLines(lines: readonly PriceEvaluationLine[], saleAmount: string): PriceEvaluationLine[];
|
|
63
|
-
interface PriceEvaluationIssue {
|
|
64
|
-
code: "dimension_mismatch" | "ambiguous_rate" | "missing_usage";
|
|
65
|
-
metric: BillingMetric;
|
|
66
|
-
componentIndex: number;
|
|
67
|
-
}
|
|
68
|
-
interface PriceEvaluation {
|
|
69
|
-
status: "rated" | "incomplete";
|
|
70
|
-
amount: string;
|
|
71
|
-
lines: PriceEvaluationLine[];
|
|
72
|
-
issues: PriceEvaluationIssue[];
|
|
73
|
-
}
|
|
74
|
-
declare function validateNormalizedUsage(value: unknown): asserts value is NormalizedUsageV1;
|
|
75
|
-
/**
|
|
76
|
-
* Deterministically rates normalized usage without mutating wallets or billing
|
|
77
|
-
* records. Amounts are rounded half-up to the database's eight-decimal money
|
|
78
|
-
* scale per line; ceil rates round usage units before multiplying the price.
|
|
79
|
-
*/
|
|
80
|
-
declare function evaluatePriceRule(ruleValue: unknown, usageValue: unknown): PriceEvaluation;
|
|
81
|
-
declare function validatePriceRule(value: unknown): asserts value is PriceRule;
|
|
82
27
|
|
|
83
28
|
type MeteringKind = "token" | "non_token" | "mixed";
|
|
84
|
-
type UsageEvidenceStatus = "complete" | "partial" | "missing" | "invalid" | "not_expected";
|
|
85
29
|
interface MeteringContract {
|
|
86
30
|
schemaVersion: 1;
|
|
87
31
|
kind: MeteringKind;
|
|
@@ -91,17 +35,6 @@ interface MeteringContract {
|
|
|
91
35
|
whenFeature?: string;
|
|
92
36
|
}>;
|
|
93
37
|
}
|
|
94
|
-
interface UsageEvidenceAssessment {
|
|
95
|
-
kind: MeteringKind | "unknown";
|
|
96
|
-
evidenceStatus: UsageEvidenceStatus;
|
|
97
|
-
expectedMetrics: BillingMetric[];
|
|
98
|
-
observedMetrics: BillingMetric[];
|
|
99
|
-
missingMetrics: BillingMetric[];
|
|
100
|
-
issues: string[];
|
|
101
|
-
}
|
|
102
|
-
declare function validateMeteringContract(value: unknown): asserts value is MeteringContract;
|
|
103
|
-
/** Evidence completeness is independent of sale/cost prices and delivery success. */
|
|
104
|
-
declare function assessUsageEvidence(contract: unknown, usage: unknown, features?: Readonly<Record<string, boolean>>): UsageEvidenceAssessment;
|
|
105
38
|
|
|
106
39
|
type ModelModality = "language" | "embedding" | "reranker" | "image" | "video" | "audio" | "world" | "multimodal" | "other";
|
|
107
40
|
interface ModelEndpointSummary {
|
|
@@ -121,6 +54,10 @@ interface ModelCapabilitySummary {
|
|
|
121
54
|
/** User-facing input patterns such as text-to-video or image-to-image. */
|
|
122
55
|
inputModes: string[];
|
|
123
56
|
features: string[];
|
|
57
|
+
/** Maximum combined input and output context supported by the model. */
|
|
58
|
+
contextWindowTokens?: number;
|
|
59
|
+
/** Maximum generated output tokens supported by the model. */
|
|
60
|
+
maxOutputTokens?: number;
|
|
124
61
|
}
|
|
125
62
|
interface ModelDateVersion {
|
|
126
63
|
id: string;
|
|
@@ -228,6 +165,15 @@ interface NexraModelOperation {
|
|
|
228
165
|
outputSchema: JsonObject;
|
|
229
166
|
metering: MeteringContract;
|
|
230
167
|
}
|
|
168
|
+
/** Public native wire endpoint metadata. Provider routing and credentials stay private. */
|
|
169
|
+
interface NexraModelEndpointSpec {
|
|
170
|
+
endpointKey: string;
|
|
171
|
+
operation: string;
|
|
172
|
+
protocol: string;
|
|
173
|
+
method: string;
|
|
174
|
+
path: string;
|
|
175
|
+
capabilities: readonly string[];
|
|
176
|
+
}
|
|
231
177
|
interface NexraModelSpec {
|
|
232
178
|
id: string;
|
|
233
179
|
contractVersion: number;
|
|
@@ -240,6 +186,7 @@ interface NexraModelSpec {
|
|
|
240
186
|
aliases: readonly string[];
|
|
241
187
|
capabilities: ModelCapabilitySummary;
|
|
242
188
|
operations: readonly NexraModelOperation[];
|
|
189
|
+
endpoints: readonly NexraModelEndpointSpec[];
|
|
243
190
|
}
|
|
244
191
|
interface NexraModelSpecFilter {
|
|
245
192
|
kind?: ModelModality;
|
|
@@ -253,11 +200,23 @@ interface NexraSalePrice {
|
|
|
253
200
|
effectiveFrom: string;
|
|
254
201
|
rule: PriceRule;
|
|
255
202
|
}
|
|
203
|
+
interface NexraSalePriceList {
|
|
204
|
+
currency: NexraBillingCurrency;
|
|
205
|
+
prices: readonly NexraSalePrice[];
|
|
206
|
+
}
|
|
256
207
|
interface CreateNexraQuoteRequest {
|
|
257
208
|
modelId: string;
|
|
258
209
|
operation: string;
|
|
259
210
|
input: JsonObject;
|
|
260
211
|
}
|
|
212
|
+
interface CreateNexraDisplayQuoteBatchRequest {
|
|
213
|
+
modelId: string;
|
|
214
|
+
operation: string;
|
|
215
|
+
entries: readonly Readonly<{
|
|
216
|
+
key: string;
|
|
217
|
+
input: JsonObject;
|
|
218
|
+
}>[];
|
|
219
|
+
}
|
|
261
220
|
interface NexraQuote {
|
|
262
221
|
quoteToken: string;
|
|
263
222
|
modelId: string;
|
|
@@ -269,6 +228,32 @@ interface NexraQuote {
|
|
|
269
228
|
accuracy: "exact" | "estimated";
|
|
270
229
|
expiresAt: string;
|
|
271
230
|
}
|
|
231
|
+
type NexraDisplayQuoteBatchEntry = Readonly<{
|
|
232
|
+
key: string;
|
|
233
|
+
amount: string;
|
|
234
|
+
maximumAmount: string;
|
|
235
|
+
accuracy: "exact" | "estimated";
|
|
236
|
+
}> | Readonly<{
|
|
237
|
+
key: string;
|
|
238
|
+
error: {
|
|
239
|
+
code: string;
|
|
240
|
+
message: string;
|
|
241
|
+
};
|
|
242
|
+
}>;
|
|
243
|
+
interface NexraDisplayQuoteBatch {
|
|
244
|
+
modelId: string;
|
|
245
|
+
contractVersion: number;
|
|
246
|
+
priceRevision: string;
|
|
247
|
+
pricingPolicyRevision: string;
|
|
248
|
+
quoteContextRevision: string;
|
|
249
|
+
currency: NexraBillingCurrency;
|
|
250
|
+
entries: readonly NexraDisplayQuoteBatchEntry[];
|
|
251
|
+
expiresAt: string;
|
|
252
|
+
}
|
|
253
|
+
interface NexraCatalogRevision {
|
|
254
|
+
revision: string;
|
|
255
|
+
changedAt: string;
|
|
256
|
+
}
|
|
272
257
|
interface NexraSettlement {
|
|
273
258
|
amount: string;
|
|
274
259
|
currency: NexraBillingCurrency;
|
|
@@ -298,16 +283,36 @@ declare class HttpTransport {
|
|
|
298
283
|
json<T>(path: string, init?: RequestInit, options?: RequestOptions): Promise<T>;
|
|
299
284
|
response(path: string, init?: RequestInit, options?: RequestOptions): Promise<Response>;
|
|
300
285
|
}
|
|
301
|
-
declare function jsonBody(value: unknown): Pick<RequestInit, "body" | "headers">;
|
|
302
|
-
declare function queryString(values: Record<string, string | number | undefined>): string;
|
|
303
|
-
declare function sleep(milliseconds: number, signal?: AbortSignal | null): Promise<void>;
|
|
304
286
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
287
|
+
/** Unified canvas vocabulary: resolution 1K/2K/4K, ratio X:X. */
|
|
288
|
+
type UnifiedMediaGeometry = {
|
|
289
|
+
resolution?: string;
|
|
290
|
+
ratio?: string;
|
|
291
|
+
quality?: string;
|
|
292
|
+
};
|
|
293
|
+
type MediaGeometryField = {
|
|
294
|
+
field: string;
|
|
295
|
+
nest?: string;
|
|
296
|
+
options: readonly string[];
|
|
297
|
+
default?: string;
|
|
298
|
+
optionLabels: Readonly<Record<string, string>>;
|
|
299
|
+
};
|
|
300
|
+
type MediaGeometryProjection = {
|
|
301
|
+
kind: "pixel-size" | "tier-size" | "resolution-ratio" | "ratio-only" | "none";
|
|
302
|
+
resolution?: MediaGeometryField;
|
|
303
|
+
ratio?: MediaGeometryField;
|
|
304
|
+
quality?: MediaGeometryField;
|
|
305
|
+
};
|
|
306
|
+
/** Schema → unified resolution/ratio/quality controls for app UIs. */
|
|
307
|
+
declare function projectMediaGeometry(inputSchema: JsonObject): MediaGeometryProjection;
|
|
308
|
+
/** Unified geometry → the model's native catalog fields (channel original params). */
|
|
309
|
+
declare function encodeMediaGeometry(inputSchema: JsonObject, geometry: UnifiedMediaGeometry): JsonObject;
|
|
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
|
+
*/
|
|
316
|
+
declare function applyMediaGeometry(inputSchema: JsonObject, input: JsonObject): JsonObject;
|
|
312
317
|
|
|
313
|
-
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 };
|
|
@@ -0,0 +1,280 @@
|
|
|
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
|
+
|
|
39
|
+
interface ApiErrorPayload {
|
|
40
|
+
error: {
|
|
41
|
+
code: string;
|
|
42
|
+
message: string;
|
|
43
|
+
category?: string;
|
|
44
|
+
retryable?: boolean;
|
|
45
|
+
requestId?: string;
|
|
46
|
+
details?: JsonObject;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
declare const TASK_STATUSES: readonly ["queued", "running", "succeeded", "failed", "cancelling", "cancelled"];
|
|
51
|
+
type TaskStatus = (typeof TASK_STATUSES)[number];
|
|
52
|
+
type TerminalTaskStatus = "succeeded" | "failed" | "cancelled";
|
|
53
|
+
interface TaskProgress {
|
|
54
|
+
percent?: number;
|
|
55
|
+
stage?: string;
|
|
56
|
+
message?: string;
|
|
57
|
+
}
|
|
58
|
+
interface TaskError {
|
|
59
|
+
code: string;
|
|
60
|
+
message: string;
|
|
61
|
+
category?: string;
|
|
62
|
+
retryable?: boolean;
|
|
63
|
+
details?: JsonObject;
|
|
64
|
+
}
|
|
65
|
+
interface TaskUsage {
|
|
66
|
+
components: Array<{
|
|
67
|
+
name: string;
|
|
68
|
+
quantity: number;
|
|
69
|
+
unit: string;
|
|
70
|
+
}>;
|
|
71
|
+
metadata?: JsonObject;
|
|
72
|
+
}
|
|
73
|
+
interface TaskCost {
|
|
74
|
+
amount: string;
|
|
75
|
+
currency: string;
|
|
76
|
+
}
|
|
77
|
+
interface TaskTiming {
|
|
78
|
+
submittedAt: string;
|
|
79
|
+
providerSubmittedAt?: string;
|
|
80
|
+
providerCompletedAt?: string;
|
|
81
|
+
storedAt?: string;
|
|
82
|
+
preparationMs: number | null;
|
|
83
|
+
generationMs: number | null;
|
|
84
|
+
storageMs: number | null;
|
|
85
|
+
totalMs: number | null;
|
|
86
|
+
startSource: "client" | "server";
|
|
87
|
+
/** Server clock reading taken when this snapshot was built; lets clients anchor live timers to server time. */
|
|
88
|
+
observedAt?: string;
|
|
89
|
+
}
|
|
90
|
+
/** Repository/console read model. HTTP clients receive TaskReceipt or TaskResult. */
|
|
91
|
+
interface Task<TOutput = JsonValue> {
|
|
92
|
+
id: string;
|
|
93
|
+
/** Original platform request ID, shared with request history. */
|
|
94
|
+
requestId?: string;
|
|
95
|
+
/** Public Run ID, when this Task belongs to a shared-input run. */
|
|
96
|
+
runId?: string;
|
|
97
|
+
model: string;
|
|
98
|
+
operation: string;
|
|
99
|
+
schemaVersion: number;
|
|
100
|
+
/** Model request parameters; native-managed tasks retain the upstream field structure. */
|
|
101
|
+
input?: JsonObject;
|
|
102
|
+
status: TaskStatus;
|
|
103
|
+
/** Regional media availability; execution/billing remain terminal while replicas prepare. */
|
|
104
|
+
deliveryStatus?: "preparing" | "ready";
|
|
105
|
+
progress?: TaskProgress;
|
|
106
|
+
/** Native-managed tasks preserve the final response shape and media URLs; catalog models may normalize model identifiers. */
|
|
107
|
+
output?: TOutput;
|
|
108
|
+
assets: MediaAsset[];
|
|
109
|
+
error?: TaskError;
|
|
110
|
+
usage?: TaskUsage;
|
|
111
|
+
cost?: TaskCost;
|
|
112
|
+
/** Customer billing state; absent on older servers. */
|
|
113
|
+
billingStatus?: "pending" | "succeeded" | "failed" | "refunded" | "unavailable";
|
|
114
|
+
/** Final customer sale settlement. Provider procurement cost is never exposed here. */
|
|
115
|
+
settlement?: NexraSettlement;
|
|
116
|
+
/** Caller-supplied business data, returned unchanged; never sent to the provider. */
|
|
117
|
+
metadata?: JsonObject;
|
|
118
|
+
timing?: TaskTiming;
|
|
119
|
+
/** Server-side Task record creation time (ISO 8601 UTC). */
|
|
120
|
+
createdAt: string;
|
|
121
|
+
/** Latest Task record update, not the generation completion time (ISO 8601 UTC). */
|
|
122
|
+
updatedAt: string;
|
|
123
|
+
/** First worker execution start; absent while queued or cancelled before execution. */
|
|
124
|
+
startedAt?: string;
|
|
125
|
+
/** Terminal succeeded/failed/cancelled time; success follows required asset storage. */
|
|
126
|
+
completedAt?: string;
|
|
127
|
+
/** @deprecated Reserved; no Task expiry policy is currently enforced. Not a media URL expiry. */
|
|
128
|
+
expiresAt?: string;
|
|
129
|
+
}
|
|
130
|
+
/** POST /tasks returns acceptance only, including for idempotent replays. */
|
|
131
|
+
type TaskReceipt = Pick<Task, "id" | "status">;
|
|
132
|
+
/** Public Task result; platform diagnostics and business tags live in RequestDetails. */
|
|
133
|
+
type TaskResult<TOutput = JsonValue> = Pick<Task<TOutput>, "id" | "model" | "status"> & Partial<Pick<Task<TOutput>, "requestId" | "output" | "assets" | "error" | "deliveryStatus" | "settlement">>;
|
|
134
|
+
/** Platform request details, used by both managed Tasks and native proxy requests. */
|
|
135
|
+
interface RequestDetails {
|
|
136
|
+
id: string;
|
|
137
|
+
requestId: string;
|
|
138
|
+
taskId: string | null;
|
|
139
|
+
method: string;
|
|
140
|
+
path: string;
|
|
141
|
+
protocol?: string;
|
|
142
|
+
accessMode?: string | null;
|
|
143
|
+
model: string | null;
|
|
144
|
+
operation: string | null;
|
|
145
|
+
status: string;
|
|
146
|
+
/** Linked Task lifecycle when this request accepted a Task; HTTP `status` stays accepted. */
|
|
147
|
+
taskStatus?: string | null;
|
|
148
|
+
httpStatus: number | null;
|
|
149
|
+
errorCode: string | null;
|
|
150
|
+
/** HTTP duration, never substituted with asynchronous task duration. */
|
|
151
|
+
durationMs: number | null;
|
|
152
|
+
timing?: TaskTiming;
|
|
153
|
+
cost?: TaskCost;
|
|
154
|
+
billingStatus?: Task["billingStatus"];
|
|
155
|
+
settlement?: NexraSettlement;
|
|
156
|
+
metadata?: JsonObject;
|
|
157
|
+
/** Latest known execution update; omitted when not observed. */
|
|
158
|
+
updatedAt?: string;
|
|
159
|
+
runId?: string;
|
|
160
|
+
schemaVersion?: number;
|
|
161
|
+
createdAt?: string;
|
|
162
|
+
startedAt?: string;
|
|
163
|
+
completedAt?: string;
|
|
164
|
+
input: JsonObject | null;
|
|
165
|
+
/** Present only on single-request reads (`includeOutput`). */
|
|
166
|
+
output?: JsonValue | null;
|
|
167
|
+
/** Output media with durable TOS URLs; present only on `includeOutput`. */
|
|
168
|
+
assets?: MediaAsset[];
|
|
169
|
+
receivedAt: string;
|
|
170
|
+
finishedAt: string | null;
|
|
171
|
+
}
|
|
172
|
+
type TaskEventType = "state" | "progress" | "preview" | "log" | "usage" | "warning" | "result";
|
|
173
|
+
interface TaskEvent {
|
|
174
|
+
id: string;
|
|
175
|
+
taskId: string;
|
|
176
|
+
sequence: number;
|
|
177
|
+
type: TaskEventType;
|
|
178
|
+
status?: TaskStatus;
|
|
179
|
+
progress?: TaskProgress;
|
|
180
|
+
asset?: MediaAsset;
|
|
181
|
+
message?: string;
|
|
182
|
+
payload?: JsonObject;
|
|
183
|
+
occurredAt: string;
|
|
184
|
+
}
|
|
185
|
+
/** @deprecated Use CreateTaskRequest.callback_url. Kept for existing callers. */
|
|
186
|
+
interface TaskWebhookConfig {
|
|
187
|
+
url: string;
|
|
188
|
+
/** Shared HMAC secret used to verify Nexra callback signatures. */
|
|
189
|
+
secret: string;
|
|
190
|
+
events?: Array<"completed">;
|
|
191
|
+
}
|
|
192
|
+
interface CreateTaskRequest<TInput = Record<string, unknown>> {
|
|
193
|
+
/** @internal Console telemetry only: browser send time before uploads, not execution time. */
|
|
194
|
+
submittedAt?: string;
|
|
195
|
+
model: string;
|
|
196
|
+
input: TInput;
|
|
197
|
+
/** Signed Nexra quote used to lock this input to a sale-price revision. */
|
|
198
|
+
quoteToken?: string;
|
|
199
|
+
/** Optional business identifiers such as orderId, available in request details. Do not include secrets. */
|
|
200
|
+
metadata?: JsonObject;
|
|
201
|
+
/** Platform completion callback, independent of provider callback support. Never sent upstream. */
|
|
202
|
+
callback_url?: string;
|
|
203
|
+
/** @deprecated Use callback_url; do not supply both. */
|
|
204
|
+
webhook?: TaskWebhookConfig;
|
|
205
|
+
/** @deprecated Compatibility check only; the server resolves the current contract. */
|
|
206
|
+
schemaVersion?: number;
|
|
207
|
+
}
|
|
208
|
+
interface TaskListParams {
|
|
209
|
+
status?: TaskStatus;
|
|
210
|
+
model?: string;
|
|
211
|
+
limit?: number;
|
|
212
|
+
cursor?: string;
|
|
213
|
+
}
|
|
214
|
+
type TaskPage<TOutput = JsonValue> = CursorPage<Task<TOutput>>;
|
|
215
|
+
interface RunResult<TOutput = JsonValue> {
|
|
216
|
+
taskId: string;
|
|
217
|
+
output: TOutput;
|
|
218
|
+
assets: MediaAsset[];
|
|
219
|
+
usage?: TaskUsage;
|
|
220
|
+
cost?: TaskCost;
|
|
221
|
+
task: TaskResult<TOutput>;
|
|
222
|
+
}
|
|
223
|
+
declare function isTerminalTaskStatus(status: TaskStatus): status is TerminalTaskStatus;
|
|
224
|
+
|
|
225
|
+
declare class AssetsClient {
|
|
226
|
+
private readonly transport;
|
|
227
|
+
constructor(transport: HttpTransport);
|
|
228
|
+
upload(file: Blob, options?: AssetUploadOptions): Promise<MediaAsset>;
|
|
229
|
+
import(request: AssetImportRequest, signal?: AbortSignal): Promise<MediaAsset>;
|
|
230
|
+
get(assetId: string, signal?: AbortSignal): Promise<MediaAsset>;
|
|
231
|
+
download(asset: MediaAsset | string, signal?: AbortSignal): Promise<Response>;
|
|
232
|
+
stream(asset: MediaAsset | string, signal?: AbortSignal): Promise<ReadableStream<Uint8Array>>;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
interface CreateTaskOptions<TInput = Record<string, unknown>> {
|
|
236
|
+
input: TInput;
|
|
237
|
+
quoteToken?: string;
|
|
238
|
+
submittedAt?: string;
|
|
239
|
+
metadata?: JsonObject;
|
|
240
|
+
callback_url?: string;
|
|
241
|
+
/** @deprecated Use callback_url; do not supply both. */
|
|
242
|
+
webhook?: TaskWebhookConfig;
|
|
243
|
+
schemaVersion?: number;
|
|
244
|
+
idempotencyKey?: string;
|
|
245
|
+
signal?: AbortSignal;
|
|
246
|
+
}
|
|
247
|
+
interface WatchTaskOptions {
|
|
248
|
+
signal?: AbortSignal;
|
|
249
|
+
lastEventId?: string;
|
|
250
|
+
maxReconnects?: number;
|
|
251
|
+
}
|
|
252
|
+
interface WaitTaskOptions extends WatchTaskOptions {
|
|
253
|
+
timeoutMs?: number;
|
|
254
|
+
pollIntervalMs?: number;
|
|
255
|
+
onEvent?: (event: TaskEvent) => void | Promise<void>;
|
|
256
|
+
}
|
|
257
|
+
interface RunTaskOptions<TInput = Record<string, unknown>> extends CreateTaskOptions<TInput>, WaitTaskOptions {
|
|
258
|
+
cancelOnAbort?: boolean;
|
|
259
|
+
}
|
|
260
|
+
declare class TasksClient {
|
|
261
|
+
private readonly transport;
|
|
262
|
+
private readonly assets;
|
|
263
|
+
constructor(transport: HttpTransport, assets: AssetsClient);
|
|
264
|
+
create<TOutput = JsonValue, TInput = Record<string, unknown>>(model: string, options: CreateTaskOptions<TInput>): Promise<TaskReceipt>;
|
|
265
|
+
get<TOutput = JsonValue>(taskId: string, signal?: AbortSignal): Promise<TaskResult<TOutput>>;
|
|
266
|
+
list<TOutput = JsonValue>(params?: TaskListParams, signal?: AbortSignal): Promise<CursorPage<TaskResult<TOutput>>>;
|
|
267
|
+
cancel<TOutput = JsonValue>(taskId: string, signal?: AbortSignal): Promise<TaskReceipt>;
|
|
268
|
+
watch(taskId: string, options?: WatchTaskOptions): AsyncGenerator<TaskEvent>;
|
|
269
|
+
wait<TOutput = JsonValue>(taskId: string, options?: WaitTaskOptions): Promise<TaskResult<TOutput>>;
|
|
270
|
+
run<TOutput = JsonValue, TInput = Record<string, unknown>>(model: string, options: RunTaskOptions<TInput>): Promise<RunResult<TOutput>>;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
interface VerifyWebhookOptions {
|
|
274
|
+
toleranceSeconds?: number;
|
|
275
|
+
now?: Date;
|
|
276
|
+
}
|
|
277
|
+
/** @deprecated Only verifies legacy signed webhooks, not callback_url notifications. */
|
|
278
|
+
declare function verifyWebhook(request: Request, secret: string, options?: VerifyWebhookOptions): Promise<boolean>;
|
|
279
|
+
|
|
280
|
+
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
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
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-CPMdhb6o.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/dist/types.js
ADDED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@byte_fluffy/nexra-sdk",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.10",
|
|
4
4
|
"type": "module",
|
|
5
|
+
"types": "./dist/index.d.ts",
|
|
5
6
|
"sideEffects": false,
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=20"
|
|
9
|
+
},
|
|
6
10
|
"repository": {
|
|
7
11
|
"type": "git",
|
|
8
12
|
"url": "git+https://github.com/starrank-soft/nexra-monorepo.git",
|
|
@@ -24,6 +28,10 @@
|
|
|
24
28
|
"./decimal": {
|
|
25
29
|
"types": "./dist/decimal.d.ts",
|
|
26
30
|
"import": "./dist/decimal.js"
|
|
31
|
+
},
|
|
32
|
+
"./types": {
|
|
33
|
+
"types": "./dist/types.d.ts",
|
|
34
|
+
"import": "./dist/types.js"
|
|
27
35
|
}
|
|
28
36
|
},
|
|
29
37
|
"publishConfig": {
|
|
@@ -32,7 +40,7 @@
|
|
|
32
40
|
},
|
|
33
41
|
"scripts": {
|
|
34
42
|
"generate": "bun scripts/generate-public-catalog.ts",
|
|
35
|
-
"build": "bun run generate && tsup
|
|
43
|
+
"build": "bun run generate && tsup",
|
|
36
44
|
"test": "vitest run --root ../.. packages/sdk/tests",
|
|
37
45
|
"prepack": "bun run build"
|
|
38
46
|
},
|