@solomonai/stripe-sync-graphql-sdk 1.17.9 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -24
- package/dist/index.d.mts +680 -1
- package/dist/index.d.ts +680 -1
- package/dist/index.js +199 -0
- package/dist/index.mjs +191 -0
- package/package.json +1 -1
- package/src/__tests__/sdk-operations.test.ts +69 -0
- package/src/hooks.ts +88 -0
- package/src/index.ts +3 -0
- package/src/sdk.ts +151 -0
package/README.md
CHANGED
|
@@ -13,8 +13,7 @@ bun add @solomonai/stripe-sync-graphql-sdk
|
|
|
13
13
|
## Usage
|
|
14
14
|
|
|
15
15
|
```typescript
|
|
16
|
-
import { createClient } from '@solomonai/stripe-sync-graphql-sdk'
|
|
17
|
-
import { gql } from 'graphql-request'
|
|
16
|
+
import { createClient, createSdk } from '@solomonai/stripe-sync-graphql-sdk'
|
|
18
17
|
|
|
19
18
|
// Create client with your API endpoint and credentials
|
|
20
19
|
const client = createClient({
|
|
@@ -25,28 +24,27 @@ const client = createClient({
|
|
|
25
24
|
},
|
|
26
25
|
})
|
|
27
26
|
|
|
28
|
-
//
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
console.log(data.customers)
|
|
27
|
+
// Create typed SDK wrappers for common operations
|
|
28
|
+
const sdk = createSdk(client)
|
|
29
|
+
|
|
30
|
+
const { customers } = await sdk.listCustomers({ first: 10 })
|
|
31
|
+
console.log(customers?.edges?.[0]?.node?.email)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## React Hooks (Adapter-based)
|
|
35
|
+
|
|
36
|
+
The SDK provides hook factories that can be wired to your query library (for example, React Query):
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
import { createSdk, createSdkReactHooks } from '@solomonai/stripe-sync-graphql-sdk'
|
|
40
|
+
import { useQuery, useMutation } from '@tanstack/react-query'
|
|
41
|
+
|
|
42
|
+
const sdk = createSdk(client)
|
|
43
|
+
const hooks = createSdkReactHooks(sdk, { useQuery, useMutation })
|
|
44
|
+
|
|
45
|
+
// inside a React component
|
|
46
|
+
const customerQuery = hooks.useCustomer({ id: 'cus_123' })
|
|
47
|
+
const triggerSync = hooks.useTriggerSync()
|
|
50
48
|
```
|
|
51
49
|
|
|
52
50
|
## Available Types
|