@reventlessdev/reventless-local 3.0.0-alpha.161 → 3.0.0-alpha.162
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 +10 -10
- package/src/Platform.res.mjs +8 -0
- package/src/adapter/CommandTopic/LocalCommandTopicChannel.res +1 -1
- package/src/adapter/CommandTopic/LocalCommandTopicChannel.res.mjs +1 -1
- package/src/adapter/DomainGraphQL_Server.res +17 -0
- package/src/adapter/DomainGraphQL_Server.res.mjs +5 -0
- package/src/adapter/EventCollector/LocalEventCollectorChannel.res +1 -1
- package/src/adapter/EventCollector/LocalEventCollectorChannel.res.mjs +2 -2
- package/src/adapter/EventLog/EventLogStorage_InMemory.res +1 -1
- package/src/adapter/EventLog/EventLogStorage_InMemory.res.mjs +1 -1
- package/src/adapter/EventLog/EventLogStorage_Sqlite.res +1 -1
- package/src/adapter/EventLog/EventLogStorage_Sqlite.res.mjs +1 -1
- package/src/adapter/EventLog/LocalEventLogStorage.res +1 -1
- package/src/adapter/EventLog/LocalEventLogStorage.res.mjs +1 -1
- package/src/adapter/EventTopic/LocalEventTopicPublisher.res +1 -1
- package/src/adapter/EventTopic/LocalEventTopicPublisher.res.mjs +1 -1
- package/src/adapter/QueryDb/LocalQueryDbStorage.res +2 -2
- package/src/adapter/QueryDb/LocalQueryDbStorage.res.mjs +2 -2
- package/src/adapter/QueryDb/QueryDbStorage_InMemory.res +1 -1
- package/src/adapter/QueryDb/QueryDbStorage_InMemory.res.mjs +1 -1
- package/src/adapter/QueryDb/QueryDbStorage_Sqlite.res +1 -1
- package/src/adapter/QueryDb/QueryDbStorage_Sqlite.res.mjs +1 -1
- package/src/adapter/Runtime/LocalAggregateRuntime_Builder.res +9 -1
- package/src/adapter/Runtime/LocalAggregateRuntime_Builder.res.mjs +5 -3
- package/src/adapter/Runtime/LocalEventCollectorRuntime_Builder.res +5 -1
- package/src/adapter/Runtime/LocalEventCollectorRuntime_Builder.res.mjs +3 -1
- package/src/adapter/Runtime/LocalPluginRuntime_Builder.res.mjs +2 -0
- package/src/adapter/Runtime/LocalRuntimeEnvironment.res +10 -0
- package/src/adapter/Runtime/LocalRuntimeEnvironment.res.mjs +10 -0
- package/src/components/Aggregate_Builder.res.mjs +4 -0
- package/src/components/AutomationSlice_Builder.res.mjs +2 -0
- package/src/components/ExtensionPoint_Builder.res.mjs +4 -0
- package/src/components/OutboundTranslationSlice_Builder.res.mjs +2 -0
- package/src/components/Plugin_Builder.res.mjs +2 -0
- package/src/components/ReadModel_Builder.res.mjs +4 -0
- package/src/components/StateViewSlice_Builder.res.mjs +2 -0
- package/src/components/Task_Builder.res.mjs +4 -0
- package/tests/adapter/BackendParityTest.res +5 -5
- package/tests/adapter/BackendParityTest.res.mjs +5 -5
- package/tests/adapter/CommandTopicChannelTest.res +4 -4
- package/tests/adapter/CommandTopicChannelTest.res.mjs +4 -4
- package/tests/adapter/EventCollectorChannelTest.res +11 -11
- package/tests/adapter/EventCollectorChannelTest.res.mjs +11 -11
- package/tests/adapter/EventLogSnapshotParityTest.res +2 -2
- package/tests/adapter/EventLogSnapshotParityTest.res.mjs +2 -2
- package/tests/adapter/EventLogStorageSqliteTest.res +11 -11
- package/tests/adapter/EventLogStorageSqliteTest.res.mjs +11 -11
- package/tests/adapter/EventTopicPublisherTest.res +4 -4
- package/tests/adapter/EventTopicPublisherTest.res.mjs +4 -4
- package/tests/adapter/LocalAuthHttpTest.res +5 -1
- package/tests/adapter/LocalAuthHttpTest.res.mjs +5 -5
- package/tests/adapter/LocalDispatchContextTest.res +83 -0
- package/tests/adapter/LocalDispatchContextTest.res.mjs +73 -0
- package/tests/adapter/ProjectionCheckpointTest.res +5 -5
- package/tests/adapter/ProjectionCheckpointTest.res.mjs +5 -5
- package/tests/adapter/QueryDbGsiTtlTest.res +12 -12
- package/tests/adapter/QueryDbGsiTtlTest.res.mjs +12 -12
- package/tests/adapter/QueryDbListPushdownParityTest.res +1 -1
- package/tests/adapter/QueryDbListPushdownParityTest.res.mjs +1 -1
- package/tests/adapter/QueryDbListResolverTest.res.mjs +1 -1
- package/tests/adapter/QueryDbStorageSqliteTest.res +6 -6
- package/tests/adapter/QueryDbStorageSqliteTest.res.mjs +6 -6
- package/tests/adapter/QueryDbStorageTest.res +10 -10
- package/tests/adapter/QueryDbStorageTest.res.mjs +10 -10
- package/tests/adapter/QueryEngineTest.res +8 -8
- package/tests/adapter/QueryEngineTest.res.mjs +8 -8
- package/tests/components/aggregate/AggregateTest.res +3 -3
- package/tests/components/aggregate/AggregateTest.res.mjs +3 -3
- package/tests/components/commandtopic/CommandTopicFixtures.res.mjs +1 -1
- package/tests/components/commandtopic/CommandTopicStreamFixtures.res.mjs +1 -1
- package/tests/components/eventcollector/EventCollectorFixtures.res.mjs +3 -1
- package/tests/components/eventlog/EventLogFixtures.res.mjs +1 -1
- package/tests/components/eventtopic/EventTopicFixtures.res.mjs +1 -1
- package/tests/components/eventtopic/EventTopicStreamFixtures.res.mjs +1 -1
- package/tests/components/querydb/QueryDbFixtures.res.mjs +1 -1
- package/tests/components/querydb/QueryDbSubIdFixtures.res.mjs +1 -1
- package/tests/components/sideeffecthandler/SideEffectHandlerFixtures.res.mjs +4 -0
|
@@ -57,7 +57,7 @@ describe("Backend parity (Memory vs Sqlite)", () => {
|
|
|
57
57
|
let scenario = async () => {
|
|
58
58
|
module TestBus = LocalBus.Make()
|
|
59
59
|
module Storage = LocalEventLogStorage.Make(TestBus)
|
|
60
|
-
let s = Storage.make(~name="parity-events", ~opts)
|
|
60
|
+
let s = Storage.make(~name="parity-events", ~owner=None, ~opts)
|
|
61
61
|
let ops = await s.operations->TestRunner.resolve
|
|
62
62
|
|
|
63
63
|
let e1 = JSON.Encode.object(Dict.fromArray([("t", JSON.Encode.string("A"))]))
|
|
@@ -81,7 +81,7 @@ describe("Backend parity (Memory vs Sqlite)", () => {
|
|
|
81
81
|
let scenario = async () => {
|
|
82
82
|
module TestBus = LocalBus.Make()
|
|
83
83
|
module Storage = LocalQueryDbStorage.Make(TestBus)
|
|
84
|
-
let s = Storage.make(~name="parity-qdb", ~indexes=[], ~api=(), ~apiRole=(), ~opts)
|
|
84
|
+
let s = Storage.make(~name="parity-qdb", ~indexes=[], ~api=(), ~apiRole=(), ~owner=None, ~opts)
|
|
85
85
|
let ops = await s.operations->TestRunner.resolve
|
|
86
86
|
|
|
87
87
|
let _ = await ops.save(
|
|
@@ -108,7 +108,7 @@ describe("Backend parity (Memory vs Sqlite)", () => {
|
|
|
108
108
|
let scenario = async () => {
|
|
109
109
|
module TestBus = LocalBus.Make()
|
|
110
110
|
module Storage = LocalQueryDbStorage.Make(TestBus)
|
|
111
|
-
let s = Storage.make(~name="parity-count", ~indexes=[], ~api=(), ~apiRole=(), ~opts)
|
|
111
|
+
let s = Storage.make(~name="parity-count", ~indexes=[], ~api=(), ~apiRole=(), ~owner=None, ~opts)
|
|
112
112
|
let ops = await s.operations->TestRunner.resolve
|
|
113
113
|
|
|
114
114
|
// First increment creates the counter item and returns the new total.
|
|
@@ -143,7 +143,7 @@ describe("Backend parity (Memory vs Sqlite)", () => {
|
|
|
143
143
|
let scenario = async () => {
|
|
144
144
|
module TestBus = LocalBus.Make()
|
|
145
145
|
module Storage = LocalQueryDbStorage.Make(TestBus)
|
|
146
|
-
let s = Storage.make(~name="parity-ttl", ~indexes=[], ~api=(), ~apiRole=(), ~opts)
|
|
146
|
+
let s = Storage.make(~name="parity-ttl", ~indexes=[], ~api=(), ~apiRole=(), ~owner=None, ~opts)
|
|
147
147
|
let ops = await s.operations->TestRunner.resolve
|
|
148
148
|
|
|
149
149
|
let item = k => JSON.Encode.object(Dict.fromArray([("id", JSON.Encode.string(k))]))
|
|
@@ -172,7 +172,7 @@ describe("Backend parity (Memory vs Sqlite)", () => {
|
|
|
172
172
|
let scenario = async () => {
|
|
173
173
|
module TestBus = LocalBus.Make()
|
|
174
174
|
module Storage = LocalEventLogStorage.Make(TestBus)
|
|
175
|
-
let s = Storage.make(~name="parity-conflict", ~opts)
|
|
175
|
+
let s = Storage.make(~name="parity-conflict", ~owner=None, ~opts)
|
|
176
176
|
let ops = await s.operations->TestRunner.resolve
|
|
177
177
|
|
|
178
178
|
let e = JSON.Encode.object(Dict.fromArray([("t", JSON.Encode.string("C"))]))
|
|
@@ -59,7 +59,7 @@ globalThis.describe("Backend parity (Memory vs Sqlite)", () => {
|
|
|
59
59
|
let scenario = async () => {
|
|
60
60
|
let TestBus = LocalBus$ReventlessLocal.Make({});
|
|
61
61
|
let Storage = LocalEventLogStorage$ReventlessLocal.Make(TestBus);
|
|
62
|
-
let s = Storage.make("parity-events", opts);
|
|
62
|
+
let s = Storage.make("parity-events", undefined, opts);
|
|
63
63
|
let ops = await TestRunner$ReventlessLocal.resolve(s.operations);
|
|
64
64
|
let e1 = Object.fromEntries([[
|
|
65
65
|
"t",
|
|
@@ -84,7 +84,7 @@ globalThis.describe("Backend parity (Memory vs Sqlite)", () => {
|
|
|
84
84
|
let scenario = async () => {
|
|
85
85
|
let TestBus = LocalBus$ReventlessLocal.Make({});
|
|
86
86
|
let Storage = LocalQueryDbStorage$ReventlessLocal.Make(TestBus);
|
|
87
|
-
let s = Storage.make("parity-qdb", [], undefined, undefined, undefined, undefined, opts);
|
|
87
|
+
let s = Storage.make("parity-qdb", [], undefined, undefined, undefined, undefined, undefined, opts);
|
|
88
88
|
let ops = await TestRunner$ReventlessLocal.resolve(s.operations);
|
|
89
89
|
await ops.save("k", "val", "Any", undefined);
|
|
90
90
|
let items = await Effect.runPromise(Effect.catchAll(Stream.runCollect(ops.loadStream("k")), param => Effect.succeed([])));
|
|
@@ -98,7 +98,7 @@ globalThis.describe("Backend parity (Memory vs Sqlite)", () => {
|
|
|
98
98
|
let scenario = async () => {
|
|
99
99
|
let TestBus = LocalBus$ReventlessLocal.Make({});
|
|
100
100
|
let Storage = LocalQueryDbStorage$ReventlessLocal.Make(TestBus);
|
|
101
|
-
let s = Storage.make("parity-count", [], undefined, undefined, undefined, undefined, opts);
|
|
101
|
+
let s = Storage.make("parity-count", [], undefined, undefined, undefined, undefined, undefined, opts);
|
|
102
102
|
let ops = await TestRunner$ReventlessLocal.resolve(s.operations);
|
|
103
103
|
let r1 = await ops.count("prod-1", "orderCount", 3);
|
|
104
104
|
globalThis.expect(r1).toEqual({
|
|
@@ -122,7 +122,7 @@ globalThis.describe("Backend parity (Memory vs Sqlite)", () => {
|
|
|
122
122
|
let scenario = async () => {
|
|
123
123
|
let TestBus = LocalBus$ReventlessLocal.Make({});
|
|
124
124
|
let Storage = LocalQueryDbStorage$ReventlessLocal.Make(TestBus);
|
|
125
|
-
let s = Storage.make("parity-ttl", [], undefined, undefined, undefined, undefined, opts);
|
|
125
|
+
let s = Storage.make("parity-ttl", [], undefined, undefined, undefined, undefined, undefined, opts);
|
|
126
126
|
let ops = await TestRunner$ReventlessLocal.resolve(s.operations);
|
|
127
127
|
let item = k => Object.fromEntries([[
|
|
128
128
|
"id",
|
|
@@ -141,7 +141,7 @@ globalThis.describe("Backend parity (Memory vs Sqlite)", () => {
|
|
|
141
141
|
let scenario = async () => {
|
|
142
142
|
let TestBus = LocalBus$ReventlessLocal.Make({});
|
|
143
143
|
let Storage = LocalEventLogStorage$ReventlessLocal.Make(TestBus);
|
|
144
|
-
let s = Storage.make("parity-conflict", opts);
|
|
144
|
+
let s = Storage.make("parity-conflict", undefined, opts);
|
|
145
145
|
let ops = await TestRunner$ReventlessLocal.resolve(s.operations);
|
|
146
146
|
let e = Object.fromEntries([[
|
|
147
147
|
"t",
|
|
@@ -72,7 +72,7 @@ describe("LocalCommandTopicChannel", () => {
|
|
|
72
72
|
TestBus.registerCommandHandler("myCmd", async (json, _) => {
|
|
73
73
|
received := Some(json)
|
|
74
74
|
})
|
|
75
|
-
let ch = TestChannel.make(~name="myCmd")
|
|
75
|
+
let ch = TestChannel.make(~name="myCmd", ~owner=None)
|
|
76
76
|
let publishFn = await ch.publishJsons->TestRunner.resolve
|
|
77
77
|
await publishFn([
|
|
78
78
|
{
|
|
@@ -96,7 +96,7 @@ describe("LocalCommandTopicChannel", () => {
|
|
|
96
96
|
TestBus.registerCommandHandler("multiCmd", async (_, _) => {
|
|
97
97
|
count := count.contents + 1
|
|
98
98
|
})
|
|
99
|
-
let ch = TestChannel.make(~name="multiCmd")
|
|
99
|
+
let ch = TestChannel.make(~name="multiCmd", ~owner=None)
|
|
100
100
|
let publishFn = await ch.publishJsons->TestRunner.resolve
|
|
101
101
|
await publishFn([
|
|
102
102
|
{
|
|
@@ -131,7 +131,7 @@ describe("LocalCommandTopicChannel", () => {
|
|
|
131
131
|
},
|
|
132
132
|
resources: [],
|
|
133
133
|
}
|
|
134
|
-
let ch = TestChannel.make(~name="testCmd")
|
|
134
|
+
let ch = TestChannel.make(~name="testCmd", ~owner=None)
|
|
135
135
|
let _ = ch.connect(
|
|
136
136
|
~name="testCmd",
|
|
137
137
|
~channel=ch,
|
|
@@ -156,7 +156,7 @@ describe("LocalCommandTopicChannel", () => {
|
|
|
156
156
|
},
|
|
157
157
|
resources: [],
|
|
158
158
|
}
|
|
159
|
-
let ch = TestChannel.make(~name="noHandlerCmd")
|
|
159
|
+
let ch = TestChannel.make(~name="noHandlerCmd", ~owner=None)
|
|
160
160
|
let _ = ch.connect(
|
|
161
161
|
~name="noHandlerCmd",
|
|
162
162
|
~channel=ch,
|
|
@@ -79,7 +79,7 @@ globalThis.describe("LocalCommandTopicChannel", () => {
|
|
|
79
79
|
TestBus.registerCommandHandler("myCmd", async (json, param) => {
|
|
80
80
|
received.contents = json;
|
|
81
81
|
});
|
|
82
|
-
let ch = TestChannel.make("myCmd", undefined);
|
|
82
|
+
let ch = TestChannel.make("myCmd", undefined, undefined);
|
|
83
83
|
let publishFn = await TestRunner$ReventlessLocal.resolve(ch.publishJsons);
|
|
84
84
|
await publishFn([{
|
|
85
85
|
id: "item-1",
|
|
@@ -100,7 +100,7 @@ globalThis.describe("LocalCommandTopicChannel", () => {
|
|
|
100
100
|
TestBus.registerCommandHandler("multiCmd", async (param, param$1) => {
|
|
101
101
|
count.contents = count.contents + 1 | 0;
|
|
102
102
|
});
|
|
103
|
-
let ch = TestChannel.make("multiCmd", undefined);
|
|
103
|
+
let ch = TestChannel.make("multiCmd", undefined, undefined);
|
|
104
104
|
let publishFn = await TestRunner$ReventlessLocal.resolve(ch.publishJsons);
|
|
105
105
|
await publishFn([
|
|
106
106
|
{
|
|
@@ -137,7 +137,7 @@ globalThis.describe("LocalCommandTopicChannel", () => {
|
|
|
137
137
|
parts: runtime_parts,
|
|
138
138
|
resources: runtime_resources
|
|
139
139
|
};
|
|
140
|
-
let ch = TestChannel.make("testCmd", undefined);
|
|
140
|
+
let ch = TestChannel.make("testCmd", undefined, undefined);
|
|
141
141
|
ch.connect("testCmd", ch, runtime, [], {});
|
|
142
142
|
await TestBus.dispatchCommand("testCmd", "test-payload");
|
|
143
143
|
globalThis.expect(received.contents).toEqual("test-payload");
|
|
@@ -155,7 +155,7 @@ globalThis.describe("LocalCommandTopicChannel", () => {
|
|
|
155
155
|
parts: runtime_parts,
|
|
156
156
|
resources: runtime_resources
|
|
157
157
|
};
|
|
158
|
-
let ch = TestChannel.make("noHandlerCmd", undefined);
|
|
158
|
+
let ch = TestChannel.make("noHandlerCmd", undefined, undefined);
|
|
159
159
|
ch.connect("noHandlerCmd", ch, runtime, [], {});
|
|
160
160
|
TestBus.dispatchCommand("noHandlerCmd", null);
|
|
161
161
|
globalThis.expect(true).toBe(true);
|
|
@@ -39,13 +39,13 @@ describe("LocalEventCollectorChannel", () => {
|
|
|
39
39
|
module TestBus = LocalBus.Make()
|
|
40
40
|
module TestPublisher = LocalEventTopicPublisher.Make(TestBus)
|
|
41
41
|
module TestCollector = LocalEventCollectorChannel.Make(TestBus)
|
|
42
|
-
let pubA = TestPublisher.make(~name="topicA", ~storageResources=[], ~opts={})
|
|
43
|
-
let pubB = TestPublisher.make(~name="topicB", ~storageResources=[], ~opts={})
|
|
42
|
+
let pubA = TestPublisher.make(~name="topicA", ~storageResources=[], ~owner=None, ~opts={})
|
|
43
|
+
let pubB = TestPublisher.make(~name="topicB", ~storageResources=[], ~owner=None, ~opts={})
|
|
44
44
|
let eventTopics = Dict.fromArray([
|
|
45
45
|
("topicA", {ReventlessInfra.EventTopic.resources: pubA.resources}),
|
|
46
46
|
("topicB", {ReventlessInfra.EventTopic.resources: pubB.resources}),
|
|
47
47
|
])
|
|
48
|
-
let ch = TestCollector.make(~name="collector", ~eventTopics, ~opts={})
|
|
48
|
+
let ch = TestCollector.make(~name="collector", ~eventTopics, ~owner=None, ~opts={})
|
|
49
49
|
// Each publisher returns 1 resource, so 2 total
|
|
50
50
|
expect(ch.resources->Array.length)->toBe(2)
|
|
51
51
|
})
|
|
@@ -53,7 +53,7 @@ describe("LocalEventCollectorChannel", () => {
|
|
|
53
53
|
testPromise("empty eventTopics produces empty resources", async () => {
|
|
54
54
|
module TestBus = LocalBus.Make()
|
|
55
55
|
module TestCollector = LocalEventCollectorChannel.Make(TestBus)
|
|
56
|
-
let ch = TestCollector.make(~name="collector", ~eventTopics=Dict.make(), ~opts={})
|
|
56
|
+
let ch = TestCollector.make(~name="collector", ~eventTopics=Dict.make(), ~owner=None, ~opts={})
|
|
57
57
|
expect(ch.resources->Array.length)->toBe(0)
|
|
58
58
|
})
|
|
59
59
|
})
|
|
@@ -67,11 +67,11 @@ describe("LocalEventCollectorChannel", () => {
|
|
|
67
67
|
let runtime = makeRuntime(async (_, _ctx) => {
|
|
68
68
|
received := received.contents + 1
|
|
69
69
|
})
|
|
70
|
-
let pub = TestPublisher.make(~name="eventA", ~storageResources=[], ~opts={})
|
|
70
|
+
let pub = TestPublisher.make(~name="eventA", ~storageResources=[], ~owner=None, ~opts={})
|
|
71
71
|
let eventTopics = Dict.fromArray([
|
|
72
72
|
("eventA", {ReventlessInfra.EventTopic.resources: pub.resources}),
|
|
73
73
|
])
|
|
74
|
-
let ch = TestCollector.make(~name="collector", ~eventTopics, ~opts={})
|
|
74
|
+
let ch = TestCollector.make(~name="collector", ~eventTopics, ~owner=None, ~opts={})
|
|
75
75
|
let channelSpec: ReventlessCore.EventCollector_Adapter.channelSpec<JSON.t, unit, unit> = {
|
|
76
76
|
channel: ch,
|
|
77
77
|
eventTopics,
|
|
@@ -98,13 +98,13 @@ describe("LocalEventCollectorChannel", () => {
|
|
|
98
98
|
let runtime = makeRuntime(async (_, _) => {
|
|
99
99
|
received := received.contents + 1
|
|
100
100
|
})
|
|
101
|
-
let pub1 = TestPublisher.make(~name="topicX", ~storageResources=[], ~opts={})
|
|
102
|
-
let pub2 = TestPublisher.make(~name="topicY", ~storageResources=[], ~opts={})
|
|
101
|
+
let pub1 = TestPublisher.make(~name="topicX", ~storageResources=[], ~owner=None, ~opts={})
|
|
102
|
+
let pub2 = TestPublisher.make(~name="topicY", ~storageResources=[], ~owner=None, ~opts={})
|
|
103
103
|
let eventTopics = Dict.fromArray([
|
|
104
104
|
("topicX", {ReventlessInfra.EventTopic.resources: pub1.resources}),
|
|
105
105
|
("topicY", {ReventlessInfra.EventTopic.resources: pub2.resources}),
|
|
106
106
|
])
|
|
107
|
-
let ch = TestCollector.make(~name="collector", ~eventTopics, ~opts={})
|
|
107
|
+
let ch = TestCollector.make(~name="collector", ~eventTopics, ~owner=None, ~opts={})
|
|
108
108
|
let channelSpec: ReventlessCore.EventCollector_Adapter.channelSpec<JSON.t, unit, unit> = {
|
|
109
109
|
channel: ch,
|
|
110
110
|
eventTopics,
|
|
@@ -138,11 +138,11 @@ describe("LocalEventCollectorChannel", () => {
|
|
|
138
138
|
},
|
|
139
139
|
resources: [],
|
|
140
140
|
}
|
|
141
|
-
let pub = TestPublisher.make(~name="noHandlerTopic", ~storageResources=[], ~opts={})
|
|
141
|
+
let pub = TestPublisher.make(~name="noHandlerTopic", ~storageResources=[], ~owner=None, ~opts={})
|
|
142
142
|
let eventTopics = Dict.fromArray([
|
|
143
143
|
("noHandlerTopic", {ReventlessInfra.EventTopic.resources: pub.resources}),
|
|
144
144
|
])
|
|
145
|
-
let ch = TestCollector.make(~name="collector", ~eventTopics, ~opts={})
|
|
145
|
+
let ch = TestCollector.make(~name="collector", ~eventTopics, ~owner=None, ~opts={})
|
|
146
146
|
let channelSpec: ReventlessCore.EventCollector_Adapter.channelSpec<JSON.t, unit, unit> = {
|
|
147
147
|
channel: ch,
|
|
148
148
|
eventTopics,
|
|
@@ -36,8 +36,8 @@ globalThis.describe("LocalEventCollectorChannel", () => {
|
|
|
36
36
|
let TestBus = LocalBus$ReventlessLocal.Make({});
|
|
37
37
|
let TestPublisher = LocalEventTopicPublisher$ReventlessLocal.Make(TestBus);
|
|
38
38
|
let TestCollector = LocalEventCollectorChannel$ReventlessLocal.Make(TestBus);
|
|
39
|
-
let pubA = TestPublisher.make("topicA", [], {});
|
|
40
|
-
let pubB = TestPublisher.make("topicB", [], {});
|
|
39
|
+
let pubA = TestPublisher.make("topicA", [], undefined, {});
|
|
40
|
+
let pubB = TestPublisher.make("topicB", [], undefined, {});
|
|
41
41
|
let eventTopics = Object.fromEntries([
|
|
42
42
|
[
|
|
43
43
|
"topicA",
|
|
@@ -52,13 +52,13 @@ globalThis.describe("LocalEventCollectorChannel", () => {
|
|
|
52
52
|
}
|
|
53
53
|
]
|
|
54
54
|
]);
|
|
55
|
-
let ch = TestCollector.make("collector", eventTopics, {});
|
|
55
|
+
let ch = TestCollector.make("collector", eventTopics, undefined, {});
|
|
56
56
|
globalThis.expect(ch.resources.length).toBe(2);
|
|
57
57
|
});
|
|
58
58
|
globalThis.test("empty eventTopics produces empty resources", async () => {
|
|
59
59
|
let TestBus = LocalBus$ReventlessLocal.Make({});
|
|
60
60
|
let TestCollector = LocalEventCollectorChannel$ReventlessLocal.Make(TestBus);
|
|
61
|
-
let ch = TestCollector.make("collector", {}, {});
|
|
61
|
+
let ch = TestCollector.make("collector", {}, undefined, {});
|
|
62
62
|
globalThis.expect(ch.resources.length).toBe(0);
|
|
63
63
|
});
|
|
64
64
|
});
|
|
@@ -73,14 +73,14 @@ globalThis.describe("LocalEventCollectorChannel", () => {
|
|
|
73
73
|
let runtime = makeRuntime(async (param, _ctx) => {
|
|
74
74
|
received.contents = received.contents + 1 | 0;
|
|
75
75
|
});
|
|
76
|
-
let pub = TestPublisher.make("eventA", [], {});
|
|
76
|
+
let pub = TestPublisher.make("eventA", [], undefined, {});
|
|
77
77
|
let eventTopics = Object.fromEntries([[
|
|
78
78
|
"eventA",
|
|
79
79
|
{
|
|
80
80
|
resources: pub.resources
|
|
81
81
|
}
|
|
82
82
|
]]);
|
|
83
|
-
let ch = TestCollector.make("collector", eventTopics, {});
|
|
83
|
+
let ch = TestCollector.make("collector", eventTopics, undefined, {});
|
|
84
84
|
let channelSpec_resources = [];
|
|
85
85
|
let channelSpec = {
|
|
86
86
|
channel: ch,
|
|
@@ -103,8 +103,8 @@ globalThis.describe("LocalEventCollectorChannel", () => {
|
|
|
103
103
|
let runtime = makeRuntime(async (param, param$1) => {
|
|
104
104
|
received.contents = received.contents + 1 | 0;
|
|
105
105
|
});
|
|
106
|
-
let pub1 = TestPublisher.make("topicX", [], {});
|
|
107
|
-
let pub2 = TestPublisher.make("topicY", [], {});
|
|
106
|
+
let pub1 = TestPublisher.make("topicX", [], undefined, {});
|
|
107
|
+
let pub2 = TestPublisher.make("topicY", [], undefined, {});
|
|
108
108
|
let eventTopics = Object.fromEntries([
|
|
109
109
|
[
|
|
110
110
|
"topicX",
|
|
@@ -119,7 +119,7 @@ globalThis.describe("LocalEventCollectorChannel", () => {
|
|
|
119
119
|
}
|
|
120
120
|
]
|
|
121
121
|
]);
|
|
122
|
-
let ch = TestCollector.make("collector", eventTopics, {});
|
|
122
|
+
let ch = TestCollector.make("collector", eventTopics, undefined, {});
|
|
123
123
|
let channelSpec_resources = [];
|
|
124
124
|
let channelSpec = {
|
|
125
125
|
channel: ch,
|
|
@@ -147,14 +147,14 @@ globalThis.describe("LocalEventCollectorChannel", () => {
|
|
|
147
147
|
parts: runtime_parts,
|
|
148
148
|
resources: runtime_resources
|
|
149
149
|
};
|
|
150
|
-
let pub = TestPublisher.make("noHandlerTopic", [], {});
|
|
150
|
+
let pub = TestPublisher.make("noHandlerTopic", [], undefined, {});
|
|
151
151
|
let eventTopics = Object.fromEntries([[
|
|
152
152
|
"noHandlerTopic",
|
|
153
153
|
{
|
|
154
154
|
resources: pub.resources
|
|
155
155
|
}
|
|
156
156
|
]]);
|
|
157
|
-
let ch = TestCollector.make("collector", eventTopics, {});
|
|
157
|
+
let ch = TestCollector.make("collector", eventTopics, undefined, {});
|
|
158
158
|
let channelSpec_resources = [];
|
|
159
159
|
let channelSpec = {
|
|
160
160
|
channel: ch,
|
|
@@ -10,7 +10,7 @@ let _ = TestRunner.setup()
|
|
|
10
10
|
let opts: Pulumi.CustomResourceOptions.t = {}
|
|
11
11
|
|
|
12
12
|
let makeMemoryOps = () => {
|
|
13
|
-
let s = EventLogStorage_InMemory.make(~name="parity", ~opts)
|
|
13
|
+
let s = EventLogStorage_InMemory.make(~name="parity", ~owner=None, ~opts)
|
|
14
14
|
s.operations->TestRunner.resolve
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -20,7 +20,7 @@ let makeSqliteOps = () => {
|
|
|
20
20
|
let db = SqliteDriver.openDb(~path=":memory:")
|
|
21
21
|
}
|
|
22
22
|
module Storage = EventLogStorage_Sqlite.Make(TestBus, DbProvider)
|
|
23
|
-
let s = Storage.make(~name="parity", ~opts)
|
|
23
|
+
let s = Storage.make(~name="parity", ~owner=None, ~opts)
|
|
24
24
|
s.operations->TestRunner.resolve
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -13,7 +13,7 @@ TestRunner$ReventlessLocal.setup();
|
|
|
13
13
|
let opts = {};
|
|
14
14
|
|
|
15
15
|
function makeMemoryOps() {
|
|
16
|
-
let s = EventLogStorage_InMemory$ReventlessLocal.make("parity", opts);
|
|
16
|
+
let s = EventLogStorage_InMemory$ReventlessLocal.make("parity", undefined, opts);
|
|
17
17
|
return TestRunner$ReventlessLocal.resolve(s.operations);
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -24,7 +24,7 @@ function makeSqliteOps() {
|
|
|
24
24
|
db: db
|
|
25
25
|
};
|
|
26
26
|
let Storage = EventLogStorage_Sqlite$ReventlessLocal.Make(TestBus)(DbProvider);
|
|
27
|
-
let s = Storage.make("parity", opts);
|
|
27
|
+
let s = Storage.make("parity", undefined, opts);
|
|
28
28
|
return TestRunner$ReventlessLocal.resolve(s.operations);
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -16,7 +16,7 @@ describe("EventLogStorage_Sqlite", () => {
|
|
|
16
16
|
}
|
|
17
17
|
module Storage = EventLogStorage_Sqlite.Make(TestBus, DbProvider)
|
|
18
18
|
|
|
19
|
-
let s = Storage.make(~name="agg", ~opts)
|
|
19
|
+
let s = Storage.make(~name="agg", ~owner=None, ~opts)
|
|
20
20
|
let ops = await s.operations->TestRunner.resolve
|
|
21
21
|
|
|
22
22
|
let event1 = JSON.Encode.object(
|
|
@@ -45,7 +45,7 @@ describe("EventLogStorage_Sqlite", () => {
|
|
|
45
45
|
}
|
|
46
46
|
module Storage = EventLogStorage_Sqlite.Make(TestBus, DbProvider)
|
|
47
47
|
|
|
48
|
-
let s = Storage.make(~name="agg", ~opts)
|
|
48
|
+
let s = Storage.make(~name="agg", ~owner=None, ~opts)
|
|
49
49
|
let ops = await s.operations->TestRunner.resolve
|
|
50
50
|
|
|
51
51
|
let e = JSON.Encode.object(Dict.fromArray([("t", JSON.Encode.string("X"))]))
|
|
@@ -67,7 +67,7 @@ describe("EventLogStorage_Sqlite", () => {
|
|
|
67
67
|
let db = makeFreshDb()
|
|
68
68
|
}
|
|
69
69
|
module Storage = EventLogStorage_Sqlite.Make(TestBus, DbProvider)
|
|
70
|
-
let s = Storage.make(~name="agg", ~opts)
|
|
70
|
+
let s = Storage.make(~name="agg", ~owner=None, ~opts)
|
|
71
71
|
let ops = await s.operations->TestRunner.resolve
|
|
72
72
|
|
|
73
73
|
let ev = i => JSON.Encode.object(Dict.fromArray([("i", JSON.Encode.int(i))]))
|
|
@@ -92,7 +92,7 @@ describe("EventLogStorage_Sqlite", () => {
|
|
|
92
92
|
let db = makeFreshDb()
|
|
93
93
|
}
|
|
94
94
|
module Storage = EventLogStorage_Sqlite.Make(TestBus, DbProvider)
|
|
95
|
-
let s = Storage.make(~name="agg", ~opts)
|
|
95
|
+
let s = Storage.make(~name="agg", ~owner=None, ~opts)
|
|
96
96
|
let ops = await s.operations->TestRunner.resolve
|
|
97
97
|
|
|
98
98
|
let ev = i => JSON.Encode.object(Dict.fromArray([("i", JSON.Encode.int(i))]))
|
|
@@ -114,7 +114,7 @@ describe("EventLogStorage_Sqlite", () => {
|
|
|
114
114
|
}
|
|
115
115
|
module Storage = EventLogStorage_Sqlite.Make(TestBus, DbProvider)
|
|
116
116
|
|
|
117
|
-
let s = Storage.make(~name="agg", ~opts)
|
|
117
|
+
let s = Storage.make(~name="agg", ~owner=None, ~opts)
|
|
118
118
|
let ops = await s.operations->TestRunner.resolve
|
|
119
119
|
|
|
120
120
|
let replayed = await ops.replay("not-there")
|
|
@@ -127,7 +127,7 @@ describe("EventLogStorage_Sqlite", () => {
|
|
|
127
127
|
let db = makeFreshDb()
|
|
128
128
|
}
|
|
129
129
|
module Storage = EventLogStorage_Sqlite.Make(TestBus, DbProvider)
|
|
130
|
-
let s = Storage.make(~name="agg", ~opts)
|
|
130
|
+
let s = Storage.make(~name="agg", ~owner=None, ~opts)
|
|
131
131
|
let ops = await s.operations->TestRunner.resolve
|
|
132
132
|
|
|
133
133
|
let ev = i => JSON.Encode.object(Dict.fromArray([("i", JSON.Encode.int(i))]))
|
|
@@ -145,7 +145,7 @@ describe("EventLogStorage_Sqlite", () => {
|
|
|
145
145
|
let db = makeFreshDb()
|
|
146
146
|
}
|
|
147
147
|
module Storage = EventLogStorage_Sqlite.Make(TestBus, DbProvider)
|
|
148
|
-
let s = Storage.make(~name="agg", ~opts)
|
|
148
|
+
let s = Storage.make(~name="agg", ~owner=None, ~opts)
|
|
149
149
|
let ops = await s.operations->TestRunner.resolve
|
|
150
150
|
|
|
151
151
|
let none = await ops.latestSnapshot("id-snap")
|
|
@@ -182,7 +182,7 @@ describe("EventLogStorage_Sqlite", () => {
|
|
|
182
182
|
let db = SqliteDriver.openDb(~path)
|
|
183
183
|
}
|
|
184
184
|
module Storage = EventLogStorage_Sqlite.Make(TestBus, DbProvider)
|
|
185
|
-
let s = Storage.make(~name="persist", ~opts)
|
|
185
|
+
let s = Storage.make(~name="persist", ~owner=None, ~opts)
|
|
186
186
|
let ops = await s.operations->TestRunner.resolve
|
|
187
187
|
let _ = await ops.writeSnapshot(
|
|
188
188
|
"id-sp",
|
|
@@ -196,7 +196,7 @@ describe("EventLogStorage_Sqlite", () => {
|
|
|
196
196
|
let db = SqliteDriver.openDb(~path)
|
|
197
197
|
}
|
|
198
198
|
module Storage2 = EventLogStorage_Sqlite.Make(TestBus2, DbProvider2)
|
|
199
|
-
let s2 = Storage2.make(~name="persist", ~opts)
|
|
199
|
+
let s2 = Storage2.make(~name="persist", ~owner=None, ~opts)
|
|
200
200
|
let ops2 = await s2.operations->TestRunner.resolve
|
|
201
201
|
let r = await ops2.latestSnapshot("id-sp")
|
|
202
202
|
expect(r)->toEqual(Ok(Some({ReventlessCore.EventLog.seqNr: 3, state, schemaHash: "h"})))
|
|
@@ -213,7 +213,7 @@ describe("EventLogStorage_Sqlite", () => {
|
|
|
213
213
|
let db = SqliteDriver.openDb(~path)
|
|
214
214
|
}
|
|
215
215
|
module Storage = EventLogStorage_Sqlite.Make(TestBus, DbProvider)
|
|
216
|
-
let s = Storage.make(~name="persist", ~opts)
|
|
216
|
+
let s = Storage.make(~name="persist", ~owner=None, ~opts)
|
|
217
217
|
let ops = await s.operations->TestRunner.resolve
|
|
218
218
|
let ev = JSON.Encode.object(Dict.fromArray([("v", JSON.Encode.int(42))]))
|
|
219
219
|
let _ = await ops.append(0, "id-p", [ev])
|
|
@@ -226,7 +226,7 @@ describe("EventLogStorage_Sqlite", () => {
|
|
|
226
226
|
let db = SqliteDriver.openDb(~path)
|
|
227
227
|
}
|
|
228
228
|
module Storage2 = EventLogStorage_Sqlite.Make(TestBus2, DbProvider2)
|
|
229
|
-
let s2 = Storage2.make(~name="persist", ~opts)
|
|
229
|
+
let s2 = Storage2.make(~name="persist", ~owner=None, ~opts)
|
|
230
230
|
let ops2 = await s2.operations->TestRunner.resolve
|
|
231
231
|
let replayed = await ops2.replay("id-p")
|
|
232
232
|
expect(replayed->Array.length)->toBe(1)
|
|
@@ -24,7 +24,7 @@ globalThis.describe("EventLogStorage_Sqlite", () => {
|
|
|
24
24
|
db: db
|
|
25
25
|
};
|
|
26
26
|
let Storage = EventLogStorage_Sqlite$ReventlessLocal.Make(TestBus)(DbProvider);
|
|
27
|
-
let s = Storage.make("agg", opts);
|
|
27
|
+
let s = Storage.make("agg", undefined, opts);
|
|
28
28
|
let ops = await TestRunner$ReventlessLocal.resolve(s.operations);
|
|
29
29
|
let event1 = Object.fromEntries([[
|
|
30
30
|
"tag",
|
|
@@ -56,7 +56,7 @@ globalThis.describe("EventLogStorage_Sqlite", () => {
|
|
|
56
56
|
db: db
|
|
57
57
|
};
|
|
58
58
|
let Storage = EventLogStorage_Sqlite$ReventlessLocal.Make(TestBus)(DbProvider);
|
|
59
|
-
let s = Storage.make("agg", opts);
|
|
59
|
+
let s = Storage.make("agg", undefined, opts);
|
|
60
60
|
let ops = await TestRunner$ReventlessLocal.resolve(s.operations);
|
|
61
61
|
let e = Object.fromEntries([[
|
|
62
62
|
"t",
|
|
@@ -82,7 +82,7 @@ globalThis.describe("EventLogStorage_Sqlite", () => {
|
|
|
82
82
|
db: db
|
|
83
83
|
};
|
|
84
84
|
let Storage = EventLogStorage_Sqlite$ReventlessLocal.Make(TestBus)(DbProvider);
|
|
85
|
-
let s = Storage.make("agg", opts);
|
|
85
|
+
let s = Storage.make("agg", undefined, opts);
|
|
86
86
|
let ops = await TestRunner$ReventlessLocal.resolve(s.operations);
|
|
87
87
|
let ev = i => Object.fromEntries([[
|
|
88
88
|
"i",
|
|
@@ -123,7 +123,7 @@ globalThis.describe("EventLogStorage_Sqlite", () => {
|
|
|
123
123
|
db: db
|
|
124
124
|
};
|
|
125
125
|
let Storage = EventLogStorage_Sqlite$ReventlessLocal.Make(TestBus)(DbProvider);
|
|
126
|
-
let s = Storage.make("agg", opts);
|
|
126
|
+
let s = Storage.make("agg", undefined, opts);
|
|
127
127
|
let ops = await TestRunner$ReventlessLocal.resolve(s.operations);
|
|
128
128
|
let ev = i => Object.fromEntries([[
|
|
129
129
|
"i",
|
|
@@ -147,7 +147,7 @@ globalThis.describe("EventLogStorage_Sqlite", () => {
|
|
|
147
147
|
db: db
|
|
148
148
|
};
|
|
149
149
|
let Storage = EventLogStorage_Sqlite$ReventlessLocal.Make(TestBus)(DbProvider);
|
|
150
|
-
let s = Storage.make("agg", opts);
|
|
150
|
+
let s = Storage.make("agg", undefined, opts);
|
|
151
151
|
let ops = await TestRunner$ReventlessLocal.resolve(s.operations);
|
|
152
152
|
let replayed = await ops.replay("not-there");
|
|
153
153
|
globalThis.expect(replayed.length).toBe(0);
|
|
@@ -159,7 +159,7 @@ globalThis.describe("EventLogStorage_Sqlite", () => {
|
|
|
159
159
|
db: db
|
|
160
160
|
};
|
|
161
161
|
let Storage = EventLogStorage_Sqlite$ReventlessLocal.Make(TestBus)(DbProvider);
|
|
162
|
-
let s = Storage.make("agg", opts);
|
|
162
|
+
let s = Storage.make("agg", undefined, opts);
|
|
163
163
|
let ops = await TestRunner$ReventlessLocal.resolve(s.operations);
|
|
164
164
|
let ev = i => Object.fromEntries([[
|
|
165
165
|
"i",
|
|
@@ -186,7 +186,7 @@ globalThis.describe("EventLogStorage_Sqlite", () => {
|
|
|
186
186
|
db: db
|
|
187
187
|
};
|
|
188
188
|
let Storage = EventLogStorage_Sqlite$ReventlessLocal.Make(TestBus)(DbProvider);
|
|
189
|
-
let s = Storage.make("agg", opts);
|
|
189
|
+
let s = Storage.make("agg", undefined, opts);
|
|
190
190
|
let ops = await TestRunner$ReventlessLocal.resolve(s.operations);
|
|
191
191
|
let none = await ops.latestSnapshot("id-snap");
|
|
192
192
|
globalThis.expect(none).toEqual({
|
|
@@ -246,7 +246,7 @@ globalThis.describe("EventLogStorage_Sqlite", () => {
|
|
|
246
246
|
db: db
|
|
247
247
|
};
|
|
248
248
|
let Storage = EventLogStorage_Sqlite$ReventlessLocal.Make(TestBus)(DbProvider);
|
|
249
|
-
let s = Storage.make("persist", opts);
|
|
249
|
+
let s = Storage.make("persist", undefined, opts);
|
|
250
250
|
let ops = await TestRunner$ReventlessLocal.resolve(s.operations);
|
|
251
251
|
await ops.writeSnapshot("id-sp", {
|
|
252
252
|
seqNr: 3,
|
|
@@ -260,7 +260,7 @@ globalThis.describe("EventLogStorage_Sqlite", () => {
|
|
|
260
260
|
db: db$1
|
|
261
261
|
};
|
|
262
262
|
let Storage2 = EventLogStorage_Sqlite$ReventlessLocal.Make(TestBus2)(DbProvider2);
|
|
263
|
-
let s2 = Storage2.make("persist", opts);
|
|
263
|
+
let s2 = Storage2.make("persist", undefined, opts);
|
|
264
264
|
let ops2 = await TestRunner$ReventlessLocal.resolve(s2.operations);
|
|
265
265
|
let r = await ops2.latestSnapshot("id-sp");
|
|
266
266
|
globalThis.expect(r).toEqual({
|
|
@@ -281,7 +281,7 @@ globalThis.describe("EventLogStorage_Sqlite", () => {
|
|
|
281
281
|
db: db
|
|
282
282
|
};
|
|
283
283
|
let Storage = EventLogStorage_Sqlite$ReventlessLocal.Make(TestBus)(DbProvider);
|
|
284
|
-
let s = Storage.make("persist", opts);
|
|
284
|
+
let s = Storage.make("persist", undefined, opts);
|
|
285
285
|
let ops = await TestRunner$ReventlessLocal.resolve(s.operations);
|
|
286
286
|
let ev = Object.fromEntries([[
|
|
287
287
|
"v",
|
|
@@ -295,7 +295,7 @@ globalThis.describe("EventLogStorage_Sqlite", () => {
|
|
|
295
295
|
db: db$1
|
|
296
296
|
};
|
|
297
297
|
let Storage2 = EventLogStorage_Sqlite$ReventlessLocal.Make(TestBus2)(DbProvider2);
|
|
298
|
-
let s2 = Storage2.make("persist", opts);
|
|
298
|
+
let s2 = Storage2.make("persist", undefined, opts);
|
|
299
299
|
let ops2 = await TestRunner$ReventlessLocal.resolve(s2.operations);
|
|
300
300
|
let replayed = await ops2.replay("id-p");
|
|
301
301
|
globalThis.expect(replayed.length).toBe(1);
|
|
@@ -20,7 +20,7 @@ describe("LocalEventTopicPublisher", () => {
|
|
|
20
20
|
testPromise("returns one resource whose name resolves to the topic name", async () => {
|
|
21
21
|
module TestBus = LocalBus.Make()
|
|
22
22
|
module TestPublisher = LocalEventTopicPublisher.Make(TestBus)
|
|
23
|
-
let pub = TestPublisher.make(~name="MyTopic", ~storageResources=[], ~opts={})
|
|
23
|
+
let pub = TestPublisher.make(~name="MyTopic", ~storageResources=[], ~owner=None, ~opts={})
|
|
24
24
|
expect(pub.resources->Array.length)->toBe(1)
|
|
25
25
|
let resource = pub.resources->Array.getUnsafe(0)
|
|
26
26
|
let name = await resource.name->TestRunner.resolve
|
|
@@ -36,7 +36,7 @@ describe("LocalEventTopicPublisher", () => {
|
|
|
36
36
|
TestBus.subscribeToEvents("TestTopic", async (_, _, json) => {
|
|
37
37
|
received := Some(json)
|
|
38
38
|
})
|
|
39
|
-
let pub = TestPublisher.make(~name="TestTopic", ~storageResources=[], ~opts={})
|
|
39
|
+
let pub = TestPublisher.make(~name="TestTopic", ~storageResources=[], ~owner=None, ~opts={})
|
|
40
40
|
let publishFn = await pub.publishJson->TestRunner.resolve
|
|
41
41
|
await publishFn("svc", testMeta, JSON.Encode.string("hello"))
|
|
42
42
|
expect(received.contents)->toEqual(Some(JSON.Encode.string("hello")))
|
|
@@ -53,7 +53,7 @@ describe("LocalEventTopicPublisher", () => {
|
|
|
53
53
|
TestBus.subscribeToEvents("topic-b", async (_, _, _) => {
|
|
54
54
|
countB := countB.contents + 1
|
|
55
55
|
})
|
|
56
|
-
let pub = TestPublisher.make(~name="topic-a", ~storageResources=[], ~opts={})
|
|
56
|
+
let pub = TestPublisher.make(~name="topic-a", ~storageResources=[], ~owner=None, ~opts={})
|
|
57
57
|
let publishFn = await pub.publishJson->TestRunner.resolve
|
|
58
58
|
await publishFn("svc", testMeta, JSON.Null)
|
|
59
59
|
expect(countA.contents)->toBe(1)
|
|
@@ -67,7 +67,7 @@ describe("LocalEventTopicPublisher", () => {
|
|
|
67
67
|
TestBus.subscribeToEvents("svcTopic", async (service, _, _) => {
|
|
68
68
|
receivedService := service
|
|
69
69
|
})
|
|
70
|
-
let pub = TestPublisher.make(~name="svcTopic", ~storageResources=[], ~opts={})
|
|
70
|
+
let pub = TestPublisher.make(~name="svcTopic", ~storageResources=[], ~owner=None, ~opts={})
|
|
71
71
|
let publishFn = await pub.publishJson->TestRunner.resolve
|
|
72
72
|
await publishFn("MyService", testMeta, JSON.Null)
|
|
73
73
|
expect(receivedService.contents)->toBe("MyService")
|
|
@@ -20,7 +20,7 @@ globalThis.describe("LocalEventTopicPublisher", () => {
|
|
|
20
20
|
globalThis.test("returns one resource whose name resolves to the topic name", async () => {
|
|
21
21
|
let TestBus = LocalBus$ReventlessLocal.Make({});
|
|
22
22
|
let TestPublisher = LocalEventTopicPublisher$ReventlessLocal.Make(TestBus);
|
|
23
|
-
let pub = TestPublisher.make("MyTopic", [], {});
|
|
23
|
+
let pub = TestPublisher.make("MyTopic", [], undefined, {});
|
|
24
24
|
globalThis.expect(pub.resources.length).toBe(1);
|
|
25
25
|
let resource = pub.resources[0];
|
|
26
26
|
let name = await TestRunner$ReventlessLocal.resolve(resource.name);
|
|
@@ -37,7 +37,7 @@ globalThis.describe("LocalEventTopicPublisher", () => {
|
|
|
37
37
|
TestBus.subscribeToEvents("TestTopic", async (param, param$1, json) => {
|
|
38
38
|
received.contents = json;
|
|
39
39
|
});
|
|
40
|
-
let pub = TestPublisher.make("TestTopic", [], {});
|
|
40
|
+
let pub = TestPublisher.make("TestTopic", [], undefined, {});
|
|
41
41
|
let publishFn = await TestRunner$ReventlessLocal.resolve(pub.publishJson);
|
|
42
42
|
await publishFn("svc", testMeta, "hello");
|
|
43
43
|
globalThis.expect(received.contents).toEqual("hello");
|
|
@@ -57,7 +57,7 @@ globalThis.describe("LocalEventTopicPublisher", () => {
|
|
|
57
57
|
TestBus.subscribeToEvents("topic-b", async (param, param$1, param$2) => {
|
|
58
58
|
countB.contents = countB.contents + 1 | 0;
|
|
59
59
|
});
|
|
60
|
-
let pub = TestPublisher.make("topic-a", [], {});
|
|
60
|
+
let pub = TestPublisher.make("topic-a", [], undefined, {});
|
|
61
61
|
let publishFn = await TestRunner$ReventlessLocal.resolve(pub.publishJson);
|
|
62
62
|
await publishFn("svc", testMeta, null);
|
|
63
63
|
globalThis.expect(countA.contents).toBe(1);
|
|
@@ -72,7 +72,7 @@ globalThis.describe("LocalEventTopicPublisher", () => {
|
|
|
72
72
|
TestBus.subscribeToEvents("svcTopic", async (service, param, param$1) => {
|
|
73
73
|
receivedService.contents = service;
|
|
74
74
|
});
|
|
75
|
-
let pub = TestPublisher.make("svcTopic", [], {});
|
|
75
|
+
let pub = TestPublisher.make("svcTopic", [], undefined, {});
|
|
76
76
|
let publishFn = await TestRunner$ReventlessLocal.resolve(pub.publishJson);
|
|
77
77
|
await publishFn("MyService", testMeta, null);
|
|
78
78
|
globalThis.expect(receivedService.contents).toBe("MyService");
|
|
@@ -8,7 +8,11 @@ open JestGlobals
|
|
|
8
8
|
|
|
9
9
|
let _ = TestRunner.setup()
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
// High port in the dynamic/ephemeral range — deliberately clear of well-known
|
|
12
|
+
// dev-server defaults (Astro 4321, Vite 5173, 3000/4000/8080) so a running dev
|
|
13
|
+
// server doesn't shadow this test's server via EADDRINUSE (the listen success
|
|
14
|
+
// callback never fires on collision, and requests silently hit the other server).
|
|
15
|
+
let port = 49321
|
|
12
16
|
|
|
13
17
|
// ── Minimal node:http POST helper ──────────────────────────────────────────
|
|
14
18
|
// Jest 27's VM context strips Node's global `fetch` (and undici needs more
|