@molecule/api-resource-user 1.0.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/LICENSE +115 -0
- package/dist/authorization.d.ts +107 -0
- package/dist/authorization.d.ts.map +1 -0
- package/dist/authorization.js +375 -0
- package/dist/authorization.js.map +1 -0
- package/dist/authorizers/auth.d.ts +8 -0
- package/dist/authorizers/auth.d.ts.map +1 -0
- package/dist/authorizers/auth.js +19 -0
- package/dist/authorizers/auth.js.map +1 -0
- package/dist/authorizers/authSelf.d.ts +14 -0
- package/dist/authorizers/authSelf.d.ts.map +1 -0
- package/dist/authorizers/authSelf.js +31 -0
- package/dist/authorizers/authSelf.js.map +1 -0
- package/dist/authorizers/index.d.ts +5 -0
- package/dist/authorizers/index.d.ts.map +1 -0
- package/dist/authorizers/index.js +5 -0
- package/dist/authorizers/index.js.map +1 -0
- package/dist/authorizers/rateLimit.d.ts +84 -0
- package/dist/authorizers/rateLimit.d.ts.map +1 -0
- package/dist/authorizers/rateLimit.js +144 -0
- package/dist/authorizers/rateLimit.js.map +1 -0
- package/dist/authorizers/requireWebhookAuthenticity.d.ts +23 -0
- package/dist/authorizers/requireWebhookAuthenticity.d.ts.map +1 -0
- package/dist/authorizers/requireWebhookAuthenticity.js +76 -0
- package/dist/authorizers/requireWebhookAuthenticity.js.map +1 -0
- package/dist/browser-guard.d.ts +2 -0
- package/dist/browser-guard.d.ts.map +1 -0
- package/dist/browser-guard.js +19 -0
- package/dist/browser-guard.js.map +1 -0
- package/dist/handlers/create.d.ts +52 -0
- package/dist/handlers/create.d.ts.map +1 -0
- package/dist/handlers/create.js +208 -0
- package/dist/handlers/create.js.map +1 -0
- package/dist/handlers/del.d.ts +30 -0
- package/dist/handlers/del.d.ts.map +1 -0
- package/dist/handlers/del.js +55 -0
- package/dist/handlers/del.js.map +1 -0
- package/dist/handlers/forgotPassword.d.ts +34 -0
- package/dist/handlers/forgotPassword.d.ts.map +1 -0
- package/dist/handlers/forgotPassword.js +119 -0
- package/dist/handlers/forgotPassword.js.map +1 -0
- package/dist/handlers/index.d.ts +16 -0
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/index.js +16 -0
- package/dist/handlers/index.js.map +1 -0
- package/dist/handlers/logIn.d.ts +91 -0
- package/dist/handlers/logIn.d.ts.map +1 -0
- package/dist/handlers/logIn.js +223 -0
- package/dist/handlers/logIn.js.map +1 -0
- package/dist/handlers/logInOAuth.d.ts +66 -0
- package/dist/handlers/logInOAuth.d.ts.map +1 -0
- package/dist/handlers/logInOAuth.js +462 -0
- package/dist/handlers/logInOAuth.js.map +1 -0
- package/dist/handlers/logout.d.ts +22 -0
- package/dist/handlers/logout.d.ts.map +1 -0
- package/dist/handlers/logout.js +57 -0
- package/dist/handlers/logout.js.map +1 -0
- package/dist/handlers/oauthAuthorize.d.ts +44 -0
- package/dist/handlers/oauthAuthorize.d.ts.map +1 -0
- package/dist/handlers/oauthAuthorize.js +141 -0
- package/dist/handlers/oauthAuthorize.js.map +1 -0
- package/dist/handlers/payments/handlePaymentNotification.d.ts +28 -0
- package/dist/handlers/payments/handlePaymentNotification.d.ts.map +1 -0
- package/dist/handlers/payments/handlePaymentNotification.js +217 -0
- package/dist/handlers/payments/handlePaymentNotification.js.map +1 -0
- package/dist/handlers/payments/registry.d.ts +13 -0
- package/dist/handlers/payments/registry.d.ts.map +1 -0
- package/dist/handlers/payments/registry.js +13 -0
- package/dist/handlers/payments/registry.js.map +1 -0
- package/dist/handlers/payments/verifyPayment.d.ts +37 -0
- package/dist/handlers/payments/verifyPayment.d.ts.map +1 -0
- package/dist/handlers/payments/verifyPayment.js +383 -0
- package/dist/handlers/payments/verifyPayment.js.map +1 -0
- package/dist/handlers/read.d.ts +17 -0
- package/dist/handlers/read.d.ts.map +1 -0
- package/dist/handlers/read.js +60 -0
- package/dist/handlers/read.js.map +1 -0
- package/dist/handlers/readSelf.d.ts +23 -0
- package/dist/handlers/readSelf.d.ts.map +1 -0
- package/dist/handlers/readSelf.js +77 -0
- package/dist/handlers/readSelf.js.map +1 -0
- package/dist/handlers/resetPassword.d.ts +40 -0
- package/dist/handlers/resetPassword.d.ts.map +1 -0
- package/dist/handlers/resetPassword.js +147 -0
- package/dist/handlers/resetPassword.js.map +1 -0
- package/dist/handlers/update.d.ts +28 -0
- package/dist/handlers/update.d.ts.map +1 -0
- package/dist/handlers/update.js +250 -0
- package/dist/handlers/update.js.map +1 -0
- package/dist/handlers/updatePassword.d.ts +35 -0
- package/dist/handlers/updatePassword.d.ts.map +1 -0
- package/dist/handlers/updatePassword.js +113 -0
- package/dist/handlers/updatePassword.js.map +1 -0
- package/dist/handlers/updatePlan.d.ts +41 -0
- package/dist/handlers/updatePlan.d.ts.map +1 -0
- package/dist/handlers/updatePlan.js +242 -0
- package/dist/handlers/updatePlan.js.map +1 -0
- package/dist/handlers/verifyTwoFactor.d.ts +46 -0
- package/dist/handlers/verifyTwoFactor.d.ts.map +1 -0
- package/dist/handlers/verifyTwoFactor.js +162 -0
- package/dist/handlers/verifyTwoFactor.js.map +1 -0
- package/dist/i18n.d.ts +10 -0
- package/dist/i18n.d.ts.map +1 -0
- package/dist/i18n.js +25 -0
- package/dist/i18n.js.map +1 -0
- package/dist/index.d.ts +88 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +88 -0
- package/dist/index.js.map +1 -0
- package/dist/requestHandlerMap.d.ts +44 -0
- package/dist/requestHandlerMap.d.ts.map +1 -0
- package/dist/requestHandlerMap.js +68 -0
- package/dist/requestHandlerMap.js.map +1 -0
- package/dist/resource.d.ts +22 -0
- package/dist/resource.d.ts.map +1 -0
- package/dist/resource.js +23 -0
- package/dist/resource.js.map +1 -0
- package/dist/routes.d.ts +44 -0
- package/dist/routes.d.ts.map +1 -0
- package/dist/routes.js +121 -0
- package/dist/routes.js.map +1 -0
- package/dist/schema.d.ts +193 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +229 -0
- package/dist/schema.js.map +1 -0
- package/dist/secrets.d.ts +16 -0
- package/dist/secrets.d.ts.map +1 -0
- package/dist/secrets.js +28 -0
- package/dist/secrets.js.map +1 -0
- package/dist/types.d.ts +14 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +9 -0
- package/dist/types.js.map +1 -0
- package/dist/utilities/getPlan.d.ts +19 -0
- package/dist/utilities/getPlan.d.ts.map +1 -0
- package/dist/utilities/getPlan.js +26 -0
- package/dist/utilities/getPlan.js.map +1 -0
- package/dist/utilities/hashResetToken.d.ts +16 -0
- package/dist/utilities/hashResetToken.d.ts.map +1 -0
- package/dist/utilities/hashResetToken.js +19 -0
- package/dist/utilities/hashResetToken.js.map +1 -0
- package/dist/utilities/index.d.ts +5 -0
- package/dist/utilities/index.d.ts.map +1 -0
- package/dist/utilities/index.js +5 -0
- package/dist/utilities/index.js.map +1 -0
- package/dist/utilities/invalidateEntitlements.d.ts +24 -0
- package/dist/utilities/invalidateEntitlements.d.ts.map +1 -0
- package/dist/utilities/invalidateEntitlements.js +41 -0
- package/dist/utilities/invalidateEntitlements.js.map +1 -0
- package/dist/utilities/normalizeEmail.d.ts +22 -0
- package/dist/utilities/normalizeEmail.d.ts.map +1 -0
- package/dist/utilities/normalizeEmail.js +28 -0
- package/dist/utilities/normalizeEmail.js.map +1 -0
- package/dist/utilities/notify.d.ts +21 -0
- package/dist/utilities/notify.d.ts.map +1 -0
- package/dist/utilities/notify.js +39 -0
- package/dist/utilities/notify.js.map +1 -0
- package/dist/utilities/stripSensitiveUserColumns.d.ts +25 -0
- package/dist/utilities/stripSensitiveUserColumns.d.ts.map +1 -0
- package/dist/utilities/stripSensitiveUserColumns.js +43 -0
- package/dist/utilities/stripSensitiveUserColumns.js.map +1 -0
- package/package.json +94 -0
- package/setup/users.sql +22 -0
- package/setup/usersSecrets.sql +9 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notify.js","sourceRoot":"","sources":["../../src/utilities/notify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAEnD,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;AAE1B;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,EAAE,EAC3B,MAAM,EACN,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,OAAO,GAQR,EAAiB,EAAE;IAClB,IAAI,CAAC;QACH,MAAM,iBAAiB,GAAG,MAAM,MAAM,CAAC,kCAAkC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAA;QAC5F,IAAI,CAAC,iBAAiB;YAAE,OAAM;QAE9B,MAAM,aAAa,GAAG,GAAG,CAItB,QAAQ,CAAC,CAAA;QACZ,IAAI,CAAC,aAAa;YAAE,OAAM;QAE1B,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAA;QAEnE,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,IAAI,MAAM,CAAC,EAAE,KAAK,QAAQ;gBAAE,SAAQ;YAEpC,IAAI,CAAC;gBACH,MAAM,iBAAiB,CAAC,IAAI,CAC1B,MAAM,CAAC,gBAAgE,EACvE,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE,CAC1D,CAAA;YACH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,CAAC,KAAK,CAAC,iCAAiC,MAAM,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,CAAA;YACpE,CAAC;QACH,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,CAAA;IACtC,CAAC;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Removes secret columns from a user row before it is returned to the client.
|
|
3
|
+
*
|
|
4
|
+
* `findById` is `SELECT *`, so a self-read (`/users/me`, `/users/:id` self)
|
|
5
|
+
* would otherwise return every column verbatim — including base-schema OAuth
|
|
6
|
+
* material AND any secret column a consuming app adds to the shared `users`
|
|
7
|
+
* table by migration. Notably `emailConfirmationToken`: an app that stores the
|
|
8
|
+
* email-verification token here in plaintext would let a user read their own
|
|
9
|
+
* token from a self-read and self-verify with no mailbox access (defeating an
|
|
10
|
+
* email-verification gate). This is a DENYLIST, not an allowlist projection, so
|
|
11
|
+
* app-added *non-secret* columns still reach the client.
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
15
|
+
/** User-row columns that must never appear in a self-read response. */
|
|
16
|
+
export declare const SENSITIVE_USER_COLUMNS: readonly ["oauthData", "oauthId", "emailConfirmationToken", "emailConfirmationTokenAt", "passwordResetToken", "passwordResetTokenAt", "passwordHash", "twoFactorSecret", "pendingTwoFactorSecret", "anonymousSecretHash", "anonymousSecret", "stripeCustomerId"];
|
|
17
|
+
/**
|
|
18
|
+
* Returns a shallow copy of a user row with {@link SENSITIVE_USER_COLUMNS}
|
|
19
|
+
* removed. The input row is not mutated.
|
|
20
|
+
*
|
|
21
|
+
* @param user - The full user row (as loaded by `findById`).
|
|
22
|
+
* @returns A copy of the row without secret columns.
|
|
23
|
+
*/
|
|
24
|
+
export declare function stripSensitiveUserColumns<T extends Record<string, unknown>>(user: T): T;
|
|
25
|
+
//# sourceMappingURL=stripSensitiveUserColumns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stripSensitiveUserColumns.d.ts","sourceRoot":"","sources":["../../src/utilities/stripSensitiveUserColumns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,uEAAuE;AACvE,eAAO,MAAM,sBAAsB,kQAazB,CAAA;AAEV;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,CAIvF"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Removes secret columns from a user row before it is returned to the client.
|
|
3
|
+
*
|
|
4
|
+
* `findById` is `SELECT *`, so a self-read (`/users/me`, `/users/:id` self)
|
|
5
|
+
* would otherwise return every column verbatim — including base-schema OAuth
|
|
6
|
+
* material AND any secret column a consuming app adds to the shared `users`
|
|
7
|
+
* table by migration. Notably `emailConfirmationToken`: an app that stores the
|
|
8
|
+
* email-verification token here in plaintext would let a user read their own
|
|
9
|
+
* token from a self-read and self-verify with no mailbox access (defeating an
|
|
10
|
+
* email-verification gate). This is a DENYLIST, not an allowlist projection, so
|
|
11
|
+
* app-added *non-secret* columns still reach the client.
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
15
|
+
/** User-row columns that must never appear in a self-read response. */
|
|
16
|
+
export const SENSITIVE_USER_COLUMNS = [
|
|
17
|
+
'oauthData',
|
|
18
|
+
'oauthId',
|
|
19
|
+
'emailConfirmationToken',
|
|
20
|
+
'emailConfirmationTokenAt',
|
|
21
|
+
'passwordResetToken',
|
|
22
|
+
'passwordResetTokenAt',
|
|
23
|
+
'passwordHash',
|
|
24
|
+
'twoFactorSecret',
|
|
25
|
+
'pendingTwoFactorSecret',
|
|
26
|
+
'anonymousSecretHash',
|
|
27
|
+
'anonymousSecret',
|
|
28
|
+
'stripeCustomerId',
|
|
29
|
+
];
|
|
30
|
+
/**
|
|
31
|
+
* Returns a shallow copy of a user row with {@link SENSITIVE_USER_COLUMNS}
|
|
32
|
+
* removed. The input row is not mutated.
|
|
33
|
+
*
|
|
34
|
+
* @param user - The full user row (as loaded by `findById`).
|
|
35
|
+
* @returns A copy of the row without secret columns.
|
|
36
|
+
*/
|
|
37
|
+
export function stripSensitiveUserColumns(user) {
|
|
38
|
+
const safe = { ...user };
|
|
39
|
+
for (const col of SENSITIVE_USER_COLUMNS)
|
|
40
|
+
delete safe[col];
|
|
41
|
+
return safe;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=stripSensitiveUserColumns.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stripSensitiveUserColumns.js","sourceRoot":"","sources":["../../src/utilities/stripSensitiveUserColumns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,uEAAuE;AACvE,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,WAAW;IACX,SAAS;IACT,wBAAwB;IACxB,0BAA0B;IAC1B,oBAAoB;IACpB,sBAAsB;IACtB,cAAc;IACd,iBAAiB;IACjB,wBAAwB;IACxB,qBAAqB;IACrB,iBAAiB;IACjB,kBAAkB;CACV,CAAA;AAEV;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB,CAAoC,IAAO;IAClF,MAAM,IAAI,GAA4B,EAAE,GAAG,IAAI,EAAE,CAAA;IACjD,KAAK,MAAM,GAAG,IAAI,sBAAsB;QAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAA;IAC1D,OAAO,IAAS,CAAA;AAClB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@molecule/api-resource-user",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "User resource types and schema for molecule.dev.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "tsc",
|
|
10
|
+
"test": "vitest run",
|
|
11
|
+
"test:watch": "vitest"
|
|
12
|
+
},
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist",
|
|
21
|
+
"setup"
|
|
22
|
+
],
|
|
23
|
+
"keywords": [
|
|
24
|
+
"molecule",
|
|
25
|
+
"resource",
|
|
26
|
+
"user",
|
|
27
|
+
"auth"
|
|
28
|
+
],
|
|
29
|
+
"license": "Apache-2.0",
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"zod": "4.4.3"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@molecule/api-bond": "1.0.0",
|
|
35
|
+
"@molecule/api-config": "1.0.0",
|
|
36
|
+
"@molecule/api-locales-user": "1.0.0",
|
|
37
|
+
"@molecule/api-locales-user-payments": "1.0.0",
|
|
38
|
+
"@molecule/api-payments": "1.0.0",
|
|
39
|
+
"@molecule/api-push-notifications": "1.0.0",
|
|
40
|
+
"@molecule/api-rate-limit": "1.0.0",
|
|
41
|
+
"@molecule/api-two-factor": "1.0.0",
|
|
42
|
+
"@types/node": "26.1.2",
|
|
43
|
+
"typescript": "6.0.3",
|
|
44
|
+
"vitest": "4.1.10"
|
|
45
|
+
},
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"@molecule/api-bond": "^1.0.0",
|
|
48
|
+
"@molecule/api-config": "^1.0.0",
|
|
49
|
+
"@molecule/api-database": "^1.0.0",
|
|
50
|
+
"@molecule/api-entitlements": "^1.0.0",
|
|
51
|
+
"@molecule/api-i18n": "^1.0.0",
|
|
52
|
+
"@molecule/api-jwt": "^1.0.0",
|
|
53
|
+
"@molecule/api-locales-user": "^1.0.0",
|
|
54
|
+
"@molecule/api-locales-user-payments": "^1.0.0",
|
|
55
|
+
"@molecule/api-password": "^1.0.0",
|
|
56
|
+
"@molecule/api-payments": "^1.0.0",
|
|
57
|
+
"@molecule/api-push-notifications": "^1.0.0",
|
|
58
|
+
"@molecule/api-rate-limit": "^1.0.0",
|
|
59
|
+
"@molecule/api-resource": "^1.0.0",
|
|
60
|
+
"@molecule/api-resource-device": "^1.0.0",
|
|
61
|
+
"@molecule/api-secrets": "^1.0.0",
|
|
62
|
+
"@molecule/api-two-factor": "^1.0.0"
|
|
63
|
+
},
|
|
64
|
+
"peerDependenciesMeta": {
|
|
65
|
+
"@molecule/api-entitlements": {
|
|
66
|
+
"optional": true
|
|
67
|
+
},
|
|
68
|
+
"@molecule/api-two-factor": {
|
|
69
|
+
"optional": true
|
|
70
|
+
},
|
|
71
|
+
"@molecule/api-emails": {
|
|
72
|
+
"optional": true
|
|
73
|
+
},
|
|
74
|
+
"@molecule/api-push-notifications": {
|
|
75
|
+
"optional": true
|
|
76
|
+
},
|
|
77
|
+
"@molecule/api-payments": {
|
|
78
|
+
"optional": true
|
|
79
|
+
},
|
|
80
|
+
"@molecule/api-resource-payment": {
|
|
81
|
+
"optional": true
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"repository": {
|
|
85
|
+
"type": "git",
|
|
86
|
+
"url": "https://github.com/molecule-dev/molecule.git",
|
|
87
|
+
"directory": "packages/api/resources/user"
|
|
88
|
+
},
|
|
89
|
+
"homepage": "https://github.com/molecule-dev/molecule/tree/main/packages/api/resources/user",
|
|
90
|
+
"bugs": "https://github.com/molecule-dev/molecule/issues",
|
|
91
|
+
"publishConfig": {
|
|
92
|
+
"access": "public"
|
|
93
|
+
}
|
|
94
|
+
}
|
package/setup/users.sql
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
CREATE TABLE IF NOT EXISTS "users" (
|
|
2
|
+
"id" uuid UNIQUE PRIMARY KEY NOT NULL,
|
|
3
|
+
"createdAt" timestamptz DEFAULT current_timestamp NOT NULL,
|
|
4
|
+
"updatedAt" timestamptz DEFAULT current_timestamp NOT NULL,
|
|
5
|
+
"username" varchar(255),
|
|
6
|
+
"name" text,
|
|
7
|
+
"email" varchar(1023) UNIQUE,
|
|
8
|
+
"emailVerified" boolean DEFAULT false NOT NULL,
|
|
9
|
+
"avatar" text,
|
|
10
|
+
"bio" text,
|
|
11
|
+
"twoFactorEnabled" boolean DEFAULT false,
|
|
12
|
+
"oauthServer" text,
|
|
13
|
+
"oauthId" text,
|
|
14
|
+
"oauthData" jsonb,
|
|
15
|
+
"planKey" text,
|
|
16
|
+
"planExpiresAt" timestamptz,
|
|
17
|
+
"planAutoRenews" boolean DEFAULT false
|
|
18
|
+
);
|
|
19
|
+
CREATE INDEX IF NOT EXISTS "users_createdAt_index" ON "users" ("createdAt");
|
|
20
|
+
CREATE INDEX IF NOT EXISTS "users_updatedAt_index" ON "users" ("updatedAt");
|
|
21
|
+
CREATE INDEX IF NOT EXISTS "users_username_index" ON "users" ("username");
|
|
22
|
+
CREATE INDEX IF NOT EXISTS "users_email_index" ON "users" ("email");
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
CREATE TABLE IF NOT EXISTS "usersSecrets" (
|
|
2
|
+
"id" uuid UNIQUE PRIMARY KEY NOT NULL,
|
|
3
|
+
"passwordHash" text,
|
|
4
|
+
"passwordResetToken" text,
|
|
5
|
+
"passwordResetTokenAt" timestamptz,
|
|
6
|
+
"pendingTwoFactorSecret" text,
|
|
7
|
+
"twoFactorSecret" text,
|
|
8
|
+
"lastTwoFactorTimeStep" integer
|
|
9
|
+
);
|