@krak-stack/auth 0.2.8 → 0.2.9

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.
@@ -89,6 +89,7 @@ export declare const AdminApiGroup: HttpApiGroup.HttpApiGroup<"admin", HttpApiEn
89
89
  readonly lastRequest: Schema.NullOr<Schema.Date>;
90
90
  readonly expiresAt: Schema.NullOr<Schema.Date>;
91
91
  readonly referrers: Schema.$Array<Schema.String>;
92
+ readonly permissions: Schema.$Record<Schema.String, Schema.$Array<Schema.String>>;
92
93
  readonly createdAt: Schema.Date;
93
94
  readonly updatedAt: Schema.Date;
94
95
  }>>, Schema.toCodecJson<typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.NotFound | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"deleteDomain", "DELETE", "/admin/domains/:id", Schema.toCodecStringTree<Schema.Struct<{
@@ -148,6 +149,7 @@ export declare const AdminApiGroup: HttpApiGroup.HttpApiGroup<"admin", HttpApiEn
148
149
  readonly lastRequest: Schema.NullOr<Schema.Date>;
149
150
  readonly expiresAt: Schema.NullOr<Schema.Date>;
150
151
  readonly referrers: Schema.$Array<Schema.String>;
152
+ readonly permissions: Schema.$Record<Schema.String, Schema.$Array<Schema.String>>;
151
153
  readonly createdAt: Schema.Date;
152
154
  readonly updatedAt: Schema.Date;
153
155
  }>>, Schema.toCodecJson<typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.NotFound | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"enableApiKeyRateLimit", "POST", "/admin/api-keys/:id/enable-rate-limit", Schema.toCodecStringTree<Schema.Struct<{
@@ -168,6 +170,7 @@ export declare const AdminApiGroup: HttpApiGroup.HttpApiGroup<"admin", HttpApiEn
168
170
  readonly lastRequest: Schema.NullOr<Schema.Date>;
169
171
  readonly expiresAt: Schema.NullOr<Schema.Date>;
170
172
  readonly referrers: Schema.$Array<Schema.String>;
173
+ readonly permissions: Schema.$Record<Schema.String, Schema.$Array<Schema.String>>;
171
174
  readonly createdAt: Schema.Date;
172
175
  readonly updatedAt: Schema.Date;
173
176
  }>>, Schema.toCodecJson<typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.NotFound | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getDomainRecords", "GET", "/admin/domains/:id/records", Schema.toCodecStringTree<Schema.Struct<{
@@ -194,6 +197,7 @@ export declare const AdminApiGroup: HttpApiGroup.HttpApiGroup<"admin", HttpApiEn
194
197
  readonly lastRequest: Schema.NullOr<Schema.Date>;
195
198
  readonly expiresAt: Schema.NullOr<Schema.Date>;
196
199
  readonly referrers: Schema.$Array<Schema.String>;
200
+ readonly permissions: Schema.$Record<Schema.String, Schema.$Array<Schema.String>>;
197
201
  readonly createdAt: Schema.Date;
198
202
  readonly updatedAt: Schema.Date;
199
203
  }>>>, Schema.toCodecJson<typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"listDomains", "GET", "/admin/domains", never, never, never, never, Schema.toCodecJson<Schema.$Array<Schema.Struct<{
@@ -305,6 +309,7 @@ export declare const AdminApiGroup: HttpApiGroup.HttpApiGroup<"admin", HttpApiEn
305
309
  readonly lastRequest: Schema.NullOr<Schema.Date>;
306
310
  readonly expiresAt: Schema.NullOr<Schema.Date>;
307
311
  readonly referrers: Schema.$Array<Schema.String>;
312
+ readonly permissions: Schema.$Record<Schema.String, Schema.$Array<Schema.String>>;
308
313
  readonly createdAt: Schema.Date;
309
314
  readonly updatedAt: Schema.Date;
310
315
  }>>, Schema.toCodecJson<typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.NotFound | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"updateApiKey", "PATCH", "/admin/api-keys/:id", Schema.toCodecStringTree<Schema.Struct<{
@@ -332,6 +337,7 @@ export declare const AdminApiGroup: HttpApiGroup.HttpApiGroup<"admin", HttpApiEn
332
337
  readonly lastRequest: Schema.NullOr<Schema.Date>;
333
338
  readonly expiresAt: Schema.NullOr<Schema.Date>;
334
339
  readonly referrers: Schema.$Array<Schema.String>;
340
+ readonly permissions: Schema.$Record<Schema.String, Schema.$Array<Schema.String>>;
335
341
  readonly createdAt: Schema.Date;
336
342
  readonly updatedAt: Schema.Date;
337
343
  }>>, Schema.toCodecJson<typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.NotFound | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"updateDomain", "PATCH", "/admin/domains/:id", Schema.toCodecStringTree<Schema.Struct<{
@@ -91,6 +91,7 @@ export declare const AdminApiKey: Schema.Struct<{
91
91
  readonly lastRequest: Schema.NullOr<Schema.Date>;
92
92
  readonly expiresAt: Schema.NullOr<Schema.Date>;
93
93
  readonly referrers: Schema.$Array<Schema.String>;
94
+ readonly permissions: Schema.$Record<Schema.String, Schema.$Array<Schema.String>>;
94
95
  readonly createdAt: Schema.Date;
95
96
  readonly updatedAt: Schema.Date;
96
97
  }>;
@@ -1,4 +1,5 @@
1
1
  import { Schema } from "effect";
2
+ import { ApiKeyPermissionGrant } from "../access.js";
2
3
  import { PaginatedResponse, Query } from "../query.js";
3
4
  import { ServerCreateDomainPayload, ServerDomain, ServerDomainIdParams, ServerDomainRecordsResponse, ServerUpdateDomainPayload, } from "../server/schema.js";
4
5
  export const AdminListQuery = Schema.Struct({
@@ -137,6 +138,7 @@ export const AdminApiKey = Schema.Struct({
137
138
  lastRequest: Schema.NullOr(Schema.Date),
138
139
  expiresAt: Schema.NullOr(Schema.Date),
139
140
  referrers: Schema.Array(Schema.String),
141
+ permissions: ApiKeyPermissionGrant,
140
142
  createdAt: Schema.Date,
141
143
  updatedAt: Schema.Date,
142
144
  }).annotate({
@@ -160,6 +162,7 @@ export const AdminApiKey = Schema.Struct({
160
162
  lastRequest: null,
161
163
  expiresAt: null,
162
164
  referrers: ["https://app.example.com"],
165
+ permissions: { "project-id": ["auth:proxy"] },
163
166
  createdAt: new Date("2026-01-01T00:00:00.000Z"),
164
167
  updatedAt: new Date("2026-01-01T00:00:00.000Z"),
165
168
  },
package/dist/api.d.ts CHANGED
@@ -1074,7 +1074,7 @@ export declare const AuthServiceApi: HttpApi.HttpApi<"AuthServiceApi", import("e
1074
1074
  readonly updatedAt: import("effect/Schema").DateFromString;
1075
1075
  }>>;
1076
1076
  readonly status: import("effect/Schema").optional<import("effect/Schema").Boolean>;
1077
- }>>, import("effect/Schema").toCodecJson<typeof import("./auth/schema.js").AuthBadRequest>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"signOut", "POST", "/api/auth/sign-out", never, never, never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
1077
+ }>>, import("effect/Schema").toCodecJson<typeof import("./auth/schema.js").AuthBadRequest>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"signOut", "POST", "/api/auth/sign-out", never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{}>>, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
1078
1078
  readonly success: import("effect/Schema").Boolean;
1079
1079
  }>>, import("effect/Schema").toCodecJson<typeof import("./auth/schema.js").AuthBadRequest>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"twoFactorDisable", "POST", "/api/auth/two-factor/disable", never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
1080
1080
  readonly password: import("effect/Schema").optional<import("effect/Schema").String>;
@@ -2024,6 +2024,7 @@ export declare const AuthClientApi: HttpApi.HttpApi<"AuthClientApi", import("eff
2024
2024
  readonly lastRequest: import("effect/Schema").NullOr<import("effect/Schema").Date>;
2025
2025
  readonly expiresAt: import("effect/Schema").NullOr<import("effect/Schema").Date>;
2026
2026
  readonly referrers: import("effect/Schema").$Array<import("effect/Schema").String>;
2027
+ readonly permissions: import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>>;
2027
2028
  readonly createdAt: import("effect/Schema").Date;
2028
2029
  readonly updatedAt: import("effect/Schema").Date;
2029
2030
  }>>, import("effect/Schema").toCodecJson<typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").NotFound | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"deleteDomain", "DELETE", "/api/auth/admin/domains/:id", import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
@@ -2083,6 +2084,7 @@ export declare const AuthClientApi: HttpApi.HttpApi<"AuthClientApi", import("eff
2083
2084
  readonly lastRequest: import("effect/Schema").NullOr<import("effect/Schema").Date>;
2084
2085
  readonly expiresAt: import("effect/Schema").NullOr<import("effect/Schema").Date>;
2085
2086
  readonly referrers: import("effect/Schema").$Array<import("effect/Schema").String>;
2087
+ readonly permissions: import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>>;
2086
2088
  readonly createdAt: import("effect/Schema").Date;
2087
2089
  readonly updatedAt: import("effect/Schema").Date;
2088
2090
  }>>, import("effect/Schema").toCodecJson<typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").NotFound | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"enableApiKeyRateLimit", "POST", "/api/auth/admin/api-keys/:id/enable-rate-limit", import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
@@ -2103,6 +2105,7 @@ export declare const AuthClientApi: HttpApi.HttpApi<"AuthClientApi", import("eff
2103
2105
  readonly lastRequest: import("effect/Schema").NullOr<import("effect/Schema").Date>;
2104
2106
  readonly expiresAt: import("effect/Schema").NullOr<import("effect/Schema").Date>;
2105
2107
  readonly referrers: import("effect/Schema").$Array<import("effect/Schema").String>;
2108
+ readonly permissions: import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>>;
2106
2109
  readonly createdAt: import("effect/Schema").Date;
2107
2110
  readonly updatedAt: import("effect/Schema").Date;
2108
2111
  }>>, import("effect/Schema").toCodecJson<typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").NotFound | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"getDomainRecords", "GET", "/api/auth/admin/domains/:id/records", import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
@@ -2129,6 +2132,7 @@ export declare const AuthClientApi: HttpApi.HttpApi<"AuthClientApi", import("eff
2129
2132
  readonly lastRequest: import("effect/Schema").NullOr<import("effect/Schema").Date>;
2130
2133
  readonly expiresAt: import("effect/Schema").NullOr<import("effect/Schema").Date>;
2131
2134
  readonly referrers: import("effect/Schema").$Array<import("effect/Schema").String>;
2135
+ readonly permissions: import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>>;
2132
2136
  readonly createdAt: import("effect/Schema").Date;
2133
2137
  readonly updatedAt: import("effect/Schema").Date;
2134
2138
  }>>>, import("effect/Schema").toCodecJson<typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"listDomains", "GET", "/api/auth/admin/domains", never, never, never, never, import("effect/Schema").toCodecJson<import("effect/Schema").$Array<import("effect/Schema").Struct<{
@@ -2240,6 +2244,7 @@ export declare const AuthClientApi: HttpApi.HttpApi<"AuthClientApi", import("eff
2240
2244
  readonly lastRequest: import("effect/Schema").NullOr<import("effect/Schema").Date>;
2241
2245
  readonly expiresAt: import("effect/Schema").NullOr<import("effect/Schema").Date>;
2242
2246
  readonly referrers: import("effect/Schema").$Array<import("effect/Schema").String>;
2247
+ readonly permissions: import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>>;
2243
2248
  readonly createdAt: import("effect/Schema").Date;
2244
2249
  readonly updatedAt: import("effect/Schema").Date;
2245
2250
  }>>, import("effect/Schema").toCodecJson<typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").NotFound | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"updateApiKey", "PATCH", "/api/auth/admin/api-keys/:id", import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
@@ -2267,6 +2272,7 @@ export declare const AuthClientApi: HttpApi.HttpApi<"AuthClientApi", import("eff
2267
2272
  readonly lastRequest: import("effect/Schema").NullOr<import("effect/Schema").Date>;
2268
2273
  readonly expiresAt: import("effect/Schema").NullOr<import("effect/Schema").Date>;
2269
2274
  readonly referrers: import("effect/Schema").$Array<import("effect/Schema").String>;
2275
+ readonly permissions: import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>>;
2270
2276
  readonly createdAt: import("effect/Schema").Date;
2271
2277
  readonly updatedAt: import("effect/Schema").Date;
2272
2278
  }>>, import("effect/Schema").toCodecJson<typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").NotFound | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"updateDomain", "PATCH", "/api/auth/admin/domains/:id", import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
@@ -3394,7 +3400,7 @@ export declare const AuthClientApi: HttpApi.HttpApi<"AuthClientApi", import("eff
3394
3400
  readonly updatedAt: import("effect/Schema").DateFromString;
3395
3401
  }>>;
3396
3402
  readonly status: import("effect/Schema").optional<import("effect/Schema").Boolean>;
3397
- }>>, import("effect/Schema").toCodecJson<typeof import("./auth/schema.js").AuthBadRequest>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"signOut", "POST", "/api/auth/sign-out", never, never, never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
3403
+ }>>, import("effect/Schema").toCodecJson<typeof import("./auth/schema.js").AuthBadRequest>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"signOut", "POST", "/api/auth/sign-out", never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{}>>, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
3398
3404
  readonly success: import("effect/Schema").Boolean;
3399
3405
  }>>, import("effect/Schema").toCodecJson<typeof import("./auth/schema.js").AuthBadRequest>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"twoFactorDisable", "POST", "/api/auth/two-factor/disable", never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
3400
3406
  readonly password: import("effect/Schema").optional<import("effect/Schema").String>;
@@ -1077,7 +1077,7 @@ export declare const AuthApiGroup: HttpApiGroup.HttpApiGroup<"auth", HttpApiEndp
1077
1077
  readonly updatedAt: Schema.DateFromString;
1078
1078
  }>>;
1079
1079
  readonly status: Schema.optional<Schema.Boolean>;
1080
- }>>, Schema.toCodecJson<typeof AuthBadRequest>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"signOut", "POST", "/sign-out", never, never, never, never, Schema.toCodecJson<Schema.Struct<{
1080
+ }>>, Schema.toCodecJson<typeof AuthBadRequest>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"signOut", "POST", "/sign-out", never, never, Schema.toCodecJson<Schema.Struct<{}>>, never, Schema.toCodecJson<Schema.Struct<{
1081
1081
  readonly success: Schema.Boolean;
1082
1082
  }>>, Schema.toCodecJson<typeof AuthBadRequest>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"twoFactorDisable", "POST", "/two-factor/disable", never, never, Schema.toCodecJson<Schema.Struct<{
1083
1083
  readonly password: Schema.optional<Schema.String>;
@@ -1,6 +1,6 @@
1
1
  import { Schema } from "effect";
2
2
  import { HttpApiEndpoint, HttpApiGroup, OpenApi, } from "effect/unstable/httpapi";
3
- import { AdminBanUserPayload, 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, SocialRedirectResponse, TwoFactorBackupVerifyPayload, TwoFactorDisablePayload, TwoFactorEnablePayload, TwoFactorEnableResponse, TwoFactorSendPayload, TwoFactorVerifyPayload, UnlinkAccountPayload, UpdateMemberRolePayload, UpdateOrganizationPayload, UpdateUserPayload, UserInvitationsQuery, VerifyEmailOtpPayload, VerifyEmailOtpResponse, } from "./schema.js";
3
+ import { AdminBanUserPayload, 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 = [
6
6
  AuthBadRequest,
@@ -20,6 +20,7 @@ export const AuthApiGroup = HttpApiGroup.make("auth")
20
20
  error: errors,
21
21
  }).annotateMerge(docs("Get session", "Returns the current browser session.")))
22
22
  .add(HttpApiEndpoint.post("signOut", "/sign-out", {
23
+ payload: SignOutPayload,
23
24
  success: AuthSuccessResponse,
24
25
  error: errors,
25
26
  }).annotateMerge(docs("Sign out", "Ends the current browser session.")))
@@ -190,6 +190,7 @@ export declare const GetSessionQuery: Schema.Struct<{
190
190
  export declare const AuthStatusResponse: Schema.Struct<{
191
191
  readonly status: Schema.Boolean;
192
192
  }>;
193
+ export declare const SignOutPayload: Schema.Struct<{}>;
193
194
  export declare const AuthSuccessResponse: Schema.Struct<{
194
195
  readonly success: Schema.Boolean;
195
196
  }>;
@@ -61,6 +61,9 @@ export const GetSessionQuery = Schema.Struct({
61
61
  export const AuthStatusResponse = Schema.Struct({
62
62
  status: Schema.Boolean,
63
63
  }).annotate({ identifier: "AuthStatusResponse", title: "Status response" });
64
+ export const SignOutPayload = Schema.Struct({}).annotate({
65
+ identifier: "SignOutPayload",
66
+ });
64
67
  export const AuthSuccessResponse = Schema.Struct({
65
68
  success: Schema.Boolean,
66
69
  }).annotate({ identifier: "AuthSuccessResponse", title: "Success response" });
@@ -95,6 +95,7 @@ export declare const authHttpClient: (baseUrl?: string | undefined) => Effect.Ef
95
95
  readonly lastRequest: import("effect/Schema").NullOr<import("effect/Schema").Date>;
96
96
  readonly expiresAt: import("effect/Schema").NullOr<import("effect/Schema").Date>;
97
97
  readonly referrers: import("effect/Schema").$Array<import("effect/Schema").String>;
98
+ readonly permissions: import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>>;
98
99
  readonly createdAt: import("effect/Schema").Date;
99
100
  readonly updatedAt: import("effect/Schema").Date;
100
101
  }>>, import("effect/Schema").toCodecJson<typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").NotFound | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError>, never, never>, never, never>;
@@ -157,6 +158,7 @@ export declare const authHttpClient: (baseUrl?: string | undefined) => Effect.Ef
157
158
  readonly lastRequest: import("effect/Schema").NullOr<import("effect/Schema").Date>;
158
159
  readonly expiresAt: import("effect/Schema").NullOr<import("effect/Schema").Date>;
159
160
  readonly referrers: import("effect/Schema").$Array<import("effect/Schema").String>;
161
+ readonly permissions: import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>>;
160
162
  readonly createdAt: import("effect/Schema").Date;
161
163
  readonly updatedAt: import("effect/Schema").Date;
162
164
  }>>, import("effect/Schema").toCodecJson<typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").NotFound | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError>, never, never>, never, never>;
@@ -178,6 +180,7 @@ export declare const authHttpClient: (baseUrl?: string | undefined) => Effect.Ef
178
180
  readonly lastRequest: import("effect/Schema").NullOr<import("effect/Schema").Date>;
179
181
  readonly expiresAt: import("effect/Schema").NullOr<import("effect/Schema").Date>;
180
182
  readonly referrers: import("effect/Schema").$Array<import("effect/Schema").String>;
183
+ readonly permissions: import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>>;
181
184
  readonly createdAt: import("effect/Schema").Date;
182
185
  readonly updatedAt: import("effect/Schema").Date;
183
186
  }>>, import("effect/Schema").toCodecJson<typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").NotFound | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError>, never, never>, never, never>;
@@ -206,6 +209,7 @@ export declare const authHttpClient: (baseUrl?: string | undefined) => Effect.Ef
206
209
  readonly lastRequest: import("effect/Schema").NullOr<import("effect/Schema").Date>;
207
210
  readonly expiresAt: import("effect/Schema").NullOr<import("effect/Schema").Date>;
208
211
  readonly referrers: import("effect/Schema").$Array<import("effect/Schema").String>;
212
+ readonly permissions: import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>>;
209
213
  readonly createdAt: import("effect/Schema").Date;
210
214
  readonly updatedAt: import("effect/Schema").Date;
211
215
  }>>>, import("effect/Schema").toCodecJson<typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError>, never, never>, never, never>;
@@ -321,6 +325,7 @@ export declare const authHttpClient: (baseUrl?: string | undefined) => Effect.Ef
321
325
  readonly lastRequest: import("effect/Schema").NullOr<import("effect/Schema").Date>;
322
326
  readonly expiresAt: import("effect/Schema").NullOr<import("effect/Schema").Date>;
323
327
  readonly referrers: import("effect/Schema").$Array<import("effect/Schema").String>;
328
+ readonly permissions: import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>>;
324
329
  readonly createdAt: import("effect/Schema").Date;
325
330
  readonly updatedAt: import("effect/Schema").Date;
326
331
  }>>, import("effect/Schema").toCodecJson<typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").NotFound | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError>, never, never>, never, never>;
@@ -349,6 +354,7 @@ export declare const authHttpClient: (baseUrl?: string | undefined) => Effect.Ef
349
354
  readonly lastRequest: import("effect/Schema").NullOr<import("effect/Schema").Date>;
350
355
  readonly expiresAt: import("effect/Schema").NullOr<import("effect/Schema").Date>;
351
356
  readonly referrers: import("effect/Schema").$Array<import("effect/Schema").String>;
357
+ readonly permissions: import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>>;
352
358
  readonly createdAt: import("effect/Schema").Date;
353
359
  readonly updatedAt: import("effect/Schema").Date;
354
360
  }>>, import("effect/Schema").toCodecJson<typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").NotFound | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError>, never, never>, never, never>;
@@ -1516,7 +1522,7 @@ export declare const authHttpClient: (baseUrl?: string | undefined) => Effect.Ef
1516
1522
  }>>;
1517
1523
  readonly status: import("effect/Schema").optional<import("effect/Schema").Boolean>;
1518
1524
  }>>, import("effect/Schema").toCodecJson<typeof import("../auth/schema.js").AuthBadRequest>, never, never>, never, never>;
1519
- readonly signOut: HttpApiClient.Client.Method<import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"signOut", "POST", "/api/auth/sign-out", never, never, never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
1525
+ readonly signOut: HttpApiClient.Client.Method<import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"signOut", "POST", "/api/auth/sign-out", never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{}>>, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
1520
1526
  readonly success: import("effect/Schema").Boolean;
1521
1527
  }>>, import("effect/Schema").toCodecJson<typeof import("../auth/schema.js").AuthBadRequest>, never, never>, never, never>;
1522
1528
  readonly twoFactorDisable: HttpApiClient.Client.Method<import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"twoFactorDisable", "POST", "/api/auth/two-factor/disable", never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
@@ -10,7 +10,9 @@ export declare const resolveInitialAuthMethod: ({ requestedMethod, lastLoginMeth
10
10
  emailPassword: boolean;
11
11
  emailOtp: boolean;
12
12
  }) => AuthMethod;
13
- export declare function Signin(props: AuthFormProps): import("react").JSX.Element;
13
+ export declare function Signin(props: AuthFormProps & {
14
+ otpExpiryDescription?: string | undefined;
15
+ }): import("react").JSX.Element;
14
16
  export declare function VerifyEmail(props: AuthFormProps): import("react").JSX.Element;
15
17
  export declare function ForgotPassword(props: AuthFormProps): import("react").JSX.Element;
16
18
  export declare function ResetPassword(props: AuthFormProps): import("react").JSX.Element;
@@ -421,7 +421,7 @@ export function Signin(props) {
421
421
  return;
422
422
  event.preventDefault();
423
423
  event.currentTarget.form?.requestSubmit();
424
- }, required: true })) : null, emailSubmitted && selectedAuthMethod === "password" ? (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(form.password, { label: m.field_password, type: "password", autoComplete: "current-password", required: true }), _jsxs("div", { className: "flex flex-wrap gap-x-4 gap-y-2 text-sm", children: [_jsx(Link, { className: authLinkClassName, to: "/reset-password", search: authMethodSearch(searchString, "password", formValues.email.trim()), children: m.sign_in_forgot_password }), canChangeAuthMethod ? (_jsxs(Button, { type: "button", variant: "link", className: "h-auto px-0", onClick: switchAuthMethod, children: [_jsx(Mail, {}), m.sign_in_use_email_otp] })) : null] })] })) : null, emailSubmitted && selectedAuthMethod === "emailOtp" ? (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(form.otp, { label: m.sign_in_email_otp_code }), _jsxs("div", { className: "flex flex-wrap gap-x-4 gap-y-2 text-sm", children: [otpSentTo ? (_jsx(Button, { type: "button", variant: "link", className: "h-auto px-0", disabled: emailOtpResendSeconds > 0, onClick: resendEmailOtp, children: emailOtpResendSeconds > 0
424
+ }, required: true })) : null, emailSubmitted && selectedAuthMethod === "password" ? (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(form.password, { label: m.field_password, type: "password", autoComplete: "current-password", required: true }), _jsxs("div", { className: "flex flex-wrap gap-x-4 gap-y-2 text-sm", children: [_jsx(Link, { className: authLinkClassName, to: "/reset-password", search: authMethodSearch(searchString, "password", formValues.email.trim()), children: m.sign_in_forgot_password }), canChangeAuthMethod ? (_jsxs(Button, { type: "button", variant: "link", className: "h-auto px-0", onClick: switchAuthMethod, children: [_jsx(Mail, {}), m.sign_in_use_email_otp] })) : null] })] })) : null, emailSubmitted && selectedAuthMethod === "emailOtp" ? (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(form.otp, { label: m.sign_in_email_otp_code }), props.otpExpiryDescription ? (_jsx("p", { className: "text-muted-foreground text-sm", children: props.otpExpiryDescription })) : null, _jsxs("div", { className: "flex flex-wrap gap-x-4 gap-y-2 text-sm", children: [otpSentTo ? (_jsx(Button, { type: "button", variant: "link", className: "h-auto px-0", disabled: emailOtpResendSeconds > 0, onClick: resendEmailOtp, children: emailOtpResendSeconds > 0
425
425
  ? text(m.sign_in_email_otp_resend_countdown, {
426
426
  seconds: String(emailOtpResendSeconds),
427
427
  })
@@ -495,7 +495,7 @@ export const UserButton = ({ baseUrl, signOutRedirect = "/", side = "bottom", de
495
495
  : emptyAccountsAtom;
496
496
  const accountsResult = useAtomValue(accountsAtom);
497
497
  const registry = useContext(RegistryContext);
498
- const [signOutAction] = useState(() => authClientApi(resolvedBaseUrl).runtime.fn(({ baseUrl, redirectUrl, }) => authHttpClient(baseUrl).pipe(Effect.flatMap((client) => client.auth.signOut()), Effect.tap(() => Effect.sync(notifyAuthChange)), Effect.flatMap(() => Effect.tryPromise(() => navigate({ href: redirectUrl }))))));
498
+ const [signOutAction] = useState(() => authClientApi(resolvedBaseUrl).runtime.fn(({ baseUrl, redirectUrl, }) => authHttpClient(baseUrl).pipe(Effect.flatMap((client) => client.auth.signOut({ payload: {} })), Effect.tap(() => Effect.sync(notifyAuthChange)), Effect.flatMap(() => Effect.tryPromise(() => navigate({ href: redirectUrl }))))));
499
499
  const signOut = useAtomSet(signOutAction);
500
500
  const signOutResult = useAtomValue(signOutAction);
501
501
  const [stopImpersonatingAction] = useState(() => authClientApi(resolvedBaseUrl).runtime.fn((input) => Effect.gen(function* () {
package/dist/service.d.ts CHANGED
@@ -1151,7 +1151,7 @@ declare const AuthService_base: Context.ServiceClass<AuthService, "@krak-stack/a
1151
1151
  }>>;
1152
1152
  readonly status: import("effect/Schema").optional<import("effect/Schema").Boolean>;
1153
1153
  }>>, import("effect/Schema").toCodecJson<typeof import("./auth/schema.js").AuthBadRequest>, never, never>, never, never>;
1154
- readonly signOut: HttpApiClient.Client.Method<import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"signOut", "POST", "/api/auth/sign-out", never, never, never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
1154
+ readonly signOut: HttpApiClient.Client.Method<import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"signOut", "POST", "/api/auth/sign-out", never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{}>>, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
1155
1155
  readonly success: import("effect/Schema").Boolean;
1156
1156
  }>>, import("effect/Schema").toCodecJson<typeof import("./auth/schema.js").AuthBadRequest>, never, never>, never, never>;
1157
1157
  readonly twoFactorDisable: HttpApiClient.Client.Method<import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"twoFactorDisable", "POST", "/api/auth/two-factor/disable", never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
@@ -3174,7 +3174,7 @@ declare const AuthService_base: Context.ServiceClass<AuthService, "@krak-stack/a
3174
3174
  }>>;
3175
3175
  readonly status: import("effect/Schema").optional<import("effect/Schema").Boolean>;
3176
3176
  }>>, import("effect/Schema").toCodecJson<typeof import("./auth/schema.js").AuthBadRequest>, never, never>, never, never>;
3177
- readonly signOut: HttpApiClient.Client.Method<import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"signOut", "POST", "/api/auth/sign-out", never, never, never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
3177
+ readonly signOut: HttpApiClient.Client.Method<import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"signOut", "POST", "/api/auth/sign-out", never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{}>>, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
3178
3178
  readonly success: import("effect/Schema").Boolean;
3179
3179
  }>>, import("effect/Schema").toCodecJson<typeof import("./auth/schema.js").AuthBadRequest>, never, never>, never, never>;
3180
3180
  readonly twoFactorDisable: HttpApiClient.Client.Method<import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"twoFactorDisable", "POST", "/api/auth/two-factor/disable", never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krak-stack/auth",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "description": "Effect HttpApi clients and schemas for KrakStack Auth.",
5
5
  "license": "MIT",
6
6
  "files": [