@nodaro/sdk 1.9.0 → 1.11.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
  }
@@ -2364,6 +2384,7 @@ exports.UnauthorizedError = UnauthorizedError;
2364
2384
  exports.UploadsResource = UploadsResource;
2365
2385
  exports.VideoProResource = VideoProResource;
2366
2386
  exports.VoicesResource = VoicesResource;
2387
+ exports.WorkflowConflictError = WorkflowConflictError;
2367
2388
  exports.WorkflowsResource = WorkflowsResource;
2368
2389
  exports.buildPersonSeedPrompt = buildPersonSeedPrompt;
2369
2390
  exports.createClient = createClient;