@krak-stack/auth 0.2.32 → 0.3.1

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 (57) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +101 -5
  3. package/dist/access.d.ts +3 -1
  4. package/dist/admin/api.group.d.ts +41 -41
  5. package/dist/admin/schema.d.ts +23 -23
  6. package/dist/admin/schema.js +21 -19
  7. package/dist/api.d.ts +126 -77
  8. package/dist/auth/api.group.d.ts +18 -18
  9. package/dist/auth/schema.d.ts +49 -33
  10. package/dist/auth/schema.js +18 -18
  11. package/dist/components/admin-organization-form.js +2 -2
  12. package/dist/components/admin-organizations.js +6 -5
  13. package/dist/components/admin-users.js +6 -6
  14. package/dist/components/api-key-edit-form.js +19 -11
  15. package/dist/components/associated-projects-notice.d.ts +2 -1
  16. package/dist/components/associated-projects-notice.js +6 -2
  17. package/dist/components/auth-atoms.js +1 -2
  18. package/dist/components/auth-client-api.d.ts +61 -61
  19. package/dist/components/auth-forms.d.ts +1 -0
  20. package/dist/components/auth-forms.js +41 -56
  21. package/dist/components/auth-provider.d.ts +3 -1
  22. package/dist/components/hooks.d.ts +2 -0
  23. package/dist/components/hooks.js +13 -6
  24. package/dist/components/index.d.ts +3 -0
  25. package/dist/components/index.js +2 -0
  26. package/dist/components/member-required.js +3 -5
  27. package/dist/components/oauth-consent.d.ts +22 -0
  28. package/dist/components/oauth-consent.js +79 -0
  29. package/dist/components/organization-switcher.d.ts +1 -1
  30. package/dist/components/organization-switcher.js +83 -54
  31. package/dist/components/project-card-list.d.ts +6 -0
  32. package/dist/components/project-card-list.js +4 -0
  33. package/dist/components/user-button.js +115 -54
  34. package/dist/extra/schema.d.ts +3 -1
  35. package/dist/oauth/authorization.d.ts +3 -0
  36. package/dist/oauth/authorization.js +39 -0
  37. package/dist/oauth/schema.d.ts +24 -0
  38. package/dist/oauth/schema.js +12 -0
  39. package/dist/oauth/verify.d.ts +13 -0
  40. package/dist/oauth/verify.js +67 -0
  41. package/dist/schema.js +1 -1
  42. package/dist/server/actor.js +2 -4
  43. package/dist/server/api.group.d.ts +49 -0
  44. package/dist/server/api.group.js +10 -1
  45. package/dist/server/index.d.ts +3 -1
  46. package/dist/server/index.js +2 -1
  47. package/dist/server/mcp.d.ts +20 -0
  48. package/dist/server/mcp.js +66 -0
  49. package/dist/server/middleware.d.ts +5 -5
  50. package/dist/server/middleware.js +15 -5
  51. package/dist/server/schema.d.ts +51 -0
  52. package/dist/server/schema.js +7 -0
  53. package/dist/server/webhook-layer.js +8 -4
  54. package/dist/server/webhooks.d.ts +9 -3
  55. package/dist/service.d.ts +152 -46
  56. package/dist/service.js +56 -9
  57. package/package.json +2 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @krak-stack/auth
2
2
 
3
+ ## 0.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 782d4f6: Add `AuthService.users.listUsersByEmails` for trusted batch lookup by primary email. Return users with their saved locale and a list of missing emails. Match emails case-insensitively, trim whitespace, and deduplicate results in request order.
8
+
9
+ ## 0.3.0
10
+
11
+ ### Minor Changes
12
+
13
+ - cc882d8: Add shared OAuth consent and signed-query continuation components, MCP resource discovery and challenges, and resource-bound OAuth authentication with organization membership checks. Preserve API-key authentication and default OAuth API access to read-only methods.
14
+
15
+ Present translated consent permissions and require delegated write scope for exposed mutation methods without elevating the user's existing permissions.
16
+
3
17
  ## 0.2.32
4
18
 
5
19
  ### Patch Changes
package/README.md CHANGED
@@ -69,7 +69,8 @@ import { Layer } from "effect";
69
69
 
70
70
  const authentication = AuthMiddleware.layer({
71
71
  onDeleteUser: ({ userId }) => eraseLocalUserData(userId),
72
- onDeleteOrganization: ({ organizationId }) => eraseLocalOrganizationData(organizationId),
72
+ onDeleteOrganization: ({ organizationId }) =>
73
+ eraseLocalOrganizationData(organizationId),
73
74
  // Optional: handle other Auth events. Validate event-specific data here.
74
75
  onWebhook: (webhook) => handleOtherAuthEvent(webhook),
75
76
  }).pipe(Layer.provide(databaseLayer));
@@ -109,8 +110,10 @@ callback covers all personal data. Inventory invitations, logs, exports,
109
110
  processors, and backups before claiming complete erasure. Use
110
111
  `@krak-stack/registry` `0.1.61` or later and upgrade sender and receiver together.
111
112
  Account and organization deletion controls are temporarily hidden in production
112
- builds, including admin organization deletion. Development controls remain available;
113
- this UI rollout gate does not disable server endpoints or change authorization.
113
+ builds, including admin organization deletion. Central Auth also rejects user
114
+ deletion (including admin removal) and organization deletion on the server unless
115
+ `NODE_ENV` is explicitly `development` or `test`. Missing configuration fails closed.
116
+ Webhook receivers remain available independently of this deletion rollout gate.
114
117
 
115
118
  **Français :** `AuthMiddleware.layer({ onDeleteUser, onDeleteOrganization })` exige les deux fonctions de nettoyage et monte la route de
116
119
  réception automatiquement. Chaque projet doit fournir son nettoyage SQL et le
@@ -132,8 +135,10 @@ les anciennes signatures sont refusées. Aucun champ `version` n’est requis da
132
135
  Ce mécanisme ne garantit pas, à lui seul, la conformité ou l’effacement complet.
133
136
  Utilisez `@krak-stack/registry` `0.1.61` ou une version ultérieure et mettez à jour les deux côtés ensemble.
134
137
  Les commandes de suppression de compte et d’organisation, y compris dans l’administration,
135
- sont temporairement masquées en production. Elles restent disponibles en développement ;
136
- ce masquage ne désactive pas les points d’entrée serveur ni leurs contrôles d’autorisation.
138
+ sont temporairement masquées en production. Le serveur central refuse également la
139
+ suppression d’utilisateur (y compris par un administrateur) et d’organisation sauf si
140
+ `NODE_ENV` vaut explicitement `development` ou `test`. Les récepteurs de webhooks
141
+ restent disponibles indépendamment de cette restriction.
137
142
 
138
143
  `AuthMiddleware` also annotates request logs and spans with verified user,
139
144
  organization, and actor IDs using its existing session lookup. Missing sessions
@@ -163,6 +168,97 @@ without it, the middleware covers every route it is provided to. The router
163
168
  adapter uses the same auth configuration and organization-impersonation policy
164
169
  as `AuthMiddleware.layer()`. It does not grant permissions or provide `CurrentActor`.
165
170
 
171
+ ## MCP OAuth
172
+
173
+ Keep the OAuth provider and its database in KrakStack Auth. Consumer projects
174
+ provide resource discovery and verify resource-bound access tokens:
175
+
176
+ ```ts
177
+ import { AuthMiddleware, McpAuth } from "@krak-stack/auth/server";
178
+
179
+ const oauth = {
180
+ issuer: "https://learning.example.com/api/auth",
181
+ resource: "https://learning.example.com/api/mcp",
182
+ jwksUrl: "https://learning.example.com/api/auth/jwks",
183
+ requiredScopes: ["mcp:read"],
184
+ scopesSupported: ["mcp:read", "mcp:write", "offline_access"],
185
+ challengeScopes: ["mcp:read", "mcp:write", "offline_access"],
186
+ };
187
+
188
+ // Add this beside the existing MCP routes.
189
+ const metadata = McpAuth.metadataLayer(oauth);
190
+ // Provide this middleware to the MCP transport layer.
191
+ const mcpAuthentication = McpAuth.middleware(oauth).layer;
192
+ // Add `oauth` to the existing AuthMiddleware.layer({ ... }) configuration.
193
+ ```
194
+
195
+ Expose `/.well-known/$` to the HTTP router too. `McpAuth.discoveryRequest(request,
196
+ oauth)` accepts supported resource-metadata paths and rewrites the RFC 8414
197
+ authorization-server metadata path to the existing `/api/auth/*` proxy. It
198
+ returns `undefined` for unrelated paths. This helper assumes the consumer hosts
199
+ the issuer through its authenticated auth proxy; an independently hosted issuer
200
+ serves its own authorization metadata.
201
+
202
+ Use `OAuthConsent` from `@krak-stack/auth/components` in a thin `/consent` route.
203
+ Pass translated `messages` (`title`, `description({ clientName })`,
204
+ `requestedScopes`, `allow`, `deny`, `error`, `invalidRequest`). It reads the
205
+ provider's signed query, identifies the requesting client, submits the decision,
206
+ and navigates to the provider-validated callback. Do not put consent under a
207
+ guest-only layout. Guest-only sign-in guards should preserve authorization
208
+ requests identified by `getOAuthAuthorizationQuery(location.searchStr)`.
209
+ Provide the optional `messages.permissions` map to show translated permission
210
+ titles/descriptions instead of OAuth scope codes. Unknown scopes remain visible.
211
+ Keep app branding and locale switching in the shared auth-page layout.
212
+
213
+ Deployment prerequisites:
214
+
215
+ - Register the consumer host as an active project domain and authorize its
216
+ existing service key to proxy that project.
217
+ - In **Project → Settings → MCP**, enter the exact endpoint URL and enable it.
218
+ Choose **Read and write** under **Access** to allow `mcp:write`, or **Read only**
219
+ to restrict delegation. This persists the resource and automatically enables
220
+ PKCE-protected client registration. No MCP
221
+ environment variable or auth restart is required. The endpoint's host must
222
+ belong to an active domain of this project.
223
+ - Alternatively, pre-register each agent's OAuth client with its exact callback, PKCE enabled,
224
+ `mcp:read offline_access` scopes, and a link to the resource. The admin client
225
+ creation payload accepts `resources`, `publicClient`, and `nativeClient`.
226
+ Public clients use no client secret; native clients support loopback callbacks.
227
+ - Configure that client ID in the MCP client when using pre-registration.
228
+ The provider advertises anonymous DCR on the configured endpoint's host only.
229
+ New clients are linked only to that MCP resource and require PKCE. Scopes
230
+ restrict delegated access; they never elevate the authenticated user's role
231
+ or permissions. Clients must still obtain user
232
+ consent. Loopback HTTP callbacks without an explicit application type are
233
+ classified as native; HTTPS callbacks keep the provider's web-client policy.
234
+ Registration is rate-limited per auth instance; enforce shared ingress limits
235
+ for multi-instance deployments. Other auth hosts keep DCR disabled.
236
+ - Deploy the provider changes before connecting clients. The provider disables
237
+ session-JWT issuance at `/token` and binds MCP grants to the user's active
238
+ organization at consent. Existing identity-only tokens are not MCP tokens.
239
+
240
+ Bearer tokens take precedence over cookies and API keys and never downgrade on
241
+ failure. Verification checks the signature, issuer, audience, expiry, access-token
242
+ type, authorized client, scopes, and consented organization. The SDK rechecks
243
+ membership and user bans and ignores caller-supplied organization overrides.
244
+ `ActorRequired` continues to enforce ordinary tenant roles and domain policies.
245
+ OAuth API requests default to GET/HEAD only; explicitly configure `allowedMethods`
246
+ before exposing mutations. Non-GET/HEAD requests additionally require `mcp:write`
247
+ (override with `writeScope` for a different scope vocabulary), and normal user
248
+ authorization still applies. Project settings do not automatically expose new
249
+ tools or API methods in consumer applications. MCP transport POSTs
250
+ are authenticated separately and do not grant write access to the API.
251
+
252
+ Disabling or changing the endpoint disables its previous OAuth resource and
253
+ removes client/resource links. Clients must reconnect. Auth re-reads policy and
254
+ domain ownership on each request, so cached instances cannot keep advertising a
255
+ disabled configuration. Apply database migration 4 before deploying this feature.
256
+
257
+ This integration currently accepts bearer JWT access tokens, not opaque or
258
+ DPoP-bound tokens. JWT verification is local: revoking a grant does not immediately
259
+ invalidate an already-issued JWT before expiry. Keep access-token lifetimes short;
260
+ refresh and grant revocation remain provider-owned.
261
+
166
262
  ## React Components
167
263
 
168
264
  The component bundle uses the optional peer dependencies declared in `package.json` and Krakstack/shadcn UI primitives from `@krak-stack/registry`. Install the component peers used by your application. Server middleware needs `effect`, the matching registry package, and an SQL pool; React component peers are not needed for server-only use.
package/dist/access.d.ts CHANGED
@@ -28,7 +28,9 @@ export type CurrentActor = {
28
28
  readonly permissions: ReadonlySet<string>;
29
29
  };
30
30
  export declare const CurrentActor: Context.Service<CurrentActor, CurrentActor>;
31
- declare const Forbidden_base: Schema.Class<Forbidden, Schema.TaggedStruct<"Forbidden", {}>, import("effect/Cause").YieldableError>;
31
+ declare const Forbidden_base: Schema.Class<Forbidden, Schema.TaggedStruct<"Forbidden", {}>, import("effect/Cause").YieldableError & {
32
+ readonly brand: unique symbol;
33
+ }>;
32
34
  export declare class Forbidden extends Forbidden_base {
33
35
  }
34
36
  export type Policy<E = never, R = never> = Effect.Effect<void, Forbidden | E, CurrentActor | R>;
@@ -35,7 +35,7 @@ export declare const AdminApiGroup: HttpApiGroup.HttpApiGroup<"admin", HttpApiEn
35
35
  readonly metadata: Schema.optional<Schema.NullOr<Schema.String>>;
36
36
  readonly userId: Schema.optional<Schema.NullOr<Schema.String>>;
37
37
  readonly parentId: Schema.optional<Schema.NullOr<Schema.String>>;
38
- readonly memberCount: Schema.optional<Schema.Number>;
38
+ readonly memberCount: Schema.optional<Schema.Finite>;
39
39
  readonly memberPreviews: Schema.optional<Schema.$Array<Schema.Struct<{
40
40
  readonly id: Schema.String;
41
41
  readonly name: Schema.String;
@@ -51,26 +51,26 @@ export declare const AdminApiGroup: HttpApiGroup.HttpApiGroup<"admin", HttpApiEn
51
51
  }>>, Schema.toCodecJson<typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"dashboardStats", "GET", "/admin/dashboard-stats", never, Schema.toCodecStringTree<Schema.Struct<{
52
52
  readonly days: Schema.optional<Schema.Union<readonly [Schema.Literal<"7">, Schema.Literal<"14">, Schema.Literal<"30">, Schema.Literal<"90">]>>;
53
53
  }>>, never, never, Schema.toCodecJson<Schema.Struct<{
54
- readonly totalUsers: Schema.Number;
55
- readonly totalOrganizations: Schema.Number;
56
- readonly totalProjects: Schema.Number;
57
- readonly totalDomains: Schema.Number;
58
- readonly totalApiKeys: Schema.Number;
59
- readonly totalOauthClients: Schema.Number;
60
- readonly dailyActiveUsers: Schema.Number;
54
+ readonly totalUsers: Schema.Finite;
55
+ readonly totalOrganizations: Schema.Finite;
56
+ readonly totalProjects: Schema.Finite;
57
+ readonly totalDomains: Schema.Finite;
58
+ readonly totalApiKeys: Schema.Finite;
59
+ readonly totalOauthClients: Schema.Finite;
60
+ readonly dailyActiveUsers: Schema.Finite;
61
61
  readonly dailyActiveUsersByDay: Schema.$Array<Schema.Struct<{
62
62
  readonly date: Schema.String;
63
- readonly count: Schema.Number;
63
+ readonly count: Schema.Finite;
64
64
  }>>;
65
65
  readonly signupsByDay: Schema.$Array<Schema.Struct<{
66
66
  readonly date: Schema.String;
67
- readonly count: Schema.Number;
67
+ readonly count: Schema.Finite;
68
68
  }>>;
69
69
  readonly projectConnections: Schema.$Array<Schema.Struct<{
70
70
  readonly projectId: Schema.String;
71
71
  readonly projectName: Schema.String;
72
- readonly users: Schema.Number;
73
- readonly organizations: Schema.Number;
72
+ readonly users: Schema.Finite;
73
+ readonly organizations: Schema.Finite;
74
74
  }>>;
75
75
  }>>, Schema.toCodecJson<typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"deleteApiKey", "DELETE", "/admin/api-keys/:id", Schema.toCodecStringTree<Schema.Struct<{
76
76
  readonly id: Schema.String;
@@ -83,10 +83,10 @@ export declare const AdminApiGroup: HttpApiGroup.HttpApiGroup<"admin", HttpApiEn
83
83
  readonly prefix: Schema.NullOr<Schema.String>;
84
84
  readonly enabled: Schema.Boolean;
85
85
  readonly rateLimitEnabled: Schema.Boolean;
86
- readonly rateLimitTimeWindow: Schema.NullOr<Schema.Number>;
87
- readonly rateLimitMax: Schema.NullOr<Schema.Number>;
88
- readonly requestCount: Schema.Number;
89
- readonly remaining: Schema.NullOr<Schema.Number>;
86
+ readonly rateLimitTimeWindow: Schema.NullOr<Schema.Finite>;
87
+ readonly rateLimitMax: Schema.NullOr<Schema.Finite>;
88
+ readonly requestCount: Schema.Finite;
89
+ readonly remaining: Schema.NullOr<Schema.Finite>;
90
90
  readonly lastRequest: Schema.NullOr<Schema.Date>;
91
91
  readonly expiresAt: Schema.NullOr<Schema.Date>;
92
92
  readonly referrers: Schema.$Array<Schema.String>;
@@ -120,7 +120,7 @@ export declare const AdminApiGroup: HttpApiGroup.HttpApiGroup<"admin", HttpApiEn
120
120
  readonly metadata: Schema.optional<Schema.NullOr<Schema.String>>;
121
121
  readonly userId: Schema.optional<Schema.NullOr<Schema.String>>;
122
122
  readonly parentId: Schema.optional<Schema.NullOr<Schema.String>>;
123
- readonly memberCount: Schema.optional<Schema.Number>;
123
+ readonly memberCount: Schema.optional<Schema.Finite>;
124
124
  readonly memberPreviews: Schema.optional<Schema.$Array<Schema.Struct<{
125
125
  readonly id: Schema.String;
126
126
  readonly name: Schema.String;
@@ -144,10 +144,10 @@ export declare const AdminApiGroup: HttpApiGroup.HttpApiGroup<"admin", HttpApiEn
144
144
  readonly prefix: Schema.NullOr<Schema.String>;
145
145
  readonly enabled: Schema.Boolean;
146
146
  readonly rateLimitEnabled: Schema.Boolean;
147
- readonly rateLimitTimeWindow: Schema.NullOr<Schema.Number>;
148
- readonly rateLimitMax: Schema.NullOr<Schema.Number>;
149
- readonly requestCount: Schema.Number;
150
- readonly remaining: Schema.NullOr<Schema.Number>;
147
+ readonly rateLimitTimeWindow: Schema.NullOr<Schema.Finite>;
148
+ readonly rateLimitMax: Schema.NullOr<Schema.Finite>;
149
+ readonly requestCount: Schema.Finite;
150
+ readonly remaining: Schema.NullOr<Schema.Finite>;
151
151
  readonly lastRequest: Schema.NullOr<Schema.Date>;
152
152
  readonly expiresAt: Schema.NullOr<Schema.Date>;
153
153
  readonly referrers: Schema.$Array<Schema.String>;
@@ -165,10 +165,10 @@ export declare const AdminApiGroup: HttpApiGroup.HttpApiGroup<"admin", HttpApiEn
165
165
  readonly prefix: Schema.NullOr<Schema.String>;
166
166
  readonly enabled: Schema.Boolean;
167
167
  readonly rateLimitEnabled: Schema.Boolean;
168
- readonly rateLimitTimeWindow: Schema.NullOr<Schema.Number>;
169
- readonly rateLimitMax: Schema.NullOr<Schema.Number>;
170
- readonly requestCount: Schema.Number;
171
- readonly remaining: Schema.NullOr<Schema.Number>;
168
+ readonly rateLimitTimeWindow: Schema.NullOr<Schema.Finite>;
169
+ readonly rateLimitMax: Schema.NullOr<Schema.Finite>;
170
+ readonly requestCount: Schema.Finite;
171
+ readonly remaining: Schema.NullOr<Schema.Finite>;
172
172
  readonly lastRequest: Schema.NullOr<Schema.Date>;
173
173
  readonly expiresAt: Schema.NullOr<Schema.Date>;
174
174
  readonly referrers: Schema.$Array<Schema.String>;
@@ -192,10 +192,10 @@ export declare const AdminApiGroup: HttpApiGroup.HttpApiGroup<"admin", HttpApiEn
192
192
  readonly prefix: Schema.NullOr<Schema.String>;
193
193
  readonly enabled: Schema.Boolean;
194
194
  readonly rateLimitEnabled: Schema.Boolean;
195
- readonly rateLimitTimeWindow: Schema.NullOr<Schema.Number>;
196
- readonly rateLimitMax: Schema.NullOr<Schema.Number>;
197
- readonly requestCount: Schema.Number;
198
- readonly remaining: Schema.NullOr<Schema.Number>;
195
+ readonly rateLimitTimeWindow: Schema.NullOr<Schema.Finite>;
196
+ readonly rateLimitMax: Schema.NullOr<Schema.Finite>;
197
+ readonly requestCount: Schema.Finite;
198
+ readonly remaining: Schema.NullOr<Schema.Finite>;
199
199
  readonly lastRequest: Schema.NullOr<Schema.Date>;
200
200
  readonly expiresAt: Schema.NullOr<Schema.Date>;
201
201
  readonly referrers: Schema.$Array<Schema.String>;
@@ -285,7 +285,7 @@ export declare const AdminApiGroup: HttpApiGroup.HttpApiGroup<"admin", HttpApiEn
285
285
  readonly metadata: Schema.optional<Schema.NullOr<Schema.String>>;
286
286
  readonly userId: Schema.optional<Schema.NullOr<Schema.String>>;
287
287
  readonly parentId: Schema.optional<Schema.NullOr<Schema.String>>;
288
- readonly memberCount: Schema.optional<Schema.Number>;
288
+ readonly memberCount: Schema.optional<Schema.Finite>;
289
289
  readonly memberPreviews: Schema.optional<Schema.$Array<Schema.Struct<{
290
290
  readonly id: Schema.String;
291
291
  readonly name: Schema.String;
@@ -405,10 +405,10 @@ export declare const AdminApiGroup: HttpApiGroup.HttpApiGroup<"admin", HttpApiEn
405
405
  readonly prefix: Schema.NullOr<Schema.String>;
406
406
  readonly enabled: Schema.Boolean;
407
407
  readonly rateLimitEnabled: Schema.Boolean;
408
- readonly rateLimitTimeWindow: Schema.NullOr<Schema.Number>;
409
- readonly rateLimitMax: Schema.NullOr<Schema.Number>;
410
- readonly requestCount: Schema.Number;
411
- readonly remaining: Schema.NullOr<Schema.Number>;
408
+ readonly rateLimitTimeWindow: Schema.NullOr<Schema.Finite>;
409
+ readonly rateLimitMax: Schema.NullOr<Schema.Finite>;
410
+ readonly requestCount: Schema.Finite;
411
+ readonly remaining: Schema.NullOr<Schema.Finite>;
412
412
  readonly lastRequest: Schema.NullOr<Schema.Date>;
413
413
  readonly expiresAt: Schema.NullOr<Schema.Date>;
414
414
  readonly referrers: Schema.$Array<Schema.String>;
@@ -421,8 +421,8 @@ export declare const AdminApiGroup: HttpApiGroup.HttpApiGroup<"admin", HttpApiEn
421
421
  readonly name: Schema.optional<Schema.NullOr<Schema.String>>;
422
422
  readonly enabled: Schema.optional<Schema.Boolean>;
423
423
  readonly rateLimitEnabled: Schema.optional<Schema.Boolean>;
424
- readonly rateLimitMax: Schema.optional<Schema.NullOr<Schema.Number>>;
425
- readonly rateLimitTimeWindow: Schema.optional<Schema.NullOr<Schema.Number>>;
424
+ readonly rateLimitMax: Schema.optional<Schema.NullOr<Schema.Finite>>;
425
+ readonly rateLimitTimeWindow: Schema.optional<Schema.NullOr<Schema.Finite>>;
426
426
  readonly referrers: Schema.optional<Schema.$Array<Schema.String>>;
427
427
  }>>, never, Schema.toCodecJson<Schema.Struct<{
428
428
  readonly id: Schema.String;
@@ -433,10 +433,10 @@ export declare const AdminApiGroup: HttpApiGroup.HttpApiGroup<"admin", HttpApiEn
433
433
  readonly prefix: Schema.NullOr<Schema.String>;
434
434
  readonly enabled: Schema.Boolean;
435
435
  readonly rateLimitEnabled: Schema.Boolean;
436
- readonly rateLimitTimeWindow: Schema.NullOr<Schema.Number>;
437
- readonly rateLimitMax: Schema.NullOr<Schema.Number>;
438
- readonly requestCount: Schema.Number;
439
- readonly remaining: Schema.NullOr<Schema.Number>;
436
+ readonly rateLimitTimeWindow: Schema.NullOr<Schema.Finite>;
437
+ readonly rateLimitMax: Schema.NullOr<Schema.Finite>;
438
+ readonly requestCount: Schema.Finite;
439
+ readonly remaining: Schema.NullOr<Schema.Finite>;
440
440
  readonly lastRequest: Schema.NullOr<Schema.Date>;
441
441
  readonly expiresAt: Schema.NullOr<Schema.Date>;
442
442
  readonly referrers: Schema.$Array<Schema.String>;
@@ -481,7 +481,7 @@ export declare const AdminApiGroup: HttpApiGroup.HttpApiGroup<"admin", HttpApiEn
481
481
  readonly metadata: Schema.optional<Schema.NullOr<Schema.String>>;
482
482
  readonly userId: Schema.optional<Schema.NullOr<Schema.String>>;
483
483
  readonly parentId: Schema.optional<Schema.NullOr<Schema.String>>;
484
- readonly memberCount: Schema.optional<Schema.Number>;
484
+ readonly memberCount: Schema.optional<Schema.Finite>;
485
485
  readonly memberPreviews: Schema.optional<Schema.$Array<Schema.Struct<{
486
486
  readonly id: Schema.String;
487
487
  readonly name: Schema.String;
@@ -275,7 +275,7 @@ export declare const AdminOrganization: Schema.Struct<{
275
275
  readonly metadata: Schema.optional<Schema.NullOr<Schema.String>>;
276
276
  readonly userId: Schema.optional<Schema.NullOr<Schema.String>>;
277
277
  readonly parentId: Schema.optional<Schema.NullOr<Schema.String>>;
278
- readonly memberCount: Schema.optional<Schema.Number>;
278
+ readonly memberCount: Schema.optional<Schema.Finite>;
279
279
  readonly memberPreviews: Schema.optional<Schema.$Array<Schema.Struct<{
280
280
  readonly id: Schema.String;
281
281
  readonly name: Schema.String;
@@ -304,10 +304,10 @@ export declare const AdminApiKey: Schema.Struct<{
304
304
  readonly prefix: Schema.NullOr<Schema.String>;
305
305
  readonly enabled: Schema.Boolean;
306
306
  readonly rateLimitEnabled: Schema.Boolean;
307
- readonly rateLimitTimeWindow: Schema.NullOr<Schema.Number>;
308
- readonly rateLimitMax: Schema.NullOr<Schema.Number>;
309
- readonly requestCount: Schema.Number;
310
- readonly remaining: Schema.NullOr<Schema.Number>;
307
+ readonly rateLimitTimeWindow: Schema.NullOr<Schema.Finite>;
308
+ readonly rateLimitMax: Schema.NullOr<Schema.Finite>;
309
+ readonly requestCount: Schema.Finite;
310
+ readonly remaining: Schema.NullOr<Schema.Finite>;
311
311
  readonly lastRequest: Schema.NullOr<Schema.Date>;
312
312
  readonly expiresAt: Schema.NullOr<Schema.Date>;
313
313
  readonly referrers: Schema.$Array<Schema.String>;
@@ -319,8 +319,8 @@ export declare const AdminUpdateApiKeyPayload: Schema.Struct<{
319
319
  readonly name: Schema.optional<Schema.NullOr<Schema.String>>;
320
320
  readonly enabled: Schema.optional<Schema.Boolean>;
321
321
  readonly rateLimitEnabled: Schema.optional<Schema.Boolean>;
322
- readonly rateLimitMax: Schema.optional<Schema.NullOr<Schema.Number>>;
323
- readonly rateLimitTimeWindow: Schema.optional<Schema.NullOr<Schema.Number>>;
322
+ readonly rateLimitMax: Schema.optional<Schema.NullOr<Schema.Finite>>;
323
+ readonly rateLimitTimeWindow: Schema.optional<Schema.NullOr<Schema.Finite>>;
324
324
  readonly referrers: Schema.optional<Schema.$Array<Schema.String>>;
325
325
  }>;
326
326
  export declare const AdminCreateOrganizationPayload: Schema.Struct<{
@@ -340,39 +340,39 @@ export declare const DashboardStatsQuery: Schema.Struct<{
340
340
  }>;
341
341
  export declare const DailyActiveUsersByDay: Schema.Struct<{
342
342
  readonly date: Schema.String;
343
- readonly count: Schema.Number;
343
+ readonly count: Schema.Finite;
344
344
  }>;
345
345
  export declare const SignupsByDay: Schema.Struct<{
346
346
  readonly date: Schema.String;
347
- readonly count: Schema.Number;
347
+ readonly count: Schema.Finite;
348
348
  }>;
349
349
  export declare const ProjectConnections: Schema.Struct<{
350
350
  readonly projectId: Schema.String;
351
351
  readonly projectName: Schema.String;
352
- readonly users: Schema.Number;
353
- readonly organizations: Schema.Number;
352
+ readonly users: Schema.Finite;
353
+ readonly organizations: Schema.Finite;
354
354
  }>;
355
355
  export declare const DashboardStatsResponse: Schema.Struct<{
356
- readonly totalUsers: Schema.Number;
357
- readonly totalOrganizations: Schema.Number;
358
- readonly totalProjects: Schema.Number;
359
- readonly totalDomains: Schema.Number;
360
- readonly totalApiKeys: Schema.Number;
361
- readonly totalOauthClients: Schema.Number;
362
- readonly dailyActiveUsers: Schema.Number;
356
+ readonly totalUsers: Schema.Finite;
357
+ readonly totalOrganizations: Schema.Finite;
358
+ readonly totalProjects: Schema.Finite;
359
+ readonly totalDomains: Schema.Finite;
360
+ readonly totalApiKeys: Schema.Finite;
361
+ readonly totalOauthClients: Schema.Finite;
362
+ readonly dailyActiveUsers: Schema.Finite;
363
363
  readonly dailyActiveUsersByDay: Schema.$Array<Schema.Struct<{
364
364
  readonly date: Schema.String;
365
- readonly count: Schema.Number;
365
+ readonly count: Schema.Finite;
366
366
  }>>;
367
367
  readonly signupsByDay: Schema.$Array<Schema.Struct<{
368
368
  readonly date: Schema.String;
369
- readonly count: Schema.Number;
369
+ readonly count: Schema.Finite;
370
370
  }>>;
371
371
  readonly projectConnections: Schema.$Array<Schema.Struct<{
372
372
  readonly projectId: Schema.String;
373
373
  readonly projectName: Schema.String;
374
- readonly users: Schema.Number;
375
- readonly organizations: Schema.Number;
374
+ readonly users: Schema.Finite;
375
+ readonly organizations: Schema.Finite;
376
376
  }>>;
377
377
  }>;
378
378
  export declare const PaginatedAdminUsers: Schema.Struct<{
@@ -415,7 +415,7 @@ export declare const PaginatedAdminOrganizations: Schema.Struct<{
415
415
  readonly metadata: Schema.optional<Schema.NullOr<Schema.String>>;
416
416
  readonly userId: Schema.optional<Schema.NullOr<Schema.String>>;
417
417
  readonly parentId: Schema.optional<Schema.NullOr<Schema.String>>;
418
- readonly memberCount: Schema.optional<Schema.Number>;
418
+ readonly memberCount: Schema.optional<Schema.Finite>;
419
419
  readonly memberPreviews: Schema.optional<Schema.$Array<Schema.Struct<{
420
420
  readonly id: Schema.String;
421
421
  readonly name: Schema.String;
@@ -121,7 +121,7 @@ export const AdminOrganization = Schema.Struct({
121
121
  metadata: Schema.optional(Schema.NullOr(Schema.String)),
122
122
  userId: Schema.optional(Schema.NullOr(Schema.String)),
123
123
  parentId: Schema.optional(Schema.NullOr(Schema.String)),
124
- memberCount: Schema.optional(Schema.Number),
124
+ memberCount: Schema.optional(Schema.Finite),
125
125
  memberPreviews: Schema.optional(Schema.Array(AdminOrganizationMember)),
126
126
  projects: Schema.optional(Schema.Array(AdminProjectPreview)),
127
127
  createdAt: Schema.Date,
@@ -172,10 +172,10 @@ export const AdminApiKey = Schema.Struct({
172
172
  prefix: Schema.NullOr(Schema.String),
173
173
  enabled: Schema.Boolean,
174
174
  rateLimitEnabled: Schema.Boolean,
175
- rateLimitTimeWindow: Schema.NullOr(Schema.Number),
176
- rateLimitMax: Schema.NullOr(Schema.Number),
177
- requestCount: Schema.Number,
178
- remaining: Schema.NullOr(Schema.Number),
175
+ rateLimitTimeWindow: Schema.NullOr(Schema.Finite),
176
+ rateLimitMax: Schema.NullOr(Schema.Finite),
177
+ requestCount: Schema.Finite,
178
+ remaining: Schema.NullOr(Schema.Finite),
179
179
  lastRequest: Schema.NullOr(Schema.Date),
180
180
  expiresAt: Schema.NullOr(Schema.Date),
181
181
  referrers: Schema.Array(Schema.String),
@@ -213,8 +213,8 @@ export const AdminUpdateApiKeyPayload = Schema.Struct({
213
213
  name: Schema.optional(Schema.NullOr(Schema.String)),
214
214
  enabled: Schema.optional(Schema.Boolean),
215
215
  rateLimitEnabled: Schema.optional(Schema.Boolean),
216
- rateLimitMax: Schema.optional(Schema.NullOr(Schema.Number)),
217
- rateLimitTimeWindow: Schema.optional(Schema.NullOr(Schema.Number)),
216
+ rateLimitMax: Schema.optional(Schema.NullOr(Schema.Finite)),
217
+ rateLimitTimeWindow: Schema.optional(Schema.NullOr(Schema.Finite)),
218
218
  referrers: Schema.optional(Schema.Array(Schema.String)),
219
219
  }).annotate({
220
220
  identifier: "AdminUpdateApiKeyPayload",
@@ -268,16 +268,16 @@ export const DashboardStatsQuery = Schema.Struct({
268
268
  });
269
269
  export const DailyActiveUsersByDay = Schema.Struct({
270
270
  date: Schema.String,
271
- count: Schema.Number,
271
+ count: Schema.Finite,
272
272
  }).annotate({
273
273
  identifier: "DailyActiveUsersByDay",
274
274
  title: "Daily active users by day",
275
- description: "Distinct authenticated users active on a calendar day.",
275
+ description: "Distinct users with recorded successful sign-ins or authenticated session checks on a UTC calendar day.",
276
276
  examples: [{ date: "2026-06-26", count: 18 }],
277
277
  });
278
278
  export const SignupsByDay = Schema.Struct({
279
279
  date: Schema.String,
280
- count: Schema.Number,
280
+ count: Schema.Finite,
281
281
  }).annotate({
282
282
  identifier: "SignupsByDay",
283
283
  title: "Signups by day",
@@ -287,8 +287,8 @@ export const SignupsByDay = Schema.Struct({
287
287
  export const ProjectConnections = Schema.Struct({
288
288
  projectId: Schema.String,
289
289
  projectName: Schema.String,
290
- users: Schema.Number,
291
- organizations: Schema.Number,
290
+ users: Schema.Finite,
291
+ organizations: Schema.Finite,
292
292
  }).annotate({
293
293
  identifier: "ProjectConnections",
294
294
  title: "Project connections",
@@ -303,13 +303,15 @@ export const ProjectConnections = Schema.Struct({
303
303
  ],
304
304
  });
305
305
  export const DashboardStatsResponse = Schema.Struct({
306
- totalUsers: Schema.Number,
307
- totalOrganizations: Schema.Number,
308
- totalProjects: Schema.Number,
309
- totalDomains: Schema.Number,
310
- totalApiKeys: Schema.Number,
311
- totalOauthClients: Schema.Number,
312
- dailyActiveUsers: Schema.Number,
306
+ totalUsers: Schema.Finite,
307
+ totalOrganizations: Schema.Finite,
308
+ totalProjects: Schema.Finite,
309
+ totalDomains: Schema.Finite,
310
+ totalApiKeys: Schema.Finite,
311
+ totalOauthClients: Schema.Finite,
312
+ dailyActiveUsers: Schema.Finite.annotate({
313
+ description: "Distinct users with recorded authentication activity today (UTC), not a rolling 24-hour window.",
314
+ }),
313
315
  dailyActiveUsersByDay: Schema.Array(DailyActiveUsersByDay),
314
316
  signupsByDay: Schema.Array(SignupsByDay),
315
317
  projectConnections: Schema.Array(ProjectConnections),