@nodaro/sdk 1.8.0 → 1.10.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
@@ -58,6 +58,18 @@ var StorageExceededError = class extends NodaroError {
58
58
  }
59
59
  limitBytes;
60
60
  };
61
+ var WorkflowConflictError = class extends NodaroError {
62
+ constructor(message = "Workflow was updated by another writer", currentUpdatedAt, currentVersion, currentRecord) {
63
+ super(message, "workflow_conflict", 409);
64
+ this.currentUpdatedAt = currentUpdatedAt;
65
+ this.currentVersion = currentVersion;
66
+ this.currentRecord = currentRecord;
67
+ this.name = "WorkflowConflictError";
68
+ }
69
+ currentUpdatedAt;
70
+ currentVersion;
71
+ currentRecord;
72
+ };
61
73
  var JobFailedError = class extends NodaroError {
62
74
  constructor(message, jobId, jobStatus = "failed") {
63
75
  super(message, "job_failed", 0);
@@ -90,6 +102,14 @@ function throwFromResponse(status, body) {
90
102
  const code = body.error?.code ?? "internal_error";
91
103
  const message = body.error?.message ?? "Request failed";
92
104
  if (status === 401) throw new UnauthorizedError(message);
105
+ if (status === 409 && code === "workflow_conflict") {
106
+ throw new WorkflowConflictError(
107
+ message,
108
+ body.error?.currentUpdatedAt,
109
+ body.error?.currentVersion,
110
+ body.error?.currentRecord
111
+ );
112
+ }
93
113
  if (status === 403 && code === "insufficient_scope") {
94
114
  throw new ForbiddenError(message, body.error?.missingScope);
95
115
  }
@@ -1736,6 +1756,19 @@ var MediaResource = class {
1736
1756
  saveToStorage(input) {
1737
1757
  return this.client.request("POST", "/v1/save-to-storage", { body: input });
1738
1758
  }
1759
+ /**
1760
+ * Composite 2–30 images into ONE large 2K/4K collage (`POST /v1/image-collage`).
1761
+ * `layout` `"smart"` (default — justified rows at each image's exact aspect
1762
+ * ratio, no cropping; the output height floats) or `"grid"` (uniform,
1763
+ * letterboxed cells). `imageSizes` is index-aligned with `imageUrls` and
1764
+ * gives per-image RELATIVE size hints for the smart layout: `0` auto
1765
+ * ("don't care", default), `1` big (~2× linear vs medium), `2` medium,
1766
+ * `3` small (~½ linear). All-equal hints change nothing; grid ignores them.
1767
+ * Poll `jobs.get(jobId)` for the finished image.
1768
+ */
1769
+ imageCollage(input) {
1770
+ return this.client.request("POST", "/v1/image-collage", { body: input });
1771
+ }
1739
1772
  /**
1740
1773
  * Trim a video to a range (`POST /v1/trim-video`). Give the range in whichever
1741
1774
  * unit fits: `startTime`/`endTime` seconds, `trim*Frames`, `trim*Seconds`, or
@@ -2351,6 +2384,7 @@ exports.UnauthorizedError = UnauthorizedError;
2351
2384
  exports.UploadsResource = UploadsResource;
2352
2385
  exports.VideoProResource = VideoProResource;
2353
2386
  exports.VoicesResource = VoicesResource;
2387
+ exports.WorkflowConflictError = WorkflowConflictError;
2354
2388
  exports.WorkflowsResource = WorkflowsResource;
2355
2389
  exports.buildPersonSeedPrompt = buildPersonSeedPrompt;
2356
2390
  exports.createClient = createClient;