@game-infra/api-schemas-core 0.0.0 → 0.4.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Igor Savin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @game-infra/api-schemas-core
2
2
 
3
- Generic service API contract: valibot schemas plus [toad-contracts](https://github.com/kibertoad/toad-contracts) `defineApiContract` definitions for auth, savegame, game-entity CRUD, admin backup, feedback, and heartbeat. This is the base contract every game backend and frontend shares; the event-editor, balance, file-storage, and progress-tracker contracts build on it.
3
+ Generic service API contract: valibot schemas plus [toad-contracts](https://github.com/kibertoad/toad-contracts) `defineApiContract` definitions for auth, service tokens, savegame, game-entity CRUD, admin backup, feedback, and heartbeat. This is the base contract every game backend and frontend shares; the event-editor, balance, file-storage, and progress-tracker contracts build on it.
4
4
 
5
5
  Published to npm. Also consumable as sibling source (`exports` points at `src/`).
6
6
 
@@ -44,6 +44,36 @@ const { getApiUrl } = createApiUrlResolver({ productionUrl: "https://api.example
44
44
  getApiUrl(window.location.hostname); // dev URL on localhost, prod otherwise
45
45
  ```
46
46
 
47
+ ### Service tokens
48
+
49
+ `serviceTokenCreateContract`, `serviceTokenListContract`, `serviceTokenRevokeContract`, `serviceTokenValidateContract`, and `serviceTokenPurgeContract` cover the credentials scripts and backend services present to game-infra APIs. The token appears in exactly one response — the one that creates it:
50
+
51
+ ```ts
52
+ import { serviceTokenCreateContract, ServiceTokenValidation } from "@game-infra/api-schemas-core";
53
+ import { sendByApiContract } from "@toad-contracts/frontend-http-client";
54
+
55
+ const created = await sendByApiContract(client, serviceTokenCreateContract, {
56
+ body: { name: "nightly-import", ttlSeconds: ServiceTokenValidation.DEFAULT_TTL_SECONDS },
57
+ });
58
+ created.token; // shown once; the issuer never stores it
59
+ ```
60
+
61
+ `ServiceTokenSchema` is what the issuer does store: id, owner, claims, issue time, expiry, revocation time. That is enough to revoke a token and nothing more, which is why revocation has to be checked with `serviceTokenValidateContract` rather than inferred from a signature.
62
+
63
+ ### Account administration
64
+
65
+ `userListContract`, `userCreateContract`, `userUpdateContract`, and `userDeleteContract` serve `/users` on identity-service, for accounts holding the `admin` claim. `UserAccountSchema` never carries the password hash; `hasPassword` says whether the account has one that can match at login. Claims are lowercase tokens (`UserAdminValidation.CLAIM_PATTERN`), because every consumer compares them byte for byte:
66
+
67
+ ```ts
68
+ import { userUpdateContract } from "@game-infra/api-schemas-core";
69
+ import { sendByApiContract } from "@toad-contracts/frontend-http-client";
70
+
71
+ await sendByApiContract(client, userUpdateContract, {
72
+ pathParams: { userId: "42" },
73
+ body: { claims: ["admin"], password: "new-secret" },
74
+ });
75
+ ```
76
+
47
77
  ## Extension points
48
78
 
49
79
  - **Entity types**: `entityType` is a plain `string()`. The old `EntityTypes` enum (spell/item/persona/secret) was dropped; games re-tighten it via their own config/validation.
package/dist/auth.d.ts CHANGED
@@ -7,13 +7,25 @@ export declare const AuthValidation: {
7
7
  readonly MAX_PASSWORD_LENGTH: 128;
8
8
  readonly MIN_USERNAME_LENGTH: 3;
9
9
  readonly MAX_USERNAME_LENGTH: 64;
10
+ /**
11
+ * Usernames may not contain `@` or whitespace.
12
+ *
13
+ * Login takes a single `identifier` matched against both usernames and
14
+ * emails, so the two namespaces have to stay disjoint. Otherwise registering
15
+ * the username `victim@example.com` makes that account a second candidate for
16
+ * the victim's own email, and which row wins is not the victim's to decide.
17
+ */
18
+ readonly USERNAME_PATTERN: RegExp;
10
19
  };
11
20
  /**
12
21
  * Registration request schema
22
+ *
23
+ * @deprecated identity-service no longer accepts self-registration; use
24
+ * `CreateUserRequestSchema` with `userCreateContract`.
13
25
  */
14
26
  export declare const RegisterRequestSchema: import("valibot").ObjectSchema<{
15
27
  readonly email: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").EmailAction<string, undefined>]>;
16
- readonly username: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 3, undefined>, import("valibot").MaxLengthAction<string, 64, undefined>]>;
28
+ readonly username: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 3, undefined>, import("valibot").MaxLengthAction<string, 64, undefined>, import("valibot").RegexAction<string, "Username may not contain @ or whitespace">]>;
17
29
  readonly password: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 6, undefined>, import("valibot").MaxLengthAction<string, 128, undefined>]>;
18
30
  }, undefined>;
19
31
  export type RegisterRequest = InferOutput<typeof RegisterRequestSchema>;
@@ -27,6 +39,9 @@ export declare const AuthResponseFieldsSchema: {
27
39
  };
28
40
  /**
29
41
  * Registration response schema
42
+ *
43
+ * @deprecated identity-service no longer accepts self-registration; use
44
+ * `UserResponseSchema` with `userCreateContract`.
30
45
  */
31
46
  export declare const RegisterResponseSchema: import("valibot").ObjectSchema<{
32
47
  readonly success: import("valibot").BooleanSchema<undefined>;
@@ -89,4 +104,38 @@ export declare const ValidateServiceTokenResponseSchema: import("valibot").Objec
89
104
  valid: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
90
105
  }, undefined>;
91
106
  export type ValidateServiceTokenResponse = InferOutput<typeof ValidateServiceTokenResponseSchema>;
107
+ /**
108
+ * Identity-service readiness response.
109
+ *
110
+ * Individual checks are added as optional keys, and stay optional. A consumer
111
+ * upgrades this package before the service it polls is redeployed — that gap is
112
+ * a rollout, not a fault — and a required key would turn readiness into a parse
113
+ * error for the duration, exactly when someone is watching it to decide whether
114
+ * the rollout worked. `failedChecks` is the field to act on either way.
115
+ *
116
+ * @example
117
+ * ```ts
118
+ * import { IdentityReadinessResponseSchema } from '@game-infra/api-schemas-core'
119
+ * ```
120
+ */
121
+ export declare const IdentityReadinessResponseSchema: import("valibot").ObjectSchema<{
122
+ readonly success: import("valibot").BooleanSchema<undefined>;
123
+ readonly checks: import("valibot").ObjectSchema<{
124
+ readonly jwtSecret: import("valibot").BooleanSchema<undefined>;
125
+ readonly usersTable: import("valibot").BooleanSchema<undefined>;
126
+ /** Absent from a deployment predating service tokens. */
127
+ readonly serviceTokensTable: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
128
+ }, undefined>;
129
+ readonly failedChecks: import("valibot").ArraySchema<import("valibot").UnionSchema<[import("valibot").LiteralSchema<"jwtSecret", undefined>, import("valibot").LiteralSchema<"usersTable", undefined>, import("valibot").LiteralSchema<"serviceTokensTable", undefined>], undefined>, undefined>;
130
+ }, undefined>;
131
+ /**
132
+ * Inferred identity-service readiness response.
133
+ *
134
+ * @example
135
+ * ```ts
136
+ * import type { IdentityReadinessResponse } from '@game-infra/api-schemas-core'
137
+ * const ready: IdentityReadinessResponse['success'] = true
138
+ * ```
139
+ */
140
+ export type IdentityReadinessResponse = InferOutput<typeof IdentityReadinessResponseSchema>;
92
141
  //# sourceMappingURL=auth.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,WAAW,EAUjB,MAAM,SAAS,CAAC;AAGjB;;GAEG;AACH,eAAO,MAAM,cAAc;aACzB,mBAAmB,EAAE,CAAC;aACtB,mBAAmB,EAAE,GAAG;aACxB,mBAAmB,EAAE,CAAC;aACtB,mBAAmB,EAAE,EAAE;CACf,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;aAYhC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAExE;;GAEG;AACH,eAAO,MAAM,wBAAwB;IACnC,KAAK;IACL,MAAM;IACN,QAAQ;CACT,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;;;aAAwD,CAAC;AAE5F,MAAM,MAAM,gBAAgB,GAAG,WAAW,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE1E;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;aAG7B,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,WAAW,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAElE;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;;;;;;aAAwD,CAAC;AAEzF,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEpE;;GAEG;AACH,eAAO,MAAM,0BAA0B;;aAErC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,WAAW,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAElF;;GAEG;AACH,eAAO,MAAM,2BAA2B;;;;;;;aAItC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,WAAW,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEpF;;;;GAIG;AACH,eAAO,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,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEpF;;;;GAIG;AACH,eAAO,MAAM,kCAAkC;;;;;aAE7C,CAAC;AAEH,MAAM,MAAM,4BAA4B,GAAG,WAAW,CAAC,OAAO,kCAAkC,CAAC,CAAC;AAElG;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,+BAA+B;;;;;QAKxC,yDAAyD;;;;aAM3D,CAAC;AAEH;;;;;;;;GAQG;AACH,MAAM,MAAM,yBAAyB,GAAG,WAAW,CAAC,OAAO,+BAA+B,CAAC,CAAC"}
package/dist/auth.js CHANGED
@@ -1,4 +1,4 @@
1
- import { boolean, email, maxLength, minLength, number, object, optional, pipe, string, } from "valibot";
1
+ import { boolean, array, literal, email, maxLength, minLength, number, object, optional, pipe, regex, string, union, } from "valibot";
2
2
  import { createSuccessResponseSchema } from "./common.js";
3
3
  /**
4
4
  * Validation constants - single source of truth for both FE and BE
@@ -8,13 +8,25 @@ export const AuthValidation = {
8
8
  MAX_PASSWORD_LENGTH: 128,
9
9
  MIN_USERNAME_LENGTH: 3,
10
10
  MAX_USERNAME_LENGTH: 64,
11
+ /**
12
+ * Usernames may not contain `@` or whitespace.
13
+ *
14
+ * Login takes a single `identifier` matched against both usernames and
15
+ * emails, so the two namespaces have to stay disjoint. Otherwise registering
16
+ * the username `victim@example.com` makes that account a second candidate for
17
+ * the victim's own email, and which row wins is not the victim's to decide.
18
+ */
19
+ USERNAME_PATTERN: /^[^\s@]+$/,
11
20
  };
12
21
  /**
13
22
  * Registration request schema
23
+ *
24
+ * @deprecated identity-service no longer accepts self-registration; use
25
+ * `CreateUserRequestSchema` with `userCreateContract`.
14
26
  */
15
27
  export const RegisterRequestSchema = object({
16
28
  email: pipe(string(), email()),
17
- username: pipe(string(), minLength(AuthValidation.MIN_USERNAME_LENGTH), maxLength(AuthValidation.MAX_USERNAME_LENGTH)),
29
+ username: pipe(string(), minLength(AuthValidation.MIN_USERNAME_LENGTH), maxLength(AuthValidation.MAX_USERNAME_LENGTH), regex(AuthValidation.USERNAME_PATTERN, "Username may not contain @ or whitespace")),
18
30
  password: pipe(string(), minLength(AuthValidation.MIN_PASSWORD_LENGTH), maxLength(AuthValidation.MAX_PASSWORD_LENGTH)),
19
31
  });
20
32
  /**
@@ -27,6 +39,9 @@ export const AuthResponseFieldsSchema = {
27
39
  };
28
40
  /**
29
41
  * Registration response schema
42
+ *
43
+ * @deprecated identity-service no longer accepts self-registration; use
44
+ * `UserResponseSchema` with `userCreateContract`.
30
45
  */
31
46
  export const RegisterResponseSchema = createSuccessResponseSchema(AuthResponseFieldsSchema);
32
47
  /**
@@ -63,4 +78,28 @@ export const ValidateTokenResponseSchema = createSuccessResponseSchema({
63
78
  export const ValidateServiceTokenResponseSchema = createSuccessResponseSchema({
64
79
  valid: optional(boolean()),
65
80
  });
81
+ /**
82
+ * Identity-service readiness response.
83
+ *
84
+ * Individual checks are added as optional keys, and stay optional. A consumer
85
+ * upgrades this package before the service it polls is redeployed — that gap is
86
+ * a rollout, not a fault — and a required key would turn readiness into a parse
87
+ * error for the duration, exactly when someone is watching it to decide whether
88
+ * the rollout worked. `failedChecks` is the field to act on either way.
89
+ *
90
+ * @example
91
+ * ```ts
92
+ * import { IdentityReadinessResponseSchema } from '@game-infra/api-schemas-core'
93
+ * ```
94
+ */
95
+ export const IdentityReadinessResponseSchema = object({
96
+ success: boolean(),
97
+ checks: object({
98
+ jwtSecret: boolean(),
99
+ usersTable: boolean(),
100
+ /** Absent from a deployment predating service tokens. */
101
+ serviceTokensTable: optional(boolean()),
102
+ }),
103
+ failedChecks: array(union([literal("jwtSecret"), literal("usersTable"), literal("serviceTokensTable")])),
104
+ });
66
105
  //# sourceMappingURL=auth.js.map
package/dist/auth.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,OAAO,EACP,KAAK,EACL,SAAS,EACT,SAAS,EACT,MAAM,EACN,MAAM,E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AAEH,MAAM,MAAM,qBAAqB,GAAG,WAAW,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEpF;;;GAGG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;aAEvC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,WAAW,CAAC,OAAO,4BAA4B,CAAC,CAAC"}
1
+ {"version":3,"file":"backup.d.ts","sourceRoot":"","sources":["../src/backup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAA2C,MAAM,SAAS,CAAC;AAIpF;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;;aAO3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,WAAW,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE9D;;GAEG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;aAKtC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,WAAW,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEpF;;GAEG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;aAEpC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,WAAW,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAEhF;;GAEG;AACH,eAAO,MAAM,0BAA0B;;;aAGrC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,WAAW,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAElF;;GAEG;AACH,eAAO,MAAM,2BAA2B;;;;;;aAGtC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,WAAW,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEpF;;;GAGG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;aAEvC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,WAAW,CAAC,OAAO,4BAA4B,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"backup.js","sourceRoot":"","sources":["../src/backup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,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Aa,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;IACjC,yBAAyB,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;CAC9C,CAAC,CAAC;AAIH;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,2BAA2B,CAAC;IACtE,MAAM,EAAE,QAAQ,CAAC,gBAAgB,CAAC;CACnC,CAAC,CAAC"}
@@ -17,12 +17,26 @@ import { ContractNoBody } from "@toad-contracts/valibot";
17
17
  * // '/games/g1/entities/item/e1'
18
18
  * ```
19
19
  */
20
+ /**
21
+ * Self-registration.
22
+ *
23
+ * @deprecated identity-service no longer serves `/auth/register`: accounts are
24
+ * created by an admin with {@link userCreateContract}. Kept so consumers still
25
+ * typecheck while they drop their sign-up forms; it will be removed in a later
26
+ * release.
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * import { userCreateContract } from '@game-infra/api-schemas-core'
31
+ * userCreateContract.pathResolver({}) // '/users'
32
+ * ```
33
+ */
20
34
  export declare const authRegisterContract: {
21
35
  readonly method: "post";
22
36
  readonly pathResolver: () => string;
23
37
  readonly requestBodySchema: import("valibot").ObjectSchema<{
24
38
  readonly email: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").EmailAction<string, undefined>]>;
25
- readonly username: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 3, undefined>, import("valibot").MaxLengthAction<string, 64, undefined>]>;
39
+ readonly username: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 3, undefined>, import("valibot").MaxLengthAction<string, 64, undefined>, import("valibot").RegexAction<string, "Username may not contain @ or whitespace">]>;
26
40
  readonly password: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 6, undefined>, import("valibot").MaxLengthAction<string, 128, undefined>]>;
27
41
  }, undefined>;
28
42
  readonly responsesByStatusCode: {
@@ -83,6 +97,338 @@ export declare const authValidateServiceTokenContract: {
83
97
  }, undefined>;
84
98
  };
85
99
  };
100
+ /**
101
+ * Identity-service readiness contract.
102
+ *
103
+ * @example
104
+ * ```ts
105
+ * import { identityReadinessContract } from '@game-infra/api-schemas-core'
106
+ * identityReadinessContract.pathResolver({}) // '/ready'
107
+ * ```
108
+ */
109
+ export declare const identityReadinessContract: {
110
+ readonly method: "get";
111
+ readonly pathResolver: () => string;
112
+ readonly responsesByStatusCode: {
113
+ 200: import("valibot").ObjectSchema<{
114
+ readonly success: import("valibot").BooleanSchema<undefined>;
115
+ readonly checks: import("valibot").ObjectSchema<{
116
+ readonly jwtSecret: import("valibot").BooleanSchema<undefined>;
117
+ readonly usersTable: import("valibot").BooleanSchema<undefined>;
118
+ readonly serviceTokensTable: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
119
+ }, undefined>;
120
+ readonly failedChecks: import("valibot").ArraySchema<import("valibot").UnionSchema<[import("valibot").LiteralSchema<"jwtSecret", undefined>, import("valibot").LiteralSchema<"usersTable", undefined>, import("valibot").LiteralSchema<"serviceTokensTable", undefined>], undefined>, undefined>;
121
+ }, undefined>;
122
+ 503: import("valibot").ObjectSchema<{
123
+ readonly success: import("valibot").BooleanSchema<undefined>;
124
+ readonly checks: import("valibot").ObjectSchema<{
125
+ readonly jwtSecret: import("valibot").BooleanSchema<undefined>;
126
+ readonly usersTable: import("valibot").BooleanSchema<undefined>;
127
+ readonly serviceTokensTable: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
128
+ }, undefined>;
129
+ readonly failedChecks: import("valibot").ArraySchema<import("valibot").UnionSchema<[import("valibot").LiteralSchema<"jwtSecret", undefined>, import("valibot").LiteralSchema<"usersTable", undefined>, import("valibot").LiteralSchema<"serviceTokensTable", undefined>], undefined>, undefined>;
130
+ }, undefined>;
131
+ };
132
+ };
133
+ /**
134
+ * Mint a service token for the authenticated account.
135
+ *
136
+ * The response is the only place the token ever appears; the issuer keeps a
137
+ * record of its id, owner, and expiry so it can be revoked, and nothing else.
138
+ *
139
+ * @example
140
+ * ```ts
141
+ * import { serviceTokenCreateContract } from '@game-infra/api-schemas-core'
142
+ * serviceTokenCreateContract.pathResolver({}) // '/service-tokens'
143
+ * ```
144
+ */
145
+ export declare const serviceTokenCreateContract: {
146
+ readonly method: "post";
147
+ readonly pathResolver: () => string;
148
+ readonly requestBodySchema: import("valibot").ObjectSchema<{
149
+ readonly name: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 1, "Name is required">, import("valibot").MaxLengthAction<string, 100, undefined>]>;
150
+ readonly ttlSeconds: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, "TTL must be a whole number of seconds">, import("valibot").MinValueAction<number, number, undefined>, import("valibot").MaxValueAction<number, number, undefined>]>, undefined>;
151
+ readonly claims: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").StringSchema<undefined>, undefined>, undefined>;
152
+ }, undefined>;
153
+ readonly responsesByStatusCode: {
154
+ 200: import("valibot").ObjectSchema<{
155
+ readonly success: import("valibot").BooleanSchema<undefined>;
156
+ readonly error: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
157
+ } & {
158
+ token: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
159
+ serviceToken: import("valibot").OptionalSchema<import("valibot").ObjectSchema<{
160
+ readonly id: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").RegexAction<string, "Not a service-token id">]>;
161
+ readonly name: import("valibot").StringSchema<undefined>;
162
+ readonly userId: import("valibot").NumberSchema<undefined>;
163
+ readonly username: import("valibot").StringSchema<undefined>;
164
+ readonly claims: import("valibot").ArraySchema<import("valibot").StringSchema<undefined>, undefined>;
165
+ readonly createdAt: import("valibot").StringSchema<undefined>;
166
+ readonly expiresAt: import("valibot").StringSchema<undefined>;
167
+ readonly revokedAt: import("valibot").NullableSchema<import("valibot").StringSchema<undefined>, undefined>;
168
+ readonly lastUsedAt: import("valibot").NullableSchema<import("valibot").StringSchema<undefined>, undefined>;
169
+ }, undefined>, undefined>;
170
+ }, undefined>;
171
+ };
172
+ };
173
+ /**
174
+ * List the authenticated account's service tokens, newest first.
175
+ *
176
+ * @example
177
+ * ```ts
178
+ * import { serviceTokenListContract } from '@game-infra/api-schemas-core'
179
+ * serviceTokenListContract.pathResolver({}) // '/service-tokens'
180
+ * ```
181
+ */
182
+ export declare const serviceTokenListContract: {
183
+ readonly method: "get";
184
+ readonly pathResolver: () => string;
185
+ readonly responsesByStatusCode: {
186
+ 200: import("valibot").ObjectSchema<{
187
+ readonly success: import("valibot").BooleanSchema<undefined>;
188
+ readonly error: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
189
+ } & {
190
+ serviceTokens: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").ObjectSchema<{
191
+ readonly id: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").RegexAction<string, "Not a service-token id">]>;
192
+ readonly name: import("valibot").StringSchema<undefined>;
193
+ readonly userId: import("valibot").NumberSchema<undefined>;
194
+ readonly username: import("valibot").StringSchema<undefined>;
195
+ readonly claims: import("valibot").ArraySchema<import("valibot").StringSchema<undefined>, undefined>;
196
+ readonly createdAt: import("valibot").StringSchema<undefined>;
197
+ readonly expiresAt: import("valibot").StringSchema<undefined>;
198
+ readonly revokedAt: import("valibot").NullableSchema<import("valibot").StringSchema<undefined>, undefined>;
199
+ readonly lastUsedAt: import("valibot").NullableSchema<import("valibot").StringSchema<undefined>, undefined>;
200
+ }, undefined>, undefined>, undefined>;
201
+ retentionSeconds: import("valibot").OptionalSchema<import("valibot").NumberSchema<undefined>, undefined>;
202
+ }, undefined>;
203
+ };
204
+ };
205
+ /**
206
+ * Revoke one service token by id.
207
+ *
208
+ * @example
209
+ * ```ts
210
+ * import { serviceTokenRevokeContract } from '@game-infra/api-schemas-core'
211
+ * serviceTokenRevokeContract.pathResolver({ tokenId: 'st_0123456789abcdef0123456789abcdef' })
212
+ * // '/service-tokens/st_0123456789abcdef0123456789abcdef'
213
+ * ```
214
+ */
215
+ export declare const serviceTokenRevokeContract: {
216
+ readonly method: "delete";
217
+ readonly requestPathParamsSchema: import("valibot").ObjectSchema<{
218
+ readonly tokenId: import("valibot").StringSchema<undefined>;
219
+ }, undefined> & import("@toad-contracts/valibot").StandardObjectKeysV1<unknown, unknown>;
220
+ readonly pathResolver: ({ tokenId }: {
221
+ tokenId: string;
222
+ }) => string;
223
+ readonly responsesByStatusCode: {
224
+ 200: import("valibot").ObjectSchema<{
225
+ readonly success: import("valibot").BooleanSchema<undefined>;
226
+ readonly error: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
227
+ } & {
228
+ serviceToken: import("valibot").OptionalSchema<import("valibot").ObjectSchema<{
229
+ readonly id: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").RegexAction<string, "Not a service-token id">]>;
230
+ readonly name: import("valibot").StringSchema<undefined>;
231
+ readonly userId: import("valibot").NumberSchema<undefined>;
232
+ readonly username: import("valibot").StringSchema<undefined>;
233
+ readonly claims: import("valibot").ArraySchema<import("valibot").StringSchema<undefined>, undefined>;
234
+ readonly createdAt: import("valibot").StringSchema<undefined>;
235
+ readonly expiresAt: import("valibot").StringSchema<undefined>;
236
+ readonly revokedAt: import("valibot").NullableSchema<import("valibot").StringSchema<undefined>, undefined>;
237
+ readonly lastUsedAt: import("valibot").NullableSchema<import("valibot").StringSchema<undefined>, undefined>;
238
+ }, undefined>, undefined>;
239
+ }, undefined>;
240
+ };
241
+ };
242
+ /**
243
+ * Check a service token's signature, expiry, and revocation state.
244
+ *
245
+ * `/auth/validate` cannot answer this: a signature proves only that the token
246
+ * was minted with this secret, and a revoked token keeps its signature.
247
+ *
248
+ * @example
249
+ * ```ts
250
+ * import { serviceTokenValidateContract } from '@game-infra/api-schemas-core'
251
+ * serviceTokenValidateContract.pathResolver({}) // '/service-tokens/validate'
252
+ * ```
253
+ */
254
+ export declare const serviceTokenValidateContract: {
255
+ readonly method: "post";
256
+ readonly pathResolver: () => string;
257
+ readonly requestBodySchema: import("valibot").ObjectSchema<{
258
+ readonly token: import("valibot").StringSchema<undefined>;
259
+ }, undefined>;
260
+ readonly responsesByStatusCode: {
261
+ 200: import("valibot").ObjectSchema<{
262
+ readonly success: import("valibot").BooleanSchema<undefined>;
263
+ readonly error: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
264
+ } & {
265
+ valid: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
266
+ reason: import("valibot").OptionalSchema<import("valibot").UnionSchema<[import("valibot").LiteralSchema<"invalid", undefined>, import("valibot").LiteralSchema<"expired", undefined>, import("valibot").LiteralSchema<"revoked", undefined>, import("valibot").LiteralSchema<"unknown", undefined>, import("valibot").LiteralSchema<"wrongTokenType", undefined>], undefined>, undefined>;
267
+ tokenId: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
268
+ userId: import("valibot").OptionalSchema<import("valibot").NumberSchema<undefined>, undefined>;
269
+ username: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
270
+ claims: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").StringSchema<undefined>, undefined>, undefined>;
271
+ expiresAt: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
272
+ }, undefined>;
273
+ };
274
+ };
275
+ /**
276
+ * Delete token records that have expired past the retention window.
277
+ *
278
+ * Runs on a schedule too; the endpoint exists so an operator or the console can
279
+ * ask for it without waiting for the next cron tick.
280
+ *
281
+ * @example
282
+ * ```ts
283
+ * import { serviceTokenPurgeContract } from '@game-infra/api-schemas-core'
284
+ * serviceTokenPurgeContract.pathResolver({}) // '/service-tokens/purge'
285
+ * ```
286
+ */
287
+ export declare const serviceTokenPurgeContract: {
288
+ readonly method: "post";
289
+ readonly pathResolver: () => string;
290
+ readonly requestBodySchema: typeof ContractNoBody;
291
+ readonly responsesByStatusCode: {
292
+ 200: import("valibot").ObjectSchema<{
293
+ readonly success: import("valibot").BooleanSchema<undefined>;
294
+ readonly error: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
295
+ } & {
296
+ purged: import("valibot").OptionalSchema<import("valibot").NumberSchema<undefined>, undefined>;
297
+ retentionSeconds: import("valibot").OptionalSchema<import("valibot").NumberSchema<undefined>, undefined>;
298
+ }, undefined>;
299
+ };
300
+ };
301
+ /**
302
+ * List every account. Requires the `admin` claim.
303
+ *
304
+ * @example
305
+ * ```ts
306
+ * import { userListContract } from '@game-infra/api-schemas-core'
307
+ * userListContract.pathResolver({}) // '/users'
308
+ * ```
309
+ */
310
+ export declare const userListContract: {
311
+ readonly method: "get";
312
+ readonly pathResolver: () => string;
313
+ readonly responsesByStatusCode: {
314
+ 200: import("valibot").ObjectSchema<{
315
+ readonly success: import("valibot").BooleanSchema<undefined>;
316
+ readonly error: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
317
+ } & {
318
+ users: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").ObjectSchema<{
319
+ readonly id: import("valibot").NumberSchema<undefined>;
320
+ readonly username: import("valibot").StringSchema<undefined>;
321
+ readonly email: import("valibot").NullableSchema<import("valibot").StringSchema<undefined>, undefined>;
322
+ readonly claims: import("valibot").ArraySchema<import("valibot").StringSchema<undefined>, undefined>;
323
+ readonly hasPassword: import("valibot").BooleanSchema<undefined>;
324
+ readonly createdAt: import("valibot").StringSchema<undefined>;
325
+ readonly updatedAt: import("valibot").StringSchema<undefined>;
326
+ }, undefined>, undefined>, undefined>;
327
+ }, undefined>;
328
+ };
329
+ };
330
+ /**
331
+ * Create an account, optionally with claims. Requires the `admin` claim.
332
+ *
333
+ * @example
334
+ * ```ts
335
+ * import { userCreateContract } from '@game-infra/api-schemas-core'
336
+ * userCreateContract.pathResolver({}) // '/users'
337
+ * ```
338
+ */
339
+ export declare const userCreateContract: {
340
+ readonly method: "post";
341
+ readonly pathResolver: () => string;
342
+ readonly requestBodySchema: import("valibot").ObjectSchema<{
343
+ readonly username: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 3, undefined>, import("valibot").MaxLengthAction<string, 64, undefined>, import("valibot").RegexAction<string, "Username may not contain @ or whitespace">]>;
344
+ readonly email: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").EmailAction<string, undefined>]>, undefined>;
345
+ readonly password: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 6, undefined>, import("valibot").MaxLengthAction<string, 128, undefined>]>;
346
+ readonly claims: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").ArraySchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MaxLengthAction<string, 64, undefined>, import("valibot").RegexAction<string, "Claims are lowercase letters, digits, '.', ':', '_' or '-', starting with a letter">]>, undefined>, import("valibot").MaxLengthAction<string[], 32, undefined>]>, undefined>;
347
+ }, undefined>;
348
+ readonly responsesByStatusCode: {
349
+ 200: import("valibot").ObjectSchema<{
350
+ readonly success: import("valibot").BooleanSchema<undefined>;
351
+ readonly error: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
352
+ } & {
353
+ user: import("valibot").OptionalSchema<import("valibot").ObjectSchema<{
354
+ readonly id: import("valibot").NumberSchema<undefined>;
355
+ readonly username: import("valibot").StringSchema<undefined>;
356
+ readonly email: import("valibot").NullableSchema<import("valibot").StringSchema<undefined>, undefined>;
357
+ readonly claims: import("valibot").ArraySchema<import("valibot").StringSchema<undefined>, undefined>;
358
+ readonly hasPassword: import("valibot").BooleanSchema<undefined>;
359
+ readonly createdAt: import("valibot").StringSchema<undefined>;
360
+ readonly updatedAt: import("valibot").StringSchema<undefined>;
361
+ }, undefined>, undefined>;
362
+ }, undefined>;
363
+ };
364
+ };
365
+ /**
366
+ * Change an account's username, email, password, or claims. Requires the
367
+ * `admin` claim.
368
+ *
369
+ * @example
370
+ * ```ts
371
+ * import { userUpdateContract } from '@game-infra/api-schemas-core'
372
+ * userUpdateContract.pathResolver({ userId: '42' }) // '/users/42'
373
+ * ```
374
+ */
375
+ export declare const userUpdateContract: {
376
+ readonly method: "patch";
377
+ readonly requestPathParamsSchema: import("valibot").ObjectSchema<{
378
+ readonly userId: import("valibot").StringSchema<undefined>;
379
+ }, undefined> & import("@toad-contracts/valibot").StandardObjectKeysV1<unknown, unknown>;
380
+ readonly pathResolver: ({ userId }: {
381
+ userId: string;
382
+ }) => string;
383
+ readonly requestBodySchema: import("valibot").ObjectSchema<{
384
+ readonly username: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 3, undefined>, import("valibot").MaxLengthAction<string, 64, undefined>, import("valibot").RegexAction<string, "Username may not contain @ or whitespace">]>, undefined>;
385
+ readonly email: import("valibot").OptionalSchema<import("valibot").NullableSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").EmailAction<string, undefined>]>, undefined>, undefined>;
386
+ readonly password: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 6, undefined>, import("valibot").MaxLengthAction<string, 128, undefined>]>, undefined>;
387
+ readonly claims: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").ArraySchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MaxLengthAction<string, 64, undefined>, import("valibot").RegexAction<string, "Claims are lowercase letters, digits, '.', ':', '_' or '-', starting with a letter">]>, undefined>, import("valibot").MaxLengthAction<string[], 32, undefined>]>, undefined>;
388
+ }, undefined>;
389
+ readonly responsesByStatusCode: {
390
+ 200: import("valibot").ObjectSchema<{
391
+ readonly success: import("valibot").BooleanSchema<undefined>;
392
+ readonly error: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
393
+ } & {
394
+ user: import("valibot").OptionalSchema<import("valibot").ObjectSchema<{
395
+ readonly id: import("valibot").NumberSchema<undefined>;
396
+ readonly username: import("valibot").StringSchema<undefined>;
397
+ readonly email: import("valibot").NullableSchema<import("valibot").StringSchema<undefined>, undefined>;
398
+ readonly claims: import("valibot").ArraySchema<import("valibot").StringSchema<undefined>, undefined>;
399
+ readonly hasPassword: import("valibot").BooleanSchema<undefined>;
400
+ readonly createdAt: import("valibot").StringSchema<undefined>;
401
+ readonly updatedAt: import("valibot").StringSchema<undefined>;
402
+ }, undefined>, undefined>;
403
+ }, undefined>;
404
+ };
405
+ };
406
+ /**
407
+ * Delete an account and revoke its service tokens. Requires the `admin` claim.
408
+ *
409
+ * @example
410
+ * ```ts
411
+ * import { userDeleteContract } from '@game-infra/api-schemas-core'
412
+ * userDeleteContract.pathResolver({ userId: '42' }) // '/users/42'
413
+ * ```
414
+ */
415
+ export declare const userDeleteContract: {
416
+ readonly method: "delete";
417
+ readonly requestPathParamsSchema: import("valibot").ObjectSchema<{
418
+ readonly userId: import("valibot").StringSchema<undefined>;
419
+ }, undefined> & import("@toad-contracts/valibot").StandardObjectKeysV1<unknown, unknown>;
420
+ readonly pathResolver: ({ userId }: {
421
+ userId: string;
422
+ }) => string;
423
+ readonly responsesByStatusCode: {
424
+ 200: import("valibot").ObjectSchema<{
425
+ readonly success: import("valibot").BooleanSchema<undefined>;
426
+ readonly error: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
427
+ } & {
428
+ revokedServiceTokens: import("valibot").OptionalSchema<import("valibot").NumberSchema<undefined>, undefined>;
429
+ }, undefined>;
430
+ };
431
+ };
86
432
  export declare const savegameSaveContract: {
87
433
  readonly method: "put";
88
434
  readonly requestPathParamsS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