@reventlessdev/reventless-core 3.0.0-alpha.180 → 3.0.0-alpha.181

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 (115) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/package.json +7 -7
  3. package/src/Message.res +2 -1
  4. package/src/Message.res.mjs +5 -1
  5. package/src/admin/Platform_Admin_Structure.res +2 -0
  6. package/src/admin/Platform_Admin_Structure.res.mjs +2 -0
  7. package/src/admin/Platform_ComponentDefinitionsApi.res +2 -1
  8. package/src/admin/Platform_ComponentDefinitionsApi.res.mjs +5 -1
  9. package/src/admin/UiFragmentRegistry/StateViewSlice/UiFragments_Projection.res +1 -1
  10. package/src/admin/UiFragmentRegistry/StateViewSlice/UiFragments_Projection.res.mjs +2 -1
  11. package/src/components/Api/ApiTargetStateHelpers.res +20 -0
  12. package/src/components/Api/ApiTargetStateHelpers.res.mjs +16 -0
  13. package/src/components/Api/GraphQL_FragmentGenerator.res +1 -0
  14. package/src/components/Api/GraphQL_FragmentGenerator.res.mjs +1 -0
  15. package/src/components/Api/SchemaType.res +3 -0
  16. package/src/components/Api/SchemaType.res.mjs +10 -2
  17. package/src/components/Api/SuryToJsonSchema.res +16 -0
  18. package/src/components/Api/SuryToJsonSchema.res.mjs +28 -0
  19. package/src/components/Dcb/Dcb_Builder.res +4 -5
  20. package/src/components/Dcb/Dcb_Builder.res.mjs +3 -5
  21. package/src/components/DcbEventLog/DcbEventLog_Operations.res +6 -1
  22. package/src/components/DcbEventLog/DcbEventLog_Operations.res.mjs +2 -1
  23. package/src/components/InboundTranslationSlice/InboundTranslationSlice.res +25 -0
  24. package/src/components/InboundTranslationSlice/InboundTranslationSlice.res.mjs +31 -0
  25. package/src/components/InboundTranslationSlice/InboundTranslationSlice_Callback.res +8 -8
  26. package/src/components/InboundTranslationSlice/InboundTranslationSlice_Callback.res.mjs +26 -6
  27. package/src/components/OutboundTranslationSlice/OutboundTranslationSlice_Builder.res +44 -37
  28. package/src/components/OutboundTranslationSlice/OutboundTranslationSlice_Builder.res.mjs +17 -25
  29. package/src/components/StateChangeSlice/StateChangeSlice_Callback.res +27 -2
  30. package/src/components/StateChangeSlice/StateChangeSlice_Callback.res.mjs +4 -0
  31. package/src/components/StateViewSlice/StateViewSlice_Builder.res +20 -6
  32. package/src/components/StateViewSlice/StateViewSlice_Builder.res.mjs +23 -5
  33. package/src/components/StateViewSlice/StateViewSlice_Callback.res +1 -1
  34. package/src/components/StateViewSlice/StateViewSlice_Callback.res.mjs +5 -1
  35. package/src/plugin/component/Plugin_Helpers.res +4 -1
  36. package/src/plugin/component/Plugin_Structure.res +15 -1
  37. package/src/plugin/component/Plugin_Structure.res.mjs +4 -1
  38. package/src/plugin/lifecycle/PluginsReadModelSpec.res.mjs +2 -0
  39. package/tests/IdentityTest.res.mjs +174 -0
  40. package/tests/ResourceAttributionTest.res.mjs +75 -0
  41. package/tests/adapter/MonitoringTest.res.mjs +116 -0
  42. package/tests/admin/Platform_ComponentDefinitionsApiTest.res +10 -0
  43. package/tests/admin/Platform_ComponentDefinitionsApiTest.res.mjs +365 -0
  44. package/tests/admin/Platform_UIFragmentsApiTest.res.mjs +101 -0
  45. package/tests/aggregate/AggregateCacheTest.res.mjs +433 -0
  46. package/tests/aggregate/AggregateCallbackTest.res.mjs +143 -0
  47. package/tests/aggregate/AggregateCausationTest.res.mjs +47 -0
  48. package/tests/aggregate/AggregateConflictTest.res.mjs +386 -0
  49. package/tests/aggregate/AggregateFixtures.res.mjs +308 -0
  50. package/tests/aggregate/AggregateRejectionTest.res.mjs +166 -0
  51. package/tests/aggregate/AggregateSnapshotTest.res.mjs +645 -0
  52. package/tests/api/ApiNoApiTest.res.mjs +90 -0
  53. package/tests/api/GraphQL_StitcherTest.res.mjs +112 -0
  54. package/tests/api/SimpleTest.res.mjs +10 -0
  55. package/tests/api/SuryToJsonSchemaTest.res +68 -0
  56. package/tests/api/SuryToJsonSchemaTest.res.mjs +843 -0
  57. package/tests/commandgenerator/CommandGeneratorCallbackTest.res.mjs +160 -0
  58. package/tests/commandgenerator/CommandGeneratorFixtures.res.mjs +197 -0
  59. package/tests/commandtopic/CommandTopicCallbackFixtures.res.mjs +152 -0
  60. package/tests/commandtopic/CommandTopicCallbackTest.res.mjs +106 -0
  61. package/tests/commandtopic/CommandTopicHelpersRejectionTest.res.mjs +109 -0
  62. package/tests/counter/CounterCallbackTest.res.mjs +140 -0
  63. package/tests/counter/CounterFixtures.res.mjs +67 -0
  64. package/tests/dcb/DcbDecodeTest.res.mjs +194 -0
  65. package/tests/dcb/DcbEventLogOperationsTest.res.mjs +268 -0
  66. package/tests/dcb/DcbFixtures.res.mjs +534 -0
  67. package/tests/dcb/DcbScopeInferenceTest.res.mjs +480 -0
  68. package/tests/dcb/DcbStateChangeSliceTest.res.mjs +540 -0
  69. package/tests/dcb/DcbTagTest.res.mjs +867 -0
  70. package/tests/dcb/DcbValidationTest.res.mjs +476 -0
  71. package/tests/eventlog/EventLogFixtures.res.mjs +196 -0
  72. package/tests/eventlog/EventLogOperationsTest.res.mjs +192 -0
  73. package/tests/eventlog/EventLogRetryTest.res.mjs +195 -0
  74. package/tests/eventmapper/EventMapperCallbackTest.res.mjs +141 -0
  75. package/tests/eventmapper/EventMapperFixtures.res.mjs +440 -0
  76. package/tests/eventmapper/EventMapperTest.res.mjs +83 -0
  77. package/tests/eventtopic/EventTopicFixtures.res.mjs +65 -0
  78. package/tests/eventtopic/EventTopicOperationsTest.res.mjs +71 -0
  79. package/tests/extensionpoint/ExtensionPointCallbackTest.res.mjs +94 -0
  80. package/tests/extensionpoint/ExtensionPointFixtures.res.mjs +205 -0
  81. package/tests/extensionpoint/ExtensionPointOperationsTest.res.mjs +304 -0
  82. package/tests/extensionpoint/PluginDisconnectScheduleTest.res.mjs +92 -0
  83. package/tests/ftp/FTPTest.res.mjs +88 -0
  84. package/tests/logger/LogFormatTest.res.mjs +329 -0
  85. package/tests/logger/LoggerLazyTest.res.mjs +40 -0
  86. package/tests/message/MessageTest.res.mjs +218 -0
  87. package/tests/message/MetaEnvelopeTest.res.mjs +188 -0
  88. package/tests/plugin/HeartbeatDisconnectGraceTest.res.mjs +91 -0
  89. package/tests/plugin/ManifestVisibilityTest.res.mjs +215 -0
  90. package/tests/plugin/PluginSpecExperiment.res.mjs +31 -0
  91. package/tests/plugin/PluginStructureTest.res +55 -0
  92. package/tests/plugin/PluginStructureTest.res.mjs +467 -0
  93. package/tests/plugin/PluginVersionTest.res.mjs +30 -0
  94. package/tests/plugin/SchemaWalkerTest.res.mjs +160 -0
  95. package/tests/plugin/StateChangeSlice/PsPlaceOrder.res.mjs +62 -0
  96. package/tests/plugin/StateChangeSlice/PsShipOrder.res +4 -1
  97. package/tests/plugin/StateChangeSlice/PsShipOrder.res.mjs +77 -0
  98. package/tests/plugin/StateViewSlice/PsAnnotatedView.res +5 -4
  99. package/tests/plugin/StateViewSlice/PsAnnotatedView.res.mjs +110 -0
  100. package/tests/plugin/StateViewSlice/PsAvailableProductsView.res +1 -1
  101. package/tests/plugin/StateViewSlice/PsAvailableProductsView.res.mjs +70 -0
  102. package/tests/plugin/StateViewSlice/PsCustomersView.res +1 -1
  103. package/tests/plugin/StateViewSlice/PsCustomersView.res.mjs +70 -0
  104. package/tests/plugin/StateViewSlice/PsOrdersView.res +1 -1
  105. package/tests/plugin/StateViewSlice/PsOrdersView.res.mjs +82 -0
  106. package/tests/poc/StructuralSubtypingPoc.res.mjs +61 -0
  107. package/tests/projection/ProjectionOptimizeTest.res.mjs +75 -0
  108. package/tests/querydb/QueryDbFixtures.res.mjs +135 -0
  109. package/tests/querydb/QueryDbOperationsTest.res.mjs +168 -0
  110. package/tests/sideeffecthandler/SideEffectHandlerCallbackTest.res.mjs +77 -0
  111. package/tests/sideeffecthandler/SideEffectHandlerFixtures.res.mjs +139 -0
  112. package/tests/util/CommandPublisherTest.res.mjs +78 -0
  113. package/tests/util/CsvStreamTest.res.mjs +51 -0
  114. package/tests/util/LruTest.res.mjs +105 -0
  115. package/tests/util/MetricsTest.res.mjs +53 -0
@@ -0,0 +1,534 @@
1
+ // Generated by ReScript, PLEASE EDIT WITH CARE
2
+
3
+ import * as S from "sury/src/S.res.mjs";
4
+ import * as Stdlib_Int from "@rescript/runtime/lib/es6/Stdlib_Int.js";
5
+ import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
6
+ import * as Effect from "effect/Effect";
7
+ import * as Stream from "effect/Stream";
8
+ import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
9
+ import * as Message$ReventlessCore from "../../src/Message.res.mjs";
10
+
11
+ S.enableJson();
12
+
13
+ let moduleUrl = import.meta.url;
14
+
15
+ let eventSchema = S.union([
16
+ S.schema(s => ({
17
+ TAG: "ItemCreated",
18
+ itemId: s.m(DcbTag$Reventless.string),
19
+ name: s.m(S.string)
20
+ })),
21
+ S.schema(s => ({
22
+ TAG: "ItemRenamed",
23
+ itemId: s.m(DcbTag$Reventless.string),
24
+ newName: s.m(S.string)
25
+ })),
26
+ S.schema(s => ({
27
+ TAG: "CountUpdated",
28
+ category: s.m(DcbTag$Reventless.string),
29
+ amount: s.m(DcbTag$Reventless.int)
30
+ })),
31
+ S.literal("SimpleEvent")
32
+ ]);
33
+
34
+ let TestEventLogSpec = {
35
+ moduleUrl: moduleUrl,
36
+ eventSchema: eventSchema
37
+ };
38
+
39
+ let eventSchema$1 = S.union([
40
+ S.schema(s => ({
41
+ TAG: "PlainEvent",
42
+ name: s.m(S.string),
43
+ value: s.m(S.int)
44
+ })),
45
+ S.literal("EmptyEvent")
46
+ ]);
47
+
48
+ let UntaggedEventSpec = {
49
+ eventSchema: eventSchema$1
50
+ };
51
+
52
+ let objectEventSchema = S.schema(s => ({
53
+ tenantId: s.m(DcbTag$Reventless.string),
54
+ data: s.m(S.string)
55
+ }));
56
+
57
+ let moduleUrl$1 = import.meta.url;
58
+
59
+ let eventSchema$2 = S.union([
60
+ S.schema(s => ({
61
+ TAG: "ItemCreated",
62
+ itemId: s.m(DcbTag$Reventless.string),
63
+ name: s.m(S.string)
64
+ })),
65
+ S.schema(s => ({
66
+ TAG: "ItemRenamed",
67
+ itemId: s.m(DcbTag$Reventless.string),
68
+ newName: s.m(S.string)
69
+ }))
70
+ ]);
71
+
72
+ let consumedEventSchema = S.union([
73
+ S.schema(s => ({
74
+ TAG: "ItemCreated",
75
+ itemId: s.m(DcbTag$Reventless.string),
76
+ name: s.m(S.string)
77
+ })),
78
+ S.schema(s => ({
79
+ TAG: "ItemRenamed",
80
+ itemId: s.m(DcbTag$Reventless.string),
81
+ newName: s.m(S.string)
82
+ }))
83
+ ]);
84
+
85
+ let commandSchema = S.union([
86
+ S.schema(s => ({
87
+ TAG: "CreateItem",
88
+ itemId: s.m(DcbTag$Reventless.string),
89
+ name: s.m(S.string)
90
+ })),
91
+ S.schema(s => ({
92
+ TAG: "RenameItem",
93
+ itemId: s.m(DcbTag$Reventless.string),
94
+ newName: s.m(S.string)
95
+ })),
96
+ S.literal("NoOp")
97
+ ]);
98
+
99
+ let errorSchema = S.union([
100
+ S.literal("ItemAlreadyExists"),
101
+ S.literal("ItemNotFound")
102
+ ]);
103
+
104
+ function evolve(state, event) {
105
+ if (event.TAG === "ItemCreated") {
106
+ return {
107
+ exists: true,
108
+ currentName: event.name
109
+ };
110
+ } else {
111
+ return {
112
+ exists: state.exists,
113
+ currentName: event.newName
114
+ };
115
+ }
116
+ }
117
+
118
+ function decide(state, command) {
119
+ if (typeof command !== "object") {
120
+ return {
121
+ TAG: "Ok",
122
+ _0: []
123
+ };
124
+ } else if (command.TAG === "CreateItem") {
125
+ if (state.exists) {
126
+ return {
127
+ TAG: "Error",
128
+ _0: "ItemAlreadyExists"
129
+ };
130
+ } else {
131
+ return {
132
+ TAG: "Ok",
133
+ _0: [{
134
+ TAG: "ItemCreated",
135
+ itemId: command.itemId,
136
+ name: command.name
137
+ }]
138
+ };
139
+ }
140
+ } else if (state.exists) {
141
+ return {
142
+ TAG: "Ok",
143
+ _0: [{
144
+ TAG: "ItemRenamed",
145
+ itemId: command.itemId,
146
+ newName: command.newName
147
+ }]
148
+ };
149
+ } else {
150
+ return {
151
+ TAG: "Error",
152
+ _0: "ItemNotFound"
153
+ };
154
+ }
155
+ }
156
+
157
+ function commandAuthorization(param) {
158
+ return "AllowAuthenticated";
159
+ }
160
+
161
+ let TestCommandSpec_initialState = {
162
+ exists: false,
163
+ currentName: undefined
164
+ };
165
+
166
+ let TestCommandSpec = {
167
+ name: "TestStateChangeSlice",
168
+ Id: undefined,
169
+ moduleUrl: moduleUrl$1,
170
+ eventSchema: eventSchema$2,
171
+ consumedEventSchema: consumedEventSchema,
172
+ commandSchema: commandSchema,
173
+ errorSchema: errorSchema,
174
+ initialState: TestCommandSpec_initialState,
175
+ evolve: evolve,
176
+ decide: decide,
177
+ commandAuthorization: commandAuthorization,
178
+ readConsistency: "EscalateOnRetry"
179
+ };
180
+
181
+ function posToInt(pos) {
182
+ return Stdlib_Option.getOr(Stdlib_Int.fromString(pos, undefined), 0);
183
+ }
184
+
185
+ function makeMockStorage() {
186
+ let events = {
187
+ contents: []
188
+ };
189
+ let position = {
190
+ contents: 0
191
+ };
192
+ let publishedEventsRef = {
193
+ contents: []
194
+ };
195
+ let failNextAppendsRef = {
196
+ contents: 0
197
+ };
198
+ let readAftersRef = {
199
+ contents: []
200
+ };
201
+ let readStrongConsistencyRef = {
202
+ contents: []
203
+ };
204
+ let matchesQuery = (event, query) => {
205
+ if (query.length === 0) {
206
+ return true;
207
+ } else {
208
+ return query.some(queryItem => {
209
+ let types = queryItem.eventTypes;
210
+ let typeMatch = types !== undefined ? types.includes(event.eventType) : true;
211
+ let tags = queryItem.tags;
212
+ let tagMatch = tags !== undefined ? tags.every(tag => event.tags.some(et => {
213
+ if (et.key === tag.key) {
214
+ return et.value === tag.value;
215
+ } else {
216
+ return false;
217
+ }
218
+ })) : true;
219
+ if (typeMatch) {
220
+ return tagMatch;
221
+ } else {
222
+ return false;
223
+ }
224
+ });
225
+ }
226
+ };
227
+ let read = async (query, after) => {
228
+ readAftersRef.contents = readAftersRef.contents.concat([after]);
229
+ let filtered = events.contents.filter(event => {
230
+ let afterMatch = after !== undefined ? posToInt(event.position) > posToInt(after) : true;
231
+ if (afterMatch) {
232
+ return matchesQuery(event, query);
233
+ } else {
234
+ return false;
235
+ }
236
+ });
237
+ let headPosition = Stdlib_Option.map(events.contents[events.contents.length - 1 | 0], e => e.position);
238
+ return {
239
+ events: filtered,
240
+ headPosition: headPosition
241
+ };
242
+ };
243
+ let append = async (newEvents, condition) => {
244
+ if (failNextAppendsRef.contents > 0) {
245
+ failNextAppendsRef.contents = failNextAppendsRef.contents - 1 | 0;
246
+ return {
247
+ TAG: "Error",
248
+ _0: "Conflict"
249
+ };
250
+ }
251
+ let conflictDetected = condition !== undefined ? events.contents.some(event => {
252
+ let pos = condition.after;
253
+ let afterMatch = pos !== undefined ? posToInt(event.position) > posToInt(pos) : true;
254
+ if (afterMatch) {
255
+ return matchesQuery(event, condition.query);
256
+ } else {
257
+ return false;
258
+ }
259
+ }) : false;
260
+ if (conflictDetected) {
261
+ return {
262
+ TAG: "Error",
263
+ _0: "Conflict"
264
+ };
265
+ }
266
+ let storedEvents = newEvents.map(event => {
267
+ position.contents = position.contents + 1 | 0;
268
+ let pos = position.contents.toString();
269
+ return {
270
+ position: pos,
271
+ eventType: event.eventType,
272
+ data: event.data,
273
+ tags: event.tags,
274
+ meta: event.meta,
275
+ recordedAt: Message$ReventlessCore.nowAsISOString()
276
+ };
277
+ });
278
+ events.contents = events.contents.concat(storedEvents);
279
+ return {
280
+ TAG: "Ok",
281
+ _0: position.contents.toString()
282
+ };
283
+ };
284
+ let readStream = (query, after, strongConsistencyOpt) => {
285
+ let strongConsistency = strongConsistencyOpt !== undefined ? strongConsistencyOpt : false;
286
+ readStrongConsistencyRef.contents = readStrongConsistencyRef.contents.concat([strongConsistency]);
287
+ return Stream.flatMap(Stream.fromEffect(Effect.map(Effect.promise(() => read(query, after)), result => result.events)), arr => Stream.fromIterable(arr));
288
+ };
289
+ let mockPublishJson = async (service, meta, json) => {
290
+ publishedEventsRef.contents = publishedEventsRef.contents.concat([{
291
+ service: service,
292
+ meta: meta,
293
+ json: json
294
+ }]);
295
+ };
296
+ let reset = () => {
297
+ events.contents = [];
298
+ position.contents = 0;
299
+ publishedEventsRef.contents = [];
300
+ failNextAppendsRef.contents = 0;
301
+ readAftersRef.contents = [];
302
+ readStrongConsistencyRef.contents = [];
303
+ };
304
+ return {
305
+ operations: {
306
+ read: read,
307
+ append: append,
308
+ readStream: readStream
309
+ },
310
+ getEvents: () => events.contents,
311
+ publishedEvents: publishedEventsRef,
312
+ mockPublishJson: mockPublishJson,
313
+ failNextAppends: failNextAppendsRef,
314
+ readAfters: readAftersRef,
315
+ readStrongConsistency: readStrongConsistencyRef,
316
+ reset: reset
317
+ };
318
+ }
319
+
320
+ let plainRecordSchema = S.schema(s => ({
321
+ name: s.m(S.string),
322
+ value: s.m(S.int)
323
+ }));
324
+
325
+ let multiTagRecordSchema = S.schema(s => ({
326
+ userId: s.m(DcbTag$Reventless.string),
327
+ tenantId: s.m(DcbTag$Reventless.string),
328
+ data: s.m(S.string)
329
+ }));
330
+
331
+ let emptyVariantSchema = S.literal("Empty");
332
+
333
+ let intTagEventSchema = S.schema(s => ({
334
+ TAG: "CountEvent",
335
+ count: s.m(DcbTag$Reventless.int)
336
+ }));
337
+
338
+ let mixedEventSchema = S.union([
339
+ S.schema(s => ({
340
+ TAG: "EventA",
341
+ id: s.m(DcbTag$Reventless.string),
342
+ name: s.m(S.string)
343
+ })),
344
+ S.schema(s => ({
345
+ TAG: "EventB",
346
+ id: s.m(DcbTag$Reventless.string),
347
+ count: s.m(S.int)
348
+ })),
349
+ S.schema(s => ({
350
+ TAG: "EventC",
351
+ untaggedField: s.m(S.string)
352
+ }))
353
+ ]);
354
+
355
+ let complexEventSchema = S.union([
356
+ S.schema(s => ({
357
+ TAG: "UserCreated",
358
+ userId: s.m(DcbTag$Reventless.string),
359
+ name: s.m(S.string)
360
+ })),
361
+ S.schema(s => ({
362
+ TAG: "UserUpdated",
363
+ userId: s.m(DcbTag$Reventless.string),
364
+ email: s.m(S.string)
365
+ })),
366
+ S.schema(s => ({
367
+ TAG: "OrderPlaced",
368
+ orderId: s.m(DcbTag$Reventless.string),
369
+ userId: s.m(DcbTag$Reventless.string),
370
+ amount: s.m(S.float)
371
+ })),
372
+ S.schema(s => ({
373
+ TAG: "OrderShipped",
374
+ orderId: s.m(DcbTag$Reventless.string),
375
+ trackingId: s.m(DcbTag$Reventless.string)
376
+ })),
377
+ S.schema(s => ({
378
+ TAG: "PaymentProcessed",
379
+ paymentId: s.m(DcbTag$Reventless.string),
380
+ amount: s.m(S.float)
381
+ }))
382
+ ]);
383
+
384
+ let multiFieldEventSchema = S.schema(s => ({
385
+ TAG: "EventWithMultipleTags",
386
+ userId: s.m(DcbTag$Reventless.string),
387
+ tenantId: s.m(DcbTag$Reventless.string),
388
+ sessionId: s.m(DcbTag$Reventless.string)
389
+ }));
390
+
391
+ let crossEntityCommandSchema = S.schema(s => ({
392
+ TAG: "PlaceOrder",
393
+ orderId: s.m(DcbTag$Reventless.string),
394
+ customerId: s.m(S.string),
395
+ productId: s.m(S.array(DcbTag$Reventless.string))
396
+ }));
397
+
398
+ let singleTagCommandSchema = S.schema(s => ({
399
+ TAG: "CreateItem",
400
+ itemId: s.m(DcbTag$Reventless.string),
401
+ name: s.m(S.string)
402
+ }));
403
+
404
+ let orderEventLogSchema = S.union([
405
+ S.schema(s => ({
406
+ TAG: "OrderPlaced",
407
+ orderId: s.m(DcbTag$Reventless.string),
408
+ customerId: s.m(DcbTag$Reventless.string),
409
+ productId: s.m(DcbTag$Reventless.string)
410
+ })),
411
+ S.schema(s => ({
412
+ TAG: "CatalogProductSynced",
413
+ productId: s.m(DcbTag$Reventless.string)
414
+ }))
415
+ ]);
416
+
417
+ let singleProductEventSchema = S.schema(s => ({
418
+ TAG: "CatalogProductSynced",
419
+ productId: s.m(DcbTag$Reventless.string)
420
+ }));
421
+
422
+ let multiProductCommandSchema = S.schema(s => ({
423
+ TAG: "PlaceOrderWithMany",
424
+ orderId: s.m(DcbTag$Reventless.string),
425
+ productIds: s.m(S.array(DcbTag$Reventless.stringForKey("productId")))
426
+ }));
427
+
428
+ let customKeyEventSchema = S.schema(s => ({
429
+ TAG: "ProductLabelled",
430
+ sku: s.m(DcbTag$Reventless.stringForKey("productSku"))
431
+ }));
432
+
433
+ let compositeEventSchema = S.schema(s => ({
434
+ TAG: "SyncPlugin",
435
+ environment: s.m(DcbTag$Reventless.compositePartitionMember(0, undefined)),
436
+ platformName: s.m(DcbTag$Reventless.compositePartitionMember(1, undefined)),
437
+ pluginName: s.m(DcbTag$Reventless.compositePartitionMember(2, undefined)),
438
+ version: s.m(S.string)
439
+ }));
440
+
441
+ let compositeEventCustomSepSchema = S.schema(s => ({
442
+ TAG: "ConfigUpdated",
443
+ tenantId: s.m(DcbTag$Reventless.compositePartitionMember(0, ":")),
444
+ region: s.m(DcbTag$Reventless.compositePartitionMember(1, "/")),
445
+ service: s.m(DcbTag$Reventless.compositePartitionMember(2, undefined)),
446
+ value: s.m(S.string)
447
+ }));
448
+
449
+ let compositeMultiVariantSchema = S.union([
450
+ S.schema(s => ({
451
+ TAG: "VariantA",
452
+ env: s.m(DcbTag$Reventless.compositePartitionMember(0, undefined)),
453
+ name: s.m(DcbTag$Reventless.compositePartitionMember(1, undefined)),
454
+ data: s.m(S.string)
455
+ })),
456
+ S.schema(s => ({
457
+ TAG: "VariantB",
458
+ env: s.m(DcbTag$Reventless.compositePartitionMember(0, undefined)),
459
+ name: s.m(DcbTag$Reventless.compositePartitionMember(1, undefined)),
460
+ count: s.m(S.int)
461
+ }))
462
+ ]);
463
+
464
+ let simplePartitionEventSchema = S.schema(s => ({
465
+ TAG: "OrderPlaced",
466
+ orderId: s.m(DcbTag$Reventless.partition),
467
+ customerId: s.m(DcbTag$Reventless.string)
468
+ }));
469
+
470
+ let mixedStrategyEventSchema = S.schema(s => ({
471
+ TAG: "BadEvent",
472
+ env: s.m(DcbTag$Reventless.compositePartitionMember(0, undefined)),
473
+ name: s.m(DcbTag$Reventless.compositePartitionMember(1, undefined)),
474
+ orderId: s.m(DcbTag$Reventless.partition)
475
+ }));
476
+
477
+ let singleCompositeEventSchema = S.schema(s => ({
478
+ TAG: "OnlyOne",
479
+ env: s.m(DcbTag$Reventless.compositePartitionMember(0, undefined)),
480
+ data: s.m(S.string)
481
+ }));
482
+
483
+ let subscriptionEventSchema = S.schema(s => ({
484
+ TAG: "StudentSubscribed",
485
+ courseId: s.m(DcbTag$Reventless.partition),
486
+ studentId: s.m(DcbTag$Reventless.crossPartition)
487
+ }));
488
+
489
+ let subscribeCommandSchema = S.schema(s => ({
490
+ TAG: "SubscribeStudent",
491
+ courseId: s.m(DcbTag$Reventless.partition),
492
+ studentId: s.m(DcbTag$Reventless.crossPartition)
493
+ }));
494
+
495
+ let testMeta = {
496
+ service: "test",
497
+ time: "2024-01-01T00:00:00Z",
498
+ ip: "127.0.0.1",
499
+ user: "test-user",
500
+ msgId: "msg-1",
501
+ correlationId: "corr-1"
502
+ };
503
+
504
+ export {
505
+ TestEventLogSpec,
506
+ UntaggedEventSpec,
507
+ objectEventSchema,
508
+ TestCommandSpec,
509
+ posToInt,
510
+ makeMockStorage,
511
+ testMeta,
512
+ plainRecordSchema,
513
+ multiTagRecordSchema,
514
+ emptyVariantSchema,
515
+ intTagEventSchema,
516
+ mixedEventSchema,
517
+ complexEventSchema,
518
+ multiFieldEventSchema,
519
+ crossEntityCommandSchema,
520
+ singleTagCommandSchema,
521
+ orderEventLogSchema,
522
+ singleProductEventSchema,
523
+ multiProductCommandSchema,
524
+ customKeyEventSchema,
525
+ compositeEventSchema,
526
+ compositeEventCustomSepSchema,
527
+ compositeMultiVariantSchema,
528
+ simplePartitionEventSchema,
529
+ mixedStrategyEventSchema,
530
+ singleCompositeEventSchema,
531
+ subscriptionEventSchema,
532
+ subscribeCommandSchema,
533
+ }
534
+ /* Not a pure module */