@reventlessdev/reventless-local 3.0.0-alpha.160 → 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.
Files changed (78) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/package.json +10 -10
  3. package/src/Platform.res.mjs +8 -0
  4. package/src/adapter/CommandTopic/LocalCommandTopicChannel.res +1 -1
  5. package/src/adapter/CommandTopic/LocalCommandTopicChannel.res.mjs +1 -1
  6. package/src/adapter/DomainGraphQL_Server.res +17 -0
  7. package/src/adapter/DomainGraphQL_Server.res.mjs +5 -0
  8. package/src/adapter/EventCollector/LocalEventCollectorChannel.res +1 -1
  9. package/src/adapter/EventCollector/LocalEventCollectorChannel.res.mjs +2 -2
  10. package/src/adapter/EventLog/EventLogStorage_InMemory.res +1 -1
  11. package/src/adapter/EventLog/EventLogStorage_InMemory.res.mjs +1 -1
  12. package/src/adapter/EventLog/EventLogStorage_Sqlite.res +1 -1
  13. package/src/adapter/EventLog/EventLogStorage_Sqlite.res.mjs +1 -1
  14. package/src/adapter/EventLog/LocalEventLogStorage.res +1 -1
  15. package/src/adapter/EventLog/LocalEventLogStorage.res.mjs +1 -1
  16. package/src/adapter/EventTopic/LocalEventTopicPublisher.res +1 -1
  17. package/src/adapter/EventTopic/LocalEventTopicPublisher.res.mjs +1 -1
  18. package/src/adapter/QueryDb/LocalQueryDbStorage.res +2 -2
  19. package/src/adapter/QueryDb/LocalQueryDbStorage.res.mjs +2 -2
  20. package/src/adapter/QueryDb/QueryDbStorage_InMemory.res +1 -1
  21. package/src/adapter/QueryDb/QueryDbStorage_InMemory.res.mjs +1 -1
  22. package/src/adapter/QueryDb/QueryDbStorage_Sqlite.res +1 -1
  23. package/src/adapter/QueryDb/QueryDbStorage_Sqlite.res.mjs +1 -1
  24. package/src/adapter/Runtime/LocalAggregateRuntime_Builder.res +9 -1
  25. package/src/adapter/Runtime/LocalAggregateRuntime_Builder.res.mjs +5 -3
  26. package/src/adapter/Runtime/LocalEventCollectorRuntime_Builder.res +5 -1
  27. package/src/adapter/Runtime/LocalEventCollectorRuntime_Builder.res.mjs +3 -1
  28. package/src/adapter/Runtime/LocalPluginRuntime_Builder.res.mjs +2 -0
  29. package/src/adapter/Runtime/LocalRuntimeEnvironment.res +10 -0
  30. package/src/adapter/Runtime/LocalRuntimeEnvironment.res.mjs +10 -0
  31. package/src/components/Aggregate_Builder.res.mjs +4 -0
  32. package/src/components/AutomationSlice_Builder.res.mjs +2 -0
  33. package/src/components/ExtensionPoint_Builder.res.mjs +4 -0
  34. package/src/components/OutboundTranslationSlice_Builder.res.mjs +2 -0
  35. package/src/components/Plugin_Builder.res.mjs +2 -0
  36. package/src/components/ReadModel_Builder.res.mjs +4 -0
  37. package/src/components/StateViewSlice_Builder.res.mjs +2 -0
  38. package/src/components/Task_Builder.res.mjs +4 -0
  39. package/tests/adapter/BackendParityTest.res +5 -5
  40. package/tests/adapter/BackendParityTest.res.mjs +5 -5
  41. package/tests/adapter/CommandTopicChannelTest.res +4 -4
  42. package/tests/adapter/CommandTopicChannelTest.res.mjs +4 -4
  43. package/tests/adapter/EventCollectorChannelTest.res +11 -11
  44. package/tests/adapter/EventCollectorChannelTest.res.mjs +11 -11
  45. package/tests/adapter/EventLogSnapshotParityTest.res +2 -2
  46. package/tests/adapter/EventLogSnapshotParityTest.res.mjs +2 -2
  47. package/tests/adapter/EventLogStorageSqliteTest.res +11 -11
  48. package/tests/adapter/EventLogStorageSqliteTest.res.mjs +11 -11
  49. package/tests/adapter/EventTopicPublisherTest.res +4 -4
  50. package/tests/adapter/EventTopicPublisherTest.res.mjs +4 -4
  51. package/tests/adapter/LocalAuthHttpTest.res +5 -1
  52. package/tests/adapter/LocalAuthHttpTest.res.mjs +5 -5
  53. package/tests/adapter/LocalDispatchContextTest.res +83 -0
  54. package/tests/adapter/LocalDispatchContextTest.res.mjs +73 -0
  55. package/tests/adapter/ProjectionCheckpointTest.res +5 -5
  56. package/tests/adapter/ProjectionCheckpointTest.res.mjs +5 -5
  57. package/tests/adapter/QueryDbGsiTtlTest.res +12 -12
  58. package/tests/adapter/QueryDbGsiTtlTest.res.mjs +12 -12
  59. package/tests/adapter/QueryDbListPushdownParityTest.res +1 -1
  60. package/tests/adapter/QueryDbListPushdownParityTest.res.mjs +1 -1
  61. package/tests/adapter/QueryDbListResolverTest.res.mjs +1 -1
  62. package/tests/adapter/QueryDbStorageSqliteTest.res +6 -6
  63. package/tests/adapter/QueryDbStorageSqliteTest.res.mjs +6 -6
  64. package/tests/adapter/QueryDbStorageTest.res +10 -10
  65. package/tests/adapter/QueryDbStorageTest.res.mjs +10 -10
  66. package/tests/adapter/QueryEngineTest.res +8 -8
  67. package/tests/adapter/QueryEngineTest.res.mjs +8 -8
  68. package/tests/components/aggregate/AggregateTest.res +3 -3
  69. package/tests/components/aggregate/AggregateTest.res.mjs +3 -3
  70. package/tests/components/commandtopic/CommandTopicFixtures.res.mjs +1 -1
  71. package/tests/components/commandtopic/CommandTopicStreamFixtures.res.mjs +1 -1
  72. package/tests/components/eventcollector/EventCollectorFixtures.res.mjs +3 -1
  73. package/tests/components/eventlog/EventLogFixtures.res.mjs +1 -1
  74. package/tests/components/eventtopic/EventTopicFixtures.res.mjs +1 -1
  75. package/tests/components/eventtopic/EventTopicStreamFixtures.res.mjs +1 -1
  76. package/tests/components/querydb/QueryDbFixtures.res.mjs +1 -1
  77. package/tests/components/querydb/QueryDbSubIdFixtures.res.mjs +1 -1
  78. package/tests/components/sideeffecthandler/SideEffectHandlerFixtures.res.mjs +4 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,28 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # 3.0.0-alpha.162 (2026-07-22)
7
+
8
+ ### Bug Fixes
9
+
10
+ * **local:** fail loudly when DomainGraphQL_Server can't bind its port ([ee35c78](https://github.com/ReventlessDev/reventless-core/commit/ee35c78ccffadb78f5ec009524b617d35df5fe24))
11
+ ### Features
12
+
13
+ * **aws:** resolve plugin at deploy time for aggregate/DCB dispatch ([4d81320](https://github.com/ReventlessDev/reventless-core/commit/4d813200d77362791263357490aa31f63eac1879))
14
+ * **aws:** unify the deployed entry-point dispatch boundary; add latency fields ([ad7b3f6](https://github.com/ReventlessDev/reventless-core/commit/ad7b3f60e7b2b2213677732bbf13f486043075ef))
15
+ * **core:** annotate event-collector logs with the element's comp ([eda413a](https://github.com/ReventlessDev/reventless-core/commit/eda413ab00eb8bb02b30e029af2d6221e3e9ba75)), closes [#1](https://github.com/ReventlessDev/reventless-core/issues/1)
16
+ * **core:** attribute piece resources to the component that owns them ([2ddd91a](https://github.com/ReventlessDev/reventless-core/commit/2ddd91ae1a5394257dec4b9b6e5021d5aa6e7f63))
17
+ * **core:** attribute shared substrate to the plugin that owns it ([a440d4f](https://github.com/ReventlessDev/reventless-core/commit/a440d4f827dfab9e2e9a763ffd9fc40240852e09))
18
+
19
+
20
+ # 3.0.0-alpha.161 (2026-07-21)
21
+
22
+ **Note:** Version bump only for package @reventlessdev/reventless-local
23
+
24
+
25
+
26
+
27
+
6
28
  # 3.0.0-alpha.160 (2026-07-20)
7
29
 
8
30
  ### Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reventlessdev/reventless-local",
3
- "version": "3.0.0-alpha.160",
3
+ "version": "3.0.0-alpha.162",
4
4
  "description": "Local platform for Reventless (in-memory or SQLite backend, for development and testing without AWS)",
5
5
  "license": "Apache-2.0",
6
6
  "jest": {
@@ -31,17 +31,17 @@
31
31
  "graphql-yoga": "^5.21.0",
32
32
  "sury": "11.0.0-alpha.4",
33
33
  "ws": "^8.18.0",
34
- "@reventlessdev/rescript-graphql-yoga": "1.0.0-alpha.24",
35
- "@reventlessdev/rescript-effect": "0.1.0-alpha.29",
36
- "@reventlessdev/rescript-mcp-sdk": "1.0.0-alpha.20",
37
34
  "@reventlessdev/rescript-jest": "1.0.0-alpha.9",
35
+ "@reventlessdev/rescript-effect": "0.1.0-alpha.30",
38
36
  "@reventlessdev/rescript-pulumi-pulumi": "2.3.0-alpha.17",
39
- "@reventlessdev/reventless-core": "3.0.0-alpha.173",
40
- "@reventlessdev/reventless-infra": "3.0.0-alpha.102",
41
- "@reventlessdev/reventless-graphql-server": "1.0.0-alpha.20",
42
- "@reventlessdev/reventless-postgres": "3.0.0-alpha.37",
43
- "@reventlessdev/reventless-gwt": "1.0.0-alpha.120",
44
- "@reventlessdev/reventless-spec": "3.0.0-alpha.79"
37
+ "@reventlessdev/rescript-mcp-sdk": "1.0.0-alpha.20",
38
+ "@reventlessdev/reventless-graphql-server": "1.0.0-alpha.22",
39
+ "@reventlessdev/reventless-core": "3.0.0-alpha.175",
40
+ "@reventlessdev/rescript-graphql-yoga": "1.0.0-alpha.24",
41
+ "@reventlessdev/reventless-gwt": "1.0.0-alpha.122",
42
+ "@reventlessdev/reventless-postgres": "3.0.0-alpha.39",
43
+ "@reventlessdev/reventless-spec": "3.0.0-alpha.80",
44
+ "@reventlessdev/reventless-infra": "3.0.0-alpha.103"
45
45
  },
46
46
  "devDependencies": {
47
47
  "rescript": "12.3.0",
@@ -762,6 +762,8 @@ function MakeWithConfig(Config) {
762
762
  groupBySource: LocalRuntimeEnvironment$ReventlessLocal.groupBySource,
763
763
  extractCorrelationId: LocalRuntimeEnvironment$ReventlessLocal.extractCorrelationId,
764
764
  extractCausationId: LocalRuntimeEnvironment$ReventlessLocal.extractCausationId,
765
+ extractSentTimestamp: LocalRuntimeEnvironment$ReventlessLocal.extractSentTimestamp,
766
+ extractRetryCount: LocalRuntimeEnvironment$ReventlessLocal.extractRetryCount,
765
767
  asEventHandler: prim => prim,
766
768
  asEffectHandler: prim => prim
767
769
  })(EventCollectorChannel)({
@@ -771,6 +773,8 @@ function MakeWithConfig(Config) {
771
773
  groupBySource: LocalRuntimeEnvironment$ReventlessLocal.groupBySource,
772
774
  extractCorrelationId: LocalRuntimeEnvironment$ReventlessLocal.extractCorrelationId,
773
775
  extractCausationId: LocalRuntimeEnvironment$ReventlessLocal.extractCausationId,
776
+ extractSentTimestamp: LocalRuntimeEnvironment$ReventlessLocal.extractSentTimestamp,
777
+ extractRetryCount: LocalRuntimeEnvironment$ReventlessLocal.extractRetryCount,
774
778
  asEventHandler: prim => prim,
775
779
  asEffectHandler: prim => prim
776
780
  })(EventCollectorChannel))(LocalDcbEventLogStorage$ReventlessLocal.Make(Bus))(LocalEventTopicPublisher$ReventlessLocal.Make(Bus))({
@@ -2427,6 +2431,8 @@ function Make($star) {
2427
2431
  groupBySource: LocalRuntimeEnvironment$ReventlessLocal.groupBySource,
2428
2432
  extractCorrelationId: LocalRuntimeEnvironment$ReventlessLocal.extractCorrelationId,
2429
2433
  extractCausationId: LocalRuntimeEnvironment$ReventlessLocal.extractCausationId,
2434
+ extractSentTimestamp: LocalRuntimeEnvironment$ReventlessLocal.extractSentTimestamp,
2435
+ extractRetryCount: LocalRuntimeEnvironment$ReventlessLocal.extractRetryCount,
2430
2436
  asEventHandler: prim => prim,
2431
2437
  asEffectHandler: prim => prim
2432
2438
  })(EventCollectorChannel)({
@@ -2436,6 +2442,8 @@ function Make($star) {
2436
2442
  groupBySource: LocalRuntimeEnvironment$ReventlessLocal.groupBySource,
2437
2443
  extractCorrelationId: LocalRuntimeEnvironment$ReventlessLocal.extractCorrelationId,
2438
2444
  extractCausationId: LocalRuntimeEnvironment$ReventlessLocal.extractCausationId,
2445
+ extractSentTimestamp: LocalRuntimeEnvironment$ReventlessLocal.extractSentTimestamp,
2446
+ extractRetryCount: LocalRuntimeEnvironment$ReventlessLocal.extractRetryCount,
2439
2447
  asEventHandler: prim => prim,
2440
2448
  asEffectHandler: prim => prim
2441
2449
  })(EventCollectorChannel))(LocalDcbEventLogStorage$ReventlessLocal.Make(Bus))(LocalEventTopicPublisher$ReventlessLocal.Make(Bus))({
@@ -29,7 +29,7 @@ module Make = (Bus: LocalBus.T) => {
29
29
  'context,
30
30
  channelParts,
31
31
  runtimeParts,
32
- > = (~name, ~opts as _=?) => {
32
+ > = (~name, ~owner as _, ~opts as _=?) => {
33
33
  // Captured when handleChannelEvent is called; used by publishJsonsAndWait to
34
34
  // run the handler inline and collect typed outcomes without going through the bus.
35
35
  let handleCmdsRef: ref<
@@ -20,7 +20,7 @@ function Make(Bus) {
20
20
  return "";
21
21
  }
22
22
  };
23
- let make = (name, param) => {
23
+ let make = (name, param, param$1) => {
24
24
  let handleCmdsRef = {
25
25
  contents: undefined
26
26
  };
@@ -42,6 +42,12 @@ let readBody = (req: nodeRequest, onBody: string => unit): unit => {
42
42
  type requestHandler = (nodeRequest, nodeResponse) => unit
43
43
  @module("http") external createServerWithHandler: requestHandler => YG.httpServer = "createServer"
44
44
 
45
+ // http.Server emits `error` (e.g. EADDRINUSE) instead of throwing from listen().
46
+ // Without a handler the failure is silent — listen()'s success callback never
47
+ // fires, the server never binds, and requests fall through to whatever else
48
+ // holds the port. We attach one so a bind failure surfaces loudly.
49
+ @send external _onServerError: (YG.httpServer, @as("error") _, JsExn.t => unit) => unit = "on"
50
+
45
51
  // -- /__inmemory/login + /logout handlers -----------------------------------
46
52
 
47
53
  let _writeJson = (res: nodeResponse, ~status: int, body: JSON.t): unit => {
@@ -577,6 +583,17 @@ let start = (~port: int=4000, ~contextFactory as _: option<YG.contextFactory>=?,
577
583
  | None => lastFullSdl.contents->Option.getOr("")
578
584
  }
579
585
  let server = createServerWithHandler((req, res) => _dispatch(req, res, yoga, getSdl))
586
+ server->_onServerError(err => {
587
+ let detail = err->JsExn.message->Option.getOr("unknown error")
588
+ log.error(
589
+ ~comp="GraphQL:Domain",
590
+ `failed to bind port ${port->Int.toString}: ${detail} — ` ++
591
+ `is another server (dev server, prior test) already listening there?`,
592
+ )
593
+ // Re-raise so the failure is loud instead of a silently-unbound server whose
594
+ // requests fall through to whatever else holds the port.
595
+ JsError.throwWithMessage(`DomainGraphQL_Server could not bind port ${port->Int.toString}: ${detail}`)
596
+ })
580
597
  server->YG.listen(port, () =>
581
598
  log.info(~comp="GraphQL:Domain", `listening on http://localhost:${port->Int.toString}/graphql (SDL: /sdl)`)
582
599
  )
@@ -489,6 +489,11 @@ function start(portOpt, param, param$1) {
489
489
  }
490
490
  };
491
491
  let server = Http.createServer((req, res) => _dispatch(req, res, yoga, getSdl));
492
+ server.on("error", err => {
493
+ let detail = Stdlib_Option.getOr(Stdlib_JsExn.message(err), "unknown error");
494
+ log.error("GraphQL:Domain", undefined, `failed to bind port ` + port.toString() + `: ` + detail + ` — is another server (dev server, prior test) already listening there?`);
495
+ Stdlib_JsError.throwWithMessage(`DomainGraphQL_Server could not bind port ` + port.toString() + `: ` + detail);
496
+ });
492
497
  server.listen(port, () => log.info("GraphQL:Domain", undefined, `listening on http://localhost:` + port.toString() + `/graphql (SDL: /sdl)`));
493
498
  activeServer.contents = Primitive_option.some(server);
494
499
  }
@@ -13,7 +13,7 @@ module Make = (Bus: LocalBus.T) => {
13
13
  let make: ReventlessCore.EventCollector_Adapter.channelMaker<callbackEvent, 'context, channelParts> = (
14
14
  ~name as _,
15
15
  ~eventTopics,
16
- ~opts as _,
16
+ ~owner as _, ~opts as _,
17
17
  ) => {
18
18
  // Collect all event topic resources as our channel resources
19
19
  let eventTopicResources =
@@ -6,7 +6,7 @@ import * as Pulumi from "@pulumi/pulumi";
6
6
  import * as Deferred from "effect/Deferred";
7
7
 
8
8
  function Make(Bus) {
9
- let make = (param, eventTopics, param$1) => {
9
+ let make = (param, eventTopics, param$1, param$2) => {
10
10
  let eventTopicResources = Object.values(eventTopics).flatMap(outputs => outputs.resources);
11
11
  return {
12
12
  parts: undefined,
@@ -40,7 +40,7 @@ function Make(Bus) {
40
40
  }
41
41
 
42
42
  function MakeProjection(Bus) {
43
- let make = (param, eventTopics, param$1) => {
43
+ let make = (param, eventTopics, param$1, param$2) => {
44
44
  let eventTopicResources = Object.values(eventTopics).flatMap(outputs => outputs.resources);
45
45
  return {
46
46
  parts: undefined,
@@ -108,7 +108,7 @@ let makeStorage = makeMemoryStorage
108
108
  // Pure in-memory storageMaker (no BackendState dispatch, no Bus). Backend
109
109
  // selection lives in LocalEventLogStorage.Make — this file holds only the
110
110
  // in-memory implementation, as its name says.
111
- let make: ReventlessCore.EventLog_Adapter.storageMaker = (~name, ~opts) => {
111
+ let make: ReventlessCore.EventLog_Adapter.storageMaker = (~name, ~owner as _, ~opts) => {
112
112
  let (_, _, storage) = makeMemoryStorage(~name, ~opts)
113
113
  storage
114
114
  }
@@ -99,7 +99,7 @@ function makeMemoryStorage(_name, param) {
99
99
  ];
100
100
  }
101
101
 
102
- function make(name, opts) {
102
+ function make(name, param, opts) {
103
103
  return makeMemoryStorage(name, opts)[2];
104
104
  }
105
105
 
@@ -258,7 +258,7 @@ let makeStorage = (~db: SqliteDriver.t, ~name: string, ~opts as _) => {
258
258
  }
259
259
 
260
260
  module Make = (Bus: LocalBus.T, DbProvider: {let db: SqliteDriver.t}) => {
261
- let make: EventLog_Adapter.storageMaker = (~name, ~opts) => {
261
+ let make: EventLog_Adapter.storageMaker = (~name, ~owner as _, ~opts) => {
262
262
  let (storageName, replay, storage) = makeStorage(~db=DbProvider.db, ~name, ~opts)
263
263
  Bus.registerEventLogReplay(storageName, replay)
264
264
  storage
@@ -244,7 +244,7 @@ function makeStorage(db, name, param) {
244
244
 
245
245
  function Make(Bus) {
246
246
  return DbProvider => {
247
- let make = (name, opts) => {
247
+ let make = (name, param, opts) => {
248
248
  let match = makeStorage(DbProvider.db, name, opts);
249
249
  Bus.registerEventLogReplay(match[0], match[1]);
250
250
  return match[2];
@@ -10,7 +10,7 @@
10
10
  // the LocalBus event-tap can stream historical events uniformly.
11
11
 
12
12
  module Make = (Bus: LocalBus.T) => {
13
- let make: ReventlessCore.EventLog_Adapter.storageMaker = (~name, ~opts) => {
13
+ let make: ReventlessCore.EventLog_Adapter.storageMaker = (~name, ~owner, ~opts) => {
14
14
  switch (BackendState.getSqliteDb(), BackendState.getPostgresPool()) {
15
15
  | (Some(db), _) =>
16
16
  let (storageName, replay, storage) = EventLogStorage_Sqlite.makeStorage(~db, ~name, ~opts)
@@ -7,7 +7,7 @@ import * as EventLogStorage_InMemory$ReventlessLocal from "./EventLogStorage_InM
7
7
  import * as EventLogStorage_Postgres$ReventlessPostgres from "@reventlessdev/reventless-postgres/src/EventLogStorage_Postgres.res.mjs";
8
8
 
9
9
  function Make(Bus) {
10
- let make = (name, opts) => {
10
+ let make = (name, owner, opts) => {
11
11
  let match = BackendState$ReventlessLocal.getSqliteDb();
12
12
  let match$1 = BackendState$ReventlessLocal.getPostgresPool();
13
13
  if (match !== undefined) {
@@ -2,7 +2,7 @@
2
2
  // The resource name doubles as the bus topic key that EventCollectorChannel subscribes to.
3
3
 
4
4
  module Make = (Bus: LocalBus.T) => {
5
- let make: ReventlessCore.EventTopic_Adapter.publisherMaker = (~name, ~storageResources as _, ~opts as _) => {
5
+ let make: ReventlessCore.EventTopic_Adapter.publisherMaker = (~name, ~storageResources as _, ~owner as _, ~opts as _) => {
6
6
  let publishJson = (service, meta, json) => Bus.publishEvent(name, service, meta, json)
7
7
  let publishJsonStream: ReventlessInfra.EventTopic.publishJsonStream = stream =>
8
8
  stream
@@ -7,7 +7,7 @@ import * as Pulumi from "@pulumi/pulumi";
7
7
  import * as Adapter$ReventlessInfra from "@reventlessdev/reventless-infra/src/adapter/Adapter.res.mjs";
8
8
 
9
9
  function Make(Bus) {
10
- let make = (name, param, param$1) => {
10
+ let make = (name, param, param$1, param$2) => {
11
11
  let publishJsonStream = stream => Stream$1.runForEach(Stream.grouped(stream, 10), items => Effect.promise(() => Promise.all(items.map(param => {
12
12
  let service = param.service;
13
13
  let meta = param.meta;
@@ -33,11 +33,11 @@ module Make = (Bus: LocalBus.T) => {
33
33
  ~ttl=?,
34
34
  ~api,
35
35
  ~apiRole,
36
- ~opts,
36
+ ~owner, ~opts,
37
37
  ) =>
38
38
  switch BackendState.getSqliteDb() {
39
39
  | Some(db) =>
40
40
  QueryDbStorage_Sqlite.makeStorage(~db, ~bus=sqliteBusCallbacks, ~name, ~indexes, ~subIdField)
41
- | None => Mem.make(~name, ~indexes, ~subIdField?, ~ttl?, ~api, ~apiRole, ~opts)
41
+ | None => Mem.make(~name, ~indexes, ~subIdField?, ~ttl?, ~api, ~apiRole, ~owner, ~opts)
42
42
  }
43
43
  }
@@ -21,12 +21,12 @@ function Make(Bus) {
21
21
  registerQueryDbIndexLookup: sqliteBusCallbacks_registerQueryDbIndexLookup,
22
22
  registerQueryDbListPage: sqliteBusCallbacks_registerQueryDbListPage
23
23
  };
24
- let make = (name, indexes, subIdField, ttl, api, apiRole, opts) => {
24
+ let make = (name, indexes, subIdField, ttl, api, apiRole, owner, opts) => {
25
25
  let db = BackendState$ReventlessLocal.getSqliteDb();
26
26
  if (db !== undefined) {
27
27
  return QueryDbStorage_Sqlite$ReventlessLocal.makeStorage(Primitive_option.valFromOption(db), sqliteBusCallbacks, name, indexes, subIdField);
28
28
  } else {
29
- return Mem.make(name, indexes, subIdField, ttl, api, apiRole, opts);
29
+ return Mem.make(name, indexes, subIdField, ttl, api, apiRole, owner, opts);
30
30
  }
31
31
  };
32
32
  return {
@@ -73,7 +73,7 @@ module Make = (Bus: LocalBus.T) => {
73
73
  ~ttl as _=?,
74
74
  ~api as _,
75
75
  ~apiRole as _,
76
- ~opts as _,
76
+ ~owner as _, ~opts as _,
77
77
  ) => {
78
78
  let store: ref<dict<dict<JSON.t>>> = ref(Dict.make())
79
79
  // Lazy flattened snapshot for the registered scan/stream closures. The old
@@ -53,7 +53,7 @@ function flattenStore(store) {
53
53
  }
54
54
 
55
55
  function Make(Bus) {
56
- let make = (name, param, subIdField, param$1, param$2, param$3, param$4) => {
56
+ let make = (name, param, subIdField, param$1, param$2, param$3, param$4, param$5) => {
57
57
  let store = {
58
58
  contents: {}
59
59
  };
@@ -509,6 +509,6 @@ module Make = (Bus: LocalBus.T, DbProvider: {let db: SqliteDriver.t}) => {
509
509
  ~ttl as _=?,
510
510
  ~api as _,
511
511
  ~apiRole as _,
512
- ~opts as _,
512
+ ~owner as _, ~opts as _,
513
513
  ) => makeStorage(~db=DbProvider.db, ~bus=busCallbacks, ~name, ~indexes, ~subIdField)
514
514
  }
@@ -404,7 +404,7 @@ function Make(Bus) {
404
404
  registerQueryDbIndexLookup: busCallbacks_registerQueryDbIndexLookup,
405
405
  registerQueryDbListPage: busCallbacks_registerQueryDbListPage
406
406
  };
407
- let make = (name, indexes, subIdField, param, param$1, param$2, param$3) => makeStorage(DbProvider.db, busCallbacks, name, indexes, subIdField);
407
+ let make = (name, indexes, subIdField, param, param$1, param$2, param$3, param$4) => makeStorage(DbProvider.db, busCallbacks, name, indexes, subIdField);
408
408
  return {
409
409
  busCallbacks: busCallbacks,
410
410
  make: make
@@ -41,6 +41,8 @@ module Make = (
41
41
  ->ReventlessCore.Runtime.runEffectHandler(
42
42
  ~extractCorrelationId=LocalRuntimeEnvironment.extractCorrelationId,
43
43
  ~extractCausationId=LocalRuntimeEnvironment.extractCausationId,
44
+ ~extractSentTimestamp=LocalRuntimeEnvironment.extractSentTimestamp,
45
+ ~extractRetryCount=LocalRuntimeEnvironment.extractRetryCount,
44
46
  ~comp=name,
45
47
  )
46
48
  ),
@@ -66,6 +68,8 @@ module Make = (
66
68
  ->ReventlessCore.Runtime.runEffectHandler(
67
69
  ~extractCorrelationId=LocalRuntimeEnvironment.extractCorrelationId,
68
70
  ~extractCausationId=LocalRuntimeEnvironment.extractCausationId,
71
+ ~extractSentTimestamp=LocalRuntimeEnvironment.extractSentTimestamp,
72
+ ~extractRetryCount=LocalRuntimeEnvironment.extractRetryCount,
69
73
  ~comp=name,
70
74
  )
71
75
  ),
@@ -84,6 +88,8 @@ module Make = (
84
88
  let resource = eventCollector->ReventlessCore.Component.toPulumiResource
85
89
  let name =
86
90
  resource.name->ReventlessCore.ComponentType.nameOpt(ReventlessCore.EventCollector.componentType)
91
+ // Same `comp` shape as the deployed dispatchers — see EventCollectorRuntime_Builder_Single.
92
+ let comp = `EventCollector(${resource.name->Option.getOr("Unnamed")})`
87
93
  let opts = {Pulumi.ComponentResource.parent: resource}
88
94
  let runtime = LocalRuntimeEnvironment.make(
89
95
  ~name,
@@ -93,7 +99,9 @@ module Make = (
93
99
  ->ReventlessCore.Runtime.runEffectHandler(
94
100
  ~extractCorrelationId=LocalRuntimeEnvironment.extractCorrelationId,
95
101
  ~extractCausationId=LocalRuntimeEnvironment.extractCausationId,
96
- ~comp=name,
102
+ ~extractSentTimestamp=LocalRuntimeEnvironment.extractSentTimestamp,
103
+ ~extractRetryCount=LocalRuntimeEnvironment.extractRetryCount,
104
+ ~comp,
97
105
  )
98
106
  ),
99
107
  )
@@ -1,5 +1,6 @@
1
1
  // Generated by ReScript, PLEASE EDIT WITH CARE
2
2
 
3
+ import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
3
4
  import * as Runtime$ReventlessCore from "@reventlessdev/reventless-core/src/adapter/Runtime/Runtime.res.mjs";
4
5
  import * as Component$ReventlessCore from "@reventlessdev/reventless-core/src/components/Component.res.mjs";
5
6
  import * as CommandTopic$ReventlessCore from "@reventlessdev/reventless-core/src/components/CommandTopic/CommandTopic.res.mjs";
@@ -13,21 +14,22 @@ function Make(Bus) {
13
14
  let forCommandGenerator = (handler, connect, param, param$1, commandGenerator) => {
14
15
  let resource = Component$ReventlessCore.toPulumiResource(commandGenerator);
15
16
  let name = ComponentType$ReventlessCore.nameOpt(resource.__name, CommandGenerator$ReventlessCore.componentType);
16
- return connect(LocalRuntimeEnvironment$ReventlessLocal.make(name, handler.apply(h => Runtime$ReventlessCore.runEffectHandler(LocalRuntimeEnvironment$ReventlessLocal.extractCorrelationId, LocalRuntimeEnvironment$ReventlessLocal.extractCausationId, name, undefined, h)), undefined, undefined, undefined));
17
+ return connect(LocalRuntimeEnvironment$ReventlessLocal.make(name, handler.apply(h => Runtime$ReventlessCore.runEffectHandler(LocalRuntimeEnvironment$ReventlessLocal.extractCorrelationId, LocalRuntimeEnvironment$ReventlessLocal.extractCausationId, LocalRuntimeEnvironment$ReventlessLocal.extractSentTimestamp, LocalRuntimeEnvironment$ReventlessLocal.extractRetryCount, name, undefined, h)), undefined, undefined, undefined));
17
18
  };
18
19
  let forCommandTopic = (handler, connect, param, param$1, commandTopic) => {
19
20
  let resource = Component$ReventlessCore.toPulumiResource(commandTopic);
20
21
  let name = ComponentType$ReventlessCore.nameOpt(resource.__name, CommandTopic$ReventlessCore.componentType);
21
- return connect(LocalRuntimeEnvironment$ReventlessLocal.make(name, handler.apply(h => Runtime$ReventlessCore.runEffectHandler(LocalRuntimeEnvironment$ReventlessLocal.extractCorrelationId, LocalRuntimeEnvironment$ReventlessLocal.extractCausationId, name, undefined, h)), undefined, undefined, undefined));
22
+ return connect(LocalRuntimeEnvironment$ReventlessLocal.make(name, handler.apply(h => Runtime$ReventlessCore.runEffectHandler(LocalRuntimeEnvironment$ReventlessLocal.extractCorrelationId, LocalRuntimeEnvironment$ReventlessLocal.extractCausationId, LocalRuntimeEnvironment$ReventlessLocal.extractSentTimestamp, LocalRuntimeEnvironment$ReventlessLocal.extractRetryCount, name, undefined, h)), undefined, undefined, undefined));
22
23
  };
23
24
  let forEventCollector = (handler, eventTopics, resources, param, param$1, eventCollector) => {
24
25
  let resource = Component$ReventlessCore.toPulumiResource(eventCollector);
25
26
  let name = ComponentType$ReventlessCore.nameOpt(resource.__name, EventCollector$ReventlessCore.componentType);
27
+ let comp = `EventCollector(` + Stdlib_Option.getOr(resource.__name, "Unnamed") + `)`;
26
28
  let opts_parent = resource;
27
29
  let opts = {
28
30
  parent: opts_parent
29
31
  };
30
- let runtime = LocalRuntimeEnvironment$ReventlessLocal.make(name, handler.apply(h => Runtime$ReventlessCore.runEffectHandler(LocalRuntimeEnvironment$ReventlessLocal.extractCorrelationId, LocalRuntimeEnvironment$ReventlessLocal.extractCausationId, name, undefined, h)), undefined, undefined, undefined);
32
+ let runtime = LocalRuntimeEnvironment$ReventlessLocal.make(name, handler.apply(h => Runtime$ReventlessCore.runEffectHandler(LocalRuntimeEnvironment$ReventlessLocal.extractCorrelationId, LocalRuntimeEnvironment$ReventlessLocal.extractCausationId, LocalRuntimeEnvironment$ReventlessLocal.extractSentTimestamp, LocalRuntimeEnvironment$ReventlessLocal.extractRetryCount, comp, undefined, h)), undefined, undefined, undefined);
31
33
  EventCollectorChannel.connect(name, [{
32
34
  channel: eventCollector.channel,
33
35
  eventTopics: eventTopics,
@@ -26,6 +26,8 @@ module Make = (
26
26
  let resource = eventCollector->ReventlessCore.Component.toPulumiResource
27
27
  let name =
28
28
  resource.name->ReventlessCore.ComponentType.nameOpt(ReventlessCore.EventCollector.componentType)
29
+ // Same `comp` shape as the deployed dispatchers — see EventCollectorRuntime_Builder_Single.
30
+ let comp = `EventCollector(${resource.name->Option.getOr("Unnamed")})`
29
31
  let opts = {Pulumi.ComponentResource.parent: resource}
30
32
  let runtime = LocalRuntimeEnvironment.make(
31
33
  ~name,
@@ -35,7 +37,9 @@ module Make = (
35
37
  ->ReventlessCore.Runtime.runEffectHandler(
36
38
  ~extractCorrelationId=LocalRuntimeEnvironment.extractCorrelationId,
37
39
  ~extractCausationId=LocalRuntimeEnvironment.extractCausationId,
38
- ~comp=name,
40
+ ~extractSentTimestamp=LocalRuntimeEnvironment.extractSentTimestamp,
41
+ ~extractRetryCount=LocalRuntimeEnvironment.extractRetryCount,
42
+ ~comp,
39
43
  )
40
44
  ),
41
45
  )
@@ -1,5 +1,6 @@
1
1
  // Generated by ReScript, PLEASE EDIT WITH CARE
2
2
 
3
+ import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
3
4
  import * as Runtime$ReventlessCore from "@reventlessdev/reventless-core/src/adapter/Runtime/Runtime.res.mjs";
4
5
  import * as Component$ReventlessCore from "@reventlessdev/reventless-core/src/components/Component.res.mjs";
5
6
  import * as ComponentType$ReventlessCore from "@reventlessdev/reventless-core/src/ComponentType.res.mjs";
@@ -11,11 +12,12 @@ function Make(Bus) {
11
12
  let forEventCollector = (handler, eventTopics, resources, param, param$1, eventCollector) => {
12
13
  let resource = Component$ReventlessCore.toPulumiResource(eventCollector);
13
14
  let name = ComponentType$ReventlessCore.nameOpt(resource.__name, EventCollector$ReventlessCore.componentType);
15
+ let comp = `EventCollector(` + Stdlib_Option.getOr(resource.__name, "Unnamed") + `)`;
14
16
  let opts_parent = resource;
15
17
  let opts = {
16
18
  parent: opts_parent
17
19
  };
18
- let runtime = LocalRuntimeEnvironment$ReventlessLocal.make(name, handler.apply(h => Runtime$ReventlessCore.runEffectHandler(LocalRuntimeEnvironment$ReventlessLocal.extractCorrelationId, LocalRuntimeEnvironment$ReventlessLocal.extractCausationId, name, undefined, h)), undefined, undefined, undefined);
20
+ let runtime = LocalRuntimeEnvironment$ReventlessLocal.make(name, handler.apply(h => Runtime$ReventlessCore.runEffectHandler(LocalRuntimeEnvironment$ReventlessLocal.extractCorrelationId, LocalRuntimeEnvironment$ReventlessLocal.extractCausationId, LocalRuntimeEnvironment$ReventlessLocal.extractSentTimestamp, LocalRuntimeEnvironment$ReventlessLocal.extractRetryCount, comp, undefined, h)), undefined, undefined, undefined);
19
21
  EventCollectorChannel.connect(name, [{
20
22
  channel: eventCollector.channel,
21
23
  eventTopics: eventTopics,
@@ -11,6 +11,8 @@ function Make(Bus) {
11
11
  groupBySource: LocalRuntimeEnvironment$ReventlessLocal.groupBySource,
12
12
  extractCorrelationId: LocalRuntimeEnvironment$ReventlessLocal.extractCorrelationId,
13
13
  extractCausationId: LocalRuntimeEnvironment$ReventlessLocal.extractCausationId,
14
+ extractSentTimestamp: LocalRuntimeEnvironment$ReventlessLocal.extractSentTimestamp,
15
+ extractRetryCount: LocalRuntimeEnvironment$ReventlessLocal.extractRetryCount,
14
16
  asEventHandler: prim => prim,
15
17
  asEffectHandler: prim => prim
16
18
  })(ECChannel);
@@ -52,6 +52,16 @@ let extractMetaField = (event: event, field) =>
52
52
  let extractCorrelationId = (event: event) => event->extractMetaField("correlationId")
53
53
  let extractCausationId = (event: event) => event->extractMetaField("causationId")
54
54
 
55
+ // In-process dispatch: the message is handed over the moment it is published, so
56
+ // dispatch time *is* send time and there is no queue to dwell in. A handler that
57
+ // computes `now - timestamp` therefore measures its own processing latency here
58
+ // and end-to-end latency on a queue-backed platform — same expression, both
59
+ // answers correct for their transport.
60
+ let extractSentTimestamp = (_event: event) => Some(Date.now())
61
+
62
+ // No redelivery in-process — the bus calls each handler once.
63
+ let extractRetryCount = (_event: event) => Some(1)
64
+
55
65
  external asEventHandler: 'a => ReventlessCore.Runtime.eventHandler<event, context, 'r> = "%identity"
56
66
  external asEffectHandler: 'a => ReventlessCore.Runtime.effectHandler<event, context, 'r, 'error> =
57
67
  "%identity"
@@ -40,11 +40,21 @@ function extractCausationId(event) {
40
40
  return extractMetaField(event, "causationId");
41
41
  }
42
42
 
43
+ function extractSentTimestamp(_event) {
44
+ return Date.now();
45
+ }
46
+
47
+ function extractRetryCount(_event) {
48
+ return 1;
49
+ }
50
+
43
51
  export {
44
52
  make,
45
53
  groupBySource,
46
54
  extractMetaField,
47
55
  extractCorrelationId,
48
56
  extractCausationId,
57
+ extractSentTimestamp,
58
+ extractRetryCount,
49
59
  }
50
60
  /* effect/Effect Not a pure module */
@@ -65,6 +65,8 @@ function MakeWithHooks(Bus) {
65
65
  groupBySource: LocalRuntimeEnvironment$ReventlessLocal.groupBySource,
66
66
  extractCorrelationId: LocalRuntimeEnvironment$ReventlessLocal.extractCorrelationId,
67
67
  extractCausationId: LocalRuntimeEnvironment$ReventlessLocal.extractCausationId,
68
+ extractSentTimestamp: LocalRuntimeEnvironment$ReventlessLocal.extractSentTimestamp,
69
+ extractRetryCount: LocalRuntimeEnvironment$ReventlessLocal.extractRetryCount,
68
70
  asEventHandler: prim => prim,
69
71
  asEffectHandler: prim => prim
70
72
  })({
@@ -112,6 +114,8 @@ function Make(Bus) {
112
114
  groupBySource: LocalRuntimeEnvironment$ReventlessLocal.groupBySource,
113
115
  extractCorrelationId: LocalRuntimeEnvironment$ReventlessLocal.extractCorrelationId,
114
116
  extractCausationId: LocalRuntimeEnvironment$ReventlessLocal.extractCausationId,
117
+ extractSentTimestamp: LocalRuntimeEnvironment$ReventlessLocal.extractSentTimestamp,
118
+ extractRetryCount: LocalRuntimeEnvironment$ReventlessLocal.extractRetryCount,
115
119
  asEventHandler: prim => prim,
116
120
  asEffectHandler: prim => prim
117
121
  })({
@@ -23,6 +23,8 @@ function Make(Bus) {
23
23
  groupBySource: LocalRuntimeEnvironment$ReventlessLocal.groupBySource,
24
24
  extractCorrelationId: LocalRuntimeEnvironment$ReventlessLocal.extractCorrelationId,
25
25
  extractCausationId: LocalRuntimeEnvironment$ReventlessLocal.extractCausationId,
26
+ extractSentTimestamp: LocalRuntimeEnvironment$ReventlessLocal.extractSentTimestamp,
27
+ extractRetryCount: LocalRuntimeEnvironment$ReventlessLocal.extractRetryCount,
26
28
  asEventHandler: prim => prim,
27
29
  asEffectHandler: prim => prim
28
30
  })({
@@ -14,6 +14,8 @@ function Make(Bus) {
14
14
  groupBySource: LocalRuntimeEnvironment$ReventlessLocal.groupBySource,
15
15
  extractCorrelationId: LocalRuntimeEnvironment$ReventlessLocal.extractCorrelationId,
16
16
  extractCausationId: LocalRuntimeEnvironment$ReventlessLocal.extractCausationId,
17
+ extractSentTimestamp: LocalRuntimeEnvironment$ReventlessLocal.extractSentTimestamp,
18
+ extractRetryCount: LocalRuntimeEnvironment$ReventlessLocal.extractRetryCount,
17
19
  asEventHandler: prim => prim,
18
20
  asEffectHandler: prim => prim
19
21
  })({
@@ -28,6 +30,8 @@ function Make(Bus) {
28
30
  groupBySource: LocalRuntimeEnvironment$ReventlessLocal.groupBySource,
29
31
  extractCorrelationId: LocalRuntimeEnvironment$ReventlessLocal.extractCorrelationId,
30
32
  extractCausationId: LocalRuntimeEnvironment$ReventlessLocal.extractCausationId,
33
+ extractSentTimestamp: LocalRuntimeEnvironment$ReventlessLocal.extractSentTimestamp,
34
+ extractRetryCount: LocalRuntimeEnvironment$ReventlessLocal.extractRetryCount,
31
35
  asEventHandler: prim => prim,
32
36
  asEffectHandler: prim => prim
33
37
  })({
@@ -24,6 +24,8 @@ function Make(Bus) {
24
24
  groupBySource: LocalRuntimeEnvironment$ReventlessLocal.groupBySource,
25
25
  extractCorrelationId: LocalRuntimeEnvironment$ReventlessLocal.extractCorrelationId,
26
26
  extractCausationId: LocalRuntimeEnvironment$ReventlessLocal.extractCausationId,
27
+ extractSentTimestamp: LocalRuntimeEnvironment$ReventlessLocal.extractSentTimestamp,
28
+ extractRetryCount: LocalRuntimeEnvironment$ReventlessLocal.extractRetryCount,
27
29
  asEventHandler: prim => prim,
28
30
  asEffectHandler: prim => prim
29
31
  })({
@@ -32,6 +32,8 @@ function Make(Bus) {
32
32
  groupBySource: LocalRuntimeEnvironment$ReventlessLocal.groupBySource,
33
33
  extractCorrelationId: LocalRuntimeEnvironment$ReventlessLocal.extractCorrelationId,
34
34
  extractCausationId: LocalRuntimeEnvironment$ReventlessLocal.extractCausationId,
35
+ extractSentTimestamp: LocalRuntimeEnvironment$ReventlessLocal.extractSentTimestamp,
36
+ extractRetryCount: LocalRuntimeEnvironment$ReventlessLocal.extractRetryCount,
35
37
  asEventHandler: prim => prim,
36
38
  asEffectHandler: prim => prim
37
39
  })(EventCollectorChannel)({
@@ -21,6 +21,8 @@ function Make(Bus) {
21
21
  groupBySource: LocalRuntimeEnvironment$ReventlessLocal.groupBySource,
22
22
  extractCorrelationId: LocalRuntimeEnvironment$ReventlessLocal.extractCorrelationId,
23
23
  extractCausationId: LocalRuntimeEnvironment$ReventlessLocal.extractCausationId,
24
+ extractSentTimestamp: LocalRuntimeEnvironment$ReventlessLocal.extractSentTimestamp,
25
+ extractRetryCount: LocalRuntimeEnvironment$ReventlessLocal.extractRetryCount,
24
26
  asEventHandler: prim => prim,
25
27
  asEffectHandler: prim => prim
26
28
  })({
@@ -39,6 +41,8 @@ function Make(Bus) {
39
41
  groupBySource: LocalRuntimeEnvironment$ReventlessLocal.groupBySource,
40
42
  extractCorrelationId: LocalRuntimeEnvironment$ReventlessLocal.extractCorrelationId,
41
43
  extractCausationId: LocalRuntimeEnvironment$ReventlessLocal.extractCausationId,
44
+ extractSentTimestamp: LocalRuntimeEnvironment$ReventlessLocal.extractSentTimestamp,
45
+ extractRetryCount: LocalRuntimeEnvironment$ReventlessLocal.extractRetryCount,
42
46
  asEventHandler: prim => prim,
43
47
  asEffectHandler: prim => prim
44
48
  })({
@@ -27,6 +27,8 @@ function Make(Bus) {
27
27
  groupBySource: LocalRuntimeEnvironment$ReventlessLocal.groupBySource,
28
28
  extractCorrelationId: LocalRuntimeEnvironment$ReventlessLocal.extractCorrelationId,
29
29
  extractCausationId: LocalRuntimeEnvironment$ReventlessLocal.extractCausationId,
30
+ extractSentTimestamp: LocalRuntimeEnvironment$ReventlessLocal.extractSentTimestamp,
31
+ extractRetryCount: LocalRuntimeEnvironment$ReventlessLocal.extractRetryCount,
30
32
  asEventHandler: prim => prim,
31
33
  asEffectHandler: prim => prim
32
34
  })({