@molecule/api-resource-user 1.6.0 → 1.7.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 +165 -40
- package/dist/handlers/create.d.ts +19 -5
- package/dist/handlers/create.d.ts.map +1 -1
- package/dist/handlers/create.js +20 -5
- package/dist/handlers/create.js.map +1 -1
- package/dist/handlers/del.d.ts +2 -2
- package/dist/handlers/del.d.ts.map +1 -1
- package/dist/handlers/del.js +1 -1
- package/dist/handlers/del.js.map +1 -1
- package/dist/handlers/forgotPassword.d.ts +2 -2
- package/dist/handlers/forgotPassword.d.ts.map +1 -1
- package/dist/handlers/forgotPassword.js +2 -2
- package/dist/handlers/forgotPassword.js.map +1 -1
- package/dist/handlers/logIn.d.ts +13 -6
- package/dist/handlers/logIn.d.ts.map +1 -1
- package/dist/handlers/logIn.js +13 -6
- package/dist/handlers/logIn.js.map +1 -1
- package/dist/handlers/logInOAuth.d.ts +8 -4
- package/dist/handlers/logInOAuth.d.ts.map +1 -1
- package/dist/handlers/logInOAuth.js +9 -5
- package/dist/handlers/logInOAuth.js.map +1 -1
- package/dist/handlers/payments/handlePaymentNotification.d.ts +2 -2
- package/dist/handlers/payments/handlePaymentNotification.d.ts.map +1 -1
- package/dist/handlers/payments/handlePaymentNotification.js +2 -2
- package/dist/handlers/payments/handlePaymentNotification.js.map +1 -1
- package/dist/handlers/payments/verifyPayment.d.ts +2 -2
- package/dist/handlers/payments/verifyPayment.d.ts.map +1 -1
- package/dist/handlers/payments/verifyPayment.js +1 -1
- package/dist/handlers/payments/verifyPayment.js.map +1 -1
- package/dist/handlers/read.d.ts +2 -2
- package/dist/handlers/read.d.ts.map +1 -1
- package/dist/handlers/read.js +1 -1
- package/dist/handlers/read.js.map +1 -1
- package/dist/handlers/readSelf.d.ts +2 -2
- package/dist/handlers/readSelf.d.ts.map +1 -1
- package/dist/handlers/readSelf.js +1 -1
- package/dist/handlers/readSelf.js.map +1 -1
- package/dist/handlers/resetPassword.d.ts +2 -1
- package/dist/handlers/resetPassword.d.ts.map +1 -1
- package/dist/handlers/resetPassword.js +2 -1
- package/dist/handlers/resetPassword.js.map +1 -1
- package/dist/handlers/update.d.ts +10 -4
- package/dist/handlers/update.d.ts.map +1 -1
- package/dist/handlers/update.js +10 -4
- package/dist/handlers/update.js.map +1 -1
- package/dist/handlers/updatePassword.d.ts +2 -2
- package/dist/handlers/updatePassword.d.ts.map +1 -1
- package/dist/handlers/updatePassword.js +2 -2
- package/dist/handlers/updatePassword.js.map +1 -1
- package/dist/handlers/updatePlan.d.ts +2 -2
- package/dist/handlers/updatePlan.d.ts.map +1 -1
- package/dist/handlers/updatePlan.js +1 -1
- package/dist/handlers/updatePlan.js.map +1 -1
- package/dist/handlers/verifyTwoFactor.d.ts +2 -2
- package/dist/handlers/verifyTwoFactor.d.ts.map +1 -1
- package/dist/handlers/verifyTwoFactor.js +2 -2
- package/dist/handlers/verifyTwoFactor.js.map +1 -1
- package/dist/index.d.ts +58 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +58 -0
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +38 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-10-
|
|
6
|
+
Generated: 2026-10-19T22:44:43.616Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/api-resource-user
|
|
@@ -73,6 +73,65 @@ res.status(statusCode).send(body)
|
|
|
73
73
|
Monkey-patching `res.json` to re-shape a handler's answer intercepts nothing the handler
|
|
74
74
|
produces, so the request it was meant to answer is left unanswered and hangs.
|
|
75
75
|
|
|
76
|
+
**Re-shaping a success answer (RealWorld's `{ user: { …, token } }`, say)? Read the token from
|
|
77
|
+
`result.body.accessToken` — it is in the BODY.** The `Authorization` response header carries
|
|
78
|
+
the same token prefixed with the mount's scheme (`Bearer <token>`), so it is not the raw value
|
|
79
|
+
a client sends back. Type the result from the handler — do not cast `body` to `unknown`, which
|
|
80
|
+
hides the success branch — and narrow on the body's own keys:
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
const result = await handlers.logIn(resource)(req, res)
|
|
84
|
+
if (!('accessToken' in result.body)) {
|
|
85
|
+
// 400/403/500 `{ error, errorKey }`, or 206 `{ twoFactorRequired: true }` — send as built.
|
|
86
|
+
res.status(result.statusCode).send(result.body)
|
|
87
|
+
return
|
|
88
|
+
}
|
|
89
|
+
// `props` and `user` are the SAFE columns (secret columns stripped); accessToken is the token.
|
|
90
|
+
const { props, accessToken } = result.body
|
|
91
|
+
res.status(200).json({ user: { ...props, token: accessToken } })
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**Constructing a handler: `schema` is optional.** Every factory accepts
|
|
95
|
+
`{ name, tableName, schema? }`. `schema` is a Zod object (anything exposing `safeParse`)
|
|
96
|
+
and only `handlers.create` / `handlers.logInOAuth` use it — both default to this package's
|
|
97
|
+
`propsSchema`. `handlers.update` validates with its own update schema; login and the
|
|
98
|
+
read/write handlers never validate props. The smallest correct wiring, with every import
|
|
99
|
+
spelled out:
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
import { createRequestHandler } from '@molecule/api-resource'
|
|
103
|
+
import { createResource, handlers } from '@molecule/api-resource-user'
|
|
104
|
+
|
|
105
|
+
// Omit `schema`: create() validates new users with this package's propsSchema.
|
|
106
|
+
const signUp = createRequestHandler(handlers.create({ name: 'User', tableName: 'users' }))
|
|
107
|
+
const signIn = createRequestHandler(handlers.logIn({ name: 'User', tableName: 'users' }))
|
|
108
|
+
|
|
109
|
+
// A constrained schema, when the app restricts oauthServer / planKey.
|
|
110
|
+
const users = createResource({ oauthServers: ['google', 'github'] as const })
|
|
111
|
+
const signUpConstrained = createRequestHandler(handlers.create(users))
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
`schema: {}` (or any object without `safeParse`) is NOT a schema: the first request
|
|
115
|
+
answers 400 `resource.error.unknownError` with
|
|
116
|
+
`TypeError: schema.safeParse is not a function`, and no row is written. Omit `schema`
|
|
117
|
+
instead of stubbing it.
|
|
118
|
+
|
|
119
|
+
**Exact responses of the sign-up and sign-in handlers** (the body shapes the routes send;
|
|
120
|
+
a handler returns `{ statusCode, body }` and the mount applies it):
|
|
121
|
+
|
|
122
|
+
- `create` (`POST /api/users`, flat body): 201 `{ props, accessToken, user }` (`user` equals
|
|
123
|
+
`props`, secret columns stripped); 400 `user.error.usernameInvalid` /
|
|
124
|
+
`user.error.bodyNestedUnderUser` / `user.error.passwordRequired` /
|
|
125
|
+
`user.error.passwordTooLong` / `user.error.passwordTooShort` / `user.error.emailInvalid` /
|
|
126
|
+
`user.error.badRequest`, or `resource.error.unknownError` when props fail the schema;
|
|
127
|
+
403 `user.error.usernameUnavailable` / `user.error.emailAlreadyRegistered`;
|
|
128
|
+
500 `user.error.failedToHashPassword` / `user.error.failedToCreateSession`.
|
|
129
|
+
- `logIn` (`POST /api/users/log-in`): 200 `{ props, accessToken, user }`; 206
|
|
130
|
+
`{ twoFactorRequired: true }`; 403 `user.error.invalidCredentials` /
|
|
131
|
+
`user.error.invalidTwoFactorToken`; 500 `user.error.failedToCreateSession` /
|
|
132
|
+
`user.error.twoFactorVerificationUnavailable` / `user.error.loginFailed`. Bad credentials
|
|
133
|
+
are 403, not 401 or 422.
|
|
134
|
+
|
|
76
135
|
> **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
|
|
77
136
|
> It is written to be read by coding agents as much as by people, and is generated from this
|
|
78
137
|
> package's source — edit `src/index.ts` JSDoc, not this file.
|
|
@@ -1067,8 +1126,22 @@ Creates a user with username and password. Validates username uniqueness and ema
|
|
|
1067
1126
|
hashes the password into a separate secrets table, creates a session device via the bonded
|
|
1068
1127
|
DeviceService, and sets JWT authorization on the response.
|
|
1069
1128
|
|
|
1129
|
+
**`schema` is optional — omit it and this package's `propsSchema` validates the row.**
|
|
1130
|
+
It must be a Zod object (anything exposing `safeParse`): pass
|
|
1131
|
+
`createResource({ oauthServers, planKeys })` or your own extended schema only when the
|
|
1132
|
+
app constrains or extends user props. A stub such as `schema: {}` is not a schema — the
|
|
1133
|
+
FIRST request answers 400 `resource.error.unknownError` with
|
|
1134
|
+
`TypeError: schema.safeParse is not a function`, after no row has been written.
|
|
1135
|
+
|
|
1136
|
+
Statuses: 201 `{ props, accessToken, user }`; 400 `user.error.usernameInvalid` /
|
|
1137
|
+
`user.error.bodyNestedUnderUser` / `user.error.passwordRequired` /
|
|
1138
|
+
`user.error.passwordTooLong` / `user.error.passwordTooShort` / `user.error.emailInvalid` /
|
|
1139
|
+
`user.error.badRequest`, or `resource.error.unknownError` when props fail the schema;
|
|
1140
|
+
403 `user.error.usernameUnavailable` / `user.error.emailAlreadyRegistered`;
|
|
1141
|
+
500 `user.error.failedToHashPassword` / `user.error.failedToCreateSession`.
|
|
1142
|
+
|
|
1070
1143
|
```typescript
|
|
1071
|
-
function create({ name, tableName, schema }: types.
|
|
1144
|
+
function create({ name, tableName, schema = propsSchema }: types.HandlerResource): (
|
|
1072
1145
|
req: CreateRequest,
|
|
1073
1146
|
res: MoleculeResponse,
|
|
1074
1147
|
) => Promise<
|
|
@@ -1088,12 +1161,12 @@ function create({ name, tableName, schema }: types.Resource<unknown>): (
|
|
|
1088
1161
|
>
|
|
1089
1162
|
```
|
|
1090
1163
|
|
|
1091
|
-
- `resource` — The user resource configuration
|
|
1092
|
-
- `resource.name` — The resource name.
|
|
1164
|
+
- `resource` — The user resource configuration: `{ name, tableName, schema? }`.
|
|
1165
|
+
- `resource.name` — The resource name used in error messages.
|
|
1093
1166
|
- `resource.tableName` — The database table name for users.
|
|
1094
|
-
- `resource.schema` —
|
|
1167
|
+
- `resource.schema` — Optional Zod schema for the created user props. Defaults to `propsSchema`.
|
|
1095
1168
|
|
|
1096
|
-
**Returns:** A request handler that responds with `{ statusCode: 201, body: { props } }` on success.
|
|
1169
|
+
**Returns:** A request handler that responds with `{ statusCode: 201, body: { props, accessToken, user } }` on success.
|
|
1097
1170
|
|
|
1098
1171
|
##### `handlers.del(resource)`
|
|
1099
1172
|
|
|
@@ -1113,7 +1186,7 @@ function del({
|
|
|
1113
1186
|
name: _name,
|
|
1114
1187
|
tableName,
|
|
1115
1188
|
schema: _schema,
|
|
1116
|
-
}: types.
|
|
1189
|
+
}: types.HandlerResource): (
|
|
1117
1190
|
req: MoleculeRequest,
|
|
1118
1191
|
) => Promise<
|
|
1119
1192
|
| { statusCode: number; body: { error: string; errorKey: string; props?: undefined } }
|
|
@@ -1124,7 +1197,7 @@ function del({
|
|
|
1124
1197
|
- `resource` — The user resource configuration (name, tableName, schema).
|
|
1125
1198
|
- `resource.name` — The resource name.
|
|
1126
1199
|
- `resource.tableName` — The database table name for users.
|
|
1127
|
-
- `resource.schema` —
|
|
1200
|
+
- `resource.schema` — Optional. Ignored — deletion does not validate props.
|
|
1128
1201
|
|
|
1129
1202
|
**Returns:** A request handler that responds with `{ statusCode: 200, body: { props: { id } } }` on success.
|
|
1130
1203
|
|
|
@@ -1151,7 +1224,7 @@ function forgotPassword({
|
|
|
1151
1224
|
name: _name,
|
|
1152
1225
|
tableName,
|
|
1153
1226
|
schema: _schema,
|
|
1154
|
-
}: types.
|
|
1227
|
+
}: types.HandlerResource): (
|
|
1155
1228
|
req: ForgotPasswordRequest,
|
|
1156
1229
|
) => Promise<
|
|
1157
1230
|
| { statusCode: number; body: { error: string; errorKey: string; success?: undefined } }
|
|
@@ -1162,7 +1235,7 @@ function forgotPassword({
|
|
|
1162
1235
|
- `resource` — The user resource configuration (name, tableName, schema).
|
|
1163
1236
|
- `resource.name` — The resource name.
|
|
1164
1237
|
- `resource.tableName` — The database table name for users.
|
|
1165
|
-
- `resource.schema` —
|
|
1238
|
+
- `resource.schema` — Optional. Ignored — the reset flow reads and writes secrets directly.
|
|
1166
1239
|
|
|
1167
1240
|
**Returns:** A request handler that responds with `{ statusCode: 200, body: { success: true } }`.
|
|
1168
1241
|
|
|
@@ -1190,8 +1263,15 @@ authentication (1-hour expiry), and optional two-factor verification via `@molec
|
|
|
1190
1263
|
On success, creates/updates a device via the bonded DeviceService, sets JWT authorization,
|
|
1191
1264
|
and notifies other devices about the new login.
|
|
1192
1265
|
|
|
1266
|
+
`schema` is optional and NOT used here: login reads stored rows and compares credentials, so
|
|
1267
|
+
there are no props to validate. Statuses: 200 `{ props, accessToken, user }`; 206
|
|
1268
|
+
`{ twoFactorRequired: true }` when the account has 2FA enabled and no `twoFactorToken` was
|
|
1269
|
+
sent; 403 `user.error.invalidCredentials` (wrong password / unknown account / spent reset
|
|
1270
|
+
token) or `user.error.invalidTwoFactorToken`; 500 `user.error.failedToCreateSession` /
|
|
1271
|
+
`user.error.twoFactorVerificationUnavailable` / `user.error.loginFailed`.
|
|
1272
|
+
|
|
1193
1273
|
```typescript
|
|
1194
|
-
function logIn({
|
|
1274
|
+
function logIn({ tableName }: types.HandlerResource): (
|
|
1195
1275
|
req: LogInRequest,
|
|
1196
1276
|
res: MoleculeResponse,
|
|
1197
1277
|
) => Promise<
|
|
@@ -1231,12 +1311,12 @@ function logIn({ name: _name, tableName, schema: _schema }: types.Resource<unkno
|
|
|
1231
1311
|
>
|
|
1232
1312
|
```
|
|
1233
1313
|
|
|
1234
|
-
- `resource` — The user resource configuration
|
|
1235
|
-
- `resource.name` — The resource name.
|
|
1314
|
+
- `resource` — The user resource configuration: `{ name, tableName, schema? }`.
|
|
1315
|
+
- `resource.name` — The resource name (unused by this handler).
|
|
1236
1316
|
- `resource.tableName` — The database table name for users.
|
|
1237
|
-
- `resource.schema` —
|
|
1317
|
+
- `resource.schema` — Optional. Ignored — login validates credentials, not props.
|
|
1238
1318
|
|
|
1239
|
-
**Returns:** A request handler that responds with `{ statusCode: 200, body: { props } }` on success, or `{ statusCode: 206, body: { twoFactorRequired: true } }` when 2FA is needed.
|
|
1319
|
+
**Returns:** A request handler that responds with `{ statusCode: 200, body: { props, accessToken, user } }` on success, or `{ statusCode: 206, body: { twoFactorRequired: true } }` when 2FA is needed.
|
|
1240
1320
|
|
|
1241
1321
|
##### `handlers.LogInOAuthRequest`
|
|
1242
1322
|
|
|
@@ -1261,8 +1341,12 @@ Logs in or creates a user via OAuth. Verifies the authorization code with the bo
|
|
|
1261
1341
|
provider (`get('oauth', serverName)`), then either finds an existing user by oauthServer+oauthId
|
|
1262
1342
|
or creates a new one with a unique username. Sets JWT authorization and creates a session device.
|
|
1263
1343
|
|
|
1344
|
+
`schema` is optional and defaults to this package's `propsSchema`; supply one only when the
|
|
1345
|
+
app constrains or extends user props. It must expose `safeParse` — a stub fails the OAuth
|
|
1346
|
+
account-creation request with 400 `resource.error.unknownError`.
|
|
1347
|
+
|
|
1264
1348
|
```typescript
|
|
1265
|
-
function logInOAuth({ name, tableName, schema }: types.
|
|
1349
|
+
function logInOAuth({ name, tableName, schema = propsSchema }: types.HandlerResource): (
|
|
1266
1350
|
req: LogInOAuthRequest,
|
|
1267
1351
|
res: MoleculeResponse,
|
|
1268
1352
|
) => Promise<
|
|
@@ -1286,10 +1370,10 @@ function logInOAuth({ name, tableName, schema }: types.Resource<unknown>): (
|
|
|
1286
1370
|
>
|
|
1287
1371
|
```
|
|
1288
1372
|
|
|
1289
|
-
- `resource` — The user resource configuration
|
|
1290
|
-
- `resource.name` — The resource name.
|
|
1373
|
+
- `resource` — The user resource configuration: `{ name, tableName, schema? }`.
|
|
1374
|
+
- `resource.name` — The resource name used in error messages.
|
|
1291
1375
|
- `resource.tableName` — The database table name for users.
|
|
1292
|
-
- `resource.schema` —
|
|
1376
|
+
- `resource.schema` — Optional Zod schema validated when a new OAuth account is created. Defaults to `propsSchema`.
|
|
1293
1377
|
|
|
1294
1378
|
**Returns:** A request handler that responds with `{ statusCode: 200, body: { props } }` on success.
|
|
1295
1379
|
|
|
@@ -1403,7 +1487,7 @@ function handlePaymentNotification({
|
|
|
1403
1487
|
name,
|
|
1404
1488
|
tableName,
|
|
1405
1489
|
schema: _schema,
|
|
1406
|
-
}: types.
|
|
1490
|
+
}: types.HandlerResource): (
|
|
1407
1491
|
req: MoleculeRequest,
|
|
1408
1492
|
) => Promise<{ statusCode: number; body: string } | { statusCode: number; body: { error: string } }>
|
|
1409
1493
|
```
|
|
@@ -1411,7 +1495,7 @@ function handlePaymentNotification({
|
|
|
1411
1495
|
- `resource` — The user resource configuration (name, tableName, schema).
|
|
1412
1496
|
- `resource.name` — The resource name.
|
|
1413
1497
|
- `resource.tableName` — The database table name for users.
|
|
1414
|
-
- `resource.schema` —
|
|
1498
|
+
- `resource.schema` — Optional. Ignored — notifications validate with `updatePlanPropsSchema`.
|
|
1415
1499
|
|
|
1416
1500
|
**Returns:** A request handler for payment provider notifications.
|
|
1417
1501
|
|
|
@@ -1428,7 +1512,7 @@ On successful verification, updates the user's plan (planKey, planExpiresAt, pla
|
|
|
1428
1512
|
and stores the payment record via the bonded PaymentRecordService.
|
|
1429
1513
|
|
|
1430
1514
|
```typescript
|
|
1431
|
-
function verifyPayment({ name, tableName, schema: _schema }: types.
|
|
1515
|
+
function verifyPayment({ name, tableName, schema: _schema }: types.HandlerResource): (
|
|
1432
1516
|
req: MoleculeRequest,
|
|
1433
1517
|
) => Promise<
|
|
1434
1518
|
| { statusCode: number; body: { error: string; errorKey: string; props?: undefined } }
|
|
@@ -1450,7 +1534,7 @@ function verifyPayment({ name, tableName, schema: _schema }: types.Resource<unkn
|
|
|
1450
1534
|
- `resource` — The user resource configuration (name, tableName, schema).
|
|
1451
1535
|
- `resource.name` — The resource name.
|
|
1452
1536
|
- `resource.tableName` — The database table name for users.
|
|
1453
|
-
- `resource.schema` —
|
|
1537
|
+
- `resource.schema` — Optional. Ignored — plan fields are written directly after provider verification.
|
|
1454
1538
|
|
|
1455
1539
|
**Returns:** A request handler for payment verification.
|
|
1456
1540
|
|
|
@@ -1465,7 +1549,7 @@ function read({
|
|
|
1465
1549
|
name: _name,
|
|
1466
1550
|
tableName,
|
|
1467
1551
|
schema: _schema,
|
|
1468
|
-
}: types.
|
|
1552
|
+
}: types.HandlerResource): (
|
|
1469
1553
|
req: MoleculeRequest,
|
|
1470
1554
|
res: MoleculeResponse,
|
|
1471
1555
|
) => Promise<{ statusCode: number; body: Record<string, unknown> }>
|
|
@@ -1474,7 +1558,7 @@ function read({
|
|
|
1474
1558
|
- `resource` — The user resource configuration (name, tableName, schema).
|
|
1475
1559
|
- `resource.name` — The resource name.
|
|
1476
1560
|
- `resource.tableName` — The database table name for users.
|
|
1477
|
-
- `resource.schema` —
|
|
1561
|
+
- `resource.schema` — Optional. Ignored — reads do not validate props.
|
|
1478
1562
|
|
|
1479
1563
|
**Returns:** A request handler that responds with `{ statusCode: 200, body: { props, plan?, twoFactorEnabled? } }`.
|
|
1480
1564
|
|
|
@@ -1502,13 +1586,13 @@ NEVER gets this field: exposing that token to JavaScript would defeat the cookie
|
|
|
1502
1586
|
```typescript
|
|
1503
1587
|
function readSelf({
|
|
1504
1588
|
tableName,
|
|
1505
|
-
}: types.
|
|
1589
|
+
}: types.HandlerResource): (
|
|
1506
1590
|
_req: MoleculeRequest,
|
|
1507
1591
|
res: MoleculeResponse,
|
|
1508
1592
|
) => Promise<{ statusCode: number; body: Record<string, unknown> }>
|
|
1509
1593
|
```
|
|
1510
1594
|
|
|
1511
|
-
- `resource` — The user resource configuration
|
|
1595
|
+
- `resource` — The user resource configuration: `{ name, tableName, schema? }` (`name` and `schema` are optional here).
|
|
1512
1596
|
- `resource.tableName` — The database table name for users.
|
|
1513
1597
|
|
|
1514
1598
|
**Returns:** A request handler responding `{ statusCode: 200, body: { props, plan?, twoFactorEnabled?, accessToken? } }`, or 401 when unauthenticated.
|
|
@@ -1561,7 +1645,7 @@ function resetPassword({
|
|
|
1561
1645
|
name: _name,
|
|
1562
1646
|
tableName,
|
|
1563
1647
|
schema: _schema,
|
|
1564
|
-
}: types.
|
|
1648
|
+
}: types.HandlerResource): (
|
|
1565
1649
|
req: ResetPasswordRequest,
|
|
1566
1650
|
) => Promise<
|
|
1567
1651
|
| { statusCode: number; body: { error: string; errorKey: string; success?: undefined } }
|
|
@@ -1571,6 +1655,7 @@ function resetPassword({
|
|
|
1571
1655
|
|
|
1572
1656
|
- `resource` — The user resource configuration (name, tableName, schema).
|
|
1573
1657
|
- `resource.tableName` — The database table name for users.
|
|
1658
|
+
- `resource.schema` — Optional. Ignored — the reset flow writes the password hash directly.
|
|
1574
1659
|
|
|
1575
1660
|
**Returns:** A request handler that responds with `{ statusCode: 200, body: { success: true } }` on success.
|
|
1576
1661
|
|
|
@@ -1579,11 +1664,15 @@ function resetPassword({
|
|
|
1579
1664
|
Updates a user's profile fields (username, name, email). Validates username format
|
|
1580
1665
|
(alphanumeric, max 255 chars), email format, and uniqueness of both fields against
|
|
1581
1666
|
other users before delegating to the resource update utility.
|
|
1667
|
+
`schema` is optional and NOT used here: this handler validates the partial update with the
|
|
1668
|
+
package's own `extendedUpdatePropsSchema` (username, name, email, avatar, bio, plus
|
|
1669
|
+
`oauthData`), so callers need not invent one. Statuses: 200 updated props; 400 for an invalid
|
|
1670
|
+
username/email, an oversized avatar/bio, a malformed `oauthData`, a missing `currentPassword`,
|
|
1671
|
+
or no updatable fields; 403 `user.error.usernameUnavailable` / `user.error.emailAlreadyRegistered`
|
|
1672
|
+
/ `user.error.currentPasswordIncorrect`; 500 `user.error.failedToUpdateUser`.
|
|
1582
1673
|
|
|
1583
1674
|
```typescript
|
|
1584
|
-
function update({ name, tableName
|
|
1585
|
-
req: MoleculeRequest,
|
|
1586
|
-
) => Promise<
|
|
1675
|
+
function update({ name, tableName }: types.HandlerResource): (req: MoleculeRequest) => Promise<
|
|
1587
1676
|
| { statusCode: number; body: { error: string; errorKey: string; props?: undefined } }
|
|
1588
1677
|
| {
|
|
1589
1678
|
statusCode: number
|
|
@@ -1596,10 +1685,10 @@ function update({ name, tableName, schema: _schema }: types.Resource<unknown>):
|
|
|
1596
1685
|
>
|
|
1597
1686
|
```
|
|
1598
1687
|
|
|
1599
|
-
- `resource` — The user resource configuration
|
|
1600
|
-
- `resource.name` — The resource name.
|
|
1688
|
+
- `resource` — The user resource configuration: `{ name, tableName, schema? }`.
|
|
1689
|
+
- `resource.name` — The resource name used in error messages.
|
|
1601
1690
|
- `resource.tableName` — The database table name for users.
|
|
1602
|
-
- `resource.schema` —
|
|
1691
|
+
- `resource.schema` — Optional. Ignored — updates validate with this package's update schema.
|
|
1603
1692
|
|
|
1604
1693
|
**Returns:** A request handler that responds with the updated user props on success.
|
|
1605
1694
|
|
|
@@ -1636,7 +1725,7 @@ function updatePassword({
|
|
|
1636
1725
|
name: _name,
|
|
1637
1726
|
tableName,
|
|
1638
1727
|
schema: _schema,
|
|
1639
|
-
}: types.
|
|
1728
|
+
}: types.HandlerResource): (
|
|
1640
1729
|
req: UpdatePasswordRequest,
|
|
1641
1730
|
res?: MoleculeResponse,
|
|
1642
1731
|
) => Promise<
|
|
@@ -1648,7 +1737,7 @@ function updatePassword({
|
|
|
1648
1737
|
- `resource` — The user resource configuration (name, tableName, schema).
|
|
1649
1738
|
- `resource.name` — The resource name.
|
|
1650
1739
|
- `resource.tableName` — The database table name for users.
|
|
1651
|
-
- `resource.schema` —
|
|
1740
|
+
- `resource.schema` — Optional. Ignored — this handler writes the password hash directly.
|
|
1652
1741
|
|
|
1653
1742
|
**Returns:** A request handler that responds with `{ statusCode: 200, body: { success: true } }` on success.
|
|
1654
1743
|
|
|
@@ -1681,7 +1770,7 @@ cross-platform subscription cancellation when switching providers. Returns a che
|
|
|
1681
1770
|
and free plan downgrades.
|
|
1682
1771
|
|
|
1683
1772
|
```typescript
|
|
1684
|
-
function updatePlan({ name, tableName, schema: _schema }: types.
|
|
1773
|
+
function updatePlan({ name, tableName, schema: _schema }: types.HandlerResource): (
|
|
1685
1774
|
req: UpdatePlanRequest,
|
|
1686
1775
|
) => Promise<
|
|
1687
1776
|
| { statusCode: number; body: { error: string; errorKey: string; props?: undefined } }
|
|
@@ -1700,7 +1789,7 @@ function updatePlan({ name, tableName, schema: _schema }: types.Resource<unknown
|
|
|
1700
1789
|
- `resource` — The user resource configuration (name, tableName, schema).
|
|
1701
1790
|
- `resource.name` — The resource name.
|
|
1702
1791
|
- `resource.tableName` — The database table name for users.
|
|
1703
|
-
- `resource.schema` —
|
|
1792
|
+
- `resource.schema` — Optional. Ignored — plan updates validate with `updatePlanPropsSchema`.
|
|
1704
1793
|
|
|
1705
1794
|
**Returns:** A request handler for plan updates.
|
|
1706
1795
|
|
|
@@ -1726,7 +1815,7 @@ Handles two-factor authentication lifecycle via `@molecule/api-two-factor`:
|
|
|
1726
1815
|
- `disable`: Verifies a TOTP token against the active secret, then deactivates 2FA.
|
|
1727
1816
|
|
|
1728
1817
|
```typescript
|
|
1729
|
-
function verifyTwoFactor({ name: _name, tableName, schema: _schema }: types.
|
|
1818
|
+
function verifyTwoFactor({ name: _name, tableName, schema: _schema }: types.HandlerResource): (
|
|
1730
1819
|
req: VerifyTwoFactorRequest,
|
|
1731
1820
|
) => Promise<
|
|
1732
1821
|
| { statusCode: number; body: { error: string; errorKey: string; twoFactorEnabled?: undefined } }
|
|
@@ -1751,7 +1840,7 @@ function verifyTwoFactor({ name: _name, tableName, schema: _schema }: types.Reso
|
|
|
1751
1840
|
- `resource` — The user resource configuration (name, tableName, schema).
|
|
1752
1841
|
- `resource.name` — The resource name.
|
|
1753
1842
|
- `resource.tableName` — The database table name for users.
|
|
1754
|
-
- `resource.schema` —
|
|
1843
|
+
- `resource.schema` — Optional. Ignored — 2FA state is written to the secrets table directly.
|
|
1755
1844
|
|
|
1756
1845
|
**Returns:** A request handler for two-factor authentication operations.
|
|
1757
1846
|
|
|
@@ -1856,6 +1945,42 @@ An object describing the `user` resource.
|
|
|
1856
1945
|
type Resource<T = unknown> = resourceTypes.Resource<T>
|
|
1857
1946
|
```
|
|
1858
1947
|
|
|
1948
|
+
##### `types.HandlerResource`
|
|
1949
|
+
|
|
1950
|
+
Configuration accepted by every user handler factory (`handlers.create`,
|
|
1951
|
+
`handlers.logIn`, `handlers.update`, …).
|
|
1952
|
+
|
|
1953
|
+
`name` and `tableName` are the caller's to supply, because an app may mount the
|
|
1954
|
+
user resource on its own table. `schema` is OPTIONAL — no factory requires you
|
|
1955
|
+
to invent one:
|
|
1956
|
+
|
|
1957
|
+
- `handlers.create` and `handlers.logInOAuth` validate the props they write and
|
|
1958
|
+
default to this package's {@link propsSchema} when `schema` is omitted.
|
|
1959
|
+
- `handlers.update` validates with the package's `updatePropsSchema` and ignores
|
|
1960
|
+
a supplied `schema`.
|
|
1961
|
+
- The remaining handlers read/write rows directly and never look at `schema`.
|
|
1962
|
+
|
|
1963
|
+
Omission is NOT "no validation": the handlers that validate use
|
|
1964
|
+
{@link propsSchema}. Pass `createResource({ oauthServers, planKeys })` (or the
|
|
1965
|
+
`resource` export) when the app constrains `oauthServer` / `planKey`, and pass
|
|
1966
|
+
your own extended Zod object only when you add fields.
|
|
1967
|
+
|
|
1968
|
+
```typescript
|
|
1969
|
+
interface HandlerResource {
|
|
1970
|
+
/** The resource name used in error messages (e.g. `'User'`). */
|
|
1971
|
+
name: string
|
|
1972
|
+
/** The database table name for users. */
|
|
1973
|
+
tableName: string
|
|
1974
|
+
/**
|
|
1975
|
+
* Optional Zod schema validated by `handlers.create` / `handlers.logInOAuth`.
|
|
1976
|
+
* Defaults to {@link propsSchema}. Must expose `safeParse`; a stub object is not
|
|
1977
|
+
* a schema and the first request answers 400 `resource.error.unknownError` with
|
|
1978
|
+
* `TypeError: schema.safeParse is not a function`.
|
|
1979
|
+
*/
|
|
1980
|
+
schema?: unknown
|
|
1981
|
+
}
|
|
1982
|
+
```
|
|
1983
|
+
|
|
1859
1984
|
#### `utilities`
|
|
1860
1985
|
|
|
1861
1986
|
Re-exported as a namespace — reach every member below through it (e.g. `utilities.<name>`).
|
|
@@ -11,13 +11,27 @@ export interface CreateRequest extends MoleculeRequest {
|
|
|
11
11
|
* Creates a user with username and password. Validates username uniqueness and email format,
|
|
12
12
|
* hashes the password into a separate secrets table, creates a session device via the bonded
|
|
13
13
|
* DeviceService, and sets JWT authorization on the response.
|
|
14
|
-
*
|
|
15
|
-
*
|
|
14
|
+
*
|
|
15
|
+
* **`schema` is optional — omit it and this package's `propsSchema` validates the row.**
|
|
16
|
+
* It must be a Zod object (anything exposing `safeParse`): pass
|
|
17
|
+
* `createResource({ oauthServers, planKeys })` or your own extended schema only when the
|
|
18
|
+
* app constrains or extends user props. A stub such as `schema: {}` is not a schema — the
|
|
19
|
+
* FIRST request answers 400 `resource.error.unknownError` with
|
|
20
|
+
* `TypeError: schema.safeParse is not a function`, after no row has been written.
|
|
21
|
+
*
|
|
22
|
+
* Statuses: 201 `{ props, accessToken, user }`; 400 `user.error.usernameInvalid` /
|
|
23
|
+
* `user.error.bodyNestedUnderUser` / `user.error.passwordRequired` /
|
|
24
|
+
* `user.error.passwordTooLong` / `user.error.passwordTooShort` / `user.error.emailInvalid` /
|
|
25
|
+
* `user.error.badRequest`, or `resource.error.unknownError` when props fail the schema;
|
|
26
|
+
* 403 `user.error.usernameUnavailable` / `user.error.emailAlreadyRegistered`;
|
|
27
|
+
* 500 `user.error.failedToHashPassword` / `user.error.failedToCreateSession`.
|
|
28
|
+
* @param resource - The user resource configuration: `{ name, tableName, schema? }`.
|
|
29
|
+
* @param resource.name - The resource name used in error messages.
|
|
16
30
|
* @param resource.tableName - The database table name for users.
|
|
17
|
-
* @param resource.schema -
|
|
18
|
-
* @returns A request handler that responds with `{ statusCode: 201, body: { props } }` on success.
|
|
31
|
+
* @param resource.schema - Optional Zod schema for the created user props. Defaults to `propsSchema`.
|
|
32
|
+
* @returns A request handler that responds with `{ statusCode: 201, body: { props, accessToken, user } }` on success.
|
|
19
33
|
*/
|
|
20
|
-
export declare const create: ({ name, tableName, schema }: types.
|
|
34
|
+
export declare const create: ({ name, tableName, schema }: types.HandlerResource) => (req: CreateRequest, res: MoleculeResponse) => Promise<{
|
|
21
35
|
statusCode: number;
|
|
22
36
|
body: {
|
|
23
37
|
error: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/handlers/create.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/handlers/create.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAM/E,OAAO,KAAK,KAAK,KAAK,MAAM,aAAa,CAAA;AAQzC,mFAAmF;AACnF,MAAM,WAAW,aAAc,SAAQ,eAAe;IACpD,IAAI,EAAE,KAAK,CAAC,WAAW,GAAG;QACxB,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,UAAU,CAAC,EAAE,MAAM,CAAA;KACpB,CAAA;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,MAAM,GAAI,6BAA2C,KAAK,CAAC,eAAe,MAOvE,KAAK,aAAa,EAAE,KAAK,gBAAgB;;;;;aAvBJ,CAAC;;;;;;;;;;;;;;;;EAuQrD,CAAA"}
|
package/dist/handlers/create.js
CHANGED
|
@@ -5,6 +5,7 @@ import { t } from '@molecule/api-i18n';
|
|
|
5
5
|
import { hash } from '@molecule/api-password';
|
|
6
6
|
import { create as resourceCreate } from '@molecule/api-resource';
|
|
7
7
|
import * as authorization from '../authorization.js';
|
|
8
|
+
import { propsSchema } from '../schema.js';
|
|
8
9
|
import { normalizeEmail } from '../utilities/normalizeEmail.js';
|
|
9
10
|
import { stripSensitiveUserColumns } from '../utilities/stripSensitiveUserColumns.js';
|
|
10
11
|
import { isNestedBody, USERNAME_RE } from '../utilities/username.js';
|
|
@@ -14,13 +15,27 @@ const logger = getLogger();
|
|
|
14
15
|
* Creates a user with username and password. Validates username uniqueness and email format,
|
|
15
16
|
* hashes the password into a separate secrets table, creates a session device via the bonded
|
|
16
17
|
* DeviceService, and sets JWT authorization on the response.
|
|
17
|
-
*
|
|
18
|
-
*
|
|
18
|
+
*
|
|
19
|
+
* **`schema` is optional — omit it and this package's `propsSchema` validates the row.**
|
|
20
|
+
* It must be a Zod object (anything exposing `safeParse`): pass
|
|
21
|
+
* `createResource({ oauthServers, planKeys })` or your own extended schema only when the
|
|
22
|
+
* app constrains or extends user props. A stub such as `schema: {}` is not a schema — the
|
|
23
|
+
* FIRST request answers 400 `resource.error.unknownError` with
|
|
24
|
+
* `TypeError: schema.safeParse is not a function`, after no row has been written.
|
|
25
|
+
*
|
|
26
|
+
* Statuses: 201 `{ props, accessToken, user }`; 400 `user.error.usernameInvalid` /
|
|
27
|
+
* `user.error.bodyNestedUnderUser` / `user.error.passwordRequired` /
|
|
28
|
+
* `user.error.passwordTooLong` / `user.error.passwordTooShort` / `user.error.emailInvalid` /
|
|
29
|
+
* `user.error.badRequest`, or `resource.error.unknownError` when props fail the schema;
|
|
30
|
+
* 403 `user.error.usernameUnavailable` / `user.error.emailAlreadyRegistered`;
|
|
31
|
+
* 500 `user.error.failedToHashPassword` / `user.error.failedToCreateSession`.
|
|
32
|
+
* @param resource - The user resource configuration: `{ name, tableName, schema? }`.
|
|
33
|
+
* @param resource.name - The resource name used in error messages.
|
|
19
34
|
* @param resource.tableName - The database table name for users.
|
|
20
|
-
* @param resource.schema -
|
|
21
|
-
* @returns A request handler that responds with `{ statusCode: 201, body: { props } }` on success.
|
|
35
|
+
* @param resource.schema - Optional Zod schema for the created user props. Defaults to `propsSchema`.
|
|
36
|
+
* @returns A request handler that responds with `{ statusCode: 201, body: { props, accessToken, user } }` on success.
|
|
22
37
|
*/
|
|
23
|
-
export const create = ({ name, tableName, schema }) => {
|
|
38
|
+
export const create = ({ name, tableName, schema = propsSchema }) => {
|
|
24
39
|
const createResource = resourceCreate({
|
|
25
40
|
name,
|
|
26
41
|
tableName,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/handlers/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAA;AAEjC,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AACjE,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AACvE,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAE7C,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAGjE,OAAO,KAAK,aAAa,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/handlers/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAA;AAEjC,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AACjE,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AACvE,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAE7C,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAGjE,OAAO,KAAK,aAAa,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAC/D,OAAO,EAAE,yBAA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AAE,UAAU,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,CAAC;qBAC9E,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;gBAClB,SAAS;qBACN,QAAQ,CAAC;oBACR,MAAM,EAAE,EAAE;oBACV,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,SAAS;oBAC/B,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,SAAS;iBAC9B,CAAC;qBACD,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;gBAElB,oEAAoE;gBACpE,iEAAiE;gBACjE,sEAAsE;gBACtE,mEAAmE;gBACnE,MAAM,IAAI,GAAG,yBAAyB,CACpC,CAAC,eAAe,CAAC,IAAI,EAAE,KAAK,IAAI,EAAE,EAAE,EAAE,GAAG,KAAK,EAAE,CAA4B,CAC7E,CAAA;gBACD,OAAO;oBACL,UAAU,EAAE,GAAG;oBACf,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE;iBACzC,CAAA;YACH,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAA;YACrD,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;YACnB,OAAO;gBACL,UAAU,EAAE,GAAG;gBACf,IAAI,EAAE;oBACJ,KAAK,EAAE,CAAC,CAAC,kCAAkC,CAAC;oBAC5C,QAAQ,EAAE,kCAAkC;iBAC7C;aACF,CAAA;QACH,CAAC;IACH,CAAC,CAAA;AACH,CAAC,CAAA"}
|
package/dist/handlers/del.d.ts
CHANGED
|
@@ -14,10 +14,10 @@ import type * as types from '../types.js';
|
|
|
14
14
|
* @param resource - The user resource configuration (name, tableName, schema).
|
|
15
15
|
* @param resource.name - The resource name.
|
|
16
16
|
* @param resource.tableName - The database table name for users.
|
|
17
|
-
* @param resource.schema -
|
|
17
|
+
* @param resource.schema - Optional. Ignored — deletion does not validate props.
|
|
18
18
|
* @returns A request handler that responds with `{ statusCode: 200, body: { props: { id } } }` on success.
|
|
19
19
|
*/
|
|
20
|
-
export declare const del: ({ name: _name, tableName, schema: _schema }: types.
|
|
20
|
+
export declare const del: ({ name: _name, tableName, schema: _schema }: types.HandlerResource) => (req: MoleculeRequest) => Promise<{
|
|
21
21
|
statusCode: number;
|
|
22
22
|
body: {
|
|
23
23
|
error: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"del.d.ts","sourceRoot":"","sources":["../../src/handlers/del.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAG7D,OAAO,KAAK,KAAK,KAAK,MAAM,aAAa,CAAA;AAKzC;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,GAAG,GAAI,6CAA6C,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"del.d.ts","sourceRoot":"","sources":["../../src/handlers/del.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAG7D,OAAO,KAAK,KAAK,KAAK,MAAM,aAAa,CAAA;AAKzC;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,GAAG,GAAI,6CAA6C,KAAK,CAAC,eAAe,MACtE,KAAK,eAAe;;;;;;;;;;;;;;;;EAmDnC,CAAA"}
|
package/dist/handlers/del.js
CHANGED
|
@@ -18,7 +18,7 @@ const logger = getLogger();
|
|
|
18
18
|
* @param resource - The user resource configuration (name, tableName, schema).
|
|
19
19
|
* @param resource.name - The resource name.
|
|
20
20
|
* @param resource.tableName - The database table name for users.
|
|
21
|
-
* @param resource.schema -
|
|
21
|
+
* @param resource.schema - Optional. Ignored — deletion does not validate props.
|
|
22
22
|
* @returns A request handler that responds with `{ statusCode: 200, body: { props: { id } } }` on success.
|
|
23
23
|
*/
|
|
24
24
|
export const del = ({ name: _name, tableName, schema: _schema }) => {
|
package/dist/handlers/del.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"del.js","sourceRoot":"","sources":["../../src/handlers/del.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACnD,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAA;AAItC,OAAO,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAA;AAGpE,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;AAChC,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;AAE1B;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"del.js","sourceRoot":"","sources":["../../src/handlers/del.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACnD,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAA;AAItC,OAAO,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAA;AAGpE,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;AAChC,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;AAE1B;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAyB,EAAE,EAAE;IACxF,OAAO,KAAK,EAAE,GAAoB,EAAE,EAAE;QACpC,IAAI,CAAC;YACH,MAAM,EAAE,GAAG,GAAG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AC,KAAK,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;YAErE,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAA;QACrD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;YACnB,OAAO;gBACL,UAAU,EAAE,GAAG;gBACf,IAAI,EAAE;oBACJ,KAAK,EAAE,CAAC,CAAC,+BAA+B,CAAC;oBACzC,QAAQ,EAAE,+BAA+B;iBAC1C;aACF,CAAA;QACH,CAAC;IACH,CAAC,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -13,10 +13,10 @@ export interface ForgotPasswordRequest extends MoleculeRequest {
|
|
|
13
13
|
* @param resource - The user resource configuration (name, tableName, schema).
|
|
14
14
|
* @param resource.name - The resource name.
|
|
15
15
|
* @param resource.tableName - The database table name for users.
|
|
16
|
-
* @param resource.schema -
|
|
16
|
+
* @param resource.schema - Optional. Ignored — the reset flow reads and writes secrets directly.
|
|
17
17
|
* @returns A request handler that responds with `{ statusCode: 200, body: { success: true } }`.
|
|
18
18
|
*/
|
|
19
|
-
export declare const forgotPassword: ({ name: _name, tableName, schema: _schema }: types.
|
|
19
|
+
export declare const forgotPassword: ({ name: _name, tableName, schema: _schema, }: types.HandlerResource) => (req: ForgotPasswordRequest) => Promise<{
|
|
20
20
|
statusCode: number;
|
|
21
21
|
body: {
|
|
22
22
|
error: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forgotPassword.d.ts","sourceRoot":"","sources":["../../src/handlers/forgotPassword.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAE7D,OAAO,KAAK,KAAK,KAAK,MAAM,aAAa,CAAA;AAOzC,kDAAkD;AAClD,MAAM,WAAW,qBAAsB,SAAQ,eAAe;IAC5D,IAAI,EAAE;QACJ,KAAK,CAAC,EAAE,MAAM,CAAA;KACf,CAAA;CACF;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,GAAI,
|
|
1
|
+
{"version":3,"file":"forgotPassword.d.ts","sourceRoot":"","sources":["../../src/handlers/forgotPassword.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAE7D,OAAO,KAAK,KAAK,KAAK,MAAM,aAAa,CAAA;AAOzC,kDAAkD;AAClD,MAAM,WAAW,qBAAsB,SAAQ,eAAe;IAC5D,IAAI,EAAE;QACJ,KAAK,CAAC,EAAE,MAAM,CAAA;KACf,CAAA;CACF;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,GAAI,8CAI5B,KAAK,CAAC,eAAe,MACR,KAAK,qBAAqB;;;;;;;;;;;;;;EAsIzC,CAAA"}
|
|
@@ -14,10 +14,10 @@ const logger = getLogger();
|
|
|
14
14
|
* @param resource - The user resource configuration (name, tableName, schema).
|
|
15
15
|
* @param resource.name - The resource name.
|
|
16
16
|
* @param resource.tableName - The database table name for users.
|
|
17
|
-
* @param resource.schema -
|
|
17
|
+
* @param resource.schema - Optional. Ignored — the reset flow reads and writes secrets directly.
|
|
18
18
|
* @returns A request handler that responds with `{ statusCode: 200, body: { success: true } }`.
|
|
19
19
|
*/
|
|
20
|
-
export const forgotPassword = ({ name: _name, tableName, schema: _schema }) => {
|
|
20
|
+
export const forgotPassword = ({ name: _name, tableName, schema: _schema, }) => {
|
|
21
21
|
return async (req) => {
|
|
22
22
|
try {
|
|
23
23
|
const { email } = req.body;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forgotPassword.js","sourceRoot":"","sources":["../../src/handlers/forgotPassword.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,C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