@pithy-sh/auth 0.10.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -2
- package/dist/admin/users.js +1 -1
- package/dist/audit/actions.d.ts +58 -0
- package/dist/audit/actions.d.ts.map +1 -1
- package/dist/audit/actions.js +59 -1
- package/dist/audit/emit.d.ts +36 -0
- package/dist/audit/emit.d.ts.map +1 -1
- package/dist/audit/emit.js +48 -2
- package/dist/audit/evidence.d.ts +8 -2
- package/dist/audit/evidence.d.ts.map +1 -1
- package/dist/capability.d.ts +47 -8
- package/dist/capability.d.ts.map +1 -1
- package/dist/capability.js +56 -6
- package/dist/client/api.d.ts +55 -12
- package/dist/client/api.d.ts.map +1 -1
- package/dist/client/api.js +57 -18
- package/dist/client/bearer.d.ts +110 -0
- package/dist/client/bearer.d.ts.map +1 -0
- package/dist/client/bearer.js +265 -0
- package/dist/client/handoff.d.ts +77 -0
- package/dist/client/handoff.d.ts.map +1 -0
- package/dist/client/handoff.js +119 -0
- package/dist/client/mcp.d.ts +70 -0
- package/dist/client/mcp.d.ts.map +1 -0
- package/dist/client/mcp.js +65 -0
- package/dist/data/betterAuth.d.ts +3 -2
- package/dist/data/betterAuth.d.ts.map +1 -1
- package/dist/data/betterAuth.js +5 -3
- package/dist/data/kitFields.d.ts +5 -0
- package/dist/data/kitFields.d.ts.map +1 -1
- package/dist/data/kitFields.js +5 -0
- package/dist/data/tables.d.ts +26 -4
- package/dist/data/tables.d.ts.map +1 -1
- package/dist/data/tables.js +5 -3
- package/dist/data/userLifecycle.d.ts +10 -0
- package/dist/data/userLifecycle.d.ts.map +1 -1
- package/dist/data/userLifecycle.js +8 -3
- package/dist/data/verificationOutcome.d.ts +53 -0
- package/dist/data/verificationOutcome.d.ts.map +1 -0
- package/dist/data/verificationOutcome.js +50 -0
- package/dist/email/send.js +6 -2
- package/dist/http/adminRoutes.d.ts.map +1 -1
- package/dist/http/adminRoutes.js +319 -8
- package/dist/http/csrf.d.ts.map +1 -1
- package/dist/http/csrf.js +2 -1
- package/dist/http/guards.d.ts +15 -10
- package/dist/http/guards.d.ts.map +1 -1
- package/dist/http/guards.js +76 -10
- package/dist/http/handoff.d.ts +76 -0
- package/dist/http/handoff.d.ts.map +1 -0
- package/dist/http/handoff.js +316 -0
- package/dist/http/middleware.d.ts +37 -1
- package/dist/http/middleware.d.ts.map +1 -1
- package/dist/http/middleware.js +68 -6
- package/dist/http/resolve.d.ts.map +1 -1
- package/dist/http/resolve.js +9 -3
- package/dist/http/responses.d.ts +322 -0
- package/dist/http/responses.d.ts.map +1 -1
- package/dist/http/responses.js +202 -5
- package/dist/http/routes.d.ts +3 -0
- package/dist/http/routes.d.ts.map +1 -1
- package/dist/http/routes.js +78 -5
- package/dist/http/schemas.d.ts +114 -0
- package/dist/http/schemas.d.ts.map +1 -1
- package/dist/http/schemas.js +94 -1
- package/dist/http/views.d.ts +60 -3
- package/dist/http/views.d.ts.map +1 -1
- package/dist/http/views.js +143 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/instance/auth.d.ts +148 -10
- package/dist/instance/auth.d.ts.map +1 -1
- package/dist/instance/auth.js +87 -42
- package/dist/instance/plugins.d.ts +6 -0
- package/dist/instance/plugins.d.ts.map +1 -1
- package/dist/instance/plugins.js +14 -1
- package/dist/ledger/read.d.ts +53 -0
- package/dist/ledger/read.d.ts.map +1 -0
- package/dist/ledger/read.js +85 -0
- package/dist/ledger/record.d.ts +35 -0
- package/dist/ledger/record.d.ts.map +1 -0
- package/dist/ledger/record.js +98 -0
- package/dist/lifecycle/audited.d.ts +48 -0
- package/dist/lifecycle/audited.d.ts.map +1 -0
- package/dist/lifecycle/audited.js +65 -0
- package/dist/lifecycle/enforce.d.ts +37 -2
- package/dist/lifecycle/enforce.d.ts.map +1 -1
- package/dist/lifecycle/enforce.js +46 -5
- package/dist/lifecycle/erasure.d.ts +9 -0
- package/dist/lifecycle/erasure.d.ts.map +1 -0
- package/dist/lifecycle/erasure.js +96 -0
- package/dist/lifecycle/inactivity.d.ts +19 -0
- package/dist/lifecycle/inactivity.d.ts.map +1 -0
- package/dist/lifecycle/inactivity.js +28 -0
- package/dist/lifecycle/reason.d.ts +11 -0
- package/dist/lifecycle/reason.d.ts.map +1 -0
- package/dist/lifecycle/reason.js +13 -0
- package/dist/lifecycle/request.d.ts +5 -2
- package/dist/lifecycle/request.d.ts.map +1 -1
- package/dist/lifecycle/request.js +6 -2
- package/dist/lifecycle/transitions.d.ts +179 -18
- package/dist/lifecycle/transitions.d.ts.map +1 -1
- package/dist/lifecycle/transitions.js +391 -70
- package/dist/mcp/argumentClass.d.ts +51 -0
- package/dist/mcp/argumentClass.d.ts.map +1 -0
- package/dist/mcp/argumentClass.js +69 -0
- package/dist/mcp/capability.d.ts +50 -0
- package/dist/mcp/capability.d.ts.map +1 -0
- package/dist/mcp/capability.js +140 -0
- package/dist/mcp/clientMetadata.d.ts +40 -0
- package/dist/mcp/clientMetadata.d.ts.map +1 -0
- package/dist/mcp/clientMetadata.js +68 -0
- package/dist/mcp/consent.d.ts +49 -0
- package/dist/mcp/consent.d.ts.map +1 -0
- package/dist/mcp/consent.js +69 -0
- package/dist/mcp/dispatch.d.ts +35 -0
- package/dist/mcp/dispatch.d.ts.map +1 -0
- package/dist/mcp/dispatch.js +135 -0
- package/dist/mcp/floor.d.ts +37 -0
- package/dist/mcp/floor.d.ts.map +1 -0
- package/dist/mcp/floor.js +41 -0
- package/dist/mcp/host.d.ts +34 -0
- package/dist/mcp/host.d.ts.map +1 -0
- package/dist/mcp/host.js +2 -0
- package/dist/mcp/http/redirectList.d.ts +9 -0
- package/dist/mcp/http/redirectList.d.ts.map +1 -0
- package/dist/mcp/http/redirectList.js +24 -0
- package/dist/mcp/http/responses.d.ts +143 -0
- package/dist/mcp/http/responses.d.ts.map +1 -0
- package/dist/mcp/http/responses.js +83 -0
- package/dist/mcp/http/routes.d.ts +28 -0
- package/dist/mcp/http/routes.d.ts.map +1 -0
- package/dist/mcp/http/routes.js +517 -0
- package/dist/mcp/http/schemas.d.ts +24 -0
- package/dist/mcp/http/schemas.d.ts.map +1 -0
- package/dist/mcp/http/schemas.js +18 -0
- package/dist/mcp/marker.d.ts +15 -0
- package/dist/mcp/marker.d.ts.map +1 -0
- package/dist/mcp/marker.js +15 -0
- package/dist/mcp/provider.d.ts +78 -0
- package/dist/mcp/provider.d.ts.map +1 -0
- package/dist/mcp/provider.js +108 -0
- package/dist/mcp/purge.d.ts +15 -0
- package/dist/mcp/purge.d.ts.map +1 -0
- package/dist/mcp/purge.js +31 -0
- package/dist/mcp/rpc.d.ts +79 -0
- package/dist/mcp/rpc.d.ts.map +1 -0
- package/dist/mcp/rpc.js +103 -0
- package/dist/mcp/toolAudit.d.ts +76 -0
- package/dist/mcp/toolAudit.d.ts.map +1 -0
- package/dist/mcp/toolAudit.js +86 -0
- package/dist/migrations/0005_purge_once.d.ts +22 -0
- package/dist/migrations/0005_purge_once.d.ts.map +1 -0
- package/dist/migrations/0005_purge_once.js +35 -0
- package/dist/migrations/0006_verification_outcomes.d.ts +15 -0
- package/dist/migrations/0006_verification_outcomes.d.ts.map +1 -0
- package/dist/migrations/0006_verification_outcomes.js +35 -0
- package/dist/migrations/0007_erasure_record.d.ts +17 -0
- package/dist/migrations/0007_erasure_record.d.ts.map +1 -0
- package/dist/migrations/0007_erasure_record.js +36 -0
- package/dist/migrations/0008_last_active.d.ts +15 -0
- package/dist/migrations/0008_last_active.d.ts.map +1 -0
- package/dist/migrations/0008_last_active.js +29 -0
- package/dist/migrations/pluginTables.d.ts +8 -0
- package/dist/migrations/pluginTables.d.ts.map +1 -1
- package/dist/migrations/pluginTables.js +8 -1
- package/dist/migrations/set.d.ts +5 -1
- package/dist/migrations/set.d.ts.map +1 -1
- package/dist/migrations/set.js +10 -2
- package/dist/peer.d.ts +3 -2
- package/dist/peer.d.ts.map +1 -1
- package/dist/processing/activities.d.ts +6 -0
- package/dist/processing/activities.d.ts.map +1 -0
- package/dist/processing/activities.js +12 -0
- package/dist/purge/contribution.d.ts +62 -0
- package/dist/purge/contribution.d.ts.map +1 -0
- package/dist/purge/contribution.js +155 -0
- package/dist/purge/retryPolicy.d.ts +22 -0
- package/dist/purge/retryPolicy.d.ts.map +1 -0
- package/dist/purge/retryPolicy.js +26 -0
- package/dist/purge/run.d.ts +158 -0
- package/dist/purge/run.d.ts.map +1 -0
- package/dist/purge/run.js +205 -0
- package/dist/purge/specs.d.ts +71 -0
- package/dist/purge/specs.d.ts.map +1 -0
- package/dist/purge/specs.js +72 -0
- package/dist/purge/start.d.ts +42 -0
- package/dist/purge/start.d.ts.map +1 -0
- package/dist/purge/start.js +37 -0
- package/dist/purge/workflow.d.ts +71 -0
- package/dist/purge/workflow.d.ts.map +1 -0
- package/dist/purge/workflow.js +140 -0
- package/dist/test-utils/accountFootprint.d.ts +13 -0
- package/dist/test-utils/accountFootprint.d.ts.map +1 -0
- package/dist/test-utils/accountFootprint.js +49 -0
- package/dist/test-utils/liveApp.d.ts +6 -0
- package/dist/test-utils/liveApp.d.ts.map +1 -1
- package/dist/test-utils/liveApp.js +7 -2
- package/dist/token/handoff.d.ts +80 -0
- package/dist/token/handoff.d.ts.map +1 -0
- package/dist/token/handoff.js +136 -0
- package/dist/version.generated.d.ts +1 -1
- package/dist/version.generated.js +1 -1
- package/docs/account-lifecycle.md +176 -12
- package/docs/apple-signin.md +32 -4
- package/docs/facebook-oauth.md +2 -2
- package/docs/github-oauth.md +2 -2
- package/docs/google-oauth.md +9 -7
- package/docs/microsoft-oauth.md +2 -2
- package/package.json +11 -5
- package/pithy.manifest.json +2 -2
- package/pithy.mcp.manifest.json +36 -0
- package/src/audit/actions.ts +58 -0
- package/src/audit/emit.ts +66 -1
- package/src/audit/evidence.ts +8 -4
- package/src/capability.ts +122 -18
- package/src/client/api.ts +69 -19
- package/src/client/bearer.ts +388 -0
- package/src/client/handoff.ts +172 -0
- package/src/client/mcp.ts +140 -0
- package/src/data/betterAuth.ts +8 -4
- package/src/data/kitFields.ts +2 -0
- package/src/data/tables.ts +4 -2
- package/src/data/userLifecycle.ts +19 -4
- package/src/data/verificationOutcome.ts +86 -0
- package/src/email/send.ts +2 -2
- package/src/http/adminRoutes.ts +465 -4
- package/src/http/csrf.ts +4 -1
- package/src/http/guards.ts +79 -10
- package/src/http/handoff.ts +350 -0
- package/src/http/middleware.ts +74 -5
- package/src/http/resolve.ts +25 -25
- package/src/http/responses.ts +374 -3
- package/src/http/routes.ts +116 -5
- package/src/http/schemas.ts +195 -0
- package/src/http/views.ts +192 -3
- package/src/index.ts +2 -0
- package/src/instance/auth.ts +58 -3
- package/src/instance/plugins.ts +20 -2
- package/src/ledger/read.ts +133 -0
- package/src/ledger/record.ts +198 -0
- package/src/lifecycle/audited.ts +104 -0
- package/src/lifecycle/enforce.ts +55 -5
- package/src/lifecycle/erasure.ts +118 -0
- package/src/lifecycle/inactivity.ts +56 -0
- package/src/lifecycle/reason.ts +11 -0
- package/src/lifecycle/request.ts +10 -2
- package/src/lifecycle/transitions.ts +552 -93
- package/src/mcp/argumentClass.ts +112 -0
- package/src/mcp/capability.ts +194 -0
- package/src/mcp/clientMetadata.ts +81 -0
- package/src/mcp/consent.ts +95 -0
- package/src/mcp/dispatch.ts +154 -0
- package/src/mcp/floor.ts +62 -0
- package/src/mcp/host.ts +36 -0
- package/src/mcp/http/redirectList.ts +26 -0
- package/src/mcp/http/responses.ts +157 -0
- package/src/mcp/http/routes.ts +635 -0
- package/src/mcp/http/schemas.ts +37 -0
- package/src/mcp/marker.ts +18 -0
- package/src/mcp/provider.ts +151 -0
- package/src/mcp/purge.ts +39 -0
- package/src/mcp/rpc.ts +135 -0
- package/src/mcp/toolAudit.ts +132 -0
- package/src/migrations/0005_purge_once.ts +42 -0
- package/src/migrations/0006_verification_outcomes.ts +51 -0
- package/src/migrations/0007_erasure_record.ts +43 -0
- package/src/migrations/0008_last_active.ts +30 -0
- package/src/migrations/pluginTables.ts +19 -1
- package/src/migrations/set.ts +9 -1
- package/src/processing/activities.ts +14 -0
- package/src/purge/contribution.ts +218 -0
- package/src/purge/retryPolicy.ts +26 -0
- package/src/purge/run.ts +348 -0
- package/src/purge/specs.ts +95 -0
- package/src/purge/start.ts +79 -0
- package/src/purge/workflow.ts +202 -0
- package/src/seeds/example.ts +2 -2
- package/src/test-utils/accountFootprint.ts +104 -0
- package/src/test-utils/liveApp.ts +10 -1
- package/src/token/handoff.ts +180 -0
- package/src/version.generated.ts +1 -1
package/dist/http/responses.d.ts
CHANGED
|
@@ -11,6 +11,13 @@ export declare const AdminUserView: z.ZodObject<{
|
|
|
11
11
|
locale: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
12
12
|
createdAt: z.ZodISODateTime;
|
|
13
13
|
updatedAt: z.ZodISODateTime;
|
|
14
|
+
state: z.ZodOptional<z.ZodEnum<{
|
|
15
|
+
active: "active";
|
|
16
|
+
deleted: "deleted";
|
|
17
|
+
suspended: "suspended";
|
|
18
|
+
}>>;
|
|
19
|
+
suspendedUntil: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
20
|
+
purgeAfter: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
14
21
|
}, z.core.$strip>;
|
|
15
22
|
export type AdminUserView = z.output<typeof AdminUserView>;
|
|
16
23
|
/** A session as a management client may see it — the token is not part of the contract. */
|
|
@@ -53,6 +60,13 @@ export declare const AdminUsersResponse: z.ZodObject<{
|
|
|
53
60
|
locale: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
54
61
|
createdAt: z.ZodISODateTime;
|
|
55
62
|
updatedAt: z.ZodISODateTime;
|
|
63
|
+
state: z.ZodOptional<z.ZodEnum<{
|
|
64
|
+
active: "active";
|
|
65
|
+
deleted: "deleted";
|
|
66
|
+
suspended: "suspended";
|
|
67
|
+
}>>;
|
|
68
|
+
suspendedUntil: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
69
|
+
purgeAfter: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
56
70
|
}, z.core.$strip>>;
|
|
57
71
|
nextCursor: z.ZodNullable<z.ZodString>;
|
|
58
72
|
}, z.core.$strip>;
|
|
@@ -67,6 +81,13 @@ export declare const AdminUserResponse: z.ZodObject<{
|
|
|
67
81
|
locale: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
68
82
|
createdAt: z.ZodISODateTime;
|
|
69
83
|
updatedAt: z.ZodISODateTime;
|
|
84
|
+
state: z.ZodOptional<z.ZodEnum<{
|
|
85
|
+
active: "active";
|
|
86
|
+
deleted: "deleted";
|
|
87
|
+
suspended: "suspended";
|
|
88
|
+
}>>;
|
|
89
|
+
suspendedUntil: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
90
|
+
purgeAfter: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
70
91
|
}, z.core.$strip>;
|
|
71
92
|
providers: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
72
93
|
state: z.ZodLiteral<"read">;
|
|
@@ -134,6 +155,84 @@ export declare const AdminDevicesResponse: z.ZodObject<{
|
|
|
134
155
|
nextCursor: z.ZodNullable<z.ZodString>;
|
|
135
156
|
}, z.core.$strip>;
|
|
136
157
|
export type AdminDevicesResponse = z.output<typeof AdminDevicesResponse>;
|
|
158
|
+
/**
|
|
159
|
+
* One sign-in link or code from the verification ledger (#829), as a management client sees it.
|
|
160
|
+
*
|
|
161
|
+
* Never the token and never the address: the ledger holds neither. The mail is named by its job id, which is how
|
|
162
|
+
* a reader holding `email:jobs:read` joins this to a bounce, a deferral or a suppression.
|
|
163
|
+
*/
|
|
164
|
+
export declare const AdminVerificationView: z.ZodObject<{
|
|
165
|
+
verificationId: z.ZodString;
|
|
166
|
+
type: z.ZodEnum<{
|
|
167
|
+
magic_link: "magic_link";
|
|
168
|
+
otp: "otp";
|
|
169
|
+
}>;
|
|
170
|
+
state: z.ZodEnum<{
|
|
171
|
+
expired: "expired";
|
|
172
|
+
pending: "pending";
|
|
173
|
+
used: "used";
|
|
174
|
+
}>;
|
|
175
|
+
userId: z.ZodNullable<z.ZodString>;
|
|
176
|
+
emailJobId: z.ZodNullable<z.ZodString>;
|
|
177
|
+
issuedAt: z.ZodISODateTime;
|
|
178
|
+
expiresAt: z.ZodISODateTime;
|
|
179
|
+
usedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
180
|
+
}, z.core.$strip>;
|
|
181
|
+
export type AdminVerificationView = z.output<typeof AdminVerificationView>;
|
|
182
|
+
/** How many of one type were issued over the window, and where they stand. */
|
|
183
|
+
export declare const VerificationTypeCounts: z.ZodObject<{
|
|
184
|
+
type: z.ZodEnum<{
|
|
185
|
+
magic_link: "magic_link";
|
|
186
|
+
otp: "otp";
|
|
187
|
+
}>;
|
|
188
|
+
issued: z.ZodNumber;
|
|
189
|
+
used: z.ZodNumber;
|
|
190
|
+
expired: z.ZodNumber;
|
|
191
|
+
pending: z.ZodNumber;
|
|
192
|
+
}, z.core.$strip>;
|
|
193
|
+
export type VerificationTypeCounts = z.output<typeof VerificationTypeCounts>;
|
|
194
|
+
/**
|
|
195
|
+
* `GET {base}/admin/verifications` (#829): the window it covered, the counts by type and state over all of it,
|
|
196
|
+
* and a page of its rows, newest issue first.
|
|
197
|
+
*
|
|
198
|
+
* The counts cover every row in the window whatever the page or the filters say, and every type, with zeros —
|
|
199
|
+
* so a pane reading "sign-in links: 0 issued" can tell it from a Worker that did not say.
|
|
200
|
+
*/
|
|
201
|
+
export declare const AdminVerificationsResponse: z.ZodObject<{
|
|
202
|
+
window: z.ZodObject<{
|
|
203
|
+
since: z.ZodISODateTime;
|
|
204
|
+
until: z.ZodISODateTime;
|
|
205
|
+
}, z.core.$strip>;
|
|
206
|
+
counts: z.ZodArray<z.ZodObject<{
|
|
207
|
+
type: z.ZodEnum<{
|
|
208
|
+
magic_link: "magic_link";
|
|
209
|
+
otp: "otp";
|
|
210
|
+
}>;
|
|
211
|
+
issued: z.ZodNumber;
|
|
212
|
+
used: z.ZodNumber;
|
|
213
|
+
expired: z.ZodNumber;
|
|
214
|
+
pending: z.ZodNumber;
|
|
215
|
+
}, z.core.$strip>>;
|
|
216
|
+
verifications: z.ZodArray<z.ZodObject<{
|
|
217
|
+
verificationId: z.ZodString;
|
|
218
|
+
type: z.ZodEnum<{
|
|
219
|
+
magic_link: "magic_link";
|
|
220
|
+
otp: "otp";
|
|
221
|
+
}>;
|
|
222
|
+
state: z.ZodEnum<{
|
|
223
|
+
expired: "expired";
|
|
224
|
+
pending: "pending";
|
|
225
|
+
used: "used";
|
|
226
|
+
}>;
|
|
227
|
+
userId: z.ZodNullable<z.ZodString>;
|
|
228
|
+
emailJobId: z.ZodNullable<z.ZodString>;
|
|
229
|
+
issuedAt: z.ZodISODateTime;
|
|
230
|
+
expiresAt: z.ZodISODateTime;
|
|
231
|
+
usedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
232
|
+
}, z.core.$strip>>;
|
|
233
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
234
|
+
}, z.core.$strip>;
|
|
235
|
+
export type AdminVerificationsResponse = z.output<typeof AdminVerificationsResponse>;
|
|
137
236
|
/**
|
|
138
237
|
* `POST {base}/admin/sessions/revoke` and `POST {base}/admin/users/:userId/sessions/revoke`.
|
|
139
238
|
*
|
|
@@ -151,6 +250,213 @@ export declare const AdminDeviceRevokeResponse: z.ZodObject<{
|
|
|
151
250
|
removed: z.ZodBoolean;
|
|
152
251
|
}, z.core.$strip>;
|
|
153
252
|
export type AdminDeviceRevokeResponse = z.output<typeof AdminDeviceRevokeResponse>;
|
|
253
|
+
/**
|
|
254
|
+
* `POST {base}/admin/users/:userId/suspend` (#621).
|
|
255
|
+
*
|
|
256
|
+
* The suspension the account is now under, how many sessions ended with it, and whether the person was told.
|
|
257
|
+
* Not the reason: the caller wrote it, the trail keeps it, and echoing it back would put it in one more place
|
|
258
|
+
* a dashboard logs.
|
|
259
|
+
*/
|
|
260
|
+
export declare const AdminUserSuspendResponse: z.ZodObject<{
|
|
261
|
+
userId: z.ZodString;
|
|
262
|
+
state: z.ZodLiteral<"suspended">;
|
|
263
|
+
outcome: z.ZodEnum<{
|
|
264
|
+
suspended: "suspended";
|
|
265
|
+
updated: "updated";
|
|
266
|
+
}>;
|
|
267
|
+
suspendedAt: z.ZodISODateTime;
|
|
268
|
+
suspendedUntil: z.ZodNullable<z.ZodISODateTime>;
|
|
269
|
+
sessionsRevoked: z.ZodNumber;
|
|
270
|
+
mailed: z.ZodBoolean;
|
|
271
|
+
}, z.core.$strip>;
|
|
272
|
+
export type AdminUserSuspendResponse = z.output<typeof AdminUserSuspendResponse>;
|
|
273
|
+
/**
|
|
274
|
+
* `POST {base}/admin/users/:userId/reinstate` (#621).
|
|
275
|
+
*
|
|
276
|
+
* No session count: a reinstatement restores none. The person signs in again.
|
|
277
|
+
*/
|
|
278
|
+
export declare const AdminUserReinstateResponse: z.ZodObject<{
|
|
279
|
+
userId: z.ZodString;
|
|
280
|
+
state: z.ZodLiteral<"active">;
|
|
281
|
+
outcome: z.ZodEnum<{
|
|
282
|
+
reinstated: "reinstated";
|
|
283
|
+
unchanged: "unchanged";
|
|
284
|
+
}>;
|
|
285
|
+
mailed: z.ZodBoolean;
|
|
286
|
+
}, z.core.$strip>;
|
|
287
|
+
export type AdminUserReinstateResponse = z.output<typeof AdminUserReinstateResponse>;
|
|
288
|
+
/**
|
|
289
|
+
* `DELETE {base}/admin/users/:userId` (#622).
|
|
290
|
+
*
|
|
291
|
+
* What the deletion left in force, how many sessions ended with it, whether the person was told, and what
|
|
292
|
+
* became of the purge. Not the reason: the caller wrote it and the trail keeps it.
|
|
293
|
+
*/
|
|
294
|
+
export declare const AdminUserDeleteResponse: z.ZodObject<{
|
|
295
|
+
userId: z.ZodString;
|
|
296
|
+
state: z.ZodLiteral<"deleted">;
|
|
297
|
+
mode: z.ZodEnum<{
|
|
298
|
+
hard: "hard";
|
|
299
|
+
soft: "soft";
|
|
300
|
+
}>;
|
|
301
|
+
outcome: z.ZodEnum<{
|
|
302
|
+
brought_forward: "brought_forward";
|
|
303
|
+
deleted: "deleted";
|
|
304
|
+
unchanged: "unchanged";
|
|
305
|
+
}>;
|
|
306
|
+
deletedAt: z.ZodISODateTime;
|
|
307
|
+
purgeAfter: z.ZodISODateTime;
|
|
308
|
+
purge: z.ZodEnum<{
|
|
309
|
+
pending: "pending";
|
|
310
|
+
scheduled: "scheduled";
|
|
311
|
+
started: "started";
|
|
312
|
+
}>;
|
|
313
|
+
sessionsRevoked: z.ZodNumber;
|
|
314
|
+
mailed: z.ZodBoolean;
|
|
315
|
+
}, z.core.$strip>;
|
|
316
|
+
export type AdminUserDeleteResponse = z.output<typeof AdminUserDeleteResponse>;
|
|
317
|
+
/**
|
|
318
|
+
* `POST {base}/admin/users/:userId/restore` (#622). No session count: a restoration restores none.
|
|
319
|
+
*/
|
|
320
|
+
export declare const AdminUserRestoreResponse: z.ZodObject<{
|
|
321
|
+
userId: z.ZodString;
|
|
322
|
+
state: z.ZodEnum<{
|
|
323
|
+
active: "active";
|
|
324
|
+
suspended: "suspended";
|
|
325
|
+
}>;
|
|
326
|
+
outcome: z.ZodEnum<{
|
|
327
|
+
restored: "restored";
|
|
328
|
+
unchanged: "unchanged";
|
|
329
|
+
}>;
|
|
330
|
+
}, z.core.$strip>;
|
|
331
|
+
export type AdminUserRestoreResponse = z.output<typeof AdminUserRestoreResponse>;
|
|
332
|
+
/**
|
|
333
|
+
* What `@pithy-sh/auth` holds about one account, as its purge contribution exports it (#622) — the `data` of
|
|
334
|
+
* the `auth` entry in an export.
|
|
335
|
+
*
|
|
336
|
+
* The person's own data and none of their credentials: no session token, no provider token, no push token.
|
|
337
|
+
* Every list is whole, because an export that stopped at a bound would answer an access request with part of
|
|
338
|
+
* an answer.
|
|
339
|
+
*/
|
|
340
|
+
export declare const AuthUserExport: z.ZodObject<{
|
|
341
|
+
user: z.ZodObject<{
|
|
342
|
+
id: z.ZodString;
|
|
343
|
+
email: z.ZodString;
|
|
344
|
+
name: z.ZodString;
|
|
345
|
+
emailVerified: z.ZodBoolean;
|
|
346
|
+
image: z.ZodNullable<z.ZodString>;
|
|
347
|
+
locale: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
348
|
+
createdAt: z.ZodISODateTime;
|
|
349
|
+
updatedAt: z.ZodISODateTime;
|
|
350
|
+
state: z.ZodOptional<z.ZodEnum<{
|
|
351
|
+
active: "active";
|
|
352
|
+
deleted: "deleted";
|
|
353
|
+
suspended: "suspended";
|
|
354
|
+
}>>;
|
|
355
|
+
suspendedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
356
|
+
suspendedUntil: z.ZodNullable<z.ZodISODateTime>;
|
|
357
|
+
deletedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
358
|
+
purgeAfter: z.ZodNullable<z.ZodISODateTime>;
|
|
359
|
+
}, z.core.$strip>;
|
|
360
|
+
sessions: z.ZodArray<z.ZodObject<{
|
|
361
|
+
id: z.ZodString;
|
|
362
|
+
deviceId: z.ZodNullable<z.ZodString>;
|
|
363
|
+
ipAddress: z.ZodNullable<z.ZodString>;
|
|
364
|
+
userAgent: z.ZodNullable<z.ZodString>;
|
|
365
|
+
createdAt: z.ZodISODateTime;
|
|
366
|
+
updatedAt: z.ZodISODateTime;
|
|
367
|
+
expiresAt: z.ZodISODateTime;
|
|
368
|
+
}, z.core.$strip>>;
|
|
369
|
+
providers: z.ZodArray<z.ZodObject<{
|
|
370
|
+
providerId: z.ZodString;
|
|
371
|
+
createdAt: z.ZodISODateTime;
|
|
372
|
+
}, z.core.$strip>>;
|
|
373
|
+
devices: z.ZodArray<z.ZodObject<{
|
|
374
|
+
id: z.ZodString;
|
|
375
|
+
userId: z.ZodString;
|
|
376
|
+
platform: z.ZodEnum<{
|
|
377
|
+
android: "android";
|
|
378
|
+
ios: "ios";
|
|
379
|
+
web: "web";
|
|
380
|
+
}>;
|
|
381
|
+
name: z.ZodNullable<z.ZodString>;
|
|
382
|
+
model: z.ZodNullable<z.ZodString>;
|
|
383
|
+
osVersion: z.ZodNullable<z.ZodString>;
|
|
384
|
+
appVersion: z.ZodNullable<z.ZodString>;
|
|
385
|
+
lastIp: z.ZodNullable<z.ZodString>;
|
|
386
|
+
lastSeenAt: z.ZodISODateTime;
|
|
387
|
+
createdAt: z.ZodISODateTime;
|
|
388
|
+
}, z.core.$strip>>;
|
|
389
|
+
history: z.ZodArray<z.ZodObject<{
|
|
390
|
+
action: z.ZodString;
|
|
391
|
+
actorType: z.ZodString;
|
|
392
|
+
reason: z.ZodNullable<z.ZodString>;
|
|
393
|
+
suspendedUntil: z.ZodNullable<z.ZodISODateTime>;
|
|
394
|
+
createdAt: z.ZodISODateTime;
|
|
395
|
+
}, z.core.$strip>>;
|
|
396
|
+
verifications: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
397
|
+
verificationId: z.ZodString;
|
|
398
|
+
type: z.ZodEnum<{
|
|
399
|
+
magic_link: "magic_link";
|
|
400
|
+
otp: "otp";
|
|
401
|
+
}>;
|
|
402
|
+
state: z.ZodEnum<{
|
|
403
|
+
expired: "expired";
|
|
404
|
+
pending: "pending";
|
|
405
|
+
used: "used";
|
|
406
|
+
}>;
|
|
407
|
+
userId: z.ZodNullable<z.ZodString>;
|
|
408
|
+
emailJobId: z.ZodNullable<z.ZodString>;
|
|
409
|
+
issuedAt: z.ZodISODateTime;
|
|
410
|
+
expiresAt: z.ZodISODateTime;
|
|
411
|
+
usedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
412
|
+
}, z.core.$strip>>>;
|
|
413
|
+
plugins: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
414
|
+
}, z.core.$strip>;
|
|
415
|
+
export type AuthUserExport = z.output<typeof AuthUserExport>;
|
|
416
|
+
/**
|
|
417
|
+
* `GET {base}/admin/users/:userId/export` (#622).
|
|
418
|
+
*
|
|
419
|
+
* Everything the kit holds about one account — the answer to an access request. One entry per composed
|
|
420
|
+
* capability that declares a purge contribution, in the order the purge runs them, each read on its own so
|
|
421
|
+
* one that will not read costs its own entry and not the document.
|
|
422
|
+
*/
|
|
423
|
+
export declare const AdminUserExportResponse: z.ZodObject<{
|
|
424
|
+
subject: z.ZodObject<{
|
|
425
|
+
type: z.ZodLiteral<"user">;
|
|
426
|
+
id: z.ZodString;
|
|
427
|
+
}, z.core.$strip>;
|
|
428
|
+
exportedAt: z.ZodISODateTime;
|
|
429
|
+
capabilities: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
430
|
+
capability: z.ZodString;
|
|
431
|
+
summary: z.ZodString;
|
|
432
|
+
disposition: z.ZodOptional<z.ZodEnum<{
|
|
433
|
+
erase: "erase";
|
|
434
|
+
retain: "retain";
|
|
435
|
+
}>>;
|
|
436
|
+
basis: z.ZodOptional<z.ZodString>;
|
|
437
|
+
state: z.ZodLiteral<"exported">;
|
|
438
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
439
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
440
|
+
capability: z.ZodString;
|
|
441
|
+
summary: z.ZodString;
|
|
442
|
+
disposition: z.ZodOptional<z.ZodEnum<{
|
|
443
|
+
erase: "erase";
|
|
444
|
+
retain: "retain";
|
|
445
|
+
}>>;
|
|
446
|
+
basis: z.ZodOptional<z.ZodString>;
|
|
447
|
+
state: z.ZodLiteral<"not_exported">;
|
|
448
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
449
|
+
capability: z.ZodString;
|
|
450
|
+
summary: z.ZodString;
|
|
451
|
+
disposition: z.ZodOptional<z.ZodEnum<{
|
|
452
|
+
erase: "erase";
|
|
453
|
+
retain: "retain";
|
|
454
|
+
}>>;
|
|
455
|
+
basis: z.ZodOptional<z.ZodString>;
|
|
456
|
+
state: z.ZodLiteral<"unavailable">;
|
|
457
|
+
}, z.core.$strip>], "state">>;
|
|
458
|
+
}, z.core.$strip>;
|
|
459
|
+
export type AdminUserExportResponse = z.output<typeof AdminUserExportResponse>;
|
|
154
460
|
/** `POST {base}/token/rotate`. */
|
|
155
461
|
export declare const TokenRotateResponse: z.ZodObject<{
|
|
156
462
|
accessToken: z.ZodString;
|
|
@@ -158,6 +464,12 @@ export declare const TokenRotateResponse: z.ZodObject<{
|
|
|
158
464
|
expiresAt: z.ZodISODateTime;
|
|
159
465
|
}, z.core.$strip>;
|
|
160
466
|
export type TokenRotateResponse = z.output<typeof TokenRotateResponse>;
|
|
467
|
+
/** `POST {base}/handoff`. */
|
|
468
|
+
export declare const HandoffExchangeResponse: z.ZodObject<{
|
|
469
|
+
token: z.ZodString;
|
|
470
|
+
expiresAt: z.ZodISODateTime;
|
|
471
|
+
}, z.core.$strip>;
|
|
472
|
+
export type HandoffExchangeResponse = z.output<typeof HandoffExchangeResponse>;
|
|
161
473
|
/** One of the caller's own registered devices. */
|
|
162
474
|
export declare const MyDeviceView: z.ZodObject<{
|
|
163
475
|
id: z.ZodString;
|
|
@@ -203,4 +515,14 @@ export declare const MyDeviceRevokeResponse: z.ZodObject<{
|
|
|
203
515
|
revoked: z.ZodNumber;
|
|
204
516
|
}, z.core.$strip>;
|
|
205
517
|
export type MyDeviceRevokeResponse = z.output<typeof MyDeviceRevokeResponse>;
|
|
518
|
+
/**
|
|
519
|
+
* `DELETE {base}/account` (#622) — the signed-in person deleted their own account. Always soft, on the
|
|
520
|
+
* configured window. Their sessions end with it, this one included.
|
|
521
|
+
*/
|
|
522
|
+
export declare const AccountDeleteResponse: z.ZodObject<{
|
|
523
|
+
state: z.ZodLiteral<"deleted">;
|
|
524
|
+
purgeAfter: z.ZodISODateTime;
|
|
525
|
+
mailed: z.ZodBoolean;
|
|
526
|
+
}, z.core.$strip>;
|
|
527
|
+
export type AccountDeleteResponse = z.output<typeof AccountDeleteResponse>;
|
|
206
528
|
//# sourceMappingURL=responses.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../src/http/responses.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../src/http/responses.ts"],"names":[],"mappings":"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"}
|
package/dist/http/responses.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
import { DevicePlatform } from "../data/device.js";
|
|
4
|
+
import { VerificationState, VerificationType } from "../data/verificationOutcome.js";
|
|
4
5
|
import { z } from "zod";
|
|
5
6
|
import { Locale } from "@pithy-sh/core/src/i18n/locale";
|
|
6
7
|
//#region src/http/responses.ts
|
|
@@ -40,7 +41,14 @@ const AdminUserView = z.object({
|
|
|
40
41
|
image: z.string().nullable().describe("The avatar URL from a social profile, or null."),
|
|
41
42
|
locale: Locale.nullable().optional().describe("The reader's chosen language as a BCP-47 tag; null when they have never chosen one, and absent when the Worker that answered predates the field (#450)."),
|
|
42
43
|
createdAt: z.iso.datetime().describe("When the user was created, ISO-8601."),
|
|
43
|
-
updatedAt: z.iso.datetime().describe("When the row was last written, ISO-8601.")
|
|
44
|
+
updatedAt: z.iso.datetime().describe("When the row was last written, ISO-8601."),
|
|
45
|
+
state: z.enum([
|
|
46
|
+
"active",
|
|
47
|
+
"suspended",
|
|
48
|
+
"deleted"
|
|
49
|
+
]).optional().describe("Where the account stands now: `active`; `suspended`, refused until it is reinstated or its end passes; or `deleted`, refused and restorable until `purgeAfter`. A suspension whose end has passed reads `active`, as enforcement reads it. Absent when the Worker that answered predates the field."),
|
|
50
|
+
suspendedUntil: z.iso.datetime().nullable().optional().describe("When a suspension in force ends by itself, ISO-8601. Null for one that lasts until a reinstatement, and in every other state. Absent when the Worker predates the field."),
|
|
51
|
+
purgeAfter: z.iso.datetime().nullable().optional().describe("For a deleted account, when the purge may erase it, ISO-8601 — restorable until then. Null in every other state. Absent when the Worker predates the field.")
|
|
44
52
|
}).describe("One user as a management client sees them. The table holds no credential, so nothing is withheld.");
|
|
45
53
|
/** A session as a management client may see it — the token is not part of the contract. */
|
|
46
54
|
const AdminSessionView = z.object({
|
|
@@ -107,6 +115,46 @@ const AdminDevicesResponse = z.object({
|
|
|
107
115
|
nextCursor: NextCursor
|
|
108
116
|
}).describe("A page of the device registry.");
|
|
109
117
|
/**
|
|
118
|
+
* One sign-in link or code from the verification ledger (#829), as a management client sees it.
|
|
119
|
+
*
|
|
120
|
+
* Never the token and never the address: the ledger holds neither. The mail is named by its job id, which is how
|
|
121
|
+
* a reader holding `email:jobs:read` joins this to a bounce, a deferral or a suppression.
|
|
122
|
+
*/
|
|
123
|
+
const AdminVerificationView = z.object({
|
|
124
|
+
verificationId: z.string().describe("The verification row that carries it. Opaque; not a credential."),
|
|
125
|
+
type: VerificationType.describe("What was issued."),
|
|
126
|
+
state: VerificationState.describe("Where it stood at the moment of the read."),
|
|
127
|
+
userId: z.string().nullable().describe("The account it signs in to — known at issue, or created by its use. Null for a sign-up nobody completed."),
|
|
128
|
+
emailJobId: z.string().nullable().describe("The `pithy_email_jobs` row that carried it, under `email:jobs:read`. Null when the email seam failed and nothing was queued."),
|
|
129
|
+
issuedAt: z.iso.datetime().describe("When it was issued, ISO-8601."),
|
|
130
|
+
expiresAt: z.iso.datetime().describe("When it stops working, used or not, ISO-8601."),
|
|
131
|
+
usedAt: z.iso.datetime().nullable().describe("When it signed somebody in, ISO-8601, or null.")
|
|
132
|
+
}).describe("One sign-in link or code: what it was, whose, the mail that carried it, and where it stands.");
|
|
133
|
+
/** How many of one type were issued over the window, and where they stand. */
|
|
134
|
+
const VerificationTypeCounts = z.object({
|
|
135
|
+
type: VerificationType.describe("Which type these counts are for."),
|
|
136
|
+
issued: z.number().int().min(0).describe("How many were issued in the window."),
|
|
137
|
+
used: z.number().int().min(0).describe("How many of those signed somebody in."),
|
|
138
|
+
expired: z.number().int().min(0).describe("How many ran out unused."),
|
|
139
|
+
pending: z.number().int().min(0).describe("How many are unused and still work. The three add up to `issued`.")
|
|
140
|
+
}).describe("One type's counts over the window, by state.");
|
|
141
|
+
/**
|
|
142
|
+
* `GET {base}/admin/verifications` (#829): the window it covered, the counts by type and state over all of it,
|
|
143
|
+
* and a page of its rows, newest issue first.
|
|
144
|
+
*
|
|
145
|
+
* The counts cover every row in the window whatever the page or the filters say, and every type, with zeros —
|
|
146
|
+
* so a pane reading "sign-in links: 0 issued" can tell it from a Worker that did not say.
|
|
147
|
+
*/
|
|
148
|
+
const AdminVerificationsResponse = z.object({
|
|
149
|
+
window: z.object({
|
|
150
|
+
since: z.iso.datetime().describe("The window's start, inclusive, ISO-8601."),
|
|
151
|
+
until: z.iso.datetime().describe("The window's end, exclusive, ISO-8601.")
|
|
152
|
+
}).describe("The window of issue times the counts and the rows cover."),
|
|
153
|
+
counts: z.array(VerificationTypeCounts).describe("Every type's counts over the whole window, by state."),
|
|
154
|
+
verifications: z.array(AdminVerificationView).describe("The page of rows, newest issue first."),
|
|
155
|
+
nextCursor: NextCursor
|
|
156
|
+
}).describe("The verification ledger over a window: counts by type and state, and the rows, paged.");
|
|
157
|
+
/**
|
|
110
158
|
* `POST {base}/admin/sessions/revoke` and `POST {base}/admin/users/:userId/sessions/revoke`.
|
|
111
159
|
*
|
|
112
160
|
* A count and nothing else, deliberately. Both routes are idempotent — revoking a session that has
|
|
@@ -119,12 +167,152 @@ const AdminDeviceRevokeResponse = z.object({
|
|
|
119
167
|
revoked: RevokedCount,
|
|
120
168
|
removed: z.boolean().describe("Whether a device row was deleted. False when the user had no such device.")
|
|
121
169
|
}).describe("How many sessions the device revocation ended, and whether the registry row went with them.");
|
|
170
|
+
/**
|
|
171
|
+
* `POST {base}/admin/users/:userId/suspend` (#621).
|
|
172
|
+
*
|
|
173
|
+
* The suspension the account is now under, how many sessions ended with it, and whether the person was told.
|
|
174
|
+
* Not the reason: the caller wrote it, the trail keeps it, and echoing it back would put it in one more place
|
|
175
|
+
* a dashboard logs.
|
|
176
|
+
*/
|
|
177
|
+
const AdminUserSuspendResponse = z.object({
|
|
178
|
+
userId: z.string().describe("The account suspended, as `pithy_auth_users.id` stores it."),
|
|
179
|
+
state: z.literal("suspended").describe("Where the account stands now. Every sign-in and refresh is refused."),
|
|
180
|
+
outcome: z.enum(["suspended", "updated"]).describe("`suspended` when this call suspended an account in good standing; `updated` when it was already suspended and this call restated the reason and the end."),
|
|
181
|
+
suspendedAt: z.iso.datetime().describe("When the suspension in force began, ISO-8601. A restatement keeps the original start."),
|
|
182
|
+
suspendedUntil: z.iso.datetime().nullable().describe("When it ends by itself, ISO-8601, with nothing written to end it. Null lasts until a reinstatement."),
|
|
183
|
+
sessionsRevoked: RevokedCount,
|
|
184
|
+
mailed: z.boolean().describe("Whether the account-suspended mail was enqueued. False for `notify: false`, when the config turns it off, or when no email capability is composed.")
|
|
185
|
+
}).describe("A suspended account: since when, until when, how many sessions it cost, and whether the person was told.");
|
|
186
|
+
/**
|
|
187
|
+
* `POST {base}/admin/users/:userId/reinstate` (#621).
|
|
188
|
+
*
|
|
189
|
+
* No session count: a reinstatement restores none. The person signs in again.
|
|
190
|
+
*/
|
|
191
|
+
const AdminUserReinstateResponse = z.object({
|
|
192
|
+
userId: z.string().describe("The account reinstated, as `pithy_auth_users.id` stores it."),
|
|
193
|
+
state: z.literal("active").describe("Where the account stands now. It can sign in again."),
|
|
194
|
+
outcome: z.enum(["reinstated", "unchanged"]).describe("`reinstated` when this call lifted a suspension; `unchanged` when there was none in force — never suspended, or past its end — and nothing was written."),
|
|
195
|
+
mailed: z.boolean().describe("Whether the account-reinstated mail was enqueued. Always false for `unchanged`, and on the same rule as a suspension's otherwise.")
|
|
196
|
+
}).describe("A reinstated account, and whether the person was told. Its revoked sessions stay revoked.");
|
|
197
|
+
/** When the purge may erase a deleted account, ISO-8601. */
|
|
198
|
+
const PurgeAfter = z.iso.datetime().describe("When the purge may erase the account, ISO-8601. It can be restored until then; a hard deletion's is the moment it was deleted.");
|
|
199
|
+
/**
|
|
200
|
+
* `DELETE {base}/admin/users/:userId` (#622).
|
|
201
|
+
*
|
|
202
|
+
* What the deletion left in force, how many sessions ended with it, whether the person was told, and what
|
|
203
|
+
* became of the purge. Not the reason: the caller wrote it and the trail keeps it.
|
|
204
|
+
*/
|
|
205
|
+
const AdminUserDeleteResponse = z.object({
|
|
206
|
+
userId: z.string().describe("The account deleted, as `pithy_auth_users.id` stores it."),
|
|
207
|
+
state: z.literal("deleted").describe("Where the account stands now. Every sign-in and refresh is refused."),
|
|
208
|
+
mode: z.enum(["soft", "hard"]).describe("The mode this call ran in — `soft` unless the caller named `hard`."),
|
|
209
|
+
outcome: z.enum([
|
|
210
|
+
"deleted",
|
|
211
|
+
"brought_forward",
|
|
212
|
+
"unchanged"
|
|
213
|
+
]).describe("`deleted` when this call deleted an account in good standing; `brought_forward` when a hard deletion moved an already-deleted account's purge to now; `unchanged` when it was already deleted and there was nothing to move."),
|
|
214
|
+
deletedAt: z.iso.datetime().describe("When the account was deleted, ISO-8601. Kept by a deletion brought forward."),
|
|
215
|
+
purgeAfter: PurgeAfter,
|
|
216
|
+
purge: z.enum([
|
|
217
|
+
"scheduled",
|
|
218
|
+
"started",
|
|
219
|
+
"pending"
|
|
220
|
+
]).describe("`scheduled`: the daily purge erases it once `purgeAfter` passes. `started`: the purge Workflow was started by this call. `pending`: the purge is due and this Worker binds no purge Workflow to start, so it runs once one is bound."),
|
|
221
|
+
sessionsRevoked: RevokedCount,
|
|
222
|
+
mailed: z.boolean().describe("Whether the deletion-scheduled mail was enqueued. Always false for `hard`, whose mail the purge sends, for `notify: false`, and when the config turns it off.")
|
|
223
|
+
}).describe("A deleted account: when, until when it can be restored, what became of the purge, and its sessions.");
|
|
224
|
+
/**
|
|
225
|
+
* `POST {base}/admin/users/:userId/restore` (#622). No session count: a restoration restores none.
|
|
226
|
+
*/
|
|
227
|
+
const AdminUserRestoreResponse = z.object({
|
|
228
|
+
userId: z.string().describe("The account restored, as `pithy_auth_users.id` stores it."),
|
|
229
|
+
state: z.enum(["active", "suspended"]).describe("Where the account stands now: `active`, or `suspended` when a suspension it was under before the deletion is still in force."),
|
|
230
|
+
outcome: z.enum(["restored", "unchanged"]).describe("`restored` when this call restored a deleted account; `unchanged` when it was not deleted.")
|
|
231
|
+
}).describe("A restored account, inside its purge window. Its revoked sessions stay revoked.");
|
|
232
|
+
/** One provider link an account holds, as an export carries it — no provider token. */
|
|
233
|
+
const AuthExportProvider = z.object({
|
|
234
|
+
providerId: z.string().describe("The sign-in provider's slug — `google`, `apple`, `github`."),
|
|
235
|
+
createdAt: z.iso.datetime().describe("When the provider was linked, ISO-8601.")
|
|
236
|
+
}).describe("One sign-in provider linked to the account. The provider's tokens are credentials and are not here.");
|
|
237
|
+
/** One transition in an account's history, as an export carries it — not who made it. */
|
|
238
|
+
const AuthExportTransition = z.object({
|
|
239
|
+
action: z.string().describe("What happened: `suspended`, `reinstated`, `deleted`, `restored`, `purge_step`, `purge_retained`, `purge_failed`, `purged`."),
|
|
240
|
+
actorType: z.string().describe("Who made it: `control-plane`, `user` (the account's holder), or `system`."),
|
|
241
|
+
reason: z.string().nullable().describe("The reason given, in the words of whoever made the transition, or null."),
|
|
242
|
+
suspendedUntil: z.iso.datetime().nullable().describe("For a suspension, when it ends by itself, ISO-8601."),
|
|
243
|
+
createdAt: z.iso.datetime().describe("When it happened, ISO-8601.")
|
|
244
|
+
}).describe("One transition in the account's history. The operator's identity is theirs, not the person's, so it is not here.");
|
|
245
|
+
/**
|
|
246
|
+
* What `@pithy-sh/auth` holds about one account, as its purge contribution exports it (#622) — the `data` of
|
|
247
|
+
* the `auth` entry in an export.
|
|
248
|
+
*
|
|
249
|
+
* The person's own data and none of their credentials: no session token, no provider token, no push token.
|
|
250
|
+
* Every list is whole, because an export that stopped at a bound would answer an access request with part of
|
|
251
|
+
* an answer.
|
|
252
|
+
*/
|
|
253
|
+
const AuthUserExport = z.object({
|
|
254
|
+
user: AdminUserView.extend({
|
|
255
|
+
suspendedAt: z.iso.datetime().nullable().describe("When a suspension in force began, ISO-8601, or null."),
|
|
256
|
+
suspendedUntil: z.iso.datetime().nullable().describe("When that suspension ends by itself, ISO-8601, or null."),
|
|
257
|
+
deletedAt: z.iso.datetime().nullable().describe("When the account was deleted, ISO-8601, or null."),
|
|
258
|
+
purgeAfter: z.iso.datetime().nullable().describe("When the purge may erase it, ISO-8601, or null.")
|
|
259
|
+
}).describe("The account itself, with where it stands."),
|
|
260
|
+
sessions: z.array(AdminSessionView).describe("Every live session, newest first. Without the tokens."),
|
|
261
|
+
providers: z.array(AuthExportProvider).describe("Every linked sign-in provider."),
|
|
262
|
+
devices: z.array(AdminDeviceView).describe("Every registered device, most recently seen first. Without push tokens."),
|
|
263
|
+
history: z.array(AuthExportTransition).describe("Every lifecycle transition, oldest first."),
|
|
264
|
+
verifications: z.array(AdminVerificationView).optional().describe("Every sign-in link and code the verification ledger records for the account, newest first (#829). Absent from a Worker that predates the ledger."),
|
|
265
|
+
plugins: z.record(z.string(), z.array(z.record(z.string(), z.unknown()))).describe("The account's rows in each table a composed Better Auth plugin created keyed by `userId` — two-factor, passkeys, API keys — keyed by table. Without a column that holds a credential. Empty when no such plugin is composed.")
|
|
266
|
+
}).describe("Everything `@pithy-sh/auth` holds about one account, without a credential.");
|
|
267
|
+
/** Fields every capability's export entry carries. */
|
|
268
|
+
const exportEntry = {
|
|
269
|
+
capability: z.string().describe("The capability whose rows these are — the purge step that erases or keeps them."),
|
|
270
|
+
summary: z.string().describe("What that capability's purge erases, anonymizes or keeps, in its own sentence."),
|
|
271
|
+
disposition: z.enum(["erase", "retain"]).optional().describe("What a purge does with these rows: `erase` (erased or anonymized) or `retain` (kept, for the reason in `basis`) (#814). Absent from a Worker that predates it, where every entry is `erase`."),
|
|
272
|
+
basis: z.string().optional().describe("For a `retain` entry, why the rows are kept, in one sentence written for the person — `Kept for tax records.` Absent for `erase`.")
|
|
273
|
+
};
|
|
274
|
+
/** One capability's part of an export. */
|
|
275
|
+
const AdminUserExportEntry = z.discriminatedUnion("state", [
|
|
276
|
+
z.object({
|
|
277
|
+
...exportEntry,
|
|
278
|
+
state: z.literal("exported").describe("The capability answered."),
|
|
279
|
+
data: z.record(z.string(), z.unknown()).describe("What it holds about the account, in the shape that capability exports. `auth`'s is `AuthUserExport`. For a `retain` entry, the rows a purge keeps.")
|
|
280
|
+
}).describe("A capability's rows about the account."),
|
|
281
|
+
z.object({
|
|
282
|
+
...exportEntry,
|
|
283
|
+
state: z.literal("not_exported").describe("The capability erases rows about the account and does not say how to export them. No kit capability answers it; an adopter's own may.")
|
|
284
|
+
}).describe("A capability that holds rows it does not export. Ask its owner."),
|
|
285
|
+
z.object({
|
|
286
|
+
...exportEntry,
|
|
287
|
+
state: z.literal("unavailable").describe("The capability's rows could not be read on this request.")
|
|
288
|
+
}).describe("Nothing was established about this capability's rows. Deliberately empty — it is not 'none'.")
|
|
289
|
+
]).describe("One capability's part of an export, behind a state, so an unread part cannot be taken for an empty one.");
|
|
290
|
+
/**
|
|
291
|
+
* `GET {base}/admin/users/:userId/export` (#622).
|
|
292
|
+
*
|
|
293
|
+
* Everything the kit holds about one account — the answer to an access request. One entry per composed
|
|
294
|
+
* capability that declares a purge contribution, in the order the purge runs them, each read on its own so
|
|
295
|
+
* one that will not read costs its own entry and not the document.
|
|
296
|
+
*/
|
|
297
|
+
const AdminUserExportResponse = z.object({
|
|
298
|
+
subject: z.object({
|
|
299
|
+
type: z.literal("user").describe("The kind of subject: one person's account."),
|
|
300
|
+
id: z.string().describe("The account's id, as `pithy_auth_users.id` stores it.")
|
|
301
|
+
}).describe("Who this export is about."),
|
|
302
|
+
exportedAt: z.iso.datetime().describe("When the export was read, ISO-8601."),
|
|
303
|
+
capabilities: z.array(AdminUserExportEntry).describe("Every composed capability's part, in the order the purge erases them.")
|
|
304
|
+
}).describe("Everything the kit holds about one account, from every composed capability, as one document.");
|
|
122
305
|
/** `POST {base}/token/rotate`. */
|
|
123
306
|
const TokenRotateResponse = z.object({
|
|
124
|
-
accessToken: z.string().describe("A
|
|
125
|
-
refreshToken: z.string().describe("The successor
|
|
307
|
+
accessToken: z.string().describe("A short-lived JWT for a service outside this Worker, which verifies it against `/jwks`. The kit's own routes do not accept it: send `refreshToken` as the bearer."),
|
|
308
|
+
refreshToken: z.string().describe("The successor session token: the bearer credential for `Authorization: Bearer` on the kit's routes, and what the next rotation takes. The one presented is spent, and presenting it again past a short grace window revokes the whole family."),
|
|
126
309
|
expiresAt: z.iso.datetime().describe("When the successor session lapses, ISO-8601.")
|
|
127
|
-
}).describe("The rotated
|
|
310
|
+
}).describe("The rotated credentials: the session token that replaces the one presented, and a JWT for outside verifiers.");
|
|
311
|
+
/** `POST {base}/handoff`. */
|
|
312
|
+
const HandoffExchangeResponse = z.object({
|
|
313
|
+
token: z.string().describe("The raw session token: the bearer credential for `Authorization: Bearer`, and the refresh credential `/token/rotate` takes. Hold it in secure storage."),
|
|
314
|
+
expiresAt: z.iso.datetime().describe("When the session lapses unless it is rotated first, ISO-8601.")
|
|
315
|
+
}).describe("The session a redirect sign-in made, handed to the native app that started it.");
|
|
128
316
|
/** One of the caller's own registered devices. */
|
|
129
317
|
const MyDeviceView = z.object({
|
|
130
318
|
id: z.string().describe("The client-generated device id it registered at sign-in."),
|
|
@@ -143,5 +331,14 @@ const MyDeviceView = z.object({
|
|
|
143
331
|
const MyDevicesResponse = z.object({ devices: z.array(MyDeviceView).describe("Every device registered to the caller, most recently seen first.") }).describe("The caller's own registered devices.");
|
|
144
332
|
/** `POST {base}/devices/revoke`. */
|
|
145
333
|
const MyDeviceRevokeResponse = z.object({ revoked: RevokedCount }).describe("How many of the device's sessions the revocation signed out. The device's row goes with them.");
|
|
334
|
+
/**
|
|
335
|
+
* `DELETE {base}/account` (#622) — the signed-in person deleted their own account. Always soft, on the
|
|
336
|
+
* configured window. Their sessions end with it, this one included.
|
|
337
|
+
*/
|
|
338
|
+
const AccountDeleteResponse = z.object({
|
|
339
|
+
state: z.literal("deleted").describe("The account is deleted. This session and every other one has ended."),
|
|
340
|
+
purgeAfter: PurgeAfter,
|
|
341
|
+
mailed: z.boolean().describe("Whether the deletion-scheduled mail, with the purge date and how to ask for the account back, was sent.")
|
|
342
|
+
}).describe("The caller's own account, deleted: when its data will be erased, and whether they were mailed.");
|
|
146
343
|
//#endregion
|
|
147
|
-
export { AdminDeviceRevokeResponse, AdminDeviceView, AdminDevicesResponse, AdminRevokeResponse, AdminSessionView, AdminUserResponse, AdminUserView, AdminUsersResponse, MyDeviceRevokeResponse, MyDeviceView, MyDevicesResponse, TokenRotateResponse };
|
|
344
|
+
export { AccountDeleteResponse, AdminDeviceRevokeResponse, AdminDeviceView, AdminDevicesResponse, AdminRevokeResponse, AdminSessionView, AdminUserDeleteResponse, AdminUserExportResponse, AdminUserReinstateResponse, AdminUserResponse, AdminUserRestoreResponse, AdminUserSuspendResponse, AdminUserView, AdminUsersResponse, AdminVerificationView, AdminVerificationsResponse, AuthUserExport, HandoffExchangeResponse, MyDeviceRevokeResponse, MyDeviceView, MyDevicesResponse, TokenRotateResponse, VerificationTypeCounts };
|
package/dist/http/routes.d.ts
CHANGED
|
@@ -17,8 +17,11 @@ import type { AuthWiring } from "../capability";
|
|
|
17
17
|
* | Route | Verification | Input |
|
|
18
18
|
* | -------------------------- | --------------- | --------------------------- |
|
|
19
19
|
* | `POST /token/rotate` | bearer/session | none — the credential only |
|
|
20
|
+
* | `GET /sign-in/social/start` | public | query `SocialSignInStartQuery` |
|
|
21
|
+
* | `POST /handoff` | public | json `HandoffExchangeBody` |
|
|
20
22
|
* | `GET /devices` | bearer/session | none |
|
|
21
23
|
* | `POST /devices/revoke` | bearer/session | json `RevokeDeviceBody` |
|
|
24
|
+
* | `DELETE /account` | bearer/session | json `DeleteAccountBody` |
|
|
22
25
|
* | `* /admin/*` | control-plane | see `./adminRoutes` |
|
|
23
26
|
*
|
|
24
27
|
* The catch-all takes NO validator, deliberately: `handleBetterAuth` hands Better Auth `c.req.raw`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/http/routes.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/http/routes.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAS7E,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,MAAM,CAAC;AAG1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAkDhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,CAAC,KAAK,IAAI,CAyKtF"}
|