@krak-stack/auth 0.1.40 → 0.1.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/api.group.d.ts +197 -0
- package/dist/admin/api.group.js +159 -0
- package/dist/admin/schema.d.ts +128 -0
- package/dist/admin/schema.js +190 -0
- package/dist/api.d.ts +264 -11
- package/dist/api.js +14 -5
- package/dist/better-auth/{index.d.ts → api.group.d.ts} +6 -8
- package/dist/better-auth/{api.js → api.group.js} +2 -4
- package/dist/components/admin-organization-form.d.ts +3 -3
- package/dist/components/admin-organization-form.js +9 -19
- package/dist/components/admin-organizations.js +16 -12
- package/dist/components/admin-users.d.ts +1 -1
- package/dist/components/admin-users.js +35 -18
- package/dist/components/{auth-api-client.d.ts → auth-client-api.d.ts} +179 -209
- package/dist/components/auth-client-api.js +29 -0
- package/dist/components/auth-forms.js +3 -3
- package/dist/components/auth-provider.js +2 -2
- package/dist/components/organization-switcher.js +15 -16
- package/dist/components/user-button.js +3 -3
- package/dist/components/utils.d.ts +11 -0
- package/dist/components/utils.js +24 -0
- package/dist/extra/api.group.d.ts +68 -0
- package/dist/extra/{api.js → api.group.js} +5 -17
- package/dist/index.d.ts +5 -3
- package/dist/index.js +5 -3
- package/dist/query.d.ts +49 -0
- package/dist/query.js +114 -0
- package/dist/server/{api.d.ts → api.group.d.ts} +0 -196
- package/dist/server/{api.js → api.group.js} +1 -6
- package/dist/server/index.d.ts +2 -2
- package/dist/server/index.js +2 -1
- package/dist/service.d.ts +12 -24
- package/dist/service.js +2 -2
- package/package.json +13 -5
- package/dist/better-auth/api.d.ts +0 -55
- package/dist/better-auth/index.js +0 -12
- package/dist/components/auth-api-client.js +0 -29
- package/dist/extra/api.d.ts +0 -139
- package/dist/extra/index.d.ts +0 -76
- package/dist/extra/index.js +0 -14
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { HttpApi } from "effect/unstable/httpapi";
|
|
2
1
|
import { HttpApiEndpoint, HttpApiError, HttpApiGroup } from "effect/unstable/httpapi";
|
|
3
2
|
export declare const ServerUsersApiGroup: HttpApiGroup.HttpApiGroup<"users", HttpApiEndpoint.HttpApiEndpoint<"getUser", "GET", "/users/:id", HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
|
|
4
3
|
readonly id: import("effect/Schema").NonEmptyString;
|
|
@@ -197,198 +196,3 @@ export declare const ServerDomainsApiGroup: HttpApiGroup.HttpApiGroup<"domains",
|
|
|
197
196
|
readonly name: import("effect/Schema").String;
|
|
198
197
|
readonly value: import("effect/Schema").String;
|
|
199
198
|
}>>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.NotFound | typeof HttpApiError.InternalServerError>, never, never>, false>;
|
|
200
|
-
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<{
|
|
201
|
-
readonly hostname: import("effect/Schema").NonEmptyString;
|
|
202
|
-
readonly rootHostname: import("effect/Schema").NonEmptyString;
|
|
203
|
-
readonly projectId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
204
|
-
readonly organizationId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
205
|
-
readonly managed: import("effect/Schema").Boolean;
|
|
206
|
-
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").Struct<{
|
|
207
|
-
readonly id: import("effect/Schema").String;
|
|
208
|
-
readonly hostname: import("effect/Schema").String;
|
|
209
|
-
readonly rootHostname: import("effect/Schema").String;
|
|
210
|
-
readonly projectId: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
211
|
-
readonly projectName: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
212
|
-
readonly projectLogo: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
213
|
-
readonly organizationId: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
214
|
-
readonly organizationName: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
215
|
-
readonly organizationLogo: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
216
|
-
readonly hostnameId: import("effect/Schema").String;
|
|
217
|
-
readonly managed: import("effect/Schema").Boolean;
|
|
218
|
-
readonly active: import("effect/Schema").Boolean;
|
|
219
|
-
readonly createdAt: import("effect/Schema").Date;
|
|
220
|
-
readonly updatedAt: import("effect/Schema").Date;
|
|
221
|
-
}>>, 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<{
|
|
222
|
-
readonly id: import("effect/Schema").NonEmptyString;
|
|
223
|
-
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").Struct<{
|
|
224
|
-
readonly id: import("effect/Schema").String;
|
|
225
|
-
readonly hostname: import("effect/Schema").String;
|
|
226
|
-
readonly rootHostname: import("effect/Schema").String;
|
|
227
|
-
readonly projectId: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
228
|
-
readonly projectName: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
229
|
-
readonly projectLogo: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
230
|
-
readonly organizationId: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
231
|
-
readonly organizationName: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
232
|
-
readonly organizationLogo: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
233
|
-
readonly hostnameId: import("effect/Schema").String;
|
|
234
|
-
readonly managed: import("effect/Schema").Boolean;
|
|
235
|
-
readonly active: import("effect/Schema").Boolean;
|
|
236
|
-
readonly createdAt: import("effect/Schema").Date;
|
|
237
|
-
readonly updatedAt: import("effect/Schema").Date;
|
|
238
|
-
}>>, 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<{
|
|
239
|
-
readonly id: import("effect/Schema").NonEmptyString;
|
|
240
|
-
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").Struct<{
|
|
241
|
-
readonly id: import("effect/Schema").String;
|
|
242
|
-
readonly hostname: import("effect/Schema").String;
|
|
243
|
-
readonly rootHostname: import("effect/Schema").String;
|
|
244
|
-
readonly projectId: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
245
|
-
readonly projectName: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
246
|
-
readonly projectLogo: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
247
|
-
readonly organizationId: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
248
|
-
readonly organizationName: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
249
|
-
readonly organizationLogo: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
250
|
-
readonly hostnameId: import("effect/Schema").String;
|
|
251
|
-
readonly managed: import("effect/Schema").Boolean;
|
|
252
|
-
readonly active: import("effect/Schema").Boolean;
|
|
253
|
-
readonly createdAt: import("effect/Schema").Date;
|
|
254
|
-
readonly updatedAt: import("effect/Schema").Date;
|
|
255
|
-
}>>, 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<{
|
|
256
|
-
readonly hostname: import("effect/Schema").NonEmptyString;
|
|
257
|
-
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").Struct<{
|
|
258
|
-
readonly id: import("effect/Schema").String;
|
|
259
|
-
readonly hostname: import("effect/Schema").String;
|
|
260
|
-
readonly rootHostname: import("effect/Schema").String;
|
|
261
|
-
readonly projectId: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
262
|
-
readonly projectName: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
263
|
-
readonly projectLogo: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
264
|
-
readonly organizationId: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
265
|
-
readonly organizationName: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
266
|
-
readonly organizationLogo: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
267
|
-
readonly hostnameId: import("effect/Schema").String;
|
|
268
|
-
readonly managed: import("effect/Schema").Boolean;
|
|
269
|
-
readonly active: import("effect/Schema").Boolean;
|
|
270
|
-
readonly createdAt: import("effect/Schema").Date;
|
|
271
|
-
readonly updatedAt: import("effect/Schema").Date;
|
|
272
|
-
}>>, 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<{
|
|
273
|
-
readonly id: import("effect/Schema").NonEmptyString;
|
|
274
|
-
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
275
|
-
readonly required: import("effect/Schema").Boolean;
|
|
276
|
-
readonly status: import("effect/Schema").String;
|
|
277
|
-
readonly type: import("effect/Schema").String;
|
|
278
|
-
readonly name: import("effect/Schema").String;
|
|
279
|
-
readonly value: import("effect/Schema").String;
|
|
280
|
-
}>>>, 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<{
|
|
281
|
-
readonly organizationId: import("effect/Schema").NonEmptyString;
|
|
282
|
-
readonly userId: import("effect/Schema").NonEmptyString;
|
|
283
|
-
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").Struct<{
|
|
284
|
-
readonly id: import("effect/Schema").String;
|
|
285
|
-
readonly organizationId: import("effect/Schema").String;
|
|
286
|
-
readonly userId: import("effect/Schema").String;
|
|
287
|
-
readonly role: import("effect/Schema").String;
|
|
288
|
-
readonly createdAt: import("effect/Schema").Date;
|
|
289
|
-
readonly user: import("effect/Schema").Struct<{
|
|
290
|
-
readonly id: import("effect/Schema").String;
|
|
291
|
-
readonly name: import("effect/Schema").String;
|
|
292
|
-
readonly email: import("effect/Schema").String;
|
|
293
|
-
readonly emailVerified: import("effect/Schema").Boolean;
|
|
294
|
-
readonly image: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
295
|
-
readonly role: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
296
|
-
readonly banned: import("effect/Schema").NullOr<import("effect/Schema").Boolean>;
|
|
297
|
-
readonly lastLoginMethod: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
298
|
-
readonly createdAt: import("effect/Schema").Date;
|
|
299
|
-
readonly updatedAt: import("effect/Schema").Date;
|
|
300
|
-
}>;
|
|
301
|
-
}>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.NotFound | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getOrganization", "GET", "/api/organizations/:id", HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
|
|
302
|
-
readonly id: import("effect/Schema").NonEmptyString;
|
|
303
|
-
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").Struct<{
|
|
304
|
-
readonly id: import("effect/Schema").String;
|
|
305
|
-
readonly name: import("effect/Schema").String;
|
|
306
|
-
readonly slug: import("effect/Schema").String;
|
|
307
|
-
readonly logo: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
308
|
-
readonly metadata: import("effect/Schema").NullOr<import("effect/Schema").Struct<{
|
|
309
|
-
readonly translations: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
310
|
-
readonly locale: import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"en">, import("effect/Schema").Literal<"fr">]>;
|
|
311
|
-
readonly name: import("effect/Schema").String;
|
|
312
|
-
readonly logo: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
313
|
-
readonly icon: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
314
|
-
readonly contactEmail: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
315
|
-
readonly location: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
316
|
-
}>>;
|
|
317
|
-
}>>;
|
|
318
|
-
readonly createdAt: import("effect/Schema").Date;
|
|
319
|
-
}>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.NotFound | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"listOrganizationMembers", "GET", "/api/organizations/:organizationId/members", HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
|
|
320
|
-
readonly organizationId: import("effect/Schema").NonEmptyString;
|
|
321
|
-
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
322
|
-
readonly id: import("effect/Schema").String;
|
|
323
|
-
readonly organizationId: import("effect/Schema").String;
|
|
324
|
-
readonly userId: import("effect/Schema").String;
|
|
325
|
-
readonly role: import("effect/Schema").String;
|
|
326
|
-
readonly createdAt: import("effect/Schema").Date;
|
|
327
|
-
readonly user: import("effect/Schema").Struct<{
|
|
328
|
-
readonly id: import("effect/Schema").String;
|
|
329
|
-
readonly name: import("effect/Schema").String;
|
|
330
|
-
readonly email: import("effect/Schema").String;
|
|
331
|
-
readonly emailVerified: import("effect/Schema").Boolean;
|
|
332
|
-
readonly image: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
333
|
-
readonly role: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
334
|
-
readonly banned: import("effect/Schema").NullOr<import("effect/Schema").Boolean>;
|
|
335
|
-
readonly lastLoginMethod: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
336
|
-
readonly createdAt: import("effect/Schema").Date;
|
|
337
|
-
readonly updatedAt: import("effect/Schema").Date;
|
|
338
|
-
}>;
|
|
339
|
-
}>>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"listOrganizations", "GET", "/api/organizations", HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
|
|
340
|
-
readonly ids: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
|
|
341
|
-
readonly userId: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
|
|
342
|
-
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").Struct<{
|
|
343
|
-
readonly data: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
344
|
-
readonly id: import("effect/Schema").String;
|
|
345
|
-
readonly name: import("effect/Schema").String;
|
|
346
|
-
readonly slug: import("effect/Schema").String;
|
|
347
|
-
readonly logo: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
348
|
-
readonly metadata: import("effect/Schema").NullOr<import("effect/Schema").Struct<{
|
|
349
|
-
readonly translations: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
350
|
-
readonly locale: import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"en">, import("effect/Schema").Literal<"fr">]>;
|
|
351
|
-
readonly name: import("effect/Schema").String;
|
|
352
|
-
readonly logo: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
353
|
-
readonly icon: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
354
|
-
readonly contactEmail: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
355
|
-
readonly location: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
356
|
-
}>>;
|
|
357
|
-
}>>;
|
|
358
|
-
readonly createdAt: import("effect/Schema").Date;
|
|
359
|
-
}>>;
|
|
360
|
-
readonly missingIds: import("effect/Schema").$Array<import("effect/Schema").String>;
|
|
361
|
-
}>>, 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<{
|
|
362
|
-
readonly id: import("effect/Schema").NonEmptyString;
|
|
363
|
-
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").Struct<{
|
|
364
|
-
readonly id: import("effect/Schema").String;
|
|
365
|
-
readonly name: import("effect/Schema").String;
|
|
366
|
-
readonly email: import("effect/Schema").String;
|
|
367
|
-
readonly emailVerified: import("effect/Schema").Boolean;
|
|
368
|
-
readonly image: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
369
|
-
readonly role: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
370
|
-
readonly banned: import("effect/Schema").NullOr<import("effect/Schema").Boolean>;
|
|
371
|
-
readonly lastLoginMethod: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
372
|
-
readonly createdAt: import("effect/Schema").Date;
|
|
373
|
-
readonly updatedAt: import("effect/Schema").Date;
|
|
374
|
-
}>>, 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<{
|
|
375
|
-
readonly userId: import("effect/Schema").NonEmptyString;
|
|
376
|
-
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").Struct<{
|
|
377
|
-
readonly id: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
378
|
-
}>>, 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<{
|
|
379
|
-
readonly ids: import("effect/Schema").NonEmptyString;
|
|
380
|
-
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").Struct<{
|
|
381
|
-
readonly data: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
382
|
-
readonly id: import("effect/Schema").String;
|
|
383
|
-
readonly name: import("effect/Schema").String;
|
|
384
|
-
readonly email: import("effect/Schema").String;
|
|
385
|
-
readonly emailVerified: import("effect/Schema").Boolean;
|
|
386
|
-
readonly image: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
387
|
-
readonly role: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
388
|
-
readonly banned: import("effect/Schema").NullOr<import("effect/Schema").Boolean>;
|
|
389
|
-
readonly lastLoginMethod: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
390
|
-
readonly createdAt: import("effect/Schema").Date;
|
|
391
|
-
readonly updatedAt: import("effect/Schema").Date;
|
|
392
|
-
}>>;
|
|
393
|
-
readonly missingIds: import("effect/Schema").$Array<import("effect/Schema").String>;
|
|
394
|
-
}>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.InternalServerError>, never, never>, false>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { OpenApi } from "effect/unstable/httpapi";
|
|
2
2
|
import { HttpApiEndpoint, HttpApiError, HttpApiGroup, } from "effect/unstable/httpapi";
|
|
3
3
|
import { Member, Organization, User } from "../schema";
|
|
4
4
|
import { ServerActiveOrganization, ServerCreateDomainPayload, ServerDomain, ServerDomainHostParams, ServerDomainIdParams, ServerDomainRecordsResponse, ServerIdParams, ServerIdsQuery, ServerMemberParams, ServerMembersResponse, ServerOrganizationIdParams, ServerOrganizationsQuery, ServerOrganizationsResponse, ServerUserIdParams, ServerUsersResponse, } from "./schema";
|
|
@@ -145,8 +145,3 @@ export const ServerDomainsApiGroup = HttpApiGroup.make("domains")
|
|
|
145
145
|
title: "Domains (Server)",
|
|
146
146
|
description: "Server-to-server auth hostname endpoints.",
|
|
147
147
|
}));
|
|
148
|
-
export const ServerApi = HttpApi.make("ServerApi")
|
|
149
|
-
.add(ServerUsersApiGroup)
|
|
150
|
-
.add(ServerOrganizationsApiGroup)
|
|
151
|
-
.add(ServerDomainsApiGroup)
|
|
152
|
-
.prefix("/api");
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { AuthService } from "../service";
|
|
2
2
|
export type { AuthSession, AuthSessionWithOrganization, AuthSessionWithUser, AuthSessionWithUserAndOrganization, } from "../service";
|
|
3
3
|
export { AuthClientConfig } from "../config";
|
|
4
|
-
export {
|
|
4
|
+
export { ServerDomainsApiGroup, ServerOrganizationsApiGroup, ServerUsersApiGroup, } from "./api.group";
|
|
5
5
|
export { proxyAuthRequest } from "./proxy";
|
|
6
6
|
export { ApiKeySecurity, AuthMiddleware, makeAuthenticationLive, } from "./middleware";
|
|
7
7
|
export type { AuthenticationLiveOptions } from "./middleware";
|
|
8
|
-
export
|
|
8
|
+
export { ServerActiveOrganization, ServerCreateDomainPayload, ServerDomain, ServerDomainHostParams, ServerDomainIdParams, ServerDomainRecordsResponse, ServerMembersResponse, ServerOrganizationsResponse, ServerUpdateDomainPayload, ServerUsersResponse, } from "./schema";
|
|
9
9
|
export type { Member, Organization, OrganizationMetadata, User, } from "../schema";
|
package/dist/server/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { AuthService } from "../service";
|
|
2
2
|
export { AuthClientConfig } from "../config";
|
|
3
|
-
export {
|
|
3
|
+
export { ServerDomainsApiGroup, ServerOrganizationsApiGroup, ServerUsersApiGroup, } from "./api.group";
|
|
4
4
|
export { proxyAuthRequest } from "./proxy";
|
|
5
5
|
export { ApiKeySecurity, AuthMiddleware, makeAuthenticationLive, } from "./middleware";
|
|
6
|
+
export { ServerActiveOrganization, ServerCreateDomainPayload, ServerDomain, ServerDomainHostParams, ServerDomainIdParams, ServerDomainRecordsResponse, ServerMembersResponse, ServerOrganizationsResponse, ServerUpdateDomainPayload, ServerUsersResponse, } from "./schema";
|
package/dist/service.d.ts
CHANGED
|
@@ -64,7 +64,7 @@ declare const AuthService_base: Context.ServiceClass<AuthService, "@krak-stack/a
|
|
|
64
64
|
readonly createdAt: import("effect/Schema").Date;
|
|
65
65
|
readonly updatedAt: import("effect/Schema").Date;
|
|
66
66
|
}>;
|
|
67
|
-
}, "Type"> | null, Mode>, import("effect/unstable/http/HttpClientError").HttpClientError | ([Mode] extends ["response-only"] ? never : HttpApiError.BadRequest | HttpApiError.Forbidden | HttpApiError.InternalServerError | HttpApiError.NotFound | import("effect/Schema").SchemaError | import("./better-auth").TooManyRequests | HttpApiError.Unauthorized), [Mode] extends ["response-only"] ? never : never>;
|
|
67
|
+
}, "Type"> | null, Mode>, import("effect/unstable/http/HttpClientError").HttpClientError | ([Mode] extends ["response-only"] ? never : HttpApiError.BadRequest | HttpApiError.Forbidden | HttpApiError.InternalServerError | HttpApiError.NotFound | import("effect/Schema").SchemaError | import("./better-auth/schema").TooManyRequests | HttpApiError.Unauthorized), [Mode] extends ["response-only"] ? never : never>;
|
|
68
68
|
};
|
|
69
69
|
authExtra: {
|
|
70
70
|
readonly createApiKey: <Mode extends HttpApiClient.Client.ResponseMode = import("effect/unstable/httpapi/HttpApiEndpoint").ClientResponseMode>(request: {
|
|
@@ -80,7 +80,7 @@ declare const AuthService_base: Context.ServiceClass<AuthService, "@krak-stack/a
|
|
|
80
80
|
}) => Effect.Effect<HttpApiClient.Client.Response<import("effect/Schema").Struct.ReadonlySide<{
|
|
81
81
|
readonly id: import("effect/Schema").String;
|
|
82
82
|
readonly key: import("effect/Schema").String;
|
|
83
|
-
}, "Type">, Mode>, import("effect/unstable/http/HttpClientError").HttpClientError | ([Mode] extends ["response-only"] ? never : import("./extra").ExtraBadRequest | import("effect/Schema").SchemaError), [Mode] extends ["response-only"] ? never : never>;
|
|
83
|
+
}, "Type">, Mode>, import("effect/unstable/http/HttpClientError").HttpClientError | ([Mode] extends ["response-only"] ? never : import("./extra/schema").ExtraBadRequest | import("effect/Schema").SchemaError), [Mode] extends ["response-only"] ? never : never>;
|
|
84
84
|
readonly getProjectPublicConfig: <Mode extends HttpApiClient.Client.ResponseMode = import("effect/unstable/httpapi/HttpApiEndpoint").ClientResponseMode>(request: {
|
|
85
85
|
readonly query: {
|
|
86
86
|
readonly projectId?: string | undefined;
|
|
@@ -111,19 +111,13 @@ declare const AuthService_base: Context.ServiceClass<AuthService, "@krak-stack/a
|
|
|
111
111
|
readonly responseMode?: Mode;
|
|
112
112
|
}) => Effect.Effect<HttpApiClient.Client.Response<import("effect/Schema").Struct.ReadonlySide<{
|
|
113
113
|
readonly ok: import("effect/Schema").Boolean;
|
|
114
|
-
}, "Type">, Mode>, import("effect/unstable/http/HttpClientError").HttpClientError | ([Mode] extends ["response-only"] ? never : import("./extra").ExtraBadRequest | import("effect/Schema").SchemaError), [Mode] extends ["response-only"] ? never : never>;
|
|
115
|
-
readonly uploadOrganizationLogo: <Mode extends HttpApiClient.Client.ResponseMode = import("effect/unstable/httpapi/HttpApiEndpoint").ClientResponseMode>(request: {
|
|
116
|
-
readonly payload: FormData;
|
|
117
|
-
readonly responseMode?: Mode;
|
|
118
|
-
}) => Effect.Effect<HttpApiClient.Client.Response<import("effect/Schema").Struct.ReadonlySide<{
|
|
119
|
-
readonly url: import("effect/Schema").String;
|
|
120
|
-
}, "Type">, Mode>, import("effect/unstable/http/HttpClientError").HttpClientError | ([Mode] extends ["response-only"] ? never : HttpApiError.BadRequest | HttpApiError.Forbidden | HttpApiError.InternalServerError | import("effect/Schema").SchemaError | HttpApiError.Unauthorized), [Mode] extends ["response-only"] ? never : never>;
|
|
114
|
+
}, "Type">, Mode>, import("effect/unstable/http/HttpClientError").HttpClientError | ([Mode] extends ["response-only"] ? never : import("./extra/schema").ExtraBadRequest | import("effect/Schema").SchemaError), [Mode] extends ["response-only"] ? never : never>;
|
|
121
115
|
readonly uploadUserImage: <Mode extends HttpApiClient.Client.ResponseMode = import("effect/unstable/httpapi/HttpApiEndpoint").ClientResponseMode>(request: {
|
|
122
116
|
readonly payload: FormData;
|
|
123
117
|
readonly responseMode?: Mode;
|
|
124
118
|
}) => Effect.Effect<HttpApiClient.Client.Response<import("effect/Schema").Struct.ReadonlySide<{
|
|
125
119
|
readonly url: import("effect/Schema").String;
|
|
126
|
-
}, "Type">, Mode>, import("effect/unstable/http/HttpClientError").HttpClientError | ([Mode] extends ["response-only"] ? never : import("./extra").ExtraBadRequest | HttpApiError.InternalServerError | import("effect/Schema").SchemaError | HttpApiError.Unauthorized), [Mode] extends ["response-only"] ? never : never>;
|
|
120
|
+
}, "Type">, Mode>, import("effect/unstable/http/HttpClientError").HttpClientError | ([Mode] extends ["response-only"] ? never : import("./extra/schema").ExtraBadRequest | HttpApiError.InternalServerError | import("effect/Schema").SchemaError | HttpApiError.Unauthorized), [Mode] extends ["response-only"] ? never : never>;
|
|
127
121
|
readonly verifyApiKey: <Mode extends HttpApiClient.Client.ResponseMode = import("effect/unstable/httpapi/HttpApiEndpoint").ClientResponseMode>(request: {
|
|
128
122
|
readonly payload: {
|
|
129
123
|
readonly key: string;
|
|
@@ -153,7 +147,7 @@ declare const AuthService_base: Context.ServiceClass<AuthService, "@krak-stack/a
|
|
|
153
147
|
readonly permissions: import("effect/Schema").NullOr<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>>>;
|
|
154
148
|
readonly metadata: import("effect/Schema").NullOr<import("effect/Schema").Unknown>;
|
|
155
149
|
}>>;
|
|
156
|
-
}, "Type">, Mode>, import("effect/unstable/http/HttpClientError").HttpClientError | ([Mode] extends ["response-only"] ? never : import("./extra").ExtraBadRequest | import("effect/Schema").SchemaError), [Mode] extends ["response-only"] ? never : never>;
|
|
150
|
+
}, "Type">, Mode>, import("effect/unstable/http/HttpClientError").HttpClientError | ([Mode] extends ["response-only"] ? never : import("./extra/schema").ExtraBadRequest | import("effect/Schema").SchemaError), [Mode] extends ["response-only"] ? never : never>;
|
|
157
151
|
readonly verifyPassword: <Mode extends HttpApiClient.Client.ResponseMode = import("effect/unstable/httpapi/HttpApiEndpoint").ClientResponseMode>(request: {
|
|
158
152
|
readonly payload: import("effect/Schema").Struct.ReadonlySide<{
|
|
159
153
|
readonly password: import("effect/Schema").NonEmptyString;
|
|
@@ -161,7 +155,7 @@ declare const AuthService_base: Context.ServiceClass<AuthService, "@krak-stack/a
|
|
|
161
155
|
readonly responseMode?: Mode;
|
|
162
156
|
}) => Effect.Effect<HttpApiClient.Client.Response<import("effect/Schema").Struct.ReadonlySide<{
|
|
163
157
|
readonly ok: import("effect/Schema").Boolean;
|
|
164
|
-
}, "Type">, Mode>, import("effect/unstable/http/HttpClientError").HttpClientError | ([Mode] extends ["response-only"] ? never : import("./extra").ExtraBadRequest | import("effect/Schema").SchemaError), [Mode] extends ["response-only"] ? never : never>;
|
|
158
|
+
}, "Type">, Mode>, import("effect/unstable/http/HttpClientError").HttpClientError | ([Mode] extends ["response-only"] ? never : import("./extra/schema").ExtraBadRequest | import("effect/Schema").SchemaError), [Mode] extends ["response-only"] ? never : never>;
|
|
165
159
|
};
|
|
166
160
|
domains: {
|
|
167
161
|
readonly createDomain: <Mode extends HttpApiClient.Client.ResponseMode = import("effect/unstable/httpapi/HttpApiEndpoint").ClientResponseMode>(request: {
|
|
@@ -446,7 +440,7 @@ declare const AuthService_base: Context.ServiceClass<AuthService, "@krak-stack/a
|
|
|
446
440
|
readonly createdAt: import("effect/Schema").Date;
|
|
447
441
|
readonly updatedAt: import("effect/Schema").Date;
|
|
448
442
|
}>;
|
|
449
|
-
}, "Type"> | null, Mode>, import("effect/unstable/http/HttpClientError").HttpClientError | ([Mode] extends ["response-only"] ? never : HttpApiError.BadRequest | HttpApiError.Forbidden | HttpApiError.InternalServerError | HttpApiError.NotFound | import("effect/Schema").SchemaError | import("./better-auth").TooManyRequests | HttpApiError.Unauthorized), [Mode] extends ["response-only"] ? never : never>;
|
|
443
|
+
}, "Type"> | null, Mode>, import("effect/unstable/http/HttpClientError").HttpClientError | ([Mode] extends ["response-only"] ? never : HttpApiError.BadRequest | HttpApiError.Forbidden | HttpApiError.InternalServerError | HttpApiError.NotFound | import("effect/Schema").SchemaError | import("./better-auth/schema").TooManyRequests | HttpApiError.Unauthorized), [Mode] extends ["response-only"] ? never : never>;
|
|
450
444
|
};
|
|
451
445
|
authExtra: {
|
|
452
446
|
readonly createApiKey: <Mode extends HttpApiClient.Client.ResponseMode = import("effect/unstable/httpapi/HttpApiEndpoint").ClientResponseMode>(request: {
|
|
@@ -462,7 +456,7 @@ declare const AuthService_base: Context.ServiceClass<AuthService, "@krak-stack/a
|
|
|
462
456
|
}) => Effect.Effect<HttpApiClient.Client.Response<import("effect/Schema").Struct.ReadonlySide<{
|
|
463
457
|
readonly id: import("effect/Schema").String;
|
|
464
458
|
readonly key: import("effect/Schema").String;
|
|
465
|
-
}, "Type">, Mode>, import("effect/unstable/http/HttpClientError").HttpClientError | ([Mode] extends ["response-only"] ? never : import("./extra").ExtraBadRequest | import("effect/Schema").SchemaError), [Mode] extends ["response-only"] ? never : never>;
|
|
459
|
+
}, "Type">, Mode>, import("effect/unstable/http/HttpClientError").HttpClientError | ([Mode] extends ["response-only"] ? never : import("./extra/schema").ExtraBadRequest | import("effect/Schema").SchemaError), [Mode] extends ["response-only"] ? never : never>;
|
|
466
460
|
readonly getProjectPublicConfig: <Mode extends HttpApiClient.Client.ResponseMode = import("effect/unstable/httpapi/HttpApiEndpoint").ClientResponseMode>(request: {
|
|
467
461
|
readonly query: {
|
|
468
462
|
readonly projectId?: string | undefined;
|
|
@@ -493,19 +487,13 @@ declare const AuthService_base: Context.ServiceClass<AuthService, "@krak-stack/a
|
|
|
493
487
|
readonly responseMode?: Mode;
|
|
494
488
|
}) => Effect.Effect<HttpApiClient.Client.Response<import("effect/Schema").Struct.ReadonlySide<{
|
|
495
489
|
readonly ok: import("effect/Schema").Boolean;
|
|
496
|
-
}, "Type">, Mode>, import("effect/unstable/http/HttpClientError").HttpClientError | ([Mode] extends ["response-only"] ? never : import("./extra").ExtraBadRequest | import("effect/Schema").SchemaError), [Mode] extends ["response-only"] ? never : never>;
|
|
497
|
-
readonly uploadOrganizationLogo: <Mode extends HttpApiClient.Client.ResponseMode = import("effect/unstable/httpapi/HttpApiEndpoint").ClientResponseMode>(request: {
|
|
498
|
-
readonly payload: FormData;
|
|
499
|
-
readonly responseMode?: Mode;
|
|
500
|
-
}) => Effect.Effect<HttpApiClient.Client.Response<import("effect/Schema").Struct.ReadonlySide<{
|
|
501
|
-
readonly url: import("effect/Schema").String;
|
|
502
|
-
}, "Type">, Mode>, import("effect/unstable/http/HttpClientError").HttpClientError | ([Mode] extends ["response-only"] ? never : HttpApiError.BadRequest | HttpApiError.Forbidden | HttpApiError.InternalServerError | import("effect/Schema").SchemaError | HttpApiError.Unauthorized), [Mode] extends ["response-only"] ? never : never>;
|
|
490
|
+
}, "Type">, Mode>, import("effect/unstable/http/HttpClientError").HttpClientError | ([Mode] extends ["response-only"] ? never : import("./extra/schema").ExtraBadRequest | import("effect/Schema").SchemaError), [Mode] extends ["response-only"] ? never : never>;
|
|
503
491
|
readonly uploadUserImage: <Mode extends HttpApiClient.Client.ResponseMode = import("effect/unstable/httpapi/HttpApiEndpoint").ClientResponseMode>(request: {
|
|
504
492
|
readonly payload: FormData;
|
|
505
493
|
readonly responseMode?: Mode;
|
|
506
494
|
}) => Effect.Effect<HttpApiClient.Client.Response<import("effect/Schema").Struct.ReadonlySide<{
|
|
507
495
|
readonly url: import("effect/Schema").String;
|
|
508
|
-
}, "Type">, Mode>, import("effect/unstable/http/HttpClientError").HttpClientError | ([Mode] extends ["response-only"] ? never : import("./extra").ExtraBadRequest | HttpApiError.InternalServerError | import("effect/Schema").SchemaError | HttpApiError.Unauthorized), [Mode] extends ["response-only"] ? never : never>;
|
|
496
|
+
}, "Type">, Mode>, import("effect/unstable/http/HttpClientError").HttpClientError | ([Mode] extends ["response-only"] ? never : import("./extra/schema").ExtraBadRequest | HttpApiError.InternalServerError | import("effect/Schema").SchemaError | HttpApiError.Unauthorized), [Mode] extends ["response-only"] ? never : never>;
|
|
509
497
|
readonly verifyApiKey: <Mode extends HttpApiClient.Client.ResponseMode = import("effect/unstable/httpapi/HttpApiEndpoint").ClientResponseMode>(request: {
|
|
510
498
|
readonly payload: {
|
|
511
499
|
readonly key: string;
|
|
@@ -535,7 +523,7 @@ declare const AuthService_base: Context.ServiceClass<AuthService, "@krak-stack/a
|
|
|
535
523
|
readonly permissions: import("effect/Schema").NullOr<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>>>;
|
|
536
524
|
readonly metadata: import("effect/Schema").NullOr<import("effect/Schema").Unknown>;
|
|
537
525
|
}>>;
|
|
538
|
-
}, "Type">, Mode>, import("effect/unstable/http/HttpClientError").HttpClientError | ([Mode] extends ["response-only"] ? never : import("./extra").ExtraBadRequest | import("effect/Schema").SchemaError), [Mode] extends ["response-only"] ? never : never>;
|
|
526
|
+
}, "Type">, Mode>, import("effect/unstable/http/HttpClientError").HttpClientError | ([Mode] extends ["response-only"] ? never : import("./extra/schema").ExtraBadRequest | import("effect/Schema").SchemaError), [Mode] extends ["response-only"] ? never : never>;
|
|
539
527
|
readonly verifyPassword: <Mode extends HttpApiClient.Client.ResponseMode = import("effect/unstable/httpapi/HttpApiEndpoint").ClientResponseMode>(request: {
|
|
540
528
|
readonly payload: import("effect/Schema").Struct.ReadonlySide<{
|
|
541
529
|
readonly password: import("effect/Schema").NonEmptyString;
|
|
@@ -543,7 +531,7 @@ declare const AuthService_base: Context.ServiceClass<AuthService, "@krak-stack/a
|
|
|
543
531
|
readonly responseMode?: Mode;
|
|
544
532
|
}) => Effect.Effect<HttpApiClient.Client.Response<import("effect/Schema").Struct.ReadonlySide<{
|
|
545
533
|
readonly ok: import("effect/Schema").Boolean;
|
|
546
|
-
}, "Type">, Mode>, import("effect/unstable/http/HttpClientError").HttpClientError | ([Mode] extends ["response-only"] ? never : import("./extra").ExtraBadRequest | import("effect/Schema").SchemaError), [Mode] extends ["response-only"] ? never : never>;
|
|
534
|
+
}, "Type">, Mode>, import("effect/unstable/http/HttpClientError").HttpClientError | ([Mode] extends ["response-only"] ? never : import("./extra/schema").ExtraBadRequest | import("effect/Schema").SchemaError), [Mode] extends ["response-only"] ? never : never>;
|
|
547
535
|
};
|
|
548
536
|
domains: {
|
|
549
537
|
readonly createDomain: <Mode extends HttpApiClient.Client.ResponseMode = import("effect/unstable/httpapi/HttpApiEndpoint").ClientResponseMode>(request: {
|
package/dist/service.js
CHANGED
|
@@ -2,7 +2,7 @@ import { Cache, Context, Duration, Effect, Exit, Layer, Redacted, } from "effect
|
|
|
2
2
|
import { FetchHttpClient, HttpClient, HttpClientRequest, } from "effect/unstable/http";
|
|
3
3
|
import { HttpApiClient } from "effect/unstable/httpapi";
|
|
4
4
|
import { HttpApiError } from "effect/unstable/httpapi";
|
|
5
|
-
import {
|
|
5
|
+
import { AuthServiceApi } from "./api";
|
|
6
6
|
import { AuthClientConfig } from "./config";
|
|
7
7
|
import { ExtraVerifiedApiKey } from "./extra/schema";
|
|
8
8
|
const forwardedAuthHeaderNames = [
|
|
@@ -65,7 +65,7 @@ export class AuthService extends Context.Service()("@krak-stack/auth/AuthService
|
|
|
65
65
|
const httpClient = HttpClient.mapRequest(http, (request) => isBetterAuthSessionRequest(request)
|
|
66
66
|
? request
|
|
67
67
|
: HttpClientRequest.bearerToken(request, Redacted.value(config.apiKey)));
|
|
68
|
-
const api = yield* HttpApiClient.makeWith(
|
|
68
|
+
const api = yield* HttpApiClient.makeWith(AuthServiceApi, {
|
|
69
69
|
baseUrl: config.baseUrl,
|
|
70
70
|
httpClient,
|
|
71
71
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@krak-stack/auth",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.42",
|
|
4
4
|
"description": "Effect HttpApi clients and schemas for KrakStack Auth.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -26,22 +26,30 @@
|
|
|
26
26
|
"types": "./dist/schema.d.ts",
|
|
27
27
|
"default": "./dist/schema.js"
|
|
28
28
|
},
|
|
29
|
+
"./query": {
|
|
30
|
+
"types": "./dist/query.d.ts",
|
|
31
|
+
"default": "./dist/query.js"
|
|
32
|
+
},
|
|
29
33
|
"./components": {
|
|
30
34
|
"types": "./dist/components/index.d.ts",
|
|
31
35
|
"default": "./dist/components/index.js"
|
|
32
36
|
},
|
|
33
37
|
"./tailwind.css": "./tailwind.css",
|
|
34
38
|
"./better-auth": {
|
|
35
|
-
"types": "./dist/better-auth/
|
|
36
|
-
"default": "./dist/better-auth/
|
|
39
|
+
"types": "./dist/better-auth/api.group.d.ts",
|
|
40
|
+
"default": "./dist/better-auth/api.group.js"
|
|
37
41
|
},
|
|
38
42
|
"./extra": {
|
|
39
|
-
"types": "./dist/extra/
|
|
40
|
-
"default": "./dist/extra/
|
|
43
|
+
"types": "./dist/extra/api.group.d.ts",
|
|
44
|
+
"default": "./dist/extra/api.group.js"
|
|
41
45
|
},
|
|
42
46
|
"./server": {
|
|
43
47
|
"types": "./dist/server/index.d.ts",
|
|
44
48
|
"default": "./dist/server/index.js"
|
|
49
|
+
},
|
|
50
|
+
"./admin": {
|
|
51
|
+
"types": "./dist/admin/api.group.d.ts",
|
|
52
|
+
"default": "./dist/admin/api.group.js"
|
|
45
53
|
}
|
|
46
54
|
},
|
|
47
55
|
"publishConfig": {
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { HttpApi } from "effect/unstable/httpapi";
|
|
2
|
-
import { HttpApiEndpoint, HttpApiError, HttpApiGroup } from "effect/unstable/httpapi";
|
|
3
|
-
import { TooManyRequests } from "./schema";
|
|
4
|
-
export declare const BetterAuthApiGroup: HttpApiGroup.HttpApiGroup<"auth", HttpApiEndpoint.HttpApiEndpoint<"getSession", "GET", "/get-session", HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").NullOr<import("effect/Schema").Struct<{
|
|
5
|
-
readonly session: import("effect/Schema").Struct<{
|
|
6
|
-
readonly id: import("effect/Schema").String;
|
|
7
|
-
readonly expiresAt: import("effect/Schema").Date;
|
|
8
|
-
readonly token: import("effect/Schema").String;
|
|
9
|
-
readonly createdAt: import("effect/Schema").Date;
|
|
10
|
-
readonly updatedAt: import("effect/Schema").Date;
|
|
11
|
-
readonly ipAddress: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
12
|
-
readonly userAgent: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
13
|
-
readonly userId: import("effect/Schema").String;
|
|
14
|
-
readonly impersonatedBy: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
15
|
-
readonly activeOrganizationId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
16
|
-
}>;
|
|
17
|
-
readonly user: import("effect/Schema").Struct<{
|
|
18
|
-
readonly id: import("effect/Schema").String;
|
|
19
|
-
readonly name: import("effect/Schema").String;
|
|
20
|
-
readonly email: import("effect/Schema").String;
|
|
21
|
-
readonly emailVerified: import("effect/Schema").Boolean;
|
|
22
|
-
readonly image: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
23
|
-
readonly role: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
24
|
-
readonly banned: import("effect/Schema").NullOr<import("effect/Schema").Boolean>;
|
|
25
|
-
readonly lastLoginMethod: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
26
|
-
readonly createdAt: import("effect/Schema").Date;
|
|
27
|
-
readonly updatedAt: import("effect/Schema").Date;
|
|
28
|
-
}>;
|
|
29
|
-
}>>>, HttpApiEndpoint.Json<typeof HttpApiError.BadRequest | typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.NotFound | typeof HttpApiError.InternalServerError | typeof TooManyRequests>, never, never>, false>;
|
|
30
|
-
export declare const BetterAuthApi: HttpApi.HttpApi<"BetterAuthApi", HttpApiGroup.HttpApiGroup<"auth", HttpApiEndpoint.HttpApiEndpoint<"getSession", "GET", "/api/auth/get-session", HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").NullOr<import("effect/Schema").Struct<{
|
|
31
|
-
readonly session: import("effect/Schema").Struct<{
|
|
32
|
-
readonly id: import("effect/Schema").String;
|
|
33
|
-
readonly expiresAt: import("effect/Schema").Date;
|
|
34
|
-
readonly token: import("effect/Schema").String;
|
|
35
|
-
readonly createdAt: import("effect/Schema").Date;
|
|
36
|
-
readonly updatedAt: import("effect/Schema").Date;
|
|
37
|
-
readonly ipAddress: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
38
|
-
readonly userAgent: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
39
|
-
readonly userId: import("effect/Schema").String;
|
|
40
|
-
readonly impersonatedBy: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
41
|
-
readonly activeOrganizationId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
42
|
-
}>;
|
|
43
|
-
readonly user: import("effect/Schema").Struct<{
|
|
44
|
-
readonly id: import("effect/Schema").String;
|
|
45
|
-
readonly name: import("effect/Schema").String;
|
|
46
|
-
readonly email: import("effect/Schema").String;
|
|
47
|
-
readonly emailVerified: import("effect/Schema").Boolean;
|
|
48
|
-
readonly image: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
49
|
-
readonly role: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
50
|
-
readonly banned: import("effect/Schema").NullOr<import("effect/Schema").Boolean>;
|
|
51
|
-
readonly lastLoginMethod: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
52
|
-
readonly createdAt: import("effect/Schema").Date;
|
|
53
|
-
readonly updatedAt: import("effect/Schema").Date;
|
|
54
|
-
}>;
|
|
55
|
-
}>>>, HttpApiEndpoint.Json<typeof HttpApiError.BadRequest | typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.NotFound | typeof HttpApiError.InternalServerError | typeof TooManyRequests>, never, never>, false>>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { FetchHttpClient } from "effect/unstable/http";
|
|
2
|
-
import { AtomHttpApi } from "effect/unstable/reactivity";
|
|
3
|
-
import { defaultBaseUrl } from "../config";
|
|
4
|
-
import { BetterAuthApi } from "./api";
|
|
5
|
-
export class BetterAuthApiClient extends AtomHttpApi.Service()("BetterAuthApiClient", {
|
|
6
|
-
api: BetterAuthApi,
|
|
7
|
-
baseUrl: defaultBaseUrl(),
|
|
8
|
-
httpClient: FetchHttpClient.layer,
|
|
9
|
-
}) {
|
|
10
|
-
}
|
|
11
|
-
export { BetterAuthApi, BetterAuthApiGroup } from "./api";
|
|
12
|
-
export * from "./schema";
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Effect } from "effect";
|
|
2
|
-
import { FetchHttpClient, HttpClient } from "effect/unstable/http";
|
|
3
|
-
import { AtomHttpApi } from "effect/unstable/reactivity";
|
|
4
|
-
import { AuthApi } from "../api";
|
|
5
|
-
const authApiUrl = (baseUrl) => {
|
|
6
|
-
const url = baseUrl?.trim() ||
|
|
7
|
-
(typeof window === "undefined"
|
|
8
|
-
? "http://localhost:3000"
|
|
9
|
-
: window.location.origin);
|
|
10
|
-
return url.replace(/\/$/, "");
|
|
11
|
-
};
|
|
12
|
-
const createAuthApiClient = (key) => AtomHttpApi.Service()(`AuthApi:${key}`, {
|
|
13
|
-
api: AuthApi,
|
|
14
|
-
baseUrl: key,
|
|
15
|
-
httpClient: FetchHttpClient.layer,
|
|
16
|
-
transformClient: (client) => HttpClient.makeWith((request) => client.postprocess(request).pipe(Effect.provideService(FetchHttpClient.RequestInit, {
|
|
17
|
-
credentials: "include",
|
|
18
|
-
})), client.preprocess),
|
|
19
|
-
});
|
|
20
|
-
const authApiClients = new Map();
|
|
21
|
-
export const authApiClient = (baseUrl) => {
|
|
22
|
-
const key = authApiUrl(baseUrl);
|
|
23
|
-
const existing = authApiClients.get(key);
|
|
24
|
-
if (existing)
|
|
25
|
-
return existing;
|
|
26
|
-
const client = createAuthApiClient(key);
|
|
27
|
-
authApiClients.set(key, client);
|
|
28
|
-
return client;
|
|
29
|
-
};
|