@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/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { buildPersonHints } from '@nodaro/prompts';
|
|
2
2
|
export { PEOPLE, PERSON_DIMENSION_LABELS, PERSON_DIMENSION_ORDER, buildPersonHints } from '@nodaro/prompts';
|
|
3
|
-
|
|
3
|
+
import { WORKSPACE_HEADER } from '@nodaro/shared';
|
|
4
|
+
export { CHARACTER_ASPECT_DEFAULTS, CHARACTER_ASPECT_OPTIONS, CHARACTER_STYLES, OBJECT_ASPECT_DEFAULTS as CREATURE_ASPECT_DEFAULTS, OBJECT_ASPECT_OPTIONS as CREATURE_ASPECT_OPTIONS, CREATURE_ATTACH_COLUMNS, LOCATION_ASSET_TYPES, LOCATION_ATTACH_COLUMNS, OBJECT_ASPECT_DEFAULTS, OBJECT_ASPECT_OPTIONS, OBJECT_ASSET_TYPES, OBJECT_ATTACH_COLUMNS, SURROUND_DIRECTIONS, WORKSPACE_HEADER } from '@nodaro/shared';
|
|
4
5
|
|
|
5
6
|
// src/errors.ts
|
|
6
7
|
var NodaroError = class extends Error {
|
|
@@ -169,7 +170,8 @@ var WorkflowsResource = class {
|
|
|
169
170
|
{ body: input }
|
|
170
171
|
);
|
|
171
172
|
}
|
|
172
|
-
/** 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). */
|
|
173
175
|
delete(id) {
|
|
174
176
|
return this.client.request("DELETE", `/v1/workflows/${encodeURIComponent(id)}`);
|
|
175
177
|
}
|
|
@@ -198,6 +200,9 @@ var WorkflowsResource = class {
|
|
|
198
200
|
/**
|
|
199
201
|
* Import a `WorkflowExport` bundle into the specified project.
|
|
200
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).
|
|
201
206
|
*/
|
|
202
207
|
import(input) {
|
|
203
208
|
const { projectId, ...workflowJson } = input;
|
|
@@ -464,7 +469,8 @@ var DeveloperAppsResource = class {
|
|
|
464
469
|
{ body: input }
|
|
465
470
|
);
|
|
466
471
|
}
|
|
467
|
-
/** 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. */
|
|
468
474
|
delete(id) {
|
|
469
475
|
return this.client.request(
|
|
470
476
|
"DELETE",
|
|
@@ -1801,6 +1807,30 @@ var MediaResource = class {
|
|
|
1801
1807
|
trimAudio(input) {
|
|
1802
1808
|
return this.client.request("POST", "/v1/trim-audio", { body: input });
|
|
1803
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
|
+
}
|
|
1804
1834
|
/**
|
|
1805
1835
|
* Probe a social video's metadata (`POST /v1/video-metadata`) — duration,
|
|
1806
1836
|
* dimensions, title, live status — WITHOUT downloading it. A direct read, not a
|
|
@@ -2041,6 +2071,107 @@ var ModelsResource = class {
|
|
|
2041
2071
|
}
|
|
2042
2072
|
};
|
|
2043
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
|
+
|
|
2044
2175
|
// src/resources/community.ts
|
|
2045
2176
|
var CommunityResource = class {
|
|
2046
2177
|
constructor(client) {
|
|
@@ -2193,11 +2324,204 @@ var TutorialsResource = class {
|
|
|
2193
2324
|
}
|
|
2194
2325
|
};
|
|
2195
2326
|
|
|
2196
|
-
// src/
|
|
2197
|
-
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" ;
|
|
2198
2522
|
var CLIENT_HEADER = "X-Nodaro-Client";
|
|
2199
2523
|
var isBrowser = () => typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
2200
|
-
var NodaroClient = class {
|
|
2524
|
+
var NodaroClient = class _NodaroClient {
|
|
2201
2525
|
baseUrl;
|
|
2202
2526
|
auth;
|
|
2203
2527
|
timeoutMs;
|
|
@@ -2240,15 +2564,22 @@ var NodaroClient = class {
|
|
|
2240
2564
|
presets;
|
|
2241
2565
|
pickerCatalogs;
|
|
2242
2566
|
models;
|
|
2567
|
+
shots;
|
|
2568
|
+
recast;
|
|
2243
2569
|
community;
|
|
2244
2570
|
templates;
|
|
2245
2571
|
tutorials;
|
|
2572
|
+
organizations;
|
|
2573
|
+
workspaces;
|
|
2574
|
+
/** The workspace this client acts in; undefined = the personal space. */
|
|
2575
|
+
workspaceId;
|
|
2246
2576
|
constructor(opts) {
|
|
2247
2577
|
this.baseUrl = opts.baseUrl.replace(/\/$/, "");
|
|
2248
2578
|
this.auth = opts.auth;
|
|
2249
2579
|
this.fetchOverride = opts.fetch;
|
|
2250
2580
|
this.timeoutMs = opts.timeoutMs ?? 6e4;
|
|
2251
2581
|
this.clientLabel = opts.clientLabel ?? `sdk/${SDK_VERSION}`;
|
|
2582
|
+
this.workspaceId = opts.workspaceId;
|
|
2252
2583
|
this.sendClientHeader = opts.clientLabel !== void 0 || !isBrowser();
|
|
2253
2584
|
this.workflows = new WorkflowsResource(this);
|
|
2254
2585
|
this.projects = new ProjectsResource(this);
|
|
@@ -2275,9 +2606,34 @@ var NodaroClient = class {
|
|
|
2275
2606
|
this.presets = new PresetsResource(this);
|
|
2276
2607
|
this.pickerCatalogs = new PickerCatalogsResource(this);
|
|
2277
2608
|
this.models = new ModelsResource(this);
|
|
2609
|
+
this.shots = new ShotsResource(this);
|
|
2610
|
+
this.recast = new RecastResource(this);
|
|
2278
2611
|
this.community = new CommunityResource(this);
|
|
2279
2612
|
this.templates = new TemplatesResource(this);
|
|
2280
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
|
+
});
|
|
2281
2637
|
}
|
|
2282
2638
|
async request(method, path, options = {}) {
|
|
2283
2639
|
const url = this.buildUrl(path, options.query);
|
|
@@ -2286,6 +2642,9 @@ var NodaroClient = class {
|
|
|
2286
2642
|
const headers = {
|
|
2287
2643
|
...isFormData ? {} : { "Content-Type": "application/json" },
|
|
2288
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 ? { [WORKSPACE_HEADER]: this.workspaceId } : {},
|
|
2289
2648
|
...options.headers ?? {}
|
|
2290
2649
|
};
|
|
2291
2650
|
if (token) headers["Authorization"] = `Bearer ${token}`;
|
|
@@ -2319,6 +2678,14 @@ var NodaroClient = class {
|
|
|
2319
2678
|
* `GET /v1/me` → the authenticated user's identity (see {@link UserIdentity}).
|
|
2320
2679
|
* Unwraps the `{ data }` envelope. Throws `UnauthorizedError` (401) when the
|
|
2321
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.
|
|
2322
2689
|
*/
|
|
2323
2690
|
async me() {
|
|
2324
2691
|
const res = await this.request("GET", "/v1/me");
|
|
@@ -2370,6 +2737,6 @@ function supabaseAuth(supabase) {
|
|
|
2370
2737
|
};
|
|
2371
2738
|
}
|
|
2372
2739
|
|
|
2373
|
-
export { AppsResource, AudioResource, CREATURE_ASSET_TYPES, CallbackAuth, CharactersResource, CommunityResource, CreaturesResource, CreditsResource, DeveloperAppsResource, ExecutionsResource, ForbiddenError, InsufficientCreditsError, JobAbortedError, JobFailedError, JobTimeoutError, JobsResource, LibraryResource, LocationsResource, MediaResource, ModelsResource, NodaroClient, NodaroError, NodesResource, NotFoundError, OAuthResource, ObjectsResource, PickerCatalogsResource, PipelinesResource, PresetsResource, ProjectsResource, PromptHelperResource, RateLimitedError, ReduceResource, StaticTokenAuth, StorageExceededError, TemplatesResource, TutorialsResource, UnauthorizedError, UploadsResource, VideoProResource, VoicesResource, WorkflowConflictError, WorkflowsResource, buildPersonSeedPrompt, createClient, supabaseAuth, throwFromResponse };
|
|
2740
|
+
export { AppsResource, AudioResource, CREATURE_ASSET_TYPES, CallbackAuth, CharactersResource, CommunityResource, CreaturesResource, CreditsResource, DeveloperAppsResource, ExecutionsResource, ForbiddenError, InsufficientCreditsError, JobAbortedError, JobFailedError, JobTimeoutError, JobsResource, LibraryResource, LocationsResource, MediaResource, ModelsResource, NodaroClient, NodaroError, NodesResource, NotFoundError, OAuthResource, ObjectsResource, OrganizationsResource, PickerCatalogsResource, PipelinesResource, PresetsResource, ProjectsResource, PromptHelperResource, RateLimitedError, RecastResource, ReduceResource, ShotsResource, StaticTokenAuth, StorageExceededError, TemplatesResource, TutorialsResource, UnauthorizedError, UploadsResource, VideoProResource, VoicesResource, WorkflowConflictError, WorkflowsResource, WorkspacesResource, buildPersonSeedPrompt, createClient, supabaseAuth, throwFromResponse };
|
|
2374
2741
|
//# sourceMappingURL=index.js.map
|
|
2375
2742
|
//# sourceMappingURL=index.js.map
|