@yongdall/user 0.5.0 → 0.5.2

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/index.d.mts CHANGED
@@ -1,33 +1,33 @@
1
- import * as imodel0 from "imodel";
1
+ import * as imodel2 from "imodel";
2
2
  import * as _yongdall_model0 from "@yongdall/model";
3
3
 
4
4
  //#region plugins/user/models/User.d.mts
5
5
  declare const _default: _yongdall_model0.ModelTable<{
6
- username: imodel0.FieldDefine<_yongdall_model0.ModelTable<{
7
- account: imodel0.FieldDefine<"string", false, false>;
8
- userId: imodel0.FieldDefine<"uuid", false, false>;
9
- type: imodel0.FieldDefine<"string", false, false>;
6
+ username: imodel2.FieldDefine<_yongdall_model0.ModelTable<{
7
+ account: imodel2.FieldDefine<"string", false, false>;
8
+ userId: imodel2.FieldDefine<"uuid", false, false>;
9
+ type: imodel2.FieldDefine<"string", false, false>;
10
10
  }, "user.account">, false, false>;
11
- id: imodel0.FieldDefine<"uuid", false, false>;
12
- name: imodel0.FieldDefine<"string", false, false>;
13
- enabled: imodel0.FieldDefine<"bool", false, false>;
14
- createdAt: imodel0.FieldDefine<"timestamp", false, false>;
15
- updatedAt: imodel0.FieldDefine<"timestamp", false, false>;
11
+ id: imodel2.FieldDefine<"uuid", false, false>;
12
+ name: imodel2.FieldDefine<"string", false, false>;
13
+ enabled: imodel2.FieldDefine<"bool", false, false>;
14
+ createdAt: imodel2.FieldDefine<"timestamp", false, false>;
15
+ updatedAt: imodel2.FieldDefine<"timestamp", false, false>;
16
16
  }, "user">;
17
17
  //#endregion
18
18
  //#region plugins/user/models/UserAccount.d.mts
19
19
  declare const _default$1: _yongdall_model0.ModelTable<{
20
- account: imodel0.FieldDefine<"string", false, false>;
21
- userId: imodel0.FieldDefine<"uuid", false, false>;
22
- type: imodel0.FieldDefine<"string", false, false>;
20
+ account: imodel2.FieldDefine<"string", false, false>;
21
+ userId: imodel2.FieldDefine<"uuid", false, false>;
22
+ type: imodel2.FieldDefine<"string", false, false>;
23
23
  }, "user.account">;
24
24
  //#endregion
25
25
  //#region plugins/user/models/UserPassword.d.mts
26
26
  declare const _default$2: _yongdall_model0.ModelTable<{
27
- userId: imodel0.FieldDefine<"uuid", false, false>;
28
- password: imodel0.FieldDefine<"string", false, false>;
29
- deadline: imodel0.FieldDefine<"timestamp", false, true>;
30
- updatedAt: imodel0.FieldDefine<"timestamp", false, false>;
27
+ userId: imodel2.FieldDefine<"uuid", false, false>;
28
+ password: imodel2.FieldDefine<"string", false, false>;
29
+ deadline: imodel2.FieldDefine<"timestamp", false, true>;
30
+ updatedAt: imodel2.FieldDefine<"timestamp", false, false>;
31
31
  }, "user.password">;
32
32
  //#endregion
33
33
  //#region plugins/user/common/verifyNewPassword.d.mts
package/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { a as verifyPassword, c as UserAccount_default, i as setPassword, l as verifyNewPassword, n as getPasswordHash, o as UserPassword_default, r as loadUserInfo, s as User_default, t as findUser } from "./user-D_GmNerB.mjs";
1
+ import { a as verifyPassword, c as UserAccount_default, i as setPassword, l as verifyNewPassword, n as getPasswordHash, o as UserPassword_default, r as loadUserInfo, s as User_default, t as findUser } from "./user-ejRy16ds.mjs";
2
2
 
3
3
  export { User_default as User, UserAccount_default as UserAccount, UserPassword_default as UserPassword, findUser, getPasswordHash, loadUserInfo, setPassword, verifyNewPassword, verifyPassword };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yongdall/user",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "type": "module",
5
5
  "main": "./index.mjs",
6
6
  "exports": {
@@ -15,7 +15,7 @@
15
15
  "@yongdall/connection": "^0.5.0",
16
16
  "@yongdall/context": "^0.5.0",
17
17
  "@yongdall/model": "^0.5.0",
18
- "@yongdall/core": "^0.5.0",
18
+ "@yongdall/core": "^0.5.2",
19
19
  "@yongdall/http": "^0.5.0"
20
20
  },
21
21
  "devDependencies": {
@@ -1,4 +1,4 @@
1
- import { i as setPassword, l as verifyNewPassword } from "./user-D_GmNerB.mjs";
1
+ import { i as setPassword, l as verifyNewPassword } from "./user-ejRy16ds.mjs";
2
2
  import { ApiRouter, useBody } from "@yongdall/http";
3
3
  import { getUser, hasUserPermission, isSingleUser, verifyUser } from "@yongdall/core";
4
4
 
@@ -1,5 +1,5 @@
1
- import { useTenant } from "@yongdall/core";
2
- import { connect } from "@yongdall/connection";
1
+ import { useSalt } from "@yongdall/core";
2
+ import { useConnection, useDatabase } from "@yongdall/connection";
3
3
  import { Query, Where, createField, createModel, now, uuid } from "@yongdall/model";
4
4
 
5
5
  //#region plugins/user/common/verifyNewPassword.mjs
@@ -150,8 +150,8 @@ const USER_INFO_KEY = "user:info";
150
150
  * @param {string} userId
151
151
  */
152
152
  async function loadUserInfo(userId) {
153
- return connect("cache").memoize(USER_INFO_KEY, userId, async () => {
154
- return (await connect("rdb").select(new Query(User_default).where({ id: userId }).limit(1)))[0];
153
+ return useConnection("cache").memoize(USER_INFO_KEY, userId, async () => {
154
+ return (await useDatabase().select(new Query(User_default).where({ id: userId }).limit(1)))[0];
155
155
  });
156
156
  }
157
157
  const allTypes = [
@@ -168,7 +168,7 @@ async function findUser(account, types) {
168
168
  const typeSet = typeof types === "string" ? new Set(types) : new Set(types);
169
169
  const t = typeSet.size ? allTypes.filter((v) => typeSet.has(v)) : allTypes;
170
170
  if (!t.length) return "";
171
- return (await connect("rdb").select(new Query(UserAccount_default).where("account", account.toLowerCase()).where("type", "in", t).limit(1)))[0]?.userId || "";
171
+ return (await useDatabase().select(new Query(UserAccount_default).where("account", account.toLowerCase()).where("type", "in", t).limit(1)))[0]?.userId || "";
172
172
  }
173
173
  /**
174
174
  * 使用 HMAC-SHA256 对一个或多个值进行哈希,使用 salt 作为密钥。
@@ -206,7 +206,7 @@ async function hash(salt, value, ...values) {
206
206
  * @param {string} userId
207
207
  */
208
208
  async function getPasswordHash(password, userId) {
209
- return await hash((await useTenant()).salt, password, userId);
209
+ return await hash(await useSalt(), password, userId);
210
210
  }
211
211
  /**
212
212
  *
@@ -215,7 +215,7 @@ async function getPasswordHash(password, userId) {
215
215
  * @returns {Promise<-2 | -1 | 1 | 2>}
216
216
  */
217
217
  async function verifyPassword(userId, password) {
218
- const item = await connect("rdb").first(new Query(UserPassword_default).select("password", "deadline").where({ userId }));
218
+ const item = await useDatabase().first(new Query(UserPassword_default).select("password", "deadline").where({ userId }));
219
219
  if (!item) return -2;
220
220
  if (item.password !== await getPasswordHash(password, userId)) return -1;
221
221
  if (!item.deadline) return 1;
@@ -232,7 +232,7 @@ async function verifyPassword(userId, password) {
232
232
  async function setPassword(userId, password, deadline) {
233
233
  if (!password) return false;
234
234
  const value = await getPasswordHash(password, userId);
235
- const connection = connect("rdb");
235
+ const connection = useDatabase();
236
236
  if (await connection.first(new Query(UserPassword_default).select("password").where({ userId }))) await connection.update(UserPassword_default, {
237
237
  password: value,
238
238
  deadline: deadline instanceof Date && deadline.valueOf() ? deadline : null
@@ -247,4 +247,4 @@ async function setPassword(userId, password, deadline) {
247
247
 
248
248
  //#endregion
249
249
  export { verifyPassword as a, UserAccount_default as c, setPassword as i, verifyNewPassword as l, getPasswordHash as n, UserPassword_default as o, loadUserInfo as r, User_default as s, findUser as t };
250
- //# sourceMappingURL=user-D_GmNerB.mjs.map
250
+ //# sourceMappingURL=user-ejRy16ds.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-ejRy16ds.mjs","names":["UserAccount","User","UserAccount","UserPassword"],"sources":["../../plugins/user/common/verifyNewPassword.mjs","../../plugins/user/models/UserAccount.mjs","../../plugins/user/models/User.mjs","../../plugins/user/models/UserPassword.mjs","../../plugins/user/index.mjs"],"sourcesContent":["const signTypeRegex = [\n\t/[a-z]/,\n\t/[A-Z]/,\n\t/[0-9]/,\n\t/[~!@#$%^&*()_+{}|<>?,./:\";'\\\\\\[\\]-]/,\n]\n/**\n * \n * @param {string} password \n */\nexport function* verifyNewPassword(password) {\n\tif (password.length < 8) { yield '密码不足 8 位'; }\n\t\n\tif (signTypeRegex.filter(r => r.test(password)).length < 3) {\n\t\tyield `密码至少包含小写字母、大写字母、数字、符号中的 3 种`;\n\t}\n\tif (password.toLowerCase().includes('admin')) {\n\t\tyield `密码不能包含admin`;\n\t}\n\tif ([...password].find((a,index, list) => list[index - 1] === a && list[index + 1] === a)) {\n\t\tyield `密码不能包含三位以上的相同的字母或数字`;\n\t}\n\tif ([...password].find((a,index, list) => {\n\t\tconst p = list[index - 1];\n\t\tconst n = list[index + 1];\n\t\tif (!p || !n) { return false; }\n\t\tconst x = p.charCodeAt(0);\n\t\tconst y = a.charCodeAt(0);\n\t\tconst z = n.charCodeAt(0);\n\t\tconst u = x - y;\n\t\tconst v = y - z;\n\t\tif (u === v && (v === 1 || v === -1)) { return true}\n\t})) {\n\t\tyield `密码不能包含三位以上的连续的字母或数字`;\n\t}\n}\n","import { createModel, createField, now } from '@yongdall/model';\n\n\nexport default createModel('user.account', {\n\taccount: createField('string', { nullable: false, label: '帐号', unique: true }),\n\tuserId: createField('uuid', { nullable: false, label: '用户', primary: 1 }),\n\ttype: createField('string', { nullable: false, default: '', primary: 2, label: '类型' }),\n});\n","import { createField, createModel, now, uuid } from '@yongdall/model';\nimport UserAccount from './UserAccount.mjs';\n\nexport default createModel('user', {\n\tusername: createField(UserAccount, { label: '登陆账号', constraints: {userId: {field: 'id'}, type: {value: 'username'}}}),\n\tid: createField('uuid', { nullable: false, default: uuid, uncreatable: true, primary: 1 }),\n\tname: createField('string', { nullable: false, default: '', label: '名称', layout: { colSpan: 6, head: 2 } }),\n\tenabled: createField('bool', { nullable: false, default: true, label: '是否启用帐号' }),\n\tcreatedAt: createField('timestamp', { nullable: false, creating: now, label: '创建日期' }),\n\tupdatedAt: createField('timestamp', { nullable: false, creating: now, updating: now, label: '最后更新日期' }),\n}, {\n\tlabel: '用户',\n\tlabelField: 'name',\n\n\tpermissions: [\n\t\t{ permission: 'system:user', fields: '*', authorizations: ['options', 'query', 'read', 'create', 'update', 'destroy', 'add', 'remove'] },\n\t],\n\tscripts: ['@yongdall/user#models.user'],\n});\n","import { createField, createModel, now } from '@yongdall/model';\n\n\nexport default createModel('user.password', {\n\tuserId: createField('uuid', { nullable: false, label: '用户', primary: 1 }),\n\tpassword: createField('string', { nullable: false, default: '', label: '新密码', renderer: 'password', layout: {colSpan: 6} }),\n\tdeadline: createField('timestamp', { nullable: true, label: '有效期', layout: {colSpan: 6} }),\n\tupdatedAt: createField('timestamp', { nullable: false, creating: now, updating: now, label: '最后更新日期', layout: {colSpan: 6} }),\n})\n","import { useConnection, useDatabase } from '@yongdall/connection';\nimport { Query, Where } from '@yongdall/model';\nimport { useSalt } from '@yongdall/core';\nimport { User, UserAccount, UserPassword } from './models/index.mjs';\n\nexport * from './models/index.mjs';\nexport { verifyNewPassword } from './common/verifyNewPassword.mjs';\n\nconst USER_INFO_KEY = 'user:info';\n\n/**\n * \n * @param {string} userId \n */\nexport async function loadUserInfo(userId) {\n\n\treturn useConnection('cache').memoize(USER_INFO_KEY, userId, async () => {\n\t\tconst rdb = useDatabase();\n\t\tconst info = await rdb.select(new Query(User).where({ id: userId }).limit(1));\n\t\treturn info[0];\n\t});\n}\n\nconst allTypes = ['username', 'phone', 'email'];\n\n/**\n * \n * @param {string} account \n * @param {string | string[] | Set<string> | null} [types] \n */\nexport async function findUser(account, types) {\n\tconst typeSet = typeof types === 'string' ? new Set(types) : new Set(types);\n\tconst t = typeSet.size ? allTypes.filter(v => typeSet.has(v)) : allTypes;\n\tif (!t.length) { return ''; }\n\tconst rdb = useDatabase();\n\tconst info = await rdb.select(\n\t\tnew Query(UserAccount)\n\t\t\t.where('account', account.toLowerCase())\n\t\t\t.where('type', 'in', t)\n\t\t\t.limit(1),\n\t);\n\treturn info[0]?.userId || '';\n}\n/**\n * 使用 HMAC-SHA256 对一个或多个值进行哈希,使用 salt 作为密钥。\n * 输出为 base64url 格式。\n *\n * @param {string | ArrayBuffer | ArrayBufferView<ArrayBuffer>} salt\n * @param {string | number} value\n * @param {...(string | number)} values\n * @returns {Promise<string>}\n */\nasync function hash(salt, value, ...values) {\n\t// 1. 准备密钥(salt)\n\t/** @type {ArrayBuffer | ArrayBufferView<ArrayBuffer>} */\n\tlet keyBuffer;\n\tif (salt instanceof ArrayBuffer || ArrayBuffer.isView(salt)) {\n\t\tkeyBuffer = salt;\n\t} else if (typeof salt === 'string') {\n\t\tkeyBuffer = new TextEncoder().encode(salt);\n\t} else {\n\t\tthrow new Error('`salt` 参数必须为字符串或 Uint8Array');\n\t}\n\n\t// 2. 导入 HMAC 密钥\n\tconst cryptoKey = await crypto.subtle.importKey(\n\t\t'raw',\n\t\tkeyBuffer,\n\t\t{ name: 'HMAC', hash: 'SHA-256' },\n\t\tfalse,\n\t\t['sign']\n\t);\n\n\t// 3. 构造输入数据\n\t/** @type {string[]} */\n\tlet data = [];\n\n\t// 处理第一个 value\n\tif (typeof value === 'number') {\n\t\tdata.push(String(value));\n\t} else if (typeof value === 'string') {\n\t\t// JSON.stringify(value).slice(1, -1) 相当于去掉引号,等价于直接编码字符串内容\n\t\tdata.push(JSON.stringify(value).slice(1, -1));\n\t} else {\n\t\tthrow new Error('`value` 参数必须为字符串或数字');\n\t}\n\n\t// 处理后续 values\n\tfor (const v of values) {\n\t\tif (typeof v === 'number') {\n\t\t\tdata.push(String(v));\n\t\t} else if (typeof v === 'string') {\n\t\t\tdata.push(JSON.stringify(v).slice(1, -1));\n\t\t}\n\t}\n\n\t// 合并所有数据\n\tconst messageBuffer = new TextEncoder().encode(data.join('\\n'));\n\n\t// 4. 生成 HMAC\n\tconst signature = await crypto.subtle.sign('HMAC', cryptoKey, messageBuffer);\n\n\t// 5. 转为 base64url 格式\n\tconst base64 = btoa(String.fromCharCode(...new Uint8Array(signature)));\n\treturn base64\n\t\t.replace(/\\+/g, '-')\n\t\t.replace(/\\//g, '_')\n\t\t.replace(/=+$/, ''); // 移除填充\n}\n/**\n * \n * @param {string} password \n * @param {string} userId \n */\nexport async function getPasswordHash(password, userId) {\n\tconst salt = await useSalt();\n\treturn await hash(salt, password, userId);\n\n}\n/**\n * \n * @param {string} userId \n * @param {string} password \n * @returns {Promise<-2 | -1 | 1 | 2>}\n */\nexport async function verifyPassword(userId, password) {\n\tconst item = await useDatabase().first(\n\t\tnew Query(UserPassword)\n\t\t\t.select('password', 'deadline')\n\t\t\t.where({ userId })\n\t);\n\tif (!item) { return -2; }\n\tif (item.password !== await getPasswordHash(password, userId)) { return -1; }\n\tif (!item.deadline) { return 1; }\n\tif (Number(item.deadline) < Date.now()) { return 2; }\n\treturn 1;\n}\n/**\n * \n * @param {string} userId \n * @param {string?} password \n * @param {Date?} [deadline] \n * @returns {Promise<boolean>}\n */\n\nexport async function setPassword(userId, password, deadline) {\n\tif (!password) { return false; }\n\tconst value = await getPasswordHash(password, userId);\n\n\n\tconst connection = useDatabase();\n\tconst item = await connection.first(\n\t\tnew Query(UserPassword)\n\t\t\t.select('password')\n\t\t\t.where({ userId })\n\t);\n\tif (item) {\n\t\tawait connection.update(UserPassword, {\n\t\t\tpassword: value,\n\t\t\tdeadline: deadline instanceof Date && deadline.valueOf() ? deadline : null,\n\t\t}, Where.and('userId', userId));\n\t} else {\n\t\tawait connection.create(UserPassword, {\n\t\t\tuserId,\n\t\t\tpassword: value,\n\t\t\tdeadline: deadline instanceof Date && deadline.valueOf() ? deadline : null,\n\t\t});\n\n\t}\n\treturn true;\n}\n"],"mappings":";;;;;AAAA,MAAM,gBAAgB;CACrB;CACA;CACA;CACA;CACA;;;;;AAKD,UAAiB,kBAAkB,UAAU;AAC5C,KAAI,SAAS,SAAS,EAAK,OAAM;AAEjC,KAAI,cAAc,QAAO,MAAK,EAAE,KAAK,SAAS,CAAC,CAAC,SAAS,EACxD,OAAM;AAEP,KAAI,SAAS,aAAa,CAAC,SAAS,QAAQ,CAC3C,OAAM;AAEP,KAAI,CAAC,GAAG,SAAS,CAAC,MAAM,GAAE,OAAO,SAAS,KAAK,QAAQ,OAAO,KAAK,KAA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,OAAO;;;;;;;;AAS1C,eAAsB,eAAe,QAAQ,UAAU;CACtD,MAAM,OAAO,MAAM,aAAa,CAAC,MAChC,IAAI,MAAMC,qBAAa,CACrB,OAAO,YAAY,WAAW,CAC9B,MAAM,EAAE,QAAQ,CAAC,CACnB;AACD,KAAI,CAAC,KAAQ,QAAO;AACpB,KAAI,KAAK,aAAa,MAAM,gBAAgB,UAAU,OAAO,CAAI,QAAO;AACxE,KAAI,CAAC,KAAK,SAAY,QAAO;AAC7B,KAAI,OAAO,KAAK,SAAS,GAAG,KAAK,KAAK,CAAI,QAAO;AACjD,QAAO;;;;;;;;;AAUR,eAAsB,YAAY,QAAQ,UAAU,UAAU;AAC7D,KAAI,CAAC,SAAY,QAAO;CACxB,MAAM,QAAQ,MAAM,gBAAgB,UAAU,OAAO;CAGrD,MAAM,aAAa,aAAa;AAMhC,KALa,MAAM,WAAW,MAC7B,IAAI,MAAMA,qBAAa,CACrB,OAAO,WAAW,CAClB,MAAM,EAAE,QAAQ,CAAC,CACnB,CAEA,OAAM,WAAW,OAAOA,sBAAc;EACrC,UAAU;EACV,UAAU,oBAAoB,QAAQ,SAAS,SAAS,GAAG,WAAW;EACtE,EAAE,MAAM,IAAI,UAAU,OAAO,CAAC;KAE/B,OAAM,WAAW,OAAOA,sBAAc;EACrC;EACA,UAAU;EACV,UAAU,oBAAoB,QAAQ,SAAS,SAAS,GAAG,WAAW;EACtE,CAAC;AAGH,QAAO"}
@@ -1,4 +1,4 @@
1
- import { c as UserAccount_default, o as UserPassword_default, s as User_default } from "../user-D_GmNerB.mjs";
1
+ import { c as UserAccount_default, o as UserPassword_default, s as User_default } from "../user-ejRy16ds.mjs";
2
2
 
3
3
  //#region plugins/user/yongdall/migration.mjs
4
4
  /** @import { Profile } from '@yongdall/migrate' */
@@ -1,4 +1,4 @@
1
- import { s as User_default } from "../user-D_GmNerB.mjs";
1
+ import { s as User_default } from "../user-ejRy16ds.mjs";
2
2
 
3
3
  //#region plugins/user/yongdall/model.mjs
4
4
  /** @import { ModelProfile } from '@yongdall/core' */
package/yongdall/user.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as verifyPassword, i as setPassword, r as loadUserInfo, t as findUser } from "../user-D_GmNerB.mjs";
1
+ import { a as verifyPassword, i as setPassword, r as loadUserInfo, t as findUser } from "../user-ejRy16ds.mjs";
2
2
 
3
3
  //#region plugins/user/yongdall/user.mjs
4
4
  /** @import { UserManager } from '@yongdall/core' */
@@ -1 +0,0 @@
1
- {"version":3,"file":"user-D_GmNerB.mjs","names":["UserAccount","User","UserAccount","UserPassword"],"sources":["../../plugins/user/common/verifyNewPassword.mjs","../../plugins/user/models/UserAccount.mjs","../../plugins/user/models/User.mjs","../../plugins/user/models/UserPassword.mjs","../../plugins/user/index.mjs"],"sourcesContent":["const signTypeRegex = [\n\t/[a-z]/,\n\t/[A-Z]/,\n\t/[0-9]/,\n\t/[~!@#$%^&*()_+{}|<>?,./:\";'\\\\\\[\\]-]/,\n]\n/**\n * \n * @param {string} password \n */\nexport function* verifyNewPassword(password) {\n\tif (password.length < 8) { yield '密码不足 8 位'; }\n\t\n\tif (signTypeRegex.filter(r => r.test(password)).length < 3) {\n\t\tyield `密码至少包含小写字母、大写字母、数字、符号中的 3 种`;\n\t}\n\tif (password.toLowerCase().includes('admin')) {\n\t\tyield `密码不能包含admin`;\n\t}\n\tif ([...password].find((a,index, list) => list[index - 1] === a && list[index + 1] === a)) {\n\t\tyield `密码不能包含三位以上的相同的字母或数字`;\n\t}\n\tif ([...password].find((a,index, list) => {\n\t\tconst p = list[index - 1];\n\t\tconst n = list[index + 1];\n\t\tif (!p || !n) { return false; }\n\t\tconst x = p.charCodeAt(0);\n\t\tconst y = a.charCodeAt(0);\n\t\tconst z = n.charCodeAt(0);\n\t\tconst u = x - y;\n\t\tconst v = y - z;\n\t\tif (u === v && (v === 1 || v === -1)) { return true}\n\t})) {\n\t\tyield `密码不能包含三位以上的连续的字母或数字`;\n\t}\n}\n","import { createModel, createField, now } from '@yongdall/model';\n\n\nexport default createModel('user.account', {\n\taccount: createField('string', { nullable: false, label: '帐号', unique: true }),\n\tuserId: createField('uuid', { nullable: false, label: '用户', primary: 1 }),\n\ttype: createField('string', { nullable: false, default: '', primary: 2, label: '类型' }),\n});\n","import { createField, createModel, now, uuid } from '@yongdall/model';\nimport UserAccount from './UserAccount.mjs';\n\nexport default createModel('user', {\n\tusername: createField(UserAccount, { label: '登陆账号', constraints: {userId: {field: 'id'}, type: {value: 'username'}}}),\n\tid: createField('uuid', { nullable: false, default: uuid, uncreatable: true, primary: 1 }),\n\tname: createField('string', { nullable: false, default: '', label: '名称', layout: { colSpan: 6, head: 2 } }),\n\tenabled: createField('bool', { nullable: false, default: true, label: '是否启用帐号' }),\n\tcreatedAt: createField('timestamp', { nullable: false, creating: now, label: '创建日期' }),\n\tupdatedAt: createField('timestamp', { nullable: false, creating: now, updating: now, label: '最后更新日期' }),\n}, {\n\tlabel: '用户',\n\tlabelField: 'name',\n\n\tpermissions: [\n\t\t{ permission: 'system:user', fields: '*', authorizations: ['options', 'query', 'read', 'create', 'update', 'destroy', 'add', 'remove'] },\n\t],\n\tscripts: ['@yongdall/user#models.user'],\n});\n","import { createField, createModel, now } from '@yongdall/model';\n\n\nexport default createModel('user.password', {\n\tuserId: createField('uuid', { nullable: false, label: '用户', primary: 1 }),\n\tpassword: createField('string', { nullable: false, default: '', label: '新密码', renderer: 'password', layout: {colSpan: 6} }),\n\tdeadline: createField('timestamp', { nullable: true, label: '有效期', layout: {colSpan: 6} }),\n\tupdatedAt: createField('timestamp', { nullable: false, creating: now, updating: now, label: '最后更新日期', layout: {colSpan: 6} }),\n})\n","import { connect } from '@yongdall/connection';\nimport { Query, Where } from '@yongdall/model';\nimport { useTenant } from '@yongdall/core';\nimport { User, UserAccount, UserPassword } from './models/index.mjs';\n\nexport * from './models/index.mjs';\nexport { verifyNewPassword } from './common/verifyNewPassword.mjs'\n\nconst USER_INFO_KEY = 'user:info';\n\n/**\n * \n * @param {string} userId \n */\nexport async function loadUserInfo(userId) {\n\n\treturn connect('cache').memoize(USER_INFO_KEY, userId, async () => {\n\t\tconst rdb = connect('rdb');\n\t\tconst info = await rdb.select(new Query(User).where({ id: userId }).limit(1));\n\t\treturn info[0];\n\t});\n}\n\nconst allTypes = ['username', 'phone', 'email'];\n\n/**\n * \n * @param {string} account \n * @param {string | string[] | Set<string> | null} [types] \n */\nexport async function findUser(account, types){\n\tconst typeSet = typeof types === 'string' ? new Set(types) : new Set(types);\n\tconst t = typeSet.size ? allTypes.filter(v => typeSet.has(v)) : allTypes;\n\tif (!t.length) { return ''; }\n\tconst rdb = connect('rdb');\n\tconst info = await rdb.select(\n\t\tnew Query(UserAccount)\n\t\t\t.where('account', account.toLowerCase())\n\t\t\t.where('type', 'in', t)\n\t\t\t.limit(1),\n\t);\n\treturn info[0]?.userId || '';\n}\n/**\n * 使用 HMAC-SHA256 对一个或多个值进行哈希,使用 salt 作为密钥。\n * 输出为 base64url 格式。\n *\n * @param {string | ArrayBuffer | ArrayBufferView<ArrayBuffer>} salt\n * @param {string | number} value\n * @param {...(string | number)} values\n * @returns {Promise<string>}\n */\nasync function hash(salt, value, ...values) {\n\t// 1. 准备密钥(salt)\n\t/** @type {ArrayBuffer | ArrayBufferView<ArrayBuffer>} */\n\tlet keyBuffer;\n\tif (salt instanceof ArrayBuffer || ArrayBuffer.isView(salt)) {\n\t\tkeyBuffer = salt;\n\t} else if (typeof salt === 'string') {\n\t\tkeyBuffer = new TextEncoder().encode(salt);\n\t} else {\n\t\tthrow new Error('`salt` 参数必须为字符串或 Uint8Array');\n\t}\n\n\t// 2. 导入 HMAC 密钥\n\tconst cryptoKey = await crypto.subtle.importKey(\n\t\t'raw',\n\t\tkeyBuffer,\n\t\t{ name: 'HMAC', hash: 'SHA-256' },\n\t\tfalse,\n\t\t['sign']\n\t);\n\n\t// 3. 构造输入数据\n\t/** @type {string[]} */\n\tlet data = [];\n\n\t// 处理第一个 value\n\tif (typeof value === 'number') {\n\t\tdata.push(String(value));\n\t} else if (typeof value === 'string') {\n\t\t// JSON.stringify(value).slice(1, -1) 相当于去掉引号,等价于直接编码字符串内容\n\t\tdata.push(JSON.stringify(value).slice(1, -1));\n\t} else {\n\t\tthrow new Error('`value` 参数必须为字符串或数字');\n\t}\n\n\t// 处理后续 values\n\tfor (const v of values) {\n\t\tif (typeof v === 'number') {\n\t\t\tdata.push(String(v));\n\t\t} else if (typeof v === 'string') {\n\t\t\tdata.push(JSON.stringify(v).slice(1, -1));\n\t\t}\n\t}\n\n\t// 合并所有数据\n\tconst messageBuffer = new TextEncoder().encode(data.join('\\n'))\n\n\t// 4. 生成 HMAC\n\tconst signature = await crypto.subtle.sign('HMAC', cryptoKey, messageBuffer);\n\n\t// 5. 转为 base64url 格式\n\tconst base64 = btoa(String.fromCharCode(...new Uint8Array(signature)));\n\treturn base64\n\t\t.replace(/\\+/g, '-')\n\t\t.replace(/\\//g, '_')\n\t\t.replace(/=+$/, ''); // 移除填充\n}\n/**\n * \n * @param {string} password \n * @param {string} userId \n */\nexport async function getPasswordHash(password, userId) {\n\tconst tenant = await useTenant();\n\treturn await hash(tenant.salt, password, userId)\n\n}\n/**\n * \n * @param {string} userId \n * @param {string} password \n * @returns {Promise<-2 | -1 | 1 | 2>}\n */\nexport async function verifyPassword(userId, password) {\n\tconst item = await connect('rdb').first(\n\t\tnew Query(UserPassword)\n\t\t.select('password', 'deadline')\n\t\t.where({ userId })\n\t);\n\tif (!item) { return -2; }\n\tif (item.password !== await getPasswordHash(password, userId)) { return -1; }\n\tif (!item.deadline) { return 1; }\n\tif (Number(item.deadline) < Date.now()) { return 2; }\n\treturn 1;\n}\n/**\n * \n * @param {string} userId \n * @param {string?} password \n * @param {Date?} [deadline] \n * @returns {Promise<boolean>}\n */\n\nexport async function setPassword(userId, password, deadline) {\n\tif (!password) { return false; }\n\tconst value = await getPasswordHash(password, userId);\n\t\n\n\tconst connection = connect('rdb');\n\tconst item = await connection.first(\n\t\tnew Query(UserPassword)\n\t\t.select('password')\n\t\t.where({ userId })\n\t);\n\tif (item) {\n\t\tawait connection.update(UserPassword, {\n\t\t\tpassword: value,\n\t\t\tdeadline: deadline instanceof Date && deadline.valueOf() ? deadline : null,\n\t\t}, Where.and('userId', userId));\n\t} else {\n\t\tawait connection.create(UserPassword, {\n\t\t\tuserId,\n\t\t\tpassword: value,\n\t\t\tdeadline: deadline instanceof Date && deadline.valueOf() ? deadline : null,\n\t\t});\n\n\t}\n\treturn true;\n\t\n}\n"],"mappings":";;;;;AAAA,MAAM,gBAAgB;CACrB;CACA;CACA;CACA;CACA;;;;;AAKD,UAAiB,kBAAkB,UAAU;AAC5C,KAAI,SAAS,SAAS,EAAK,OAAM;AAEjC,KAAI,cAAc,QAAO,MAAK,EAAE,KAAK,SAAS,CAAC,CAAC,SAAS,EACxD,OAAM;AAEP,KAAI,SAAS,aAAa,CAAC,SAAS,QAAQ,CAC3C,OAAM;AAEP,KAAI,CAAC,GAAG,SAAS,CAAC,MAAM,GAAE,OAAO,SAAS,KAAK,QAAQ,OAAO,KAAK,KAAK,QAAQ,OAAO,EAAE,CACxF,OAAM;AAEP,KAAI,CAAC,GAAG,SAAS,CAAC,MAAM,GAAE,OAAO,SAAS;EACzC,MAAM,IAAI,KAAK,QAAQ;EACvB,MAAM,IAAI,KAAK,QAAQ;AACvB,MAAI,CAAC,KAAK,CAAC,EAAK,QAAO;EACvB,MAAM,IAAI,EAAE,WAAW,EAAE;EACzB,MAAM,IAAI,EAAE,WAAW,EAAE;EACzB,MAAM,IAAI,EAAE,WAAW,EAAE;EACzB,MAAM,IAAI,IAAI;EACd,MAAM,IAAI,IAAI;AACd,MAAI,MAAM,MAAM,MAAM,KAAK,MAAM,IAAO,QAAO;GAC9C,CACD,OAAM;;;;;AC9BR,0BAAe,YAAY,gBAAgB;CAC1C,SAAS,YAAY,UAAU;EAAE,UAAU;EAAO,OAAO;EAAM,QAAQ;EAAM,CAAC;CAC9E,QAAQ,YAAY,QAAQ;EAAE,UAAU;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