Oss
Supply Chain Management (SCM) modules share a common runtime bootstrap pattern and export loop participant manifests for the Loop Engine graph.
At application startup, call the package configure*Runtime with infrastructure dependencies (getDb, outbox, readChannelMessages).
1import { configureInventoryRuntime } from "@betterdata/scm-inventory";2import type { ChannelReader, OutboxWriter } from "@betterdata/scm-contracts";3 4const outbox: OutboxWriter = {5 async write(entry, tx) {6 /* persist outbox row in same transaction as domain write */7 },8};9 10const readChannelMessages: ChannelReader = async (args) => {11 /* load channel messages for worker consumption */12};13 14configureInventoryRuntime({15 getDb: () => prisma,16 outbox,17 readChannelMessages,18});Other SCM packages expose parallel entry points:
configureProcurementRuntime — @betterdata/scm-procurementconfigureExecutionRuntime — @betterdata/scm-executionCatalog-focused flows use adapter seams documented in each package README.
1import { StockService } from "@betterdata/scm-inventory";2 3const result = await StockService.reserveStock({4 /* domain input — see package types */5});Every SCM module ships a *LoopParticipant manifest typed as LoopParticipantManifest from @betterdata/loop-definitions.
1import { inventoryLoopParticipant } from "@betterdata/scm-inventory";2import { EventNames, LoopIds } from "@betterdata/loop-definitions";3 4"cmt">// inventoryLoopParticipant.moduleId === "scm.inventory"5"cmt">// Example handler binding:6"cmt">// { event: EventNames.EXECUTION_GOODS_RECEIVED, loops: [LoopIds.SCM_PROCUREMENT, LoopIds.SCM_FULFILLMENT] }@betterdata/loop-actors includes validation tests so participants only reference known LoopIds and EventNames.
| Package | What it does |
| ------- | ------------- |
| @betterdata/scm-contracts | Shared types, event envelopes, OutboxWriter, ChannelReader, runtime helpers |
| @betterdata/scm-inventory | Stock, lots, reservations, QOH, availability |
| @betterdata/scm-procurement | PO lifecycle, invoice alignment hooks |
| @betterdata/scm-execution | Shipments, pick/pack/ship/receive |
| @betterdata/scm-catalog | Product masters, marketplace search, normalizers |
Event contracts are centralized in domain contracts.
@betterdata/scm-inventory — StockService, reservation helpers, LotService, inventoryLoopParticipant, configureInventoryRuntime.
@betterdata/scm-catalog — product resolution, marketplace search services, catalogLoopParticipant, adapter interfaces for ranking and trust.
@betterdata/scm-procurement — procurement services, loop-participation / preload-contribution, configureProcurementRuntime.
@betterdata/scm-execution — shipment and warehouse engines, configureExecutionRuntime, execution loop participation.
