Skip to Content
gentlemans-stack
ReferenceLibs

contract-kit

Browser-safe conventions for authoring concrete service contracts.

API

Use the focused subpath exports: /errors, /mutation-result, /openapi, and /pagination.

  • Error declarations: defineContractErrors, commonContractErrors, authenticationContractErrors, transportContractErrors, rateLimitContractError, resourceConflictContractError, resourceNotFoundContractError.
  • Pagination: createPaginatedResultSchema, paginationInputSchema, pageInfoSchema.
  • Mutation results: createMutationResultSchema.
  • OpenAPI specs: withBearerAuthSpec, withMutationResultSpec, withResponseSchemaSpec, appErrorOpenApiCommonSchemas.
  • Types: ContractErrorDefinition, ContractErrors, OperationSpec, PageInfo, PaginationInput.

Commands

pnpm nx run contract-kit:typecheck   # type-check the package
pnpm nx run contract-kit:test        # run the Vitest suite

On this page