@kubb/plugin-ts 5.0.0-beta.103 → 5.0.0-beta.106
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 +13 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -978,13 +978,24 @@ function resolveContentTypeVariants(entries, baseName) {
|
|
|
978
978
|
};
|
|
979
979
|
});
|
|
980
980
|
}
|
|
981
|
+
const operationParameterGroupsByNode = /* @__PURE__ */ new WeakMap();
|
|
982
|
+
/**
|
|
983
|
+
* Groups an operation's parameters by location (`path`/`query`/`header`/`cookie`), deduping each
|
|
984
|
+
* group by name. Every plugin generator visiting the same `OperationNode` shares one AST instance
|
|
985
|
+
* (see `KubbDriver`), so the result is cached per node to avoid re-filtering and re-deduping the
|
|
986
|
+
* same parameters once per plugin.
|
|
987
|
+
*/
|
|
981
988
|
function getOperationParameters(node) {
|
|
982
|
-
|
|
989
|
+
const cached = operationParameterGroupsByNode.get(node);
|
|
990
|
+
if (cached) return cached;
|
|
991
|
+
const groups = {
|
|
983
992
|
path: dedupeParams(node.parameters.filter((param) => param.in === "path")),
|
|
984
993
|
query: dedupeParams(node.parameters.filter((param) => param.in === "query")),
|
|
985
994
|
header: dedupeParams(node.parameters.filter((param) => param.in === "header")),
|
|
986
995
|
cookie: dedupeParams(node.parameters.filter((param) => param.in === "cookie"))
|
|
987
996
|
};
|
|
997
|
+
operationParameterGroupsByNode.set(node, groups);
|
|
998
|
+
return groups;
|
|
988
999
|
}
|
|
989
1000
|
/**
|
|
990
1001
|
* Builds the combined `{ body, path, query, headers }` options object schema for an operation,
|