@krak-stack/auth 0.1.37 → 0.1.39

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.
@@ -10,6 +10,7 @@ export declare const ServerUsersApiGroup: HttpApiGroup.HttpApiGroup<"users", Htt
10
10
  readonly image: import("effect/Schema").NullOr<import("effect/Schema").String>;
11
11
  readonly role: import("effect/Schema").NullOr<import("effect/Schema").String>;
12
12
  readonly banned: import("effect/Schema").NullOr<import("effect/Schema").Boolean>;
13
+ readonly lastLoginMethod: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
13
14
  readonly createdAt: import("effect/Schema").Date;
14
15
  readonly updatedAt: import("effect/Schema").Date;
15
16
  }>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.NotFound | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getUserActiveOrganization", "GET", "/organizations/user/:userId/active", HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
@@ -27,6 +28,7 @@ export declare const ServerUsersApiGroup: HttpApiGroup.HttpApiGroup<"users", Htt
27
28
  readonly image: import("effect/Schema").NullOr<import("effect/Schema").String>;
28
29
  readonly role: import("effect/Schema").NullOr<import("effect/Schema").String>;
29
30
  readonly banned: import("effect/Schema").NullOr<import("effect/Schema").Boolean>;
31
+ readonly lastLoginMethod: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
30
32
  readonly createdAt: import("effect/Schema").Date;
31
33
  readonly updatedAt: import("effect/Schema").Date;
32
34
  }>>;
@@ -49,6 +51,7 @@ export declare const ServerOrganizationsApiGroup: HttpApiGroup.HttpApiGroup<"org
49
51
  readonly image: import("effect/Schema").NullOr<import("effect/Schema").String>;
50
52
  readonly role: import("effect/Schema").NullOr<import("effect/Schema").String>;
51
53
  readonly banned: import("effect/Schema").NullOr<import("effect/Schema").Boolean>;
54
+ readonly lastLoginMethod: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
52
55
  readonly createdAt: import("effect/Schema").Date;
53
56
  readonly updatedAt: import("effect/Schema").Date;
54
57
  }>;
@@ -86,6 +89,7 @@ export declare const ServerOrganizationsApiGroup: HttpApiGroup.HttpApiGroup<"org
86
89
  readonly image: import("effect/Schema").NullOr<import("effect/Schema").String>;
87
90
  readonly role: import("effect/Schema").NullOr<import("effect/Schema").String>;
88
91
  readonly banned: import("effect/Schema").NullOr<import("effect/Schema").Boolean>;
92
+ readonly lastLoginMethod: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
89
93
  readonly createdAt: import("effect/Schema").Date;
90
94
  readonly updatedAt: import("effect/Schema").Date;
91
95
  }>;
@@ -177,38 +181,71 @@ export declare const ServerDomainsApiGroup: HttpApiGroup.HttpApiGroup<"domains",
177
181
  readonly name: import("effect/Schema").String;
178
182
  readonly value: import("effect/Schema").String;
179
183
  }>>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.NotFound | typeof HttpApiError.InternalServerError>, never, never>, false>;
180
- export declare const ServerApi: HttpApi.HttpApi<"ServerApi", HttpApiGroup.HttpApiGroup<"users", HttpApiEndpoint.HttpApiEndpoint<"getUser", "GET", "/api/users/:id", HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
184
+ export declare const ServerApi: HttpApi.HttpApi<"ServerApi", HttpApiGroup.HttpApiGroup<"domains", HttpApiEndpoint.HttpApiEndpoint<"createDomain", "POST", "/api/domains", HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").Struct<{
185
+ readonly hostname: import("effect/Schema").NonEmptyString;
186
+ readonly rootHostname: import("effect/Schema").NonEmptyString;
187
+ readonly projectId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
188
+ readonly organizationId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
189
+ readonly managed: import("effect/Schema").Boolean;
190
+ }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").Struct<{
191
+ readonly id: import("effect/Schema").String;
192
+ readonly hostname: import("effect/Schema").String;
193
+ readonly rootHostname: import("effect/Schema").String;
194
+ readonly projectId: import("effect/Schema").NullOr<import("effect/Schema").String>;
195
+ readonly organizationId: import("effect/Schema").NullOr<import("effect/Schema").String>;
196
+ readonly hostnameId: import("effect/Schema").String;
197
+ readonly managed: import("effect/Schema").Boolean;
198
+ readonly active: import("effect/Schema").Boolean;
199
+ readonly createdAt: import("effect/Schema").Date;
200
+ readonly updatedAt: import("effect/Schema").Date;
201
+ }>>, HttpApiEndpoint.Json<typeof HttpApiError.BadRequest | typeof HttpApiError.Unauthorized | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"deleteDomain", "DELETE", "/api/domains/:id", HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
202
+ readonly id: import("effect/Schema").NonEmptyString;
203
+ }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").Struct<{
204
+ readonly id: import("effect/Schema").String;
205
+ readonly hostname: import("effect/Schema").String;
206
+ readonly rootHostname: import("effect/Schema").String;
207
+ readonly projectId: import("effect/Schema").NullOr<import("effect/Schema").String>;
208
+ readonly organizationId: import("effect/Schema").NullOr<import("effect/Schema").String>;
209
+ readonly hostnameId: import("effect/Schema").String;
210
+ readonly managed: import("effect/Schema").Boolean;
211
+ readonly active: import("effect/Schema").Boolean;
212
+ readonly createdAt: import("effect/Schema").Date;
213
+ readonly updatedAt: import("effect/Schema").Date;
214
+ }>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.NotFound | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getDomain", "GET", "/api/domains/:id", HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
181
215
  readonly id: import("effect/Schema").NonEmptyString;
182
216
  }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").Struct<{
183
217
  readonly id: import("effect/Schema").String;
184
- readonly name: import("effect/Schema").String;
185
- readonly email: import("effect/Schema").String;
186
- readonly emailVerified: import("effect/Schema").Boolean;
187
- readonly image: import("effect/Schema").NullOr<import("effect/Schema").String>;
188
- readonly role: import("effect/Schema").NullOr<import("effect/Schema").String>;
189
- readonly banned: import("effect/Schema").NullOr<import("effect/Schema").Boolean>;
218
+ readonly hostname: import("effect/Schema").String;
219
+ readonly rootHostname: import("effect/Schema").String;
220
+ readonly projectId: import("effect/Schema").NullOr<import("effect/Schema").String>;
221
+ readonly organizationId: import("effect/Schema").NullOr<import("effect/Schema").String>;
222
+ readonly hostnameId: import("effect/Schema").String;
223
+ readonly managed: import("effect/Schema").Boolean;
224
+ readonly active: import("effect/Schema").Boolean;
190
225
  readonly createdAt: import("effect/Schema").Date;
191
226
  readonly updatedAt: import("effect/Schema").Date;
192
- }>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.NotFound | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getUserActiveOrganization", "GET", "/api/organizations/user/:userId/active", HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
193
- readonly userId: import("effect/Schema").NonEmptyString;
227
+ }>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.NotFound | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getDomainByHost", "GET", "/api/domains/by-host/:hostname", HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
228
+ readonly hostname: import("effect/Schema").NonEmptyString;
194
229
  }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").Struct<{
195
- readonly id: import("effect/Schema").NullOr<import("effect/Schema").String>;
196
- }>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"listUsersByIds", "GET", "/api/users", HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
197
- readonly ids: import("effect/Schema").NonEmptyString;
198
- }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").Struct<{
199
- readonly data: import("effect/Schema").$Array<import("effect/Schema").Struct<{
200
- readonly id: import("effect/Schema").String;
201
- readonly name: import("effect/Schema").String;
202
- readonly email: import("effect/Schema").String;
203
- readonly emailVerified: import("effect/Schema").Boolean;
204
- readonly image: import("effect/Schema").NullOr<import("effect/Schema").String>;
205
- readonly role: import("effect/Schema").NullOr<import("effect/Schema").String>;
206
- readonly banned: import("effect/Schema").NullOr<import("effect/Schema").Boolean>;
207
- readonly createdAt: import("effect/Schema").Date;
208
- readonly updatedAt: import("effect/Schema").Date;
209
- }>>;
210
- readonly missingIds: import("effect/Schema").$Array<import("effect/Schema").String>;
211
- }>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.InternalServerError>, never, never>, false> | HttpApiGroup.HttpApiGroup<"organizations", HttpApiEndpoint.HttpApiEndpoint<"getActiveMember", "GET", "/api/organizations/:organizationId/members/:userId", HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
230
+ readonly id: import("effect/Schema").String;
231
+ readonly hostname: import("effect/Schema").String;
232
+ readonly rootHostname: import("effect/Schema").String;
233
+ readonly projectId: import("effect/Schema").NullOr<import("effect/Schema").String>;
234
+ readonly organizationId: import("effect/Schema").NullOr<import("effect/Schema").String>;
235
+ readonly hostnameId: import("effect/Schema").String;
236
+ readonly managed: import("effect/Schema").Boolean;
237
+ readonly active: import("effect/Schema").Boolean;
238
+ readonly createdAt: import("effect/Schema").Date;
239
+ readonly updatedAt: import("effect/Schema").Date;
240
+ }>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.NotFound | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getDomainRecords", "GET", "/api/domains/:id/records", HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
241
+ readonly id: import("effect/Schema").NonEmptyString;
242
+ }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").$Array<import("effect/Schema").Struct<{
243
+ readonly required: import("effect/Schema").Boolean;
244
+ readonly status: import("effect/Schema").String;
245
+ readonly type: import("effect/Schema").String;
246
+ readonly name: import("effect/Schema").String;
247
+ readonly value: import("effect/Schema").String;
248
+ }>>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.NotFound | typeof HttpApiError.InternalServerError>, never, never>, false> | HttpApiGroup.HttpApiGroup<"organizations", HttpApiEndpoint.HttpApiEndpoint<"getActiveMember", "GET", "/api/organizations/:organizationId/members/:userId", HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
212
249
  readonly organizationId: import("effect/Schema").NonEmptyString;
213
250
  readonly userId: import("effect/Schema").NonEmptyString;
214
251
  }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").Struct<{
@@ -225,6 +262,7 @@ export declare const ServerApi: HttpApi.HttpApi<"ServerApi", HttpApiGroup.HttpAp
225
262
  readonly image: import("effect/Schema").NullOr<import("effect/Schema").String>;
226
263
  readonly role: import("effect/Schema").NullOr<import("effect/Schema").String>;
227
264
  readonly banned: import("effect/Schema").NullOr<import("effect/Schema").Boolean>;
265
+ readonly lastLoginMethod: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
228
266
  readonly createdAt: import("effect/Schema").Date;
229
267
  readonly updatedAt: import("effect/Schema").Date;
230
268
  }>;
@@ -262,6 +300,7 @@ export declare const ServerApi: HttpApi.HttpApi<"ServerApi", HttpApiGroup.HttpAp
262
300
  readonly image: import("effect/Schema").NullOr<import("effect/Schema").String>;
263
301
  readonly role: import("effect/Schema").NullOr<import("effect/Schema").String>;
264
302
  readonly banned: import("effect/Schema").NullOr<import("effect/Schema").Boolean>;
303
+ readonly lastLoginMethod: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
265
304
  readonly createdAt: import("effect/Schema").Date;
266
305
  readonly updatedAt: import("effect/Schema").Date;
267
306
  }>;
@@ -287,68 +326,37 @@ export declare const ServerApi: HttpApi.HttpApi<"ServerApi", HttpApiGroup.HttpAp
287
326
  readonly createdAt: import("effect/Schema").Date;
288
327
  }>>;
289
328
  readonly missingIds: import("effect/Schema").$Array<import("effect/Schema").String>;
290
- }>>, HttpApiEndpoint.Json<typeof HttpApiError.BadRequest | typeof HttpApiError.Unauthorized | typeof HttpApiError.InternalServerError>, never, never>, false> | HttpApiGroup.HttpApiGroup<"domains", HttpApiEndpoint.HttpApiEndpoint<"createDomain", "POST", "/api/domains", HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").Struct<{
291
- readonly hostname: import("effect/Schema").NonEmptyString;
292
- readonly rootHostname: import("effect/Schema").NonEmptyString;
293
- readonly projectId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
294
- readonly organizationId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
295
- readonly managed: import("effect/Schema").Boolean;
296
- }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").Struct<{
297
- readonly id: import("effect/Schema").String;
298
- readonly hostname: import("effect/Schema").String;
299
- readonly rootHostname: import("effect/Schema").String;
300
- readonly projectId: import("effect/Schema").NullOr<import("effect/Schema").String>;
301
- readonly organizationId: import("effect/Schema").NullOr<import("effect/Schema").String>;
302
- readonly hostnameId: import("effect/Schema").String;
303
- readonly managed: import("effect/Schema").Boolean;
304
- readonly active: import("effect/Schema").Boolean;
305
- readonly createdAt: import("effect/Schema").Date;
306
- readonly updatedAt: import("effect/Schema").Date;
307
- }>>, HttpApiEndpoint.Json<typeof HttpApiError.BadRequest | typeof HttpApiError.Unauthorized | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"deleteDomain", "DELETE", "/api/domains/:id", HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
308
- readonly id: import("effect/Schema").NonEmptyString;
309
- }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").Struct<{
310
- readonly id: import("effect/Schema").String;
311
- readonly hostname: import("effect/Schema").String;
312
- readonly rootHostname: import("effect/Schema").String;
313
- readonly projectId: import("effect/Schema").NullOr<import("effect/Schema").String>;
314
- readonly organizationId: import("effect/Schema").NullOr<import("effect/Schema").String>;
315
- readonly hostnameId: import("effect/Schema").String;
316
- readonly managed: import("effect/Schema").Boolean;
317
- readonly active: import("effect/Schema").Boolean;
318
- readonly createdAt: import("effect/Schema").Date;
319
- readonly updatedAt: import("effect/Schema").Date;
320
- }>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.NotFound | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getDomain", "GET", "/api/domains/:id", HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
329
+ }>>, HttpApiEndpoint.Json<typeof HttpApiError.BadRequest | typeof HttpApiError.Unauthorized | typeof HttpApiError.InternalServerError>, never, never>, false> | HttpApiGroup.HttpApiGroup<"users", HttpApiEndpoint.HttpApiEndpoint<"getUser", "GET", "/api/users/:id", HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
321
330
  readonly id: import("effect/Schema").NonEmptyString;
322
331
  }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").Struct<{
323
332
  readonly id: import("effect/Schema").String;
324
- readonly hostname: import("effect/Schema").String;
325
- readonly rootHostname: import("effect/Schema").String;
326
- readonly projectId: import("effect/Schema").NullOr<import("effect/Schema").String>;
327
- readonly organizationId: import("effect/Schema").NullOr<import("effect/Schema").String>;
328
- readonly hostnameId: import("effect/Schema").String;
329
- readonly managed: import("effect/Schema").Boolean;
330
- readonly active: import("effect/Schema").Boolean;
333
+ readonly name: import("effect/Schema").String;
334
+ readonly email: import("effect/Schema").String;
335
+ readonly emailVerified: import("effect/Schema").Boolean;
336
+ readonly image: import("effect/Schema").NullOr<import("effect/Schema").String>;
337
+ readonly role: import("effect/Schema").NullOr<import("effect/Schema").String>;
338
+ readonly banned: import("effect/Schema").NullOr<import("effect/Schema").Boolean>;
339
+ readonly lastLoginMethod: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
331
340
  readonly createdAt: import("effect/Schema").Date;
332
341
  readonly updatedAt: import("effect/Schema").Date;
333
- }>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.NotFound | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getDomainByHost", "GET", "/api/domains/by-host/:hostname", HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
334
- readonly hostname: import("effect/Schema").NonEmptyString;
342
+ }>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.NotFound | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getUserActiveOrganization", "GET", "/api/organizations/user/:userId/active", HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
343
+ readonly userId: import("effect/Schema").NonEmptyString;
335
344
  }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").Struct<{
336
- readonly id: import("effect/Schema").String;
337
- readonly hostname: import("effect/Schema").String;
338
- readonly rootHostname: import("effect/Schema").String;
339
- readonly projectId: import("effect/Schema").NullOr<import("effect/Schema").String>;
340
- readonly organizationId: import("effect/Schema").NullOr<import("effect/Schema").String>;
341
- readonly hostnameId: import("effect/Schema").String;
342
- readonly managed: import("effect/Schema").Boolean;
343
- readonly active: import("effect/Schema").Boolean;
344
- readonly createdAt: import("effect/Schema").Date;
345
- readonly updatedAt: import("effect/Schema").Date;
346
- }>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.NotFound | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getDomainRecords", "GET", "/api/domains/:id/records", HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
347
- readonly id: import("effect/Schema").NonEmptyString;
348
- }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").$Array<import("effect/Schema").Struct<{
349
- readonly required: import("effect/Schema").Boolean;
350
- readonly status: import("effect/Schema").String;
351
- readonly type: import("effect/Schema").String;
352
- readonly name: import("effect/Schema").String;
353
- readonly value: import("effect/Schema").String;
354
- }>>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.NotFound | typeof HttpApiError.InternalServerError>, never, never>, false>>;
345
+ readonly id: import("effect/Schema").NullOr<import("effect/Schema").String>;
346
+ }>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"listUsersByIds", "GET", "/api/users", HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
347
+ readonly ids: import("effect/Schema").NonEmptyString;
348
+ }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").Struct<{
349
+ readonly data: import("effect/Schema").$Array<import("effect/Schema").Struct<{
350
+ readonly id: import("effect/Schema").String;
351
+ readonly name: import("effect/Schema").String;
352
+ readonly email: import("effect/Schema").String;
353
+ readonly emailVerified: import("effect/Schema").Boolean;
354
+ readonly image: import("effect/Schema").NullOr<import("effect/Schema").String>;
355
+ readonly role: import("effect/Schema").NullOr<import("effect/Schema").String>;
356
+ readonly banned: import("effect/Schema").NullOr<import("effect/Schema").Boolean>;
357
+ readonly lastLoginMethod: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
358
+ readonly createdAt: import("effect/Schema").Date;
359
+ readonly updatedAt: import("effect/Schema").Date;
360
+ }>>;
361
+ readonly missingIds: import("effect/Schema").$Array<import("effect/Schema").String>;
362
+ }>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.InternalServerError>, never, never>, false>>;
@@ -1,6 +1,9 @@
1
1
  export { AuthService } from "../service";
2
+ export type { AuthSession, AuthSessionWithOrganization, AuthSessionWithUser, AuthSessionWithUserAndOrganization, } from "../service";
2
3
  export { AuthClientConfig } from "../config";
3
4
  export { ServerApi, ServerOrganizationsApiGroup, ServerUsersApiGroup, } from "./api";
4
5
  export { proxyAuthRequest } from "./proxy";
6
+ export { ApiKeySecurity, AuthMiddleware, makeAuthenticationLive, } from "./middleware";
7
+ export type { AuthenticationLiveOptions } from "./middleware";
5
8
  export type { ServerActiveOrganization, ServerMembersResponse, ServerOrganizationsResponse, ServerUsersResponse, } from "./schema";
6
9
  export type { Member, Organization, OrganizationMetadata, User, } from "../schema";
@@ -2,3 +2,4 @@ export { AuthService } from "../service";
2
2
  export { AuthClientConfig } from "../config";
3
3
  export { ServerApi, ServerOrganizationsApiGroup, ServerUsersApiGroup, } from "./api";
4
4
  export { proxyAuthRequest } from "./proxy";
5
+ export { ApiKeySecurity, AuthMiddleware, makeAuthenticationLive, } from "./middleware";
@@ -0,0 +1,23 @@
1
+ import { Layer } from "effect";
2
+ import { HttpApiError, HttpApiMiddleware, HttpApiSecurity } from "effect/unstable/httpapi";
3
+ import { AuthService, type AuthServiceLayerOptions } from "../service";
4
+ export declare const ApiKeySecurity: HttpApiSecurity.ApiKey;
5
+ declare const AuthMiddleware_base: HttpApiMiddleware.ServiceClass<AuthMiddleware, "@krak-stack/auth/AuthMiddleware", {
6
+ requires: never;
7
+ provides: AuthService;
8
+ error: typeof HttpApiError.Unauthorized;
9
+ clientError: never;
10
+ requiredForClient: false;
11
+ security: {
12
+ readonly apiKey: HttpApiSecurity.ApiKey;
13
+ };
14
+ }, HttpApiMiddleware.HttpApiMiddlewareSecurity<{
15
+ readonly apiKey: HttpApiSecurity.ApiKey;
16
+ }, AuthService, typeof HttpApiError.Unauthorized, never>>;
17
+ export declare class AuthMiddleware extends AuthMiddleware_base {
18
+ }
19
+ export type AuthenticationLiveOptions = AuthServiceLayerOptions & {
20
+ readonly authLayer?: Layer.Layer<AuthService, unknown>;
21
+ };
22
+ export declare const makeAuthenticationLive: (options?: AuthenticationLiveOptions | Layer.Layer<AuthService, unknown>) => Layer.Layer<AuthMiddleware, never, never>;
23
+ export {};
@@ -0,0 +1,40 @@
1
+ import { Cause, Effect, Layer, Redacted } from "effect";
2
+ import { HttpServerRequest } from "effect/unstable/http";
3
+ import { HttpApiError, HttpApiMiddleware, HttpApiSecurity, } from "effect/unstable/httpapi";
4
+ import { AuthService } from "../service";
5
+ export const ApiKeySecurity = HttpApiSecurity.apiKey({
6
+ key: "x-api-key",
7
+ in: "header",
8
+ });
9
+ export class AuthMiddleware extends HttpApiMiddleware.Service()("@krak-stack/auth/AuthMiddleware", {
10
+ error: HttpApiError.Unauthorized,
11
+ security: {
12
+ apiKey: ApiKeySecurity,
13
+ },
14
+ }) {
15
+ }
16
+ const isAuthServiceLayer = (value) => Layer.isLayer(value);
17
+ export const makeAuthenticationLive = (options = {}) => {
18
+ const legacyLayer = isAuthServiceLayer(options) ? options : undefined;
19
+ const authOptions = isAuthServiceLayer(options) ? {} : options;
20
+ const authLayer = legacyLayer ?? authOptions.authLayer;
21
+ return Layer.effect(AuthMiddleware, Effect.gen(function* () {
22
+ return {
23
+ apiKey: (httpEffect, { credential }) => Effect.gen(function* () {
24
+ const request = yield* HttpServerRequest.HttpServerRequest;
25
+ const apiKey = Redacted.value(credential).trim();
26
+ const headers = apiKey
27
+ ? { ...request.headers, "x-api-key": apiKey }
28
+ : request.headers;
29
+ const auth = yield* AuthService.pipe(Effect.provide(authLayer ??
30
+ AuthService.layer({
31
+ ...authOptions,
32
+ headers,
33
+ })), Effect.tapCause((cause) => Effect.logError("Authentication rejected: auth client initialization failed", Cause.pretty(cause))), Effect.mapError(() => new HttpApiError.Unauthorized({})));
34
+ return yield* httpEffect.pipe(Effect.provideService(AuthService, auth));
35
+ }).pipe(Effect.mapError((error) => error instanceof HttpApiError.Unauthorized
36
+ ? error
37
+ : new HttpApiError.Unauthorized({}))),
38
+ };
39
+ }));
40
+ };
@@ -31,6 +31,7 @@ export declare const ServerUsersResponse: Schema.Struct<{
31
31
  readonly image: Schema.NullOr<Schema.String>;
32
32
  readonly role: Schema.NullOr<Schema.String>;
33
33
  readonly banned: Schema.NullOr<Schema.Boolean>;
34
+ readonly lastLoginMethod: Schema.optional<Schema.NullOr<Schema.String>>;
34
35
  readonly createdAt: Schema.Date;
35
36
  readonly updatedAt: Schema.Date;
36
37
  }>>;
@@ -70,6 +71,7 @@ export declare const ServerMembersResponse: Schema.$Array<Schema.Struct<{
70
71
  readonly image: Schema.NullOr<Schema.String>;
71
72
  readonly role: Schema.NullOr<Schema.String>;
72
73
  readonly banned: Schema.NullOr<Schema.Boolean>;
74
+ readonly lastLoginMethod: Schema.optional<Schema.NullOr<Schema.String>>;
73
75
  readonly createdAt: Schema.Date;
74
76
  readonly updatedAt: Schema.Date;
75
77
  }>;