@nodaro/sdk 2.21.1 → 2.24.0

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.js CHANGED
@@ -1027,10 +1027,14 @@ var CharactersResource = class {
1027
1027
  /**
1028
1028
  * Fetch a single character including in-flight portrait / asset job state.
1029
1029
  * Soft-deleted (archived) rows are returned by id intentionally so canvas
1030
- * nodes that hold a stale `characterDbId` keep loading.
1030
+ * nodes that hold a stale `characterDbId` keep loading. Pass
1031
+ * `{ candidates: "all" }` to also get the current portrait's own take in
1032
+ * `previousCandidates` (flagged `isPortrait: true`).
1031
1033
  */
1032
- get(id) {
1033
- return this.client.request("GET", `/v1/characters/${encodeURIComponent(id)}`);
1034
+ get(id, options = {}) {
1035
+ const query = {};
1036
+ if (options.candidates) query.candidates = options.candidates;
1037
+ return this.client.request("GET", `/v1/characters/${encodeURIComponent(id)}`, { query });
1034
1038
  }
1035
1039
  /**
1036
1040
  * Create or update a character. Omit `id` to create; supply it to update
@@ -1101,8 +1105,8 @@ var CharactersResource = class {
1101
1105
  * is enqueued — mid-batch failures roll back atomically.
1102
1106
  *
1103
1107
  * When `attachToCharacterId` is set, the worker writes the result directly
1104
- * to the row's `source_image_url`; otherwise you must call
1105
- * `approvePortrait()` after picking a candidate.
1108
+ * to the row's `source_image_url` (unless `attachPortrait: false`);
1109
+ * otherwise you must call `approvePortrait()` after picking a candidate.
1106
1110
  */
1107
1111
  generate(input) {
1108
1112
  return this.client.request("POST", "/v1/generate-character", { body: input });
@@ -2425,6 +2429,32 @@ var MediaResource = class {
2425
2429
  videoOverlay(input) {
2426
2430
  return this.client.request("POST", "/v1/video-overlay", { body: input });
2427
2431
  }
2432
+ /**
2433
+ * Track a subject described in plain text through a video and get a
2434
+ * black-and-white MASK VIDEO back (`POST /v1/video-mask`, SAM 3.1 by default,
2435
+ * or `provider: "sam-3"` at half the price) — white = the subject. Clips up
2436
+ * to 5 minutes at 30 fps (a faster clip counts
2437
+ * proportionally longer), priced by the clip's length. Poll
2438
+ * `jobs.get(jobId)`: the output carries `videoUrl` (the mask), `width`,
2439
+ * `height`, `frames` and `coverage` (the fraction of pixels selected). Feed
2440
+ * the mask to {@link MediaResource.maskComposite}.
2441
+ */
2442
+ videoMask(input) {
2443
+ return this.client.request("POST", "/v1/video-mask", { body: input });
2444
+ }
2445
+ /**
2446
+ * Place a foreground video over a background video through a mask video
2447
+ * (`POST /v1/mask-composite`; white = foreground) — local FFmpeg, no AI.
2448
+ * The result follows the foreground's size, frame rate and length; the
2449
+ * background is fitted (`backgroundFit`, default cover) and loops when
2450
+ * shorter; the mask holds its last frame when shorter. Optional
2451
+ * `invertMask`, `feather` (0–20 px), `grow` (−10–10 px) and `audioSource`
2452
+ * (foreground / background / mix / none). Priced per started 5 seconds of
2453
+ * the result (foreground up to 300 s). Poll `jobs.get(jobId)` for `videoUrl`.
2454
+ */
2455
+ maskComposite(input) {
2456
+ return this.client.request("POST", "/v1/mask-composite", { body: input });
2457
+ }
2428
2458
  /**
2429
2459
  * Probe a social video's metadata (`POST /v1/video-metadata`) — duration,
2430
2460
  * dimensions, title, live status — WITHOUT downloading it. A direct read, not a
@@ -2496,6 +2526,16 @@ var AudioResource = class {
2496
2526
  adjustVolume(input) {
2497
2527
  return this.client.request("POST", "/v1/adjust-volume", { body: input });
2498
2528
  }
2529
+ /**
2530
+ * Shift pitch and/or change tempo with Rubber Band (`POST /v1/pitch-tempo`):
2531
+ * `semitones` −12…+12 (default 0), `tempo` 0.5…2 with the pitch kept
2532
+ * (default 1; fixed at 1 for a video), `preserveFormants` (default true).
2533
+ * Provide exactly one of `audioUrl` or `videoUrl` — a video keeps its picture.
2534
+ * Input up to 30 minutes, priced per started minute.
2535
+ */
2536
+ pitchTempo(input) {
2537
+ return this.client.request("POST", "/v1/pitch-tempo", { body: input });
2538
+ }
2499
2539
  /**
2500
2540
  * Concatenate audio segments end-to-end (`POST /v1/combine-audio`). Each
2501
2541
  * segment is a `url` with an optional `[startTime, endTime]` sub-range.
@@ -2724,10 +2764,44 @@ var CollectionsResource = class {
2724
2764
  async delete(id) {
2725
2765
  await this.client.request("DELETE", `/v1/collections/${encodeURIComponent(id)}`);
2726
2766
  }
2727
- /** `GET /v1/collections/:id/records` → the records, newest first. Narrow with `q` (words) and `since` (ISO); page with `cursor` / `limit` (1-100, default 50). */
2767
+ /**
2768
+ * `GET /v1/collections/:id/records` → the records, newest first (`order: "oldest"`
2769
+ * flips it). Narrow with `q` (words), `since` / `until` (ISO) and `usage`
2770
+ * (`all`, `unused` — not used yet — or `used`); page with `cursor` / `limit`
2771
+ * (1-100, default 50). Each record carries `usedAt` / `usedBy`, and its
2772
+ * `source` the saving workflow's name and project when it is yours.
2773
+ */
2728
2774
  records(id, params = {}) {
2729
2775
  return this.client.request("GET", `/v1/collections/${encodeURIComponent(id)}/records`, {
2730
- query: { q: params.q, since: params.since, cursor: params.cursor, limit: params.limit }
2776
+ query: {
2777
+ q: params.q,
2778
+ since: params.since,
2779
+ until: params.until,
2780
+ usage: params.usage,
2781
+ status: params.status,
2782
+ order: params.order,
2783
+ cursor: params.cursor,
2784
+ offset: params.offset,
2785
+ limit: params.limit
2786
+ }
2787
+ });
2788
+ }
2789
+ /** `POST /v1/collections/:id/records/:recordId/restore` → bring a record back from the Trash; the record. */
2790
+ restoreRecord(id, recordId) {
2791
+ return this.client.request("POST", `/v1/collections/${encodeURIComponent(id)}/records/${encodeURIComponent(recordId)}/restore`);
2792
+ }
2793
+ /** `POST /v1/collections/:id/records/bulk` → move up to 100 records to the Trash, bring them back, or delete records already in the Trash for good, in one call. */
2794
+ bulkRecords(id, input) {
2795
+ return this.client.request("POST", `/v1/collections/${encodeURIComponent(id)}/records/bulk`, { body: input });
2796
+ }
2797
+ /**
2798
+ * `PATCH /v1/collections/:id/records/:recordId` → mark a record used (or not
2799
+ * used again). `source` says who is marking it (defaults to the API). A
2800
+ * server before the usage release answers `503 not_available`.
2801
+ */
2802
+ setUsed(id, recordId, used, source) {
2803
+ return this.client.request("PATCH", `/v1/collections/${encodeURIComponent(id)}/records/${encodeURIComponent(recordId)}`, {
2804
+ body: { used, ...source ? { source } : {} }
2731
2805
  });
2732
2806
  }
2733
2807
  /**
@@ -2743,17 +2817,22 @@ var CollectionsResource = class {
2743
2817
  ...opts.idempotencyKey ? { headers: { "Idempotency-Key": opts.idempotencyKey } } : {}
2744
2818
  });
2745
2819
  }
2746
- /** `DELETE /v1/collections/:id/records/:recordId` → remove one record. */
2820
+ /**
2821
+ * `DELETE /v1/collections/:id/records/:recordId` → the record moves to the
2822
+ * collection's Trash (`restoreRecord` brings it back; `deleteRecordForever`
2823
+ * removes it for good).
2824
+ */
2747
2825
  async deleteRecord(id, recordId) {
2748
- await this.client.request(
2749
- "DELETE",
2750
- `/v1/collections/${encodeURIComponent(id)}/records/${encodeURIComponent(recordId)}`
2751
- );
2826
+ await this.client.request("DELETE", `/v1/collections/${encodeURIComponent(id)}/records/${encodeURIComponent(recordId)}`);
2827
+ }
2828
+ /** `DELETE /v1/collections/:id/records/:recordId/permanent` → a record already in the Trash is deleted for good (`409 not_in_trash` for a live one). */
2829
+ async deleteRecordForever(id, recordId) {
2830
+ await this.client.request("DELETE", `/v1/collections/${encodeURIComponent(id)}/records/${encodeURIComponent(recordId)}/permanent`);
2752
2831
  }
2753
- /** `GET /v1/collections/:id/export` → the whole collection as CSV (default) or JSON text, newest first; `since` and `q` narrow it. */
2832
+ /** `GET /v1/collections/:id/export` → the whole collection as CSV (default) or JSON text, newest first; `since`, `until`, `usage` and `q` narrow it. */
2754
2833
  export(id, params = {}) {
2755
2834
  return this.client.requestText("GET", `/v1/collections/${encodeURIComponent(id)}/export`, {
2756
- query: { format: params.format, since: params.since, q: params.q }
2835
+ query: { format: params.format, since: params.since, until: params.until, usage: params.usage, q: params.q }
2757
2836
  });
2758
2837
  }
2759
2838
  };
@@ -3975,7 +4054,7 @@ var EditResource = class {
3975
4054
  return remapTranscriptThroughEdl(edl, transcript);
3976
4055
  }
3977
4056
  };
3978
- var SDK_VERSION = "2.21.1" ;
4057
+ var SDK_VERSION = "2.24.0" ;
3979
4058
  var CLIENT_HEADER = "X-Nodaro-Client";
3980
4059
  var isBrowser = () => typeof window !== "undefined" && typeof window.document !== "undefined";
3981
4060
  var NodaroClient = class _NodaroClient {