No description
  • TypeScript 96.8%
  • JavaScript 3.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Errilaz a190a899b0
All checks were successful
Checks / checks (push) Successful in 8s
Mirror to GitHub / mirror (push) Successful in 3s
Checks / release (push) Successful in 7s
chore: sync config
2026-09-14 11:02:03 +02:00
.forgejo/workflows chore: configure CI, release, and project tooling 2026-09-05 19:09:55 +02:00
.husky chore: configure CI, release, and project tooling 2026-09-05 19:09:55 +02:00
src feat: hop 2026-09-05 00:29:51 +02:00
tests feat: hop 2026-09-05 00:29:51 +02:00
.gitignore chore: configure CI, release, and project tooling 2026-09-05 19:09:55 +02:00
bun.lock feat: hop 2026-09-05 00:29:51 +02:00
bunfig.toml chore: configure CI, release, and project tooling 2026-09-05 19:09:55 +02:00
commitlint.config.ts chore: configure CI, release, and project tooling 2026-09-05 19:09:55 +02:00
hop.code-workspace chore: sync config 2026-09-14 11:02:03 +02:00
LICENSE chore: configure CI, release, and project tooling 2026-09-05 19:09:55 +02:00
oxfmt.config.ts chore: configure CI, release, and project tooling 2026-09-05 19:09:55 +02:00
oxlint.config.ts chore: sync config 2026-09-14 11:02:03 +02:00
package.json chore: configure CI, release, and project tooling 2026-09-05 19:09:55 +02:00
README.md chore: make package public 2026-09-05 00:34:51 +02:00
regime.config.json chore: configure CI, release, and project tooling 2026-09-05 19:09:55 +02:00
release.config.cjs chore: configure CI, release, and project tooling 2026-09-05 19:09:55 +02:00
tsconfig.base.json chore: configure CI, release, and project tooling 2026-09-05 19:09:55 +02:00
tsconfig.config.json chore: configure CI, release, and project tooling 2026-09-05 19:09:55 +02:00
tsconfig.json chore: configure CI, release, and project tooling 2026-09-05 19:09:55 +02:00
tsconfig.src.json chore: configure CI, release, and project tooling 2026-09-05 19:09:55 +02:00
tsconfig.test.json chore: configure CI, release, and project tooling 2026-09-05 19:09:55 +02:00

@sigitex/hop

Tiny typed operations over HTTP, using @sigitex/route and Arktype. Stop-gap until more impressive library is finished.

API

import { api, HopError, operation } from "@sigitex/hop/api"
import { prefix } from "@sigitex/route"
import { type } from "arktype"

export const operations = {
  greeting: operation(
    { input: type({ name: "string" }), output: type.string },
    async ({ name }) => `Hello, ${name}.`,
  ),
}

const handler = prefix("/api", api(operations))

Operations without an input accept JSON null on the wire and receive undefined. Operations returning undefined fall through to the next route handler.

Proxy

import { proxy } from "@sigitex/hop/proxy"
import type { operations } from "./operations"

export const api = proxy<typeof operations>("/api")

await api.greeting({ name: "Toad" })

Failed responses throw HopError with the response status and message.