@kubb/plugin-vue-query 5.13.1 → 5.13.2
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.cjs +5 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -11
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Diagnostics, Resolver, Url, addMacro, addTemplate, casing, code, createResolver, defineExtension, defineTemplate, operationKey, setResolver, useConfig, useKubb } from "@kubb/kit";
|
|
1
|
+
import { Diagnostics, Resolver, Url, addMacro, addTemplate, casing, code, createResolver, defineExtension, defineTemplate, memo, operationKey, setResolver, text, useConfig, useKubb } from "@kubb/kit";
|
|
2
2
|
import { createFunctionParameter, createFunctionParameters, createObjectBindingPattern, createTypeLiteral, functionPrinter, pluginTsName } from "@kubb/plugin-ts";
|
|
3
3
|
import { ast, file as file$1, node, ref } from "@kubb/ast";
|
|
4
4
|
import path from "node:path";
|
|
@@ -10,7 +10,7 @@ var compatibility = {
|
|
|
10
10
|
"node": ">=22.22"
|
|
11
11
|
};
|
|
12
12
|
// package.json
|
|
13
|
-
var version = "5.13.
|
|
13
|
+
var version = "5.13.2";
|
|
14
14
|
// ../../internals/ast/src/http/requestBody.ts
|
|
15
15
|
/** The schema of the first request body entry, else `undefined` when the operation takes no body. */
|
|
16
16
|
function getSchema(node) {
|
|
@@ -56,15 +56,10 @@ function findPrimary(node) {
|
|
|
56
56
|
}
|
|
57
57
|
// ../../internals/ast/src/http/index.ts
|
|
58
58
|
const isOperation = ast.http.isOperation;
|
|
59
|
-
/** Computes once per key; generators visit the same node many times. */
|
|
60
|
-
function cached(store, key, compute) {
|
|
61
|
-
if (!store.has(key)) store.set(key, compute());
|
|
62
|
-
return store.get(key);
|
|
63
|
-
}
|
|
64
59
|
const parametersByNode = /* @__PURE__ */ new WeakMap();
|
|
65
60
|
/** The operation's parameters by location, with a `querystring` parameter in `query`. A repeated name keeps its first parameter. */
|
|
66
61
|
function groupParameters(node) {
|
|
67
|
-
return
|
|
62
|
+
return memo(parametersByNode, node, () => {
|
|
68
63
|
const group = (...locations) => {
|
|
69
64
|
const seen = /* @__PURE__ */ new Set();
|
|
70
65
|
return locations.flatMap((location) => node.parameters.filter((param) => {
|
|
@@ -84,7 +79,7 @@ function groupParameters(node) {
|
|
|
84
79
|
const requestGroupsByNode = /* @__PURE__ */ new WeakMap();
|
|
85
80
|
/** Which request groups are present, which hold a required member, and the body's media types. Built once per operation. */
|
|
86
81
|
function getRequestGroups(node) {
|
|
87
|
-
return
|
|
82
|
+
return memo(requestGroupsByNode, node, () => {
|
|
88
83
|
const { path, query, header, cookie } = groupParameters(node);
|
|
89
84
|
const content = node.requestBody?.content ?? [];
|
|
90
85
|
const body = Boolean(content[0]?.schema);
|
|
@@ -1338,7 +1333,7 @@ const declarationPrinter$4 = functionPrinter({ mode: "declaration" });
|
|
|
1338
1333
|
*/
|
|
1339
1334
|
const mutationKeyTransformer = ({ node }) => {
|
|
1340
1335
|
if (!node.path) return [];
|
|
1341
|
-
return [`{ url:
|
|
1336
|
+
return [`{ url: ${text.quote(Url.toPath(node.path))} }`];
|
|
1342
1337
|
};
|
|
1343
1338
|
function MutationKey({ name, node, transformer, typeName }) {
|
|
1344
1339
|
const paramsNode = createFunctionParameters({ params: [] });
|
|
@@ -1376,7 +1371,7 @@ const queryKeyTransformer = ({ node, variant }) => {
|
|
|
1376
1371
|
if (!node.path) return [];
|
|
1377
1372
|
const { path, query } = groupParameters(node);
|
|
1378
1373
|
const isInfinite = variant === "infiniteQuery" || variant === "suspenseInfiniteQuery";
|
|
1379
|
-
const urlFields = [`url:
|
|
1374
|
+
const urlFields = [`url: ${text.quote(Url.toPath(node.path))}`];
|
|
1380
1375
|
if (path.length > 0) urlFields.push("params: path");
|
|
1381
1376
|
if (isInfinite) urlFields.push("infinite: true");
|
|
1382
1377
|
const result = [`{ ${urlFields.join(", ")} }`];
|