@layer_ai/sdk 1.0.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 +166 -0
- package/dist/client.d.ts +74 -0
- package/dist/client.js +108 -0
- package/dist/errors.d.ts +98 -0
- package/dist/errors.js +109 -0
- package/dist/generated/types.d.ts +1443 -0
- package/dist/generated/types.js +7 -0
- package/dist/http.d.ts +76 -0
- package/dist/http.js +193 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +29 -0
- package/dist/pagination.d.ts +28 -0
- package/dist/pagination.js +21 -0
- package/dist/resources/base-models.d.ts +47 -0
- package/dist/resources/base-models.js +59 -0
- package/dist/resources/files.d.ts +54 -0
- package/dist/resources/files.js +94 -0
- package/dist/resources/inferences.d.ts +70 -0
- package/dist/resources/inferences.js +126 -0
- package/dist/resources/projects.d.ts +42 -0
- package/dist/resources/projects.js +66 -0
- package/dist/resources/reference-sets.d.ts +30 -0
- package/dist/resources/reference-sets.js +40 -0
- package/dist/resources/scores.d.ts +24 -0
- package/dist/resources/scores.js +31 -0
- package/dist/resources/training-runs.d.ts +50 -0
- package/dist/resources/training-runs.js +93 -0
- package/dist/resources/workflows.d.ts +37 -0
- package/dist/resources/workflows.js +38 -0
- package/dist/resources/workspaces.d.ts +23 -0
- package/dist/resources/workspaces.js +35 -0
- package/dist/types.d.ts +61 -0
- package/dist/types.js +9 -0
- package/dist/version.d.ts +11 -0
- package/dist/version.js +1 -0
- package/package.json +50 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type ListOptions, type Page } from "../pagination.js";
|
|
2
|
+
import type { WorkspaceInfo, WorkspaceUsageOutput } from "../generated/types.js";
|
|
3
|
+
import type { HttpClient } from "../http.js";
|
|
4
|
+
/** Workspaces the credential can see, and what each has spent. */
|
|
5
|
+
export declare class Workspaces {
|
|
6
|
+
private readonly http;
|
|
7
|
+
private readonly workspace;
|
|
8
|
+
constructor(http: HttpClient, workspace: (override?: string) => Promise<string>);
|
|
9
|
+
/** One page of the workspaces this credential belongs to, most recently active first. */
|
|
10
|
+
list(options?: ListOptions): Promise<Page<WorkspaceInfo>>;
|
|
11
|
+
/** Every workspace this credential belongs to, paging as it goes. */
|
|
12
|
+
listAll(options?: Omit<ListOptions, "cursor">): AsyncGenerator<WorkspaceInfo, void, undefined>;
|
|
13
|
+
/** One workspace, including its Creative Unit balance. */
|
|
14
|
+
get(workspaceId?: string, options?: {
|
|
15
|
+
signal?: AbortSignal;
|
|
16
|
+
}): Promise<WorkspaceInfo>;
|
|
17
|
+
/** Creative Units consumed over the last `days`, with a daily breakdown. */
|
|
18
|
+
usage(options?: {
|
|
19
|
+
workspaceId?: string;
|
|
20
|
+
days?: number;
|
|
21
|
+
signal?: AbortSignal;
|
|
22
|
+
}): Promise<WorkspaceUsageOutput>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { walkPages } from "../pagination.js";
|
|
2
|
+
/** Workspaces the credential can see, and what each has spent. */
|
|
3
|
+
export class Workspaces {
|
|
4
|
+
http;
|
|
5
|
+
workspace;
|
|
6
|
+
constructor(http, workspace) {
|
|
7
|
+
this.http = http;
|
|
8
|
+
this.workspace = workspace;
|
|
9
|
+
}
|
|
10
|
+
/** One page of the workspaces this credential belongs to, most recently active first. */
|
|
11
|
+
async list(options = {}) {
|
|
12
|
+
const body = await this.http.get("/v2/workspaces", {
|
|
13
|
+
query: { limit: options.limit, cursor: options.cursor },
|
|
14
|
+
signal: options.signal,
|
|
15
|
+
});
|
|
16
|
+
return { items: body.workspaces, pagination: body.pagination };
|
|
17
|
+
}
|
|
18
|
+
/** Every workspace this credential belongs to, paging as it goes. */
|
|
19
|
+
listAll(options = {}) {
|
|
20
|
+
return walkPages((cursor) => this.list({ ...options, cursor }));
|
|
21
|
+
}
|
|
22
|
+
/** One workspace, including its Creative Unit balance. */
|
|
23
|
+
async get(workspaceId, options = {}) {
|
|
24
|
+
const id = await this.workspace(workspaceId);
|
|
25
|
+
return this.http.get(`/v2/workspaces/${id}`, { signal: options.signal });
|
|
26
|
+
}
|
|
27
|
+
/** Creative Units consumed over the last `days`, with a daily breakdown. */
|
|
28
|
+
async usage(options = {}) {
|
|
29
|
+
const id = await this.workspace(options.workspaceId);
|
|
30
|
+
return this.http.get(`/v2/workspaces/${id}/usage`, {
|
|
31
|
+
query: { days: options.days },
|
|
32
|
+
signal: options.signal,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The wire types, under the names the SDK's own surface uses.
|
|
3
|
+
*
|
|
4
|
+
* The generated names follow the API's operation ids, which read as server internals
|
|
5
|
+
* (`GetInferenceRunV2Output`) rather than as domain objects. These aliases are what the
|
|
6
|
+
* methods are typed with and what the documentation calls them; both names are exported,
|
|
7
|
+
* so code generated against the raw spec still compiles.
|
|
8
|
+
*/
|
|
9
|
+
import type { BaseModelDefaultsOutput, BaseModelDetail, BaseModelSummary, CreateReferenceSetRequest, EstimateInferencePriceV2Output, EstimateInferencePriceV2Request, EstimateTrainingPriceResponse, EstimateWorkflowPriceOutput, ExecuteInferenceV2Output, ExecuteInferenceV2Request, ForgeRunAsset, GetInferenceRunV2Output, GetReferenceSetOutput, GetTrainingRunResponse, GetWorkflowRunOutput, ProjectDetail, ProjectSummary, ReferenceSetSummary, RequestUploadUrlResponse, StartTrainingRequest, StartTrainingResponse, TrainedModelResponse, TrainingRunSummary, WorkflowSummary, WorkspaceInfo, WorkspaceUsageOutput } from "./generated/types.js";
|
|
10
|
+
/** One asset a run produced — its download URL, type, and dimensions. */
|
|
11
|
+
export type GeneratedAsset = ForgeRunAsset;
|
|
12
|
+
/** What a generation run is asked to do. */
|
|
13
|
+
export type GenerateRequest = ExecuteInferenceV2Request;
|
|
14
|
+
/** A generation run that has been accepted but not yet finished. */
|
|
15
|
+
export type AcceptedRun = ExecuteInferenceV2Output;
|
|
16
|
+
/** A generation run's current state, with its outputs once complete. */
|
|
17
|
+
export type InferenceRun = GetInferenceRunV2Output;
|
|
18
|
+
/** What a generation would be priced at, and what it would leave in the balance. */
|
|
19
|
+
export type PriceEstimate = EstimateInferencePriceV2Output;
|
|
20
|
+
/** What to price. Accepts the same fields as a run, minus the ones that only affect output. */
|
|
21
|
+
export type PriceEstimateRequest = EstimateInferencePriceV2Request;
|
|
22
|
+
/** A workspace, with its Creative Unit balance. */
|
|
23
|
+
export type Workspace = WorkspaceInfo;
|
|
24
|
+
/** Creative Units consumed over a period, with a daily breakdown. */
|
|
25
|
+
export type WorkspaceUsage = WorkspaceUsageOutput;
|
|
26
|
+
/** A project in a list. */
|
|
27
|
+
export type Project = ProjectSummary;
|
|
28
|
+
/** A single project, with everything a list omits. */
|
|
29
|
+
export type ProjectWithDetail = ProjectDetail;
|
|
30
|
+
/** A base model in the catalogue. */
|
|
31
|
+
export type BaseModel = BaseModelSummary;
|
|
32
|
+
/** A single base model, with its full capabilities. */
|
|
33
|
+
export type BaseModelWithDetail = BaseModelDetail;
|
|
34
|
+
/** Layer's curated picks per modality and use case, filtered to this workspace. */
|
|
35
|
+
export type BaseModelDefaults = BaseModelDefaultsOutput;
|
|
36
|
+
/** A reference set in a list. */
|
|
37
|
+
export type ReferenceSet = ReferenceSetSummary;
|
|
38
|
+
/** A single reference set, with its files. */
|
|
39
|
+
export type ReferenceSetWithDetail = GetReferenceSetOutput;
|
|
40
|
+
/** What a new reference set is made of. */
|
|
41
|
+
export type CreateReferenceSetInput = CreateReferenceSetRequest;
|
|
42
|
+
/** A training run in a list. */
|
|
43
|
+
export type TrainingRun = TrainingRunSummary;
|
|
44
|
+
/** A training run's current state. */
|
|
45
|
+
export type TrainingRunStatus = GetTrainingRunResponse;
|
|
46
|
+
/** A training run that has been accepted but not yet finished. */
|
|
47
|
+
export type AcceptedTrainingRun = StartTrainingResponse;
|
|
48
|
+
/** What to train, and from what. */
|
|
49
|
+
export type StartTrainingInput = StartTrainingRequest;
|
|
50
|
+
/** What a training run would be priced at. */
|
|
51
|
+
export type TrainingPriceEstimate = EstimateTrainingPriceResponse;
|
|
52
|
+
/** The model a finished training run produced. */
|
|
53
|
+
export type TrainedModel = TrainedModelResponse;
|
|
54
|
+
/** A saved workflow (Blueprint) in a list. */
|
|
55
|
+
export type Workflow = WorkflowSummary;
|
|
56
|
+
/** A workflow run's current state, step by step. */
|
|
57
|
+
export type WorkflowRun = GetWorkflowRunOutput;
|
|
58
|
+
/** What a workflow run would be priced at, and how many outputs it would make. */
|
|
59
|
+
export type WorkflowPriceEstimate = EstimateWorkflowPriceOutput;
|
|
60
|
+
/** An uploaded file's id and the signed URL its bytes went to. */
|
|
61
|
+
export type UploadedFile = RequestUploadUrlResponse;
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The wire types, under the names the SDK's own surface uses.
|
|
3
|
+
*
|
|
4
|
+
* The generated names follow the API's operation ids, which read as server internals
|
|
5
|
+
* (`GetInferenceRunV2Output`) rather than as domain objects. These aliases are what the
|
|
6
|
+
* methods are typed with and what the documentation calls them; both names are exported,
|
|
7
|
+
* so code generated against the raw spec still compiles.
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The version this build reports in its `User-Agent`.
|
|
3
|
+
*
|
|
4
|
+
* The value here is the floor declared in `package.json`; a published build has this
|
|
5
|
+
* module's compiled form rewritten with the version the installable ledger allocated for
|
|
6
|
+
* its content. Typed as `string` rather than inferred as a literal, so the declaration
|
|
7
|
+
* emitted beside it is true of every build.
|
|
8
|
+
*
|
|
9
|
+
* Kept in step with `package.json` by `task -d apps/sdk-ts check-project`.
|
|
10
|
+
*/
|
|
11
|
+
export declare const VERSION: string;
|
package/dist/version.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const VERSION = "1.0.0";
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@layer_ai/sdk",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Official JavaScript and TypeScript SDK for Layer \u2014 AI asset creation for game studios.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ai",
|
|
7
|
+
"game-assets",
|
|
8
|
+
"game-development",
|
|
9
|
+
"generative-ai",
|
|
10
|
+
"layer",
|
|
11
|
+
"layer-ai",
|
|
12
|
+
"sdk",
|
|
13
|
+
"text-to-3d",
|
|
14
|
+
"text-to-image",
|
|
15
|
+
"text-to-video"
|
|
16
|
+
],
|
|
17
|
+
"homepage": "https://www.layer.ai",
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://www.layer.ai/docs/sdk"
|
|
20
|
+
},
|
|
21
|
+
"license": "Apache-2.0",
|
|
22
|
+
"author": "Layer <info@layer.ai> (https://www.layer.ai)",
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/layerai/app.git",
|
|
26
|
+
"directory": "apps/sdk-ts"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist",
|
|
30
|
+
"README.md"
|
|
31
|
+
],
|
|
32
|
+
"type": "module",
|
|
33
|
+
"sideEffects": false,
|
|
34
|
+
"main": "./dist/index.js",
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"exports": {
|
|
37
|
+
".": {
|
|
38
|
+
"types": "./dist/index.d.ts",
|
|
39
|
+
"default": "./dist/index.js"
|
|
40
|
+
},
|
|
41
|
+
"./package.json": "./package.json"
|
|
42
|
+
},
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public",
|
|
45
|
+
"provenance": true
|
|
46
|
+
},
|
|
47
|
+
"engines": {
|
|
48
|
+
"node": ">=20.6"
|
|
49
|
+
}
|
|
50
|
+
}
|