yingzios-platform-backend-shared 1.0.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 (194) hide show
  1. package/README.md +51 -0
  2. package/dist/apollo/apollo.config.d.ts +26 -0
  3. package/dist/apollo/apollo.config.d.ts.map +1 -0
  4. package/dist/apollo/apollo.config.js +2 -0
  5. package/dist/apollo/apollo.module.d.ts +13 -0
  6. package/dist/apollo/apollo.module.d.ts.map +1 -0
  7. package/dist/apollo/apollo.module.js +61 -0
  8. package/dist/apollo/apollo.service.d.ts +17 -0
  9. package/dist/apollo/apollo.service.d.ts.map +1 -0
  10. package/dist/apollo/apollo.service.js +35 -0
  11. package/dist/apollo/index.d.ts +5 -0
  12. package/dist/apollo/index.d.ts.map +1 -0
  13. package/dist/apollo/index.js +17 -0
  14. package/dist/cache/cache.config.d.ts +28 -0
  15. package/dist/cache/cache.config.d.ts.map +1 -0
  16. package/dist/cache/cache.config.js +2 -0
  17. package/dist/cache/cache.module.d.ts +39 -0
  18. package/dist/cache/cache.module.d.ts.map +1 -0
  19. package/dist/cache/cache.module.js +75 -0
  20. package/dist/cache/cache.service.d.ts +49 -0
  21. package/dist/cache/cache.service.d.ts.map +1 -0
  22. package/dist/cache/cache.service.js +208 -0
  23. package/dist/cache/index.d.ts +4 -0
  24. package/dist/cache/index.d.ts.map +1 -0
  25. package/dist/cache/index.js +19 -0
  26. package/dist/env/env-loader.d.ts +50 -0
  27. package/dist/env/env-loader.d.ts.map +1 -0
  28. package/dist/env/env-loader.js +159 -0
  29. package/dist/env/env.module.d.ts +11 -0
  30. package/dist/env/env.module.d.ts.map +1 -0
  31. package/dist/env/env.module.js +47 -0
  32. package/dist/env/env.service.d.ts +31 -0
  33. package/dist/env/env.service.d.ts.map +1 -0
  34. package/dist/env/env.service.js +195 -0
  35. package/dist/env/index.d.ts +4 -0
  36. package/dist/env/index.d.ts.map +1 -0
  37. package/dist/env/index.js +19 -0
  38. package/dist/index.d.ts +12 -0
  39. package/dist/index.d.ts.map +1 -0
  40. package/dist/index.js +27 -0
  41. package/dist/internal-auth/decorators/caller.decorator.d.ts +29 -0
  42. package/dist/internal-auth/decorators/caller.decorator.d.ts.map +1 -0
  43. package/dist/internal-auth/decorators/caller.decorator.js +37 -0
  44. package/dist/internal-auth/decorators/index.d.ts +3 -0
  45. package/dist/internal-auth/decorators/index.d.ts.map +1 -0
  46. package/dist/internal-auth/decorators/index.js +18 -0
  47. package/dist/internal-auth/decorators/use-either-guard.decorator.d.ts +31 -0
  48. package/dist/internal-auth/decorators/use-either-guard.decorator.d.ts.map +1 -0
  49. package/dist/internal-auth/decorators/use-either-guard.decorator.js +79 -0
  50. package/dist/internal-auth/guards/index.d.ts +2 -0
  51. package/dist/internal-auth/guards/index.d.ts.map +1 -0
  52. package/dist/internal-auth/guards/index.js +17 -0
  53. package/dist/internal-auth/guards/service-key.guard.d.ts +36 -0
  54. package/dist/internal-auth/guards/service-key.guard.d.ts.map +1 -0
  55. package/dist/internal-auth/guards/service-key.guard.js +86 -0
  56. package/dist/internal-auth/index.d.ts +43 -0
  57. package/dist/internal-auth/index.d.ts.map +1 -0
  58. package/dist/internal-auth/index.js +62 -0
  59. package/dist/internal-auth/internal-auth.module.d.ts +62 -0
  60. package/dist/internal-auth/internal-auth.module.d.ts.map +1 -0
  61. package/dist/internal-auth/internal-auth.module.js +118 -0
  62. package/dist/internal-auth/internal-http.service.d.ts +72 -0
  63. package/dist/internal-auth/internal-http.service.d.ts.map +1 -0
  64. package/dist/internal-auth/internal-http.service.js +119 -0
  65. package/dist/jwt/auto-fill-user.pipe.d.ts +43 -0
  66. package/dist/jwt/auto-fill-user.pipe.d.ts.map +1 -0
  67. package/dist/jwt/auto-fill-user.pipe.js +166 -0
  68. package/dist/jwt/decorators/current-user.decorator.d.ts +37 -0
  69. package/dist/jwt/decorators/current-user.decorator.d.ts.map +1 -0
  70. package/dist/jwt/decorators/current-user.decorator.js +29 -0
  71. package/dist/jwt/decorators/public.decorator.d.ts +8 -0
  72. package/dist/jwt/decorators/public.decorator.d.ts.map +1 -0
  73. package/dist/jwt/decorators/public.decorator.js +12 -0
  74. package/dist/jwt/guards/jwt-auth.guard.d.ts +20 -0
  75. package/dist/jwt/guards/jwt-auth.guard.d.ts.map +1 -0
  76. package/dist/jwt/guards/jwt-auth.guard.js +88 -0
  77. package/dist/jwt/index.d.ts +8 -0
  78. package/dist/jwt/index.d.ts.map +1 -0
  79. package/dist/jwt/index.js +26 -0
  80. package/dist/jwt/jwt-config.service.d.ts +10 -0
  81. package/dist/jwt/jwt-config.service.d.ts.map +1 -0
  82. package/dist/jwt/jwt-config.service.js +40 -0
  83. package/dist/jwt/jwt.config.d.ts +15 -0
  84. package/dist/jwt/jwt.config.d.ts.map +1 -0
  85. package/dist/jwt/jwt.config.js +2 -0
  86. package/dist/jwt/jwt.module.d.ts +19 -0
  87. package/dist/jwt/jwt.module.d.ts.map +1 -0
  88. package/dist/jwt/jwt.module.js +100 -0
  89. package/dist/jwt/jwt.service.d.ts +31 -0
  90. package/dist/jwt/jwt.service.d.ts.map +1 -0
  91. package/dist/jwt/jwt.service.js +71 -0
  92. package/dist/jwt/strategies/jwt.strategy.d.ts +25 -0
  93. package/dist/jwt/strategies/jwt.strategy.d.ts.map +1 -0
  94. package/dist/jwt/strategies/jwt.strategy.js +150 -0
  95. package/dist/jwt/user-aware-axios.service.d.ts +17 -0
  96. package/dist/jwt/user-aware-axios.service.d.ts.map +1 -0
  97. package/dist/jwt/user-aware-axios.service.js +105 -0
  98. package/dist/jwt/utils/jwt.utils.d.ts +24 -0
  99. package/dist/jwt/utils/jwt.utils.d.ts.map +1 -0
  100. package/dist/jwt/utils/jwt.utils.js +40 -0
  101. package/dist/logger/index.d.ts +4 -0
  102. package/dist/logger/index.d.ts.map +1 -0
  103. package/dist/logger/index.js +19 -0
  104. package/dist/logger/logger.config.d.ts +41 -0
  105. package/dist/logger/logger.config.d.ts.map +1 -0
  106. package/dist/logger/logger.config.js +13 -0
  107. package/dist/logger/logger.module.d.ts +17 -0
  108. package/dist/logger/logger.module.d.ts.map +1 -0
  109. package/dist/logger/logger.module.js +49 -0
  110. package/dist/logger/logger.service.d.ts +62 -0
  111. package/dist/logger/logger.service.d.ts.map +1 -0
  112. package/dist/logger/logger.service.js +124 -0
  113. package/dist/logger/winston.config.d.ts +43 -0
  114. package/dist/logger/winston.config.d.ts.map +1 -0
  115. package/dist/logger/winston.config.js +183 -0
  116. package/dist/nacos/index.d.ts +4 -0
  117. package/dist/nacos/index.d.ts.map +1 -0
  118. package/dist/nacos/index.js +19 -0
  119. package/dist/nacos/nacos.config.d.ts +10 -0
  120. package/dist/nacos/nacos.config.d.ts.map +1 -0
  121. package/dist/nacos/nacos.config.js +2 -0
  122. package/dist/nacos/nacos.module.d.ts +9 -0
  123. package/dist/nacos/nacos.module.d.ts.map +1 -0
  124. package/dist/nacos/nacos.module.js +42 -0
  125. package/dist/nacos/nacos.service.d.ts +43 -0
  126. package/dist/nacos/nacos.service.d.ts.map +1 -0
  127. package/dist/nacos/nacos.service.js +212 -0
  128. package/dist/nacos/utils.d.ts +10 -0
  129. package/dist/nacos/utils.d.ts.map +1 -0
  130. package/dist/nacos/utils.js +65 -0
  131. package/dist/restful/current-request.util.d.ts +16 -0
  132. package/dist/restful/current-request.util.d.ts.map +1 -0
  133. package/dist/restful/current-request.util.js +34 -0
  134. package/dist/restful/http-exception.filter.d.ts +24 -0
  135. package/dist/restful/http-exception.filter.d.ts.map +1 -0
  136. package/dist/restful/http-exception.filter.js +126 -0
  137. package/dist/restful/index.d.ts +8 -0
  138. package/dist/restful/index.d.ts.map +1 -0
  139. package/dist/restful/index.js +23 -0
  140. package/dist/restful/request-context.middleware.d.ts +6 -0
  141. package/dist/restful/request-context.middleware.d.ts.map +1 -0
  142. package/dist/restful/request-context.middleware.js +25 -0
  143. package/dist/restful/response-codes.d.ts +104 -0
  144. package/dist/restful/response-codes.d.ts.map +1 -0
  145. package/dist/restful/response-codes.js +163 -0
  146. package/dist/restful/response.dto.d.ts +52 -0
  147. package/dist/restful/response.dto.d.ts.map +1 -0
  148. package/dist/restful/response.dto.js +146 -0
  149. package/dist/restful/response.interceptor.d.ts +17 -0
  150. package/dist/restful/response.interceptor.d.ts.map +1 -0
  151. package/dist/restful/response.interceptor.js +86 -0
  152. package/dist/restful/restful.module.d.ts +5 -0
  153. package/dist/restful/restful.module.d.ts.map +1 -0
  154. package/dist/restful/restful.module.js +26 -0
  155. package/dist/sequelize/index.d.ts +4 -0
  156. package/dist/sequelize/index.d.ts.map +1 -0
  157. package/dist/sequelize/index.js +19 -0
  158. package/dist/sequelize/sequelize.config.d.ts +24 -0
  159. package/dist/sequelize/sequelize.config.d.ts.map +1 -0
  160. package/dist/sequelize/sequelize.config.js +5 -0
  161. package/dist/sequelize/sequelize.module.d.ts +28 -0
  162. package/dist/sequelize/sequelize.module.d.ts.map +1 -0
  163. package/dist/sequelize/sequelize.module.js +50 -0
  164. package/dist/sequelize/sequelize.provider.d.ts +7 -0
  165. package/dist/sequelize/sequelize.provider.d.ts.map +1 -0
  166. package/dist/sequelize/sequelize.provider.js +154 -0
  167. package/dist/snowflake/index.d.ts +4 -0
  168. package/dist/snowflake/index.d.ts.map +1 -0
  169. package/dist/snowflake/index.js +19 -0
  170. package/dist/snowflake/snowflake.config.d.ts +30 -0
  171. package/dist/snowflake/snowflake.config.d.ts.map +1 -0
  172. package/dist/snowflake/snowflake.config.js +12 -0
  173. package/dist/snowflake/snowflake.module.d.ts +17 -0
  174. package/dist/snowflake/snowflake.module.d.ts.map +1 -0
  175. package/dist/snowflake/snowflake.module.js +58 -0
  176. package/dist/snowflake/snowflake.service.d.ts +21 -0
  177. package/dist/snowflake/snowflake.service.d.ts.map +1 -0
  178. package/dist/snowflake/snowflake.service.js +44 -0
  179. package/dist/swagger/index.d.ts +6 -0
  180. package/dist/swagger/index.d.ts.map +1 -0
  181. package/dist/swagger/index.js +19 -0
  182. package/dist/swagger/swagger.config.d.ts +45 -0
  183. package/dist/swagger/swagger.config.d.ts.map +1 -0
  184. package/dist/swagger/swagger.config.js +19 -0
  185. package/dist/swagger/swagger.decorators.d.ts +21 -0
  186. package/dist/swagger/swagger.decorators.d.ts.map +1 -0
  187. package/dist/swagger/swagger.decorators.js +112 -0
  188. package/dist/swagger/swagger.module.d.ts +15 -0
  189. package/dist/swagger/swagger.module.d.ts.map +1 -0
  190. package/dist/swagger/swagger.module.js +49 -0
  191. package/dist/swagger/swagger.service.d.ts +44 -0
  192. package/dist/swagger/swagger.service.d.ts.map +1 -0
  193. package/dist/swagger/swagger.service.js +202 -0
  194. package/package.json +75 -0
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.RequestContextMiddleware = void 0;
10
+ const common_1 = require("@nestjs/common");
11
+ const current_request_util_1 = require("./current-request.util");
12
+ let RequestContextMiddleware = class RequestContextMiddleware {
13
+ use(req, res, next) {
14
+ // 在AsyncLocalStorage上下文中运行请求处理
15
+ (0, current_request_util_1.runWithContext)(() => {
16
+ // 设置当前请求上下文
17
+ (0, current_request_util_1.setCurrentRequest)(req);
18
+ next();
19
+ }, req);
20
+ }
21
+ };
22
+ exports.RequestContextMiddleware = RequestContextMiddleware;
23
+ exports.RequestContextMiddleware = RequestContextMiddleware = __decorate([
24
+ (0, common_1.Injectable)()
25
+ ], RequestContextMiddleware);
@@ -0,0 +1,104 @@
1
+ /**
2
+ * 统一业务状态码定义
3
+ *
4
+ * 规范:
5
+ * - 所有接口统一返回 HTTP 200
6
+ * - 通过响应体中的 code 字段判断业务状态
7
+ * - code 为 6 位数字字符串
8
+ *
9
+ * 状态码分类:
10
+ * - 000xxx: 成功
11
+ * - 100xxx: 客户端错误(参数、认证、权限等)
12
+ * - 200xxx: 服务端错误(系统错误、数据库错误等)
13
+ * - 300xxx: 业务错误(业务规则限制等)
14
+ */
15
+ /**
16
+ * 业务状态码枚举
17
+ */
18
+ export declare enum ResponseCode {
19
+ /** 操作成功 */
20
+ SUCCESS = "000000",
21
+ /** 请求参数错误 */
22
+ BAD_REQUEST = "100400",
23
+ /** 未认证(未登录) */
24
+ UNAUTHORIZED = "100401",
25
+ /** 无权限 */
26
+ FORBIDDEN = "100403",
27
+ /** 资源不存在 */
28
+ NOT_FOUND = "100404",
29
+ /** 请求方法不允许 */
30
+ METHOD_NOT_ALLOWED = "100405",
31
+ /** 请求超时 */
32
+ REQUEST_TIMEOUT = "100408",
33
+ /** 请求冲突 */
34
+ CONFLICT = "100409",
35
+ /** 请求实体过大 */
36
+ PAYLOAD_TOO_LARGE = "100413",
37
+ /** 请求频率过高 */
38
+ TOO_MANY_REQUESTS = "100429",
39
+ /** 令牌无效 */
40
+ TOKEN_INVALID = "101001",
41
+ /** 令牌已过期 */
42
+ TOKEN_EXPIRED = "101002",
43
+ /** 令牌被撤销 */
44
+ TOKEN_REVOKED = "101003",
45
+ /** 刷新令牌无效 */
46
+ REFRESH_TOKEN_INVALID = "101004",
47
+ /** 检测到令牌重用 */
48
+ TOKEN_REUSED = "101005",
49
+ /** 验证码错误 */
50
+ CAPTCHA_ERROR = "101006",
51
+ /** 验证码已过期 */
52
+ CAPTCHA_EXPIRED = "101007",
53
+ /** 内部服务器错误 */
54
+ INTERNAL_ERROR = "200500",
55
+ /** 服务不可用 */
56
+ SERVICE_UNAVAILABLE = "200503",
57
+ /** 网关超时 */
58
+ GATEWAY_TIMEOUT = "200504",
59
+ /** 数据库错误 */
60
+ DATABASE_ERROR = "200510",
61
+ /** 缓存错误 */
62
+ CACHE_ERROR = "200511",
63
+ /** 外部服务错误 */
64
+ EXTERNAL_SERVICE_ERROR = "200520",
65
+ /** 业务规则限制 */
66
+ BUSINESS_ERROR = "300001",
67
+ /** 数据已存在 */
68
+ DATA_EXISTS = "300002",
69
+ /** 数据不存在 */
70
+ DATA_NOT_FOUND = "300003",
71
+ /** 操作不允许 */
72
+ OPERATION_NOT_ALLOWED = "300004",
73
+ /** 状态不允许 */
74
+ STATE_NOT_ALLOWED = "300005",
75
+ /** 余额不足 */
76
+ INSUFFICIENT_BALANCE = "300006",
77
+ /** 库存不足 */
78
+ INSUFFICIENT_STOCK = "300007"
79
+ }
80
+ /**
81
+ * 业务状态码描述映射
82
+ */
83
+ export declare const ResponseCodeMessage: Record<ResponseCode, string>;
84
+ /**
85
+ * 获取状态码对应的描述
86
+ */
87
+ export declare function getResponseMessage(code: ResponseCode | string): string;
88
+ /**
89
+ * 判断是否为成功状态
90
+ */
91
+ export declare function isSuccess(code: string): boolean;
92
+ /**
93
+ * 判断是否为认证错误
94
+ */
95
+ export declare function isAuthError(code: string): boolean;
96
+ /**
97
+ * 判断是否为服务端错误
98
+ */
99
+ export declare function isServerError(code: string): boolean;
100
+ /**
101
+ * 判断是否为业务错误
102
+ */
103
+ export declare function isBusinessError(code: string): boolean;
104
+ //# sourceMappingURL=response-codes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response-codes.d.ts","sourceRoot":"","sources":["../../src/restful/response-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;GAEG;AACH,oBAAY,YAAY;IAEtB,WAAW;IACX,OAAO,WAAW;IAGlB,aAAa;IACb,WAAW,WAAW;IACtB,eAAe;IACf,YAAY,WAAW;IACvB,UAAU;IACV,SAAS,WAAW;IACpB,YAAY;IACZ,SAAS,WAAW;IACpB,cAAc;IACd,kBAAkB,WAAW;IAC7B,WAAW;IACX,eAAe,WAAW;IAC1B,WAAW;IACX,QAAQ,WAAW;IACnB,aAAa;IACb,iBAAiB,WAAW;IAC5B,aAAa;IACb,iBAAiB,WAAW;IAG5B,WAAW;IACX,aAAa,WAAW;IACxB,YAAY;IACZ,aAAa,WAAW;IACxB,YAAY;IACZ,aAAa,WAAW;IACxB,aAAa;IACb,qBAAqB,WAAW;IAChC,cAAc;IACd,YAAY,WAAW;IACvB,YAAY;IACZ,aAAa,WAAW;IACxB,aAAa;IACb,eAAe,WAAW;IAG1B,cAAc;IACd,cAAc,WAAW;IACzB,YAAY;IACZ,mBAAmB,WAAW;IAC9B,WAAW;IACX,eAAe,WAAW;IAC1B,YAAY;IACZ,cAAc,WAAW;IACzB,WAAW;IACX,WAAW,WAAW;IACtB,aAAa;IACb,sBAAsB,WAAW;IAGjC,aAAa;IACb,cAAc,WAAW;IACzB,YAAY;IACZ,WAAW,WAAW;IACtB,YAAY;IACZ,cAAc,WAAW;IACzB,YAAY;IACZ,qBAAqB,WAAW;IAChC,YAAY;IACZ,iBAAiB,WAAW;IAC5B,WAAW;IACX,oBAAoB,WAAW;IAC/B,WAAW;IACX,kBAAkB,WAAW;CAC9B;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAwC5D,CAAC;AAEF;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,GAAG,MAAM,CAEtE;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE/C;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEjD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAErD"}
@@ -0,0 +1,163 @@
1
+ "use strict";
2
+ /**
3
+ * 统一业务状态码定义
4
+ *
5
+ * 规范:
6
+ * - 所有接口统一返回 HTTP 200
7
+ * - 通过响应体中的 code 字段判断业务状态
8
+ * - code 为 6 位数字字符串
9
+ *
10
+ * 状态码分类:
11
+ * - 000xxx: 成功
12
+ * - 100xxx: 客户端错误(参数、认证、权限等)
13
+ * - 200xxx: 服务端错误(系统错误、数据库错误等)
14
+ * - 300xxx: 业务错误(业务规则限制等)
15
+ */
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.ResponseCodeMessage = exports.ResponseCode = void 0;
18
+ exports.getResponseMessage = getResponseMessage;
19
+ exports.isSuccess = isSuccess;
20
+ exports.isAuthError = isAuthError;
21
+ exports.isServerError = isServerError;
22
+ exports.isBusinessError = isBusinessError;
23
+ /**
24
+ * 业务状态码枚举
25
+ */
26
+ var ResponseCode;
27
+ (function (ResponseCode) {
28
+ // ========== 成功 ==========
29
+ /** 操作成功 */
30
+ ResponseCode["SUCCESS"] = "000000";
31
+ // ========== 客户端错误 (100xxx) ==========
32
+ /** 请求参数错误 */
33
+ ResponseCode["BAD_REQUEST"] = "100400";
34
+ /** 未认证(未登录) */
35
+ ResponseCode["UNAUTHORIZED"] = "100401";
36
+ /** 无权限 */
37
+ ResponseCode["FORBIDDEN"] = "100403";
38
+ /** 资源不存在 */
39
+ ResponseCode["NOT_FOUND"] = "100404";
40
+ /** 请求方法不允许 */
41
+ ResponseCode["METHOD_NOT_ALLOWED"] = "100405";
42
+ /** 请求超时 */
43
+ ResponseCode["REQUEST_TIMEOUT"] = "100408";
44
+ /** 请求冲突 */
45
+ ResponseCode["CONFLICT"] = "100409";
46
+ /** 请求实体过大 */
47
+ ResponseCode["PAYLOAD_TOO_LARGE"] = "100413";
48
+ /** 请求频率过高 */
49
+ ResponseCode["TOO_MANY_REQUESTS"] = "100429";
50
+ // ========== 认证相关 (101xxx) ==========
51
+ /** 令牌无效 */
52
+ ResponseCode["TOKEN_INVALID"] = "101001";
53
+ /** 令牌已过期 */
54
+ ResponseCode["TOKEN_EXPIRED"] = "101002";
55
+ /** 令牌被撤销 */
56
+ ResponseCode["TOKEN_REVOKED"] = "101003";
57
+ /** 刷新令牌无效 */
58
+ ResponseCode["REFRESH_TOKEN_INVALID"] = "101004";
59
+ /** 检测到令牌重用 */
60
+ ResponseCode["TOKEN_REUSED"] = "101005";
61
+ /** 验证码错误 */
62
+ ResponseCode["CAPTCHA_ERROR"] = "101006";
63
+ /** 验证码已过期 */
64
+ ResponseCode["CAPTCHA_EXPIRED"] = "101007";
65
+ // ========== 服务端错误 (200xxx) ==========
66
+ /** 内部服务器错误 */
67
+ ResponseCode["INTERNAL_ERROR"] = "200500";
68
+ /** 服务不可用 */
69
+ ResponseCode["SERVICE_UNAVAILABLE"] = "200503";
70
+ /** 网关超时 */
71
+ ResponseCode["GATEWAY_TIMEOUT"] = "200504";
72
+ /** 数据库错误 */
73
+ ResponseCode["DATABASE_ERROR"] = "200510";
74
+ /** 缓存错误 */
75
+ ResponseCode["CACHE_ERROR"] = "200511";
76
+ /** 外部服务错误 */
77
+ ResponseCode["EXTERNAL_SERVICE_ERROR"] = "200520";
78
+ // ========== 业务错误 (300xxx) ==========
79
+ /** 业务规则限制 */
80
+ ResponseCode["BUSINESS_ERROR"] = "300001";
81
+ /** 数据已存在 */
82
+ ResponseCode["DATA_EXISTS"] = "300002";
83
+ /** 数据不存在 */
84
+ ResponseCode["DATA_NOT_FOUND"] = "300003";
85
+ /** 操作不允许 */
86
+ ResponseCode["OPERATION_NOT_ALLOWED"] = "300004";
87
+ /** 状态不允许 */
88
+ ResponseCode["STATE_NOT_ALLOWED"] = "300005";
89
+ /** 余额不足 */
90
+ ResponseCode["INSUFFICIENT_BALANCE"] = "300006";
91
+ /** 库存不足 */
92
+ ResponseCode["INSUFFICIENT_STOCK"] = "300007";
93
+ })(ResponseCode || (exports.ResponseCode = ResponseCode = {}));
94
+ /**
95
+ * 业务状态码描述映射
96
+ */
97
+ exports.ResponseCodeMessage = {
98
+ // 成功
99
+ [ResponseCode.SUCCESS]: '操作成功',
100
+ // 客户端错误
101
+ [ResponseCode.BAD_REQUEST]: '请求参数错误',
102
+ [ResponseCode.UNAUTHORIZED]: '未认证,请先登录',
103
+ [ResponseCode.FORBIDDEN]: '无权限访问',
104
+ [ResponseCode.NOT_FOUND]: '资源不存在',
105
+ [ResponseCode.METHOD_NOT_ALLOWED]: '请求方法不允许',
106
+ [ResponseCode.REQUEST_TIMEOUT]: '请求超时',
107
+ [ResponseCode.CONFLICT]: '请求冲突',
108
+ [ResponseCode.PAYLOAD_TOO_LARGE]: '请求实体过大',
109
+ [ResponseCode.TOO_MANY_REQUESTS]: '请求过于频繁,请稍后再试',
110
+ // 认证相关
111
+ [ResponseCode.TOKEN_INVALID]: '令牌无效',
112
+ [ResponseCode.TOKEN_EXPIRED]: '令牌已过期',
113
+ [ResponseCode.TOKEN_REVOKED]: '令牌已被撤销',
114
+ [ResponseCode.REFRESH_TOKEN_INVALID]: '刷新令牌无效',
115
+ [ResponseCode.TOKEN_REUSED]: '检测到令牌重用,会话已撤销',
116
+ [ResponseCode.CAPTCHA_ERROR]: '验证码错误',
117
+ [ResponseCode.CAPTCHA_EXPIRED]: '验证码已过期',
118
+ // 服务端错误
119
+ [ResponseCode.INTERNAL_ERROR]: '服务器内部错误',
120
+ [ResponseCode.SERVICE_UNAVAILABLE]: '服务暂不可用',
121
+ [ResponseCode.GATEWAY_TIMEOUT]: '网关超时',
122
+ [ResponseCode.DATABASE_ERROR]: '数据库错误',
123
+ [ResponseCode.CACHE_ERROR]: '缓存错误',
124
+ [ResponseCode.EXTERNAL_SERVICE_ERROR]: '外部服务错误',
125
+ // 业务错误
126
+ [ResponseCode.BUSINESS_ERROR]: '业务规则限制',
127
+ [ResponseCode.DATA_EXISTS]: '数据已存在',
128
+ [ResponseCode.DATA_NOT_FOUND]: '数据不存在',
129
+ [ResponseCode.OPERATION_NOT_ALLOWED]: '操作不允许',
130
+ [ResponseCode.STATE_NOT_ALLOWED]: '当前状态不允许此操作',
131
+ [ResponseCode.INSUFFICIENT_BALANCE]: '余额不足',
132
+ [ResponseCode.INSUFFICIENT_STOCK]: '库存不足',
133
+ };
134
+ /**
135
+ * 获取状态码对应的描述
136
+ */
137
+ function getResponseMessage(code) {
138
+ return exports.ResponseCodeMessage[code] || '未知错误';
139
+ }
140
+ /**
141
+ * 判断是否为成功状态
142
+ */
143
+ function isSuccess(code) {
144
+ return code === ResponseCode.SUCCESS;
145
+ }
146
+ /**
147
+ * 判断是否为认证错误
148
+ */
149
+ function isAuthError(code) {
150
+ return code.startsWith('101');
151
+ }
152
+ /**
153
+ * 判断是否为服务端错误
154
+ */
155
+ function isServerError(code) {
156
+ return code.startsWith('200');
157
+ }
158
+ /**
159
+ * 判断是否为业务错误
160
+ */
161
+ function isBusinessError(code) {
162
+ return code.startsWith('300');
163
+ }
@@ -0,0 +1,52 @@
1
+ import { ResponseCode } from './response-codes';
2
+ /**
3
+ * 标准API响应格式
4
+ */
5
+ export declare class ApiResponseDto<T = any> {
6
+ code: string;
7
+ message?: string;
8
+ data?: T;
9
+ traceId?: string;
10
+ constructor(partial: Partial<ApiResponseDto<T>>);
11
+ /**
12
+ * 创建成功响应
13
+ */
14
+ static success<T>(data?: T, message?: string): ApiResponseDto<T>;
15
+ /**
16
+ * 创建错误响应
17
+ */
18
+ static error<T = any>(code: string | ResponseCode, message?: string, data?: T): ApiResponseDto<T>;
19
+ }
20
+ /**
21
+ * 错误响应格式
22
+ */
23
+ export declare class ErrorResponseDto {
24
+ code: string;
25
+ message: string;
26
+ traceId?: string;
27
+ constructor(code: string, message: string, options?: {
28
+ traceId?: string;
29
+ });
30
+ }
31
+ /**
32
+ * 新的分页响应格式
33
+ */
34
+ export declare class PaginatedResponseDto<T> extends ApiResponseDto<any> {
35
+ code: string;
36
+ msg: string;
37
+ data: {
38
+ totalCount: string;
39
+ pageSize: string;
40
+ totalPage: string;
41
+ currentPage: string;
42
+ list: T[];
43
+ };
44
+ ptraceId?: string;
45
+ constructor(list: T[], total: number, page: number, limit: number, options?: {
46
+ code?: string;
47
+ msg?: string;
48
+ traceId?: string;
49
+ ptraceId?: string;
50
+ });
51
+ }
52
+ //# sourceMappingURL=response.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response.dto.d.ts","sourceRoot":"","sources":["../../src/restful/response.dto.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAsB,MAAM,kBAAkB,CAAC;AAEpE;;GAEG;AACH,qBAAa,cAAc,CAAC,CAAC,GAAG,GAAG;IAMjC,IAAI,EAAE,MAAM,CAAC;IAGb,OAAO,CAAC,EAAE,MAAM,CAAC;IAGjB,IAAI,CAAC,EAAE,CAAC,CAAC;IAGT,OAAO,CAAC,EAAE,MAAM,CAAC;gBAEL,OAAO,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;IAI/C;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC,CAAC,CAAC;IAQhE;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC;CAOlG;AAED;;GAEG;AACH,qBAAa,gBAAgB;IAE3B,IAAI,EAAE,MAAM,CAAC;IAGb,OAAO,EAAE,MAAM,CAAC;IAGhB,OAAO,CAAC,EAAE,MAAM,CAAC;gBAGf,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB;CAMJ;AAED;;GAEG;AACH,qBAAa,oBAAoB,CAAC,CAAC,CAAE,SAAQ,cAAc,CAAC,GAAG,CAAC;IAE9D,IAAI,EAAE,MAAM,CAAY;IAGxB,GAAG,EAAE,MAAM,CAAa;IAgBxB,IAAI,EAAE;QACJ,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,WAAW,EAAE,MAAM,CAAC;QACpB,IAAI,EAAE,CAAC,EAAE,CAAC;KACX,CAAkF;IAGnF,QAAQ,CAAC,EAAE,MAAM,CAAC;gBAGhB,IAAI,EAAE,CAAC,EAAE,EACT,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE;QACR,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB;CAeJ"}
@@ -0,0 +1,146 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.PaginatedResponseDto = exports.ErrorResponseDto = exports.ApiResponseDto = void 0;
13
+ const swagger_1 = require("@nestjs/swagger");
14
+ const response_codes_1 = require("./response-codes");
15
+ /**
16
+ * 标准API响应格式
17
+ */
18
+ class ApiResponseDto {
19
+ code;
20
+ message;
21
+ data;
22
+ traceId;
23
+ constructor(partial) {
24
+ Object.assign(this, partial);
25
+ }
26
+ /**
27
+ * 创建成功响应
28
+ */
29
+ static success(data, message) {
30
+ return new ApiResponseDto({
31
+ code: response_codes_1.ResponseCode.SUCCESS,
32
+ message: message || (0, response_codes_1.getResponseMessage)(response_codes_1.ResponseCode.SUCCESS),
33
+ data: data,
34
+ });
35
+ }
36
+ /**
37
+ * 创建错误响应
38
+ */
39
+ static error(code, message, data) {
40
+ return new ApiResponseDto({
41
+ code: String(code),
42
+ message: message || (0, response_codes_1.getResponseMessage)(code),
43
+ ...(data === undefined ? {} : { data }),
44
+ });
45
+ }
46
+ }
47
+ exports.ApiResponseDto = ApiResponseDto;
48
+ __decorate([
49
+ (0, swagger_1.ApiProperty)({
50
+ description: '响应编码',
51
+ example: '000000',
52
+ default: '000000',
53
+ }),
54
+ __metadata("design:type", String)
55
+ ], ApiResponseDto.prototype, "code", void 0);
56
+ __decorate([
57
+ (0, swagger_1.ApiPropertyOptional)({ description: '响应消息', example: '操作成功' }),
58
+ __metadata("design:type", String)
59
+ ], ApiResponseDto.prototype, "message", void 0);
60
+ __decorate([
61
+ (0, swagger_1.ApiPropertyOptional)({ description: '响应数据' }),
62
+ __metadata("design:type", Object)
63
+ ], ApiResponseDto.prototype, "data", void 0);
64
+ __decorate([
65
+ (0, swagger_1.ApiPropertyOptional)({ description: '追踪ID' }),
66
+ __metadata("design:type", String)
67
+ ], ApiResponseDto.prototype, "traceId", void 0);
68
+ /**
69
+ * 错误响应格式
70
+ */
71
+ class ErrorResponseDto {
72
+ code;
73
+ message;
74
+ traceId;
75
+ constructor(code, message, options) {
76
+ this.code = code;
77
+ this.message = message;
78
+ this.traceId = options?.traceId;
79
+ }
80
+ }
81
+ exports.ErrorResponseDto = ErrorResponseDto;
82
+ __decorate([
83
+ (0, swagger_1.ApiProperty)({ description: '响应码', example: '000000' }),
84
+ __metadata("design:type", String)
85
+ ], ErrorResponseDto.prototype, "code", void 0);
86
+ __decorate([
87
+ (0, swagger_1.ApiProperty)({ description: '响应消息', example: 'Success' }),
88
+ __metadata("design:type", String)
89
+ ], ErrorResponseDto.prototype, "message", void 0);
90
+ __decorate([
91
+ (0, swagger_1.ApiPropertyOptional)({ description: '追踪ID' }),
92
+ __metadata("design:type", String)
93
+ ], ErrorResponseDto.prototype, "traceId", void 0);
94
+ /**
95
+ * 新的分页响应格式
96
+ */
97
+ class PaginatedResponseDto extends ApiResponseDto {
98
+ code = '000000';
99
+ msg = 'Success';
100
+ data = { totalCount: '0', pageSize: '0', totalPage: '0', currentPage: '0', list: [] };
101
+ ptraceId;
102
+ constructor(list, total, page, limit, options) {
103
+ super({});
104
+ this.code = options?.code || '000000';
105
+ this.msg = options?.msg || 'Success';
106
+ this.traceId = options?.traceId;
107
+ this.ptraceId = options?.ptraceId;
108
+ this.data = {
109
+ totalCount: total.toString(),
110
+ pageSize: limit.toString(),
111
+ totalPage: Math.ceil(total / limit).toString(),
112
+ currentPage: page.toString(),
113
+ list,
114
+ };
115
+ }
116
+ }
117
+ exports.PaginatedResponseDto = PaginatedResponseDto;
118
+ __decorate([
119
+ (0, swagger_1.ApiProperty)({ description: '响应码', example: '000000' }),
120
+ __metadata("design:type", String)
121
+ ], PaginatedResponseDto.prototype, "code", void 0);
122
+ __decorate([
123
+ (0, swagger_1.ApiProperty)({ description: '响应消息', example: 'Success' }),
124
+ __metadata("design:type", String)
125
+ ], PaginatedResponseDto.prototype, "msg", void 0);
126
+ __decorate([
127
+ (0, swagger_1.ApiProperty)({
128
+ description: '分页数据',
129
+ properties: {
130
+ totalCount: { type: 'string', description: '总记录数' },
131
+ pageSize: { type: 'string', description: '每页记录数' },
132
+ totalPage: { type: 'string', description: '总页数' },
133
+ currentPage: { type: 'string', description: '当前页码' },
134
+ list: {
135
+ type: 'array',
136
+ items: { type: 'object' },
137
+ description: '数据列表',
138
+ },
139
+ },
140
+ }),
141
+ __metadata("design:type", Object)
142
+ ], PaginatedResponseDto.prototype, "data", void 0);
143
+ __decorate([
144
+ (0, swagger_1.ApiPropertyOptional)({ description: '父追踪ID' }),
145
+ __metadata("design:type", String)
146
+ ], PaginatedResponseDto.prototype, "ptraceId", void 0);
@@ -0,0 +1,17 @@
1
+ import { NestInterceptor, ExecutionContext, CallHandler } from '@nestjs/common';
2
+ import { Observable } from 'rxjs';
3
+ /**
4
+ * 全局响应拦截器
5
+ * 统一格式化所有API响应
6
+ */
7
+ export declare class ResponseInterceptor implements NestInterceptor {
8
+ intercept(context: ExecutionContext, next: CallHandler): Observable<any>;
9
+ }
10
+ /**
11
+ * 创建响应拦截器提供者
12
+ */
13
+ export declare const ResponseInterceptorProvider: {
14
+ provide: string;
15
+ useClass: typeof ResponseInterceptor;
16
+ };
17
+ //# sourceMappingURL=response.interceptor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response.interceptor.d.ts","sourceRoot":"","sources":["../../src/restful/response.interceptor.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EACf,gBAAgB,EAChB,WAAW,EAGZ,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,UAAU,EAAc,MAAM,MAAM,CAAC;AAI9C;;;GAGG;AACH,qBACa,mBAAoB,YAAW,eAAe;IACzD,SAAS,CAAC,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,WAAW,GAAG,UAAU,CAAC,GAAG,CAAC;CAoEzE;AAED;;GAEG;AACH,eAAO,MAAM,2BAA2B;;;CAGvC,CAAC"}
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.ResponseInterceptorProvider = exports.ResponseInterceptor = void 0;
10
+ const common_1 = require("@nestjs/common");
11
+ const core_1 = require("@nestjs/core");
12
+ const rxjs_1 = require("rxjs");
13
+ const operators_1 = require("rxjs/operators");
14
+ const response_dto_1 = require("./response.dto");
15
+ /**
16
+ * 全局响应拦截器
17
+ * 统一格式化所有API响应
18
+ */
19
+ let ResponseInterceptor = class ResponseInterceptor {
20
+ intercept(context, next) {
21
+ const ctx = context.switchToHttp();
22
+ const response = ctx.getResponse();
23
+ return next.handle().pipe((0, operators_1.map)((data) => {
24
+ // 如果已经是 ApiResponseDto 格式,直接返回
25
+ if (data instanceof response_dto_1.ApiResponseDto || data instanceof response_dto_1.PaginatedResponseDto) {
26
+ return data;
27
+ }
28
+ // 处理分页数据格式
29
+ if (data && typeof data === 'object' && 'data' in data && 'meta' in data) {
30
+ const { data: items, meta } = data;
31
+ // 检查是否是分页格式 { data: [], meta: { total, page, limit, totalPages } }
32
+ if (Array.isArray(items) &&
33
+ meta &&
34
+ typeof meta === 'object' &&
35
+ 'total' in meta &&
36
+ 'page' in meta &&
37
+ 'limit' in meta) {
38
+ // 使用新的分页格式
39
+ return new response_dto_1.PaginatedResponseDto(items, meta.total, meta.page, meta.limit);
40
+ }
41
+ }
42
+ // 默认成功响应
43
+ return response_dto_1.ApiResponseDto.success(data);
44
+ }), (0, operators_1.catchError)((error) => {
45
+ let status = common_1.HttpStatus.INTERNAL_SERVER_ERROR;
46
+ let message = 'Internal server error';
47
+ let code = 'INTERNAL_ERROR';
48
+ // 处理 HttpException
49
+ if (error instanceof common_1.HttpException) {
50
+ status = error.getStatus();
51
+ const errorResponse = error.getResponse();
52
+ if (typeof errorResponse === 'string') {
53
+ message = errorResponse;
54
+ }
55
+ else if (typeof errorResponse === 'object') {
56
+ const errorObj = errorResponse;
57
+ message = errorObj.message || error.message;
58
+ code = errorObj.code || error.name;
59
+ return (0, rxjs_1.throwError)(() => new common_1.HttpException(errorResponse, status));
60
+ }
61
+ }
62
+ else {
63
+ // 处理其他错误
64
+ message = error.message || 'Unknown error';
65
+ code = error.name || 'UNKNOWN_ERROR';
66
+ }
67
+ // 设置HTTP状态码
68
+ response.status(status);
69
+ // 返回统一错误格式
70
+ const errorResponse = new response_dto_1.ErrorResponseDto(code, message);
71
+ // 返回标准的HttpException,但使用我们自定义的错误响应格式
72
+ return (0, rxjs_1.throwError)(() => new common_1.HttpException(errorResponse, status));
73
+ }));
74
+ }
75
+ };
76
+ exports.ResponseInterceptor = ResponseInterceptor;
77
+ exports.ResponseInterceptor = ResponseInterceptor = __decorate([
78
+ (0, common_1.Injectable)()
79
+ ], ResponseInterceptor);
80
+ /**
81
+ * 创建响应拦截器提供者
82
+ */
83
+ exports.ResponseInterceptorProvider = {
84
+ provide: core_1.APP_INTERCEPTOR,
85
+ useClass: ResponseInterceptor,
86
+ };
@@ -0,0 +1,5 @@
1
+ import { DynamicModule } from '@nestjs/common';
2
+ export declare class RestfulModule {
3
+ static forRoot(): DynamicModule;
4
+ }
5
+ //# sourceMappingURL=restful.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"restful.module.d.ts","sourceRoot":"","sources":["../../src/restful/restful.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAkB,MAAM,gBAAgB,CAAC;AAG/D,qBAEa,aAAa;IACxB,MAAM,CAAC,OAAO,IAAI,aAAa;CAOhC"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var RestfulModule_1;
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.RestfulModule = void 0;
11
+ const common_1 = require("@nestjs/common");
12
+ const response_interceptor_1 = require("./response.interceptor");
13
+ let RestfulModule = RestfulModule_1 = class RestfulModule {
14
+ static forRoot() {
15
+ return {
16
+ module: RestfulModule_1,
17
+ providers: [response_interceptor_1.ResponseInterceptor, response_interceptor_1.ResponseInterceptorProvider],
18
+ exports: [response_interceptor_1.ResponseInterceptor],
19
+ };
20
+ }
21
+ };
22
+ exports.RestfulModule = RestfulModule;
23
+ exports.RestfulModule = RestfulModule = RestfulModule_1 = __decorate([
24
+ (0, common_1.Global)(),
25
+ (0, common_1.Module)({})
26
+ ], RestfulModule);
@@ -0,0 +1,4 @@
1
+ export * from './sequelize.config';
2
+ export * from './sequelize.provider';
3
+ export * from './sequelize.module';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sequelize/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC"}