@nodaro/sdk 2.18.0 → 2.20.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.cjs CHANGED
@@ -300,6 +300,34 @@ var WorkflowsResource = class {
300
300
  { body: params }
301
301
  );
302
302
  }
303
+ /**
304
+ * Render final (`renderFinal` on `POST /v1/workflows/:id/run`): run the
305
+ * render at Final for this run only, and every node after it, continuing the
306
+ * execution that stopped at its preview. The server derives the nodes and
307
+ * the override — send nothing else. Quote it first with
308
+ * {@link estimateRenderFinal}. Refused with `render_final_node_not_found`,
309
+ * `render_final_not_a_render`, or a continuation code (see `run`); a run
310
+ * its payer cannot cover throws `InsufficientCreditsError` (with `required`
311
+ * and, when it is yours to see, `available`) before any execution exists.
312
+ */
313
+ renderFinal(id, params) {
314
+ return this.client.request("POST", `/v1/workflows/${encodeURIComponent(id)}/run`, {
315
+ body: {
316
+ renderFinal: { renderNodeId: params.renderNodeId },
317
+ continueFromExecutionId: params.continueFromExecutionId
318
+ }
319
+ });
320
+ }
321
+ /**
322
+ * Quote a Render final (`POST /v1/workflows/:id/render-final/estimate`): the
323
+ * nodes it will run, the override it runs with and its estimated credits.
324
+ * Nothing is created or charged.
325
+ */
326
+ estimateRenderFinal(id, params) {
327
+ return this.client.request("POST", `/v1/workflows/${encodeURIComponent(id)}/render-final/estimate`, {
328
+ body: { renderNodeId: params.renderNodeId, continueFromExecutionId: params.continueFromExecutionId }
329
+ });
330
+ }
303
331
  /**
304
332
  * Export a workflow as a portable JSON bundle.
305
333
  * Pass `opts.assets = true` to include character/object/location entity data.
@@ -2078,13 +2106,20 @@ var VoicesResource = class {
2078
2106
  }
2079
2107
  /**
2080
2108
  * Voice a multi-speaker script as ONE audio file
2081
- * (`POST /v1/text-to-dialogue`, ElevenLabs Dialogue v3). Each `dialogue`
2082
- * line is `{ text, voice }` in speaking order — `voice` is a premade voice
2083
- * name or an ElevenLabs voice UUID (cloned/library voices work too; mixed
2084
- * casts are fine). At most 5,000 characters total across lines (≤2,000
2085
- * recommended for best quality) and 10 unique voices. Line text may carry
2086
- * `[audio tags]` like `[laughs]`. Costs credits and runs async — poll
2087
- * `jobs.get(jobId)` for `output_data.audioUrl`.
2109
+ * (`POST /v1/text-to-dialogue`) on ElevenLabs Dialogue v3 — the default — or
2110
+ * Dialogue v4 (`provider: "elevenlabs-dialogue-v4"`). Each `dialogue` line is
2111
+ * `{ text, voice }` in speaking order — `voice` is a premade voice name or an
2112
+ * ElevenLabs voice UUID (cloned/library voices work too; mixed casts are
2113
+ * fine). At most 5,000 characters total across lines on either model
2114
+ * (≤2,000 recommended for best quality) and 10 unique voices. Line text may
2115
+ * carry `[audio tags]` like `[laughs]`. Costs credits and runs async — poll
2116
+ * `jobs.get(jobId)` for `output_data.audioUrl` and — on every dialogue model,
2117
+ * since both return timings at no extra credits — `output_data.transcript`, a
2118
+ * `Transcript` (`@nodaro/shared`): `words[]` with `startMs` / `endMs` /
2119
+ * `speaker` and one `segments[]` entry per line, `speaker` being the line's
2120
+ * `voice` as you sent it. Pass `transcript.words` to
2121
+ * `addCaptions({ captions, autoTranscribe: false })` to caption the dialogue
2122
+ * without a second transcription.
2088
2123
  */
2089
2124
  textToDialogue(input) {
2090
2125
  return this.client.request("POST", "/v1/text-to-dialogue", { body: input });
@@ -2440,7 +2475,14 @@ var AudioResource = class {
2440
2475
  /**
2441
2476
  * Layer multiple audio tracks into one (`POST /v1/mix-audio`). `audioUrls`
2442
2477
  * (2–20) are summed; optional `trackVolumes` (0–200% each, positionally) set
2443
- * per-track level.
2478
+ * per-track level. `duck` puts a music bed under speech: every track EXCEPT
2479
+ * `duck.under` (the 0-based index of the voice track) dips while that track
2480
+ * is loud and rises back in its pauses (sidechain compression). `amount`
2481
+ * (0–100, default 75) is how hard; `thresholdDb` (-60–0, default -30),
2482
+ * `ratio` (1–20, overrides `amount`), `attackMs` (1–2000, default 20) and
2483
+ * `releaseMs` (10–9000, default 500) are optional fine controls. A ducked mix
2484
+ * sums its tracks rather than averaging them, so the voice keeps its level;
2485
+ * the price is the same with or without a duck.
2444
2486
  */
2445
2487
  mix(input) {
2446
2488
  return this.client.request("POST", "/v1/mix-audio", { body: input });
@@ -2655,6 +2697,66 @@ var SavedPostsResource = class {
2655
2697
  }
2656
2698
  };
2657
2699
 
2700
+ // src/resources/collections.ts
2701
+ var CollectionsResource = class {
2702
+ constructor(client) {
2703
+ this.client = client;
2704
+ }
2705
+ client;
2706
+ /** `GET /v1/collections` → your collections with their record counts, whether the server has collections at all, and your caps. */
2707
+ list() {
2708
+ return this.client.request("GET", "/v1/collections");
2709
+ }
2710
+ /** `GET /v1/collections/:id` → one collection. */
2711
+ get(id) {
2712
+ return this.client.request("GET", `/v1/collections/${encodeURIComponent(id)}`);
2713
+ }
2714
+ /** `POST /v1/collections` → a new collection (`409 name_taken` when you have one by that name, `403 collection_limit_reached` at your cap). */
2715
+ create(input) {
2716
+ return this.client.request("POST", "/v1/collections", { body: input });
2717
+ }
2718
+ /** `PATCH /v1/collections/:id` → rename or re-describe a collection. */
2719
+ update(id, input) {
2720
+ return this.client.request("PATCH", `/v1/collections/${encodeURIComponent(id)}`, { body: input });
2721
+ }
2722
+ /** `DELETE /v1/collections/:id` → remove a collection and every record in it. */
2723
+ async delete(id) {
2724
+ await this.client.request("DELETE", `/v1/collections/${encodeURIComponent(id)}`);
2725
+ }
2726
+ /** `GET /v1/collections/:id/records` → the records, newest first. Narrow with `q` (words) and `since` (ISO); page with `cursor` / `limit` (1-100, default 50). */
2727
+ records(id, params = {}) {
2728
+ return this.client.request("GET", `/v1/collections/${encodeURIComponent(id)}/records`, {
2729
+ query: { q: params.q, since: params.since, cursor: params.cursor, limit: params.limit }
2730
+ });
2731
+ }
2732
+ /**
2733
+ * `POST /v1/collections/:id/records` → save one record. Give the fields, or
2734
+ * `item` (any JSON — a feed post, a search result) and let the server map it;
2735
+ * explicit fields win. `outcome` is `inserted`, `duplicate` (the same link or
2736
+ * dedupe key is already there — the existing record comes back) or `replayed`
2737
+ * (a write with the same `idempotencyKey` already happened).
2738
+ */
2739
+ addRecord(id, input, opts = {}) {
2740
+ return this.client.request("POST", `/v1/collections/${encodeURIComponent(id)}/records`, {
2741
+ body: input,
2742
+ ...opts.idempotencyKey ? { headers: { "Idempotency-Key": opts.idempotencyKey } } : {}
2743
+ });
2744
+ }
2745
+ /** `DELETE /v1/collections/:id/records/:recordId` → remove one record. */
2746
+ async deleteRecord(id, recordId) {
2747
+ await this.client.request(
2748
+ "DELETE",
2749
+ `/v1/collections/${encodeURIComponent(id)}/records/${encodeURIComponent(recordId)}`
2750
+ );
2751
+ }
2752
+ /** `GET /v1/collections/:id/export` → the whole collection as CSV (default) or JSON text, newest first; `since` and `q` narrow it. */
2753
+ export(id, params = {}) {
2754
+ return this.client.requestText("GET", `/v1/collections/${encodeURIComponent(id)}/export`, {
2755
+ query: { format: params.format, since: params.since, q: params.q }
2756
+ });
2757
+ }
2758
+ };
2759
+
2658
2760
  // src/resources/competitors.ts
2659
2761
  var CompetitorsResource = class {
2660
2762
  constructor(client) {
@@ -2663,12 +2765,37 @@ var CompetitorsResource = class {
2663
2765
  client;
2664
2766
  /** `GET /v1/competitors` → every tracked brand. */
2665
2767
  async list() {
2666
- const res = await this.client.request("GET", "/v1/competitors");
2667
- return res.data;
2768
+ const res = await this.listWithPlan();
2769
+ return [...res.data];
2668
2770
  }
2669
- /** `GET /v1/competitors/:id` → one brand with its latest scan (posts and cards) and its scan history. */
2670
- get(id) {
2671
- return this.client.request("GET", `/v1/competitors/${encodeURIComponent(id)}`);
2771
+ /** `GET /v1/competitors` → every tracked brand, with how many months of scans your plan keeps. */
2772
+ listWithPlan() {
2773
+ return this.client.request("GET", "/v1/competitors");
2774
+ }
2775
+ /**
2776
+ * `GET /v1/competitors/:id` → one brand with its latest scan (posts and
2777
+ * cards) and its scan history; with `scan`, the brand as of that scan.
2778
+ */
2779
+ get(id, options = {}) {
2780
+ const query = options.scan ? `?scan=${encodeURIComponent(options.scan)}` : "";
2781
+ return this.client.request("GET", `/v1/competitors/${encodeURIComponent(id)}${query}`);
2782
+ }
2783
+ /** `GET /v1/competitors/:id/history` → the brand's scans oldest first, per platform what each found and read (free). */
2784
+ history(id) {
2785
+ return this.client.request("GET", `/v1/competitors/${encodeURIComponent(id)}/history`);
2786
+ }
2787
+ /**
2788
+ * `GET /v1/competitors/:id/compare` → the brand over a period, and over a
2789
+ * second one to compare with (free). A post belongs to a period by its
2790
+ * publish date; a period is at most a year.
2791
+ */
2792
+ compare(id, input) {
2793
+ const params = new URLSearchParams({ from: input.from, to: input.to });
2794
+ if (input.vsFrom !== void 0 && input.vsTo !== void 0) {
2795
+ params.set("vsFrom", input.vsFrom);
2796
+ params.set("vsTo", input.vsTo);
2797
+ }
2798
+ return this.client.request("GET", `/v1/competitors/${encodeURIComponent(id)}/compare?${params.toString()}`);
2672
2799
  }
2673
2800
  /** `POST /v1/competitors` → track a brand. Accounts take handles or links. */
2674
2801
  create(input) {
@@ -3761,6 +3888,8 @@ var EditResource = class {
3761
3888
  ...input.output !== void 0 ? { output: input.output } : {},
3762
3889
  ...input.quality !== void 0 ? { quality: input.quality } : {},
3763
3890
  ...input.crossfadeMs !== void 0 ? { crossfadeMs: input.crossfadeMs } : {},
3891
+ ...input.clipKey !== void 0 ? { clipKey: input.clipKey } : {},
3892
+ ...input.planBasis !== void 0 ? { planBasis: input.planBasis } : {},
3764
3893
  ...input.workflowId !== void 0 ? { workflowId: input.workflowId } : {}
3765
3894
  }
3766
3895
  });
@@ -3769,8 +3898,8 @@ var EditResource = class {
3769
3898
  * Plan a transcript-driven cut (`POST /v1/edit-plan`). Reads a timed
3770
3899
  * transcript (plus optional silence ranges) and the media sources, and plans
3771
3900
  * the edit. The finished job's `output_data` holds the plan: an `Edl`
3772
- * (`"tighten"`), an {@link EdlClipSet} (`"clips"`), or a {@link ChapterSet}
3773
- * (`"chapters"`) — normalize it with {@link unwrapEditPlanOutput}.
3901
+ * (`"tighten"` or `"trailer"`), an {@link EdlClipSet} (`"clips"`), or a
3902
+ * {@link ChapterSet} (`"chapters"`) — normalize it with {@link unwrapEditPlanOutput}.
3774
3903
  *
3775
3904
  * On a self-hosted install the request relays to nodaro.ai and needs the
3776
3905
  * install connected (a 503 `code: "nodaro_connection_required"` otherwise);
@@ -3845,7 +3974,7 @@ var EditResource = class {
3845
3974
  return shared.remapTranscriptThroughEdl(edl, transcript);
3846
3975
  }
3847
3976
  };
3848
- var SDK_VERSION = "2.18.0" ;
3977
+ var SDK_VERSION = "2.20.0" ;
3849
3978
  var CLIENT_HEADER = "X-Nodaro-Client";
3850
3979
  var isBrowser = () => typeof window !== "undefined" && typeof window.document !== "undefined";
3851
3980
  var NodaroClient = class _NodaroClient {
@@ -3892,6 +4021,7 @@ var NodaroClient = class _NodaroClient {
3892
4021
  library;
3893
4022
  presets;
3894
4023
  savedPosts;
4024
+ collections;
3895
4025
  competitors;
3896
4026
  pickerCatalogs;
3897
4027
  catalogs;
@@ -3942,6 +4072,7 @@ var NodaroClient = class _NodaroClient {
3942
4072
  this.library = new LibraryResource(this);
3943
4073
  this.presets = new PresetsResource(this);
3944
4074
  this.savedPosts = new SavedPostsResource(this);
4075
+ this.collections = new CollectionsResource(this);
3945
4076
  this.competitors = new CompetitorsResource(this);
3946
4077
  this.pickerCatalogs = new PickerCatalogsResource(this);
3947
4078
  this.catalogs = new CatalogsResource(this);
@@ -4218,6 +4349,7 @@ exports.CREATURE_ASSET_TYPES = CREATURE_ASSET_TYPES;
4218
4349
  exports.CallbackAuth = CallbackAuth;
4219
4350
  exports.CatalogsResource = CatalogsResource;
4220
4351
  exports.CharactersResource = CharactersResource;
4352
+ exports.CollectionsResource = CollectionsResource;
4221
4353
  exports.CommunityResource = CommunityResource;
4222
4354
  exports.CompetitorsResource = CompetitorsResource;
4223
4355
  exports.CopilotResource = CopilotResource;