@ctil/gql 1.0.7 → 1.0.8

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.d.cts CHANGED
@@ -124,7 +124,7 @@ interface WhereInput {
124
124
  [field: string]: any;
125
125
  }
126
126
  /** 构造 where 字段,所有非变量都转成字符串 */
127
- declare function buildWhere(where: WhereInput): string;
127
+ declare function buildWhere(where: Record<string, any>): string;
128
128
  /** 构造字段 */
129
129
  declare function buildFields(fields: FieldInput[]): string;
130
130
  /** 构建 mutation 返回字段 */
package/dist/index.d.ts CHANGED
@@ -124,7 +124,7 @@ interface WhereInput {
124
124
  [field: string]: any;
125
125
  }
126
126
  /** 构造 where 字段,所有非变量都转成字符串 */
127
- declare function buildWhere(where: WhereInput): string;
127
+ declare function buildWhere(where: Record<string, any>): string;
128
128
  /** 构造字段 */
129
129
  declare function buildFields(fields: FieldInput[]): string;
130
130
  /** 构建 mutation 返回字段 */
package/dist/index.js CHANGED
@@ -910,16 +910,13 @@ function buildWhere(where) {
910
910
  const sub = buildWhere(value);
911
911
  if (sub) parts.push(`${key}: { ${sub} }`);
912
912
  } else if (typeof value === "object" && value !== null) {
913
- const conds = Object.entries(value).map(([op, val]) => {
914
- if (typeof val === "string" && val.startsWith("$")) return `${op}: ${val}`;
915
- return `${op}: ${JSON.stringify(String(val))}`;
916
- }).join(", ");
917
- parts.push(`${key}: { ${conds} }`);
913
+ const sub = buildWhere(value);
914
+ parts.push(`${key}: { ${sub} }`);
918
915
  } else {
919
916
  if (typeof value === "string" && value.startsWith("$")) {
920
917
  parts.push(`${key}: ${value}`);
921
918
  } else {
922
- parts.push(`${key}: ${JSON.stringify(String(value))}`);
919
+ parts.push(`${key}: ${JSON.stringify(value)}`);
923
920
  }
924
921
  }
925
922
  }