@krak-stack/auth 0.2.17 → 0.2.19
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/README.md +34 -0
- package/dist/admin/api.group.d.ts +19 -13
- package/dist/admin/api.group.js +1 -1
- package/dist/admin/schema.d.ts +9 -7
- package/dist/admin/schema.js +1 -2
- package/dist/api.d.ts +161 -155
- package/dist/api.js +1 -1
- package/dist/auth/api.group.d.ts +1 -1
- package/dist/auth/api.group.js +1 -1
- package/dist/auth/schema.js +1 -1
- package/dist/components/admin-organization-form.js +1 -1
- package/dist/components/admin-organizations.js +5 -25
- package/dist/components/admin-users.js +5 -25
- package/dist/components/associated-projects-notice.js +1 -1
- package/dist/components/auth-atoms.d.ts +1 -1
- package/dist/components/auth-atoms.js +1 -1
- package/dist/components/auth-client-api.d.ts +117 -111
- package/dist/components/auth-client-api.js +3 -3
- package/dist/components/auth-forms.js +2 -2
- package/dist/components/auth-provider.d.ts +1 -1
- package/dist/components/auth-provider.js +2 -2
- package/dist/components/member-required.js +1 -1
- package/dist/components/organization-switcher.js +1 -1
- package/dist/components/user-button.js +1 -1
- package/dist/config.js +2 -2
- package/dist/extra/api.group.d.ts +3 -3
- package/dist/extra/api.group.js +2 -2
- package/dist/extra/schema.d.ts +2 -2
- package/dist/extra/schema.js +2 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/server/actor.d.ts +1 -1
- package/dist/server/actor.js +1 -1
- package/dist/server/api.group.d.ts +1 -1
- package/dist/server/api.group.js +2 -2
- package/dist/server/middleware.d.ts +2 -2
- package/dist/server/middleware.js +2 -2
- package/dist/server/proxy.d.ts +4 -2
- package/dist/server/proxy.js +12 -3
- package/dist/service.d.ts +141 -141
- package/dist/service.js +3 -3
- package/package.json +7 -11
- package/patches/@lucas-barake%2Feffect-form-react@0.26.0-beta.5.patch +66 -0
- package/patches/@lucas-barake%2Feffect-form@0.25.0-beta.6.patch +86 -0
- package/patches/README.md +31 -0
- package/dist/query.d.ts +0 -49
- package/dist/query.js +0 -114
package/dist/api.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HttpApi, OpenApi } from "effect/
|
|
1
|
+
import { HttpApi, OpenApi } from "effect/http-api";
|
|
2
2
|
import { AdminApiGroup } from "./admin/api.group.js";
|
|
3
3
|
import { AuthApiGroup } from "./auth/api.group.js";
|
|
4
4
|
import { ExtraApiGroup } from "./extra/api.group.js";
|
package/dist/auth/api.group.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
import { HttpApiEndpoint, HttpApiGroup } from "effect/
|
|
2
|
+
import { HttpApiEndpoint, HttpApiGroup } from "effect/http-api";
|
|
3
3
|
import { AuthBadRequest, AuthConflict, AuthExpectationFailed, AuthForbidden, AuthInternalServerError, AuthNotFound, AuthTooManyRequests, AuthUnauthorized } from "./schema.js";
|
|
4
4
|
export * from "./schema.js";
|
|
5
5
|
export declare const AuthApiGroup: HttpApiGroup.HttpApiGroup<"auth", HttpApiEndpoint.HttpApiEndpoint<"adminBanUser", "POST", "/admin/ban-user", never, never, Schema.toCodecJson<Schema.Struct<{
|
package/dist/auth/api.group.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
import { HttpApiEndpoint, HttpApiGroup, OpenApi
|
|
2
|
+
import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/http-api";
|
|
3
3
|
import { AdminBanUserPayload, AdminStopImpersonatingPayload, AdminUserIdPayload, AdminUserResponse, AuthBadRequest, AuthConflict, AuthExpectationFailed, AuthForbidden, AuthInternalServerError, AuthInvitation, AuthNotFound, AuthOrganization, AuthSessionResponse, AuthStatusResponse, AuthSuccessResponse, AuthTooManyRequests, AuthUnauthorized, ChangePasswordPayload, ChangePasswordResponse, CreateOrganizationPayload, DeleteApiKeyPayload, FullAuthOrganization, GetFullOrganizationQuery, GetInvitationQuery, GetInvitationResponse, GetSessionQuery, GetSessionResponse, InvitationActionResponse, InvitationIdPayload, InviteMemberPayload, LeaveOrganizationPayload, LinkedAccount, LinkSocialPayload, ListApiKeysQuery, ListApiKeysResponse, MemberResponse, OAuthConsentPayload, OAuthPublicClient, OAuthPublicClientQuery, OAuthRedirectResponse, OrganizationImpersonateUserPayload, OrganizationImpersonateUserResponse, OrganizationInvitationsQuery, OrganizationListMembersQuery, OrganizationListMembersResponse, RemoveMemberPayload, RequestPasswordResetPayload, RequestPasswordResetResponse, ResetPasswordPayload, SendVerificationOtpPayload, SetActiveOrganizationPayload, SignInEmailOtpPayload, SignInEmailPayload, SignInEmailResponse, SignInResponse, SignInSocialPayload, SignOutPayload, SocialRedirectResponse, TwoFactorBackupVerifyPayload, TwoFactorDisablePayload, TwoFactorEnablePayload, TwoFactorEnableResponse, TwoFactorSendPayload, TwoFactorVerifyPayload, UnlinkAccountPayload, UpdateMemberRolePayload, UpdateOrganizationPayload, UpdateUserPayload, UserInvitationsQuery, VerifyEmailOtpPayload, VerifyEmailOtpResponse, } from "./schema.js";
|
|
4
4
|
export * from "./schema.js";
|
|
5
5
|
const errors = [
|
package/dist/auth/schema.js
CHANGED
|
@@ -6,7 +6,7 @@ export const AuthRedirectURLFromString = (origin = "http://localhost") => Schema
|
|
|
6
6
|
!url.username &&
|
|
7
7
|
!url.password
|
|
8
8
|
? undefined
|
|
9
|
-
: "Expected an HTTP or HTTPS redirect URL without credentials")), SchemaTransformation.
|
|
9
|
+
: "Expected an HTTP or HTTPS redirect URL without credentials")), SchemaTransformation.transformEffect({
|
|
10
10
|
decode: (value) => Effect.try({
|
|
11
11
|
try: () => new URL(value, origin),
|
|
12
12
|
catch: () => new SchemaIssue.InvalidValue({ message: "Invalid authentication redirect URL" }, value),
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useAtomSubscribe, useAtomValue } from "@effect/atom-react";
|
|
3
3
|
import { FormBuilder, FormReact } from "@lucas-barake/effect-form-react";
|
|
4
4
|
import { Effect, Schema } from "effect";
|
|
5
|
-
import { AsyncResult, Atom } from "effect/
|
|
5
|
+
import { AsyncResult, Atom } from "effect/reactivity";
|
|
6
6
|
import { useState } from "react";
|
|
7
7
|
import { ImageField, SingleSearchableSelectField, SubmitButton, SubmitError, TextField, } from "@krak-stack/registry/effect-form";
|
|
8
8
|
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from "@/components/ui/dialog";
|
|
@@ -2,15 +2,16 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useAtomSet, useAtomSubscribe, useAtomValue } from "@effect/atom-react";
|
|
3
3
|
import { useNavigate, useRouter } from "@tanstack/react-router";
|
|
4
4
|
import { Cause, Effect, Schema } from "effect";
|
|
5
|
-
import { Atom, AsyncResult } from "effect/
|
|
5
|
+
import { Atom, AsyncResult } from "effect/reactivity";
|
|
6
6
|
import { Building2, Pencil, Trash2, UserCog } from "lucide-react";
|
|
7
7
|
import { useEffect, useState } from "react";
|
|
8
8
|
import { DataTable, DataTableListSummary, } from "@krak-stack/registry/data-table";
|
|
9
|
-
import { Query
|
|
9
|
+
import { Query } from "@krak-stack/registry/query";
|
|
10
10
|
import { ErrorMessage } from "@krak-stack/registry/effect-form";
|
|
11
11
|
import { AppBrand } from "@krak-stack/registry/app-brand";
|
|
12
12
|
import { Badge } from "@/components/ui/badge";
|
|
13
13
|
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "@/components/ui/alert-dialog";
|
|
14
|
+
import { AdminListQuery } from "../admin/schema.js";
|
|
14
15
|
import { normalizeOrganizationRoles } from "../roles.js";
|
|
15
16
|
import { AdminOrganizationForm } from "./admin-organization-form.js";
|
|
16
17
|
import { authClientApi, authHttpClient } from "./auth-client-api.js";
|
|
@@ -97,31 +98,10 @@ const organizationDisplay = (organization, locale, baseUrl) => {
|
|
|
97
98
|
};
|
|
98
99
|
};
|
|
99
100
|
const AdminOrganizationsFamilyKey = Schema.fromJsonString(Schema.Struct({
|
|
100
|
-
query:
|
|
101
|
-
page: Schema.Number,
|
|
102
|
-
pageSize: Schema.Number,
|
|
103
|
-
globalFilter: Schema.optional(Schema.String),
|
|
104
|
-
sort: Schema.optional(Schema.String),
|
|
105
|
-
projectId: Schema.optional(Schema.String),
|
|
106
|
-
}),
|
|
101
|
+
query: AdminListQuery,
|
|
107
102
|
reloadKey: Schema.Number,
|
|
108
103
|
})).annotate({ identifier: "AdminOrganizationsFamilyKey" });
|
|
109
|
-
const organizationsQuery = (search, projectId) => {
|
|
110
|
-
let query = {
|
|
111
|
-
page: search.page ?? 0,
|
|
112
|
-
pageSize: search.pageSize ?? 10,
|
|
113
|
-
};
|
|
114
|
-
if (search.globalFilter)
|
|
115
|
-
query = { ...query, globalFilter: search.globalFilter };
|
|
116
|
-
if (search.sort)
|
|
117
|
-
query = {
|
|
118
|
-
...query,
|
|
119
|
-
sort: Schema.encodeSync(SortParamsFromString)(search.sort),
|
|
120
|
-
};
|
|
121
|
-
if (projectId)
|
|
122
|
-
query = { ...query, projectId };
|
|
123
|
-
return query;
|
|
124
|
-
};
|
|
104
|
+
const organizationsQuery = (search, projectId) => projectId ? { ...search, projectId } : search;
|
|
125
105
|
const adminOrganizationsFamilyKey = (search, projectId, reloadKey) => JSON.stringify({
|
|
126
106
|
query: organizationsQuery(search, projectId),
|
|
127
107
|
reloadKey,
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useAtomSet, useAtomValue } from "@effect/atom-react";
|
|
3
3
|
import { useNavigate, useRouter } from "@tanstack/react-router";
|
|
4
|
-
import { Atom, AsyncResult } from "effect/
|
|
4
|
+
import { Atom, AsyncResult } from "effect/reactivity";
|
|
5
5
|
import { Effect, Schema } from "effect";
|
|
6
6
|
import { Ban, Loader2, ShieldOff, UserCog, UserIcon } from "lucide-react";
|
|
7
7
|
import { useEffect, useState } from "react";
|
|
8
8
|
import { DataTable, DataTableListSummary, } from "@krak-stack/registry/data-table";
|
|
9
|
-
import { Query
|
|
9
|
+
import { Query } from "@krak-stack/registry/query";
|
|
10
10
|
import { ErrorMessage } from "@krak-stack/registry/effect-form";
|
|
11
11
|
import { AppBrand } from "@krak-stack/registry/app-brand";
|
|
12
12
|
import { Badge } from "@/components/ui/badge";
|
|
13
13
|
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "@/components/ui/alert-dialog";
|
|
14
|
+
import { AdminListQuery } from "../admin/schema.js";
|
|
14
15
|
import { notifyAuthChange } from "./auth-atoms.js";
|
|
15
16
|
import { authClientApi, authHttpClient } from "./auth-client-api.js";
|
|
16
17
|
import { useKrakstackAuth } from "./auth-provider.js";
|
|
@@ -82,31 +83,10 @@ const initials = (name) => name
|
|
|
82
83
|
.toUpperCase();
|
|
83
84
|
const text = (value, params) => Object.entries(params ?? {}).reduce((current, [key, replacement]) => current.replace(`{${key}}`, replacement), value);
|
|
84
85
|
const AdminUsersFamilyKey = Schema.fromJsonString(Schema.Struct({
|
|
85
|
-
query:
|
|
86
|
-
page: Schema.Number,
|
|
87
|
-
pageSize: Schema.Number,
|
|
88
|
-
globalFilter: Schema.optional(Schema.String),
|
|
89
|
-
sort: Schema.optional(Schema.String),
|
|
90
|
-
projectId: Schema.optional(Schema.String),
|
|
91
|
-
}),
|
|
86
|
+
query: AdminListQuery,
|
|
92
87
|
reloadKey: Schema.Number,
|
|
93
88
|
})).annotate({ identifier: "AdminUsersFamilyKey" });
|
|
94
|
-
const adminUsersQuery = (search, projectId) => {
|
|
95
|
-
let query = {
|
|
96
|
-
page: search.page ?? 0,
|
|
97
|
-
pageSize: search.pageSize ?? 10,
|
|
98
|
-
};
|
|
99
|
-
if (search.globalFilter)
|
|
100
|
-
query = { ...query, globalFilter: search.globalFilter };
|
|
101
|
-
if (search.sort)
|
|
102
|
-
query = {
|
|
103
|
-
...query,
|
|
104
|
-
sort: Schema.encodeSync(SortParamsFromString)(search.sort),
|
|
105
|
-
};
|
|
106
|
-
if (projectId)
|
|
107
|
-
query = { ...query, projectId };
|
|
108
|
-
return query;
|
|
109
|
-
};
|
|
89
|
+
const adminUsersQuery = (search, projectId) => projectId ? { ...search, projectId } : search;
|
|
110
90
|
const adminUsersFamilyKey = (search, projectId, reloadKey) => JSON.stringify({ query: adminUsersQuery(search, projectId), reloadKey });
|
|
111
91
|
const usersAtom = Atom.family((baseUrl) => Atom.family((key) => {
|
|
112
92
|
const { query, reloadKey } = Schema.decodeUnknownSync(AdminUsersFamilyKey)(key);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useAtomValue } from "@effect/atom-react";
|
|
3
|
-
import { AsyncResult, Atom } from "effect/
|
|
3
|
+
import { AsyncResult, Atom } from "effect/reactivity";
|
|
4
4
|
import { Badge } from "@/components/ui/badge";
|
|
5
5
|
import { authClientApi } from "./auth-client-api.js";
|
|
6
6
|
const associatedProjectsAtom = Atom.family((baseUrl) => Atom.family((organizationId) => authClientApi(baseUrl).query("authExtra", "listAssociatedProjects", {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AsyncResult, Atom } from "effect/
|
|
1
|
+
import { AsyncResult, Atom } from "effect/reactivity";
|
|
2
2
|
export declare const AUTH_CLIENT_CHANGE_EVENT = "krakstack-auth:change";
|
|
3
3
|
export declare const refreshOnAuthChange: <A>(atom: Atom.Atom<A>) => Atom.Atom<A>;
|
|
4
4
|
export declare const authSessionAtom: (arg: string | undefined) => Atom.Atom<AsyncResult.AsyncResult<{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Option } from "effect";
|
|
2
|
-
import { AsyncResult, Atom } from "effect/
|
|
2
|
+
import { AsyncResult, Atom } from "effect/reactivity";
|
|
3
3
|
import { authClientApi } from "./auth-client-api.js";
|
|
4
4
|
const LAST_LOGIN_METHOD_COOKIE = "krakstack-auth.last_used_login_method";
|
|
5
5
|
export const AUTH_CLIENT_CHANGE_EVENT = "krakstack-auth:change";
|