@solomonai/stripe-sync-graphql-sdk
v1.18.3
Published
Type-safe GraphQL SDK for the Stripe Sync Engine API
Maintainers
Readme
@solomonai/stripe-sync-graphql-sdk
Type-safe GraphQL SDK for the Stripe Sync Engine API.
Installation
npm install @solomonai/stripe-sync-graphql-sdk
# or
bun add @solomonai/stripe-sync-graphql-sdkUsage
import { createClient, createSdk } from '@solomonai/stripe-sync-graphql-sdk'
// Create client with your API endpoint and credentials
const client = createClient({
endpoint: 'https://your-api.com/graphql',
headers: {
'x-tenant-id': 'your-tenant-id',
'x-api-key': 'your-api-key',
},
})
// Create typed SDK wrappers for common operations
const sdk = createSdk(client)
const { customers } = await sdk.listCustomers({ first: 10 })
console.log(customers?.edges?.[0]?.node?.email)React Hooks (Adapter-based)
The SDK provides hook factories that can be wired to your query library (for example, React Query):
import { createSdk, createSdkReactHooks } from '@solomonai/stripe-sync-graphql-sdk'
import { useQuery, useMutation } from '@tanstack/react-query'
const sdk = createSdk(client)
const hooks = createSdkReactHooks(sdk, { useQuery, useMutation })
// inside a React component
const customerQuery = hooks.useCustomer({ id: 'cus_123' })
const triggerSync = hooks.useTriggerSync()Available Types
The SDK exports all GraphQL types for type-safe queries:
import type { Customer, Subscription, Invoice } from '@solomonai/stripe-sync-graphql-sdk'Regenerating Types
Types are auto-generated from the GraphQL schema. To regenerate:
cd packages/fastify-app
bun run graphql:generateLicense
MIT
