@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.mjs CHANGED
@@ -2026,6 +2026,16 @@ function getQueryCacheKey(query) {
2026
2026
  }
2027
2027
  return "";
2028
2028
  }
2029
+ function stableStringify(value) {
2030
+ if (value === null || typeof value !== "object") {
2031
+ return JSON.stringify(value);
2032
+ }
2033
+ if (Array.isArray(value)) {
2034
+ return "[" + value.map(stableStringify).join(",") + "]";
2035
+ }
2036
+ const keys = Object.keys(value).sort();
2037
+ return "{" + keys.map((k) => JSON.stringify(k) + ":" + stableStringify(value[k])).join(",") + "}";
2038
+ }
2029
2039
  function getCacheKey(collection, op, params) {
2030
2040
  if (collection === "database" && op === "execute" && params?.sql) {
2031
2041
  return getQueryCacheKey(params.sql);
@@ -2037,8 +2047,9 @@ function getCacheKey(collection, op, params) {
2037
2047
  return sqlKey ? `et:${toolId}:${sqlKey}:${paramsKey}` : "";
2038
2048
  }
2039
2049
  if (collection === "external-tools" && op === "execute" && params?.toolId && !params?.sql) {
2040
- const dataKey = params.data ? JSON.stringify(params.data) : "";
2041
- return `et-direct:${params.toolId}:${dataKey}`;
2050
+ const { toolId, toolName, ...rest } = params;
2051
+ const paramsKey = stableStringify(rest);
2052
+ return `et-direct:${toolId}:${paramsKey}`;
2042
2053
  }
2043
2054
  if (collection === "external-tools" && op === "executeByQueryId" && params?.queryId) {
2044
2055
  const toolId = params.toolId || "";