@byte_fluffy/nexra-sdk 0.1.0-alpha.16 → 0.1.0-alpha.18

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
@@ -6,7 +6,7 @@ import {
6
6
  getModelSpec,
7
7
  listModelSpecs,
8
8
  projectMediaGeometry
9
- } from "./chunk-5FVL2U56.js";
9
+ } from "./chunk-VFIIDWIH.js";
10
10
  export {
11
11
  CatalogClient,
12
12
  applyMediaGeometry,
@@ -3779,8 +3779,10 @@ var image_generated_default = [
3779
3779
  default: false,
3780
3780
  "x-ui": {
3781
3781
  order: 4,
3782
- control: "switch"
3783
- }
3782
+ control: "switch",
3783
+ hidden: true
3784
+ },
3785
+ const: false
3784
3786
  },
3785
3787
  seed: {
3786
3788
  type: "integer",
@@ -4259,8 +4261,10 @@ var image_generated_default = [
4259
4261
  default: false,
4260
4262
  "x-ui": {
4261
4263
  order: 4,
4262
- control: "switch"
4263
- }
4264
+ control: "switch",
4265
+ hidden: true
4266
+ },
4267
+ const: false
4264
4268
  },
4265
4269
  seed: {
4266
4270
  type: "integer",
@@ -4846,8 +4850,10 @@ var image_generated_default = [
4846
4850
  title: "\u6C34\u5370",
4847
4851
  description: "\u662F\u5426\u6DFB\u52A0\u6C34\u5370\u3002",
4848
4852
  "x-ui": {
4849
- order: 5
4850
- }
4853
+ order: 5,
4854
+ hidden: true
4855
+ },
4856
+ const: false
4851
4857
  }
4852
4858
  },
4853
4859
  required: [
@@ -5085,8 +5091,10 @@ var image_generated_default = [
5085
5091
  title: "\u6C34\u5370",
5086
5092
  description: "\u662F\u5426\u6DFB\u52A0\u6C34\u5370\u3002",
5087
5093
  "x-ui": {
5088
- order: 5
5089
- }
5094
+ order: 5,
5095
+ hidden: true
5096
+ },
5097
+ const: false
5090
5098
  },
5091
5099
  layer_decomposition: {
5092
5100
  type: "boolean",
@@ -21669,9 +21677,11 @@ var video_generated_default = [
21669
21677
  description: "Whether to add an AI Generated watermark to the output.",
21670
21678
  "x-ui": {
21671
21679
  order: 10,
21672
- control: "switch"
21680
+ control: "switch",
21681
+ hidden: true
21673
21682
  },
21674
- default: false
21683
+ default: false,
21684
+ const: false
21675
21685
  },
21676
21686
  seed: {
21677
21687
  type: "integer",
@@ -22153,6 +22163,11 @@ var video_generated_default = [
22153
22163
  {
22154
22164
  metric: "output_video_seconds",
22155
22165
  requirement: "required"
22166
+ },
22167
+ {
22168
+ metric: "input_video_seconds",
22169
+ requirement: "conditional",
22170
+ whenFeature: "task_input_video_v1"
22156
22171
  }
22157
22172
  ]
22158
22173
  }
@@ -22759,8 +22774,10 @@ var video_generated_default = [
22759
22774
  title: "\u89C6\u9891\u6C34\u5370",
22760
22775
  default: false,
22761
22776
  "x-ui": {
22762
- order: 5
22763
- }
22777
+ order: 5,
22778
+ hidden: true
22779
+ },
22780
+ const: false
22764
22781
  },
22765
22782
  return_last_frame: {
22766
22783
  type: "boolean",
@@ -23492,8 +23509,10 @@ var video_generated_default = [
23492
23509
  title: "\u89C6\u9891\u6C34\u5370",
23493
23510
  default: false,
23494
23511
  "x-ui": {
23495
- order: 5
23496
- }
23512
+ order: 5,
23513
+ hidden: true
23514
+ },
23515
+ const: false
23497
23516
  },
23498
23517
  return_last_frame: {
23499
23518
  type: "boolean",
@@ -24225,8 +24244,10 @@ var video_generated_default = [
24225
24244
  title: "\u89C6\u9891\u6C34\u5370",
24226
24245
  default: false,
24227
24246
  "x-ui": {
24228
- order: 5
24229
- }
24247
+ order: 5,
24248
+ hidden: true
24249
+ },
24250
+ const: false
24230
24251
  },
24231
24252
  return_last_frame: {
24232
24253
  type: "boolean",
@@ -25213,8 +25234,10 @@ var video_generated_default = [
25213
25234
  title: "\u89C6\u9891\u6C34\u5370",
25214
25235
  default: false,
25215
25236
  "x-ui": {
25216
- order: 5
25217
- }
25237
+ order: 5,
25238
+ hidden: true
25239
+ },
25240
+ const: false
25218
25241
  },
25219
25242
  return_last_frame: {
25220
25243
  type: "boolean",
@@ -26159,8 +26182,10 @@ var video_generated_default = [
26159
26182
  title: "\u89C6\u9891\u6C34\u5370",
26160
26183
  default: false,
26161
26184
  "x-ui": {
26162
- order: 5
26163
- }
26185
+ order: 5,
26186
+ hidden: true
26187
+ },
26188
+ const: false
26164
26189
  },
26165
26190
  return_last_frame: {
26166
26191
  type: "boolean",
@@ -26920,8 +26945,10 @@ var video_generated_default = [
26920
26945
  title: "\u89C6\u9891\u6C34\u5370",
26921
26946
  default: false,
26922
26947
  "x-ui": {
26923
- order: 5
26924
- }
26948
+ order: 5,
26949
+ hidden: true
26950
+ },
26951
+ const: false
26925
26952
  },
26926
26953
  return_last_frame: {
26927
26954
  type: "boolean",
@@ -27678,8 +27705,10 @@ var video_generated_default = [
27678
27705
  title: "\u89C6\u9891\u6C34\u5370",
27679
27706
  default: false,
27680
27707
  "x-ui": {
27681
- order: 7
27682
- }
27708
+ order: 7,
27709
+ hidden: true
27710
+ },
27711
+ const: false
27683
27712
  },
27684
27713
  return_last_frame: {
27685
27714
  type: "boolean",
@@ -34311,6 +34340,24 @@ function applyMediaGeometry(inputSchema, input) {
34311
34340
  return next;
34312
34341
  }
34313
34342
 
34343
+ // src/catalog/watermark.ts
34344
+ function isObject2(value) {
34345
+ return value !== null && typeof value === "object" && !Array.isArray(value);
34346
+ }
34347
+ function isFixedOff(field) {
34348
+ return isObject2(field) && field.type === "boolean" && field.const === false;
34349
+ }
34350
+ function applyNoWatermark(inputSchema, input) {
34351
+ const properties = isObject2(inputSchema.properties) ? inputSchema.properties : {};
34352
+ if (isFixedOff(properties.watermark)) return { ...input, watermark: false };
34353
+ const parametersSchema = isObject2(properties.parameters) ? properties.parameters : {};
34354
+ const parameterProperties = isObject2(parametersSchema.properties) ? parametersSchema.properties : {};
34355
+ if (isFixedOff(parameterProperties.watermark)) {
34356
+ return { ...input, parameters: { ...isObject2(input.parameters) ? input.parameters : {}, watermark: false } };
34357
+ }
34358
+ return input;
34359
+ }
34360
+
34314
34361
  // src/errors.ts
34315
34362
  var NexraApiError = class extends Error {
34316
34363
  status;
@@ -34348,7 +34395,7 @@ var NexraWaitTimeoutError = class extends Error {
34348
34395
  };
34349
34396
 
34350
34397
  // src/generated/version.generated.ts
34351
- var SDK_VERSION = "0.1.0-alpha.16";
34398
+ var SDK_VERSION = "0.1.0-alpha.18";
34352
34399
 
34353
34400
  // src/transport.ts
34354
34401
  var DEFAULT_BASE_URL = "https://api.nexra-ai.com/v1";
@@ -34494,7 +34541,7 @@ var CatalogClient = class {
34494
34541
  quote(request, signal) {
34495
34542
  const spec = getModelSpec(request.modelId);
34496
34543
  const schema = spec?.operations.find((operation) => operation.operation === request.operation)?.inputSchema ?? spec?.operations[0]?.inputSchema;
34497
- const input = schema ? applyMediaGeometry(schema, request.input) : request.input;
34544
+ const input = schema ? applyNoWatermark(schema, applyMediaGeometry(schema, request.input)) : request.input;
34498
34545
  return this.transport.json(
34499
34546
  "/catalog/quotes",
34500
34547
  { method: "POST", ...jsonBody({ ...request, input }), signal },
@@ -34504,7 +34551,7 @@ var CatalogClient = class {
34504
34551
  quoteBatch(request, signal) {
34505
34552
  const spec = getModelSpec(request.modelId);
34506
34553
  const schema = spec?.operations.find((operation) => operation.operation === request.operation)?.inputSchema ?? spec?.operations[0]?.inputSchema;
34507
- const entries = schema ? request.entries.map((entry) => ({ ...entry, input: applyMediaGeometry(schema, entry.input) })) : request.entries;
34554
+ const entries = schema ? request.entries.map((entry) => ({ ...entry, input: applyNoWatermark(schema, applyMediaGeometry(schema, entry.input)) })) : request.entries;
34508
34555
  return this.transport.json(
34509
34556
  "/catalog/quotes/batch",
34510
34557
  { method: "POST", ...jsonBody({ ...request, entries }), signal },
@@ -34550,6 +34597,7 @@ export {
34550
34597
  encodeMediaGeometry,
34551
34598
  decodeMediaGeometry,
34552
34599
  applyMediaGeometry,
34600
+ applyNoWatermark,
34553
34601
  CatalogClient,
34554
34602
  getModelSpec,
34555
34603
  listModelSpecs
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as AssetsClient, T as TasksClient, R as RunTaskOptions, a as RunResult, b as ApiErrorPayload, c as TaskResult } from './types-5jsH7tBX.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-5jsH7tBX.js';
1
+ import { A as AssetsClient, T as TasksClient, R as RunTaskOptions, a as RunResult, b as ApiErrorPayload, c as TaskResult } from './types-Dwy7j1S1.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-Dwy7j1S1.js';
3
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
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';
5
5
  import { CatalogClient } from './catalog.js';
package/dist/index.js CHANGED
@@ -7,6 +7,7 @@ import {
7
7
  NexraWaitTimeoutError,
8
8
  TASK_STATUSES,
9
9
  applyMediaGeometry,
10
+ applyNoWatermark,
10
11
  decodeMediaGeometry,
11
12
  encodeMediaGeometry,
12
13
  getModelSpec,
@@ -16,7 +17,7 @@ import {
16
17
  projectMediaGeometry,
17
18
  queryString,
18
19
  sleep
19
- } from "./chunk-5FVL2U56.js";
20
+ } from "./chunk-VFIIDWIH.js";
20
21
  import {
21
22
  ceilDecimal,
22
23
  multiplyDecimal
@@ -280,7 +281,7 @@ var TasksClient = class {
280
281
  assets;
281
282
  async create(model, options) {
282
283
  const schema = getModelSpec(model)?.operations[0]?.inputSchema;
283
- const mapped = schema && options.input && typeof options.input === "object" && !Array.isArray(options.input) ? applyMediaGeometry(schema, options.input) : options.input;
284
+ const mapped = schema && options.input && typeof options.input === "object" && !Array.isArray(options.input) ? applyNoWatermark(schema, applyMediaGeometry(schema, options.input)) : options.input;
284
285
  const input = await normalizeTaskInput(mapped, this.assets, options.signal);
285
286
  const body = {
286
287
  model,
@@ -350,7 +351,9 @@ var TasksClient = class {
350
351
  const event = JSON.parse(serverEvent.data);
351
352
  yield event;
352
353
  if (event.status && isTerminalTaskStatus(event.status)) {
353
- reachedTerminalState = true;
354
+ const task = event.payload?.task;
355
+ const deliveryPreparing = task && typeof task === "object" && !Array.isArray(task) && task.deliveryStatus === "preparing";
356
+ if (!deliveryPreparing) reachedTerminalState = true;
354
357
  }
355
358
  }
356
359
  if (reachedTerminalState) return;
@@ -100,10 +100,18 @@ interface TaskTiming {
100
100
  submittedAt: string;
101
101
  providerSubmittedAt?: string;
102
102
  providerCompletedAt?: string;
103
+ /** First public terminal response; background media may still be preparing. */
104
+ firstResponseAt?: string;
105
+ /** Background media ready response; absent while preparing or after persistence failure. */
106
+ secondResponseAt?: string;
103
107
  storedAt?: string;
108
+ persistPolicy?: "terminal" | "background";
109
+ deliveryStatus?: "preparing" | "ready" | "failed";
104
110
  preparationMs: number | null;
105
111
  generationMs: number | null;
106
112
  storageMs: number | null;
113
+ /** Background persistence elapsed time from first response to durable asset readiness. */
114
+ persistMs?: number | null;
107
115
  totalMs: number | null;
108
116
  startSource: "client" | "server";
109
117
  /** Server clock reading taken when this snapshot was built; lets clients anchor live timers to server time. */
@@ -122,8 +130,16 @@ interface Task<TOutput = JsonValue> {
122
130
  /** Model request parameters; native-managed tasks retain the upstream field structure. */
123
131
  input?: JsonObject;
124
132
  status: TaskStatus;
125
- /** Regional media availability; execution/billing remain terminal while replicas prepare. */
126
- deliveryStatus?: "preparing" | "ready";
133
+ /** Persistence policy frozen when the Task is created. Background is limited to video Tasks. */
134
+ persistPolicy?: "terminal" | "background";
135
+ /**
136
+ * Regional media availability. "preparing" means the task result is delivered
137
+ * with provider media URLs while Nexra persists them to its own object storage
138
+ * in the background; "ready" means persisted URLs; "failed" means background
139
+ * persistence exhausted its retries and the provider URLs have expired.
140
+ * Execution/billing remain terminal regardless of this value.
141
+ */
142
+ deliveryStatus?: "preparing" | "ready" | "failed";
127
143
  progress?: TaskProgress;
128
144
  /** Native-managed tasks preserve the final response shape and media URLs; catalog models may normalize model identifiers. */
129
145
  output?: TOutput;
@@ -135,7 +151,13 @@ interface Task<TOutput = JsonValue> {
135
151
  billingStatus?: "pending" | "succeeded" | "failed" | "refunded" | "unavailable";
136
152
  /** Final customer sale settlement. Provider procurement cost is never exposed here. */
137
153
  settlement?: NexraSettlement;
138
- /** Caller-supplied business data, returned unchanged; never sent to the provider. */
154
+ /**
155
+ * Caller-supplied business data, returned unchanged; never sent to the provider.
156
+ * The platform extracts the reserved string keys `callerUrl` (caller origin,
157
+ * https URL) and `endUserId` (opaque end-user identifier) into dedicated
158
+ * attribution columns for support diagnostics; their values are not validated
159
+ * beyond format checks and remain unchanged inside `metadata`.
160
+ */
139
161
  metadata?: JsonObject;
140
162
  timing?: TaskTiming;
141
163
  /** Server-side Task record creation time (ISO 8601 UTC). */
@@ -144,7 +166,12 @@ interface Task<TOutput = JsonValue> {
144
166
  updatedAt: string;
145
167
  /** First worker execution start; absent while queued or cancelled before execution. */
146
168
  startedAt?: string;
147
- /** Terminal succeeded/failed/cancelled time; success follows required asset storage. */
169
+ /**
170
+ * Terminal succeeded/failed/cancelled time. Synchronously persisted tasks
171
+ * (default) reach succeeded only after required asset storage; background-
172
+ * persisted tasks are declared succeeded at result delivery while storage
173
+ * continues, signalled by `deliveryStatus` and the task timing second response.
174
+ */
148
175
  completedAt?: string;
149
176
  /** @deprecated Reserved; no Task expiry policy is currently enforced. Not a media URL expiry. */
150
177
  expiresAt?: string;
@@ -152,7 +179,7 @@ interface Task<TOutput = JsonValue> {
152
179
  /** POST /tasks returns acceptance only, including for idempotent replays. */
153
180
  type TaskReceipt = Pick<Task, "id" | "status">;
154
181
  /** Public Task result; platform diagnostics and business tags live in RequestDetails. */
155
- type TaskResult<TOutput = JsonValue> = Pick<Task<TOutput>, "id" | "model" | "status"> & Partial<Pick<Task<TOutput>, "requestId" | "output" | "assets" | "error" | "deliveryStatus" | "settlement">>;
182
+ type TaskResult<TOutput = JsonValue> = Pick<Task<TOutput>, "id" | "model" | "status"> & Partial<Pick<Task<TOutput>, "requestId" | "output" | "assets" | "error" | "persistPolicy" | "deliveryStatus" | "settlement">>;
156
183
  /** Platform request details, used by both managed Tasks and native proxy requests. */
157
184
  interface RequestDetails {
158
185
  id: string;
@@ -167,6 +194,8 @@ interface RequestDetails {
167
194
  status: string;
168
195
  /** Linked Task lifecycle when this request accepted a Task; HTTP `status` stays accepted. */
169
196
  taskStatus?: string | null;
197
+ persistPolicy?: "terminal" | "background";
198
+ deliveryStatus?: Task["deliveryStatus"];
170
199
  httpStatus: number | null;
171
200
  errorCode: string | null;
172
201
  /** HTTP duration, never substituted with asynchronous task duration. */
@@ -176,6 +205,12 @@ interface RequestDetails {
176
205
  billingStatus?: Task["billingStatus"];
177
206
  settlement?: NexraSettlement;
178
207
  metadata?: JsonObject;
208
+ /** Caller-asserted origin extracted from metadata.callerUrl; diagnostics display only. */
209
+ callerUrl?: string | null;
210
+ /** Caller-asserted end-user identifier extracted from metadata.endUserId; diagnostics display only. */
211
+ endUserId?: string | null;
212
+ /** Name of the API key that authenticated this request; diagnostics display only. */
213
+ apiKeyName?: string | null;
179
214
  /** Latest known execution update; omitted when not observed. */
180
215
  updatedAt?: string;
181
216
  runId?: string;
package/dist/types.d.ts CHANGED
@@ -1,2 +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-5jsH7tBX.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-Dwy7j1S1.js';
2
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.16",
3
+ "version": "0.1.0-alpha.18",
4
4
  "type": "module",
5
5
  "types": "./dist/index.d.ts",
6
6
  "sideEffects": false,