@krak-stack/auth 0.1.9 → 0.1.10

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.
@@ -1,6 +1,6 @@
1
1
  import { HttpApi } from "effect/unstable/httpapi";
2
2
  import { HttpApiEndpoint, HttpApiError, HttpApiGroup } from "effect/unstable/httpapi";
3
- export declare const BackendApiGroup: HttpApiGroup.HttpApiGroup<"backend", HttpApiEndpoint.HttpApiEndpoint<"listUsersByIds", "GET", "/users", HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
3
+ export declare const ServerUsersApiGroup: HttpApiGroup.HttpApiGroup<"serverUsers", HttpApiEndpoint.HttpApiEndpoint<"listUsersByIds", "GET", "/users", HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
4
4
  readonly ids: import("effect/Schema").NonEmptyString;
5
5
  }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").Struct<{
6
6
  readonly data: import("effect/Schema").$Array<import("effect/Schema").Struct<{
@@ -27,11 +27,12 @@ export declare const BackendApiGroup: HttpApiGroup.HttpApiGroup<"backend", HttpA
27
27
  readonly banned: import("effect/Schema").NullOr<import("effect/Schema").Boolean>;
28
28
  readonly createdAt: import("effect/Schema").Date;
29
29
  readonly updatedAt: import("effect/Schema").Date;
30
- }>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.InternalServerError | typeof HttpApiError.NotFound>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getUserActiveOrganization", "GET", "/organizations/user/:userId/active", HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
30
+ }>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.NotFound | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getUserActiveOrganization", "GET", "/organizations/user/:userId/active", HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
31
31
  readonly userId: import("effect/Schema").NonEmptyString;
32
32
  }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").Struct<{
33
33
  readonly id: import("effect/Schema").NullOr<import("effect/Schema").String>;
34
- }>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"listOrganizations", "GET", "/organizations", HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
34
+ }>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.InternalServerError>, never, never>, false>;
35
+ export declare const ServerOrganizationsApiGroup: HttpApiGroup.HttpApiGroup<"serverOrganizations", HttpApiEndpoint.HttpApiEndpoint<"listOrganizations", "GET", "/organizations", HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
35
36
  readonly ids: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
36
37
  readonly userId: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
37
38
  }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").Struct<{
@@ -52,7 +53,7 @@ export declare const BackendApiGroup: HttpApiGroup.HttpApiGroup<"backend", HttpA
52
53
  readonly createdAt: import("effect/Schema").Date;
53
54
  }>>;
54
55
  readonly missingIds: import("effect/Schema").$Array<import("effect/Schema").String>;
55
- }>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.InternalServerError | typeof HttpApiError.BadRequest>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getOrganization", "GET", "/organizations/:id", HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
56
+ }>>, HttpApiEndpoint.Json<typeof HttpApiError.BadRequest | typeof HttpApiError.Unauthorized | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getOrganization", "GET", "/organizations/:id", HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
56
57
  readonly id: import("effect/Schema").NonEmptyString;
57
58
  }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").Struct<{
58
59
  readonly id: import("effect/Schema").String;
@@ -69,7 +70,7 @@ export declare const BackendApiGroup: HttpApiGroup.HttpApiGroup<"backend", HttpA
69
70
  }>>;
70
71
  }>>;
71
72
  readonly createdAt: import("effect/Schema").Date;
72
- }>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.InternalServerError | typeof HttpApiError.NotFound>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getActiveMember", "GET", "/organizations/:organizationId/members/:userId", HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
73
+ }>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.NotFound | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getActiveMember", "GET", "/organizations/:organizationId/members/:userId", HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
73
74
  readonly organizationId: import("effect/Schema").NonEmptyString;
74
75
  readonly userId: import("effect/Schema").NonEmptyString;
75
76
  }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").Struct<{
@@ -89,7 +90,7 @@ export declare const BackendApiGroup: HttpApiGroup.HttpApiGroup<"backend", HttpA
89
90
  readonly createdAt: import("effect/Schema").Date;
90
91
  readonly updatedAt: import("effect/Schema").Date;
91
92
  }>;
92
- }>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.InternalServerError | typeof HttpApiError.NotFound>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"listOrganizationMembers", "GET", "/organizations/:organizationId/members", HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
93
+ }>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.NotFound | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"listOrganizationMembers", "GET", "/organizations/:organizationId/members", HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
93
94
  readonly organizationId: import("effect/Schema").NonEmptyString;
94
95
  }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").$Array<import("effect/Schema").Struct<{
95
96
  readonly id: import("effect/Schema").String;
@@ -109,7 +110,7 @@ export declare const BackendApiGroup: HttpApiGroup.HttpApiGroup<"backend", HttpA
109
110
  readonly updatedAt: import("effect/Schema").Date;
110
111
  }>;
111
112
  }>>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.InternalServerError>, never, never>, false>;
112
- export declare const BackendApi: HttpApi.HttpApi<"BackendApi", HttpApiGroup.HttpApiGroup<"backend", HttpApiEndpoint.HttpApiEndpoint<"listUsersByIds", "GET", "/api/users", HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
113
+ export declare const ServerApi: HttpApi.HttpApi<"ServerApi", HttpApiGroup.HttpApiGroup<"serverUsers", HttpApiEndpoint.HttpApiEndpoint<"listUsersByIds", "GET", "/api/users", HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
113
114
  readonly ids: import("effect/Schema").NonEmptyString;
114
115
  }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").Struct<{
115
116
  readonly data: import("effect/Schema").$Array<import("effect/Schema").Struct<{
@@ -136,11 +137,11 @@ export declare const BackendApi: HttpApi.HttpApi<"BackendApi", HttpApiGroup.Http
136
137
  readonly banned: import("effect/Schema").NullOr<import("effect/Schema").Boolean>;
137
138
  readonly createdAt: import("effect/Schema").Date;
138
139
  readonly updatedAt: import("effect/Schema").Date;
139
- }>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.InternalServerError | typeof HttpApiError.NotFound>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getUserActiveOrganization", "GET", "/api/organizations/user/:userId/active", HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
140
+ }>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.NotFound | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getUserActiveOrganization", "GET", "/api/organizations/user/:userId/active", HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
140
141
  readonly userId: import("effect/Schema").NonEmptyString;
141
142
  }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").Struct<{
142
143
  readonly id: import("effect/Schema").NullOr<import("effect/Schema").String>;
143
- }>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"listOrganizations", "GET", "/api/organizations", HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
144
+ }>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.InternalServerError>, never, never>, false> | HttpApiGroup.HttpApiGroup<"serverOrganizations", HttpApiEndpoint.HttpApiEndpoint<"listOrganizations", "GET", "/api/organizations", HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
144
145
  readonly ids: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
145
146
  readonly userId: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
146
147
  }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").Struct<{
@@ -161,7 +162,7 @@ export declare const BackendApi: HttpApi.HttpApi<"BackendApi", HttpApiGroup.Http
161
162
  readonly createdAt: import("effect/Schema").Date;
162
163
  }>>;
163
164
  readonly missingIds: import("effect/Schema").$Array<import("effect/Schema").String>;
164
- }>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.InternalServerError | typeof HttpApiError.BadRequest>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getOrganization", "GET", "/api/organizations/:id", HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
165
+ }>>, HttpApiEndpoint.Json<typeof HttpApiError.BadRequest | typeof HttpApiError.Unauthorized | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getOrganization", "GET", "/api/organizations/:id", HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
165
166
  readonly id: import("effect/Schema").NonEmptyString;
166
167
  }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").Struct<{
167
168
  readonly id: import("effect/Schema").String;
@@ -178,7 +179,7 @@ export declare const BackendApi: HttpApi.HttpApi<"BackendApi", HttpApiGroup.Http
178
179
  }>>;
179
180
  }>>;
180
181
  readonly createdAt: import("effect/Schema").Date;
181
- }>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.InternalServerError | typeof HttpApiError.NotFound>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getActiveMember", "GET", "/api/organizations/:organizationId/members/:userId", HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
182
+ }>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.NotFound | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getActiveMember", "GET", "/api/organizations/:organizationId/members/:userId", HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
182
183
  readonly organizationId: import("effect/Schema").NonEmptyString;
183
184
  readonly userId: import("effect/Schema").NonEmptyString;
184
185
  }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").Struct<{
@@ -198,7 +199,7 @@ export declare const BackendApi: HttpApi.HttpApi<"BackendApi", HttpApiGroup.Http
198
199
  readonly createdAt: import("effect/Schema").Date;
199
200
  readonly updatedAt: import("effect/Schema").Date;
200
201
  }>;
201
- }>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.InternalServerError | typeof HttpApiError.NotFound>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"listOrganizationMembers", "GET", "/api/organizations/:organizationId/members", HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
202
+ }>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.NotFound | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"listOrganizationMembers", "GET", "/api/organizations/:organizationId/members", HttpApiEndpoint.StringTree<import("effect/Schema").Struct<{
202
203
  readonly organizationId: import("effect/Schema").NonEmptyString;
203
204
  }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").$Array<import("effect/Schema").Struct<{
204
205
  readonly id: import("effect/Schema").String;
@@ -1,11 +1,11 @@
1
1
  import { HttpApi, OpenApi } from "effect/unstable/httpapi";
2
2
  import { HttpApiEndpoint, HttpApiError, HttpApiGroup, } from "effect/unstable/httpapi";
3
3
  import { Member, Organization, User } from "../schema";
4
- import { BackendActiveOrganization, BackendIdParams, BackendIdsQuery, BackendMemberParams, BackendMembersResponse, BackendOrganizationIdParams, BackendOrganizationsQuery, BackendOrganizationsResponse, BackendUserIdParams, BackendUsersResponse, } from "./schema";
5
- export const BackendApiGroup = HttpApiGroup.make("backend")
4
+ import { ServerActiveOrganization, ServerIdParams, ServerIdsQuery, ServerMemberParams, ServerMembersResponse, ServerOrganizationIdParams, ServerOrganizationsQuery, ServerOrganizationsResponse, ServerUserIdParams, ServerUsersResponse, } from "./schema";
5
+ export const ServerUsersApiGroup = HttpApiGroup.make("serverUsers")
6
6
  .add(HttpApiEndpoint.get("listUsersByIds", "/users", {
7
- query: BackendIdsQuery,
8
- success: BackendUsersResponse,
7
+ query: ServerIdsQuery,
8
+ success: ServerUsersResponse,
9
9
  error: [HttpApiError.Unauthorized, HttpApiError.InternalServerError],
10
10
  }).annotateMerge(OpenApi.annotations({
11
11
  title: "List users by IDs",
@@ -13,7 +13,7 @@ export const BackendApiGroup = HttpApiGroup.make("backend")
13
13
  description: "Returns trusted user records for a comma-separated list of IDs. Requires a service API key.",
14
14
  })))
15
15
  .add(HttpApiEndpoint.get("getUser", "/users/:id", {
16
- params: BackendIdParams,
16
+ params: ServerIdParams,
17
17
  success: User,
18
18
  error: [
19
19
  HttpApiError.Unauthorized,
@@ -26,17 +26,22 @@ export const BackendApiGroup = HttpApiGroup.make("backend")
26
26
  description: "Returns a trusted user record by ID. Requires a service API key.",
27
27
  })))
28
28
  .add(HttpApiEndpoint.get("getUserActiveOrganization", "/organizations/user/:userId/active", {
29
- params: BackendUserIdParams,
30
- success: BackendActiveOrganization,
29
+ params: ServerUserIdParams,
30
+ success: ServerActiveOrganization,
31
31
  error: [HttpApiError.Unauthorized, HttpApiError.InternalServerError],
32
32
  }).annotateMerge(OpenApi.annotations({
33
33
  title: "Get user active organization",
34
34
  summary: "Get active organization for a user",
35
35
  description: "Returns the active organization ID from the user's latest auth session. Requires a service API key.",
36
36
  })))
37
+ .annotateMerge(OpenApi.annotations({
38
+ title: "Users (Server)",
39
+ description: "Server-to-server user endpoints for trusted services.",
40
+ }));
41
+ export const ServerOrganizationsApiGroup = HttpApiGroup.make("serverOrganizations")
37
42
  .add(HttpApiEndpoint.get("listOrganizations", "/organizations", {
38
- query: BackendOrganizationsQuery,
39
- success: BackendOrganizationsResponse,
43
+ query: ServerOrganizationsQuery,
44
+ success: ServerOrganizationsResponse,
40
45
  error: [
41
46
  HttpApiError.BadRequest,
42
47
  HttpApiError.Unauthorized,
@@ -48,7 +53,7 @@ export const BackendApiGroup = HttpApiGroup.make("backend")
48
53
  description: "Returns trusted organization records for either a comma-separated list of IDs or a user ID. Exactly one of ids or userId is required. Requires a service API key.",
49
54
  })))
50
55
  .add(HttpApiEndpoint.get("getOrganization", "/organizations/:id", {
51
- params: BackendIdParams,
56
+ params: ServerIdParams,
52
57
  success: Organization,
53
58
  error: [
54
59
  HttpApiError.Unauthorized,
@@ -61,7 +66,7 @@ export const BackendApiGroup = HttpApiGroup.make("backend")
61
66
  description: "Returns a trusted organization record by ID. Requires a service API key.",
62
67
  })))
63
68
  .add(HttpApiEndpoint.get("getActiveMember", "/organizations/:organizationId/members/:userId", {
64
- params: BackendMemberParams,
69
+ params: ServerMemberParams,
65
70
  success: Member,
66
71
  error: [
67
72
  HttpApiError.Unauthorized,
@@ -74,8 +79,8 @@ export const BackendApiGroup = HttpApiGroup.make("backend")
74
79
  description: "Returns the member record and role for a user in an organization. Requires a service API key.",
75
80
  })))
76
81
  .add(HttpApiEndpoint.get("listOrganizationMembers", "/organizations/:organizationId/members", {
77
- params: BackendOrganizationIdParams,
78
- success: BackendMembersResponse,
82
+ params: ServerOrganizationIdParams,
83
+ success: ServerMembersResponse,
79
84
  error: [HttpApiError.Unauthorized, HttpApiError.InternalServerError],
80
85
  }).annotateMerge(OpenApi.annotations({
81
86
  title: "List organization members",
@@ -83,9 +88,10 @@ export const BackendApiGroup = HttpApiGroup.make("backend")
83
88
  description: "Returns organization members with user contact details. Requires a service API key.",
84
89
  })))
85
90
  .annotateMerge(OpenApi.annotations({
86
- title: "Backend",
87
- description: "Server-to-server authentication and identity endpoints for trusted services.",
91
+ title: "Organizations (Server)",
92
+ description: "Server-to-server organization and membership endpoints for trusted services.",
88
93
  }));
89
- export const BackendApi = HttpApi.make("BackendApi")
90
- .add(BackendApiGroup)
94
+ export const ServerApi = HttpApi.make("ServerApi")
95
+ .add(ServerUsersApiGroup)
96
+ .add(ServerOrganizationsApiGroup)
91
97
  .prefix("/api");
@@ -0,0 +1,4 @@
1
+ export { AuthClient, AuthClientConfig } from "../client";
2
+ export { ServerApi, ServerOrganizationsApiGroup, ServerUsersApiGroup, } from "./api";
3
+ export type { ServerActiveOrganization, ServerMembersResponse, ServerOrganizationsResponse, ServerUsersResponse, } from "./schema";
4
+ export type { Member, Organization, OrganizationMetadata, User, } from "../schema";
@@ -0,0 +1,2 @@
1
+ export { AuthClient, AuthClientConfig } from "../client";
2
+ export { ServerApi, ServerOrganizationsApiGroup, ServerUsersApiGroup, } from "./api";
@@ -1,28 +1,28 @@
1
1
  import { Schema } from "effect";
2
- export declare const BackendIdsQuery: Schema.Struct<{
2
+ export declare const ServerIdsQuery: Schema.Struct<{
3
3
  readonly ids: Schema.NonEmptyString;
4
4
  }>;
5
- export declare const BackendOrganizationsQuery: Schema.Struct<{
5
+ export declare const ServerOrganizationsQuery: Schema.Struct<{
6
6
  readonly ids: Schema.optional<Schema.NonEmptyString>;
7
7
  readonly userId: Schema.optional<Schema.NonEmptyString>;
8
8
  }>;
9
- export declare const BackendIdParams: Schema.Struct<{
9
+ export declare const ServerIdParams: Schema.Struct<{
10
10
  readonly id: Schema.NonEmptyString;
11
11
  }>;
12
- export declare const BackendUserIdParams: Schema.Struct<{
12
+ export declare const ServerUserIdParams: Schema.Struct<{
13
13
  readonly userId: Schema.NonEmptyString;
14
14
  }>;
15
- export declare const BackendOrganizationIdParams: Schema.Struct<{
15
+ export declare const ServerOrganizationIdParams: Schema.Struct<{
16
16
  readonly organizationId: Schema.NonEmptyString;
17
17
  }>;
18
- export declare const BackendMemberParams: Schema.Struct<{
18
+ export declare const ServerMemberParams: Schema.Struct<{
19
19
  readonly organizationId: Schema.NonEmptyString;
20
20
  readonly userId: Schema.NonEmptyString;
21
21
  }>;
22
- export declare const BackendActiveOrganization: Schema.Struct<{
22
+ export declare const ServerActiveOrganization: Schema.Struct<{
23
23
  readonly id: Schema.NullOr<Schema.String>;
24
24
  }>;
25
- export declare const BackendUsersResponse: Schema.Struct<{
25
+ export declare const ServerUsersResponse: Schema.Struct<{
26
26
  readonly data: Schema.$Array<Schema.Struct<{
27
27
  readonly id: Schema.String;
28
28
  readonly name: Schema.String;
@@ -36,7 +36,7 @@ export declare const BackendUsersResponse: Schema.Struct<{
36
36
  }>>;
37
37
  readonly missingIds: Schema.$Array<Schema.String>;
38
38
  }>;
39
- export declare const BackendOrganizationsResponse: Schema.Struct<{
39
+ export declare const ServerOrganizationsResponse: Schema.Struct<{
40
40
  readonly data: Schema.$Array<Schema.Struct<{
41
41
  readonly id: Schema.String;
42
42
  readonly name: Schema.String;
@@ -55,7 +55,7 @@ export declare const BackendOrganizationsResponse: Schema.Struct<{
55
55
  }>>;
56
56
  readonly missingIds: Schema.$Array<Schema.String>;
57
57
  }>;
58
- export declare const BackendMembersResponse: Schema.$Array<Schema.Struct<{
58
+ export declare const ServerMembersResponse: Schema.$Array<Schema.Struct<{
59
59
  readonly id: Schema.String;
60
60
  readonly organizationId: Schema.String;
61
61
  readonly userId: Schema.String;
@@ -73,7 +73,7 @@ export declare const BackendMembersResponse: Schema.$Array<Schema.Struct<{
73
73
  readonly updatedAt: Schema.Date;
74
74
  }>;
75
75
  }>>;
76
- export type BackendUsersResponse = typeof BackendUsersResponse.Type;
77
- export type BackendOrganizationsResponse = typeof BackendOrganizationsResponse.Type;
78
- export type BackendMembersResponse = typeof BackendMembersResponse.Type;
79
- export type BackendActiveOrganization = typeof BackendActiveOrganization.Type;
76
+ export type ServerUsersResponse = typeof ServerUsersResponse.Type;
77
+ export type ServerOrganizationsResponse = typeof ServerOrganizationsResponse.Type;
78
+ export type ServerMembersResponse = typeof ServerMembersResponse.Type;
79
+ export type ServerActiveOrganization = typeof ServerActiveOrganization.Type;
@@ -0,0 +1,81 @@
1
+ import { Schema } from "effect";
2
+ import { Member, Organization, User } from "../schema";
3
+ export const ServerIdsQuery = Schema.Struct({
4
+ ids: Schema.NonEmptyString,
5
+ }).annotate({
6
+ identifier: "ServerIdsQuery",
7
+ title: "Server IDs query",
8
+ description: "Comma-separated resource IDs used to return server records.",
9
+ examples: [{ ids: "user_1,user_2,user_3" }],
10
+ });
11
+ export const ServerOrganizationsQuery = Schema.Struct({
12
+ ids: Schema.optional(Schema.NonEmptyString),
13
+ userId: Schema.optional(Schema.NonEmptyString),
14
+ }).annotate({
15
+ identifier: "ServerOrganizationsQuery",
16
+ title: "Server organizations query",
17
+ description: "Query used to return organizations. Provide either comma-separated organization IDs or a user ID, but not both.",
18
+ examples: [{ ids: "org_1,org_2" }, { userId: "user_1" }],
19
+ });
20
+ export const ServerIdParams = Schema.Struct({
21
+ id: Schema.NonEmptyString,
22
+ }).annotate({
23
+ identifier: "ServerIdParams",
24
+ title: "Server ID params",
25
+ description: "Resource ID used to return a server record.",
26
+ examples: [{ id: "user_1" }],
27
+ });
28
+ export const ServerUserIdParams = Schema.Struct({
29
+ userId: Schema.NonEmptyString,
30
+ }).annotate({
31
+ identifier: "ServerUserIdParams",
32
+ title: "Server user ID params",
33
+ description: "User ID used to return server records scoped to a user.",
34
+ examples: [{ userId: "user_1" }],
35
+ });
36
+ export const ServerOrganizationIdParams = Schema.Struct({
37
+ organizationId: Schema.NonEmptyString,
38
+ }).annotate({
39
+ identifier: "ServerOrganizationIdParams",
40
+ title: "Server organization ID params",
41
+ description: "Organization ID used to return server organization records.",
42
+ examples: [{ organizationId: "org_1" }],
43
+ });
44
+ export const ServerMemberParams = Schema.Struct({
45
+ organizationId: Schema.NonEmptyString,
46
+ userId: Schema.NonEmptyString,
47
+ }).annotate({
48
+ identifier: "ServerMemberParams",
49
+ title: "Server member params",
50
+ description: "Organization and user IDs used to return a member record.",
51
+ examples: [{ organizationId: "org_1", userId: "user_1" }],
52
+ });
53
+ export const ServerActiveOrganization = Schema.Struct({
54
+ id: Schema.NullOr(Schema.String),
55
+ }).annotate({
56
+ identifier: "ServerActiveOrganization",
57
+ title: "Server active organization",
58
+ description: "The active organization ID from a user's latest auth session.",
59
+ examples: [{ id: "org_1" }],
60
+ });
61
+ export const ServerUsersResponse = Schema.Struct({
62
+ data: Schema.Array(User),
63
+ missingIds: Schema.Array(Schema.String),
64
+ }).annotate({
65
+ identifier: "ServerUsersResponse",
66
+ title: "Server users response",
67
+ description: "Batch user response with records and requested IDs that were not found.",
68
+ });
69
+ export const ServerOrganizationsResponse = Schema.Struct({
70
+ data: Schema.Array(Organization),
71
+ missingIds: Schema.Array(Schema.String),
72
+ }).annotate({
73
+ identifier: "ServerOrganizationsResponse",
74
+ title: "Server organizations response",
75
+ description: "Batch organization response with records and requested IDs that were not found.",
76
+ });
77
+ export const ServerMembersResponse = Schema.Array(Member).annotate({
78
+ identifier: "ServerMembersResponse",
79
+ title: "Server members response",
80
+ description: "Organization members with user contact details.",
81
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krak-stack/auth",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "Effect HttpApi clients and schemas for KrakStack Auth.",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -21,13 +21,17 @@
21
21
  "types": "./dist/components/index.d.ts",
22
22
  "default": "./dist/components/index.js"
23
23
  },
24
- "./backend": {
25
- "types": "./dist/backend/index.d.ts",
26
- "default": "./dist/backend/index.js"
24
+ "./better-auth": {
25
+ "types": "./dist/better-auth/index.d.ts",
26
+ "default": "./dist/better-auth/index.js"
27
27
  },
28
- "./frontend": {
29
- "types": "./dist/frontend/index.d.ts",
30
- "default": "./dist/frontend/index.js"
28
+ "./extra": {
29
+ "types": "./dist/extra/index.d.ts",
30
+ "default": "./dist/extra/index.js"
31
+ },
32
+ "./server": {
33
+ "types": "./dist/server/index.d.ts",
34
+ "default": "./dist/server/index.js"
31
35
  }
32
36
  },
33
37
  "publishConfig": {
@@ -1,4 +0,0 @@
1
- export { AuthClient, AuthClientConfig } from "../client";
2
- export { BackendApi, BackendApiGroup } from "./api";
3
- export type { BackendActiveOrganization, BackendMembersResponse, BackendOrganizationsResponse, BackendUsersResponse, } from "./schema";
4
- export type { Member, Organization, OrganizationMetadata, User, } from "../schema";
@@ -1,2 +0,0 @@
1
- export { AuthClient, AuthClientConfig } from "../client";
2
- export { BackendApi, BackendApiGroup } from "./api";
@@ -1,81 +0,0 @@
1
- import { Schema } from "effect";
2
- import { Member, Organization, User } from "../schema";
3
- export const BackendIdsQuery = Schema.Struct({
4
- ids: Schema.NonEmptyString,
5
- }).annotate({
6
- identifier: "BackendIdsQuery",
7
- title: "Backend IDs query",
8
- description: "Comma-separated resource IDs used to return backend records.",
9
- examples: [{ ids: "user_1,user_2,user_3" }],
10
- });
11
- export const BackendOrganizationsQuery = Schema.Struct({
12
- ids: Schema.optional(Schema.NonEmptyString),
13
- userId: Schema.optional(Schema.NonEmptyString),
14
- }).annotate({
15
- identifier: "BackendOrganizationsQuery",
16
- title: "Backend organizations query",
17
- description: "Query used to return organizations. Provide either comma-separated organization IDs or a user ID, but not both.",
18
- examples: [{ ids: "org_1,org_2" }, { userId: "user_1" }],
19
- });
20
- export const BackendIdParams = Schema.Struct({
21
- id: Schema.NonEmptyString,
22
- }).annotate({
23
- identifier: "BackendIdParams",
24
- title: "Backend ID params",
25
- description: "Resource ID used to return a backend record.",
26
- examples: [{ id: "user_1" }],
27
- });
28
- export const BackendUserIdParams = Schema.Struct({
29
- userId: Schema.NonEmptyString,
30
- }).annotate({
31
- identifier: "BackendUserIdParams",
32
- title: "Backend user ID params",
33
- description: "User ID used to return backend records scoped to a user.",
34
- examples: [{ userId: "user_1" }],
35
- });
36
- export const BackendOrganizationIdParams = Schema.Struct({
37
- organizationId: Schema.NonEmptyString,
38
- }).annotate({
39
- identifier: "BackendOrganizationIdParams",
40
- title: "Backend organization ID params",
41
- description: "Organization ID used to return backend organization records.",
42
- examples: [{ organizationId: "org_1" }],
43
- });
44
- export const BackendMemberParams = Schema.Struct({
45
- organizationId: Schema.NonEmptyString,
46
- userId: Schema.NonEmptyString,
47
- }).annotate({
48
- identifier: "BackendMemberParams",
49
- title: "Backend member params",
50
- description: "Organization and user IDs used to return a member record.",
51
- examples: [{ organizationId: "org_1", userId: "user_1" }],
52
- });
53
- export const BackendActiveOrganization = Schema.Struct({
54
- id: Schema.NullOr(Schema.String),
55
- }).annotate({
56
- identifier: "BackendActiveOrganization",
57
- title: "Backend active organization",
58
- description: "The active organization ID from a user's latest auth session.",
59
- examples: [{ id: "org_1" }],
60
- });
61
- export const BackendUsersResponse = Schema.Struct({
62
- data: Schema.Array(User),
63
- missingIds: Schema.Array(Schema.String),
64
- }).annotate({
65
- identifier: "BackendUsersResponse",
66
- title: "Backend users response",
67
- description: "Batch user response with records and requested IDs that were not found.",
68
- });
69
- export const BackendOrganizationsResponse = Schema.Struct({
70
- data: Schema.Array(Organization),
71
- missingIds: Schema.Array(Schema.String),
72
- }).annotate({
73
- identifier: "BackendOrganizationsResponse",
74
- title: "Backend organizations response",
75
- description: "Batch organization response with records and requested IDs that were not found.",
76
- });
77
- export const BackendMembersResponse = Schema.Array(Member).annotate({
78
- identifier: "BackendMembersResponse",
79
- title: "Backend members response",
80
- description: "Organization members with user contact details.",
81
- });
@@ -1,16 +0,0 @@
1
- import { HttpApi } from "effect/unstable/httpapi";
2
- import { HttpApiEndpoint, HttpApiError, HttpApiGroup } from "effect/unstable/httpapi";
3
- export declare const FrontendOrganizationsApiGroup: HttpApiGroup.HttpApiGroup<"organizations", HttpApiEndpoint.HttpApiEndpoint<"presignOrganizationLogoUpload", "POST", "/organizations/logo/presign", HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").Struct<{
4
- readonly fileName: import("effect/Schema").NonEmptyString;
5
- readonly contentType: import("effect/Schema").NonEmptyString;
6
- }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").Struct<{
7
- readonly uploadUrl: import("effect/Schema").String;
8
- readonly url: import("effect/Schema").String;
9
- }>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.InternalServerError | typeof HttpApiError.BadRequest | typeof HttpApiError.Forbidden>, never, never>, false>;
10
- export declare const FrontendApi: HttpApi.HttpApi<"FrontendApi", HttpApiGroup.HttpApiGroup<"organizations", HttpApiEndpoint.HttpApiEndpoint<"presignOrganizationLogoUpload", "POST", "/api/organizations/logo/presign", HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").Struct<{
11
- readonly fileName: import("effect/Schema").NonEmptyString;
12
- readonly contentType: import("effect/Schema").NonEmptyString;
13
- }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<import("effect/Schema").Struct<{
14
- readonly uploadUrl: import("effect/Schema").String;
15
- readonly url: import("effect/Schema").String;
16
- }>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.InternalServerError | typeof HttpApiError.BadRequest | typeof HttpApiError.Forbidden>, never, never>, false>>;
@@ -1,21 +0,0 @@
1
- import { HttpApi, OpenApi } from "effect/unstable/httpapi";
2
- import { HttpApiEndpoint, HttpApiError, HttpApiGroup, } from "effect/unstable/httpapi";
3
- import { FrontendPresignedUpload, FrontendPresignUploadPayload, } from "./schema";
4
- export const FrontendOrganizationsApiGroup = HttpApiGroup.make("organizations")
5
- .add(HttpApiEndpoint.post("presignOrganizationLogoUpload", "/organizations/logo/presign", {
6
- payload: FrontendPresignUploadPayload,
7
- success: FrontendPresignedUpload,
8
- error: [
9
- HttpApiError.BadRequest,
10
- HttpApiError.Unauthorized,
11
- HttpApiError.Forbidden,
12
- HttpApiError.InternalServerError,
13
- ],
14
- }))
15
- .annotateMerge(OpenApi.annotations({
16
- title: "Frontend organizations",
17
- description: "Frontend API organization endpoints for browser-facing organization actions.",
18
- }));
19
- export const FrontendApi = HttpApi.make("FrontendApi")
20
- .add(FrontendOrganizationsApiGroup)
21
- .prefix("/api");
@@ -1,14 +0,0 @@
1
- import { AtomHttpApi } from "effect/unstable/reactivity";
2
- declare const FrontendApiClient_base: AtomHttpApi.AtomHttpApiClient<FrontendApiClient, "FrontendApiClient", import("effect/unstable/httpapi/HttpApiGroup").HttpApiGroup<"organizations", import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"presignOrganizationLogoUpload", "POST", "/api/organizations/logo/presign", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
3
- readonly fileName: import("effect/Schema").NonEmptyString;
4
- readonly contentType: import("effect/Schema").NonEmptyString;
5
- }>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
6
- readonly uploadUrl: import("effect/Schema").String;
7
- readonly url: import("effect/Schema").String;
8
- }>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError | typeof import("effect/unstable/httpapi/HttpApiError").BadRequest | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden>, never, never>, false>>;
9
- export declare class FrontendApiClient extends FrontendApiClient_base {
10
- }
11
- export { AuthClient, AuthClientConfig } from "../client";
12
- export { FrontendApi, FrontendOrganizationsApiGroup } from "./api";
13
- export type { FrontendPresignedUpload, FrontendPresignUploadPayload, } from "./schema";
14
- export type { Organization, OrganizationMetadata } from "../schema";
@@ -1,11 +0,0 @@
1
- import { Schema } from "effect";
2
- export declare const FrontendPresignUploadPayload: Schema.Struct<{
3
- readonly fileName: Schema.NonEmptyString;
4
- readonly contentType: Schema.NonEmptyString;
5
- }>;
6
- export declare const FrontendPresignedUpload: Schema.Struct<{
7
- readonly uploadUrl: Schema.String;
8
- readonly url: Schema.String;
9
- }>;
10
- export type FrontendPresignUploadPayload = typeof FrontendPresignUploadPayload.Type;
11
- export type FrontendPresignedUpload = typeof FrontendPresignedUpload.Type;
@@ -1,18 +0,0 @@
1
- import { Schema } from "effect";
2
- export const FrontendPresignUploadPayload = Schema.Struct({
3
- fileName: Schema.NonEmptyString,
4
- contentType: Schema.NonEmptyString,
5
- }).annotate({
6
- identifier: "FrontendPresignUploadPayload",
7
- title: "Frontend presign upload payload",
8
- description: "Payload used to request a presigned organization logo upload URL.",
9
- examples: [{ fileName: "logo.png", contentType: "image/png" }],
10
- });
11
- export const FrontendPresignedUpload = Schema.Struct({
12
- uploadUrl: Schema.String,
13
- url: Schema.String,
14
- }).annotate({
15
- identifier: "FrontendPresignedUpload",
16
- title: "Frontend presigned upload",
17
- description: "Presigned upload URL and stable public asset URL.",
18
- });