mirror of
https://github.com/hanzo-js/sdk.git
synced 2026-11-09 11:17:16 +00:00
Restructures @hanzo/sdk from a Commerce-only SDK into the canonical
TypeScript client for every Hanzo backend. One install (`npm i @hanzo/sdk`),
typed clients for every service via tree-shakable subpath imports.
Services covered (1:1 with hanzoai/* Go upstreams):
@hanzo/sdk/iam hanzoai/iam OIDC, applications, redirect URIs, users, orgs
@hanzo/sdk/kms hanzoai/kms Secrets get/set/list, envelope encrypt/decrypt
@hanzo/sdk/commerce hanzoai/commerce Existing storefront+admin (preserved, moved under /commerce)
@hanzo/sdk/billing hanzoai/billing Subscriptions, invoices (scaffold)
@hanzo/sdk/mpc hanzoai/mpc Threshold sign CGGMP21/FROST (scaffold)
@hanzo/sdk/paas hanzoai/paas Deployments, environments (scaffold)
@hanzo/sdk/team hanzoai/team Members, invites (scaffold)
@hanzo/sdk/api hanzoai/api Generic gateway passthrough
IAM and KMS are production-grade today (the two surfaces most reached
for in ops). The rest are typed scaffolds that compile + emit .d.ts —
they fill out as each upstream Go service's REST API stabilises.
Architecture:
src/_shared/client.ts BaseClient — one HTTP layer, used by every service
client. Token + fetch + HanzoAPIError surface.
src/<service>/index.ts Service-specific client classes. Public methods
are deliberately named (fetch / list / upsert / remove
/ add) to avoid colliding with BaseClient.get/post.
src/index.ts HanzoSDK umbrella — mounts every service under one
config with per-service base-URL overrides for
envs where services live on different hostnames
(e.g. Liquidity: iam.dev.satschel.com vs
kms.dev.satschel.com vs api.dev.satschel.com).
Top-of-thread motivation: today's Slack thread asking "how do I add a
redirect URI to vcc-exchange-client-id?" The answer used to be "clone
github.com/hanzo-js/iam and call addRedirectUri()". Now it's:
await new IAMClient({ baseUrl, token })
.applications.redirectURIs.add('vcc-exchange-client-id', urls)
Or via the CLI side (liquidityio/cli):
liquid iam redirect add vcc-exchange-client-id <url> [<url> ...]
Both layers (CLI + SDK) call the same upstream IAM admin endpoint
(POST /v1/iam/admin/applications/upsert). One canonical operation,
three surfaces (REST / TS SDK / CLI) — no drift.
Breaking change from v1.x: HanzoSDK.admin / .store / .auth moved
under HanzoSDK.commerce.{admin,store,auth}. Migration is a single
search-replace per consumer; the old surface lives at
@hanzo/sdk/commerce instead of the root if back-compat shims are
needed.
Build: tsup, dual ESM + CJS, splitting on, full .d.ts emit. 11 entry
points × 2 formats × 1 dts pass = 33 build artifacts. Typecheck
clean, build clean.
113 lines
2.9 KiB
JSON
113 lines
2.9 KiB
JSON
{
|
|
"name": "@hanzo/sdk",
|
|
"version": "2.0.0",
|
|
"description": "Unified Hanzo TypeScript SDK — IAM, KMS, Commerce, Billing, MPC, PaaS, Team. One install, every service.",
|
|
"publishConfig": {
|
|
"registry": "https://registry.npmjs.org/",
|
|
"access": "public"
|
|
},
|
|
"main": "dist/index.js",
|
|
"module": "dist/index.mjs",
|
|
"types": "dist/index.d.ts",
|
|
"exports": {
|
|
".": {
|
|
"types": "./dist/index.d.ts",
|
|
"import": "./dist/index.mjs",
|
|
"require": "./dist/index.js"
|
|
},
|
|
"./iam": {
|
|
"types": "./dist/iam/index.d.ts",
|
|
"import": "./dist/iam/index.mjs",
|
|
"require": "./dist/iam/index.js"
|
|
},
|
|
"./kms": {
|
|
"types": "./dist/kms/index.d.ts",
|
|
"import": "./dist/kms/index.mjs",
|
|
"require": "./dist/kms/index.js"
|
|
},
|
|
"./commerce": {
|
|
"types": "./dist/commerce/index.d.ts",
|
|
"import": "./dist/commerce/index.mjs",
|
|
"require": "./dist/commerce/index.js"
|
|
},
|
|
"./commerce/admin": {
|
|
"types": "./dist/commerce/admin/index.d.ts",
|
|
"import": "./dist/commerce/admin/index.mjs",
|
|
"require": "./dist/commerce/admin/index.js"
|
|
},
|
|
"./commerce/store": {
|
|
"types": "./dist/commerce/store/index.d.ts",
|
|
"import": "./dist/commerce/store/index.mjs",
|
|
"require": "./dist/commerce/store/index.js"
|
|
},
|
|
"./commerce/types": {
|
|
"types": "./dist/commerce/types.d.ts",
|
|
"import": "./dist/commerce/types.mjs",
|
|
"require": "./dist/commerce/types.js"
|
|
},
|
|
"./billing": {
|
|
"types": "./dist/billing/index.d.ts",
|
|
"import": "./dist/billing/index.mjs",
|
|
"require": "./dist/billing/index.js"
|
|
},
|
|
"./mpc": {
|
|
"types": "./dist/mpc/index.d.ts",
|
|
"import": "./dist/mpc/index.mjs",
|
|
"require": "./dist/mpc/index.js"
|
|
},
|
|
"./paas": {
|
|
"types": "./dist/paas/index.d.ts",
|
|
"import": "./dist/paas/index.mjs",
|
|
"require": "./dist/paas/index.js"
|
|
},
|
|
"./team": {
|
|
"types": "./dist/team/index.d.ts",
|
|
"import": "./dist/team/index.mjs",
|
|
"require": "./dist/team/index.js"
|
|
},
|
|
"./api": {
|
|
"types": "./dist/api/index.d.ts",
|
|
"import": "./dist/api/index.mjs",
|
|
"require": "./dist/api/index.js"
|
|
}
|
|
},
|
|
"files": [
|
|
"dist",
|
|
"src"
|
|
],
|
|
"scripts": {
|
|
"build": "tsup",
|
|
"dev": "tsup --watch",
|
|
"typecheck": "tsc --noEmit",
|
|
"prepublishOnly": "npm run build"
|
|
},
|
|
"keywords": [
|
|
"hanzo",
|
|
"sdk",
|
|
"iam",
|
|
"kms",
|
|
"commerce",
|
|
"billing",
|
|
"mpc",
|
|
"paas",
|
|
"team",
|
|
"oidc",
|
|
"oauth2",
|
|
"typescript"
|
|
],
|
|
"homepage": "https://github.com/hanzo-js/sdk",
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "git+https://github.com/hanzo-js/sdk.git"
|
|
},
|
|
"bugs": {
|
|
"url": "https://github.com/hanzo-js/sdk/issues"
|
|
},
|
|
"author": "Hanzo AI, Inc. <[email protected]>",
|
|
"license": "BSD-3-Clause",
|
|
"devDependencies": {
|
|
"tsup": "^8.0.0",
|
|
"typescript": "^5.3.0"
|
|
}
|
|
}
|