befly-shared 1.2.8 → 1.3.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.
Files changed (98) hide show
  1. package/package.json +13 -30
  2. package/utils/arrayToTree.ts +135 -0
  3. package/utils/buildTreeByParentPath.ts +127 -0
  4. package/utils/scanViewsDir.ts +148 -0
  5. package/README.md +0 -439
  6. package/dist/addonHelper.js +0 -83
  7. package/dist/arrayKeysToCamel.js +0 -18
  8. package/dist/arrayToTree.js +0 -23
  9. package/dist/calcPerfTime.js +0 -13
  10. package/dist/configTypes.js +0 -1
  11. package/dist/constants.js +0 -46
  12. package/dist/deepTransformKeys.js +0 -139
  13. package/dist/fieldClear.js +0 -57
  14. package/dist/genShortId.js +0 -12
  15. package/dist/hashPassword.js +0 -22
  16. package/dist/index.js +0 -26
  17. package/dist/keysToCamel.js +0 -21
  18. package/dist/keysToSnake.js +0 -21
  19. package/dist/layouts.js +0 -59
  20. package/dist/pickFields.js +0 -16
  21. package/dist/redisKeys.js +0 -34
  22. package/dist/regex.js +0 -202
  23. package/dist/scanConfig.js +0 -83
  24. package/dist/scanFiles.js +0 -39
  25. package/dist/scanViews.js +0 -48
  26. package/dist/withDefaultColumns.js +0 -32
  27. package/src/addonHelper.ts +0 -88
  28. package/src/arrayKeysToCamel.ts +0 -18
  29. package/src/arrayToTree.ts +0 -31
  30. package/src/calcPerfTime.ts +0 -13
  31. package/src/configTypes.ts +0 -29
  32. package/src/constants.ts +0 -60
  33. package/src/deepTransformKeys.ts +0 -172
  34. package/src/fieldClear.ts +0 -75
  35. package/src/genShortId.ts +0 -12
  36. package/src/hashPassword.ts +0 -27
  37. package/src/index.ts +0 -29
  38. package/src/keysToCamel.ts +0 -22
  39. package/src/keysToSnake.ts +0 -22
  40. package/src/layouts.ts +0 -90
  41. package/src/pickFields.ts +0 -19
  42. package/src/redisKeys.ts +0 -44
  43. package/src/regex.ts +0 -225
  44. package/src/scanConfig.ts +0 -106
  45. package/src/scanFiles.ts +0 -49
  46. package/src/scanViews.ts +0 -55
  47. package/src/withDefaultColumns.ts +0 -36
  48. package/tests/addonHelper.test.ts +0 -55
  49. package/tests/arrayKeysToCamel.test.ts +0 -21
  50. package/tests/arrayToTree.test.ts +0 -98
  51. package/tests/calcPerfTime.test.ts +0 -19
  52. package/tests/deepTransformKeys.test.ts +0 -466
  53. package/tests/fieldClear.test.ts +0 -39
  54. package/tests/keysToCamel.test.ts +0 -22
  55. package/tests/keysToSnake.test.ts +0 -22
  56. package/tests/layouts.test.ts +0 -93
  57. package/tests/pickFields.test.ts +0 -22
  58. package/tests/regex.test.ts +0 -308
  59. package/tests/scanFiles.test.ts +0 -58
  60. package/tests/types.test.ts +0 -289
  61. package/types/addon.d.ts +0 -50
  62. package/types/addonConfigMerge.d.ts +0 -17
  63. package/types/addonHelper.d.ts +0 -24
  64. package/types/api.d.ts +0 -63
  65. package/types/arrayKeysToCamel.d.ts +0 -13
  66. package/types/arrayToTree.d.ts +0 -8
  67. package/types/calcPerfTime.d.ts +0 -4
  68. package/types/common.d.ts +0 -8
  69. package/types/configMerge.d.ts +0 -49
  70. package/types/configTypes.d.ts +0 -28
  71. package/types/constants.d.ts +0 -48
  72. package/types/context.d.ts +0 -38
  73. package/types/crypto.d.ts +0 -23
  74. package/types/database.d.ts +0 -55
  75. package/types/deepTransformKeys.d.ts +0 -84
  76. package/types/fieldClear.d.ts +0 -16
  77. package/types/genShortId.d.ts +0 -10
  78. package/types/hashPassword.d.ts +0 -11
  79. package/types/index.d.ts +0 -23
  80. package/types/jwt.d.ts +0 -99
  81. package/types/keysToCamel.d.ts +0 -10
  82. package/types/keysToSnake.d.ts +0 -10
  83. package/types/layouts.d.ts +0 -29
  84. package/types/loadAndMergeConfig.d.ts +0 -7
  85. package/types/logger.d.ts +0 -22
  86. package/types/menu.d.ts +0 -49
  87. package/types/mergeConfig.d.ts +0 -7
  88. package/types/pickFields.d.ts +0 -4
  89. package/types/redisKeys.d.ts +0 -34
  90. package/types/regex.d.ts +0 -145
  91. package/types/scanConfig.d.ts +0 -7
  92. package/types/scanFiles.d.ts +0 -12
  93. package/types/scanViews.d.ts +0 -11
  94. package/types/table.d.ts +0 -49
  95. package/types/tool.d.ts +0 -67
  96. package/types/types.d.ts +0 -44
  97. package/types/validate.d.ts +0 -69
  98. package/types/withDefaultColumns.d.ts +0 -7
package/types/addon.d.ts DELETED
@@ -1,50 +0,0 @@
1
- /**
2
- * Addon 配置类型定义
3
- */
4
-
5
- /**
6
- * Addon 作者信息
7
- */
8
- export interface AddonAuthor {
9
- /** 作者名称 */
10
- name: string;
11
- /** 作者邮箱 */
12
- email?: string;
13
- /** 作者网站 */
14
- url?: string;
15
- }
16
-
17
- /**
18
- * Addon 配置
19
- */
20
- export interface AddonConfig {
21
- /** Addon 唯一标识(小写、短横线或下划线),例如 "admin"、"demo" */
22
- name: string;
23
-
24
- /** Addon 人类可读名称,例如 "管理后台" */
25
- title: string;
26
-
27
- /** 版本号(语义化版本),例如 "1.0.0" */
28
- version?: string;
29
-
30
- /** 简短描述 */
31
- description?: string;
32
-
33
- /** 作者信息 */
34
- author?: AddonAuthor | string;
35
-
36
- /** 源码仓库链接 */
37
- repo?: string;
38
-
39
- /** 关键词(用于搜索和分类) */
40
- keywords?: string[];
41
-
42
- /** 主入口文件路径(相对于 addon 目录),例如 "index.ts" */
43
- entry?: string;
44
-
45
- /** 依赖的其他 addon 或核心包 */
46
- dependencies?: Record<string, string>;
47
-
48
- /** 许可证 */
49
- license?: string;
50
- }
@@ -1,17 +0,0 @@
1
- import type { MergeConfigOptions } from './configTypes.js';
2
- /**
3
- * Addon 配置合并函数
4
- * 自动根据调用位置的 package.json 获取 addon 名称,然后加载项目 config 目录下的同名配置文件进行合并
5
- * @param options - 合并选项
6
- * @returns 合并后的配置对象
7
- * @example
8
- * ```ts
9
- * // 在 @befly-addon/admin 包中调用
10
- * const config = await addonConfigMerge();
11
- * // 自动读取:
12
- * // 1. @befly-addon/admin/package.json 的 befly 字段
13
- * // 2. 项目根目录/config/admin.{js,ts,json} 配置文件
14
- * // 3. 合并后返回
15
- * ```
16
- */
17
- export declare function addonConfigMerge(options?: MergeConfigOptions): Promise<Record<string, any>>;
@@ -1,24 +0,0 @@
1
- /**
2
- * 扫描所有可用的 addon
3
- * 优先从本地 addons/ 目录加载,其次从 node_modules/@befly-addon/ 加载
4
- * @param cwd - 项目根目录,默认为 process.cwd()
5
- * @returns addon 名称数组
6
- */
7
- export declare const scanAddons: (cwd?: string) => string[];
8
- /**
9
- * 获取 addon 的指定子目录路径
10
- * 优先返回本地 addons 目录,其次返回 node_modules 目录
11
- * @param name - addon 名称
12
- * @param subDir - 子目录名称
13
- * @param cwd - 项目根目录,默认为 process.cwd()
14
- * @returns 完整路径
15
- */
16
- export declare const getAddonDir: (name: string, subDir: string, cwd?: string) => string;
17
- /**
18
- * 检查 addon 子目录是否存在
19
- * @param name - addon 名称
20
- * @param subDir - 子目录名称
21
- * @param cwd - 项目根目录,默认为 process.cwd()
22
- * @returns 是否存在
23
- */
24
- export declare const addonDirExists: (name: string, subDir: string, cwd?: string) => boolean;
package/types/api.d.ts DELETED
@@ -1,63 +0,0 @@
1
- /**
2
- * API 相关类型定义
3
- */
4
-
5
- import type { TableDefinition } from './validate';
6
-
7
- /**
8
- * HTTP 方法类型
9
- */
10
- export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
11
-
12
- /**
13
- * API 响应结果类型
14
- */
15
- export interface ResponseResult<T = any> {
16
- /** 状态码:0 表示成功,非 0 表示失败 */
17
- code: number;
18
- /** 响应消息 */
19
- msg: string;
20
- /** 响应数据 */
21
- data?: T;
22
- /** 错误信息(仅在失败时) */
23
- error?: any;
24
- }
25
-
26
- /**
27
- * 分页响应结果类型
28
- */
29
- export interface PaginatedResult<T = any> {
30
- /** 状态码 */
31
- code: number;
32
- /** 响应消息 */
33
- msg: string;
34
- /** 数据列表 */
35
- data: T[];
36
- /** 总记录数 */
37
- total: number;
38
- /** 当前页码 */
39
- page: number;
40
- /** 每页数量 */
41
- limit: number;
42
- /** 总页数 */
43
- pages: number;
44
- }
45
-
46
- /**
47
- * API 路由基础配置
48
- * 用于跨包共享的最小路由定义
49
- */
50
- export interface BaseApiRoute {
51
- /** 接口名称(必填) */
52
- name: string;
53
- /** HTTP 方法(可选,默认 POST) */
54
- method?: HttpMethod;
55
- /** 认证类型(可选,默认 true) */
56
- auth?: boolean;
57
- /** 字段定义(验证规则) */
58
- fields?: TableDefinition;
59
- /** 必填字段 */
60
- required?: string[];
61
- /** 路由路径(运行时生成) */
62
- route?: string;
63
- }
@@ -1,13 +0,0 @@
1
- /**
2
- * 数组对象字段名批量转小驼峰
3
- * @param arr - 源数组
4
- * @returns 字段名转为小驼峰格式的新数组
5
- *
6
- * @example
7
- * arrayKeysToCamel([
8
- * { user_id: 1, user_name: 'John' },
9
- * { user_id: 2, user_name: 'Jane' }
10
- * ])
11
- * // [{ userId: 1, userName: 'John' }, { userId: 2, userName: 'Jane' }]
12
- */
13
- export declare const arrayKeysToCamel: <T = any>(arr: Record<string, any>[]) => T[];
@@ -1,8 +0,0 @@
1
- export interface ArrayToTreeOptions<T = any> {
2
- idField?: string;
3
- pidField?: string;
4
- childrenField?: string;
5
- rootPid?: any;
6
- mapFn?: (node: T) => T;
7
- }
8
- export declare function arrayToTree<T = any>(items: T[], options?: ArrayToTreeOptions<T>): T[];
@@ -1,4 +0,0 @@
1
- /**
2
- * 计算性能时间差
3
- */
4
- export declare const calcPerfTime: (startTime: number, endTime?: number) => string;
package/types/common.d.ts DELETED
@@ -1,8 +0,0 @@
1
- /**
2
- * 通用类型定义
3
- */
4
-
5
- /**
6
- * 通用键值对类型
7
- */
8
- export type KeyValue<T = any> = Record<string, T>;
@@ -1,49 +0,0 @@
1
- /**
2
- * 配置来源信息
3
- */
4
- export interface ConfigSource {
5
- /** 配置文件路径 */
6
- filePath: string;
7
- /** 配置数据 */
8
- data: Record<string, any>;
9
- }
10
- /**
11
- * 合并配置选项
12
- */
13
- export interface MergeConfigOptions {
14
- /** 合并策略:deep 深度合并(默认),shallow 浅合并,override 覆盖 */
15
- strategy?: 'deep' | 'shallow' | 'override';
16
- /** 是否克隆数据(避免引用污染),默认 true */
17
- clone?: boolean;
18
- }
19
- /**
20
- * 加载配置选项
21
- */
22
- export interface LoadConfigOptions {
23
- /** 目录数组:要搜索的目录路径 */
24
- dirs: string[];
25
- /** 文件数组:要匹配的文件名 */
26
- files: string[];
27
- /** 合并选项 */
28
- merge?: MergeConfigOptions;
29
- /** 是否必须找到至少一个配置文件,默认 false */
30
- required?: boolean;
31
- /** 文件扩展名,默认 ['.js', '.ts', '.json'] */
32
- extensions?: string[];
33
- }
34
- /**
35
- * 合并多个配置对象
36
- * @param configs - 配置对象数组
37
- * @param options - 合并选项
38
- * @returns 合并后的配置对象
39
- */
40
- export declare function mergeConfig(configs: Record<string, any>[], options?: MergeConfigOptions): Record<string, any>;
41
- /**
42
- * 加载并合并配置文件(矩阵搜索:dirs × files)
43
- * @param options - 加载选项
44
- * @returns 合并后的配置对象和来源信息
45
- */
46
- export declare function loadAndMergeConfig(options: LoadConfigOptions): Promise<{
47
- config: Record<string, any>;
48
- sources: ConfigSource[];
49
- }>;
@@ -1,28 +0,0 @@
1
- /**
2
- * 加载配置选项
3
- */
4
- export interface LoadConfigOptions {
5
- /** 当前工作目录,默认 process.cwd() */
6
- cwd?: string;
7
- /** 目录数组:要搜索的目录路径(相对于 cwd) */
8
- dirs: string[];
9
- /** 文件数组:要匹配的文件名 */
10
- files: string[];
11
- /** 文件扩展名,默认 ['.js', '.ts', '.json'] */
12
- extensions?: string[];
13
- /** 加载模式:'first' = 返回第一个找到的配置(默认),'merge' = 合并所有配置 */
14
- mode?: 'merge' | 'first';
15
- /** 指定要提取的字段路径数组,如 ['menus', 'database.host'],为空则返回完整对象 */
16
- paths?: string[];
17
- /** 默认配置,会与找到的配置合并(优先级最低) */
18
- defaults?: Record<string, any>;
19
- }
20
- /**
21
- * Addon 配置合并选项(已废弃,仅用于向后兼容)
22
- */
23
- export interface MergeConfigOptions {
24
- /** 合并策略(已废弃,始终使用 deep) */
25
- strategy?: 'deep' | 'shallow' | 'override';
26
- /** 是否克隆数据(已废弃) */
27
- clone?: boolean;
28
- }
@@ -1,48 +0,0 @@
1
- /**
2
- * Befly 共享常量定义
3
- * 运行时使用的常量(非纯类型)
4
- */
5
- /**
6
- * API 响应码
7
- */
8
- export declare const ApiCode: {
9
- /** 成功 */
10
- readonly SUCCESS: 0;
11
- /** 通用失败 */
12
- readonly FAIL: 1;
13
- /** 未授权 */
14
- readonly UNAUTHORIZED: 401;
15
- /** 禁止访问 */
16
- readonly FORBIDDEN: 403;
17
- /** 未找到 */
18
- readonly NOT_FOUND: 404;
19
- /** 服务器错误 */
20
- readonly SERVER_ERROR: 500;
21
- };
22
- /**
23
- * API 响应码类型
24
- */
25
- export type ApiCodeType = (typeof ApiCode)[keyof typeof ApiCode];
26
- /**
27
- * 通用错误消息
28
- */
29
- export declare const ErrorMessages: {
30
- /** 未授权 */
31
- readonly UNAUTHORIZED: "请先登录";
32
- /** 禁止访问 */
33
- readonly FORBIDDEN: "无访问权限";
34
- /** 未找到 */
35
- readonly NOT_FOUND: "资源不存在";
36
- /** 服务器错误 */
37
- readonly SERVER_ERROR: "服务器错误";
38
- /** 参数错误 */
39
- readonly INVALID_PARAMS: "参数错误";
40
- /** Token 过期 */
41
- readonly TOKEN_EXPIRED: "Token 已过期";
42
- /** Token 无效 */
43
- readonly TOKEN_INVALID: "Token 无效";
44
- };
45
- /**
46
- * 错误消息类型
47
- */
48
- export type ErrorMessageType = (typeof ErrorMessages)[keyof typeof ErrorMessages];
@@ -1,38 +0,0 @@
1
- /**
2
- * 请求上下文相关类型定义
3
- */
4
-
5
- /**
6
- * 用户信息类型
7
- */
8
- export interface UserInfo {
9
- /** 用户 ID */
10
- id: number;
11
- /** 用户名 */
12
- username?: string;
13
- /** 邮箱 */
14
- email?: string;
15
- /** 角色代码 */
16
- roleCode?: string;
17
- /** 其他自定义字段 */
18
- [key: string]: any;
19
- }
20
-
21
- /**
22
- * 请求上下文基础接口
23
- * 用于跨包共享的最小上下文定义
24
- */
25
- export interface BaseRequestContext {
26
- /** 请求体参数 */
27
- body: Record<string, any>;
28
- /** 用户信息 */
29
- user: Record<string, any>;
30
- /** 请求开始时间(毫秒) */
31
- now: number;
32
- /** 客户端 IP 地址 */
33
- ip: string;
34
- /** API 路由路径(如 POST/api/user/login) */
35
- route: string;
36
- /** 请求唯一 ID */
37
- requestId: string;
38
- }
package/types/crypto.d.ts DELETED
@@ -1,23 +0,0 @@
1
- /**
2
- * 加密相关类型定义
3
- */
4
-
5
- /**
6
- * 编码类型
7
- */
8
- export type EncodingType = 'hex' | 'base64' | 'base64url';
9
-
10
- /**
11
- * 哈希算法类型
12
- */
13
- export type HashAlgorithm = 'md5' | 'sha1' | 'sha256' | 'sha512' | 'sha384' | 'sha224';
14
-
15
- /**
16
- * 密码哈希选项
17
- */
18
- export interface PasswordHashOptions {
19
- algorithm?: 'argon2' | 'bcrypt';
20
- memoryCost?: number;
21
- timeCost?: number;
22
- [key: string]: any;
23
- }
@@ -1,55 +0,0 @@
1
- /**
2
- * 数据库相关类型定义
3
- */
4
-
5
- /**
6
- * SQL 值类型
7
- */
8
- export type SqlValue = string | number | boolean | null | Date;
9
-
10
- /**
11
- * SQL 参数数组类型
12
- */
13
- export type SqlParams = SqlValue[];
14
-
15
- /**
16
- * 排序方向
17
- */
18
- export type OrderDirection = 'ASC' | 'DESC' | 'asc' | 'desc';
19
-
20
- /**
21
- * 数据库类型
22
- */
23
- export type DatabaseType = 'mysql' | 'postgresql' | 'sqlite';
24
-
25
- /**
26
- * 数据库配置类型
27
- */
28
- export interface DatabaseConfig {
29
- /** 数据库类型 */
30
- type: DatabaseType;
31
- /** 主机地址 */
32
- host: string;
33
- /** 端口号 */
34
- port: number;
35
- /** 用户名 */
36
- user: string;
37
- /** 密码 */
38
- password: string;
39
- /** 数据库名 */
40
- database: string;
41
- }
42
-
43
- /**
44
- * Redis 配置类型
45
- */
46
- export interface RedisConfig {
47
- /** 主机地址 */
48
- host: string;
49
- /** 端口号 */
50
- port: number;
51
- /** 密码 */
52
- password?: string;
53
- /** 数据库索引 */
54
- db?: number;
55
- }
@@ -1,84 +0,0 @@
1
- /**
2
- * 键名转换函数类型
3
- */
4
- export type KeyTransformer = (key: string) => string;
5
- /**
6
- * 预设的转换方式
7
- * - camel: 小驼峰 user_id → userId
8
- * - snake: 下划线 userId → user_id
9
- * - kebab: 短横线 userId → user-id
10
- * - pascal: 大驼峰 user_id → UserId
11
- * - upper: 大写 userId → USERID
12
- * - lower: 小写 UserId → userid
13
- */
14
- export type PresetTransform = 'camel' | 'snake' | 'kebab' | 'pascal' | 'upper' | 'lower';
15
- /**
16
- * 转换选项
17
- */
18
- export interface TransformOptions {
19
- /** 最大递归深度,默认 100。设置为 0 表示不限制深度(不推荐) */
20
- maxDepth?: number;
21
- /** 排除的键名列表,这些键名不会被转换 */
22
- excludeKeys?: string[];
23
- }
24
- /**
25
- * 深度递归遍历数据结构,转换所有键名
26
- * 支持嵌套对象和数组,自动防止循环引用和栈溢出
27
- *
28
- * @param data - 源数据(对象、数组或其他类型)
29
- * @param transformer - 转换函数或预设方式
30
- * @param options - 转换选项
31
- * @returns 键名转换后的新数据
32
- *
33
- * @example
34
- * // 小驼峰
35
- * deepTransformKeys({ user_id: 123, user_info: { first_name: 'John' } }, 'camel')
36
- * // { userId: 123, userInfo: { firstName: 'John' } }
37
- *
38
- * @example
39
- * // 下划线
40
- * deepTransformKeys({ userId: 123, userInfo: { firstName: 'John' } }, 'snake')
41
- * // { user_id: 123, user_info: { first_name: 'John' } }
42
- *
43
- * @example
44
- * // 短横线
45
- * deepTransformKeys({ userId: 123, userInfo: { firstName: 'John' } }, 'kebab')
46
- * // { 'user-id': 123, 'user-info': { 'first-name': 'John' } }
47
- *
48
- * @example
49
- * // 大驼峰
50
- * deepTransformKeys({ user_id: 123 }, 'pascal')
51
- * // { UserId: 123 }
52
- *
53
- * @example
54
- * // 大写
55
- * deepTransformKeys({ userId: 123 }, 'upper')
56
- * // { USERID: 123 }
57
- *
58
- * @example
59
- * // 小写
60
- * deepTransformKeys({ UserId: 123 }, 'lower')
61
- * // { userid: 123 }
62
- *
63
- * @example
64
- * // 自定义转换函数
65
- * deepTransformKeys({ user_id: 123 }, (key) => `prefix_${key}`)
66
- * // { prefix_user_id: 123 }
67
- *
68
- * @example
69
- * // 限制递归深度
70
- * deepTransformKeys(deepData, 'camel', { maxDepth: 10 })
71
- *
72
- * @example
73
- * // 排除特定键名
74
- * deepTransformKeys({ _id: '123', user_name: 'John' }, 'camel', { excludeKeys: ['_id'] })
75
- * // { _id: '123', userName: 'John' }
76
- *
77
- * @example
78
- * // 嵌套数组和对象
79
- * deepTransformKeys({
80
- * user_list: [{ user_id: 1, user_tags: [{ tag_name: 'vip' }] }]
81
- * }, 'camel')
82
- * // { userList: [{ userId: 1, userTags: [{ tagName: 'vip' }] }] }
83
- */
84
- export declare const deepTransformKeys: <T = any>(data: any, transformer: KeyTransformer | PresetTransform, options?: TransformOptions) => T;
@@ -1,16 +0,0 @@
1
- export interface FieldClearOptions {
2
- pickKeys?: string[];
3
- omitKeys?: string[];
4
- keepValues?: any[];
5
- excludeValues?: any[];
6
- keepMap?: Record<string, any>;
7
- }
8
- export type FieldClearResult<T> =
9
- T extends Array<infer U>
10
- ? Array<FieldClearResult<U>>
11
- : T extends object
12
- ? {
13
- [K in keyof T]?: T[K];
14
- }
15
- : T;
16
- export declare function fieldClear<T = any>(data: T | T[], options?: FieldClearOptions): FieldClearResult<T>;
@@ -1,10 +0,0 @@
1
- /**
2
- * 生成短 ID
3
- * 由时间戳(base36)+ 随机字符组成,约 13 位
4
- * - 前 8 位:时间戳(可排序)
5
- * - 后 5 位:随机字符(防冲突)
6
- * @returns 短 ID 字符串
7
- * @example
8
- * genShortId() // "lxyz1a2b3c4"
9
- */
10
- export declare function genShortId(): string;
@@ -1,11 +0,0 @@
1
- /**
2
- * 密码哈希工具
3
- * 使用 SHA-256 + 盐值对密码进行单向哈希
4
- */
5
- /**
6
- * 使用 SHA-256 对密码进行哈希
7
- * @param password - 原始密码
8
- * @param salt - 盐值,默认为 befly
9
- * @returns 哈希后的密码(十六进制字符串)
10
- */
11
- export declare function hashPassword(password: string, salt?: string): Promise<string>;
package/types/index.d.ts DELETED
@@ -1,23 +0,0 @@
1
- /**
2
- * Befly Shared 统一导出
3
- * 跨包共享的工具函数、常量、类型定义
4
- */
5
- export * from './constants.js';
6
- export * from './redisKeys.js';
7
- export * from './regex.js';
8
- export * from './addonHelper.js';
9
- export * from './arrayKeysToCamel.js';
10
- export * from './arrayToTree.js';
11
- export * from './calcPerfTime.js';
12
- export * from './configTypes.js';
13
- export * from './deepTransformKeys.js';
14
- export * from './genShortId.js';
15
- export * from './scanConfig.js';
16
- export * from './fieldClear.js';
17
- export * from './keysToCamel.js';
18
- export * from './keysToSnake.js';
19
- export * from './layouts.js';
20
- export * from './pickFields.js';
21
- export * from './scanFiles.js';
22
- export * from './scanViews.js';
23
- export * from './withDefaultColumns.js';