@lssm-tech/module.design-studio
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.
Commandes
bun run test
bun run typecheck
bun run lint:check
bun run build