plutin 1.0.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 (237) hide show
  1. package/dist/base-controller-cec5714c.d.ts +46 -0
  2. package/dist/core/decorators/controller-http-decorator.cjs +752 -0
  3. package/dist/core/decorators/controller-http-decorator.cjs.map +1 -0
  4. package/dist/core/decorators/controller-http-decorator.d.cts +13 -0
  5. package/dist/core/decorators/controller-http-decorator.d.ts +13 -0
  6. package/dist/core/decorators/controller-http-decorator.js +735 -0
  7. package/dist/core/decorators/controller-http-decorator.js.map +1 -0
  8. package/dist/core/decorators/dependency-container.cjs +92 -0
  9. package/dist/core/decorators/dependency-container.cjs.map +1 -0
  10. package/dist/core/decorators/dependency-container.d.cts +22 -0
  11. package/dist/core/decorators/dependency-container.d.ts +22 -0
  12. package/dist/core/decorators/dependency-container.js +69 -0
  13. package/dist/core/decorators/dependency-container.js.map +1 -0
  14. package/dist/core/entities/aggregate-root.cjs +99 -0
  15. package/dist/core/entities/aggregate-root.cjs.map +1 -0
  16. package/dist/core/entities/aggregate-root.d.cts +8 -0
  17. package/dist/core/entities/aggregate-root.d.ts +8 -0
  18. package/dist/core/entities/aggregate-root.js +74 -0
  19. package/dist/core/entities/aggregate-root.js.map +1 -0
  20. package/dist/core/entities/common-dto.cjs +19 -0
  21. package/dist/core/entities/common-dto.cjs.map +1 -0
  22. package/dist/core/entities/common-dto.d.cts +10 -0
  23. package/dist/core/entities/common-dto.d.ts +10 -0
  24. package/dist/core/entities/common-dto.js +1 -0
  25. package/dist/core/entities/common-dto.js.map +1 -0
  26. package/dist/core/entities/domain-event.cjs +19 -0
  27. package/dist/core/entities/domain-event.cjs.map +1 -0
  28. package/dist/core/entities/domain-event.d.cts +6 -0
  29. package/dist/core/entities/domain-event.d.ts +6 -0
  30. package/dist/core/entities/domain-event.js +1 -0
  31. package/dist/core/entities/domain-event.js.map +1 -0
  32. package/dist/core/entities/entity.cjs +92 -0
  33. package/dist/core/entities/entity.cjs.map +1 -0
  34. package/dist/core/entities/entity.d.cts +17 -0
  35. package/dist/core/entities/entity.d.ts +17 -0
  36. package/dist/core/entities/entity.js +67 -0
  37. package/dist/core/entities/entity.js.map +1 -0
  38. package/dist/core/entities/optional.cjs +19 -0
  39. package/dist/core/entities/optional.cjs.map +1 -0
  40. package/dist/core/entities/optional.d.cts +3 -0
  41. package/dist/core/entities/optional.d.ts +3 -0
  42. package/dist/core/entities/optional.js +1 -0
  43. package/dist/core/entities/optional.js.map +1 -0
  44. package/dist/core/entities/unique-entity-id.cjs +50 -0
  45. package/dist/core/entities/unique-entity-id.cjs.map +1 -0
  46. package/dist/core/entities/unique-entity-id.d.cts +9 -0
  47. package/dist/core/entities/unique-entity-id.d.ts +9 -0
  48. package/dist/core/entities/unique-entity-id.js +27 -0
  49. package/dist/core/entities/unique-entity-id.js.map +1 -0
  50. package/dist/core/entities/value-object.cjs +40 -0
  51. package/dist/core/entities/value-object.cjs.map +1 -0
  52. package/dist/core/entities/value-object.d.cts +6 -0
  53. package/dist/core/entities/value-object.d.ts +6 -0
  54. package/dist/core/entities/value-object.js +17 -0
  55. package/dist/core/entities/value-object.js.map +1 -0
  56. package/dist/core/entities/watched-list.cjs +121 -0
  57. package/dist/core/entities/watched-list.cjs.map +1 -0
  58. package/dist/core/entities/watched-list.d.cts +27 -0
  59. package/dist/core/entities/watched-list.d.ts +27 -0
  60. package/dist/core/entities/watched-list.js +98 -0
  61. package/dist/core/entities/watched-list.js.map +1 -0
  62. package/dist/core/entities/watched-list.test.cjs +186 -0
  63. package/dist/core/entities/watched-list.test.cjs.map +1 -0
  64. package/dist/core/entities/watched-list.test.d.cts +2 -0
  65. package/dist/core/entities/watched-list.test.d.ts +2 -0
  66. package/dist/core/entities/watched-list.test.js +185 -0
  67. package/dist/core/entities/watched-list.test.js.map +1 -0
  68. package/dist/core/errors/api-common-error.cjs +38 -0
  69. package/dist/core/errors/api-common-error.cjs.map +1 -0
  70. package/dist/core/errors/api-common-error.d.cts +28 -0
  71. package/dist/core/errors/api-common-error.d.ts +28 -0
  72. package/dist/core/errors/api-common-error.js +13 -0
  73. package/dist/core/errors/api-common-error.js.map +1 -0
  74. package/dist/core/errors/application-error.cjs +54 -0
  75. package/dist/core/errors/application-error.cjs.map +1 -0
  76. package/dist/core/errors/application-error.d.cts +8 -0
  77. package/dist/core/errors/application-error.d.ts +8 -0
  78. package/dist/core/errors/application-error.js +33 -0
  79. package/dist/core/errors/application-error.js.map +1 -0
  80. package/dist/core/errors/conflict-error.cjs +56 -0
  81. package/dist/core/errors/conflict-error.cjs.map +1 -0
  82. package/dist/core/errors/conflict-error.d.cts +13 -0
  83. package/dist/core/errors/conflict-error.d.ts +13 -0
  84. package/dist/core/errors/conflict-error.js +35 -0
  85. package/dist/core/errors/conflict-error.js.map +1 -0
  86. package/dist/core/errors/domain-error.cjs +54 -0
  87. package/dist/core/errors/domain-error.cjs.map +1 -0
  88. package/dist/core/errors/domain-error.d.cts +8 -0
  89. package/dist/core/errors/domain-error.d.ts +8 -0
  90. package/dist/core/errors/domain-error.js +33 -0
  91. package/dist/core/errors/domain-error.js.map +1 -0
  92. package/dist/core/errors/http-client-error.cjs +54 -0
  93. package/dist/core/errors/http-client-error.cjs.map +1 -0
  94. package/dist/core/errors/http-client-error.d.cts +8 -0
  95. package/dist/core/errors/http-client-error.d.ts +8 -0
  96. package/dist/core/errors/http-client-error.js +33 -0
  97. package/dist/core/errors/http-client-error.js.map +1 -0
  98. package/dist/core/errors/infra-error.cjs +54 -0
  99. package/dist/core/errors/infra-error.cjs.map +1 -0
  100. package/dist/core/errors/infra-error.d.cts +8 -0
  101. package/dist/core/errors/infra-error.d.ts +8 -0
  102. package/dist/core/errors/infra-error.js +33 -0
  103. package/dist/core/errors/infra-error.js.map +1 -0
  104. package/dist/core/errors/validation-error.cjs +55 -0
  105. package/dist/core/errors/validation-error.cjs.map +1 -0
  106. package/dist/core/errors/validation-error.d.cts +8 -0
  107. package/dist/core/errors/validation-error.d.ts +8 -0
  108. package/dist/core/errors/validation-error.js +34 -0
  109. package/dist/core/errors/validation-error.js.map +1 -0
  110. package/dist/core/http/base-controller.cjs +731 -0
  111. package/dist/core/http/base-controller.cjs.map +1 -0
  112. package/dist/core/http/base-controller.d.cts +1 -0
  113. package/dist/core/http/base-controller.d.ts +1 -0
  114. package/dist/core/http/base-controller.js +720 -0
  115. package/dist/core/http/base-controller.js.map +1 -0
  116. package/dist/core/http/dto-response.cjs +19 -0
  117. package/dist/core/http/dto-response.cjs.map +1 -0
  118. package/dist/core/http/dto-response.d.cts +10 -0
  119. package/dist/core/http/dto-response.d.ts +10 -0
  120. package/dist/core/http/dto-response.js +1 -0
  121. package/dist/core/http/dto-response.js.map +1 -0
  122. package/dist/core/http/error-notifier.cjs +19 -0
  123. package/dist/core/http/error-notifier.cjs.map +1 -0
  124. package/dist/core/http/error-notifier.d.cts +1 -0
  125. package/dist/core/http/error-notifier.d.ts +1 -0
  126. package/dist/core/http/error-notifier.js +1 -0
  127. package/dist/core/http/error-notifier.js.map +1 -0
  128. package/dist/core/http/get-take-and-skip.cjs +40 -0
  129. package/dist/core/http/get-take-and-skip.cjs.map +1 -0
  130. package/dist/core/http/get-take-and-skip.d.cts +6 -0
  131. package/dist/core/http/get-take-and-skip.d.ts +6 -0
  132. package/dist/core/http/get-take-and-skip.js +17 -0
  133. package/dist/core/http/get-take-and-skip.js.map +1 -0
  134. package/dist/core/http/health-connections.cjs +42 -0
  135. package/dist/core/http/health-connections.cjs.map +1 -0
  136. package/dist/core/http/health-connections.d.cts +16 -0
  137. package/dist/core/http/health-connections.d.ts +16 -0
  138. package/dist/core/http/health-connections.js +23 -0
  139. package/dist/core/http/health-connections.js.map +1 -0
  140. package/dist/core/http/http.cjs +19 -0
  141. package/dist/core/http/http.cjs.map +1 -0
  142. package/dist/core/http/http.d.cts +10 -0
  143. package/dist/core/http/http.d.ts +10 -0
  144. package/dist/core/http/http.js +1 -0
  145. package/dist/core/http/http.js.map +1 -0
  146. package/dist/core/http/pagination.cjs +19 -0
  147. package/dist/core/http/pagination.cjs.map +1 -0
  148. package/dist/core/http/pagination.d.cts +9 -0
  149. package/dist/core/http/pagination.d.ts +9 -0
  150. package/dist/core/http/pagination.js +1 -0
  151. package/dist/core/http/pagination.js.map +1 -0
  152. package/dist/core/http/validator.cjs +19 -0
  153. package/dist/core/http/validator.cjs.map +1 -0
  154. package/dist/core/http/validator.d.cts +11 -0
  155. package/dist/core/http/validator.d.ts +11 -0
  156. package/dist/core/http/validator.js +1 -0
  157. package/dist/core/http/validator.js.map +1 -0
  158. package/dist/core/index.cjs +957 -0
  159. package/dist/core/index.cjs.map +1 -0
  160. package/dist/core/index.d.cts +18 -0
  161. package/dist/core/index.d.ts +18 -0
  162. package/dist/core/index.js +933 -0
  163. package/dist/core/index.js.map +1 -0
  164. package/dist/infra/adapters/http/express-adapter.cjs +577 -0
  165. package/dist/infra/adapters/http/express-adapter.cjs.map +1 -0
  166. package/dist/infra/adapters/http/express-adapter.d.cts +15 -0
  167. package/dist/infra/adapters/http/express-adapter.d.ts +15 -0
  168. package/dist/infra/adapters/http/express-adapter.js +556 -0
  169. package/dist/infra/adapters/http/express-adapter.js.map +1 -0
  170. package/dist/infra/adapters/http/fastify-adapter.cjs +562 -0
  171. package/dist/infra/adapters/http/fastify-adapter.cjs.map +1 -0
  172. package/dist/infra/adapters/http/fastify-adapter.d.cts +14 -0
  173. package/dist/infra/adapters/http/fastify-adapter.d.ts +14 -0
  174. package/dist/infra/adapters/http/fastify-adapter.js +541 -0
  175. package/dist/infra/adapters/http/fastify-adapter.js.map +1 -0
  176. package/dist/infra/adapters/http/response-error-code.cjs +35 -0
  177. package/dist/infra/adapters/http/response-error-code.cjs.map +1 -0
  178. package/dist/infra/adapters/http/response-error-code.d.cts +6 -0
  179. package/dist/infra/adapters/http/response-error-code.d.ts +6 -0
  180. package/dist/infra/adapters/http/response-error-code.js +10 -0
  181. package/dist/infra/adapters/http/response-error-code.js.map +1 -0
  182. package/dist/infra/adapters/http/validate-controller-metadata.cjs +42 -0
  183. package/dist/infra/adapters/http/validate-controller-metadata.cjs.map +1 -0
  184. package/dist/infra/adapters/http/validate-controller-metadata.d.cts +11 -0
  185. package/dist/infra/adapters/http/validate-controller-metadata.d.ts +11 -0
  186. package/dist/infra/adapters/http/validate-controller-metadata.js +19 -0
  187. package/dist/infra/adapters/http/validate-controller-metadata.js.map +1 -0
  188. package/dist/infra/adapters/notifications/discord.cjs +86 -0
  189. package/dist/infra/adapters/notifications/discord.cjs.map +1 -0
  190. package/dist/infra/adapters/notifications/discord.d.cts +14 -0
  191. package/dist/infra/adapters/notifications/discord.d.ts +14 -0
  192. package/dist/infra/adapters/notifications/discord.js +65 -0
  193. package/dist/infra/adapters/notifications/discord.js.map +1 -0
  194. package/dist/infra/adapters/notifications/in-memory.cjs +40 -0
  195. package/dist/infra/adapters/notifications/in-memory.cjs.map +1 -0
  196. package/dist/infra/adapters/notifications/in-memory.d.cts +8 -0
  197. package/dist/infra/adapters/notifications/in-memory.d.ts +8 -0
  198. package/dist/infra/adapters/notifications/in-memory.js +21 -0
  199. package/dist/infra/adapters/notifications/in-memory.js.map +1 -0
  200. package/dist/infra/adapters/notifications/sentry.cjs +129 -0
  201. package/dist/infra/adapters/notifications/sentry.cjs.map +1 -0
  202. package/dist/infra/adapters/notifications/sentry.d.cts +13 -0
  203. package/dist/infra/adapters/notifications/sentry.d.ts +13 -0
  204. package/dist/infra/adapters/notifications/sentry.js +96 -0
  205. package/dist/infra/adapters/notifications/sentry.js.map +1 -0
  206. package/dist/infra/adapters/validators/zod/index.cjs +179 -0
  207. package/dist/infra/adapters/validators/zod/index.cjs.map +1 -0
  208. package/dist/infra/adapters/validators/zod/index.d.cts +19 -0
  209. package/dist/infra/adapters/validators/zod/index.d.ts +19 -0
  210. package/dist/infra/adapters/validators/zod/index.js +154 -0
  211. package/dist/infra/adapters/validators/zod/index.js.map +1 -0
  212. package/dist/infra/adapters/validators/zod/zod-map-error.cjs +79 -0
  213. package/dist/infra/adapters/validators/zod/zod-map-error.cjs.map +1 -0
  214. package/dist/infra/adapters/validators/zod/zod-map-error.d.cts +15 -0
  215. package/dist/infra/adapters/validators/zod/zod-map-error.d.ts +15 -0
  216. package/dist/infra/adapters/validators/zod/zod-map-error.js +60 -0
  217. package/dist/infra/adapters/validators/zod/zod-map-error.js.map +1 -0
  218. package/dist/infra/adapters/validators/zod/zod-validator.cjs +178 -0
  219. package/dist/infra/adapters/validators/zod/zod-validator.cjs.map +1 -0
  220. package/dist/infra/adapters/validators/zod/zod-validator.d.cts +13 -0
  221. package/dist/infra/adapters/validators/zod/zod-validator.d.ts +13 -0
  222. package/dist/infra/adapters/validators/zod/zod-validator.js +153 -0
  223. package/dist/infra/adapters/validators/zod/zod-validator.js.map +1 -0
  224. package/dist/infra/env/index.cjs +473 -0
  225. package/dist/infra/env/index.cjs.map +1 -0
  226. package/dist/infra/env/index.d.cts +10 -0
  227. package/dist/infra/env/index.d.ts +10 -0
  228. package/dist/infra/env/index.js +456 -0
  229. package/dist/infra/env/index.js.map +1 -0
  230. package/dist/infra/index.cjs +781 -0
  231. package/dist/infra/index.cjs.map +1 -0
  232. package/dist/infra/index.d.cts +5 -0
  233. package/dist/infra/index.d.ts +5 -0
  234. package/dist/infra/index.js +752 -0
  235. package/dist/infra/index.js.map +1 -0
  236. package/package.json +82 -0
  237. package/readme.md +56 -0
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=domain-event.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/core/entities/entity.ts
22
+ var entity_exports = {};
23
+ __export(entity_exports, {
24
+ Entity: () => Entity
25
+ });
26
+ module.exports = __toCommonJS(entity_exports);
27
+
28
+ // src/core/entities/unique-entity-id.ts
29
+ var import_node_crypto = require("crypto");
30
+ var UniqueEntityId = class {
31
+ static {
32
+ __name(this, "UniqueEntityId");
33
+ }
34
+ value;
35
+ constructor(value) {
36
+ this.value = value ?? (0, import_node_crypto.randomUUID)();
37
+ }
38
+ toString() {
39
+ return this.value;
40
+ }
41
+ toValue() {
42
+ return this.value;
43
+ }
44
+ equals(id) {
45
+ return id.toValue() === this.toValue();
46
+ }
47
+ };
48
+
49
+ // src/core/entities/entity.ts
50
+ var Entity = class {
51
+ static {
52
+ __name(this, "Entity");
53
+ }
54
+ _id;
55
+ props;
56
+ get id() {
57
+ return this._id;
58
+ }
59
+ set id(id) {
60
+ this._id = id;
61
+ }
62
+ get createdAt() {
63
+ return this.props.createdAt;
64
+ }
65
+ set createdAt(date) {
66
+ this.props.createdAt = date;
67
+ }
68
+ get updatedAt() {
69
+ return this.props.updatedAt;
70
+ }
71
+ touch() {
72
+ this.props.updatedAt = /* @__PURE__ */ new Date();
73
+ }
74
+ constructor(props, id) {
75
+ this._id = id ?? new UniqueEntityId(id);
76
+ this.props = props;
77
+ }
78
+ equals(entity) {
79
+ if (entity === this) {
80
+ return true;
81
+ }
82
+ if (entity.id === this._id) {
83
+ return true;
84
+ }
85
+ return false;
86
+ }
87
+ };
88
+ // Annotate the CommonJS export names for ESM import in node:
89
+ 0 && (module.exports = {
90
+ Entity
91
+ });
92
+ //# sourceMappingURL=entity.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/core/entities/entity.ts","../../../src/core/entities/unique-entity-id.ts"],"sourcesContent":["import { CommonDTO } from './common-dto'\nimport { UniqueEntityId } from './unique-entity-id'\n\nexport abstract class Entity<Props extends CommonDTO> {\n private _id: UniqueEntityId\n protected props: Props\n\n get id() {\n return this._id\n }\n\n set id(id: UniqueEntityId) {\n this._id = id\n }\n\n get createdAt() {\n return this.props.createdAt\n }\n\n set createdAt(date: Date) {\n this.props.createdAt = date\n }\n\n get updatedAt(): Date | undefined | null {\n return this.props.updatedAt\n }\n\n public touch() {\n this.props.updatedAt = new Date()\n }\n\n protected constructor(props: Props, id?: UniqueEntityId) {\n this._id = id ?? new UniqueEntityId(id)\n this.props = props\n }\n\n public equals(entity: Entity<any>) {\n if (entity === this) {\n return true\n }\n\n if (entity.id === this._id) {\n return true\n }\n\n return false\n }\n}\n","import { randomUUID } from 'node:crypto'\n\nexport class UniqueEntityId {\n private value: string\n\n constructor(value?: string) {\n this.value = value ?? randomUUID()\n }\n\n toString() {\n return this.value\n }\n\n toValue() {\n return this.value\n }\n\n public equals(id: UniqueEntityId) {\n return id.toValue() === this.toValue()\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA;;;;;;;ACDA,yBAA2B;AAEpB,IAAMA,iBAAN,MAAMA;EAFb,OAEaA;;;EACHC;EAERC,YAAYD,OAAgB;AAC1B,SAAKA,QAAQA,aAASE,+BAAAA;EACxB;EAEAC,WAAW;AACT,WAAO,KAAKH;EACd;EAEAI,UAAU;AACR,WAAO,KAAKJ;EACd;EAEOK,OAAOC,IAAoB;AAChC,WAAOA,GAAGF,QAAO,MAAO,KAAKA,QAAO;EACtC;AACF;;;ADjBO,IAAeG,SAAf,MAAeA;EAFtB,OAEsBA;;;EACZC;EACEC;EAEV,IAAIC,KAAK;AACP,WAAO,KAAKF;EACd;EAEA,IAAIE,GAAGA,IAAoB;AACzB,SAAKF,MAAME;EACb;EAEA,IAAIC,YAAY;AACd,WAAO,KAAKF,MAAME;EACpB;EAEA,IAAIA,UAAUC,MAAY;AACxB,SAAKH,MAAME,YAAYC;EACzB;EAEA,IAAIC,YAAqC;AACvC,WAAO,KAAKJ,MAAMI;EACpB;EAEOC,QAAQ;AACb,SAAKL,MAAMI,YAAY,oBAAIE,KAAAA;EAC7B;EAEA,YAAsBN,OAAcC,IAAqB;AACvD,SAAKF,MAAME,MAAM,IAAIM,eAAeN,EAAAA;AACpC,SAAKD,QAAQA;EACf;EAEOQ,OAAOC,QAAqB;AACjC,QAAIA,WAAW,MAAM;AACnB,aAAO;IACT;AAEA,QAAIA,OAAOR,OAAO,KAAKF,KAAK;AAC1B,aAAO;IACT;AAEA,WAAO;EACT;AACF;","names":["UniqueEntityId","value","constructor","randomUUID","toString","toValue","equals","id","Entity","_id","props","id","createdAt","date","updatedAt","touch","Date","UniqueEntityId","equals","entity"]}
@@ -0,0 +1,17 @@
1
+ import { CommonDTO } from './common-dto.cjs';
2
+ import { UniqueEntityId } from './unique-entity-id.cjs';
3
+
4
+ declare abstract class Entity<Props extends CommonDTO> {
5
+ private _id;
6
+ protected props: Props;
7
+ get id(): UniqueEntityId;
8
+ set id(id: UniqueEntityId);
9
+ get createdAt(): Date;
10
+ set createdAt(date: Date);
11
+ get updatedAt(): Date | undefined | null;
12
+ touch(): void;
13
+ protected constructor(props: Props, id?: UniqueEntityId);
14
+ equals(entity: Entity<any>): boolean;
15
+ }
16
+
17
+ export { Entity };
@@ -0,0 +1,17 @@
1
+ import { CommonDTO } from './common-dto.js';
2
+ import { UniqueEntityId } from './unique-entity-id.js';
3
+
4
+ declare abstract class Entity<Props extends CommonDTO> {
5
+ private _id;
6
+ protected props: Props;
7
+ get id(): UniqueEntityId;
8
+ set id(id: UniqueEntityId);
9
+ get createdAt(): Date;
10
+ set createdAt(date: Date);
11
+ get updatedAt(): Date | undefined | null;
12
+ touch(): void;
13
+ protected constructor(props: Props, id?: UniqueEntityId);
14
+ equals(entity: Entity<any>): boolean;
15
+ }
16
+
17
+ export { Entity };
@@ -0,0 +1,67 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ // src/core/entities/unique-entity-id.ts
5
+ import { randomUUID } from "crypto";
6
+ var UniqueEntityId = class {
7
+ static {
8
+ __name(this, "UniqueEntityId");
9
+ }
10
+ value;
11
+ constructor(value) {
12
+ this.value = value ?? randomUUID();
13
+ }
14
+ toString() {
15
+ return this.value;
16
+ }
17
+ toValue() {
18
+ return this.value;
19
+ }
20
+ equals(id) {
21
+ return id.toValue() === this.toValue();
22
+ }
23
+ };
24
+
25
+ // src/core/entities/entity.ts
26
+ var Entity = class {
27
+ static {
28
+ __name(this, "Entity");
29
+ }
30
+ _id;
31
+ props;
32
+ get id() {
33
+ return this._id;
34
+ }
35
+ set id(id) {
36
+ this._id = id;
37
+ }
38
+ get createdAt() {
39
+ return this.props.createdAt;
40
+ }
41
+ set createdAt(date) {
42
+ this.props.createdAt = date;
43
+ }
44
+ get updatedAt() {
45
+ return this.props.updatedAt;
46
+ }
47
+ touch() {
48
+ this.props.updatedAt = /* @__PURE__ */ new Date();
49
+ }
50
+ constructor(props, id) {
51
+ this._id = id ?? new UniqueEntityId(id);
52
+ this.props = props;
53
+ }
54
+ equals(entity) {
55
+ if (entity === this) {
56
+ return true;
57
+ }
58
+ if (entity.id === this._id) {
59
+ return true;
60
+ }
61
+ return false;
62
+ }
63
+ };
64
+ export {
65
+ Entity
66
+ };
67
+ //# sourceMappingURL=entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/core/entities/unique-entity-id.ts","../../../src/core/entities/entity.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto'\n\nexport class UniqueEntityId {\n private value: string\n\n constructor(value?: string) {\n this.value = value ?? randomUUID()\n }\n\n toString() {\n return this.value\n }\n\n toValue() {\n return this.value\n }\n\n public equals(id: UniqueEntityId) {\n return id.toValue() === this.toValue()\n }\n}\n","import { CommonDTO } from './common-dto'\nimport { UniqueEntityId } from './unique-entity-id'\n\nexport abstract class Entity<Props extends CommonDTO> {\n private _id: UniqueEntityId\n protected props: Props\n\n get id() {\n return this._id\n }\n\n set id(id: UniqueEntityId) {\n this._id = id\n }\n\n get createdAt() {\n return this.props.createdAt\n }\n\n set createdAt(date: Date) {\n this.props.createdAt = date\n }\n\n get updatedAt(): Date | undefined | null {\n return this.props.updatedAt\n }\n\n public touch() {\n this.props.updatedAt = new Date()\n }\n\n protected constructor(props: Props, id?: UniqueEntityId) {\n this._id = id ?? new UniqueEntityId(id)\n this.props = props\n }\n\n public equals(entity: Entity<any>) {\n if (entity === this) {\n return true\n }\n\n if (entity.id === this._id) {\n return true\n }\n\n return false\n }\n}\n"],"mappings":";;;;AAAA,SAASA,kBAAkB;AAEpB,IAAMC,iBAAN,MAAMA;EAFb,OAEaA;;;EACHC;EAERC,YAAYD,OAAgB;AAC1B,SAAKA,QAAQA,SAASE,WAAAA;EACxB;EAEAC,WAAW;AACT,WAAO,KAAKH;EACd;EAEAI,UAAU;AACR,WAAO,KAAKJ;EACd;EAEOK,OAAOC,IAAoB;AAChC,WAAOA,GAAGF,QAAO,MAAO,KAAKA,QAAO;EACtC;AACF;;;ACjBO,IAAeG,SAAf,MAAeA;EAFtB,OAEsBA;;;EACZC;EACEC;EAEV,IAAIC,KAAK;AACP,WAAO,KAAKF;EACd;EAEA,IAAIE,GAAGA,IAAoB;AACzB,SAAKF,MAAME;EACb;EAEA,IAAIC,YAAY;AACd,WAAO,KAAKF,MAAME;EACpB;EAEA,IAAIA,UAAUC,MAAY;AACxB,SAAKH,MAAME,YAAYC;EACzB;EAEA,IAAIC,YAAqC;AACvC,WAAO,KAAKJ,MAAMI;EACpB;EAEOC,QAAQ;AACb,SAAKL,MAAMI,YAAY,oBAAIE,KAAAA;EAC7B;EAEA,YAAsBN,OAAcC,IAAqB;AACvD,SAAKF,MAAME,MAAM,IAAIM,eAAeN,EAAAA;AACpC,SAAKD,QAAQA;EACf;EAEOQ,OAAOC,QAAqB;AACjC,QAAIA,WAAW,MAAM;AACnB,aAAO;IACT;AAEA,QAAIA,OAAOR,OAAO,KAAKF,KAAK;AAC1B,aAAO;IACT;AAEA,WAAO;EACT;AACF;","names":["randomUUID","UniqueEntityId","value","constructor","randomUUID","toString","toValue","equals","id","Entity","_id","props","id","createdAt","date","updatedAt","touch","Date","UniqueEntityId","equals","entity"]}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/core/entities/optional.ts
17
+ var optional_exports = {};
18
+ module.exports = __toCommonJS(optional_exports);
19
+ //# sourceMappingURL=optional.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/core/entities/optional.ts"],"sourcesContent":["export type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;;","names":[]}
@@ -0,0 +1,3 @@
1
+ type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
2
+
3
+ export { Optional };
@@ -0,0 +1,3 @@
1
+ type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
2
+
3
+ export { Optional };
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=optional.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/core/entities/unique-entity-id.ts
22
+ var unique_entity_id_exports = {};
23
+ __export(unique_entity_id_exports, {
24
+ UniqueEntityId: () => UniqueEntityId
25
+ });
26
+ module.exports = __toCommonJS(unique_entity_id_exports);
27
+ var import_node_crypto = require("crypto");
28
+ var UniqueEntityId = class {
29
+ static {
30
+ __name(this, "UniqueEntityId");
31
+ }
32
+ value;
33
+ constructor(value) {
34
+ this.value = value ?? (0, import_node_crypto.randomUUID)();
35
+ }
36
+ toString() {
37
+ return this.value;
38
+ }
39
+ toValue() {
40
+ return this.value;
41
+ }
42
+ equals(id) {
43
+ return id.toValue() === this.toValue();
44
+ }
45
+ };
46
+ // Annotate the CommonJS export names for ESM import in node:
47
+ 0 && (module.exports = {
48
+ UniqueEntityId
49
+ });
50
+ //# sourceMappingURL=unique-entity-id.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/core/entities/unique-entity-id.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto'\n\nexport class UniqueEntityId {\n private value: string\n\n constructor(value?: string) {\n this.value = value ?? randomUUID()\n }\n\n toString() {\n return this.value\n }\n\n toValue() {\n return this.value\n }\n\n public equals(id: UniqueEntityId) {\n return id.toValue() === this.toValue()\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;yBAA2B;AAEpB,IAAMA,iBAAN,MAAMA;EAFb,OAEaA;;;EACHC;EAERC,YAAYD,OAAgB;AAC1B,SAAKA,QAAQA,aAASE,+BAAAA;EACxB;EAEAC,WAAW;AACT,WAAO,KAAKH;EACd;EAEAI,UAAU;AACR,WAAO,KAAKJ;EACd;EAEOK,OAAOC,IAAoB;AAChC,WAAOA,GAAGF,QAAO,MAAO,KAAKA,QAAO;EACtC;AACF;","names":["UniqueEntityId","value","constructor","randomUUID","toString","toValue","equals","id"]}
@@ -0,0 +1,9 @@
1
+ declare class UniqueEntityId {
2
+ private value;
3
+ constructor(value?: string);
4
+ toString(): string;
5
+ toValue(): string;
6
+ equals(id: UniqueEntityId): boolean;
7
+ }
8
+
9
+ export { UniqueEntityId };
@@ -0,0 +1,9 @@
1
+ declare class UniqueEntityId {
2
+ private value;
3
+ constructor(value?: string);
4
+ toString(): string;
5
+ toValue(): string;
6
+ equals(id: UniqueEntityId): boolean;
7
+ }
8
+
9
+ export { UniqueEntityId };
@@ -0,0 +1,27 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ // src/core/entities/unique-entity-id.ts
5
+ import { randomUUID } from "crypto";
6
+ var UniqueEntityId = class {
7
+ static {
8
+ __name(this, "UniqueEntityId");
9
+ }
10
+ value;
11
+ constructor(value) {
12
+ this.value = value ?? randomUUID();
13
+ }
14
+ toString() {
15
+ return this.value;
16
+ }
17
+ toValue() {
18
+ return this.value;
19
+ }
20
+ equals(id) {
21
+ return id.toValue() === this.toValue();
22
+ }
23
+ };
24
+ export {
25
+ UniqueEntityId
26
+ };
27
+ //# sourceMappingURL=unique-entity-id.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/core/entities/unique-entity-id.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto'\n\nexport class UniqueEntityId {\n private value: string\n\n constructor(value?: string) {\n this.value = value ?? randomUUID()\n }\n\n toString() {\n return this.value\n }\n\n toValue() {\n return this.value\n }\n\n public equals(id: UniqueEntityId) {\n return id.toValue() === this.toValue()\n }\n}\n"],"mappings":";;;;AAAA,SAASA,kBAAkB;AAEpB,IAAMC,iBAAN,MAAMA;EAFb,OAEaA;;;EACHC;EAERC,YAAYD,OAAgB;AAC1B,SAAKA,QAAQA,SAASE,WAAAA;EACxB;EAEAC,WAAW;AACT,WAAO,KAAKH;EACd;EAEAI,UAAU;AACR,WAAO,KAAKJ;EACd;EAEOK,OAAOC,IAAoB;AAChC,WAAOA,GAAGF,QAAO,MAAO,KAAKA,QAAO;EACtC;AACF;","names":["randomUUID","UniqueEntityId","value","constructor","randomUUID","toString","toValue","equals","id"]}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/core/entities/value-object.ts
22
+ var value_object_exports = {};
23
+ __export(value_object_exports, {
24
+ ValueObject: () => ValueObject
25
+ });
26
+ module.exports = __toCommonJS(value_object_exports);
27
+ var ValueObject = class {
28
+ static {
29
+ __name(this, "ValueObject");
30
+ }
31
+ props;
32
+ constructor(props) {
33
+ this.props = props;
34
+ }
35
+ };
36
+ // Annotate the CommonJS export names for ESM import in node:
37
+ 0 && (module.exports = {
38
+ ValueObject
39
+ });
40
+ //# sourceMappingURL=value-object.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/core/entities/value-object.ts"],"sourcesContent":["export abstract class ValueObject<Props> {\n protected props: Props\n\n protected constructor(props: Props) {\n this.props = props\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;AAAO,IAAeA,cAAf,MAAeA;EAAtB,OAAsBA;;;EACVC;EAEV,YAAsBA,OAAc;AAClC,SAAKA,QAAQA;EACf;AACF;","names":["ValueObject","props"]}
@@ -0,0 +1,6 @@
1
+ declare abstract class ValueObject<Props> {
2
+ protected props: Props;
3
+ protected constructor(props: Props);
4
+ }
5
+
6
+ export { ValueObject };
@@ -0,0 +1,6 @@
1
+ declare abstract class ValueObject<Props> {
2
+ protected props: Props;
3
+ protected constructor(props: Props);
4
+ }
5
+
6
+ export { ValueObject };
@@ -0,0 +1,17 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ // src/core/entities/value-object.ts
5
+ var ValueObject = class {
6
+ static {
7
+ __name(this, "ValueObject");
8
+ }
9
+ props;
10
+ constructor(props) {
11
+ this.props = props;
12
+ }
13
+ };
14
+ export {
15
+ ValueObject
16
+ };
17
+ //# sourceMappingURL=value-object.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/core/entities/value-object.ts"],"sourcesContent":["export abstract class ValueObject<Props> {\n protected props: Props\n\n protected constructor(props: Props) {\n this.props = props\n }\n}\n"],"mappings":";;;;AAAO,IAAeA,cAAf,MAAeA;EAAtB,OAAsBA;;;EACVC;EAEV,YAAsBA,OAAc;AAClC,SAAKA,QAAQA;EACf;AACF;","names":["ValueObject","props"]}
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/core/entities/watched-list.ts
22
+ var watched_list_exports = {};
23
+ __export(watched_list_exports, {
24
+ WatchedList: () => WatchedList
25
+ });
26
+ module.exports = __toCommonJS(watched_list_exports);
27
+ var WatchedList = class {
28
+ static {
29
+ __name(this, "WatchedList");
30
+ }
31
+ currentItems;
32
+ initial;
33
+ new;
34
+ removed;
35
+ updated;
36
+ constructor(initialItems) {
37
+ this.currentItems = initialItems || [];
38
+ this.initial = initialItems || [];
39
+ this.new = [];
40
+ this.removed = [];
41
+ this.updated = [];
42
+ }
43
+ getItems() {
44
+ return this.currentItems;
45
+ }
46
+ getNewItems() {
47
+ return this.new;
48
+ }
49
+ getRemovedItems() {
50
+ return this.removed;
51
+ }
52
+ getUpdatedItems() {
53
+ return this.updated;
54
+ }
55
+ addUpdatedItem(item) {
56
+ return this.updated.push(item);
57
+ }
58
+ isCurrentItem(item) {
59
+ return this.currentItems.filter((v) => this.compareItems(item, v)).length !== 0;
60
+ }
61
+ isNewItem(item) {
62
+ return this.new.filter((v) => this.compareItems(item, v)).length !== 0;
63
+ }
64
+ isRemovedItem(item) {
65
+ return this.removed.filter((v) => this.compareItems(item, v)).length !== 0;
66
+ }
67
+ removeFromNew(item) {
68
+ this.new = this.new.filter((v) => !this.compareItems(v, item));
69
+ }
70
+ removeFromCurrent(item) {
71
+ this.currentItems = this.currentItems.filter((v) => !this.compareItems(item, v));
72
+ }
73
+ removeFromRemoved(item) {
74
+ this.removed = this.removed.filter((v) => !this.compareItems(item, v));
75
+ }
76
+ wasAddedInitially(item) {
77
+ return this.initial.filter((v) => this.compareItems(item, v)).length !== 0;
78
+ }
79
+ exists(item) {
80
+ return this.isCurrentItem(item);
81
+ }
82
+ add(item) {
83
+ if (this.isRemovedItem(item)) {
84
+ this.removeFromRemoved(item);
85
+ }
86
+ if (!this.isNewItem(item) && !this.wasAddedInitially(item)) {
87
+ this.new.push(item);
88
+ }
89
+ if (!this.isCurrentItem(item)) {
90
+ this.currentItems.push(item);
91
+ }
92
+ }
93
+ remove(item) {
94
+ this.removeFromCurrent(item);
95
+ if (this.isNewItem(item)) {
96
+ this.removeFromNew(item);
97
+ return;
98
+ }
99
+ if (!this.isRemovedItem(item)) {
100
+ this.removed.push(item);
101
+ }
102
+ }
103
+ update(items) {
104
+ const newItems = items.filter((a) => {
105
+ return !this.getItems().some((b) => this.compareItems(a, b));
106
+ });
107
+ const removedItems = this.getItems().filter((a) => {
108
+ return !items.some((b) => this.compareItems(a, b));
109
+ });
110
+ const updatedItems = items.filter((item) => !newItems.some((a) => this.compareItems(item, a) && !removedItems.some((b) => this.compareItems(item, b))));
111
+ this.currentItems = items;
112
+ this.new = newItems;
113
+ this.removed = removedItems;
114
+ this.updated = updatedItems;
115
+ }
116
+ };
117
+ // Annotate the CommonJS export names for ESM import in node:
118
+ 0 && (module.exports = {
119
+ WatchedList
120
+ });
121
+ //# sourceMappingURL=watched-list.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/core/entities/watched-list.ts"],"sourcesContent":["export abstract class WatchedList<T> {\n public currentItems: T[]\n private initial: T[]\n private new: T[]\n private removed: T[]\n private updated: T[]\n\n constructor(initialItems?: T[]) {\n this.currentItems = initialItems || []\n this.initial = initialItems || []\n this.new = []\n this.removed = []\n this.updated = []\n }\n\n abstract compareItems(a: T, b: T): boolean\n\n public getItems(): T[] {\n return this.currentItems\n }\n\n public getNewItems(): T[] {\n return this.new\n }\n\n public getRemovedItems(): T[] {\n return this.removed\n }\n\n public getUpdatedItems(): T[] {\n return this.updated\n }\n\n public addUpdatedItem(item: T) {\n return this.updated.push(item)\n }\n\n private isCurrentItem(item: T): boolean {\n return (\n this.currentItems.filter((v: T) => this.compareItems(item, v)).length !==\n 0\n )\n }\n\n private isNewItem(item: T): boolean {\n return this.new.filter((v: T) => this.compareItems(item, v)).length !== 0\n }\n\n private isRemovedItem(item: T): boolean {\n return (\n this.removed.filter((v: T) => this.compareItems(item, v)).length !== 0\n )\n }\n\n private removeFromNew(item: T): void {\n this.new = this.new.filter((v) => !this.compareItems(v, item))\n }\n\n private removeFromCurrent(item: T): void {\n this.currentItems = this.currentItems.filter(\n (v) => !this.compareItems(item, v)\n )\n }\n\n private removeFromRemoved(item: T): void {\n this.removed = this.removed.filter((v) => !this.compareItems(item, v))\n }\n\n private wasAddedInitially(item: T): boolean {\n return (\n this.initial.filter((v: T) => this.compareItems(item, v)).length !== 0\n )\n }\n\n public exists(item: T): boolean {\n return this.isCurrentItem(item)\n }\n\n public add(item: T): void {\n if (this.isRemovedItem(item)) {\n this.removeFromRemoved(item)\n }\n\n if (!this.isNewItem(item) && !this.wasAddedInitially(item)) {\n this.new.push(item)\n }\n\n if (!this.isCurrentItem(item)) {\n this.currentItems.push(item)\n }\n }\n\n public remove(item: T): void {\n this.removeFromCurrent(item)\n\n if (this.isNewItem(item)) {\n this.removeFromNew(item)\n\n return\n }\n\n if (!this.isRemovedItem(item)) {\n this.removed.push(item)\n }\n }\n\n public update(items: T[]): void {\n const newItems = items.filter((a) => {\n return !this.getItems().some((b) => this.compareItems(a, b))\n })\n\n const removedItems = this.getItems().filter((a) => {\n return !items.some((b) => this.compareItems(a, b))\n })\n\n const updatedItems = items.filter(\n (item) =>\n !newItems.some(\n (a) =>\n this.compareItems(item, a) &&\n !removedItems.some((b) => this.compareItems(item, b))\n )\n )\n\n this.currentItems = items\n this.new = newItems\n this.removed = removedItems\n this.updated = updatedItems\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;AAAO,IAAeA,cAAf,MAAeA;EAAtB,OAAsBA;;;EACbC;EACCC;EACAC;EACAC;EACAC;EAERC,YAAYC,cAAoB;AAC9B,SAAKN,eAAeM,gBAAgB,CAAA;AACpC,SAAKL,UAAUK,gBAAgB,CAAA;AAC/B,SAAKJ,MAAM,CAAA;AACX,SAAKC,UAAU,CAAA;AACf,SAAKC,UAAU,CAAA;EACjB;EAIOG,WAAgB;AACrB,WAAO,KAAKP;EACd;EAEOQ,cAAmB;AACxB,WAAO,KAAKN;EACd;EAEOO,kBAAuB;AAC5B,WAAO,KAAKN;EACd;EAEOO,kBAAuB;AAC5B,WAAO,KAAKN;EACd;EAEOO,eAAeC,MAAS;AAC7B,WAAO,KAAKR,QAAQS,KAAKD,IAAAA;EAC3B;EAEQE,cAAcF,MAAkB;AACtC,WACE,KAAKZ,aAAae,OAAO,CAACC,MAAS,KAAKC,aAAaL,MAAMI,CAAAA,CAAAA,EAAIE,WAC/D;EAEJ;EAEQC,UAAUP,MAAkB;AAClC,WAAO,KAAKV,IAAIa,OAAO,CAACC,MAAS,KAAKC,aAAaL,MAAMI,CAAAA,CAAAA,EAAIE,WAAW;EAC1E;EAEQE,cAAcR,MAAkB;AACtC,WACE,KAAKT,QAAQY,OAAO,CAACC,MAAS,KAAKC,aAAaL,MAAMI,CAAAA,CAAAA,EAAIE,WAAW;EAEzE;EAEQG,cAAcT,MAAe;AACnC,SAAKV,MAAM,KAAKA,IAAIa,OAAO,CAACC,MAAM,CAAC,KAAKC,aAAaD,GAAGJ,IAAAA,CAAAA;EAC1D;EAEQU,kBAAkBV,MAAe;AACvC,SAAKZ,eAAe,KAAKA,aAAae,OACpC,CAACC,MAAM,CAAC,KAAKC,aAAaL,MAAMI,CAAAA,CAAAA;EAEpC;EAEQO,kBAAkBX,MAAe;AACvC,SAAKT,UAAU,KAAKA,QAAQY,OAAO,CAACC,MAAM,CAAC,KAAKC,aAAaL,MAAMI,CAAAA,CAAAA;EACrE;EAEQQ,kBAAkBZ,MAAkB;AAC1C,WACE,KAAKX,QAAQc,OAAO,CAACC,MAAS,KAAKC,aAAaL,MAAMI,CAAAA,CAAAA,EAAIE,WAAW;EAEzE;EAEOO,OAAOb,MAAkB;AAC9B,WAAO,KAAKE,cAAcF,IAAAA;EAC5B;EAEOc,IAAId,MAAe;AACxB,QAAI,KAAKQ,cAAcR,IAAAA,GAAO;AAC5B,WAAKW,kBAAkBX,IAAAA;IACzB;AAEA,QAAI,CAAC,KAAKO,UAAUP,IAAAA,KAAS,CAAC,KAAKY,kBAAkBZ,IAAAA,GAAO;AAC1D,WAAKV,IAAIW,KAAKD,IAAAA;IAChB;AAEA,QAAI,CAAC,KAAKE,cAAcF,IAAAA,GAAO;AAC7B,WAAKZ,aAAaa,KAAKD,IAAAA;IACzB;EACF;EAEOe,OAAOf,MAAe;AAC3B,SAAKU,kBAAkBV,IAAAA;AAEvB,QAAI,KAAKO,UAAUP,IAAAA,GAAO;AACxB,WAAKS,cAAcT,IAAAA;AAEnB;IACF;AAEA,QAAI,CAAC,KAAKQ,cAAcR,IAAAA,GAAO;AAC7B,WAAKT,QAAQU,KAAKD,IAAAA;IACpB;EACF;EAEOgB,OAAOC,OAAkB;AAC9B,UAAMC,WAAWD,MAAMd,OAAO,CAACgB,MAAAA;AAC7B,aAAO,CAAC,KAAKxB,SAAQ,EAAGyB,KAAK,CAACC,MAAM,KAAKhB,aAAac,GAAGE,CAAAA,CAAAA;IAC3D,CAAA;AAEA,UAAMC,eAAe,KAAK3B,SAAQ,EAAGQ,OAAO,CAACgB,MAAAA;AAC3C,aAAO,CAACF,MAAMG,KAAK,CAACC,MAAM,KAAKhB,aAAac,GAAGE,CAAAA,CAAAA;IACjD,CAAA;AAEA,UAAME,eAAeN,MAAMd,OACzB,CAACH,SACC,CAACkB,SAASE,KACR,CAACD,MACC,KAAKd,aAAaL,MAAMmB,CAAAA,KACxB,CAACG,aAAaF,KAAK,CAACC,MAAM,KAAKhB,aAAaL,MAAMqB,CAAAA,CAAAA,CAAAA,CAAAA;AAI1D,SAAKjC,eAAe6B;AACpB,SAAK3B,MAAM4B;AACX,SAAK3B,UAAU+B;AACf,SAAK9B,UAAU+B;EACjB;AACF;","names":["WatchedList","currentItems","initial","new","removed","updated","constructor","initialItems","getItems","getNewItems","getRemovedItems","getUpdatedItems","addUpdatedItem","item","push","isCurrentItem","filter","v","compareItems","length","isNewItem","isRemovedItem","removeFromNew","removeFromCurrent","removeFromRemoved","wasAddedInitially","exists","add","remove","update","items","newItems","a","some","b","removedItems","updatedItems"]}
@@ -0,0 +1,27 @@
1
+ declare abstract class WatchedList<T> {
2
+ currentItems: T[];
3
+ private initial;
4
+ private new;
5
+ private removed;
6
+ private updated;
7
+ constructor(initialItems?: T[]);
8
+ abstract compareItems(a: T, b: T): boolean;
9
+ getItems(): T[];
10
+ getNewItems(): T[];
11
+ getRemovedItems(): T[];
12
+ getUpdatedItems(): T[];
13
+ addUpdatedItem(item: T): number;
14
+ private isCurrentItem;
15
+ private isNewItem;
16
+ private isRemovedItem;
17
+ private removeFromNew;
18
+ private removeFromCurrent;
19
+ private removeFromRemoved;
20
+ private wasAddedInitially;
21
+ exists(item: T): boolean;
22
+ add(item: T): void;
23
+ remove(item: T): void;
24
+ update(items: T[]): void;
25
+ }
26
+
27
+ export { WatchedList };
@@ -0,0 +1,27 @@
1
+ declare abstract class WatchedList<T> {
2
+ currentItems: T[];
3
+ private initial;
4
+ private new;
5
+ private removed;
6
+ private updated;
7
+ constructor(initialItems?: T[]);
8
+ abstract compareItems(a: T, b: T): boolean;
9
+ getItems(): T[];
10
+ getNewItems(): T[];
11
+ getRemovedItems(): T[];
12
+ getUpdatedItems(): T[];
13
+ addUpdatedItem(item: T): number;
14
+ private isCurrentItem;
15
+ private isNewItem;
16
+ private isRemovedItem;
17
+ private removeFromNew;
18
+ private removeFromCurrent;
19
+ private removeFromRemoved;
20
+ private wasAddedInitially;
21
+ exists(item: T): boolean;
22
+ add(item: T): void;
23
+ remove(item: T): void;
24
+ update(items: T[]): void;
25
+ }
26
+
27
+ export { WatchedList };