@krak-stack/auth 0.1.45 → 0.1.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/api.group.d.ts +134 -16
- package/dist/admin/api.group.js +84 -1
- package/dist/admin/schema.d.ts +43 -13
- package/dist/admin/schema.js +70 -0
- package/dist/api.d.ts +144 -26
- package/dist/better-auth/api.group.d.ts +1 -1
- package/dist/better-auth/api.group.js +1 -0
- package/dist/components/auth-client-api.d.ts +256 -138
- package/dist/components/auth-provider.d.ts +15 -15
- package/dist/components/organization-switcher.js +0 -3
- package/dist/components/user-button.d.ts +2 -0
- package/dist/components/user-button.js +8 -3
- package/dist/extra/api.group.d.ts +4 -4
- package/dist/extra/api.group.js +19 -3
- package/dist/server/middleware.d.ts +9 -3
- package/dist/server/middleware.js +25 -2
- package/dist/server/proxy.js +1 -13
- package/dist/service.d.ts +480 -484
- package/package.json +1 -1
|
@@ -58,7 +58,26 @@ export declare const AdminApiGroup: HttpApiGroup.HttpApiGroup<"admin", HttpApiEn
|
|
|
58
58
|
readonly users: Schema.Number;
|
|
59
59
|
readonly organizations: Schema.Number;
|
|
60
60
|
}>>;
|
|
61
|
-
}>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"
|
|
61
|
+
}>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"deleteApiKey", "DELETE", "/admin/api-keys/:id", HttpApiEndpoint.StringTree<Schema.Struct<{
|
|
62
|
+
readonly id: Schema.String;
|
|
63
|
+
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
|
|
64
|
+
readonly id: Schema.String;
|
|
65
|
+
readonly configId: Schema.String;
|
|
66
|
+
readonly name: Schema.NullOr<Schema.String>;
|
|
67
|
+
readonly start: Schema.NullOr<Schema.String>;
|
|
68
|
+
readonly referenceId: Schema.String;
|
|
69
|
+
readonly prefix: Schema.NullOr<Schema.String>;
|
|
70
|
+
readonly enabled: Schema.Boolean;
|
|
71
|
+
readonly rateLimitEnabled: Schema.Boolean;
|
|
72
|
+
readonly rateLimitTimeWindow: Schema.NullOr<Schema.Number>;
|
|
73
|
+
readonly rateLimitMax: Schema.NullOr<Schema.Number>;
|
|
74
|
+
readonly requestCount: Schema.Number;
|
|
75
|
+
readonly remaining: Schema.NullOr<Schema.Number>;
|
|
76
|
+
readonly lastRequest: Schema.NullOr<Schema.Date>;
|
|
77
|
+
readonly expiresAt: Schema.NullOr<Schema.Date>;
|
|
78
|
+
readonly createdAt: Schema.Date;
|
|
79
|
+
readonly updatedAt: Schema.Date;
|
|
80
|
+
}>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.NotFound | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"deleteDomain", "DELETE", "/admin/domains/:id", HttpApiEndpoint.StringTree<Schema.Struct<{
|
|
62
81
|
readonly id: Schema.NonEmptyString;
|
|
63
82
|
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
|
|
64
83
|
readonly id: Schema.String;
|
|
@@ -85,6 +104,44 @@ export declare const AdminApiGroup: HttpApiGroup.HttpApiGroup<"admin", HttpApiEn
|
|
|
85
104
|
readonly metadata: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
86
105
|
readonly memberCount: Schema.optional<Schema.Number>;
|
|
87
106
|
readonly createdAt: Schema.Date;
|
|
107
|
+
}>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.NotFound | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"disableApiKeyRateLimit", "POST", "/admin/api-keys/:id/disable-rate-limit", HttpApiEndpoint.StringTree<Schema.Struct<{
|
|
108
|
+
readonly id: Schema.String;
|
|
109
|
+
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
|
|
110
|
+
readonly id: Schema.String;
|
|
111
|
+
readonly configId: Schema.String;
|
|
112
|
+
readonly name: Schema.NullOr<Schema.String>;
|
|
113
|
+
readonly start: Schema.NullOr<Schema.String>;
|
|
114
|
+
readonly referenceId: Schema.String;
|
|
115
|
+
readonly prefix: Schema.NullOr<Schema.String>;
|
|
116
|
+
readonly enabled: Schema.Boolean;
|
|
117
|
+
readonly rateLimitEnabled: Schema.Boolean;
|
|
118
|
+
readonly rateLimitTimeWindow: Schema.NullOr<Schema.Number>;
|
|
119
|
+
readonly rateLimitMax: Schema.NullOr<Schema.Number>;
|
|
120
|
+
readonly requestCount: Schema.Number;
|
|
121
|
+
readonly remaining: Schema.NullOr<Schema.Number>;
|
|
122
|
+
readonly lastRequest: Schema.NullOr<Schema.Date>;
|
|
123
|
+
readonly expiresAt: Schema.NullOr<Schema.Date>;
|
|
124
|
+
readonly createdAt: Schema.Date;
|
|
125
|
+
readonly updatedAt: Schema.Date;
|
|
126
|
+
}>>, HttpApiEndpoint.Json<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", HttpApiEndpoint.StringTree<Schema.Struct<{
|
|
127
|
+
readonly id: Schema.String;
|
|
128
|
+
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
|
|
129
|
+
readonly id: Schema.String;
|
|
130
|
+
readonly configId: Schema.String;
|
|
131
|
+
readonly name: Schema.NullOr<Schema.String>;
|
|
132
|
+
readonly start: Schema.NullOr<Schema.String>;
|
|
133
|
+
readonly referenceId: Schema.String;
|
|
134
|
+
readonly prefix: Schema.NullOr<Schema.String>;
|
|
135
|
+
readonly enabled: Schema.Boolean;
|
|
136
|
+
readonly rateLimitEnabled: Schema.Boolean;
|
|
137
|
+
readonly rateLimitTimeWindow: Schema.NullOr<Schema.Number>;
|
|
138
|
+
readonly rateLimitMax: Schema.NullOr<Schema.Number>;
|
|
139
|
+
readonly requestCount: Schema.Number;
|
|
140
|
+
readonly remaining: Schema.NullOr<Schema.Number>;
|
|
141
|
+
readonly lastRequest: Schema.NullOr<Schema.Date>;
|
|
142
|
+
readonly expiresAt: Schema.NullOr<Schema.Date>;
|
|
143
|
+
readonly createdAt: Schema.Date;
|
|
144
|
+
readonly updatedAt: Schema.Date;
|
|
88
145
|
}>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.NotFound | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getDomainRecords", "GET", "/admin/domains/:id/records", HttpApiEndpoint.StringTree<Schema.Struct<{
|
|
89
146
|
readonly id: Schema.NonEmptyString;
|
|
90
147
|
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.$Array<Schema.Struct<{
|
|
@@ -93,7 +150,24 @@ export declare const AdminApiGroup: HttpApiGroup.HttpApiGroup<"admin", HttpApiEn
|
|
|
93
150
|
readonly type: Schema.String;
|
|
94
151
|
readonly name: Schema.String;
|
|
95
152
|
readonly value: Schema.String;
|
|
96
|
-
}>>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.NotFound | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"
|
|
153
|
+
}>>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.NotFound | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"listApiKeys", "GET", "/admin/api-keys", HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.$Array<Schema.Struct<{
|
|
154
|
+
readonly id: Schema.String;
|
|
155
|
+
readonly configId: Schema.String;
|
|
156
|
+
readonly name: Schema.NullOr<Schema.String>;
|
|
157
|
+
readonly start: Schema.NullOr<Schema.String>;
|
|
158
|
+
readonly referenceId: Schema.String;
|
|
159
|
+
readonly prefix: Schema.NullOr<Schema.String>;
|
|
160
|
+
readonly enabled: Schema.Boolean;
|
|
161
|
+
readonly rateLimitEnabled: Schema.Boolean;
|
|
162
|
+
readonly rateLimitTimeWindow: Schema.NullOr<Schema.Number>;
|
|
163
|
+
readonly rateLimitMax: Schema.NullOr<Schema.Number>;
|
|
164
|
+
readonly requestCount: Schema.Number;
|
|
165
|
+
readonly remaining: Schema.NullOr<Schema.Number>;
|
|
166
|
+
readonly lastRequest: Schema.NullOr<Schema.Date>;
|
|
167
|
+
readonly expiresAt: Schema.NullOr<Schema.Date>;
|
|
168
|
+
readonly createdAt: Schema.Date;
|
|
169
|
+
readonly updatedAt: Schema.Date;
|
|
170
|
+
}>>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"listDomains", "GET", "/admin/domains", HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.$Array<Schema.Struct<{
|
|
97
171
|
readonly id: Schema.String;
|
|
98
172
|
readonly hostname: Schema.String;
|
|
99
173
|
readonly rootHostname: Schema.String;
|
|
@@ -143,26 +217,70 @@ export declare const AdminApiGroup: HttpApiGroup.HttpApiGroup<"admin", HttpApiEn
|
|
|
143
217
|
}>>, Schema.String, never, never>, never, never>>;
|
|
144
218
|
readonly projectId: Schema.optional<Schema.String>;
|
|
145
219
|
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
|
|
146
|
-
readonly data: Schema.$Array<Schema.Schema<{
|
|
147
|
-
readonly id:
|
|
148
|
-
readonly name:
|
|
149
|
-
readonly email:
|
|
150
|
-
readonly emailVerified:
|
|
151
|
-
readonly image:
|
|
152
|
-
readonly createdAt: Date;
|
|
153
|
-
readonly lastSignedIn: Date
|
|
154
|
-
readonly role:
|
|
155
|
-
readonly banned:
|
|
156
|
-
readonly banReason:
|
|
157
|
-
readonly banExpires: Date
|
|
158
|
-
}
|
|
220
|
+
readonly data: Schema.$Array<Schema.Schema<Schema.Struct.ReadonlySide<{
|
|
221
|
+
readonly id: Schema.String;
|
|
222
|
+
readonly name: Schema.String;
|
|
223
|
+
readonly email: Schema.String;
|
|
224
|
+
readonly emailVerified: Schema.Boolean;
|
|
225
|
+
readonly image: Schema.NullOr<Schema.String>;
|
|
226
|
+
readonly createdAt: Schema.Date;
|
|
227
|
+
readonly lastSignedIn: Schema.NullOr<Schema.Date>;
|
|
228
|
+
readonly role: Schema.NullOr<Schema.String>;
|
|
229
|
+
readonly banned: Schema.NullOr<Schema.Boolean>;
|
|
230
|
+
readonly banReason: Schema.NullOr<Schema.String>;
|
|
231
|
+
readonly banExpires: Schema.NullOr<Schema.Date>;
|
|
232
|
+
}, "Type">>>;
|
|
159
233
|
readonly meta: Schema.Struct<{
|
|
160
234
|
readonly page: Schema.Int;
|
|
161
235
|
readonly pageSize: Schema.Int;
|
|
162
236
|
readonly total: Schema.Int;
|
|
163
237
|
readonly pageCount: Schema.Int;
|
|
164
238
|
}>;
|
|
165
|
-
}>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"
|
|
239
|
+
}>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"resetApiKeyRateLimit", "POST", "/admin/api-keys/:id/reset-rate-limit", HttpApiEndpoint.StringTree<Schema.Struct<{
|
|
240
|
+
readonly id: Schema.String;
|
|
241
|
+
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
|
|
242
|
+
readonly id: Schema.String;
|
|
243
|
+
readonly configId: Schema.String;
|
|
244
|
+
readonly name: Schema.NullOr<Schema.String>;
|
|
245
|
+
readonly start: Schema.NullOr<Schema.String>;
|
|
246
|
+
readonly referenceId: Schema.String;
|
|
247
|
+
readonly prefix: Schema.NullOr<Schema.String>;
|
|
248
|
+
readonly enabled: Schema.Boolean;
|
|
249
|
+
readonly rateLimitEnabled: Schema.Boolean;
|
|
250
|
+
readonly rateLimitTimeWindow: Schema.NullOr<Schema.Number>;
|
|
251
|
+
readonly rateLimitMax: Schema.NullOr<Schema.Number>;
|
|
252
|
+
readonly requestCount: Schema.Number;
|
|
253
|
+
readonly remaining: Schema.NullOr<Schema.Number>;
|
|
254
|
+
readonly lastRequest: Schema.NullOr<Schema.Date>;
|
|
255
|
+
readonly expiresAt: Schema.NullOr<Schema.Date>;
|
|
256
|
+
readonly createdAt: Schema.Date;
|
|
257
|
+
readonly updatedAt: Schema.Date;
|
|
258
|
+
}>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.NotFound | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"updateApiKey", "PATCH", "/admin/api-keys/:id", HttpApiEndpoint.StringTree<Schema.Struct<{
|
|
259
|
+
readonly id: Schema.String;
|
|
260
|
+
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
|
|
261
|
+
readonly name: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
262
|
+
readonly enabled: Schema.optional<Schema.Boolean>;
|
|
263
|
+
readonly rateLimitEnabled: Schema.optional<Schema.Boolean>;
|
|
264
|
+
readonly rateLimitMax: Schema.optional<Schema.NullOr<Schema.Number>>;
|
|
265
|
+
readonly rateLimitTimeWindow: Schema.optional<Schema.NullOr<Schema.Number>>;
|
|
266
|
+
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
|
|
267
|
+
readonly id: Schema.String;
|
|
268
|
+
readonly configId: Schema.String;
|
|
269
|
+
readonly name: Schema.NullOr<Schema.String>;
|
|
270
|
+
readonly start: Schema.NullOr<Schema.String>;
|
|
271
|
+
readonly referenceId: Schema.String;
|
|
272
|
+
readonly prefix: Schema.NullOr<Schema.String>;
|
|
273
|
+
readonly enabled: Schema.Boolean;
|
|
274
|
+
readonly rateLimitEnabled: Schema.Boolean;
|
|
275
|
+
readonly rateLimitTimeWindow: Schema.NullOr<Schema.Number>;
|
|
276
|
+
readonly rateLimitMax: Schema.NullOr<Schema.Number>;
|
|
277
|
+
readonly requestCount: Schema.Number;
|
|
278
|
+
readonly remaining: Schema.NullOr<Schema.Number>;
|
|
279
|
+
readonly lastRequest: Schema.NullOr<Schema.Date>;
|
|
280
|
+
readonly expiresAt: Schema.NullOr<Schema.Date>;
|
|
281
|
+
readonly createdAt: Schema.Date;
|
|
282
|
+
readonly updatedAt: Schema.Date;
|
|
283
|
+
}>>, HttpApiEndpoint.Json<typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.NotFound | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"updateDomain", "PATCH", "/admin/domains/:id", HttpApiEndpoint.StringTree<Schema.Struct<{
|
|
166
284
|
readonly id: Schema.NonEmptyString;
|
|
167
285
|
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
|
|
168
286
|
readonly hostname: Schema.NonEmptyString;
|
package/dist/admin/api.group.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HttpApiEndpoint, HttpApiError, HttpApiGroup, OpenApi, } from "effect/unstable/httpapi";
|
|
2
2
|
import { Schema } from "effect";
|
|
3
|
-
import { AdminCreateOrganizationPayload, AdminListQuery, AdminOrganization, AdminOrganizationIdParams, AdminUpdateOrganizationPayload, DashboardStatsQuery, DashboardStatsResponse, PaginatedAdminOrganizations, PaginatedAdminUsers, ServerCreateDomainPayload, ServerDomain, ServerDomainIdParams, ServerDomainRecordsResponse, ServerUpdateDomainPayload, } from "./schema";
|
|
3
|
+
import { AdminCreateOrganizationPayload, AdminApiKey, AdminApiKeyIdParams, AdminListQuery, AdminOrganization, AdminOrganizationIdParams, AdminUpdateApiKeyPayload, AdminUpdateOrganizationPayload, DashboardStatsQuery, DashboardStatsResponse, PaginatedAdminOrganizations, PaginatedAdminUsers, ServerCreateDomainPayload, ServerDomain, ServerDomainIdParams, ServerDomainRecordsResponse, ServerUpdateDomainPayload, } from "./schema";
|
|
4
4
|
export * from "./schema";
|
|
5
5
|
export const AdminApiGroup = HttpApiGroup.make("admin")
|
|
6
6
|
.add(HttpApiEndpoint.get("dashboardStats", "/admin/dashboard-stats", {
|
|
@@ -15,6 +15,89 @@ export const AdminApiGroup = HttpApiGroup.make("admin")
|
|
|
15
15
|
title: "Dashboard stats",
|
|
16
16
|
summary: "Get dashboard statistics",
|
|
17
17
|
description: "Returns user, organization, and daily active user counts for authenticated administrators.",
|
|
18
|
+
})))
|
|
19
|
+
.add(HttpApiEndpoint.get("listApiKeys", "/admin/api-keys", {
|
|
20
|
+
success: Schema.Array(AdminApiKey),
|
|
21
|
+
error: [
|
|
22
|
+
HttpApiError.Unauthorized,
|
|
23
|
+
HttpApiError.Forbidden,
|
|
24
|
+
HttpApiError.InternalServerError,
|
|
25
|
+
],
|
|
26
|
+
}).annotateMerge(OpenApi.annotations({
|
|
27
|
+
title: "List API keys",
|
|
28
|
+
summary: "List API keys for administrators",
|
|
29
|
+
description: "Returns all API key metadata for authenticated administrators.",
|
|
30
|
+
})))
|
|
31
|
+
.add(HttpApiEndpoint.delete("deleteApiKey", "/admin/api-keys/:id", {
|
|
32
|
+
params: AdminApiKeyIdParams,
|
|
33
|
+
success: AdminApiKey,
|
|
34
|
+
error: [
|
|
35
|
+
HttpApiError.Unauthorized,
|
|
36
|
+
HttpApiError.Forbidden,
|
|
37
|
+
HttpApiError.NotFound,
|
|
38
|
+
HttpApiError.InternalServerError,
|
|
39
|
+
],
|
|
40
|
+
}).annotateMerge(OpenApi.annotations({
|
|
41
|
+
title: "Delete API key",
|
|
42
|
+
summary: "Delete an API key",
|
|
43
|
+
description: "Deletes an API key for authenticated administrators.",
|
|
44
|
+
})))
|
|
45
|
+
.add(HttpApiEndpoint.patch("updateApiKey", "/admin/api-keys/:id", {
|
|
46
|
+
params: AdminApiKeyIdParams,
|
|
47
|
+
payload: AdminUpdateApiKeyPayload,
|
|
48
|
+
success: AdminApiKey,
|
|
49
|
+
error: [
|
|
50
|
+
HttpApiError.Unauthorized,
|
|
51
|
+
HttpApiError.Forbidden,
|
|
52
|
+
HttpApiError.NotFound,
|
|
53
|
+
HttpApiError.InternalServerError,
|
|
54
|
+
],
|
|
55
|
+
}).annotateMerge(OpenApi.annotations({
|
|
56
|
+
title: "Update API key",
|
|
57
|
+
summary: "Update an API key",
|
|
58
|
+
description: "Updates API key metadata and rate-limit settings for authenticated administrators.",
|
|
59
|
+
})))
|
|
60
|
+
.add(HttpApiEndpoint.post("resetApiKeyRateLimit", "/admin/api-keys/:id/reset-rate-limit", {
|
|
61
|
+
params: AdminApiKeyIdParams,
|
|
62
|
+
success: AdminApiKey,
|
|
63
|
+
error: [
|
|
64
|
+
HttpApiError.Unauthorized,
|
|
65
|
+
HttpApiError.Forbidden,
|
|
66
|
+
HttpApiError.NotFound,
|
|
67
|
+
HttpApiError.InternalServerError,
|
|
68
|
+
],
|
|
69
|
+
}).annotateMerge(OpenApi.annotations({
|
|
70
|
+
title: "Reset API key rate limit",
|
|
71
|
+
summary: "Reset an API key rate-limit window",
|
|
72
|
+
description: "Resets request count and last-used window state for an API key.",
|
|
73
|
+
})))
|
|
74
|
+
.add(HttpApiEndpoint.post("enableApiKeyRateLimit", "/admin/api-keys/:id/enable-rate-limit", {
|
|
75
|
+
params: AdminApiKeyIdParams,
|
|
76
|
+
success: AdminApiKey,
|
|
77
|
+
error: [
|
|
78
|
+
HttpApiError.Unauthorized,
|
|
79
|
+
HttpApiError.Forbidden,
|
|
80
|
+
HttpApiError.NotFound,
|
|
81
|
+
HttpApiError.InternalServerError,
|
|
82
|
+
],
|
|
83
|
+
}).annotateMerge(OpenApi.annotations({
|
|
84
|
+
title: "Enable API key rate limit",
|
|
85
|
+
summary: "Enable API key rate limiting",
|
|
86
|
+
description: "Enables rate-limit enforcement for an API key.",
|
|
87
|
+
})))
|
|
88
|
+
.add(HttpApiEndpoint.post("disableApiKeyRateLimit", "/admin/api-keys/:id/disable-rate-limit", {
|
|
89
|
+
params: AdminApiKeyIdParams,
|
|
90
|
+
success: AdminApiKey,
|
|
91
|
+
error: [
|
|
92
|
+
HttpApiError.Unauthorized,
|
|
93
|
+
HttpApiError.Forbidden,
|
|
94
|
+
HttpApiError.NotFound,
|
|
95
|
+
HttpApiError.InternalServerError,
|
|
96
|
+
],
|
|
97
|
+
}).annotateMerge(OpenApi.annotations({
|
|
98
|
+
title: "Disable API key rate limit",
|
|
99
|
+
summary: "Disable API key rate limiting",
|
|
100
|
+
description: "Disables rate-limit enforcement for an API key.",
|
|
18
101
|
})))
|
|
19
102
|
.add(HttpApiEndpoint.get("listUsers", "/admin/users", {
|
|
20
103
|
query: AdminListQuery,
|
package/dist/admin/schema.d.ts
CHANGED
|
@@ -35,6 +35,34 @@ export declare const AdminOrganization: Schema.Struct<{
|
|
|
35
35
|
export declare const AdminOrganizationIdParams: Schema.Struct<{
|
|
36
36
|
readonly id: Schema.String;
|
|
37
37
|
}>;
|
|
38
|
+
export declare const AdminApiKeyIdParams: Schema.Struct<{
|
|
39
|
+
readonly id: Schema.String;
|
|
40
|
+
}>;
|
|
41
|
+
export declare const AdminApiKey: Schema.Struct<{
|
|
42
|
+
readonly id: Schema.String;
|
|
43
|
+
readonly configId: Schema.String;
|
|
44
|
+
readonly name: Schema.NullOr<Schema.String>;
|
|
45
|
+
readonly start: Schema.NullOr<Schema.String>;
|
|
46
|
+
readonly referenceId: Schema.String;
|
|
47
|
+
readonly prefix: Schema.NullOr<Schema.String>;
|
|
48
|
+
readonly enabled: Schema.Boolean;
|
|
49
|
+
readonly rateLimitEnabled: Schema.Boolean;
|
|
50
|
+
readonly rateLimitTimeWindow: Schema.NullOr<Schema.Number>;
|
|
51
|
+
readonly rateLimitMax: Schema.NullOr<Schema.Number>;
|
|
52
|
+
readonly requestCount: Schema.Number;
|
|
53
|
+
readonly remaining: Schema.NullOr<Schema.Number>;
|
|
54
|
+
readonly lastRequest: Schema.NullOr<Schema.Date>;
|
|
55
|
+
readonly expiresAt: Schema.NullOr<Schema.Date>;
|
|
56
|
+
readonly createdAt: Schema.Date;
|
|
57
|
+
readonly updatedAt: Schema.Date;
|
|
58
|
+
}>;
|
|
59
|
+
export declare const AdminUpdateApiKeyPayload: Schema.Struct<{
|
|
60
|
+
readonly name: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
61
|
+
readonly enabled: Schema.optional<Schema.Boolean>;
|
|
62
|
+
readonly rateLimitEnabled: Schema.optional<Schema.Boolean>;
|
|
63
|
+
readonly rateLimitMax: Schema.optional<Schema.NullOr<Schema.Number>>;
|
|
64
|
+
readonly rateLimitTimeWindow: Schema.optional<Schema.NullOr<Schema.Number>>;
|
|
65
|
+
}>;
|
|
38
66
|
export declare const AdminCreateOrganizationPayload: Schema.Struct<{
|
|
39
67
|
readonly name: Schema.NonEmptyString;
|
|
40
68
|
readonly slug: Schema.NonEmptyString;
|
|
@@ -86,19 +114,19 @@ export declare const DashboardStatsResponse: Schema.Struct<{
|
|
|
86
114
|
}>>;
|
|
87
115
|
}>;
|
|
88
116
|
export declare const PaginatedAdminUsers: Schema.Struct<{
|
|
89
|
-
readonly data: Schema.$Array<Schema.Schema<{
|
|
90
|
-
readonly id:
|
|
91
|
-
readonly name:
|
|
92
|
-
readonly email:
|
|
93
|
-
readonly emailVerified:
|
|
94
|
-
readonly image:
|
|
95
|
-
readonly createdAt: Date;
|
|
96
|
-
readonly lastSignedIn: Date
|
|
97
|
-
readonly role:
|
|
98
|
-
readonly banned:
|
|
99
|
-
readonly banReason:
|
|
100
|
-
readonly banExpires: Date
|
|
101
|
-
}
|
|
117
|
+
readonly data: Schema.$Array<Schema.Schema<Schema.Struct.ReadonlySide<{
|
|
118
|
+
readonly id: Schema.String;
|
|
119
|
+
readonly name: Schema.String;
|
|
120
|
+
readonly email: Schema.String;
|
|
121
|
+
readonly emailVerified: Schema.Boolean;
|
|
122
|
+
readonly image: Schema.NullOr<Schema.String>;
|
|
123
|
+
readonly createdAt: Schema.Date;
|
|
124
|
+
readonly lastSignedIn: Schema.NullOr<Schema.Date>;
|
|
125
|
+
readonly role: Schema.NullOr<Schema.String>;
|
|
126
|
+
readonly banned: Schema.NullOr<Schema.Boolean>;
|
|
127
|
+
readonly banReason: Schema.NullOr<Schema.String>;
|
|
128
|
+
readonly banExpires: Schema.NullOr<Schema.Date>;
|
|
129
|
+
}, "Type">>>;
|
|
102
130
|
readonly meta: Schema.Struct<{
|
|
103
131
|
readonly page: Schema.Int;
|
|
104
132
|
readonly pageSize: Schema.Int;
|
|
@@ -126,6 +154,8 @@ export declare const PaginatedAdminOrganizations: Schema.Struct<{
|
|
|
126
154
|
export type AdminListQuery = typeof AdminListQuery.Type;
|
|
127
155
|
export type AdminUser = typeof AdminUser.Type;
|
|
128
156
|
export type AdminOrganization = typeof AdminOrganization.Type;
|
|
157
|
+
export type AdminApiKey = typeof AdminApiKey.Type;
|
|
158
|
+
export type AdminUpdateApiKeyPayload = typeof AdminUpdateApiKeyPayload.Type;
|
|
129
159
|
export type AdminCreateOrganizationPayload = typeof AdminCreateOrganizationPayload.Type;
|
|
130
160
|
export type AdminUpdateOrganizationPayload = typeof AdminUpdateOrganizationPayload.Type;
|
|
131
161
|
export { ServerCreateDomainPayload, ServerDomain, ServerDomainIdParams, ServerDomainRecordsResponse, ServerUpdateDomainPayload, };
|
package/dist/admin/schema.js
CHANGED
|
@@ -74,6 +74,76 @@ export const AdminOrganizationIdParams = Schema.Struct({
|
|
|
74
74
|
description: "Path parameters used to identify an organization.",
|
|
75
75
|
examples: [{ id: "organization-id" }],
|
|
76
76
|
});
|
|
77
|
+
export const AdminApiKeyIdParams = Schema.Struct({
|
|
78
|
+
id: Schema.String,
|
|
79
|
+
}).annotate({
|
|
80
|
+
identifier: "AdminApiKeyIdParams",
|
|
81
|
+
title: "Admin API key ID params",
|
|
82
|
+
description: "Path parameters used to identify an API key.",
|
|
83
|
+
examples: [{ id: "api-key-id" }],
|
|
84
|
+
});
|
|
85
|
+
export const AdminApiKey = Schema.Struct({
|
|
86
|
+
id: Schema.String,
|
|
87
|
+
configId: Schema.String,
|
|
88
|
+
name: Schema.NullOr(Schema.String),
|
|
89
|
+
start: Schema.NullOr(Schema.String),
|
|
90
|
+
referenceId: Schema.String,
|
|
91
|
+
prefix: Schema.NullOr(Schema.String),
|
|
92
|
+
enabled: Schema.Boolean,
|
|
93
|
+
rateLimitEnabled: Schema.Boolean,
|
|
94
|
+
rateLimitTimeWindow: Schema.NullOr(Schema.Number),
|
|
95
|
+
rateLimitMax: Schema.NullOr(Schema.Number),
|
|
96
|
+
requestCount: Schema.Number,
|
|
97
|
+
remaining: Schema.NullOr(Schema.Number),
|
|
98
|
+
lastRequest: Schema.NullOr(Schema.Date),
|
|
99
|
+
expiresAt: Schema.NullOr(Schema.Date),
|
|
100
|
+
createdAt: Schema.Date,
|
|
101
|
+
updatedAt: Schema.Date,
|
|
102
|
+
}).annotate({
|
|
103
|
+
identifier: "AdminApiKey",
|
|
104
|
+
title: "Admin API key",
|
|
105
|
+
description: "API key metadata returned to administrators.",
|
|
106
|
+
examples: [
|
|
107
|
+
{
|
|
108
|
+
id: "api-key-id",
|
|
109
|
+
configId: "service",
|
|
110
|
+
name: "Production service",
|
|
111
|
+
start: "svc_1234",
|
|
112
|
+
referenceId: "user-id",
|
|
113
|
+
prefix: "svc_",
|
|
114
|
+
enabled: true,
|
|
115
|
+
rateLimitEnabled: true,
|
|
116
|
+
rateLimitTimeWindow: 86400000,
|
|
117
|
+
rateLimitMax: 10000,
|
|
118
|
+
requestCount: 0,
|
|
119
|
+
remaining: null,
|
|
120
|
+
lastRequest: null,
|
|
121
|
+
expiresAt: null,
|
|
122
|
+
createdAt: new Date("2026-01-01T00:00:00.000Z"),
|
|
123
|
+
updatedAt: new Date("2026-01-01T00:00:00.000Z"),
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
});
|
|
127
|
+
export const AdminUpdateApiKeyPayload = Schema.Struct({
|
|
128
|
+
name: Schema.optional(Schema.NullOr(Schema.String)),
|
|
129
|
+
enabled: Schema.optional(Schema.Boolean),
|
|
130
|
+
rateLimitEnabled: Schema.optional(Schema.Boolean),
|
|
131
|
+
rateLimitMax: Schema.optional(Schema.NullOr(Schema.Number)),
|
|
132
|
+
rateLimitTimeWindow: Schema.optional(Schema.NullOr(Schema.Number)),
|
|
133
|
+
}).annotate({
|
|
134
|
+
identifier: "AdminUpdateApiKeyPayload",
|
|
135
|
+
title: "Update API key payload",
|
|
136
|
+
description: "Payload used by administrators to update API key metadata and rate limits.",
|
|
137
|
+
examples: [
|
|
138
|
+
{
|
|
139
|
+
name: "Production service",
|
|
140
|
+
enabled: true,
|
|
141
|
+
rateLimitEnabled: true,
|
|
142
|
+
rateLimitMax: 10000,
|
|
143
|
+
rateLimitTimeWindow: 86400000,
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
});
|
|
77
147
|
export const AdminCreateOrganizationPayload = Schema.Struct({
|
|
78
148
|
name: Schema.NonEmptyString,
|
|
79
149
|
slug: Schema.NonEmptyString,
|