@edgenets/utils 0.3.12 → 0.4.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 (138) hide show
  1. package/README.md +53 -104
  2. package/dist/constants/env.d.ts +3 -0
  3. package/dist/constants/env.d.ts.map +1 -0
  4. package/dist/constants/env.js +2 -0
  5. package/dist/constants/env.js.map +1 -0
  6. package/dist/constants/index.d.ts +2 -0
  7. package/dist/constants/index.d.ts.map +1 -0
  8. package/dist/constants/index.js +2 -0
  9. package/dist/constants/index.js.map +1 -0
  10. package/dist/date/diff.d.ts +2 -0
  11. package/dist/date/diff.d.ts.map +1 -0
  12. package/dist/date/diff.js +4 -0
  13. package/dist/date/diff.js.map +1 -0
  14. package/dist/date/format.d.ts +2 -0
  15. package/dist/date/format.d.ts.map +1 -0
  16. package/dist/date/format.js +12 -0
  17. package/dist/date/format.js.map +1 -0
  18. package/dist/date/index.d.ts +3 -0
  19. package/dist/date/index.d.ts.map +1 -0
  20. package/dist/date/index.js +3 -0
  21. package/dist/date/index.js.map +1 -0
  22. package/dist/env/index.d.ts +2 -0
  23. package/dist/env/index.d.ts.map +1 -0
  24. package/dist/env/index.js +8 -0
  25. package/dist/env/index.js.map +1 -0
  26. package/dist/errors/app-error.d.ts +12 -0
  27. package/dist/errors/app-error.d.ts.map +1 -0
  28. package/dist/errors/app-error.js +19 -0
  29. package/dist/errors/app-error.js.map +1 -0
  30. package/dist/errors/{code.d.ts → codes.d.ts} +1 -1
  31. package/dist/errors/codes.d.ts.map +1 -0
  32. package/dist/errors/{code.js → codes.js} +1 -1
  33. package/dist/errors/codes.js.map +1 -0
  34. package/dist/errors/index.d.ts +3 -13
  35. package/dist/errors/index.d.ts.map +1 -1
  36. package/dist/errors/index.js +3 -80
  37. package/dist/errors/index.js.map +1 -1
  38. package/dist/errors/messages.d.ts +3 -0
  39. package/dist/errors/messages.d.ts.map +1 -0
  40. package/dist/errors/messages.js +21 -0
  41. package/dist/errors/messages.js.map +1 -0
  42. package/dist/id/index.d.ts +2 -0
  43. package/dist/id/index.d.ts.map +1 -0
  44. package/dist/id/index.js +2 -0
  45. package/dist/id/index.js.map +1 -0
  46. package/dist/{utils/nanoid.util.d.ts → id/nano-id.util.d.ts} +2 -2
  47. package/dist/id/nano-id.util.d.ts.map +1 -0
  48. package/dist/id/nano-id.util.js +34 -0
  49. package/dist/id/nano-id.util.js.map +1 -0
  50. package/dist/index.d.ts +7 -13
  51. package/dist/index.d.ts.map +1 -1
  52. package/dist/index.js +7 -13
  53. package/dist/index.js.map +1 -1
  54. package/dist/logger/console-logger.d.ts +12 -0
  55. package/dist/logger/console-logger.d.ts.map +1 -0
  56. package/dist/logger/console-logger.js +40 -0
  57. package/dist/logger/console-logger.js.map +1 -0
  58. package/dist/logger/factory.d.ts +5 -0
  59. package/dist/logger/factory.d.ts.map +1 -0
  60. package/dist/logger/factory.js +12 -0
  61. package/dist/logger/factory.js.map +1 -0
  62. package/dist/logger/index.d.ts +4 -0
  63. package/dist/logger/index.d.ts.map +1 -0
  64. package/dist/logger/index.js +4 -0
  65. package/dist/logger/index.js.map +1 -0
  66. package/dist/{models/logger.d.ts → logger/types.d.ts} +2 -1
  67. package/dist/logger/types.d.ts.map +1 -0
  68. package/dist/logger/types.js +2 -0
  69. package/dist/logger/types.js.map +1 -0
  70. package/dist/types/index.d.ts +7 -0
  71. package/dist/types/index.d.ts.map +1 -0
  72. package/dist/types/index.js +2 -0
  73. package/dist/types/index.js.map +1 -0
  74. package/dist/validation/index.d.ts +11 -0
  75. package/dist/validation/index.d.ts.map +1 -0
  76. package/dist/validation/index.js +2 -0
  77. package/dist/validation/index.js.map +1 -0
  78. package/package.json +23 -5
  79. package/dist/config/product.config.d.ts +0 -7
  80. package/dist/config/product.config.d.ts.map +0 -1
  81. package/dist/config/product.config.js +0 -65
  82. package/dist/config/product.config.js.map +0 -1
  83. package/dist/errors/code.d.ts.map +0 -1
  84. package/dist/errors/code.js.map +0 -1
  85. package/dist/logger/default.d.ts +0 -13
  86. package/dist/logger/default.d.ts.map +0 -1
  87. package/dist/logger/default.js +0 -24
  88. package/dist/logger/default.js.map +0 -1
  89. package/dist/models/broadcast.d.ts +0 -28
  90. package/dist/models/broadcast.d.ts.map +0 -1
  91. package/dist/models/broadcast.js +0 -9
  92. package/dist/models/broadcast.js.map +0 -1
  93. package/dist/models/logger.d.ts.map +0 -1
  94. package/dist/models/logger.js +0 -2
  95. package/dist/models/logger.js.map +0 -1
  96. package/dist/models/order.d.ts +0 -113
  97. package/dist/models/order.d.ts.map +0 -1
  98. package/dist/models/order.js +0 -45
  99. package/dist/models/order.js.map +0 -1
  100. package/dist/models/point.d.ts +0 -21
  101. package/dist/models/point.d.ts.map +0 -1
  102. package/dist/models/point.js +0 -2
  103. package/dist/models/point.js.map +0 -1
  104. package/dist/models/product.d.ts +0 -8
  105. package/dist/models/product.d.ts.map +0 -1
  106. package/dist/models/product.js +0 -2
  107. package/dist/models/product.js.map +0 -1
  108. package/dist/models/transaction.d.ts +0 -27
  109. package/dist/models/transaction.d.ts.map +0 -1
  110. package/dist/models/transaction.js +0 -13
  111. package/dist/models/transaction.js.map +0 -1
  112. package/dist/models/user.d.ts +0 -96
  113. package/dist/models/user.d.ts.map +0 -1
  114. package/dist/models/user.js +0 -2
  115. package/dist/models/user.js.map +0 -1
  116. package/dist/queue/index.d.ts +0 -2
  117. package/dist/queue/index.d.ts.map +0 -1
  118. package/dist/queue/index.js +0 -12
  119. package/dist/queue/index.js.map +0 -1
  120. package/dist/queue/queue.d.ts +0 -25
  121. package/dist/queue/queue.d.ts.map +0 -1
  122. package/dist/queue/queue.js +0 -64
  123. package/dist/queue/queue.js.map +0 -1
  124. package/dist/utils/nanoid.util.d.ts.map +0 -1
  125. package/dist/utils/nanoid.util.js +0 -36
  126. package/dist/utils/nanoid.util.js.map +0 -1
  127. package/dist/utils/signature.util.d.ts +0 -12
  128. package/dist/utils/signature.util.d.ts.map +0 -1
  129. package/dist/utils/signature.util.js +0 -51
  130. package/dist/utils/signature.util.js.map +0 -1
  131. package/dist/utils/statemachine.util.d.ts +0 -7
  132. package/dist/utils/statemachine.util.d.ts.map +0 -1
  133. package/dist/utils/statemachine.util.js +0 -21
  134. package/dist/utils/statemachine.util.js.map +0 -1
  135. package/dist/utils/string.util.d.ts +0 -6
  136. package/dist/utils/string.util.d.ts.map +0 -1
  137. package/dist/utils/string.util.js +0 -13
  138. package/dist/utils/string.util.js.map +0 -1
package/README.md CHANGED
@@ -1,125 +1,74 @@
1
1
  # @edgenets/utils
2
2
 
3
- Edgenets utilities package containing common types and utilities.
3
+ A shared TypeScript utility library for the Edgenets ecosystem.
4
+ Provides logging, type helpers, environment config, validation, and other reusable tools.
4
5
 
5
- ## Features
6
+ > Designed for Firebase Cloud Functions and pnpm monorepo projects.
6
7
 
7
- - Logger
8
- - Queue
9
- - Config
10
- - Services
11
- - Repositories
12
- - Utilities
13
- - Models
14
-
15
- ## Installation
8
+ ## Table of contents
16
9
 
17
10
  ```bash
18
- npm install @edgenets/utils
11
+ edgenets-utils/
12
+ ├── src/
13
+ │ ├── assert/ → 运行时断言,辅助强制类型收窄
14
+ │ ├── env/ → 环境变量获取、校验、缓存
15
+ │ ├── logger/ → 日志封装,默认 pino,支持 mockLogger
16
+ │ ├── date/ → 时间封装(基于 Intl + dayjs adapter)
17
+ │ │ ├── format.ts # 格式化相关函数
18
+ │ │ ├── diff.ts # 时间差计算
19
+ │ │ └── index.ts # 模块导出
20
+ │ ├── errors/ → 异常封装
21
+ │ │ ├── codes.ts # 错误枚举 ErrorCode
22
+ │ │ ├── messages.ts # 可选:错误码 → 默认提示
23
+ │ │ ├── app-error.ts # 错误基类 AppError
24
+ │ │ └── index.ts # 统一导出
25
+ │ ├── validation/ → 基于 zod,但可插拔(保持 adapter 模式)
26
+ │ ├── constants/ → 项目常量、枚举(跨模块复用)
27
+ │ ├── types/ → 基础类型工具(如 DeepPartial、Awaitable)
28
+ │ ├── string/ → 字符串工具,如 slug、uuid 等
29
+ │ ├── array/ → 数组处理,如 groupBy、uniqueBy
30
+ │ ├── object/ → 对象深拷贝、merge 等
31
+ │ └── index.ts → 仅 re-export,核心 API 明确暴露
32
+ ├── .gitignore
33
+ ├── package.json # name: @edgenets/utils
34
+ ├── tsconfig.json
35
+ └── README.md
19
36
  ```
20
37
 
21
38
  ## Usage
22
39
 
23
- ### Importing Modules
40
+ ### Error handling
24
41
 
25
42
  ```typescript
26
- import { ConsoleLogger, Queue, defaultConfig, ExampleService, ExampleRepository, Utils, User, Order } from '@edgenets/utils';
27
-
28
- // Logger
29
- const logger = ConsoleLogger.getInstance();
30
- logger.info('Library initialized');
31
-
32
- // Queue
33
- const queue = new Queue(defaultConfig.maxConcurrent, defaultConfig.requestRate);
34
- queue.addTask(async () => {
35
- // Your task here
36
- });
37
-
38
- // Service
39
- const service = new ExampleService();
40
- service.execute();
41
-
42
- // Repository
43
- const repository = new ExampleRepository();
44
- repository.save({ id: '1', name: 'Example' });
45
-
46
- // Utilities
47
- console.log(Utils.formatDate(new Date(), 'yyyy-MM-dd'));
48
-
49
- // Models
50
- const newUser: User = {
51
- id: '1',
52
- name: 'John Doe',
53
- email: 'john.doe@example.com',
54
- password: 'securepassword',
55
- createdAt: new Date(),
56
- updatedAt: new Date(),
57
- };
58
-
59
- const newOrder: Order = {
60
- id: '1',
61
- userId: '1',
62
- productIds: ['100001', '100002'],
63
- totalAmount: 450,
64
- status: 'pending',
65
- createdAt: new Date(),
66
- updatedAt: new Date(),
67
- };
43
+ import { AppError, ErrorCode } from '@edgenets/utils'
44
+
45
+ function checkToken(token?: string) {
46
+ if (!token) {
47
+ throw new AppError(ErrorCode.AUTH_VAL_TOKEN_INVALID)
48
+ }
49
+ }
68
50
  ```
69
51
 
70
- ### Project Structure
52
+ ### Logging handling
71
53
 
72
- ```
73
- enterprise-node-lib
74
- ├── src
75
- │ ├── index.ts
76
- │ ├── config
77
- │ │ ├── default.ts
78
- │ │ ├── product.config.ts
79
- │ │ └── index.ts
80
- │ ├── interfaces
81
- │ │ ├── service.ts
82
- │ │ ├── repository.ts
83
- │ │ └── index.ts
84
- │ ├── logger
85
- │ │ ├── default.ts
86
- │ │ └── index.ts
87
- │ ├── models
88
- │ │ ├── user.ts
89
- │ │ ├── order.ts
90
- │ │ └── index.ts
91
- │ ├── queue
92
- │ │ ├── queue.ts
93
- │ │ └── index.ts
94
- │ ├── services
95
- │ │ ├── exampleService.ts
96
- │ │ └── index.ts
97
- │ ├── repositories
98
- │ │ ├── exampleRepository.ts
99
- │ │ └── index.ts
100
- │ ├── utils
101
- │ │ └── index.ts
102
- ├── tests
103
- │ ├── logger.test.ts
104
- │ ├── queue.test.ts
105
- │ ├── config.test.ts
106
- │ ├── service.test.ts
107
- │ ├── repository.test.ts
108
- │ ├── user.test.ts
109
- │ └── order.test.ts
110
- ├── package.json
111
- ├── tsconfig.json
112
- └── README.md
113
- ```
54
+ ```typescript
55
+ import { getLogger, setGlobalLogger, createConsoleLogger } from '@edgenets/utils'
114
56
 
115
- ### Running Tests
57
+ // 设置全局等级
58
+ setGlobalLogger(createConsoleLogger('debug'))
116
59
 
117
- To run the tests, use the following command:
60
+ const logger = getLogger()
118
61
 
119
- ```bash
120
- npm test
62
+ logger.info('App started')
63
+ logger.debug('Debug message')
121
64
  ```
122
65
 
123
- ### License
66
+ ### ID generation
67
+
68
+ ```typescript
69
+ import { NanoIdUtil } from '@edgenets/utils'
124
70
 
125
- This project is licensed under the MIT License.
71
+ const id = NanoIdUtil.generateDefault(12) // ab8X0kTzG7Q9
72
+ const custom = NanoIdUtil.generateCustom(6, 'xyz') // xyyzyz
73
+ const numericId = NanoIdUtil.generateNumberId() // 1073132153242091
74
+ ```
@@ -0,0 +1,3 @@
1
+ export declare const ENVIRONMENTS: readonly ["development", "staging", "production"];
2
+ export type Env = (typeof ENVIRONMENTS)[number];
3
+ //# sourceMappingURL=env.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/constants/env.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,mDAAoD,CAAC;AAC9E,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export const ENVIRONMENTS = ["development", "staging", "production"];
2
+ //# sourceMappingURL=env.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/constants/env.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,aAAa,EAAE,SAAS,EAAE,YAAY,CAAU,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./env.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./env.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function diffInSeconds(from: Date, to: Date): number;
2
+ //# sourceMappingURL=diff.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../src/date/diff.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,GAAG,MAAM,CAE1D"}
@@ -0,0 +1,4 @@
1
+ export function diffInSeconds(from, to) {
2
+ return Math.floor((to.getTime() - from.getTime()) / 1000);
3
+ }
4
+ //# sourceMappingURL=diff.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff.js","sourceRoot":"","sources":["../../src/date/diff.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,aAAa,CAAC,IAAU,EAAE,EAAQ;IAChD,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;AAC5D,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function formatDate(date: Date | string, locale?: string): string;
2
+ //# sourceMappingURL=format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/date/format.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,EAAE,MAAM,SAAU,GAAG,MAAM,CAUxE"}
@@ -0,0 +1,12 @@
1
+ export function formatDate(date, locale = "en-US") {
2
+ const d = typeof date === "string" ? new Date(date) : date;
3
+ return new Intl.DateTimeFormat(locale, {
4
+ year: "numeric",
5
+ month: "2-digit",
6
+ day: "2-digit",
7
+ hour: "2-digit",
8
+ minute: "2-digit",
9
+ hour12: false,
10
+ }).format(d);
11
+ }
12
+ //# sourceMappingURL=format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/date/format.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,UAAU,CAAC,IAAmB,EAAE,MAAM,GAAG,OAAO;IAC9D,MAAM,CAAC,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC3D,OAAO,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE;QACrC,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,SAAS;QAChB,GAAG,EAAE,SAAS;QACd,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,SAAS;QACjB,MAAM,EAAE,KAAK;KACd,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACf,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./format.js";
2
+ export * from "./diff.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/date/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./format.js";
2
+ export * from "./diff.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/date/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function getEnv(name: string, fallback?: string): string;
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/env/index.ts"],"names":[],"mappings":"AAAA,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAM9D"}
@@ -0,0 +1,8 @@
1
+ export function getEnv(name, fallback) {
2
+ const val = process.env[name];
3
+ if (!val && fallback === undefined) {
4
+ throw new Error(`Missing required environment variable: ${name}`);
5
+ }
6
+ return val ?? fallback;
7
+ }
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/env/index.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,MAAM,CAAC,IAAY,EAAE,QAAiB;IACpD,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC9B,IAAI,CAAC,GAAG,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,0CAA0C,IAAI,EAAE,CAAC,CAAC;IACpE,CAAC;IACD,OAAO,GAAG,IAAI,QAAS,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { ErrorCode } from "./codes.js";
2
+ export declare class AppError extends Error {
3
+ readonly code: ErrorCode;
4
+ readonly cause?: unknown | undefined;
5
+ constructor(code: ErrorCode, message?: string, cause?: unknown | undefined);
6
+ toJSON(): {
7
+ error: string;
8
+ code: ErrorCode;
9
+ message: string;
10
+ };
11
+ }
12
+ //# sourceMappingURL=app-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-error.d.ts","sourceRoot":"","sources":["../../src/errors/app-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,qBAAa,QAAS,SAAQ,KAAK;aAEf,IAAI,EAAE,SAAS;aAEf,KAAK,CAAC,EAAE,OAAO;gBAFf,IAAI,EAAE,SAAS,EAC/B,OAAO,CAAC,EAAE,MAAM,EACA,KAAK,CAAC,EAAE,OAAO,YAAA;IAMjC,MAAM;;;;;CAOP"}
@@ -0,0 +1,19 @@
1
+ import { ErrorMessages } from "./messages.js";
2
+ export class AppError extends Error {
3
+ code;
4
+ cause;
5
+ constructor(code, message, cause) {
6
+ super(message || ErrorMessages[code]);
7
+ this.code = code;
8
+ this.cause = cause;
9
+ this.name = "AppError";
10
+ }
11
+ toJSON() {
12
+ return {
13
+ error: this.name,
14
+ code: this.code,
15
+ message: this.message,
16
+ };
17
+ }
18
+ }
19
+ //# sourceMappingURL=app-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-error.js","sourceRoot":"","sources":["../../src/errors/app-error.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,MAAM,OAAO,QAAS,SAAQ,KAAK;IAEf;IAEA;IAHlB,YACkB,IAAe,EAC/B,OAAgB,EACA,KAAe;QAE/B,KAAK,CAAC,OAAO,IAAI,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;QAJtB,SAAI,GAAJ,IAAI,CAAW;QAEf,UAAK,GAAL,KAAK,CAAU;QAG/B,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;IACzB,CAAC;IAED,MAAM;QACJ,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,IAAI;YAChB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC;IACJ,CAAC;CACF"}
@@ -17,4 +17,4 @@ export declare enum ErrorCode {
17
17
  API_CONN_FAILED = "API-SYS-001",
18
18
  API_RATE_LIMIT_EXCEEDED = "API-SYS-002"
19
19
  }
20
- //# sourceMappingURL=code.d.ts.map
20
+ //# sourceMappingURL=codes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codes.d.ts","sourceRoot":"","sources":["../../src/errors/codes.ts"],"names":[],"mappings":"AAAA,oBAAY,SAAS;IAEnB,sBAAsB,gBAAgB;IACtC,qBAAqB,gBAAgB;IACrC,kBAAkB,iBAAiB;IACnC,kBAAkB,iBAAiB;IAGnC,0BAA0B,iBAAiB;IAC3C,sBAAsB,iBAAiB;IACvC,sBAAsB,iBAAiB;IACvC,sBAAsB,kBAAkB;IAGxC,cAAc,eAAe;IAC7B,eAAe,eAAe;IAC9B,gBAAgB,gBAAgB;IAGhC,WAAW,gBAAgB;IAC3B,kBAAkB,gBAAgB;IAClC,WAAW,gBAAgB;IAG3B,wBAAwB,gBAAgB;IACxC,eAAe,gBAAgB;IAC/B,uBAAuB,gBAAgB;CACxC"}
@@ -18,4 +18,4 @@ export var ErrorCode;
18
18
  ErrorCode["API_CONN_FAILED"] = "API-SYS-001";
19
19
  ErrorCode["API_RATE_LIMIT_EXCEEDED"] = "API-SYS-002";
20
20
  })(ErrorCode || (ErrorCode = {}));
21
- //# sourceMappingURL=code.js.map
21
+ //# sourceMappingURL=codes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codes.js","sourceRoot":"","sources":["../../src/errors/codes.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,SA2BX;AA3BD,WAAY,SAAS;IAEnB,mDAAsC,CAAA;IACtC,kDAAqC,CAAA;IACrC,gDAAmC,CAAA;IACnC,gDAAmC,CAAA;IAGnC,wDAA2C,CAAA;IAC3C,oDAAuC,CAAA;IACvC,oDAAuC,CAAA;IACvC,qDAAwC,CAAA;IAGxC,0CAA6B,CAAA;IAC7B,2CAA8B,CAAA;IAC9B,6CAAgC,CAAA;IAGhC,wCAA2B,CAAA;IAC3B,+CAAkC,CAAA;IAClC,wCAA2B,CAAA;IAG3B,qDAAwC,CAAA;IACxC,4CAA+B,CAAA;IAC/B,oDAAuC,CAAA;AACzC,CAAC,EA3BW,SAAS,KAAT,SAAS,QA2BpB"}
@@ -1,14 +1,4 @@
1
- import { ErrorCode } from "./code.js";
2
- export { ErrorCode };
3
- export declare const ErrorDetails: {
4
- [key in ErrorCode]: {
5
- message: string;
6
- httpStatus: number;
7
- };
8
- };
9
- export declare function handleError(errorCode: ErrorCode): {
10
- code: string;
11
- message: string;
12
- httpStatus: number;
13
- };
1
+ export * from "./codes.js";
2
+ export * from "./messages.js";
3
+ export * from "./app-error.js";
14
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,SAAS,EAAE,CAAC;AAErB,eAAO,MAAM,YAAY,EAAE;KACxB,GAAG,IAAI,SAAS,GAAG;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE;CA+E5D,CAAC;AAEF,wBAAgB,WAAW,CAAC,SAAS,EAAE,SAAS,GAAG;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB,CAOA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC"}
@@ -1,81 +1,4 @@
1
- import { ErrorCode } from "./code.js";
2
- export { ErrorCode };
3
- export const ErrorDetails = {
4
- [ErrorCode.USR_VAL_MISSING_FIELDS]: {
5
- message: "Required fields are missing.",
6
- httpStatus: 400,
7
- },
8
- [ErrorCode.USR_VAL_INVALID_INPUT]: {
9
- message: "Invalid input provided.",
10
- httpStatus: 400,
11
- },
12
- [ErrorCode.USR_DATA_NOT_FOUND]: {
13
- message: "User data not found.",
14
- httpStatus: 404,
15
- },
16
- [ErrorCode.USR_DATA_DUPLICATE]: {
17
- message: "Duplicate user data found.",
18
- httpStatus: 409,
19
- },
20
- [ErrorCode.AUTH_VAL_SIGNATURE_INVALID]: {
21
- message: "Signature is invalid.",
22
- httpStatus: 401,
23
- },
24
- [ErrorCode.AUTH_VAL_TOKEN_EXPIRED]: {
25
- message: "Authentication token has expired.",
26
- httpStatus: 401,
27
- },
28
- [ErrorCode.AUTH_VAL_TOKEN_INVALID]: {
29
- message: "Invalid authentication token.",
30
- httpStatus: 401,
31
- },
32
- [ErrorCode.AUTH_AUTH_UNAUTHORIZED]: {
33
- message: "User is unauthorized.",
34
- httpStatus: 403,
35
- },
36
- [ErrorCode.DB_CONN_FAILED]: {
37
- message: "Database connection failed.",
38
- httpStatus: 500,
39
- },
40
- [ErrorCode.DB_QUERY_FAILED]: {
41
- message: "Database query failed.",
42
- httpStatus: 500,
43
- },
44
- [ErrorCode.DB_DATA_CONFLICT]: {
45
- message: "Data conflict in database.",
46
- httpStatus: 409,
47
- },
48
- [ErrorCode.SYS_UNKNOWN]: {
49
- message: "Unknown system error.",
50
- httpStatus: 500,
51
- },
52
- [ErrorCode.SYS_INTERNAL_ERROR]: {
53
- message: "Internal server error.",
54
- httpStatus: 500,
55
- },
56
- [ErrorCode.SYS_TIMEOUT]: {
57
- message: "System request timed out.",
58
- httpStatus: 504,
59
- },
60
- [ErrorCode.API_VAL_RESPONSE_INVALID]: {
61
- message: "Invalid response from external API.",
62
- httpStatus: 502,
63
- },
64
- [ErrorCode.API_CONN_FAILED]: {
65
- message: "Failed to connect to external API.",
66
- httpStatus: 502,
67
- },
68
- [ErrorCode.API_RATE_LIMIT_EXCEEDED]: {
69
- message: "External API rate limit exceeded.",
70
- httpStatus: 429,
71
- },
72
- };
73
- export function handleError(errorCode) {
74
- const errorDetail = ErrorDetails[errorCode];
75
- return {
76
- code: errorCode,
77
- message: errorDetail.message,
78
- httpStatus: errorDetail.httpStatus,
79
- };
80
- }
1
+ export * from "./codes.js";
2
+ export * from "./messages.js";
3
+ export * from "./app-error.js";
81
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,SAAS,EAAE,CAAC;AAErB,MAAM,CAAC,MAAM,YAAY,GAErB;IAEF,CAAC,SAAS,CAAC,sBAAsB,CAAC,EAAE;QAClC,OAAO,EAAE,8BAA8B;QACvC,UAAU,EAAE,GAAG;KAChB;IACD,CAAC,SAAS,CAAC,qBAAqB,CAAC,EAAE;QACjC,OAAO,EAAE,yBAAyB;QAClC,UAAU,EAAE,GAAG;KAChB;IACD,CAAC,SAAS,CAAC,kBAAkB,CAAC,EAAE;QAC9B,OAAO,EAAE,sBAAsB;QAC/B,UAAU,EAAE,GAAG;KAChB;IACD,CAAC,SAAS,CAAC,kBAAkB,CAAC,EAAE;QAC9B,OAAO,EAAE,4BAA4B;QACrC,UAAU,EAAE,GAAG;KAChB;IAGD,CAAC,SAAS,CAAC,0BAA0B,CAAC,EAAE;QACtC,OAAO,EAAE,uBAAuB;QAChC,UAAU,EAAE,GAAG;KAChB;IACD,CAAC,SAAS,CAAC,sBAAsB,CAAC,EAAE;QAClC,OAAO,EAAE,mCAAmC;QAC5C,UAAU,EAAE,GAAG;KAChB;IACD,CAAC,SAAS,CAAC,sBAAsB,CAAC,EAAE;QAClC,OAAO,EAAE,+BAA+B;QACxC,UAAU,EAAE,GAAG;KAChB;IACD,CAAC,SAAS,CAAC,sBAAsB,CAAC,EAAE;QAClC,OAAO,EAAE,uBAAuB;QAChC,UAAU,EAAE,GAAG;KAChB;IAGD,CAAC,SAAS,CAAC,cAAc,CAAC,EAAE;QAC1B,OAAO,EAAE,6BAA6B;QACtC,UAAU,EAAE,GAAG;KAChB;IACD,CAAC,SAAS,CAAC,eAAe,CAAC,EAAE;QAC3B,OAAO,EAAE,wBAAwB;QACjC,UAAU,EAAE,GAAG;KAChB;IACD,CAAC,SAAS,CAAC,gBAAgB,CAAC,EAAE;QAC5B,OAAO,EAAE,4BAA4B;QACrC,UAAU,EAAE,GAAG;KAChB;IAGD,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE;QACvB,OAAO,EAAE,uBAAuB;QAChC,UAAU,EAAE,GAAG;KAChB;IACD,CAAC,SAAS,CAAC,kBAAkB,CAAC,EAAE;QAC9B,OAAO,EAAE,wBAAwB;QACjC,UAAU,EAAE,GAAG;KAChB;IACD,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE;QACvB,OAAO,EAAE,2BAA2B;QACpC,UAAU,EAAE,GAAG;KAChB;IAGD,CAAC,SAAS,CAAC,wBAAwB,CAAC,EAAE;QACpC,OAAO,EAAE,qCAAqC;QAC9C,UAAU,EAAE,GAAG;KAChB;IACD,CAAC,SAAS,CAAC,eAAe,CAAC,EAAE;QAC3B,OAAO,EAAE,oCAAoC;QAC7C,UAAU,EAAE,GAAG;KAChB;IACD,CAAC,SAAS,CAAC,uBAAuB,CAAC,EAAE;QACnC,OAAO,EAAE,mCAAmC;QAC5C,UAAU,EAAE,GAAG;KAChB;CACF,CAAC;AAEF,MAAM,UAAU,WAAW,CAAC,SAAoB;IAK9C,MAAM,WAAW,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;IAC5C,OAAO;QACL,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,WAAW,CAAC,OAAO;QAC5B,UAAU,EAAE,WAAW,CAAC,UAAU;KACnC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { ErrorCode } from "./codes.js";
2
+ export declare const ErrorMessages: Record<ErrorCode, string>;
3
+ //# sourceMappingURL=messages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/errors/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAsBnD,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { ErrorCode } from "./codes.js";
2
+ export const ErrorMessages = {
3
+ [ErrorCode.USR_VAL_MISSING_FIELDS]: "缺少必要字段",
4
+ [ErrorCode.USR_VAL_INVALID_INPUT]: "用户输入不合法",
5
+ [ErrorCode.USR_DATA_NOT_FOUND]: "用户不存在",
6
+ [ErrorCode.USR_DATA_DUPLICATE]: "用户数据重复",
7
+ [ErrorCode.AUTH_VAL_SIGNATURE_INVALID]: "签名不合法",
8
+ [ErrorCode.AUTH_VAL_TOKEN_EXPIRED]: "令牌已过期",
9
+ [ErrorCode.AUTH_VAL_TOKEN_INVALID]: "令牌无效",
10
+ [ErrorCode.AUTH_AUTH_UNAUTHORIZED]: "未授权访问",
11
+ [ErrorCode.DB_CONN_FAILED]: "数据库连接失败",
12
+ [ErrorCode.DB_QUERY_FAILED]: "数据库查询失败",
13
+ [ErrorCode.DB_DATA_CONFLICT]: "数据冲突",
14
+ [ErrorCode.SYS_UNKNOWN]: "未知错误",
15
+ [ErrorCode.SYS_INTERNAL_ERROR]: "内部错误",
16
+ [ErrorCode.SYS_TIMEOUT]: "请求超时",
17
+ [ErrorCode.API_VAL_RESPONSE_INVALID]: "外部接口响应无效",
18
+ [ErrorCode.API_CONN_FAILED]: "外部接口连接失败",
19
+ [ErrorCode.API_RATE_LIMIT_EXCEEDED]: "API 调用频率超出限制",
20
+ };
21
+ //# sourceMappingURL=messages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/errors/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,MAAM,CAAC,MAAM,aAAa,GAA8B;IACtD,CAAC,SAAS,CAAC,sBAAsB,CAAC,EAAE,QAAQ;IAC5C,CAAC,SAAS,CAAC,qBAAqB,CAAC,EAAE,SAAS;IAC5C,CAAC,SAAS,CAAC,kBAAkB,CAAC,EAAE,OAAO;IACvC,CAAC,SAAS,CAAC,kBAAkB,CAAC,EAAE,QAAQ;IAExC,CAAC,SAAS,CAAC,0BAA0B,CAAC,EAAE,OAAO;IAC/C,CAAC,SAAS,CAAC,sBAAsB,CAAC,EAAE,OAAO;IAC3C,CAAC,SAAS,CAAC,sBAAsB,CAAC,EAAE,MAAM;IAC1C,CAAC,SAAS,CAAC,sBAAsB,CAAC,EAAE,OAAO;IAE3C,CAAC,SAAS,CAAC,cAAc,CAAC,EAAE,SAAS;IACrC,CAAC,SAAS,CAAC,eAAe,CAAC,EAAE,SAAS;IACtC,CAAC,SAAS,CAAC,gBAAgB,CAAC,EAAE,MAAM;IAEpC,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,MAAM;IAC/B,CAAC,SAAS,CAAC,kBAAkB,CAAC,EAAE,MAAM;IACtC,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,MAAM;IAE/B,CAAC,SAAS,CAAC,wBAAwB,CAAC,EAAE,UAAU;IAChD,CAAC,SAAS,CAAC,eAAe,CAAC,EAAE,UAAU;IACvC,CAAC,SAAS,CAAC,uBAAuB,CAAC,EAAE,cAAc;CACpD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./nano-id.util.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/id/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./nano-id.util.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/id/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
@@ -2,7 +2,7 @@ export declare class NanoIdUtil {
2
2
  private static readonly DEFAULT_CHARS;
3
3
  static generate(length: number, chars?: string): string;
4
4
  static generateDefault(length: number): string;
5
- static generateCustom(length: number, customChars: string): string;
5
+ static generateCustom(length: number, chars: string): string;
6
6
  static generateNumberId(length?: number): number;
7
7
  }
8
- //# sourceMappingURL=nanoid.util.d.ts.map
8
+ //# sourceMappingURL=nano-id.util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nano-id.util.d.ts","sourceRoot":"","sources":["../../src/id/nano-id.util.ts"],"names":[],"mappings":"AAKA,qBAAa,UAAU;IAIrB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAC8B;WAOrD,QAAQ,CACpB,MAAM,EAAE,MAAM,EACd,KAAK,GAAE,MAAiC,GACvC,MAAM;WAaK,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;WAKvC,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;WAWrD,gBAAgB,CAAC,MAAM,GAAE,MAAU,GAAG,MAAM;CAiB3D"}
@@ -0,0 +1,34 @@
1
+ import crypto from "crypto";
2
+ export class NanoIdUtil {
3
+ static DEFAULT_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
4
+ static generate(length, chars = NanoIdUtil.DEFAULT_CHARS) {
5
+ if (length <= 0) {
6
+ throw new Error("Length must be greater than 0");
7
+ }
8
+ const bytes = crypto.randomBytes(length);
9
+ return Array.from({ length }, (_, i) => {
10
+ const index = bytes[i] % chars.length;
11
+ return chars[index];
12
+ }).join("");
13
+ }
14
+ static generateDefault(length) {
15
+ return this.generate(length);
16
+ }
17
+ static generateCustom(length, chars) {
18
+ return this.generate(length, chars);
19
+ }
20
+ static generateNumberId(length = 8) {
21
+ const now = new Date();
22
+ const start = new Date("2025-01-01T00:00:00Z");
23
+ const daysSince = Math.floor((now.getTime() - start.getTime()) / (1000 * 60 * 60 * 24));
24
+ const minutesOfDay = now.getHours() * 60 + now.getMinutes();
25
+ const dayPart = daysSince.toString().slice(-4).padStart(4, "0");
26
+ const minutePart = minutesOfDay.toString().padStart(4, "0");
27
+ const randomPart = this.generate(length, "0123456789");
28
+ let id = `${dayPart}${minutePart}${randomPart}`;
29
+ if (id.startsWith("0"))
30
+ id = "1" + id.slice(1);
31
+ return Number(id);
32
+ }
33
+ }
34
+ //# sourceMappingURL=nano-id.util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nano-id.util.js","sourceRoot":"","sources":["../../src/id/nano-id.util.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAK5B,MAAM,OAAO,UAAU;IAIb,MAAM,CAAU,aAAa,GACnC,gEAAgE,CAAC;IAO5D,MAAM,CAAC,QAAQ,CACpB,MAAc,EACd,QAAgB,UAAU,CAAC,aAAa;QAExC,IAAI,MAAM,IAAI,CAAC,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;QACnD,CAAC;QAED,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QACzC,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;YACrC,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;YACtC,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACd,CAAC;IAGM,MAAM,CAAC,eAAe,CAAC,MAAc;QAC1C,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;IAGM,MAAM,CAAC,cAAc,CAAC,MAAc,EAAE,KAAa;QACxD,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACtC,CAAC;IASM,MAAM,CAAC,gBAAgB,CAAC,SAAiB,CAAC;QAC/C,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAC/C,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAC1B,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAC1D,CAAC;QACF,MAAM,YAAY,GAAG,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC;QAE5D,MAAM,OAAO,GAAG,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QAChE,MAAM,UAAU,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QAC5D,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QAEvD,IAAI,EAAE,GAAG,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,EAAE,CAAC;QAChD,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,EAAE,GAAG,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAE/C,OAAO,MAAM,CAAC,EAAE,CAAC,CAAC;IACpB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,15 +1,9 @@
1
- export * from "./models/user.js";
2
- export * from "./models/product.js";
3
- export * from "./models/logger.js";
4
- export * from "./models/order.js";
5
- export * from "./models/broadcast.js";
6
- export * from "./models/point.js";
7
- export * from "./models/transaction.js";
8
- export { StringUtils } from "./utils/string.util.js";
9
- export { SimpleStateMachine, OrderStateMachine, } from "./utils/statemachine.util.js";
10
- export { SignatureUtils } from "./utils/signature.util.js";
11
- export * from "./queue/queue.js";
12
- export * from "./utils/nanoid.util.js";
13
- export * from "./logger/default.js";
1
+ export * from "./logger/index.js";
2
+ export * from "./types/index.js";
3
+ export * from "./date/index.js";
4
+ export * from "./constants/index.js";
5
+ export * from "./validation/index.js";
14
6
  export * from "./errors/index.js";
7
+ export * from "./env/index.js";
8
+ export * from "./id/index.js";
15
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AAGxC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGrD,OAAO,EACL,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAG3D,cAAc,kBAAkB,CAAC;AAGjC,cAAc,wBAAwB,CAAC;AAGvC,cAAc,qBAAqB,CAAC;AAGpC,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC"}