@nodaro/sdk 2.47.0 → 2.49.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/{chunk-I7AHLDXV.js → chunk-2JAKOBD3.js} +8 -8
- package/dist/{chunk-I7AHLDXV.js.map → chunk-2JAKOBD3.js.map} +1 -1
- package/dist/{chunk-KBHDUHKM.js → chunk-2SQ7V6EX.js} +2 -2
- package/dist/chunk-2SQ7V6EX.js.map +1 -0
- package/dist/{chunk-FCYN4N3M.js → chunk-5MZYOJCJ.js} +3 -3
- package/dist/{chunk-FCYN4N3M.js.map → chunk-5MZYOJCJ.js.map} +1 -1
- package/dist/{chunk-JTAW54UM.js → chunk-AEUPH7EE.js} +2 -2
- package/dist/{chunk-34PU2DAT.cjs.map → chunk-AEUPH7EE.js.map} +1 -1
- package/dist/{chunk-DIF7A5OH.cjs → chunk-E5MJK3W5.cjs} +2 -2
- package/dist/chunk-E5MJK3W5.cjs.map +1 -0
- package/dist/{chunk-XKDVEQVD.cjs → chunk-LTZKNAXM.cjs} +2 -2
- package/dist/chunk-LTZKNAXM.cjs.map +1 -0
- package/dist/{chunk-MYTMNPCP.cjs → chunk-NOBQQTAG.cjs} +3 -3
- package/dist/{chunk-MYTMNPCP.cjs.map → chunk-NOBQQTAG.cjs.map} +1 -1
- package/dist/{chunk-OWG3XAHQ.js → chunk-OCRUDBPG.js} +10 -6
- package/dist/chunk-OCRUDBPG.js.map +1 -0
- package/dist/{chunk-7LTVS75S.cjs → chunk-P6AM42UB.cjs} +2 -2
- package/dist/chunk-P6AM42UB.cjs.map +1 -0
- package/dist/{chunk-NP6KDFIJ.cjs → chunk-PPP6VZ3I.cjs} +14 -14
- package/dist/{chunk-NP6KDFIJ.cjs.map → chunk-PPP6VZ3I.cjs.map} +1 -1
- package/dist/{chunk-34PU2DAT.cjs → chunk-Q45PC4YD.cjs} +2 -2
- package/dist/chunk-Q45PC4YD.cjs.map +1 -0
- package/dist/{chunk-PQHZUWSL.js → chunk-THLTFB6I.js} +2 -2
- package/dist/chunk-THLTFB6I.js.map +1 -0
- package/dist/{chunk-GDDV5U32.cjs → chunk-TY2S25W5.cjs} +10 -6
- package/dist/chunk-TY2S25W5.cjs.map +1 -0
- package/dist/{chunk-XILR6TFO.js → chunk-YXVMQEJX.js} +2 -2
- package/dist/chunk-YXVMQEJX.js.map +1 -0
- package/dist/entries/cast-swap.cjs +2 -2
- package/dist/entries/cast-swap.d.cts +34 -31
- package/dist/entries/cast-swap.d.ts +34 -31
- package/dist/entries/cast-swap.js +1 -1
- package/dist/entries/client.cjs +12 -12
- package/dist/entries/client.js +7 -7
- package/dist/entries/core.cjs +5 -5
- package/dist/entries/core.js +1 -1
- package/dist/entries/jobs.cjs +2 -2
- package/dist/entries/jobs.d.cts +18 -7
- package/dist/entries/jobs.d.ts +18 -7
- package/dist/entries/jobs.js +1 -1
- package/dist/entries/node-presets.cjs +2 -2
- package/dist/entries/node-presets.d.cts +6 -0
- package/dist/entries/node-presets.d.ts +6 -0
- package/dist/entries/node-presets.js +1 -1
- package/dist/entries/trash.cjs +2 -2
- package/dist/entries/trash.d.cts +4 -1
- package/dist/entries/trash.d.ts +4 -1
- package/dist/entries/trash.js +1 -1
- package/dist/entries/trends.cjs +2 -2
- package/dist/entries/trends.d.cts +22 -13
- package/dist/entries/trends.d.ts +22 -13
- package/dist/entries/trends.js +1 -1
- package/dist/index.cjs +18 -18
- package/dist/index.js +7 -7
- package/package.json +3 -3
- package/dist/chunk-7LTVS75S.cjs.map +0 -1
- package/dist/chunk-DIF7A5OH.cjs.map +0 -1
- package/dist/chunk-GDDV5U32.cjs.map +0 -1
- package/dist/chunk-JTAW54UM.js.map +0 -1
- package/dist/chunk-KBHDUHKM.js.map +0 -1
- package/dist/chunk-OWG3XAHQ.js.map +0 -1
- package/dist/chunk-PQHZUWSL.js.map +0 -1
- package/dist/chunk-XILR6TFO.js.map +0 -1
- package/dist/chunk-XKDVEQVD.cjs.map +0 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var models = require('@nodaro/shared/models');
|
|
4
|
+
|
|
3
5
|
// src/resources/cast-swap.ts
|
|
4
6
|
var CastSwapResource = class {
|
|
5
7
|
constructor(client) {
|
|
@@ -20,13 +22,15 @@ var CastSwapResource = class {
|
|
|
20
22
|
});
|
|
21
23
|
}
|
|
22
24
|
/** Quote a run before starting it (`POST /v1/cast-swap/estimate`); spends nothing. */
|
|
23
|
-
estimate(params) {
|
|
24
|
-
|
|
25
|
+
async estimate(params) {
|
|
26
|
+
const quote = await this.client.request("POST", "/v1/cast-swap/estimate", { body: params });
|
|
27
|
+
const engine = models.nodaroMotionEngineFrom(quote?.engine);
|
|
28
|
+
return engine && engine !== quote.engine ? { ...quote, engine } : quote;
|
|
25
29
|
}
|
|
26
30
|
/**
|
|
27
31
|
* Quote finishing a run at Full Quality (`POST
|
|
28
32
|
* /v1/cast-swap/:jobId/full-quality/estimate`); spends nothing. `jobId` is a
|
|
29
|
-
* finished Nodaro Motion
|
|
33
|
+
* finished Nodaro Motion Prism DRAFT run, or a finished Nodaro Motion Pulse
|
|
30
34
|
* run at 720p (a Nodaro Motion or trend run); the quote's `kind` says whether it is the same take
|
|
31
35
|
* re-rendered or a new take. The quote
|
|
32
36
|
* does not look for a Full Quality already running: when one is,
|
|
@@ -39,7 +43,7 @@ var CastSwapResource = class {
|
|
|
39
43
|
/**
|
|
40
44
|
* Finish a run at Full Quality (`POST /v1/cast-swap/:jobId/full-quality`):
|
|
41
45
|
* at 1080p, with the clip's audio, as a new job linked to the run — a
|
|
42
|
-
* Nodaro Motion
|
|
46
|
+
* Nodaro Motion Prism draft's own take re-rendered, or a new Nodaro Motion Pulse take from a
|
|
43
47
|
* 720p run's inputs (the quote's `kind`). SPENDS CREDITS: quote it first with
|
|
44
48
|
* {@link fullQualityEstimate}. Answers 202 `{ jobId }`, or 200
|
|
45
49
|
* `{ jobId, existing: true }` when this run's Full Quality is already
|
|
@@ -55,5 +59,5 @@ var CastSwapResource = class {
|
|
|
55
59
|
};
|
|
56
60
|
|
|
57
61
|
exports.CastSwapResource = CastSwapResource;
|
|
58
|
-
//# sourceMappingURL=chunk-
|
|
59
|
-
//# sourceMappingURL=chunk-
|
|
62
|
+
//# sourceMappingURL=chunk-TY2S25W5.cjs.map
|
|
63
|
+
//# sourceMappingURL=chunk-TY2S25W5.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/resources/cast-swap.ts"],"names":["nodaroMotionEngineFrom"],"mappings":";;;;;AAqdO,IAAM,mBAAN,MAAuB;AAAA,EAC5B,YAAoB,MAAA,EAA0B;AAA1B,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA;AAAA,EAA2B;AAAA,EAA3B,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASpB,GAAA,CAAI,QAAwB,OAAA,EAA6E;AACvG,IAAA,OAAO,IAAA,CAAK,MAAA,CAAO,OAAA,CAAQ,MAAA,EAAQ,eAAA,EAAiB;AAAA,MAClD,IAAA,EAAM,MAAA;AAAA,MACN,GAAI,OAAA,EAAS,cAAA,GAAiB,EAAE,OAAA,EAAS,EAAE,iBAAA,EAAmB,OAAA,CAAQ,cAAA,EAAe,EAAE,GAAI;AAAC,KAC7F,CAAA;AAAA,EACH;AAAA;AAAA,EAGA,MAAM,SAAS,MAAA,EAAmD;AAChE,IAAA,MAAM,KAAA,GAAQ,MAAM,IAAA,CAAK,MAAA,CAAO,OAAA,CAA0B,QAAQ,wBAAA,EAA0B,EAAE,IAAA,EAAM,MAAA,EAAQ,CAAA;AAE5G,IAAA,MAAM,MAAA,GAASA,6BAAA,CAAuB,KAAA,EAAO,MAAM,CAAA;AACnD,IAAA,OAAO,MAAA,IAAU,WAAW,KAAA,CAAM,MAAA,GAAS,EAAE,GAAG,KAAA,EAAO,QAAO,GAAI,KAAA;AAAA,EACpE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,oBAAoB,KAAA,EAAqD;AACvE,IAAA,OAAO,IAAA,CAAK,MAAA,CAAO,OAAA,CAAQ,MAAA,EAAQ,CAAA,cAAA,EAAiB,kBAAA,CAAmB,KAAK,CAAC,CAAA,sBAAA,CAAA,EAA0B,EAAE,IAAA,EAAM,IAAI,CAAA;AAAA,EACrH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcA,WAAA,CAAY,KAAA,EAAe,MAAA,GAAoC,EAAC,EAAuC;AACrG,IAAA,MAAM,IAAA,GAAO,OAAO,SAAA,KAAc,MAAA,GAAY,EAAE,SAAA,EAAW,MAAA,CAAO,SAAA,EAAU,GAAI,EAAC;AACjF,IAAA,OAAO,IAAA,CAAK,MAAA,CAAO,OAAA,CAAQ,MAAA,EAAQ,CAAA,cAAA,EAAiB,kBAAA,CAAmB,KAAK,CAAC,CAAA,aAAA,CAAA,EAAiB,EAAE,IAAA,EAAM,CAAA;AAAA,EACxG;AACF","file":"chunk-TY2S25W5.cjs","sourcesContent":["import { nodaroMotionEngineFrom } from \"@nodaro/shared/models\"\nimport type { NodaroClientCore } from \"../core.js\"\n\n/**\n * Nodaro Motion (the `castSwap` resource; routes `/v1/cast-swap`) — replace\n * the people, pets, products and/or the location in a short video with your\n * own references, keeping its motion, framing, timing and sound (the clip's\n * audio is kept, and the result is the clip's length).\n *\n * Before the video, each person, pet and product role's photos are turned\n * into one clean reference picture by an image model. This costs extra\n * credits (`breakdown.references` in the estimate), charged when it runs, even\n * if the video then fails; it adds about a minute, falls back to your own\n * photos if it fails, and is turned off with `prepareReferences: false`.\n * Locations are not prepared.\n *\n * Engines: a run is made on Nodaro Motion Prism (`engine` left out, or\n * `\"motion-prism\"`) or Nodaro Motion Pulse (`\"motion-pulse\"`). Pulse renders 720p\n * (its default) or 1080p and has no draft; it makes a new take guided by the\n * clip and pictures, so its Full Quality is a new take at 1080p rather than\n * the same take re-rendered (`CastSwapFullQualityEstimate.kind`).\n *\n * How the clip is prepared for the video model (for one, whether faces are\n * hidden first, and whether a refused clip is retried) is set by Nodaro for\n * each engine; a run cannot change it. `faceMasking` is no longer read\n * (deprecated: accepted and ignored).\n *\n * Cloud edition only: `/v1/cast-swap` is served by the cloud plugin and 404s\n * on self-hosted installs. `run()` answers 202 with a job id; follow it with\n * `client.jobs.get(jobId)` / `client.jobs.getStatus(jobId)` like any other job.\n *\n * Repeats: pass `{ idempotencyKey }` to `run()` and it is sent as the\n * `Idempotency-Key` header. A repeat with the same key within the credit\n * guard's dedup window (about 10 s) answers 200 `{ jobId, deduped: true }` with\n * an `X-Dedup-Hit` header; a later one answers 202 with the first run's\n * `jobId`. Nothing new is started or charged.\n *\n * Refusals (thrown as a `NodaroError` subclass; body `{ error: { code, message } }`), before\n * anything is charged: 400 `validation_error` (the body: no role with images,\n * no reference and no `prePrompt` or `postPrompt`, more roles of a kind\n * than allowed, more than 30 images in all, `draft: true` above 480p, a\n * `prePrompt` or `postPrompt` over 4,000 characters); on Nodaro Motion Pulse,\n * `draft_unsupported` (`draft: true`), `resolution_unsupported` (480p),\n * `output_format_unsupported` (a MOV edit output) and `too_many_images` (more\n * than 10 images in the run, across every role and fixed reference);\n * `raw_reference_token` (also in a reference's `line`),\n * `invalid_role_mention` (also any `{role:N}` in a reference's `line`),\n * `unsafe_url`, `video_unreadable`, `clip_out_of_range` (4–30 s),\n * `preview_out_of_range`, `no_roles_in_preview` (a preview with every role\n * `inPreview: false`, always refused even with a prompt, or with no role kept\n * in it that has images and no `prePrompt` or `postPrompt`), `prompt_too_long`\n * (the prompt would build too long: a `{role:N}` reads as the role's name when\n * it sends no images; Nodaro Motion Pulse's cap is 8,000 characters); 401; 402 `insufficient_credits` (`run()` only); 404\n * (a `sessionId` you may not use, `run()` only); 422 `job_blocked` (`run()`\n * only); 503 `host_too_old` (both); 503 `estimate_unavailable` (`estimate()`\n * only).\n */\n\n/**\n * The engine a Nodaro Motion run is made on, by its public id. Left out =\n * `\"motion-prism\"`.\n *\n * - `\"motion-prism\"` (Nodaro Motion Prism): 480p (the default, a draft unless\n * `draft: false`), 720p or 1080p; Full Quality re-renders a draft's own take\n * at 1080p.\n * - `\"motion-pulse\"` (Nodaro Motion Pulse): 720p (the default) or 1080p, never a\n * draft (`draft: true` answers 400 `draft_unsupported`); Full Quality makes a\n * new take at 1080p from a completed 720p run's inputs. A preview is still\n * 4 s from `previewStart`.\n */\nexport type CastSwapEngine = \"motion-prism\" | \"motion-pulse\"\n\n/**\n * The engine ids an older client sent: the earlier public ids (`\"motion-pro\"`\n * = `\"motion-prism\"`, `\"motion-lite\"` = `\"motion-pulse\"`) and the internal\n * ones (`\"seedance-2-5\"`, `\"kling-4\"`). Still accepted in a request; never\n * returned.\n * @deprecated use {@link CastSwapEngine}.\n */\nexport type CastSwapEngineLegacyId = \"motion-pro\" | \"motion-lite\" | \"seedance-2-5\" | \"kling-4\"\n\n/**\n * Where a Nodaro Motion Pulse run cuts the clip to whole seconds (Pulse renders\n * whole seconds; asked for more than the clip, it would stretch the motion):\n * - `\"cut-end\"` (the default): drop the fraction of a second at its end;\n * - `\"cut-start\"`: drop it at its start.\n */\nexport type CastSwapMotionLength = \"cut-end\" | \"cut-start\"\n\n/** @deprecated use {@link CastSwapMotionLength}. */\nexport type CastSwapKlingLength = CastSwapMotionLength\n\n/** Whether a swapped subject takes this trait from the references (`\"new\"`) or keeps the video's (`\"original\"`). */\nexport type CastSwapTraitSource = \"new\" | \"original\"\n\n/**\n * Preview-only settings, on every role kind; a full run (`preview` not `true`)\n * ignores both.\n */\nexport interface CastSwapRolePreviewSettings {\n /** The name used instead of `name` in a preview. Same rules as `name` (1–200 characters). */\n previewName?: string\n /**\n * `false` leaves this role out of the preview: its reference images are not\n * sent, not prepared and not charged, and a `{role:N}` naming it reads as its\n * `previewName`, else its `name`. Default `true`. A preview with every role\n * left out (always refused, even with a prompt), or with no role kept in it\n * that has images and no pre / post prompt, answers 400 `no_roles_in_preview`.\n */\n inPreview?: boolean\n}\n\n/** A person in the video to recast. */\nexport interface CastSwapPersonRole extends CastSwapRolePreviewSettings {\n kind: \"person\"\n /** How the person is told apart in the video, e.g. `\"the woman that attacks\"`. */\n name: string\n /** 0–3 images of ONE person. Empty or `null` keeps the original person. */\n images: string[] | null\n /** Body from the references or the video. Default `\"new\"`. */\n body?: CastSwapTraitSource\n /** Outfit from the references or the video. Default `\"new\"`. */\n outfit?: CastSwapTraitSource\n /** Hairstyle and haircut from the references or the video. Default `\"new\"`. */\n hair?: CastSwapTraitSource\n}\n\n/** The place the video happens in. */\nexport interface CastSwapLocationRole extends CastSwapRolePreviewSettings {\n kind: \"location\"\n /** How the place is named. Default `\"the setting\"`. */\n name?: string\n /** 0–3 images of ONE place. Empty or `null` keeps the original place. */\n images: string[] | null\n}\n\n/** An animal in the video to recast. */\nexport interface CastSwapPetRole extends CastSwapRolePreviewSettings {\n kind: \"pet\"\n /** How the animal is told apart in the video, e.g. `\"the dog\"`. */\n name: string\n /** 0–3 images of ONE animal. Empty or `null` keeps the original animal. */\n images: string[] | null\n /** Body (shape, size and build) from the references or the video. Default `\"new\"`. */\n body?: CastSwapTraitSource\n /** Coat (fur, colors and markings) from the references or the video. Default `\"new\"`. */\n coat?: CastSwapTraitSource\n}\n\n/** An object in the video to recast. */\nexport interface CastSwapProductRole extends CastSwapRolePreviewSettings {\n kind: \"product\"\n /** How the object is told apart in the video, e.g. `\"the can\"`. */\n name: string\n /** 0–3 images of ONE product. Empty or `null` keeps the original object. */\n images: string[] | null\n /** Shape and proportions from the references or the video. Default `\"new\"`. */\n shape?: CastSwapTraitSource\n /** Finish (colors, materials, label and markings) from the references or the video. Default `\"new\"`. */\n finish?: CastSwapTraitSource\n}\n\nexport type CastSwapRole = CastSwapPersonRole | CastSwapLocationRole | CastSwapPetRole | CastSwapProductRole\n\n/**\n * A fixed reference: 1–3 images of ONE thing that no role replaces, and the\n * line that says what it is (`\"the glass she drinks from\"`). Sent as given,\n * never prepared; its images count toward the 30.\n */\nexport interface CastSwapReference {\n /** 1–3 http(s) image URLs of one thing. */\n images: string[]\n /**\n * What it is, 1–500 characters. `{image}` in the line stands for this\n * reference's first image (`\"Use {image} for the sky\"`); a line without it\n * gets it appended. A `{role:N}` or a raw `{image:` / `{video:` / `{audio:`\n * token answers 400.\n */\n line: string\n}\n\n/**\n * @deprecated Nodaro sets this per engine; a run's `faceMasking` is ignored.\n */\nexport interface CastSwapFaceMaskingZone {\n leftPct?: number\n rightPct?: number\n topPct?: number\n bottomPct?: number\n}\n\n/**\n * @deprecated Nodaro sets how the clip is prepared for the video model, per\n * engine; a run cannot change it. A `faceMasking` sent is accepted and\n * ignored (no error), so older code keeps working unchanged.\n */\nexport interface CastSwapFaceMasking {\n mode: \"off\" | \"always\" | \"auto\"\n fill?: \"blur\" | \"depth\"\n minFaceHeightPct?: number\n maxFaceHeightPct?: number\n zone?: CastSwapFaceMaskingZone | null\n blurStrengthPct?: number\n threshold?: number\n}\n\n/** The body of `POST /v1/cast-swap` and `POST /v1/cast-swap/estimate`. */\nexport interface CastSwapParams {\n /** The source clip, 4–30 seconds. */\n videoUrl: string\n /**\n * Who and what to swap: at most 6 person roles, 1 location role, 3 pet roles\n * and 3 product roles, with at most 30 images in all. A role with no images\n * is skipped (that subject or place stays as in the video). At least one role\n * with images, or a `prePrompt` or `postPrompt`, is required.\n */\n roles: CastSwapRole[]\n /**\n * Fixed references (at most 5): things the video should show that no role\n * replaces, each with the line that names it. Their images count toward the\n * 30. A reference alone is enough for a run (no role needs images).\n */\n references?: CastSwapReference[]\n /**\n * Your own words placed at the start of the prompt, before the role\n * instructions; at most 4,000 characters. Mention a role as `{role:N}`, as in\n * `postPrompt`; the same 400 refusals apply (an N outside 1..`roles.length`,\n * a raw `{image:` / `{video:` / `{audio:` token).\n */\n prePrompt?: string\n /**\n * Extra instructions in your own words, at most 4,000 characters. Mention a\n * role as `{role:N}`, where N is its 1-based position in `roles`\n * (`{role:1}` is `roles[0]`; empty roles count).\n *\n * The route answers 400, before charging, for an N outside 1..`roles.length`,\n * for a raw `{image:` / `{video:` / `{audio:` token in the pre or post prompt\n * or a role's `name`, for a clip outside 4–30 s, and for a preview past the clip's\n * end (`previewStart + 4` > its length).\n */\n postPrompt?: string\n /** `true` runs on 4 seconds of the clip, starting at `previewStart`: a cheap check of the roles and choices. */\n preview?: boolean\n /** Where the preview starts, in seconds. Default 0. */\n previewStart?: number\n /**\n * The engine (see {@link CastSwapEngine}). Default `\"motion-prism\"`. The job\n * records it in `input_data.engine`, and a completed job's output in its\n * `engine`. The ids an older client sent ({@link CastSwapEngineLegacyId})\n * are still accepted.\n */\n engine?: CastSwapEngine | CastSwapEngineLegacyId\n /**\n * Nodaro Motion Pulse only (Prism ignores it): which end of the clip is cut to\n * whole seconds (see {@link CastSwapMotionLength}). Default `\"cut-end\"`.\n */\n motionLength?: CastSwapMotionLength\n /** @deprecated use {@link motionLength} (still accepted). */\n klingLength?: CastSwapKlingLength\n /**\n * The output resolution. Nodaro Motion Prism: `\"480p\"` (default), `\"720p\"` or\n * `\"1080p\"`. Nodaro Motion Pulse: `\"720p\"` (default) or `\"1080p\"`; `\"480p\"`\n * answers 400.\n */\n resolution?: \"480p\" | \"720p\" | \"1080p\"\n /**\n * Render as a draft (Nodaro Motion Prism only). Defaults to `true` at 480p and\n * `false` above it; `true` with `\"720p\"` or `\"1080p\"` answers 400 (draft is\n * 480p only). Nodaro Motion Pulse has no draft: `true` answers 400\n * `draft_unsupported`.\n */\n draft?: boolean\n /**\n * Turn each person, pet and product role's photos into one clean reference\n * picture before the video (extra credits, shown in `breakdown.references`;\n * about a minute longer; falls back to your own photos if it fails).\n * Default `true`.\n */\n prepareReferences?: boolean\n /**\n * Ignored: Nodaro sets how the clip is prepared, per engine. Accepted (no\n * error) so older code keeps working.\n * @deprecated leave it out.\n */\n faceMasking?: CastSwapFaceMasking\n /**\n * `\"draft\"` means 480p draft.\n * @deprecated use `resolution` + `draft`.\n */\n quality?: \"draft\"\n /** A generation session to file the result in. */\n sessionId?: string\n /** The client app that sent the run (stored on the job as `input_data.origin`). */\n origin?: string\n}\n\n/** What a run would cost, in credits. */\nexport interface CastSwapEstimate {\n /**\n * The engine the run would use, by its public id (absent from an older\n * server = `\"motion-prism\"`). An id an older server answers is read as the\n * public id it names.\n */\n engine?: CastSwapEngine\n /**\n * What is held when the run starts. The run is charged what it actually\n * costs, which is expected to be `expectedCredits`.\n */\n totalCredits: number\n /**\n * The charge the run is expected to come to. Never above `totalCredits`\n * (on Nodaro Motion Pulse it equals it: Pulse renders exactly the length\n * asked for, so the hold is what it settles at). Absent from an older\n * server: read `totalCredits` then.\n */\n expectedCredits?: number\n /**\n * The parts of the quote, by name, for display only:\n * - `base`: the run itself (its base fee). A server before Cast Swap 0.396.0\n * names it `castSwap` instead: read `base`, else `castSwap`;\n * - `references`: preparing the reference pictures (0 when\n * `prepareReferences` is off or there is nothing to prepare);\n * - `motion`: what the video holds (on Nodaro Motion Pulse, what it costs);\n * - `motionExpected`: what the video is expected to be charged, never above\n * `motion` (Nodaro Motion Prism);\n * - `privacy`: preparing the clip, when the engine's setting does. In both\n * totals when it always runs; outside both when it is the retry\n * (`privacyCredits`).\n *\n * `motion` and `motionExpected` are alternatives, so the parts sum to more\n * than either total: read `totalCredits` and `expectedCredits`, never the\n * sum. Other parts may appear.\n */\n breakdown: {\n base?: number\n /** @deprecated read {@link base} (an older server answered this name for the same part). */\n castSwap?: number\n references: number\n motion?: number\n motionExpected?: number\n privacy?: number\n } & Record<string, number>\n /**\n * The extra credits charged only if the video model refuses the clip and\n * the run is retried (Nodaro's setting for the engine decides whether it\n * does). Not in `totalCredits` or `expectedCredits`; `run()` needs credits\n * for both the hold and this (else 402).\n */\n privacyCredits?: number\n /** @deprecated read {@link privacyCredits} (an older server answered this name). */\n maskingCredits?: number\n /**\n * `true` when the video is made at Auto length (every Nodaro Motion Prism\n * run): the final charge is expected to come out lower than `totalCredits`,\n * at about `expectedCredits`. `false` on Nodaro Motion Pulse.\n */\n settlesLower: boolean\n}\n\n/** Per-call options for {@link CastSwapResource.run}. */\nexport interface CastSwapRunOptions {\n /**\n * Sent as the `Idempotency-Key` header, unchanged (the SDK checks nothing;\n * an empty string sends no header, like no key).\n * The server takes 8–200 characters and answers 400 for any other length.\n * Reuse the same value when retrying the same run: within about 10 s the\n * repeat answers 200 `{ jobId, deduped: true }`, later 202 with the first\n * run's `jobId`. Nothing new is started or charged.\n */\n idempotencyKey?: string\n}\n\n/**\n * What a Full Quality version would be: `\"same-take\"` re-renders a Nodaro\n * Motion Prism draft's own take at 1080p; `\"new-take\"` makes a new Nodaro Motion Pulse take at\n * 1080p from a 720p run's inputs (it will not match the 720p run frame for\n * frame). The 720p run or draft stays either way.\n */\nexport type CastSwapFullQualityKind = \"same-take\" | \"new-take\"\n\n/**\n * What a Full Quality version of a run would cost\n * (`POST /v1/cast-swap/:jobId/full-quality/estimate`): a Nodaro Motion Prism\n * draft, or a completed Nodaro Motion Pulse run at 720p.\n */\nexport interface CastSwapFullQualityEstimate {\n /**\n * Which Full Quality this is ({@link CastSwapFullQualityKind}), so it can\n * be worded right. Absent from an older server: `\"same-take\"`.\n */\n kind?: CastSwapFullQualityKind\n /** The quote in credits: `breakdown.base` plus the 1080p render (same take) or the new take. */\n totalCredits: number\n /**\n * The parts of the quote, by name, for display only: `base` (the Full\n * Quality job's own steps; a server before Cast Swap 0.396.0 names it\n * `castSwap` instead: read `base`, else `castSwap`), and `motionHd` (a same\n * take: the 1080p render, 0 when an earlier try of this draft already\n * finished that render, which is then reused) or `motion` (a new take).\n */\n breakdown: {\n base?: number\n /** @deprecated read {@link base} (an older server answered this name for the same part). */\n castSwap?: number\n motionHd?: number\n motion?: number\n } & Record<string, number>\n /** ISO time until which the run can be finished at Full Quality (7 days after it completed). */\n availableUntil: string\n}\n\n/** Options for {@link CastSwapResource.fullQuality}. */\nexport interface CastSwapFullQualityParams {\n /** A generation session to file the Full Quality result in. */\n sessionId?: string\n}\n\n/** The Full Quality job (`POST /v1/cast-swap/:jobId/full-quality`). */\nexport interface CastSwapFullQualityResult {\n jobId: string\n /** `true` when this run's Full Quality was already running or done: that job is answered, nothing new is started or charged. */\n existing?: boolean\n}\n\n/**\n * The `code` of a Full Quality refusal (`NodaroError.code`), all before\n * anything is charged:\n * - `unauthorized` (401): no authenticated user;\n * - `not_found` (404): not your job, or not a Nodaro Motion run; also a\n * `sessionId` you may not use;\n * - `not_completed` (409): the run has not finished;\n * - `not_a_draft` (409): the run is neither a Nodaro Motion Prism draft nor a\n * Nodaro Motion Pulse run at 720p (a Pulse run at 1080p is already Full Quality);\n * - `draft_expired` (410): more than 7 days after the draft completed, or\n * the draft can no longer be finished at Full Quality;\n * - `full_quality_pending` (409, `details.retryable: true`): not final — an\n * earlier try's 1080p render of this draft is being reviewed, or has not\n * started yet; try again later (once the review ends). The only refusal\n * that ends on its own;\n * - `full_quality_unavailable` (409): final — nothing kept to re-render, no\n * readable completion time, or the 1080p finalize refuses this draft; on\n * the start only, also \"failed too many times\" (every try failed) or no\n * try can be started for this run;\n * - `insufficient_credits` (402), or in a workspace `budget_exceeded`,\n * `member_cap_exceeded` or `user_allowance_exceeded`;\n * - `job_blocked` (422): the request was blocked by the job policy;\n * - `job_read_failed` (503, retryable), `estimate_unavailable` (503, try\n * again shortly), `host_too_old` (503).\n *\n * Open-ended: a code not listed here may still arrive.\n */\nexport type CastSwapFullQualityRefusalCode =\n | \"unauthorized\"\n | \"not_found\"\n | \"not_completed\"\n | \"not_a_draft\"\n | \"draft_expired\"\n | \"full_quality_pending\"\n | \"full_quality_unavailable\"\n | \"insufficient_credits\"\n | \"budget_exceeded\"\n | \"member_cap_exceeded\"\n | \"user_allowance_exceeded\"\n | \"job_blocked\"\n | \"job_read_failed\"\n | \"estimate_unavailable\"\n | \"host_too_old\"\n | (string & {})\n\nexport class CastSwapResource {\n constructor(private client: NodaroClientCore) {}\n\n /**\n * Start a Nodaro Motion run (`POST /v1/cast-swap`, 202 `{ jobId }`). Returns the\n * job to follow. With `options.idempotencyKey` (sent as the\n * `Idempotency-Key` header; 8–200 characters, else 400) a repeat with the\n * same key within about 10 s answers 200 `{ jobId, deduped: true }`, a later\n * one 202 with the first run's `jobId`; nothing new starts.\n */\n run(params: CastSwapParams, options?: CastSwapRunOptions): Promise<{ jobId: string; deduped?: boolean }> {\n return this.client.request(\"POST\", \"/v1/cast-swap\", {\n body: params,\n ...(options?.idempotencyKey ? { headers: { \"Idempotency-Key\": options.idempotencyKey } } : {}),\n })\n }\n\n /** Quote a run before starting it (`POST /v1/cast-swap/estimate`); spends nothing. */\n async estimate(params: CastSwapParams): Promise<CastSwapEstimate> {\n const quote = await this.client.request<CastSwapEstimate>(\"POST\", \"/v1/cast-swap/estimate\", { body: params })\n // An older server names the engine by an earlier id: answered as the public id it names.\n const engine = nodaroMotionEngineFrom(quote?.engine)\n return engine && engine !== quote.engine ? { ...quote, engine } : quote\n }\n\n /**\n * Quote finishing a run at Full Quality (`POST\n * /v1/cast-swap/:jobId/full-quality/estimate`); spends nothing. `jobId` is a\n * finished Nodaro Motion Prism DRAFT run, or a finished Nodaro Motion Pulse\n * run at 720p (a Nodaro Motion or trend run); the quote's `kind` says whether it is the same take\n * re-rendered or a new take. The quote\n * does not look for a Full Quality already running: when one is,\n * {@link fullQuality} answers it (`existing: true`) and charges nothing.\n * Refusals: {@link CastSwapFullQualityRefusalCode}.\n */\n fullQualityEstimate(jobId: string): Promise<CastSwapFullQualityEstimate> {\n return this.client.request(\"POST\", `/v1/cast-swap/${encodeURIComponent(jobId)}/full-quality/estimate`, { body: {} })\n }\n\n /**\n * Finish a run at Full Quality (`POST /v1/cast-swap/:jobId/full-quality`):\n * at 1080p, with the clip's audio, as a new job linked to the run — a\n * Nodaro Motion Prism draft's own take re-rendered, or a new Nodaro Motion Pulse take from a\n * 720p run's inputs (the quote's `kind`). SPENDS CREDITS: quote it first with\n * {@link fullQualityEstimate}. Answers 202 `{ jobId }`, or 200\n * `{ jobId, existing: true }` when this run's Full Quality is already\n * running or done (one per run; a failed one may be asked again). Follow\n * the job with `client.jobs.get(jobId)`. No `Idempotency-Key` is taken: the\n * server keys the job by the draft. The new job keeps the draft's origin.\n * Refusals: {@link CastSwapFullQualityRefusalCode}.\n */\n fullQuality(jobId: string, params: CastSwapFullQualityParams = {}): Promise<CastSwapFullQualityResult> {\n const body = params.sessionId !== undefined ? { sessionId: params.sessionId } : {}\n return this.client.request(\"POST\", `/v1/cast-swap/${encodeURIComponent(jobId)}/full-quality`, { body })\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/resources/trends.ts"],"names":[],"mappings":"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","file":"chunk-YXVMQEJX.js","sourcesContent":["import type { NodaroClientCore } from \"../core.js\"\nimport type { CastSwapEngine } from \"./cast-swap.js\"\n\n/**\n * Trends — ready-made Nodaro Motion recipes. A trend is a short clip with slots\n * (the people, pets, products and place you can replace); fill its slots with\n * your own pictures and run it to get the clip back with them in it.\n *\n * Cloud edition only: `/v1/trends` 404s on self-hosted installs. Only\n * published trends exist here: a draft, unpublished or unknown slug is a 404\n * on every route. `\"runs\"` and `\"tags\"` are never slugs (`/v1/trends/runs` is\n * the run list, `/v1/trends/tags` the tag list): the slug methods throw a\n * `TypeError` for them before any request. `run()` answers 202 with a job id; follow it with\n * `client.jobs.get(jobId)` / `client.jobs.getStatus(jobId)` like any other\n * job, or read it back as a trend run with `getRun(jobId)` / `runs()`.\n *\n * Repeats: pass `{ idempotencyKey }` to `run()` and it is sent as the\n * `Idempotency-Key` header. A repeat with the same key answers with the first\n * run's `jobId`; nothing new is started or charged.\n *\n * Refusals (thrown as a `NodaroError` subclass; body `{ error: { code, message } }`):\n * - 400 `validation_error` (the body, a query, or a bad `cursor`);\n * `estimate()` / `run()` only, before anything is charged:\n * `missing_slot` (a required slot without pictures, or an optional one\n * left empty that the chosen example has no pictures for), `unknown_slot`,\n * `invalid_choice` (a chip the slot's kind does not take),\n * `chip_not_offered` (a chip of the kind that the slot's\n * {@link TrendDetailSlot.chips} does not list: the trend fixes it),\n * `example_out_of_range` (`example` names no example of the trend, or is\n * sent at all on a trend with none), `preview_unavailable` (the trend offers no\n * preview), `invalid_slot_mention` (a `{slot:<key>}` in `details` naming no\n * slot), `prompt_too_long` (shorten `details`), `draft_unsupported`\n * (`draft: true` on a trend whose `engine` has no draft: Nodaro Motion Pulse),\n * `resolution_unsupported` (a `resolution` not in the trend's\n * `resolutions`), `too_many_images` (a Nodaro Motion Pulse trend's run would send more\n * than 10 pictures: send fewer per slot). The slot errors carry the\n * slot's key as `slot` (in `NodaroError.details`), and `chip_not_offered`\n * the chip as `chip` too.\n * - 401 `unauthorized`.\n * - 404 `not_found`: the trend is not published (every method), or `run()`'s\n * `sessionId` is not a session you may use.\n * - 502 `engine_error` (`estimate()` / `run()`).\n * - 503 `engine_unsupported` (this platform version cannot run trends yet),\n * `trend_unavailable` (`estimate()` / `run()`), `not_available` (this\n * server has no trend catalog yet).\n * - `estimate()` / `run()` answer the video engine's refusals with the trend\n * routes' OWN codes and fixed messages — never the engine's text or\n * `issues`: 400 `trend_run_rejected` (the inputs could not run), or\n * `clip_out_of_range` / `preview_out_of_range` / `video_unreadable` (this\n * trend's clip), `unsafe_url` (a picture is not a public http(s) address),\n * `raw_reference_token` (`details` holds `{image:` / `{video:` /\n * `{audio:`); 402 `insufficient_credits` (or a workspace cap) as given;\n * 413 `storage_limit_exceeded`; 422 `job_blocked` (the job policy\n * blocked it); 429 `rate_limited`; 503 `engine_unsupported`,\n * `estimate_unavailable`; 502 `engine_error` for anything else. `run()`\n * also answers 400 `validation_error` for an `idempotencyKey` outside\n * 8–200 characters.\n */\n\n/** `/v1/trends/runs` is the run list and `/v1/trends/tags` the tag list, so neither can be a trend's slug. */\nconst RESERVED_SLUGS: Readonly<Record<string, string>> = {\n runs: \"the run list; use runs()\",\n tags: \"the tag list; use tags()\",\n}\n\nfunction trendPath(slug: string, rest = \"\"): string {\n if (Object.hasOwn(RESERVED_SLUGS, slug)) {\n throw new TypeError(`\"${slug}\" is not a trend slug (it is reserved for ${RESERVED_SLUGS[slug]})`)\n }\n return `/v1/trends/${encodeURIComponent(slug)}${rest}`\n}\n\n/** What a slot holds. */\nexport type TrendSlotKind = \"person\" | \"location\" | \"product\" | \"pet\"\n\n/** A chip: make this trait anew from your pictures (`\"new\"`), or keep the clip's (`\"original\"`). */\nexport type TrendChoice = \"new\" | \"original\"\n\n/**\n * The chips a slot can take, by its kind: a person `body` / `outfit` / `hair`,\n * a pet `body` / `coat`, a product `shape` / `finish`, a location none.\n */\nexport interface TrendChips {\n body?: TrendChoice\n outfit?: TrendChoice\n hair?: TrendChoice\n coat?: TrendChoice\n shape?: TrendChoice\n finish?: TrendChoice\n}\n\n/** A chip's name: `body`, `outfit`, `hair`, `coat`, `shape` or `finish`. */\nexport type TrendChipKey = keyof TrendChips\n\nexport type TrendResolution = \"480p\" | \"720p\" | \"1080p\"\n\n/**\n * The engine a trend runs on, by its public id ({@link CastSwapEngine}):\n * `\"motion-prism\"` (Nodaro Motion Prism) or `\"motion-pulse\"` (Nodaro Motion Pulse).\n * The trend chooses it, never the person running it.\n */\nexport type TrendEngine = CastSwapEngine\n\n/** A trend in the catalog (`list()`). Text is in the resolved locale. */\nexport interface TrendCard {\n id: string\n slug: string\n name: string\n description?: string\n tags: string[]\n /** e.g. `\"trending\"`, `\"new\"`. */\n badges: string[]\n /**\n * The trend's first example, else (a trend with no example) its original's\n * display copy, as {@link TrendDetail.original}.\n */\n cover: { videoUrl: string; posterUrl?: string; width: number; height: number }\n /** How many slots of each kind the trend has. */\n needs: Record<TrendSlotKind, number>\n /** The length of a full run, in seconds. */\n durationSec: number\n isFavorite: boolean\n}\n\n/** One slot of a trend: what it asks you for. */\nexport interface TrendDetailSlot {\n /** The key to fill in {@link TrendRunRequest.slots}, and to mention in `details` as `{slot:<key>}`. */\n key: string\n label: string\n kind: TrendSlotKind\n /**\n * A required slot needs pictures; an optional one left empty takes the\n * chosen example's, or, on a trend with no example, stays as in the original.\n */\n required: boolean\n hint?: string\n /**\n * A picture showing who or what this slot is in the original (e.g. a frame\n * of that actor), when the trend has one. Show it on an empty slot; a run\n * never sends it.\n */\n hintImageUrl?: string\n /**\n * The chips you may set on this slot, in its kind's order; `[]` = none (show\n * no chips row). A chip of the kind that is not listed is fixed by the\n * trend: sending it is refused with `400 chip_not_offered`.\n */\n chips: TrendChipKey[]\n /** The starting value of the chips in {@link chips} (only those). */\n defaults?: TrendChips\n}\n\n/** A finished run shown on a trend's page, with the pictures it used per slot. */\nexport interface TrendExample {\n videoUrl: string\n posterUrl?: string\n width: number\n height: number\n /** Slot key → the pictures this example used for it. */\n slots: Record<string, string[]>\n}\n\n/**\n * The clip a trend recasts, as you may show it: a browser-safe copy (H.264\n * MP4) of the clip every run starts from. Its fields parallel\n * {@link TrendExample}'s.\n */\nexport interface TrendOriginal {\n videoUrl: string\n posterUrl?: string\n width: number\n height: number\n /** The copy's length, in seconds. */\n durationSec: number\n /**\n * Where the 4-second preview starts in the clip, in seconds (`0` included),\n * when the trend offers one ({@link TrendDetail.previewSec} is `4`); absent\n * otherwise.\n */\n previewStartSec?: number\n}\n\n/** A trend's page (`get()`). */\nexport interface TrendDetail extends TrendCard {\n /** The published version this page shows. */\n version: number\n /** `4` when the trend offers a 4-second preview run, else `null`. */\n previewSec: 4 | null\n /**\n * The original clip every run starts from, to show beside the examples.\n * Absent only on a version without a display copy (and from an older server).\n */\n original?: TrendOriginal\n /** The engine every run of this trend uses. Absent (an older server) = `\"motion-prism\"`. */\n engine?: TrendEngine\n /** Its name to show: \"Nodaro Motion Prism\" or \"Nodaro Motion Pulse\". Absent from an older server. */\n engineName?: string\n /**\n * The resolutions a run may ask for, the default first. Nodaro Motion Prism:\n * `[\"480p\", \"720p\", \"1080p\"]`, where 480p is a draft (show it as one);\n * Nodaro Motion Pulse: `[\"720p\", \"1080p\"]`, no draft. Offer exactly these.\n */\n resolutions: TrendResolution[]\n slots: TrendDetailSlot[]\n /** Finished runs to show beside the original; may be empty (a trend with only its original). */\n examples: TrendExample[]\n}\n\n/** What you put in one slot of a run: 1–3 pictures, and the chips the slot offers ({@link TrendDetailSlot.chips}). */\nexport interface TrendRunSlot extends TrendChips {\n images?: string[]\n}\n\n/** The body of `estimate()` and `run()`. */\nexport interface TrendRunRequest {\n /**\n * Slot key → what you put in it. Every required slot needs pictures; an\n * optional slot left out takes the chosen example's, or, on a trend with no\n * example, stays as in the original. 1–3 pictures per slot.\n */\n slots: Record<string, TrendRunSlot>\n /**\n * 1-based example whose pictures fill the optional slots you leave empty.\n * Default 1. Leave it out on a trend with no examples: sending one there\n * answers 400 `example_out_of_range` (and `0` is a `validation_error`).\n */\n example?: number\n /** Your own words, at most 1,000 characters. Mention a slot as `{slot:<key>}`. */\n details?: string\n /** `true` runs a 4-second preview (only when the trend's `previewSec` is `4`). */\n preview?: boolean\n /**\n * One of the trend's {@link TrendDetail.resolutions}; default its first\n * (`\"480p\"` on Nodaro Motion Prism, `\"720p\"` on Nodaro Motion Pulse). Another answers 400\n * `resolution_unsupported`.\n */\n resolution?: TrendResolution\n /**\n * A draft run, only at 480p on a Nodaro Motion Prism trend. Default `true` at\n * 480p. `true` on a Nodaro Motion Pulse trend answers 400 `draft_unsupported`.\n */\n draft?: boolean\n /**\n * A generation session of yours. Accepted (and checked: one you may not use\n * is a 404), but not yet applied: trend runs are not filed into sessions yet.\n */\n sessionId?: string\n /** Accepted, but not used by the run today. */\n projectId?: string\n /**\n * A full run's own preview: the `jobId` of a completed preview run of this\n * trend that you started. When that preview needed the trend's retry (the\n * clip refused at first), the full run is made that way from the start (the\n * quote includes it). Any other job is ignored, without an error. Must be a uuid\n * (else 400 `validation_error`).\n */\n previewJobId?: string\n /**\n * `run()`: your client app's slug (e.g. `\"tools\"`: lowercase letters,\n * digits and `-`, 1–40 characters, starting with a letter or digit), as on\n * any job: the run's job carries it as `input_data.origin`, so\n * `client.jobs.list({ origin })` finds it. Not a slug is a 400\n * `validation_error`; without it the run has no origin. `estimate()`\n * ignores it.\n */\n origin?: string\n}\n\n/** What a run would cost, in credits (`estimate()`). */\nexport interface TrendEstimate {\n /** The charge the run is expected to come to. */\n expectedCredits: number\n /** What is reserved when the run starts; the run is charged what it actually costs. */\n holdCredits: number\n /**\n * The parts of the quote, by name, for display only: some are alternatives\n * or sit outside the totals (`privacy`, the retry's, beside\n * `privacyCredits`), so read `expectedCredits` and `holdCredits`, never\n * their sum.\n */\n breakdown: Record<string, number>\n /**\n * Only on a trend that retries a clip the video model refuses: the extra\n * credits charged if that retry runs. Not included in `expectedCredits` or\n * `holdCredits`. 0 (or absent) when there is nothing extra to charge.\n */\n privacyCredits?: number\n /** @deprecated read {@link privacyCredits} (an older server answered this name). */\n maskingCredits?: number\n}\n\n/** Per-call options for {@link TrendsResource.run}. */\nexport interface TrendRunOptions {\n /**\n * Sent as the `Idempotency-Key` header, unchanged (an empty string sends no\n * header). The server takes 8–200 characters and answers 400 for any other\n * length. Reuse it when retrying the same run.\n */\n idempotencyKey?: string\n}\n\n/** One slot of a past run, as it was run. Labels are English. */\nexport interface TrendRunDisplaySlot extends TrendChips {\n key: string\n label: string\n kind: TrendSlotKind\n images: string[]\n /**\n * `true` when the slot was left empty and the example's pictures filled it.\n * `false` with no `images`: left empty on a trend with no example, so it\n * stayed as in the original.\n */\n fromExample: boolean\n}\n\n/**\n * One of your trend runs (`runs()`, `getRun()`). Stays readable after the\n * trend moves on or is unpublished.\n *\n * A Full Quality version of a draft is a run of its own, with its own status,\n * result and charge: `fullQualityOf` names the draft it was made from, and it\n * stays listed after that draft is deleted.\n */\nexport interface TrendRun {\n jobId: string\n status: string\n progress: number | null\n /**\n * Why a failed or cancelled run did not finish; `null` otherwise. `code` is\n * `safety-block` or `policy-block` when the job was blocked, `credits` when\n * it ran out of credits partway (it was refunded: ask the person to top up,\n * then run it again), else `cancelled` or `failed`. `message` is the same\n * fixed sentence for every code — branch on `code`, not on the text.\n */\n error: { code?: string; message: string } | null\n createdAt: string\n completedAt: string | null\n /** The trend and version it ran (name in English). */\n trend: { id: string; slug: string; version: number; name: string }\n /**\n * The 1-based example used for empty optional slots; `0` = the trend had no\n * example (none was used: never show it as \"Example 0\").\n */\n example: number\n slots: TrendRunDisplaySlot[]\n details?: string\n preview: boolean\n resolution: string\n draft: boolean\n /** The engine the run was made on. Absent (an older server) = `\"motion-prism\"`. */\n engine?: TrendEngine\n /** Its name to show: \"Nodaro Motion Prism\" or \"Nodaro Motion Pulse\". Absent from an older server. */\n engineName?: string\n /** The result, once completed. */\n videoUrl: string | null\n posterUrl: string | null\n /**\n * What the run was charged once settled, every step it ran included (its\n * reference preparation, mask and video); `null` until the run's own hold\n * settles. A step adds its charge once it settles.\n */\n creditsCharged: number | null\n /** The run's hold: its own plus its steps'. Absent from an older server. */\n creditsHeld?: number | null\n /** What went back from `creditsHeld` once every hold in the run settled; `null` until then. Absent from an older server. */\n creditsReleased?: number | null\n /** A Full Quality version: the job id of the run (a draft, or a Nodaro Motion Pulse 720p run) it was made from. `null` for any other run. */\n fullQualityOf: string | null\n /**\n * A draft's (or Nodaro Motion Pulse 720p run's) newest Full Quality try, if one was started: a pointer only,\n * to know an upgrade exists and how it is going. Its video and charge are on\n * that run, listed on its own (its `fullQualityOf` is this run's `jobId`) —\n * read it there (`getRun(fullQuality.jobId)`). Older tries of the draft (a\n * failed or cancelled one tried again) are not listed by `runs()`;\n * `getRun()` still reads one by its id.\n */\n fullQuality: { jobId: string; status: string } | null\n /**\n * Until when a completed run can be redone in Full Quality — a Nodaro Motion\n * Prism draft (the same take at 1080p) or a Nodaro Motion Pulse run at 720p (a new take at\n * 1080p); `null` otherwise.\n */\n fullQualityUntil: string | null\n}\n\nexport interface ListTrendsParams {\n /** Search text. */\n q?: string\n tag?: string\n /** `true` lists only your favorites. */\n favorites?: boolean\n /** A platform language for names and descriptions; default your profile's, then English. */\n locale?: string\n /** The previous page's `next`. */\n cursor?: string\n /** Page size, 1–60 (server default 30). */\n limit?: number\n}\n\nexport interface ListTrendRunsParams {\n /** Only runs of this trend (its slug). */\n trend?: string\n /** The previous page's `next`. */\n cursor?: string\n /** Page size, 1–60 (server default 30). */\n limit?: number\n}\n\n/** A tag in use on the published catalog (`tags()`). */\nexport interface TrendTag {\n /** The tag itself: pass it as `list({ tag })`. */\n tag: string\n /** The tag's label in the resolved locale; the tag itself when it has none. */\n label: string\n /** How many published trends carry it. */\n count: number\n}\n\nexport interface TrendPage<T> {\n data: T[]\n /** Pass back as `cursor` for the next page; `null` on the last one. */\n next: string | null\n}\n\nexport class TrendsResource {\n constructor(private client: NodaroClientCore) {}\n\n /** The published catalog in its curated order (`GET /v1/trends`), a page at a time. */\n list(params: ListTrendsParams = {}): Promise<TrendPage<TrendCard>> {\n const query: Record<string, string> = {}\n if (params.q) query.q = params.q\n if (params.tag) query.tag = params.tag\n if (params.favorites) query.favorites = \"1\"\n if (params.locale) query.locale = params.locale\n if (params.cursor) query.cursor = params.cursor\n if (params.limit !== undefined) query.limit = String(params.limit)\n return this.client.request(\"GET\", \"/v1/trends\", { query })\n }\n\n /** A published trend's page (`GET /v1/trends/:slug`). */\n async get(slug: string, params: { locale?: string } = {}): Promise<TrendDetail> {\n const query: Record<string, string> = {}\n if (params.locale) query.locale = params.locale\n const res = await this.client.request<{ data: TrendDetail }>(\"GET\", trendPath(slug), { query })\n return res.data\n }\n\n /** Quote a run before starting it (`POST /v1/trends/:slug/estimate`); spends nothing. */\n async estimate(slug: string, request: TrendRunRequest): Promise<TrendEstimate> {\n const res = await this.client.request<{ data: TrendEstimate }>(\n \"POST\",\n trendPath(slug, \"/estimate\"),\n { body: request },\n )\n return res.data\n }\n\n /**\n * Start a run (`POST /v1/trends/:slug/runs`, 202). Returns the job to follow.\n * With `options.idempotencyKey` (sent as the `Idempotency-Key` header) a\n * repeat with the same key answers with the first run's `jobId`.\n */\n async run(slug: string, request: TrendRunRequest, options?: TrendRunOptions): Promise<{ jobId: string }> {\n const res = await this.client.request<{ data: { jobId: string } }>(\n \"POST\",\n trendPath(slug, \"/runs\"),\n {\n body: request,\n ...(options?.idempotencyKey ? { headers: { \"Idempotency-Key\": options.idempotencyKey } } : {}),\n },\n )\n return res.data\n }\n\n /**\n * Your trend runs, newest first (`GET /v1/trends/runs`). A Full Quality\n * version of a draft is listed as its own run (`fullQualityOf`).\n */\n runs(params: ListTrendRunsParams = {}): Promise<TrendPage<TrendRun>> {\n const query: Record<string, string> = {}\n if (params.trend) query.trend = params.trend\n if (params.cursor) query.cursor = params.cursor\n if (params.limit !== undefined) query.limit = String(params.limit)\n return this.client.request(\"GET\", \"/v1/trends/runs\", { query })\n }\n\n /**\n * One of your trend runs by its job id (`GET /v1/trends/runs/:jobId`), in\n * the same shape as `runs()`. A job that is not your own trend run is a\n * `NotFoundError`.\n */\n async getRun(jobId: string): Promise<TrendRun> {\n const res = await this.client.request<{ data: TrendRun }>(\"GET\", `/v1/trends/runs/${encodeURIComponent(jobId)}`)\n return res.data\n }\n\n /**\n * The tags in use on the published catalog, each with its label in the\n * resolved locale (`GET /v1/trends/tags`), most used first.\n */\n async tags(params: { locale?: string } = {}): Promise<TrendTag[]> {\n const query: Record<string, string> = {}\n if (params.locale) query.locale = params.locale\n const res = await this.client.request<{ data: TrendTag[] }>(\"GET\", \"/v1/trends/tags\", { query })\n return res.data\n }\n\n /** Add a trend to your favorites (`PUT /v1/trends/:slug/favorite`). */\n async favorite(slug: string): Promise<void> {\n await this.client.request<void>(\"PUT\", trendPath(slug, \"/favorite\"))\n }\n\n /** Remove a trend from your favorites (`DELETE /v1/trends/:slug/favorite`). */\n async unfavorite(slug: string): Promise<void> {\n await this.client.request<void>(\"DELETE\", trendPath(slug, \"/favorite\"))\n }\n}\n"]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
require('../chunk-RQSGS7ZK.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkTY2S25W5_cjs = require('../chunk-TY2S25W5.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, "CastSwapResource", {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
10
|
+
get: function () { return chunkTY2S25W5_cjs.CastSwapResource; }
|
|
11
11
|
});
|
|
12
12
|
//# sourceMappingURL=cast-swap.cjs.map
|
|
13
13
|
//# sourceMappingURL=cast-swap.cjs.map
|
|
@@ -15,8 +15,8 @@ import '@nodaro/shared/organizations';
|
|
|
15
15
|
* photos if it fails, and is turned off with `prepareReferences: false`.
|
|
16
16
|
* Locations are not prepared.
|
|
17
17
|
*
|
|
18
|
-
* Engines: a run is made on Nodaro Motion
|
|
19
|
-
* `"motion-
|
|
18
|
+
* Engines: a run is made on Nodaro Motion Prism (`engine` left out, or
|
|
19
|
+
* `"motion-prism"`) or Nodaro Motion Pulse (`"motion-pulse"`). Pulse renders 720p
|
|
20
20
|
* (its default) or 1080p and has no draft; it makes a new take guided by the
|
|
21
21
|
* clip and pictures, so its Full Quality is a new take at 1080p rather than
|
|
22
22
|
* the same take re-rendered (`CastSwapFullQualityEstimate.kind`).
|
|
@@ -40,7 +40,7 @@ import '@nodaro/shared/organizations';
|
|
|
40
40
|
* anything is charged: 400 `validation_error` (the body: no role with images,
|
|
41
41
|
* no reference and no `prePrompt` or `postPrompt`, more roles of a kind
|
|
42
42
|
* than allowed, more than 30 images in all, `draft: true` above 480p, a
|
|
43
|
-
* `prePrompt` or `postPrompt` over 4,000 characters); on Nodaro Motion
|
|
43
|
+
* `prePrompt` or `postPrompt` over 4,000 characters); on Nodaro Motion Pulse,
|
|
44
44
|
* `draft_unsupported` (`draft: true`), `resolution_unsupported` (480p),
|
|
45
45
|
* `output_format_unsupported` (a MOV edit output) and `too_many_images` (more
|
|
46
46
|
* than 10 images in the run, across every role and fixed reference);
|
|
@@ -51,32 +51,34 @@ import '@nodaro/shared/organizations';
|
|
|
51
51
|
* `inPreview: false`, always refused even with a prompt, or with no role kept
|
|
52
52
|
* in it that has images and no `prePrompt` or `postPrompt`), `prompt_too_long`
|
|
53
53
|
* (the prompt would build too long: a `{role:N}` reads as the role's name when
|
|
54
|
-
* it sends no images; Nodaro Motion
|
|
54
|
+
* it sends no images; Nodaro Motion Pulse's cap is 8,000 characters); 401; 402 `insufficient_credits` (`run()` only); 404
|
|
55
55
|
* (a `sessionId` you may not use, `run()` only); 422 `job_blocked` (`run()`
|
|
56
56
|
* only); 503 `host_too_old` (both); 503 `estimate_unavailable` (`estimate()`
|
|
57
57
|
* only).
|
|
58
58
|
*/
|
|
59
59
|
/**
|
|
60
60
|
* The engine a Nodaro Motion run is made on, by its public id. Left out =
|
|
61
|
-
* `"motion-
|
|
61
|
+
* `"motion-prism"`.
|
|
62
62
|
*
|
|
63
|
-
* - `"motion-
|
|
63
|
+
* - `"motion-prism"` (Nodaro Motion Prism): 480p (the default, a draft unless
|
|
64
64
|
* `draft: false`), 720p or 1080p; Full Quality re-renders a draft's own take
|
|
65
65
|
* at 1080p.
|
|
66
|
-
* - `"motion-
|
|
66
|
+
* - `"motion-pulse"` (Nodaro Motion Pulse): 720p (the default) or 1080p, never a
|
|
67
67
|
* draft (`draft: true` answers 400 `draft_unsupported`); Full Quality makes a
|
|
68
68
|
* new take at 1080p from a completed 720p run's inputs. A preview is still
|
|
69
69
|
* 4 s from `previewStart`.
|
|
70
70
|
*/
|
|
71
|
-
type CastSwapEngine = "motion-
|
|
71
|
+
type CastSwapEngine = "motion-prism" | "motion-pulse";
|
|
72
72
|
/**
|
|
73
|
-
* The engine ids an older client sent
|
|
74
|
-
* `"
|
|
73
|
+
* The engine ids an older client sent: the earlier public ids (`"motion-pro"`
|
|
74
|
+
* = `"motion-prism"`, `"motion-lite"` = `"motion-pulse"`) and the internal
|
|
75
|
+
* ones (`"seedance-2-5"`, `"kling-4"`). Still accepted in a request; never
|
|
76
|
+
* returned.
|
|
75
77
|
* @deprecated use {@link CastSwapEngine}.
|
|
76
78
|
*/
|
|
77
|
-
type CastSwapEngineLegacyId = "seedance-2-5" | "kling-4";
|
|
79
|
+
type CastSwapEngineLegacyId = "motion-pro" | "motion-lite" | "seedance-2-5" | "kling-4";
|
|
78
80
|
/**
|
|
79
|
-
* Where a Nodaro Motion
|
|
81
|
+
* Where a Nodaro Motion Pulse run cuts the clip to whole seconds (Pulse renders
|
|
80
82
|
* whole seconds; asked for more than the clip, it would stretch the motion):
|
|
81
83
|
* - `"cut-end"` (the default): drop the fraction of a second at its end;
|
|
82
84
|
* - `"cut-start"`: drop it at its start.
|
|
@@ -228,29 +230,29 @@ interface CastSwapParams {
|
|
|
228
230
|
/** Where the preview starts, in seconds. Default 0. */
|
|
229
231
|
previewStart?: number;
|
|
230
232
|
/**
|
|
231
|
-
* The engine (see {@link CastSwapEngine}). Default `"motion-
|
|
233
|
+
* The engine (see {@link CastSwapEngine}). Default `"motion-prism"`. The job
|
|
232
234
|
* records it in `input_data.engine`, and a completed job's output in its
|
|
233
235
|
* `engine`. The ids an older client sent ({@link CastSwapEngineLegacyId})
|
|
234
236
|
* are still accepted.
|
|
235
237
|
*/
|
|
236
238
|
engine?: CastSwapEngine | CastSwapEngineLegacyId;
|
|
237
239
|
/**
|
|
238
|
-
* Nodaro Motion
|
|
240
|
+
* Nodaro Motion Pulse only (Prism ignores it): which end of the clip is cut to
|
|
239
241
|
* whole seconds (see {@link CastSwapMotionLength}). Default `"cut-end"`.
|
|
240
242
|
*/
|
|
241
243
|
motionLength?: CastSwapMotionLength;
|
|
242
244
|
/** @deprecated use {@link motionLength} (still accepted). */
|
|
243
245
|
klingLength?: CastSwapKlingLength;
|
|
244
246
|
/**
|
|
245
|
-
* The output resolution. Nodaro Motion
|
|
246
|
-
* `"1080p"`. Nodaro Motion
|
|
247
|
+
* The output resolution. Nodaro Motion Prism: `"480p"` (default), `"720p"` or
|
|
248
|
+
* `"1080p"`. Nodaro Motion Pulse: `"720p"` (default) or `"1080p"`; `"480p"`
|
|
247
249
|
* answers 400.
|
|
248
250
|
*/
|
|
249
251
|
resolution?: "480p" | "720p" | "1080p";
|
|
250
252
|
/**
|
|
251
|
-
* Render as a draft (Nodaro Motion
|
|
253
|
+
* Render as a draft (Nodaro Motion Prism only). Defaults to `true` at 480p and
|
|
252
254
|
* `false` above it; `true` with `"720p"` or `"1080p"` answers 400 (draft is
|
|
253
|
-
* 480p only). Nodaro Motion
|
|
255
|
+
* 480p only). Nodaro Motion Pulse has no draft: `true` answers 400
|
|
254
256
|
* `draft_unsupported`.
|
|
255
257
|
*/
|
|
256
258
|
draft?: boolean;
|
|
@@ -281,7 +283,8 @@ interface CastSwapParams {
|
|
|
281
283
|
interface CastSwapEstimate {
|
|
282
284
|
/**
|
|
283
285
|
* The engine the run would use, by its public id (absent from an older
|
|
284
|
-
* server = `"motion-
|
|
286
|
+
* server = `"motion-prism"`). An id an older server answers is read as the
|
|
287
|
+
* public id it names.
|
|
285
288
|
*/
|
|
286
289
|
engine?: CastSwapEngine;
|
|
287
290
|
/**
|
|
@@ -291,7 +294,7 @@ interface CastSwapEstimate {
|
|
|
291
294
|
totalCredits: number;
|
|
292
295
|
/**
|
|
293
296
|
* The charge the run is expected to come to. Never above `totalCredits`
|
|
294
|
-
* (on Nodaro Motion
|
|
297
|
+
* (on Nodaro Motion Pulse it equals it: Pulse renders exactly the length
|
|
295
298
|
* asked for, so the hold is what it settles at). Absent from an older
|
|
296
299
|
* server: read `totalCredits` then.
|
|
297
300
|
*/
|
|
@@ -302,9 +305,9 @@ interface CastSwapEstimate {
|
|
|
302
305
|
* names it `castSwap` instead: read `base`, else `castSwap`;
|
|
303
306
|
* - `references`: preparing the reference pictures (0 when
|
|
304
307
|
* `prepareReferences` is off or there is nothing to prepare);
|
|
305
|
-
* - `motion`: what the video holds (on Nodaro Motion
|
|
308
|
+
* - `motion`: what the video holds (on Nodaro Motion Pulse, what it costs);
|
|
306
309
|
* - `motionExpected`: what the video is expected to be charged, never above
|
|
307
|
-
* `motion` (Nodaro Motion
|
|
310
|
+
* `motion` (Nodaro Motion Prism);
|
|
308
311
|
* - `privacy`: preparing the clip, when the engine's setting does. In both
|
|
309
312
|
* totals when it always runs; outside both when it is the retry
|
|
310
313
|
* (`privacyCredits`).
|
|
@@ -332,9 +335,9 @@ interface CastSwapEstimate {
|
|
|
332
335
|
/** @deprecated read {@link privacyCredits} (an older server answered this name). */
|
|
333
336
|
maskingCredits?: number;
|
|
334
337
|
/**
|
|
335
|
-
* `true` when the video is made at Auto length (every Nodaro Motion
|
|
338
|
+
* `true` when the video is made at Auto length (every Nodaro Motion Prism
|
|
336
339
|
* run): the final charge is expected to come out lower than `totalCredits`,
|
|
337
|
-
* at about `expectedCredits`. `false` on Nodaro Motion
|
|
340
|
+
* at about `expectedCredits`. `false` on Nodaro Motion Pulse.
|
|
338
341
|
*/
|
|
339
342
|
settlesLower: boolean;
|
|
340
343
|
}
|
|
@@ -352,15 +355,15 @@ interface CastSwapRunOptions {
|
|
|
352
355
|
}
|
|
353
356
|
/**
|
|
354
357
|
* What a Full Quality version would be: `"same-take"` re-renders a Nodaro
|
|
355
|
-
* Motion
|
|
358
|
+
* Motion Prism draft's own take at 1080p; `"new-take"` makes a new Nodaro Motion Pulse take at
|
|
356
359
|
* 1080p from a 720p run's inputs (it will not match the 720p run frame for
|
|
357
360
|
* frame). The 720p run or draft stays either way.
|
|
358
361
|
*/
|
|
359
362
|
type CastSwapFullQualityKind = "same-take" | "new-take";
|
|
360
363
|
/**
|
|
361
364
|
* What a Full Quality version of a run would cost
|
|
362
|
-
* (`POST /v1/cast-swap/:jobId/full-quality/estimate`): a Nodaro Motion
|
|
363
|
-
* draft, or a completed Nodaro Motion
|
|
365
|
+
* (`POST /v1/cast-swap/:jobId/full-quality/estimate`): a Nodaro Motion Prism
|
|
366
|
+
* draft, or a completed Nodaro Motion Pulse run at 720p.
|
|
364
367
|
*/
|
|
365
368
|
interface CastSwapFullQualityEstimate {
|
|
366
369
|
/**
|
|
@@ -405,8 +408,8 @@ interface CastSwapFullQualityResult {
|
|
|
405
408
|
* - `not_found` (404): not your job, or not a Nodaro Motion run; also a
|
|
406
409
|
* `sessionId` you may not use;
|
|
407
410
|
* - `not_completed` (409): the run has not finished;
|
|
408
|
-
* - `not_a_draft` (409): the run is neither a Nodaro Motion
|
|
409
|
-
* Nodaro Motion
|
|
411
|
+
* - `not_a_draft` (409): the run is neither a Nodaro Motion Prism draft nor a
|
|
412
|
+
* Nodaro Motion Pulse run at 720p (a Pulse run at 1080p is already Full Quality);
|
|
410
413
|
* - `draft_expired` (410): more than 7 days after the draft completed, or
|
|
411
414
|
* the draft can no longer be finished at Full Quality;
|
|
412
415
|
* - `full_quality_pending` (409, `details.retryable: true`): not final — an
|
|
@@ -445,7 +448,7 @@ declare class CastSwapResource {
|
|
|
445
448
|
/**
|
|
446
449
|
* Quote finishing a run at Full Quality (`POST
|
|
447
450
|
* /v1/cast-swap/:jobId/full-quality/estimate`); spends nothing. `jobId` is a
|
|
448
|
-
* finished Nodaro Motion
|
|
451
|
+
* finished Nodaro Motion Prism DRAFT run, or a finished Nodaro Motion Pulse
|
|
449
452
|
* run at 720p (a Nodaro Motion or trend run); the quote's `kind` says whether it is the same take
|
|
450
453
|
* re-rendered or a new take. The quote
|
|
451
454
|
* does not look for a Full Quality already running: when one is,
|
|
@@ -456,7 +459,7 @@ declare class CastSwapResource {
|
|
|
456
459
|
/**
|
|
457
460
|
* Finish a run at Full Quality (`POST /v1/cast-swap/:jobId/full-quality`):
|
|
458
461
|
* at 1080p, with the clip's audio, as a new job linked to the run — a
|
|
459
|
-
* Nodaro Motion
|
|
462
|
+
* Nodaro Motion Prism draft's own take re-rendered, or a new Nodaro Motion Pulse take from a
|
|
460
463
|
* 720p run's inputs (the quote's `kind`). SPENDS CREDITS: quote it first with
|
|
461
464
|
* {@link fullQualityEstimate}. Answers 202 `{ jobId }`, or 200
|
|
462
465
|
* `{ jobId, existing: true }` when this run's Full Quality is already
|
|
@@ -15,8 +15,8 @@ import '@nodaro/shared/organizations';
|
|
|
15
15
|
* photos if it fails, and is turned off with `prepareReferences: false`.
|
|
16
16
|
* Locations are not prepared.
|
|
17
17
|
*
|
|
18
|
-
* Engines: a run is made on Nodaro Motion
|
|
19
|
-
* `"motion-
|
|
18
|
+
* Engines: a run is made on Nodaro Motion Prism (`engine` left out, or
|
|
19
|
+
* `"motion-prism"`) or Nodaro Motion Pulse (`"motion-pulse"`). Pulse renders 720p
|
|
20
20
|
* (its default) or 1080p and has no draft; it makes a new take guided by the
|
|
21
21
|
* clip and pictures, so its Full Quality is a new take at 1080p rather than
|
|
22
22
|
* the same take re-rendered (`CastSwapFullQualityEstimate.kind`).
|
|
@@ -40,7 +40,7 @@ import '@nodaro/shared/organizations';
|
|
|
40
40
|
* anything is charged: 400 `validation_error` (the body: no role with images,
|
|
41
41
|
* no reference and no `prePrompt` or `postPrompt`, more roles of a kind
|
|
42
42
|
* than allowed, more than 30 images in all, `draft: true` above 480p, a
|
|
43
|
-
* `prePrompt` or `postPrompt` over 4,000 characters); on Nodaro Motion
|
|
43
|
+
* `prePrompt` or `postPrompt` over 4,000 characters); on Nodaro Motion Pulse,
|
|
44
44
|
* `draft_unsupported` (`draft: true`), `resolution_unsupported` (480p),
|
|
45
45
|
* `output_format_unsupported` (a MOV edit output) and `too_many_images` (more
|
|
46
46
|
* than 10 images in the run, across every role and fixed reference);
|
|
@@ -51,32 +51,34 @@ import '@nodaro/shared/organizations';
|
|
|
51
51
|
* `inPreview: false`, always refused even with a prompt, or with no role kept
|
|
52
52
|
* in it that has images and no `prePrompt` or `postPrompt`), `prompt_too_long`
|
|
53
53
|
* (the prompt would build too long: a `{role:N}` reads as the role's name when
|
|
54
|
-
* it sends no images; Nodaro Motion
|
|
54
|
+
* it sends no images; Nodaro Motion Pulse's cap is 8,000 characters); 401; 402 `insufficient_credits` (`run()` only); 404
|
|
55
55
|
* (a `sessionId` you may not use, `run()` only); 422 `job_blocked` (`run()`
|
|
56
56
|
* only); 503 `host_too_old` (both); 503 `estimate_unavailable` (`estimate()`
|
|
57
57
|
* only).
|
|
58
58
|
*/
|
|
59
59
|
/**
|
|
60
60
|
* The engine a Nodaro Motion run is made on, by its public id. Left out =
|
|
61
|
-
* `"motion-
|
|
61
|
+
* `"motion-prism"`.
|
|
62
62
|
*
|
|
63
|
-
* - `"motion-
|
|
63
|
+
* - `"motion-prism"` (Nodaro Motion Prism): 480p (the default, a draft unless
|
|
64
64
|
* `draft: false`), 720p or 1080p; Full Quality re-renders a draft's own take
|
|
65
65
|
* at 1080p.
|
|
66
|
-
* - `"motion-
|
|
66
|
+
* - `"motion-pulse"` (Nodaro Motion Pulse): 720p (the default) or 1080p, never a
|
|
67
67
|
* draft (`draft: true` answers 400 `draft_unsupported`); Full Quality makes a
|
|
68
68
|
* new take at 1080p from a completed 720p run's inputs. A preview is still
|
|
69
69
|
* 4 s from `previewStart`.
|
|
70
70
|
*/
|
|
71
|
-
type CastSwapEngine = "motion-
|
|
71
|
+
type CastSwapEngine = "motion-prism" | "motion-pulse";
|
|
72
72
|
/**
|
|
73
|
-
* The engine ids an older client sent
|
|
74
|
-
* `"
|
|
73
|
+
* The engine ids an older client sent: the earlier public ids (`"motion-pro"`
|
|
74
|
+
* = `"motion-prism"`, `"motion-lite"` = `"motion-pulse"`) and the internal
|
|
75
|
+
* ones (`"seedance-2-5"`, `"kling-4"`). Still accepted in a request; never
|
|
76
|
+
* returned.
|
|
75
77
|
* @deprecated use {@link CastSwapEngine}.
|
|
76
78
|
*/
|
|
77
|
-
type CastSwapEngineLegacyId = "seedance-2-5" | "kling-4";
|
|
79
|
+
type CastSwapEngineLegacyId = "motion-pro" | "motion-lite" | "seedance-2-5" | "kling-4";
|
|
78
80
|
/**
|
|
79
|
-
* Where a Nodaro Motion
|
|
81
|
+
* Where a Nodaro Motion Pulse run cuts the clip to whole seconds (Pulse renders
|
|
80
82
|
* whole seconds; asked for more than the clip, it would stretch the motion):
|
|
81
83
|
* - `"cut-end"` (the default): drop the fraction of a second at its end;
|
|
82
84
|
* - `"cut-start"`: drop it at its start.
|
|
@@ -228,29 +230,29 @@ interface CastSwapParams {
|
|
|
228
230
|
/** Where the preview starts, in seconds. Default 0. */
|
|
229
231
|
previewStart?: number;
|
|
230
232
|
/**
|
|
231
|
-
* The engine (see {@link CastSwapEngine}). Default `"motion-
|
|
233
|
+
* The engine (see {@link CastSwapEngine}). Default `"motion-prism"`. The job
|
|
232
234
|
* records it in `input_data.engine`, and a completed job's output in its
|
|
233
235
|
* `engine`. The ids an older client sent ({@link CastSwapEngineLegacyId})
|
|
234
236
|
* are still accepted.
|
|
235
237
|
*/
|
|
236
238
|
engine?: CastSwapEngine | CastSwapEngineLegacyId;
|
|
237
239
|
/**
|
|
238
|
-
* Nodaro Motion
|
|
240
|
+
* Nodaro Motion Pulse only (Prism ignores it): which end of the clip is cut to
|
|
239
241
|
* whole seconds (see {@link CastSwapMotionLength}). Default `"cut-end"`.
|
|
240
242
|
*/
|
|
241
243
|
motionLength?: CastSwapMotionLength;
|
|
242
244
|
/** @deprecated use {@link motionLength} (still accepted). */
|
|
243
245
|
klingLength?: CastSwapKlingLength;
|
|
244
246
|
/**
|
|
245
|
-
* The output resolution. Nodaro Motion
|
|
246
|
-
* `"1080p"`. Nodaro Motion
|
|
247
|
+
* The output resolution. Nodaro Motion Prism: `"480p"` (default), `"720p"` or
|
|
248
|
+
* `"1080p"`. Nodaro Motion Pulse: `"720p"` (default) or `"1080p"`; `"480p"`
|
|
247
249
|
* answers 400.
|
|
248
250
|
*/
|
|
249
251
|
resolution?: "480p" | "720p" | "1080p";
|
|
250
252
|
/**
|
|
251
|
-
* Render as a draft (Nodaro Motion
|
|
253
|
+
* Render as a draft (Nodaro Motion Prism only). Defaults to `true` at 480p and
|
|
252
254
|
* `false` above it; `true` with `"720p"` or `"1080p"` answers 400 (draft is
|
|
253
|
-
* 480p only). Nodaro Motion
|
|
255
|
+
* 480p only). Nodaro Motion Pulse has no draft: `true` answers 400
|
|
254
256
|
* `draft_unsupported`.
|
|
255
257
|
*/
|
|
256
258
|
draft?: boolean;
|
|
@@ -281,7 +283,8 @@ interface CastSwapParams {
|
|
|
281
283
|
interface CastSwapEstimate {
|
|
282
284
|
/**
|
|
283
285
|
* The engine the run would use, by its public id (absent from an older
|
|
284
|
-
* server = `"motion-
|
|
286
|
+
* server = `"motion-prism"`). An id an older server answers is read as the
|
|
287
|
+
* public id it names.
|
|
285
288
|
*/
|
|
286
289
|
engine?: CastSwapEngine;
|
|
287
290
|
/**
|
|
@@ -291,7 +294,7 @@ interface CastSwapEstimate {
|
|
|
291
294
|
totalCredits: number;
|
|
292
295
|
/**
|
|
293
296
|
* The charge the run is expected to come to. Never above `totalCredits`
|
|
294
|
-
* (on Nodaro Motion
|
|
297
|
+
* (on Nodaro Motion Pulse it equals it: Pulse renders exactly the length
|
|
295
298
|
* asked for, so the hold is what it settles at). Absent from an older
|
|
296
299
|
* server: read `totalCredits` then.
|
|
297
300
|
*/
|
|
@@ -302,9 +305,9 @@ interface CastSwapEstimate {
|
|
|
302
305
|
* names it `castSwap` instead: read `base`, else `castSwap`;
|
|
303
306
|
* - `references`: preparing the reference pictures (0 when
|
|
304
307
|
* `prepareReferences` is off or there is nothing to prepare);
|
|
305
|
-
* - `motion`: what the video holds (on Nodaro Motion
|
|
308
|
+
* - `motion`: what the video holds (on Nodaro Motion Pulse, what it costs);
|
|
306
309
|
* - `motionExpected`: what the video is expected to be charged, never above
|
|
307
|
-
* `motion` (Nodaro Motion
|
|
310
|
+
* `motion` (Nodaro Motion Prism);
|
|
308
311
|
* - `privacy`: preparing the clip, when the engine's setting does. In both
|
|
309
312
|
* totals when it always runs; outside both when it is the retry
|
|
310
313
|
* (`privacyCredits`).
|
|
@@ -332,9 +335,9 @@ interface CastSwapEstimate {
|
|
|
332
335
|
/** @deprecated read {@link privacyCredits} (an older server answered this name). */
|
|
333
336
|
maskingCredits?: number;
|
|
334
337
|
/**
|
|
335
|
-
* `true` when the video is made at Auto length (every Nodaro Motion
|
|
338
|
+
* `true` when the video is made at Auto length (every Nodaro Motion Prism
|
|
336
339
|
* run): the final charge is expected to come out lower than `totalCredits`,
|
|
337
|
-
* at about `expectedCredits`. `false` on Nodaro Motion
|
|
340
|
+
* at about `expectedCredits`. `false` on Nodaro Motion Pulse.
|
|
338
341
|
*/
|
|
339
342
|
settlesLower: boolean;
|
|
340
343
|
}
|
|
@@ -352,15 +355,15 @@ interface CastSwapRunOptions {
|
|
|
352
355
|
}
|
|
353
356
|
/**
|
|
354
357
|
* What a Full Quality version would be: `"same-take"` re-renders a Nodaro
|
|
355
|
-
* Motion
|
|
358
|
+
* Motion Prism draft's own take at 1080p; `"new-take"` makes a new Nodaro Motion Pulse take at
|
|
356
359
|
* 1080p from a 720p run's inputs (it will not match the 720p run frame for
|
|
357
360
|
* frame). The 720p run or draft stays either way.
|
|
358
361
|
*/
|
|
359
362
|
type CastSwapFullQualityKind = "same-take" | "new-take";
|
|
360
363
|
/**
|
|
361
364
|
* What a Full Quality version of a run would cost
|
|
362
|
-
* (`POST /v1/cast-swap/:jobId/full-quality/estimate`): a Nodaro Motion
|
|
363
|
-
* draft, or a completed Nodaro Motion
|
|
365
|
+
* (`POST /v1/cast-swap/:jobId/full-quality/estimate`): a Nodaro Motion Prism
|
|
366
|
+
* draft, or a completed Nodaro Motion Pulse run at 720p.
|
|
364
367
|
*/
|
|
365
368
|
interface CastSwapFullQualityEstimate {
|
|
366
369
|
/**
|
|
@@ -405,8 +408,8 @@ interface CastSwapFullQualityResult {
|
|
|
405
408
|
* - `not_found` (404): not your job, or not a Nodaro Motion run; also a
|
|
406
409
|
* `sessionId` you may not use;
|
|
407
410
|
* - `not_completed` (409): the run has not finished;
|
|
408
|
-
* - `not_a_draft` (409): the run is neither a Nodaro Motion
|
|
409
|
-
* Nodaro Motion
|
|
411
|
+
* - `not_a_draft` (409): the run is neither a Nodaro Motion Prism draft nor a
|
|
412
|
+
* Nodaro Motion Pulse run at 720p (a Pulse run at 1080p is already Full Quality);
|
|
410
413
|
* - `draft_expired` (410): more than 7 days after the draft completed, or
|
|
411
414
|
* the draft can no longer be finished at Full Quality;
|
|
412
415
|
* - `full_quality_pending` (409, `details.retryable: true`): not final — an
|
|
@@ -445,7 +448,7 @@ declare class CastSwapResource {
|
|
|
445
448
|
/**
|
|
446
449
|
* Quote finishing a run at Full Quality (`POST
|
|
447
450
|
* /v1/cast-swap/:jobId/full-quality/estimate`); spends nothing. `jobId` is a
|
|
448
|
-
* finished Nodaro Motion
|
|
451
|
+
* finished Nodaro Motion Prism DRAFT run, or a finished Nodaro Motion Pulse
|
|
449
452
|
* run at 720p (a Nodaro Motion or trend run); the quote's `kind` says whether it is the same take
|
|
450
453
|
* re-rendered or a new take. The quote
|
|
451
454
|
* does not look for a Full Quality already running: when one is,
|
|
@@ -456,7 +459,7 @@ declare class CastSwapResource {
|
|
|
456
459
|
/**
|
|
457
460
|
* Finish a run at Full Quality (`POST /v1/cast-swap/:jobId/full-quality`):
|
|
458
461
|
* at 1080p, with the clip's audio, as a new job linked to the run — a
|
|
459
|
-
* Nodaro Motion
|
|
462
|
+
* Nodaro Motion Prism draft's own take re-rendered, or a new Nodaro Motion Pulse take from a
|
|
460
463
|
* 720p run's inputs (the quote's `kind`). SPENDS CREDITS: quote it first with
|
|
461
464
|
* {@link fullQualityEstimate}. Answers 202 `{ jobId }`, or 200
|
|
462
465
|
* `{ jobId, existing: true }` when this run's Full Quality is already
|