@ctil/gql 1.0.17 → 1.0.19

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
@@ -946,7 +946,12 @@ function buildDataValue(data) {
946
946
  const parts = [];
947
947
  for (const key in data) {
948
948
  const value = data[key];
949
- if (value === null || value === void 0) continue;
949
+ if (value === null) {
950
+ parts.push(`${key}: ${value}`);
951
+ continue;
952
+ }
953
+ ;
954
+ if (value === void 0) continue;
950
955
  if (typeof value === "string" && value.startsWith("$")) {
951
956
  parts.push(`${key}: ${value}`);
952
957
  } else if (typeof value === "object" && !Array.isArray(value) && value.constructor === Object) {
@@ -1934,7 +1939,7 @@ import crypto from "crypto";
1934
1939
  import fs2 from "fs";
1935
1940
  import path2 from "path";
1936
1941
  async function computeFileMd5Base64(file) {
1937
- if (typeof window != "undefined") {
1942
+ if (typeof window === "undefined") {
1938
1943
  let buffer;
1939
1944
  if (typeof file === "string") {
1940
1945
  buffer = fs2.readFileSync(path2.resolve(file));
@@ -1988,7 +1993,6 @@ var oss = {
1988
1993
  const result = await execute({ query: query2, variables });
1989
1994
  return result;
1990
1995
  });
1991
- console.log("presignedResult====>", presignedResult);
1992
1996
  if (!presignedResult.uploadPresignedUrl) throw new Error("\u83B7\u53D6\u9884\u7B7E\u540D URL \u5931\u8D25");
1993
1997
  const { uploadUrl, uploadHeaders, downloadUrl, resourceId, contentType, originalFileName } = presignedResult.uploadPresignedUrl;
1994
1998
  const headers = {};
@@ -2034,7 +2038,11 @@ var oss = {
2034
2038
  md5Base64 = crypto.createHash("md5").update(Buffer.from(arrayBuffer)).digest("base64");
2035
2039
  } else {
2036
2040
  const SparkMD5 = (await import("spark-md5")).default;
2037
- md5Base64 = SparkMD5.ArrayBuffer.hash(arrayBuffer, true);
2041
+ const md5Hex = SparkMD5.ArrayBuffer.hash(arrayBuffer, false);
2042
+ const md5Bytes = new Uint8Array(md5Hex.match(/.{2}/g).map((b) => parseInt(b, 16)));
2043
+ let binary = "";
2044
+ md5Bytes.forEach((byte) => binary += String.fromCharCode(byte));
2045
+ md5Base64 = btoa(binary);
2038
2046
  }
2039
2047
  const presignedInput = {
2040
2048
  fileMd5Base64: md5Base64,