@pattern-stack/codegen 0.19.0 → 0.20.1
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 +91 -0
- package/consumer-skills/events/authoring-events.md +31 -0
- package/dist/{chunk-Z7PQCAVK.js → chunk-4OC5MSHO.js} +50 -4
- package/dist/chunk-4OC5MSHO.js.map +1 -0
- package/dist/{chunk-7OVCARTQ.js → chunk-5RT7JGKT.js} +4 -4
- package/dist/{chunk-AZLUWG5S.js → chunk-AJILKWGO.js} +9 -9
- package/dist/{chunk-SNH35CNA.js → chunk-AODME4YK.js} +10 -10
- package/dist/{chunk-PKDS6QIJ.js → chunk-ATVGYF3D.js} +7 -7
- package/dist/{chunk-4MVGAMUA.js → chunk-BK5ICA2F.js} +4 -4
- package/dist/{chunk-2TVVBC53.js → chunk-BORNCTH3.js} +2 -2
- package/dist/{chunk-J7JMVS2B.js → chunk-CZQUOIDY.js} +4 -4
- package/dist/{chunk-V4AF6DI4.js → chunk-DUBZOXJC.js} +9 -2
- package/dist/{chunk-V4AF6DI4.js.map → chunk-DUBZOXJC.js.map} +1 -1
- package/dist/{chunk-VQOAATIG.js → chunk-DUMI2J5M.js} +4 -4
- package/dist/chunk-DUUCU77W.js +211 -0
- package/dist/chunk-DUUCU77W.js.map +1 -0
- package/dist/{chunk-OFRRBC7M.js → chunk-E2BRT5IB.js} +15 -1
- package/dist/chunk-E2BRT5IB.js.map +1 -0
- package/dist/{chunk-XKWOJZZ4.js → chunk-E45CSC33.js} +2 -2
- package/dist/{chunk-B34G6PHD.js → chunk-HCAKMT64.js} +77 -10
- package/dist/chunk-HCAKMT64.js.map +1 -0
- package/dist/{chunk-43SBT72G.js → chunk-I6UXRJ3Q.js} +4 -4
- package/dist/{chunk-GM3RMJIJ.js → chunk-INO47JXD.js} +3 -3
- package/dist/{chunk-BGULBWKJ.js → chunk-JOBQ6RUU.js} +1 -1
- package/dist/chunk-JOBQ6RUU.js.map +1 -0
- package/dist/{chunk-F7KN3U6U.js → chunk-KK5A7B2T.js} +27 -1
- package/dist/chunk-KK5A7B2T.js.map +1 -0
- package/dist/{chunk-65MO75WM.js → chunk-M3TIZGIB.js} +9 -9
- package/dist/{chunk-E6PLM6QG.js → chunk-MB5VVG4Z.js} +8 -8
- package/dist/{chunk-K2I6XIK5.js → chunk-MVKW2BCR.js} +2 -2
- package/dist/{chunk-VDL5CJ5C.js → chunk-P7EZCTIN.js} +8 -8
- package/dist/{chunk-R6F6KFIL.js → chunk-SGSWVNNB.js} +7 -7
- package/dist/chunk-SYVZ4MD2.js +1 -0
- package/dist/{chunk-235ZMMJR.js → chunk-SZYZ4SHF.js} +6 -6
- package/dist/{chunk-7LKAMLV4.js → chunk-T6SCOJF4.js} +4 -4
- package/dist/{chunk-OZEPJGMA.js → chunk-VOYFPR3S.js} +54 -6
- package/dist/chunk-VOYFPR3S.js.map +1 -0
- package/dist/{chunk-CLWBNXKF.js → chunk-W2UIDI3R.js} +4 -4
- package/dist/runtime/subsystems/analytics/analytics.module.js +2 -2
- package/dist/runtime/subsystems/analytics/index.js +4 -4
- package/dist/runtime/subsystems/auth/auth.module.js +2 -2
- package/dist/runtime/subsystems/auth/index.js +7 -7
- package/dist/runtime/subsystems/bridge/bridge-delivery-handler.js +3 -3
- package/dist/runtime/subsystems/bridge/bridge-delivery.drizzle-backend.js +4 -4
- package/dist/runtime/subsystems/bridge/bridge-delivery.schema.js +2 -2
- package/dist/runtime/subsystems/bridge/bridge-outbox-drain-hook.js +8 -8
- package/dist/runtime/subsystems/bridge/bridge.module.js +19 -19
- package/dist/runtime/subsystems/bridge/event-flow.service.js +2 -2
- package/dist/runtime/subsystems/bridge/index.js +27 -27
- package/dist/runtime/subsystems/events/domain-events.schema.js +1 -1
- package/dist/runtime/subsystems/events/event-bus.drizzle-backend.d.ts +19 -32
- package/dist/runtime/subsystems/events/event-bus.drizzle-backend.js +4 -4
- package/dist/runtime/subsystems/events/event-bus.memory-backend.d.ts +18 -1
- package/dist/runtime/subsystems/events/event-bus.memory-backend.js +2 -2
- package/dist/runtime/subsystems/events/event-bus.protocol.d.ts +45 -1
- package/dist/runtime/subsystems/events/event-scheduler.d.ts +96 -0
- package/dist/runtime/subsystems/events/event-scheduler.js +25 -0
- package/dist/runtime/subsystems/events/event-scheduler.js.map +1 -0
- package/dist/runtime/subsystems/events/events-errors.d.ts +12 -1
- package/dist/runtime/subsystems/events/events-errors.js +5 -3
- package/dist/runtime/subsystems/events/events.module.d.ts +41 -2
- package/dist/runtime/subsystems/events/events.module.js +12 -9
- package/dist/runtime/subsystems/events/generated/bus.js +3 -3
- package/dist/runtime/subsystems/events/generated/index.js +3 -3
- package/dist/runtime/subsystems/events/generated/registry.d.ts +6 -0
- package/dist/runtime/subsystems/events/generated/registry.js +1 -1
- package/dist/runtime/subsystems/events/index.d.ts +4 -3
- package/dist/runtime/subsystems/events/index.js +39 -15
- package/dist/runtime/subsystems/index.d.ts +1 -0
- package/dist/runtime/subsystems/index.js +99 -98
- package/dist/runtime/subsystems/integration/build-change-source.js +2 -2
- package/dist/runtime/subsystems/integration/index.js +36 -36
- package/dist/runtime/subsystems/integration/integration.module.js +4 -4
- package/dist/runtime/subsystems/jobs/index.js +23 -23
- package/dist/runtime/subsystems/jobs/job-orchestrator.bullmq-backend.js +3 -3
- package/dist/runtime/subsystems/jobs/job-orchestrator.drizzle-backend.js +3 -3
- package/dist/runtime/subsystems/jobs/job-orchestrator.memory-backend.js +2 -2
- package/dist/runtime/subsystems/jobs/job-worker.js +3 -3
- package/dist/runtime/subsystems/jobs/job-worker.module.js +9 -9
- package/dist/runtime/subsystems/jobs/jobs-domain.module.js +7 -7
- package/dist/runtime/subsystems/observability/index.js +3 -3
- package/dist/runtime/subsystems/observability/observability.module.js +3 -3
- package/dist/runtime/subsystems/observability/observability.service.js +2 -2
- package/dist/runtime/subsystems/storage/index.js +4 -4
- package/dist/runtime/subsystems/storage/storage.module.js +2 -2
- package/dist/src/cli/index.js +38 -15
- package/dist/src/cli/index.js.map +1 -1
- package/dist/src/index.js +12 -12
- package/package.json +1 -1
- package/runtime/subsystems/events/domain-events.schema.ts +16 -0
- package/runtime/subsystems/events/event-bus.drizzle-backend.ts +103 -1
- package/runtime/subsystems/events/event-bus.memory-backend.ts +57 -1
- package/runtime/subsystems/events/event-bus.protocol.ts +47 -0
- package/runtime/subsystems/events/event-scheduler.ts +351 -0
- package/runtime/subsystems/events/events-errors.ts +14 -0
- package/runtime/subsystems/events/events.module.ts +78 -1
- package/runtime/subsystems/events/generated/registry.ts +1 -0
- package/runtime/subsystems/events/index.ts +25 -3
- package/dist/chunk-B34G6PHD.js.map +0 -1
- package/dist/chunk-BGULBWKJ.js.map +0 -1
- package/dist/chunk-F7KN3U6U.js.map +0 -1
- package/dist/chunk-FN2PYDPP.js +0 -1
- package/dist/chunk-OFRRBC7M.js.map +0 -1
- package/dist/chunk-OZEPJGMA.js.map +0 -1
- package/dist/chunk-Z7PQCAVK.js.map +0 -1
- /package/dist/{chunk-7OVCARTQ.js.map → chunk-5RT7JGKT.js.map} +0 -0
- /package/dist/{chunk-AZLUWG5S.js.map → chunk-AJILKWGO.js.map} +0 -0
- /package/dist/{chunk-SNH35CNA.js.map → chunk-AODME4YK.js.map} +0 -0
- /package/dist/{chunk-PKDS6QIJ.js.map → chunk-ATVGYF3D.js.map} +0 -0
- /package/dist/{chunk-4MVGAMUA.js.map → chunk-BK5ICA2F.js.map} +0 -0
- /package/dist/{chunk-2TVVBC53.js.map → chunk-BORNCTH3.js.map} +0 -0
- /package/dist/{chunk-J7JMVS2B.js.map → chunk-CZQUOIDY.js.map} +0 -0
- /package/dist/{chunk-VQOAATIG.js.map → chunk-DUMI2J5M.js.map} +0 -0
- /package/dist/{chunk-XKWOJZZ4.js.map → chunk-E45CSC33.js.map} +0 -0
- /package/dist/{chunk-43SBT72G.js.map → chunk-I6UXRJ3Q.js.map} +0 -0
- /package/dist/{chunk-GM3RMJIJ.js.map → chunk-INO47JXD.js.map} +0 -0
- /package/dist/{chunk-65MO75WM.js.map → chunk-M3TIZGIB.js.map} +0 -0
- /package/dist/{chunk-E6PLM6QG.js.map → chunk-MB5VVG4Z.js.map} +0 -0
- /package/dist/{chunk-K2I6XIK5.js.map → chunk-MVKW2BCR.js.map} +0 -0
- /package/dist/{chunk-VDL5CJ5C.js.map → chunk-P7EZCTIN.js.map} +0 -0
- /package/dist/{chunk-R6F6KFIL.js.map → chunk-SGSWVNNB.js.map} +0 -0
- /package/dist/{chunk-FN2PYDPP.js.map → chunk-SYVZ4MD2.js.map} +0 -0
- /package/dist/{chunk-235ZMMJR.js.map → chunk-SZYZ4SHF.js.map} +0 -0
- /package/dist/{chunk-7LKAMLV4.js.map → chunk-T6SCOJF4.js.map} +0 -0
- /package/dist/{chunk-CLWBNXKF.js.map → chunk-W2UIDI3R.js.map} +0 -0
|
@@ -1,56 +1,56 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BridgeModule
|
|
3
|
-
} from "../../../chunk-
|
|
3
|
+
} from "../../../chunk-AODME4YK.js";
|
|
4
4
|
import "../../../chunk-5A432NZJ.js";
|
|
5
|
-
import {
|
|
6
|
-
BridgeOutboxDrainHook
|
|
7
|
-
} from "../../../chunk-65MO75WM.js";
|
|
8
5
|
import {
|
|
9
6
|
EventFlowService
|
|
10
|
-
} from "../../../chunk-
|
|
7
|
+
} from "../../../chunk-5RT7JGKT.js";
|
|
11
8
|
import {
|
|
12
9
|
BRIDGE_RESERVED_POOLS
|
|
13
10
|
} from "../../../chunk-EDKJU5BO.js";
|
|
11
|
+
import {
|
|
12
|
+
DrizzleBridgeDeliveryRepo
|
|
13
|
+
} from "../../../chunk-MVKW2BCR.js";
|
|
14
|
+
import {
|
|
15
|
+
MemoryBridgeDeliveryRepo
|
|
16
|
+
} from "../../../chunk-4DOJBQTP.js";
|
|
17
|
+
import {
|
|
18
|
+
BridgeOutboxDrainHook
|
|
19
|
+
} from "../../../chunk-M3TIZGIB.js";
|
|
14
20
|
import {
|
|
15
21
|
BRIDGE_DELIVERY_JOB_TYPE,
|
|
16
22
|
BridgeDeliveryHandler
|
|
17
|
-
} from "../../../chunk-
|
|
18
|
-
import {
|
|
19
|
-
DrizzleBridgeDeliveryRepo
|
|
20
|
-
} from "../../../chunk-K2I6XIK5.js";
|
|
23
|
+
} from "../../../chunk-SGSWVNNB.js";
|
|
21
24
|
import {
|
|
22
25
|
assertTenantId
|
|
23
26
|
} from "../../../chunk-6DWFJNIK.js";
|
|
24
27
|
import {
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
bridgeDelivery,
|
|
29
|
+
bridgeDeliveryStatusEnum
|
|
30
|
+
} from "../../../chunk-BORNCTH3.js";
|
|
27
31
|
import {
|
|
28
32
|
BridgeReservedPoolsNotPolledError,
|
|
29
33
|
MissingTenantIdError,
|
|
30
34
|
UniqueConstraintError
|
|
31
35
|
} from "../../../chunk-NXXDZ6ZF.js";
|
|
32
|
-
import
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
} from "../../../chunk-2TVVBC53.js";
|
|
36
|
-
import "../../../chunk-235ZMMJR.js";
|
|
37
|
-
import "../../../chunk-VDL5CJ5C.js";
|
|
38
|
-
import "../../../chunk-AZLUWG5S.js";
|
|
39
|
-
import "../../../chunk-VNBC3VXM.js";
|
|
40
|
-
import "../../../chunk-BHZP6LOV.js";
|
|
36
|
+
import "../../../chunk-SZYZ4SHF.js";
|
|
37
|
+
import "../../../chunk-P7EZCTIN.js";
|
|
38
|
+
import "../../../chunk-AJILKWGO.js";
|
|
41
39
|
import "../../../chunk-DV4RV2DC.js";
|
|
42
|
-
import "../../../chunk-
|
|
43
|
-
import "../../../chunk-
|
|
40
|
+
import "../../../chunk-MB5VVG4Z.js";
|
|
41
|
+
import "../../../chunk-DUMI2J5M.js";
|
|
44
42
|
import "../../../chunk-PNZSGAB2.js";
|
|
43
|
+
import "../../../chunk-VNBC3VXM.js";
|
|
44
|
+
import "../../../chunk-BHZP6LOV.js";
|
|
45
45
|
import "../../../chunk-SNQ3TOWP.js";
|
|
46
46
|
import "../../../chunk-T4BIIU5E.js";
|
|
47
47
|
import "../../../chunk-L3LZWWSX.js";
|
|
48
48
|
import "../../../chunk-I6MVCB5A.js";
|
|
49
49
|
import "../../../chunk-RHVN6NA7.js";
|
|
50
|
-
import "../../../chunk-Q6LRJ4VI.js";
|
|
51
|
-
import "../../../chunk-7P5ODGLA.js";
|
|
52
50
|
import "../../../chunk-ZPL74UQN.js";
|
|
53
|
-
import "../../../chunk-
|
|
51
|
+
import "../../../chunk-7P5ODGLA.js";
|
|
52
|
+
import "../../../chunk-OKXZ63IA.js";
|
|
53
|
+
import "../../../chunk-Q6LRJ4VI.js";
|
|
54
54
|
import {
|
|
55
55
|
BRIDGE_DELIVERY_REPO,
|
|
56
56
|
BRIDGE_MODULE_OPTIONS,
|
|
@@ -59,8 +59,8 @@ import {
|
|
|
59
59
|
BRIDGE_REGISTRY,
|
|
60
60
|
EVENT_FLOW
|
|
61
61
|
} from "../../../chunk-4LH67P4U.js";
|
|
62
|
-
import "../../../chunk-
|
|
63
|
-
import "../../../chunk-
|
|
62
|
+
import "../../../chunk-E2BRT5IB.js";
|
|
63
|
+
import "../../../chunk-H5NH7KPE.js";
|
|
64
64
|
import "../../../chunk-GYGNEQSC.js";
|
|
65
65
|
import "../../../chunk-U64T4YZE.js";
|
|
66
66
|
import "../../../chunk-2E224ZSN.js";
|
|
@@ -1,46 +1,16 @@
|
|
|
1
1
|
import { OnModuleInit, OnModuleDestroy } from '@nestjs/common';
|
|
2
|
-
import { IEventBus, DomainEvent, DrizzleTransaction } from './event-bus.protocol.js';
|
|
2
|
+
import { IEventBus, DomainEvent, DrizzleTransaction, ScheduledEventSpec } from './event-bus.protocol.js';
|
|
3
3
|
import { IEventReadPort, ListEventsQuery, EventPage } from './event-read.protocol.js';
|
|
4
4
|
import { DrizzleClient } from '../../types/drizzle.js';
|
|
5
5
|
import { EventsModuleOptions } from './events.module.js';
|
|
6
6
|
import { IBridgeOutboxDrainHook } from '../bridge/bridge.protocol.js';
|
|
7
7
|
import 'drizzle-orm/node-postgres';
|
|
8
|
+
import './event-scheduler.js';
|
|
8
9
|
import 'drizzle-orm';
|
|
9
10
|
import './event-registry.js';
|
|
10
11
|
import '../bridge/bridge-delivery.schema.js';
|
|
11
12
|
import 'drizzle-orm/pg-core';
|
|
12
13
|
|
|
13
|
-
/**
|
|
14
|
-
* DrizzleEventBus — Postgres-backed event bus using the transactional outbox pattern.
|
|
15
|
-
*
|
|
16
|
-
* Events are inserted into the `domain_events` table within the caller's
|
|
17
|
-
* Drizzle transaction. A background polling loop (started on module init)
|
|
18
|
-
* reads unprocessed events and dispatches them to registered subscribers.
|
|
19
|
-
*
|
|
20
|
-
* When the transaction rolls back, the event is never persisted — no
|
|
21
|
-
* phantom events.
|
|
22
|
-
*
|
|
23
|
-
* Pool awareness (EVT-4):
|
|
24
|
-
* - On `publish`/`publishMany` the backend writes `metadata.pool`,
|
|
25
|
-
* `metadata.direction`, and `metadata.tenantId` into the first-class
|
|
26
|
-
* `pool` / `direction` / `tenant_id` columns (metadata JSON is still
|
|
27
|
-
* written unchanged for protocol stability).
|
|
28
|
-
* - The drain loop filters by `opts.pools` when provided, so separate
|
|
29
|
-
* processes (e.g. one per `events_inbound` / `events_change` /
|
|
30
|
-
* `events_outbound`) can claim only their own lane. `pools: undefined`
|
|
31
|
-
* drains all pending rows (backwards-compatible behaviour).
|
|
32
|
-
*
|
|
33
|
-
* EVT-Q7: No stale-event sweeper. `FOR UPDATE SKIP LOCKED` is
|
|
34
|
-
* self-healing — the row is only locked for the duration of the
|
|
35
|
-
* enclosing polling transaction; the `status='processed'` update happens
|
|
36
|
-
* within that same transaction. There is no `claimed_at` semantic (unlike
|
|
37
|
-
* jobs), so no stale rows can exist.
|
|
38
|
-
*
|
|
39
|
-
* This backend is suitable until you need real-time fan-out or very high
|
|
40
|
-
* throughput. At that point, swap the backend for Redis Streams or similar
|
|
41
|
-
* via EventsModule.forRoot({ backend: '...' }) without touching use cases.
|
|
42
|
-
*/
|
|
43
|
-
|
|
44
14
|
declare class DrizzleEventBus implements IEventBus, IEventReadPort, OnModuleInit, OnModuleDestroy {
|
|
45
15
|
private readonly db;
|
|
46
16
|
/**
|
|
@@ -99,6 +69,23 @@ declare class DrizzleEventBus implements IEventBus, IEventReadPort, OnModuleInit
|
|
|
99
69
|
private emitWakeNotify;
|
|
100
70
|
findById(eventId: string): Promise<DomainEvent | null>;
|
|
101
71
|
subscribe<T extends DomainEvent = DomainEvent>(eventType: string, handler: (event: T) => Promise<void>): () => void;
|
|
72
|
+
/**
|
|
73
|
+
* Insert one scheduled tick event idempotently. The slot key is stamped onto
|
|
74
|
+
* `metadata.scheduleSlot`; `ON CONFLICT DO NOTHING` against the partial UNIQUE
|
|
75
|
+
* expression index `idx_domain_events_schedule_slot` makes a duplicate insert
|
|
76
|
+
* a no-op — the DB constraint is the exactly-one-event-per-slot invariant.
|
|
77
|
+
*
|
|
78
|
+
* Reuses the standard outbox row shape (pool/direction/metadata) so the
|
|
79
|
+
* existing drain carries the tick like any other event. A LISTEN/NOTIFY wake
|
|
80
|
+
* fires for an immediately-due tick (boot/catch-up rows whose slot is already
|
|
81
|
+
* in the past); a future slot is claimed by polling once `occurred_at` passes.
|
|
82
|
+
*/
|
|
83
|
+
materializeScheduledEvent(spec: ScheduledEventSpec): Promise<{
|
|
84
|
+
created: boolean;
|
|
85
|
+
}>;
|
|
86
|
+
/** Most recent scheduled tick's `occurred_at` (epoch ms) for `type`, or null.
|
|
87
|
+
* Read by the scheduler's catch-up backfill. */
|
|
88
|
+
lastScheduledSlotMs(type: string): Promise<number | null>;
|
|
102
89
|
listEvents(query?: ListEventsQuery): Promise<EventPage>;
|
|
103
90
|
/**
|
|
104
91
|
* Test-only hook. Runs exactly one drain cycle and returns. Production
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DrizzleEventBus
|
|
3
|
-
} from "../../../chunk-
|
|
4
|
-
import "../../../chunk-UQ5EHOH2.js";
|
|
3
|
+
} from "../../../chunk-HCAKMT64.js";
|
|
5
4
|
import "../../../chunk-Q6LRJ4VI.js";
|
|
6
|
-
import "../../../chunk-H5NH7KPE.js";
|
|
7
5
|
import "../../../chunk-4LH67P4U.js";
|
|
8
|
-
import "../../../chunk-
|
|
6
|
+
import "../../../chunk-E2BRT5IB.js";
|
|
7
|
+
import "../../../chunk-H5NH7KPE.js";
|
|
8
|
+
import "../../../chunk-UQ5EHOH2.js";
|
|
9
9
|
import "../../../chunk-GYGNEQSC.js";
|
|
10
10
|
import "../../../chunk-U64T4YZE.js";
|
|
11
11
|
import "../../../chunk-2E224ZSN.js";
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { IEventBus, DomainEvent } from './event-bus.protocol.js';
|
|
1
|
+
import { IEventBus, DomainEvent, ScheduledEventSpec } from './event-bus.protocol.js';
|
|
2
2
|
import { IEventReadPort, ListEventsQuery, EventPage } from './event-read.protocol.js';
|
|
3
3
|
import { EventsModuleOptions } from './events.module.js';
|
|
4
4
|
import '../../types/drizzle.js';
|
|
5
5
|
import 'drizzle-orm/node-postgres';
|
|
6
6
|
import '@nestjs/common';
|
|
7
|
+
import './event-scheduler.js';
|
|
7
8
|
|
|
8
9
|
declare class MemoryEventBus implements IEventBus, IEventReadPort {
|
|
9
10
|
private readonly logger;
|
|
@@ -15,6 +16,22 @@ declare class MemoryEventBus implements IEventBus, IEventReadPort {
|
|
|
15
16
|
publish(event: DomainEvent): Promise<void>;
|
|
16
17
|
publishMany(events: DomainEvent[]): Promise<void>;
|
|
17
18
|
findById(eventId: string): Promise<DomainEvent | null>;
|
|
19
|
+
/** Slot keys already materialised — the in-memory mirror of the partial
|
|
20
|
+
* UNIQUE expression index `idx_domain_events_schedule_slot`. */
|
|
21
|
+
private readonly materialisedSlots;
|
|
22
|
+
/**
|
|
23
|
+
* Mirror of the Drizzle `ON CONFLICT DO NOTHING` insert: emit one payload-free
|
|
24
|
+
* tick event per slot key, no-op if the slot was already materialised. The
|
|
25
|
+
* "constraint" is the `materialisedSlots` set. The tick is published through
|
|
26
|
+
* the normal `publish` path so subscribers fire synchronously (the memory bus
|
|
27
|
+
* has no future-slot/poll concept — a materialised slot dispatches now, which
|
|
28
|
+
* is the behaviour the unit suite pins).
|
|
29
|
+
*/
|
|
30
|
+
materializeScheduledEvent(spec: ScheduledEventSpec): Promise<{
|
|
31
|
+
created: boolean;
|
|
32
|
+
}>;
|
|
33
|
+
/** Most recent scheduled tick's `occurred_at` (epoch ms) for `type`, or null. */
|
|
34
|
+
lastScheduledSlotMs(type: string): Promise<number | null>;
|
|
18
35
|
subscribe<T extends DomainEvent = DomainEvent>(eventType: string, handler: (event: T) => Promise<void>): () => void;
|
|
19
36
|
listEvents(query?: ListEventsQuery): Promise<EventPage>;
|
|
20
37
|
/** Remove all published events and subscriptions. Useful in beforeEach. */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MemoryEventBus
|
|
3
|
-
} from "../../../chunk-
|
|
4
|
-
import "../../../chunk-UQ5EHOH2.js";
|
|
3
|
+
} from "../../../chunk-4OC5MSHO.js";
|
|
5
4
|
import "../../../chunk-H5NH7KPE.js";
|
|
5
|
+
import "../../../chunk-UQ5EHOH2.js";
|
|
6
6
|
import "../../../chunk-GYGNEQSC.js";
|
|
7
7
|
import "../../../chunk-2E224ZSN.js";
|
|
8
8
|
export {
|
|
@@ -65,6 +65,50 @@ interface IEventBus {
|
|
|
65
65
|
* of Redis backend is unsupported.
|
|
66
66
|
*/
|
|
67
67
|
findById(eventId: string): Promise<DomainEvent | null>;
|
|
68
|
+
/**
|
|
69
|
+
* Materialise exactly one scheduled tick event (ADR-039 — time as an event
|
|
70
|
+
* source). Called by the framework `EventScheduler` on its boot + tick passes.
|
|
71
|
+
*
|
|
72
|
+
* The `slotKey` (`@schedule/<type>/<slotStartMs>`) is a pure function of
|
|
73
|
+
* (type, slot) — every instance computes the same key — and is stamped onto
|
|
74
|
+
* `metadata.scheduleSlot` (+ `metadata.triggerSource='schedule'`). The insert
|
|
75
|
+
* is deterministic and idempotent:
|
|
76
|
+
* - Drizzle: `INSERT … ON CONFLICT DO NOTHING` against the partial UNIQUE
|
|
77
|
+
* expression index on `(type, metadata->>'scheduleSlot')`. The DB
|
|
78
|
+
* constraint — not a read, not a lock — is the exactly-one-event-per-slot
|
|
79
|
+
* invariant across multi-instance deploys and boot/tick races.
|
|
80
|
+
* - Memory: a slot-key marker set mirrors the constraint.
|
|
81
|
+
*
|
|
82
|
+
* Returns `created: false` when the slot event already existed (the no-op
|
|
83
|
+
* case). Optional on the protocol — only the scheduler calls it, and the
|
|
84
|
+
* Redis backend (no outbox history) does not implement it (the scheduler is
|
|
85
|
+
* drizzle/memory only).
|
|
86
|
+
*/
|
|
87
|
+
materializeScheduledEvent?(spec: ScheduledEventSpec): Promise<{
|
|
88
|
+
created: boolean;
|
|
89
|
+
}>;
|
|
90
|
+
/**
|
|
91
|
+
* Optional (ADR-039) — `occurred_at` (epoch ms) of the most recent scheduled
|
|
92
|
+
* tick for `type`, or `null`. Read by the scheduler's catch-up backfill as
|
|
93
|
+
* `MAX(occurred_at) WHERE type=? AND metadata->>'triggerSource'='schedule'`.
|
|
94
|
+
*/
|
|
95
|
+
lastScheduledSlotMs?(type: string): Promise<number | null>;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* The fully-resolved shape the scheduler hands a backend to materialise one
|
|
99
|
+
* tick. Carries the routing fields the outbox row needs (direction/pool from
|
|
100
|
+
* the event's registry metadata) plus the slot key + boundary.
|
|
101
|
+
*/
|
|
102
|
+
interface ScheduledEventSpec {
|
|
103
|
+
type: string;
|
|
104
|
+
/** `@schedule/<type>/<slotStartMs>` — the idempotency key. */
|
|
105
|
+
slotKey: string;
|
|
106
|
+
/** Slot boundary → the event's `occurred_at`. */
|
|
107
|
+
slotStart: Date;
|
|
108
|
+
/** `inbound | change | outbound` from the event's registry metadata. */
|
|
109
|
+
direction: string;
|
|
110
|
+
/** `events_inbound | events_change | events_outbound` from the registry. */
|
|
111
|
+
pool: string;
|
|
68
112
|
}
|
|
69
113
|
|
|
70
|
-
export type { DomainEvent, DrizzleTransaction, IEventBus };
|
|
114
|
+
export type { DomainEvent, DrizzleTransaction, IEventBus, ScheduledEventSpec };
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { IEventBus } from './event-bus.protocol.js';
|
|
2
|
+
import '../../types/drizzle.js';
|
|
3
|
+
import 'drizzle-orm/node-postgres';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Parse a `schedule.every` into milliseconds. Accepts a positive number (ms) or
|
|
7
|
+
* a duration string `<number><unit>` (unit ∈ ms|s|m|h|d; decimals allowed).
|
|
8
|
+
* Throws `ScheduleConfigError` synchronously on anything unparseable, ≤0, or
|
|
9
|
+
* non-finite — so a bad schedule surfaces at boot before the tick loop starts.
|
|
10
|
+
*/
|
|
11
|
+
declare function parseEvery(every: string | number, eventType?: string): number;
|
|
12
|
+
/**
|
|
13
|
+
* The start of the slot containing `atMs`, for a schedule of `everyMs`.
|
|
14
|
+
* - `align: true` (default) — epoch-anchored: `floor(at / every) * every`.
|
|
15
|
+
* - `align: false` — anchored to `anchorMs` (the scheduler's first-run time).
|
|
16
|
+
*/
|
|
17
|
+
declare function slotStartFor(atMs: number, everyMs: number, align: boolean, anchorMs: number): number;
|
|
18
|
+
/** The start of the slot AFTER the one containing `atMs`. */
|
|
19
|
+
declare function nextSlotStart(atMs: number, everyMs: number, align: boolean, anchorMs: number): number;
|
|
20
|
+
/** Prefix every scheduler-materialised `metadata.scheduleSlot` carries — the
|
|
21
|
+
* partial UNIQUE index is scoped to non-null slot keys; this prefix keeps the
|
|
22
|
+
* key namespace unambiguous and greppable. */
|
|
23
|
+
declare const SCHEDULE_KEY_PREFIX = "@schedule/";
|
|
24
|
+
/** Deterministic slot key. Pure function of (type, slotStart) — every instance
|
|
25
|
+
* computes the same value, which is what makes the idempotent insert
|
|
26
|
+
* exactly-once. */
|
|
27
|
+
declare function slotKeyFor(type: string, slotStartMs: number): string;
|
|
28
|
+
/** Below this floor (== the default outbox poll interval) materialise/drain
|
|
29
|
+
* latency dominates the cadence; allowed but warned once at boot. */
|
|
30
|
+
declare const SCHEDULE_FLOOR_MS = 1000;
|
|
31
|
+
/** One scheduled event the scheduler will materialise. Built from the generated
|
|
32
|
+
* event registry (`schedule` block + direction/pool routing metadata). */
|
|
33
|
+
interface ScheduledEvent {
|
|
34
|
+
type: string;
|
|
35
|
+
everyMs: number;
|
|
36
|
+
align: boolean;
|
|
37
|
+
catchUp: boolean;
|
|
38
|
+
maxCatchUpSlots: number;
|
|
39
|
+
/** Routing — from the event's registry metadata (a scheduled event is
|
|
40
|
+
* domain-tier, so both are always present). */
|
|
41
|
+
direction: string;
|
|
42
|
+
pool: string;
|
|
43
|
+
}
|
|
44
|
+
/** The raw `schedule` block as it appears in the generated registry entry. */
|
|
45
|
+
interface RegistrySchedule {
|
|
46
|
+
every: string | number;
|
|
47
|
+
align?: boolean;
|
|
48
|
+
catchUp?: boolean;
|
|
49
|
+
maxCatchUpSlots?: number;
|
|
50
|
+
}
|
|
51
|
+
/** Validate + normalise one registry entry's `schedule` into a `ScheduledEvent`.
|
|
52
|
+
* Throws `ScheduleConfigError` on a malformed `every` (boot backstop — codegen
|
|
53
|
+
* already validated, this catches hand-edits / version skew). */
|
|
54
|
+
declare function resolveScheduledEvent(type: string, schedule: RegistrySchedule, direction: string | null, pool: string | null): ScheduledEvent;
|
|
55
|
+
/**
|
|
56
|
+
* Read the scheduled-event set from a generated `eventRegistry`. The registry
|
|
57
|
+
* value shape is structural (`{ schedule?, direction, pool }`) so this stays
|
|
58
|
+
* decoupled from the generated `EventMetadata` type. Returns `[]` when nothing
|
|
59
|
+
* declared `schedule:`.
|
|
60
|
+
*/
|
|
61
|
+
declare function scheduledEventsFromRegistry(registry: Record<string, {
|
|
62
|
+
schedule?: RegistrySchedule;
|
|
63
|
+
direction: string | null;
|
|
64
|
+
pool: string | null;
|
|
65
|
+
}>): ScheduledEvent[];
|
|
66
|
+
interface EventSchedulerOptions {
|
|
67
|
+
/** Tick cadence (ms). Default = smallest scheduled `every`, floored. Test override. */
|
|
68
|
+
tickIntervalMs?: number;
|
|
69
|
+
/** Injectable clock for deterministic tests. Default `Date.now`. */
|
|
70
|
+
now?: () => number;
|
|
71
|
+
}
|
|
72
|
+
declare class EventScheduler {
|
|
73
|
+
private readonly bus;
|
|
74
|
+
private readonly schedules;
|
|
75
|
+
private readonly logger;
|
|
76
|
+
private readonly now;
|
|
77
|
+
private timer;
|
|
78
|
+
private readonly anchorMs;
|
|
79
|
+
private readonly tickIntervalMs;
|
|
80
|
+
constructor(bus: IEventBus, schedules: ReadonlyArray<ScheduledEvent>, opts?: EventSchedulerOptions);
|
|
81
|
+
/** Reconcile-on-boot, then start the tick interval. Idempotent. */
|
|
82
|
+
start(): Promise<void>;
|
|
83
|
+
/** Stop the tick interval. Idempotent. */
|
|
84
|
+
stop(): void;
|
|
85
|
+
/** Boot pass — materialise the current slot (or bounded backfill) per event. */
|
|
86
|
+
materializeBoot(): Promise<void>;
|
|
87
|
+
/** Tick pass — materialise the current + next slot per event (current covers a
|
|
88
|
+
* tick landing in a fresh slot the boot pass missed). */
|
|
89
|
+
materializeTick(): Promise<void>;
|
|
90
|
+
private materializeOne;
|
|
91
|
+
/** Backfill missed slots from the last emitted slot to the current one,
|
|
92
|
+
* bounded by `maxCatchUpSlots`. */
|
|
93
|
+
private backfill;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export { EventScheduler, type EventSchedulerOptions, type RegistrySchedule, SCHEDULE_FLOOR_MS, SCHEDULE_KEY_PREFIX, type ScheduledEvent, nextSlotStart, parseEvery, resolveScheduledEvent, scheduledEventsFromRegistry, slotKeyFor, slotStartFor };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EventScheduler,
|
|
3
|
+
SCHEDULE_FLOOR_MS,
|
|
4
|
+
SCHEDULE_KEY_PREFIX,
|
|
5
|
+
nextSlotStart,
|
|
6
|
+
parseEvery,
|
|
7
|
+
resolveScheduledEvent,
|
|
8
|
+
scheduledEventsFromRegistry,
|
|
9
|
+
slotKeyFor,
|
|
10
|
+
slotStartFor
|
|
11
|
+
} from "../../../chunk-DUUCU77W.js";
|
|
12
|
+
import "../../../chunk-DUBZOXJC.js";
|
|
13
|
+
import "../../../chunk-2E224ZSN.js";
|
|
14
|
+
export {
|
|
15
|
+
EventScheduler,
|
|
16
|
+
SCHEDULE_FLOOR_MS,
|
|
17
|
+
SCHEDULE_KEY_PREFIX,
|
|
18
|
+
nextSlotStart,
|
|
19
|
+
parseEvery,
|
|
20
|
+
resolveScheduledEvent,
|
|
21
|
+
scheduledEventsFromRegistry,
|
|
22
|
+
slotKeyFor,
|
|
23
|
+
slotStartFor
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=event-scheduler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -21,5 +21,16 @@ declare class MissingTenantIdError extends Error {
|
|
|
21
21
|
readonly name = "MissingTenantIdError";
|
|
22
22
|
constructor(eventType: string);
|
|
23
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Thrown (ADR-039) when a scheduled event's `schedule` config is invalid at
|
|
26
|
+
* runtime — a malformed `schedule.every` duration, or a scheduled event with no
|
|
27
|
+
* direction/pool to route by. Codegen validates `schedule` at `gen-all` time;
|
|
28
|
+
* this is the boot backstop for a hand-edited registry or version skew. Raised
|
|
29
|
+
* by `EventScheduler` construction / `parseEvery`.
|
|
30
|
+
*/
|
|
31
|
+
declare class ScheduleConfigError extends Error {
|
|
32
|
+
readonly name = "ScheduleConfigError";
|
|
33
|
+
constructor(message: string);
|
|
34
|
+
}
|
|
24
35
|
|
|
25
|
-
export { MissingTenantIdError };
|
|
36
|
+
export { MissingTenantIdError, ScheduleConfigError };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
MissingTenantIdError
|
|
3
|
-
|
|
2
|
+
MissingTenantIdError,
|
|
3
|
+
ScheduleConfigError
|
|
4
|
+
} from "../../../chunk-DUBZOXJC.js";
|
|
4
5
|
import "../../../chunk-2E224ZSN.js";
|
|
5
6
|
export {
|
|
6
|
-
MissingTenantIdError
|
|
7
|
+
MissingTenantIdError,
|
|
8
|
+
ScheduleConfigError
|
|
7
9
|
};
|
|
8
10
|
//# sourceMappingURL=events-errors.js.map
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import { Type, DynamicModule } from '@nestjs/common';
|
|
1
|
+
import { Type, OnModuleInit, OnModuleDestroy, DynamicModule } from '@nestjs/common';
|
|
2
|
+
import { IEventBus } from './event-bus.protocol.js';
|
|
3
|
+
import { RegistrySchedule } from './event-scheduler.js';
|
|
4
|
+
import '../../types/drizzle.js';
|
|
5
|
+
import 'drizzle-orm/node-postgres';
|
|
2
6
|
|
|
3
7
|
/**
|
|
4
8
|
* EventsModule — DynamicModule factory for the event bus subsystem.
|
|
@@ -120,6 +124,41 @@ interface EventsModuleOptions {
|
|
|
120
124
|
* keeps the bundled bus.
|
|
121
125
|
*/
|
|
122
126
|
typedBus?: Type<unknown>;
|
|
127
|
+
/**
|
|
128
|
+
* ADR-039 — the consumer's generated `eventRegistry`, threaded so the
|
|
129
|
+
* `EventScheduler` can read the `schedule:` block + routing metadata of every
|
|
130
|
+
* scheduled event. Package mode: the generated subsystem barrel passes the
|
|
131
|
+
* consumer's `eventRegistry` (the bundled one is the package's empty/fixture
|
|
132
|
+
* registry, which the package can't see the consumer's events through — same
|
|
133
|
+
* reason `typedBus` is threaded). Omitted ⇒ no scheduler is spawned (vendored
|
|
134
|
+
* tree reads its own bundled registry only if the barrel passes it; tests
|
|
135
|
+
* pass a registry directly).
|
|
136
|
+
*
|
|
137
|
+
* Structural shape: each value needs `schedule?` + `direction` + `pool`. The
|
|
138
|
+
* generated `EventMetadata` satisfies it; typing it loosely here avoids a
|
|
139
|
+
* runtime dependency on the generated types from the module file.
|
|
140
|
+
*/
|
|
141
|
+
eventRegistry?: Record<string, {
|
|
142
|
+
schedule?: RegistrySchedule;
|
|
143
|
+
direction: string | null;
|
|
144
|
+
pool: string | null;
|
|
145
|
+
}>;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Lifecycle holder for the `EventScheduler` (ADR-039). Registered as a provider
|
|
149
|
+
* on the drizzle/memory `forRoot` branches; Nest drives `onModuleInit` (after
|
|
150
|
+
* the bus is constructed) and `onModuleDestroy`. Reads the scheduled-event set
|
|
151
|
+
* from the threaded `eventRegistry` and starts the materialiser. No-op when
|
|
152
|
+
* nothing declared `schedule:`, or under the redis backend (no outbox history).
|
|
153
|
+
*/
|
|
154
|
+
declare class EventSchedulerLifecycle implements OnModuleInit, OnModuleDestroy {
|
|
155
|
+
private readonly bus;
|
|
156
|
+
private readonly opts;
|
|
157
|
+
private readonly logger;
|
|
158
|
+
private scheduler;
|
|
159
|
+
constructor(bus: IEventBus, opts?: EventsModuleOptions | null);
|
|
160
|
+
onModuleInit(): Promise<void>;
|
|
161
|
+
onModuleDestroy(): Promise<void>;
|
|
123
162
|
}
|
|
124
163
|
interface EventsModuleAsyncOptions {
|
|
125
164
|
useFactory: (...args: unknown[]) => Promise<EventsModuleOptions> | EventsModuleOptions;
|
|
@@ -131,4 +170,4 @@ declare class EventsModule {
|
|
|
131
170
|
static forRoot(options?: EventsModuleOptions): DynamicModule;
|
|
132
171
|
}
|
|
133
172
|
|
|
134
|
-
export { EventsModule, type EventsModuleAsyncOptions, type EventsModuleOptions };
|
|
173
|
+
export { EventSchedulerLifecycle, EventsModule, type EventsModuleAsyncOptions, type EventsModuleOptions };
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
|
+
EventSchedulerLifecycle,
|
|
2
3
|
EventsModule
|
|
3
|
-
} from "../../../chunk-
|
|
4
|
-
import "../../../chunk-
|
|
5
|
-
import "../../../chunk-
|
|
4
|
+
} from "../../../chunk-VOYFPR3S.js";
|
|
5
|
+
import "../../../chunk-INO47JXD.js";
|
|
6
|
+
import "../../../chunk-JOBQ6RUU.js";
|
|
6
7
|
import "../../../chunk-JRQO2IOF.js";
|
|
7
|
-
import "../../../chunk-
|
|
8
|
-
import "../../../chunk-
|
|
9
|
-
import "../../../chunk-
|
|
10
|
-
import "../../../chunk-UQ5EHOH2.js";
|
|
8
|
+
import "../../../chunk-DUUCU77W.js";
|
|
9
|
+
import "../../../chunk-DUBZOXJC.js";
|
|
10
|
+
import "../../../chunk-HCAKMT64.js";
|
|
11
11
|
import "../../../chunk-Q6LRJ4VI.js";
|
|
12
|
-
import "../../../chunk-H5NH7KPE.js";
|
|
13
12
|
import "../../../chunk-4LH67P4U.js";
|
|
14
|
-
import "../../../chunk-
|
|
13
|
+
import "../../../chunk-E2BRT5IB.js";
|
|
14
|
+
import "../../../chunk-4OC5MSHO.js";
|
|
15
|
+
import "../../../chunk-H5NH7KPE.js";
|
|
16
|
+
import "../../../chunk-UQ5EHOH2.js";
|
|
15
17
|
import "../../../chunk-GYGNEQSC.js";
|
|
16
18
|
import "../../../chunk-U64T4YZE.js";
|
|
17
19
|
import "../../../chunk-2E224ZSN.js";
|
|
18
20
|
export {
|
|
21
|
+
EventSchedulerLifecycle,
|
|
19
22
|
EventsModule
|
|
20
23
|
};
|
|
21
24
|
//# sourceMappingURL=events.module.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TypedEventBus
|
|
3
|
-
} from "../../../../chunk-
|
|
4
|
-
import "../../../../chunk-
|
|
3
|
+
} from "../../../../chunk-INO47JXD.js";
|
|
4
|
+
import "../../../../chunk-JOBQ6RUU.js";
|
|
5
5
|
import "../../../../chunk-JRQO2IOF.js";
|
|
6
|
-
import "../../../../chunk-
|
|
6
|
+
import "../../../../chunk-DUBZOXJC.js";
|
|
7
7
|
import "../../../../chunk-H5NH7KPE.js";
|
|
8
8
|
import "../../../../chunk-GYGNEQSC.js";
|
|
9
9
|
import "../../../../chunk-2E224ZSN.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "../../../../chunk-HUH73XGI.js";
|
|
2
2
|
import {
|
|
3
3
|
TypedEventBus
|
|
4
|
-
} from "../../../../chunk-
|
|
4
|
+
} from "../../../../chunk-INO47JXD.js";
|
|
5
5
|
import {
|
|
6
6
|
eventRegistry,
|
|
7
7
|
getEventMetadata
|
|
8
|
-
} from "../../../../chunk-
|
|
8
|
+
} from "../../../../chunk-JOBQ6RUU.js";
|
|
9
9
|
import {
|
|
10
10
|
contactCreatedPayloadSchema,
|
|
11
11
|
contactMarkedChampionPayloadSchema,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
stripePaymentReceivedPayloadSchema,
|
|
18
18
|
webhookOutboundContactSyncPayloadSchema
|
|
19
19
|
} from "../../../../chunk-JRQO2IOF.js";
|
|
20
|
-
import "../../../../chunk-
|
|
20
|
+
import "../../../../chunk-DUBZOXJC.js";
|
|
21
21
|
import "../../../../chunk-H5NH7KPE.js";
|
|
22
22
|
import "../../../../chunk-GYGNEQSC.js";
|
|
23
23
|
import "../../../../chunk-2E224ZSN.js";
|
|
@@ -16,6 +16,12 @@ interface EventMetadata {
|
|
|
16
16
|
attempts: number;
|
|
17
17
|
backoff: 'linear' | 'exponential';
|
|
18
18
|
};
|
|
19
|
+
schedule?: {
|
|
20
|
+
every: string | number;
|
|
21
|
+
align: boolean;
|
|
22
|
+
catchUp: boolean;
|
|
23
|
+
maxCatchUpSlots: number;
|
|
24
|
+
};
|
|
19
25
|
}
|
|
20
26
|
declare const eventRegistry: {
|
|
21
27
|
readonly contact_created: {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
export { DomainEvent, DrizzleTransaction, IEventBus } from './event-bus.protocol.js';
|
|
1
|
+
export { DomainEvent, DrizzleTransaction, IEventBus, ScheduledEventSpec } from './event-bus.protocol.js';
|
|
2
2
|
export { DomainEventRegistry, EventOfType, EventTypeName } from './event-registry.js';
|
|
3
3
|
export { EventPage, EventSummary, IEventReadPort, ListEventsQuery } from './event-read.protocol.js';
|
|
4
4
|
export { EVENTS_MODULE_OPTIONS, EVENTS_MULTI_TENANT, EVENT_BUS, EVENT_READ_PORT, TYPED_EVENT_BUS } from './events.tokens.js';
|
|
5
5
|
export { TypedEventBus } from './generated/bus.js';
|
|
6
|
-
export { MissingTenantIdError } from './events-errors.js';
|
|
7
|
-
export { EventsModule, EventsModuleOptions } from './events.module.js';
|
|
6
|
+
export { MissingTenantIdError, ScheduleConfigError } from './events-errors.js';
|
|
7
|
+
export { EventSchedulerLifecycle, EventsModule, EventsModuleOptions } from './events.module.js';
|
|
8
|
+
export { EventScheduler, EventSchedulerOptions, RegistrySchedule, SCHEDULE_FLOOR_MS, SCHEDULE_KEY_PREFIX, ScheduledEvent, nextSlotStart, parseEvery, resolveScheduledEvent, scheduledEventsFromRegistry, slotKeyFor, slotStartFor } from './event-scheduler.js';
|
|
8
9
|
export { MemoryEventBus } from './event-bus.memory-backend.js';
|
|
9
10
|
export { DrizzleEventBus } from './event-bus.drizzle-backend.js';
|
|
10
11
|
export { DomainEventRecord, domainEvents } from './domain-events.schema.js';
|