@spoosh/react 0.7.2 → 0.7.3
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/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +8 -8
- package/dist/index.mjs +8 -8
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
|
@@ -370,7 +370,7 @@ type SpooshReactHooks<TDefaultError, TSchema, TPlugins extends PluginArray> = {
|
|
|
370
370
|
* Shape of a Spoosh instance required for creating React hooks.
|
|
371
371
|
*/
|
|
372
372
|
type SpooshInstanceShape<TApi, TSchema, TDefaultError, TPlugins> = {
|
|
373
|
-
/** The API
|
|
373
|
+
/** The API instance */
|
|
374
374
|
api: TApi;
|
|
375
375
|
/** State manager for caching and state */
|
|
376
376
|
stateManager: StateManager;
|
|
@@ -392,7 +392,7 @@ type SpooshInstanceShape<TApi, TSchema, TDefaultError, TPlugins> = {
|
|
|
392
392
|
* @template TSchema - The API schema type
|
|
393
393
|
* @template TDefaultError - The default error type
|
|
394
394
|
* @template TPlugins - The plugins array type
|
|
395
|
-
* @template TApi - The API
|
|
395
|
+
* @template TApi - The API type
|
|
396
396
|
* @param instance - The Spoosh instance containing api, stateManager, eventEmitter, and pluginExecutor
|
|
397
397
|
* @returns An object containing useRead, useWrite, useInfiniteRead hooks and plugin instance APIs
|
|
398
398
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -370,7 +370,7 @@ type SpooshReactHooks<TDefaultError, TSchema, TPlugins extends PluginArray> = {
|
|
|
370
370
|
* Shape of a Spoosh instance required for creating React hooks.
|
|
371
371
|
*/
|
|
372
372
|
type SpooshInstanceShape<TApi, TSchema, TDefaultError, TPlugins> = {
|
|
373
|
-
/** The API
|
|
373
|
+
/** The API instance */
|
|
374
374
|
api: TApi;
|
|
375
375
|
/** State manager for caching and state */
|
|
376
376
|
stateManager: StateManager;
|
|
@@ -392,7 +392,7 @@ type SpooshInstanceShape<TApi, TSchema, TDefaultError, TPlugins> = {
|
|
|
392
392
|
* @template TSchema - The API schema type
|
|
393
393
|
* @template TDefaultError - The default error type
|
|
394
394
|
* @template TPlugins - The plugins array type
|
|
395
|
-
* @template TApi - The API
|
|
395
|
+
* @template TApi - The API type
|
|
396
396
|
* @param instance - The Spoosh instance containing api, stateManager, eventEmitter, and pluginExecutor
|
|
397
397
|
* @returns An object containing useRead, useWrite, useInfiniteRead hooks and plugin instance APIs
|
|
398
398
|
*
|
package/dist/index.js
CHANGED
|
@@ -60,7 +60,7 @@ function createUseRead(options) {
|
|
|
60
60
|
const resolvedPath = (0, import_core.resolvePath)(pathSegments, requestOptions?.params);
|
|
61
61
|
const resolvedTags = (0, import_core.resolveTags)({ tags }, resolvedPath);
|
|
62
62
|
const queryKey = stateManager.createQueryKey({
|
|
63
|
-
path:
|
|
63
|
+
path: capturedCall.path,
|
|
64
64
|
method: capturedCall.method,
|
|
65
65
|
options: capturedCall.options
|
|
66
66
|
});
|
|
@@ -76,7 +76,7 @@ function createUseRead(options) {
|
|
|
76
76
|
if (!controllerRef.current || baseQueryKeyChanged) {
|
|
77
77
|
const controller2 = (0, import_core.createOperationController)({
|
|
78
78
|
operationType: "read",
|
|
79
|
-
path:
|
|
79
|
+
path: capturedCall.path,
|
|
80
80
|
method: capturedCall.method,
|
|
81
81
|
tags: resolvedTags,
|
|
82
82
|
requestOptions: capturedCall.options,
|
|
@@ -195,7 +195,7 @@ function createUseRead(options) {
|
|
|
195
195
|
...overrideOptions
|
|
196
196
|
};
|
|
197
197
|
const newQueryKey = stateManager.createQueryKey({
|
|
198
|
-
path:
|
|
198
|
+
path: capturedCall.path,
|
|
199
199
|
method: capturedCall.method,
|
|
200
200
|
options: mergedOptions
|
|
201
201
|
});
|
|
@@ -207,7 +207,7 @@ function createUseRead(options) {
|
|
|
207
207
|
const newResolvedTags = (0, import_core.resolveTags)({ tags }, newResolvedPath);
|
|
208
208
|
const newController = (0, import_core.createOperationController)({
|
|
209
209
|
operationType: "read",
|
|
210
|
-
path:
|
|
210
|
+
path: capturedCall.path,
|
|
211
211
|
method: capturedCall.method,
|
|
212
212
|
tags: newResolvedTags,
|
|
213
213
|
requestOptions: mergedOptions,
|
|
@@ -316,7 +316,7 @@ function createUseWrite(options) {
|
|
|
316
316
|
}
|
|
317
317
|
const pathSegments = selectedEndpoint.path.split("/").filter(Boolean);
|
|
318
318
|
const queryKey = stateManager.createQueryKey({
|
|
319
|
-
path:
|
|
319
|
+
path: selectedEndpoint.path,
|
|
320
320
|
method: selectedEndpoint.method,
|
|
321
321
|
options: void 0
|
|
322
322
|
});
|
|
@@ -325,7 +325,7 @@ function createUseWrite(options) {
|
|
|
325
325
|
controllerRef.current = {
|
|
326
326
|
controller: (0, import_core2.createOperationController)({
|
|
327
327
|
operationType: "write",
|
|
328
|
-
path:
|
|
328
|
+
path: selectedEndpoint.path,
|
|
329
329
|
method: selectedEndpoint.method,
|
|
330
330
|
tags: [],
|
|
331
331
|
stateManager,
|
|
@@ -464,7 +464,7 @@ function createUseInfiniteRead(options) {
|
|
|
464
464
|
prevPageRequestRef.current = prevPageRequest;
|
|
465
465
|
mergerRef.current = merger;
|
|
466
466
|
const queryKey = stateManager.createQueryKey({
|
|
467
|
-
path:
|
|
467
|
+
path: capturedCall.path,
|
|
468
468
|
method: capturedCall.method,
|
|
469
469
|
options: baseOptionsForKey
|
|
470
470
|
});
|
|
@@ -472,7 +472,7 @@ function createUseInfiniteRead(options) {
|
|
|
472
472
|
if (!controllerRef.current || controllerRef.current.queryKey !== queryKey) {
|
|
473
473
|
controllerRef.current = {
|
|
474
474
|
controller: (0, import_core3.createInfiniteReadController)({
|
|
475
|
-
path:
|
|
475
|
+
path: capturedCall.path,
|
|
476
476
|
method: capturedCall.method,
|
|
477
477
|
tags: resolvedTags,
|
|
478
478
|
initialRequest,
|
package/dist/index.mjs
CHANGED
|
@@ -44,7 +44,7 @@ function createUseRead(options) {
|
|
|
44
44
|
const resolvedPath = resolvePath(pathSegments, requestOptions?.params);
|
|
45
45
|
const resolvedTags = resolveTags({ tags }, resolvedPath);
|
|
46
46
|
const queryKey = stateManager.createQueryKey({
|
|
47
|
-
path:
|
|
47
|
+
path: capturedCall.path,
|
|
48
48
|
method: capturedCall.method,
|
|
49
49
|
options: capturedCall.options
|
|
50
50
|
});
|
|
@@ -60,7 +60,7 @@ function createUseRead(options) {
|
|
|
60
60
|
if (!controllerRef.current || baseQueryKeyChanged) {
|
|
61
61
|
const controller2 = createOperationController({
|
|
62
62
|
operationType: "read",
|
|
63
|
-
path:
|
|
63
|
+
path: capturedCall.path,
|
|
64
64
|
method: capturedCall.method,
|
|
65
65
|
tags: resolvedTags,
|
|
66
66
|
requestOptions: capturedCall.options,
|
|
@@ -179,7 +179,7 @@ function createUseRead(options) {
|
|
|
179
179
|
...overrideOptions
|
|
180
180
|
};
|
|
181
181
|
const newQueryKey = stateManager.createQueryKey({
|
|
182
|
-
path:
|
|
182
|
+
path: capturedCall.path,
|
|
183
183
|
method: capturedCall.method,
|
|
184
184
|
options: mergedOptions
|
|
185
185
|
});
|
|
@@ -191,7 +191,7 @@ function createUseRead(options) {
|
|
|
191
191
|
const newResolvedTags = resolveTags({ tags }, newResolvedPath);
|
|
192
192
|
const newController = createOperationController({
|
|
193
193
|
operationType: "read",
|
|
194
|
-
path:
|
|
194
|
+
path: capturedCall.path,
|
|
195
195
|
method: capturedCall.method,
|
|
196
196
|
tags: newResolvedTags,
|
|
197
197
|
requestOptions: mergedOptions,
|
|
@@ -311,7 +311,7 @@ function createUseWrite(options) {
|
|
|
311
311
|
}
|
|
312
312
|
const pathSegments = selectedEndpoint.path.split("/").filter(Boolean);
|
|
313
313
|
const queryKey = stateManager.createQueryKey({
|
|
314
|
-
path:
|
|
314
|
+
path: selectedEndpoint.path,
|
|
315
315
|
method: selectedEndpoint.method,
|
|
316
316
|
options: void 0
|
|
317
317
|
});
|
|
@@ -320,7 +320,7 @@ function createUseWrite(options) {
|
|
|
320
320
|
controllerRef.current = {
|
|
321
321
|
controller: createOperationController2({
|
|
322
322
|
operationType: "write",
|
|
323
|
-
path:
|
|
323
|
+
path: selectedEndpoint.path,
|
|
324
324
|
method: selectedEndpoint.method,
|
|
325
325
|
tags: [],
|
|
326
326
|
stateManager,
|
|
@@ -470,7 +470,7 @@ function createUseInfiniteRead(options) {
|
|
|
470
470
|
prevPageRequestRef.current = prevPageRequest;
|
|
471
471
|
mergerRef.current = merger;
|
|
472
472
|
const queryKey = stateManager.createQueryKey({
|
|
473
|
-
path:
|
|
473
|
+
path: capturedCall.path,
|
|
474
474
|
method: capturedCall.method,
|
|
475
475
|
options: baseOptionsForKey
|
|
476
476
|
});
|
|
@@ -478,7 +478,7 @@ function createUseInfiniteRead(options) {
|
|
|
478
478
|
if (!controllerRef.current || controllerRef.current.queryKey !== queryKey) {
|
|
479
479
|
controllerRef.current = {
|
|
480
480
|
controller: createInfiniteReadController({
|
|
481
|
-
path:
|
|
481
|
+
path: capturedCall.path,
|
|
482
482
|
method: capturedCall.method,
|
|
483
483
|
tags: resolvedTags,
|
|
484
484
|
initialRequest,
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spoosh/react",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"description": "React hooks for Spoosh API
|
|
5
|
+
"description": "React hooks for Spoosh API toolkit",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"spoosh",
|
|
8
8
|
"react",
|
|
9
9
|
"hooks",
|
|
10
|
-
"api-
|
|
10
|
+
"api-toolkit",
|
|
11
11
|
"useRead",
|
|
12
12
|
"useWrite"
|
|
13
13
|
],
|
|
@@ -34,14 +34,14 @@
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@spoosh/core": ">=0.
|
|
37
|
+
"@spoosh/core": ">=0.11.0",
|
|
38
38
|
"react": "^18 || ^19"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@testing-library/react": "^16.0.0",
|
|
42
42
|
"jsdom": "^26.0.0",
|
|
43
|
-
"@spoosh/core": "0.
|
|
44
|
-
"@spoosh/test-utils": "0.1.
|
|
43
|
+
"@spoosh/core": "0.11.0",
|
|
44
|
+
"@spoosh/test-utils": "0.1.6"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"dev": "tsup --watch",
|