Skip to content
ContractSpec
Start here

Package manual · platform

·Interfaces, presentations and design

module.design-studio

Tenant-safe design pack selection, drafting, certification, and reusable studio surfaces.

platformmodulev2.0.4experimentalservernode
@lssm-tech/module.design-studio
bun add @lssm-tech/module.design-studio
Package source ↗Manifest ↗

Manifest declarations describe the current workspace; they do not verify registry publication or runtime execution.

Package guide

Reusable, spec-first design selection and publishing workflows for ContractSpec applications.

The core package provides a canonical async DesignAuthoringStorePort service created with createDesignStudioService({ store, clock, ids, certifier }) and an InMemoryDesignAuthoringStore reference adapter. The original synchronous service remains available through createInMemoryDesignStudioService for compatibility. Both paths preserve strict tenant scoping, private user-owned drafts, optimistic revisions, safe patches, permission-gated certification, immutable publications, unpublication receipts, and deterministic fallback metadata. Catalog discovery supports industry and style filters through a contract adapter.

@lssm-tech/module.design-studio/tenant-authoring is the managed tenant authoring profile used behind authenticated HTTP routes: TenantDesignAuthoringService({ storeFor, now?, id? }) merges built-in packs with the tenant's published designs, enforces the tenant selection policy (fixed, allowed, custom-design switch), keeps private-draft selections in sync, and runs create/clone/replace/restore/delete with revision CAS, validation and preview, certification receipts and publish/unpublish. It differs from AsyncDesignStudioService deliberately: patches replace rather than append, drafts start only from built-in packs, publication requires the exact certified receipt and keeps the per-draft ref tenant.<tenant>.design.<draft>@<revision>.0.0, and every reset request is audited. Errors are DesignStudioError codes with stable host-facing messages. InMemoryDesignAuthoringDatabase gives one tenant-guarded InMemoryDesignAuthoringStore per tenant; the reference store lists drafts newest first and, like the SQL adapter, fences updates by owner and returns false for a stale delete.

Presentation exports provide matching web and React Native faceted gallery, picker, structured section controls, editor, diagnostics, responsive preview, history/diff, and publish controls built from design-system primitives. Consumers own persistence adapters, routing, and application-specific previews. The reference API application supplies the production PostgreSQL adapter and authenticated route composition; the reference web and Expo applications mount the paired Studio surfaces against the real authenticated lifecycle.

@lssm-tech/module.design-studio/presentation/design-studio-session is the platform-neutral client session shared by those web and Expo hosts: useDesignStudioSession({ client, onRefresh }) drives select -> draft -> patch -> validate -> certify -> publish/unpublish -> restore over an injected DesignStudioClient transport port and calls onRefresh after every persisted change (the saved patch refreshes before validation, so an invalid draft is still reflected); selecting a pack clears the draft and publication. assertDesignValidation joins patch and certification issues into one error. Hosts keep the transport adapter and the refresh binding.

Commands

  • bun run test
  • bun run typecheck
  • bun run lint:check
  • bun run build

Relationships

THIS PACKAGEmodule.design-studio5 import paths

Arrows point from a package to its direct dependency. Counts are derived from captured workspace manifests.

5 declarations

Declared capabilities

Module Design Studio

Tenant-safe design pack selection, drafting, certification, and reusable studio surfaces.

Scripts

  • publish:pkgbun publish --tolerate-republish --ignore-scripts --verbose
  • publish:pkg:canarybun publish:pkg --tag canary
  • buildcontractspec-bun-build build
  • build:bundlecontractspec-bun-build transpile
  • build:typescontractspec-bun-build types
  • devcontractspec-bun-build dev
  • cleanrimraf dist .turbo
  • lintbun lint:fix
  • lint:fixnode ../../../../scripts/biome.cjs check --write --unsafe --only=nursery/useSortedClasses . && node ../../../../scripts/biome.cjs check --write .
  • lint:checknode ../../../../scripts/biome.cjs check .
  • testbun test
  • prebuildcontractspec-bun-build prebuild
  • typechecktsgo --noEmit