@harborline-software/contracts
v0.1.0-alpha.1
Published
Polyglot schema-first contracts for Shipyard, including generated Carrier and Hull protocol bindings.
Downloads
296
Readme
@harborline-software/contracts
Shared contract package for Shipyard. Existing domain namespaces remain TypeScript compatibility surfaces; the Carrier/Hull boundary is schema-first and generates TypeScript, C#, and Rust bindings.
Namespaces
| Namespace | Types exported | Source of truth |
|-------------|----------------|-----------------|
| property | Property, Unit, OccupancyStatus, RentStatus, RentRollRow | Bridge property endpoints |
| accounting| LedgerEntry, JournalEntry, BankTransaction, PLSummary, PLLineItem, OutstandingInvoice | Bridge accounting endpoints |
| tenant | Tenant, Lease, PaymentRecord, MessageThread | Bridge tenant endpoints |
| sync | SyncStatus, OfflineQueueEntry, ConflictRecord | Offline-first sync layer |
| integrations | IntegrationAtlasView, IntegrationCategory, ... | ADR 0067 |
| system-requirements | SystemRequirementsResult, OverallVerdict, ... | ADR 0063 |
| bundles | BusinessCaseBundleManifest, BundleCategory, BundleStatus, DeploymentMode, ProviderCategory, ProviderRequirement, MinimumSpec | ADR 0007 + A1 |
| protocol | HullPort, CarrierHostPort, CarrierApplicationPort and their DTOs | protocol/manifest.json + JSON Schema 2020-12 |
Carrier and Hull protocol
Import the TypeScript projection from @harborline-software/contracts/protocol. C# consumers reference
Shipyard.Contracts.csproj; Rust consumers depend on rust/Cargo.toml. None of those projections
is canonical—the manifest and schema are.
Change the schema first, regenerate all projections, and run the cross-language fixture suite:
pnpm carrier-contracts:codegen
pnpm carrier-contracts:codegen:check
pnpm carrier-contracts:codegen:testBundle-manifest namespace — drift discipline
The bundles namespace mirrors the C# record
Shipyard.Foundation.Catalog.Bundles.BusinessCaseBundleManifest
(canonical source: packages/foundation-catalog/Bundles/BusinessCaseBundleManifest.cs).
Drift discipline:
- The C# record is canonical. Any field additions, type changes, or removals to the C# record
MUST be reflected in
src/bundles.tsbefore the change ships. - The fixture-roundtrip test at
src/__tests__/bundles.test.tsloads each of the 5 canonical*.bundle.jsonfiles frompackages/foundation-catalog/Manifests/Bundles/and asserts shape conformance against the TypeScript interfaces. This test is the primary CI-time drift detector. - Rust consumers (tender) carry a serde struct mirror in
tender/apps/desktop/src-tauri/src/bundles.rs. Rust drift is caught by that repo'scargo testagainst the same fixture files.
All three mirrors (TypeScript, Rust, C#) must remain in sync. When the C# record changes, update TypeScript here + Rust in tender, and ensure the fixture JSON files are also updated.
Usage
import type { BusinessCaseBundleManifest } from '@harborline-software/contracts'Development
npm run build # compile TypeScript
npm run typecheck # type-check without emit
npm test # run vitest suite (includes bundle fixture-roundtrip)