@bett3r-dev/pv3-types 1.0.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/CHANGELOG.md +305 -0
  2. package/build/adminPlugin.d.ts +24 -0
  3. package/build/adminPlugin.d.ts.map +1 -0
  4. package/build/{eventsourcing/utils.js → adminPlugin.js} +1 -1
  5. package/build/adminPlugin.js.map +1 -0
  6. package/build/aggregateSchema.d.ts +94 -0
  7. package/build/aggregateSchema.d.ts.map +1 -0
  8. package/build/aggregateSchema.js +287 -0
  9. package/build/aggregateSchema.js.map +1 -0
  10. package/build/authentication.d.ts +179 -78
  11. package/build/authentication.d.ts.map +1 -1
  12. package/build/authentication.js +62 -19
  13. package/build/authentication.js.map +1 -1
  14. package/build/cache.d.ts +50 -4
  15. package/build/cache.d.ts.map +1 -1
  16. package/build/clusterAdministration.d.ts +712 -225
  17. package/build/clusterAdministration.d.ts.map +1 -1
  18. package/build/clusterAdministration.js +175 -52
  19. package/build/clusterAdministration.js.map +1 -1
  20. package/build/configuration.d.ts +26 -5
  21. package/build/configuration.d.ts.map +1 -1
  22. package/build/database.d.ts +240 -56
  23. package/build/database.d.ts.map +1 -1
  24. package/build/database.js +102 -20
  25. package/build/database.js.map +1 -1
  26. package/build/endpoints.d.ts +141 -41
  27. package/build/endpoints.d.ts.map +1 -1
  28. package/build/endpoints.js +50 -26
  29. package/build/endpoints.js.map +1 -1
  30. package/build/errors.d.ts +166 -0
  31. package/build/errors.d.ts.map +1 -0
  32. package/build/errors.js +276 -0
  33. package/build/errors.js.map +1 -0
  34. package/build/evenstore.d.ts +47 -7
  35. package/build/evenstore.d.ts.map +1 -1
  36. package/build/eventsourcing/aggregateBuilder.d.ts +17 -8
  37. package/build/eventsourcing/aggregateBuilder.d.ts.map +1 -1
  38. package/build/eventsourcing/commandBuilder.d.ts +20 -13
  39. package/build/eventsourcing/commandBuilder.d.ts.map +1 -1
  40. package/build/eventsourcing/commandHandlers.d.ts +155 -33
  41. package/build/eventsourcing/commandHandlers.d.ts.map +1 -1
  42. package/build/eventsourcing/commandHandlers.js +62 -14
  43. package/build/eventsourcing/commandHandlers.js.map +1 -1
  44. package/build/eventsourcing/eventHandlers.d.ts +173 -44
  45. package/build/eventsourcing/eventHandlers.d.ts.map +1 -1
  46. package/build/eventsourcing/eventHandlers.js +29 -21
  47. package/build/eventsourcing/eventHandlers.js.map +1 -1
  48. package/build/eventsourcing/eventHandlersBuilder.d.ts +18 -12
  49. package/build/eventsourcing/eventHandlersBuilder.d.ts.map +1 -1
  50. package/build/eventsourcing/eventHandlersBuilder.js.map +1 -1
  51. package/build/eventsourcing/eventsourcing.types.d.ts +322 -0
  52. package/build/eventsourcing/eventsourcing.types.d.ts.map +1 -0
  53. package/build/eventsourcing/eventsourcing.types.js +26 -0
  54. package/build/eventsourcing/eventsourcing.types.js.map +1 -0
  55. package/build/eventsourcing/externalSystemBuilder.d.ts +8 -7
  56. package/build/eventsourcing/externalSystemBuilder.d.ts.map +1 -1
  57. package/build/eventsourcing/index.d.ts +2 -378
  58. package/build/eventsourcing/index.d.ts.map +1 -1
  59. package/build/eventsourcing/index.js +2 -23
  60. package/build/eventsourcing/index.js.map +1 -1
  61. package/build/eventsourcing/invariants.d.ts +34 -10
  62. package/build/eventsourcing/invariants.d.ts.map +1 -1
  63. package/build/eventsourcing/shapeChangeForSubscriber.d.ts +33 -0
  64. package/build/eventsourcing/shapeChangeForSubscriber.d.ts.map +1 -0
  65. package/build/eventsourcing/shapeChangeForSubscriber.js +47 -0
  66. package/build/eventsourcing/shapeChangeForSubscriber.js.map +1 -0
  67. package/build/index.d.ts +6 -1
  68. package/build/index.d.ts.map +1 -1
  69. package/build/index.js +6 -1
  70. package/build/index.js.map +1 -1
  71. package/build/infrastructure.d.ts +9 -1
  72. package/build/infrastructure.d.ts.map +1 -1
  73. package/build/infrastructure.js +33 -1
  74. package/build/infrastructure.js.map +1 -1
  75. package/build/livenessWatchdog.d.ts +28 -0
  76. package/build/livenessWatchdog.d.ts.map +1 -0
  77. package/build/livenessWatchdog.js +43 -0
  78. package/build/livenessWatchdog.js.map +1 -0
  79. package/build/logger.d.ts +8 -9
  80. package/build/logger.d.ts.map +1 -1
  81. package/build/logger.js +18 -6
  82. package/build/logger.js.map +1 -1
  83. package/build/outboxManager.d.ts +858 -14
  84. package/build/outboxManager.d.ts.map +1 -1
  85. package/build/outboxManager.js +173 -15
  86. package/build/outboxManager.js.map +1 -1
  87. package/build/permissions.d.ts +47 -0
  88. package/build/permissions.d.ts.map +1 -0
  89. package/build/permissions.js +3 -0
  90. package/build/permissions.js.map +1 -0
  91. package/build/ports.d.ts +10 -10
  92. package/build/ports.d.ts.map +1 -1
  93. package/build/routesAuth.d.ts +17 -25
  94. package/build/routesAuth.d.ts.map +1 -1
  95. package/build/routesAuth.js +4 -14
  96. package/build/routesAuth.js.map +1 -1
  97. package/build/typedEventEmitter.d.ts +7 -13
  98. package/build/typedEventEmitter.d.ts.map +1 -1
  99. package/build/typedEventEmitter.js +2 -2
  100. package/build/typedEventEmitter.js.map +1 -1
  101. package/build/userSession.d.ts +8 -0
  102. package/build/userSession.d.ts.map +1 -0
  103. package/build/userSession.js +3 -0
  104. package/build/userSession.js.map +1 -0
  105. package/package.json +22 -7
  106. package/build/eventsourcing/utils.d.ts +0 -4
  107. package/build/eventsourcing/utils.d.ts.map +0 -1
  108. package/build/eventsourcing/utils.js.map +0 -1
  109. package/build/validation.d.ts +0 -64
  110. package/build/validation.d.ts.map +0 -1
  111. package/build/validation.js +0 -57
  112. package/build/validation.js.map +0 -1
  113. package/src/authentication.ts +0 -273
  114. package/src/cache.ts +0 -109
  115. package/src/clusterAdministration.ts +0 -216
  116. package/src/configuration.ts +0 -71
  117. package/src/database.ts +0 -157
  118. package/src/endpoints.ts +0 -198
  119. package/src/evenstore.ts +0 -27
  120. package/src/eventsourcing/aggregateBuilder.ts +0 -11
  121. package/src/eventsourcing/commandBuilder.ts +0 -64
  122. package/src/eventsourcing/commandHandlers.ts +0 -137
  123. package/src/eventsourcing/eventHandlers.ts +0 -118
  124. package/src/eventsourcing/eventHandlersBuilder.ts +0 -42
  125. package/src/eventsourcing/externalSystemBuilder.ts +0 -20
  126. package/src/eventsourcing/index.ts +0 -111
  127. package/src/eventsourcing/invariants.ts +0 -27
  128. package/src/eventsourcing/utils.ts +0 -4
  129. package/src/index.ts +0 -15
  130. package/src/infrastructure.ts +0 -41
  131. package/src/logger.ts +0 -45
  132. package/src/outboxManager.ts +0 -36
  133. package/src/ports.ts +0 -42
  134. package/src/routesAuth.ts +0 -58
  135. package/src/typedEventEmitter.ts +0 -73
  136. package/src/validation.ts +0 -89
  137. package/tsconfig.json +0 -15
@@ -0,0 +1,276 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DuplicatedValueInIndexError = exports.GatewayTimeoutError = exports.ServiceUnavailableError = exports.BadGatewayError = exports.NotImplementedError = exports.InternalServerError = exports.TooManyRequestsError = exports.PayloadTooLargeError = exports.PreconditionFailedError = exports.LengthRequiredError = exports.GoneError = exports.ConflictError = exports.RequestTimeoutError = exports.ProxyAuthenticationRequiredError = exports.NotAcceptableError = exports.MethodNotAllowedError = exports.NotFoundError = exports.ForbiddenError = exports.PaymentRequiredError = exports.BadRequestError = exports.ValidationError = exports.ConcurrencyError = exports.UnauthorizedError = exports.UnknownRouteError = exports.AuthenticationError = exports.InvalidTokenError = exports.EmailAlreadyExists = exports.statusCodeErrorMap = exports.errorStatusCodeMap = exports.AppError = void 0;
7
+ const jsonschema_definer_1 = __importDefault(require("@bett3r-dev/jsonschema-definer"));
8
+ /** Extends Native error
9
+ * name
10
+ * message
11
+ * stack
12
+ *
13
+ * `logLevel` is optional and lets a thrower opt this specific error instance
14
+ * out of the default `error`-level logging in the HTTP error handler. Useful
15
+ * for expected, high-volume conditions (e.g. unauthenticated /me probes from
16
+ * the login page) that would otherwise drown real signal in noise. Leave
17
+ * unset for normal errors.
18
+ */
19
+ class AppError extends Error {
20
+ code;
21
+ type;
22
+ details;
23
+ status;
24
+ logLevel;
25
+ constructor(message, code, details, type, status, logLevel) {
26
+ super(message);
27
+ Object.defineProperty(this, 'code', {
28
+ value: code,
29
+ enumerable: true,
30
+ writable: true,
31
+ configurable: true
32
+ });
33
+ Object.defineProperty(this, 'type', {
34
+ value: type || 'InternalServerError',
35
+ enumerable: true,
36
+ writable: true,
37
+ configurable: true
38
+ });
39
+ Object.defineProperty(this, 'details', {
40
+ value: details,
41
+ enumerable: true,
42
+ writable: true,
43
+ configurable: true
44
+ });
45
+ Object.defineProperty(this, 'status', {
46
+ value: status,
47
+ enumerable: true,
48
+ writable: true,
49
+ configurable: true
50
+ });
51
+ Object.defineProperty(this, 'logLevel', {
52
+ value: logLevel,
53
+ enumerable: true,
54
+ writable: true,
55
+ configurable: true
56
+ });
57
+ }
58
+ withLogLevel(level) {
59
+ this.logLevel = level;
60
+ return this;
61
+ }
62
+ }
63
+ exports.AppError = AppError;
64
+ // export type AppErrorType<ErrorPayload = any> = Partial<AppError<ErrorPayload>> & {schema?: BaseSchema<ErrorPayload>}
65
+ /**
66
+ * @hidden
67
+ */
68
+ exports.errorStatusCodeMap = {
69
+ BadRequestError: 400,
70
+ UnauthorizedError: 401,
71
+ PaymentRequiredError: 402,
72
+ ForbiddenError: 403,
73
+ NotFoundError: 404,
74
+ MethodNotAllowedError: 405,
75
+ NotAcceptableError: 406,
76
+ ProxyAuthenticationRequiredError: 407,
77
+ RequestTimeoutError: 408,
78
+ ConflictError: 409,
79
+ ConcurrencyError: 409,
80
+ GoneError: 410,
81
+ LengthRequiredError: 411,
82
+ PreconditionFailedError: 412,
83
+ PayloadTooLargeError: 413,
84
+ TooManyRequestsError: 429,
85
+ InternalServerError: 500,
86
+ NotImplementedError: 501,
87
+ BadGatewayError: 502,
88
+ ServiceUnavailableError: 503,
89
+ GatewayTimeoutError: 504
90
+ };
91
+ exports.statusCodeErrorMap = {
92
+ 400: 'BadRequestError',
93
+ 401: 'UnauthorizedError',
94
+ 402: 'PaymentRequiredError',
95
+ 403: 'ForbiddenError',
96
+ 404: 'NotFoundError',
97
+ 405: 'MethodNotAllowedError',
98
+ 406: 'NotAcceptableError',
99
+ 407: 'ProxyAuthenticationRequiredError',
100
+ 408: 'RequestTimeoutError',
101
+ 409: 'ConcurrencyError',
102
+ 410: 'GoneError',
103
+ 411: 'LengthRequiredError',
104
+ 412: 'PreconditionFailedError',
105
+ 413: 'PayloadTooLargeError',
106
+ 429: 'TooManyRequestsError',
107
+ 500: 'InternalServerError',
108
+ 501: 'NotImplementedError',
109
+ 502: 'BadGatewayError',
110
+ 503: 'ServiceUnavailableError',
111
+ 504: 'GatewayTimeoutError'
112
+ };
113
+ const ErrorTypesSchema = jsonschema_definer_1.default.string().enum('BadRequestError', 'UnauthorizedError', 'PaymentRequiredError', 'ForbiddenError', 'NotFoundError', 'MethodNotAllowedError', 'NotAcceptableError', 'ProxyAuthenticationRequiredError', 'RequestTimeoutError', 'ConflictError', 'ConcurrencyError', 'GoneError', 'LengthRequiredError', 'PreconditionFailedError', 'PayloadTooLargeError', 'TooManyRequestsError', 'InternalServerError', 'NotImplementedError', 'BadGatewayError', 'ServiceUnavailableError', 'GatewayTimeoutError');
114
+ class EmailAlreadyExists extends AppError {
115
+ constructor(message, code = 'CONFLICT_ERROR', details) {
116
+ super(message, code, details, 'ConflictError', 409);
117
+ }
118
+ }
119
+ exports.EmailAlreadyExists = EmailAlreadyExists;
120
+ class InvalidTokenError extends AppError {
121
+ constructor(message, code = 'UNAUTHORIZED_ERROR', details) {
122
+ super(message, code, details, 'UnauthorizedError', 401);
123
+ }
124
+ }
125
+ exports.InvalidTokenError = InvalidTokenError;
126
+ class AuthenticationError extends AppError {
127
+ constructor(message, code = 'UNAUTHORIZED_ERROR', details) {
128
+ super(message, code, details, 'UnauthorizedError', 401);
129
+ }
130
+ }
131
+ exports.AuthenticationError = AuthenticationError;
132
+ class UnknownRouteError extends AppError {
133
+ constructor(message, code = 'BAD_REQUEST_ERROR', details) {
134
+ super(message, code, details, 'BadRequestError', 400);
135
+ }
136
+ }
137
+ exports.UnknownRouteError = UnknownRouteError;
138
+ class UnauthorizedError extends AppError {
139
+ constructor(message, code = 'UNAUTHORIZED_ERROR', details) {
140
+ super(message, code, details, 'UnauthorizedError', 403);
141
+ }
142
+ }
143
+ exports.UnauthorizedError = UnauthorizedError;
144
+ class ConcurrencyError extends AppError {
145
+ constructor(message, code = 'CONCURRENCY_ERROR', details) {
146
+ super(message, code, details, 'ConcurrencyError', 409);
147
+ }
148
+ }
149
+ exports.ConcurrencyError = ConcurrencyError;
150
+ class ValidationError extends AppError {
151
+ constructor(message, code = 'BAD_REQUEST_ERROR', details) {
152
+ super(message, code, details, 'BadRequestError', 400);
153
+ }
154
+ }
155
+ exports.ValidationError = ValidationError;
156
+ class BadRequestError extends AppError {
157
+ constructor(message, code = 'BAD_REQUEST_ERROR', details) {
158
+ super(message, code, details, 'BadRequestError', 400);
159
+ }
160
+ }
161
+ exports.BadRequestError = BadRequestError;
162
+ class PaymentRequiredError extends AppError {
163
+ constructor(message, code = 'PAYMENT_REQUIRED_ERROR', details) {
164
+ super(message, code, details, 'PaymentRequiredError', 402);
165
+ }
166
+ }
167
+ exports.PaymentRequiredError = PaymentRequiredError;
168
+ class ForbiddenError extends AppError {
169
+ constructor(message, code = 'FORBIDDEN_ERROR', details) {
170
+ super(message, code, details, 'ForbiddenError', 403);
171
+ }
172
+ }
173
+ exports.ForbiddenError = ForbiddenError;
174
+ class NotFoundError extends AppError {
175
+ constructor(message, code = 'NOT_FOUND_ERROR', details) {
176
+ super(message, code, details, 'NotFoundError', 404);
177
+ }
178
+ }
179
+ exports.NotFoundError = NotFoundError;
180
+ class MethodNotAllowedError extends AppError {
181
+ constructor(message, code = 'METHOD_NOT_ALLOWED_ERROR', details) {
182
+ super(message, code, details, 'MethodNotAllowedError', 405);
183
+ }
184
+ }
185
+ exports.MethodNotAllowedError = MethodNotAllowedError;
186
+ class NotAcceptableError extends AppError {
187
+ constructor(message, code = 'NOT_ACCEPTABLE_ERROR', details) {
188
+ super(message, code, details, 'NotAcceptableError', 406);
189
+ }
190
+ }
191
+ exports.NotAcceptableError = NotAcceptableError;
192
+ class ProxyAuthenticationRequiredError extends AppError {
193
+ constructor(message, code = 'PROXY_AUTHENTICATION_REQUIRED_ERROR', details) {
194
+ super(message, code, details, 'ProxyAuthenticationRequiredError', 407);
195
+ }
196
+ }
197
+ exports.ProxyAuthenticationRequiredError = ProxyAuthenticationRequiredError;
198
+ class RequestTimeoutError extends AppError {
199
+ constructor(message, code = 'REQUEST_TIMEOUT_ERROR', details) {
200
+ super(message, code, details, 'RequestTimeoutError', 408);
201
+ }
202
+ }
203
+ exports.RequestTimeoutError = RequestTimeoutError;
204
+ class ConflictError extends AppError {
205
+ constructor(message, code = 'CONFLICT_ERROR', details) {
206
+ super(message, code, details, 'ConflictError', 409);
207
+ }
208
+ }
209
+ exports.ConflictError = ConflictError;
210
+ class GoneError extends AppError {
211
+ constructor(message, code = 'GONE_ERROR', details) {
212
+ super(message, code, details, 'GoneError', 410);
213
+ }
214
+ }
215
+ exports.GoneError = GoneError;
216
+ class LengthRequiredError extends AppError {
217
+ constructor(message, code = 'LENGTH_REQUIRED_ERROR', details) {
218
+ super(message, code, details, 'LengthRequiredError', 411);
219
+ }
220
+ }
221
+ exports.LengthRequiredError = LengthRequiredError;
222
+ class PreconditionFailedError extends AppError {
223
+ constructor(message, code = 'PRECONDITION_FAILED_ERROR', details) {
224
+ super(message, code, details, 'PreconditionFailedError', 412);
225
+ }
226
+ }
227
+ exports.PreconditionFailedError = PreconditionFailedError;
228
+ class PayloadTooLargeError extends AppError {
229
+ constructor(message, code = 'PAYLOAD_TOO_LARGE_ERROR', details) {
230
+ super(message, code, details, 'PayloadTooLargeError', 413);
231
+ }
232
+ }
233
+ exports.PayloadTooLargeError = PayloadTooLargeError;
234
+ class TooManyRequestsError extends AppError {
235
+ constructor(message, code = 'TOO_MANY_REQUESTS_ERROR', details) {
236
+ super(message, code, details, 'TooManyRequestsError', 429);
237
+ }
238
+ }
239
+ exports.TooManyRequestsError = TooManyRequestsError;
240
+ class InternalServerError extends AppError {
241
+ constructor(message, code = 'INTERNAL_SERVER_ERROR', details) {
242
+ super(message, code, details, 'InternalServerError', 500);
243
+ }
244
+ }
245
+ exports.InternalServerError = InternalServerError;
246
+ class NotImplementedError extends AppError {
247
+ constructor(message, code = 'NOT_IMPLEMENTED_ERROR', details) {
248
+ super(message, code, details, 'NotImplementedError', 501);
249
+ }
250
+ }
251
+ exports.NotImplementedError = NotImplementedError;
252
+ class BadGatewayError extends AppError {
253
+ constructor(message, code = 'BAD_GATEWAY_ERROR', details) {
254
+ super(message, code, details, 'BadGatewayError', 502);
255
+ }
256
+ }
257
+ exports.BadGatewayError = BadGatewayError;
258
+ class ServiceUnavailableError extends AppError {
259
+ constructor(message, code = 'SERVICE_UNAVAILABLE_ERROR', details) {
260
+ super(message, code, details, 'ServiceUnavailableError', 503);
261
+ }
262
+ }
263
+ exports.ServiceUnavailableError = ServiceUnavailableError;
264
+ class GatewayTimeoutError extends AppError {
265
+ constructor(message, code = 'GATEWAY_TIMEOUT_ERROR', details) {
266
+ super(message, code, details, 'GatewayTimeoutError', 504);
267
+ }
268
+ }
269
+ exports.GatewayTimeoutError = GatewayTimeoutError;
270
+ class DuplicatedValueInIndexError extends AppError {
271
+ constructor(message, code = 'DATABASE_DUPLICATED_VALUE_IN_UNIQUE_INDEX', details) {
272
+ super(message, code, details, 'ConflictError', 409);
273
+ }
274
+ }
275
+ exports.DuplicatedValueInIndexError = DuplicatedValueInIndexError;
276
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";;;;;;AAAA,wFAA+D;AAI/D;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AE,OAAa;QACrF,KAAK,CAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,yBAAyB,EAAE,GAAG,CAAE,CAAC;IAClE,CAAC;CACF;;AAED,yBAAiC,SAAQ,QAAa;IACpD,YAAa,OAAe,EAAE,IAAI,GAAW,uBAAuB,EAAE,OAAa;QACjF,KAAK,CAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,qBAAqB,EAAE,GAAG,CAAE,CAAC;IAC9D,CAAC;CACF;;AAED,iCAAyC,SAAQ,QAAQ;IACvD,YAAa,OAAe,EAAE,IAAI,GAAW,2CAA2C,EAAE,OAAa;QACrG,KAAK,CAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,CAAE,CAAC;IACxD,CAAC;CACF"}
@@ -1,26 +1,66 @@
1
- import { DatabaseTransaction } from './database';
1
+ import { DatabaseAdapter, DatabaseTransaction } from './database';
2
2
  import { CommittedEvent, EventToCommit, ReadMultipleStreamOptions, ReadStreamOptions } from './eventsourcing';
3
3
  import { AdapterBase, PortEmitter } from './ports';
4
4
  export declare const EventStoreConfigSchema: import("@bett3r-dev/jsonschema-definer").ObjectSchema<{
5
- collection?: string | undefined;
6
5
  enabled?: boolean | undefined;
6
+ collection?: string | undefined;
7
7
  }, false>;
8
8
  export type EventStoreConfig = typeof EventStoreConfigSchema.type;
9
9
  export type EventStoreType = {
10
- appendToStream: <Type>(stream: string, events: EventToCommit | EventToCommit[], expectedVersion?: number, transaction?: DatabaseTransaction) => Promise<CommittedEvent<Type>[]>;
10
+ getConnectionId: () => string;
11
+ /**
12
+ * The stream's current head version — the version the next versioned append will number
13
+ * from — or `0` when the stream holds no versioned event yet.
14
+ *
15
+ * This is the SAME observation `appendToStream` takes to number what it commits; it is
16
+ * exposed so a caller can take it at LOAD time and assert it back as `expectedVersion` at
17
+ * commit time (optimistic concurrency). Load-time and commit-time answers must come from
18
+ * one implementation, or an expectation asserted at load could be unsatisfiable at commit
19
+ * and the command would retry to exhaustion.
20
+ *
21
+ * Pass the `transaction` you are working in: the head must include that transaction's own
22
+ * uncommitted appends, which a pool read cannot see.
23
+ *
24
+ * Version-free events (`expectedVersion: null`, stored as `version = NULL`) are NOT part of
25
+ * the head — a stream mixing both reports its versioned head.
26
+ */
27
+ getStreamVersion: (stream: string, transaction?: DatabaseTransaction) => Promise<number>;
28
+ /**
29
+ * Drop whatever this eventstore has cached ABOUT that transaction. Called immediately after a
30
+ * `rollbackToSavepoint`, by the only code that knows the rewind happened.
31
+ *
32
+ * An adapter may cache per-transaction state that is only true while the transaction's own
33
+ * rows exist — `PostgresEventstore` caches the head version of every stream a transaction has
34
+ * appended to, so an append can see its own uncommitted work. A savepoint rollback removes
35
+ * those rows; the cache would go on claiming them, and the next append would number itself
36
+ * from a version that was rolled away — a permanent GAP or a duplicate, silently, long after
37
+ * the rollback.
38
+ *
39
+ * OPTIONAL: an adapter with no per-transaction state has nothing to forget (`DatabaseEventstore`
40
+ * reads every head through the transaction's own collection). Dropping cached state can only
41
+ * cost a re-read — never correctness — so forgetting MORE than the rollback invalidated is
42
+ * always safe.
43
+ */
44
+ forgetTransactionState?: (transaction: DatabaseTransaction) => void;
45
+ appendToStream: <Type>(stream: string, events: EventToCommit | EventToCommit[], expectedVersion?: number | null, transaction?: DatabaseTransaction) => Promise<CommittedEvent<Type>[]>;
11
46
  appendToMultipleStreams?: <Type>(streams: Record<string, {
12
47
  events: EventToCommit | EventToCommit[];
13
- expectedVersion?: number;
48
+ expectedVersion?: number | null;
14
49
  }>, transaction?: DatabaseTransaction) => Promise<CommittedEvent<Type>[]>;
15
- readStream: <Model = any>(readOptions: ReadStreamOptions, callback: (event: CommittedEvent, stop: () => void) => Partial<Model> | Promise<Partial<Model>>) => Promise<Model>;
16
- readMultipleStream?: <Model = any>(readOptions: ReadMultipleStreamOptions, callback: (event: CommittedEvent, stop: () => void) => Record<string, Partial<Model>> | Promise<Record<string, Partial<Model>>>) => Promise<Record<string, Model>>;
50
+ reduceStream: <ReducedType>(readOptions: ReadStreamOptions, callback: (state: ReducedType, event: CommittedEvent, stop: (stateAtStop?: ReducedType) => void) => ReducedType | Promise<ReducedType>, initialState: ReducedType) => Promise<ReducedType>;
51
+ read: (readOptions?: ReadStreamOptions) => Promise<CommittedEvent[]>;
52
+ readById?: (id: string) => Promise<CommittedEvent | undefined>;
53
+ readMultipleStream?: <Model = any>(readOptions: ReadMultipleStreamOptions, callback: (event: CommittedEvent, stop: () => void) => Record<string, Partial<Model>> | Promise<Record<string, Partial<Model>>>, initialState: Record<string, Partial<Model>>) => Promise<Record<string, Model>>;
54
+ reduceMultipleStream?: <ReducedType>(readOptions: ReadMultipleStreamOptions, callback: (state: ReducedType, event: CommittedEvent, stop: () => void) => ReducedType | Promise<ReducedType>, initialState: ReducedType, transaction?: DatabaseTransaction) => Promise<ReducedType>;
17
55
  subscribe: (onData: (event: CommittedEvent) => void, onError?: (e: Error) => void) => Promise<{
18
56
  close: () => void;
19
57
  }>;
20
58
  flush: () => Promise<void>;
59
+ start: () => Promise<void>;
60
+ stop: () => Promise<void>;
21
61
  };
22
62
  export type EventStoreAdapter = AdapterBase & EventStoreType;
23
63
  export type EventStorePort = PortEmitter & EventStoreType & {
24
- _adapter: EventStoreAdapter;
64
+ _adapter: () => DatabaseAdapter;
25
65
  };
26
66
  //# sourceMappingURL=evenstore.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"evenstore.d.ts","sourceRoot":"","sources":["../src/evenstore.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAC9G,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEnD,eAAO,MAAM,sBAAsB;;;SAGtB,CAAC;AACd,MAAM,MAAM,gBAAgB,GAAG,OAAO,sBAAsB,CAAC,IAAI,C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R,oBAAoB,CAAC,EAAE,CAAC,WAAW,EAAG,WAAW,EAAE,yBAAyB,EAAE,QAAQ,EAAE,CAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,IAAI,KAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,CAAC,EAAE,mBAAmB,KAAM,OAAO,CAAC,WAAW,CAAC,CAAA;IACrR,SAAS,EAAE,CAAE,MAAM,EAAE,CAAE,KAAK,EAAE,cAAc,KAAM,IAAI,EAAE,OAAO,CAAC,EAAE,CAAE,CAAC,EAAE,KAAK,KAAM,IAAI,KAAM,OAAO,CAAC;QAClG,KAAK,EAAE,MAAM,IAAI,CAAA;KAClB,CAAC,CAAA;IACF,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1B,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1B,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC1B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG,cAAc,CAAC;AAE7D,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,cAAc,GAAG;IAC1D,QAAQ,EAAE,MAAM,eAAe,CAAA;CAChC,CAAC"}
@@ -1,10 +1,19 @@
1
- import { Command, EventFactory, EventReducers } from '.';
2
- import { DatabasePort } from '..';
3
- import { ExternalSystemBuilderType } from './externalSystemBuilder';
4
- export type AggregateBuilderType<Model, EVENTS extends Record<string, EventFactory>> = Omit<ExternalSystemBuilderType<Model, EVENTS>, 'withCommandTemplate'> & {
5
- withCommandTemplate: (command: Command) => AggregateBuilderType<Model, EVENTS>;
6
- notEventsourced: (database: DatabasePort, collection: string) => AggregateBuilderType<Model, EVENTS>;
7
- initialValue: (init: () => (Partial<Model> | null | undefined)) => Pick<AggregateBuilderType<Model, EVENTS>, 'withEventReducers' | 'withCommands'>;
8
- withEventReducers: (eventReducers: EventReducers<EVENTS, Model>) => Pick<AggregateBuilderType<Model, EVENTS>, 'withCommands'>;
1
+ import { Command, CommandTemplate, EventFactory, EventReducers } from '.';
2
+ import { Aggregate, Builder, CommandBuilderType, DatabasePort } from '..';
3
+ import { BaseSchema } from '@bett3r-dev/jsonschema-definer';
4
+ export type AggregateBuilderFunctionType<METADATA = any, USER = any> = <Model, EVENTS extends Record<string, EventFactory>>(schema: BaseSchema<Model>, events: EVENTS, aggregate?: Aggregate) => AggregateBuilderType<METADATA, USER, Model, EVENTS>;
5
+ export type AggregateBuilderType<METADATA = any, USER = any, Model = any, EVENTS extends Record<string, EventFactory> = any> = {
6
+ withCommandTemplate: (template: CommandTemplate<EVENTS, Extract<keyof EVENTS, string>, Model>) => AggregateBuilderType<METADATA, USER, Model, EVENTS>;
7
+ withSubdomain: (subdomain: string) => AggregateBuilderType<METADATA, USER, Model, EVENTS>;
8
+ /** @deprecated use `stateStored` — same behaviour, kept callable for existing consumers */
9
+ notEventsourced: (database: DatabasePort, collection: string) => AggregateBuilderType<METADATA, USER, Model, EVENTS>;
10
+ /** Named entry point for declaring a state-stored aggregate ( wraps the same internals as `notEventsourced` ). */
11
+ stateStored: (database: DatabasePort, collection: string) => AggregateBuilderType<METADATA, USER, Model, EVENTS>;
12
+ initialValue: (init: () => (Partial<Model> | null | undefined)) => Pick<AggregateBuilderType<METADATA, USER, Model, EVENTS>, 'withEventReducers' | 'withCommands'>;
13
+ withEventReducers: (eventReducers: EventReducers<EVENTS, Model>) => Pick<AggregateBuilderType<METADATA, USER, Model, EVENTS>, 'withCommands'>;
14
+ withCommands: <EVENT extends Extract<keyof EVENTS, string>, Commands extends Record<string, Command<EVENTS, EVENT, Model> | Builder<Command<EVENTS, EVENT, Model>>>>(commands: (params: {
15
+ commandBuilder: CommandBuilderType<METADATA, USER, Model, EVENTS>;
16
+ }) => Commands) => Aggregate<Commands, EVENTS, Model>;
17
+ system: Aggregate<any, any, Model>;
9
18
  };
10
19
  //# sourceMappingURL=aggregateBuilder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"aggregateBuilder.d.ts","sourceRoot":"","sources":["../../src/eventsourcing/aggregateBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,GAAG,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAGpE,MAAM,MAAM,oBAAoB,CAAC,KAAK,EAAE,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,IAAI,IAAI,CAAC,yBAAyB,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,qBAAqB,CAAC,GAAG;IAC7J,mBAAmB,EAAE,CAAE,OAAO,EAAE,OAAO,KAAM,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;IAChF,eAAe,EAAE,CAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,KAAM,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;IACtG,YAAY,EAAE,CAAE,IAAI,EAAE,MAAM,CAAE,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,SAAS,CAAE,KAAK,IAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,mBAAmB,GAAG,cAAc,CAAC,CAAA;IACrJ,iBAAiB,EAAE,CAAE,aAAa,EAAE,aAAa,CAAC,MAAM,EAAE,KAAK,CAAC,KAAM,IAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,cAAc,CAAC,CAAA;CAChI,CAAA"}
1
+ {"version":3,"file":"aggregateBuilder.d.ts","sourceRoot":"","sources":["../../src/eventsourcing/aggregateBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,aAA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AoB,CAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;IAClH,YAAY,EAAE,CAAE,IAAI,EAAE,MAAM,CAAE,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,SAAS,CAAE,KAAK,IAAI,CAAC,oBAAoB,CAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,EAAE,mBAAmB,GAAG,cAAc,CAAC,CAAA;IACrK,iBAAiB,EAAE,CAAE,aAAa,EAAE,aAAa,CAAC,MAAM,EAAE,KAAK,CAAC,KAAM,IAAI,CAAC,oBAAoB,CAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,EAAE,cAAc,CAAC,CAAC;IAChJ,YAAY,EAAE,CACZ,KAAK,SAAS,OAAO,CAAC,MAAM,MAAM,EAAE,MAAM,CAAC,EAC3C,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EACrG,QAAQ,EAAE,CAAE,MAAM,EAAE;QACtB,cAAc,EAAE,kBAAkB,CAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;KACnE,KAAK,QAAQ,KAAM,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IACvD,MAAM,EAAE,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,CAAA;CACnC,CAAC"}
@@ -1,6 +1,9 @@
1
1
  import { BaseSchema } from '@bett3r-dev/jsonschema-definer';
2
- import { Command, CommandCommitFunction, CommandErrorHandlerFunction, CommandFormatFunction, CommandHandlerFunction, CommandLoadFunction, EventFactory, InvariantType } from '.';
3
- export type CommandBuilderFromSchemaType<Model, EVENTS extends Record<string, EventFactory>, EVENT extends keyof EVENTS, CommandPayload> = {
2
+ import { Command, CommandCommitFunction, CommandErrorHandlerFunction, CommandFormatFunction, CommandHandlerFunction, CommandLoadFunction, CommandPreProcessingFunction, CommittedEvent, EventFactory, EventHandler, GetMessageType, IdempotencyCheckType, InvariantType, System } from '.';
3
+ import { PermissionString } from '../permissions';
4
+ export type CreateEventType<Handler extends System | EventHandler, EVENT extends string> = (event: EVENT, data?: GetMessageType<Handler['events'][EVENT]>, committedEvent?: Partial<Omit<CommittedEvent, 'data' | 'name'>>) => EventFactory<EVENT, GetMessageType<Handler['events'][EVENT]>>;
5
+ export type CurryCreateEventType = <Handler extends System | EventHandler, EVENT extends string>(handler: Handler) => CreateEventType<Handler, EVENT>;
6
+ export type CommandBuilderFromSchemaType<Model, EVENTS extends Record<string, EventFactory>, EVENT extends keyof EVENTS, CommandPayload, USER = any, METADATA = any> = {
4
7
  /**
5
8
  * Loads the streams from the aggregate. If the Command Handler is an Aggregate the fuction will be ignored.
6
9
  * Default Implementation:
@@ -10,7 +13,7 @@ export type CommandBuilderFromSchemaType<Model, EVENTS extends Record<string, Ev
10
13
  * .then((aggregateState) => ({...state, aggregateState} as CommandHandlerState));
11
14
  * ```
12
15
  */
13
- withLoadFunction: (loadFunction: CommandLoadFunction<Model, CommandPayload>) => CommandBuilderFromSchemaType<Model, EVENTS, EVENT, CommandPayload>;
16
+ withLoadFunction: (loadFunction: CommandLoadFunction<USER, Model, CommandPayload, METADATA>) => CommandBuilderFromSchemaType<Model, EVENTS, EVENT, CommandPayload, USER, METADATA>;
14
17
  /**
15
18
  * Commits the new event/events to the store
16
19
  * DefaultImplementation:
@@ -19,11 +22,13 @@ export type CommandBuilderFromSchemaType<Model, EVENTS extends Record<string, Ev
19
22
  * commitCommands(state);
20
23
  * ```
21
24
  */
22
- withCommitFunction: (commitFunction: CommandCommitFunction<Model, CommandPayload>) => CommandBuilderFromSchemaType<Model, EVENTS, EVENT, CommandPayload>;
23
- withResultFormatFunction: (resultFormatFunction: CommandFormatFunction<Model, CommandPayload>) => CommandBuilderFromSchemaType<Model, EVENTS, EVENT, CommandPayload>;
24
- withInvariant: (invariant: InvariantType<Model, CommandPayload> | ((state: Model, data: CommandPayload) => Promise<void>)) => CommandBuilderFromSchemaType<Model, EVENTS, EVENT, CommandPayload>;
25
- produces: <EVENT extends keyof EVENTS>(events: EVENT[]) => {
26
- withHandler: <USER, StateModel = Model>(handler: CommandHandlerFunction<StateModel, CommandPayload, EVENTS, EVENT, USER>) => {
25
+ withCommitFunction: (commitFunction: CommandCommitFunction<Model, CommandPayload, USER>) => CommandBuilderFromSchemaType<Model, EVENTS, EVENT, CommandPayload, USER, METADATA>;
26
+ withResultFormatFunction: (resultFormatFunction: CommandFormatFunction<Model, CommandPayload, USER>) => CommandBuilderFromSchemaType<Model, EVENTS, EVENT, CommandPayload, USER, METADATA>;
27
+ withPreProcessing: (preProcessingFunction: CommandPreProcessingFunction<USER, Model, CommandPayload, METADATA>) => CommandBuilderFromSchemaType<Model, EVENTS, EVENT, CommandPayload, USER, METADATA>;
28
+ withInvariant: (invariant: InvariantType<Model, CommandPayload, USER>) => CommandBuilderFromSchemaType<Model, EVENTS, EVENT, CommandPayload, USER, METADATA>;
29
+ withIdempotencyCheck: (idempotencyCheck: IdempotencyCheckType<Model, CommandPayload, USER>) => CommandBuilderFromSchemaType<Model, EVENTS, EVENT, CommandPayload, USER, METADATA>;
30
+ produces: <EVENT extends Extract<keyof EVENTS, string>>(events: EVENT[]) => {
31
+ withHandler: <StateModel = Model>(handler: CommandHandlerFunction<StateModel, CommandPayload, EVENTS, EVENT, USER, METADATA>) => {
27
32
  build: () => Command<EVENTS, EVENT, Model, CommandPayload>;
28
33
  withErrorHandler: (errorHandler: CommandErrorHandlerFunction<CommandPayload>) => {
29
34
  build: () => Command<EVENTS, EVENT, Model, CommandPayload>;
@@ -35,8 +40,10 @@ export type CommandBuilderFromSchemaType<Model, EVENTS extends Record<string, Ev
35
40
  build: () => Command<EVENTS, EVENT, Model, CommandPayload>;
36
41
  };
37
42
  };
38
- export type CommandBuilderInstance<Model, EVENTS extends Record<string, EventFactory>, EVENT extends keyof EVENTS, CommandPayload> = {
39
- withDescription: (description: string) => CommandBuilderInstance<Model, EVENTS, EVENT, CommandPayload>;
43
+ export type CommandBuilderInstance<Model, EVENTS extends Record<string, EventFactory>, EVENT extends keyof EVENTS, CommandPayload, USER = any, METADATA = any> = {
44
+ withPermissions: (permissions: PermissionString[]) => CommandBuilderInstance<Model, EVENTS, EVENT, CommandPayload, USER, METADATA>;
45
+ withDescription: (description: string) => CommandBuilderInstance<Model, EVENTS, EVENT, CommandPayload, USER, METADATA>;
46
+ withVisibility: (visibility: 'public' | 'private' | 'internal') => CommandBuilderInstance<Model, EVENTS, EVENT, CommandPayload, USER, METADATA>;
40
47
  /** Specify where to find the id of the aggregate when the command has no Id in the Params of the request
41
48
  *
42
49
  * suppose a structure of
@@ -51,8 +58,8 @@ export type CommandBuilderInstance<Model, EVENTS extends Record<string, EventFac
51
58
  * In the case of an array use a Dollar sign `$`.
52
59
  * `products.$.id`
53
60
  */
54
- withDataPropertyId: (dataPath: string) => CommandBuilderInstance<Model, EVENTS, EVENT, CommandPayload>;
55
- withSchema: <CommandPayload>(schema: BaseSchema<CommandPayload>) => CommandBuilderFromSchemaType<Model, EVENTS, EVENT, CommandPayload>;
61
+ withDataPropertyId: (dataPath: string) => CommandBuilderInstance<Model, EVENTS, EVENT, CommandPayload, METADATA>;
62
+ withSchema: <CommandPayload>(schema: BaseSchema<CommandPayload>) => CommandBuilderFromSchemaType<Model, EVENTS, EVENT, CommandPayload, USER, METADATA>;
56
63
  };
57
- export type CommandBuilderType<Model = any, EVENTS extends Record<string, EventFactory> = any, EVENT extends keyof EVENTS = any, CommandPayload = any> = (init?: Omit<Command<EVENTS, EVENT, CommandPayload, Model>, 'handler' | 'events' | 'schema'>) => CommandBuilderInstance<Model, EVENTS, EVENT, CommandPayload>;
64
+ export type CommandBuilderType<METADATA = any, USER = any, Model = any, EVENTS extends Record<string, EventFactory> = any, EVENT extends Extract<keyof EVENTS, string> = any, CommandPayload = any> = (init?: Omit<Command<EVENTS, EVENT, CommandPayload, Model>, 'handler' | 'events' | 'schema'>) => CommandBuilderInstance<Model, EVENTS, EVENT, CommandPayload, USER, METADATA>;
58
65
  //# sourceMappingURL=commandBuilder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"commandBuilder.d.ts","sourceRoot":"","sources":["../../src/eventsourcing/commandBuilder.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,qBAAqB,EAAE,2BAA2B,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,GAAG,CAAC;AAEjL,MAAM,MAAM,4BAA4B,CAAC,KAAK,EAAE,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,EAAE,KAAK,SAAS,MAAM,MAAM,EAAE,cAAc,IAAI;IACzI;;;;;;;;OAQG;IACH,gBAAgB,EAAE,CAAE,YAAY,EAAE,mBAAmB,CAAC,KAAK,EAAE,cAAc,CAAC,KAAM,4BAA4B,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,CAAC,CAAA;IACpJ;;;;;;;OAOG;IACH,kBAAkB,EAAE,CAAE,cAAc,EAAE,qBAAqB,CAAC,KAAK,EAAE,cAAc,CAAC,KAAM,4BAA4B,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,CAAC,CAAA;IAC1J,wBAAwB,EAAE,CAAE,oBAAoB,EAAE,qBAAqB,CAAC,KAAK,EAAE,cAAc,CAAC,KAAM,4BAA4B,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,CAAC,CAAA;IACtK,aAAa,EAAE,CAAE,SAAS,EAAE,aAAa,CAAC,KAAK,EAAE,cAAc,CAAC,GAAG,CAAC,CAAE,KA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