@openapi-qraft/react 1.0.6 → 1.0.7

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @openapi-qraft/react
2
2
 
3
+ ## 1.0.7
4
+
5
+ ### Patch Changes
6
+
7
+ - bf0c4c7: chore: Add 'use client' to `QraftContext.ts`
8
+ - 26980c7: docs: Update README.md
9
+
3
10
  ## 1.0.6
4
11
 
5
12
  ### Patch Changes
package/README.md CHANGED
@@ -73,7 +73,7 @@ safety and auto-completion features.
73
73
  Now, create the API Client to utilize typed React Hooks for your API endpoints.
74
74
 
75
75
  ```ts
76
- /** '--output-dir' path to your generated services **/
76
+ // where `./api` is the '--output-dir' path to the services you generated
77
77
  import { createAPIClient } from './api';
78
78
 
79
79
  const qraft = createAPIClient();
@@ -92,9 +92,20 @@ Every request will be handled by `requestClient`, which can be customized to fit
92
92
  ```tsx
93
93
  import { useMemo } from 'react';
94
94
 
95
- import { request, bodySerializer, urlSerializer } from '@openapi-qraft/react';
95
+ import {
96
+ request,
97
+ bodySerializer,
98
+ urlSerializer,
99
+ QraftContext,
100
+ } from '@openapi-qraft/react';
96
101
  import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
97
102
 
103
+ // where `./api` is the '--output-dir' path to the services you generated
104
+ import { createAPIClient } from './api';
105
+
106
+ // create a client anywhere
107
+ const qraft = createAPIClient();
108
+
98
109
  function Providers({ children }: { children: React.ReactNode }) {
99
110
  const queryClient = useMemo(() => new QueryClient(), []);
100
111
 
@@ -105,11 +116,9 @@ function Providers({ children }: { children: React.ReactNode }) {
105
116
  /**
106
117
  * Request client will be invoked for every request
107
118
  */
108
- requestClient(schema, options) {
119
+ async requestClient(schema, options) {
109
120
  return request(
110
- {
111
- baseUrl: 'https://api.sandbox.monite.com/v1',
112
- },
121
+ { baseUrl: 'https://api.sandbox.monite.com/v1' },
113
122
  {
114
123
  ...schema,
115
124
  ...options,
@@ -1 +1 @@
1
- {"version":3,"file":"QraftContext.d.ts","sourceRoot":"","sources":["../src/QraftContext.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,MAAM,MAAM,iBAAiB,GACzB;IACE,yFAAyF;IACzF,aAAa,EAAE,aAAa,CAAC;CAC9B,GACD,SAAS,CAAC;AAEd,eAAO,MAAM,YAAY,4CAA8C,CAAC"}
1
+ {"version":3,"file":"QraftContext.d.ts","sourceRoot":"","sources":["../src/QraftContext.ts"],"names":[],"mappings":";AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,MAAM,MAAM,iBAAiB,GACzB;IACE,yFAAyF;IACzF,aAAa,EAAE,aAAa,CAAC;CAC9B,GACD,SAAS,CAAC;AAEd,eAAO,MAAM,YAAY,4CAA8C,CAAC"}
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { createContext } from 'react';
2
3
  export const QraftContext = createContext(undefined);
3
4
  //# sourceMappingURL=QraftContext.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"QraftContext.js","sourceRoot":"","sources":["../src/QraftContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAWtC,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAAoB,SAAS,CAAC,CAAC"}
1
+ {"version":3,"file":"QraftContext.js","sourceRoot":"","sources":["../src/QraftContext.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAWtC,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAAoB,SAAS,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openapi-qraft/react",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "API client for React, providing type-safe requests and dynamic Tanstack Query React Hooks via a modular, Proxy-based architecture.",
5
5
  "scripts": {
6
6
  "build": "rimraf dist/ && tsc --project tsconfig.build.json",
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import { createContext } from 'react';
2
4
 
3
5
  import type { RequestClient } from './RequestClient.js';