@ctil/gql 1.0.5 → 1.0.7
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 +15 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -1
- package/dist/index.d.ts +23 -1
- package/dist/index.js +15 -5
- package/dist/index.js.map +1 -1
- package/package.json +8 -3
- package/.vscode/launch.json +0 -18
- package/ctil-gql-1.0.5.tgz +0 -0
- package/src/builders/auth.ts +0 -182
- package/src/builders/baseType.ts +0 -194
- package/src/builders/index.ts +0 -6
- package/src/builders/mutation.ts +0 -341
- package/src/builders/oss.ts +0 -140
- package/src/builders/query.ts +0 -180
- package/src/builders/sms.ts +0 -59
- package/src/cache/memoryCache.ts +0 -34
- package/src/core/api/auth.ts +0 -86
- package/src/core/api/gql.ts +0 -22
- package/src/core/api/mutation.ts +0 -100
- package/src/core/api/oss.ts +0 -216
- package/src/core/api/query.ts +0 -82
- package/src/core/api/sms.ts +0 -18
- package/src/core/client.ts +0 -47
- package/src/core/core.ts +0 -284
- package/src/core/executor.ts +0 -19
- package/src/core/type.ts +0 -76
- package/src/device/index.ts +0 -116
- package/src/index.ts +0 -60
- package/src/rateLimit/rateLimit.ts +0 -51
- package/src/rateLimit/rateLimitConfig.ts +0 -12
- package/src/test.ts +0 -109
- package/tsconfig.json +0 -17
- package/tsup.config.ts +0 -10
package/dist/index.cjs
CHANGED
|
@@ -4297,8 +4297,8 @@ var import_fs = __toESM(require("fs"), 1);
|
|
|
4297
4297
|
var import_path = __toESM(require("path"), 1);
|
|
4298
4298
|
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
4299
4299
|
var isNode2 = typeof process !== "undefined" && process.versions?.node != null;
|
|
4300
|
-
var NODE_LOGIN_FILE = import_path.default.resolve(process.cwd(), "loginInfo.json");
|
|
4301
|
-
var NODE_LOGIN_REMEBER_FILE = import_path.default.resolve(process.cwd(), "loginInfo.json.remember");
|
|
4300
|
+
var NODE_LOGIN_FILE = isNode2 ? import_path.default.resolve(process.cwd(), "loginInfo.json") : "";
|
|
4301
|
+
var NODE_LOGIN_REMEBER_FILE = isNode2 ? import_path.default.resolve(process.cwd(), "loginInfo.json.remember") : "";
|
|
4302
4302
|
var STORAGE_KEY = "GRAPHQL_LOGIN_INFO";
|
|
4303
4303
|
var REMEMBER_KEY = "GRAPHQL_LOGIN_REMEMBER";
|
|
4304
4304
|
var nodeLoginInfo = null;
|
|
@@ -4319,9 +4319,19 @@ var CCRequest = class {
|
|
|
4319
4319
|
}
|
|
4320
4320
|
/** 构建 GraphQLClient 实例 */
|
|
4321
4321
|
buildClient() {
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4322
|
+
const options = { headers: this.headers };
|
|
4323
|
+
if (isBrowser) {
|
|
4324
|
+
const corsMode = this.config.corsMode || "cors";
|
|
4325
|
+
const withCred = !!this.config.withCredentials;
|
|
4326
|
+
options.fetch = (input, init) => {
|
|
4327
|
+
return fetch(input, {
|
|
4328
|
+
...init,
|
|
4329
|
+
mode: corsMode,
|
|
4330
|
+
credentials: withCred ? "include" : init?.credentials
|
|
4331
|
+
});
|
|
4332
|
+
};
|
|
4333
|
+
}
|
|
4334
|
+
this.client = new import_graphql_request.GraphQLClient(this.config.endpoint || "/graphql", options);
|
|
4325
4335
|
}
|
|
4326
4336
|
/** 构建初始 headers */
|
|
4327
4337
|
buildHeaders(config) {
|