@khalidadil/filebot-contracts (0.2.0)
Installation
@khalidadil:registry=npm install @khalidadil/filebot-contracts@0.2.0"@khalidadil/filebot-contracts": "0.2.0"About this package
@khalidadil/filebot-contracts
The single source of truth every Filebot component shares: TypeBox schemas for the whole /v1 API and the host routes, the error-code and status enums, the policy defaults, the event and webhook shapes, and the generated OpenAPI document. The API, the server SDK, the browser client and the console all import from here so a name is declared exactly once — a name exported by two modules is a build error in this package.
Pure ESM, Node >=20.19. The only runtime dependency is @sinclair/typebox.
Publishes to the private Gitea registry https://git.kadil.dev/api/packages/khalidadil/npm/ (never GitHub), installable with no token.
pnpm add @khalidadil/filebot-contracts
What it exports
- Enums / codes —
ErrorCode,FileStatus,ScanStatus,Visibilityand the terminal-status lists. - Policy defaults —
BUCKET_DEFAULTS({ visibility: "private", preserveQuality: false }) is the one place those defaults live;DEFAULT_SERVINGand the serving caps. - API bodies/responses — TypeBox schemas plus their static types for every
/v1resource: projects, buckets, files, uploads, URLs, QR sessions, event tickets, webhooks, transfers and signing keys (the FR-5 name list the SDKs import). - Events —
WebhookEnvelope,WebhookFileData(with the file's storedmetaandscanStatus),SSE_EVENT_TYPES, thesseScopebuilders andTERMINAL_FILE_STATUSES. - Host routes —
DEFAULT_HOST_MOUNT,HOST_ROUTES,HostErrorCodeand theHost*Body/Host*Responseshapes, so the server router and the browser client exchange host-route JSON without importing each other.
Subpath: the OpenAPI document
The generated OpenAPI 3.1 document ships in the tarball and is importable as a data subpath:
import openapi from "@khalidadil/filebot-contracts/openapi/filebot-v1.json" with { type: "json" };
It is a generated artifact — regenerate it with the repo's scripts/emit-openapi.ts, never hand-edit it. Non-JS hosts (Go, Python, PHP) generate their clients from it and still get scoped tokens and signed URLs.
Testing
pnpm --filter @khalidadil/filebot-contracts test runs the schema/enum unit suite (no services). test/pack.test.ts asserts the published tarball ships dist/**, the OpenAPI document, README.md and package.json only — no src/, tests or fixtures — with @sinclair/typebox as the sole runtime dependency.
Release
Part of the five-package Filebot lockstep set (signing, contracts, server, client, react — one shared version). packages/filebot-server/scripts/lockstep-check.ts verifies the set and prints, but never runs, the publish command; publishing needs the lead's go and Khalid's approval.
Dependencies
Dependencies
| ID | Version |
|---|---|
| @sinclair/typebox | ^0.34.0 |
Development Dependencies
| ID | Version |
|---|---|
| @types/node | ^22.10.0 |
| tsx | ^4.19.2 |
| typescript | ^5.7.0 |