@abapify/speci
Arrow-function contract DSL. Declarative http.get/post/put/delete/patch
helpers produce plain descriptor objects; createClient turns a contract
tree into a typed client using a pluggable HttpAdapter. No decorators, no
runtime metaprogramming.
Install
bun add @abapify/speci
Public API
// @abapify/speci/rest
import {
http,
createClient,
createFetchAdapter,
type HttpAdapter,
type RestContract,
} from '@abapify/speci/rest';
Core types (Inferrable, ContractOperation, etc.) live in the package
root. Planned submodules: @abapify/speci/openapi, @abapify/speci/cli.
Usage
import { http, createClient, createFetchAdapter } from '@abapify/speci/rest';
const api = {
users: {
get: (id: string) =>
http.get(`/users/${id}`, { responses: { 200: UserSchema } }),
},
};
const client = createClient(api, {
baseUrl: 'https://api.example.com',
adapter: createFetchAdapter(),
});
Dependencies
- Consumed by
adt-contracts,adt-client.