@nodaro/sdk 2.2.0 → 2.5.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
@@ -2138,6 +2138,22 @@ var MediaResource = class {
2138
2138
  imageCollage(input) {
2139
2139
  return this.client.request("POST", "/v1/image-collage", { body: input });
2140
2140
  }
2141
+ /**
2142
+ * Place 1–12 layers — pictures, real text, QR codes, shapes — on a base image,
2143
+ * pixel-exactly (`POST /v1/image-overlay`) — local, deterministic, no AI.
2144
+ * Every layer position/size is a PERCENT of the base image: `anchor` (nine
2145
+ * positions, default `"center"`), `x`/`y` (offset from the anchor in % of
2146
+ * the base width/height; negative on a right/bottom anchor moves inward),
2147
+ * `width` (% of the base width, default 25 — height follows the layer's
2148
+ * aspect unless `height` is set). Plus `opacity` (0..1), `rotation`
2149
+ * (degrees), `blend` (`"over"` | `"multiply"` | `"screen"`), `fit`,
2150
+ * `shadow` and `roundedCorners`. The output keeps the base's pixel size
2151
+ * unless `canvas` is set. Flat credit cost. Poll `jobs.get(jobId)` for the
2152
+ * finished image.
2153
+ */
2154
+ imageOverlay(input) {
2155
+ return this.client.request("POST", "/v1/image-overlay", { body: input });
2156
+ }
2141
2157
  /**
2142
2158
  * Trim a video to a range (`POST /v1/trim-video`). Give the range in whichever
2143
2159
  * unit fits: `startTime`/`endTime` seconds, `trim*Frames`, `trim*Seconds`, or
@@ -2543,7 +2559,7 @@ var RecastResource = class {
2543
2559
  }
2544
2560
  };
2545
2561
 
2546
- // src/resources/studio.ts
2562
+ // src/resources/studio-productions.ts
2547
2563
  function isStudioGenerateEstimate(result) {
2548
2564
  return result.dryRun === true;
2549
2565
  }
@@ -2775,11 +2791,80 @@ var StudioProductionsResource = class {
2775
2791
  return res.data.production;
2776
2792
  }
2777
2793
  };
2794
+
2795
+ // src/resources/studio.ts
2796
+ var root = "/v1/studio/productions";
2797
+ var path = (id) => `${root}/${encodeURIComponent(id)}`;
2778
2798
  var StudioResource = class {
2779
- productions;
2780
2799
  constructor(client) {
2800
+ this.client = client;
2781
2801
  this.productions = new StudioProductionsResource(client);
2782
2802
  }
2803
+ client;
2804
+ productions;
2805
+ capabilities() {
2806
+ return this.client.request("GET", `${root}/capabilities`);
2807
+ }
2808
+ skill() {
2809
+ return this.client.request("GET", `${root}/skill`);
2810
+ }
2811
+ list(options = {}) {
2812
+ return this.client.request("GET", root, { query: options });
2813
+ }
2814
+ get(id, options = {}) {
2815
+ return this.client.request("GET", path(id), { query: { detail: options.detail, shot_id: options.shotId } });
2816
+ }
2817
+ validatePlan(plan) {
2818
+ return this.client.request("POST", `${root}/validate`, { body: { plan } });
2819
+ }
2820
+ create(input) {
2821
+ return this.client.request("POST", root, { body: input });
2822
+ }
2823
+ /** Import a portable document through the compatible server writer.
2824
+ * Retained frame media requires an authorized source; acceptance never transfers. */
2825
+ importBundle(input) {
2826
+ return this.client.request("POST", `${root}/import-bundle`, { body: input });
2827
+ }
2828
+ /** Append a bundle's scenes and frame closure under an exact destination revision. */
2829
+ appendBundle(id, input) {
2830
+ return this.client.request("POST", `${path(id)}/import-bundle`, { body: input });
2831
+ }
2832
+ /** Copy a saved production. Linked copies retain verified inputs, remap
2833
+ * dependencies and require fresh frame acceptance; they start no media jobs. */
2834
+ clone(id, input = {}) {
2835
+ return this.client.request("POST", `${path(id)}/clone`, { body: input });
2836
+ }
2837
+ edit(id, input) {
2838
+ return this.client.request("POST", `${path(id)}/ops`, { body: input });
2839
+ }
2840
+ /** Audience-authorized sharing; an expected revision prevents publication
2841
+ * of concurrent edits the caller has not reviewed. */
2842
+ setShared(id, input) {
2843
+ return this.client.request("POST", `${path(id)}/share`, { body: input });
2844
+ }
2845
+ /** Save ordinary editor fields against the loaded revision. Protected frame
2846
+ * and job state can only change through their dedicated semantic actions. */
2847
+ saveEditorState(id, input) {
2848
+ return this.edit(id, {
2849
+ baseVersion: input.expectedVersion,
2850
+ strict: true,
2851
+ ...input.clientRequestId ? { clientRequestId: input.clientRequestId } : {},
2852
+ ops: [{ op: "save_editor_state", expectedVersion: input.expectedVersion, graph: input.graph }]
2853
+ });
2854
+ }
2855
+ generateKeyframe(id, input) {
2856
+ return this.client.request("POST", `${path(id)}/generate`, { body: { ...input, kind: "keyframe" } });
2857
+ }
2858
+ generateShot(id, input) {
2859
+ return this.client.request("POST", `${path(id)}/generate`, { body: input });
2860
+ }
2861
+ /** A separate explicit review action; generation never calls this method. */
2862
+ acceptKeyframe(id, input, concurrency = {}) {
2863
+ return this.edit(id, { ...concurrency, ops: [{ ...input, op: "accept_keyframe_result" }] });
2864
+ }
2865
+ reconcile(id) {
2866
+ return this.client.request("POST", `${path(id)}/reconcile`, { body: {} });
2867
+ }
2783
2868
  };
2784
2869
 
2785
2870
  // src/resources/community.ts
@@ -3163,7 +3248,7 @@ var WorkspacesResource = class {
3163
3248
  return this.client.requestText("GET", `/v1/workspaces/${encodeURIComponent(id)}/usage`, { query: { ...opts, format: "csv" } });
3164
3249
  }
3165
3250
  };
3166
- var SDK_VERSION = "2.2.0" ;
3251
+ var SDK_VERSION = "2.5.0" ;
3167
3252
  var CLIENT_HEADER = "X-Nodaro-Client";
3168
3253
  var isBrowser = () => typeof window !== "undefined" && typeof window.document !== "undefined";
3169
3254
  var NodaroClient = class _NodaroClient {
@@ -3295,8 +3380,8 @@ var NodaroClient = class _NodaroClient {
3295
3380
  * stalled CSV stream aborts, it does not hang forever). Both the JSON path
3296
3381
  * ({@link request}) and the text path ({@link requestText}) go through here.
3297
3382
  */
3298
- async send(method, path, options, read) {
3299
- const url = this.buildUrl(path, options.query);
3383
+ async send(method, path2, options, read) {
3384
+ const url = this.buildUrl(path2, options.query);
3300
3385
  const token = await this.auth.getToken();
3301
3386
  const isFormData = typeof FormData !== "undefined" && options.body instanceof FormData;
3302
3387
  const headers = {
@@ -3336,14 +3421,14 @@ var NodaroClient = class _NodaroClient {
3336
3421
  }
3337
3422
  }
3338
3423
  /** Authenticated, bounded binary reads through the normal timeout/error transport. */
3339
- async requestBytes(method, path, options) {
3424
+ async requestBytes(method, path2, options) {
3340
3425
  if (!Number.isSafeInteger(options.maxBytes) || options.maxBytes < 1) throw new Error("maxBytes must be a positive integer");
3341
- return this.send(method, path, options, (response) => readBinaryResponse(response, options.maxBytes));
3426
+ return this.send(method, path2, options, (response) => readBinaryResponse(response, options.maxBytes));
3342
3427
  }
3343
- async request(method, path, options = {}) {
3428
+ async request(method, path2, options = {}) {
3344
3429
  return this.send(
3345
3430
  method,
3346
- path,
3431
+ path2,
3347
3432
  options,
3348
3433
  async (res) => (
3349
3434
  // 204 No Content
@@ -3356,8 +3441,8 @@ var NodaroClient = class _NodaroClient {
3356
3441
  * are still the JSON envelope and throw the same typed errors, and the read is
3357
3442
  * bounded by the same timeout as the request.
3358
3443
  */
3359
- async requestText(method, path, options = {}) {
3360
- return this.send(method, path, options, (res) => res.text());
3444
+ async requestText(method, path2, options = {}) {
3445
+ return this.send(method, path2, options, (res) => res.text());
3361
3446
  }
3362
3447
  /**
3363
3448
  * `GET /v1/me` → the authenticated user's identity (see {@link UserIdentity}).
@@ -3376,9 +3461,9 @@ var NodaroClient = class _NodaroClient {
3376
3461
  const res = await this.request("GET", "/v1/me");
3377
3462
  return res.data;
3378
3463
  }
3379
- buildUrl(path, query) {
3464
+ buildUrl(path2, query) {
3380
3465
  const base = this.baseUrl || (typeof window !== "undefined" ? window.location.origin : "http://placeholder");
3381
- const url = new URL(path, base);
3466
+ const url = new URL(path2, base);
3382
3467
  const fullUrl = this.baseUrl ? url.toString() : url.pathname + url.search;
3383
3468
  if (query) {
3384
3469
  const u = new URL(this.baseUrl ? fullUrl : fullUrl, base);