@molecule/api-resource-user 1.7.0 → 1.7.1
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 +60 -3
- package/dist/handlers/payments/billingPortal.d.ts +3 -0
- package/dist/handlers/payments/billingPortal.d.ts.map +1 -1
- package/dist/handlers/payments/billingPortal.js +10 -3
- package/dist/handlers/payments/billingPortal.js.map +1 -1
- package/dist/handlers/payments/verifyPayment.d.ts +3 -0
- package/dist/handlers/payments/verifyPayment.d.ts.map +1 -1
- package/dist/handlers/payments/verifyPayment.js +9 -2
- package/dist/handlers/payments/verifyPayment.js.map +1 -1
- package/dist/handlers/update.d.ts +9 -0
- package/dist/handlers/update.d.ts.map +1 -1
- package/dist/handlers/update.js +9 -0
- package/dist/handlers/update.js.map +1 -1
- package/dist/handlers/updatePassword.d.ts +10 -0
- package/dist/handlers/updatePassword.d.ts.map +1 -1
- package/dist/handlers/updatePassword.js +10 -0
- package/dist/handlers/updatePassword.js.map +1 -1
- package/dist/handlers/updatePlan.d.ts +4 -0
- package/dist/handlers/updatePlan.d.ts.map +1 -1
- package/dist/handlers/updatePlan.js +10 -2
- package/dist/handlers/updatePlan.js.map +1 -1
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -1
- package/dist/utilities/payments.d.ts +29 -0
- package/dist/utilities/payments.d.ts.map +1 -0
- package/dist/utilities/payments.js +47 -0
- package/dist/utilities/payments.js.map +1 -0
- 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-21T08:49:08.924Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/api-resource-user
|
|
@@ -132,6 +132,34 @@ a handler returns `{ statusCode, body }` and the mount applies it):
|
|
|
132
132
|
`user.error.twoFactorVerificationUnavailable` / `user.error.loginFailed`. Bad credentials
|
|
133
133
|
are 403, not 401 or 422.
|
|
134
134
|
|
|
135
|
+
**A JWT you sign yourself is NOT a session.** `verifyMiddleware` accepts a token only when
|
|
136
|
+
the bonded `@molecule/api-jwt` provider verifies it AND its `deviceId` names an ACTIVE row
|
|
137
|
+
in `devices`; anything else — another secret or algorithm, or an invented/placeholder
|
|
138
|
+
`deviceId` — is answered 401 on every request (a request with no credential at all answers
|
|
139
|
+
`{"errors":{"token":["is missing"]}}`). Mint sessions with `authorization.set()` after
|
|
140
|
+
`device.createOrUpdate()` (the sequence above) and mount `verifyMiddleware` once in front of
|
|
141
|
+
the routes — never hand-roll auth middleware or a second token scheme.
|
|
142
|
+
|
|
143
|
+
**Changing the EMAIL or the PASSWORD requires the CURRENT password — there is no opt-out.**
|
|
144
|
+
`handlers.update` (`PATCH /users/:id`) takes profile fields; when the body changes (or
|
|
145
|
+
clears) `email` on an account that has a password, the SAME flat body must also carry that
|
|
146
|
+
account's `currentPassword`. Missing → 400 `user.error.currentPasswordRequired`; wrong → 403
|
|
147
|
+
`user.error.currentPasswordIncorrect`. A real change resets `emailVerified` to `false`
|
|
148
|
+
server-side (the new address is unproven), and `emailVerified` is NEVER read from the body.
|
|
149
|
+
An OAuth-only account (no `passwordHash`) has no password to present, so its provider-backed
|
|
150
|
+
session is the credential. `handlers.updatePassword` (`PATCH /users/:id/password`) requires
|
|
151
|
+
`newPassword` (8–1024 characters) and, on a password account, `currentPassword` as well —
|
|
152
|
+
same 400/403 codes; it answers 200 `{ success: true }`, clears any outstanding reset token,
|
|
153
|
+
and revokes every OTHER device while the caller's own session keeps working.
|
|
154
|
+
|
|
155
|
+
Do NOT work around either gate by storing, caching or replaying the user's password, by
|
|
156
|
+
sending an invented `currentPassword`, or by writing `email` around the handler with the
|
|
157
|
+
datastore: the password is the re-authentication factor that stops a hijacked session from
|
|
158
|
+
moving the account-recovery address. If a wire format (e.g. RealWorld's token-only
|
|
159
|
+
`PUT /user`) cannot collect the current password, that flow is simply unsupported as written
|
|
160
|
+
— have the client ask for it in a re-authentication step, or route sign-in and account
|
|
161
|
+
changes through the auth pages (`useAuth()`). There is no supported bypass to add.
|
|
162
|
+
|
|
135
163
|
> **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
|
|
136
164
|
> It is written to be read by coding agents as much as by people, and is generated from this
|
|
137
165
|
> package's source — edit `src/index.ts` JSDoc, not this file.
|
|
@@ -1454,6 +1482,9 @@ The user is returned to the APP origin on exit (never the API origin, whose
|
|
|
1454
1482
|
host holds no session cookie); an app-relative `returnPath` in the request
|
|
1455
1483
|
body sends them back to the exact page they opened the portal from.
|
|
1456
1484
|
|
|
1485
|
+
`@molecule/api-payments` is an OPTIONAL peer: its helpers are loaded lazily per
|
|
1486
|
+
request, so importing this package never requires the payments core to be installed.
|
|
1487
|
+
|
|
1457
1488
|
```typescript
|
|
1458
1489
|
function billingPortal(): (req: MoleculeRequest) => Promise<
|
|
1459
1490
|
| {
|
|
@@ -1511,6 +1542,9 @@ provider name from the `:provider` route parameter and dispatches based on `veri
|
|
|
1511
1542
|
On successful verification, updates the user's plan (planKey, planExpiresAt, planAutoRenews)
|
|
1512
1543
|
and stores the payment record via the bonded PaymentRecordService.
|
|
1513
1544
|
|
|
1545
|
+
`@molecule/api-payments` is an OPTIONAL peer: the config-error helper is loaded lazily in
|
|
1546
|
+
the catch, so importing this package never requires the payments core to be installed.
|
|
1547
|
+
|
|
1514
1548
|
```typescript
|
|
1515
1549
|
function verifyPayment({ name, tableName, schema: _schema }: types.HandlerResource): (
|
|
1516
1550
|
req: MoleculeRequest,
|
|
@@ -1671,6 +1705,15 @@ username/email, an oversized avatar/bio, a malformed `oauthData`, a missing `cur
|
|
|
1671
1705
|
or no updatable fields; 403 `user.error.usernameUnavailable` / `user.error.emailAlreadyRegistered`
|
|
1672
1706
|
/ `user.error.currentPasswordIncorrect`; 500 `user.error.failedToUpdateUser`.
|
|
1673
1707
|
|
|
1708
|
+
**A change to `email` is re-authenticated.** On an account that has a password, changing OR
|
|
1709
|
+
clearing the address requires that account's `currentPassword` in the same flat body — 400
|
|
1710
|
+
`user.error.currentPasswordRequired` when it is missing, 403
|
|
1711
|
+
`user.error.currentPasswordIncorrect` when it does not match. A real change sets
|
|
1712
|
+
`emailVerified` to `false` server-side (the new address is unproven; the flag is never read
|
|
1713
|
+
from the body). An OAuth-only account has no password hash, so its provider-backed session is
|
|
1714
|
+
the credential. Do NOT skip the gate by writing `email` through the datastore instead: return
|
|
1715
|
+
the 400 and let the client collect the current password (a re-authentication step).
|
|
1716
|
+
|
|
1674
1717
|
```typescript
|
|
1675
1718
|
function update({ name, tableName }: types.HandlerResource): (req: MoleculeRequest) => Promise<
|
|
1676
1719
|
| { statusCode: number; body: { error: string; errorKey: string; props?: undefined } }
|
|
@@ -1711,14 +1754,24 @@ Updates a user's password. If the user already has a password hash, the current
|
|
|
1711
1754
|
must be provided and verified first. The new password is hashed via `@molecule/api-password`
|
|
1712
1755
|
and stored in the secrets table.
|
|
1713
1756
|
|
|
1757
|
+
**Body and results.** The flat body needs `newPassword` (8–1024 characters) and, on an
|
|
1758
|
+
account that ALREADY has a password (the password-signup case), `currentPassword` too —
|
|
1759
|
+
there is no variant that changes a password account's password from `newPassword` alone.
|
|
1760
|
+
Missing current password → 400 `user.error.currentPasswordRequired`; wrong → 403
|
|
1761
|
+
`user.error.currentPasswordIncorrect`; an invalid new password is 400
|
|
1762
|
+
`user.error.newPasswordRequired` / `user.error.passwordTooShort` /
|
|
1763
|
+
`user.error.passwordTooLong`. Only an account with no password hash (OAuth-only) may omit
|
|
1764
|
+
`currentPassword`. Success is 200 `{ success: true }` and also clears any outstanding reset
|
|
1765
|
+
token. Never cache or replay the login password to satisfy this check.
|
|
1766
|
+
|
|
1714
1767
|
**Every OTHER session is revoked; the caller's own is kept.** The device rows of all other
|
|
1715
1768
|
devices are deleted, so a stolen token on another device dies — but the device this request
|
|
1716
1769
|
arrived on stays, and the token that made the request (the `Authorization` header the client
|
|
1717
1770
|
is holding) keeps working. A RealWorld-style suite changes the password and then keeps using
|
|
1718
1771
|
the same token for the next request; revoking the caller too is what answered its second
|
|
1719
1772
|
`PUT /user` with 401 (xr-flash-m167, ~2 min lost). Do not fold a per-user secret into the
|
|
1720
|
-
|
|
1721
|
-
|
|
1773
|
+
|
|
1774
|
+
_(description truncated — read the full text in `node_modules/@molecule/api-resource-user/dist/handlers/updatePassword.d.ts`.)_
|
|
1722
1775
|
|
|
1723
1776
|
```typescript
|
|
1724
1777
|
function updatePassword({
|
|
@@ -1769,6 +1822,10 @@ cross-platform subscription cancellation when switching providers. Returns a che
|
|
|
1769
1822
|
(status 201) for new subscriptions, or directly updates the user record for in-place changes
|
|
1770
1823
|
and free plan downgrades.
|
|
1771
1824
|
|
|
1825
|
+
`@molecule/api-payments` is an OPTIONAL peer: its `isConfigNotConfiguredError` helper is
|
|
1826
|
+
loaded lazily inside the catch, so an app that installs no payments package can still import
|
|
1827
|
+
(and boot) this resource — the free-plan path and every non-payment route keep working.
|
|
1828
|
+
|
|
1772
1829
|
```typescript
|
|
1773
1830
|
function updatePlan({ name, tableName, schema: _schema }: types.HandlerResource): (
|
|
1774
1831
|
req: UpdatePlanRequest,
|
|
@@ -13,6 +13,9 @@ import type { MoleculeRequest } from '@molecule/api-resource';
|
|
|
13
13
|
* The user is returned to the APP origin on exit (never the API origin, whose
|
|
14
14
|
* host holds no session cookie); an app-relative `returnPath` in the request
|
|
15
15
|
* body sends them back to the exact page they opened the portal from.
|
|
16
|
+
*
|
|
17
|
+
* `@molecule/api-payments` is an OPTIONAL peer: its helpers are loaded lazily per
|
|
18
|
+
* request, so importing this package never requires the payments core to be installed.
|
|
16
19
|
* @returns A request handler that responds `{ url, id }` with the portal session.
|
|
17
20
|
*/
|
|
18
21
|
export declare const billingPortal: () => (req: MoleculeRequest) => Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billingPortal.d.ts","sourceRoot":"","sources":["../../../src/handlers/payments/billingPortal.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"billingPortal.d.ts","sourceRoot":"","sources":["../../../src/handlers/payments/billingPortal.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAO7D;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,aAAa,SACV,KAAK,eAAe;;;;;;;;;;;;;;;;EA6FnC,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getAnalytics, getLogger, require as bondRequire } from '@molecule/api-bond';
|
|
2
2
|
import { t } from '@molecule/api-i18n';
|
|
3
|
-
import {
|
|
3
|
+
import { loadPayments } from '../../utilities/payments.js';
|
|
4
4
|
const analytics = getAnalytics();
|
|
5
5
|
const logger = getLogger();
|
|
6
6
|
/**
|
|
@@ -17,6 +17,9 @@ const logger = getLogger();
|
|
|
17
17
|
* The user is returned to the APP origin on exit (never the API origin, whose
|
|
18
18
|
* host holds no session cookie); an app-relative `returnPath` in the request
|
|
19
19
|
* body sends them back to the exact page they opened the portal from.
|
|
20
|
+
*
|
|
21
|
+
* `@molecule/api-payments` is an OPTIONAL peer: its helpers are loaded lazily per
|
|
22
|
+
* request, so importing this package never requires the payments core to be installed.
|
|
20
23
|
* @returns A request handler that responds `{ url, id }` with the portal session.
|
|
21
24
|
*/
|
|
22
25
|
export const billingPortal = () => {
|
|
@@ -32,6 +35,10 @@ export const billingPortal = () => {
|
|
|
32
35
|
},
|
|
33
36
|
};
|
|
34
37
|
}
|
|
38
|
+
// Optional peer — resolved per request, never at module scope (see
|
|
39
|
+
// utilities/payments.ts). No payments core means no bonded provider can serve
|
|
40
|
+
// this route, so the `bondRequire` below fails into the handler's error path.
|
|
41
|
+
const payments = await loadPayments();
|
|
35
42
|
try {
|
|
36
43
|
const provider = bondRequire('payments', providerName);
|
|
37
44
|
if (!provider.createPortalSession) {
|
|
@@ -45,7 +52,7 @@ export const billingPortal = () => {
|
|
|
45
52
|
}
|
|
46
53
|
const session = await provider.createPortalSession({
|
|
47
54
|
userId: id,
|
|
48
|
-
returnUrl: resolveBillingPortalReturnUrl(req.body?.returnPath),
|
|
55
|
+
returnUrl: payments?.resolveBillingPortalReturnUrl(req.body?.returnPath),
|
|
49
56
|
});
|
|
50
57
|
if (!session?.url) {
|
|
51
58
|
// No customer record for this user (never purchased, or the purchase
|
|
@@ -71,7 +78,7 @@ export const billingPortal = () => {
|
|
|
71
78
|
// A missing provider secret is a config problem, not a billing problem —
|
|
72
79
|
// pass its real 503 + errorKey through so the operator sees which key to
|
|
73
80
|
// set (same contract as verifyPayment).
|
|
74
|
-
if (isConfigNotConfiguredError(error)) {
|
|
81
|
+
if (payments && payments.isConfigNotConfiguredError(error)) {
|
|
75
82
|
logger.warn(error.message, { errorKey: error.errorKey, provider: providerName });
|
|
76
83
|
return {
|
|
77
84
|
statusCode: error.statusCode,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billingPortal.js","sourceRoot":"","sources":["../../../src/handlers/payments/billingPortal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACpF,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"billingPortal.js","sourceRoot":"","sources":["../../../src/handlers/payments/billingPortal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACpF,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAA;AAItC,OAAO,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,IAAI,EAAE;oBACJ,KAAK,EAAE,CAAC,CACN,2BAA2B,EAC3B,EAAE,QAAQ,EAAE,YAAY,EAAE,EAC1B,EAAE,YAAY,EAAE,iDAAiD,EAAE,CACpE;oBACD,QAAQ,EAAE,2BAA2B;iBACtC;aACF,CAAA;QACH,CAAC;IACH,CAAC,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -9,6 +9,9 @@ import type * as types from '../../types.js';
|
|
|
9
9
|
*
|
|
10
10
|
* On successful verification, updates the user's plan (planKey, planExpiresAt, planAutoRenews)
|
|
11
11
|
* and stores the payment record via the bonded PaymentRecordService.
|
|
12
|
+
*
|
|
13
|
+
* `@molecule/api-payments` is an OPTIONAL peer: the config-error helper is loaded lazily in
|
|
14
|
+
* the catch, so importing this package never requires the payments core to be installed.
|
|
12
15
|
* @param resource - The user resource configuration (name, tableName, schema).
|
|
13
16
|
* @param resource.name - The resource name.
|
|
14
17
|
* @param resource.tableName - The database table name for users.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifyPayment.d.ts","sourceRoot":"","sources":["../../../src/handlers/payments/verifyPayment.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"verifyPayment.d.ts","sourceRoot":"","sources":["../../../src/handlers/payments/verifyPayment.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAI7D,OAAO,KAAK,KAAK,KAAK,MAAM,gBAAgB,CAAA;AAO5C;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,aAAa,GAAI,sCAAsC,KAAK,CAAC,eAAe,MACzE,KAAK,eAAe;;;;;aAHN,CAAA;;;;;;;;;;;;;EA8Z7B,CAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { get, getAnalytics, getLogger, require as bondRequire } from '@molecule/api-bond';
|
|
2
2
|
import { t } from '@molecule/api-i18n';
|
|
3
|
-
import { isConfigNotConfiguredError, } from '@molecule/api-payments';
|
|
4
3
|
import { update as resourceUpdate } from '@molecule/api-resource';
|
|
5
4
|
import { updatePlanPropsSchema } from '../../schema.js';
|
|
6
5
|
import { invalidateEntitlementsCacheSafe } from '../../utilities/invalidateEntitlements.js';
|
|
6
|
+
import { loadPayments } from '../../utilities/payments.js';
|
|
7
7
|
const analytics = getAnalytics();
|
|
8
8
|
const logger = getLogger();
|
|
9
9
|
/**
|
|
@@ -15,6 +15,9 @@ const logger = getLogger();
|
|
|
15
15
|
*
|
|
16
16
|
* On successful verification, updates the user's plan (planKey, planExpiresAt, planAutoRenews)
|
|
17
17
|
* and stores the payment record via the bonded PaymentRecordService.
|
|
18
|
+
*
|
|
19
|
+
* `@molecule/api-payments` is an OPTIONAL peer: the config-error helper is loaded lazily in
|
|
20
|
+
* the catch, so importing this package never requires the payments core to be installed.
|
|
18
21
|
* @param resource - The user resource configuration (name, tableName, schema).
|
|
19
22
|
* @param resource.name - The resource name.
|
|
20
23
|
* @param resource.tableName - The database table name for users.
|
|
@@ -362,7 +365,11 @@ export const verifyPayment = ({ name, tableName, schema: _schema }) => {
|
|
|
362
365
|
// verification returns — pass its REAL statusCode/errorKey through so the
|
|
363
366
|
// actionable "which key, where to get it" message reaches the caller
|
|
364
367
|
// instead of a generic 500 that reads identically to "bad receipt."
|
|
365
|
-
|
|
368
|
+
// OPTIONAL peer, loaded on the failure path only — the package must import (and
|
|
369
|
+
// boot) in an install that omits @molecule/api-payments. Absent → not a tagged
|
|
370
|
+
// config error → the generic 500 below, exactly as any other unexpected failure.
|
|
371
|
+
const payments = await loadPayments();
|
|
372
|
+
if (payments && payments.isConfigNotConfiguredError(error)) {
|
|
366
373
|
logger.warn(error.message, { errorKey: error.errorKey, provider: providerName });
|
|
367
374
|
return {
|
|
368
375
|
statusCode: error.statusCode,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifyPayment.js","sourceRoot":"","sources":["../../../src/handlers/payments/verifyPayment.ts"],"names":[],"mappings":"AAAA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SAAS;oBAC7B,OAAO,EAAE,IAAI,CAAC,OAAO;iBACtB;aACF,CAAC;iBACD,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;YAElB,uEAAuE;YACvE,yEAAyE;YACzE,wDAAwD;YAExD,OAAO,MAAM,CAAA;QACf,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,0EAA0E;YAC1E,4EAA4E;YAC5E,wEAAwE;YACxE,0EAA0E;YAC1E,qEAAqE;YACrE,oEAAoE;YACpE,gFAAgF;YAChF,+EAA+E;YAC/E,iFAAiF;YACjF,MAAM,QAAQ,GAAG,MAAM,YAAY,EAAE,CAAA;YACrC,IAAI,QAAQ,IAAI,QAAQ,CAAC,0BAA0B,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC3D,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,CAAA;gBAChF,OAAO;oBACL,UAAU,EAAE,KAAK,CAAC,UAAU;oBAC5B,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE;iBACzD,CAAA;YACH,CAAC;YACD,MAAM,CAAC,KAAK,CAAC,GAAG,YAAY,uBAAuB,EAAE,KAAK,CAAC,CAAA;YAC3D,OAAO;gBACL,UAAU,EAAE,GAAG;gBACf,IAAI,EAAE;oBACJ,KAAK,EAAE,CAAC,CAAC,iCAAiC,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC;oBACvE,QAAQ,EAAE,iCAAiC;iBAC5C;aACF,CAAA;QACH,CAAC;IACH,CAAC,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -10,6 +10,15 @@ import type * as types from '../types.js';
|
|
|
10
10
|
* username/email, an oversized avatar/bio, a malformed `oauthData`, a missing `currentPassword`,
|
|
11
11
|
* or no updatable fields; 403 `user.error.usernameUnavailable` / `user.error.emailAlreadyRegistered`
|
|
12
12
|
* / `user.error.currentPasswordIncorrect`; 500 `user.error.failedToUpdateUser`.
|
|
13
|
+
*
|
|
14
|
+
* **A change to `email` is re-authenticated.** On an account that has a password, changing OR
|
|
15
|
+
* clearing the address requires that account's `currentPassword` in the same flat body — 400
|
|
16
|
+
* `user.error.currentPasswordRequired` when it is missing, 403
|
|
17
|
+
* `user.error.currentPasswordIncorrect` when it does not match. A real change sets
|
|
18
|
+
* `emailVerified` to `false` server-side (the new address is unproven; the flag is never read
|
|
19
|
+
* from the body). An OAuth-only account has no password hash, so its provider-backed session is
|
|
20
|
+
* the credential. Do NOT skip the gate by writing `email` through the datastore instead: return
|
|
21
|
+
* the 400 and let the client collect the current password (a re-authentication step).
|
|
13
22
|
* @param resource - The user resource configuration: `{ name, tableName, schema? }`.
|
|
14
23
|
* @param resource.name - The resource name used in error messages.
|
|
15
24
|
* @param resource.tableName - The database table name for users.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/handlers/update.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAI7D,OAAO,KAAK,KAAK,KAAK,MAAM,aAAa,CAAA;AA2BzC
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/handlers/update.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAI7D,OAAO,KAAK,KAAK,KAAK,MAAM,aAAa,CAAA;AA2BzC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,MAAM,GAAI,qBAAqB,KAAK,CAAC,eAAe,MAOjD,KAAK,eAAe;;;;;aArCiC,CAAC;;;;;;;;;EAoRrE,CAAA"}
|
package/dist/handlers/update.js
CHANGED
|
@@ -40,6 +40,15 @@ const extendedUpdatePropsSchema = updatePropsSchema.extend({
|
|
|
40
40
|
* username/email, an oversized avatar/bio, a malformed `oauthData`, a missing `currentPassword`,
|
|
41
41
|
* or no updatable fields; 403 `user.error.usernameUnavailable` / `user.error.emailAlreadyRegistered`
|
|
42
42
|
* / `user.error.currentPasswordIncorrect`; 500 `user.error.failedToUpdateUser`.
|
|
43
|
+
*
|
|
44
|
+
* **A change to `email` is re-authenticated.** On an account that has a password, changing OR
|
|
45
|
+
* clearing the address requires that account's `currentPassword` in the same flat body — 400
|
|
46
|
+
* `user.error.currentPasswordRequired` when it is missing, 403
|
|
47
|
+
* `user.error.currentPasswordIncorrect` when it does not match. A real change sets
|
|
48
|
+
* `emailVerified` to `false` server-side (the new address is unproven; the flag is never read
|
|
49
|
+
* from the body). An OAuth-only account has no password hash, so its provider-backed session is
|
|
50
|
+
* the credential. Do NOT skip the gate by writing `email` through the datastore instead: return
|
|
51
|
+
* the 400 and let the client collect the current password (a re-authentication step).
|
|
43
52
|
* @param resource - The user resource configuration: `{ name, tableName, schema? }`.
|
|
44
53
|
* @param resource.name - The resource name used in error messages.
|
|
45
54
|
* @param resource.tableName - The database table name for users.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../src/handlers/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAChD,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;AAC1B,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;AAChC,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAEhD,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAEjE,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,WAAW,EAAE,iBAAiB,EAAE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}
|
|
@@ -12,6 +12,16 @@ export interface UpdatePasswordRequest extends MoleculeRequest {
|
|
|
12
12
|
* must be provided and verified first. The new password is hashed via `@molecule/api-password`
|
|
13
13
|
* and stored in the secrets table.
|
|
14
14
|
*
|
|
15
|
+
* **Body and results.** The flat body needs `newPassword` (8–1024 characters) and, on an
|
|
16
|
+
* account that ALREADY has a password (the password-signup case), `currentPassword` too —
|
|
17
|
+
* there is no variant that changes a password account's password from `newPassword` alone.
|
|
18
|
+
* Missing current password → 400 `user.error.currentPasswordRequired`; wrong → 403
|
|
19
|
+
* `user.error.currentPasswordIncorrect`; an invalid new password is 400
|
|
20
|
+
* `user.error.newPasswordRequired` / `user.error.passwordTooShort` /
|
|
21
|
+
* `user.error.passwordTooLong`. Only an account with no password hash (OAuth-only) may omit
|
|
22
|
+
* `currentPassword`. Success is 200 `{ success: true }` and also clears any outstanding reset
|
|
23
|
+
* token. Never cache or replay the login password to satisfy this check.
|
|
24
|
+
*
|
|
15
25
|
* **Every OTHER session is revoked; the caller's own is kept.** The device rows of all other
|
|
16
26
|
* devices are deleted, so a stolen token on another device dies — but the device this request
|
|
17
27
|
* arrived on stays, and the token that made the request (the `Authorization` header the client
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updatePassword.d.ts","sourceRoot":"","sources":["../../src/handlers/updatePassword.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAI/E,OAAO,KAAK,KAAK,KAAK,MAAM,aAAa,CAAA;AAKzC,6FAA6F;AAC7F,MAAM,WAAW,qBAAsB,SAAQ,eAAe;IAC5D,IAAI,EAAE;QACJ,eAAe,CAAC,EAAE,MAAM,CAAA;QACxB,WAAW,CAAC,EAAE,MAAM,CAAA;KACrB,CAAA;CACF;AAED
|
|
1
|
+
{"version":3,"file":"updatePassword.d.ts","sourceRoot":"","sources":["../../src/handlers/updatePassword.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAI/E,OAAO,KAAK,KAAK,KAAK,MAAM,aAAa,CAAA;AAKzC,6FAA6F;AAC7F,MAAM,WAAW,qBAAsB,SAAQ,eAAe;IAC5D,IAAI,EAAE;QACJ,eAAe,CAAC,EAAE,MAAM,CAAA;QACxB,WAAW,CAAC,EAAE,MAAM,CAAA;KACrB,CAAA;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,cAAc,GAAI,8CAI5B,KAAK,CAAC,eAAe,MACR,KAAK,qBAAqB,EAAE,MAAM,gBAAgB;;;;;;;;;;;;;;EA6GjE,CAAA"}
|
|
@@ -10,6 +10,16 @@ const logger = getLogger();
|
|
|
10
10
|
* must be provided and verified first. The new password is hashed via `@molecule/api-password`
|
|
11
11
|
* and stored in the secrets table.
|
|
12
12
|
*
|
|
13
|
+
* **Body and results.** The flat body needs `newPassword` (8–1024 characters) and, on an
|
|
14
|
+
* account that ALREADY has a password (the password-signup case), `currentPassword` too —
|
|
15
|
+
* there is no variant that changes a password account's password from `newPassword` alone.
|
|
16
|
+
* Missing current password → 400 `user.error.currentPasswordRequired`; wrong → 403
|
|
17
|
+
* `user.error.currentPasswordIncorrect`; an invalid new password is 400
|
|
18
|
+
* `user.error.newPasswordRequired` / `user.error.passwordTooShort` /
|
|
19
|
+
* `user.error.passwordTooLong`. Only an account with no password hash (OAuth-only) may omit
|
|
20
|
+
* `currentPassword`. Success is 200 `{ success: true }` and also clears any outstanding reset
|
|
21
|
+
* token. Never cache or replay the login password to satisfy this check.
|
|
22
|
+
*
|
|
13
23
|
* **Every OTHER session is revoked; the caller's own is kept.** The device rows of all other
|
|
14
24
|
* devices are deleted, so a stolen token on another device dies — but the device this request
|
|
15
25
|
* arrived on stays, and the token that made the request (the `Authorization` header the client
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updatePassword.js","sourceRoot":"","sources":["../../src/handlers/updatePassword.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AACjE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAItD,OAAO,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAA;AAGpE,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;AAChC,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;AAU1B
|
|
1
|
+
{"version":3,"file":"updatePassword.js","sourceRoot":"","sources":["../../src/handlers/updatePassword.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AACjE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAItD,OAAO,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAA;AAGpE,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;AAChC,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;AAU1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAC7B,IAAI,EAAE,KAAK,EACX,SAAS,EACT,MAAM,EAAE,OAAO,GACO,EAAE,EAAE;IAC1B,OAAO,KAAK,EAAE,GAA0B,EAAE,GAAsB,EAAE,EAAE;QAClE,IAAI,CAAC;YACH,MAAM,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAA;YACxB,MAAM,EAAE,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AAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;YAE9E,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,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,mCAAmC,CAAC;oBAC7C,QAAQ,EAAE,mCAAmC;iBAC9C;aACF,CAAA;QACH,CAAC;IACH,CAAC,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -20,6 +20,10 @@ export interface UpdatePlanRequest extends MoleculeRequest {
|
|
|
20
20
|
* cross-platform subscription cancellation when switching providers. Returns a checkout URL
|
|
21
21
|
* (status 201) for new subscriptions, or directly updates the user record for in-place changes
|
|
22
22
|
* and free plan downgrades.
|
|
23
|
+
*
|
|
24
|
+
* `@molecule/api-payments` is an OPTIONAL peer: its `isConfigNotConfiguredError` helper is
|
|
25
|
+
* loaded lazily inside the catch, so an app that installs no payments package can still import
|
|
26
|
+
* (and boot) this resource — the free-plan path and every non-payment route keep working.
|
|
23
27
|
* @param resource - The user resource configuration (name, tableName, schema).
|
|
24
28
|
* @param resource.name - The resource name.
|
|
25
29
|
* @param resource.tableName - The database table name for users.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updatePlan.d.ts","sourceRoot":"","sources":["../../src/handlers/updatePlan.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"updatePlan.d.ts","sourceRoot":"","sources":["../../src/handlers/updatePlan.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAI7D,OAAO,KAAK,KAAK,KAAK,MAAM,aAAa,CAAA;AAOzC,oEAAoE;AACpE,MAAM,WAAW,iBAAkB,SAAQ,eAAe;IACxD,IAAI,EAAE;QACJ,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB;;;;;;WAMG;QACH,QAAQ,CAAC,EAAE,MAAM,CAAA;KAClB,CAAA;CACF;AAyBD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,UAAU,GAAI,sCAAsC,KAAK,CAAC,eAAe,MAiCtE,KAAK,iBAAiB;;;;;aAxDnC,CAAC;;;;;;;;;;;;;;EAgTH,CAAA"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { get, getAnalytics, getLogger } from '@molecule/api-bond';
|
|
2
2
|
import { findById } from '@molecule/api-database';
|
|
3
3
|
import { t } from '@molecule/api-i18n';
|
|
4
|
-
import { isConfigNotConfiguredError, } from '@molecule/api-payments';
|
|
5
4
|
import { update as resourceUpdate } from '@molecule/api-resource';
|
|
6
5
|
import { updatePlanPropsSchema } from '../schema.js';
|
|
7
6
|
import { invalidateEntitlementsCacheSafe } from '../utilities/invalidateEntitlements.js';
|
|
7
|
+
import { loadPayments } from '../utilities/payments.js';
|
|
8
8
|
const analytics = getAnalytics();
|
|
9
9
|
const logger = getLogger();
|
|
10
10
|
/**
|
|
@@ -36,6 +36,10 @@ function normalizeQuantity(raw) {
|
|
|
36
36
|
* cross-platform subscription cancellation when switching providers. Returns a checkout URL
|
|
37
37
|
* (status 201) for new subscriptions, or directly updates the user record for in-place changes
|
|
38
38
|
* and free plan downgrades.
|
|
39
|
+
*
|
|
40
|
+
* `@molecule/api-payments` is an OPTIONAL peer: its `isConfigNotConfiguredError` helper is
|
|
41
|
+
* loaded lazily inside the catch, so an app that installs no payments package can still import
|
|
42
|
+
* (and boot) this resource — the free-plan path and every non-payment route keep working.
|
|
39
43
|
* @param resource - The user resource configuration (name, tableName, schema).
|
|
40
44
|
* @param resource.name - The resource name.
|
|
41
45
|
* @param resource.tableName - The database table name for users.
|
|
@@ -277,7 +281,11 @@ export const updatePlan = ({ name, tableName, schema: _schema }) => {
|
|
|
277
281
|
// its REAL statusCode/errorKey through instead of flattening it to a
|
|
278
282
|
// generic 500. Otherwise a missing secret is indistinguishable from an
|
|
279
283
|
// unexpected server error at the exact moment a user tries to upgrade.
|
|
280
|
-
|
|
284
|
+
// The payments core is an OPTIONAL peer — loaded here (never at module scope) so
|
|
285
|
+
// the package boots in an install that omits it. No payments package means the
|
|
286
|
+
// error is not a tagged config error, so it falls through to the generic 500 below.
|
|
287
|
+
const payments = await loadPayments();
|
|
288
|
+
if (payments && payments.isConfigNotConfiguredError(error)) {
|
|
281
289
|
logger.warn(error.message, { errorKey: error.errorKey });
|
|
282
290
|
return {
|
|
283
291
|
statusCode: error.statusCode,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updatePlan.js","sourceRoot":"","sources":["../../src/handlers/updatePlan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACjD,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"updatePlan.js","sourceRoot":"","sources":["../../src/handlers/updatePlan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACjD,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAA;AAGtC,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAEjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AAEpD,OAAO,EAAE,+BAA+B,EAAE,MAAM,wCAAwC,CAAA;AACxF,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEvD,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;AAChC,MAAM,MAAM,GAAG,S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AAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,oEAAoE;YACpE,uEAAuE;YACvE,qEAAqE;YACrE,uEAAuE;YACvE,uEAAuE;YACvE,iFAAiF;YACjF,+EAA+E;YAC/E,oFAAoF;YACpF,MAAM,QAAQ,GAAG,MAAM,YAAY,EAAE,CAAA;YACrC,IAAI,QAAQ,IAAI,QAAQ,CAAC,0BAA0B,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC3D,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAA;gBACxD,OAAO;oBACL,UAAU,EAAE,KAAK,CAAC,UAAU;oBAC5B,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE;iBACzD,CAAA;YACH,CAAC;YACD,MAAM,CAAC,KAAK,CAAC,oBAAoB,EAAE;gBACjC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE;gBACrB,OAAO,EAAE,GAAG,CAAC,IAAI,EAAE,OAAO;gBAC1B,KAAK;aACN,CAAC,CAAA;YACF,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"}
|
package/dist/index.d.ts
CHANGED
|
@@ -121,6 +121,34 @@
|
|
|
121
121
|
* `user.error.twoFactorVerificationUnavailable` / `user.error.loginFailed`. Bad credentials
|
|
122
122
|
* are 403, not 401 or 422.
|
|
123
123
|
*
|
|
124
|
+
* **A JWT you sign yourself is NOT a session.** `verifyMiddleware` accepts a token only when
|
|
125
|
+
* the bonded `@molecule/api-jwt` provider verifies it AND its `deviceId` names an ACTIVE row
|
|
126
|
+
* in `devices`; anything else — another secret or algorithm, or an invented/placeholder
|
|
127
|
+
* `deviceId` — is answered 401 on every request (a request with no credential at all answers
|
|
128
|
+
* `{"errors":{"token":["is missing"]}}`). Mint sessions with `authorization.set()` after
|
|
129
|
+
* `device.createOrUpdate()` (the sequence above) and mount `verifyMiddleware` once in front of
|
|
130
|
+
* the routes — never hand-roll auth middleware or a second token scheme.
|
|
131
|
+
*
|
|
132
|
+
* **Changing the EMAIL or the PASSWORD requires the CURRENT password — there is no opt-out.**
|
|
133
|
+
* `handlers.update` (`PATCH /users/:id`) takes profile fields; when the body changes (or
|
|
134
|
+
* clears) `email` on an account that has a password, the SAME flat body must also carry that
|
|
135
|
+
* account's `currentPassword`. Missing → 400 `user.error.currentPasswordRequired`; wrong → 403
|
|
136
|
+
* `user.error.currentPasswordIncorrect`. A real change resets `emailVerified` to `false`
|
|
137
|
+
* server-side (the new address is unproven), and `emailVerified` is NEVER read from the body.
|
|
138
|
+
* An OAuth-only account (no `passwordHash`) has no password to present, so its provider-backed
|
|
139
|
+
* session is the credential. `handlers.updatePassword` (`PATCH /users/:id/password`) requires
|
|
140
|
+
* `newPassword` (8–1024 characters) and, on a password account, `currentPassword` as well —
|
|
141
|
+
* same 400/403 codes; it answers 200 `{ success: true }`, clears any outstanding reset token,
|
|
142
|
+
* and revokes every OTHER device while the caller's own session keeps working.
|
|
143
|
+
*
|
|
144
|
+
* Do NOT work around either gate by storing, caching or replaying the user's password, by
|
|
145
|
+
* sending an invented `currentPassword`, or by writing `email` around the handler with the
|
|
146
|
+
* datastore: the password is the re-authentication factor that stops a hijacked session from
|
|
147
|
+
* moving the account-recovery address. If a wire format (e.g. RealWorld's token-only
|
|
148
|
+
* `PUT /user`) cannot collect the current password, that flow is simply unsupported as written
|
|
149
|
+
* — have the client ask for it in a re-authentication step, or route sign-in and account
|
|
150
|
+
* changes through the auth pages (`useAuth()`). There is no supported bypass to add.
|
|
151
|
+
*
|
|
124
152
|
* @remarks
|
|
125
153
|
* The user record is split across TWO schemas — pick the right one or you leak credentials:
|
|
126
154
|
* - **{@link Props} (`propsSchema`)** — SAFE, client-facing fields (username, name, email,
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyRG;AAEH,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAA;AACnD,OAAO,KAAK,WAAW,MAAM,wBAAwB,CAAA;AACrD,cAAc,oBAAoB,CAAA;AAClC,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAA;AAC/C,cAAc,WAAW,CAAA;AACzB,cAAc,wBAAwB,CAAA;AACtC,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -121,6 +121,34 @@
|
|
|
121
121
|
* `user.error.twoFactorVerificationUnavailable` / `user.error.loginFailed`. Bad credentials
|
|
122
122
|
* are 403, not 401 or 422.
|
|
123
123
|
*
|
|
124
|
+
* **A JWT you sign yourself is NOT a session.** `verifyMiddleware` accepts a token only when
|
|
125
|
+
* the bonded `@molecule/api-jwt` provider verifies it AND its `deviceId` names an ACTIVE row
|
|
126
|
+
* in `devices`; anything else — another secret or algorithm, or an invented/placeholder
|
|
127
|
+
* `deviceId` — is answered 401 on every request (a request with no credential at all answers
|
|
128
|
+
* `{"errors":{"token":["is missing"]}}`). Mint sessions with `authorization.set()` after
|
|
129
|
+
* `device.createOrUpdate()` (the sequence above) and mount `verifyMiddleware` once in front of
|
|
130
|
+
* the routes — never hand-roll auth middleware or a second token scheme.
|
|
131
|
+
*
|
|
132
|
+
* **Changing the EMAIL or the PASSWORD requires the CURRENT password — there is no opt-out.**
|
|
133
|
+
* `handlers.update` (`PATCH /users/:id`) takes profile fields; when the body changes (or
|
|
134
|
+
* clears) `email` on an account that has a password, the SAME flat body must also carry that
|
|
135
|
+
* account's `currentPassword`. Missing → 400 `user.error.currentPasswordRequired`; wrong → 403
|
|
136
|
+
* `user.error.currentPasswordIncorrect`. A real change resets `emailVerified` to `false`
|
|
137
|
+
* server-side (the new address is unproven), and `emailVerified` is NEVER read from the body.
|
|
138
|
+
* An OAuth-only account (no `passwordHash`) has no password to present, so its provider-backed
|
|
139
|
+
* session is the credential. `handlers.updatePassword` (`PATCH /users/:id/password`) requires
|
|
140
|
+
* `newPassword` (8–1024 characters) and, on a password account, `currentPassword` as well —
|
|
141
|
+
* same 400/403 codes; it answers 200 `{ success: true }`, clears any outstanding reset token,
|
|
142
|
+
* and revokes every OTHER device while the caller's own session keeps working.
|
|
143
|
+
*
|
|
144
|
+
* Do NOT work around either gate by storing, caching or replaying the user's password, by
|
|
145
|
+
* sending an invented `currentPassword`, or by writing `email` around the handler with the
|
|
146
|
+
* datastore: the password is the re-authentication factor that stops a hijacked session from
|
|
147
|
+
* moving the account-recovery address. If a wire format (e.g. RealWorld's token-only
|
|
148
|
+
* `PUT /user`) cannot collect the current password, that flow is simply unsupported as written
|
|
149
|
+
* — have the client ask for it in a re-authentication step, or route sign-in and account
|
|
150
|
+
* changes through the auth pages (`useAuth()`). There is no supported bypass to add.
|
|
151
|
+
*
|
|
124
152
|
* @remarks
|
|
125
153
|
* The user record is split across TWO schemas — pick the right one or you leak credentials:
|
|
126
154
|
* - **{@link Props} (`propsSchema`)** — SAFE, client-facing fields (username, name, email,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyRG;AAEH,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAA;AACnD,OAAO,KAAK,WAAW,MAAM,wBAAwB,CAAA;AACrD,cAAc,oBAAoB,CAAA;AAClC,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAA;AAC/C,cAAc,WAAW,CAAA;AACzB,cAAc,wBAAwB,CAAA;AACtC,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lazy access to `@molecule/api-payments`, which is an OPTIONAL peer of this package.
|
|
3
|
+
*
|
|
4
|
+
* The payment handlers need two runtime helpers from the core package
|
|
5
|
+
* (`isConfigNotConfiguredError` for the config-vs-failure split, and
|
|
6
|
+
* `resolveBillingPortalReturnUrl` for the portal exit origin), but the peer is declared
|
|
7
|
+
* `optional` in `peerDependenciesMeta` because an app that takes no payments must not be
|
|
8
|
+
* forced to install it. A static `import … from '@molecule/api-payments'` contradicts that:
|
|
9
|
+
* the package barrel exports every handler, so Node evaluates the import while loading
|
|
10
|
+
* `@molecule/api-resource-user` itself, and a production install (which installs no optional
|
|
11
|
+
* peer) dies at BOOT with `ERR_MODULE_NOT_FOUND … imported from
|
|
12
|
+
* …/dist/handlers/updatePlan.js` — xr-flash-m354, two failed deploys on 2026-10-21.
|
|
13
|
+
*
|
|
14
|
+
* A dynamic `import()` is evaluated only when a payments feature is actually used, and its
|
|
15
|
+
* absence means "this app has no payments", never a crash.
|
|
16
|
+
*
|
|
17
|
+
* @module
|
|
18
|
+
*/
|
|
19
|
+
import type * as paymentsModule from '@molecule/api-payments';
|
|
20
|
+
/**
|
|
21
|
+
* Load `@molecule/api-payments` once, or `null` when the optional peer is not installed.
|
|
22
|
+
*
|
|
23
|
+
* Call it from a request path, never at module scope: the whole point is that importing
|
|
24
|
+
* this package does not require the peer.
|
|
25
|
+
*
|
|
26
|
+
* @returns The payments core module, or `null` when the app has not installed it.
|
|
27
|
+
*/
|
|
28
|
+
export declare const loadPayments: () => Promise<typeof paymentsModule | null>;
|
|
29
|
+
//# sourceMappingURL=payments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payments.d.ts","sourceRoot":"","sources":["../../src/utilities/payments.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,KAAK,cAAc,MAAM,wBAAwB,CAAA;AAQ7D;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,QAAO,OAAO,CAAC,OAAO,cAAc,GAAG,IAAI,CAgBnE,CAAA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lazy access to `@molecule/api-payments`, which is an OPTIONAL peer of this package.
|
|
3
|
+
*
|
|
4
|
+
* The payment handlers need two runtime helpers from the core package
|
|
5
|
+
* (`isConfigNotConfiguredError` for the config-vs-failure split, and
|
|
6
|
+
* `resolveBillingPortalReturnUrl` for the portal exit origin), but the peer is declared
|
|
7
|
+
* `optional` in `peerDependenciesMeta` because an app that takes no payments must not be
|
|
8
|
+
* forced to install it. A static `import … from '@molecule/api-payments'` contradicts that:
|
|
9
|
+
* the package barrel exports every handler, so Node evaluates the import while loading
|
|
10
|
+
* `@molecule/api-resource-user` itself, and a production install (which installs no optional
|
|
11
|
+
* peer) dies at BOOT with `ERR_MODULE_NOT_FOUND … imported from
|
|
12
|
+
* …/dist/handlers/updatePlan.js` — xr-flash-m354, two failed deploys on 2026-10-21.
|
|
13
|
+
*
|
|
14
|
+
* A dynamic `import()` is evaluated only when a payments feature is actually used, and its
|
|
15
|
+
* absence means "this app has no payments", never a crash.
|
|
16
|
+
*
|
|
17
|
+
* @module
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* The first load of the optional peer — the module, or `null` when it is not installed.
|
|
21
|
+
* Memoised so absence is probed once per process instead of on every request.
|
|
22
|
+
*/
|
|
23
|
+
let paymentsModulePromise;
|
|
24
|
+
/**
|
|
25
|
+
* Load `@molecule/api-payments` once, or `null` when the optional peer is not installed.
|
|
26
|
+
*
|
|
27
|
+
* Call it from a request path, never at module scope: the whole point is that importing
|
|
28
|
+
* this package does not require the peer.
|
|
29
|
+
*
|
|
30
|
+
* @returns The payments core module, or `null` when the app has not installed it.
|
|
31
|
+
*/
|
|
32
|
+
export const loadPayments = () => {
|
|
33
|
+
paymentsModulePromise ??= import('@molecule/api-payments').catch((error) => {
|
|
34
|
+
// Only absence of THIS optional peer is expected. A missing transitive import,
|
|
35
|
+
// invalid export or initialization failure in an installed package is a real
|
|
36
|
+
// failure and must reach the handler's normal error reporting.
|
|
37
|
+
const failure = error;
|
|
38
|
+
if (failure?.code === 'ERR_MODULE_NOT_FOUND' &&
|
|
39
|
+
typeof failure.message === 'string' &&
|
|
40
|
+
/^Cannot find package ['"]@molecule\/api-payments['"] imported from /.test(failure.message)) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
throw error;
|
|
44
|
+
});
|
|
45
|
+
return paymentsModulePromise;
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=payments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payments.js","sourceRoot":"","sources":["../../src/utilities/payments.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH;;;GAGG;AACH,IAAI,qBAAwE,CAAA;AAE5E;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,GAA0C,EAAE;IACtE,qBAAqB,KAAK,MAAM,CAAC,wBAAwB,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;QAClF,+EAA+E;QAC/E,6EAA6E;QAC7E,+DAA+D;QAC/D,MAAM,OAAO,GAAG,KAAqD,CAAA;QACrE,IACE,OAAO,EAAE,IAAI,KAAK,sBAAsB;YACxC,OAAO,OAAO,CAAC,OAAO,KAAK,QAAQ;YACnC,qEAAqE,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAC3F,CAAC;YACD,OAAO,IAAI,CAAA;QACb,CAAC;QACD,MAAM,KAAK,CAAA;IACb,CAAC,CAAC,CAAA;IACF,OAAO,qBAAqB,CAAA;AAC9B,CAAC,CAAA"}
|