@omnichar/contracts 0.2.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/errors.d.ts +39 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +42 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/manifest/index.d.ts +18 -0
- package/dist/manifest/index.d.ts.map +1 -0
- package/dist/manifest/index.js +13 -0
- package/dist/manifest/index.js.map +1 -0
- package/dist/result.d.ts +12 -0
- package/dist/result.d.ts.map +1 -0
- package/dist/result.js +7 -0
- package/dist/result.js.map +1 -0
- package/dist/v1/apiKeys.d.ts +38 -0
- package/dist/v1/apiKeys.d.ts.map +1 -0
- package/dist/v1/apiKeys.js +28 -0
- package/dist/v1/apiKeys.js.map +1 -0
- package/dist/v1/assets.d.ts +47 -0
- package/dist/v1/assets.d.ts.map +1 -0
- package/dist/v1/assets.js +24 -0
- package/dist/v1/assets.js.map +1 -0
- package/dist/v1/capacity.d.ts +48 -0
- package/dist/v1/capacity.d.ts.map +1 -0
- package/dist/v1/capacity.js +18 -0
- package/dist/v1/capacity.js.map +1 -0
- package/dist/v1/characters.d.ts +88 -0
- package/dist/v1/characters.d.ts.map +1 -0
- package/dist/v1/characters.js +59 -0
- package/dist/v1/characters.js.map +1 -0
- package/dist/v1/common.d.ts +13 -0
- package/dist/v1/common.d.ts.map +1 -0
- package/dist/v1/common.js +12 -0
- package/dist/v1/common.js.map +1 -0
- package/dist/v1/credits.d.ts +90 -0
- package/dist/v1/credits.d.ts.map +1 -0
- package/dist/v1/credits.js +68 -0
- package/dist/v1/credits.js.map +1 -0
- package/dist/v1/datasets.d.ts +153 -0
- package/dist/v1/datasets.d.ts.map +1 -0
- package/dist/v1/datasets.js +93 -0
- package/dist/v1/datasets.js.map +1 -0
- package/dist/v1/health.d.ts +13 -0
- package/dist/v1/health.d.ts.map +1 -0
- package/dist/v1/health.js +10 -0
- package/dist/v1/health.js.map +1 -0
- package/dist/v1/index.d.ts +14 -0
- package/dist/v1/index.d.ts.map +1 -0
- package/dist/v1/index.js +14 -0
- package/dist/v1/index.js.map +1 -0
- package/dist/v1/me.d.ts +23 -0
- package/dist/v1/me.d.ts.map +1 -0
- package/dist/v1/me.js +16 -0
- package/dist/v1/me.js.map +1 -0
- package/dist/v1/plans.d.ts +30 -0
- package/dist/v1/plans.d.ts.map +1 -0
- package/dist/v1/plans.js +19 -0
- package/dist/v1/plans.js.map +1 -0
- package/dist/v1/runs.d.ts +359 -0
- package/dist/v1/runs.d.ts.map +1 -0
- package/dist/v1/runs.js +173 -0
- package/dist/v1/runs.js.map +1 -0
- package/dist/v1/uploads.d.ts +56 -0
- package/dist/v1/uploads.d.ts.map +1 -0
- package/dist/v1/uploads.js +56 -0
- package/dist/v1/uploads.js.map +1 -0
- package/dist/v1/workflows.d.ts +198 -0
- package/dist/v1/workflows.d.ts.map +1 -0
- package/dist/v1/workflows.js +103 -0
- package/dist/v1/workflows.js.map +1 -0
- package/package.json +34 -0
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ERROR_CODES: readonly ["bad_request", "unauthorized", "forbidden", "not_found", "conflict", "unprocessable", "rate_limited", "insufficient_credits", "storage_limit_reached", "upstream_unavailable", "internal"];
|
|
3
|
+
export type ErrorCode = (typeof ERROR_CODES)[number];
|
|
4
|
+
export declare const errorCodeSchema: z.ZodEnum<{
|
|
5
|
+
bad_request: "bad_request";
|
|
6
|
+
unauthorized: "unauthorized";
|
|
7
|
+
forbidden: "forbidden";
|
|
8
|
+
not_found: "not_found";
|
|
9
|
+
conflict: "conflict";
|
|
10
|
+
unprocessable: "unprocessable";
|
|
11
|
+
rate_limited: "rate_limited";
|
|
12
|
+
insufficient_credits: "insufficient_credits";
|
|
13
|
+
storage_limit_reached: "storage_limit_reached";
|
|
14
|
+
upstream_unavailable: "upstream_unavailable";
|
|
15
|
+
internal: "internal";
|
|
16
|
+
}>;
|
|
17
|
+
export declare const apiErrorSchema: z.ZodObject<{
|
|
18
|
+
error: z.ZodObject<{
|
|
19
|
+
code: z.ZodEnum<{
|
|
20
|
+
bad_request: "bad_request";
|
|
21
|
+
unauthorized: "unauthorized";
|
|
22
|
+
forbidden: "forbidden";
|
|
23
|
+
not_found: "not_found";
|
|
24
|
+
conflict: "conflict";
|
|
25
|
+
unprocessable: "unprocessable";
|
|
26
|
+
rate_limited: "rate_limited";
|
|
27
|
+
insufficient_credits: "insufficient_credits";
|
|
28
|
+
storage_limit_reached: "storage_limit_reached";
|
|
29
|
+
upstream_unavailable: "upstream_unavailable";
|
|
30
|
+
internal: "internal";
|
|
31
|
+
}>;
|
|
32
|
+
message: z.ZodString;
|
|
33
|
+
requestId: z.ZodOptional<z.ZodString>;
|
|
34
|
+
details: z.ZodOptional<z.ZodUnknown>;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
export type ApiError = z.infer<typeof apiErrorSchema>;
|
|
38
|
+
export declare const HTTP_STATUS_FOR_CODE: Record<ErrorCode, number>;
|
|
39
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,eAAO,MAAM,WAAW,sMAcd,CAAA;AAEV,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAA;AAEpD,eAAO,MAAM,eAAe;;;;;;;;;;;;EAAsB,CAAA;AAElD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;iBAQzB,CAAA;AAEF,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA;AAErD,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAY1D,CAAA"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
// Mirrors the shape Inline Core already returns from its own /v1, so a client that can read one
|
|
3
|
+
// can read the other. Carried over an honest HTTP status, never a 200 with an error inside.
|
|
4
|
+
export const ERROR_CODES = [
|
|
5
|
+
'bad_request',
|
|
6
|
+
'unauthorized',
|
|
7
|
+
'forbidden',
|
|
8
|
+
'not_found',
|
|
9
|
+
'conflict',
|
|
10
|
+
'unprocessable',
|
|
11
|
+
'rate_limited',
|
|
12
|
+
'insufficient_credits',
|
|
13
|
+
// Storage is an entitlement, not a purchase. Somebody at their cap with a full credit balance
|
|
14
|
+
// needs to be told about storage, so this is deliberately not insufficient_credits.
|
|
15
|
+
'storage_limit_reached',
|
|
16
|
+
'upstream_unavailable',
|
|
17
|
+
'internal',
|
|
18
|
+
];
|
|
19
|
+
export const errorCodeSchema = z.enum(ERROR_CODES);
|
|
20
|
+
export const apiErrorSchema = z.object({
|
|
21
|
+
error: z.object({
|
|
22
|
+
code: errorCodeSchema,
|
|
23
|
+
message: z.string(),
|
|
24
|
+
// Echoes the caller's x-request-id so a screenshot of an error is enough to find the log line.
|
|
25
|
+
requestId: z.string().optional(),
|
|
26
|
+
details: z.unknown().optional(),
|
|
27
|
+
}),
|
|
28
|
+
});
|
|
29
|
+
export const HTTP_STATUS_FOR_CODE = {
|
|
30
|
+
bad_request: 400,
|
|
31
|
+
unauthorized: 401,
|
|
32
|
+
forbidden: 403,
|
|
33
|
+
not_found: 404,
|
|
34
|
+
conflict: 409,
|
|
35
|
+
unprocessable: 422,
|
|
36
|
+
rate_limited: 429,
|
|
37
|
+
insufficient_credits: 402,
|
|
38
|
+
storage_limit_reached: 409,
|
|
39
|
+
upstream_unavailable: 503,
|
|
40
|
+
internal: 500,
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,gGAAgG;AAChG,4FAA4F;AAC5F,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,aAAa;IACb,cAAc;IACd,WAAW;IACX,WAAW;IACX,UAAU;IACV,eAAe;IACf,cAAc;IACd,sBAAsB;IACtB,8FAA8F;IAC9F,oFAAoF;IACpF,uBAAuB;IACvB,sBAAsB;IACtB,UAAU;CACF,CAAA;AAIV,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;AAElD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,IAAI,EAAE,eAAe;QACrB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;QACnB,+FAA+F;QAC/F,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAChC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;KAChC,CAAC;CACH,CAAC,CAAA;AAIF,MAAM,CAAC,MAAM,oBAAoB,GAA8B;IAC7D,WAAW,EAAE,GAAG;IAChB,YAAY,EAAE,GAAG;IACjB,SAAS,EAAE,GAAG;IACd,SAAS,EAAE,GAAG;IACd,QAAQ,EAAE,GAAG;IACb,aAAa,EAAE,GAAG;IAClB,YAAY,EAAE,GAAG;IACjB,oBAAoB,EAAE,GAAG;IACzB,qBAAqB,EAAE,GAAG;IAC1B,oBAAoB,EAAE,GAAG;IACzB,QAAQ,EAAE,GAAG;CACd,CAAA"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,qBAAqB,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,qBAAqB,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const MANIFEST_VERSION: 1;
|
|
3
|
+
export declare const manifestKindSchema: z.ZodEnum<{
|
|
4
|
+
generate: "generate";
|
|
5
|
+
train: "train";
|
|
6
|
+
}>;
|
|
7
|
+
export declare const runManifestSchema: z.ZodObject<{
|
|
8
|
+
version: z.ZodLiteral<1>;
|
|
9
|
+
kind: z.ZodEnum<{
|
|
10
|
+
generate: "generate";
|
|
11
|
+
train: "train";
|
|
12
|
+
}>;
|
|
13
|
+
model: z.ZodString;
|
|
14
|
+
inputs: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
export type RunManifest = z.infer<typeof runManifestSchema>;
|
|
17
|
+
export type ManifestKind = z.infer<typeof manifestKindSchema>;
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/manifest/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,eAAO,MAAM,gBAAgB,EAAG,CAAU,CAAA;AAE1C,eAAO,MAAM,kBAAkB;;;EAAgC,CAAA;AAE/D,eAAO,MAAM,iBAAiB;;;;;;;;iBAM5B,CAAA;AAEF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAC3D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
// A run manifest is the description of work the control plane accepts and a worker executes. Both
|
|
3
|
+
// sides validate against this, so a worker never has to guess what an older studio meant.
|
|
4
|
+
export const MANIFEST_VERSION = 1;
|
|
5
|
+
export const manifestKindSchema = z.enum(['generate', 'train']);
|
|
6
|
+
export const runManifestSchema = z.object({
|
|
7
|
+
version: z.literal(MANIFEST_VERSION),
|
|
8
|
+
kind: manifestKindSchema,
|
|
9
|
+
// Opaque to the control plane. It routes on kind and model, and never inspects the payload.
|
|
10
|
+
model: z.string().min(1).max(200),
|
|
11
|
+
inputs: z.record(z.string(), z.unknown()),
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/manifest/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,kGAAkG;AAClG,0FAA0F;AAC1F,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAU,CAAA;AAE1C,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,CAAA;AAE/D,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC;IACpC,IAAI,EAAE,kBAAkB;IACxB,4FAA4F;IAC5F,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IACjC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;CAC1C,CAAC,CAAA"}
|
package/dist/result.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type Ok<T> = {
|
|
2
|
+
ok: true;
|
|
3
|
+
value: T;
|
|
4
|
+
};
|
|
5
|
+
export type Err = {
|
|
6
|
+
ok: false;
|
|
7
|
+
error: string;
|
|
8
|
+
};
|
|
9
|
+
export type Result<T> = Ok<T> | Err;
|
|
10
|
+
export declare function ok<T>(value: T): Ok<T>;
|
|
11
|
+
export declare function err(error: string): Err;
|
|
12
|
+
//# sourceMappingURL=result.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../src/result.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,EAAE,CAAC,CAAC,IAAI;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,CAAA;AAC1C,MAAM,MAAM,GAAG,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAC9C,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,CAAA;AAEnC,wBAAgB,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAErC;AAED,wBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,CAEtC"}
|
package/dist/result.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result.js","sourceRoot":"","sources":["../src/result.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,EAAE,CAAI,KAAQ;IAC5B,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;AAC5B,CAAC;AAED,MAAM,UAAU,GAAG,CAAC,KAAa;IAC/B,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;AAC7B,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const API_KEY_PREFIX = "oc_sk_";
|
|
3
|
+
export declare const API_KEY_HEADER = "x-api-key";
|
|
4
|
+
export declare const apiKeySecretSchema: z.ZodString;
|
|
5
|
+
export declare const apiKeySchema: z.ZodObject<{
|
|
6
|
+
id: z.ZodUUID;
|
|
7
|
+
name: z.ZodString;
|
|
8
|
+
hint: z.ZodString;
|
|
9
|
+
createdAt: z.ZodISODateTime;
|
|
10
|
+
lastUsedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
export declare const apiKeyListSchema: z.ZodObject<{
|
|
13
|
+
items: z.ZodArray<z.ZodObject<{
|
|
14
|
+
id: z.ZodUUID;
|
|
15
|
+
name: z.ZodString;
|
|
16
|
+
hint: z.ZodString;
|
|
17
|
+
createdAt: z.ZodISODateTime;
|
|
18
|
+
lastUsedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
19
|
+
}, z.core.$strip>>;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
export declare const createApiKeyBodySchema: z.ZodObject<{
|
|
22
|
+
name: z.ZodDefault<z.ZodString>;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
export declare const createApiKeyResponseSchema: z.ZodObject<{
|
|
25
|
+
key: z.ZodObject<{
|
|
26
|
+
id: z.ZodUUID;
|
|
27
|
+
name: z.ZodString;
|
|
28
|
+
hint: z.ZodString;
|
|
29
|
+
createdAt: z.ZodISODateTime;
|
|
30
|
+
lastUsedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
secret: z.ZodString;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
export type ApiKey = z.infer<typeof apiKeySchema>;
|
|
35
|
+
export type ApiKeyList = z.infer<typeof apiKeyListSchema>;
|
|
36
|
+
export type CreateApiKeyBody = z.infer<typeof createApiKeyBodySchema>;
|
|
37
|
+
export type CreateApiKeyResponse = z.infer<typeof createApiKeyResponseSchema>;
|
|
38
|
+
//# sourceMappingURL=apiKeys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiKeys.d.ts","sourceRoot":"","sources":["../../src/v1/apiKeys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,eAAO,MAAM,cAAc,WAAW,CAAA;AAItC,eAAO,MAAM,cAAc,cAAc,CAAA;AACzC,eAAO,MAAM,kBAAkB,aAAgD,CAAA;AAG/E,eAAO,MAAM,YAAY;;;;;;iBAOvB,CAAA;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;iBAA6C,CAAA;AAE1E,eAAO,MAAM,sBAAsB;;iBAEjC,CAAA;AAIF,eAAO,MAAM,0BAA0B;;;;;;;;;iBAGrC,CAAA;AAEF,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAA;AACjD,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AACzD,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA;AACrE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
// `oc_sk_` names the scheme, then 32 random bytes as base64url. Long enough that guessing is not a
|
|
3
|
+
// strategy, and prefixed so a leaked one is recognisable in a scanner.
|
|
4
|
+
export const API_KEY_PREFIX = 'oc_sk_';
|
|
5
|
+
// Its own header. The authorization header carries a dashboard session, and one header holding two
|
|
6
|
+
// kinds of credential is how the wrong one ends up trusted.
|
|
7
|
+
export const API_KEY_HEADER = 'x-api-key';
|
|
8
|
+
export const apiKeySecretSchema = z.string().regex(/^oc_sk_[A-Za-z0-9_-]{43}$/);
|
|
9
|
+
// What a listing may show. The secret itself is not here: it exists once, in the create response.
|
|
10
|
+
export const apiKeySchema = z.object({
|
|
11
|
+
id: z.uuid(),
|
|
12
|
+
name: z.string(),
|
|
13
|
+
// The last four characters of the secret, which is how a person tells two keys apart.
|
|
14
|
+
hint: z.string().length(4),
|
|
15
|
+
createdAt: z.iso.datetime(),
|
|
16
|
+
lastUsedAt: z.iso.datetime().nullable(),
|
|
17
|
+
});
|
|
18
|
+
export const apiKeyListSchema = z.object({ items: z.array(apiKeySchema) });
|
|
19
|
+
export const createApiKeyBodySchema = z.object({
|
|
20
|
+
name: z.string().trim().min(1).max(60).default('API key'),
|
|
21
|
+
});
|
|
22
|
+
// The one and only time the secret is returned. It is not stored, only its hash, so a lost key is
|
|
23
|
+
// replaced rather than recovered.
|
|
24
|
+
export const createApiKeyResponseSchema = z.object({
|
|
25
|
+
key: apiKeySchema,
|
|
26
|
+
secret: apiKeySecretSchema,
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=apiKeys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiKeys.js","sourceRoot":"","sources":["../../src/v1/apiKeys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,mGAAmG;AACnG,uEAAuE;AACvE,MAAM,CAAC,MAAM,cAAc,GAAG,QAAQ,CAAA;AAEtC,mGAAmG;AACnG,4DAA4D;AAC5D,MAAM,CAAC,MAAM,cAAc,GAAG,WAAW,CAAA;AACzC,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAA;AAE/E,kGAAkG;AAClG,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE;IACZ,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,sFAAsF;IACtF,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAC1B,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE;IAC3B,UAAU,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;CACxC,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,CAAC,CAAA;AAE1E,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;CAC1D,CAAC,CAAA;AAEF,kGAAkG;AAClG,kCAAkC;AAClC,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,GAAG,EAAE,YAAY;IACjB,MAAM,EAAE,kBAAkB;CAC3B,CAAC,CAAA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const IMPORTED_ASSET_KINDS: readonly ["image", "video", "character"];
|
|
3
|
+
export declare const importedAssetKindSchema: z.ZodEnum<{
|
|
4
|
+
image: "image";
|
|
5
|
+
video: "video";
|
|
6
|
+
character: "character";
|
|
7
|
+
}>;
|
|
8
|
+
export declare const importedAssetSchema: z.ZodObject<{
|
|
9
|
+
id: z.ZodString;
|
|
10
|
+
r2Key: z.ZodString;
|
|
11
|
+
name: z.ZodString;
|
|
12
|
+
kind: z.ZodEnum<{
|
|
13
|
+
image: "image";
|
|
14
|
+
video: "video";
|
|
15
|
+
character: "character";
|
|
16
|
+
}>;
|
|
17
|
+
contentType: z.ZodString;
|
|
18
|
+
bytes: z.ZodNumber;
|
|
19
|
+
uploadedAt: z.ZodISODateTime;
|
|
20
|
+
url: z.ZodURL;
|
|
21
|
+
thumbUrl: z.ZodNullable<z.ZodURL>;
|
|
22
|
+
usedInRuns: z.ZodNumber;
|
|
23
|
+
usedInDatasets: z.ZodNumber;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
export declare const importedAssetListSchema: z.ZodObject<{
|
|
26
|
+
items: z.ZodArray<z.ZodObject<{
|
|
27
|
+
id: z.ZodString;
|
|
28
|
+
r2Key: z.ZodString;
|
|
29
|
+
name: z.ZodString;
|
|
30
|
+
kind: z.ZodEnum<{
|
|
31
|
+
image: "image";
|
|
32
|
+
video: "video";
|
|
33
|
+
character: "character";
|
|
34
|
+
}>;
|
|
35
|
+
contentType: z.ZodString;
|
|
36
|
+
bytes: z.ZodNumber;
|
|
37
|
+
uploadedAt: z.ZodISODateTime;
|
|
38
|
+
url: z.ZodURL;
|
|
39
|
+
thumbUrl: z.ZodNullable<z.ZodURL>;
|
|
40
|
+
usedInRuns: z.ZodNumber;
|
|
41
|
+
usedInDatasets: z.ZodNumber;
|
|
42
|
+
}, z.core.$strip>>;
|
|
43
|
+
}, z.core.$strip>;
|
|
44
|
+
export type ImportedAssetKind = z.infer<typeof importedAssetKindSchema>;
|
|
45
|
+
export type ImportedAsset = z.infer<typeof importedAssetSchema>;
|
|
46
|
+
export type ImportedAssetList = z.infer<typeof importedAssetListSchema>;
|
|
47
|
+
//# sourceMappingURL=assets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../src/v1/assets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,oBAAoB,0CAA2C,CAAA;AAC5E,eAAO,MAAM,uBAAuB;;;;EAA+B,CAAA;AAKnE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;iBAe9B,CAAA;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;iBAAoD,CAAA;AAExF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA;AACvE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAC/D,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const IMPORTED_ASSET_KINDS = ['image', 'video', 'character'];
|
|
3
|
+
export const importedAssetKindSchema = z.enum(IMPORTED_ASSET_KINDS);
|
|
4
|
+
// One file the caller uploaded. `id` is its path under their own folder; `r2Key` is the whole key,
|
|
5
|
+
// which a run input has to carry - the browser already receives one from every upload it makes, so
|
|
6
|
+
// this is the same fact arriving a second way rather than a new one.
|
|
7
|
+
export const importedAssetSchema = z.object({
|
|
8
|
+
id: z.string().max(200),
|
|
9
|
+
r2Key: z.string().max(512),
|
|
10
|
+
name: z.string(),
|
|
11
|
+
kind: importedAssetKindSchema,
|
|
12
|
+
// Needed to send this file back as a run input, which checks the type against the kind.
|
|
13
|
+
contentType: z.string().max(100),
|
|
14
|
+
bytes: z.number().int().nonnegative(),
|
|
15
|
+
uploadedAt: z.iso.datetime(),
|
|
16
|
+
// A signed link on the media gateway, never a storage URL.
|
|
17
|
+
url: z.url(),
|
|
18
|
+
// A small WebP of the same file, when one was made. Null means the grid shows the original.
|
|
19
|
+
thumbUrl: z.url().nullable(),
|
|
20
|
+
usedInRuns: z.number().int().nonnegative(),
|
|
21
|
+
usedInDatasets: z.number().int().nonnegative(),
|
|
22
|
+
});
|
|
23
|
+
export const importedAssetListSchema = z.object({ items: z.array(importedAssetSchema) });
|
|
24
|
+
//# sourceMappingURL=assets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assets.js","sourceRoot":"","sources":["../../src/v1/assets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,CAAU,CAAA;AAC5E,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAA;AAEnE,mGAAmG;AACnG,mGAAmG;AACnG,qEAAqE;AACrE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC;IACvB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC;IAC1B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,uBAAuB;IAC7B,wFAAwF;IACxF,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC;IAChC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IACrC,UAAU,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE;IAC5B,2DAA2D;IAC3D,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE;IACZ,4FAA4F;IAC5F,QAAQ,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IAC5B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IAC1C,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;CAC/C,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAA"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const gpuStockSchema: z.ZodEnum<{
|
|
3
|
+
unknown: "unknown";
|
|
4
|
+
low: "low";
|
|
5
|
+
high: "high";
|
|
6
|
+
medium: "medium";
|
|
7
|
+
none: "none";
|
|
8
|
+
}>;
|
|
9
|
+
export declare const capacityPoolSchema: z.ZodObject<{
|
|
10
|
+
available: z.ZodBoolean;
|
|
11
|
+
stock: z.ZodEnum<{
|
|
12
|
+
unknown: "unknown";
|
|
13
|
+
low: "low";
|
|
14
|
+
high: "high";
|
|
15
|
+
medium: "medium";
|
|
16
|
+
none: "none";
|
|
17
|
+
}>;
|
|
18
|
+
enabled: z.ZodBoolean;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
export declare const capacityResponseSchema: z.ZodObject<{
|
|
21
|
+
checkedAt: z.ZodString;
|
|
22
|
+
generation: z.ZodObject<{
|
|
23
|
+
available: z.ZodBoolean;
|
|
24
|
+
stock: z.ZodEnum<{
|
|
25
|
+
unknown: "unknown";
|
|
26
|
+
low: "low";
|
|
27
|
+
high: "high";
|
|
28
|
+
medium: "medium";
|
|
29
|
+
none: "none";
|
|
30
|
+
}>;
|
|
31
|
+
enabled: z.ZodBoolean;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
training: z.ZodObject<{
|
|
34
|
+
available: z.ZodBoolean;
|
|
35
|
+
stock: z.ZodEnum<{
|
|
36
|
+
unknown: "unknown";
|
|
37
|
+
low: "low";
|
|
38
|
+
high: "high";
|
|
39
|
+
medium: "medium";
|
|
40
|
+
none: "none";
|
|
41
|
+
}>;
|
|
42
|
+
enabled: z.ZodBoolean;
|
|
43
|
+
}, z.core.$strip>;
|
|
44
|
+
}, z.core.$strip>;
|
|
45
|
+
export type GpuStock = z.infer<typeof gpuStockSchema>;
|
|
46
|
+
export type CapacityPool = z.infer<typeof capacityPoolSchema>;
|
|
47
|
+
export type CapacityResponse = z.infer<typeof capacityResponseSchema>;
|
|
48
|
+
//# sourceMappingURL=capacity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capacity.d.ts","sourceRoot":"","sources":["../../src/v1/capacity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,eAAO,MAAM,cAAc;;;;;;EAAuD,CAAA;AAElF,eAAO,MAAM,kBAAkB;;;;;;;;;;iBAM7B,CAAA;AAGF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;iBAIjC,CAAA;AAEF,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA;AACrD,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAC7D,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
// What the provider says is free. `unknown` is a real answer rather than a failure: the lookup did
|
|
3
|
+
// not come back, and a run is allowed on an unknown reading rather than blocked by one.
|
|
4
|
+
export const gpuStockSchema = z.enum(['high', 'medium', 'low', 'none', 'unknown']);
|
|
5
|
+
export const capacityPoolSchema = z.object({
|
|
6
|
+
// The only field a Run button needs: whether a run of this kind can start at all.
|
|
7
|
+
available: z.boolean(),
|
|
8
|
+
stock: gpuStockSchema,
|
|
9
|
+
// False means switched off here, which is not the same as every GPU being busy.
|
|
10
|
+
enabled: z.boolean(),
|
|
11
|
+
});
|
|
12
|
+
// No GPU names and no data centre: which cards run this is infrastructure, not a product fact.
|
|
13
|
+
export const capacityResponseSchema = z.object({
|
|
14
|
+
checkedAt: z.string(),
|
|
15
|
+
generation: capacityPoolSchema,
|
|
16
|
+
training: capacityPoolSchema,
|
|
17
|
+
});
|
|
18
|
+
//# sourceMappingURL=capacity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capacity.js","sourceRoot":"","sources":["../../src/v1/capacity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,mGAAmG;AACnG,wFAAwF;AACxF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAA;AAElF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,kFAAkF;IAClF,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;IACtB,KAAK,EAAE,cAAc;IACrB,gFAAgF;IAChF,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;CACrB,CAAC,CAAA;AAEF,+FAA+F;AAC/F,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,UAAU,EAAE,kBAAkB;IAC9B,QAAQ,EAAE,kBAAkB;CAC7B,CAAC,CAAA"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const characterSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodUUID;
|
|
4
|
+
name: z.ZodString;
|
|
5
|
+
description: z.ZodString;
|
|
6
|
+
fileName: z.ZodString;
|
|
7
|
+
r2Key: z.ZodString;
|
|
8
|
+
archs: z.ZodArray<z.ZodString>;
|
|
9
|
+
bytes: z.ZodNumber;
|
|
10
|
+
downloadUrl: z.ZodURL;
|
|
11
|
+
createdAt: z.ZodISODateTime;
|
|
12
|
+
runId: z.ZodNullable<z.ZodUUID>;
|
|
13
|
+
refs: z.ZodArray<z.ZodObject<{
|
|
14
|
+
url: z.ZodURL;
|
|
15
|
+
thumbUrl: z.ZodURL;
|
|
16
|
+
}, z.core.$strip>>;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
export declare const pendingCharacterSchema: z.ZodObject<{
|
|
19
|
+
runId: z.ZodUUID;
|
|
20
|
+
name: z.ZodString;
|
|
21
|
+
status: z.ZodString;
|
|
22
|
+
createdAt: z.ZodISODateTime;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
export declare const characterListSchema: z.ZodObject<{
|
|
25
|
+
items: z.ZodArray<z.ZodObject<{
|
|
26
|
+
id: z.ZodUUID;
|
|
27
|
+
name: z.ZodString;
|
|
28
|
+
description: z.ZodString;
|
|
29
|
+
fileName: z.ZodString;
|
|
30
|
+
r2Key: z.ZodString;
|
|
31
|
+
archs: z.ZodArray<z.ZodString>;
|
|
32
|
+
bytes: z.ZodNumber;
|
|
33
|
+
downloadUrl: z.ZodURL;
|
|
34
|
+
createdAt: z.ZodISODateTime;
|
|
35
|
+
runId: z.ZodNullable<z.ZodUUID>;
|
|
36
|
+
refs: z.ZodArray<z.ZodObject<{
|
|
37
|
+
url: z.ZodURL;
|
|
38
|
+
thumbUrl: z.ZodURL;
|
|
39
|
+
}, z.core.$strip>>;
|
|
40
|
+
}, z.core.$strip>>;
|
|
41
|
+
pending: z.ZodArray<z.ZodObject<{
|
|
42
|
+
runId: z.ZodUUID;
|
|
43
|
+
name: z.ZodString;
|
|
44
|
+
status: z.ZodString;
|
|
45
|
+
createdAt: z.ZodISODateTime;
|
|
46
|
+
}, z.core.$strip>>;
|
|
47
|
+
}, z.core.$strip>;
|
|
48
|
+
export declare const CHARACTER_SLOTS: readonly ["images", "body", "cloth"];
|
|
49
|
+
export declare const characterSlotSchema: z.ZodEnum<{
|
|
50
|
+
images: "images";
|
|
51
|
+
body: "body";
|
|
52
|
+
cloth: "cloth";
|
|
53
|
+
}>;
|
|
54
|
+
export declare const MAX_CHARACTER_REFS = 20;
|
|
55
|
+
export declare const createCharacterBodySchema: z.ZodObject<{
|
|
56
|
+
name: z.ZodString;
|
|
57
|
+
description: z.ZodDefault<z.ZodString>;
|
|
58
|
+
archs: z.ZodArray<z.ZodString>;
|
|
59
|
+
refResolution: z.ZodOptional<z.ZodNumber>;
|
|
60
|
+
files: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
61
|
+
r2Key: z.ZodString;
|
|
62
|
+
contentType: z.ZodString;
|
|
63
|
+
}, z.core.$strip>>>;
|
|
64
|
+
}, z.core.$strip>;
|
|
65
|
+
export declare const createCharacterResponseSchema: z.ZodObject<{
|
|
66
|
+
runId: z.ZodUUID;
|
|
67
|
+
characterName: z.ZodString;
|
|
68
|
+
}, z.core.$strip>;
|
|
69
|
+
export declare const characterOptionsSchema: z.ZodObject<{
|
|
70
|
+
archs: z.ZodArray<z.ZodObject<{
|
|
71
|
+
value: z.ZodString;
|
|
72
|
+
label: z.ZodString;
|
|
73
|
+
}, z.core.$strip>>;
|
|
74
|
+
maxRefs: z.ZodNumber;
|
|
75
|
+
slots: z.ZodArray<z.ZodEnum<{
|
|
76
|
+
images: "images";
|
|
77
|
+
body: "body";
|
|
78
|
+
cloth: "cloth";
|
|
79
|
+
}>>;
|
|
80
|
+
}, z.core.$strip>;
|
|
81
|
+
export type Character = z.infer<typeof characterSchema>;
|
|
82
|
+
export type CharacterList = z.infer<typeof characterListSchema>;
|
|
83
|
+
export type PendingCharacter = z.infer<typeof pendingCharacterSchema>;
|
|
84
|
+
export type CharacterSlot = z.infer<typeof characterSlotSchema>;
|
|
85
|
+
export type CreateCharacterBody = z.infer<typeof createCharacterBodySchema>;
|
|
86
|
+
export type CreateCharacterResponse = z.infer<typeof createCharacterResponseSchema>;
|
|
87
|
+
export type CharacterOptions = z.infer<typeof characterOptionsSchema>;
|
|
88
|
+
//# sourceMappingURL=characters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"characters.d.ts","sourceRoot":"","sources":["../../src/v1/characters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;iBAmB1B,CAAA;AAKF,eAAO,MAAM,sBAAsB;;;;;iBAKjC,CAAA;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;iBAG9B,CAAA;AAIF,eAAO,MAAM,eAAe,sCAAuC,CAAA;AACnE,eAAO,MAAM,mBAAmB;;;;EAA0B,CAAA;AAE1D,eAAO,MAAM,kBAAkB,KAAK,CAAA;AAEpC,eAAO,MAAM,yBAAyB;;;;;;;;;iBAYpC,CAAA;AAEF,eAAO,MAAM,6BAA6B;;;iBAA2D,CAAA;AAGrG,eAAO,MAAM,sBAAsB;;;;;;;;;;;iBAIjC,CAAA;AAEF,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA;AACvD,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAC/D,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA;AACrE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAC/D,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAC3E,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAA;AACnF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
// A .char the caller built here. `refs` are thumbnails pulled out of the file itself, so the list
|
|
3
|
+
// shows the references the character was actually encoded from rather than the upload beside it.
|
|
4
|
+
export const characterSchema = z.object({
|
|
5
|
+
id: z.uuid(),
|
|
6
|
+
name: z.string(),
|
|
7
|
+
description: z.string(),
|
|
8
|
+
/** The stem the worker wrote, which is also what a run's character picker sends back. */
|
|
9
|
+
fileName: z.string(),
|
|
10
|
+
// The key a run input carries. Same exposure as an upload's, which the browser already holds.
|
|
11
|
+
r2Key: z.string().max(512),
|
|
12
|
+
/** Which models this character carries a payload for. */
|
|
13
|
+
archs: z.array(z.string()),
|
|
14
|
+
bytes: z.number().int().nonnegative(),
|
|
15
|
+
// A signed link to the .char itself, so a character can be taken out of the cloud and used on a
|
|
16
|
+
// desktop. Add ?download=1 for an attachment; the grant still decides access.
|
|
17
|
+
downloadUrl: z.url(),
|
|
18
|
+
createdAt: z.iso.datetime(),
|
|
19
|
+
runId: z.uuid().nullable(),
|
|
20
|
+
// Signed links on the media gateway, never storage URLs. `thumbUrl` is signed without checking
|
|
21
|
+
// it exists, so a client falls back to `url` on a miss.
|
|
22
|
+
refs: z.array(z.object({ url: z.url(), thumbUrl: z.url() })),
|
|
23
|
+
});
|
|
24
|
+
// A character exists only once its run has written the .char, so a build in flight is not an item
|
|
25
|
+
// yet. Reported beside them rather than not at all: a library that looks empty for the minutes a
|
|
26
|
+
// build takes reads as a button that did nothing.
|
|
27
|
+
export const pendingCharacterSchema = z.object({
|
|
28
|
+
runId: z.uuid(),
|
|
29
|
+
name: z.string(),
|
|
30
|
+
status: z.string(),
|
|
31
|
+
createdAt: z.iso.datetime(),
|
|
32
|
+
});
|
|
33
|
+
export const characterListSchema = z.object({
|
|
34
|
+
items: z.array(characterSchema),
|
|
35
|
+
pending: z.array(pendingCharacterSchema),
|
|
36
|
+
});
|
|
37
|
+
// The three reference slots character/encode takes. `images` is the identity; the other two are
|
|
38
|
+
// optional and describe the same person's build and clothing.
|
|
39
|
+
export const CHARACTER_SLOTS = ['images', 'body', 'cloth'];
|
|
40
|
+
export const characterSlotSchema = z.enum(CHARACTER_SLOTS);
|
|
41
|
+
export const MAX_CHARACTER_REFS = 20;
|
|
42
|
+
export const createCharacterBodySchema = z.object({
|
|
43
|
+
name: z.string().trim().min(1).max(80),
|
|
44
|
+
description: z.string().trim().max(2000).default(''),
|
|
45
|
+
// At least one, because a character with no reference images is not a character.
|
|
46
|
+
archs: z.array(z.string().max(40)).min(1).max(8),
|
|
47
|
+
refResolution: z.number().int().min(256).max(2048).optional(),
|
|
48
|
+
files: z
|
|
49
|
+
.record(z.string(), z.object({ r2Key: z.string().min(1).max(512), contentType: z.string().max(100) }))
|
|
50
|
+
.default({}),
|
|
51
|
+
});
|
|
52
|
+
export const createCharacterResponseSchema = z.object({ runId: z.uuid(), characterName: z.string() });
|
|
53
|
+
// What the form needs to render: the models this worker can compile a payload for.
|
|
54
|
+
export const characterOptionsSchema = z.object({
|
|
55
|
+
archs: z.array(z.object({ value: z.string(), label: z.string() })),
|
|
56
|
+
maxRefs: z.number().int().positive(),
|
|
57
|
+
slots: z.array(characterSlotSchema),
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=characters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"characters.js","sourceRoot":"","sources":["../../src/v1/characters.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const REQUEST_ID_HEADER = "x-request-id";
|
|
3
|
+
export declare const idSchema: z.ZodString;
|
|
4
|
+
export declare const pageQuerySchema: z.ZodObject<{
|
|
5
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
6
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
export type PageQuery = z.infer<typeof pageQuerySchema>;
|
|
9
|
+
export declare function pageOf<T extends z.ZodTypeAny>(item: T): z.ZodObject<{
|
|
10
|
+
items: z.ZodArray<T>;
|
|
11
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/v1/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,iBAAiB,iBAAiB,CAAA;AAE/C,eAAO,MAAM,QAAQ,aAA4B,CAAA;AAGjD,eAAO,MAAM,eAAe;;;iBAG1B,CAAA;AAEF,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA;AAEvD,wBAAgB,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC;;;kBAErD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const REQUEST_ID_HEADER = 'x-request-id';
|
|
3
|
+
export const idSchema = z.string().min(1).max(64);
|
|
4
|
+
// Every list endpoint pages the same way, so a client writes the loop once.
|
|
5
|
+
export const pageQuerySchema = z.object({
|
|
6
|
+
cursor: z.string().max(512).optional(),
|
|
7
|
+
limit: z.coerce.number().int().min(1).max(100).default(25),
|
|
8
|
+
});
|
|
9
|
+
export function pageOf(item) {
|
|
10
|
+
return z.object({ items: z.array(item), nextCursor: z.string().nullable() });
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/v1/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,CAAC,MAAM,iBAAiB,GAAG,cAAc,CAAA;AAE/C,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;AAEjD,4EAA4E;AAC5E,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IACtC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;CAC3D,CAAC,CAAA;AAIF,MAAM,UAAU,MAAM,CAAyB,IAAO;IACpD,OAAO,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;AAC9E,CAAC"}
|