@reventlessdev/reventless-core 3.0.0-alpha.170 → 3.0.0-alpha.171
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 +7 -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/Task/Task_Builder.res +6 -4
- package/src/components/Task/Task_Builder.res.mjs +4 -4
- package/src/plugin/connect/PluginExtensionPoint_Builder.res +2 -0
- package/src/plugin/connect/PluginExtensionPoint_Builder.res.mjs +3 -3
- 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,94 +0,0 @@
|
|
|
1
|
-
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
-
|
|
3
|
-
import * as Effect from "effect/Effect";
|
|
4
|
-
import * as Stream from "effect/Stream";
|
|
5
|
-
import * as ExtensionPointFixtures$ReventlessCore from "./ExtensionPointFixtures.res.mjs";
|
|
6
|
-
|
|
7
|
-
globalThis.beforeEach(() => ExtensionPointFixtures$ReventlessCore.reset());
|
|
8
|
-
|
|
9
|
-
globalThis.describe("ExtensionPoint_Callback.handleIncomingCommands:", () => {
|
|
10
|
-
globalThis.describe("AbstractPublishCommand — known aggregate", () => {
|
|
11
|
-
globalThis.test("dispatches to aggregate publishJsons, returns Ok(reference)", async () => {
|
|
12
|
-
let results = await Effect.runPromise(ExtensionPointFixtures$ReventlessCore.TestHandler.handleIncomingCommands(Stream.fromIterable([ExtensionPointFixtures$ReventlessCore.makeTopicItem("ref-1", {
|
|
13
|
-
TAG: "RouteToAgg",
|
|
14
|
-
aggId: "agg-1"
|
|
15
|
-
})])));
|
|
16
|
-
globalThis.expect([
|
|
17
|
-
results,
|
|
18
|
-
ExtensionPointFixtures$ReventlessCore.capturedPublishedCmds.contents.length
|
|
19
|
-
]).toEqual([
|
|
20
|
-
[{
|
|
21
|
-
TAG: "Ok",
|
|
22
|
-
_0: "ref-1"
|
|
23
|
-
}],
|
|
24
|
-
1
|
|
25
|
-
]);
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
globalThis.describe("AbstractPublishCommand — unknown aggregate", () => {
|
|
29
|
-
globalThis.test("throws internally, returns Error(reference)", async () => {
|
|
30
|
-
let results = await Effect.runPromise(ExtensionPointFixtures$ReventlessCore.TestHandler.handleIncomingCommands(Stream.fromIterable([
|
|
31
|
-
ExtensionPointFixtures$ReventlessCore.makeTopicItem("ref-a", {
|
|
32
|
-
TAG: "RouteToAgg",
|
|
33
|
-
aggId: "agg-1"
|
|
34
|
-
}),
|
|
35
|
-
ExtensionPointFixtures$ReventlessCore.makeTopicItem("ref-b", {
|
|
36
|
-
TAG: "RouteToAgg",
|
|
37
|
-
aggId: "agg-2"
|
|
38
|
-
})
|
|
39
|
-
])));
|
|
40
|
-
globalThis.expect(results.length).toBe(2);
|
|
41
|
-
let allOk = results.every(r => r.TAG === "Ok");
|
|
42
|
-
globalThis.expect(allOk).toBe(true);
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
globalThis.describe("AbstractHandleDirective handler succeeds", () => {
|
|
46
|
-
globalThis.test("handler called, returns Ok(reference)", async () => {
|
|
47
|
-
let results = await Effect.runPromise(ExtensionPointFixtures$ReventlessCore.TestHandler.handleIncomingCommands(Stream.fromIterable([ExtensionPointFixtures$ReventlessCore.makeTopicItem("ref-1", {
|
|
48
|
-
TAG: "TriggerDirective",
|
|
49
|
-
value: "test"
|
|
50
|
-
})])));
|
|
51
|
-
globalThis.expect([
|
|
52
|
-
results,
|
|
53
|
-
ExtensionPointFixtures$ReventlessCore.capturedCallCount.contents
|
|
54
|
-
]).toEqual([
|
|
55
|
-
[{
|
|
56
|
-
TAG: "Ok",
|
|
57
|
-
_0: "ref-1"
|
|
58
|
-
}],
|
|
59
|
-
1
|
|
60
|
-
]);
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
globalThis.describe("mixed actions", () => {
|
|
64
|
-
globalThis.test("AbstractPublishCommand and AbstractHandleDirective both resolved", async () => {
|
|
65
|
-
let results = await Effect.runPromise(ExtensionPointFixtures$ReventlessCore.TestHandler.handleIncomingCommands(Stream.fromIterable([
|
|
66
|
-
ExtensionPointFixtures$ReventlessCore.makeTopicItem("ref-pub", {
|
|
67
|
-
TAG: "RouteToAgg",
|
|
68
|
-
aggId: "agg-1"
|
|
69
|
-
}),
|
|
70
|
-
ExtensionPointFixtures$ReventlessCore.makeTopicItem("ref-call", {
|
|
71
|
-
TAG: "TriggerDirective",
|
|
72
|
-
value: "v"
|
|
73
|
-
})
|
|
74
|
-
])));
|
|
75
|
-
globalThis.expect([
|
|
76
|
-
results.length,
|
|
77
|
-
ExtensionPointFixtures$ReventlessCore.capturedPublishedCmds.contents.length,
|
|
78
|
-
ExtensionPointFixtures$ReventlessCore.capturedCallCount.contents
|
|
79
|
-
]).toEqual([
|
|
80
|
-
2,
|
|
81
|
-
1,
|
|
82
|
-
1
|
|
83
|
-
]);
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
globalThis.describe("empty batch", () => {
|
|
87
|
-
globalThis.test("returns empty array", async () => {
|
|
88
|
-
let results = await Effect.runPromise(ExtensionPointFixtures$ReventlessCore.TestHandler.handleIncomingCommands(Stream.fromIterable([])));
|
|
89
|
-
globalThis.expect(results).toEqual([]);
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
/* Not a pure module */
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
-
|
|
3
|
-
import * as S from "sury/src/S.res.mjs";
|
|
4
|
-
import * as Id$Reventless from "@reventlessdev/reventless-spec/src/types/Id.res.mjs";
|
|
5
|
-
import * as ExtensionPoint_Callback$ReventlessCore from "../../src/components/ExtensionPoint/ExtensionPoint_Callback.res.mjs";
|
|
6
|
-
|
|
7
|
-
S.enableJson();
|
|
8
|
-
|
|
9
|
-
let name = "TestExtensionPoint";
|
|
10
|
-
|
|
11
|
-
let commandSchema = S.union([
|
|
12
|
-
S.schema(s => ({
|
|
13
|
-
TAG: "RouteToAgg",
|
|
14
|
-
aggId: s.m(S.string)
|
|
15
|
-
})),
|
|
16
|
-
S.schema(s => ({
|
|
17
|
-
TAG: "TriggerDirective",
|
|
18
|
-
value: s.m(S.string)
|
|
19
|
-
}))
|
|
20
|
-
]);
|
|
21
|
-
|
|
22
|
-
let eventSchema = S.schema(s => ({
|
|
23
|
-
TAG: "Done",
|
|
24
|
-
result: s.m(S.string)
|
|
25
|
-
}));
|
|
26
|
-
|
|
27
|
-
let directiveSchema = S.literal("DirectiveA");
|
|
28
|
-
|
|
29
|
-
let moduleUrl = import.meta.url;
|
|
30
|
-
|
|
31
|
-
function commandAuthorization(param) {
|
|
32
|
-
return "AllowAuthenticated";
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
let TestEPSpec = {
|
|
36
|
-
name: name,
|
|
37
|
-
commandSchema: commandSchema,
|
|
38
|
-
eventSchema: eventSchema,
|
|
39
|
-
directiveSchema: directiveSchema,
|
|
40
|
-
moduleUrl: moduleUrl,
|
|
41
|
-
commandAuthorization: commandAuthorization
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
let capturedPublishedCmds = {
|
|
45
|
-
contents: []
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
let capturedCallCount = {
|
|
49
|
-
contents: 0
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
let delegateName = "TestTargetAgg";
|
|
53
|
-
|
|
54
|
-
function mapIncomingCommands(topicItems, _createSchedule, _deleteSchedule, _queryEngine) {
|
|
55
|
-
return topicItems.flatMap(topicItem => {
|
|
56
|
-
let match = topicItem.command.command;
|
|
57
|
-
if (match.TAG === "RouteToAgg") {
|
|
58
|
-
return [{
|
|
59
|
-
TAG: "AbstractPublishCommand",
|
|
60
|
-
_0: "TestTargetAgg",
|
|
61
|
-
_1: topicItem.reference,
|
|
62
|
-
_2: {
|
|
63
|
-
id: match.aggId,
|
|
64
|
-
meta: topicItem.command.meta,
|
|
65
|
-
commandJson: "Create"
|
|
66
|
-
}
|
|
67
|
-
}];
|
|
68
|
-
} else {
|
|
69
|
-
return [{
|
|
70
|
-
TAG: "AbstractHandleDirective",
|
|
71
|
-
_0: topicItem.reference,
|
|
72
|
-
_1: async () => {
|
|
73
|
-
capturedCallCount.contents = capturedCallCount.contents + 1 | 0;
|
|
74
|
-
}
|
|
75
|
-
}];
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
let TestMapping = {
|
|
81
|
-
ExtensionPoint: undefined,
|
|
82
|
-
delegateName: delegateName,
|
|
83
|
-
mapIncomingCommands: mapIncomingCommands,
|
|
84
|
-
mapOutgoingEvent: undefined
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
let moduleUrl$1 = import.meta.url;
|
|
88
|
-
|
|
89
|
-
let mappings = [{
|
|
90
|
-
delegateName: delegateName,
|
|
91
|
-
mapIncomingCommands: mapIncomingCommands,
|
|
92
|
-
mapOutgoingEvent: undefined
|
|
93
|
-
}];
|
|
94
|
-
|
|
95
|
-
let TestMappings = {
|
|
96
|
-
Spec: undefined,
|
|
97
|
-
name: "TestMappings",
|
|
98
|
-
moduleUrl: moduleUrl$1,
|
|
99
|
-
mappings: mappings
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
let publishToAggregates = Object.fromEntries([[
|
|
103
|
-
"TestTargetAgg",
|
|
104
|
-
async cmds => {
|
|
105
|
-
capturedPublishedCmds.contents = capturedPublishedCmds.contents.concat(cmds);
|
|
106
|
-
}
|
|
107
|
-
]]);
|
|
108
|
-
|
|
109
|
-
let commandTopicResources = [];
|
|
110
|
-
|
|
111
|
-
async function scheduler_createSchedule(_resources, _schedule) {
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
async function scheduler_deleteSchedule(_resources, _name) {
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
let scheduler = {
|
|
120
|
-
createSchedule: scheduler_createSchedule,
|
|
121
|
-
deleteSchedule: scheduler_deleteSchedule
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
async function queryEngine_scan(param, param$1, param$2) {
|
|
125
|
-
return [];
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
async function queryEngine_query(param, param$1, param$2, param$3, param$4, param$5, param$6) {
|
|
129
|
-
return [];
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
let queryEngine = {
|
|
133
|
-
scan: queryEngine_scan,
|
|
134
|
-
query: queryEngine_query
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
function resourceNaming_validateName(name) {
|
|
138
|
-
return name;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
function resourceNaming_urnName(name) {
|
|
142
|
-
return name;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
let resourceNaming = {
|
|
146
|
-
validateName: resourceNaming_validateName,
|
|
147
|
-
urnName: resourceNaming_urnName
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
let TestCallbackSpec = {
|
|
151
|
-
publishToAggregates: publishToAggregates,
|
|
152
|
-
commandTopicResources: commandTopicResources,
|
|
153
|
-
scheduler: scheduler,
|
|
154
|
-
queryEngine: queryEngine,
|
|
155
|
-
resourceNaming: resourceNaming
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
let TestHandler = ExtensionPoint_Callback$ReventlessCore.Make(TestCallbackSpec)({
|
|
159
|
-
name: name,
|
|
160
|
-
moduleUrl: moduleUrl,
|
|
161
|
-
commandSchema: commandSchema,
|
|
162
|
-
eventSchema: eventSchema,
|
|
163
|
-
directiveSchema: directiveSchema
|
|
164
|
-
})({
|
|
165
|
-
mappings: mappings
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
let testMeta = {
|
|
169
|
-
service: "TestExtensionPoint",
|
|
170
|
-
time: "2024-01-01T00:00:00Z",
|
|
171
|
-
ip: "127.0.0.1",
|
|
172
|
-
user: "test-user",
|
|
173
|
-
msgId: "ep-msg-1",
|
|
174
|
-
correlationId: "ep-corr-1"
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
function makeTopicItem(reference, command) {
|
|
178
|
-
return {
|
|
179
|
-
command: {
|
|
180
|
-
id: Id$Reventless.$$String.makeFromString(reference),
|
|
181
|
-
meta: testMeta,
|
|
182
|
-
command: command
|
|
183
|
-
},
|
|
184
|
-
reference: reference
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
function reset() {
|
|
189
|
-
capturedPublishedCmds.contents = [];
|
|
190
|
-
capturedCallCount.contents = 0;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
export {
|
|
194
|
-
TestEPSpec,
|
|
195
|
-
capturedPublishedCmds,
|
|
196
|
-
capturedCallCount,
|
|
197
|
-
TestMapping,
|
|
198
|
-
TestMappings,
|
|
199
|
-
TestCallbackSpec,
|
|
200
|
-
TestHandler,
|
|
201
|
-
testMeta,
|
|
202
|
-
makeTopicItem,
|
|
203
|
-
reset,
|
|
204
|
-
}
|
|
205
|
-
/* Not a pure module */
|
|
@@ -1,304 +0,0 @@
|
|
|
1
|
-
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
-
|
|
3
|
-
import * as S from "sury/src/S.res.mjs";
|
|
4
|
-
import * as Message$Reventless from "@reventlessdev/reventless-spec/src/types/Message.res.mjs";
|
|
5
|
-
import * as ExtensionPoint_Operations$ReventlessCore from "../../src/components/ExtensionPoint/ExtensionPoint_Operations.res.mjs";
|
|
6
|
-
|
|
7
|
-
S.enableJson();
|
|
8
|
-
|
|
9
|
-
let name = "OpsTestEP";
|
|
10
|
-
|
|
11
|
-
let commandSchema = S.schema(s => ({
|
|
12
|
-
TAG: "OpsEPCmd",
|
|
13
|
-
id: s.m(S.string)
|
|
14
|
-
}));
|
|
15
|
-
|
|
16
|
-
let eventSchema = S.schema(s => ({
|
|
17
|
-
TAG: "OpsEPEvent",
|
|
18
|
-
result: s.m(S.string)
|
|
19
|
-
}));
|
|
20
|
-
|
|
21
|
-
let directiveSchema = S.literal("OpsEPNoDirective");
|
|
22
|
-
|
|
23
|
-
let moduleUrl = import.meta.url;
|
|
24
|
-
|
|
25
|
-
function commandAuthorization(param) {
|
|
26
|
-
return "AllowAuthenticated";
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
let OpsEPSpec = {
|
|
30
|
-
name: name,
|
|
31
|
-
commandSchema: commandSchema,
|
|
32
|
-
eventSchema: eventSchema,
|
|
33
|
-
directiveSchema: directiveSchema,
|
|
34
|
-
moduleUrl: moduleUrl,
|
|
35
|
-
commandAuthorization: commandAuthorization
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
let capturedPublished = {
|
|
39
|
-
contents: []
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
let capturedCallCount = {
|
|
43
|
-
contents: 0
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
let outgoingMeta = {
|
|
47
|
-
service: "PublishAgg",
|
|
48
|
-
time: "2024-01-01T00:00:00Z",
|
|
49
|
-
ip: "127.0.0.1",
|
|
50
|
-
user: "tester",
|
|
51
|
-
msgId: "ops-msg-1",
|
|
52
|
-
correlationId: "ops-corr-1"
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
let delegateName = "PublishAgg";
|
|
56
|
-
|
|
57
|
-
function mapIncomingCommands(_topicItems, _createSchedule, _deleteSchedule, _queryEngine) {
|
|
58
|
-
return [];
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
let mapOutgoingEvent = (eventJson, _createSchedule, _deleteSchedule, _queryEngine) => [{
|
|
62
|
-
TAG: "AbstractPublishEvent",
|
|
63
|
-
_0: "ep-dest",
|
|
64
|
-
_1: outgoingMeta,
|
|
65
|
-
_2: eventJson
|
|
66
|
-
}];
|
|
67
|
-
|
|
68
|
-
let TestPublishMapping = {
|
|
69
|
-
ExtensionPoint: undefined,
|
|
70
|
-
delegateName: delegateName,
|
|
71
|
-
mapIncomingCommands: mapIncomingCommands,
|
|
72
|
-
mapOutgoingEvent: mapOutgoingEvent
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
let delegateName$1 = "CallAgg";
|
|
76
|
-
|
|
77
|
-
function mapIncomingCommands$1(_topicItems, _createSchedule, _deleteSchedule, _queryEngine) {
|
|
78
|
-
return [];
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
let mapOutgoingEvent$1 = (_eventJson, _createSchedule, _deleteSchedule, _queryEngine) => [{
|
|
82
|
-
TAG: "AbstractHandleDirective",
|
|
83
|
-
_0: async () => {
|
|
84
|
-
capturedCallCount.contents = capturedCallCount.contents + 1 | 0;
|
|
85
|
-
}
|
|
86
|
-
}];
|
|
87
|
-
|
|
88
|
-
let TestCallMapping = {
|
|
89
|
-
ExtensionPoint: undefined,
|
|
90
|
-
delegateName: delegateName$1,
|
|
91
|
-
mapIncomingCommands: mapIncomingCommands$1,
|
|
92
|
-
mapOutgoingEvent: mapOutgoingEvent$1
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
let delegateName$2 = "AsyncAgg";
|
|
96
|
-
|
|
97
|
-
function mapIncomingCommands$2(_topicItems, _createSchedule, _deleteSchedule, _queryEngine) {
|
|
98
|
-
return [];
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
let mapOutgoingEvent$2 = (eventJson, _createSchedule, _deleteSchedule, _queryEngine) => {
|
|
102
|
-
let asyncResult = Promise.resolve([
|
|
103
|
-
"ep-async-dest",
|
|
104
|
-
outgoingMeta,
|
|
105
|
-
eventJson
|
|
106
|
-
]);
|
|
107
|
-
return [{
|
|
108
|
-
TAG: "AbstractPublishEventAsync",
|
|
109
|
-
_0: asyncResult
|
|
110
|
-
}];
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
let TestAsyncMapping = {
|
|
114
|
-
ExtensionPoint: undefined,
|
|
115
|
-
delegateName: delegateName$2,
|
|
116
|
-
mapIncomingCommands: mapIncomingCommands$2,
|
|
117
|
-
mapOutgoingEvent: mapOutgoingEvent$2
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
let moduleUrl$1 = import.meta.url;
|
|
121
|
-
|
|
122
|
-
let mappings = [
|
|
123
|
-
{
|
|
124
|
-
delegateName: delegateName,
|
|
125
|
-
mapIncomingCommands: mapIncomingCommands,
|
|
126
|
-
mapOutgoingEvent: mapOutgoingEvent
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
delegateName: delegateName$1,
|
|
130
|
-
mapIncomingCommands: mapIncomingCommands$1,
|
|
131
|
-
mapOutgoingEvent: mapOutgoingEvent$1
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
delegateName: delegateName$2,
|
|
135
|
-
mapIncomingCommands: mapIncomingCommands$2,
|
|
136
|
-
mapOutgoingEvent: mapOutgoingEvent$2
|
|
137
|
-
}
|
|
138
|
-
];
|
|
139
|
-
|
|
140
|
-
let TestOpsMappings = {
|
|
141
|
-
Spec: undefined,
|
|
142
|
-
name: "TestOpsMappings",
|
|
143
|
-
moduleUrl: moduleUrl$1,
|
|
144
|
-
mappings: mappings
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
async function publishToEventTopic(id, meta, eventJson) {
|
|
148
|
-
capturedPublished.contents = capturedPublished.contents.concat([[
|
|
149
|
-
id,
|
|
150
|
-
meta,
|
|
151
|
-
eventJson
|
|
152
|
-
]]);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
let commandTopicResources = [];
|
|
156
|
-
|
|
157
|
-
async function scheduler_createSchedule(param, param$1) {
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
async function scheduler_deleteSchedule(param, param$1) {
|
|
162
|
-
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
let scheduler = {
|
|
166
|
-
createSchedule: scheduler_createSchedule,
|
|
167
|
-
deleteSchedule: scheduler_deleteSchedule
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
async function queryEngine_scan(param, param$1, param$2) {
|
|
171
|
-
return [];
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
async function queryEngine_query(param, param$1, param$2, param$3, param$4, param$5, param$6) {
|
|
175
|
-
return [];
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
let queryEngine = {
|
|
179
|
-
scan: queryEngine_scan,
|
|
180
|
-
query: queryEngine_query
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
function resourceNaming_validateName(n) {
|
|
184
|
-
return n;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
function resourceNaming_urnName(n) {
|
|
188
|
-
return n;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
let resourceNaming = {
|
|
192
|
-
validateName: resourceNaming_validateName,
|
|
193
|
-
urnName: resourceNaming_urnName
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
let TestOps = {
|
|
197
|
-
publishToEventTopic: publishToEventTopic,
|
|
198
|
-
commandTopicResources: commandTopicResources,
|
|
199
|
-
scheduler: scheduler,
|
|
200
|
-
queryEngine: queryEngine,
|
|
201
|
-
resourceNaming: resourceNaming
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
let EpOps = ExtensionPoint_Operations$ReventlessCore.Make({
|
|
205
|
-
name: name,
|
|
206
|
-
moduleUrl: moduleUrl,
|
|
207
|
-
commandSchema: commandSchema,
|
|
208
|
-
eventSchema: eventSchema,
|
|
209
|
-
directiveSchema: directiveSchema
|
|
210
|
-
})({
|
|
211
|
-
mappings: mappings
|
|
212
|
-
})(TestOps);
|
|
213
|
-
|
|
214
|
-
function makeEventJsonForAgg(aggregateName) {
|
|
215
|
-
let meta_ip = "127.0.0.1";
|
|
216
|
-
let meta_user = "tester";
|
|
217
|
-
let meta = {
|
|
218
|
-
service: aggregateName,
|
|
219
|
-
time: "2024-01-01T00:00:00Z",
|
|
220
|
-
ip: meta_ip,
|
|
221
|
-
user: meta_user,
|
|
222
|
-
msgId: "msg-test",
|
|
223
|
-
correlationId: "corr-test"
|
|
224
|
-
};
|
|
225
|
-
return Object.fromEntries([
|
|
226
|
-
[
|
|
227
|
-
"meta",
|
|
228
|
-
S.reverseConvertToJsonOrThrow(meta, Message$Reventless.metaSchema)
|
|
229
|
-
],
|
|
230
|
-
[
|
|
231
|
-
"event",
|
|
232
|
-
"SomeEvent"
|
|
233
|
-
]
|
|
234
|
-
]);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
function reset() {
|
|
238
|
-
capturedPublished.contents = [];
|
|
239
|
-
capturedCallCount.contents = 0;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
globalThis.describe("ExtensionPoint_Operations.Make:", () => {
|
|
243
|
-
globalThis.beforeEach(() => reset());
|
|
244
|
-
globalThis.describe("outgoingJsonEventsHandler — AbstractPublishEvent:", () => {
|
|
245
|
-
globalThis.test("known aggregate calls publishToEventTopic with correct destination id", async () => {
|
|
246
|
-
let eventJson = makeEventJsonForAgg("PublishAgg");
|
|
247
|
-
await EpOps.outgoingJsonEventsHandler(eventJson, undefined);
|
|
248
|
-
globalThis.expect(capturedPublished.contents.length).toBe(1);
|
|
249
|
-
let item = capturedPublished.contents[0];
|
|
250
|
-
globalThis.expect(item[0]).toBe("ep-dest");
|
|
251
|
-
});
|
|
252
|
-
globalThis.test("publishToEventTopic receives the original event JSON", async () => {
|
|
253
|
-
let eventJson = makeEventJsonForAgg("PublishAgg");
|
|
254
|
-
await EpOps.outgoingJsonEventsHandler(eventJson, undefined);
|
|
255
|
-
let item = capturedPublished.contents[0];
|
|
256
|
-
globalThis.expect(item[2]).toEqual(eventJson);
|
|
257
|
-
});
|
|
258
|
-
});
|
|
259
|
-
globalThis.describe("outgoingJsonEventsHandler — AbstractHandleDirective:", () => {
|
|
260
|
-
globalThis.test("known aggregate with AbstractHandleDirective invokes the handler", async () => {
|
|
261
|
-
let eventJson = makeEventJsonForAgg("CallAgg");
|
|
262
|
-
await EpOps.outgoingJsonEventsHandler(eventJson, undefined);
|
|
263
|
-
globalThis.expect(capturedCallCount.contents).toBe(1);
|
|
264
|
-
globalThis.expect(capturedPublished.contents.length).toBe(0);
|
|
265
|
-
});
|
|
266
|
-
});
|
|
267
|
-
globalThis.describe("outgoingJsonEventsHandler — AbstractPublishEventAsync:", () => {
|
|
268
|
-
globalThis.test("async mapping resolves and calls publishToEventTopic", async () => {
|
|
269
|
-
let eventJson = makeEventJsonForAgg("AsyncAgg");
|
|
270
|
-
await EpOps.outgoingJsonEventsHandler(eventJson, undefined);
|
|
271
|
-
globalThis.expect(capturedPublished.contents.length).toBe(1);
|
|
272
|
-
let item = capturedPublished.contents[0];
|
|
273
|
-
globalThis.expect(item[0]).toBe("ep-async-dest");
|
|
274
|
-
});
|
|
275
|
-
});
|
|
276
|
-
globalThis.describe("outgoingJsonEventsHandler — no matching mapping:", () => {
|
|
277
|
-
globalThis.test("event from unknown aggregate throws", async () => {
|
|
278
|
-
let eventJson = makeEventJsonForAgg("UnknownAgg");
|
|
279
|
-
let didThrow = false;
|
|
280
|
-
try {
|
|
281
|
-
await EpOps.outgoingJsonEventsHandler(eventJson, undefined);
|
|
282
|
-
} catch (exn) {
|
|
283
|
-
didThrow = true;
|
|
284
|
-
}
|
|
285
|
-
globalThis.expect(didThrow).toBe(true);
|
|
286
|
-
});
|
|
287
|
-
});
|
|
288
|
-
});
|
|
289
|
-
|
|
290
|
-
export {
|
|
291
|
-
OpsEPSpec,
|
|
292
|
-
capturedPublished,
|
|
293
|
-
capturedCallCount,
|
|
294
|
-
outgoingMeta,
|
|
295
|
-
TestPublishMapping,
|
|
296
|
-
TestCallMapping,
|
|
297
|
-
TestAsyncMapping,
|
|
298
|
-
TestOpsMappings,
|
|
299
|
-
TestOps,
|
|
300
|
-
EpOps,
|
|
301
|
-
makeEventJsonForAgg,
|
|
302
|
-
reset,
|
|
303
|
-
}
|
|
304
|
-
/* Not a pure module */
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
-
|
|
3
|
-
import * as FTP$ReventlessCore from "../../src/util/FTP.res.mjs";
|
|
4
|
-
|
|
5
|
-
globalThis.describe("FTP.SSH2 should", () => {
|
|
6
|
-
globalThis.test("parse valid url, only url given", () => {
|
|
7
|
-
let t = FTP$ReventlessCore.parseUrl("example.com");
|
|
8
|
-
globalThis.expect(t).toEqual([
|
|
9
|
-
"example.com",
|
|
10
|
-
undefined,
|
|
11
|
-
""
|
|
12
|
-
]);
|
|
13
|
-
});
|
|
14
|
-
globalThis.test("parse valid url, url and relative path given", () => {
|
|
15
|
-
let t = FTP$ReventlessCore.parseUrl("example.com/some/path");
|
|
16
|
-
globalThis.expect(t).toEqual([
|
|
17
|
-
"example.com",
|
|
18
|
-
undefined,
|
|
19
|
-
"some/path"
|
|
20
|
-
]);
|
|
21
|
-
});
|
|
22
|
-
globalThis.test("parse valid url, url and absolute path given", () => {
|
|
23
|
-
let t = FTP$ReventlessCore.parseUrl("example.com//some/path");
|
|
24
|
-
globalThis.expect(t).toEqual([
|
|
25
|
-
"example.com",
|
|
26
|
-
undefined,
|
|
27
|
-
"/some/path"
|
|
28
|
-
]);
|
|
29
|
-
});
|
|
30
|
-
globalThis.test("parse valid url, url and port given", () => {
|
|
31
|
-
let t = FTP$ReventlessCore.parseUrl("example.com:8080");
|
|
32
|
-
globalThis.expect(t).toEqual([
|
|
33
|
-
"example.com",
|
|
34
|
-
8080,
|
|
35
|
-
""
|
|
36
|
-
]);
|
|
37
|
-
});
|
|
38
|
-
globalThis.test("parse valid url, all parts given (relative path)", () => {
|
|
39
|
-
let t = FTP$ReventlessCore.parseUrl("reventless.example.com:8025/some/path");
|
|
40
|
-
globalThis.expect(t).toEqual([
|
|
41
|
-
"reventless.example.com",
|
|
42
|
-
8025,
|
|
43
|
-
"some/path"
|
|
44
|
-
]);
|
|
45
|
-
});
|
|
46
|
-
globalThis.test("parse valid url, all parts given (absolute path)", () => {
|
|
47
|
-
let t = FTP$ReventlessCore.parseUrl("reventless.example.com:8025//some/path");
|
|
48
|
-
globalThis.expect(t).toEqual([
|
|
49
|
-
"reventless.example.com",
|
|
50
|
-
8025,
|
|
51
|
-
"/some/path"
|
|
52
|
-
]);
|
|
53
|
-
});
|
|
54
|
-
globalThis.test("parse valid url, all parts given (relative path first)", () => {
|
|
55
|
-
let t = FTP$ReventlessCore.parseUrl("example.com/some/path:8080");
|
|
56
|
-
globalThis.expect(t).toEqual([
|
|
57
|
-
"example.com",
|
|
58
|
-
8080,
|
|
59
|
-
"some/path"
|
|
60
|
-
]);
|
|
61
|
-
});
|
|
62
|
-
globalThis.test("parse valid url, all parts given (absolute path first)", () => {
|
|
63
|
-
let t = FTP$ReventlessCore.parseUrl("example.com//some/path:8080");
|
|
64
|
-
globalThis.expect(t).toEqual([
|
|
65
|
-
"example.com",
|
|
66
|
-
8080,
|
|
67
|
-
"/some/path"
|
|
68
|
-
]);
|
|
69
|
-
});
|
|
70
|
-
globalThis.test("parse url with invalid port (relative path)", () => {
|
|
71
|
-
let t = FTP$ReventlessCore.parseUrl("example.com/some/path:invalidPort");
|
|
72
|
-
globalThis.expect(t).toEqual([
|
|
73
|
-
"example.com",
|
|
74
|
-
undefined,
|
|
75
|
-
"some/path"
|
|
76
|
-
]);
|
|
77
|
-
});
|
|
78
|
-
globalThis.test("parse url with invalid port (absolute path)", () => {
|
|
79
|
-
let t = FTP$ReventlessCore.parseUrl("example.com//some/path:invalidPort");
|
|
80
|
-
globalThis.expect(t).toEqual([
|
|
81
|
-
"example.com",
|
|
82
|
-
undefined,
|
|
83
|
-
"/some/path"
|
|
84
|
-
]);
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
/* Not a pure module */
|