@dbcube/core 3.0.5 → 3.0.6

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 CHANGED
@@ -929,22 +929,30 @@ var QueryEngine = class {
929
929
  reject(new Error("TCP request timeout"));
930
930
  }, this.timeout);
931
931
  client.connect(this.tcpPort, "127.0.0.1", () => {
932
+ const dmlIndex = args.findIndex((arg) => arg === "--dml");
933
+ const dmlJson = dmlIndex !== -1 ? args[dmlIndex + 1] : null;
934
+ if (!dmlJson) {
935
+ client.destroy();
936
+ reject(new Error("No DML found in arguments"));
937
+ return;
938
+ }
932
939
  const command = {
933
940
  action: "execute",
934
- args
941
+ dml: dmlJson
935
942
  };
936
- client.write(JSON.stringify(command) + "\n");
943
+ client.write(JSON.stringify(command));
937
944
  });
938
945
  client.on("data", (data) => {
939
946
  responseBuffer += data.toString();
940
- if (responseBuffer.includes("\n")) {
947
+ const match = responseBuffer.match(/PROCESS_RESPONSE:(\{.*\})/);
948
+ if (match) {
941
949
  clearTimeout(timeout);
942
950
  client.destroy();
943
951
  try {
944
- const response = JSON.parse(responseBuffer.trim());
952
+ const response = JSON.parse(match[1]);
945
953
  resolve5({
946
- status: response.status || 200,
947
- message: response.message || "Success",
954
+ status: response.status,
955
+ message: response.message,
948
956
  data: response.data
949
957
  });
950
958
  } catch (error) {