@reventlessdev/reventless-core 3.0.0-alpha.170 → 3.0.0-alpha.172
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.
- package/CHANGELOG.md +14 -0
- package/package.json +14 -14
- package/src/components/ExtensionPoint/ExtensionPoint_Builder.res +5 -2
- package/src/components/ExtensionPoint/ExtensionPoint_Builder.res.mjs +3 -3
- package/src/components/Heartbeat/Heartbeat.res +2 -2
- package/src/components/Heartbeat/Heartbeat_Builder.res +2 -2
- package/src/components/Heartbeat/Heartbeat_Builder.res.mjs +2 -4
- package/src/components/Task/Task_Builder.res +6 -4
- package/src/components/Task/Task_Builder.res.mjs +4 -4
- package/src/plugin/component/Plugin_Builder.res +5 -1
- package/src/plugin/component/Plugin_Builder.res.mjs +1 -1
- package/src/plugin/component/Plugin_Helpers.res +6 -1
- package/src/plugin/connect/PluginExtensionPoint_Builder.res +2 -0
- package/src/plugin/connect/PluginExtensionPoint_Builder.res.mjs +3 -3
- package/src/plugin/connect/PluginExtensionPoint_Plugin.res +12 -5
- package/src/plugin/connect/PluginExtensionPoint_Plugin.res.mjs +8 -2
- package/tests/plugin/HeartbeatDisconnectGraceTest.res +98 -0
- package/tests/IdentityTest.res.mjs +0 -174
- package/tests/adapter/MonitoringTest.res.mjs +0 -82
- package/tests/admin/Platform_ComponentDefinitionsApiTest.res.mjs +0 -356
- package/tests/admin/Platform_UIFragmentsApiTest.res.mjs +0 -101
- package/tests/aggregate/AggregateCacheTest.res.mjs +0 -433
- package/tests/aggregate/AggregateCallbackTest.res.mjs +0 -143
- package/tests/aggregate/AggregateCausationTest.res.mjs +0 -47
- package/tests/aggregate/AggregateConflictTest.res.mjs +0 -386
- package/tests/aggregate/AggregateFixtures.res.mjs +0 -308
- package/tests/aggregate/AggregateRejectionTest.res.mjs +0 -166
- package/tests/aggregate/AggregateSnapshotTest.res.mjs +0 -645
- package/tests/api/ApiNoApiTest.res.mjs +0 -90
- package/tests/api/GraphQL_StitcherTest.res.mjs +0 -112
- package/tests/api/SimpleTest.res.mjs +0 -10
- package/tests/api/SuryToJsonSchemaTest.res.mjs +0 -674
- package/tests/commandgenerator/CommandGeneratorCallbackTest.res.mjs +0 -160
- package/tests/commandgenerator/CommandGeneratorFixtures.res.mjs +0 -197
- package/tests/commandtopic/CommandTopicCallbackFixtures.res.mjs +0 -152
- package/tests/commandtopic/CommandTopicCallbackTest.res.mjs +0 -106
- package/tests/commandtopic/CommandTopicHelpersRejectionTest.res.mjs +0 -109
- package/tests/counter/CounterCallbackTest.res.mjs +0 -140
- package/tests/counter/CounterFixtures.res.mjs +0 -67
- package/tests/dcb/DcbDecodeTest.res.mjs +0 -194
- package/tests/dcb/DcbEventLogOperationsTest.res.mjs +0 -268
- package/tests/dcb/DcbFixtures.res.mjs +0 -534
- package/tests/dcb/DcbScopeInferenceTest.res.mjs +0 -480
- package/tests/dcb/DcbStateChangeSliceTest.res.mjs +0 -540
- package/tests/dcb/DcbTagTest.res.mjs +0 -867
- package/tests/dcb/DcbValidationTest.res.mjs +0 -476
- package/tests/eventlog/EventLogFixtures.res.mjs +0 -196
- package/tests/eventlog/EventLogOperationsTest.res.mjs +0 -192
- package/tests/eventlog/EventLogRetryTest.res.mjs +0 -195
- package/tests/eventmapper/EventMapperCallbackTest.res.mjs +0 -141
- package/tests/eventmapper/EventMapperFixtures.res.mjs +0 -440
- package/tests/eventmapper/EventMapperTest.res.mjs +0 -83
- package/tests/eventtopic/EventTopicFixtures.res.mjs +0 -65
- package/tests/eventtopic/EventTopicOperationsTest.res.mjs +0 -71
- package/tests/extensionpoint/ExtensionPointCallbackTest.res.mjs +0 -94
- package/tests/extensionpoint/ExtensionPointFixtures.res.mjs +0 -205
- package/tests/extensionpoint/ExtensionPointOperationsTest.res.mjs +0 -304
- package/tests/ftp/FTPTest.res.mjs +0 -88
- package/tests/logger/LogFormatTest.res.mjs +0 -309
- package/tests/logger/LoggerLazyTest.res.mjs +0 -40
- package/tests/message/MessageTest.res.mjs +0 -218
- package/tests/message/MetaEnvelopeTest.res.mjs +0 -188
- package/tests/plugin/ManifestVisibilityTest.res.mjs +0 -215
- package/tests/plugin/PluginSpecExperiment.res.mjs +0 -31
- package/tests/plugin/PluginStructureTest.res.mjs +0 -419
- package/tests/plugin/PluginVersionTest.res.mjs +0 -30
- package/tests/plugin/SchemaWalkerTest.res.mjs +0 -160
- package/tests/plugin/StateChangeSlice/PsPlaceOrder.res.mjs +0 -62
- package/tests/plugin/StateChangeSlice/PsShipOrder.res.mjs +0 -69
- package/tests/plugin/StateViewSlice/PsAnnotatedView.res.mjs +0 -95
- package/tests/plugin/StateViewSlice/PsAvailableProductsView.res.mjs +0 -69
- package/tests/plugin/StateViewSlice/PsCustomersView.res.mjs +0 -69
- package/tests/plugin/StateViewSlice/PsOrdersView.res.mjs +0 -81
- package/tests/poc/StructuralSubtypingPoc.res.mjs +0 -61
- package/tests/projection/ProjectionOptimizeTest.res.mjs +0 -75
- package/tests/querydb/QueryDbFixtures.res.mjs +0 -135
- package/tests/querydb/QueryDbOperationsTest.res.mjs +0 -168
- package/tests/sideeffecthandler/SideEffectHandlerCallbackTest.res.mjs +0 -77
- package/tests/sideeffecthandler/SideEffectHandlerFixtures.res.mjs +0 -139
- package/tests/util/CommandPublisherTest.res.mjs +0 -78
- package/tests/util/CsvStreamTest.res.mjs +0 -51
- package/tests/util/LruTest.res.mjs +0 -105
- package/tests/util/MetricsTest.res.mjs +0 -53
|
@@ -1,534 +0,0 @@
|
|
|
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 */
|