@krak-stack/auth 0.1.39 → 0.1.41

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 (40) hide show
  1. package/dist/admin/api.d.ts +196 -0
  2. package/dist/admin/api.js +158 -0
  3. package/dist/admin/index.d.ts +2 -0
  4. package/dist/admin/index.js +2 -0
  5. package/dist/admin/schema.d.ts +128 -0
  6. package/dist/admin/schema.js +190 -0
  7. package/dist/api.d.ts +278 -1
  8. package/dist/api.js +11 -2
  9. package/dist/components/admin-organization-form.d.ts +6 -0
  10. package/dist/components/admin-organization-form.js +126 -0
  11. package/dist/components/admin-organizations.d.ts +7 -0
  12. package/dist/components/admin-organizations.js +122 -0
  13. package/dist/components/admin-users.d.ts +8 -0
  14. package/dist/components/admin-users.js +282 -0
  15. package/dist/components/{auth-api-client.d.ts → auth-client-api.d.ts} +186 -196
  16. package/dist/components/auth-client-api.js +29 -0
  17. package/dist/components/auth-client.d.ts +2 -1
  18. package/dist/components/auth-forms.js +3 -3
  19. package/dist/components/auth-provider.d.ts +16 -15
  20. package/dist/components/auth-provider.js +30 -5
  21. package/dist/components/index.d.ts +3 -0
  22. package/dist/components/index.js +3 -0
  23. package/dist/components/organization-switcher.js +4 -5
  24. package/dist/components/user-button.d.ts +11 -1
  25. package/dist/components/user-button.js +57 -6
  26. package/dist/components/utils.d.ts +11 -0
  27. package/dist/components/utils.js +24 -0
  28. package/dist/index.d.ts +4 -2
  29. package/dist/index.js +4 -2
  30. package/dist/query.d.ts +49 -0
  31. package/dist/query.js +114 -0
  32. package/dist/server/api.d.ts +32 -0
  33. package/dist/server/index.d.ts +2 -2
  34. package/dist/server/index.js +2 -1
  35. package/dist/server/schema.d.ts +4 -0
  36. package/dist/server/schema.js +8 -0
  37. package/dist/service.d.ts +462 -434
  38. package/dist/service.js +2 -2
  39. package/package.json +9 -1
  40. package/dist/components/auth-api-client.js +0 -29
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 { AuthApi } from "./api";
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(AuthApi, {
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.39",
3
+ "version": "0.1.41",
4
4
  "description": "Effect HttpApi clients and schemas for KrakStack Auth.",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -26,6 +26,10 @@
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"
@@ -42,6 +46,10 @@
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/index.d.ts",
52
+ "default": "./dist/admin/index.js"
45
53
  }
46
54
  },
47
55
  "publishConfig": {
@@ -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
- };