Types
Use @bnomei/emdash-mika/types for public DTOs and branded primitives.
This subpath exports commerce DTOs, input/result shapes, branded ID and currency helpers, provider capabilities, error codes, and agent context/proof types.
Storage record types may exist in source, but storage is not a stable public subpath.
Most host integrations need these first:
| Need | Types |
|---|---|
| Product page reads | ContentRefDTO, SellableDTO, PriceDTO, AvailabilityDTO. |
| Form/action results | MikaApiResult, MikaError, MikaErrorCode. |
| Cart and checkout UI | CartDTO, CartLineDTO, CartQuoteDTO, CheckoutSessionDTO, CheckoutPreviewDTO. |
| Account pages | AccountDTO, OrderSummaryDTO, SubscriptionDTO, EntitlementDTO, DownloadDTO. |
| Provider wiring | ProviderName, MikaProviderCapability, ProviderHealthDTO. |
Export Groups
Section titled “Export Groups”| Group | Examples |
|---|---|
| API results and errors | MikaApiResult, MikaError, MikaErrorCode, MIKA_ERROR_CODES, MikaClientEffect. |
| Catalog and stock DTOs | ContentRefDTO, SellableDTO, PriceDTO, AvailabilityDTO, VariantOptionGroupDTO, VariantOptionValueDTO. |
| Cart, wishlist, and checkout DTOs | CartDTO, CartLineDTO, WishlistDTO, CheckoutSessionDTO, CartQuoteDTO, CheckoutPreviewDTO. |
| Account, order, subscription, fulfillment DTOs | AccountDTO, AccountExportDownloadDTO, OrderSummaryDTO, SubscriptionDTO, EntitlementDTO, DownloadDTO, DownloadResolutionDTO. |
| Operation input DTOs | AddCartItemInput, StartCheckoutInput, MagicLinkRequestInput, OrderInvoiceInput, WebhookReceiveInput, admin input types. |
| Provider metadata | MikaProviderCapability, MIKA_PROVIDER_CAPABILITIES, ProviderHealthDTO. |
| Agent contracts | MikaAgentManifest, MikaAgentActionDescriptor, visibility/capability/risk/proof constants and types. |
| Branded primitives | MikaId, ISODateTime, CurrencyCode, ProviderName, JSON types, and domain status enums. |
Branded Primitive Constructors
Section titled “Branded Primitive Constructors”Use constructors when values cross a boundary from strings into Mika domain types:
import { createCurrencyCode, createISODateTime, createMikaId, createProviderName,} from "@bnomei/emdash-mika/types";
const provider = createProviderName("stripe");const currency = createCurrencyCode("USD");const productId = createMikaId("buttonwood-creator-bundle");const now = createISODateTime(new Date().toISOString());Constructor behavior:
createMikaId()trims and rejects empty strings;createISODateTime()validates parseability and canonicalizes to UTCZwith milliseconds;createCurrencyCode()accepts only three uppercase letters;createProviderName()trims and rejects empty strings.
Type guards include isMikaId(), isISODateTime(), isCurrencyCode(),
isProviderName(), isJsonObject(), and isJsonValue().
DTO Boundary
Section titled “DTO Boundary”DTOs describe the public shape returned by Mika operations and plugin routes. They are intentionally smaller and more stable than internal documents. For example:
SellableDTOis the public sellable shape used by catalog reads and product pages;CartDTO,WishlistDTO,CheckoutSessionDTO, andAccountDTOare API responses, not direct storage records;AccountExportDownloadDTOcan represent a pre-consume confirmation state withrequiresConfirmation: trueandconfirmMethod: "POST", or a consumed download result withhref;- admin input/result types describe runner operations, not browser-mutable JSON endpoints.
Use internal document types from src/types/documents.ts only when working
inside the package source or a consciously version-pinned host adapter.
Source Anchors
Section titled “Source Anchors”- ⓟ
../emdash-mika/src/types/index.ts - ⓟ
../emdash-mika/src/types/primitives.ts - ⓟ
../emdash-mika/src/api/types.ts - ⓟ
../emdash-mika/src/api/agent-types.ts