@nodaro/sdk 1.16.0 → 1.19.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/README.md +9 -1
- package/dist/index.cjs +379 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +668 -13
- package/dist/index.d.ts +668 -13
- package/dist/index.js +374 -7
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -263,14 +263,19 @@ try {
|
|
|
263
263
|
| `client.workflows` | List, get, create, update, delete, run |
|
|
264
264
|
| `client.projects` | Workspace organization |
|
|
265
265
|
| `client.jobs` | Job status (+ lean `getStatus` for poll loops) and cancellation |
|
|
266
|
+
| `client.videoPro` | Generate Video Pro run control: graceful stop + continue |
|
|
267
|
+
| `client.recast` | Recast runs + authored-script import (validate / import / estimate / gates) — Cloud |
|
|
266
268
|
| `client.executions` | Workflow execution status, list, cancel |
|
|
267
269
|
| `client.nodes` | Node discovery + direct `run` / `runAndWait` / `runMany` |
|
|
270
|
+
| `client.models` | Model catalog: capability sheets, credit pricing, prompt tips, `doctrineCovered` |
|
|
268
271
|
| `client.apps` | Published apps: inputs, run, runs history |
|
|
269
272
|
| `client.characters` | Character Studio: CRUD, portraits, assets, motion, LoRA |
|
|
270
273
|
| `client.locations` | Location Studio: CRUD, assets, atmosphere motion |
|
|
271
274
|
| `client.objects` | Object Studio: CRUD, assets, motion |
|
|
272
275
|
| `client.creatures` | Creature Studio: CRUD, assets, motion |
|
|
273
276
|
| `client.voices` | Voice catalog + clones (from URL or file), voice changer, multi-speaker recast + the interactive `analyze`/stems/`exportMix` flow, design, remix, dubbing |
|
|
277
|
+
| `client.media` | Social-video import, trim, collage, save-to-storage, metadata probe |
|
|
278
|
+
| `client.audio` | Audio primitives: separate, isolate, FX, mix, volume, combine |
|
|
274
279
|
| `client.pipelines` | Showrunner pipelines: stages, approvals, chat, branch |
|
|
275
280
|
| `client.reduce` | Fan-in reducer (pick-best, concat, vote, merge…) |
|
|
276
281
|
| `client.promptHelper` | Prompt enhancement / wizard |
|
|
@@ -278,8 +283,11 @@ try {
|
|
|
278
283
|
| `client.uploads` | Signed upload URLs for image / video / audio |
|
|
279
284
|
| `client.library` | Generated-media library |
|
|
280
285
|
| `client.presets` | Node presets (factory + user) |
|
|
281
|
-
| `client.pickerCatalogs` | Parameter-picker catalog discovery |
|
|
286
|
+
| `client.pickerCatalogs` | Parameter-picker catalog discovery + text→pickers AI Fill (`analyzeText`) |
|
|
287
|
+
| `client.shots` | Cine share → remix records (create, read, visibility, delete) |
|
|
282
288
|
| `client.community` | Shared characters/locations/objects: browse, clone, favorites |
|
|
289
|
+
| `client.templates` | Workflow templates: browse + clone |
|
|
290
|
+
| `client.tutorials` | Guided tutorial catalog |
|
|
283
291
|
| `client.developerApps` | Manage your own OAuth apps |
|
|
284
292
|
| `client.oauth` | Code exchange, revoke, app-info |
|
|
285
293
|
|
package/dist/index.cjs
CHANGED
|
@@ -170,7 +170,8 @@ var WorkflowsResource = class {
|
|
|
170
170
|
{ body: input }
|
|
171
171
|
);
|
|
172
172
|
}
|
|
173
|
-
/** Delete a workflow. Returns `{ success: true }`.
|
|
173
|
+
/** Delete a workflow. Returns `{ success: true }`. Throws `NotFoundError`
|
|
174
|
+
* when the id doesn't exist or isn't yours (the delete is not silent). */
|
|
174
175
|
delete(id) {
|
|
175
176
|
return this.client.request("DELETE", `/v1/workflows/${encodeURIComponent(id)}`);
|
|
176
177
|
}
|
|
@@ -199,6 +200,9 @@ var WorkflowsResource = class {
|
|
|
199
200
|
/**
|
|
200
201
|
* Import a `WorkflowExport` bundle into the specified project.
|
|
201
202
|
* Re-creates any bundled assets (characters, objects, locations) under your account.
|
|
203
|
+
* Media the bundle references on other hosts is copied onto this instance's
|
|
204
|
+
* storage where reachable; `importReport` says what was copied, what could
|
|
205
|
+
* not be reached, and what was skipped (and why).
|
|
202
206
|
*/
|
|
203
207
|
import(input) {
|
|
204
208
|
const { projectId, ...workflowJson } = input;
|
|
@@ -465,7 +469,8 @@ var DeveloperAppsResource = class {
|
|
|
465
469
|
{ body: input }
|
|
466
470
|
);
|
|
467
471
|
}
|
|
468
|
-
/** Delete a developer app. Returns `{ success: true }`.
|
|
472
|
+
/** Delete a developer app. Returns `{ success: true }`. Throws
|
|
473
|
+
* `NotFoundError` when the id doesn't exist or isn't yours. */
|
|
469
474
|
delete(id) {
|
|
470
475
|
return this.client.request(
|
|
471
476
|
"DELETE",
|
|
@@ -1802,6 +1807,30 @@ var MediaResource = class {
|
|
|
1802
1807
|
trimAudio(input) {
|
|
1803
1808
|
return this.client.request("POST", "/v1/trim-audio", { body: input });
|
|
1804
1809
|
}
|
|
1810
|
+
/**
|
|
1811
|
+
* Turn one still image + one audio track into an MP4
|
|
1812
|
+
* (`POST /v1/still-to-video`) — locally rendered (FFmpeg), no AI model,
|
|
1813
|
+
* zero credits. The output duration IS the audio's duration; there is no
|
|
1814
|
+
* duration field. Optional `motion` animates the still (zoom / pan /
|
|
1815
|
+
* ken-burns) at `intensity` 1–10. `fit: "contain"` letterboxes with
|
|
1816
|
+
* `padColor` instead of cropping. Poll `jobs.get(jobId)`.
|
|
1817
|
+
*/
|
|
1818
|
+
stillToVideo(input) {
|
|
1819
|
+
return this.client.request("POST", "/v1/still-to-video", { body: input });
|
|
1820
|
+
}
|
|
1821
|
+
/**
|
|
1822
|
+
* Turn 2–100 images + one optional audio track into an MP4 slideshow
|
|
1823
|
+
* (`POST /v1/slideshow`) — locally rendered (FFmpeg), zero credits. With
|
|
1824
|
+
* audio, the output duration IS the audio's duration (equal split unless
|
|
1825
|
+
* `imageDurations` pins rows — null entries = auto; mismatched pinned sums
|
|
1826
|
+
* scale proportionally and the factor is disclosed in the job output).
|
|
1827
|
+
* Without audio: N × `perImageDuration`, silent output. Transitions
|
|
1828
|
+
* consume the outgoing slide, so totals stay exact. For a single image use
|
|
1829
|
+
* `stillToVideo`. Poll `jobs.get(jobId)`.
|
|
1830
|
+
*/
|
|
1831
|
+
slideshow(input) {
|
|
1832
|
+
return this.client.request("POST", "/v1/slideshow", { body: input });
|
|
1833
|
+
}
|
|
1805
1834
|
/**
|
|
1806
1835
|
* Probe a social video's metadata (`POST /v1/video-metadata`) — duration,
|
|
1807
1836
|
* dimensions, title, live status — WITHOUT downloading it. A direct read, not a
|
|
@@ -2042,6 +2071,107 @@ var ModelsResource = class {
|
|
|
2042
2071
|
}
|
|
2043
2072
|
};
|
|
2044
2073
|
|
|
2074
|
+
// src/resources/shots.ts
|
|
2075
|
+
var ShotsResource = class {
|
|
2076
|
+
constructor(client) {
|
|
2077
|
+
this.client = client;
|
|
2078
|
+
}
|
|
2079
|
+
client;
|
|
2080
|
+
/** Create a shot record. Returns the new shot's id — an unguessable
|
|
2081
|
+
* capability string that doubles as the share-link path segment. */
|
|
2082
|
+
create(input = {}) {
|
|
2083
|
+
return this.client.request("POST", "/v1/shots", { body: input });
|
|
2084
|
+
}
|
|
2085
|
+
/** Read a shot. Public shots are readable by anyone holding the id;
|
|
2086
|
+
* private shots resolve only for their owner (404 otherwise). */
|
|
2087
|
+
get(id) {
|
|
2088
|
+
return this.client.request("GET", `/v1/shots/${encodeURIComponent(id)}`);
|
|
2089
|
+
}
|
|
2090
|
+
/** Update an owned shot (any subset of fields, e.g. a visibility toggle). */
|
|
2091
|
+
update(id, input) {
|
|
2092
|
+
return this.client.request("PATCH", `/v1/shots/${encodeURIComponent(id)}`, { body: input });
|
|
2093
|
+
}
|
|
2094
|
+
/** Delete an owned shot. */
|
|
2095
|
+
async delete(id) {
|
|
2096
|
+
await this.client.request("DELETE", `/v1/shots/${encodeURIComponent(id)}`);
|
|
2097
|
+
}
|
|
2098
|
+
};
|
|
2099
|
+
|
|
2100
|
+
// src/resources/recast.ts
|
|
2101
|
+
var RecastResource = class {
|
|
2102
|
+
constructor(client) {
|
|
2103
|
+
this.client = client;
|
|
2104
|
+
}
|
|
2105
|
+
client;
|
|
2106
|
+
// ── Authored-script lane (all three endpoints are free) ────────────────
|
|
2107
|
+
/** The generated authoring guide (markdown): document contract, enum
|
|
2108
|
+
* vocabularies, bounds, audio rules, and a validated worked example. */
|
|
2109
|
+
async authoringSkill() {
|
|
2110
|
+
const res = await this.client.request(
|
|
2111
|
+
"GET",
|
|
2112
|
+
"/v1/video-analysis/authoring-skill"
|
|
2113
|
+
);
|
|
2114
|
+
return res.markdown ?? "";
|
|
2115
|
+
}
|
|
2116
|
+
/** FREE validation of an authored script. Loop until `valid: true`. */
|
|
2117
|
+
validateScript(script) {
|
|
2118
|
+
return this.client.request("POST", "/v1/video-analysis/import/validate", {
|
|
2119
|
+
body: { script }
|
|
2120
|
+
});
|
|
2121
|
+
}
|
|
2122
|
+
/**
|
|
2123
|
+
* Import a VALIDATED authored script as a completed analysis job.
|
|
2124
|
+
* `rightsAttested: true` is required (403 otherwise) — authored recasts
|
|
2125
|
+
* render Faithful, exactly as written, so only import work you own.
|
|
2126
|
+
*/
|
|
2127
|
+
importScript(script, opts) {
|
|
2128
|
+
return this.client.request("POST", "/v1/video-analysis/import", {
|
|
2129
|
+
body: { script, rightsAttested: opts.rightsAttested }
|
|
2130
|
+
});
|
|
2131
|
+
}
|
|
2132
|
+
// ── Run lane ───────────────────────────────────────────────────────────
|
|
2133
|
+
/** Quote a run (credits) before buying the plan. */
|
|
2134
|
+
estimate(input) {
|
|
2135
|
+
return this.client.request("POST", "/v1/recast/estimate", { body: input });
|
|
2136
|
+
}
|
|
2137
|
+
/** Create a run (buys the plan). Returns `{ recastId }`. */
|
|
2138
|
+
create(input) {
|
|
2139
|
+
return this.client.request("POST", "/v1/recast", { body: input });
|
|
2140
|
+
}
|
|
2141
|
+
/** Poll the run — status plus any pending interactive step. */
|
|
2142
|
+
get(recastId) {
|
|
2143
|
+
return this.client.request("GET", `/v1/recast/${encodeURIComponent(recastId)}`);
|
|
2144
|
+
}
|
|
2145
|
+
/** Quote a revisioned Music replacement and/or complete desired mix. Free. */
|
|
2146
|
+
estimateRescore(recastId, input) {
|
|
2147
|
+
return this.client.request(
|
|
2148
|
+
"POST",
|
|
2149
|
+
`/v1/recast/${encodeURIComponent(recastId)}/estimate-rescore`,
|
|
2150
|
+
{ body: input }
|
|
2151
|
+
);
|
|
2152
|
+
}
|
|
2153
|
+
/** Apply a quoted audio operation. Reuse its request id only for a transport retry. */
|
|
2154
|
+
rescore(recastId, input) {
|
|
2155
|
+
return this.client.request(
|
|
2156
|
+
"POST",
|
|
2157
|
+
`/v1/recast/${encodeURIComponent(recastId)}/rescore`,
|
|
2158
|
+
{ body: input }
|
|
2159
|
+
);
|
|
2160
|
+
}
|
|
2161
|
+
/** Start rendering a `planned` run. Idempotent server-side. */
|
|
2162
|
+
start(recastId, opts = {}) {
|
|
2163
|
+
return this.client.request("POST", `/v1/recast/${encodeURIComponent(recastId)}/start`, {
|
|
2164
|
+
body: opts
|
|
2165
|
+
});
|
|
2166
|
+
}
|
|
2167
|
+
/** Answer a pending interactive gate (the pick itself is free). */
|
|
2168
|
+
resolveGate(recastId, input) {
|
|
2169
|
+
return this.client.request("POST", `/v1/recast/${encodeURIComponent(recastId)}/select`, {
|
|
2170
|
+
body: input
|
|
2171
|
+
});
|
|
2172
|
+
}
|
|
2173
|
+
};
|
|
2174
|
+
|
|
2045
2175
|
// src/resources/community.ts
|
|
2046
2176
|
var CommunityResource = class {
|
|
2047
2177
|
constructor(client) {
|
|
@@ -2194,11 +2324,204 @@ var TutorialsResource = class {
|
|
|
2194
2324
|
}
|
|
2195
2325
|
};
|
|
2196
2326
|
|
|
2197
|
-
// src/
|
|
2198
|
-
var
|
|
2327
|
+
// src/resources/organizations.ts
|
|
2328
|
+
var OrganizationsResource = class {
|
|
2329
|
+
constructor(client) {
|
|
2330
|
+
this.client = client;
|
|
2331
|
+
}
|
|
2332
|
+
client;
|
|
2333
|
+
/** The organizations this account belongs to. */
|
|
2334
|
+
list() {
|
|
2335
|
+
return this.client.request("GET", "/v1/orgs");
|
|
2336
|
+
}
|
|
2337
|
+
get(id) {
|
|
2338
|
+
return this.client.request("GET", `/v1/orgs/${encodeURIComponent(id)}`);
|
|
2339
|
+
}
|
|
2340
|
+
/**
|
|
2341
|
+
* Create an organization. On instances that require it, `acceptTerms` must
|
|
2342
|
+
* be true or the server answers `terms_required` — the SDK does not decide
|
|
2343
|
+
* whether terms apply, because only the instance knows.
|
|
2344
|
+
*
|
|
2345
|
+
* A new organization may come back `pending`: some instances hold new
|
|
2346
|
+
* organizations for a platform admin to approve, and a pending one grants
|
|
2347
|
+
* nothing until it is active.
|
|
2348
|
+
*/
|
|
2349
|
+
create(input) {
|
|
2350
|
+
return this.client.request("POST", "/v1/orgs", { body: input });
|
|
2351
|
+
}
|
|
2352
|
+
update(id, input) {
|
|
2353
|
+
return this.client.request("PATCH", `/v1/orgs/${encodeURIComponent(id)}`, { body: input });
|
|
2354
|
+
}
|
|
2355
|
+
/** Soft-delete. The organization stops granting context; nothing is destroyed. */
|
|
2356
|
+
delete(id) {
|
|
2357
|
+
return this.client.request("DELETE", `/v1/orgs/${encodeURIComponent(id)}`);
|
|
2358
|
+
}
|
|
2359
|
+
/** Hand the organization to another member. The caller becomes an admin. */
|
|
2360
|
+
transferOwnership(id, userId) {
|
|
2361
|
+
return this.client.request("POST", `/v1/orgs/${encodeURIComponent(id)}/transfer-ownership`, {
|
|
2362
|
+
body: { userId }
|
|
2363
|
+
});
|
|
2364
|
+
}
|
|
2365
|
+
/** Leave. An owner cannot — transfer ownership first (`owner_cannot_leave`). */
|
|
2366
|
+
leave(id) {
|
|
2367
|
+
return this.client.request("POST", `/v1/orgs/${encodeURIComponent(id)}/leave`);
|
|
2368
|
+
}
|
|
2369
|
+
// -- members --------------------------------------------------------------
|
|
2370
|
+
listMembers(orgId, opts = {}) {
|
|
2371
|
+
return this.client.request("GET", `/v1/orgs/${encodeURIComponent(orgId)}/members`, { query: { ...opts } });
|
|
2372
|
+
}
|
|
2373
|
+
updateMember(orgId, userId, input) {
|
|
2374
|
+
return this.client.request(
|
|
2375
|
+
"PATCH",
|
|
2376
|
+
`/v1/orgs/${encodeURIComponent(orgId)}/members/${encodeURIComponent(userId)}`,
|
|
2377
|
+
{ body: input }
|
|
2378
|
+
);
|
|
2379
|
+
}
|
|
2380
|
+
removeMember(orgId, userId) {
|
|
2381
|
+
return this.client.request(
|
|
2382
|
+
"DELETE",
|
|
2383
|
+
`/v1/orgs/${encodeURIComponent(orgId)}/members/${encodeURIComponent(userId)}`
|
|
2384
|
+
);
|
|
2385
|
+
}
|
|
2386
|
+
// -- invitations ----------------------------------------------------------
|
|
2387
|
+
/**
|
|
2388
|
+
* Invite by email. Returns ONE ROW PER ADDRESS, and a row whose `status` is
|
|
2389
|
+
* not `sent` carries a `link` instead.
|
|
2390
|
+
*
|
|
2391
|
+
* Surface that link. An install with no mail provider — every fresh
|
|
2392
|
+
* self-host — delivers nothing, and an integration that reports "invited"
|
|
2393
|
+
* without showing the link creates invitations nobody can ever reach.
|
|
2394
|
+
*/
|
|
2395
|
+
invite(orgId, input) {
|
|
2396
|
+
return this.client.request("POST", `/v1/orgs/${encodeURIComponent(orgId)}/invitations`, { body: input });
|
|
2397
|
+
}
|
|
2398
|
+
listInvitations(orgId, opts = {}) {
|
|
2399
|
+
return this.client.request("GET", `/v1/orgs/${encodeURIComponent(orgId)}/invitations`, {
|
|
2400
|
+
query: { ...opts }
|
|
2401
|
+
});
|
|
2402
|
+
}
|
|
2403
|
+
revokeInvitation(id) {
|
|
2404
|
+
return this.client.request("DELETE", `/v1/invitations/${encodeURIComponent(id)}`);
|
|
2405
|
+
}
|
|
2406
|
+
resendInvitation(id) {
|
|
2407
|
+
return this.client.request("POST", `/v1/invitations/${encodeURIComponent(id)}/resend`);
|
|
2408
|
+
}
|
|
2409
|
+
/**
|
|
2410
|
+
* What an invitee sees before signing in — the one organization read that
|
|
2411
|
+
* needs no token, so it works while the recipient is still signed out.
|
|
2412
|
+
*/
|
|
2413
|
+
previewInvitation(token) {
|
|
2414
|
+
return this.client.request("GET", `/v1/invitations/by-token/${encodeURIComponent(token)}`);
|
|
2415
|
+
}
|
|
2416
|
+
/** Accept. Requires an authenticated caller whose email matches the invite. */
|
|
2417
|
+
acceptInvitation(token) {
|
|
2418
|
+
return this.client.request("POST", `/v1/invitations/${encodeURIComponent(token)}/accept`);
|
|
2419
|
+
}
|
|
2420
|
+
// -- audit ----------------------------------------------------------------
|
|
2421
|
+
/**
|
|
2422
|
+
* The organization's audit log, newest first. Owner and admins only, and
|
|
2423
|
+
* readable while the organization is suspended — the record of what
|
|
2424
|
+
* happened is exactly what someone needs when things have gone wrong.
|
|
2425
|
+
*/
|
|
2426
|
+
audit(orgId, opts = {}) {
|
|
2427
|
+
return this.client.request("GET", `/v1/orgs/${encodeURIComponent(orgId)}/audit`, { query: { ...opts } });
|
|
2428
|
+
}
|
|
2429
|
+
};
|
|
2430
|
+
|
|
2431
|
+
// src/resources/workspaces.ts
|
|
2432
|
+
var WorkspacesResource = class {
|
|
2433
|
+
constructor(client) {
|
|
2434
|
+
this.client = client;
|
|
2435
|
+
}
|
|
2436
|
+
client;
|
|
2437
|
+
/**
|
|
2438
|
+
* Every workspace this account belongs to, across all its organizations.
|
|
2439
|
+
*
|
|
2440
|
+
* An identity read: a stale workspace binding cannot lock a caller out of
|
|
2441
|
+
* it, which is what makes it safe to call when a selection has gone bad.
|
|
2442
|
+
*
|
|
2443
|
+
* Byte-for-byte the list `GET /v1/me` carries, so a client reconciles
|
|
2444
|
+
* against one truth rather than two. That is why these are SUMMARIES —
|
|
2445
|
+
* enough to render a switcher, not the full view; use {@link get} for that.
|
|
2446
|
+
*/
|
|
2447
|
+
list() {
|
|
2448
|
+
return this.client.request("GET", "/v1/workspaces");
|
|
2449
|
+
}
|
|
2450
|
+
listForOrg(orgId, opts = {}) {
|
|
2451
|
+
return this.client.request("GET", `/v1/orgs/${encodeURIComponent(orgId)}/workspaces`, {
|
|
2452
|
+
query: { includeArchived: opts.includeArchived }
|
|
2453
|
+
});
|
|
2454
|
+
}
|
|
2455
|
+
get(id) {
|
|
2456
|
+
return this.client.request("GET", `/v1/workspaces/${encodeURIComponent(id)}`);
|
|
2457
|
+
}
|
|
2458
|
+
create(orgId, input) {
|
|
2459
|
+
return this.client.request("POST", `/v1/orgs/${encodeURIComponent(orgId)}/workspaces`, { body: input });
|
|
2460
|
+
}
|
|
2461
|
+
update(id, input) {
|
|
2462
|
+
return this.client.request("PATCH", `/v1/workspaces/${encodeURIComponent(id)}`, { body: input });
|
|
2463
|
+
}
|
|
2464
|
+
/**
|
|
2465
|
+
* Archive or restore. Archiving is REVERSIBLE and destroys nothing: the
|
|
2466
|
+
* workspace stops accepting new work and stays fully readable, which is
|
|
2467
|
+
* what a finished class term needs and a delete would not survive.
|
|
2468
|
+
*/
|
|
2469
|
+
setArchived(id, archived) {
|
|
2470
|
+
return this.client.request(
|
|
2471
|
+
"POST",
|
|
2472
|
+
`/v1/workspaces/${encodeURIComponent(id)}/${archived ? "archive" : "unarchive"}`
|
|
2473
|
+
);
|
|
2474
|
+
}
|
|
2475
|
+
// -- members --------------------------------------------------------------
|
|
2476
|
+
listMembers(id, opts = {}) {
|
|
2477
|
+
return this.client.request("GET", `/v1/workspaces/${encodeURIComponent(id)}/members`, {
|
|
2478
|
+
query: { ...opts }
|
|
2479
|
+
});
|
|
2480
|
+
}
|
|
2481
|
+
/** Add someone who is ALREADY in the organization. To bring in a new person, invite them. */
|
|
2482
|
+
addMember(id, input) {
|
|
2483
|
+
return this.client.request("POST", `/v1/workspaces/${encodeURIComponent(id)}/members`, { body: input });
|
|
2484
|
+
}
|
|
2485
|
+
updateMember(id, userId, input) {
|
|
2486
|
+
return this.client.request(
|
|
2487
|
+
"PATCH",
|
|
2488
|
+
`/v1/workspaces/${encodeURIComponent(id)}/members/${encodeURIComponent(userId)}`,
|
|
2489
|
+
{ body: input }
|
|
2490
|
+
);
|
|
2491
|
+
}
|
|
2492
|
+
removeMember(id, userId) {
|
|
2493
|
+
return this.client.request(
|
|
2494
|
+
"DELETE",
|
|
2495
|
+
`/v1/workspaces/${encodeURIComponent(id)}/members/${encodeURIComponent(userId)}`
|
|
2496
|
+
);
|
|
2497
|
+
}
|
|
2498
|
+
// -- join codes -----------------------------------------------------------
|
|
2499
|
+
/** The workspace's join code, or `null` if none has been created. Admins only. */
|
|
2500
|
+
getJoinCode(id) {
|
|
2501
|
+
return this.client.request("GET", `/v1/workspaces/${encodeURIComponent(id)}/join-code`);
|
|
2502
|
+
}
|
|
2503
|
+
/**
|
|
2504
|
+
* Rotate, enable or disable the code. Rotating invalidates the old one
|
|
2505
|
+
* immediately — that is the point of it, and anyone still holding a link
|
|
2506
|
+
* with the old code will be refused.
|
|
2507
|
+
*/
|
|
2508
|
+
actOnJoinCode(id, action) {
|
|
2509
|
+
return this.client.request("POST", `/v1/workspaces/${encodeURIComponent(id)}/join-code`, {
|
|
2510
|
+
body: { action }
|
|
2511
|
+
});
|
|
2512
|
+
}
|
|
2513
|
+
/**
|
|
2514
|
+
* Join by code. Another way IN, so a stale workspace binding must not block
|
|
2515
|
+
* it — the server treats this as an identity route for that reason.
|
|
2516
|
+
*/
|
|
2517
|
+
join(code) {
|
|
2518
|
+
return this.client.request("POST", "/v1/workspaces/join", { body: { code } });
|
|
2519
|
+
}
|
|
2520
|
+
};
|
|
2521
|
+
var SDK_VERSION = "1.19.0" ;
|
|
2199
2522
|
var CLIENT_HEADER = "X-Nodaro-Client";
|
|
2200
2523
|
var isBrowser = () => typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
2201
|
-
var NodaroClient = class {
|
|
2524
|
+
var NodaroClient = class _NodaroClient {
|
|
2202
2525
|
baseUrl;
|
|
2203
2526
|
auth;
|
|
2204
2527
|
timeoutMs;
|
|
@@ -2241,15 +2564,22 @@ var NodaroClient = class {
|
|
|
2241
2564
|
presets;
|
|
2242
2565
|
pickerCatalogs;
|
|
2243
2566
|
models;
|
|
2567
|
+
shots;
|
|
2568
|
+
recast;
|
|
2244
2569
|
community;
|
|
2245
2570
|
templates;
|
|
2246
2571
|
tutorials;
|
|
2572
|
+
organizations;
|
|
2573
|
+
workspaces;
|
|
2574
|
+
/** The workspace this client acts in; undefined = the personal space. */
|
|
2575
|
+
workspaceId;
|
|
2247
2576
|
constructor(opts) {
|
|
2248
2577
|
this.baseUrl = opts.baseUrl.replace(/\/$/, "");
|
|
2249
2578
|
this.auth = opts.auth;
|
|
2250
2579
|
this.fetchOverride = opts.fetch;
|
|
2251
2580
|
this.timeoutMs = opts.timeoutMs ?? 6e4;
|
|
2252
2581
|
this.clientLabel = opts.clientLabel ?? `sdk/${SDK_VERSION}`;
|
|
2582
|
+
this.workspaceId = opts.workspaceId;
|
|
2253
2583
|
this.sendClientHeader = opts.clientLabel !== void 0 || !isBrowser();
|
|
2254
2584
|
this.workflows = new WorkflowsResource(this);
|
|
2255
2585
|
this.projects = new ProjectsResource(this);
|
|
@@ -2276,9 +2606,34 @@ var NodaroClient = class {
|
|
|
2276
2606
|
this.presets = new PresetsResource(this);
|
|
2277
2607
|
this.pickerCatalogs = new PickerCatalogsResource(this);
|
|
2278
2608
|
this.models = new ModelsResource(this);
|
|
2609
|
+
this.shots = new ShotsResource(this);
|
|
2610
|
+
this.recast = new RecastResource(this);
|
|
2279
2611
|
this.community = new CommunityResource(this);
|
|
2280
2612
|
this.templates = new TemplatesResource(this);
|
|
2281
2613
|
this.tutorials = new TutorialsResource(this);
|
|
2614
|
+
this.organizations = new OrganizationsResource(this);
|
|
2615
|
+
this.workspaces = new WorkspacesResource(this);
|
|
2616
|
+
}
|
|
2617
|
+
/**
|
|
2618
|
+
* A client that acts in `workspaceId`, sharing this one's auth and config.
|
|
2619
|
+
*
|
|
2620
|
+
* A NEW client rather than a setter, deliberately. A mutable selection is
|
|
2621
|
+
* the bug this whole axis exists to prevent: two concurrent operations
|
|
2622
|
+
* against one client would race over which workspace they were in, and the
|
|
2623
|
+
* loser would create work in the wrong place with nothing failing. A
|
|
2624
|
+
* per-workspace client cannot be raced.
|
|
2625
|
+
*
|
|
2626
|
+
* Pass `null` for the personal space.
|
|
2627
|
+
*/
|
|
2628
|
+
withWorkspace(workspaceId) {
|
|
2629
|
+
return new _NodaroClient({
|
|
2630
|
+
baseUrl: this.baseUrl,
|
|
2631
|
+
auth: this.auth,
|
|
2632
|
+
timeoutMs: this.timeoutMs,
|
|
2633
|
+
...this.fetchOverride ? { fetch: this.fetchOverride } : {},
|
|
2634
|
+
...this.sendClientHeader ? { clientLabel: this.clientLabel } : {},
|
|
2635
|
+
...workspaceId ? { workspaceId } : {}
|
|
2636
|
+
});
|
|
2282
2637
|
}
|
|
2283
2638
|
async request(method, path, options = {}) {
|
|
2284
2639
|
const url = this.buildUrl(path, options.query);
|
|
@@ -2287,6 +2642,9 @@ var NodaroClient = class {
|
|
|
2287
2642
|
const headers = {
|
|
2288
2643
|
...isFormData ? {} : { "Content-Type": "application/json" },
|
|
2289
2644
|
...this.sendClientHeader ? { [CLIENT_HEADER]: this.clientLabel } : {},
|
|
2645
|
+
// Before per-request headers: a resource that needs to reach outside
|
|
2646
|
+
// this client's workspace says so explicitly and wins.
|
|
2647
|
+
...this.workspaceId ? { [shared.WORKSPACE_HEADER]: this.workspaceId } : {},
|
|
2290
2648
|
...options.headers ?? {}
|
|
2291
2649
|
};
|
|
2292
2650
|
if (token) headers["Authorization"] = `Bearer ${token}`;
|
|
@@ -2320,6 +2678,14 @@ var NodaroClient = class {
|
|
|
2320
2678
|
* `GET /v1/me` → the authenticated user's identity (see {@link UserIdentity}).
|
|
2321
2679
|
* Unwraps the `{ data }` envelope. Throws `UnauthorizedError` (401) when the
|
|
2322
2680
|
* token is missing/invalid, and the SDK's other typed errors as usual.
|
|
2681
|
+
*
|
|
2682
|
+
* On an instance with organizations it also carries what the caller belongs
|
|
2683
|
+
* to. THREE states, and collapsing them is wrong in a way users feel: the
|
|
2684
|
+
* organization fields ABSENT means this instance has no organizations at
|
|
2685
|
+
* all; present and empty means the account belongs to none; and
|
|
2686
|
+
* `organizationsUnavailable` means the lookup failed — keep whatever
|
|
2687
|
+
* selection you already had rather than concluding the person was removed
|
|
2688
|
+
* from everything.
|
|
2323
2689
|
*/
|
|
2324
2690
|
async me() {
|
|
2325
2691
|
const res = await this.request("GET", "/v1/me");
|
|
@@ -2439,6 +2805,10 @@ Object.defineProperty(exports, "SURROUND_DIRECTIONS", {
|
|
|
2439
2805
|
enumerable: true,
|
|
2440
2806
|
get: function () { return shared.SURROUND_DIRECTIONS; }
|
|
2441
2807
|
});
|
|
2808
|
+
Object.defineProperty(exports, "WORKSPACE_HEADER", {
|
|
2809
|
+
enumerable: true,
|
|
2810
|
+
get: function () { return shared.WORKSPACE_HEADER; }
|
|
2811
|
+
});
|
|
2442
2812
|
exports.AppsResource = AppsResource;
|
|
2443
2813
|
exports.AudioResource = AudioResource;
|
|
2444
2814
|
exports.CREATURE_ASSET_TYPES = CREATURE_ASSET_TYPES;
|
|
@@ -2465,13 +2835,16 @@ exports.NodesResource = NodesResource;
|
|
|
2465
2835
|
exports.NotFoundError = NotFoundError;
|
|
2466
2836
|
exports.OAuthResource = OAuthResource;
|
|
2467
2837
|
exports.ObjectsResource = ObjectsResource;
|
|
2838
|
+
exports.OrganizationsResource = OrganizationsResource;
|
|
2468
2839
|
exports.PickerCatalogsResource = PickerCatalogsResource;
|
|
2469
2840
|
exports.PipelinesResource = PipelinesResource;
|
|
2470
2841
|
exports.PresetsResource = PresetsResource;
|
|
2471
2842
|
exports.ProjectsResource = ProjectsResource;
|
|
2472
2843
|
exports.PromptHelperResource = PromptHelperResource;
|
|
2473
2844
|
exports.RateLimitedError = RateLimitedError;
|
|
2845
|
+
exports.RecastResource = RecastResource;
|
|
2474
2846
|
exports.ReduceResource = ReduceResource;
|
|
2847
|
+
exports.ShotsResource = ShotsResource;
|
|
2475
2848
|
exports.StaticTokenAuth = StaticTokenAuth;
|
|
2476
2849
|
exports.StorageExceededError = StorageExceededError;
|
|
2477
2850
|
exports.TemplatesResource = TemplatesResource;
|
|
@@ -2482,6 +2855,7 @@ exports.VideoProResource = VideoProResource;
|
|
|
2482
2855
|
exports.VoicesResource = VoicesResource;
|
|
2483
2856
|
exports.WorkflowConflictError = WorkflowConflictError;
|
|
2484
2857
|
exports.WorkflowsResource = WorkflowsResource;
|
|
2858
|
+
exports.WorkspacesResource = WorkspacesResource;
|
|
2485
2859
|
exports.buildPersonSeedPrompt = buildPersonSeedPrompt;
|
|
2486
2860
|
exports.createClient = createClient;
|
|
2487
2861
|
exports.supabaseAuth = supabaseAuth;
|