@zephytiju/lattice-common-interfaces
v0.4.0
Published
Generated client library for the Lattice Common bundle's interfaces — typed factories binding Prism micro-UIs to per-method Lattice routes. Emitted deterministically from the compiled Python bundle artifact (artifact.json, LatticeCommonBundle's compile_bu
Downloads
948
Readme
LatticeCommonInterfaces
GENERATED — do not edit. Everything in this package (src/surface.ts, src/types.ts,
src/clients.ts, src/index.ts, this README) is emitted by the deterministic generator
(tools/generate-from-artifact.mjs) from the compiled Python bundle artifact
(github.com/zephytiju/LatticeCommonBundle's
compile_bundle() output, checked in here as artifact.json). Same artifact ⇒ byte-identical
client, payload types, routes, and API-surface digest on every generation; the anti-drift
test (test/generation-drift.test.ts) regenerates in --check mode and fails on any hand edit,
and test/artifact-drift.test.ts re-verifies artifact.json against the Python compiler when
the bundle repo is checked out as a sibling.
This is the client library that powers UI components: Prism micro-UIs import its typed
factories and bind them to the common Lattice transport. Each factory method calls its
per-method route (interfaces/{interfaceId}/{method}) with full server-side validation —
no URLs, credentials, or generic invokes. useLatticeTransport(API_SURFACE_DIGEST) verifies
the digest against the generated runtime on first call so client/runtime drift fails fast
(design record §8 of the
Guanlan Lattice Ontology Design).
Install
Published to npm as @zephytiju/lattice-common-interfaces.
npm install @zephytiju/lattice-common-interfacesPeer dependency: @zephytiju/prism-react — install it alongside; it provides the Lattice
transport hook. The payload types (SearchRequest, EntityResultsProjection, …) are
generated into this package from the artifact, so the deprecated
@zephytiju/lattice-common-bundle package is no longer needed.
Interface clients (20 methods across 14 interfaces)
| Interface | Factory | Method | Route | Idempotent |
| --- | --- | --- | --- | --- |
| ISearchable | createSearchableClient | search | interfaces/ISearchable/search | no |
| IEntitySummary | createEntitySummaryClient | get | interfaces/IEntitySummary/get | no |
| IGeoView | createGeoViewClient | serialize | interfaces/IGeoView/serialize | no |
| IGeoView | createGeoViewClient | restore | interfaces/IGeoView/restore | no |
| IRelatedGraph | createRelatedGraphClient | relate | interfaces/IRelatedGraph/relate | no |
| ITimelineEvent | createTimelineEventClient | timeline | interfaces/ITimelineEvent/timeline | no |
| IGeoLocatable | createGeoLocatableClient | locate | interfaces/IGeoLocatable/locate | no |
| IEvidenceSource | createEvidenceSourceClient | evidence | interfaces/IEvidenceSource/evidence | no |
| IAuditChain | createAuditChainClient | query | interfaces/IAuditChain/query | no |
| IAuditRefAppend | createAuditRefAppendClient | append | interfaces/IAuditRefAppend/append | yes |
| IFileEntry | createFileEntryClient | list | interfaces/IFileEntry/list | no |
| IFileEntry | createFileEntryClient | read | interfaces/IFileEntry/read | no |
| IFileEntry | createFileEntryClient | write | interfaces/IFileEntry/write | yes |
| IDossierDoc | createDossierDocClient | get | interfaces/IDossierDoc/get | no |
| IDossierDoc | createDossierDocClient | appendBlock | interfaces/IDossierDoc/appendBlock | yes |
| ICommentThread | createCommentThreadClient | list | interfaces/ICommentThread/list | no |
| ICommentThread | createCommentThreadClient | post | interfaces/ICommentThread/post | yes |
| IWorkflowDefinition | createWorkflowDefinitionClient | list | interfaces/IWorkflowDefinition/list | no |
| IWorkflowRuntime | createWorkflowRuntimeClient | invoke | interfaces/IWorkflowRuntime/invoke | yes |
| IWorkflowRuntime | createWorkflowRuntimeClient | status | interfaces/IWorkflowRuntime/status | no |
Regenerate
The generation flow is: Python bundle → compile_bundle() → artifact.json →
generate-from-artifact.mjs → this TS client.
# 1. compile the Python bundle (github.com/zephytiju/LatticeCommonBundle) and copy the artifact
cd ../LatticeCommonBundle
python -c "from lattice_common_bundle.compile import write_artifact; write_artifact('../LatticeCommonInterfaces/artifact.json')"
# 2. regenerate every generated file in this repo from the artifact
cd ../LatticeCommonInterfaces
npm run generate # writes src/surface.ts, src/types.ts, src/clients.ts, src/index.ts, README.md
npm run generate -- --check # verify no drift instead of writingnpm run generate resolves the artifact in this order: an explicit --artifact <path> flag,
the sibling Python checkout's ../LatticeCommonBundle/artifact.json, then the checked-in
./artifact.json. The artifact is self-certifying (artifact_digest — sha256 over its
canonical JSON), so the generator fails closed on any hand-edited or stale copy, and it
re-derives api_surface_digest from the embedded method manifest before emitting.
Development (of the generator, not this package)
npm install
npm run typecheck
npm testThe development dependencies install the published @zephytiju/prism-react package from the
npm registry (exact pin in package.json); no local path installs are needed.
