@hoodx/sdk
v0.1.0
Published
TypeScript SDK for the HoodX API
Readme
@hoodx/sdk
Generated TypeScript SDK for the HoodX API. It uses the Fetch API and works with Expo and React Native.
Install
pnpm add @hoodx/sdkExpo authentication
Install expo-secure-store in the Expo app and adapt it to the SDK token store:
import * as SecureStore from "expo-secure-store";
import {
createHoodxClient,
postAuthLogin,
} from "@hoodx/sdk";
const TOKEN_KEY = "hoodx.session";
const client = createHoodxClient({
baseUrl: process.env.EXPO_PUBLIC_HOODX_API_URL!,
sessionTokenStore: {
get: () => SecureStore.getItemAsync(TOKEN_KEY),
set: (token) => SecureStore.setItemAsync(TOKEN_KEY, token),
delete: () => SecureStore.deleteItemAsync(TOKEN_KEY),
},
});
const result = await postAuthLogin({
client,
body: { email, password },
});The client sends X-Session-Token on authenticated requests, stores rotated
tokens, preserves pending authentication sessions, and clears invalid sessions.
Do not store session tokens in AsyncStorage.
Development
openapi.json is exported from the HoodX backend and is the source of truth for
generated files under src/generated/.
pnpm install
pnpm generate
pnpm checkDo not edit src/generated/ manually.
Release
The first release must be published by an npm organization owner because the package does not exist yet:
npm login
npm publish --access public --provenance=falseLocal publishing cannot generate provenance because it does not run under a supported cloud CI identity provider.
After the package exists, configure npm trusted publishing for:
- GitHub organization:
HoodX-Live - Repository:
sdk-ts - Workflow:
.github/workflows/publish.yml - Environment:
npm
Subsequent releases use GitHub Actions:
- Update
versioninpackage.json. - Commit the regenerated SDK and lockfile.
- Push a tag matching the package version:
git tag sdk-v0.1.0
git push origin sdk-v0.1.0The release workflow verifies the version, builds and tests the package, and publishes it to npm with provenance.
