@nodaro/sdk 1.24.0 → 1.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +129 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +248 -11
- package/dist/index.d.ts +248 -11
- package/dist/index.js +126 -9
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -238,10 +238,17 @@ var WorkflowsResource = class {
|
|
|
238
238
|
}
|
|
239
239
|
/**
|
|
240
240
|
* Import a `WorkflowExport` bundle into the specified project.
|
|
241
|
-
* Re-creates any bundled assets (characters, objects, locations)
|
|
241
|
+
* Re-creates any bundled assets (characters, objects, creatures, locations)
|
|
242
|
+
* under your account, and re-points BOTH the entity nodes and every `@`-chip
|
|
243
|
+
* (`ConnectedReference`) bound in the graph at the rows it created.
|
|
242
244
|
* Media the bundle references on other hosts is copied onto this instance's
|
|
243
|
-
* storage where reachable;
|
|
244
|
-
*
|
|
245
|
+
* storage where reachable; a bundled entity's images are copied whoever
|
|
246
|
+
* hosts them, because they are the exporter's bytes and their lifecycle is
|
|
247
|
+
* not yours. `importReport` says what was copied, what could not be reached
|
|
248
|
+
* and what was skipped (and why); `assetIdMap` maps each bundled entity id
|
|
249
|
+
* to the row created for it (for chips you hold outside the graph), and
|
|
250
|
+
* `assetsSkipped` names the entities your storage quota left uncreated —
|
|
251
|
+
* the workflow itself still lands.
|
|
245
252
|
*/
|
|
246
253
|
import(input) {
|
|
247
254
|
const { projectId, ...workflowJson } = input;
|
|
@@ -324,6 +331,14 @@ var JobsResource = class {
|
|
|
324
331
|
get(id) {
|
|
325
332
|
return this.client.request("GET", `/v1/jobs/${encodeURIComponent(id)}`);
|
|
326
333
|
}
|
|
334
|
+
/**
|
|
335
|
+
* Your jobs, newest first (`GET /v1/jobs`), cursor-paginated. `type` and
|
|
336
|
+
* `origin` filter on the job's own `input_data`, which every job carries —
|
|
337
|
+
* a client app lists its runs with `{ type: "llm-structured", origin: "studio" }`.
|
|
338
|
+
*/
|
|
339
|
+
list(params = {}) {
|
|
340
|
+
return this.client.request("GET", "/v1/jobs", { query: { ...params } });
|
|
341
|
+
}
|
|
327
342
|
/**
|
|
328
343
|
* Get the lean status of a single job (poll-loop friendly).
|
|
329
344
|
* Hits `GET /v1/jobs/:id/status` — returns only id/status/progress/
|
|
@@ -1786,6 +1801,36 @@ var VoicesResource = class {
|
|
|
1786
1801
|
}
|
|
1787
1802
|
};
|
|
1788
1803
|
|
|
1804
|
+
// src/resources/llm.ts
|
|
1805
|
+
var LlmResource = class {
|
|
1806
|
+
constructor(client) {
|
|
1807
|
+
this.client = client;
|
|
1808
|
+
}
|
|
1809
|
+
client;
|
|
1810
|
+
/**
|
|
1811
|
+
* Synchronous forced-schema completion (`POST /v1/llm/structured`). A call
|
|
1812
|
+
* can run several minutes — longer than the client's default 60 s
|
|
1813
|
+
* `timeoutMs`; construct the client with a larger `timeoutMs` for this
|
|
1814
|
+
* call, or use {@link LlmResource.structuredJob}.
|
|
1815
|
+
*/
|
|
1816
|
+
structured(input) {
|
|
1817
|
+
return this.client.request("POST", "/v1/llm/structured", { body: input });
|
|
1818
|
+
}
|
|
1819
|
+
/**
|
|
1820
|
+
* The same call as a job (`POST /v1/llm/structured/jobs`): answers `{ jobId }`
|
|
1821
|
+
* at once. Poll `jobs.getStatus(jobId)` — `output_data` is an
|
|
1822
|
+
* {@link LlmStructuredJobOutput}; `error_message` says why a run failed.
|
|
1823
|
+
* `jobs.list({ type: "llm-structured", origin })` finds every run later.
|
|
1824
|
+
* Throws `NotFoundError` on a platform that predates the route. An instance
|
|
1825
|
+
* that proxies its LLM calls to nodaro.ai answers `503 provider_unavailable`
|
|
1826
|
+
* permanently — the SDK surfaces that as a generic `NodaroError` with the
|
|
1827
|
+
* same code; treat it as unavailable here, not as transient.
|
|
1828
|
+
*/
|
|
1829
|
+
structuredJob(input) {
|
|
1830
|
+
return this.client.request("POST", "/v1/llm/structured/jobs", { body: input });
|
|
1831
|
+
}
|
|
1832
|
+
};
|
|
1833
|
+
|
|
1789
1834
|
// src/resources/media.ts
|
|
1790
1835
|
var MediaResource = class {
|
|
1791
1836
|
constructor(client) {
|
|
@@ -1935,6 +1980,16 @@ var MediaResource = class {
|
|
|
1935
1980
|
videoMetadata(input) {
|
|
1936
1981
|
return this.client.request("POST", "/v1/video-metadata", { body: input });
|
|
1937
1982
|
}
|
|
1983
|
+
/**
|
|
1984
|
+
* Cut or crop a stored file (`POST /v1/media/process`) — synchronous and
|
|
1985
|
+
* free, the source-preparation sibling of the priced `trimVideo` node.
|
|
1986
|
+
* `trim` is `[startTime, endTime]` in seconds; `deleteSource: true` removes
|
|
1987
|
+
* the source object afterwards when it is yours and nothing else references
|
|
1988
|
+
* it ("the cut replaces the original"). Answers the stored file.
|
|
1989
|
+
*/
|
|
1990
|
+
process(input) {
|
|
1991
|
+
return this.client.request("POST", "/v1/media/process", { body: input });
|
|
1992
|
+
}
|
|
1938
1993
|
};
|
|
1939
1994
|
|
|
1940
1995
|
// src/resources/audio.ts
|
|
@@ -2536,6 +2591,23 @@ var OrganizationsResource = class {
|
|
|
2536
2591
|
audit(orgId, opts = {}) {
|
|
2537
2592
|
return this.client.request("GET", `/v1/orgs/${encodeURIComponent(orgId)}/audit`, { query: { ...opts } });
|
|
2538
2593
|
}
|
|
2594
|
+
// -- usage ----------------------------------------------------------------
|
|
2595
|
+
/**
|
|
2596
|
+
* Credits by workspace, member, model or day. Owner and org admins only.
|
|
2597
|
+
* Inclusive dates (`from`/`to`), IANA `tz` (default UTC), ≤ 366 days
|
|
2598
|
+
* (default last 30).
|
|
2599
|
+
*/
|
|
2600
|
+
usage(orgId, opts = {}) {
|
|
2601
|
+
return this.client.request("GET", `/v1/orgs/${encodeURIComponent(orgId)}/usage`, { query: { ...opts } });
|
|
2602
|
+
}
|
|
2603
|
+
/** The individual runs behind a report, newest first, cursor-paged. */
|
|
2604
|
+
usageRows(orgId, opts = {}) {
|
|
2605
|
+
return this.client.request("GET", `/v1/orgs/${encodeURIComponent(orgId)}/usage`, { query: { ...opts, groupBy: "none" } });
|
|
2606
|
+
}
|
|
2607
|
+
/** The same report (or the rows, with `groupBy: "none"`) as CSV text. */
|
|
2608
|
+
usageCsv(orgId, opts = {}) {
|
|
2609
|
+
return this.client.requestText("GET", `/v1/orgs/${encodeURIComponent(orgId)}/usage`, { query: { ...opts, format: "csv" } });
|
|
2610
|
+
}
|
|
2539
2611
|
};
|
|
2540
2612
|
|
|
2541
2613
|
// src/resources/workspaces.ts
|
|
@@ -2627,8 +2699,26 @@ var WorkspacesResource = class {
|
|
|
2627
2699
|
join(code) {
|
|
2628
2700
|
return this.client.request("POST", "/v1/workspaces/join", { body: { code } });
|
|
2629
2701
|
}
|
|
2702
|
+
// -- usage ----------------------------------------------------------------
|
|
2703
|
+
/**
|
|
2704
|
+
* Credits by member, model or day for this workspace. A plain member sees
|
|
2705
|
+
* their OWN runs (the report is self-narrowed and `groupBy: "member"` is
|
|
2706
|
+
* refused); a workspace admin sees everyone and may filter `userId`.
|
|
2707
|
+
* Inclusive dates, IANA `tz` (default UTC), ≤ 366 days (default last 30).
|
|
2708
|
+
*/
|
|
2709
|
+
usage(id, opts = {}) {
|
|
2710
|
+
return this.client.request("GET", `/v1/workspaces/${encodeURIComponent(id)}/usage`, { query: { ...opts } });
|
|
2711
|
+
}
|
|
2712
|
+
/** The individual runs behind a report, newest first, cursor-paged. */
|
|
2713
|
+
usageRows(id, opts = {}) {
|
|
2714
|
+
return this.client.request("GET", `/v1/workspaces/${encodeURIComponent(id)}/usage`, { query: { ...opts, groupBy: "none" } });
|
|
2715
|
+
}
|
|
2716
|
+
/** The same report (or the rows, with `groupBy: "none"`) as CSV text. */
|
|
2717
|
+
usageCsv(id, opts = {}) {
|
|
2718
|
+
return this.client.requestText("GET", `/v1/workspaces/${encodeURIComponent(id)}/usage`, { query: { ...opts, format: "csv" } });
|
|
2719
|
+
}
|
|
2630
2720
|
};
|
|
2631
|
-
var SDK_VERSION = "1.
|
|
2721
|
+
var SDK_VERSION = "1.26.0" ;
|
|
2632
2722
|
var CLIENT_HEADER = "X-Nodaro-Client";
|
|
2633
2723
|
var isBrowser = () => typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
2634
2724
|
var NodaroClient = class _NodaroClient {
|
|
@@ -2666,6 +2756,7 @@ var NodaroClient = class _NodaroClient {
|
|
|
2666
2756
|
reduce;
|
|
2667
2757
|
promptHelper;
|
|
2668
2758
|
voices;
|
|
2759
|
+
llm;
|
|
2669
2760
|
media;
|
|
2670
2761
|
audio;
|
|
2671
2762
|
credits;
|
|
@@ -2709,6 +2800,7 @@ var NodaroClient = class _NodaroClient {
|
|
|
2709
2800
|
this.reduce = new ReduceResource(this);
|
|
2710
2801
|
this.promptHelper = new PromptHelperResource(this);
|
|
2711
2802
|
this.voices = new VoicesResource(this);
|
|
2803
|
+
this.llm = new LlmResource(this);
|
|
2712
2804
|
this.media = new MediaResource(this);
|
|
2713
2805
|
this.audio = new AudioResource(this);
|
|
2714
2806
|
this.credits = new CreditsResource(this);
|
|
@@ -2747,7 +2839,14 @@ var NodaroClient = class _NodaroClient {
|
|
|
2747
2839
|
...workspaceId ? { workspaceId } : {}
|
|
2748
2840
|
});
|
|
2749
2841
|
}
|
|
2750
|
-
|
|
2842
|
+
/**
|
|
2843
|
+
* The transport: build the request, send it, throw the typed error on a
|
|
2844
|
+
* non-2xx via {@link throwFromResponse}, then read the body via `read` — all
|
|
2845
|
+
* inside the abort timer, so `timeoutMs` bounds the body download too (a
|
|
2846
|
+
* stalled CSV stream aborts, it does not hang forever). Both the JSON path
|
|
2847
|
+
* ({@link request}) and the text path ({@link requestText}) go through here.
|
|
2848
|
+
*/
|
|
2849
|
+
async send(method, path, options, read) {
|
|
2751
2850
|
const url = this.buildUrl(path, options.query);
|
|
2752
2851
|
const token = await this.auth.getToken();
|
|
2753
2852
|
const isFormData = typeof FormData !== "undefined" && options.body instanceof FormData;
|
|
@@ -2780,12 +2879,30 @@ var NodaroClient = class _NodaroClient {
|
|
|
2780
2879
|
}
|
|
2781
2880
|
throwFromResponse(res.status, errBody);
|
|
2782
2881
|
}
|
|
2783
|
-
|
|
2784
|
-
return await res.json();
|
|
2882
|
+
return await read(res);
|
|
2785
2883
|
} finally {
|
|
2786
2884
|
clearTimeout(timeoutId);
|
|
2787
2885
|
}
|
|
2788
2886
|
}
|
|
2887
|
+
async request(method, path, options = {}) {
|
|
2888
|
+
return this.send(
|
|
2889
|
+
method,
|
|
2890
|
+
path,
|
|
2891
|
+
options,
|
|
2892
|
+
async (res) => (
|
|
2893
|
+
// 204 No Content
|
|
2894
|
+
res.status === 204 ? void 0 : await res.json()
|
|
2895
|
+
)
|
|
2896
|
+
);
|
|
2897
|
+
}
|
|
2898
|
+
/**
|
|
2899
|
+
* Like {@link request}, for endpoints that answer text (CSV exports). Errors
|
|
2900
|
+
* are still the JSON envelope and throw the same typed errors, and the read is
|
|
2901
|
+
* bounded by the same timeout as the request.
|
|
2902
|
+
*/
|
|
2903
|
+
async requestText(method, path, options = {}) {
|
|
2904
|
+
return this.send(method, path, options, (res) => res.text());
|
|
2905
|
+
}
|
|
2789
2906
|
/**
|
|
2790
2907
|
* `GET /v1/me` → the authenticated user's identity (see {@link UserIdentity}).
|
|
2791
2908
|
* Unwraps the `{ data }` envelope. Throws `UnauthorizedError` (401) when the
|
|
@@ -2925,6 +3042,10 @@ Object.defineProperty(exports, "SURROUND_DIRECTIONS", {
|
|
|
2925
3042
|
enumerable: true,
|
|
2926
3043
|
get: function () { return shared.SURROUND_DIRECTIONS; }
|
|
2927
3044
|
});
|
|
3045
|
+
Object.defineProperty(exports, "USAGE_GROUP_BYS", {
|
|
3046
|
+
enumerable: true,
|
|
3047
|
+
get: function () { return shared.USAGE_GROUP_BYS; }
|
|
3048
|
+
});
|
|
2928
3049
|
Object.defineProperty(exports, "WORKSPACE_HEADER", {
|
|
2929
3050
|
enumerable: true,
|
|
2930
3051
|
get: function () { return shared.WORKSPACE_HEADER; }
|
|
@@ -2947,6 +3068,7 @@ exports.JobFailedError = JobFailedError;
|
|
|
2947
3068
|
exports.JobTimeoutError = JobTimeoutError;
|
|
2948
3069
|
exports.JobsResource = JobsResource;
|
|
2949
3070
|
exports.LibraryResource = LibraryResource;
|
|
3071
|
+
exports.LlmResource = LlmResource;
|
|
2950
3072
|
exports.LocationsResource = LocationsResource;
|
|
2951
3073
|
exports.MediaResource = MediaResource;
|
|
2952
3074
|
exports.ModelsResource = ModelsResource;
|