@krak-stack/auth 0.2.17 → 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 (42) 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 +143 -143
  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.js +1 -1
  9. package/dist/components/admin-organization-form.js +1 -1
  10. package/dist/components/admin-organizations.js +1 -1
  11. package/dist/components/admin-users.js +1 -1
  12. package/dist/components/associated-projects-notice.js +1 -1
  13. package/dist/components/auth-atoms.d.ts +1 -1
  14. package/dist/components/auth-atoms.js +1 -1
  15. package/dist/components/auth-client-api.d.ts +99 -99
  16. package/dist/components/auth-client-api.js +3 -3
  17. package/dist/components/auth-forms.js +2 -2
  18. package/dist/components/auth-provider.d.ts +1 -1
  19. package/dist/components/auth-provider.js +2 -2
  20. package/dist/components/member-required.js +1 -1
  21. package/dist/components/organization-switcher.js +1 -1
  22. package/dist/components/user-button.js +1 -1
  23. package/dist/config.js +2 -2
  24. package/dist/extra/api.group.d.ts +3 -3
  25. package/dist/extra/api.group.js +2 -2
  26. package/dist/extra/schema.d.ts +2 -2
  27. package/dist/extra/schema.js +2 -2
  28. package/dist/query.js +2 -2
  29. package/dist/server/actor.d.ts +1 -1
  30. package/dist/server/actor.js +1 -1
  31. package/dist/server/api.group.d.ts +1 -1
  32. package/dist/server/api.group.js +2 -2
  33. package/dist/server/middleware.d.ts +2 -2
  34. package/dist/server/middleware.js +2 -2
  35. package/dist/server/proxy.d.ts +2 -2
  36. package/dist/server/proxy.js +1 -1
  37. package/dist/service.d.ts +141 -141
  38. package/dist/service.js +3 -3
  39. package/package.json +6 -5
  40. package/patches/@lucas-barake%2Feffect-form-react@0.26.0-beta.5.patch +66 -0
  41. package/patches/@lucas-barake%2Feffect-form@0.25.0-beta.6.patch +86 -0
  42. 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) => {
@@ -3,8 +3,8 @@ import { useAtomSet, useAtomSuspense, useAtomValue } from "@effect/atom-react";
3
3
  import { FormBuilder, FormReact } from "@lucas-barake/effect-form-react";
4
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";
@@ -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",