@veams/status-quo-query 0.1.0 → 0.2.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/.turbo/turbo-test.log +2 -2
- package/README.md +6 -6
- package/dist/cache.d.ts +1 -1
- package/dist/cache.js +1 -1
- package/dist/cache.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/provider.d.ts +16 -0
- package/dist/provider.js +17 -0
- package/dist/provider.js.map +1 -0
- package/package.json +5 -5
- package/src/__tests__/{cache.spec.ts → provider.spec.ts} +2 -2
- package/src/index.ts +1 -1
- package/src/{cache.ts → provider.ts} +1 -1
package/.turbo/turbo-test.log
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
> @veams/status-quo-query@0.1.0 test
|
|
3
3
|
> cross-env NODE_ENV=test jest --config jest.config.cjs
|
|
4
4
|
|
|
5
|
-
PASS src/__tests__/
|
|
5
|
+
PASS src/__tests__/provider.spec.ts
|
|
6
6
|
PASS src/__tests__/mutation.spec.ts
|
|
7
7
|
PASS src/__tests__/query.spec.ts
|
|
8
8
|
|
|
9
9
|
Test Suites: 3 passed, 3 total
|
|
10
10
|
Tests: 7 passed, 7 total
|
|
11
11
|
Snapshots: 0 total
|
|
12
|
-
Time: 0.
|
|
12
|
+
Time: 0.785 s, estimated 1 s
|
|
13
13
|
Ran all test suites.
|
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ npm install @veams/status-quo-query @tanstack/query-core
|
|
|
12
12
|
|
|
13
13
|
Root exports:
|
|
14
14
|
|
|
15
|
-
- `
|
|
15
|
+
- `setupQueryProvider`
|
|
16
16
|
- `setupQuery`
|
|
17
17
|
- `setupMutation`
|
|
18
18
|
- `isQueryLoading`
|
|
@@ -34,7 +34,7 @@ Root exports:
|
|
|
34
34
|
|
|
35
35
|
Subpath exports:
|
|
36
36
|
|
|
37
|
-
- `@veams/status-quo-query/
|
|
37
|
+
- `@veams/status-quo-query/provider`
|
|
38
38
|
- `@veams/status-quo-query/query`
|
|
39
39
|
- `@veams/status-quo-query/mutation`
|
|
40
40
|
|
|
@@ -43,11 +43,11 @@ Subpath exports:
|
|
|
43
43
|
```ts
|
|
44
44
|
import { QueryClient } from '@tanstack/query-core';
|
|
45
45
|
import {
|
|
46
|
-
|
|
46
|
+
setupQueryProvider,
|
|
47
47
|
} from '@veams/status-quo-query';
|
|
48
48
|
|
|
49
49
|
const queryClient = new QueryClient();
|
|
50
|
-
const cache =
|
|
50
|
+
const cache = setupQueryProvider(queryClient);
|
|
51
51
|
|
|
52
52
|
const userQuery = cache.createQuery(['user', 42], () => fetchUser(42), {
|
|
53
53
|
enabled: false,
|
|
@@ -64,7 +64,7 @@ cache.setQueryData(['user', 42], (current) => current);
|
|
|
64
64
|
|
|
65
65
|
## API
|
|
66
66
|
|
|
67
|
-
### `
|
|
67
|
+
### `setupQueryProvider(queryClient)`
|
|
68
68
|
|
|
69
69
|
Creates the package-level cache facade around an existing TanStack `QueryClient`.
|
|
70
70
|
|
|
@@ -170,4 +170,4 @@ Creates a `createMutation` factory bound to a `QueryClient`.
|
|
|
170
170
|
- `getSnapshot()` always returns passive state only.
|
|
171
171
|
- Commands live on the handle itself: `refetch`, `invalidate`, `mutate`, `reset`.
|
|
172
172
|
- Raw TanStack observer and client access is explicit through `unsafe_getResult()` and `unsafe_getClient()`.
|
|
173
|
-
- Cache-level operations live on `
|
|
173
|
+
- Cache-level operations live on `setupQueryProvider()`, not on individual snapshots.
|
package/dist/cache.d.ts
CHANGED
|
@@ -13,4 +13,4 @@ export interface CacheApi {
|
|
|
13
13
|
setQueryData: QueryClient['setQueryData'];
|
|
14
14
|
unsafe_getClient: () => QueryClient;
|
|
15
15
|
}
|
|
16
|
-
export declare function
|
|
16
|
+
export declare function setupQueryProvider(queryClient: QueryClient): CacheApi;
|
package/dist/cache.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { setupMutation } from './mutation';
|
|
2
2
|
import { setupQuery } from './query';
|
|
3
|
-
export function
|
|
3
|
+
export function setupQueryProvider(queryClient) {
|
|
4
4
|
return {
|
|
5
5
|
createMutation: setupMutation(queryClient),
|
|
6
6
|
createQuery: setupQuery(queryClient),
|
package/dist/cache.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AAIA,OAAO,EAAuB,aAAa,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,EAAoB,UAAU,EAAE,MAAM,SAAS,CAAC;AAevD,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AAIA,OAAO,EAAuB,aAAa,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,EAAoB,UAAU,EAAE,MAAM,SAAS,CAAC;AAevD,MAAM,UAAU,kBAAkB,CAAC,WAAwB;IACzD,OAAO;QACL,cAAc,EAAE,aAAa,CAAC,WAAW,CAAC;QAC1C,WAAW,EAAE,UAAU,CAAC,WAAW,CAAC;QACpC,aAAa,EAAE,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC;QAC1D,YAAY,EAAE,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC;QACxD,iBAAiB,EAAE,WAAW,CAAC,iBAAiB,CAAC,IAAI,CAAC,WAAW,CAAC;QAClE,cAAc,EAAE,WAAW,CAAC,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC;QAC5D,aAAa,EAAE,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC;QAC1D,YAAY,EAAE,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC;QACxD,YAAY,EAAE,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC;QACxD,gBAAgB,EAAE,GAAG,EAAE,CAAC,WAAW;KACpC,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type QueryClient } from '@tanstack/query-core';
|
|
2
|
+
import { type CreateMutation } from './mutation';
|
|
3
|
+
import { type CreateQuery } from './query';
|
|
4
|
+
export interface CacheApi {
|
|
5
|
+
createMutation: CreateMutation;
|
|
6
|
+
createQuery: CreateQuery;
|
|
7
|
+
cancelQueries: QueryClient['cancelQueries'];
|
|
8
|
+
getQueryData: QueryClient['getQueryData'];
|
|
9
|
+
invalidateQueries: QueryClient['invalidateQueries'];
|
|
10
|
+
refetchQueries: QueryClient['refetchQueries'];
|
|
11
|
+
removeQueries: QueryClient['removeQueries'];
|
|
12
|
+
resetQueries: QueryClient['resetQueries'];
|
|
13
|
+
setQueryData: QueryClient['setQueryData'];
|
|
14
|
+
unsafe_getClient: () => QueryClient;
|
|
15
|
+
}
|
|
16
|
+
export declare function setupQueryProvider(queryClient: QueryClient): CacheApi;
|
package/dist/provider.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { setupMutation } from './mutation';
|
|
2
|
+
import { setupQuery } from './query';
|
|
3
|
+
export function setupQueryProvider(queryClient) {
|
|
4
|
+
return {
|
|
5
|
+
createMutation: setupMutation(queryClient),
|
|
6
|
+
createQuery: setupQuery(queryClient),
|
|
7
|
+
cancelQueries: queryClient.cancelQueries.bind(queryClient),
|
|
8
|
+
getQueryData: queryClient.getQueryData.bind(queryClient),
|
|
9
|
+
invalidateQueries: queryClient.invalidateQueries.bind(queryClient),
|
|
10
|
+
refetchQueries: queryClient.refetchQueries.bind(queryClient),
|
|
11
|
+
removeQueries: queryClient.removeQueries.bind(queryClient),
|
|
12
|
+
resetQueries: queryClient.resetQueries.bind(queryClient),
|
|
13
|
+
setQueryData: queryClient.setQueryData.bind(queryClient),
|
|
14
|
+
unsafe_getClient: () => queryClient,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAIA,OAAO,EAAuB,aAAa,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,EAAoB,UAAU,EAAE,MAAM,SAAS,CAAC;AAevD,MAAM,UAAU,kBAAkB,CAAC,WAAwB;IACzD,OAAO;QACL,cAAc,EAAE,aAAa,CAAC,WAAW,CAAC;QAC1C,WAAW,EAAE,UAAU,CAAC,WAAW,CAAC;QACpC,aAAa,EAAE,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC;QAC1D,YAAY,EAAE,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC;QACxD,iBAAiB,EAAE,WAAW,CAAC,iBAAiB,CAAC,IAAI,CAAC,WAAW,CAAC;QAClE,cAAc,EAAE,WAAW,CAAC,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC;QAC5D,aAAa,EAAE,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC;QAC1D,YAAY,EAAE,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC;QACxD,YAAY,EAAE,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC;QACxD,gBAAgB,EAAE,GAAG,EAAE,CAAC,WAAW;KACpC,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veams/status-quo-query",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "TanStack Query service layer for the VEAMS StatusQuo ecosystem.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -26,12 +26,12 @@
|
|
|
26
26
|
},
|
|
27
27
|
"require": "./dist/query.js"
|
|
28
28
|
},
|
|
29
|
-
"./
|
|
29
|
+
"./provider": {
|
|
30
30
|
"import": {
|
|
31
|
-
"types": "./dist/
|
|
32
|
-
"default": "./dist/
|
|
31
|
+
"types": "./dist/provider.d.ts",
|
|
32
|
+
"default": "./dist/provider.js"
|
|
33
33
|
},
|
|
34
|
-
"require": "./dist/
|
|
34
|
+
"require": "./dist/provider.js"
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
"types": "dist/index.d.ts",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { QueryClient } from '@tanstack/query-core';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { setupQueryProvider } from '../provider';
|
|
4
4
|
|
|
5
5
|
describe('Cache API', () => {
|
|
6
6
|
it('exposes cache-level query client operations', async () => {
|
|
@@ -10,7 +10,7 @@ describe('Cache API', () => {
|
|
|
10
10
|
const cancelQueriesSpy = jest.spyOn(queryClient, 'cancelQueries');
|
|
11
11
|
const resetQueriesSpy = jest.spyOn(queryClient, 'resetQueries');
|
|
12
12
|
const removeQueriesSpy = jest.spyOn(queryClient, 'removeQueries');
|
|
13
|
-
const cache =
|
|
13
|
+
const cache = setupQueryProvider(queryClient);
|
|
14
14
|
|
|
15
15
|
cache.setQueryData<{ id: number }>(['user', 42], { id: 42 });
|
|
16
16
|
|
package/src/index.ts
CHANGED
|
@@ -18,7 +18,7 @@ export interface CacheApi {
|
|
|
18
18
|
unsafe_getClient: () => QueryClient;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
export function
|
|
21
|
+
export function setupQueryProvider(queryClient: QueryClient): CacheApi {
|
|
22
22
|
return {
|
|
23
23
|
createMutation: setupMutation(queryClient),
|
|
24
24
|
createQuery: setupQuery(queryClient),
|