@schorts/shared-kernel 1.0.2 → 1.0.4

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 (202) hide show
  1. package/CHANGELOG +25 -0
  2. package/dist/auth/auth-provider.d.ts +10 -0
  3. package/dist/auth/auth-provider.d.ts.map +1 -0
  4. package/dist/auth/auth-provider.js +3 -0
  5. package/dist/auth/auth-provider.js.map +1 -0
  6. package/dist/auth/exceptions/index.d.ts +2 -0
  7. package/dist/auth/exceptions/index.d.ts.map +1 -0
  8. package/dist/auth/exceptions/index.js +6 -0
  9. package/dist/auth/exceptions/index.js.map +1 -0
  10. package/dist/auth/exceptions/not-authenticated.d.ts +3 -0
  11. package/dist/auth/exceptions/not-authenticated.d.ts.map +1 -0
  12. package/dist/auth/exceptions/not-authenticated.js +7 -0
  13. package/dist/auth/exceptions/not-authenticated.js.map +1 -0
  14. package/dist/auth/index.d.ts +4 -0
  15. package/dist/auth/index.d.ts.map +1 -0
  16. package/dist/auth/index.js +8 -0
  17. package/dist/auth/index.js.map +1 -0
  18. package/dist/auth/require-auth.decorator.d.ts +5 -0
  19. package/dist/auth/require-auth.decorator.d.ts.map +1 -0
  20. package/dist/auth/require-auth.decorator.js +36 -0
  21. package/dist/auth/require-auth.decorator.js.map +1 -0
  22. package/dist/criteria/criteria.d.ts +15 -0
  23. package/dist/criteria/criteria.d.ts.map +1 -0
  24. package/dist/criteria/criteria.js +34 -0
  25. package/dist/criteria/criteria.js.map +1 -0
  26. package/dist/criteria/direction.d.ts +2 -0
  27. package/dist/criteria/direction.d.ts.map +1 -0
  28. package/dist/criteria/direction.js +3 -0
  29. package/dist/criteria/direction.js.map +1 -0
  30. package/dist/criteria/exceptions/index.d.ts +3 -0
  31. package/dist/criteria/exceptions/index.d.ts.map +1 -0
  32. package/dist/criteria/exceptions/index.js +8 -0
  33. package/dist/criteria/exceptions/index.js.map +1 -0
  34. package/dist/criteria/exceptions/limit-not-valid.d.ts +3 -0
  35. package/dist/criteria/exceptions/limit-not-valid.d.ts.map +1 -0
  36. package/dist/criteria/exceptions/limit-not-valid.js +7 -0
  37. package/dist/criteria/exceptions/limit-not-valid.js.map +1 -0
  38. package/dist/criteria/exceptions/offset-not-valid.d.ts +3 -0
  39. package/dist/criteria/exceptions/offset-not-valid.d.ts.map +1 -0
  40. package/dist/criteria/exceptions/offset-not-valid.js +7 -0
  41. package/dist/criteria/exceptions/offset-not-valid.js.map +1 -0
  42. package/dist/criteria/filter-criterion.d.ts +6 -0
  43. package/dist/criteria/filter-criterion.d.ts.map +1 -0
  44. package/dist/criteria/filter-criterion.js +3 -0
  45. package/dist/criteria/filter-criterion.js.map +1 -0
  46. package/dist/criteria/index.d.ts +7 -0
  47. package/dist/criteria/index.d.ts.map +1 -0
  48. package/dist/criteria/index.js +9 -0
  49. package/dist/criteria/index.js.map +1 -0
  50. package/dist/criteria/operator.d.ts +2 -0
  51. package/dist/criteria/operator.d.ts.map +1 -0
  52. package/dist/criteria/operator.js +3 -0
  53. package/dist/criteria/operator.js.map +1 -0
  54. package/dist/criteria/order.d.ts +5 -0
  55. package/dist/criteria/order.d.ts.map +1 -0
  56. package/dist/criteria/order.js +3 -0
  57. package/dist/criteria/order.js.map +1 -0
  58. package/dist/domain-events/domain-event-primitives.d.ts +8 -0
  59. package/dist/domain-events/domain-event-primitives.d.ts.map +1 -0
  60. package/dist/domain-events/domain-event-primitives.js +3 -0
  61. package/dist/domain-events/domain-event-primitives.js.map +1 -0
  62. package/dist/domain-events/domain-event.d.ts +13 -0
  63. package/dist/domain-events/domain-event.d.ts.map +1 -0
  64. package/dist/domain-events/domain-event.js +19 -0
  65. package/dist/domain-events/domain-event.js.map +1 -0
  66. package/dist/domain-events/index.d.ts +3 -0
  67. package/dist/domain-events/index.d.ts.map +1 -0
  68. package/dist/domain-events/index.js +6 -0
  69. package/dist/domain-events/index.js.map +1 -0
  70. package/dist/entities/entity.d.ts +12 -0
  71. package/dist/entities/entity.d.ts.map +1 -0
  72. package/dist/entities/entity.js +20 -0
  73. package/dist/entities/entity.js.map +1 -0
  74. package/dist/entities/index.d.ts +2 -0
  75. package/dist/entities/index.d.ts.map +1 -0
  76. package/dist/entities/index.js +6 -0
  77. package/dist/entities/index.js.map +1 -0
  78. package/dist/formatters/index.d.ts +2 -0
  79. package/dist/formatters/index.d.ts.map +1 -0
  80. package/dist/formatters/index.js +6 -0
  81. package/dist/formatters/index.js.map +1 -0
  82. package/dist/formatters/pascal-camel-to-snake.d.ts +4 -0
  83. package/dist/formatters/pascal-camel-to-snake.d.ts.map +1 -0
  84. package/dist/formatters/pascal-camel-to-snake.js +13 -0
  85. package/dist/formatters/pascal-camel-to-snake.js.map +1 -0
  86. package/dist/http/exceptions/http-exception.d.ts +6 -0
  87. package/dist/http/exceptions/http-exception.d.ts.map +1 -0
  88. package/dist/http/exceptions/http-exception.js +14 -0
  89. package/dist/http/exceptions/http-exception.js.map +1 -0
  90. package/dist/http/exceptions/index.d.ts +2 -0
  91. package/dist/http/exceptions/index.d.ts.map +1 -0
  92. package/dist/http/exceptions/index.js +6 -0
  93. package/dist/http/exceptions/index.js.map +1 -0
  94. package/dist/http/fetch-http-provider.d.ts +13 -0
  95. package/dist/http/fetch-http-provider.d.ts.map +1 -0
  96. package/dist/http/fetch-http-provider.js +88 -0
  97. package/dist/http/fetch-http-provider.js.map +1 -0
  98. package/dist/http/http-provider.d.ts +8 -0
  99. package/dist/http/http-provider.d.ts.map +1 -0
  100. package/dist/http/http-provider.js +3 -0
  101. package/dist/http/http-provider.js.map +1 -0
  102. package/dist/http/index.d.ts +4 -0
  103. package/dist/http/index.d.ts.map +1 -0
  104. package/dist/http/index.js +8 -0
  105. package/dist/http/index.js.map +1 -0
  106. package/dist/json-api/index.d.ts +5 -0
  107. package/dist/json-api/index.d.ts.map +1 -0
  108. package/dist/json-api/index.js +8 -0
  109. package/dist/json-api/index.js.map +1 -0
  110. package/dist/json-api/json-api-connector.d.ts +21 -0
  111. package/dist/json-api/json-api-connector.d.ts.map +1 -0
  112. package/dist/json-api/json-api-connector.js +29 -0
  113. package/dist/json-api/json-api-connector.js.map +1 -0
  114. package/dist/json-api/json-api-list.d.ts +14 -0
  115. package/dist/json-api/json-api-list.d.ts.map +1 -0
  116. package/dist/json-api/json-api-list.js +3 -0
  117. package/dist/json-api/json-api-list.js.map +1 -0
  118. package/dist/json-api/json-api-single.d.ts +14 -0
  119. package/dist/json-api/json-api-single.d.ts.map +1 -0
  120. package/dist/json-api/json-api-single.js +3 -0
  121. package/dist/json-api/json-api-single.js.map +1 -0
  122. package/dist/json-api/url-criteria-builder.d.ts +9 -0
  123. package/dist/json-api/url-criteria-builder.d.ts.map +1 -0
  124. package/dist/json-api/url-criteria-builder.js +49 -0
  125. package/dist/json-api/url-criteria-builder.js.map +1 -0
  126. package/dist/messages/index.d.ts +2 -0
  127. package/dist/messages/index.d.ts.map +1 -0
  128. package/dist/messages/index.js +3 -0
  129. package/dist/messages/index.js.map +1 -0
  130. package/dist/messages/message.d.ts +4 -0
  131. package/dist/messages/message.d.ts.map +1 -0
  132. package/dist/messages/message.js +3 -0
  133. package/dist/messages/message.js.map +1 -0
  134. package/dist/models/base-model.d.ts +4 -0
  135. package/dist/models/base-model.d.ts.map +1 -0
  136. package/dist/models/base-model.js +3 -0
  137. package/dist/models/base-model.js.map +1 -0
  138. package/dist/models/index.d.ts +2 -0
  139. package/dist/models/index.d.ts.map +1 -0
  140. package/dist/models/index.js +3 -0
  141. package/dist/models/index.js.map +1 -0
  142. package/dist/state-manager/index.d.ts +2 -0
  143. package/dist/state-manager/index.d.ts.map +1 -0
  144. package/dist/state-manager/index.js +6 -0
  145. package/dist/state-manager/index.js.map +1 -0
  146. package/dist/state-manager/state-manager.d.ts +12 -0
  147. package/dist/state-manager/state-manager.d.ts.map +1 -0
  148. package/dist/state-manager/state-manager.js +24 -0
  149. package/dist/state-manager/state-manager.js.map +1 -0
  150. package/dist/utils/index.d.ts +2 -0
  151. package/dist/utils/index.d.ts.map +1 -0
  152. package/dist/utils/index.js +6 -0
  153. package/dist/utils/index.js.map +1 -0
  154. package/dist/utils/url/index.d.ts +2 -0
  155. package/dist/utils/url/index.d.ts.map +1 -0
  156. package/dist/utils/url/index.js +6 -0
  157. package/dist/utils/url/index.js.map +1 -0
  158. package/dist/utils/url/url-with-params-builder.d.ts +7 -0
  159. package/dist/utils/url/url-with-params-builder.d.ts.map +1 -0
  160. package/dist/utils/url/url-with-params-builder.js +25 -0
  161. package/dist/utils/url/url-with-params-builder.js.map +1 -0
  162. package/dist/value-objects/coordinates-value.d.ts +15 -0
  163. package/dist/value-objects/coordinates-value.d.ts.map +1 -0
  164. package/dist/value-objects/coordinates-value.js +39 -0
  165. package/dist/value-objects/coordinates-value.js.map +1 -0
  166. package/dist/value-objects/email-value.d.ts +10 -0
  167. package/dist/value-objects/email-value.d.ts.map +1 -0
  168. package/dist/value-objects/email-value.js +23 -0
  169. package/dist/value-objects/email-value.js.map +1 -0
  170. package/dist/value-objects/enum-value.d.ts +11 -0
  171. package/dist/value-objects/enum-value.d.ts.map +1 -0
  172. package/dist/value-objects/enum-value.js +24 -0
  173. package/dist/value-objects/enum-value.js.map +1 -0
  174. package/dist/value-objects/index.d.ts +10 -0
  175. package/dist/value-objects/index.d.ts.map +1 -0
  176. package/dist/value-objects/index.js +20 -0
  177. package/dist/value-objects/index.js.map +1 -0
  178. package/dist/value-objects/integer-value.d.ts +12 -0
  179. package/dist/value-objects/integer-value.d.ts.map +1 -0
  180. package/dist/value-objects/integer-value.js +28 -0
  181. package/dist/value-objects/integer-value.js.map +1 -0
  182. package/dist/value-objects/phone-value.d.ts +13 -0
  183. package/dist/value-objects/phone-value.d.ts.map +1 -0
  184. package/dist/value-objects/phone-value.js +43 -0
  185. package/dist/value-objects/phone-value.js.map +1 -0
  186. package/dist/value-objects/slug-value.d.ts +10 -0
  187. package/dist/value-objects/slug-value.d.ts.map +1 -0
  188. package/dist/value-objects/slug-value.js +23 -0
  189. package/dist/value-objects/slug-value.js.map +1 -0
  190. package/dist/value-objects/string-value.d.ts +12 -0
  191. package/dist/value-objects/string-value.d.ts.map +1 -0
  192. package/dist/value-objects/string-value.js +26 -0
  193. package/dist/value-objects/string-value.js.map +1 -0
  194. package/dist/value-objects/uuid-value.d.ts +13 -0
  195. package/dist/value-objects/uuid-value.d.ts.map +1 -0
  196. package/dist/value-objects/uuid-value.js +29 -0
  197. package/dist/value-objects/uuid-value.js.map +1 -0
  198. package/dist/value-objects/value-object.d.ts +8 -0
  199. package/dist/value-objects/value-object.d.ts.map +1 -0
  200. package/dist/value-objects/value-object.js +3 -0
  201. package/dist/value-objects/value-object.js.map +1 -0
  202. package/package.json +8 -200
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-exception.d.ts","sourceRoot":"","sources":["../../../src/http/exceptions/http-exception.ts"],"names":[],"mappings":"AAAA,qBAAa,aAAc,SAAQ,KAAK;IAEpC,QAAQ,CAAC,OAAO,EAAE,MAAM;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM;gBADlB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM;CAI9B"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HTTPException = void 0;
4
+ class HTTPException extends Error {
5
+ message;
6
+ statusCode;
7
+ constructor(message, statusCode) {
8
+ super();
9
+ this.message = message;
10
+ this.statusCode = statusCode;
11
+ }
12
+ }
13
+ exports.HTTPException = HTTPException;
14
+ //# sourceMappingURL=http-exception.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-exception.js","sourceRoot":"","sources":["../../../src/http/exceptions/http-exception.ts"],"names":[],"mappings":";;;AAAA,MAAa,aAAc,SAAQ,KAAK;IAE3B;IACA;IAFX,YACW,OAAe,EACf,UAAkB;QAE3B,KAAK,EAAE,CAAA;QAHE,YAAO,GAAP,OAAO,CAAQ;QACf,eAAU,GAAV,UAAU,CAAQ;IAG7B,CAAC;CACF;AAPD,sCAOC"}
@@ -0,0 +1,2 @@
1
+ export { HTTPException } from "./http-exception";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/http/exceptions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HTTPException = void 0;
4
+ var http_exception_1 = require("./http-exception");
5
+ Object.defineProperty(exports, "HTTPException", { enumerable: true, get: function () { return http_exception_1.HTTPException; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/http/exceptions/index.ts"],"names":[],"mappings":";;;AAAA,mDAAiD;AAAxC,+GAAA,aAAa,OAAA"}
@@ -0,0 +1,13 @@
1
+ import type { HTTPProvider } from "./http-provider";
2
+ export declare class FetchHTTPProvider implements HTTPProvider {
3
+ private ongoingRequests;
4
+ get<ResponseType>(url: URL): Promise<ResponseType>;
5
+ post<RequestBodySchema, ResponseType>(url: URL, body: RequestBodySchema): Promise<ResponseType>;
6
+ put<RequestBodySchema, ResponseType>(url: URL, body: RequestBodySchema): Promise<ResponseType>;
7
+ patch<RequestBodySchema, ResponseType>(url: URL, body: RequestBodySchema): Promise<ResponseType>;
8
+ delete<ResponseType>(url: URL): Promise<ResponseType>;
9
+ private request;
10
+ private generateRequestKey;
11
+ private hashString;
12
+ }
13
+ //# sourceMappingURL=fetch-http-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch-http-provider.d.ts","sourceRoot":"","sources":["../../src/http/fetch-http-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGpD,qBAAa,iBAAkB,YAAW,YAAY;IACpD,OAAO,CAAC,eAAe,CAAmC;IAE1D,GAAG,CAAC,YAAY,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,YAAY,CAAC;IAIlD,IAAI,CAAC,iBAAiB,EAAE,YAAY,EAClC,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,iBAAiB,GACtB,OAAO,CAAC,YAAY,CAAC;IAIxB,GAAG,CAAC,iBAAiB,EAAE,YAAY,EACjC,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,iBAAiB,GACtB,OAAO,CAAC,YAAY,CAAC;IAIxB,KAAK,CAAC,iBAAiB,EAAE,YAAY,EACnC,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,iBAAiB,GACtB,OAAO,CAAC,YAAY,CAAC;IAIxB,MAAM,CAAC,YAAY,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,YAAY,CAAC;YAIvC,OAAO;IAkErB,OAAO,CAAC,kBAAkB;IAO1B,OAAO,CAAC,UAAU;CAWnB"}
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FetchHTTPProvider = void 0;
4
+ const exceptions_1 = require("./exceptions");
5
+ class FetchHTTPProvider {
6
+ ongoingRequests = new Map();
7
+ get(url) {
8
+ return this.request("GET", url);
9
+ }
10
+ post(url, body) {
11
+ return this.request("POST", url, body);
12
+ }
13
+ put(url, body) {
14
+ return this.request("PUT", url, body);
15
+ }
16
+ patch(url, body) {
17
+ return this.request("PATCH", url, body);
18
+ }
19
+ delete(url) {
20
+ return this.request("DELETE", url);
21
+ }
22
+ async request(method, url, body) {
23
+ const key = this.generateRequestKey(method, url, body);
24
+ if (this.ongoingRequests.has(key)) {
25
+ return this.ongoingRequests.get(key);
26
+ }
27
+ const init = {
28
+ method,
29
+ body: body !== undefined ? JSON.stringify(body) : null,
30
+ };
31
+ if (body !== undefined) {
32
+ init.headers = { "Content-Type": "application/json" };
33
+ }
34
+ const request = (async () => {
35
+ const response = await fetch(url.href, init);
36
+ if (!response) {
37
+ throw new exceptions_1.HTTPException("Fetch returned undefined", 0);
38
+ }
39
+ if (response.status === 204) {
40
+ return undefined;
41
+ }
42
+ const contentType = response.headers.get("Content-Type") ?? "";
43
+ let parsed;
44
+ try {
45
+ if (contentType.includes("application/json")) {
46
+ parsed = await response.json();
47
+ }
48
+ else if (contentType.includes("text/")) {
49
+ parsed = await response.text();
50
+ }
51
+ else {
52
+ parsed = await response.blob();
53
+ }
54
+ }
55
+ catch {
56
+ parsed = undefined;
57
+ }
58
+ if (!response.ok) {
59
+ const message = typeof parsed === "string"
60
+ ? parsed
61
+ : parsed?.title ?? "Unknown error";
62
+ const code = parsed?.code ?? response.status;
63
+ throw new exceptions_1.HTTPException(message, code);
64
+ }
65
+ return parsed;
66
+ })().finally(() => {
67
+ this.ongoingRequests.delete(key);
68
+ });
69
+ this.ongoingRequests.set(key, request);
70
+ return request;
71
+ }
72
+ generateRequestKey(method, url, body) {
73
+ const base = `${method}:${url.href}`;
74
+ const bodyHash = body !== undefined ? this.hashString(JSON.stringify(body)) : "";
75
+ return `${base}:${bodyHash}`;
76
+ }
77
+ hashString(input) {
78
+ let hash = 0;
79
+ for (let i = 0; i < input.length; i++) {
80
+ const chr = input.charCodeAt(i);
81
+ hash = (hash << 5) - hash + chr;
82
+ hash |= 0;
83
+ }
84
+ return hash.toString();
85
+ }
86
+ }
87
+ exports.FetchHTTPProvider = FetchHTTPProvider;
88
+ //# sourceMappingURL=fetch-http-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch-http-provider.js","sourceRoot":"","sources":["../../src/http/fetch-http-provider.ts"],"names":[],"mappings":";;;AACA,6CAA6C;AAE7C,MAAa,iBAAiB;IACpB,eAAe,GAAG,IAAI,GAAG,EAAwB,CAAC;IAE1D,GAAG,CAAe,GAAQ;QACxB,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAClC,CAAC;IAED,IAAI,CACF,GAAQ,EACR,IAAuB;QAEvB,OAAO,IAAI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O,CAAC,CAAC;QAEvC,OAAO,OAAO,CAAC;IACjB,CAAC;IAEO,kBAAkB,CAAC,MAAc,EAAE,GAAQ,EAAE,IAAc;QACjE,MAAM,IAAI,GAAG,GAAG,MAAM,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;QACrC,MAAM,QAAQ,GAAG,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAEjF,OAAO,GAAG,IAAI,IAAI,QAAQ,EAAE,CAAC;IAC/B,CAAC;IAEO,UAAU,CAAC,KAAa;QAC9B,IAAI,IAAI,GAAG,CAAC,CAAC;QAEb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACtC,MAAM,GAAG,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;YAChC,IAAI,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,IAAI,GAAG,GAAG,CAAC;YAChC,IAAI,IAAI,CAAC,CAAC;QACZ,CAAC;QAED,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IACzB,CAAC;CACF;AApHD,8CAoHC"}
@@ -0,0 +1,8 @@
1
+ export interface HTTPProvider {
2
+ get<ResponseType>(url: URL): Promise<ResponseType>;
3
+ post<RequestBodySchema, ResponseType>(url: URL, body: RequestBodySchema): Promise<ResponseType>;
4
+ put<RequestBodySchema, ResponseType>(url: URL, body: RequestBodySchema): Promise<ResponseType>;
5
+ patch<RequestBodySchema, ResponseType>(url: URL, body: RequestBodySchema): Promise<ResponseType>;
6
+ delete<ResponseType>(url: URL): Promise<ResponseType>;
7
+ }
8
+ //# sourceMappingURL=http-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-provider.d.ts","sourceRoot":"","sources":["../../src/http/http-provider.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,YAAY,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IACnD,IAAI,CAAC,iBAAiB,EAAE,YAAY,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAChG,GAAG,CAAC,iBAAiB,EAAE,YAAY,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/F,KAAK,CAAC,iBAAiB,EAAE,YAAY,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IACjG,MAAM,CAAC,YAAY,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CACvD"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=http-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-provider.js","sourceRoot":"","sources":["../../src/http/http-provider.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export type { HTTPProvider } from "./http-provider";
2
+ export { HTTPException } from "./exceptions";
3
+ export { FetchHTTPProvider } from "./fetch-http-provider";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/http/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FetchHTTPProvider = exports.HTTPException = void 0;
4
+ var exceptions_1 = require("./exceptions");
5
+ Object.defineProperty(exports, "HTTPException", { enumerable: true, get: function () { return exceptions_1.HTTPException; } });
6
+ var fetch_http_provider_1 = require("./fetch-http-provider");
7
+ Object.defineProperty(exports, "FetchHTTPProvider", { enumerable: true, get: function () { return fetch_http_provider_1.FetchHTTPProvider; } });
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/http/index.ts"],"names":[],"mappings":";;;AAEA,2CAA6C;AAApC,2GAAA,aAAa,OAAA;AACtB,6DAA0D;AAAjD,wHAAA,iBAAiB,OAAA"}
@@ -0,0 +1,5 @@
1
+ export type { JSONAPISingle } from "./json-api-single";
2
+ export type { JSONAPIList } from "./json-api-list";
3
+ export { URLCriteriaBuilder } from "./url-criteria-builder";
4
+ export { JSONAPIConnector } from "./json-api-connector";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/json-api/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JSONAPIConnector = exports.URLCriteriaBuilder = void 0;
4
+ var url_criteria_builder_1 = require("./url-criteria-builder");
5
+ Object.defineProperty(exports, "URLCriteriaBuilder", { enumerable: true, get: function () { return url_criteria_builder_1.URLCriteriaBuilder; } });
6
+ var json_api_connector_1 = require("./json-api-connector");
7
+ Object.defineProperty(exports, "JSONAPIConnector", { enumerable: true, get: function () { return json_api_connector_1.JSONAPIConnector; } });
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/json-api/index.ts"],"names":[],"mappings":";;;AAEA,+DAA4D;AAAnD,0HAAA,kBAAkB,OAAA;AAC3B,2DAAwD;AAA/C,sHAAA,gBAAgB,OAAA"}
@@ -0,0 +1,21 @@
1
+ import type { HTTPProvider } from "../http";
2
+ import type { JSONAPIList } from "./json-api-list";
3
+ import type { JSONAPISingle } from "./json-api-single";
4
+ import { Criteria } from "../criteria";
5
+ export declare class JSONAPIConnector {
6
+ private http;
7
+ constructor(http: HTTPProvider);
8
+ findOne<EntityAttributes>(url: URL, criteria?: Criteria, include?: string[]): Promise<JSONAPISingle<EntityAttributes>>;
9
+ findMany<EntityAttributes>(url: URL, criteria?: Criteria, include?: string[]): Promise<JSONAPIList<EntityAttributes>>;
10
+ create<EntityAttributes>(url: URL, payload: {
11
+ type: string;
12
+ attributes: Omit<EntityAttributes, "id">;
13
+ }): Promise<JSONAPISingle<EntityAttributes>>;
14
+ update<EntityAttributes>(url: URL, payload: {
15
+ id: string;
16
+ type: string;
17
+ attributes: Omit<EntityAttributes, "id">;
18
+ }): Promise<JSONAPISingle<EntityAttributes>>;
19
+ delete<EntityAttributes>(url: URL): Promise<JSONAPISingle<EntityAttributes>>;
20
+ }
21
+ //# sourceMappingURL=json-api-connector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-api-connector.d.ts","sourceRoot":"","sources":["../../src/json-api/json-api-connector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,qBAAa,gBAAgB;IACf,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,YAAY;IAEhC,OAAO,CAAC,gBAAgB,EAC5B,GAAG,EAAE,GAAG,EACR,QAAQ,CAAC,EAAE,QAAQ,EACnB,OAAO,CAAC,EAAE,MAAM,EAAE,GACjB,OAAO,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;IAMrC,QAAQ,CAAC,gBAAgB,EAC7B,GAAG,EAAE,GAAG,EACR,QAAQ,CAAC,EAAE,QAAQ,EACnB,OAAO,CAAC,EAAE,MAAM,EAAE,GACjB,OAAO,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;IAMnC,MAAM,CAAC,gBAAgB,EAC3B,GAAG,EAAE,GAAG,EACR,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;KAC1C,GACA,OAAO,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;IAIrC,MAAM,CAAC,gBAAgB,EAC3B,GAAG,EAAE,GAAG,EACR,OAAO,EAAE;QACP,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;KAC1C,GACA,OAAO,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;IAIrC,MAAM,CAAC,gBAAgB,EAC3B,GAAG,EAAE,GAAG,GACP,OAAO,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;CAG5C"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JSONAPIConnector = void 0;
4
+ const url_criteria_builder_1 = require("./url-criteria-builder");
5
+ class JSONAPIConnector {
6
+ http;
7
+ constructor(http) {
8
+ this.http = http;
9
+ }
10
+ async findOne(url, criteria, include) {
11
+ const fullUrl = new url_criteria_builder_1.URLCriteriaBuilder(url, criteria, include).build();
12
+ return this.http.get(fullUrl);
13
+ }
14
+ async findMany(url, criteria, include) {
15
+ const fullUrl = new url_criteria_builder_1.URLCriteriaBuilder(url, criteria, include).build();
16
+ return this.http.get(fullUrl);
17
+ }
18
+ async create(url, payload) {
19
+ return this.http.post(url, { data: payload });
20
+ }
21
+ async update(url, payload) {
22
+ return this.http.patch(url, { data: payload });
23
+ }
24
+ async delete(url) {
25
+ return this.http.delete(url);
26
+ }
27
+ }
28
+ exports.JSONAPIConnector = JSONAPIConnector;
29
+ //# sourceMappingURL=json-api-connector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-api-connector.js","sourceRoot":"","sources":["../../src/json-api/json-api-connector.ts"],"names":[],"mappings":";;;AAGA,iEAA4D;AAG5D,MAAa,gBAAgB;IACP;IAApB,YAAoB,IAAkB;QAAlB,SAAI,GAAJ,IAAI,CAAc;IAAG,CAAC;IAE1C,KAAK,CAAC,OAAO,CACX,GAAQ,EACR,QAAmB,EACnB,OAAkB;QAElB,MAAM,OAAO,GAAG,IAAI,yCAAkB,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,KAAK,EAAE,CAAC;QAEvE,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,QAAQ,CACZ,GAAQ,EACR,QAAmB,EACnB,OAAkB;QAElB,MAAM,OAAO,GAAG,IAAI,yCAAkB,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,KAAK,EAAE,CAAC;QAEvE,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,MAAM,CACV,GAAQ,EACR,OAGC;QAED,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;IAChD,CAAC;IAED,KAAK,CAAC,MAAM,CACV,GAAQ,EACR,OAIC;QAED,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;IACjD,CAAC;IAED,KAAK,CAAC,MAAM,CACV,GAAQ;QAER,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;CACF;AAjDD,4CAiDC"}
@@ -0,0 +1,14 @@
1
+ export type JSONAPIList<EntityAttributes> = {
2
+ data: Array<{
3
+ id: string;
4
+ type: string;
5
+ attributes: Omit<EntityAttributes, "id">;
6
+ }>;
7
+ included?: Array<{
8
+ id: string;
9
+ type: string;
10
+ attributes: Record<string, any>;
11
+ }>;
12
+ meta?: Record<string, any>;
13
+ };
14
+ //# sourceMappingURL=json-api-list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-api-list.d.ts","sourceRoot":"","sources":["../../src/json-api/json-api-list.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,CAAC,gBAAgB,IAAI;IAC1C,IAAI,EAAE,KAAK,CAAC;QACV,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;KAC1C,CAAC,CAAC;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC;QACf,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KACjC,CAAC,CAAC;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC5B,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=json-api-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-api-list.js","sourceRoot":"","sources":["../../src/json-api/json-api-list.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ export type JSONAPISingle<EntityAttributes> = {
2
+ data: {
3
+ id: string;
4
+ type: string;
5
+ attributes: Omit<EntityAttributes, "id">;
6
+ };
7
+ included?: Array<{
8
+ id: string;
9
+ type: string;
10
+ attributes: Record<string, any>;
11
+ }>;
12
+ meta?: Record<string, any>;
13
+ };
14
+ //# sourceMappingURL=json-api-single.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-api-single.d.ts","sourceRoot":"","sources":["../../src/json-api/json-api-single.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,CAAC,gBAAgB,IAAI;IAC5C,IAAI,EAAE;QACJ,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;KAC1C,CAAC;IACF,QAAQ,CAAC,EAAE,KAAK,CAAC;QACf,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KACjC,CAAC,CAAC;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC5B,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=json-api-single.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-api-single.js","sourceRoot":"","sources":["../../src/json-api/json-api-single.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ import { Criteria } from "../criteria";
2
+ export declare class URLCriteriaBuilder {
3
+ private readonly base;
4
+ private readonly criteria?;
5
+ private readonly include?;
6
+ constructor(base: URL, criteria?: Criteria | undefined, include?: string[] | undefined);
7
+ build(): URL;
8
+ }
9
+ //# sourceMappingURL=url-criteria-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url-criteria-builder.d.ts","sourceRoot":"","sources":["../../src/json-api/url-criteria-builder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,qBAAa,kBAAkB;IAE3B,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;IAC1B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;gBAFR,IAAI,EAAE,GAAG,EACT,QAAQ,CAAC,EAAE,QAAQ,YAAA,EACnB,OAAO,CAAC,EAAE,MAAM,EAAE,YAAA;IAGrC,KAAK,IAAI,GAAG;CAsCb"}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.URLCriteriaBuilder = void 0;
4
+ const utils_1 = require("../utils");
5
+ class URLCriteriaBuilder {
6
+ base;
7
+ criteria;
8
+ include;
9
+ constructor(base, criteria, include) {
10
+ this.base = base;
11
+ this.criteria = criteria;
12
+ this.include = include;
13
+ }
14
+ build() {
15
+ const builder = new utils_1.URLWithParamsBuilder(new URL(this.base.href));
16
+ if (this.include?.length) {
17
+ builder.with({ include: this.include });
18
+ }
19
+ if (this.criteria) {
20
+ Object.entries(this.criteria.filters).forEach(([field, { operator, value }]) => {
21
+ const encodedField = field.replace(/\./g, "."); // allows nested filters like roles.name
22
+ if (operator === "EQUAL") {
23
+ builder.with({ [`filter[${encodedField}]`]: value });
24
+ }
25
+ else if (operator === "IN" && Array.isArray(value)) {
26
+ builder.with({ [`filter[${encodedField}]`]: value.join(",") });
27
+ }
28
+ else {
29
+ builder.with({ [`filter[${encodedField}][${operator}]`]: value });
30
+ }
31
+ });
32
+ if (this.criteria.orders.length > 0) {
33
+ const sortParam = this.criteria.orders
34
+ .map(({ field, direction }) => (direction === "DESC" ? `-${field}` : field))
35
+ .join(",");
36
+ builder.with({ sort: sortParam });
37
+ }
38
+ if (this.criteria.limit !== undefined) {
39
+ builder.with({ "page[limit]": this.criteria.limit });
40
+ }
41
+ if (this.criteria.offset !== undefined) {
42
+ builder.with({ "page[offset]": this.criteria.offset });
43
+ }
44
+ }
45
+ return builder.build();
46
+ }
47
+ }
48
+ exports.URLCriteriaBuilder = URLCriteriaBuilder;
49
+ //# sourceMappingURL=url-criteria-builder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url-criteria-builder.js","sourceRoot":"","sources":["../../src/json-api/url-criteria-builder.ts"],"names":[],"mappings":";;;AAAA,oCAAgD;AAGhD,MAAa,kBAAkB;IAEV;IACA;IACA;IAHnB,YACmB,IAAS,EACT,QAAmB,EACnB,OAAkB;QAFlB,SAAI,GAAJ,IAAI,CAAK;QACT,aAAQ,GAAR,QAAQ,CAAW;QACnB,YAAO,GAAP,OAAO,CAAW;IAClC,CAAC;IAEJ,KAAK;QACH,MAAM,OAAO,GAAG,IAAI,4BAAoB,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAElE,IAAI,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;YACzB,OAAO,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;QAC1C,CAAC;QAED,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;gBAC7E,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,wCAAwC;gBAExF,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;oBACzB,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,UAAU,YAAY,GAAG,CAAC,EAAE,KAAK,EAA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AK,EAAE,CAAC;IACzB,CAAC;CACF;AA7CD,gDA6CC"}
@@ -0,0 +1,2 @@
1
+ export type { Message } from "./message";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export interface Message<Primitives = {}> {
2
+ toPrimitives(): Primitives;
3
+ }
4
+ //# sourceMappingURL=message.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/messages/message.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO,CAAC,UAAU,GAAG,EAAE;IACtC,YAAY,IAAI,UAAU,CAAC;CAC5B"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message.js","sourceRoot":"","sources":["../../src/messages/message.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export type BaseModel = {
2
+ id: string | number;
3
+ };
4
+ //# sourceMappingURL=base-model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-model.d.ts","sourceRoot":"","sources":["../../src/models/base-model.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG;IACtB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;CACrB,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=base-model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-model.js","sourceRoot":"","sources":["../../src/models/base-model.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export type { BaseModel } from "./base-model";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export { StateManager } from "./state-manager";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/state-manager/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StateManager = void 0;
4
+ var state_manager_1 = require("./state-manager");
5
+ Object.defineProperty(exports, "StateManager", { enumerable: true, get: function () { return state_manager_1.StateManager; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/state-manager/index.ts"],"names":[],"mappings":";;;AAAA,iDAA+C;AAAtC,6GAAA,YAAY,OAAA"}
@@ -0,0 +1,12 @@
1
+ export declare abstract class StateManager<Schema extends Record<string, any>> {
2
+ protected state: Schema;
3
+ private listeners;
4
+ constructor(initialState?: Schema);
5
+ abstract getValue<Key extends keyof Schema>(key: Key): Promise<Schema[Key]>;
6
+ abstract setValue<Key extends keyof Schema>(key: Key, value: Schema[Key]): Promise<void>;
7
+ abstract removeValue<Key extends keyof Schema>(key: Key): Promise<void>;
8
+ getState(): Schema;
9
+ subscribe(listener: (state: Schema) => void): () => void;
10
+ protected notifyListeners(): void;
11
+ }
12
+ //# sourceMappingURL=state-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state-manager.d.ts","sourceRoot":"","sources":["../../src/state-manager/state-manager.ts"],"names":[],"mappings":"AAAA,8BAAsB,YAAY,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IACnE,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,SAAS,CAAsC;gBAE3C,YAAY,GAAE,MAAqB;IAI/C,QAAQ,CAAC,QAAQ,CAAC,GAAG,SAAS,MAAM,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC3E,QAAQ,CAAC,QAAQ,CAAC,GAAG,SAAS,MAAM,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IACxF,QAAQ,CAAC,WAAW,CAAC,GAAG,SAAS,MAAM,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAEvE,QAAQ,IAAI,MAAM;IAIlB,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,IAAI;IAQxD,SAAS,CAAC,eAAe,IAAI,IAAI;CAGlC"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StateManager = void 0;
4
+ class StateManager {
5
+ state;
6
+ listeners = [];
7
+ constructor(initialState = {}) {
8
+ this.state = initialState;
9
+ }
10
+ getState() {
11
+ return this.state;
12
+ }
13
+ subscribe(listener) {
14
+ this.listeners.push(listener);
15
+ return () => {
16
+ this.listeners = this.listeners.filter(l => l !== listener);
17
+ };
18
+ }
19
+ notifyListeners() {
20
+ this.listeners.forEach(listener => listener(this.state));
21
+ }
22
+ }
23
+ exports.StateManager = StateManager;
24
+ //# sourceMappingURL=state-manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state-manager.js","sourceRoot":"","sources":["../../src/state-manager/state-manager.ts"],"names":[],"mappings":";;;AAAA,MAAsB,YAAY;IACtB,KAAK,CAAS;IAChB,SAAS,GAAmC,EAAE,CAAC;IAEvD,YAAY,eAAuB,EAAY;QAC7C,IAAI,CAAC,KAAK,GAAG,YAAY,CAAC;IAC5B,CAAC;IAMD,QAAQ;QACN,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,SAAS,CAAC,QAAiC;QACzC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAE9B,OAAO,GAAG,EAAE;YACV,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC;QAC9D,CAAC,CAAC;IACJ,CAAC;IAES,eAAe;QACvB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3D,CAAC;CACF;AA3BD,oCA2BC"}
@@ -0,0 +1,2 @@
1
+ export { URLWithParamsBuilder } from "./url";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.URLWithParamsBuilder = void 0;
4
+ var url_1 = require("./url");
5
+ Object.defineProperty(exports, "URLWithParamsBuilder", { enumerable: true, get: function () { return url_1.URLWithParamsBuilder; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;AAAA,6BAA6C;AAApC,2GAAA,oBAAoB,OAAA"}
@@ -0,0 +1,2 @@
1
+ export { URLWithParamsBuilder } from "./url-with-params-builder";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/url/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.URLWithParamsBuilder = void 0;
4
+ var url_with_params_builder_1 = require("./url-with-params-builder");
5
+ Object.defineProperty(exports, "URLWithParamsBuilder", { enumerable: true, get: function () { return url_with_params_builder_1.URLWithParamsBuilder; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/url/index.ts"],"names":[],"mappings":";;;AAAA,qEAAiE;AAAxD,+HAAA,oBAAoB,OAAA"}
@@ -0,0 +1,7 @@
1
+ export declare class URLWithParamsBuilder {
2
+ private readonly base;
3
+ constructor(base: URL);
4
+ with(params: Record<string, string | number | boolean | Array<string | number>>): URLWithParamsBuilder;
5
+ build(): URL;
6
+ }
7
+ //# sourceMappingURL=url-with-params-builder.d.ts.map