Skip to main content

Warehousing Module

The warehousing module manages inventory, stock levels, warehousing providers, and tokenized product handling.

Configuration Options

The warehousing module has no configuration options.

Module API

Access via modules.warehousing in the Unchained API context.

Provider Queries

MethodArgumentsDescription
findProvider{ warehousingProviderId }Get a specific provider
findProvidersquery?, options?List warehousing providers
allProvidersGet all active providers (cached)
countquery?Count providers
providerExists{ warehousingProviderId }Check if provider exists

Provider Mutations

MethodArgumentsDescription
createdocCreate a warehousing provider
updatewarehousingProviderId, docUpdate provider
deleteproviderIdDelete provider

Token Operations

For tokenized products (NFTs, digital assets):

MethodArgumentsDescription
findToken{ tokenId }, options?Get a specific token
findTokensselector, options?List tokens
tokensCountselector?Count tokens
findTokensForUser{ userId, limit?, offset? }Get user's tokens
createTokenstokensBatch create tokens
updateTokenOwnershiptokenId, { userId, originalProductId? }Transfer token ownership
invalidateTokentokenIdRevoke a token
buildAccessKeyForTokentokenIdGenerate an access key

Usage

// Create a warehousing provider
await modules.warehousing.create({
adapterKey: 'shop.unchained.warehousing.store',
type: 'PHYSICAL',
configuration: [],
});

// Find tokens for a user
const tokens = await modules.warehousing.findTokensForUser({
userId: 'user-123',
limit: 10,
});

// Transfer token ownership
await modules.warehousing.updateTokenOwnership('token-id', {
userId: 'new-owner-id',
});

Events

EventPayloadDescription
WAREHOUSING_PROVIDER_CREATE{ warehousingProvider }Emitted when a warehousing provider is created
WAREHOUSING_PROVIDER_UPDATE{ warehousingProvider }Emitted when a warehousing provider is updated
WAREHOUSING_PROVIDER_REMOVE{ warehousingProvider }Emitted when a warehousing provider is removed