@superatomai/sdk-node 0.0.1-mds → 0.0.2-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 +13 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1935,10 +1935,16 @@ function getQueryCacheKey(query) {
|
|
|
1935
1935
|
return "";
|
|
1936
1936
|
}
|
|
1937
1937
|
async function handleDataRequest(data, collections, sendMessage) {
|
|
1938
|
+
let requestId;
|
|
1939
|
+
let collection;
|
|
1940
|
+
let op;
|
|
1938
1941
|
try {
|
|
1939
1942
|
const dataRequest = DataRequestMessageSchema.parse(data);
|
|
1940
1943
|
const { id, payload } = dataRequest;
|
|
1941
|
-
|
|
1944
|
+
requestId = id;
|
|
1945
|
+
const { collection: col, op: operation, params, SA_RUNTIME } = payload;
|
|
1946
|
+
collection = col;
|
|
1947
|
+
op = operation;
|
|
1942
1948
|
if (!collections[collection]) {
|
|
1943
1949
|
sendDataResponse(id, collection, op, null, {
|
|
1944
1950
|
error: `Collection '${collection}' not found`
|
|
@@ -2027,7 +2033,13 @@ async function handleDataRequest(data, collections, sendMessage) {
|
|
|
2027
2033
|
}
|
|
2028
2034
|
sendDataResponse(id, collection, op, result, { executionMs }, sendMessage);
|
|
2029
2035
|
} catch (error) {
|
|
2036
|
+
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
2030
2037
|
logger.error("Failed to handle data request:", error);
|
|
2038
|
+
if (requestId) {
|
|
2039
|
+
sendDataResponse(requestId, collection || "unknown", op || "unknown", null, {
|
|
2040
|
+
error: errorMsg
|
|
2041
|
+
}, sendMessage);
|
|
2042
|
+
}
|
|
2031
2043
|
}
|
|
2032
2044
|
}
|
|
2033
2045
|
function sendDataResponse(id, collection, op, data, meta, sendMessage) {
|