@krak-stack/auth 0.2.32 → 0.3.0

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 (53) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +101 -5
  3. package/dist/access.d.ts +3 -1
  4. package/dist/admin/api.group.d.ts +41 -41
  5. package/dist/admin/schema.d.ts +23 -23
  6. package/dist/admin/schema.js +21 -19
  7. package/dist/api.d.ts +1313 -1313
  8. package/dist/auth/api.group.d.ts +18 -18
  9. package/dist/auth/schema.d.ts +49 -33
  10. package/dist/auth/schema.js +18 -18
  11. package/dist/components/admin-organization-form.js +2 -2
  12. package/dist/components/admin-organizations.js +6 -5
  13. package/dist/components/admin-users.js +6 -6
  14. package/dist/components/api-key-edit-form.js +19 -11
  15. package/dist/components/associated-projects-notice.d.ts +2 -1
  16. package/dist/components/associated-projects-notice.js +6 -2
  17. package/dist/components/auth-atoms.js +1 -2
  18. package/dist/components/auth-client-api.d.ts +61 -61
  19. package/dist/components/auth-forms.d.ts +1 -0
  20. package/dist/components/auth-forms.js +41 -56
  21. package/dist/components/auth-provider.d.ts +3 -1
  22. package/dist/components/hooks.d.ts +2 -0
  23. package/dist/components/hooks.js +13 -6
  24. package/dist/components/index.d.ts +3 -0
  25. package/dist/components/index.js +2 -0
  26. package/dist/components/member-required.js +3 -5
  27. package/dist/components/oauth-consent.d.ts +22 -0
  28. package/dist/components/oauth-consent.js +79 -0
  29. package/dist/components/organization-switcher.d.ts +1 -1
  30. package/dist/components/organization-switcher.js +83 -54
  31. package/dist/components/project-card-list.d.ts +6 -0
  32. package/dist/components/project-card-list.js +4 -0
  33. package/dist/components/user-button.js +115 -54
  34. package/dist/extra/schema.d.ts +3 -1
  35. package/dist/oauth/authorization.d.ts +3 -0
  36. package/dist/oauth/authorization.js +39 -0
  37. package/dist/oauth/schema.d.ts +24 -0
  38. package/dist/oauth/schema.js +12 -0
  39. package/dist/oauth/verify.d.ts +13 -0
  40. package/dist/oauth/verify.js +67 -0
  41. package/dist/schema.js +1 -1
  42. package/dist/server/actor.js +2 -4
  43. package/dist/server/index.d.ts +2 -0
  44. package/dist/server/index.js +1 -0
  45. package/dist/server/mcp.d.ts +20 -0
  46. package/dist/server/mcp.js +66 -0
  47. package/dist/server/middleware.d.ts +5 -5
  48. package/dist/server/middleware.js +15 -5
  49. package/dist/server/webhook-layer.js +8 -4
  50. package/dist/server/webhooks.d.ts +9 -3
  51. package/dist/service.d.ts +52 -46
  52. package/dist/service.js +56 -9
  53. package/package.json +2 -1
@@ -5,7 +5,7 @@ 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<{
6
6
  readonly userId: Schema.String;
7
7
  readonly banReason: Schema.optional<Schema.String>;
8
- readonly banExpiresIn: Schema.optional<Schema.Number>;
8
+ readonly banExpiresIn: Schema.optional<Schema.Finite>;
9
9
  }>>, never, Schema.toCodecJson<Schema.Struct<{
10
10
  readonly user: Schema.Struct<{
11
11
  readonly id: Schema.String;
@@ -240,8 +240,8 @@ export declare const AuthApiGroup: HttpApiGroup.HttpApiGroup<"auth", HttpApiEndp
240
240
  }>>, Schema.toCodecJson<typeof AuthBadRequest | typeof AuthUnauthorized | typeof AuthForbidden | typeof AuthNotFound | typeof AuthConflict | typeof AuthExpectationFailed | typeof AuthTooManyRequests | typeof AuthInternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"apiKeyList", "GET", "/api-key/list", never, Schema.toCodecStringTree<Schema.Struct<{
241
241
  readonly configId: Schema.optional<Schema.String>;
242
242
  readonly organizationId: Schema.optional<Schema.String>;
243
- readonly limit: Schema.optional<Schema.NumberFromString>;
244
- readonly offset: Schema.optional<Schema.NumberFromString>;
243
+ readonly limit: Schema.optional<Schema.FiniteFromString>;
244
+ readonly offset: Schema.optional<Schema.FiniteFromString>;
245
245
  readonly sortBy: Schema.optional<Schema.String>;
246
246
  readonly sortDirection: Schema.optional<Schema.Literals<readonly ["asc", "desc"]>>;
247
247
  }>>, never, never, Schema.toCodecJson<Schema.Struct<{
@@ -253,15 +253,15 @@ export declare const AuthApiGroup: HttpApiGroup.HttpApiGroup<"auth", HttpApiEndp
253
253
  readonly userId: Schema.optional<Schema.String>;
254
254
  readonly referenceId: Schema.String;
255
255
  readonly configId: Schema.String;
256
- readonly refillInterval: Schema.NullOr<Schema.Number>;
257
- readonly refillAmount: Schema.NullOr<Schema.Number>;
256
+ readonly refillInterval: Schema.NullOr<Schema.Finite>;
257
+ readonly refillAmount: Schema.NullOr<Schema.Finite>;
258
258
  readonly lastRefillAt: Schema.NullOr<Schema.DateFromString>;
259
259
  readonly enabled: Schema.Boolean;
260
260
  readonly rateLimitEnabled: Schema.Boolean;
261
- readonly rateLimitTimeWindow: Schema.NullOr<Schema.Number>;
262
- readonly rateLimitMax: Schema.NullOr<Schema.Number>;
263
- readonly requestCount: Schema.Number;
264
- readonly remaining: Schema.NullOr<Schema.Number>;
261
+ readonly rateLimitTimeWindow: Schema.NullOr<Schema.Finite>;
262
+ readonly rateLimitMax: Schema.NullOr<Schema.Finite>;
263
+ readonly requestCount: Schema.Finite;
264
+ readonly remaining: Schema.NullOr<Schema.Finite>;
265
265
  readonly lastRequest: Schema.NullOr<Schema.DateFromString>;
266
266
  readonly expiresAt: Schema.NullOr<Schema.DateFromString>;
267
267
  readonly createdAt: Schema.DateFromString;
@@ -270,9 +270,9 @@ export declare const AuthApiGroup: HttpApiGroup.HttpApiGroup<"auth", HttpApiEndp
270
270
  readonly permissions: Schema.optional<Schema.NullOr<Schema.$Record<Schema.String, Schema.$Array<Schema.String>>>>;
271
271
  readonly referrers: Schema.optional<Schema.NullOr<Schema.$Array<Schema.String>>>;
272
272
  }>>;
273
- readonly total: Schema.Number;
274
- readonly limit: Schema.optional<Schema.NullOr<Schema.Number>>;
275
- readonly offset: Schema.optional<Schema.NullOr<Schema.Number>>;
273
+ readonly total: Schema.Finite;
274
+ readonly limit: Schema.optional<Schema.NullOr<Schema.Finite>>;
275
+ readonly offset: Schema.optional<Schema.NullOr<Schema.Finite>>;
276
276
  }>>, Schema.toCodecJson<typeof AuthBadRequest | typeof AuthUnauthorized | typeof AuthForbidden | typeof AuthNotFound | typeof AuthConflict | typeof AuthExpectationFailed | typeof AuthTooManyRequests | typeof AuthInternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"changePassword", "POST", "/change-password", never, never, Schema.toCodecJson<Schema.Struct<{
277
277
  readonly newPassword: Schema.String;
278
278
  readonly currentPassword: Schema.String;
@@ -558,7 +558,7 @@ export declare const AuthApiGroup: HttpApiGroup.HttpApiGroup<"auth", HttpApiEndp
558
558
  }>>, Schema.toCodecJson<typeof AuthBadRequest | typeof AuthUnauthorized | typeof AuthForbidden | typeof AuthNotFound | typeof AuthConflict | typeof AuthExpectationFailed | typeof AuthTooManyRequests | typeof AuthInternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"organizationGetFull", "GET", "/organization/get-full-organization", never, Schema.toCodecStringTree<Schema.Struct<{
559
559
  readonly organizationId: Schema.optional<Schema.String>;
560
560
  readonly organizationSlug: Schema.optional<Schema.String>;
561
- readonly membersLimit: Schema.optional<Schema.NumberFromString>;
561
+ readonly membersLimit: Schema.optional<Schema.FiniteFromString>;
562
562
  }>>, never, never, Schema.toCodecJson<Schema.NullOr<Schema.Struct<{
563
563
  readonly id: Schema.String;
564
564
  readonly name: Schema.String;
@@ -644,7 +644,7 @@ export declare const AuthApiGroup: HttpApiGroup.HttpApiGroup<"auth", HttpApiEndp
644
644
  readonly organizationId: Schema.NonEmptyString;
645
645
  readonly actorUserId: Schema.NonEmptyString;
646
646
  readonly targetUserId: Schema.NonEmptyString;
647
- readonly expiresInSeconds: Schema.optional<Schema.Number>;
647
+ readonly expiresInSeconds: Schema.optional<Schema.Finite>;
648
648
  }>>, never, Schema.toCodecJson<Schema.Struct<{
649
649
  readonly session: Schema.Struct<{
650
650
  readonly id: Schema.String;
@@ -755,8 +755,8 @@ export declare const AuthApiGroup: HttpApiGroup.HttpApiGroup<"auth", HttpApiEndp
755
755
  readonly expiresAt: Schema.DateFromString;
756
756
  readonly createdAt: Schema.optional<Schema.DateFromString>;
757
757
  }>>>, Schema.toCodecJson<typeof AuthBadRequest | typeof AuthUnauthorized | typeof AuthForbidden | typeof AuthNotFound | typeof AuthConflict | typeof AuthExpectationFailed | typeof AuthTooManyRequests | typeof AuthInternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"organizationListMembers", "GET", "/organization/list-members", never, Schema.toCodecStringTree<Schema.Struct<{
758
- readonly limit: Schema.optional<Schema.NumberFromString>;
759
- readonly offset: Schema.optional<Schema.NumberFromString>;
758
+ readonly limit: Schema.optional<Schema.FiniteFromString>;
759
+ readonly offset: Schema.optional<Schema.FiniteFromString>;
760
760
  readonly sortBy: Schema.optional<Schema.String>;
761
761
  readonly sortDirection: Schema.optional<Schema.Literals<readonly ["asc", "desc"]>>;
762
762
  readonly filterField: Schema.optional<Schema.String>;
@@ -810,7 +810,7 @@ export declare const AuthApiGroup: HttpApiGroup.HttpApiGroup<"auth", HttpApiEndp
810
810
  }>, Schema.Unknown, never, never>>>;
811
811
  }>;
812
812
  }>>;
813
- readonly total: Schema.Number;
813
+ readonly total: Schema.Finite;
814
814
  }>>, Schema.toCodecJson<typeof AuthBadRequest | typeof AuthUnauthorized | typeof AuthForbidden | typeof AuthNotFound | typeof AuthConflict | typeof AuthExpectationFailed | typeof AuthTooManyRequests | typeof AuthInternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"organizationListUserInvitations", "GET", "/organization/list-user-invitations", never, Schema.toCodecStringTree<Schema.Struct<{}>>, never, never, Schema.toCodecJson<Schema.$Array<Schema.Struct<{
815
815
  readonly id: Schema.String;
816
816
  readonly email: Schema.String;
@@ -1039,7 +1039,7 @@ export declare const AuthApiGroup: HttpApiGroup.HttpApiGroup<"auth", HttpApiEndp
1039
1039
  readonly nonce: Schema.optional<Schema.String>;
1040
1040
  readonly accessToken: Schema.optional<Schema.String>;
1041
1041
  readonly refreshToken: Schema.optional<Schema.String>;
1042
- readonly expiresAt: Schema.optional<Schema.Number>;
1042
+ readonly expiresAt: Schema.optional<Schema.Finite>;
1043
1043
  readonly user: Schema.optional<Schema.Struct<{
1044
1044
  readonly name: Schema.optional<Schema.Struct<{
1045
1045
  readonly firstName: Schema.optional<Schema.String>;
@@ -219,7 +219,9 @@ declare const AuthBadRequest_base: Schema.Class<AuthBadRequest, Schema.TaggedStr
219
219
  error: Schema.optional<Schema.String>;
220
220
  error_description: Schema.optional<Schema.String>;
221
221
  _tag: Schema.withDecodingDefaultKey<Schema.tag<"AuthBadRequest">, never>;
222
- }>, import("effect/Cause").YieldableError>;
222
+ }>, import("effect/Cause").YieldableError & {
223
+ readonly brand: unique symbol;
224
+ }>;
223
225
  export declare class AuthBadRequest extends AuthBadRequest_base {
224
226
  }
225
227
  declare const AuthUnauthorized_base: Schema.Class<AuthUnauthorized, Schema.TaggedStruct<"AuthUnauthorized", {
@@ -228,7 +230,9 @@ declare const AuthUnauthorized_base: Schema.Class<AuthUnauthorized, Schema.Tagge
228
230
  error: Schema.optional<Schema.String>;
229
231
  error_description: Schema.optional<Schema.String>;
230
232
  _tag: Schema.withDecodingDefaultKey<Schema.tag<"AuthUnauthorized">, never>;
231
- }>, import("effect/Cause").YieldableError>;
233
+ }>, import("effect/Cause").YieldableError & {
234
+ readonly brand: unique symbol;
235
+ }>;
232
236
  export declare class AuthUnauthorized extends AuthUnauthorized_base {
233
237
  }
234
238
  declare const AuthForbidden_base: Schema.Class<AuthForbidden, Schema.TaggedStruct<"AuthForbidden", {
@@ -237,7 +241,9 @@ declare const AuthForbidden_base: Schema.Class<AuthForbidden, Schema.TaggedStruc
237
241
  error: Schema.optional<Schema.String>;
238
242
  error_description: Schema.optional<Schema.String>;
239
243
  _tag: Schema.withDecodingDefaultKey<Schema.tag<"AuthForbidden">, never>;
240
- }>, import("effect/Cause").YieldableError>;
244
+ }>, import("effect/Cause").YieldableError & {
245
+ readonly brand: unique symbol;
246
+ }>;
241
247
  export declare class AuthForbidden extends AuthForbidden_base {
242
248
  }
243
249
  declare const AuthNotFound_base: Schema.Class<AuthNotFound, Schema.TaggedStruct<"AuthNotFound", {
@@ -246,7 +252,9 @@ declare const AuthNotFound_base: Schema.Class<AuthNotFound, Schema.TaggedStruct<
246
252
  error: Schema.optional<Schema.String>;
247
253
  error_description: Schema.optional<Schema.String>;
248
254
  _tag: Schema.withDecodingDefaultKey<Schema.tag<"AuthNotFound">, never>;
249
- }>, import("effect/Cause").YieldableError>;
255
+ }>, import("effect/Cause").YieldableError & {
256
+ readonly brand: unique symbol;
257
+ }>;
250
258
  export declare class AuthNotFound extends AuthNotFound_base {
251
259
  }
252
260
  declare const AuthConflict_base: Schema.Class<AuthConflict, Schema.TaggedStruct<"AuthConflict", {
@@ -255,7 +263,9 @@ declare const AuthConflict_base: Schema.Class<AuthConflict, Schema.TaggedStruct<
255
263
  error: Schema.optional<Schema.String>;
256
264
  error_description: Schema.optional<Schema.String>;
257
265
  _tag: Schema.withDecodingDefaultKey<Schema.tag<"AuthConflict">, never>;
258
- }>, import("effect/Cause").YieldableError>;
266
+ }>, import("effect/Cause").YieldableError & {
267
+ readonly brand: unique symbol;
268
+ }>;
259
269
  export declare class AuthConflict extends AuthConflict_base {
260
270
  }
261
271
  declare const AuthExpectationFailed_base: Schema.Class<AuthExpectationFailed, Schema.TaggedStruct<"AuthExpectationFailed", {
@@ -264,7 +274,9 @@ declare const AuthExpectationFailed_base: Schema.Class<AuthExpectationFailed, Sc
264
274
  error: Schema.optional<Schema.String>;
265
275
  error_description: Schema.optional<Schema.String>;
266
276
  _tag: Schema.withDecodingDefaultKey<Schema.tag<"AuthExpectationFailed">, never>;
267
- }>, import("effect/Cause").YieldableError>;
277
+ }>, import("effect/Cause").YieldableError & {
278
+ readonly brand: unique symbol;
279
+ }>;
268
280
  export declare class AuthExpectationFailed extends AuthExpectationFailed_base {
269
281
  }
270
282
  declare const AuthTooManyRequests_base: Schema.Class<AuthTooManyRequests, Schema.TaggedStruct<"AuthTooManyRequests", {
@@ -273,7 +285,9 @@ declare const AuthTooManyRequests_base: Schema.Class<AuthTooManyRequests, Schema
273
285
  error: Schema.optional<Schema.String>;
274
286
  error_description: Schema.optional<Schema.String>;
275
287
  _tag: Schema.withDecodingDefaultKey<Schema.tag<"AuthTooManyRequests">, never>;
276
- }>, import("effect/Cause").YieldableError>;
288
+ }>, import("effect/Cause").YieldableError & {
289
+ readonly brand: unique symbol;
290
+ }>;
277
291
  export declare class AuthTooManyRequests extends AuthTooManyRequests_base {
278
292
  }
279
293
  declare const AuthInternalServerError_base: Schema.Class<AuthInternalServerError, Schema.TaggedStruct<"AuthInternalServerError", {
@@ -282,7 +296,9 @@ declare const AuthInternalServerError_base: Schema.Class<AuthInternalServerError
282
296
  error: Schema.optional<Schema.String>;
283
297
  error_description: Schema.optional<Schema.String>;
284
298
  _tag: Schema.withDecodingDefaultKey<Schema.tag<"AuthInternalServerError">, never>;
285
- }>, import("effect/Cause").YieldableError>;
299
+ }>, import("effect/Cause").YieldableError & {
300
+ readonly brand: unique symbol;
301
+ }>;
286
302
  export declare class AuthInternalServerError extends AuthInternalServerError_base {
287
303
  }
288
304
  export declare const UpdateUserPayload: Schema.Struct<{
@@ -448,7 +464,7 @@ export declare const SocialIdToken: Schema.Struct<{
448
464
  readonly nonce: Schema.optional<Schema.String>;
449
465
  readonly accessToken: Schema.optional<Schema.String>;
450
466
  readonly refreshToken: Schema.optional<Schema.String>;
451
- readonly expiresAt: Schema.optional<Schema.Number>;
467
+ readonly expiresAt: Schema.optional<Schema.Finite>;
452
468
  readonly user: Schema.optional<Schema.Struct<{
453
469
  readonly name: Schema.optional<Schema.Struct<{
454
470
  readonly firstName: Schema.optional<Schema.String>;
@@ -468,7 +484,7 @@ export declare const SignInSocialPayload: Schema.Struct<{
468
484
  readonly nonce: Schema.optional<Schema.String>;
469
485
  readonly accessToken: Schema.optional<Schema.String>;
470
486
  readonly refreshToken: Schema.optional<Schema.String>;
471
- readonly expiresAt: Schema.optional<Schema.Number>;
487
+ readonly expiresAt: Schema.optional<Schema.Finite>;
472
488
  readonly user: Schema.optional<Schema.Struct<{
473
489
  readonly name: Schema.optional<Schema.Struct<{
474
490
  readonly firstName: Schema.optional<Schema.String>;
@@ -901,7 +917,7 @@ export declare const FullAuthOrganization: Schema.Struct<{
901
917
  export declare const GetFullOrganizationQuery: Schema.Struct<{
902
918
  readonly organizationId: Schema.optional<Schema.String>;
903
919
  readonly organizationSlug: Schema.optional<Schema.String>;
904
- readonly membersLimit: Schema.optional<Schema.NumberFromString>;
920
+ readonly membersLimit: Schema.optional<Schema.FiniteFromString>;
905
921
  }>;
906
922
  export declare const SetActiveOrganizationPayload: Schema.Struct<{
907
923
  readonly organizationId: Schema.optional<Schema.NullOr<Schema.String>>;
@@ -926,8 +942,8 @@ export declare const UpdateOrganizationPayload: Schema.Struct<{
926
942
  }>;
927
943
  }>;
928
944
  export declare const OrganizationListMembersQuery: Schema.Struct<{
929
- readonly limit: Schema.optional<Schema.NumberFromString>;
930
- readonly offset: Schema.optional<Schema.NumberFromString>;
945
+ readonly limit: Schema.optional<Schema.FiniteFromString>;
946
+ readonly offset: Schema.optional<Schema.FiniteFromString>;
931
947
  readonly sortBy: Schema.optional<Schema.String>;
932
948
  readonly sortDirection: Schema.optional<Schema.Literals<readonly ["asc", "desc"]>>;
933
949
  readonly filterField: Schema.optional<Schema.String>;
@@ -982,7 +998,7 @@ export declare const OrganizationListMembersResponse: Schema.Struct<{
982
998
  }>, Schema.Unknown, never, never>>>;
983
999
  }>;
984
1000
  }>>;
985
- readonly total: Schema.Number;
1001
+ readonly total: Schema.Finite;
986
1002
  }>;
987
1003
  export declare const InviteMemberPayload: Schema.Struct<{
988
1004
  readonly email: Schema.String;
@@ -1064,7 +1080,7 @@ export declare const OrganizationImpersonateUserPayload: Schema.Struct<{
1064
1080
  readonly organizationId: Schema.NonEmptyString;
1065
1081
  readonly actorUserId: Schema.NonEmptyString;
1066
1082
  readonly targetUserId: Schema.NonEmptyString;
1067
- readonly expiresInSeconds: Schema.optional<Schema.Number>;
1083
+ readonly expiresInSeconds: Schema.optional<Schema.Finite>;
1068
1084
  }>;
1069
1085
  export declare const OrganizationImpersonateUserResponse: Schema.Struct<{
1070
1086
  readonly session: Schema.Struct<{
@@ -1137,15 +1153,15 @@ export declare const AuthApiKey: Schema.Struct<{
1137
1153
  readonly userId: Schema.optional<Schema.String>;
1138
1154
  readonly referenceId: Schema.String;
1139
1155
  readonly configId: Schema.String;
1140
- readonly refillInterval: Schema.NullOr<Schema.Number>;
1141
- readonly refillAmount: Schema.NullOr<Schema.Number>;
1156
+ readonly refillInterval: Schema.NullOr<Schema.Finite>;
1157
+ readonly refillAmount: Schema.NullOr<Schema.Finite>;
1142
1158
  readonly lastRefillAt: Schema.NullOr<Schema.DateFromString>;
1143
1159
  readonly enabled: Schema.Boolean;
1144
1160
  readonly rateLimitEnabled: Schema.Boolean;
1145
- readonly rateLimitTimeWindow: Schema.NullOr<Schema.Number>;
1146
- readonly rateLimitMax: Schema.NullOr<Schema.Number>;
1147
- readonly requestCount: Schema.Number;
1148
- readonly remaining: Schema.NullOr<Schema.Number>;
1161
+ readonly rateLimitTimeWindow: Schema.NullOr<Schema.Finite>;
1162
+ readonly rateLimitMax: Schema.NullOr<Schema.Finite>;
1163
+ readonly requestCount: Schema.Finite;
1164
+ readonly remaining: Schema.NullOr<Schema.Finite>;
1149
1165
  readonly lastRequest: Schema.NullOr<Schema.DateFromString>;
1150
1166
  readonly expiresAt: Schema.NullOr<Schema.DateFromString>;
1151
1167
  readonly createdAt: Schema.DateFromString;
@@ -1157,8 +1173,8 @@ export declare const AuthApiKey: Schema.Struct<{
1157
1173
  export declare const ListApiKeysQuery: Schema.Struct<{
1158
1174
  readonly configId: Schema.optional<Schema.String>;
1159
1175
  readonly organizationId: Schema.optional<Schema.String>;
1160
- readonly limit: Schema.optional<Schema.NumberFromString>;
1161
- readonly offset: Schema.optional<Schema.NumberFromString>;
1176
+ readonly limit: Schema.optional<Schema.FiniteFromString>;
1177
+ readonly offset: Schema.optional<Schema.FiniteFromString>;
1162
1178
  readonly sortBy: Schema.optional<Schema.String>;
1163
1179
  readonly sortDirection: Schema.optional<Schema.Literals<readonly ["asc", "desc"]>>;
1164
1180
  }>;
@@ -1171,15 +1187,15 @@ export declare const ListApiKeysResponse: Schema.Struct<{
1171
1187
  readonly userId: Schema.optional<Schema.String>;
1172
1188
  readonly referenceId: Schema.String;
1173
1189
  readonly configId: Schema.String;
1174
- readonly refillInterval: Schema.NullOr<Schema.Number>;
1175
- readonly refillAmount: Schema.NullOr<Schema.Number>;
1190
+ readonly refillInterval: Schema.NullOr<Schema.Finite>;
1191
+ readonly refillAmount: Schema.NullOr<Schema.Finite>;
1176
1192
  readonly lastRefillAt: Schema.NullOr<Schema.DateFromString>;
1177
1193
  readonly enabled: Schema.Boolean;
1178
1194
  readonly rateLimitEnabled: Schema.Boolean;
1179
- readonly rateLimitTimeWindow: Schema.NullOr<Schema.Number>;
1180
- readonly rateLimitMax: Schema.NullOr<Schema.Number>;
1181
- readonly requestCount: Schema.Number;
1182
- readonly remaining: Schema.NullOr<Schema.Number>;
1195
+ readonly rateLimitTimeWindow: Schema.NullOr<Schema.Finite>;
1196
+ readonly rateLimitMax: Schema.NullOr<Schema.Finite>;
1197
+ readonly requestCount: Schema.Finite;
1198
+ readonly remaining: Schema.NullOr<Schema.Finite>;
1183
1199
  readonly lastRequest: Schema.NullOr<Schema.DateFromString>;
1184
1200
  readonly expiresAt: Schema.NullOr<Schema.DateFromString>;
1185
1201
  readonly createdAt: Schema.DateFromString;
@@ -1188,9 +1204,9 @@ export declare const ListApiKeysResponse: Schema.Struct<{
1188
1204
  readonly permissions: Schema.optional<Schema.NullOr<Schema.$Record<Schema.String, Schema.$Array<Schema.String>>>>;
1189
1205
  readonly referrers: Schema.optional<Schema.NullOr<Schema.$Array<Schema.String>>>;
1190
1206
  }>>;
1191
- readonly total: Schema.Number;
1192
- readonly limit: Schema.optional<Schema.NullOr<Schema.Number>>;
1193
- readonly offset: Schema.optional<Schema.NullOr<Schema.Number>>;
1207
+ readonly total: Schema.Finite;
1208
+ readonly limit: Schema.optional<Schema.NullOr<Schema.Finite>>;
1209
+ readonly offset: Schema.optional<Schema.NullOr<Schema.Finite>>;
1194
1210
  }>;
1195
1211
  export declare const DeleteApiKeyPayload: Schema.Struct<{
1196
1212
  readonly configId: Schema.optional<Schema.String>;
@@ -1203,7 +1219,7 @@ export declare const AdminStopImpersonatingPayload: Schema.Struct<{}>;
1203
1219
  export declare const AdminBanUserPayload: Schema.Struct<{
1204
1220
  readonly userId: Schema.String;
1205
1221
  readonly banReason: Schema.optional<Schema.String>;
1206
- readonly banExpiresIn: Schema.optional<Schema.Number>;
1222
+ readonly banExpiresIn: Schema.optional<Schema.Finite>;
1207
1223
  }>;
1208
1224
  export declare const AdminUserResponse: Schema.Struct<{
1209
1225
  readonly user: Schema.Struct<{
@@ -200,7 +200,7 @@ export const SocialIdToken = Schema.Struct({
200
200
  nonce: Schema.optional(Schema.String),
201
201
  accessToken: Schema.optional(Schema.String),
202
202
  refreshToken: Schema.optional(Schema.String),
203
- expiresAt: Schema.optional(Schema.Number),
203
+ expiresAt: Schema.optional(Schema.Finite),
204
204
  user: Schema.optional(Schema.Struct({
205
205
  name: Schema.optional(Schema.Struct({
206
206
  firstName: Schema.optional(Schema.String),
@@ -428,7 +428,7 @@ export const FullAuthOrganization = Schema.Struct({
428
428
  export const GetFullOrganizationQuery = Schema.Struct({
429
429
  organizationId: Schema.optional(Schema.String),
430
430
  organizationSlug: Schema.optional(Schema.String),
431
- membersLimit: Schema.optional(Schema.NumberFromString),
431
+ membersLimit: Schema.optional(Schema.FiniteFromString),
432
432
  }).annotate({
433
433
  identifier: "GetFullOrganizationQuery",
434
434
  title: "Get full organization query",
@@ -465,8 +465,8 @@ export const UpdateOrganizationPayload = Schema.Struct({
465
465
  title: "Update organization payload",
466
466
  });
467
467
  export const OrganizationListMembersQuery = Schema.Struct({
468
- limit: Schema.optional(Schema.NumberFromString),
469
- offset: Schema.optional(Schema.NumberFromString),
468
+ limit: Schema.optional(Schema.FiniteFromString),
469
+ offset: Schema.optional(Schema.FiniteFromString),
470
470
  sortBy: Schema.optional(Schema.String),
471
471
  sortDirection: Schema.optional(Schema.Literals(["asc", "desc"])),
472
472
  filterField: Schema.optional(Schema.String),
@@ -480,7 +480,7 @@ export const OrganizationListMembersQuery = Schema.Struct({
480
480
  });
481
481
  export const OrganizationListMembersResponse = Schema.Struct({
482
482
  members: Schema.Array(AuthMember),
483
- total: Schema.Number,
483
+ total: Schema.Finite,
484
484
  }).annotate({
485
485
  identifier: "OrganizationListMembersResponse",
486
486
  title: "List organization members response",
@@ -562,7 +562,7 @@ export const OrganizationImpersonateUserPayload = Schema.Struct({
562
562
  organizationId: Schema.NonEmptyString,
563
563
  actorUserId: Schema.NonEmptyString,
564
564
  targetUserId: Schema.NonEmptyString,
565
- expiresInSeconds: Schema.optional(Schema.Number),
565
+ expiresInSeconds: Schema.optional(Schema.Finite),
566
566
  }).annotate({
567
567
  identifier: "OrganizationImpersonateUserPayload",
568
568
  title: "Organization impersonate user payload",
@@ -580,15 +580,15 @@ export const AuthApiKey = Schema.Struct({
580
580
  userId: Schema.optional(Schema.String),
581
581
  referenceId: Schema.String,
582
582
  configId: Schema.String,
583
- refillInterval: Schema.NullOr(Schema.Number),
584
- refillAmount: Schema.NullOr(Schema.Number),
583
+ refillInterval: Schema.NullOr(Schema.Finite),
584
+ refillAmount: Schema.NullOr(Schema.Finite),
585
585
  lastRefillAt: Schema.NullOr(Schema.DateFromString),
586
586
  enabled: Schema.Boolean,
587
587
  rateLimitEnabled: Schema.Boolean,
588
- rateLimitTimeWindow: Schema.NullOr(Schema.Number),
589
- rateLimitMax: Schema.NullOr(Schema.Number),
590
- requestCount: Schema.Number,
591
- remaining: Schema.NullOr(Schema.Number),
588
+ rateLimitTimeWindow: Schema.NullOr(Schema.Finite),
589
+ rateLimitMax: Schema.NullOr(Schema.Finite),
590
+ requestCount: Schema.Finite,
591
+ remaining: Schema.NullOr(Schema.Finite),
592
592
  lastRequest: Schema.NullOr(Schema.DateFromString),
593
593
  expiresAt: Schema.NullOr(Schema.DateFromString),
594
594
  createdAt: Schema.DateFromString,
@@ -600,16 +600,16 @@ export const AuthApiKey = Schema.Struct({
600
600
  export const ListApiKeysQuery = Schema.Struct({
601
601
  configId: Schema.optional(Schema.String),
602
602
  organizationId: Schema.optional(Schema.String),
603
- limit: Schema.optional(Schema.NumberFromString),
604
- offset: Schema.optional(Schema.NumberFromString),
603
+ limit: Schema.optional(Schema.FiniteFromString),
604
+ offset: Schema.optional(Schema.FiniteFromString),
605
605
  sortBy: Schema.optional(Schema.String),
606
606
  sortDirection: Schema.optional(Schema.Literals(["asc", "desc"])),
607
607
  }).annotate({ identifier: "ListApiKeysQuery", title: "List API keys query" });
608
608
  export const ListApiKeysResponse = Schema.Struct({
609
609
  apiKeys: Schema.Array(AuthApiKey),
610
- total: Schema.Number,
611
- limit: Schema.optional(Schema.NullOr(Schema.Number)),
612
- offset: Schema.optional(Schema.NullOr(Schema.Number)),
610
+ total: Schema.Finite,
611
+ limit: Schema.optional(Schema.NullOr(Schema.Finite)),
612
+ offset: Schema.optional(Schema.NullOr(Schema.Finite)),
613
613
  }).annotate({
614
614
  identifier: "ListApiKeysResponse",
615
615
  title: "List API keys response",
@@ -634,7 +634,7 @@ export const AdminStopImpersonatingPayload = Schema.Struct({}).annotate({
634
634
  export const AdminBanUserPayload = Schema.Struct({
635
635
  userId: Schema.String,
636
636
  banReason: Schema.optional(Schema.String),
637
- banExpiresIn: Schema.optional(Schema.Number),
637
+ banExpiresIn: Schema.optional(Schema.Finite),
638
638
  }).annotate({ identifier: "AdminBanUserPayload", title: "Ban user payload" });
639
639
  export const AdminUserResponse = Schema.Struct({ user: AuthUser }).annotate({
640
640
  identifier: "AdminUserResponse",
@@ -90,9 +90,9 @@ const makeOrganizationForm = ({ baseUrl, organization, }) => FormReact.make(orga
90
90
  slug: slugify(decoded.slug || decoded.name),
91
91
  logo: logo ?? undefined,
92
92
  };
93
- const payload = Schema.decodeUnknownSync(AdminCreateOrganizationPayload)(decoded.parentId === noParentOrganization
93
+ const payload = yield* Schema.decodeEffect(AdminCreateOrganizationPayload)(decoded.parentId === noParentOrganization
94
94
  ? input
95
- : { ...input, parentId: decoded.parentId });
95
+ : { ...input, parentId: decoded.parentId }).pipe(Effect.orDie);
96
96
  const saved = organization
97
97
  ? yield* http.admin.updateOrganization({
98
98
  params: { id: organization.id },
@@ -13,6 +13,7 @@ import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent,
13
13
  import { AdminListQuery } from "../admin/schema.js";
14
14
  import { normalizeOrganizationRoles } from "../roles.js";
15
15
  import { AdminOrganizationForm } from "./admin-organization-form.js";
16
+ import { ProjectCardList } from "./project-card-list.js";
16
17
  import { deletionControlsEnabled } from "./deletion-visibility.js";
17
18
  import { authClientApi, authHttpClient } from "./auth-client-api.js";
18
19
  import { useKrakstackAuth } from "./auth-provider.js";
@@ -99,7 +100,7 @@ const organizationDisplay = (organization, locale, baseUrl) => {
99
100
  };
100
101
  const AdminOrganizationsFamilyKey = Schema.fromJsonString(Schema.Struct({
101
102
  query: AdminListQuery,
102
- reloadKey: Schema.Number,
103
+ reloadKey: Schema.Finite,
103
104
  })).annotate({ identifier: "AdminOrganizationsFamilyKey" });
104
105
  const organizationsQuery = (search, projectId) => projectId ? { ...search, projectId } : search;
105
106
  const adminOrganizationsFamilyKey = (search, projectId, reloadKey) => JSON.stringify({
@@ -107,7 +108,7 @@ const adminOrganizationsFamilyKey = (search, projectId, reloadKey) => JSON.strin
107
108
  reloadKey,
108
109
  });
109
110
  const organizationsAtom = Atom.family((baseUrl) => Atom.family((key) => {
110
- const { query, reloadKey } = Schema.decodeUnknownSync(AdminOrganizationsFamilyKey)(key);
111
+ const { query, reloadKey } = Schema.decodeSync(AdminOrganizationsFamilyKey)(key);
111
112
  return authClientApi(baseUrl).query("admin", "listOrganizations", {
112
113
  query,
113
114
  timeToLive: "1 minute",
@@ -166,7 +167,7 @@ export function AdminOrganizationsTable({ messages: messageOverrides, onSearchCh
166
167
  projectId,
167
168
  reloadKey,
168
169
  refreshKey: 0,
169
- search: search ?? Schema.decodeUnknownSync(Query)({}),
170
+ search: search ?? Schema.decodeSync(Query)({}),
170
171
  }));
171
172
  const setTableRequest = useAtomSet(tableAtoms.requestAtom);
172
173
  const tableRequest = useAtomValue(tableAtoms.requestAtom);
@@ -226,7 +227,7 @@ export function AdminOrganizationsTable({ messages: messageOverrides, onSearchCh
226
227
  ],
227
228
  },
228
229
  }, state: tableRequest.search, onStateChange: ({ page, pageSize, globalFilter, sort, filters }) => {
229
- const nextSearch = Schema.decodeUnknownSync(Query)({
230
+ const nextSearch = Schema.decodeSync(Query)({
230
231
  page,
231
232
  pageSize,
232
233
  globalFilter,
@@ -357,7 +358,7 @@ function DeleteOrganizationDialog({ baseUrl, labels: m, organization, onClose, o
357
358
  ? Cause.squash(result.cause)
358
359
  : undefined;
359
360
  const isPending = !AsyncResult.isInitial(result) && result.waiting;
360
- return (_jsx(AlertDialog, { open: true, onOpenChange: (open) => !open && onClose(), children: _jsxs(AlertDialogContent, { children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: m.organization_delete_title }), _jsx(AlertDialogDescription, { children: m.organization_delete_description.replace("{name}", organization.name) })] }), error ? (_jsx(ErrorMessage, { text: error instanceof Error
361
+ return (_jsx(AlertDialog, { open: true, onOpenChange: (open) => !open && onClose(), children: _jsxs(AlertDialogContent, { className: "max-h-[85vh] overflow-y-auto sm:max-w-xl", children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: m.organization_delete_title }), _jsx(AlertDialogDescription, { children: m.organization_delete_description.replace("{name}", organization.name) })] }), organization.projects?.length ? (_jsxs("section", { className: "space-y-2", children: [_jsxs("h3", { className: "text-muted-foreground text-xs font-medium", children: [m.admin_column_projects, " ", _jsx("span", { className: "ml-1 tabular-nums", children: organization.projects.length })] }), _jsx(ProjectCardList, { projects: organization.projects })] })) : null, error ? (_jsx(ErrorMessage, { text: error instanceof Error
361
362
  ? error.message
362
363
  : m.organization_delete_error })) : null, _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { disabled: isPending, children: m.organization_delete_cancel }), _jsx(AlertDialogAction, { disabled: isPending, onClick: (event) => {
363
364
  event.preventDefault();
@@ -83,12 +83,12 @@ const initials = (name) => name
83
83
  const text = (value, params) => Object.entries(params ?? {}).reduce((current, [key, replacement]) => current.replace(`{${key}}`, replacement), value);
84
84
  const AdminUsersFamilyKey = Schema.fromJsonString(Schema.Struct({
85
85
  query: AdminListQuery,
86
- reloadKey: Schema.Number,
86
+ reloadKey: Schema.Finite,
87
87
  })).annotate({ identifier: "AdminUsersFamilyKey" });
88
88
  const adminUsersQuery = (search, projectId) => projectId ? { ...search, projectId } : search;
89
89
  const adminUsersFamilyKey = (search, projectId, reloadKey) => JSON.stringify({ query: adminUsersQuery(search, projectId), reloadKey });
90
90
  const usersAtom = Atom.family((baseUrl) => Atom.family((key) => {
91
- const { query, reloadKey } = Schema.decodeUnknownSync(AdminUsersFamilyKey)(key);
91
+ const { query, reloadKey } = Schema.decodeSync(AdminUsersFamilyKey)(key);
92
92
  return authClientApi(baseUrl).query("admin", "listUsers", {
93
93
  query,
94
94
  timeToLive: "1 minute",
@@ -118,7 +118,7 @@ export function AdminUsersTable({ onSearchChange, reloadKey = 0, search, }) {
118
118
  projectId,
119
119
  reloadKey,
120
120
  refreshKey: 0,
121
- search: search ?? Schema.decodeUnknownSync(Query)({}),
121
+ search: search ?? Schema.decodeSync(Query)({}),
122
122
  }));
123
123
  const setTableRequest = useAtomSet(tableAtoms.requestAtom);
124
124
  const tableRequest = useAtomValue(tableAtoms.requestAtom);
@@ -200,7 +200,7 @@ export function AdminUsersTable({ onSearchChange, reloadKey = 0, search, }) {
200
200
  ],
201
201
  },
202
202
  }, state: tableRequest.search, onStateChange: ({ page, pageSize, globalFilter, sort, filters }) => {
203
- const nextSearch = Schema.decodeUnknownSync(Query)({
203
+ const nextSearch = Schema.decodeSync(Query)({
204
204
  page,
205
205
  pageSize,
206
206
  globalFilter,
@@ -322,8 +322,8 @@ const userColumns = (m, baseUrl) => [
322
322
  },
323
323
  ];
324
324
  function BanUserDialog({ labels: m, baseUrl, user, onBanned, onClose, }) {
325
- const [banUserAtom] = useState(() => authClientApi(baseUrl).runtime.fn((userId) => Effect.flatMap(authHttpClient(baseUrl), (client) => client.auth.adminBanUser({ payload: { userId } })).pipe(Effect.tap(() => Effect.sync(onBanned)), Effect.tap(() => Effect.sync(onClose)), Effect.catch((cause) => Effect.sync(() => setError(cause instanceof Error ? cause.message : m.admin_error_ban))))));
326
325
  const [error, setError] = useState("");
326
+ const [banUserAtom] = useState(() => authClientApi(baseUrl).runtime.fn((userId) => Effect.flatMap(authHttpClient(baseUrl), (client) => client.auth.adminBanUser({ payload: { userId } })).pipe(Effect.tap(() => Effect.sync(onBanned)), Effect.tap(() => Effect.sync(onClose)), Effect.catch((cause) => Effect.sync(() => setError(cause instanceof Error ? cause.message : m.admin_error_ban))))));
327
327
  const banUser = useAtomSet(banUserAtom);
328
328
  const isPending = useAtomValue(banUserAtom).waiting;
329
329
  return (_jsx(AlertDialog, { open: true, onOpenChange: (open) => !open && onClose(), children: _jsxs(AlertDialogContent, { children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: m.admin_ban_title }), _jsx(AlertDialogDescription, { children: text(m.admin_ban_description, {
@@ -335,8 +335,8 @@ function BanUserDialog({ labels: m, baseUrl, user, onBanned, onClose, }) {
335
335
  }, disabled: isPending, children: [isPending ? (_jsx(Loader2, { className: "animate-spin", "data-icon": "inline-start" })) : null, m.admin_action_ban] })] })] }) }));
336
336
  }
337
337
  function UnbanUserDialog({ labels: m, baseUrl, user, onUnbanned, onClose, }) {
338
- const [unbanUserAtom] = useState(() => authClientApi(baseUrl).runtime.fn((userId) => Effect.flatMap(authHttpClient(baseUrl), (client) => client.auth.adminUnbanUser({ payload: { userId } })).pipe(Effect.tap(() => Effect.sync(onUnbanned)), Effect.tap(() => Effect.sync(onClose)), Effect.catch((cause) => Effect.sync(() => setError(cause instanceof Error ? cause.message : m.admin_error_unban))))));
339
338
  const [error, setError] = useState("");
339
+ const [unbanUserAtom] = useState(() => authClientApi(baseUrl).runtime.fn((userId) => Effect.flatMap(authHttpClient(baseUrl), (client) => client.auth.adminUnbanUser({ payload: { userId } })).pipe(Effect.tap(() => Effect.sync(onUnbanned)), Effect.tap(() => Effect.sync(onClose)), Effect.catch((cause) => Effect.sync(() => setError(cause instanceof Error ? cause.message : m.admin_error_unban))))));
340
340
  const unbanUser = useAtomSet(unbanUserAtom);
341
341
  const isPending = useAtomValue(unbanUserAtom).waiting;
342
342
  return (_jsx(AlertDialog, { open: true, onOpenChange: (open) => !open && onClose(), children: _jsxs(AlertDialogContent, { children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: m.admin_unban_title }), _jsx(AlertDialogDescription, { children: text(m.admin_unban_description, {
@@ -1,14 +1,18 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as Data from "effect/Data";
2
3
  import { useAtomSet, useAtomValue } from "@effect/atom-react";
3
4
  import { FormBuilder, FormReact } from "@lucas-barake/effect-form-react";
4
5
  import { Effect, Schema } from "effect";
5
- import { useRef, useState } from "react";
6
+ import { useState } from "react";
7
+ import { useLatestAtom } from "./hooks.js";
6
8
  import { CheckboxField, SubmitButton, SubmitError, TextAreaField, TextField, } from "@krak-stack/registry/effect-form";
7
9
  import { parseApiKeyReferrers } from "./api-key.js";
8
10
  import { authClientApi, authHttpClient } from "./auth-client-api.js";
9
11
  import { ApiKeyPermissions } from "./api-key-permissions.js";
10
12
  import { apiKeyReferrers } from "./api-key-referrers.js";
11
13
  import { ExtraApiKeyPermissions } from "../extra/schema.js";
14
+ class ApiKeyEditError extends Data.TaggedError("ApiKeyEditError") {
15
+ }
12
16
  const editApiKeyFormBuilder = FormBuilder.empty
13
17
  .addField("name", Schema.NonEmptyString)
14
18
  .addField("enabled", Schema.Boolean)
@@ -24,16 +28,14 @@ export const ApiKeyEditForm = ({ baseUrl, configId, keyData, messages, permissio
24
28
  project,
25
29
  action,
26
30
  })));
27
- const currentPermissions = Schema.decodeUnknownOption(ExtraApiKeyPermissions)(keyData.permissions ?? {});
31
+ const currentPermissions = Schema.decodeOption(ExtraApiKeyPermissions)(keyData.permissions ?? {});
28
32
  const currentGrant = currentPermissions._tag === "Some" ? currentPermissions.value : {};
29
33
  const initialSelectedPermissions = Object.fromEntries(permissionOptions.map((option) => [
30
34
  option.id,
31
35
  currentGrant[option.project]?.includes(option.action) ?? false,
32
36
  ]));
33
- const permissionOptionsRef = useRef(permissionOptions);
34
- const permissionsRef = useRef(permissions);
35
- permissionOptionsRef.current = permissionOptions;
36
- permissionsRef.current = permissions;
37
+ const permissionOptionsAtom = useLatestAtom(permissionOptions);
38
+ const permissionsAtom = useLatestAtom(permissions);
37
39
  const [form] = useState(() => FormReact.make(editApiKeyFormBuilder, {
38
40
  runtime: authClientApi(baseUrl).runtime,
39
41
  fields: {
@@ -43,16 +45,19 @@ export const ApiKeyEditForm = ({ baseUrl, configId, keyData, messages, permissio
43
45
  permissions: ApiKeyPermissionsField,
44
46
  },
45
47
  mode: { validation: "onSubmit" },
46
- onSubmit: (_, { decoded }) => Effect.gen(function* () {
48
+ onSubmit: (_, { decoded, get }) => Effect.gen(function* () {
47
49
  const referrers = yield* Effect.try({
48
50
  try: () => parseApiKeyReferrers(decoded.referrers, messages.referrersError),
49
- catch: (cause) => cause instanceof Error ? cause : new Error(messages.updateError),
51
+ catch: (cause) => new ApiKeyEditError({
52
+ message: cause instanceof Error ? cause.message : messages.updateError,
53
+ cause: cause,
54
+ }),
50
55
  });
51
56
  const selectedGrant = {};
52
- for (const project of Object.keys(permissionsRef.current)) {
57
+ for (const project of Object.keys(get(permissionsAtom))) {
53
58
  selectedGrant[project] = [];
54
59
  }
55
- for (const option of permissionOptionsRef.current) {
60
+ for (const option of get(permissionOptionsAtom)) {
56
61
  if (!decoded.permissions[option.id])
57
62
  continue;
58
63
  selectedGrant[option.project] = [
@@ -73,7 +78,10 @@ export const ApiKeyEditForm = ({ baseUrl, configId, keyData, messages, permissio
73
78
  });
74
79
  yield* Effect.sync(onSaved);
75
80
  return updated;
76
- }).pipe(Effect.mapError((cause) => cause instanceof Error ? cause : new Error(messages.updateError))),
81
+ }).pipe(Effect.mapError((cause) => new ApiKeyEditError({
82
+ message: cause instanceof Error ? cause.message : messages.updateError,
83
+ cause: cause,
84
+ }))),
77
85
  }));
78
86
  const submit = useAtomSet(form.submit);
79
87
  const submitResult = useAtomValue(form.submit);
@@ -1,5 +1,6 @@
1
- export declare const AssociatedProjectsNotice: ({ baseUrl, getSummary, organizationId, viewLabel, }: {
1
+ export declare const AssociatedProjectsNotice: ({ baseUrl, expanded, getSummary, organizationId, viewLabel, }: {
2
2
  baseUrl?: string | undefined;
3
+ expanded?: boolean;
3
4
  getSummary: (count: number) => string;
4
5
  organizationId?: string | null;
5
6
  viewLabel: string;