Channels
A channel is a sales connection owned by a seller inside a tenant. Secrets live on IntegrationConnection, not on Channel.config.
Responsibilities
- Represent Shopify, WooCommerce, Amazon, Flipkart, BigCommerce, WhatsApp, Meesho, and
CUSTOMconnections.Channel.typeis aString, not a Prisma enum. - Store publish defaults (allocation mode, buffers, fulfillment mode,
manageState). - Record sync runs on
SyncJobLog. - Stop sync when status is
INACTIVEorSUSPENDED.
Architecture
Code map
| Piece | Path |
|---|---|
| Schema | 21-channel.prisma |
| Seller | src/modules/commerce/seller |
| Channel feature | src/modules/commerce/channel |
| Registry | src/integrations/registry |
| Connection vault | src/integrations/connection |
| Auto registration | IntegrationAutoRegistrationService |
Entities: Channel, Seller, WarehouseChannelLocation, ChannelInventoryState, ChannelInventoryFeedSubmission, SyncJobLog, IntegrationRegistry, IntegrationConnection.
Business rules
Implementation behavior
INACTIVEis only for an explicit user update. Automated code must not writeINACTIVEor turn an inactive channel back toACTIVE.SUSPENDEDis for the sync circuit breaker. Both stop sync. OnlyINACTIVEmeans a person turned the channel off.Status
Schema comment. See ADR 0002.
Implementation behavior
5 consecutive non-transient failures of one sync type inside 6 hours set
SUSPENDED. Auth-shaped failures use a threshold of 2 in that window.Status
sync-job.processor.ts. How a human returns the channel toACTIVEis unknown.
Cadence constants: product 6 hours, customer 12 hours, settlement 24 hours. Order interval is tenant-configured. The comment says production uses 5 minutes. That number is not the constant. The storage field and UI control are unknown.
CUSTOM has no marketplace handler. The scheduler skips types with no handler. Whether CUSTOM is a supported selling mode or only a seed placeholder is unknown.
API surface
Channel and channel-admin controllers, plus per-provider controllers under src/integrations/*/controllers. OpenAPI lists the fields.
Events
channel.created and channel.updated are in-process. They are not outbox types. channel.created auto-binds locations. channel.updated is observed by webhook health.
Failure scenarios
Repeated sync failure suspends the channel. Later ticks skip it. Bull still retries the job (3 attempts) before the history accumulates. An unknown channel type logs a warning and is not retried until a handler exists.
Development
Register marketplace classes with the expected names or they will not sync. Keep credentials on the connection vault.