@pwfabric/contracts
v1.1.0
Published
PWFabric contract definitions and interfaces
Downloads
1,394
Readme
@pwfabric/contracts
The types and schemas every part of PWFabric agrees on: ids, results, versions,
blocks, surfaces, capabilities, events and the pwpack manifest. Everything else
in the engine depends on this package; it depends only on zod.
Install
pnpm add @pwfabric/contracts zod@3ESM only: import it from an ES module ("type": "module" or .mjs). Node 22+. Peer: TypeScript 5.4+.
Main exports
| Export | What it is |
|--------|------------|
| ok, err, isOk, isErr, unwrap, mapResult, … | The Result type every engine call returns |
| surfaceId, capabilityId, artifactId, parseId, isValidId, … | Branded ids |
| parseVersion, compareVersions, isValidVersion | Semver helpers |
| toJsonSchema, validationOk, validationErr | Schema and validation helpers |
| CapabilityBuilder, defineCapability | Declare a capability |
| Block, surface, event and manifest types and schemas | The shapes a pwpack and a pwapp are made of |
Entry points
| Import | Contents |
|--------|----------|
| @pwfabric/contracts | Everything above (the only entry point) |
Licence
Apache-2.0 — see LICENSE. No additional conditions, patent grant included. See licensing.
Part of PWFabric — the engine that renders an app. Source: github.com/pwfabric/pwfabric.
