@superatomai/sdk-node 0.0.39-mds → 0.0.40-mds

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.js CHANGED
@@ -2086,6 +2086,16 @@ function getQueryCacheKey(query) {
2086
2086
  }
2087
2087
  return "";
2088
2088
  }
2089
+ function stableStringify(value) {
2090
+ if (value === null || typeof value !== "object") {
2091
+ return JSON.stringify(value);
2092
+ }
2093
+ if (Array.isArray(value)) {
2094
+ return "[" + value.map(stableStringify).join(",") + "]";
2095
+ }
2096
+ const keys = Object.keys(value).sort();
2097
+ return "{" + keys.map((k) => JSON.stringify(k) + ":" + stableStringify(value[k])).join(",") + "}";
2098
+ }
2089
2099
  function getCacheKey(collection, op, params) {
2090
2100
  if (collection === "database" && op === "execute" && params?.sql) {
2091
2101
  return getQueryCacheKey(params.sql);
@@ -2097,8 +2107,9 @@ function getCacheKey(collection, op, params) {
2097
2107
  return sqlKey ? `et:${toolId}:${sqlKey}:${paramsKey}` : "";
2098
2108
  }
2099
2109
  if (collection === "external-tools" && op === "execute" && params?.toolId && !params?.sql) {
2100
- const dataKey = params.data ? JSON.stringify(params.data) : "";
2101
- return `et-direct:${params.toolId}:${dataKey}`;
2110
+ const { toolId, toolName, ...rest } = params;
2111
+ const paramsKey = stableStringify(rest);
2112
+ return `et-direct:${toolId}:${paramsKey}`;
2102
2113
  }
2103
2114
  if (collection === "external-tools" && op === "executeByQueryId" && params?.queryId) {
2104
2115
  const toolId = params.toolId || "";