@omnichar/contracts 0.0.0-01d940d

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.
Files changed (113) hide show
  1. package/dist/errors.d.ts +39 -0
  2. package/dist/errors.d.ts.map +1 -0
  3. package/dist/errors.js +42 -0
  4. package/dist/errors.js.map +1 -0
  5. package/dist/index.d.ts +5 -0
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.js +5 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/manifest/index.d.ts +18 -0
  10. package/dist/manifest/index.d.ts.map +1 -0
  11. package/dist/manifest/index.js +13 -0
  12. package/dist/manifest/index.js.map +1 -0
  13. package/dist/result.d.ts +12 -0
  14. package/dist/result.d.ts.map +1 -0
  15. package/dist/result.js +7 -0
  16. package/dist/result.js.map +1 -0
  17. package/dist/v1/accessRequests.d.ts +11 -0
  18. package/dist/v1/accessRequests.d.ts.map +1 -0
  19. package/dist/v1/accessRequests.js +12 -0
  20. package/dist/v1/accessRequests.js.map +1 -0
  21. package/dist/v1/apiKeys.d.ts +38 -0
  22. package/dist/v1/apiKeys.d.ts.map +1 -0
  23. package/dist/v1/apiKeys.js +28 -0
  24. package/dist/v1/apiKeys.js.map +1 -0
  25. package/dist/v1/assets.d.ts +47 -0
  26. package/dist/v1/assets.d.ts.map +1 -0
  27. package/dist/v1/assets.js +24 -0
  28. package/dist/v1/assets.js.map +1 -0
  29. package/dist/v1/capacity.d.ts +48 -0
  30. package/dist/v1/capacity.d.ts.map +1 -0
  31. package/dist/v1/capacity.js +18 -0
  32. package/dist/v1/capacity.js.map +1 -0
  33. package/dist/v1/characterListings.d.ts +75 -0
  34. package/dist/v1/characterListings.d.ts.map +1 -0
  35. package/dist/v1/characterListings.js +68 -0
  36. package/dist/v1/characterListings.js.map +1 -0
  37. package/dist/v1/characters.d.ts +171 -0
  38. package/dist/v1/characters.d.ts.map +1 -0
  39. package/dist/v1/characters.js +111 -0
  40. package/dist/v1/characters.js.map +1 -0
  41. package/dist/v1/common.d.ts +13 -0
  42. package/dist/v1/common.d.ts.map +1 -0
  43. package/dist/v1/common.js +12 -0
  44. package/dist/v1/common.js.map +1 -0
  45. package/dist/v1/credits.d.ts +124 -0
  46. package/dist/v1/credits.d.ts.map +1 -0
  47. package/dist/v1/credits.js +82 -0
  48. package/dist/v1/credits.js.map +1 -0
  49. package/dist/v1/datasets.d.ts +153 -0
  50. package/dist/v1/datasets.d.ts.map +1 -0
  51. package/dist/v1/datasets.js +93 -0
  52. package/dist/v1/datasets.js.map +1 -0
  53. package/dist/v1/featureRequests.d.ts +29 -0
  54. package/dist/v1/featureRequests.d.ts.map +1 -0
  55. package/dist/v1/featureRequests.js +36 -0
  56. package/dist/v1/featureRequests.js.map +1 -0
  57. package/dist/v1/guest.d.ts +154 -0
  58. package/dist/v1/guest.d.ts.map +1 -0
  59. package/dist/v1/guest.js +91 -0
  60. package/dist/v1/guest.js.map +1 -0
  61. package/dist/v1/health.d.ts +13 -0
  62. package/dist/v1/health.d.ts.map +1 -0
  63. package/dist/v1/health.js +10 -0
  64. package/dist/v1/health.js.map +1 -0
  65. package/dist/v1/index.d.ts +24 -0
  66. package/dist/v1/index.d.ts.map +1 -0
  67. package/dist/v1/index.js +24 -0
  68. package/dist/v1/index.js.map +1 -0
  69. package/dist/v1/me.d.ts +30 -0
  70. package/dist/v1/me.d.ts.map +1 -0
  71. package/dist/v1/me.js +22 -0
  72. package/dist/v1/me.js.map +1 -0
  73. package/dist/v1/plans.d.ts +30 -0
  74. package/dist/v1/plans.d.ts.map +1 -0
  75. package/dist/v1/plans.js +19 -0
  76. package/dist/v1/plans.js.map +1 -0
  77. package/dist/v1/purchases.d.ts +40 -0
  78. package/dist/v1/purchases.d.ts.map +1 -0
  79. package/dist/v1/purchases.js +56 -0
  80. package/dist/v1/purchases.js.map +1 -0
  81. package/dist/v1/runs.d.ts +791 -0
  82. package/dist/v1/runs.d.ts.map +1 -0
  83. package/dist/v1/runs.js +257 -0
  84. package/dist/v1/runs.js.map +1 -0
  85. package/dist/v1/sessions.d.ts +486 -0
  86. package/dist/v1/sessions.d.ts.map +1 -0
  87. package/dist/v1/sessions.js +89 -0
  88. package/dist/v1/sessions.js.map +1 -0
  89. package/dist/v1/studio.d.ts +279 -0
  90. package/dist/v1/studio.d.ts.map +1 -0
  91. package/dist/v1/studio.js +309 -0
  92. package/dist/v1/studio.js.map +1 -0
  93. package/dist/v1/terms.d.ts +8 -0
  94. package/dist/v1/terms.d.ts.map +1 -0
  95. package/dist/v1/terms.js +15 -0
  96. package/dist/v1/terms.js.map +1 -0
  97. package/dist/v1/uploads.d.ts +60 -0
  98. package/dist/v1/uploads.d.ts.map +1 -0
  99. package/dist/v1/uploads.js +77 -0
  100. package/dist/v1/uploads.js.map +1 -0
  101. package/dist/v1/usernames.d.ts +35 -0
  102. package/dist/v1/usernames.d.ts.map +1 -0
  103. package/dist/v1/usernames.js +67 -0
  104. package/dist/v1/usernames.js.map +1 -0
  105. package/dist/v1/videoPricing.d.ts +70 -0
  106. package/dist/v1/videoPricing.d.ts.map +1 -0
  107. package/dist/v1/videoPricing.js +131 -0
  108. package/dist/v1/videoPricing.js.map +1 -0
  109. package/dist/v1/workflows.d.ts +201 -0
  110. package/dist/v1/workflows.d.ts.map +1 -0
  111. package/dist/v1/workflows.js +104 -0
  112. package/dist/v1/workflows.js.map +1 -0
  113. package/package.json +34 -0
@@ -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"}
@@ -0,0 +1,5 @@
1
+ export * from './result.js';
2
+ export * from './errors.js';
3
+ export * from './v1/index.js';
4
+ export * from './manifest/index.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -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,5 @@
1
+ export * from './result.js';
2
+ export * from './errors.js';
3
+ export * from './v1/index.js';
4
+ export * from './manifest/index.js';
5
+ //# sourceMappingURL=index.js.map
@@ -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"}
@@ -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,7 @@
1
+ export function ok(value) {
2
+ return { ok: true, value };
3
+ }
4
+ export function err(error) {
5
+ return { ok: false, error };
6
+ }
7
+ //# sourceMappingURL=result.js.map
@@ -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,11 @@
1
+ import { z } from 'zod';
2
+ export declare const accessRequestBodySchema: z.ZodObject<{
3
+ message: z.ZodOptional<z.ZodString>;
4
+ }, z.core.$strip>;
5
+ export declare const accessRequestResponseSchema: z.ZodObject<{
6
+ ok: z.ZodLiteral<true>;
7
+ alreadyRequested: z.ZodBoolean;
8
+ }, z.core.$strip>;
9
+ export type AccessRequestBody = z.infer<typeof accessRequestBodySchema>;
10
+ export type AccessRequestResponse = z.infer<typeof accessRequestResponseSchema>;
11
+ //# sourceMappingURL=accessRequests.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accessRequests.d.ts","sourceRoot":"","sources":["../../src/v1/accessRequests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,eAAO,MAAM,uBAAuB;;iBAElC,CAAA;AAEF,eAAO,MAAM,2BAA2B;;;iBAItC,CAAA;AAEF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA;AACvE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAA"}
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod';
2
+ // Asking to be let in, from inside the product. The email is never sent: it is read from the
3
+ // caller's verified session, so a request cannot be filed in somebody else's name.
4
+ export const accessRequestBodySchema = z.object({
5
+ message: z.string().trim().max(1000).optional(),
6
+ });
7
+ export const accessRequestResponseSchema = z.object({
8
+ ok: z.literal(true),
9
+ // True when this account already asked recently, so the UI can say so instead of thanking twice.
10
+ alreadyRequested: z.boolean(),
11
+ });
12
+ //# sourceMappingURL=accessRequests.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accessRequests.js","sourceRoot":"","sources":["../../src/v1/accessRequests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,6FAA6F;AAC7F,mFAAmF;AACnF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;CAChD,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IAClD,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;IACnB,iGAAiG;IACjG,gBAAgB,EAAE,CAAC,CAAC,OAAO,EAAE;CAC9B,CAAC,CAAA"}
@@ -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,75 @@
1
+ import { z } from 'zod';
2
+ export declare const characterDownloadBodySchema: z.ZodObject<{
3
+ slug: z.ZodString;
4
+ }, z.core.$strip>;
5
+ export declare const characterDownloadResponseSchema: z.ZodObject<{
6
+ url: z.ZodURL;
7
+ }, z.core.$strip>;
8
+ export type CharacterDownloadBody = z.infer<typeof characterDownloadBodySchema>;
9
+ export type CharacterDownloadResponse = z.infer<typeof characterDownloadResponseSchema>;
10
+ export declare const listingSourceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
11
+ kind: z.ZodLiteral<"upload">;
12
+ r2Key: z.ZodString;
13
+ }, z.core.$strip>, z.ZodObject<{
14
+ kind: z.ZodLiteral<"character">;
15
+ characterId: z.ZodUUID;
16
+ }, z.core.$strip>], "kind">;
17
+ export declare const showcaseEntrySchema: z.ZodObject<{
18
+ r2Key: z.ZodOptional<z.ZodString>;
19
+ artifactId: z.ZodOptional<z.ZodUUID>;
20
+ type: z.ZodEnum<{
21
+ image: "image";
22
+ video: "video";
23
+ }>;
24
+ prompt: z.ZodDefault<z.ZodString>;
25
+ model: z.ZodDefault<z.ZodString>;
26
+ }, z.core.$strip>;
27
+ export declare const inspectUploadBodySchema: z.ZodObject<{
28
+ r2Key: z.ZodString;
29
+ }, z.core.$strip>;
30
+ export declare const inspectUploadResponseSchema: z.ZodObject<{
31
+ archs: z.ZodArray<z.ZodString>;
32
+ refCount: z.ZodNumber;
33
+ hasAdapter: z.ZodBoolean;
34
+ bytes: z.ZodNumber;
35
+ }, z.core.$strip>;
36
+ export type InspectUploadBody = z.infer<typeof inspectUploadBodySchema>;
37
+ export type InspectUploadResponse = z.infer<typeof inspectUploadResponseSchema>;
38
+ export declare const createListingBodySchema: z.ZodObject<{
39
+ source: z.ZodDiscriminatedUnion<[z.ZodObject<{
40
+ kind: z.ZodLiteral<"upload">;
41
+ r2Key: z.ZodString;
42
+ }, z.core.$strip>, z.ZodObject<{
43
+ kind: z.ZodLiteral<"character">;
44
+ characterId: z.ZodUUID;
45
+ }, z.core.$strip>], "kind">;
46
+ title: z.ZodString;
47
+ summary: z.ZodString;
48
+ body: z.ZodDefault<z.ZodString>;
49
+ showcase: z.ZodArray<z.ZodObject<{
50
+ r2Key: z.ZodOptional<z.ZodString>;
51
+ artifactId: z.ZodOptional<z.ZodUUID>;
52
+ type: z.ZodEnum<{
53
+ image: "image";
54
+ video: "video";
55
+ }>;
56
+ prompt: z.ZodDefault<z.ZodString>;
57
+ model: z.ZodDefault<z.ZodString>;
58
+ }, z.core.$strip>>;
59
+ consent: z.ZodLiteral<true>;
60
+ }, z.core.$strip>;
61
+ export declare const createListingResponseSchema: z.ZodObject<{
62
+ slug: z.ZodString;
63
+ }, z.core.$strip>;
64
+ export type ListingSource = z.infer<typeof listingSourceSchema>;
65
+ export type CreateListingBody = z.infer<typeof createListingBodySchema>;
66
+ export type CreateListingResponse = z.infer<typeof createListingResponseSchema>;
67
+ export declare const importListingBodySchema: z.ZodObject<{
68
+ slug: z.ZodString;
69
+ }, z.core.$strip>;
70
+ export declare const importListingResponseSchema: z.ZodObject<{
71
+ characterId: z.ZodUUID;
72
+ }, z.core.$strip>;
73
+ export type ImportListingBody = z.infer<typeof importListingBodySchema>;
74
+ export type ImportListingResponse = z.infer<typeof importListingResponseSchema>;
75
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AAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA;AACvE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAA"}
@@ -0,0 +1,68 @@
1
+ import { z } from 'zod';
2
+ // A download link for a published character. The caller names the public slug; the object key is
3
+ // looked up server-side, because a key parameter would be a request to sign a read of any object.
4
+ export const characterDownloadBodySchema = z.object({
5
+ slug: z.string().min(2).max(80),
6
+ });
7
+ export const characterDownloadResponseSchema = z.object({
8
+ url: z.url(),
9
+ });
10
+ // Where a listing's bytes come from. An upload is inspected; a character the caller already built in
11
+ // the cloud is read off its row, which is why publishing one copies no archive.
12
+ export const listingSourceSchema = z.discriminatedUnion('kind', [
13
+ z.object({ kind: z.literal('upload'), r2Key: z.string().min(1).max(500) }),
14
+ z.object({ kind: z.literal('character'), characterId: z.uuid() }),
15
+ ]);
16
+ export const showcaseEntrySchema = z
17
+ .object({
18
+ // The caller's own upload, which publishing copies into the public bucket. A key rather than a
19
+ // URL, and the public key is derived server-side: a listing can then hold no URL at all, so no
20
+ // row can ever point a gallery page at a third party.
21
+ r2Key: z.string().min(1).max(500).optional(),
22
+ // A take the caller already generated, named by id because Cloud Studio is never told a storage
23
+ // key. The key is looked up from the id against the caller's own runs.
24
+ artifactId: z.uuid().optional(),
25
+ type: z.enum(['image', 'video']),
26
+ // What the publisher typed to make this one. Free text, capped so twelve of them cannot make a
27
+ // listing row unbounded; the empty string is stored as "not shared" rather than as a blank panel.
28
+ prompt: z.string().trim().max(2000).default(''),
29
+ // Which model made it. Checked against the archs parsed out of the file, never taken on trust: a
30
+ // tag naming a model the character has no payload for is a claim the file does not support.
31
+ model: z.string().trim().max(40).default(''),
32
+ })
33
+ .refine((entry) => (entry.r2Key === undefined) !== (entry.artifactId === undefined), {
34
+ message: 'A showcase entry names an upload or a generated take, never both and never neither.',
35
+ });
36
+ // What an uploaded .char turns out to contain, so the publish form can offer the models the file
37
+ // actually carries instead of asking the publisher to name one.
38
+ export const inspectUploadBodySchema = z.object({
39
+ r2Key: z.string().min(1).max(500),
40
+ });
41
+ export const inspectUploadResponseSchema = z.object({
42
+ archs: z.array(z.string()),
43
+ refCount: z.number().int().nonnegative(),
44
+ hasAdapter: z.boolean(),
45
+ bytes: z.number().int().nonnegative(),
46
+ });
47
+ export const createListingBodySchema = z.object({
48
+ source: listingSourceSchema,
49
+ title: z.string().trim().min(1).max(120),
50
+ summary: z.string().trim().min(1).max(280),
51
+ body: z.string().trim().max(20000).default(''),
52
+ showcase: z.array(showcaseEntrySchema).min(1).max(12),
53
+ // The only thing standing between this gallery and a wall of photographs of people who never
54
+ // agreed to appear in one. A literal, so an absent or false value is a schema failure.
55
+ consent: z.literal(true),
56
+ });
57
+ export const createListingResponseSchema = z.object({
58
+ slug: z.string(),
59
+ });
60
+ // Copying a published character into the caller's own library, so the run picker can resolve it. The
61
+ // caller names the public slug; the object key is never theirs to name.
62
+ export const importListingBodySchema = z.object({
63
+ slug: z.string().min(2).max(80),
64
+ });
65
+ export const importListingResponseSchema = z.object({
66
+ characterId: z.uuid(),
67
+ });
68
+ //# sourceMappingURL=characterListings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"characterListings.js","sourceRoot":"","sources":["../../src/v1/characterListings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,iGAAiG;AACjG,kGAAkG;AAClG,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IAClD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;CAChC,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC,MAAM,CAAC;IACtD,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE;CACb,CAAC,CAAA;AAKF,qGAAqG;A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