@krak-stack/auth 0.2.16 → 0.2.18

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 (44) hide show
  1. package/README.md +34 -0
  2. package/dist/admin/api.group.d.ts +1 -1
  3. package/dist/admin/api.group.js +1 -1
  4. package/dist/api.d.ts +933 -933
  5. package/dist/api.js +1 -1
  6. package/dist/auth/api.group.d.ts +1 -1
  7. package/dist/auth/api.group.js +1 -1
  8. package/dist/auth/schema.d.ts +1 -0
  9. package/dist/auth/schema.js +12 -1
  10. package/dist/components/admin-organization-form.js +1 -1
  11. package/dist/components/admin-organizations.js +1 -1
  12. package/dist/components/admin-users.js +1 -1
  13. package/dist/components/associated-projects-notice.js +1 -1
  14. package/dist/components/auth-atoms.d.ts +1 -1
  15. package/dist/components/auth-atoms.js +1 -1
  16. package/dist/components/auth-client-api.d.ts +99 -99
  17. package/dist/components/auth-client-api.js +3 -3
  18. package/dist/components/auth-forms.d.ts +9 -1
  19. package/dist/components/auth-forms.js +56 -33
  20. package/dist/components/auth-provider.d.ts +1 -1
  21. package/dist/components/auth-provider.js +2 -2
  22. package/dist/components/member-required.js +1 -1
  23. package/dist/components/organization-switcher.js +1 -1
  24. package/dist/components/user-button.js +1 -1
  25. package/dist/config.js +2 -2
  26. package/dist/extra/api.group.d.ts +3 -3
  27. package/dist/extra/api.group.js +2 -2
  28. package/dist/extra/schema.d.ts +2 -2
  29. package/dist/extra/schema.js +2 -2
  30. package/dist/query.js +2 -2
  31. package/dist/server/actor.d.ts +1 -1
  32. package/dist/server/actor.js +1 -1
  33. package/dist/server/api.group.d.ts +1 -1
  34. package/dist/server/api.group.js +2 -2
  35. package/dist/server/middleware.d.ts +2 -2
  36. package/dist/server/middleware.js +2 -2
  37. package/dist/server/proxy.d.ts +2 -2
  38. package/dist/server/proxy.js +1 -1
  39. package/dist/service.d.ts +141 -141
  40. package/dist/service.js +3 -3
  41. package/package.json +6 -5
  42. package/patches/@lucas-barake%2Feffect-form-react@0.26.0-beta.5.patch +66 -0
  43. package/patches/@lucas-barake%2Feffect-form@0.25.0-beta.6.patch +86 -0
  44. package/patches/README.md +31 -0
@@ -1,7 +1,7 @@
1
1
  import { Effect } from "effect";
2
- import { FetchHttpClient, HttpClient, HttpClientRequest, } from "effect/unstable/http";
3
- import { AtomHttpApi } from "effect/unstable/reactivity";
4
- import { HttpApi, HttpApiClient } from "effect/unstable/httpapi";
2
+ import { FetchHttpClient, HttpClient, HttpClientRequest } from "effect/http";
3
+ import { AtomHttpApi } from "effect/reactivity";
4
+ import { HttpApi, HttpApiClient } from "effect/http-api";
5
5
  import { AuthClientApi } from "../api.js";
6
6
  import { defaultBaseUrl } from "../config.js";
7
7
  const authClientApiUrl = (baseUrl) => {
@@ -1,8 +1,9 @@
1
- import { useNavigate } from "@tanstack/react-router";
1
+ import { useNavigate, useRouter } from "@tanstack/react-router";
2
2
  import { type KrakstackAuthLocale } from "./auth-provider.js";
3
3
  type AuthFormProps = {
4
4
  baseUrl?: string | undefined;
5
5
  locale?: KrakstackAuthLocale | undefined;
6
+ defaultRedirectTo?: string | undefined;
6
7
  };
7
8
  type AuthMethod = "password" | "emailOtp";
8
9
  export declare const resolveInitialAuthMethod: ({ requestedMethod, lastLoginMethod, emailPassword, emailOtp, }: {
@@ -16,5 +17,12 @@ export declare function VerifyEmail(props: AuthFormProps): import("react").JSX.E
16
17
  export declare function ForgotPassword(props: AuthFormProps): import("react").JSX.Element;
17
18
  export declare function ResetPassword(props: AuthFormProps): import("react").JSX.Element;
18
19
  export declare function TwoFactor(props: AuthFormProps): import("react").JSX.Element;
20
+ export declare const getRedirectTarget: (searchString: string, defaultRedirectTo?: string) => string;
21
+ export declare const getSocialRedirectTarget: (searchString: string, defaultRedirectTo?: string, origin?: string) => string;
22
+ export declare const getSocialSignInDestinations: (router: ReturnType<typeof useRouter>, defaultRedirectTo: string | undefined, browserHref: string) => {
23
+ callbackURL: string;
24
+ errorCallbackURL: string;
25
+ oauthQuery: string | null;
26
+ };
19
27
  export declare const navigateTarget: (target: string, navigate: ReturnType<typeof useNavigate>) => Promise<void> | undefined;
20
28
  export {};
@@ -1,10 +1,10 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useAtomSet, useAtomSuspense, useAtomValue } from "@effect/atom-react";
3
3
  import { FormBuilder, FormReact } from "@lucas-barake/effect-form-react";
4
- import { Link, useNavigate, useRouterState } from "@tanstack/react-router";
4
+ import { Link, useNavigate, useRouter, useRouterState, } from "@tanstack/react-router";
5
5
  import { Effect, Option, Schema } from "effect";
6
- import { Atom, AsyncResult } from "effect/unstable/reactivity";
7
- import { HttpClientError } from "effect/unstable/http";
6
+ import { Atom, AsyncResult } from "effect/reactivity";
7
+ import { HttpClientError } from "effect/http";
8
8
  import { REGEXP_ONLY_DIGITS } from "input-otp";
9
9
  import { KeyRound, Loader2, Mail } from "lucide-react";
10
10
  import { useEffect, useRef, useState } from "react";
@@ -18,7 +18,7 @@ import { authClientApi, authHttpClient } from "./auth-client-api.js";
18
18
  import { useKrakstackAuth } from "./auth-provider.js";
19
19
  import { cn } from "./utils.js";
20
20
  import { ExtraProjectPublicConfig as ExtraProjectPublicConfigSchema, } from "../extra/schema.js";
21
- import { AuthBadRequest, AuthInternalServerError, AuthTooManyRequests, AuthUnauthorized, } from "../auth/schema.js";
21
+ import { AuthBadRequest, AuthInternalServerError, AuthTooManyRequests, AuthUnauthorized, AuthRedirectURLFromString, } from "../auth/schema.js";
22
22
  const EMAIL_OTP_RESEND_COOLDOWN_SECONDS = 60;
23
23
  const signinFormBuilder = FormBuilder.empty
24
24
  .addField("email", Schema.String)
@@ -257,13 +257,13 @@ export const resolveInitialAuthMethod = ({ requestedMethod, lastLoginMethod, ema
257
257
  };
258
258
  export function Signin(props) {
259
259
  const { baseUrl, locale, labels: m, projectConfig: providedProjectConfig, } = useAuthFormOptions(props);
260
+ const router = useRouter();
260
261
  const navigate = useNavigate();
261
262
  const searchString = useRouterState({
262
263
  select: (state) => state.location.searchStr,
263
264
  });
264
265
  const projectConfig = useAuthProjectConfig(baseUrl, searchString, providedProjectConfig);
265
- const redirectTarget = getRedirectTarget(searchString, projectConfig?.authDomain, projectConfig?.rootDomain);
266
- const socialRedirectTarget = getSocialRedirectTarget(searchString, projectConfig?.authDomain, projectConfig?.rootDomain);
266
+ const redirectTarget = getRedirectTarget(searchString, props.defaultRedirectTo);
267
267
  const initialEmail = getSearchParam(searchString, "email")?.trim() ?? "";
268
268
  const oauthQuery = getOAuthQuery(searchString);
269
269
  const authOptions = projectConfig?.authOptions;
@@ -385,19 +385,19 @@ export function Signin(props) {
385
385
  }));
386
386
  const submit = useAtomSet(form.submit);
387
387
  const submitResult = useAtomValue(form.submit);
388
- const [socialSignIn] = useState(() => authClientApi(baseUrl).runtime.fn((provider) => Effect.gen(function* () {
389
- const payload = oauthQuery
388
+ const [socialSignIn] = useState(() => authClientApi(baseUrl).runtime.fn((input) => Effect.gen(function* () {
389
+ const payload = input.oauthQuery
390
390
  ? {
391
- provider,
392
- callbackURL: socialRedirectTarget,
393
- errorCallbackURL: "/sign-in",
394
- additionalData: { query: oauthQuery },
395
- oauth_query: oauthQuery,
391
+ provider: "google",
392
+ callbackURL: input.callbackURL,
393
+ errorCallbackURL: input.errorCallbackURL,
394
+ additionalData: { query: input.oauthQuery },
395
+ oauth_query: input.oauthQuery,
396
396
  }
397
397
  : {
398
- provider,
399
- callbackURL: socialRedirectTarget,
400
- errorCallbackURL: "/sign-in",
398
+ provider: "google",
399
+ callbackURL: input.callbackURL,
400
+ errorCallbackURL: input.errorCallbackURL,
401
401
  };
402
402
  const result = yield* authHttpClient(baseUrl, locale).pipe(Effect.flatMap((client) => client.auth.signInSocial({ payload })));
403
403
  notifyAuthChange();
@@ -452,7 +452,7 @@ export function Signin(props) {
452
452
  setErrorContext("sendEmailOtp");
453
453
  submit({ type: "sendEmailOtp" });
454
454
  };
455
- const signInWithGoogle = () => startSocialSignIn("google");
455
+ const signInWithGoogle = () => startSocialSignIn(getSocialSignInDestinations(router, props.defaultRedirectTo, window.location.href));
456
456
  return (_jsxs(Card, { className: "w-full max-w-md", children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { className: "text-3xl", children: m.auth_sign_in }), _jsx(CardDescription, { children: !emailSubmitted ? (m.sign_in_description) : (_jsxs(_Fragment, { children: [text(m.sign_in_email_as, { email: formValues.email }), " ", _jsx(Button, { type: "button", variant: "link", className: "h-auto px-0", onClick: resetEmailStep, children: m.sign_in_change_email })] })) })] }), _jsxs(CardContent, { children: [hasPrimaryAuth ? (_jsx(form.Initialize, { defaultValues: { email: initialEmail, password: "", otp: "" }, children: _jsxs("form", { className: "flex flex-col gap-4", onSubmit: (event) => {
457
457
  event.preventDefault();
458
458
  event.stopPropagation();
@@ -498,13 +498,12 @@ export function Signin(props) {
498
498
  : m.auth_sign_in] }) })] }) })) : null, options.google && !emailSubmitted ? (_jsxs("div", { className: "mt-4 flex flex-col gap-3", children: [hasPrimaryAuth ? (_jsx(Divider, { label: m.auth_or_continue_with })) : null, _jsxs(Button, { type: "button", variant: "outline", className: "w-full", disabled: submitResult.waiting, onClick: signInWithGoogle, children: [_jsx(GoogleLogo, {}), m.auth_continue_with_google] }), _jsx(AuthSubmitError, { result: socialSignInResult, labels: m, messages: { fallback: m.sign_in_error } })] })) : null, !hasPrimaryAuth && !options.google ? (_jsx("p", { className: "text-muted-foreground text-sm", children: m.oauth_client_no_auth_methods })) : null] })] }));
499
499
  }
500
500
  export function VerifyEmail(props) {
501
- const { baseUrl, locale, labels: m, projectConfig: providedProjectConfig, } = useAuthFormOptions(props);
501
+ const { baseUrl, locale, labels: m } = useAuthFormOptions(props);
502
502
  const navigate = useNavigate();
503
503
  const searchString = useRouterState({
504
504
  select: (state) => state.location.searchStr,
505
505
  });
506
- const projectConfig = useAuthProjectConfig(baseUrl, searchString, providedProjectConfig);
507
- const redirectTarget = getRedirectTarget(searchString, projectConfig?.authDomain, projectConfig?.rootDomain);
506
+ const redirectTarget = getRedirectTarget(searchString, props.defaultRedirectTo);
508
507
  const onNavigate = (target) => navigateTarget(target, navigate);
509
508
  const [resent, setResent] = useState(false);
510
509
  const [lastAction, setLastAction] = useState("verify");
@@ -620,13 +619,12 @@ function ResetPasswordForm({ token, ...props }) {
620
619
  }, children: [_jsx(form.password, { label: m.reset_password_new_password, type: "password", autoComplete: "new-password", minLength: 8, required: true }), _jsx(AuthSubmitError, { result: submitResult, labels: m, messages: { fallback: m.reset_password_error } }), _jsxs(Button, { type: "submit", disabled: submitResult.waiting, children: [submitResult.waiting ? (_jsx(Loader2, { className: "animate-spin", "data-icon": "inline-start" })) : null, effectFormMessages().submit] })] }) }) })] }));
621
620
  }
622
621
  export function TwoFactor(props) {
623
- const { baseUrl, locale, labels: m, projectConfig: providedProjectConfig, } = useAuthFormOptions(props);
622
+ const { baseUrl, locale, labels: m } = useAuthFormOptions(props);
624
623
  const navigate = useNavigate();
625
624
  const searchString = useRouterState({
626
625
  select: (state) => state.location.searchStr,
627
626
  });
628
- const projectConfig = useAuthProjectConfig(baseUrl, searchString, providedProjectConfig);
629
- const redirectTarget = getRedirectTarget(searchString, projectConfig?.authDomain, projectConfig?.rootDomain);
627
+ const redirectTarget = getRedirectTarget(searchString, props.defaultRedirectTo);
630
628
  const oauthQuery = getOAuthQuery(searchString);
631
629
  const onNavigate = (target) => navigateTarget(target, navigate);
632
630
  const [mode, setMode] = useState("totp");
@@ -713,18 +711,46 @@ const TwoFactorRedirect = Schema.Struct({ twoFactorRedirect: Schema.Boolean });
713
711
  const RedirectResult = Schema.Struct({ url: Schema.String });
714
712
  const hasTwoFactorRedirect = (data) => Option.exists(Schema.decodeUnknownOption(TwoFactorRedirect)(data), (result) => result.twoFactorRedirect);
715
713
  const getResultRedirectUrl = (data) => Option.map(Schema.decodeUnknownOption(RedirectResult)(data), (result) => result.url).pipe(Option.getOrNull);
716
- const getRedirectTarget = (searchString, projectAuthDomain, projectRootDomain) => {
714
+ export const getRedirectTarget = (searchString, defaultRedirectTo = "/") => {
717
715
  const oauthTarget = getOAuthAuthorizeTarget(searchString);
718
716
  if (oauthTarget)
719
717
  return oauthTarget;
720
- return (getAuthRedirectParam(searchString) ??
721
- getDefaultAuthRedirectTarget(projectAuthDomain, projectRootDomain));
718
+ const decode = Schema.decodeUnknownOption(AuthRedirectURLFromString());
719
+ const target = getAuthRedirectParam(searchString);
720
+ if (target && Option.isSome(decode(target)))
721
+ return target;
722
+ return Option.isSome(decode(defaultRedirectTo)) ? defaultRedirectTo : "/";
722
723
  };
723
- const getSocialRedirectTarget = (searchString, projectAuthDomain, projectRootDomain) => {
724
+ export const getSocialRedirectTarget = (searchString, defaultRedirectTo = "/", origin = globalThis.window?.location.origin) => {
724
725
  const oauthTarget = getOAuthAuthorizeTargetWithoutPromptLogin(searchString);
725
- if (oauthTarget)
726
- return oauthTarget;
727
- return getRedirectTarget(searchString, projectAuthDomain, projectRootDomain);
726
+ const target = oauthTarget ?? getRedirectTarget(searchString, defaultRedirectTo);
727
+ // A relative callback is otherwise resolved against the auth backend, which
728
+ // may be a different origin from the site displaying the sign-in form.
729
+ if (!origin)
730
+ return target;
731
+ return Schema.decodeUnknownOption(AuthRedirectURLFromString(origin))(target).pipe(Option.map((url) => url.href), Option.getOrElse(() => origin));
732
+ };
733
+ export const getSocialSignInDestinations = (router, defaultRedirectTo = "/", browserHref) => {
734
+ const browserURL = Schema.decodeUnknownSync(AuthRedirectURLFromString())(browserHref);
735
+ const searchString = router.state.location.searchStr;
736
+ const defaultTarget = getRedirectTarget("", defaultRedirectTo);
737
+ const defaultURL = Schema.decodeUnknownSync(AuthRedirectURLFromString(browserURL.origin))(defaultTarget);
738
+ const defaultHref = Option.isSome(Schema.decodeUnknownOption(Schema.URLFromString)(defaultTarget))
739
+ ? defaultTarget
740
+ : router.buildLocation({
741
+ to: defaultURL.pathname,
742
+ search: Object.fromEntries(defaultURL.searchParams),
743
+ hash: defaultURL.hash.slice(1),
744
+ }).publicHref;
745
+ // Resolve at click time so router rewrites use the current locale. Error
746
+ // callbacks return to the actual browser-facing sign-in route, not a guessed
747
+ // locale-prefixed path.
748
+ browserURL.searchParams.delete("error");
749
+ return {
750
+ callbackURL: getSocialRedirectTarget(searchString, defaultHref, browserURL.origin),
751
+ errorCallbackURL: browserURL.href,
752
+ oauthQuery: getOAuthQuery(searchString),
753
+ };
728
754
  };
729
755
  const getOAuthAuthorizeTarget = (searchString) => {
730
756
  if (!searchString)
@@ -774,9 +800,6 @@ const getAuthRedirectParam = (searchString) => {
774
800
  search.get("redirectTo") ??
775
801
  search.get("returnTo"));
776
802
  };
777
- const getDefaultAuthRedirectTarget = (_projectAuthDomain, _projectRootDomain) => {
778
- return "/admin";
779
- };
780
803
  const getSearchParam = (searchString, key) => new URLSearchParams(searchString).get(key);
781
804
  const getBrowserAuthHost = () => globalThis.window?.location.host ?? null;
782
805
  export const navigateTarget = (target, navigate) => {
@@ -1,5 +1,5 @@
1
1
  import { Cause, Schema } from "effect";
2
- import { AsyncResult } from "effect/unstable/reactivity";
2
+ import { AsyncResult } from "effect/reactivity";
3
3
  import { type ReactNode } from "react";
4
4
  import type { ExtraProjectPublicConfig } from "../extra/schema.js";
5
5
  import type { ProjectAccessCatalog, ProjectAccessLabelCatalog } from "../access.js";
@@ -2,8 +2,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useAtomValue } from "@effect/atom-react";
3
3
  import { useRouterState } from "@tanstack/react-router";
4
4
  import { Cause, Option, Schema } from "effect";
5
- import { HttpApiError } from "effect/unstable/httpapi";
6
- import { AsyncResult, Atom } from "effect/unstable/reactivity";
5
+ import { HttpApiError } from "effect/http-api";
6
+ import { AsyncResult, Atom } from "effect/reactivity";
7
7
  import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider";
8
8
  import { createContext, useContext, useEffect, useMemo, useRef, } from "react";
9
9
  import { activeAuthOrganizationAtom, authSessionAtom } from "./auth-atoms.js";
@@ -1,7 +1,7 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useAtomSet, useAtomSuspense } from "@effect/atom-react";
3
3
  import { Effect, Schema } from "effect";
4
- import { Atom } from "effect/unstable/reactivity";
4
+ import { Atom } from "effect/reactivity";
5
5
  import { Check, Loader2, Mail, ShieldAlert } from "lucide-react";
6
6
  import { useState } from "react";
7
7
  import { Button } from "@/components/ui/button";
@@ -2,7 +2,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
2
2
  import { useAtomRefresh, useAtomSet, useAtomValue } from "@effect/atom-react";
3
3
  import { FormBuilder, FormReact } from "@lucas-barake/effect-form-react";
4
4
  import { Effect, Option, Predicate, Schema } from "effect";
5
- import { AsyncResult, Atom } from "effect/unstable/reactivity";
5
+ import { AsyncResult, Atom } from "effect/reactivity";
6
6
  import { ArrowLeft, Building2, Check, ChevronsUpDown, Copy, KeyRound, LogOut, Mail, PencilIcon, Plus, Trash2, UserIcon, UserPlus, Users, X, } from "lucide-react";
7
7
  import { createContext, useContext, useEffect, useRef, useState, } from "react";
8
8
  import { DataTable, DataTableListSummary, DataTableListCell, } from "@krak-stack/registry/data-table";
@@ -3,7 +3,7 @@ import { RegistryContext, useAtomRefresh, useAtomSet, useAtomValue, } from "@eff
3
3
  import { FormBuilder, FormReact } from "@lucas-barake/effect-form-react";
4
4
  import { useNavigate, useRouterState, } from "@tanstack/react-router";
5
5
  import { Effect, Option, Predicate, Schema } from "effect";
6
- import { AsyncResult, Atom, AtomRegistry } from "effect/unstable/reactivity";
6
+ import { AsyncResult, Atom, AtomRegistry } from "effect/reactivity";
7
7
  import { ArrowLeft, Building2, KeyRound, Loader2, LogOutIcon, Mail, Pencil, Plus, ShieldCheck, StopCircle, Trash2, UserCircleIcon, Users, UserIcon, } from "lucide-react";
8
8
  import { QRCode } from "react-qr-code";
9
9
  import { createContext, useContext, useRef, useEffect, useState, } from "react";
package/dist/config.js CHANGED
@@ -10,9 +10,9 @@ export class AuthClientConfig extends Context.Service()("@krak-stack/auth/AuthCl
10
10
  make: (options = {}) => Effect.gen(function* () {
11
11
  const baseUrl = options.baseUrl ??
12
12
  process.env.KRAKSTACK_AUTH_URL ??
13
- (yield* Config.string("VITE_KRAKSTACK_AUTH_URL"));
13
+ (yield* Config.String("VITE_KRAKSTACK_AUTH_URL"));
14
14
  const apiKey = options.apiKey ??
15
- (yield* Config.redacted("KRAKSTACK_AUTH_SERVICE_API_KEY"));
15
+ (yield* Config.Redacted("KRAKSTACK_AUTH_SERVICE_API_KEY"));
16
16
  return {
17
17
  baseUrl: normalizeBaseUrl(baseUrl),
18
18
  apiKey,
@@ -1,5 +1,5 @@
1
1
  import { Schema } from "effect";
2
- import { HttpApiEndpoint, HttpApiError, HttpApiGroup } from "effect/unstable/httpapi";
2
+ import { HttpApiEndpoint, HttpApiError, HttpApiGroup } from "effect/http-api";
3
3
  import { ExtraBadRequest } from "./schema.js";
4
4
  export * from "./schema.js";
5
5
  export type { Organization, OrganizationMetadata } from "../schema.js";
@@ -101,8 +101,8 @@ export declare const ExtraApiGroup: HttpApiGroup.HttpApiGroup<"authExtra", HttpA
101
101
  readonly referrers: Schema.optional<Schema.$Array<Schema.String>>;
102
102
  }>>, never, Schema.toCodecJson<Schema.Struct<{
103
103
  readonly ok: Schema.Boolean;
104
- }>>, Schema.toCodecJson<typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.InternalServerError | typeof ExtraBadRequest>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"uploadUserImage", "POST", "/auth/image/upload", never, never, Schema.toCodecJson<import("effect/unstable/httpapi/HttpApiSchema").asMultipartStream<Schema.Struct<{
105
- readonly file: Schema.decodeTo<import("effect/unstable/http/Multipart").PersistedFileSchema, Schema.$Array<import("effect/unstable/http/Multipart").PersistedFileSchema>, never, never>;
104
+ }>>, Schema.toCodecJson<typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.InternalServerError | typeof ExtraBadRequest>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"uploadUserImage", "POST", "/auth/image/upload", never, never, Schema.toCodecJson<import("effect/http-api/HttpApiSchema").asMultipartStream<Schema.Struct<{
105
+ readonly file: Schema.decodeTo<import("effect/http/Multipart").PersistedFileSchema, Schema.$Array<import("effect/http/Multipart").PersistedFileSchema>, never, never>;
106
106
  }>>>, never, Schema.toCodecJson<Schema.Struct<{
107
107
  readonly url: Schema.String;
108
108
  }>>, Schema.toCodecJson<typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.InternalServerError | typeof ExtraBadRequest>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"verifyApiKey", "POST", "/auth/verify-api-key", never, never, Schema.toCodecJson<Schema.Struct<{
@@ -1,6 +1,6 @@
1
1
  import { Schema } from "effect";
2
- import { OpenApi } from "effect/unstable/httpapi";
3
- import { HttpApiEndpoint, HttpApiError, HttpApiGroup, } from "effect/unstable/httpapi";
2
+ import { OpenApi } from "effect/http-api";
3
+ import { HttpApiEndpoint, HttpApiError, HttpApiGroup } from "effect/http-api";
4
4
  import { ExtraBadRequest, ExtraAssociatedProjects, ExtraAssociatedProjectsQuery, ExtraCreateApiKeyPayload, ExtraCreateApiKeyResponse, ExtraImageUploadMultipartPayload, ExtraOkResponse, ExtraOrganizationPublicProfile, ExtraOrganizationPublicProfileQuery, ExtraProjectPublicConfig, ExtraProjectPublicConfigQuery, ExtraSetPasswordPayload, ExtraUpdateApiKeyPayload, ExtraUploadedAsset, ExtraVerifyApiKeyPayload, ExtraVerifyApiKeyResponse, ExtraVerifyPasswordPayload, } from "./schema.js";
5
5
  export * from "./schema.js";
6
6
  export const ExtraApiGroup = HttpApiGroup.make("authExtra")
@@ -1,6 +1,6 @@
1
1
  import { Schema } from "effect";
2
- import { Multipart } from "effect/unstable/http";
3
- import { HttpApiSchema } from "effect/unstable/httpapi";
2
+ import { Multipart } from "effect/http";
3
+ import { HttpApiSchema } from "effect/http-api";
4
4
  export declare const ExtraImageUploadPayload: Schema.Struct<{
5
5
  readonly file: Schema.decodeTo<Multipart.PersistedFileSchema, Schema.$Array<Multipart.PersistedFileSchema>, never, never>;
6
6
  }>;
@@ -1,6 +1,6 @@
1
1
  import { Schema } from "effect";
2
- import { Multipart } from "effect/unstable/http";
3
- import { HttpApiSchema } from "effect/unstable/httpapi";
2
+ import { Multipart } from "effect/http";
3
+ import { HttpApiSchema } from "effect/http-api";
4
4
  import { OrganizationEmail, OrganizationLocale, OrganizationPhone, OrganizationSocial, OrganizationWebsite, FormattedOrganizationAddress, } from "../schema.js";
5
5
  export const ExtraImageUploadPayload = Schema.Struct({
6
6
  file: Multipart.SingleFileSchema,
package/dist/query.js CHANGED
@@ -24,7 +24,7 @@ export const SortParam = Schema.Struct({
24
24
  description: "Decoded sort parameter with a field id and direction.",
25
25
  examples: [{ id: "name", direction: "asc" }],
26
26
  });
27
- export const SortParamFromString = Schema.String.pipe(Schema.decodeTo(SortParam, SchemaTransformation.transformOrFail({
27
+ export const SortParamFromString = Schema.String.pipe(Schema.decodeTo(SortParam, SchemaTransformation.transformEffect({
28
28
  decode: (sort) => {
29
29
  const sortParam = parseSortParam(sort);
30
30
  if (!sortParam) {
@@ -41,7 +41,7 @@ export const SortParamFromString = Schema.String.pipe(Schema.decodeTo(SortParam,
41
41
  description: 'URL encoded single sort parameter where descending fields are prefixed with "-".',
42
42
  examples: [{ id: "name", direction: "asc" }],
43
43
  }));
44
- export const SortParamsFromString = Schema.String.pipe(Schema.decodeTo(Schema.Array(SortParam), SchemaTransformation.transformOrFail({
44
+ export const SortParamsFromString = Schema.String.pipe(Schema.decodeTo(Schema.Array(SortParam), SchemaTransformation.transformEffect({
45
45
  decode: (sort) => {
46
46
  const parts = sort.split(",");
47
47
  const sortParams = [];
@@ -1,5 +1,5 @@
1
1
  import { Layer } from "effect";
2
- import { HttpApiError, HttpApiMiddleware } from "effect/unstable/httpapi";
2
+ import { HttpApiError, HttpApiMiddleware } from "effect/http-api";
3
3
  import { CurrentActor, type ProjectAccessDefinition } from "../access.js";
4
4
  import { AuthService } from "../service.js";
5
5
  declare const AnyActorRequired_base: HttpApiMiddleware.ServiceClass<AnyActorRequired, "@krak-stack/auth/ActorRequired", {
@@ -1,5 +1,5 @@
1
1
  import { Effect, Layer, Schema } from "effect";
2
- import { HttpApiError, HttpApiMiddleware } from "effect/unstable/httpapi";
2
+ import { HttpApiError, HttpApiMiddleware } from "effect/http-api";
3
3
  import { ApiKeyPermissionGrant, CurrentActor, } from "../access.js";
4
4
  import { parseRoleList } from "../roles.js";
5
5
  import { AuthService } from "../service.js";
@@ -1,4 +1,4 @@
1
- import { HttpApiEndpoint, HttpApiError, HttpApiGroup } from "effect/unstable/httpapi";
1
+ import { HttpApiEndpoint, HttpApiError, HttpApiGroup } from "effect/http-api";
2
2
  export declare const ServerUsersApiGroup: HttpApiGroup.HttpApiGroup<"users", HttpApiEndpoint.HttpApiEndpoint<"getUser", "GET", "/users/:id", import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
3
3
  readonly id: import("effect/Schema").NonEmptyString;
4
4
  }>>, never, never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
@@ -1,5 +1,5 @@
1
- import { OpenApi } from "effect/unstable/httpapi";
2
- import { HttpApiEndpoint, HttpApiError, HttpApiGroup, } from "effect/unstable/httpapi";
1
+ import { OpenApi } from "effect/http-api";
2
+ import { HttpApiEndpoint, HttpApiError, HttpApiGroup } from "effect/http-api";
3
3
  import { Member, Organization, User } from "../schema.js";
4
4
  import { ServerActiveOrganization, ServerCreateDomainPayload, ServerDomain, ServerDomainHostParams, ServerDomainIdParams, ServerDomainRecordsResponse, ServerIdParams, ServerIdsQuery, ServerMemberParams, ServerMembersResponse, ServerOrganizationChildrenResponse, ServerOrganizationIdParams, ServerOrganizationsQuery, ServerOrganizationsResponse, ServerUserIdParams, ServerUsersResponse, } from "./schema.js";
5
5
  export const ServerUsersApiGroup = HttpApiGroup.make("users")
@@ -1,6 +1,6 @@
1
1
  import { Layer } from "effect";
2
- import { HttpServerRequest } from "effect/unstable/http";
3
- import { HttpApiError, HttpApiMiddleware, HttpApiSecurity } from "effect/unstable/httpapi";
2
+ import { HttpServerRequest } from "effect/http";
3
+ import { HttpApiError, HttpApiMiddleware, HttpApiSecurity } from "effect/http-api";
4
4
  import { AuthService, type AuthServiceLayerOptions } from "../service.js";
5
5
  export declare const ApiKeySecurity: HttpApiSecurity.ApiKey;
6
6
  declare const AuthMiddleware_base: HttpApiMiddleware.ServiceClass<AuthMiddleware, "@krak-stack/auth/AuthMiddleware", {
@@ -1,6 +1,6 @@
1
1
  import { Cause, Effect, Layer, Redacted } from "effect";
2
- import { HttpServerRequest } from "effect/unstable/http";
3
- import { HttpApiError, HttpApiMiddleware, HttpApiSecurity, } from "effect/unstable/httpapi";
2
+ import { HttpServerRequest } from "effect/http";
3
+ import { HttpApiError, HttpApiMiddleware, HttpApiSecurity, } from "effect/http-api";
4
4
  import { AuthService } from "../service.js";
5
5
  export const ApiKeySecurity = HttpApiSecurity.apiKey({
6
6
  key: "x-api-key",
@@ -1,5 +1,5 @@
1
1
  import { Effect, type Redacted } from "effect";
2
- import { HttpClient, HttpServerRequest, HttpServerResponse } from "effect/unstable/http";
2
+ import { HttpClient, HttpServerRequest, HttpServerResponse } from "effect/http";
3
3
  import { AuthProxyError } from "./proxy-origin.js";
4
4
  export interface ProxyAuthRequestOptions {
5
5
  cookieDomain?: string;
@@ -7,4 +7,4 @@ export interface ProxyAuthRequestOptions {
7
7
  }
8
8
  export declare const proxyAuthRequest: (request: Request, baseUrl: string | URL, options?: ProxyAuthRequestOptions) => Promise<Response>;
9
9
  export declare const proxyAuthRequestEffect: (request: Request, baseUrl: string | URL, options?: ProxyAuthRequestOptions) => Effect.Effect<HttpServerResponse.HttpServerResponse, AuthProxyError, HttpClient.HttpClient>;
10
- export declare const proxyAuthHttpEffect: (baseUrl: string | URL, options?: ProxyAuthRequestOptions) => Effect.Effect<HttpServerResponse.HttpServerResponse, AuthProxyError | import("effect/unstable/http/HttpServerError").RequestError, HttpClient.HttpClient | HttpServerRequest.HttpServerRequest>;
10
+ export declare const proxyAuthHttpEffect: (baseUrl: string | URL, options?: ProxyAuthRequestOptions) => Effect.Effect<HttpServerResponse.HttpServerResponse, AuthProxyError | import("effect/http/HttpServerError").RequestError, HttpClient.HttpClient | HttpServerRequest.HttpServerRequest>;
@@ -1,5 +1,5 @@
1
1
  import { Effect } from "effect";
2
- import { Cookies, FetchHttpClient, Headers as HttpHeaders, HttpClient, HttpClientRequest, HttpServerRequest, HttpServerResponse, } from "effect/unstable/http";
2
+ import { Cookies, FetchHttpClient, Headers as HttpHeaders, HttpClient, HttpClientRequest, HttpServerRequest, HttpServerResponse, } from "effect/http";
3
3
  import { AuthProxyError, authProxyKeyHeader, proxyOriginHeaders, } from "./proxy-origin.js";
4
4
  const blockedRequestHeaders = [
5
5
  "accept-encoding",