@nodaro/sdk 2.26.0 → 2.28.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
@@ -1,7 +1,16 @@
1
- import { nodeRunRoute, NODE_TYPES_WITHOUT_RUN_ROUTE, SOCIAL_POST_NODE_PLATFORM, NODE_RUN_ROUTES, SCENE3D_V2_LIMITS, resolveEditPlanSources, describeAudioSyncOffsetIssue, transcriptSpeakerLabels, remapTranscriptThroughEdl, WORKSPACE_HEADER } from '@nodaro/shared';
2
- export { CHARACTER_ASPECT_DEFAULTS, CHARACTER_ASPECT_OPTIONS, CHARACTER_STYLES, OBJECT_ASPECT_DEFAULTS as CREATURE_ASPECT_DEFAULTS, OBJECT_ASPECT_OPTIONS as CREATURE_ASPECT_OPTIONS, CREATURE_ATTACH_COLUMNS, LOCATION_ASSET_TYPES, LOCATION_ATTACH_COLUMNS, OBJECT_ASPECT_DEFAULTS, OBJECT_ASPECT_OPTIONS, OBJECT_ASSET_TYPES, OBJECT_ATTACH_COLUMNS, OUTPUT_BEARING_NODE_STATUSES, PROMPT_PREFIX_KEY, PROMPT_SUFFIX_KEY, RECAST_SEGMENT_PACKS, SURROUND_DIRECTIONS, USAGE_GROUP_BYS, WORKSPACE_HEADER, nodeStateMayCarryOutput, unwrapEditPlanOutput } from '@nodaro/shared';
3
- import { buildPersonHints } from '@nodaro/prompts';
4
- export { PEOPLE, PERSON_DIMENSION_LABELS, PERSON_DIMENSION_ORDER, buildPersonHints } from '@nodaro/prompts';
1
+ export { OUTPUT_BEARING_NODE_STATUSES, nodeStateMayCarryOutput } from '@nodaro/shared/workflow';
2
+ import { nodeRunRoute, NODE_TYPES_WITHOUT_RUN_ROUTE, NODE_RUN_ROUTES } from '@nodaro/shared/nodes';
3
+ export { PROMPT_PREFIX_KEY, PROMPT_SUFFIX_KEY } from '@nodaro/shared/nodes';
4
+ import { SOCIAL_POST_NODE_PLATFORM } from '@nodaro/shared/social';
5
+ import { SCENE3D_V2_LIMITS } from '@nodaro/shared/scene3d';
6
+ import { buildPersonHints } from '@nodaro/prompts/person';
7
+ export { PEOPLE, PERSON_DIMENSION_LABELS, PERSON_DIMENSION_ORDER, buildPersonHints } from '@nodaro/prompts/person';
8
+ export { CHARACTER_ASPECT_DEFAULTS, CHARACTER_ASPECT_OPTIONS, CHARACTER_STYLES, OBJECT_ASPECT_DEFAULTS as CREATURE_ASPECT_DEFAULTS, OBJECT_ASPECT_OPTIONS as CREATURE_ASPECT_OPTIONS, CREATURE_ATTACH_COLUMNS, LOCATION_ASSET_TYPES, LOCATION_ATTACH_COLUMNS, OBJECT_ASPECT_DEFAULTS, OBJECT_ASPECT_OPTIONS, OBJECT_ASSET_TYPES, OBJECT_ATTACH_COLUMNS, SURROUND_DIRECTIONS } from '@nodaro/shared/entities';
9
+ import { resolveEditPlanSources, describeAudioSyncOffsetIssue, transcriptSpeakerLabels, remapTranscriptThroughEdl } from '@nodaro/shared/edl';
10
+ export { unwrapEditPlanOutput } from '@nodaro/shared/edl';
11
+ import { WORKSPACE_HEADER } from '@nodaro/shared/organizations';
12
+ export { USAGE_GROUP_BYS, WORKSPACE_HEADER } from '@nodaro/shared/organizations';
13
+ export { RECAST_SEGMENT_PACKS } from '@nodaro/shared/apps';
5
14
 
6
15
  // src/binary-response.ts
7
16
  async function readBinaryResponse(response, maxBytes) {
@@ -112,6 +121,19 @@ var StudioOpError = class extends NodaroError {
112
121
  }
113
122
  opIndex;
114
123
  };
124
+ var CONTINUATION_REFUSAL_CODES = /* @__PURE__ */ new Set([
125
+ "already_running",
126
+ "continuation_superseded",
127
+ "render_final_already_rendered"
128
+ ]);
129
+ var ContinuationRefusedError = class extends NodaroError {
130
+ constructor(message, code, jobId) {
131
+ super(message, code, 409);
132
+ this.jobId = jobId;
133
+ this.name = "ContinuationRefusedError";
134
+ }
135
+ jobId;
136
+ };
115
137
  var JobBlockedError = class extends NodaroError {
116
138
  constructor(message = "Blocked by this deployment's content policy") {
117
139
  super(message, "job_blocked", 422);
@@ -184,6 +206,9 @@ function throwFromResponse(status, body) {
184
206
  if (status >= 400 && status < 500 && typeof body.error?.opIndex === "number") {
185
207
  throw new StudioOpError(message, code, status, body.error.opIndex);
186
208
  }
209
+ if (status === 409 && CONTINUATION_REFUSAL_CODES.has(code) && typeof body.jobId === "string") {
210
+ throw new ContinuationRefusedError(message, code, body.jobId);
211
+ }
187
212
  if (status === 422 && code === "job_blocked") throw new JobBlockedError(message);
188
213
  if (status === 403 && code === "insufficient_scope") {
189
214
  throw new ForbiddenError(message, body.error?.missingScope);
@@ -424,6 +449,65 @@ var ProjectsResource = class {
424
449
  }
425
450
  };
426
451
 
452
+ // src/resources/sessions.ts
453
+ var SessionsResource = class {
454
+ constructor(client) {
455
+ this.client = client;
456
+ }
457
+ client;
458
+ /**
459
+ * Create a session. Send its `id` as `sessionId` on a generation request
460
+ * (`nodes.run("generate-image", { sessionId, … })`, video, speech, music) and
461
+ * the job is born in it.
462
+ */
463
+ create(input) {
464
+ return this.client.request("POST", "/v1/sessions", { body: input });
465
+ }
466
+ /** Your sessions, newest first. */
467
+ list(params = {}) {
468
+ const query = {};
469
+ if (params.projectId) query.projectId = params.projectId;
470
+ if (params.tool) query.tool = params.tool;
471
+ if (params.includeArchived) query.includeArchived = "true";
472
+ if (params.limit !== void 0) query.limit = String(params.limit);
473
+ if (params.cursor) query.cursor = params.cursor;
474
+ return this.client.request("GET", "/v1/sessions", { query });
475
+ }
476
+ get(id) {
477
+ return this.client.request("GET", `/v1/sessions/${encodeURIComponent(id)}`);
478
+ }
479
+ /** Rename or archive a session. Its project cannot change. */
480
+ update(id, input) {
481
+ return this.client.request("PATCH", `/v1/sessions/${encodeURIComponent(id)}`, { body: input });
482
+ }
483
+ /** Delete a session and its links. Its jobs are kept, and stay in every other session holding them. */
484
+ delete(id) {
485
+ return this.client.request("DELETE", `/v1/sessions/${encodeURIComponent(id)}`);
486
+ }
487
+ /** The session's items, born-in and imported, newest first. */
488
+ items(id, params = {}) {
489
+ const query = {};
490
+ if (params.limit !== void 0) query.limit = String(params.limit);
491
+ if (params.cursor) query.cursor = params.cursor;
492
+ return this.client.request("GET", `/v1/sessions/${encodeURIComponent(id)}/items`, { query });
493
+ }
494
+ /**
495
+ * Import some of your own jobs into a session — a link, not a copy (up to 100
496
+ * a call). All-or-nothing: if any id is not one of your jobs, nothing is
497
+ * imported and the call fails with 404. Items already there are left as they are.
498
+ */
499
+ importItems(id, input) {
500
+ return this.client.request("POST", `/v1/sessions/${encodeURIComponent(id)}/items`, { body: input });
501
+ }
502
+ /** Remove one item from a session. Only the link goes: the job, and every other session holding it, stay. */
503
+ removeItem(id, jobId) {
504
+ return this.client.request(
505
+ "DELETE",
506
+ `/v1/sessions/${encodeURIComponent(id)}/items/${encodeURIComponent(jobId)}`
507
+ );
508
+ }
509
+ };
510
+
427
511
  // src/resources/jobs.ts
428
512
  var JobsResource = class {
429
513
  constructor(client) {
@@ -2536,7 +2620,10 @@ var AudioResource = class {
2536
2620
  * `ratio` (1–20, overrides `amount`), `attackMs` (1–2000, default 20) and
2537
2621
  * `releaseMs` (10–9000, default 500) are optional fine controls. A ducked mix
2538
2622
  * sums its tracks rather than averaging them, so the voice keeps its level;
2539
- * the price is the same with or without a duck.
2623
+ * the price is the same with or without a duck. `endAt` (`"longest"`, the
2624
+ * default, or `"voice"`) says where the mix ends: `"voice"` ends it when the
2625
+ * voice (the `duck.under` track) ends (needs `duck`). A video URL is a track
2626
+ * too: its audio is mixed, and a video with no sound is a silent track.
2540
2627
  */
2541
2628
  mix(input) {
2542
2629
  return this.client.request("POST", "/v1/mix-audio", { body: input });
@@ -2613,6 +2700,18 @@ var CreditsResource = class {
2613
2700
  );
2614
2701
  return res.data;
2615
2702
  }
2703
+ /**
2704
+ * `GET /v1/credits/transactions` → one page of the caller's credit
2705
+ * transactions, newest first, with `nextCursor` for the next page (`null`
2706
+ * at the end). Read `credits_charged` for what each run cost — it can be
2707
+ * below the hold (`credits_reserved`) and is `null` while the hold is open.
2708
+ * Cloud-only route: a self-hosted instance answers 404.
2709
+ */
2710
+ transactions(options = {}) {
2711
+ return this.client.request("GET", "/v1/credits/transactions", {
2712
+ query: { limit: options.limit, cursor: options.cursor }
2713
+ });
2714
+ }
2616
2715
  /**
2617
2716
  * `POST /v1/credits/model-costs` → per-identifier credit cost, for editor
2618
2717
  * cost previews. Capped at the first {@link MODEL_COSTS_LIMIT} identifiers
@@ -3955,6 +4054,13 @@ var WorkspacesResource = class {
3955
4054
  return this.client.requestText("GET", `/v1/workspaces/${encodeURIComponent(id)}/usage`, { query: { ...opts, format: "csv" } });
3956
4055
  }
3957
4056
  };
4057
+ function tightenBody(input) {
4058
+ const { mediaUrl, ...rest } = input;
4059
+ return { mediaUrls: [mediaUrl], ...Object.fromEntries(Object.entries(rest).filter(([, v]) => v !== void 0)) };
4060
+ }
4061
+ function idempotencyHeaders(options) {
4062
+ return options?.idempotencyKey ? { headers: { "Idempotency-Key": options.idempotencyKey } } : {};
4063
+ }
3958
4064
  var EditResource = class {
3959
4065
  constructor(client) {
3960
4066
  this.client = client;
@@ -4014,6 +4120,42 @@ var EditResource = class {
4014
4120
  }
4015
4121
  });
4016
4122
  }
4123
+ /**
4124
+ * Tighten Episode (`POST /v1/tighten-episode`): tighten a podcast recording
4125
+ * in one call — transcribe, cut the silences and filler, render, with
4126
+ * optional captions, music and framing. Answers the run's job to poll; its
4127
+ * `output_data` holds the episode. The run is priced as its steps at their own
4128
+ * rates plus the listed per-run fee. Quote it first with
4129
+ * {@link estimateTightenEpisode}.
4130
+ */
4131
+ tightenEpisode(input, options) {
4132
+ return this.client.request("POST", "/v1/tighten-episode", { body: tightenBody(input), ...idempotencyHeaders(options) });
4133
+ }
4134
+ /**
4135
+ * What a Tighten Episode run is estimated at (`POST /v1/tighten-episode/estimate`):
4136
+ * its steps at their own rates plus its per-run fee. Nothing is created or
4137
+ * charged. The estimate leans high: the render is priced at the recording's
4138
+ * full length, while the charge follows the minutes actually rendered.
4139
+ */
4140
+ estimateTightenEpisode(input) {
4141
+ return this.client.request("POST", "/v1/tighten-episode/estimate", { body: tightenBody(input) });
4142
+ }
4143
+ /**
4144
+ * Continue a Tighten Episode run as a new job (`POST /v1/tighten-episode/continue`):
4145
+ * `"from-failed"` keeps the steps that finished and runs the rest (the fee is
4146
+ * held again; the failed run's was refunded); `"render-final"` renders the
4147
+ * full-quality episode after a review-on preview, with the preview's
4148
+ * settings and no fee. A refusal that names another job
4149
+ * (`already_running`, `continuation_superseded`,
4150
+ * `render_final_already_rendered`) throws a `ContinuationRefusedError`
4151
+ * carrying that `jobId`.
4152
+ */
4153
+ continueUseCase(input, options) {
4154
+ return this.client.request("POST", "/v1/tighten-episode/continue", {
4155
+ body: { jobId: input.jobId, mode: input.mode, ...input.editedEdl !== void 0 ? { editedEdl: input.editedEdl } : {} },
4156
+ ...idempotencyHeaders(options)
4157
+ });
4158
+ }
4017
4159
  /**
4018
4160
  * Plan a transcript-driven cut (`POST /v1/edit-plan`). Reads a timed
4019
4161
  * transcript (plus optional silence ranges) and the media sources, and plans
@@ -4094,7 +4236,7 @@ var EditResource = class {
4094
4236
  return remapTranscriptThroughEdl(edl, transcript);
4095
4237
  }
4096
4238
  };
4097
- var SDK_VERSION = "2.26.0" ;
4239
+ var SDK_VERSION = "2.28.0" ;
4098
4240
  var CLIENT_HEADER = "X-Nodaro-Client";
4099
4241
  var isBrowser = () => typeof window !== "undefined" && typeof window.document !== "undefined";
4100
4242
  var NodaroClient = class _NodaroClient {
@@ -4117,6 +4259,8 @@ var NodaroClient = class _NodaroClient {
4117
4259
  }
4118
4260
  workflows;
4119
4261
  projects;
4262
+ /** Generation sessions inside projects (Create Image / Video / Music). */
4263
+ sessions;
4120
4264
  jobs;
4121
4265
  videoPro;
4122
4266
  executions;
@@ -4168,6 +4312,7 @@ var NodaroClient = class _NodaroClient {
4168
4312
  this.sendClientHeader = opts.clientLabel !== void 0 || !isBrowser();
4169
4313
  this.workflows = new WorkflowsResource(this);
4170
4314
  this.projects = new ProjectsResource(this);
4315
+ this.sessions = new SessionsResource(this);
4171
4316
  this.jobs = new JobsResource(this);
4172
4317
  this.videoPro = new VideoProResource(this);
4173
4318
  this.executions = new ExecutionsResource(this);
@@ -4363,6 +4508,6 @@ function supabaseAuth(supabase) {
4363
4508
  };
4364
4509
  }
4365
4510
 
4366
- export { AppsResource, AudioResource, CREATURE_ASSET_TYPES, CallbackAuth, CatalogsResource, CharactersResource, CollectionsResource, CommunityResource, CompetitorsResource, CopilotResource, CreaturesResource, CreditsResource, DeveloperAppsResource, EditResource, ExecutionsResource, ForbiddenError, InsufficientCreditsError, JobAbortedError, JobBlockedError, JobFailedError, JobHeldError, JobTimeoutError, JobsResource, LibraryResource, LlmResource, LocationsResource, MediaResource, ModelsResource, NodaroClient, NodaroError, NodesResource, NotFoundError, OAuthResource, ObjectsResource, OrganizationsResource, PickerCatalogsResource, PipelinesResource, PresetsResource, ProjectsResource, PromptHelperResource, RateLimitedError, RecastResource, ReduceResource, SCENE3D_DELIVERY_ASSET_USAGE, SavedPostsResource, Scene3DResource, ShotsResource, StaticTokenAuth, StorageExceededError, StudioOpError, StudioPreviewAppliedError, StudioPreviewUnavailable, StudioProductionsResource, StudioResource, TemplatesResource, TutorialsResource, UnauthorizedError, UploadsResource, VideoProResource, VoicesResource, WorkflowConflictError, WorkflowsResource, WorkspacesResource, buildPersonSeedPrompt, createClient, isStudioGenerateEstimate, supabaseAuth, throwFromResponse };
4511
+ export { AppsResource, AudioResource, CREATURE_ASSET_TYPES, CallbackAuth, CatalogsResource, CharactersResource, CollectionsResource, CommunityResource, CompetitorsResource, ContinuationRefusedError, CopilotResource, CreaturesResource, CreditsResource, DeveloperAppsResource, EditResource, ExecutionsResource, ForbiddenError, InsufficientCreditsError, JobAbortedError, JobBlockedError, JobFailedError, JobHeldError, JobTimeoutError, JobsResource, LibraryResource, LlmResource, LocationsResource, MediaResource, ModelsResource, NodaroClient, NodaroError, NodesResource, NotFoundError, OAuthResource, ObjectsResource, OrganizationsResource, PickerCatalogsResource, PipelinesResource, PresetsResource, ProjectsResource, PromptHelperResource, RateLimitedError, RecastResource, ReduceResource, SCENE3D_DELIVERY_ASSET_USAGE, SavedPostsResource, Scene3DResource, SessionsResource, ShotsResource, StaticTokenAuth, StorageExceededError, StudioOpError, StudioPreviewAppliedError, StudioPreviewUnavailable, StudioProductionsResource, StudioResource, TemplatesResource, TutorialsResource, UnauthorizedError, UploadsResource, VideoProResource, VoicesResource, WorkflowConflictError, WorkflowsResource, WorkspacesResource, buildPersonSeedPrompt, createClient, isStudioGenerateEstimate, supabaseAuth, throwFromResponse };
4367
4512
  //# sourceMappingURL=index.js.map
4368
4513
  //# sourceMappingURL=index.js.map