@monorise/core 3.0.0 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (206) hide show
  1. package/dist/index.d.ts +4759 -27
  2. package/dist/index.js +7940 -31
  3. package/dist/index.js.map +1 -1
  4. package/package.json +4 -4
  5. package/dist/configs/service.config.d.ts +0 -5
  6. package/dist/configs/service.config.d.ts.map +0 -1
  7. package/dist/configs/service.config.js +0 -5
  8. package/dist/configs/service.config.js.map +0 -1
  9. package/dist/constants/table.d.ts +0 -3
  10. package/dist/constants/table.d.ts.map +0 -1
  11. package/dist/constants/table.js +0 -3
  12. package/dist/constants/table.js.map +0 -1
  13. package/dist/controllers/entity/create-entity.controller.d.ts +0 -7
  14. package/dist/controllers/entity/create-entity.controller.d.ts.map +0 -1
  15. package/dist/controllers/entity/create-entity.controller.js +0 -64
  16. package/dist/controllers/entity/create-entity.controller.js.map +0 -1
  17. package/dist/controllers/entity/delete-entity.controller.d.ts +0 -7
  18. package/dist/controllers/entity/delete-entity.controller.d.ts.map +0 -1
  19. package/dist/controllers/entity/delete-entity.controller.js +0 -38
  20. package/dist/controllers/entity/delete-entity.controller.js.map +0 -1
  21. package/dist/controllers/entity/get-entity-by-unique-field-value.controller.d.ts +0 -7
  22. package/dist/controllers/entity/get-entity-by-unique-field-value.controller.d.ts.map +0 -1
  23. package/dist/controllers/entity/get-entity-by-unique-field-value.controller.js +0 -36
  24. package/dist/controllers/entity/get-entity-by-unique-field-value.controller.js.map +0 -1
  25. package/dist/controllers/entity/get-entity.controller.d.ts +0 -7
  26. package/dist/controllers/entity/get-entity.controller.d.ts.map +0 -1
  27. package/dist/controllers/entity/get-entity.controller.js +0 -37
  28. package/dist/controllers/entity/get-entity.controller.js.map +0 -1
  29. package/dist/controllers/entity/list-entities.controller.d.ts +0 -7
  30. package/dist/controllers/entity/list-entities.controller.d.ts.map +0 -1
  31. package/dist/controllers/entity/list-entities.controller.js +0 -61
  32. package/dist/controllers/entity/list-entities.controller.js.map +0 -1
  33. package/dist/controllers/entity/update-entity.controller.d.ts +0 -7
  34. package/dist/controllers/entity/update-entity.controller.d.ts.map +0 -1
  35. package/dist/controllers/entity/update-entity.controller.js +0 -62
  36. package/dist/controllers/entity/update-entity.controller.js.map +0 -1
  37. package/dist/controllers/entity/upsert-entity.controller.d.ts +0 -11
  38. package/dist/controllers/entity/upsert-entity.controller.d.ts.map +0 -1
  39. package/dist/controllers/entity/upsert-entity.controller.js +0 -84
  40. package/dist/controllers/entity/upsert-entity.controller.js.map +0 -1
  41. package/dist/controllers/mutual/create-mutual.controller.d.ts +0 -7
  42. package/dist/controllers/mutual/create-mutual.controller.d.ts.map +0 -1
  43. package/dist/controllers/mutual/create-mutual.controller.js +0 -60
  44. package/dist/controllers/mutual/create-mutual.controller.js.map +0 -1
  45. package/dist/controllers/mutual/delete-mutual.controller.d.ts +0 -7
  46. package/dist/controllers/mutual/delete-mutual.controller.d.ts.map +0 -1
  47. package/dist/controllers/mutual/delete-mutual.controller.js +0 -40
  48. package/dist/controllers/mutual/delete-mutual.controller.js.map +0 -1
  49. package/dist/controllers/mutual/get-mutual.controller.d.ts +0 -7
  50. package/dist/controllers/mutual/get-mutual.controller.d.ts.map +0 -1
  51. package/dist/controllers/mutual/get-mutual.controller.js +0 -36
  52. package/dist/controllers/mutual/get-mutual.controller.js.map +0 -1
  53. package/dist/controllers/mutual/list-entities-by-entity.controller.d.ts +0 -7
  54. package/dist/controllers/mutual/list-entities-by-entity.controller.d.ts.map +0 -1
  55. package/dist/controllers/mutual/list-entities-by-entity.controller.js +0 -72
  56. package/dist/controllers/mutual/list-entities-by-entity.controller.js.map +0 -1
  57. package/dist/controllers/mutual/update-mutual.controller.d.ts +0 -7
  58. package/dist/controllers/mutual/update-mutual.controller.d.ts.map +0 -1
  59. package/dist/controllers/mutual/update-mutual.controller.js +0 -54
  60. package/dist/controllers/mutual/update-mutual.controller.js.map +0 -1
  61. package/dist/controllers/setupRoutes.d.ts +0 -4
  62. package/dist/controllers/setupRoutes.d.ts.map +0 -1
  63. package/dist/controllers/setupRoutes.js +0 -32
  64. package/dist/controllers/setupRoutes.js.map +0 -1
  65. package/dist/controllers/tag/list-tags.controller.d.ts +0 -7
  66. package/dist/controllers/tag/list-tags.controller.d.ts.map +0 -1
  67. package/dist/controllers/tag/list-tags.controller.js +0 -57
  68. package/dist/controllers/tag/list-tags.controller.js.map +0 -1
  69. package/dist/data/DbUtils.d.ts +0 -7
  70. package/dist/data/DbUtils.d.ts.map +0 -1
  71. package/dist/data/DbUtils.js +0 -34
  72. package/dist/data/DbUtils.js.map +0 -1
  73. package/dist/data/Entity.d.ts +0 -77
  74. package/dist/data/Entity.d.ts.map +0 -1
  75. package/dist/data/Entity.js +0 -504
  76. package/dist/data/Entity.js.map +0 -1
  77. package/dist/data/EventUtils.d.ts +0 -15
  78. package/dist/data/EventUtils.d.ts.map +0 -1
  79. package/dist/data/EventUtils.js +0 -43
  80. package/dist/data/EventUtils.js.map +0 -1
  81. package/dist/data/FileObject.d.ts +0 -62
  82. package/dist/data/FileObject.d.ts.map +0 -1
  83. package/dist/data/FileObject.js +0 -13
  84. package/dist/data/FileObject.js.map +0 -1
  85. package/dist/data/Mutual.d.ts +0 -93
  86. package/dist/data/Mutual.d.ts.map +0 -1
  87. package/dist/data/Mutual.js +0 -439
  88. package/dist/data/Mutual.js.map +0 -1
  89. package/dist/data/ProjectionExpression.d.ts +0 -6
  90. package/dist/data/ProjectionExpression.d.ts.map +0 -1
  91. package/dist/data/ProjectionExpression.js +0 -5
  92. package/dist/data/ProjectionExpression.js.map +0 -1
  93. package/dist/data/Tag.d.ts +0 -77
  94. package/dist/data/Tag.d.ts.map +0 -1
  95. package/dist/data/Tag.js +0 -329
  96. package/dist/data/Tag.js.map +0 -1
  97. package/dist/data/abstract/Item.base.d.ts +0 -11
  98. package/dist/data/abstract/Item.base.d.ts.map +0 -1
  99. package/dist/data/abstract/Item.base.js +0 -9
  100. package/dist/data/abstract/Item.base.js.map +0 -1
  101. package/dist/data/abstract/Repository.base.d.ts +0 -11
  102. package/dist/data/abstract/Repository.base.d.ts.map +0 -1
  103. package/dist/data/abstract/Repository.base.js +0 -51
  104. package/dist/data/abstract/Repository.base.js.map +0 -1
  105. package/dist/errors/api-error.d.ts +0 -23
  106. package/dist/errors/api-error.d.ts.map +0 -1
  107. package/dist/errors/api-error.js +0 -26
  108. package/dist/errors/api-error.js.map +0 -1
  109. package/dist/errors/extendable-error.d.ts +0 -18
  110. package/dist/errors/extendable-error.d.ts.map +0 -1
  111. package/dist/errors/extendable-error.js +0 -15
  112. package/dist/errors/extendable-error.js.map +0 -1
  113. package/dist/errors/standard-error.d.ts +0 -33
  114. package/dist/errors/standard-error.d.ts.map +0 -1
  115. package/dist/errors/standard-error.js +0 -39
  116. package/dist/errors/standard-error.js.map +0 -1
  117. package/dist/handles/app.d.ts +0 -16
  118. package/dist/handles/app.d.ts.map +0 -1
  119. package/dist/handles/app.js +0 -31
  120. package/dist/handles/app.js.map +0 -1
  121. package/dist/helpers/dependencies.d.ts +0 -8
  122. package/dist/helpers/dependencies.d.ts.map +0 -1
  123. package/dist/helpers/dependencies.js +0 -10
  124. package/dist/helpers/dependencies.js.map +0 -1
  125. package/dist/helpers/event.d.ts +0 -22
  126. package/dist/helpers/event.d.ts.map +0 -1
  127. package/dist/helpers/event.js +0 -48
  128. package/dist/helpers/event.js.map +0 -1
  129. package/dist/helpers/fromLastKeyQuery.d.ts +0 -3
  130. package/dist/helpers/fromLastKeyQuery.d.ts.map +0 -1
  131. package/dist/helpers/fromLastKeyQuery.js +0 -7
  132. package/dist/helpers/fromLastKeyQuery.js.map +0 -1
  133. package/dist/helpers/sleep.d.ts +0 -2
  134. package/dist/helpers/sleep.d.ts.map +0 -1
  135. package/dist/helpers/sleep.js +0 -2
  136. package/dist/helpers/sleep.js.map +0 -1
  137. package/dist/helpers/toLastKeyResponse.d.ts +0 -3
  138. package/dist/helpers/toLastKeyResponse.d.ts.map +0 -1
  139. package/dist/helpers/toLastKeyResponse.js +0 -7
  140. package/dist/helpers/toLastKeyResponse.js.map +0 -1
  141. package/dist/index.d.ts.map +0 -1
  142. package/dist/middlewares/api-key-auth.d.ts +0 -3
  143. package/dist/middlewares/api-key-auth.d.ts.map +0 -1
  144. package/dist/middlewares/api-key-auth.js +0 -32
  145. package/dist/middlewares/api-key-auth.js.map +0 -1
  146. package/dist/middlewares/entity-type-check.d.ts +0 -3
  147. package/dist/middlewares/entity-type-check.d.ts.map +0 -1
  148. package/dist/middlewares/entity-type-check.js +0 -22
  149. package/dist/middlewares/entity-type-check.js.map +0 -1
  150. package/dist/middlewares/general-error-handler.d.ts +0 -7
  151. package/dist/middlewares/general-error-handler.d.ts.map +0 -1
  152. package/dist/middlewares/general-error-handler.js +0 -40
  153. package/dist/middlewares/general-error-handler.js.map +0 -1
  154. package/dist/middlewares/mutual-type-check.d.ts +0 -3
  155. package/dist/middlewares/mutual-type-check.d.ts.map +0 -1
  156. package/dist/middlewares/mutual-type-check.js +0 -23
  157. package/dist/middlewares/mutual-type-check.js.map +0 -1
  158. package/dist/processors/create-entity-processor.d.ts +0 -6
  159. package/dist/processors/create-entity-processor.d.ts.map +0 -1
  160. package/dist/processors/create-entity-processor.js +0 -44
  161. package/dist/processors/create-entity-processor.js.map +0 -1
  162. package/dist/processors/mutual-processor.d.ts +0 -16
  163. package/dist/processors/mutual-processor.d.ts.map +0 -1
  164. package/dist/processors/mutual-processor.js +0 -142
  165. package/dist/processors/mutual-processor.js.map +0 -1
  166. package/dist/processors/prejoin-processor.d.ts +0 -13
  167. package/dist/processors/prejoin-processor.d.ts.map +0 -1
  168. package/dist/processors/prejoin-processor.js +0 -161
  169. package/dist/processors/prejoin-processor.js.map +0 -1
  170. package/dist/processors/replication-processor.d.ts +0 -9
  171. package/dist/processors/replication-processor.d.ts.map +0 -1
  172. package/dist/processors/replication-processor.js +0 -180
  173. package/dist/processors/replication-processor.js.map +0 -1
  174. package/dist/processors/tag-processor.d.ts +0 -12
  175. package/dist/processors/tag-processor.d.ts.map +0 -1
  176. package/dist/processors/tag-processor.js +0 -118
  177. package/dist/processors/tag-processor.js.map +0 -1
  178. package/dist/services/DependencyContainer.d.ts +0 -67
  179. package/dist/services/DependencyContainer.d.ts.map +0 -1
  180. package/dist/services/DependencyContainer.js +0 -121
  181. package/dist/services/DependencyContainer.js.map +0 -1
  182. package/dist/services/entity-service-lifecycle.d.ts +0 -12
  183. package/dist/services/entity-service-lifecycle.d.ts.map +0 -1
  184. package/dist/services/entity-service-lifecycle.js +0 -41
  185. package/dist/services/entity-service-lifecycle.js.map +0 -1
  186. package/dist/services/entity.service.d.ts +0 -34
  187. package/dist/services/entity.service.d.ts.map +0 -1
  188. package/dist/services/entity.service.js +0 -120
  189. package/dist/services/entity.service.js.map +0 -1
  190. package/dist/services/mutual.service.d.ts +0 -64
  191. package/dist/services/mutual.service.d.ts.map +0 -1
  192. package/dist/services/mutual.service.js +0 -141
  193. package/dist/services/mutual.service.js.map +0 -1
  194. package/dist/tsconfig.tsbuildinfo +0 -1
  195. package/dist/types/entity.type.d.ts +0 -20
  196. package/dist/types/entity.type.d.ts.map +0 -1
  197. package/dist/types/entity.type.js +0 -2
  198. package/dist/types/entity.type.js.map +0 -1
  199. package/dist/types/event.d.ts +0 -73
  200. package/dist/types/event.d.ts.map +0 -1
  201. package/dist/types/event.js +0 -74
  202. package/dist/types/event.js.map +0 -1
  203. package/dist/vitest.config.d.ts +0 -3
  204. package/dist/vitest.config.d.ts.map +0 -1
  205. package/dist/vitest.config.js +0 -10
  206. package/dist/vitest.config.js.map +0 -1
@@ -1,33 +0,0 @@
1
- export declare class StandardError extends Error {
2
- code: string;
3
- lastError?: object | null;
4
- context?: string | null;
5
- constructor(errorCode: string, message: string, lastError?: any, context?: object | string | null);
6
- toJSON(): {
7
- code: string;
8
- message: string;
9
- };
10
- }
11
- export declare const StandardErrorCode: {
12
- readonly CONDITIONAL_CHECK_FAILED: "CONDITIONAL_CHECK_FAILED";
13
- readonly EMAIL_EXISTS: "EMAIL_EXISTS";
14
- readonly ENTITY_ID_IS_UNDEFINED: "ENTITY_ID_IS_UNDEFINED";
15
- readonly ENTITY_IS_UNDEFINED: "ENTITY_IS_UNDEFINED";
16
- readonly ENTITY_NOT_FOUND: "ENTITY_NOT_FOUND";
17
- readonly INVALID_ENTITY_TYPE: "INVALID_ENTITY_TYPE";
18
- readonly INVALID_MUTUAL: "INVALID_MUTUAL";
19
- readonly INVALID_QUERY: "INVALID_QUERY";
20
- readonly INVALID_UNIQUE_VALUE_TYPE: "INVALID_UNIQUE_VALUE_TYPE";
21
- readonly MUTUAL_EXISTS: "MUTUAL_EXISTS";
22
- readonly MUTUAL_IS_UNDEFINED: "MUTUAL_IS_UNDEFINED";
23
- readonly MUTUAL_LOCK_CONFLICT: "MUTUAL_LOCK_CONFLICT";
24
- readonly MUTUAL_NOT_FOUND: "MUTUAL_NOT_FOUND";
25
- readonly MUTUAL_PROCESSOR_ERROR: "MUTUAL_PROCESSOR_ERROR";
26
- readonly REPLICATION_ERROR: "REPLICATION_ERROR";
27
- readonly RETRYABLE_MUTUAL_LOCK_CONFLICT: "RETRYABLE_MUTUAL_LOCK_CONFLICT";
28
- readonly TAG_IS_UNDEFINED: "TAG_IS_UNDEFINED";
29
- readonly TRANSACTION_FAILED: "TRANSACTION_FAILED";
30
- readonly UNIQUE_VALUE_EXISTS: "UNIQUE_VALUE_EXISTS";
31
- };
32
- export type StandardErrorCode = typeof StandardErrorCode[keyof typeof StandardErrorCode];
33
- //# sourceMappingURL=standard-error.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"standard-error.d.ts","sourceRoot":"","sources":["../../errors/standard-error.ts"],"names":[],"mappings":"AAAA,qBAAa,aAAc,SAAQ,KAAK;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;gBAG7B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,SAAS,CAAC,EAAE,GAAG,EACf,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAa3B,MAAM;;;;CAMd;AAED,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;CAoBpB,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC"}
@@ -1,39 +0,0 @@
1
- export class StandardError extends Error {
2
- constructor(errorCode, message, lastError, context) {
3
- super(message);
4
- // So you can do typeof CustomError
5
- Object.setPrototypeOf(this, new.target.prototype);
6
- this.name = this.constructor.name;
7
- this.code = errorCode;
8
- this.lastError = lastError;
9
- this.context = JSON.stringify(context, null, 2);
10
- }
11
- toJSON() {
12
- return {
13
- code: this.code,
14
- message: this.message,
15
- };
16
- }
17
- }
18
- export const StandardErrorCode = {
19
- CONDITIONAL_CHECK_FAILED: 'CONDITIONAL_CHECK_FAILED',
20
- EMAIL_EXISTS: 'EMAIL_EXISTS',
21
- ENTITY_ID_IS_UNDEFINED: 'ENTITY_ID_IS_UNDEFINED',
22
- ENTITY_IS_UNDEFINED: 'ENTITY_IS_UNDEFINED',
23
- ENTITY_NOT_FOUND: 'ENTITY_NOT_FOUND',
24
- INVALID_ENTITY_TYPE: 'INVALID_ENTITY_TYPE',
25
- INVALID_MUTUAL: 'INVALID_MUTUAL',
26
- INVALID_QUERY: 'INVALID_QUERY',
27
- INVALID_UNIQUE_VALUE_TYPE: 'INVALID_UNIQUE_VALUE_TYPE',
28
- MUTUAL_EXISTS: 'MUTUAL_EXISTS',
29
- MUTUAL_IS_UNDEFINED: 'MUTUAL_IS_UNDEFINED',
30
- MUTUAL_LOCK_CONFLICT: 'MUTUAL_LOCK_CONFLICT',
31
- MUTUAL_NOT_FOUND: 'MUTUAL_NOT_FOUND',
32
- MUTUAL_PROCESSOR_ERROR: 'MUTUAL_PROCESSOR_ERROR',
33
- REPLICATION_ERROR: 'REPLICATION_ERROR',
34
- RETRYABLE_MUTUAL_LOCK_CONFLICT: 'RETRYABLE_MUTUAL_LOCK_CONFLICT',
35
- TAG_IS_UNDEFINED: 'TAG_IS_UNDEFINED',
36
- TRANSACTION_FAILED: 'TRANSACTION_FAILED',
37
- UNIQUE_VALUE_EXISTS: 'UNIQUE_VALUE_EXISTS',
38
- };
39
- //# sourceMappingURL=standard-error.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"standard-error.js","sourceRoot":"","sources":["../../errors/standard-error.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,aAAc,SAAQ,KAAK;IAKtC,YACE,SAAiB,EACjB,OAAe,EACf,SAAe,EACf,OAAgC;QAEhC,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,mCAAmC;QACnC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAElD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAClC,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;QACtB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAClD,CAAC;IAEM,MAAM;QACX,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC;IACJ,CAAC;CACF;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,wBAAwB,EAAE,0BAA0B;IACpD,YAAY,EAAE,cAAc;IAC5B,sBAAsB,EAAE,wBAAwB;IAChD,mBAAmB,EAAE,qBAAqB;IAC1C,gBAAgB,EAAE,kBAAkB;IACpC,mBAAmB,EAAE,qBAAqB;IAC1C,cAAc,EAAE,gBAAgB;IAChC,aAAa,EAAE,eAAe;IAC9B,yBAAyB,EAAE,2BAA2B;IACtD,aAAa,EAAE,eAAe;IAC9B,mBAAmB,EAAE,qBAAqB;IAC1C,oBAAoB,EAAE,sBAAsB;IAC5C,gBAAgB,EAAE,kBAAkB;IACpC,sBAAsB,EAAE,wBAAwB;IAChD,iBAAiB,EAAE,mBAAmB;IACtC,8BAA8B,EAAE,gCAAgC;IAChE,gBAAgB,EAAE,kBAAkB;IACpC,kBAAkB,EAAE,oBAAoB;IACxC,mBAAmB,EAAE,qBAAqB;CAClC,CAAC"}
@@ -1,16 +0,0 @@
1
- import { Hono } from 'hono';
2
- import type { DependencyContainer } from '../services/DependencyContainer';
3
- type AppHandleArgs = {
4
- routes?: (container: DependencyContainer) => Hono | Hono;
5
- };
6
- export declare const appHandler: (container: DependencyContainer) => ({ routes }: AppHandleArgs) => <L extends import("hono/aws-lambda").LambdaEvent>(event: L, lambdaContext?: import("hono/aws-lambda").LambdaContext) => Promise<import("hono/aws-lambda").APIGatewayProxyResult & (L extends {
7
- multiValueHeaders: Record<string, string[]>;
8
- } ? {
9
- headers?: undefined;
10
- multiValueHeaders: Record<string, string[]>;
11
- } : {
12
- headers: Record<string, string>;
13
- multiValueHeaders?: undefined;
14
- })>;
15
- export {};
16
- //# sourceMappingURL=app.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../handles/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAO5B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAE3E,KAAK,aAAa,GAAG;IACnB,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,mBAAmB,KAAK,IAAI,GAAG,IAAI,CAAC;CAC1D,CAAC;AAEF,eAAO,MAAM,UAAU,GACpB,WAAW,mBAAmB,MAC5B,YAAY,aAAa;;;;;;;;GA4BzB,CAAC"}
@@ -1,31 +0,0 @@
1
- import { Hono } from 'hono';
2
- import { handle } from 'hono/aws-lambda';
3
- import { cors } from 'hono/cors';
4
- import { secureHeaders } from 'hono/secure-headers';
5
- import { setupCommonRoutes } from '../controllers/setupRoutes';
6
- import apiKeyAuth from '../middlewares/api-key-auth';
7
- import generalErrorHandler from '../middlewares/general-error-handler';
8
- export const appHandler = (container) => ({ routes }) => {
9
- const app = new Hono().basePath('/core');
10
- app.use(secureHeaders());
11
- app.use(cors({
12
- allowHeaders: ['Content-Type'],
13
- credentials: true,
14
- origin: process.env.ALLOWED_ORIGIN
15
- ? JSON.parse(process.env.ALLOWED_ORIGIN)
16
- : [],
17
- }));
18
- app.use(apiKeyAuth);
19
- if (routes) {
20
- if (typeof routes !== 'function') {
21
- app.route('/app', routes);
22
- }
23
- else {
24
- app.route('/app', routes(container));
25
- }
26
- }
27
- app.route('/', setupCommonRoutes(container));
28
- app.use(generalErrorHandler());
29
- return handle(app);
30
- };
31
- //# sourceMappingURL=app.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"app.js","sourceRoot":"","sources":["../../handles/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,UAAU,MAAM,6BAA6B,CAAC;AACrD,OAAO,mBAAmB,MAAM,sCAAsC,CAAC;AAOvE,MAAM,CAAC,MAAM,UAAU,GACrB,CAAC,SAA8B,EAAE,EAAE,CACjC,CAAC,EAAE,MAAM,EAAiB,EAAE,EAAE;IAC5B,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAEzC,GAAG,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC,CAAC;IACzB,GAAG,CAAC,GAAG,CACL,IAAI,CAAC;QACH,YAAY,EAAE,CAAC,cAAc,CAAC;QAC9B,WAAW,EAAE,IAAI;QACjB,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc;YAChC,CAAC,CAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,cAAwB,CAAc;YAChE,CAAC,CAAC,EAAE;KACP,CAAC,CACH,CAAC;IACF,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAEpB,IAAI,MAAM,EAAE,CAAC;QACX,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE,CAAC;YACjC,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC5B,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;QACvC,CAAC;IACH,CAAC;IAED,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC;IAE7C,GAAG,CAAC,GAAG,CAAC,mBAAmB,EAAE,CAAC,CAAC;IAE/B,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;AACrB,CAAC,CAAC"}
@@ -1,8 +0,0 @@
1
- import { nanoid } from 'nanoid';
2
- import { publishErrorEvent, publishEvent } from './event';
3
- export declare const getDependencies: () => {
4
- nanoid: typeof nanoid;
5
- publishEvent: typeof publishEvent;
6
- publishErrorEvent: typeof publishErrorEvent;
7
- };
8
- //# sourceMappingURL=dependencies.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../helpers/dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE1D,eAAO,MAAM,eAAe;;;;CAM3B,CAAC"}
@@ -1,10 +0,0 @@
1
- import { nanoid } from 'nanoid';
2
- import { publishErrorEvent, publishEvent } from './event';
3
- export const getDependencies = () => {
4
- return {
5
- nanoid,
6
- publishEvent,
7
- publishErrorEvent,
8
- };
9
- };
10
- //# sourceMappingURL=dependencies.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../helpers/dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE1D,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,OAAO;QACL,MAAM;QACN,YAAY;QACZ,iBAAiB;KAClB,CAAC;AACJ,CAAC,CAAC"}
@@ -1,22 +0,0 @@
1
- import { type EventDetail } from '../types/event';
2
- type PublishEventProps<T> = {
3
- payload: T;
4
- event: EventDetail;
5
- };
6
- type ParsedSQSBusEvent<T = Record<string, any>> = {
7
- event: EventDetail;
8
- detail: T;
9
- };
10
- export declare function parseSQSBusEvent<T>(evRecordBody: string): ParsedSQSBusEvent<T>;
11
- export declare function publishEvent<T extends Record<string, any>>({ payload, event, }: PublishEventProps<T>): Promise<void>;
12
- type PublishErrorEventPayload = {
13
- id: string;
14
- serviceName: string;
15
- method: string;
16
- path: string;
17
- body?: Record<string, any>;
18
- error: Error;
19
- };
20
- export declare function publishErrorEvent({ id, serviceName, method, path, body, error, }: PublishErrorEventPayload): Promise<void>;
21
- export {};
22
- //# sourceMappingURL=event.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../helpers/event.ts"],"names":[],"mappings":"AAKA,OAAO,EAAS,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAIzD,KAAK,iBAAiB,CAAC,CAAC,IAAI;IAC1B,OAAO,EAAE,CAAC,CAAC;IACX,KAAK,EAAE,WAAW,CAAC;CACpB,CAAC;AAEF,KAAK,iBAAiB,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI;IAChD,KAAK,EAAE,WAAW,CAAC;IACnB,MAAM,EAAE,CAAC,CAAC;CACX,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,CAAC,EAChC,YAAY,EAAE,MAAM,GACnB,iBAAiB,CAAC,CAAC,CAAC,CAUtB;AAED,wBAAsB,YAAY,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,EAChE,OAAO,EACP,KAAK,GACN,EAAE,iBAAiB,CAAC,CAAC,CAAC,iBAYtB;AAED,KAAK,wBAAwB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,KAAK,EAAE,KAAK,CAAC;CACd,CAAC;AAEF,wBAAsB,iBAAiB,CAAC,EACtC,EAAE,EACF,WAAW,EACX,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,KAAK,GACN,EAAE,wBAAwB,iBAkB1B"}
@@ -1,48 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { EventBridgeClient, PutEventsCommand, } from '@aws-sdk/client-eventbridge';
11
- import { CORE_EVENT_BUS } from '../configs/service.config';
12
- import { EVENT } from '../types/event';
13
- const eventBridge = new EventBridgeClient();
14
- export function parseSQSBusEvent(evRecordBody) {
15
- const body = JSON.parse(evRecordBody);
16
- return Object.assign(Object.assign({}, body), { detail: body.detail, event: {
17
- Source: body.source,
18
- DetailType: body['detail-type'],
19
- } });
20
- }
21
- export function publishEvent(_a) {
22
- return __awaiter(this, arguments, void 0, function* ({ payload, event, }) {
23
- const params = {
24
- Entries: [
25
- Object.assign(Object.assign({}, event), { Detail: JSON.stringify(payload), EventBusName: CORE_EVENT_BUS }),
26
- ],
27
- };
28
- yield eventBridge.send(new PutEventsCommand(params));
29
- });
30
- }
31
- export function publishErrorEvent(_a) {
32
- return __awaiter(this, arguments, void 0, function* ({ id, serviceName, method, path, body, error, }) {
33
- yield publishEvent({
34
- event: EVENT.GENERAL.ENDPOINT_ERROR,
35
- payload: Object.assign(Object.assign({ id,
36
- serviceName,
37
- method,
38
- path }, (body ? { requestBody: body } : {})), { error: {
39
- name: error.name,
40
- message: error.message,
41
- // @ts-ignore
42
- cause: error.cause,
43
- stack: error.stack,
44
- } }),
45
- });
46
- });
47
- }
48
- //# sourceMappingURL=event.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"event.js","sourceRoot":"","sources":["../../helpers/event.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EACL,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAoB,MAAM,gBAAgB,CAAC;AAEzD,MAAM,WAAW,GAAG,IAAI,iBAAiB,EAAE,CAAC;AAY5C,MAAM,UAAU,gBAAgB,CAC9B,YAAoB;IAEpB,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IACtC,uCACK,IAAI,KACP,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,KAAK,EAAE;YACL,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC;SAChC,IACD;AACJ,CAAC;AAED,MAAM,UAAgB,YAAY;yDAAgC,EAChE,OAAO,EACP,KAAK,GACgB;QACrB,MAAM,MAAM,GAAG;YACb,OAAO,EAAE;gDAEF,KAAK,KACR,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAC/B,YAAY,EAAE,cAAc;aAE/B;SACF,CAAC;QAEF,MAAM,WAAW,CAAC,IAAI,CAAC,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;IACvD,CAAC;CAAA;AAWD,MAAM,UAAgB,iBAAiB;yDAAC,EACtC,EAAE,EACF,WAAW,EACX,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,KAAK,GACoB;QACzB,MAAM,YAAY,CAAC;YACjB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,cAAc;YACnC,OAAO,gCACL,EAAE;gBACF,WAAW;gBACX,MAAM;gBACN,IAAI,IACD,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KACtC,KAAK,EAAE;oBACL,IAAI,EAAE,KAAK,CAAC,IAAI;oBAChB,OAAO,EAAE,KAAK,CAAC,OAAO;oBACtB,aAAa;oBACb,KAAK,EAAE,KAAK,CAAC,KAAK;oBAClB,KAAK,EAAE,KAAK,CAAC,KAAK;iBACnB,GACF;SACF,CAAC,CAAC;IACL,CAAC;CAAA"}
@@ -1,3 +0,0 @@
1
- import type { NativeAttributeValue } from '@aws-sdk/util-dynamodb';
2
- export declare function fromLastKeyQuery(lastKeyQuery?: string): Record<string, NativeAttributeValue> | undefined;
3
- //# sourceMappingURL=fromLastKeyQuery.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fromLastKeyQuery.d.ts","sourceRoot":"","sources":["../../helpers/fromLastKeyQuery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAEnE,wBAAgB,gBAAgB,CAC9B,YAAY,CAAC,EAAE,MAAM,GACpB,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,GAAG,SAAS,CAMlD"}
@@ -1,7 +0,0 @@
1
- export function fromLastKeyQuery(lastKeyQuery) {
2
- if (!lastKeyQuery) {
3
- return;
4
- }
5
- return JSON.parse(Buffer.from(lastKeyQuery, 'base64').toString('utf-8'));
6
- }
7
- //# sourceMappingURL=fromLastKeyQuery.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fromLastKeyQuery.js","sourceRoot":"","sources":["../../helpers/fromLastKeyQuery.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,gBAAgB,CAC9B,YAAqB;IAErB,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO;IACT,CAAC;IAED,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;AAC3E,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare const sleep: (ms: number) => Promise<unknown>;
2
- //# sourceMappingURL=sleep.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sleep.d.ts","sourceRoot":"","sources":["../../helpers/sleep.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,GAAI,IAAI,MAAM,qBAA8C,CAAC"}
@@ -1,2 +0,0 @@
1
- export const sleep = (ms) => new Promise((res) => setTimeout(res, ms));
2
- //# sourceMappingURL=sleep.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sleep.js","sourceRoot":"","sources":["../../helpers/sleep.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { NativeAttributeValue } from '@aws-sdk/util-dynamodb';
2
- export declare function toLastKeyResponse(lastKey?: Record<string, NativeAttributeValue>): string | undefined;
3
- //# sourceMappingURL=toLastKeyResponse.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"toLastKeyResponse.d.ts","sourceRoot":"","sources":["../../helpers/toLastKeyResponse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAEnE,wBAAgB,iBAAiB,CAC/B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,GAC7C,MAAM,GAAG,SAAS,CAMpB"}
@@ -1,7 +0,0 @@
1
- export function toLastKeyResponse(lastKey) {
2
- if (!lastKey) {
3
- return;
4
- }
5
- return Buffer.from(JSON.stringify(lastKey)).toString('base64');
6
- }
7
- //# sourceMappingURL=toLastKeyResponse.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"toLastKeyResponse.js","sourceRoot":"","sources":["../../helpers/toLastKeyResponse.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,iBAAiB,CAC/B,OAA8C;IAE9C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO;IACT,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACjE,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AACxF,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AACrF,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1D,cAAM,WAAW;IAWb,OAAO,CAAC,MAAM;IAVT,iBAAiB,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;IACxD,eAAe,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;IACpD,oBAAoB,EAAE,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;IAC9D,qBAAqB,EAAE,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC;IAChE,gBAAgB,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;IACtD,YAAY,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;IAC9C,UAAU,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;IAC1C,mBAAmB,EAAE,mBAAmB,CAAC;gBAGtC,MAAM,EAAE;QACd,YAAY,EAAE,MAAM,CAAC,UAAU,EAAE,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC;QACxE,kBAAkB,EAAE,UAAU,EAAE,CAAC;QACjC,wBAAwB,EAAE,UAAU,EAAE,CAAC;KACxC;CAaJ;AAED,OAAO,EACL,iBAAiB,EACjB,MAAM,EACN,gBAAgB,EAChB,aAAa,EACb,MAAM,EACN,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,YAAY,EACZ,UAAU,EACV,mBAAmB,EACnB,aAAa,EACb,iBAAiB,GAClB,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -1,3 +0,0 @@
1
- declare const apiKeyAuth: import("hono").MiddlewareHandler<import("hono").Env, string, {}>;
2
- export default apiKeyAuth;
3
- //# sourceMappingURL=api-key-auth.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api-key-auth.d.ts","sourceRoot":"","sources":["../../middlewares/api-key-auth.ts"],"names":[],"mappings":"AASA,QAAA,MAAM,UAAU,kEAiBd,CAAC;AAEH,eAAe,UAAU,CAAC"}
@@ -1,32 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { createFactory } from 'hono/factory';
11
- import httpStatus from 'http-status';
12
- const factory = createFactory();
13
- const API_KEYS = process.env.API_KEYS
14
- ? JSON.parse(process.env.API_KEYS)
15
- : [];
16
- const apiKeyAuth = factory.createMiddleware((c, next) => __awaiter(void 0, void 0, void 0, function* () {
17
- const xApiKey = c.req.header('x-api-key');
18
- // check if its public url
19
- if (c.req.url.match(/^\/core\/public\//)) {
20
- return yield next();
21
- }
22
- if (!xApiKey || Array.isArray(xApiKey) || !API_KEYS.includes(xApiKey)) {
23
- c.status(httpStatus.UNAUTHORIZED);
24
- return c.json({
25
- status: httpStatus.UNAUTHORIZED,
26
- message: httpStatus['401_MESSAGE'],
27
- });
28
- }
29
- return yield next();
30
- }));
31
- export default apiKeyAuth;
32
- //# sourceMappingURL=api-key-auth.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api-key-auth.js","sourceRoot":"","sources":["../../middlewares/api-key-auth.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,UAAU,MAAM,aAAa,CAAC;AAErC,MAAM,OAAO,GAAG,aAAa,EAAE,CAAC;AAEhC,MAAM,QAAQ,GAAa,OAAO,CAAC,GAAG,CAAC,QAAQ;IAC7C,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,QAAkB,CAAC;IAC5C,CAAC,CAAC,EAAE,CAAC;AAEP,MAAM,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAO,CAAC,EAAE,IAAI,EAAE,EAAE;IAC5D,MAAM,OAAO,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAE1C,0BAA0B;IAC1B,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,mBAAmB,CAAC,EAAE,CAAC;QACzC,OAAO,MAAM,IAAI,EAAE,CAAC;IACtB,CAAC;IAED,IAAI,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QACtE,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;QAClC,OAAO,CAAC,CAAC,IAAI,CAAC;YACZ,MAAM,EAAE,UAAU,CAAC,YAAY;YAC/B,OAAO,EAAE,UAAU,CAAC,aAAa,CAAC;SACnC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,MAAM,IAAI,EAAE,CAAC;AACtB,CAAC,CAAA,CAAC,CAAC;AAEH,eAAe,UAAU,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { DependencyContainer } from '../services/DependencyContainer';
2
- export declare const entityTypeCheck: (container: DependencyContainer) => import("hono").MiddlewareHandler<any, string, {}>;
3
- //# sourceMappingURL=entity-type-check.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"entity-type-check.d.ts","sourceRoot":"","sources":["../../middlewares/entity-type-check.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAE3E,eAAO,MAAM,eAAe,GAAI,WAAW,mBAAmB,sDAY1D,CAAC"}
@@ -1,22 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { createMiddleware } from 'hono/factory';
11
- import httpStatus from 'http-status';
12
- export const entityTypeCheck = (container) => createMiddleware((c, next) => __awaiter(void 0, void 0, void 0, function* () {
13
- const { entityType } = c.req.param();
14
- if (!container.config.AllowedEntityTypes.includes(entityType)) {
15
- c.status(httpStatus.NOT_FOUND);
16
- return c.json({
17
- code: 'NOT_FOUND',
18
- });
19
- }
20
- yield next();
21
- }));
22
- //# sourceMappingURL=entity-type-check.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"entity-type-check.js","sourceRoot":"","sources":["../../middlewares/entity-type-check.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,UAAU,MAAM,aAAa,CAAC;AAGrC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,SAA8B,EAAE,EAAE,CAChE,gBAAgB,CAAC,CAAO,CAAC,EAAE,IAAI,EAAE,EAAE;IACjC,MAAM,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,EAA4B,CAAC;IAE/D,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,kBAAkB,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QAC9D,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QAC/B,OAAO,CAAC,CAAC,IAAI,CAAC;YACZ,IAAI,EAAE,WAAW;SAClB,CAAC,CAAC;IACL,CAAC;IAED,MAAM,IAAI,EAAE,CAAC;AACf,CAAC,CAAA,CAAC,CAAC"}
@@ -1,7 +0,0 @@
1
- declare const generalErrorHandler: (dependencies?: {
2
- nanoid: typeof import("nanoid").nanoid;
3
- publishEvent: typeof import("../helpers/event").publishEvent;
4
- publishErrorEvent: typeof import("../helpers/event").publishErrorEvent;
5
- }) => import("hono").MiddlewareHandler<import("hono").Env, string, {}>;
6
- export default generalErrorHandler;
7
- //# sourceMappingURL=general-error-handler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"general-error-handler.d.ts","sourceRoot":"","sources":["../../middlewares/general-error-handler.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,mBAAmB,GAAI;;;;CAAgC,qEAoCzD,CAAC;AAEL,eAAe,mBAAmB,CAAC"}
@@ -1,40 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { createFactory } from 'hono/factory';
11
- import { getDependencies } from '../helpers/dependencies';
12
- const factory = createFactory();
13
- const generalErrorHandler = (dependencies = getDependencies()) => factory.createMiddleware((c) => __awaiter(void 0, void 0, void 0, function* () {
14
- if (c.error) {
15
- const { nanoid, publishErrorEvent } = dependencies;
16
- const errorId = nanoid();
17
- const body = yield c.req.json();
18
- yield publishErrorEvent({
19
- serviceName: 'monorise-core',
20
- method: c.req.method,
21
- path: c.req.path,
22
- id: errorId,
23
- body,
24
- error: c.error,
25
- });
26
- console.warn(JSON.stringify({
27
- message: 'INTERNAL_SERVER_EXCEPTION',
28
- details: c.error,
29
- }));
30
- c.status(500);
31
- c.json({
32
- code: 'INTERNAL_SERVER_EXCEPTION',
33
- id: errorId,
34
- });
35
- // so lambda monitor able to track error rate
36
- throw new Error(`INTERNAL_SERVER_EXCEPTION: ${errorId}: ${c.req.method} ${c.req.path}: ${c.error}`);
37
- }
38
- }));
39
- export default generalErrorHandler;
40
- //# sourceMappingURL=general-error-handler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"general-error-handler.js","sourceRoot":"","sources":["../../middlewares/general-error-handler.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,MAAM,OAAO,GAAG,aAAa,EAAE,CAAC;AAEhC,MAAM,mBAAmB,GAAG,CAAC,YAAY,GAAG,eAAe,EAAE,EAAE,EAAE,CAC/D,OAAO,CAAC,gBAAgB,CAAC,CAAO,CAAC,EAAE,EAAE;IACnC,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC;QACZ,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,GAAG,YAAY,CAAC;QAEnD,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC;QAEzB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;QAEhC,MAAM,iBAAiB,CAAC;YACtB,WAAW,EAAE,eAAe;YAC5B,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,MAAM;YACpB,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI;YAChB,EAAE,EAAE,OAAO;YACX,IAAI;YACJ,KAAK,EAAE,CAAC,CAAC,KAAK;SACf,CAAC,CAAC;QAEH,OAAO,CAAC,IAAI,CACV,IAAI,CAAC,SAAS,CAAC;YACb,OAAO,EAAE,2BAA2B;YACpC,OAAO,EAAE,CAAC,CAAC,KAAK;SACjB,CAAC,CACH,CAAC;QAEF,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACd,CAAC,CAAC,IAAI,CAAC;YACL,IAAI,EAAE,2BAA2B;YACjC,EAAE,EAAE,OAAO;SACZ,CAAC,CAAC;QAEH,6CAA6C;QAC7C,MAAM,IAAI,KAAK,CACb,8BAA8B,OAAO,KAAK,CAAC,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC,KAAK,EAAE,CACnF,CAAC;IACJ,CAAC;AACH,CAAC,CAAA,CAAC,CAAC;AAEL,eAAe,mBAAmB,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { DependencyContainer } from '../services/DependencyContainer';
2
- export declare const mutualTypeCheck: (container: DependencyContainer) => import("hono").MiddlewareHandler<any, string, {}>;
3
- //# sourceMappingURL=mutual-type-check.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mutual-type-check.d.ts","sourceRoot":"","sources":["../../middlewares/mutual-type-check.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAE3E,eAAO,MAAM,eAAe,GAAI,WAAW,mBAAmB,sDAkB1D,CAAC"}
@@ -1,23 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { createMiddleware } from 'hono/factory';
11
- import httpStatus from 'http-status';
12
- export const mutualTypeCheck = (container) => createMiddleware((c, next) => __awaiter(void 0, void 0, void 0, function* () {
13
- const { entityType, byEntityType } = c.req.param();
14
- if (!container.config.AllowedEntityTypes.includes(entityType) ||
15
- !container.config.AllowedEntityTypes.includes(byEntityType)) {
16
- c.status(httpStatus.NOT_FOUND);
17
- return c.json({
18
- code: 'NOT_FOUND',
19
- });
20
- }
21
- yield next();
22
- }));
23
- //# sourceMappingURL=mutual-type-check.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mutual-type-check.js","sourceRoot":"","sources":["../../middlewares/mutual-type-check.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,UAAU,MAAM,aAAa,CAAC;AAGrC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,SAA8B,EAAE,EAAE,CAChE,gBAAgB,CAAC,CAAO,CAAC,EAAE,IAAI,EAAE,EAAE;IACjC,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,EAG/C,CAAC;IAEF,IACE,CAAC,SAAS,CAAC,MAAM,CAAC,kBAAkB,CAAC,QAAQ,CAAC,UAAU,CAAC;QACzD,CAAC,SAAS,CAAC,MAAM,CAAC,kBAAkB,CAAC,QAAQ,CAAC,YAAY,CAAC,EAC3D,CAAC;QACD,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QAC/B,OAAO,CAAC,CAAC,IAAI,CAAC;YACZ,IAAI,EAAE,WAAW;SAClB,CAAC,CAAC;IACL,CAAC;IAED,MAAM,IAAI,EAAE,CAAC;AACf,CAAC,CAAA,CAAC,CAAC"}
@@ -1,6 +0,0 @@
1
- import type { SQSBatchItemFailure, SQSEvent } from 'aws-lambda';
2
- import type { DependencyContainer } from '../services/DependencyContainer';
3
- export declare const handler: (container: DependencyContainer) => (ev: SQSEvent) => Promise<{
4
- batchItemFailures: SQSBatchItemFailure[];
5
- }>;
6
- //# sourceMappingURL=create-entity-processor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-entity-processor.d.ts","sourceRoot":"","sources":["../../processors/create-entity-processor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGhE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAa3E,eAAO,MAAM,OAAO,GACjB,WAAW,mBAAmB,MAAY,IAAI,QAAQ;;EA2CtD,CAAC"}
@@ -1,44 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { StandardError, StandardErrorCode } from '../errors/standard-error';
11
- import { parseSQSBusEvent } from '../helpers/event';
12
- export const handler = (container) => (ev) => __awaiter(void 0, void 0, void 0, function* () {
13
- const { entityService } = container;
14
- const batchItemFailures = [];
15
- for (const record of ev.Records) {
16
- const errorContext = {};
17
- const body = parseSQSBusEvent(record.body);
18
- const { detail } = body;
19
- const { entityType, entityId, entityPayload, accountId, options } = detail;
20
- errorContext.body = body;
21
- try {
22
- if (!entityType) {
23
- continue;
24
- }
25
- yield entityService.createEntity({
26
- entityType,
27
- entityId,
28
- entityPayload,
29
- accountId,
30
- options,
31
- });
32
- }
33
- catch (err) {
34
- console.error('=====CREATE_ENTITY_PROCESSOR_ERROR=====', err, JSON.stringify({ errorContext }, null, 2));
35
- if (err instanceof StandardError &&
36
- err.code === StandardErrorCode.INVALID_ENTITY_TYPE) {
37
- continue; // do not retry
38
- }
39
- batchItemFailures.push({ itemIdentifier: record.messageId });
40
- }
41
- }
42
- return { batchItemFailures };
43
- });
44
- //# sourceMappingURL=create-entity-processor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-entity-processor.js","sourceRoot":"","sources":["../../processors/create-entity-processor.ts"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAcpD,MAAM,CAAC,MAAM,OAAO,GAClB,CAAC,SAA8B,EAAE,EAAE,CAAC,CAAO,EAAY,EAAE,EAAE;IACzD,MAAM,EAAE,aAAa,EAAE,GAAG,SAAS,CAAC;IACpC,MAAM,iBAAiB,GAA0B,EAAE,CAAC;IAEpD,KAAK,MAAM,MAAM,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;QAChC,MAAM,YAAY,GAA4B,EAAE,CAAC;QACjD,MAAM,IAAI,GAAG,gBAAgB,CAAkB,MAAM,CAAC,IAAI,CAAC,CAAC;QAC5D,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QACxB,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAE,OAAO,EAAE,GAC/D,MAAM,CAAC;QACT,YAAY,CAAC,IAAI,GAAG,IAAI,CAAC;QAEzB,IAAI,CAAC;YACH,IAAI,CAAC,UAAU,EAAE,CAAC;gBAChB,SAAS;YACX,CAAC;YAED,MAAM,aAAa,CAAC,YAAY,CAAC;gBAC/B,UAAU;gBACV,QAAQ;gBACR,aAAa;gBACb,SAAS;gBACT,OAAO;aACR,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CACX,yCAAyC,EACzC,GAAG,EACH,IAAI,CAAC,SAAS,CAAC,EAAE,YAAY,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAC1C,CAAC;YAEF,IACE,GAAG,YAAY,aAAa;gBAC5B,GAAG,CAAC,IAAI,KAAK,iBAAiB,CAAC,mBAAmB,EAClD,CAAC;gBACD,SAAS,CAAC,eAAe;YAC3B,CAAC;YAED,iBAAiB,CAAC,IAAI,CAAC,EAAE,cAAc,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;IAED,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAC/B,CAAC,CAAA,CAAC"}
@@ -1,16 +0,0 @@
1
- import type { Entity } from '@monorise/base';
2
- import type { SQSBatchItemFailure, SQSEvent } from 'aws-lambda';
3
- import type { DependencyContainer } from '../services/DependencyContainer';
4
- export type EventDetailBody = {
5
- mutualIds: string[];
6
- byEntityType: Entity;
7
- byEntityId: string;
8
- entityType: Entity;
9
- field: string;
10
- publishedAt: string;
11
- customContext?: Record<string, unknown>;
12
- };
13
- export declare const handler: (container: DependencyContainer) => (ev: SQSEvent) => Promise<{
14
- batchItemFailures: SQSBatchItemFailure[];
15
- }>;
16
- //# sourceMappingURL=mutual-processor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mutual-processor.d.ts","sourceRoot":"","sources":["../../processors/mutual-processor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAKhE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAG3E,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACzC,CAAC;AAOF,eAAO,MAAM,OAAO,GACjB,WAAW,mBAAmB,MAAY,IAAI,QAAQ;;EAuPtD,CAAC"}