@beignet/react-query 0.0.3 → 0.0.4
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 +33 -0
- package/README.md +175 -37
- package/dist/index.d.ts +108 -15
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +140 -9
- package/dist/index.js.map +1 -1
- package/package.json +4 -5
- package/src/index.ts +293 -44
package/dist/index.js
CHANGED
|
@@ -4,6 +4,12 @@ function mergeParamObjects(base, patch) {
|
|
|
4
4
|
return patch;
|
|
5
5
|
if (patch == null)
|
|
6
6
|
return base;
|
|
7
|
+
if (typeof base !== "object" ||
|
|
8
|
+
typeof patch !== "object" ||
|
|
9
|
+
Array.isArray(base) ||
|
|
10
|
+
Array.isArray(patch)) {
|
|
11
|
+
return patch;
|
|
12
|
+
}
|
|
7
13
|
return {
|
|
8
14
|
...base,
|
|
9
15
|
...patch,
|
|
@@ -25,6 +31,15 @@ function normalizeKeyValue(value) {
|
|
|
25
31
|
}
|
|
26
32
|
const BEIGNET_QUERY_KEY_SCOPE = "beignet";
|
|
27
33
|
const UNNAMESPACED_QUERY_KEY_NAMESPACE = null;
|
|
34
|
+
/**
|
|
35
|
+
* Idempotency keys generated per `mutate(...)` invocation, keyed by variables
|
|
36
|
+
* object identity.
|
|
37
|
+
*
|
|
38
|
+
* TanStack Query re-invokes `mutationFn` with the same variables object on
|
|
39
|
+
* every HTTP retry attempt, so one key per variables object means retries
|
|
40
|
+
* reuse the key while separate `mutate(...)` calls get fresh keys.
|
|
41
|
+
*/
|
|
42
|
+
const idempotencyKeyForVariables = new WeakMap();
|
|
28
43
|
/**
|
|
29
44
|
* TanStack Query helper bound to one Beignet contract.
|
|
30
45
|
*
|
|
@@ -35,9 +50,11 @@ const UNNAMESPACED_QUERY_KEY_NAMESPACE = null;
|
|
|
35
50
|
export class ReactQueryContractHelper {
|
|
36
51
|
contract;
|
|
37
52
|
_endpoint;
|
|
38
|
-
|
|
53
|
+
options;
|
|
54
|
+
constructor(contract, _endpoint, options = {}) {
|
|
39
55
|
this.contract = contract;
|
|
40
56
|
this._endpoint = _endpoint;
|
|
57
|
+
this.options = options;
|
|
41
58
|
}
|
|
42
59
|
/**
|
|
43
60
|
* Fully qualified contract name.
|
|
@@ -45,6 +62,13 @@ export class ReactQueryContractHelper {
|
|
|
45
62
|
get name() {
|
|
46
63
|
return this.contract.name;
|
|
47
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Contract route used as the key segment that disambiguates contracts with
|
|
67
|
+
* the same local name, such as `/v1/todos` and `/v2/todos` list contracts.
|
|
68
|
+
*/
|
|
69
|
+
get route() {
|
|
70
|
+
return `${this.contract.method} ${this.contract.path}`;
|
|
71
|
+
}
|
|
48
72
|
/**
|
|
49
73
|
* Resource namespace used for query-key grouping.
|
|
50
74
|
*/
|
|
@@ -67,7 +91,56 @@ export class ReactQueryContractHelper {
|
|
|
67
91
|
* Build a contract-level query key without path/query params.
|
|
68
92
|
*/
|
|
69
93
|
contractKey() {
|
|
70
|
-
return [
|
|
94
|
+
return [
|
|
95
|
+
BEIGNET_QUERY_KEY_SCOPE,
|
|
96
|
+
this.namespace,
|
|
97
|
+
this.localName,
|
|
98
|
+
this.route,
|
|
99
|
+
];
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Build TanStack Query filters for all contracts in this namespace.
|
|
103
|
+
*/
|
|
104
|
+
namespaceFilter(options = {}) {
|
|
105
|
+
return {
|
|
106
|
+
...options,
|
|
107
|
+
queryKey: this.namespaceKey(),
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Build TanStack Query filters for every cached call to this contract.
|
|
112
|
+
*/
|
|
113
|
+
contractFilter(options = {}) {
|
|
114
|
+
return {
|
|
115
|
+
...options,
|
|
116
|
+
queryKey: this.contractKey(),
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Pick the adapter-whitelisted `keyHeaders` out of call headers.
|
|
121
|
+
*
|
|
122
|
+
* Returns `undefined` unless the adapter opted in with `keyHeaders` and the
|
|
123
|
+
* call provides at least one whitelisted header. Header names are matched
|
|
124
|
+
* case-insensitively and lowercased in the key component.
|
|
125
|
+
*/
|
|
126
|
+
pickKeyHeaders(headers) {
|
|
127
|
+
const keyHeaders = this.options.keyHeaders;
|
|
128
|
+
if (!keyHeaders || keyHeaders.length === 0)
|
|
129
|
+
return undefined;
|
|
130
|
+
if (headers === null ||
|
|
131
|
+
headers === undefined ||
|
|
132
|
+
typeof headers !== "object" ||
|
|
133
|
+
Array.isArray(headers)) {
|
|
134
|
+
return undefined;
|
|
135
|
+
}
|
|
136
|
+
const allowed = new Set(keyHeaders.map((name) => name.toLowerCase()));
|
|
137
|
+
const picked = {};
|
|
138
|
+
for (const [name, value] of Object.entries(headers)) {
|
|
139
|
+
const lowered = name.toLowerCase();
|
|
140
|
+
if (allowed.has(lowered))
|
|
141
|
+
picked[lowered] = value;
|
|
142
|
+
}
|
|
143
|
+
return picked;
|
|
71
144
|
}
|
|
72
145
|
/**
|
|
73
146
|
* Build a stable query key for this contract
|
|
@@ -76,12 +149,20 @@ export class ReactQueryContractHelper {
|
|
|
76
149
|
* This ensures consistent serialization between server (dehydrate) and
|
|
77
150
|
* client (hydrate), since undefined object values may serialize
|
|
78
151
|
* differently across React's RSC boundary vs JSON.stringify.
|
|
152
|
+
*
|
|
153
|
+
* Headers are never included unless the adapter opted in with
|
|
154
|
+
* `createReactQuery(client, { keyHeaders })`, and then only the whitelisted
|
|
155
|
+
* header names are included.
|
|
79
156
|
*/
|
|
80
157
|
key(params) {
|
|
81
158
|
const path = normalizeKeyValue(params?.path);
|
|
82
159
|
const query = normalizeKeyValue(params?.query);
|
|
83
160
|
const body = normalizeKeyValue(params?.body);
|
|
84
|
-
|
|
161
|
+
const headers = normalizeKeyValue(this.pickKeyHeaders(params?.headers));
|
|
162
|
+
if (path === undefined &&
|
|
163
|
+
query === undefined &&
|
|
164
|
+
body === undefined &&
|
|
165
|
+
headers === undefined) {
|
|
85
166
|
return this.contractKey();
|
|
86
167
|
}
|
|
87
168
|
const cleanParams = {};
|
|
@@ -91,8 +172,28 @@ export class ReactQueryContractHelper {
|
|
|
91
172
|
cleanParams.query = query;
|
|
92
173
|
if (body !== undefined)
|
|
93
174
|
cleanParams.body = body;
|
|
175
|
+
if (headers !== undefined)
|
|
176
|
+
cleanParams.headers = headers;
|
|
94
177
|
return [...this.contractKey(), cleanParams];
|
|
95
178
|
}
|
|
179
|
+
/**
|
|
180
|
+
* Build TanStack Query filters for one contract call or parameter prefix.
|
|
181
|
+
*/
|
|
182
|
+
filter(params, options = {}) {
|
|
183
|
+
return {
|
|
184
|
+
...options,
|
|
185
|
+
queryKey: this.key(params),
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Invalidate cached data for this contract.
|
|
190
|
+
*
|
|
191
|
+
* With no params this invalidates every cached call to the contract. Pass
|
|
192
|
+
* path/query/body params to target a single call or parameter prefix.
|
|
193
|
+
*/
|
|
194
|
+
invalidate(queryClient, params, options) {
|
|
195
|
+
return queryClient.invalidateQueries(this.filter(params, options));
|
|
196
|
+
}
|
|
96
197
|
/**
|
|
97
198
|
* Create query options for TanStack Query.
|
|
98
199
|
*
|
|
@@ -102,7 +203,8 @@ export class ReactQueryContractHelper {
|
|
|
102
203
|
queryOptions(...callArgs) {
|
|
103
204
|
const args = (callArgs[0] ?? {});
|
|
104
205
|
const { path, query, body, headers, key: customKey, ...rest } = args;
|
|
105
|
-
const queryKey = (customKey ||
|
|
206
|
+
const queryKey = (customKey ||
|
|
207
|
+
this.key({ path, query, body, headers }));
|
|
106
208
|
const queryFn = async (context) => {
|
|
107
209
|
return await this._endpoint.call({
|
|
108
210
|
path,
|
|
@@ -123,10 +225,33 @@ export class ReactQueryContractHelper {
|
|
|
123
225
|
*
|
|
124
226
|
* The generated `mutationFn` accepts the same variables shape as the
|
|
125
227
|
* underlying contract endpoint call.
|
|
228
|
+
*
|
|
229
|
+
* For contracts with idempotency metadata, the generated `mutationFn`
|
|
230
|
+
* derives one idempotency key per `mutate(...)` invocation and keeps it
|
|
231
|
+
* stable across TanStack retry attempts, which re-invoke `mutationFn` with
|
|
232
|
+
* the same variables object. Pass `idempotencyKey` in the variables to
|
|
233
|
+
* control the key explicitly. Calling `mutate()` with no variables falls
|
|
234
|
+
* back to per-attempt key generation in the client.
|
|
126
235
|
*/
|
|
127
236
|
mutationOptions(args = {}) {
|
|
237
|
+
const hasIdempotencyMetadata = Boolean(this.contract.metadata?.idempotency);
|
|
128
238
|
const mutationFn = async (vars) => {
|
|
129
|
-
|
|
239
|
+
let idempotencyKey = vars?.idempotencyKey;
|
|
240
|
+
if (!idempotencyKey &&
|
|
241
|
+
hasIdempotencyMetadata &&
|
|
242
|
+
vars &&
|
|
243
|
+
typeof vars === "object") {
|
|
244
|
+
idempotencyKey =
|
|
245
|
+
idempotencyKeyForVariables.get(vars) ?? crypto.randomUUID();
|
|
246
|
+
idempotencyKeyForVariables.set(vars, idempotencyKey);
|
|
247
|
+
}
|
|
248
|
+
if (idempotencyKey === undefined) {
|
|
249
|
+
return await this._endpoint.call(vars);
|
|
250
|
+
}
|
|
251
|
+
return await this._endpoint.call({
|
|
252
|
+
...vars,
|
|
253
|
+
idempotencyKey,
|
|
254
|
+
});
|
|
130
255
|
};
|
|
131
256
|
return {
|
|
132
257
|
...args,
|
|
@@ -154,14 +279,15 @@ export class ReactQueryContractHelper {
|
|
|
154
279
|
resolveParams = params;
|
|
155
280
|
}
|
|
156
281
|
else {
|
|
157
|
-
const { path, query, headers, page, key, ...other } = args;
|
|
158
|
-
queryKey = (key || this.key({ path, query }));
|
|
282
|
+
const { path, query, body, headers, page, key, ...other } = args;
|
|
283
|
+
queryKey = (key || this.key({ path, query, body, headers }));
|
|
159
284
|
rest = other;
|
|
160
285
|
resolveParams = (context) => {
|
|
161
286
|
const pageParams = page?.(context);
|
|
162
287
|
return {
|
|
163
288
|
path: mergeParamObjects(path, pageParams?.path),
|
|
164
289
|
query: mergeParamObjects(query, pageParams?.query),
|
|
290
|
+
body: mergeParamObjects(body, pageParams?.body),
|
|
165
291
|
headers: mergeParamObjects(headers, pageParams?.headers),
|
|
166
292
|
};
|
|
167
293
|
};
|
|
@@ -171,6 +297,7 @@ export class ReactQueryContractHelper {
|
|
|
171
297
|
return await this._endpoint.call({
|
|
172
298
|
path: resolvedParams.path,
|
|
173
299
|
query: resolvedParams.query,
|
|
300
|
+
body: resolvedParams.body,
|
|
174
301
|
headers: resolvedParams.headers,
|
|
175
302
|
signal: context.signal,
|
|
176
303
|
});
|
|
@@ -193,12 +320,16 @@ export class ReactQueryContractHelper {
|
|
|
193
320
|
*
|
|
194
321
|
* Create this once near client setup, then bind contracts with the returned
|
|
195
322
|
* `rq(contract)` function.
|
|
323
|
+
*
|
|
324
|
+
* Pass `keyHeaders` to include specific identity headers, such as a tenant
|
|
325
|
+
* header, in generated query keys. Headers are excluded by default so
|
|
326
|
+
* persisted caches never store credentials.
|
|
196
327
|
*/
|
|
197
|
-
export function createReactQuery(client) {
|
|
328
|
+
export function createReactQuery(client, options = {}) {
|
|
198
329
|
return function rq(contract) {
|
|
199
330
|
const resolved = resolveContract(contract);
|
|
200
331
|
const endpoint = client.endpoint(contract);
|
|
201
|
-
return new ReactQueryContractHelper(resolved, endpoint);
|
|
332
|
+
return new ReactQueryContractHelper(resolved, endpoint, options);
|
|
202
333
|
};
|
|
203
334
|
}
|
|
204
335
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA,OAAO,EAIL,eAAe,GAChB,MAAM,yBAAyB,CAAC;AAsMjC,SAAS,iBAAiB,CAAI,IAAQ,EAAE,KAAS;IAC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,CAAC,CAAC;YAC9C,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;gBAC/B,IAAI,EAAE,cAAc,CAAC,IAAI;gBACzB,KAAK,EAAE,cAAc,CAAC,KAAK;gBAC3B,IAAI,EAAE,cAAc,CAAC,IAAI;gBACzB,OAAO,EAAE,cAAc,CAAC,OAAO;gBAC/B,MAAM,EAAE,OAAO,CAAC,MAAM;aACqC,CAAC,CAAC;QACjE,CAAC,CAAC;QAEF,OAAO;YACL,GAAG,IAAI;YACP,QAAQ;YACR,OAAO;SAOR,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CACF;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,gBAAgB,CAC9B,MAAgC,EAChC,UAAmC,EAAE;IAErC,OAAO,SAAS,EAAE,CAChB,QAAuB;QAKvB,MAAM,QAAQ,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;QAC3C,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAGxC,CAAC;QACF,OAAO,IAAI,wBAAwB,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IACnE,CAAC,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beignet/react-query",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "TanStack Query integration for Beignet",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -24,8 +24,9 @@
|
|
|
24
24
|
"build": "tsc",
|
|
25
25
|
"dev": "tsc --watch",
|
|
26
26
|
"clean": "rm -rf dist coverage .turbo",
|
|
27
|
-
"test": "bun test",
|
|
27
|
+
"test": "bun test && bun run typecheck:types",
|
|
28
28
|
"test:coverage": "bun test --coverage",
|
|
29
|
+
"typecheck:types": "tsc -p tsconfig.type-tests.json",
|
|
29
30
|
"lint": "biome check ."
|
|
30
31
|
},
|
|
31
32
|
"keywords": [
|
|
@@ -52,12 +53,10 @@
|
|
|
52
53
|
"node": ">=18.0.0"
|
|
53
54
|
},
|
|
54
55
|
"peerDependencies": {
|
|
56
|
+
"@beignet/core": ">=0.0.3 <1.0.0",
|
|
55
57
|
"@tanstack/react-query": "^5.0.0",
|
|
56
58
|
"react": "^18.0.0 || ^19.0.0"
|
|
57
59
|
},
|
|
58
|
-
"dependencies": {
|
|
59
|
-
"@beignet/core": "*"
|
|
60
|
-
},
|
|
61
60
|
"devDependencies": {
|
|
62
61
|
"@tanstack/react-query": "^5.0.0",
|
|
63
62
|
"@testing-library/dom": "^9.3.4",
|