@krak-stack/auth 0.2.18 → 0.2.20
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 +6 -30
- package/dist/admin/api.group.d.ts +18 -12
- package/dist/admin/schema.d.ts +9 -7
- package/dist/admin/schema.js +1 -2
- package/dist/api.d.ts +18 -12
- package/dist/components/admin-organizations.js +4 -24
- package/dist/components/admin-users.js +4 -24
- package/dist/components/auth-client-api.d.ts +18 -12
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/server/proxy.d.ts +2 -0
- package/dist/server/proxy.js +11 -2
- package/package.json +5 -11
- package/dist/query.d.ts +0 -49
- package/dist/query.js +0 -114
- package/patches/@lucas-barake%2Feffect-form-react@0.26.0-beta.5.patch +0 -66
- package/patches/@lucas-barake%2Feffect-form@0.25.0-beta.6.patch +0 -86
- package/patches/README.md +0 -31
package/README.md
CHANGED
|
@@ -8,37 +8,13 @@ Typed Effect contracts, server authentication middleware, project authorization
|
|
|
8
8
|
bun add @krak-stack/auth effect
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
###
|
|
11
|
+
### Effect forms
|
|
12
12
|
|
|
13
|
-
React
|
|
14
|
-
stable Effect 4
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
mkdir -p patches
|
|
19
|
-
cp node_modules/@krak-stack/auth/patches/*.patch patches/
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
Merge these fields into the application's workspace-root `package.json`,
|
|
23
|
-
preserving existing overrides and patches, then run `bun install`:
|
|
24
|
-
|
|
25
|
-
```json
|
|
26
|
-
{
|
|
27
|
-
"overrides": {
|
|
28
|
-
"@lucas-barake/effect-form": "0.25.0-beta.6",
|
|
29
|
-
"@lucas-barake/effect-form-react": "0.26.0-beta.5"
|
|
30
|
-
},
|
|
31
|
-
"patchedDependencies": {
|
|
32
|
-
"@lucas-barake/effect-form@0.25.0-beta.6": "patches/@lucas-barake%2Feffect-form@0.25.0-beta.6.patch",
|
|
33
|
-
"@lucas-barake/effect-form-react@0.26.0-beta.5": "patches/@lucas-barake%2Feffect-form-react@0.26.0-beta.5.patch"
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
Commit the patches, manifest, and lockfile together. Other package managers need
|
|
39
|
-
equivalent patch configuration. Server-only imports do not load the form
|
|
40
|
-
libraries. See the bundled `patches/README.md` for provenance and cleanup after
|
|
41
|
-
[upstream release PR #111](https://github.com/lucas-barake/effect-form/pull/111).
|
|
13
|
+
React components use `@lucas-barake/effect-form-react@1.1.0`, which supports
|
|
14
|
+
stable Effect 4 without compatibility patches. When upgrading from the patched
|
|
15
|
+
betas, remove their `patchedDependencies` entries and patch files, update any
|
|
16
|
+
direct form dependencies or version overrides to `1.1.0`, and run `bun install`.
|
|
17
|
+
Server-only imports do not load the form libraries.
|
|
42
18
|
|
|
43
19
|
### Entry points
|
|
44
20
|
|
|
@@ -218,13 +218,16 @@ export declare const AdminApiGroup: HttpApiGroup.HttpApiGroup<"admin", HttpApiEn
|
|
|
218
218
|
readonly createdAt: Schema.Date;
|
|
219
219
|
readonly updatedAt: Schema.Date;
|
|
220
220
|
}>>>, Schema.toCodecJson<typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"listOrganizations", "GET", "/admin/organizations", never, Schema.toCodecStringTree<Schema.Struct<{
|
|
221
|
-
readonly page: Schema.Int
|
|
222
|
-
readonly pageSize: Schema.Int
|
|
221
|
+
readonly page: Schema.decodeTo<Schema.Int, Schema.optional<Schema.Union<readonly [Schema.Number, Schema.NumberFromString]>>, never, never>;
|
|
222
|
+
readonly pageSize: Schema.decodeTo<Schema.Int, Schema.optional<Schema.Union<readonly [Schema.Number, Schema.NumberFromString]>>, never, never>;
|
|
223
223
|
readonly globalFilter: Schema.optional<Schema.String>;
|
|
224
|
-
readonly sort: Schema.optional<Schema.
|
|
225
|
-
readonly id:
|
|
226
|
-
readonly direction:
|
|
227
|
-
}
|
|
224
|
+
readonly sort: Schema.optional<Schema.declare<readonly {
|
|
225
|
+
readonly id: string;
|
|
226
|
+
readonly direction: "asc" | "desc";
|
|
227
|
+
}[], readonly {
|
|
228
|
+
readonly id: string;
|
|
229
|
+
readonly direction: "asc" | "desc";
|
|
230
|
+
}[]>>;
|
|
228
231
|
readonly projectId: Schema.optional<Schema.String>;
|
|
229
232
|
}>>, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
230
233
|
readonly data: Schema.$Array<Schema.Struct<{
|
|
@@ -256,13 +259,16 @@ export declare const AdminApiGroup: HttpApiGroup.HttpApiGroup<"admin", HttpApiEn
|
|
|
256
259
|
readonly pageCount: Schema.Int;
|
|
257
260
|
}>;
|
|
258
261
|
}>>, Schema.toCodecJson<typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"listUsers", "GET", "/admin/users", never, Schema.toCodecStringTree<Schema.Struct<{
|
|
259
|
-
readonly page: Schema.Int
|
|
260
|
-
readonly pageSize: Schema.Int
|
|
262
|
+
readonly page: Schema.decodeTo<Schema.Int, Schema.optional<Schema.Union<readonly [Schema.Number, Schema.NumberFromString]>>, never, never>;
|
|
263
|
+
readonly pageSize: Schema.decodeTo<Schema.Int, Schema.optional<Schema.Union<readonly [Schema.Number, Schema.NumberFromString]>>, never, never>;
|
|
261
264
|
readonly globalFilter: Schema.optional<Schema.String>;
|
|
262
|
-
readonly sort: Schema.optional<Schema.
|
|
263
|
-
readonly id:
|
|
264
|
-
readonly direction:
|
|
265
|
-
}
|
|
265
|
+
readonly sort: Schema.optional<Schema.declare<readonly {
|
|
266
|
+
readonly id: string;
|
|
267
|
+
readonly direction: "asc" | "desc";
|
|
268
|
+
}[], readonly {
|
|
269
|
+
readonly id: string;
|
|
270
|
+
readonly direction: "asc" | "desc";
|
|
271
|
+
}[]>>;
|
|
266
272
|
readonly projectId: Schema.optional<Schema.String>;
|
|
267
273
|
}>>, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
268
274
|
readonly data: Schema.$Array<Schema.Struct<{
|
package/dist/admin/schema.d.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
import { ServerCreateDomainPayload, ServerDomain, ServerDomainIdParams, ServerDomainRecordsResponse, ServerUpdateDomainPayload } from "../server/schema.js";
|
|
3
3
|
export declare const AdminListQuery: Schema.Struct<{
|
|
4
|
-
readonly page: Schema.Int
|
|
5
|
-
readonly pageSize: Schema.Int
|
|
4
|
+
readonly page: Schema.decodeTo<Schema.Int, Schema.optional<Schema.Union<readonly [Schema.Number, Schema.NumberFromString]>>, never, never>;
|
|
5
|
+
readonly pageSize: Schema.decodeTo<Schema.Int, Schema.optional<Schema.Union<readonly [Schema.Number, Schema.NumberFromString]>>, never, never>;
|
|
6
6
|
readonly globalFilter: Schema.optional<Schema.String>;
|
|
7
|
-
readonly sort: Schema.optional<Schema.
|
|
8
|
-
readonly id:
|
|
9
|
-
readonly direction:
|
|
10
|
-
}
|
|
7
|
+
readonly sort: Schema.optional<Schema.declare<readonly {
|
|
8
|
+
readonly id: string;
|
|
9
|
+
readonly direction: "asc" | "desc";
|
|
10
|
+
}[], readonly {
|
|
11
|
+
readonly id: string;
|
|
12
|
+
readonly direction: "asc" | "desc";
|
|
13
|
+
}[]>>;
|
|
11
14
|
readonly projectId: Schema.optional<Schema.String>;
|
|
12
15
|
}>;
|
|
13
16
|
export declare const AdminProjectPreview: Schema.Struct<{
|
|
@@ -229,4 +232,3 @@ export type AdminUpdateApiKeyPayload = typeof AdminUpdateApiKeyPayload.Type;
|
|
|
229
232
|
export type AdminCreateOrganizationPayload = typeof AdminCreateOrganizationPayload.Type;
|
|
230
233
|
export type AdminUpdateOrganizationPayload = typeof AdminUpdateOrganizationPayload.Type;
|
|
231
234
|
export { ServerCreateDomainPayload, ServerDomain, ServerDomainIdParams, ServerDomainRecordsResponse, ServerUpdateDomainPayload, };
|
|
232
|
-
export { SortParamsFromString } from "../query.js";
|
package/dist/admin/schema.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
import { ApiKeyPermissionGrant } from "../access.js";
|
|
3
|
-
import { PaginatedResponse, Query } from "
|
|
3
|
+
import { PaginatedResponse, Query } from "@krak-stack/registry/query";
|
|
4
4
|
import { ServerCreateDomainPayload, ServerDomain, ServerDomainIdParams, ServerDomainRecordsResponse, ServerUpdateDomainPayload, } from "../server/schema.js";
|
|
5
5
|
export const AdminListQuery = Schema.Struct({
|
|
6
6
|
...Query.fields,
|
|
@@ -312,4 +312,3 @@ export const PaginatedAdminOrganizations = PaginatedResponse(AdminOrganization).
|
|
|
312
312
|
description: "Paginated administrative organization list response.",
|
|
313
313
|
});
|
|
314
314
|
export { ServerCreateDomainPayload, ServerDomain, ServerDomainIdParams, ServerDomainRecordsResponse, ServerUpdateDomainPayload, };
|
|
315
|
-
export { SortParamsFromString } from "../query.js";
|
package/dist/api.d.ts
CHANGED
|
@@ -2158,13 +2158,16 @@ export declare const AuthClientApi: HttpApi.HttpApi<"AuthClientApi", import("eff
|
|
|
2158
2158
|
readonly createdAt: import("effect/Schema").Date;
|
|
2159
2159
|
readonly updatedAt: import("effect/Schema").Date;
|
|
2160
2160
|
}>>>, import("effect/Schema").toCodecJson<typeof import("effect/http-api/HttpApiError").Unauthorized | typeof import("effect/http-api/HttpApiError").Forbidden | typeof import("effect/http-api/HttpApiError").InternalServerError>, never, never> | import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"listOrganizations", "GET", "/api/auth/admin/organizations", never, import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
|
|
2161
|
-
readonly page: import("effect/Schema").Int
|
|
2162
|
-
readonly pageSize: import("effect/Schema").Int
|
|
2161
|
+
readonly page: import("effect/Schema").decodeTo<import("effect/Schema").Int, import("effect/Schema").optional<import("effect/Schema").Union<readonly [import("effect/Schema").Number, import("effect/Schema").NumberFromString]>>, never, never>;
|
|
2162
|
+
readonly pageSize: import("effect/Schema").decodeTo<import("effect/Schema").Int, import("effect/Schema").optional<import("effect/Schema").Union<readonly [import("effect/Schema").Number, import("effect/Schema").NumberFromString]>>, never, never>;
|
|
2163
2163
|
readonly globalFilter: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
2164
|
-
readonly sort: import("effect/Schema").optional<import("effect/Schema").
|
|
2165
|
-
readonly id:
|
|
2166
|
-
readonly direction:
|
|
2167
|
-
}
|
|
2164
|
+
readonly sort: import("effect/Schema").optional<import("effect/Schema").declare<readonly {
|
|
2165
|
+
readonly id: string;
|
|
2166
|
+
readonly direction: "asc" | "desc";
|
|
2167
|
+
}[], readonly {
|
|
2168
|
+
readonly id: string;
|
|
2169
|
+
readonly direction: "asc" | "desc";
|
|
2170
|
+
}[]>>;
|
|
2168
2171
|
readonly projectId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
2169
2172
|
}>>, never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
2170
2173
|
readonly data: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
@@ -2196,13 +2199,16 @@ export declare const AuthClientApi: HttpApi.HttpApi<"AuthClientApi", import("eff
|
|
|
2196
2199
|
readonly pageCount: import("effect/Schema").Int;
|
|
2197
2200
|
}>;
|
|
2198
2201
|
}>>, import("effect/Schema").toCodecJson<typeof import("effect/http-api/HttpApiError").Unauthorized | typeof import("effect/http-api/HttpApiError").Forbidden | typeof import("effect/http-api/HttpApiError").InternalServerError>, never, never> | import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"listUsers", "GET", "/api/auth/admin/users", never, import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
|
|
2199
|
-
readonly page: import("effect/Schema").Int
|
|
2200
|
-
readonly pageSize: import("effect/Schema").Int
|
|
2202
|
+
readonly page: import("effect/Schema").decodeTo<import("effect/Schema").Int, import("effect/Schema").optional<import("effect/Schema").Union<readonly [import("effect/Schema").Number, import("effect/Schema").NumberFromString]>>, never, never>;
|
|
2203
|
+
readonly pageSize: import("effect/Schema").decodeTo<import("effect/Schema").Int, import("effect/Schema").optional<import("effect/Schema").Union<readonly [import("effect/Schema").Number, import("effect/Schema").NumberFromString]>>, never, never>;
|
|
2201
2204
|
readonly globalFilter: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
2202
|
-
readonly sort: import("effect/Schema").optional<import("effect/Schema").
|
|
2203
|
-
readonly id:
|
|
2204
|
-
readonly direction:
|
|
2205
|
-
}
|
|
2205
|
+
readonly sort: import("effect/Schema").optional<import("effect/Schema").declare<readonly {
|
|
2206
|
+
readonly id: string;
|
|
2207
|
+
readonly direction: "asc" | "desc";
|
|
2208
|
+
}[], readonly {
|
|
2209
|
+
readonly id: string;
|
|
2210
|
+
readonly direction: "asc" | "desc";
|
|
2211
|
+
}[]>>;
|
|
2206
2212
|
readonly projectId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
2207
2213
|
}>>, never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
2208
2214
|
readonly data: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
@@ -6,11 +6,12 @@ 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,
|
|
@@ -6,11 +6,12 @@ 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);
|
|
@@ -232,13 +232,16 @@ export declare const authHttpClient: (baseUrl?: string | undefined, getLocale?:
|
|
|
232
232
|
readonly updatedAt: import("effect/Schema").Date;
|
|
233
233
|
}>>>, import("effect/Schema").toCodecJson<typeof import("effect/http-api/HttpApiError").Unauthorized | typeof import("effect/http-api/HttpApiError").Forbidden | typeof import("effect/http-api/HttpApiError").InternalServerError>, never, never>, never, never>;
|
|
234
234
|
readonly listOrganizations: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"listOrganizations", "GET", "/api/auth/admin/organizations", never, import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
|
|
235
|
-
readonly page: import("effect/Schema").Int
|
|
236
|
-
readonly pageSize: import("effect/Schema").Int
|
|
235
|
+
readonly page: import("effect/Schema").decodeTo<import("effect/Schema").Int, import("effect/Schema").optional<import("effect/Schema").Union<readonly [import("effect/Schema").Number, import("effect/Schema").NumberFromString]>>, never, never>;
|
|
236
|
+
readonly pageSize: import("effect/Schema").decodeTo<import("effect/Schema").Int, import("effect/Schema").optional<import("effect/Schema").Union<readonly [import("effect/Schema").Number, import("effect/Schema").NumberFromString]>>, never, never>;
|
|
237
237
|
readonly globalFilter: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
238
|
-
readonly sort: import("effect/Schema").optional<import("effect/Schema").
|
|
239
|
-
readonly id:
|
|
240
|
-
readonly direction:
|
|
241
|
-
}
|
|
238
|
+
readonly sort: import("effect/Schema").optional<import("effect/Schema").declare<readonly {
|
|
239
|
+
readonly id: string;
|
|
240
|
+
readonly direction: "asc" | "desc";
|
|
241
|
+
}[], readonly {
|
|
242
|
+
readonly id: string;
|
|
243
|
+
readonly direction: "asc" | "desc";
|
|
244
|
+
}[]>>;
|
|
242
245
|
readonly projectId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
243
246
|
}>>, never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
244
247
|
readonly data: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
@@ -271,13 +274,16 @@ export declare const authHttpClient: (baseUrl?: string | undefined, getLocale?:
|
|
|
271
274
|
}>;
|
|
272
275
|
}>>, import("effect/Schema").toCodecJson<typeof import("effect/http-api/HttpApiError").Unauthorized | typeof import("effect/http-api/HttpApiError").Forbidden | typeof import("effect/http-api/HttpApiError").InternalServerError>, never, never>, never, never>;
|
|
273
276
|
readonly listUsers: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"listUsers", "GET", "/api/auth/admin/users", never, import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
|
|
274
|
-
readonly page: import("effect/Schema").Int
|
|
275
|
-
readonly pageSize: import("effect/Schema").Int
|
|
277
|
+
readonly page: import("effect/Schema").decodeTo<import("effect/Schema").Int, import("effect/Schema").optional<import("effect/Schema").Union<readonly [import("effect/Schema").Number, import("effect/Schema").NumberFromString]>>, never, never>;
|
|
278
|
+
readonly pageSize: import("effect/Schema").decodeTo<import("effect/Schema").Int, import("effect/Schema").optional<import("effect/Schema").Union<readonly [import("effect/Schema").Number, import("effect/Schema").NumberFromString]>>, never, never>;
|
|
276
279
|
readonly globalFilter: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
277
|
-
readonly sort: import("effect/Schema").optional<import("effect/Schema").
|
|
278
|
-
readonly id:
|
|
279
|
-
readonly direction:
|
|
280
|
-
}
|
|
280
|
+
readonly sort: import("effect/Schema").optional<import("effect/Schema").declare<readonly {
|
|
281
|
+
readonly id: string;
|
|
282
|
+
readonly direction: "asc" | "desc";
|
|
283
|
+
}[], readonly {
|
|
284
|
+
readonly id: string;
|
|
285
|
+
readonly direction: "asc" | "desc";
|
|
286
|
+
}[]>>;
|
|
281
287
|
readonly projectId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
282
288
|
}>>, never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
283
289
|
readonly data: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/server/proxy.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ import { AuthProxyError } from "./proxy-origin.js";
|
|
|
4
4
|
export interface ProxyAuthRequestOptions {
|
|
5
5
|
cookieDomain?: string;
|
|
6
6
|
apiKey?: Redacted.Redacted<string>;
|
|
7
|
+
/** For proxyAuthHttpEffect only; enable behind an ingress that overwrites x-forwarded-proto. */
|
|
8
|
+
trustForwardedProto?: boolean;
|
|
7
9
|
}
|
|
8
10
|
export declare const proxyAuthRequest: (request: Request, baseUrl: string | URL, options?: ProxyAuthRequestOptions) => Promise<Response>;
|
|
9
11
|
export declare const proxyAuthRequestEffect: (request: Request, baseUrl: string | URL, options?: ProxyAuthRequestOptions) => Effect.Effect<HttpServerResponse.HttpServerResponse, AuthProxyError, HttpClient.HttpClient>;
|
package/dist/server/proxy.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Effect } from "effect";
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
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
|
+
import { AuthProxyOrigin } from "./schema.js";
|
|
4
5
|
const blockedRequestHeaders = [
|
|
5
6
|
"accept-encoding",
|
|
6
7
|
"b3",
|
|
@@ -128,5 +129,13 @@ export const proxyAuthRequestEffect = (request, baseUrl, options) => Effect.gen(
|
|
|
128
129
|
export const proxyAuthHttpEffect = (baseUrl, options) => Effect.gen(function* () {
|
|
129
130
|
const request = yield* HttpServerRequest.HttpServerRequest;
|
|
130
131
|
const webRequest = yield* HttpServerRequest.toWeb(request);
|
|
131
|
-
|
|
132
|
+
if (!options?.trustForwardedProto) {
|
|
133
|
+
return yield* proxyAuthRequestEffect(webRequest, baseUrl, options);
|
|
134
|
+
}
|
|
135
|
+
// toWeb can return the original Web Request with the internal HTTP URL.
|
|
136
|
+
// Trust only the configured ingress protocol, never forwarded host headers.
|
|
137
|
+
const url = new URL(webRequest.url);
|
|
138
|
+
const protocol = yield* Schema.decodeUnknownEffect(AuthProxyOrigin.fields.protocol)(request.headers["x-forwarded-proto"] ?? url.protocol.slice(0, -1)).pipe(Effect.mapError(() => new AuthProxyError({ reason: "invalid" })));
|
|
139
|
+
url.protocol = `${protocol}:`;
|
|
140
|
+
return yield* proxyAuthRequestEffect(new Request(url, webRequest), baseUrl, options);
|
|
132
141
|
});
|
package/package.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@krak-stack/auth",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.20",
|
|
4
4
|
"description": "Effect HttpApi clients and schemas for KrakStack Auth.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist",
|
|
8
|
-
"patches",
|
|
9
8
|
"tailwind.css"
|
|
10
9
|
],
|
|
11
10
|
"type": "module",
|
|
@@ -27,10 +26,6 @@
|
|
|
27
26
|
"types": "./dist/schema.d.ts",
|
|
28
27
|
"default": "./dist/schema.js"
|
|
29
28
|
},
|
|
30
|
-
"./query": {
|
|
31
|
-
"types": "./dist/query.d.ts",
|
|
32
|
-
"default": "./dist/query.js"
|
|
33
|
-
},
|
|
34
29
|
"./roles": {
|
|
35
30
|
"types": "./dist/roles.d.ts",
|
|
36
31
|
"default": "./dist/roles.js"
|
|
@@ -72,19 +67,18 @@
|
|
|
72
67
|
"build": "rm -rf dist && tsc -p tsconfig.build.json",
|
|
73
68
|
"build:watch": "rm -rf dist && tsc -p tsconfig.build.json --watch --preserveWatchOutput",
|
|
74
69
|
"dev": "bun run build:watch",
|
|
75
|
-
"prepack": "bun run build"
|
|
76
|
-
"type:check": "tsc -p tsconfig.json --noEmit"
|
|
70
|
+
"prepack": "bun run build"
|
|
77
71
|
},
|
|
78
72
|
"dependencies": {
|
|
79
73
|
"@effect/atom-react": "^4.0.0",
|
|
80
|
-
"@lucas-barake/effect-form-react": "
|
|
74
|
+
"@lucas-barake/effect-form-react": "1.1.0",
|
|
81
75
|
"react-qr-code": "^2.2.0"
|
|
82
76
|
},
|
|
83
77
|
"devDependencies": {
|
|
84
|
-
"@krak-stack/registry": "0.1.
|
|
78
|
+
"@krak-stack/registry": "0.1.42"
|
|
85
79
|
},
|
|
86
80
|
"peerDependencies": {
|
|
87
|
-
"@krak-stack/registry": "^0.1.
|
|
81
|
+
"@krak-stack/registry": "^0.1.42",
|
|
88
82
|
"@tanstack/react-router": "^1.170.15",
|
|
89
83
|
"effect": "^4.0.0",
|
|
90
84
|
"input-otp": "^1.5.0",
|
package/dist/query.d.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { Schema } from "effect";
|
|
2
|
-
export type SortDirection = "asc" | "desc";
|
|
3
|
-
export interface SortState {
|
|
4
|
-
readonly id: string;
|
|
5
|
-
readonly desc: boolean;
|
|
6
|
-
}
|
|
7
|
-
export interface SortParam {
|
|
8
|
-
readonly id: string;
|
|
9
|
-
readonly direction: SortDirection;
|
|
10
|
-
}
|
|
11
|
-
export declare const SortDirection: Schema.Union<readonly [Schema.Literal<"asc">, Schema.Literal<"desc">]>;
|
|
12
|
-
export declare const SortParam: Schema.Struct<{
|
|
13
|
-
readonly id: Schema.NonEmptyString;
|
|
14
|
-
readonly direction: Schema.Union<readonly [Schema.Literal<"asc">, Schema.Literal<"desc">]>;
|
|
15
|
-
}>;
|
|
16
|
-
export declare const SortParamFromString: Schema.decodeTo<Schema.Struct<{
|
|
17
|
-
readonly id: Schema.NonEmptyString;
|
|
18
|
-
readonly direction: Schema.Union<readonly [Schema.Literal<"asc">, Schema.Literal<"desc">]>;
|
|
19
|
-
}>, Schema.String, never, never>;
|
|
20
|
-
export declare const SortParamsFromString: Schema.decodeTo<Schema.$Array<Schema.Struct<{
|
|
21
|
-
readonly id: Schema.NonEmptyString;
|
|
22
|
-
readonly direction: Schema.Union<readonly [Schema.Literal<"asc">, Schema.Literal<"desc">]>;
|
|
23
|
-
}>>, Schema.String, never, never>;
|
|
24
|
-
export declare const Query: Schema.Struct<{
|
|
25
|
-
readonly page: Schema.Int;
|
|
26
|
-
readonly pageSize: Schema.Int;
|
|
27
|
-
readonly globalFilter: Schema.optional<Schema.String>;
|
|
28
|
-
readonly sort: Schema.optional<Schema.decodeTo<Schema.String, Schema.decodeTo<Schema.$Array<Schema.Struct<{
|
|
29
|
-
readonly id: Schema.NonEmptyString;
|
|
30
|
-
readonly direction: Schema.Union<readonly [Schema.Literal<"asc">, Schema.Literal<"desc">]>;
|
|
31
|
-
}>>, Schema.String, never, never>, never, never>>;
|
|
32
|
-
}>;
|
|
33
|
-
export type QueryType = typeof Query.Type;
|
|
34
|
-
export declare const PaginationMeta: Schema.Struct<{
|
|
35
|
-
readonly page: Schema.Int;
|
|
36
|
-
readonly pageSize: Schema.Int;
|
|
37
|
-
readonly total: Schema.Int;
|
|
38
|
-
readonly pageCount: Schema.Int;
|
|
39
|
-
}>;
|
|
40
|
-
export type PaginationMetaType = typeof PaginationMeta.Type;
|
|
41
|
-
export declare const PaginatedResponse: <S extends Schema.Top>(items: S) => Schema.Struct<{
|
|
42
|
-
readonly data: Schema.$Array<S>;
|
|
43
|
-
readonly meta: Schema.Struct<{
|
|
44
|
-
readonly page: Schema.Int;
|
|
45
|
-
readonly pageSize: Schema.Int;
|
|
46
|
-
readonly total: Schema.Int;
|
|
47
|
-
readonly pageCount: Schema.Int;
|
|
48
|
-
}>;
|
|
49
|
-
}>;
|
package/dist/query.js
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { Effect, Schema, SchemaIssue, SchemaTransformation } from "effect";
|
|
2
|
-
const parseSortParam = (sort) => {
|
|
3
|
-
const id = sort.startsWith("-") ? sort.slice(1) : sort;
|
|
4
|
-
if (!id || id.includes(",") || id.includes(":")) {
|
|
5
|
-
return null;
|
|
6
|
-
}
|
|
7
|
-
return { id, direction: sort.startsWith("-") ? "desc" : "asc" };
|
|
8
|
-
};
|
|
9
|
-
export const SortDirection = Schema.Union([
|
|
10
|
-
Schema.Literal("asc"),
|
|
11
|
-
Schema.Literal("desc"),
|
|
12
|
-
]).annotate({
|
|
13
|
-
identifier: "SortDirection",
|
|
14
|
-
title: "Sort Direction",
|
|
15
|
-
description: "Sort direction for list query results.",
|
|
16
|
-
examples: ["asc", "desc"],
|
|
17
|
-
});
|
|
18
|
-
export const SortParam = Schema.Struct({
|
|
19
|
-
id: Schema.NonEmptyString,
|
|
20
|
-
direction: SortDirection,
|
|
21
|
-
}).annotate({
|
|
22
|
-
identifier: "SortParam",
|
|
23
|
-
title: "Sort Parameter",
|
|
24
|
-
description: "Decoded sort parameter with a field id and direction.",
|
|
25
|
-
examples: [{ id: "name", direction: "asc" }],
|
|
26
|
-
});
|
|
27
|
-
export const SortParamFromString = Schema.String.pipe(Schema.decodeTo(SortParam, SchemaTransformation.transformEffect({
|
|
28
|
-
decode: (sort) => {
|
|
29
|
-
const sortParam = parseSortParam(sort);
|
|
30
|
-
if (!sortParam) {
|
|
31
|
-
return Effect.fail(new SchemaIssue.InvalidValue({
|
|
32
|
-
message: 'Expected sort in the format "field" or "-field"',
|
|
33
|
-
}, sort));
|
|
34
|
-
}
|
|
35
|
-
return Effect.succeed(sortParam);
|
|
36
|
-
},
|
|
37
|
-
encode: (sort) => Effect.succeed(sort.direction === "desc" ? `-${sort.id}` : sort.id),
|
|
38
|
-
})), Schema.annotate({
|
|
39
|
-
identifier: "SortParamFromString",
|
|
40
|
-
title: "Sort Parameter From String",
|
|
41
|
-
description: 'URL encoded single sort parameter where descending fields are prefixed with "-".',
|
|
42
|
-
examples: [{ id: "name", direction: "asc" }],
|
|
43
|
-
}));
|
|
44
|
-
export const SortParamsFromString = Schema.String.pipe(Schema.decodeTo(Schema.Array(SortParam), SchemaTransformation.transformEffect({
|
|
45
|
-
decode: (sort) => {
|
|
46
|
-
const parts = sort.split(",");
|
|
47
|
-
const sortParams = [];
|
|
48
|
-
for (const part of parts) {
|
|
49
|
-
const sortParam = parseSortParam(part);
|
|
50
|
-
if (!sortParam) {
|
|
51
|
-
return Effect.fail(new SchemaIssue.InvalidValue({
|
|
52
|
-
message: 'Expected sort in the format "field,-otherField"',
|
|
53
|
-
}, sort));
|
|
54
|
-
}
|
|
55
|
-
sortParams.push(sortParam);
|
|
56
|
-
}
|
|
57
|
-
return Effect.succeed(sortParams);
|
|
58
|
-
},
|
|
59
|
-
encode: (sort) => Effect.succeed(sort
|
|
60
|
-
.map((part) => Schema.encodeSync(SortParamFromString)(part))
|
|
61
|
-
.join(",")),
|
|
62
|
-
})), Schema.annotate({
|
|
63
|
-
identifier: "SortParamsFromString",
|
|
64
|
-
title: "Sort Parameters From String",
|
|
65
|
-
description: 'URL encoded sort parameters where descending fields are prefixed with "-" and multiple fields are comma-separated.',
|
|
66
|
-
examples: [
|
|
67
|
-
[
|
|
68
|
-
{ id: "name", direction: "desc" },
|
|
69
|
-
{ id: "createdAt", direction: "asc" },
|
|
70
|
-
],
|
|
71
|
-
],
|
|
72
|
-
}));
|
|
73
|
-
const SortParamSearch = SortParamsFromString.pipe(Schema.decodeTo(Schema.String, SchemaTransformation.transform({
|
|
74
|
-
decode: (sort) => Schema.encodeSync(SortParamsFromString)(sort),
|
|
75
|
-
encode: (sort) => Schema.decodeUnknownSync(SortParamsFromString)(sort),
|
|
76
|
-
})), Schema.annotate({
|
|
77
|
-
identifier: "SortParamSearch",
|
|
78
|
-
title: "Sort Search Parameter",
|
|
79
|
-
description: 'Search parameter sort value normalized to the compact "-field,otherField" URL format.',
|
|
80
|
-
examples: ["-name,createdAt"],
|
|
81
|
-
}));
|
|
82
|
-
export const Query = Schema.Struct({
|
|
83
|
-
page: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
|
|
84
|
-
pageSize: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 100 })),
|
|
85
|
-
globalFilter: Schema.optional(Schema.String),
|
|
86
|
-
sort: Schema.optional(SortParamSearch),
|
|
87
|
-
}).annotate({
|
|
88
|
-
identifier: "Query",
|
|
89
|
-
title: "Query",
|
|
90
|
-
description: "Zero-based page request parameters with optional filtering and sorting for list endpoints.",
|
|
91
|
-
examples: [
|
|
92
|
-
{
|
|
93
|
-
page: 0,
|
|
94
|
-
pageSize: 10,
|
|
95
|
-
globalFilter: "housing",
|
|
96
|
-
sort: "-name,createdAt",
|
|
97
|
-
},
|
|
98
|
-
],
|
|
99
|
-
});
|
|
100
|
-
export const PaginationMeta = Schema.Struct({
|
|
101
|
-
page: Schema.Int,
|
|
102
|
-
pageSize: Schema.Int,
|
|
103
|
-
total: Schema.Int,
|
|
104
|
-
pageCount: Schema.Int,
|
|
105
|
-
}).annotate({
|
|
106
|
-
identifier: "PaginationMeta",
|
|
107
|
-
title: "Pagination Metadata",
|
|
108
|
-
description: "Pagination metadata returned with a paginated list response.",
|
|
109
|
-
examples: [{ page: 0, pageSize: 10, total: 125, pageCount: 13 }],
|
|
110
|
-
});
|
|
111
|
-
export const PaginatedResponse = (items) => Schema.Struct({
|
|
112
|
-
data: Schema.Array(items),
|
|
113
|
-
meta: PaginationMeta,
|
|
114
|
-
});
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
diff --git a/dist/FormReact.d.ts b/dist/FormReact.d.ts
|
|
2
|
-
index 61b65ad3ef858a3d9994d4cfde7e47216d44b549..0431a57a4a27eefa43180fc19f04f887a25ebf24 100644
|
|
3
|
-
--- a/dist/FormReact.d.ts
|
|
4
|
-
+++ b/dist/FormReact.d.ts
|
|
5
|
-
@@ -4,8 +4,8 @@ import type * as FormBuilder from "@lucas-barake/effect-form/FormBuilder";
|
|
6
|
-
import type * as Effect from "effect/Effect";
|
|
7
|
-
import * as Option from "effect/Option";
|
|
8
|
-
import type * as Schema from "effect/Schema";
|
|
9
|
-
-import * as Atom from "effect/unstable/reactivity/Atom";
|
|
10
|
-
-import type * as AtomRegistry from "effect/unstable/reactivity/AtomRegistry";
|
|
11
|
-
+import * as Atom from "effect/reactivity/Atom";
|
|
12
|
-
+import type * as AtomRegistry from "effect/reactivity/AtomRegistry";
|
|
13
|
-
import * as React from "react";
|
|
14
|
-
export type FieldValue<T> = FieldStateModule.FieldValue<T>;
|
|
15
|
-
export type FieldState<E> = FieldStateModule.FieldState<E>;
|
|
16
|
-
diff --git a/dist/FormReact.js b/dist/FormReact.js
|
|
17
|
-
index 03e34ec60b833b4dd220ac6faffe70b9138703cd..f313c18c5e6cdb7138e19180aeb0acd4281857fa 100644
|
|
18
|
-
--- a/dist/FormReact.js
|
|
19
|
-
+++ b/dist/FormReact.js
|
|
20
|
-
@@ -4,7 +4,7 @@ import { Field, FormAtoms } from "@lucas-barake/effect-form";
|
|
21
|
-
import { getNestedValue } from "@lucas-barake/effect-form/Path";
|
|
22
|
-
import * as Layer from "effect/Layer";
|
|
23
|
-
import * as Option from "effect/Option";
|
|
24
|
-
-import * as Atom from "effect/unstable/reactivity/Atom";
|
|
25
|
-
+import * as Atom from "effect/reactivity/Atom";
|
|
26
|
-
import * as React from "react";
|
|
27
|
-
import { createContext, useContext } from "react";
|
|
28
|
-
const ArrayItemContext = /*#__PURE__*/createContext(null);
|
|
29
|
-
diff --git a/package.json b/package.json
|
|
30
|
-
index 416aed4983dfb7dfc1528b3cca636b860ab0986e..048e49b01201623854c1c8f042044d3f5bd64703 100644
|
|
31
|
-
--- a/package.json
|
|
32
|
-
+++ b/package.json
|
|
33
|
-
@@ -41,14 +41,14 @@
|
|
34
|
-
"@lucas-barake/effect-form": "^0.25.0-beta.6"
|
|
35
|
-
},
|
|
36
|
-
"devDependencies": {
|
|
37
|
-
- "@effect/atom-react": "4.0.0-beta.52",
|
|
38
|
-
+ "@effect/atom-react": "4.0.0",
|
|
39
|
-
"@vitejs/plugin-react": "^5.1.1",
|
|
40
|
-
- "effect": "4.0.0-beta.52",
|
|
41
|
-
+ "effect": "4.0.0",
|
|
42
|
-
"react": "^19.0.0"
|
|
43
|
-
},
|
|
44
|
-
"peerDependencies": {
|
|
45
|
-
- "@effect/atom-react": ">=4.0.0-beta.52 <4.0.1",
|
|
46
|
-
- "effect": ">=4.0.0-beta.52 <4.0.1",
|
|
47
|
-
+ "@effect/atom-react": "^4.0.0",
|
|
48
|
-
+ "effect": "^4.0.0",
|
|
49
|
-
"react": "^19.0.0"
|
|
50
|
-
},
|
|
51
|
-
"scripts": {
|
|
52
|
-
diff --git a/src/FormReact.tsx b/src/FormReact.tsx
|
|
53
|
-
index 49c358e92fe04a62a9ef97dbae6665ce53e905a5..dfb2792d4b824d448bf3e8f4b469c0861422bd6f 100644
|
|
54
|
-
--- a/src/FormReact.tsx
|
|
55
|
-
+++ b/src/FormReact.tsx
|
|
56
|
-
@@ -7,8 +7,8 @@ import type * as Effect from "effect/Effect"
|
|
57
|
-
import * as Layer from "effect/Layer"
|
|
58
|
-
import * as Option from "effect/Option"
|
|
59
|
-
import type * as Schema from "effect/Schema"
|
|
60
|
-
-import * as Atom from "effect/unstable/reactivity/Atom"
|
|
61
|
-
-import type * as AtomRegistry from "effect/unstable/reactivity/AtomRegistry"
|
|
62
|
-
+import * as Atom from "effect/reactivity/Atom"
|
|
63
|
-
+import type * as AtomRegistry from "effect/reactivity/AtomRegistry"
|
|
64
|
-
import * as React from "react"
|
|
65
|
-
import { createContext, useContext } from "react"
|
|
66
|
-
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
diff --git a/dist/FormAtoms.d.ts b/dist/FormAtoms.d.ts
|
|
2
|
-
index 08d1e4e2e8edf08cecb5b550099c3293cbd10cd7..f7b1fa4a5a7d65e8b8b3785dc9eb5397d24718b4 100644
|
|
3
|
-
--- a/dist/FormAtoms.d.ts
|
|
4
|
-
+++ b/dist/FormAtoms.d.ts
|
|
5
|
-
@@ -1,7 +1,7 @@
|
|
6
|
-
import * as Effect from "effect/Effect";
|
|
7
|
-
import * as Option from "effect/Option";
|
|
8
|
-
import * as Schema from "effect/Schema";
|
|
9
|
-
-import * as Atom from "effect/unstable/reactivity/Atom";
|
|
10
|
-
+import * as Atom from "effect/reactivity/Atom";
|
|
11
|
-
import * as Field from "./Field.ts";
|
|
12
|
-
import * as FormBuilder from "./FormBuilder.ts";
|
|
13
|
-
import * as Mode from "./Mode.ts";
|
|
14
|
-
diff --git a/dist/FormAtoms.js b/dist/FormAtoms.js
|
|
15
|
-
index 663c4478a08eb17bfb7a11df952ced8f7812cbf8..ebaa1be93c33af0390857e945a9d414094f215ab 100644
|
|
16
|
-
--- a/dist/FormAtoms.js
|
|
17
|
-
+++ b/dist/FormAtoms.js
|
|
18
|
-
@@ -3,8 +3,8 @@ import * as Effect from "effect/Effect";
|
|
19
|
-
import { pipe } from "effect/Function";
|
|
20
|
-
import * as Option from "effect/Option";
|
|
21
|
-
import * as Schema from "effect/Schema";
|
|
22
|
-
-import * as AsyncResult from "effect/unstable/reactivity/AsyncResult";
|
|
23
|
-
-import * as Atom from "effect/unstable/reactivity/Atom";
|
|
24
|
-
+import * as AsyncResult from "effect/reactivity/AsyncResult";
|
|
25
|
-
+import * as Atom from "effect/reactivity/Atom";
|
|
26
|
-
import * as Field from "./Field.js";
|
|
27
|
-
import * as FormBuilder from "./FormBuilder.js";
|
|
28
|
-
import { recalculateDirtyFieldsForArray, recalculateDirtySubtree } from "./internal/dirty.js";
|
|
29
|
-
diff --git a/dist/FormBuilder.d.ts b/dist/FormBuilder.d.ts
|
|
30
|
-
index d42cf00d24b9efea5168831549b85468a64dfcef..16dfc1af6443555454ec7e6219c94eeabce3d724 100644
|
|
31
|
-
--- a/dist/FormBuilder.d.ts
|
|
32
|
-
+++ b/dist/FormBuilder.d.ts
|
|
33
|
-
@@ -1,7 +1,7 @@
|
|
34
|
-
import type * as Effect from "effect/Effect";
|
|
35
|
-
import type * as Option from "effect/Option";
|
|
36
|
-
import * as Schema from "effect/Schema";
|
|
37
|
-
-import type * as AtomRegistry from "effect/unstable/reactivity/AtomRegistry";
|
|
38
|
-
+import type * as AtomRegistry from "effect/reactivity/AtomRegistry";
|
|
39
|
-
import type { ArrayFieldDef, DecodedFromFields, EncodedFromFields, FieldDef, FieldsRecord } from "./Field.ts";
|
|
40
|
-
/**
|
|
41
|
-
* Flattens an intersection of field records into a single object type so that
|
|
42
|
-
diff --git a/package.json b/package.json
|
|
43
|
-
index 96ad0aa1729c64e8378a8cb2ad29f13b5347e568..06ae5ac6312779be749ff867b846c8f3c4ccf5b1 100644
|
|
44
|
-
--- a/package.json
|
|
45
|
-
+++ b/package.json
|
|
46
|
-
@@ -36,10 +36,10 @@
|
|
47
|
-
"license": "MIT",
|
|
48
|
-
"sideEffects": [],
|
|
49
|
-
"peerDependencies": {
|
|
50
|
-
- "effect": ">=4.0.0-beta.52 <4.0.1"
|
|
51
|
-
+ "effect": "^4.0.0"
|
|
52
|
-
},
|
|
53
|
-
"devDependencies": {
|
|
54
|
-
- "effect": "4.0.0-beta.52"
|
|
55
|
-
+ "effect": "4.0.0"
|
|
56
|
-
},
|
|
57
|
-
"scripts": {
|
|
58
|
-
"build": "tsc -b tsconfig.json && pnpm babel",
|
|
59
|
-
diff --git a/src/FormAtoms.ts b/src/FormAtoms.ts
|
|
60
|
-
index bc60a7f7b676edf4d1e99f6eb4162335b3247022..60d3dadfe2ef14c0a1b66b5e16886e8870c82681 100644
|
|
61
|
-
--- a/src/FormAtoms.ts
|
|
62
|
-
+++ b/src/FormAtoms.ts
|
|
63
|
-
@@ -3,8 +3,8 @@ import * as Effect from "effect/Effect"
|
|
64
|
-
import { pipe } from "effect/Function"
|
|
65
|
-
import * as Option from "effect/Option"
|
|
66
|
-
import * as Schema from "effect/Schema"
|
|
67
|
-
-import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"
|
|
68
|
-
-import * as Atom from "effect/unstable/reactivity/Atom"
|
|
69
|
-
+import * as AsyncResult from "effect/reactivity/AsyncResult"
|
|
70
|
-
+import * as Atom from "effect/reactivity/Atom"
|
|
71
|
-
import * as Field from "./Field.ts"
|
|
72
|
-
import * as FormBuilder from "./FormBuilder.ts"
|
|
73
|
-
import { recalculateDirtyFieldsForArray, recalculateDirtySubtree } from "./internal/dirty.ts"
|
|
74
|
-
diff --git a/src/FormBuilder.ts b/src/FormBuilder.ts
|
|
75
|
-
index 764de854be6b072967d1140c707ba9565eda9516..6a2d0fe285ae3b2d1afc4bf928897e5b7bfb0a4b 100644
|
|
76
|
-
--- a/src/FormBuilder.ts
|
|
77
|
-
+++ b/src/FormBuilder.ts
|
|
78
|
-
@@ -3,7 +3,7 @@ import type * as Option from "effect/Option"
|
|
79
|
-
import * as Predicate from "effect/Predicate"
|
|
80
|
-
import * as Schema from "effect/Schema"
|
|
81
|
-
import * as SchemaGetter from "effect/SchemaGetter"
|
|
82
|
-
-import type * as AtomRegistry from "effect/unstable/reactivity/AtomRegistry"
|
|
83
|
-
+import type * as AtomRegistry from "effect/reactivity/AtomRegistry"
|
|
84
|
-
|
|
85
|
-
import type {
|
|
86
|
-
AnyFieldDef,
|
package/patches/README.md
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# Temporary Effect form compatibility patches
|
|
2
|
-
|
|
3
|
-
These patches backport the stable Effect 4 changes from upstream commit
|
|
4
|
-
[`c10a53e041c9b0b338b26b2af66be5eb24f07d47`](https://github.com/lucas-barake/effect-form/commit/c10a53e041c9b0b338b26b2af66be5eb24f07d47).
|
|
5
|
-
The fixed npm packages are awaiting [release PR #111](https://github.com/lucas-barake/effect-form/pull/111).
|
|
6
|
-
|
|
7
|
-
The patches update reactivity imports in shipped JavaScript, TypeScript
|
|
8
|
-
declarations, and source, and change Effect peer ranges to `^4.0.0`.
|
|
9
|
-
They do not change form behavior or package versions.
|
|
10
|
-
|
|
11
|
-
## Installation
|
|
12
|
-
|
|
13
|
-
The workspace-root `package.json` configures `patchedDependencies` and exact
|
|
14
|
-
version overrides for both packages. Run `bun install` to apply them; commit
|
|
15
|
-
these patch files, `package.json`, and `bun.lock` together. In a monorepo, configure
|
|
16
|
-
the patches at the workspace root, not inside individual packages.
|
|
17
|
-
|
|
18
|
-
Patches do **not** propagate from a published KrakStack package to a consuming
|
|
19
|
-
application. Every application using the affected form packages must configure
|
|
20
|
-
both patches itself. The interim Auth and Registry packages also ship copies
|
|
21
|
-
under `patches/` for consumers to copy into their application roots.
|
|
22
|
-
|
|
23
|
-
## Removing the workaround
|
|
24
|
-
|
|
25
|
-
After upstream publishes `@lucas-barake/effect-form@0.25.0-beta.7` and
|
|
26
|
-
`@lucas-barake/effect-form-react@0.26.0-beta.6` (or newer compatible releases):
|
|
27
|
-
|
|
28
|
-
1. Update direct dependencies and KrakStack peer requirements to the fixed versions.
|
|
29
|
-
2. Remove the two form overrides and `patchedDependencies` entries.
|
|
30
|
-
3. Remove these two patch files and any copies shipped with KrakStack packages.
|
|
31
|
-
4. Run `bun install`, then the project's type, test, and release checks.
|