@celljs/web 4.2.0 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/README.md +48 -4
  2. package/cell.schema.json +266 -0
  3. package/cell.yml +12 -17
  4. package/esm/common/constants.d.ts +3 -3
  5. package/esm/common/constants.js +3 -3
  6. package/esm/common/constants.js.map +1 -1
  7. package/esm/node/body/body-middleware.js +1 -1
  8. package/esm/node/body/body-middleware.js.map +1 -1
  9. package/esm/node/body/body-parser.d.ts +5 -0
  10. package/esm/node/body/body-parser.js +7 -0
  11. package/esm/node/body/body-parser.js.map +1 -1
  12. package/esm/node/body/body-protocol.d.ts +1 -1
  13. package/esm/node/context.d.ts +4 -0
  14. package/esm/node/context.js +11 -11
  15. package/esm/node/context.js.map +1 -1
  16. package/esm/node/cookies/cookies-factory.js +2 -2
  17. package/esm/node/cookies/cookies-factory.js.map +1 -1
  18. package/esm/node/cookies/cookies-protocol.d.ts +1 -1
  19. package/esm/node/cookies/cookies-security-check.d.ts +13 -0
  20. package/esm/node/cookies/cookies-security-check.js +55 -0
  21. package/esm/node/cookies/cookies-security-check.js.map +1 -0
  22. package/esm/node/cookies/cookies.d.ts +1 -1
  23. package/esm/node/cookies/cookies.js +1 -1
  24. package/esm/node/cookies/index.d.ts +1 -0
  25. package/esm/node/cookies/index.js +1 -0
  26. package/esm/node/cookies/index.js.map +1 -1
  27. package/esm/node/cors/cors-middleware.d.ts +1 -1
  28. package/esm/node/cors/cors-middleware.js +1 -1
  29. package/esm/node/cors/cors-middleware.js.map +1 -1
  30. package/esm/node/cors/cors-protocol.d.ts +1 -1
  31. package/esm/node/dispatcher/dispatcher.d.ts +10 -0
  32. package/esm/node/dispatcher/dispatcher.js +36 -3
  33. package/esm/node/dispatcher/dispatcher.js.map +1 -1
  34. package/esm/node/error/error-handler-provider.d.ts +6 -2
  35. package/esm/node/error/error-handler-provider.js +17 -9
  36. package/esm/node/error/error-handler-provider.js.map +1 -1
  37. package/esm/node/error/error-message-resolver.d.ts +11 -0
  38. package/esm/node/error/error-message-resolver.js +43 -0
  39. package/esm/node/error/error-message-resolver.js.map +1 -0
  40. package/esm/node/error/error-protocol.d.ts +12 -2
  41. package/esm/node/error/error-protocol.js +3 -2
  42. package/esm/node/error/error-protocol.js.map +1 -1
  43. package/esm/node/error/error-response-util.d.ts +8 -0
  44. package/esm/node/error/error-response-util.js +24 -0
  45. package/esm/node/error/error-response-util.js.map +1 -0
  46. package/esm/node/error/http-error.d.ts +9 -1
  47. package/esm/node/error/http-error.js +6 -2
  48. package/esm/node/error/http-error.js.map +1 -1
  49. package/esm/node/error/index.d.ts +2 -0
  50. package/esm/node/error/index.js +2 -0
  51. package/esm/node/error/index.js.map +1 -1
  52. package/esm/node/health/health-executor.js +8 -12
  53. package/esm/node/health/health-executor.js.map +1 -1
  54. package/esm/node/health/health-middleware.js +1 -1
  55. package/esm/node/health/health-middleware.js.map +1 -1
  56. package/esm/node/matcher/request-matcher.js +2 -2
  57. package/esm/node/matcher/request-matcher.js.map +1 -1
  58. package/esm/node/session/session-manager.js +2 -2
  59. package/esm/node/session/session-manager.js.map +1 -1
  60. package/esm/node/session/session-middleware.js +1 -1
  61. package/esm/node/session/session-middleware.js.map +1 -1
  62. package/esm/node/session/session-store.js +1 -1
  63. package/esm/node/session/session-store.js.map +1 -1
  64. package/esm/node/session/session-strategy.js +1 -1
  65. package/esm/node/session/session-strategy.js.map +1 -1
  66. package/esm/node/session/session.d.ts +14 -2
  67. package/esm/node/session/session.js +33 -4
  68. package/esm/node/session/session.js.map +1 -1
  69. package/esm/node/trace/trace-id-resolver.js +2 -2
  70. package/esm/node/trace/trace-id-resolver.js.map +1 -1
  71. package/esm/node/trace/trace-protocol.d.ts +2 -2
  72. package/esm/node/trace/trace-protocol.js +2 -2
  73. package/esm/node/trace/trace-protocol.js.map +1 -1
  74. package/lib/common/constants.d.ts +3 -3
  75. package/lib/common/constants.d.ts.map +1 -1
  76. package/lib/common/constants.js +3 -3
  77. package/lib/common/constants.js.map +1 -1
  78. package/lib/node/body/body-middleware.js +1 -1
  79. package/lib/node/body/body-middleware.js.map +1 -1
  80. package/lib/node/body/body-parser.d.ts +5 -0
  81. package/lib/node/body/body-parser.d.ts.map +1 -1
  82. package/lib/node/body/body-parser.js +7 -0
  83. package/lib/node/body/body-parser.js.map +1 -1
  84. package/lib/node/body/body-protocol.d.ts +1 -1
  85. package/lib/node/body/body-protocol.d.ts.map +1 -1
  86. package/lib/node/context.d.ts +4 -0
  87. package/lib/node/context.d.ts.map +1 -1
  88. package/lib/node/context.js +11 -11
  89. package/lib/node/context.js.map +1 -1
  90. package/lib/node/context.spec.d.ts +2 -0
  91. package/lib/node/context.spec.d.ts.map +1 -0
  92. package/lib/node/context.spec.js +25 -0
  93. package/lib/node/context.spec.js.map +1 -0
  94. package/lib/node/cookies/cookies-factory.js +2 -2
  95. package/lib/node/cookies/cookies-factory.js.map +1 -1
  96. package/lib/node/cookies/cookies-protocol.d.ts +1 -1
  97. package/lib/node/cookies/cookies-protocol.d.ts.map +1 -1
  98. package/lib/node/cookies/cookies-security-check.d.ts +14 -0
  99. package/lib/node/cookies/cookies-security-check.d.ts.map +1 -0
  100. package/lib/node/cookies/cookies-security-check.js +58 -0
  101. package/lib/node/cookies/cookies-security-check.js.map +1 -0
  102. package/lib/node/cookies/cookies-security-check.spec.d.ts +2 -0
  103. package/lib/node/cookies/cookies-security-check.spec.d.ts.map +1 -0
  104. package/lib/node/cookies/cookies-security-check.spec.js +21 -0
  105. package/lib/node/cookies/cookies-security-check.spec.js.map +1 -0
  106. package/lib/node/cookies/cookies.d.ts +1 -1
  107. package/lib/node/cookies/cookies.js +1 -1
  108. package/lib/node/cookies/index.d.ts +1 -0
  109. package/lib/node/cookies/index.d.ts.map +1 -1
  110. package/lib/node/cookies/index.js +1 -0
  111. package/lib/node/cookies/index.js.map +1 -1
  112. package/lib/node/cors/cors-middleware.d.ts +1 -1
  113. package/lib/node/cors/cors-middleware.d.ts.map +1 -1
  114. package/lib/node/cors/cors-middleware.js +1 -1
  115. package/lib/node/cors/cors-middleware.js.map +1 -1
  116. package/lib/node/cors/cors-protocol.d.ts +1 -1
  117. package/lib/node/cors/cors-protocol.d.ts.map +1 -1
  118. package/lib/node/dispatcher/dispatcher.d.ts +10 -0
  119. package/lib/node/dispatcher/dispatcher.d.ts.map +1 -1
  120. package/lib/node/dispatcher/dispatcher.js +36 -3
  121. package/lib/node/dispatcher/dispatcher.js.map +1 -1
  122. package/lib/node/dispatcher/dispatcher.spec.d.ts +2 -0
  123. package/lib/node/dispatcher/dispatcher.spec.d.ts.map +1 -0
  124. package/lib/node/dispatcher/dispatcher.spec.js +105 -0
  125. package/lib/node/dispatcher/dispatcher.spec.js.map +1 -0
  126. package/lib/node/error/error-handler-provider.d.ts +6 -2
  127. package/lib/node/error/error-handler-provider.d.ts.map +1 -1
  128. package/lib/node/error/error-handler-provider.js +16 -8
  129. package/lib/node/error/error-handler-provider.js.map +1 -1
  130. package/lib/node/error/error-message-resolver.d.ts +12 -0
  131. package/lib/node/error/error-message-resolver.d.ts.map +1 -0
  132. package/lib/node/error/error-message-resolver.js +46 -0
  133. package/lib/node/error/error-message-resolver.js.map +1 -0
  134. package/lib/node/error/error-message-resolver.spec.d.ts +2 -0
  135. package/lib/node/error/error-message-resolver.spec.d.ts.map +1 -0
  136. package/lib/node/error/error-message-resolver.spec.js +42 -0
  137. package/lib/node/error/error-message-resolver.spec.js.map +1 -0
  138. package/lib/node/error/error-protocol.d.ts +12 -2
  139. package/lib/node/error/error-protocol.d.ts.map +1 -1
  140. package/lib/node/error/error-protocol.js +4 -3
  141. package/lib/node/error/error-protocol.js.map +1 -1
  142. package/lib/node/error/error-response-util.d.ts +9 -0
  143. package/lib/node/error/error-response-util.d.ts.map +1 -0
  144. package/lib/node/error/error-response-util.js +27 -0
  145. package/lib/node/error/error-response-util.js.map +1 -0
  146. package/lib/node/error/http-error.d.ts +9 -1
  147. package/lib/node/error/http-error.d.ts.map +1 -1
  148. package/lib/node/error/http-error.js +6 -2
  149. package/lib/node/error/http-error.js.map +1 -1
  150. package/lib/node/error/index.d.ts +2 -0
  151. package/lib/node/error/index.d.ts.map +1 -1
  152. package/lib/node/error/index.js +2 -0
  153. package/lib/node/error/index.js.map +1 -1
  154. package/lib/node/health/health-executor.d.ts.map +1 -1
  155. package/lib/node/health/health-executor.js +8 -12
  156. package/lib/node/health/health-executor.js.map +1 -1
  157. package/lib/node/health/health-executor.spec.d.ts +2 -0
  158. package/lib/node/health/health-executor.spec.d.ts.map +1 -0
  159. package/lib/node/health/health-executor.spec.js +44 -0
  160. package/lib/node/health/health-executor.spec.js.map +1 -0
  161. package/lib/node/health/health-middleware.js +1 -1
  162. package/lib/node/health/health-middleware.js.map +1 -1
  163. package/lib/node/matcher/request-matcher.js +2 -2
  164. package/lib/node/matcher/request-matcher.js.map +1 -1
  165. package/lib/node/session/session-manager.js +2 -2
  166. package/lib/node/session/session-manager.js.map +1 -1
  167. package/lib/node/session/session-middleware.js +1 -1
  168. package/lib/node/session/session-middleware.js.map +1 -1
  169. package/lib/node/session/session-store.js +1 -1
  170. package/lib/node/session/session-store.js.map +1 -1
  171. package/lib/node/session/session-strategy.js +1 -1
  172. package/lib/node/session/session-strategy.js.map +1 -1
  173. package/lib/node/session/session.d.ts +14 -2
  174. package/lib/node/session/session.d.ts.map +1 -1
  175. package/lib/node/session/session.js +33 -4
  176. package/lib/node/session/session.js.map +1 -1
  177. package/lib/node/session/session.spec.js +21 -0
  178. package/lib/node/session/session.spec.js.map +1 -1
  179. package/lib/node/trace/trace-id-resolver.js +1 -1
  180. package/lib/node/trace/trace-id-resolver.js.map +1 -1
  181. package/lib/node/trace/trace-protocol.d.ts +2 -2
  182. package/lib/node/trace/trace-protocol.d.ts.map +1 -1
  183. package/lib/node/trace/trace-protocol.js +2 -2
  184. package/lib/node/trace/trace-protocol.js.map +1 -1
  185. package/package.json +5 -4
  186. package/src/common/constants.ts +3 -3
  187. package/src/node/body/body-middleware.ts +1 -1
  188. package/src/node/body/body-parser.ts +8 -0
  189. package/src/node/body/body-protocol.ts +1 -1
  190. package/src/node/context.spec.ts +25 -0
  191. package/src/node/context.ts +9 -9
  192. package/src/node/cookies/cookies-factory.ts +2 -2
  193. package/src/node/cookies/cookies-protocol.ts +1 -1
  194. package/src/node/cookies/cookies-security-check.spec.ts +21 -0
  195. package/src/node/cookies/cookies-security-check.ts +44 -0
  196. package/src/node/cookies/cookies.ts +1 -1
  197. package/src/node/cookies/index.ts +1 -1
  198. package/src/node/cors/cors-middleware.ts +1 -1
  199. package/src/node/cors/cors-protocol.ts +1 -1
  200. package/src/node/dispatcher/dispatcher.spec.ts +110 -0
  201. package/src/node/dispatcher/dispatcher.ts +37 -4
  202. package/src/node/error/error-handler-provider.ts +17 -11
  203. package/src/node/error/error-message-resolver.spec.ts +44 -0
  204. package/src/node/error/error-message-resolver.ts +31 -0
  205. package/src/node/error/error-protocol.ts +14 -3
  206. package/src/node/error/error-response-util.ts +24 -0
  207. package/src/node/error/http-error.ts +14 -2
  208. package/src/node/error/index.ts +1 -1
  209. package/src/node/health/health-executor.spec.ts +40 -0
  210. package/src/node/health/health-executor.ts +8 -13
  211. package/src/node/health/health-middleware.ts +1 -1
  212. package/src/node/matcher/request-matcher.ts +2 -2
  213. package/src/node/session/session-manager.ts +2 -2
  214. package/src/node/session/session-middleware.ts +1 -1
  215. package/src/node/session/session-store.ts +1 -1
  216. package/src/node/session/session-strategy.ts +1 -1
  217. package/src/node/session/session.spec.ts +24 -0
  218. package/src/node/session/session.ts +41 -7
  219. package/src/node/trace/trace-id-resolver.ts +2 -2
  220. package/src/node/trace/trace-protocol.ts +2 -2
@@ -0,0 +1,46 @@
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.ErrorMessageResolverImpl = void 0;
13
+ const node_http_1 = require("node:http");
14
+ const core_1 = require("@celljs/core");
15
+ const http_error_1 = require("./http-error");
16
+ const error_protocol_1 = require("./error-protocol");
17
+ /**
18
+ * A 4xx `HttpError` (or one with `expose: true`) answers with its message. Any other error answers
19
+ * with the status text (`Internal Server Error`) in production, so that messages of internal errors
20
+ * (SQL, file paths, hosts) stay in the log; `web.errors.exposeMessages` decides otherwise.
21
+ */
22
+ let ErrorMessageResolverImpl = class ErrorMessageResolverImpl {
23
+ resolve(error) {
24
+ var _a;
25
+ const status = error instanceof http_error_1.HttpError ? error.statusCode : 500;
26
+ const statusText = (_a = node_http_1.STATUS_CODES[status]) !== null && _a !== void 0 ? _a : `HTTP ${status}`;
27
+ const exposed = (error instanceof http_error_1.HttpError && error.expose) || this.exposesMessages();
28
+ const message = error instanceof Error ? error.message : undefined;
29
+ return { status, message: exposed && message ? message : statusText };
30
+ }
31
+ exposesMessages() {
32
+ if (typeof this.exposeMessages === 'boolean') {
33
+ return this.exposeMessages;
34
+ }
35
+ return process.env.NODE_ENV !== 'production';
36
+ }
37
+ };
38
+ exports.ErrorMessageResolverImpl = ErrorMessageResolverImpl;
39
+ __decorate([
40
+ (0, core_1.Value)('web.errors.exposeMessages'),
41
+ __metadata("design:type", Boolean)
42
+ ], ErrorMessageResolverImpl.prototype, "exposeMessages", void 0);
43
+ exports.ErrorMessageResolverImpl = ErrorMessageResolverImpl = __decorate([
44
+ (0, core_1.Component)(error_protocol_1.ErrorMessageResolver)
45
+ ], ErrorMessageResolverImpl);
46
+ //# sourceMappingURL=error-message-resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-message-resolver.js","sourceRoot":"","sources":["../../../src/node/error/error-message-resolver.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAyC;AACzC,uCAAgD;AAChD,6CAAyC;AACzC,qDAAuE;AAEvE;;;;GAIG;AAEI,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAKjC,OAAO,CAAC,KAAc;;QAClB,MAAM,MAAM,GAAG,KAAK,YAAY,sBAAS,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC;QACnE,MAAM,UAAU,SAAG,wBAAY,CAAC,MAAM,CAAC,mCAAI,QAAQ,MAAM,EAAE,CAAC;QAC5D,MAAM,OAAO,GAAG,CAAC,KAAK,YAAY,sBAAS,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;QACvF,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;QACnE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;IAC1E,CAAC;IAES,eAAe;QACrB,IAAI,OAAO,IAAI,CAAC,cAAc,KAAK,SAAS,EAAE,CAAC;YAC3C,OAAO,IAAI,CAAC,cAAc,CAAC;QAC/B,CAAC;QACD,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,CAAC;IACjD,CAAC;CACJ,CAAA;;AAhBsB;IADlB,IAAA,YAAK,EAAC,2BAA2B,CAAC;;gEACS;mCAHnC,wBAAwB;IADpC,IAAA,gBAAS,EAAC,qCAAoB,CAAC;GACnB,wBAAwB,CAmBpC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=error-message-resolver.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-message-resolver.spec.d.ts","sourceRoot":"","sources":["../../../src/node/error/error-message-resolver.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const bun_test_1 = require("bun:test");
4
+ const chai_1 = require("chai");
5
+ const error_message_resolver_1 = require("./error-message-resolver");
6
+ const http_error_1 = require("./http-error");
7
+ const not_found_error_1 = require("./not-found-error");
8
+ const nodeEnv = process.env.NODE_ENV;
9
+ (0, bun_test_1.afterEach)(() => {
10
+ process.env.NODE_ENV = nodeEnv;
11
+ });
12
+ function resolver(exposeMessages) {
13
+ return Object.assign(new error_message_resolver_1.ErrorMessageResolverImpl(), { exposeMessages });
14
+ }
15
+ (0, bun_test_1.describe)('ErrorMessageResolverImpl', () => {
16
+ (0, bun_test_1.it)('sends the message of a 4xx HttpError, the status text of anything else in production', () => {
17
+ process.env.NODE_ENV = 'production';
18
+ (0, chai_1.expect)(resolver().resolve(new not_found_error_1.NotFoundError('no user 7'))).to.deep.equal({ status: 404, message: 'no user 7' });
19
+ (0, chai_1.expect)(resolver().resolve(new Error('ECONNREFUSED 10.0.0.5:5432'))).to.deep.equal({ status: 500, message: 'Internal Server Error' });
20
+ (0, chai_1.expect)(resolver().resolve(new http_error_1.HttpError(502, 'upstream 10.0.0.5 failed'))).to.deep.equal({ status: 502, message: 'Bad Gateway' });
21
+ (0, chai_1.expect)(resolver().resolve(new http_error_1.HttpError(503, 'Down for maintenance', { expose: true }))).to.deep.equal({ status: 503, message: 'Down for maintenance' });
22
+ });
23
+ (0, bun_test_1.it)('sends every message outside production, or when web.errors.exposeMessages says so', () => {
24
+ process.env.NODE_ENV = 'development';
25
+ (0, chai_1.expect)(resolver().resolve(new Error('boom')).message).to.equal('boom');
26
+ (0, chai_1.expect)(resolver(false).resolve(new Error('boom')).message).to.equal('Internal Server Error');
27
+ process.env.NODE_ENV = 'production';
28
+ (0, chai_1.expect)(resolver(true).resolve(new Error('boom')).message).to.equal('boom');
29
+ });
30
+ });
31
+ (0, bun_test_1.describe)('HttpError', () => {
32
+ (0, bun_test_1.it)('defaults the message to the status text and keeps the cause', () => {
33
+ const cause = new Error('EACCES /srv/app/secret');
34
+ const error = new http_error_1.HttpError(500, undefined, { cause });
35
+ (0, chai_1.expect)(error.message).to.equal('Internal Server Error');
36
+ (0, chai_1.expect)(error.cause).to.equal(cause);
37
+ (0, chai_1.expect)(error.expose).to.equal(false);
38
+ (0, chai_1.expect)(new not_found_error_1.NotFoundError().message).to.equal('Not Found');
39
+ (0, chai_1.expect)(new http_error_1.HttpError(404).expose).to.equal(true);
40
+ });
41
+ });
42
+ //# sourceMappingURL=error-message-resolver.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-message-resolver.spec.js","sourceRoot":"","sources":["../../../src/node/error/error-message-resolver.spec.ts"],"names":[],"mappings":";;AAAA,uCAAmD;AACnD,+BAA8B;AAC9B,qEAAoE;AACpE,6CAAyC;AACzC,uDAAkD;AAElD,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;AACrC,IAAA,oBAAS,EAAC,GAAG,EAAE;IACX,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,OAAO,CAAC;AACnC,CAAC,CAAC,CAAC;AAEH,SAAS,QAAQ,CAAC,cAAwB;IACtC,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,iDAAwB,EAAE,EAAE,EAAE,cAAc,EAAE,CAAC,CAAC;AAC7E,CAAC;AAED,IAAA,mBAAQ,EAAC,0BAA0B,EAAE,GAAG,EAAE;IACtC,IAAA,aAAE,EAAC,sFAAsF,EAAE,GAAG,EAAE;QAC5F,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,YAAY,CAAC;QACpC,IAAA,aAAM,EAAC,QAAQ,E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{ Context } from '../context';
2
2
  export declare const ErrorHandler: unique symbol;
3
- export declare const DEFALUT_ERROR_HANDLER_PRIORITY = 1;
3
+ export declare const ErrorMessageResolver: unique symbol;
4
+ export declare const DEFAULT_ERROR_HANDLER_PRIORITY = 1;
4
5
  export declare const HTTP_ERROR_HANDLER_PRIORITY: number;
5
6
  export declare const VALIDATION_ERRORS_ERROR_HANDLER_PRIORITY: number;
6
7
  export interface ErrorHandler {
7
8
  /**
8
- * The priority value must be greater than the default Error Handler's priority: DEFALUT_ERROR_HANDLER_PRIORITY, otherwise it will never be executed.
9
+ * The priority value must be greater than the default Error Handler's priority: DEFAULT_ERROR_HANDLER_PRIORITY, otherwise it will never be executed.
9
10
  */
10
11
  readonly priority: number;
11
12
  canHandle(ctx: Context, err: Error): Promise<boolean>;
12
13
  handle(ctx: Context, err: Error): Promise<void>;
13
14
  }
15
+ /** What the client is told about an error. */
16
+ export interface ErrorResponse {
17
+ status: number;
18
+ message: string;
19
+ }
20
+ /** Decides the status and the message an error answers with; error handlers and the mvc JSON view use it. */
21
+ export interface ErrorMessageResolver {
22
+ resolve(error: unknown): ErrorResponse;
23
+ }
14
24
  //# sourceMappingURL=error-protocol.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"error-protocol.d.ts","sourceRoot":"","sources":["../../../src/node/error/error-protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,eAAO,MAAM,YAAY,eAAyB,CAAC;AAEnD,eAAO,MAAM,8BAA8B,IAAI,CAAC;AAChD,eAAO,MAAM,2BAA2B,QAAuC,CAAC;AAChF,eAAO,MAAM,wCAAwC,QAAoC,CAAC;AAE1F,MAAM,WAAW,YAAY;IACzB;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACtD,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnD"}
1
+ {"version":3,"file":"error-protocol.d.ts","sourceRoot":"","sources":["../../../src/node/error/error-protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,eAAO,MAAM,YAAY,eAAyB,CAAC;AACnD,eAAO,MAAM,oBAAoB,eAAiC,CAAC;AAEnE,eAAO,MAAM,8BAA8B,IAAI,CAAC;AAChD,eAAO,MAAM,2BAA2B,QAAuC,CAAC;AAChF,eAAO,MAAM,wCAAwC,QAAoC,CAAC;AAE1F,MAAM,WAAW,YAAY;IACzB;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACtD,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnD;AACD,8CAA8C;AAC9C,MAAM,WAAW,aAAa;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,6GAA6G;AAC7G,MAAM,WAAW,oBAAoB;IACjC,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa,CAAC;CAC1C"}
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VALIDATION_ERRORS_ERROR_HANDLER_PRIORITY = exports.HTTP_ERROR_HANDLER_PRIORITY = exports.DEFALUT_ERROR_HANDLER_PRIORITY = exports.ErrorHandler = void 0;
3
+ exports.VALIDATION_ERRORS_ERROR_HANDLER_PRIORITY = exports.HTTP_ERROR_HANDLER_PRIORITY = exports.DEFAULT_ERROR_HANDLER_PRIORITY = exports.ErrorMessageResolver = exports.ErrorHandler = void 0;
4
4
  exports.ErrorHandler = Symbol('ErrorHandler');
5
- exports.DEFALUT_ERROR_HANDLER_PRIORITY = 1;
6
- exports.HTTP_ERROR_HANDLER_PRIORITY = exports.DEFALUT_ERROR_HANDLER_PRIORITY + 100;
5
+ exports.ErrorMessageResolver = Symbol('ErrorMessageResolver');
6
+ exports.DEFAULT_ERROR_HANDLER_PRIORITY = 1;
7
+ exports.HTTP_ERROR_HANDLER_PRIORITY = exports.DEFAULT_ERROR_HANDLER_PRIORITY + 100;
7
8
  exports.VALIDATION_ERRORS_ERROR_HANDLER_PRIORITY = exports.HTTP_ERROR_HANDLER_PRIORITY + 100;
8
9
  //# sourceMappingURL=error-protocol.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"error-protocol.js","sourceRoot":"","sources":["../../../src/node/error/error-protocol.ts"],"names":[],"mappings":";;;AAEa,QAAA,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAEtC,QAAA,8BAA8B,GAAG,CAAC,CAAC;AACnC,QAAA,2BAA2B,GAAG,QAAA,8BAA8B,GAAG,GAAG,CAAC;AACnE,QAAA,wCAAwC,GAAG,QAAA,2BAA2B,GAAG,GAAG,CAAC"}
1
+ {"version":3,"file":"error-protocol.js","sourceRoot":"","sources":["../../../src/node/error/error-protocol.ts"],"names":[],"mappings":";;;AAEa,QAAA,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AACtC,QAAA,oBAAoB,GAAG,MAAM,CAAC,sBAAsB,CAAC,CAAC;AAEtD,QAAA,8BAA8B,GAAG,CAAC,CAAC;AACnC,QAAA,2BAA2B,GAAG,QAAA,8BAA8B,GAAG,GAAG,CAAC;AACnE,QAAA,wCAAwC,GAAG,QAAA,2BAA2B,GAAG,GAAG,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { Context } from '../context';
2
+ export declare namespace ErrorResponseUtil {
3
+ /**
4
+ * Ends the response of a failed request with `status` and `body` (and `contentType` when given).
5
+ * A response the handler had already started is only ended; an ended one is left alone.
6
+ */
7
+ function end(ctx: Context, status: number, body: string, contentType?: string): void;
8
+ }
9
+ //# sourceMappingURL=error-response-util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-response-util.d.ts","sourceRoot":"","sources":["../../../src/node/error/error-response-util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,yBAAiB,iBAAiB,CAAC;IAE/B;;;OAGG;IACH,SAAgB,GAAG,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAc1F;CACJ"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ErrorResponseUtil = void 0;
4
+ var ErrorResponseUtil;
5
+ (function (ErrorResponseUtil) {
6
+ /**
7
+ * Ends the response of a failed request with `status` and `body` (and `contentType` when given).
8
+ * A response the handler had already started is only ended; an ended one is left alone.
9
+ */
10
+ function end(ctx, status, body, contentType) {
11
+ const { response } = ctx;
12
+ if (response.writableEnded) {
13
+ return;
14
+ }
15
+ if (response.headersSent) {
16
+ response.end();
17
+ return;
18
+ }
19
+ response.statusCode = status;
20
+ if (contentType) {
21
+ response.setHeader('Content-Type', contentType);
22
+ }
23
+ response.end(body);
24
+ }
25
+ ErrorResponseUtil.end = end;
26
+ })(ErrorResponseUtil || (exports.ErrorResponseUtil = ErrorResponseUtil = {}));
27
+ //# sourceMappingURL=error-response-util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-response-util.js","sourceRoot":"","sources":["../../../src/node/error/error-response-util.ts"],"names":[],"mappings":";;;AAEA,IAAiB,iBAAiB,CAqBjC;AArBD,WAAiB,iBAAiB;IAE9B;;;OAGG;IACH,SAAgB,GAAG,CAAC,GAAY,EAAE,MAAc,EAAE,IAAY,EAAE,WAAoB;QAChF,MAAM,EAAE,QAAQ,EAAE,GAAG,GAAG,CAAC;QACzB,IAAI,QAAQ,CAAC,aAAa,EAAE,CAAC;YACzB,OAAO;QACX,CAAC;QACD,IAAI,QAAQ,CAAC,WAAW,EAAE,CAAC;YACvB,QAAQ,CAAC,GAAG,EAAE,CAAC;YACf,OAAO;QACX,CAAC;QACD,QAAQ,CAAC,UAAU,GAAG,MAAM,CAAC;QAC7B,IAAI,WAAW,EAAE,CAAC;YACd,QAAQ,CAAC,SAAS,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;QACpD,CAAC;QACD,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAde,kBAAA,GAAG,MAclB,CAAA;AACL,CAAC,EArBgB,iBAAiB,aAAjB,iBAAiB,GAAjB,iBAAiB,QAqBjC"}
@@ -1,6 +1,14 @@
1
1
  import { CustomError } from '@celljs/core';
2
+ export interface HttpErrorOptions {
3
+ /** The error behind this one; logged with it, never sent. */
4
+ cause?: unknown;
5
+ /** Whether the client gets `message`; default: for 4xx, not for 5xx (see `web.errors.exposeMessages`). */
6
+ expose?: boolean;
7
+ }
8
+ /** An error that answers with `statusCode`. Without a message, the message is the status text (`Not Found`). */
2
9
  export declare class HttpError extends CustomError {
3
10
  statusCode: number;
4
- constructor(statusCode: number, message?: string);
11
+ readonly expose: boolean;
12
+ constructor(statusCode: number, message?: string, options?: HttpErrorOptions);
5
13
  }
6
14
  //# sourceMappingURL=http-error.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"http-error.d.ts","sourceRoot":"","sources":["../../../src/node/error/http-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,qBAAa,SAAU,SAAQ,WAAW;IAEnB,UAAU,EAAE,MAAM;IAArC,YAAmB,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAEtD;CAEJ"}
1
+ {"version":3,"file":"http-error.d.ts","sourceRoot":"","sources":["../../../src/node/error/http-error.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,WAAW,gBAAgB;IAC7B,6DAA6D;IAC7D,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,0GAA0G;IAC1G,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,gHAAgH;AAChH,qBAAa,SAAU,SAAQ,WAAW;IAInB,UAAU,EAAE,MAAM;IAFrC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IAEzB,YAAmB,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,EAGtF;CAEJ"}
@@ -1,11 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HttpError = void 0;
4
+ const node_http_1 = require("node:http");
4
5
  const core_1 = require("@celljs/core");
6
+ /** An error that answers with `statusCode`. Without a message, the message is the status text (`Not Found`). */
5
7
  class HttpError extends core_1.CustomError {
6
- constructor(statusCode, message) {
7
- super(message);
8
+ constructor(statusCode, message, options = {}) {
9
+ var _a, _b;
10
+ super((_a = message !== null && message !== void 0 ? message : node_http_1.STATUS_CODES[statusCode]) !== null && _a !== void 0 ? _a : `HTTP ${statusCode}`, options.cause === undefined ? undefined : { cause: options.cause });
8
11
  this.statusCode = statusCode;
12
+ this.expose = (_b = options.expose) !== null && _b !== void 0 ? _b : statusCode < 500;
9
13
  }
10
14
  }
11
15
  exports.HttpError = HttpError;
@@ -1 +1 @@
1
- {"version":3,"file":"http-error.js","sourceRoot":"","sources":["../../../src/node/error/http-error.ts"],"names":[],"mappings":";;;AAAA,uCAA2C;AAE3C,eAAuB,SAAQ,kBAAW;IAEtC,YAAmB,UAAkB,EAAE,OAAgB;QACnD,KAAK,CAAC,OAAO,CAAC,CAAC;0BADA,UAAU;IAE7B,CAAC;CAEJ"}
1
+ {"version":3,"file":"http-error.js","sourceRoot":"","sources":["../../../src/node/error/http-error.ts"],"names":[],"mappings":";;;AAAA,yCAAyC;AACzC,uCAA2C;AAS3C,gHAAgH;AAChH,eAAuB,SAAQ,kBAAW;IAItC,YAAmB,UAAkB,EAAE,OAAgB,EAAE,OAAO,GAAqB,EAAE;;QACnF,KAAK,OAAC,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,wBAAY,CAAC,UAAU,CAAC,mCAAI,QAAQ,UAAU,EAAE,EAAE,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;0BADxH,UAAU;QAEzB,IAAI,CAAC,MAAM,SAAG,OAAO,CAAC,MAAM,mCAAI,UAAU,GAAG,GAAG,CAAC;IACrD,CAAC;CAEJ"}
@@ -2,4 +2,6 @@ export * from './http-error';
2
2
  export * from './error-handler-provider';
3
3
  export * from './error-protocol';
4
4
  export * from './not-found-error';
5
+ export * from './error-message-resolver';
6
+ export * from './error-response-util';
5
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/error/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/error/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAAA,cAAc,0BAA0B,CAAC;AAAA,cAAc,uBAAuB,CAAC"}
@@ -18,4 +18,6 @@ __exportStar(require("./http-error"), exports);
18
18
  __exportStar(require("./error-handler-provider"), exports);
19
19
  __exportStar(require("./error-protocol"), exports);
20
20
  __exportStar(require("./not-found-error"), exports);
21
+ __exportStar(require("./error-message-resolver"), exports);
22
+ __exportStar(require("./error-response-util"), exports);
21
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/error/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,2DAAyC;AACzC,mDAAiC;AACjC,oDAAkC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/error/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,2DAAyC;AACzC,mDAAiC;AACjC,oDAAkC;AAAA,2DAAyC;AAAA,wDAAsC"}
@@ -1 +1 @@
1
- {"version":3,"file":"health-executor.d.ts","sourceRoot":"","sources":["../../../src/node/health/health-executor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmB,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAE9H,qBACa,kBAAmB,YAAW,cAAc;IAGrD,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,eAAe,EAAE,CAAC;IAGvD,SAAS,CAAC,QAAQ,CAAC,sBAAsB,EAAE,sBAAsB,CAAC;IAElE,SAAS,CAAC,sBAAsB,CAAC,eAAe,EAAE,eAAe,GAAG,MAAM,GAAG,SAAS,CAErF;IAEK,OAAO,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CA8B9D;CAEJ"}
1
+ {"version":3,"file":"health-executor.d.ts","sourceRoot":"","sources":["../../../src/node/health/health-executor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmB,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAE9H,qBACa,kBAAmB,YAAW,cAAc;IAGrD,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,eAAe,EAAE,CAAC;IAGvD,SAAS,CAAC,QAAQ,CAAC,sBAAsB,EAAE,sBAAsB,CAAC;IAElE,SAAS,CAAC,sBAAsB,CAAC,eAAe,EAAE,eAAe,GAAG,MAAM,GAAG,SAAS,CAErF;IAEK,OAAO,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAyB9D;CAEJ"}
@@ -29,19 +29,15 @@ let HealthExecutorImpl = class HealthExecutorImpl {
29
29
  }
30
30
  throw new health_errors_1.HealthNotFoundError(indicatorName, `Health indicator ${indicatorName} not found`);
31
31
  }
32
+ // Each indicator is checked once, all at the same time; the components keep the order of the indicators.
33
+ const named = this.healthIndicators
34
+ .map(indicator => ({ indicator, name: this.getHealthIndicatorName(indicator) }))
35
+ .filter((entry) => !!entry.name);
36
+ const healths = await Promise.all(named.map(({ indicator }) => indicator.health()));
32
37
  const components = {};
33
- for (const healthIndicator of this.healthIndicators) {
34
- const name = this.getHealthIndicatorName(healthIndicator);
35
- if (name) {
36
- components[name.toLowerCase().replace('healthindicator', '')] = await healthIndicator.health();
37
- }
38
- }
39
- await Promise.all(this.healthIndicators.map(async (h) => {
40
- const name = this.getHealthIndicatorName(h);
41
- if (name) {
42
- components[name.toLowerCase().replace('healthindicator', '')] = await h.health();
43
- }
44
- }));
38
+ named.forEach(({ name }, index) => {
39
+ components[name.replace('healthindicator', '')] = healths[index];
40
+ });
45
41
  return {
46
42
  status: this.healthStatusAggregator.aggregate(Object.values(components).map(c => c.status)),
47
43
  components
@@ -1 +1 @@
1
- {"version":3,"file":"health-executor.js","sourceRoot":"","sources":["../../../src/node/health/health-executor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAoE;AACpE,mDAAsD;AACtD,uDAA8H;AAGvH,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAQjB,sBAAsB,CAAC,eAAgC;;QAC7D,OAAO,MAAA,MAAA,IAAA,qBAAc,EAAC,eAAe,CAAC,0CAAE,IAAI,0CAAE,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
1
+ {"version":3,"file":"health-executor.spec.d.ts","sourceRoot":"","sources":["../../../src/node/health/health-executor.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const bun_test_1 = require("bun:test");
4
+ const chai_1 = require("chai");
5
+ const health_executor_1 = require("./health-executor");
6
+ const health_status_aggregator_1 = require("./health-status-aggregator");
7
+ const health_protocol_1 = require("./health-protocol");
8
+ class CountingHealthIndicator {
9
+ constructor(status, wait = 0) {
10
+ this.status = status;
11
+ this.wait = wait;
12
+ this.calls = 0;
13
+ }
14
+ async health() {
15
+ this.calls++;
16
+ await new Promise(resolve => setTimeout(resolve, this.wait));
17
+ return { status: this.status };
18
+ }
19
+ }
20
+ class DbHealthIndicator extends CountingHealthIndicator {
21
+ }
22
+ class DiskHealthIndicator extends CountingHealthIndicator {
23
+ }
24
+ function executor(...indicators) {
25
+ return Object.assign(new health_executor_1.HealthExecutorImpl(), { healthIndicators: indicators, healthStatusAggregator: new health_status_aggregator_1.HealthStatusAggregatorImpl() });
26
+ }
27
+ (0, bun_test_1.describe)('HealthExecutorImpl', () => {
28
+ (0, bun_test_1.it)('checks each indicator once and keeps their order, whichever answers first', async () => {
29
+ const db = new DbHealthIndicator(health_protocol_1.HealthStatus.UP, 10);
30
+ const disk = new DiskHealthIndicator(health_protocol_1.HealthStatus.DOWN);
31
+ const result = await executor(db, disk).execute();
32
+ (0, chai_1.expect)([db.calls, disk.calls]).to.deep.equal([1, 1]);
33
+ (0, chai_1.expect)(Object.keys(result.components)).to.deep.equal(['db', 'disk']);
34
+ (0, chai_1.expect)(result.components.disk.status).to.equal(health_protocol_1.HealthStatus.DOWN);
35
+ (0, chai_1.expect)(result.status).to.equal(health_protocol_1.HealthStatus.DOWN);
36
+ });
37
+ (0, bun_test_1.it)('checks only the indicator asked for by name', async () => {
38
+ const db = new DbHealthIndicator(health_protocol_1.HealthStatus.UP);
39
+ const disk = new DiskHealthIndicator(health_protocol_1.HealthStatus.UP);
40
+ (0, chai_1.expect)((await executor(db, disk).execute('disk')).status).to.equal(health_protocol_1.HealthStatus.UP);
41
+ (0, chai_1.expect)([db.calls, disk.calls]).to.deep.equal([0, 1]);
42
+ });
43
+ });
44
+ //# sourceMappingURL=health-executor.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"health-executor.spec.js","sourceRoot":"","sources":["../../../src/node/health/health-executor.spec.ts"],"names":[],"mappings":";;AAAA,uCAAwC;AACxC,+BAA8B;AAC9B,uDAAuD;AACvD,yEAAwE;AACxE,uDAA0E;AAE1E,MAAM,uBAAuB;IAEzB,YAA+B,MAAoB,EAAqB,IAAI,GAAG,CAAC;QAAjD,WAAM,GAAN,MAAM,CAAc;QAAqB,SAAI,GAAJ,IAAI,CAAI;QADhF,UAAK,GAAG,CAAC,CAAC;IAC0E,CAAC;IACrF,KAAK,CAAC,MAAM;QACR,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC7D,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;IACnC,CAAC;CACJ;AACD,MAAM,iBAAkB,SAAQ,uBAAuB;CAAI;AAC3D,MAAM,mBAAoB,SAAQ,uBAAuB;CAAI;AAE7D,SAAS,QAAQ,CAAC,GAAG,UAA6B;IAC9C,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,oCAAkB,EAAE,EAAE,EAAE,gBAAgB,EAAE,UAAU,EAAE,sBAAsB,EAAE,IAAI,qDAA0B,EAAE,EAAE,CAAC,CAAC;AAC/I,CAAC;AAED,IAAA,mBAAQ,EAAC,oBAAoB,EAAE,GAAG,EAAE;IAChC,IAAA,aAAE,EAAC,2EAA2E,EAAE,KAAK,IAAI,EAAE;QACvF,MAAM,EAAE,GAAG,IAAI,iBAAiB,C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AC,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -59,7 +59,7 @@ __decorate([
59
59
  __metadata("design:type", Object)
60
60
  ], HealthMiddleware.prototype, "pathResolver", void 0);
61
61
  __decorate([
62
- (0, core_1.Value)('cell.health'),
62
+ (0, core_1.Value)('web.health'),
63
63
  __metadata("design:type", Object)
64
64
  ], HealthMiddleware.prototype, "healthOptions", void 0);
65
65
  exports.HealthMiddleware = HealthMiddleware = __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"health-middleware.js","sourceRoot":"","sources":["../../../src/node/health/health-middleware.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAA2C;AAE3C,uCAA2D;AAC3D,uDAA8F;AAC9F,oCAAyC;AACzC,wCAA4C;AAC5C,oDAAqD;AACrD,uCAAsD;AAG/C,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAAtB;QAsCM,aAAQ,GAAG,4CAA0B,CAAC;IAEnD,CAAC;IA1BG,KAAK,CAAC,MAAM,CAAC,GAAY,EAAE,IAAyB;QAChD,IAAI,CAAC;YACD,MAAM,IAAI,EAAE,CAAC;QACjB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,MAAM,EAAE,QAAQ,EAAE,GAAG,GAAG,CAAC;YACzB,IAAI,KAAK,YAAY,qBAAa,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE,CAAC;gBAC5D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;gBAClC,IAAI,MAAM,EAAE,CAAC;oBACT,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;oBACvE,QAAQ,CAAC,UAA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+20,7 @@ let RequestMatcherImpl = class RequestMatcherImpl {
20
20
  }
21
21
  async match(pattern, method) {
22
22
  const request = context_1.Context.getRequest();
23
- if (method && request.method && method.toUpperCase() !== request.method.toUpperCase()) {
23
+ if (method && request.method && method !== request.method && method.toUpperCase() !== request.method.toUpperCase()) {
24
24
  return false;
25
25
  }
26
26
  pattern = pattern || '/';
@@ -42,7 +42,7 @@ let RequestMatcherImpl = class RequestMatcherImpl {
42
42
  };
43
43
  exports.RequestMatcherImpl = RequestMatcherImpl;
44
44
  __decorate([
45
- (0, core_1.Value)('cell.web.route.cacheSize'),
45
+ (0, core_1.Value)('web.route.cacheSize'),
46
46
  __metadata("design:type", Number)
47
47
  ], RequestMatcherImpl.prototype, "cacheSize", void 0);
48
48
  exports.RequestMatcherImpl = RequestMatcherImpl = __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"request-matcher.js","sourceRoot":"","sources":["../../../src/node/matcher/request-matcher.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAAoD;AACpD,wCAAqC;AACrC,uCAAgD;AAChD,iDAA6C;AAGtC,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAAxB;QACO,WAAM,GAA6B,IAAI,GAAG,EAAuB,CAAC;IA0BhF,CAAC;IArBG,KAAK,CAAC,KAAK,CAAC,OAAY,EAAE,MAAe;QACrC,MAAM,OAAO,GAAG,iBAAO,CAAC,UAAU,EAAE,CAAC;QACrC,IAAI,MAAM,IAAI,OAAO,CAAC,MAAM,IAAI,MAAM,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,CAAC;YACpF,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,OAAO,GAAG,OAAO,IAAI,GAAG,CAAC;QACzB,IAAI,WAAoC,CAAC;QACzC,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAC9B,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,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AI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAC9B,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACvC,IAAI,CAAC,WAAW,EAAE,CAAC;gBACf,WAAW,GAAG,IAAI,0BAAW,CAAC,OAAO,CAAC,CAAC;gBACvC,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;oBACpC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;gBAC1C,CAAC;YACL,CAAC;QACL,CAAC;aAAM,CAAC;YACJ,WAAW,GAAG,IAAI,0BAAW,CAAC,OAAO,CAAC,CAAC;QAC3C,CAAC;QACD,OAAO,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;CAEJ,CAAA;;AAvBsB;IADlB,IAAA,YAAK,EAAC,qBAAqB,CAAC;;qDACQ;6BAJ5B,kBAAkB;IAD9B,IAAA,gBAAS,EAAC,iCAAc,CAAC;GACb,kBAAkB,CA2B9B"}
@@ -53,11 +53,11 @@ let SessionManagerImpl = class SessionManagerImpl {
53
53
  };
54
54
  exports.SessionManagerImpl = SessionManagerImpl;
55
55
  __decorate([
56
- (0, core_1.Value)('cell.session.sessionIdKey'),
56
+ (0, core_1.Value)('web.session.sessionIdKey'),
57
57
  __metadata("design:type", String)
58
58
  ], SessionManagerImpl.prototype, "sessionIdKey", void 0);
59
59
  __decorate([
60
- (0, core_1.Value)('cell.session'),
60
+ (0, core_1.Value)('web.session'),
61
61
  __metadata("design:type", Object)
62
62
  ], SessionManagerImpl.prototype, "sessionOptions", void 0);
63
63
  __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"session-manager.js","sourceRoot":"","sources":["../../../src/node/session/session-manager.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAA6G;AAC7G,uCAA2D;AAC3D,wCAAqC;AAG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DACyB;AAGjC;IADlB,IAAA,gBAAS,EAAC,+BAAY,CAAC;;wDACsB;6BAZrC,kBAAkB;IAD9B,IAAA,gBAAS,EAAC,iCAAc,CAAC;GACb,kBAAkB,CAsD9B"}
@@ -36,7 +36,7 @@ __decorate([
36
36
  __metadata("design:type", Object)
37
37
  ], SessionMiddleware.prototype, "sessionManager", void 0);
38
38
  __decorate([
39
- (0, core_1.Value)('cell.session'),
39
+ (0, core_1.Value)('web.session'),
40
40
  __metadata("design:type", Object)
41
41
  ], SessionMiddleware.prototype, "sessionOptions", void 0);
42
42
  exports.SessionMiddleware = SessionMiddleware = __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"session-middleware.js","sourceRoot":"","sources":["../../../src/node/session/session-middleware.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAA2C;AAC3C,wCAAqC;AACrC,uCAA2D;AAC3D,yDAAiF;AAG1E,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAAvB;QAmBM,aAAQ,GAAG,8CAA2B,CAAC;IAEpD,CAAC;IAbG,KAAK,CAAC,MAAM,CAAC,GAAY,EAAE,IAAyB;QAChD,iBAAO,CAAC,UAAU,CAAC,MAAM,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,CAAC,CAAC;QACpD,IAAI,CAAC;YACD,MAAM,IAAI,EAAE,CAAC;QACjB,CAAC;gBAAS,CAAC;YACP,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,CAAC;gBACjC,MAAM,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC;YACvC,CAAC;QACL,CAAC;IACL,CAAC;CAIJ,CAAA;;AAlBsB;IADlB,IAAA,gBAAS,EAAC,iCAAc,CAAC;;yDACwB;AAG/B;IADlB,IAAA,YAAK,EAAC,cAAc,CAAC;;yDACiB;4BAN9B,iBAAiB;IAD7B,IAAA,gBAAS,EAAC,uBAAU,CAAC;GACT,iBAAiB,CAqB7B"}
1
+ {"version":3,"file":"session-middleware.js","sourceRoot":"","sources":["../../../src/node/session/session-middleware.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAA2C;AAC3C,wCAAqC;AACrC,uCAA2D;AAC3D,yDAAiF;AAG1E,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAAvB;QAmBM,aAAQ,GAAG,8CAA2B,CAAC;IAEpD,CAAC;IAbG,KAAK,CAAC,MAAM,CAAC,GAAY,EAAE,IAAyB;QAChD,iBAAO,CAAC,UAAU,CAAC,MAAM,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,CAAC,CAAC;QACpD,IAAI,CAAC;YACD,MAAM,IAAI,EAAE,CAAC;QACjB,CAAC;gBAAS,CAAC;YACP,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,CAAC;gBACjC,MAAM,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC;YACvC,CAAC;QACL,CAAC;IACL,CAAC;CAIJ,CAAA;;AAlBsB;IADlB,IAAA,gBAAS,EAAC,iCAAc,CAAC;;yDACwB;AAG/B;IADlB,IAAA,YAAK,EAAC,aAAa,CAAC;;yDACkB;4BAN9B,iBAAiB;IAD7B,IAAA,gBAAS,EAAC,uBAAU,CAAC;GACT,iBAAiB,CAqB7B"}
@@ -42,7 +42,7 @@ let CookieSessionStore = class CookieSessionStore {
42
42
  };
43
43
  exports.CookieSessionStore = CookieSessionStore;
44
44
  __decorate([
45
- (0, core_1.Value)('cell.session'),
45
+ (0, core_1.Value)('web.session'),
46
46
  __metadata("design:type", Object)
47
47
  ], CookieSessionStore.prototype, "sessionOptions", void 0);
48
48
  __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"session-store.js","sourceRoot":"","sources":["../../../src/node/session/session-store.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAA6F;AAC7F,uCAAmE;AACnE,wCAAqC;AACrC,yCAAsC;AACtC,yCAAyD;AAEzD,MAAM,IAAI,GAAG,IAAA,qBAAS,EAAC,gBAAY,CAAC,CA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CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QAChE,iBAAO,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IACjH,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU;QACnB,iBAAO,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,EAAE,EAAE;YACzD,OAAO,EAAE,kCAAe;SAC3B,CAAC,CAAC;IACP,CAAC;CAEJ,CAAA;;AAhCsB;IADlB,IAAA,YAAK,EAAC,aAAa,CAAC;;0DACkB;AAGpB;IADlB,IAAA,gBAAS,EAAC,kCAAe,CAAC;;2DACyB;AAGjC;IADlB,IAAA,gBAAS,EAAC,aAAM,CAAC;;kDACgB;6BAXzB,kBAAkB;IAD9B,IAAA,gBAAS,EAAC,+BAAY,CAAC;GACX,kBAAkB,CAqC9B"}
@@ -41,7 +41,7 @@ let SessionStrategyImpl = class SessionStrategyImpl {
41
41
  };
42
42
  exports.SessionStrategyImpl = SessionStrategyImpl;
43
43
  __decorate([
44
- (0, core_1.Value)('cell.session'),
44
+ (0, core_1.Value)('web.session'),
45
45
  __metadata("design:type", Object)
46
46
  ], SessionStrategyImpl.prototype, "sessionOptions", void 0);
47
47
  exports.SessionStrategyImpl = SessionStrategyImpl = __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"session-strategy.js","sourceRoot":"","sources":["../../../src/node/session/session-strategy.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAA8D;AAC9D,uCAAwC;AACxC,uCAAgD;AAGzC,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAK5B,KAAK,CAAC,KAAK,CAAC,OAAgB;QACxB,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;YAChD,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,CAAC,GAAS;QACZ,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,qBAAW,CAAC,IAAI,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC,CAAC;IACtE,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,OAAgB;QACpC,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YAClB,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,8CAA8C;QAC9C,IAAI,IAAI,CAAC,cAAc,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;YACrC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YAC9B,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YAC9B,gDAAgD;YAChD,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,MAAM,GAAG,CAAC,EAAE,CAAC;gBACvD,OAAO,IAAI,CAAC;YAChB,CAAC;QACL,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ,CAAA;;AA5BsB;IADlB,IAAA,YAAK,EAAC,cAAc,CAAC;;2DACiB;8BAH9B,mBAAmB;IAD/B,IAAA,gBAAS,EAAC,kCAAe,CAAC;GACd,mBAAmB,CA+B/B"}
1
+ {"version":3,"file":"session-strategy.js","sourceRoot":"","sources":["../../../src/node/session/session-strategy.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAA8D;AAC9D,uCAAwC;AACxC,uCAAgD;AAGzC,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAK5B,KAAK,CAAC,KAAK,CAAC,OAAgB;QACxB,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;YAChD,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,CAAC,GAAS;QACZ,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,qBAAW,CAAC,IAAI,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC,CAAC;IACtE,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,OAAgB;QACpC,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YAClB,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,8CAA8C;QAC9C,IAAI,IAAI,CAAC,cAAc,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;YACrC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YAC9B,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YAC9B,gDAAgD;YAChD,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,MAAM,GAAG,CAAC,EAAE,CAAC;gBACvD,OAAO,IAAI,CAAC;YAChB,CAAC;QACL,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ,CAAA;;AA5BsB;IADlB,IAAA,YAAK,EAAC,aAAa,CAAC;;2DACkB;8BAH9B,mBAAmB;IAD/B,IAAA,gBAAS,EAAC,kCAAe,CAAC;GACd,mBAAmB,CA+B/B"}
@@ -1,14 +1,26 @@
1
1
  import { Session } from './session-protocol';
2
2
  export declare class SessionImpl implements Session {
3
+ /** From node:crypto: a session id must be unguessable on every runtime (Node.js 18 has no global `crypto`). */
3
4
  readonly id: string;
4
5
  isNew: boolean;
5
6
  expire: number;
6
7
  maxAge: number;
7
- /** The serialized values when the session was created or restored, to tell whether it changed. */
8
- protected _snapshot: string;
8
+ /** The serialized values of a restored session, to tell whether it changed. */
9
+ protected _snapshot?: string;
10
+ /** `expire` and `maxAge` of a new session as created. */
11
+ protected _created?: {
12
+ id: string;
13
+ expire: number;
14
+ maxAge: number;
15
+ };
16
+ /**
17
+ * Every request without a session gets a new one, so a new session is cheap: no serialization, and
18
+ * `changed` compares its few values instead of JSON. A restored session is serialized once to compare.
19
+ */
9
20
  constructor(sessionOptions: any, obj?: any);
10
21
  protected serialize(): string;
11
22
  toJSON(): any;
23
+ /** Whether the serialized session differs from the one created or restored. */
12
24
  get changed(): boolean;
13
25
  }
14
26
  //# sourceMappingURL=session.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/node/session/session.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,qBAAa,WAAY,YAAW,OAAO;IACvC,QAAQ,CAAC,EAAE,SAAmB;IAC9B,KAAK,UAAQ;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,kGAAkG;IAClG,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC;IAC5B,YAAY,cAAc,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAWzC;IAED,SAAS,CAAC,SAAS,IAAI,MAAM,CAE5B;IAED,MAAM,IAAI,GAAG,CAQZ;IAED,IAAI,OAAO,YAEV;CAEJ"}
1
+ {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/node/session/session.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAO7C,qBAAa,WAAY,YAAW,OAAO;IACvC,+GAA+G;IAC/G,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,KAAK,UAAQ;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,+EAA+E;IAC/E,SAAS,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC7B,yDAAyD;IACzD,SAAS,CAAC,QAAQ,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAEpE;;;OAGG;IACH,YAAY,cAAc,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAazC;IAED,SAAS,CAAC,SAAS,IAAI,MAAM,CAE5B;IAED,MAAM,IAAI,GAAG,CAQZ;IAED,+EAA+E;IAC/E,IAAI,OAAO,IAAI,OAAO,CAoBrB;CAEJ"}