@devxcommerce/knya-types
v0.9.0
Published
Knya BFF response types + Strapi/Shopify codegen output. Consumed by knya-bff (BFF-internal) and knya-mobile (root export only) per ADR-0016.
Readme
@devxcommerce/knya-types
Brand-scoped types package for Knya. Per workshop ADR-0016: three subpath exports.
| Export | Audience | Contents |
|---|---|---|
| . (@devxcommerce/knya-types) | mobile + BFF | Per-route response types under src/routes/ (split by BFF module) + leaf primitives under src/{customer,orders,wishlist,tracking}.ts |
| ./strapi | BFF-internal only | Strapi codegen output (DocumentNodes + types) at src/strapi/generated.ts |
| ./shopify | BFF-internal only | Shopify Storefront + Admin codegen output at src/shopify/{storefront,admin}.ts |
Layout
types/src/
├── index.ts ← root barrel (re-exports everything below)
├── routes/ ← per-BFF-module response types
│ ├── auth.ts ← /v1/auth/*
│ ├── account.ts ← /v1/account/{profile,addresses}/*
│ ├── cart.ts ← /v1/cart/embroidery/upload
│ ├── orders.ts ← /v1/orders/*
│ ├── wishlist.ts ← /v1/wishlist/*
│ ├── pages.ts ← /v1/pages/:handle (C3 — pre-baked, not shipped)
│ ├── collections.ts ← /v1/collections/:handle{,/products} (C4 — pre-baked)
│ └── products.ts ← /v1/products/:handle (C5 — pre-baked)
├── customer.ts ← leaf: CustomerProfile, CustomerAddress, MailingAddressInput
├── orders.ts ← leaf: OrderSummary, OrderDetail, DisplayStatus, Embroidery
├── tracking.ts ← leaf: ClickPostWaybillResult, ClickPostStatusObject
├── wishlist.ts ← leaf: WishlistProductNode
├── strapi/ ← codegen output (BFF-internal subpath)
│ ├── index.ts
│ └── generated.ts
└── shopify/ ← codegen output (BFF-internal subpath)
├── index.ts
├── storefront.ts
└── admin.tsAdding a new route: land the BFF handler at bff/src/modules/<domain>/handlers.ts → add the response type to types/src/routes/<domain>.ts. The barrel re-exports everything in routes/.
Regenerating codegen output
# From the repo root:
bun run codegen # regen from committed SDL snapshots (offline)
bun run codegen:introspect # refresh SDL snapshots from live endpoints (rare)Codegen writes to types/src/strapi/generated.ts, types/src/shopify/storefront.ts, types/src/shopify/admin.ts.
CI drift check: bun run codegen && git diff --quiet runs in the quality job — catches .gql edits that weren't paired with a bun run codegen run before commit (per workshop ADR-0015). Offline; reads only the committed SDL snapshots.
Publishing
@devxcommerce/knya-types is published to GitHub Packages (npm.pkg.github.com) as a private package.
package.json is publish-ready (publishConfig, repository, files whitelist, 0.1.0 version stamped). The actual publish workflow (.github/workflows/release.yml) lands as a separate task — defer until mobile begins consuming the package, since the BFF resolves it via workspace:* in this monorepo and doesn't need a published artifact.
To dry-run a publish locally:
bun --cwd types pack # produces a tarball; inspect contents before publishing