@ctil/gql 1.0.6 → 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.cjs +16 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +16 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3677,16 +3677,13 @@ function buildWhere(where) {
|
|
|
3677
3677
|
const sub = buildWhere(value);
|
|
3678
3678
|
if (sub) parts.push(`${key}: { ${sub} }`);
|
|
3679
3679
|
} else if (typeof value === "object" && value !== null) {
|
|
3680
|
-
const
|
|
3681
|
-
|
|
3682
|
-
return `${op}: ${JSON.stringify(String(val))}`;
|
|
3683
|
-
}).join(", ");
|
|
3684
|
-
parts.push(`${key}: { ${conds} }`);
|
|
3680
|
+
const sub = buildWhere(value);
|
|
3681
|
+
parts.push(`${key}: { ${sub} }`);
|
|
3685
3682
|
} else {
|
|
3686
3683
|
if (typeof value === "string" && value.startsWith("$")) {
|
|
3687
3684
|
parts.push(`${key}: ${value}`);
|
|
3688
3685
|
} else {
|
|
3689
|
-
parts.push(`${key}: ${JSON.stringify(
|
|
3686
|
+
parts.push(`${key}: ${JSON.stringify(value)}`);
|
|
3690
3687
|
}
|
|
3691
3688
|
}
|
|
3692
3689
|
}
|
|
@@ -4319,9 +4316,19 @@ var CCRequest = class {
|
|
|
4319
4316
|
}
|
|
4320
4317
|
/** 构建 GraphQLClient 实例 */
|
|
4321
4318
|
buildClient() {
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4319
|
+
const options = { headers: this.headers };
|
|
4320
|
+
if (isBrowser) {
|
|
4321
|
+
const corsMode = this.config.corsMode || "cors";
|
|
4322
|
+
const withCred = !!this.config.withCredentials;
|
|
4323
|
+
options.fetch = (input, init) => {
|
|
4324
|
+
return fetch(input, {
|
|
4325
|
+
...init,
|
|
4326
|
+
mode: corsMode,
|
|
4327
|
+
credentials: withCred ? "include" : init?.credentials
|
|
4328
|
+
});
|
|
4329
|
+
};
|
|
4330
|
+
}
|
|
4331
|
+
this.client = new import_graphql_request.GraphQLClient(this.config.endpoint || "/graphql", options);
|
|
4325
4332
|
}
|
|
4326
4333
|
/** 构建初始 headers */
|
|
4327
4334
|
buildHeaders(config) {
|