@ontos-ai/knowhere-claw 0.1.0-beta.0
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/README.md +163 -0
- package/dist/_virtual/_rolldown/runtime.js +37 -0
- package/dist/client.d.ts +33 -0
- package/dist/client.js +395 -0
- package/dist/config.d.ts +6 -0
- package/dist/config.js +132 -0
- package/dist/error-message.d.ts +1 -0
- package/dist/error-message.js +48 -0
- package/dist/hooks.d.ts +8 -0
- package/dist/hooks.js +415 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +43 -0
- package/dist/node_modules/.pnpm/@knowhere-ai_sdk@0.1.1/node_modules/@knowhere-ai/sdk/dist/index.js +717 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/adapters/adapters.js +83 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/adapters/fetch.js +170 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/adapters/xhr.js +106 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/axios.js +57 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/cancel/CancelToken.js +90 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/cancel/CanceledError.js +20 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/cancel/isCancel.js +6 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/Axios.js +174 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/AxiosError.js +70 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/AxiosHeaders.js +204 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/InterceptorManager.js +60 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/buildFullPath.js +20 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/dispatchRequest.js +52 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/mergeConfig.js +81 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/settle.js +18 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/transformData.js +25 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/defaults/index.js +107 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/defaults/transitional.js +9 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/env/data.js +4 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +50 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/HttpStatusCode.js +77 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/bind.js +15 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/buildURL.js +40 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/combineURLs.js +14 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/composeSignals.js +39 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/cookies.js +31 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/formDataToJSON.js +67 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/isAbsoluteURL.js +14 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/isAxiosError.js +14 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/isURLSameOrigin.js +8 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/parseHeaders.js +53 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/parseProtocol.js +7 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/progressEventReducer.js +38 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/resolveConfig.js +36 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/speedometer.js +36 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/spread.js +29 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/throttle.js +38 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/toFormData.js +151 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/toURLEncodedForm.js +18 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/trackStream.js +69 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/helpers/validator.js +76 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/platform/browser/classes/Blob.js +4 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/platform/browser/classes/FormData.js +4 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +5 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/platform/browser/index.js +22 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/platform/common/utils.js +46 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/platform/index.js +9 -0
- package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/utils.js +698 -0
- package/dist/node_modules/.pnpm/fflate@0.8.2/node_modules/fflate/esm/browser.js +426 -0
- package/dist/node_modules/.pnpm/jszip@3.10.1/node_modules/jszip/dist/jszip.min.js +3110 -0
- package/dist/parser.d.ts +16 -0
- package/dist/parser.js +323 -0
- package/dist/session.d.ts +11 -0
- package/dist/session.js +78 -0
- package/dist/store.d.ts +62 -0
- package/dist/store.js +482 -0
- package/dist/text.d.ts +10 -0
- package/dist/text.js +34 -0
- package/dist/tools.d.ts +9 -0
- package/dist/tools.js +1177 -0
- package/dist/tracker-progress.d.ts +8 -0
- package/dist/tracker-progress.js +197 -0
- package/dist/types.d.ts +247 -0
- package/dist/types.js +9 -0
- package/openclaw.plugin.json +107 -0
- package/package.json +61 -0
- package/skills/knowhere/SKILL.md +243 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import utils_default from "../utils.js";
|
|
2
|
+
import buildURL from "../helpers/buildURL.js";
|
|
3
|
+
import InterceptorManager from "./InterceptorManager.js";
|
|
4
|
+
import transitional_default from "../defaults/transitional.js";
|
|
5
|
+
import AxiosHeaders from "./AxiosHeaders.js";
|
|
6
|
+
import buildFullPath from "./buildFullPath.js";
|
|
7
|
+
import mergeConfig from "./mergeConfig.js";
|
|
8
|
+
import dispatchRequest from "./dispatchRequest.js";
|
|
9
|
+
import validator_default from "../helpers/validator.js";
|
|
10
|
+
//#region node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/Axios.js
|
|
11
|
+
const validators = validator_default.validators;
|
|
12
|
+
/**
|
|
13
|
+
* Create a new instance of Axios
|
|
14
|
+
*
|
|
15
|
+
* @param {Object} instanceConfig The default config for the instance
|
|
16
|
+
*
|
|
17
|
+
* @return {Axios} A new instance of Axios
|
|
18
|
+
*/
|
|
19
|
+
var Axios = class {
|
|
20
|
+
constructor(instanceConfig) {
|
|
21
|
+
this.defaults = instanceConfig || {};
|
|
22
|
+
this.interceptors = {
|
|
23
|
+
request: new InterceptorManager(),
|
|
24
|
+
response: new InterceptorManager()
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Dispatch a request
|
|
29
|
+
*
|
|
30
|
+
* @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
|
|
31
|
+
* @param {?Object} config
|
|
32
|
+
*
|
|
33
|
+
* @returns {Promise} The Promise to be fulfilled
|
|
34
|
+
*/
|
|
35
|
+
async request(configOrUrl, config) {
|
|
36
|
+
try {
|
|
37
|
+
return await this._request(configOrUrl, config);
|
|
38
|
+
} catch (err) {
|
|
39
|
+
if (err instanceof Error) {
|
|
40
|
+
let dummy = {};
|
|
41
|
+
Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = /* @__PURE__ */ new Error();
|
|
42
|
+
const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : "";
|
|
43
|
+
try {
|
|
44
|
+
if (!err.stack) err.stack = stack;
|
|
45
|
+
else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) err.stack += "\n" + stack;
|
|
46
|
+
} catch (e) {}
|
|
47
|
+
}
|
|
48
|
+
throw err;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
_request(configOrUrl, config) {
|
|
52
|
+
if (typeof configOrUrl === "string") {
|
|
53
|
+
config = config || {};
|
|
54
|
+
config.url = configOrUrl;
|
|
55
|
+
} else config = configOrUrl || {};
|
|
56
|
+
config = mergeConfig(this.defaults, config);
|
|
57
|
+
const { transitional, paramsSerializer, headers } = config;
|
|
58
|
+
if (transitional !== void 0) validator_default.assertOptions(transitional, {
|
|
59
|
+
silentJSONParsing: validators.transitional(validators.boolean),
|
|
60
|
+
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
61
|
+
clarifyTimeoutError: validators.transitional(validators.boolean),
|
|
62
|
+
legacyInterceptorReqResOrdering: validators.transitional(validators.boolean)
|
|
63
|
+
}, false);
|
|
64
|
+
if (paramsSerializer != null) if (utils_default.isFunction(paramsSerializer)) config.paramsSerializer = { serialize: paramsSerializer };
|
|
65
|
+
else validator_default.assertOptions(paramsSerializer, {
|
|
66
|
+
encode: validators.function,
|
|
67
|
+
serialize: validators.function
|
|
68
|
+
}, true);
|
|
69
|
+
if (config.allowAbsoluteUrls !== void 0) {} else if (this.defaults.allowAbsoluteUrls !== void 0) config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
|
|
70
|
+
else config.allowAbsoluteUrls = true;
|
|
71
|
+
validator_default.assertOptions(config, {
|
|
72
|
+
baseUrl: validators.spelling("baseURL"),
|
|
73
|
+
withXsrfToken: validators.spelling("withXSRFToken")
|
|
74
|
+
}, true);
|
|
75
|
+
config.method = (config.method || this.defaults.method || "get").toLowerCase();
|
|
76
|
+
let contextHeaders = headers && utils_default.merge(headers.common, headers[config.method]);
|
|
77
|
+
headers && utils_default.forEach([
|
|
78
|
+
"delete",
|
|
79
|
+
"get",
|
|
80
|
+
"head",
|
|
81
|
+
"post",
|
|
82
|
+
"put",
|
|
83
|
+
"patch",
|
|
84
|
+
"common"
|
|
85
|
+
], (method) => {
|
|
86
|
+
delete headers[method];
|
|
87
|
+
});
|
|
88
|
+
config.headers = AxiosHeaders.concat(contextHeaders, headers);
|
|
89
|
+
const requestInterceptorChain = [];
|
|
90
|
+
let synchronousRequestInterceptors = true;
|
|
91
|
+
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
|
92
|
+
if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config) === false) return;
|
|
93
|
+
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
94
|
+
const transitional = config.transitional || transitional_default;
|
|
95
|
+
if (transitional && transitional.legacyInterceptorReqResOrdering) requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
96
|
+
else requestInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
97
|
+
});
|
|
98
|
+
const responseInterceptorChain = [];
|
|
99
|
+
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
|
100
|
+
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
101
|
+
});
|
|
102
|
+
let promise;
|
|
103
|
+
let i = 0;
|
|
104
|
+
let len;
|
|
105
|
+
if (!synchronousRequestInterceptors) {
|
|
106
|
+
const chain = [dispatchRequest.bind(this), void 0];
|
|
107
|
+
chain.unshift(...requestInterceptorChain);
|
|
108
|
+
chain.push(...responseInterceptorChain);
|
|
109
|
+
len = chain.length;
|
|
110
|
+
promise = Promise.resolve(config);
|
|
111
|
+
while (i < len) promise = promise.then(chain[i++], chain[i++]);
|
|
112
|
+
return promise;
|
|
113
|
+
}
|
|
114
|
+
len = requestInterceptorChain.length;
|
|
115
|
+
let newConfig = config;
|
|
116
|
+
while (i < len) {
|
|
117
|
+
const onFulfilled = requestInterceptorChain[i++];
|
|
118
|
+
const onRejected = requestInterceptorChain[i++];
|
|
119
|
+
try {
|
|
120
|
+
newConfig = onFulfilled(newConfig);
|
|
121
|
+
} catch (error) {
|
|
122
|
+
onRejected.call(this, error);
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
try {
|
|
127
|
+
promise = dispatchRequest.call(this, newConfig);
|
|
128
|
+
} catch (error) {
|
|
129
|
+
return Promise.reject(error);
|
|
130
|
+
}
|
|
131
|
+
i = 0;
|
|
132
|
+
len = responseInterceptorChain.length;
|
|
133
|
+
while (i < len) promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
|
|
134
|
+
return promise;
|
|
135
|
+
}
|
|
136
|
+
getUri(config) {
|
|
137
|
+
config = mergeConfig(this.defaults, config);
|
|
138
|
+
return buildURL(buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls), config.params, config.paramsSerializer);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
utils_default.forEach([
|
|
142
|
+
"delete",
|
|
143
|
+
"get",
|
|
144
|
+
"head",
|
|
145
|
+
"options"
|
|
146
|
+
], function forEachMethodNoData(method) {
|
|
147
|
+
Axios.prototype[method] = function(url, config) {
|
|
148
|
+
return this.request(mergeConfig(config || {}, {
|
|
149
|
+
method,
|
|
150
|
+
url,
|
|
151
|
+
data: (config || {}).data
|
|
152
|
+
}));
|
|
153
|
+
};
|
|
154
|
+
});
|
|
155
|
+
utils_default.forEach([
|
|
156
|
+
"post",
|
|
157
|
+
"put",
|
|
158
|
+
"patch"
|
|
159
|
+
], function forEachMethodWithData(method) {
|
|
160
|
+
function generateHTTPMethod(isForm) {
|
|
161
|
+
return function httpMethod(url, data, config) {
|
|
162
|
+
return this.request(mergeConfig(config || {}, {
|
|
163
|
+
method,
|
|
164
|
+
headers: isForm ? { "Content-Type": "multipart/form-data" } : {},
|
|
165
|
+
url,
|
|
166
|
+
data
|
|
167
|
+
}));
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
Axios.prototype[method] = generateHTTPMethod();
|
|
171
|
+
Axios.prototype[method + "Form"] = generateHTTPMethod(true);
|
|
172
|
+
});
|
|
173
|
+
//#endregion
|
|
174
|
+
export { Axios as default };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import utils_default from "../utils.js";
|
|
2
|
+
//#region node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/AxiosError.js
|
|
3
|
+
var AxiosError = class AxiosError extends Error {
|
|
4
|
+
static from(error, code, config, request, response, customProps) {
|
|
5
|
+
const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
|
|
6
|
+
axiosError.cause = error;
|
|
7
|
+
axiosError.name = error.name;
|
|
8
|
+
if (error.status != null && axiosError.status == null) axiosError.status = error.status;
|
|
9
|
+
customProps && Object.assign(axiosError, customProps);
|
|
10
|
+
return axiosError;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Create an Error with the specified message, config, error code, request and response.
|
|
14
|
+
*
|
|
15
|
+
* @param {string} message The error message.
|
|
16
|
+
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
17
|
+
* @param {Object} [config] The config.
|
|
18
|
+
* @param {Object} [request] The request.
|
|
19
|
+
* @param {Object} [response] The response.
|
|
20
|
+
*
|
|
21
|
+
* @returns {Error} The created error.
|
|
22
|
+
*/
|
|
23
|
+
constructor(message, code, config, request, response) {
|
|
24
|
+
super(message);
|
|
25
|
+
Object.defineProperty(this, "message", {
|
|
26
|
+
value: message,
|
|
27
|
+
enumerable: true,
|
|
28
|
+
writable: true,
|
|
29
|
+
configurable: true
|
|
30
|
+
});
|
|
31
|
+
this.name = "AxiosError";
|
|
32
|
+
this.isAxiosError = true;
|
|
33
|
+
code && (this.code = code);
|
|
34
|
+
config && (this.config = config);
|
|
35
|
+
request && (this.request = request);
|
|
36
|
+
if (response) {
|
|
37
|
+
this.response = response;
|
|
38
|
+
this.status = response.status;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
toJSON() {
|
|
42
|
+
return {
|
|
43
|
+
message: this.message,
|
|
44
|
+
name: this.name,
|
|
45
|
+
description: this.description,
|
|
46
|
+
number: this.number,
|
|
47
|
+
fileName: this.fileName,
|
|
48
|
+
lineNumber: this.lineNumber,
|
|
49
|
+
columnNumber: this.columnNumber,
|
|
50
|
+
stack: this.stack,
|
|
51
|
+
config: utils_default.toJSONObject(this.config),
|
|
52
|
+
code: this.code,
|
|
53
|
+
status: this.status
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
AxiosError.ERR_BAD_OPTION_VALUE = "ERR_BAD_OPTION_VALUE";
|
|
58
|
+
AxiosError.ERR_BAD_OPTION = "ERR_BAD_OPTION";
|
|
59
|
+
AxiosError.ECONNABORTED = "ECONNABORTED";
|
|
60
|
+
AxiosError.ETIMEDOUT = "ETIMEDOUT";
|
|
61
|
+
AxiosError.ERR_NETWORK = "ERR_NETWORK";
|
|
62
|
+
AxiosError.ERR_FR_TOO_MANY_REDIRECTS = "ERR_FR_TOO_MANY_REDIRECTS";
|
|
63
|
+
AxiosError.ERR_DEPRECATED = "ERR_DEPRECATED";
|
|
64
|
+
AxiosError.ERR_BAD_RESPONSE = "ERR_BAD_RESPONSE";
|
|
65
|
+
AxiosError.ERR_BAD_REQUEST = "ERR_BAD_REQUEST";
|
|
66
|
+
AxiosError.ERR_CANCELED = "ERR_CANCELED";
|
|
67
|
+
AxiosError.ERR_NOT_SUPPORT = "ERR_NOT_SUPPORT";
|
|
68
|
+
AxiosError.ERR_INVALID_URL = "ERR_INVALID_URL";
|
|
69
|
+
//#endregion
|
|
70
|
+
export { AxiosError as default };
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import utils_default from "../utils.js";
|
|
2
|
+
import parseHeaders_default from "../helpers/parseHeaders.js";
|
|
3
|
+
//#region node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/AxiosHeaders.js
|
|
4
|
+
const $internals = Symbol("internals");
|
|
5
|
+
function normalizeHeader(header) {
|
|
6
|
+
return header && String(header).trim().toLowerCase();
|
|
7
|
+
}
|
|
8
|
+
function normalizeValue(value) {
|
|
9
|
+
if (value === false || value == null) return value;
|
|
10
|
+
return utils_default.isArray(value) ? value.map(normalizeValue) : String(value);
|
|
11
|
+
}
|
|
12
|
+
function parseTokens(str) {
|
|
13
|
+
const tokens = Object.create(null);
|
|
14
|
+
const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
15
|
+
let match;
|
|
16
|
+
while (match = tokensRE.exec(str)) tokens[match[1]] = match[2];
|
|
17
|
+
return tokens;
|
|
18
|
+
}
|
|
19
|
+
const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
|
20
|
+
function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
|
21
|
+
if (utils_default.isFunction(filter)) return filter.call(this, value, header);
|
|
22
|
+
if (isHeaderNameFilter) value = header;
|
|
23
|
+
if (!utils_default.isString(value)) return;
|
|
24
|
+
if (utils_default.isString(filter)) return value.indexOf(filter) !== -1;
|
|
25
|
+
if (utils_default.isRegExp(filter)) return filter.test(value);
|
|
26
|
+
}
|
|
27
|
+
function formatHeader(header) {
|
|
28
|
+
return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
|
|
29
|
+
return char.toUpperCase() + str;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function buildAccessors(obj, header) {
|
|
33
|
+
const accessorName = utils_default.toCamelCase(" " + header);
|
|
34
|
+
[
|
|
35
|
+
"get",
|
|
36
|
+
"set",
|
|
37
|
+
"has"
|
|
38
|
+
].forEach((methodName) => {
|
|
39
|
+
Object.defineProperty(obj, methodName + accessorName, {
|
|
40
|
+
value: function(arg1, arg2, arg3) {
|
|
41
|
+
return this[methodName].call(this, header, arg1, arg2, arg3);
|
|
42
|
+
},
|
|
43
|
+
configurable: true
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
var AxiosHeaders = class {
|
|
48
|
+
constructor(headers) {
|
|
49
|
+
headers && this.set(headers);
|
|
50
|
+
}
|
|
51
|
+
set(header, valueOrRewrite, rewrite) {
|
|
52
|
+
const self = this;
|
|
53
|
+
function setHeader(_value, _header, _rewrite) {
|
|
54
|
+
const lHeader = normalizeHeader(_header);
|
|
55
|
+
if (!lHeader) throw new Error("header name must be a non-empty string");
|
|
56
|
+
const key = utils_default.findKey(self, lHeader);
|
|
57
|
+
if (!key || self[key] === void 0 || _rewrite === true || _rewrite === void 0 && self[key] !== false) self[key || _header] = normalizeValue(_value);
|
|
58
|
+
}
|
|
59
|
+
const setHeaders = (headers, _rewrite) => utils_default.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
|
60
|
+
if (utils_default.isPlainObject(header) || header instanceof this.constructor) setHeaders(header, valueOrRewrite);
|
|
61
|
+
else if (utils_default.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) setHeaders(parseHeaders_default(header), valueOrRewrite);
|
|
62
|
+
else if (utils_default.isObject(header) && utils_default.isIterable(header)) {
|
|
63
|
+
let obj = {}, dest, key;
|
|
64
|
+
for (const entry of header) {
|
|
65
|
+
if (!utils_default.isArray(entry)) throw TypeError("Object iterator must return a key-value pair");
|
|
66
|
+
obj[key = entry[0]] = (dest = obj[key]) ? utils_default.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]] : entry[1];
|
|
67
|
+
}
|
|
68
|
+
setHeaders(obj, valueOrRewrite);
|
|
69
|
+
} else header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
70
|
+
return this;
|
|
71
|
+
}
|
|
72
|
+
get(header, parser) {
|
|
73
|
+
header = normalizeHeader(header);
|
|
74
|
+
if (header) {
|
|
75
|
+
const key = utils_default.findKey(this, header);
|
|
76
|
+
if (key) {
|
|
77
|
+
const value = this[key];
|
|
78
|
+
if (!parser) return value;
|
|
79
|
+
if (parser === true) return parseTokens(value);
|
|
80
|
+
if (utils_default.isFunction(parser)) return parser.call(this, value, key);
|
|
81
|
+
if (utils_default.isRegExp(parser)) return parser.exec(value);
|
|
82
|
+
throw new TypeError("parser must be boolean|regexp|function");
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
has(header, matcher) {
|
|
87
|
+
header = normalizeHeader(header);
|
|
88
|
+
if (header) {
|
|
89
|
+
const key = utils_default.findKey(this, header);
|
|
90
|
+
return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
|
91
|
+
}
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
delete(header, matcher) {
|
|
95
|
+
const self = this;
|
|
96
|
+
let deleted = false;
|
|
97
|
+
function deleteHeader(_header) {
|
|
98
|
+
_header = normalizeHeader(_header);
|
|
99
|
+
if (_header) {
|
|
100
|
+
const key = utils_default.findKey(self, _header);
|
|
101
|
+
if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
|
|
102
|
+
delete self[key];
|
|
103
|
+
deleted = true;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (utils_default.isArray(header)) header.forEach(deleteHeader);
|
|
108
|
+
else deleteHeader(header);
|
|
109
|
+
return deleted;
|
|
110
|
+
}
|
|
111
|
+
clear(matcher) {
|
|
112
|
+
const keys = Object.keys(this);
|
|
113
|
+
let i = keys.length;
|
|
114
|
+
let deleted = false;
|
|
115
|
+
while (i--) {
|
|
116
|
+
const key = keys[i];
|
|
117
|
+
if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
118
|
+
delete this[key];
|
|
119
|
+
deleted = true;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return deleted;
|
|
123
|
+
}
|
|
124
|
+
normalize(format) {
|
|
125
|
+
const self = this;
|
|
126
|
+
const headers = {};
|
|
127
|
+
utils_default.forEach(this, (value, header) => {
|
|
128
|
+
const key = utils_default.findKey(headers, header);
|
|
129
|
+
if (key) {
|
|
130
|
+
self[key] = normalizeValue(value);
|
|
131
|
+
delete self[header];
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
const normalized = format ? formatHeader(header) : String(header).trim();
|
|
135
|
+
if (normalized !== header) delete self[header];
|
|
136
|
+
self[normalized] = normalizeValue(value);
|
|
137
|
+
headers[normalized] = true;
|
|
138
|
+
});
|
|
139
|
+
return this;
|
|
140
|
+
}
|
|
141
|
+
concat(...targets) {
|
|
142
|
+
return this.constructor.concat(this, ...targets);
|
|
143
|
+
}
|
|
144
|
+
toJSON(asStrings) {
|
|
145
|
+
const obj = Object.create(null);
|
|
146
|
+
utils_default.forEach(this, (value, header) => {
|
|
147
|
+
value != null && value !== false && (obj[header] = asStrings && utils_default.isArray(value) ? value.join(", ") : value);
|
|
148
|
+
});
|
|
149
|
+
return obj;
|
|
150
|
+
}
|
|
151
|
+
[Symbol.iterator]() {
|
|
152
|
+
return Object.entries(this.toJSON())[Symbol.iterator]();
|
|
153
|
+
}
|
|
154
|
+
toString() {
|
|
155
|
+
return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
|
|
156
|
+
}
|
|
157
|
+
getSetCookie() {
|
|
158
|
+
return this.get("set-cookie") || [];
|
|
159
|
+
}
|
|
160
|
+
get [Symbol.toStringTag]() {
|
|
161
|
+
return "AxiosHeaders";
|
|
162
|
+
}
|
|
163
|
+
static from(thing) {
|
|
164
|
+
return thing instanceof this ? thing : new this(thing);
|
|
165
|
+
}
|
|
166
|
+
static concat(first, ...targets) {
|
|
167
|
+
const computed = new this(first);
|
|
168
|
+
targets.forEach((target) => computed.set(target));
|
|
169
|
+
return computed;
|
|
170
|
+
}
|
|
171
|
+
static accessor(header) {
|
|
172
|
+
const accessors = (this[$internals] = this[$internals] = { accessors: {} }).accessors;
|
|
173
|
+
const prototype = this.prototype;
|
|
174
|
+
function defineAccessor(_header) {
|
|
175
|
+
const lHeader = normalizeHeader(_header);
|
|
176
|
+
if (!accessors[lHeader]) {
|
|
177
|
+
buildAccessors(prototype, _header);
|
|
178
|
+
accessors[lHeader] = true;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
utils_default.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
|
182
|
+
return this;
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
AxiosHeaders.accessor([
|
|
186
|
+
"Content-Type",
|
|
187
|
+
"Content-Length",
|
|
188
|
+
"Accept",
|
|
189
|
+
"Accept-Encoding",
|
|
190
|
+
"User-Agent",
|
|
191
|
+
"Authorization"
|
|
192
|
+
]);
|
|
193
|
+
utils_default.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
|
|
194
|
+
let mapped = key[0].toUpperCase() + key.slice(1);
|
|
195
|
+
return {
|
|
196
|
+
get: () => value,
|
|
197
|
+
set(headerValue) {
|
|
198
|
+
this[mapped] = headerValue;
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
});
|
|
202
|
+
utils_default.freezeMethods(AxiosHeaders);
|
|
203
|
+
//#endregion
|
|
204
|
+
export { AxiosHeaders as default };
|
package/dist/node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/InterceptorManager.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import utils_default from "../utils.js";
|
|
2
|
+
//#region node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/InterceptorManager.js
|
|
3
|
+
var InterceptorManager = class {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.handlers = [];
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Add a new interceptor to the stack
|
|
9
|
+
*
|
|
10
|
+
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
11
|
+
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
12
|
+
* @param {Object} options The options for the interceptor, synchronous and runWhen
|
|
13
|
+
*
|
|
14
|
+
* @return {Number} An ID used to remove interceptor later
|
|
15
|
+
*/
|
|
16
|
+
use(fulfilled, rejected, options) {
|
|
17
|
+
this.handlers.push({
|
|
18
|
+
fulfilled,
|
|
19
|
+
rejected,
|
|
20
|
+
synchronous: options ? options.synchronous : false,
|
|
21
|
+
runWhen: options ? options.runWhen : null
|
|
22
|
+
});
|
|
23
|
+
return this.handlers.length - 1;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Remove an interceptor from the stack
|
|
27
|
+
*
|
|
28
|
+
* @param {Number} id The ID that was returned by `use`
|
|
29
|
+
*
|
|
30
|
+
* @returns {void}
|
|
31
|
+
*/
|
|
32
|
+
eject(id) {
|
|
33
|
+
if (this.handlers[id]) this.handlers[id] = null;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Clear all interceptors from the stack
|
|
37
|
+
*
|
|
38
|
+
* @returns {void}
|
|
39
|
+
*/
|
|
40
|
+
clear() {
|
|
41
|
+
if (this.handlers) this.handlers = [];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Iterate over all the registered interceptors
|
|
45
|
+
*
|
|
46
|
+
* This method is particularly useful for skipping over any
|
|
47
|
+
* interceptors that may have become `null` calling `eject`.
|
|
48
|
+
*
|
|
49
|
+
* @param {Function} fn The function to call for each interceptor
|
|
50
|
+
*
|
|
51
|
+
* @returns {void}
|
|
52
|
+
*/
|
|
53
|
+
forEach(fn) {
|
|
54
|
+
utils_default.forEach(this.handlers, function forEachHandler(h) {
|
|
55
|
+
if (h !== null) fn(h);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
//#endregion
|
|
60
|
+
export { InterceptorManager as default };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import isAbsoluteURL from "../helpers/isAbsoluteURL.js";
|
|
2
|
+
import combineURLs from "../helpers/combineURLs.js";
|
|
3
|
+
//#region node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/buildFullPath.js
|
|
4
|
+
/**
|
|
5
|
+
* Creates a new URL by combining the baseURL with the requestedURL,
|
|
6
|
+
* only when the requestedURL is not already an absolute URL.
|
|
7
|
+
* If the requestURL is absolute, this function returns the requestedURL untouched.
|
|
8
|
+
*
|
|
9
|
+
* @param {string} baseURL The base URL
|
|
10
|
+
* @param {string} requestedURL Absolute or relative URL to combine
|
|
11
|
+
*
|
|
12
|
+
* @returns {string} The combined full path
|
|
13
|
+
*/
|
|
14
|
+
function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
|
15
|
+
let isRelativeUrl = !isAbsoluteURL(requestedURL);
|
|
16
|
+
if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) return combineURLs(baseURL, requestedURL);
|
|
17
|
+
return requestedURL;
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { buildFullPath as default };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import defaults from "../defaults/index.js";
|
|
2
|
+
import AxiosHeaders from "./AxiosHeaders.js";
|
|
3
|
+
import transformData from "./transformData.js";
|
|
4
|
+
import isCancel from "../cancel/isCancel.js";
|
|
5
|
+
import CanceledError from "../cancel/CanceledError.js";
|
|
6
|
+
import adapters_default from "../adapters/adapters.js";
|
|
7
|
+
//#region node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/dispatchRequest.js
|
|
8
|
+
/**
|
|
9
|
+
* Throws a `CanceledError` if cancellation has been requested.
|
|
10
|
+
*
|
|
11
|
+
* @param {Object} config The config that is to be used for the request
|
|
12
|
+
*
|
|
13
|
+
* @returns {void}
|
|
14
|
+
*/
|
|
15
|
+
function throwIfCancellationRequested(config) {
|
|
16
|
+
if (config.cancelToken) config.cancelToken.throwIfRequested();
|
|
17
|
+
if (config.signal && config.signal.aborted) throw new CanceledError(null, config);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Dispatch a request to the server using the configured adapter.
|
|
21
|
+
*
|
|
22
|
+
* @param {object} config The config that is to be used for the request
|
|
23
|
+
*
|
|
24
|
+
* @returns {Promise} The Promise to be fulfilled
|
|
25
|
+
*/
|
|
26
|
+
function dispatchRequest(config) {
|
|
27
|
+
throwIfCancellationRequested(config);
|
|
28
|
+
config.headers = AxiosHeaders.from(config.headers);
|
|
29
|
+
config.data = transformData.call(config, config.transformRequest);
|
|
30
|
+
if ([
|
|
31
|
+
"post",
|
|
32
|
+
"put",
|
|
33
|
+
"patch"
|
|
34
|
+
].indexOf(config.method) !== -1) config.headers.setContentType("application/x-www-form-urlencoded", false);
|
|
35
|
+
return adapters_default.getAdapter(config.adapter || defaults.adapter, config)(config).then(function onAdapterResolution(response) {
|
|
36
|
+
throwIfCancellationRequested(config);
|
|
37
|
+
response.data = transformData.call(config, config.transformResponse, response);
|
|
38
|
+
response.headers = AxiosHeaders.from(response.headers);
|
|
39
|
+
return response;
|
|
40
|
+
}, function onAdapterRejection(reason) {
|
|
41
|
+
if (!isCancel(reason)) {
|
|
42
|
+
throwIfCancellationRequested(config);
|
|
43
|
+
if (reason && reason.response) {
|
|
44
|
+
reason.response.data = transformData.call(config, config.transformResponse, reason.response);
|
|
45
|
+
reason.response.headers = AxiosHeaders.from(reason.response.headers);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return Promise.reject(reason);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
export { dispatchRequest as default };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import utils_default from "../utils.js";
|
|
2
|
+
import AxiosHeaders from "./AxiosHeaders.js";
|
|
3
|
+
//#region node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/mergeConfig.js
|
|
4
|
+
const headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing;
|
|
5
|
+
/**
|
|
6
|
+
* Config-specific merge-function which creates a new config-object
|
|
7
|
+
* by merging two configuration objects together.
|
|
8
|
+
*
|
|
9
|
+
* @param {Object} config1
|
|
10
|
+
* @param {Object} config2
|
|
11
|
+
*
|
|
12
|
+
* @returns {Object} New object resulting from merging config2 to config1
|
|
13
|
+
*/
|
|
14
|
+
function mergeConfig(config1, config2) {
|
|
15
|
+
config2 = config2 || {};
|
|
16
|
+
const config = {};
|
|
17
|
+
function getMergedValue(target, source, prop, caseless) {
|
|
18
|
+
if (utils_default.isPlainObject(target) && utils_default.isPlainObject(source)) return utils_default.merge.call({ caseless }, target, source);
|
|
19
|
+
else if (utils_default.isPlainObject(source)) return utils_default.merge({}, source);
|
|
20
|
+
else if (utils_default.isArray(source)) return source.slice();
|
|
21
|
+
return source;
|
|
22
|
+
}
|
|
23
|
+
function mergeDeepProperties(a, b, prop, caseless) {
|
|
24
|
+
if (!utils_default.isUndefined(b)) return getMergedValue(a, b, prop, caseless);
|
|
25
|
+
else if (!utils_default.isUndefined(a)) return getMergedValue(void 0, a, prop, caseless);
|
|
26
|
+
}
|
|
27
|
+
function valueFromConfig2(a, b) {
|
|
28
|
+
if (!utils_default.isUndefined(b)) return getMergedValue(void 0, b);
|
|
29
|
+
}
|
|
30
|
+
function defaultToConfig2(a, b) {
|
|
31
|
+
if (!utils_default.isUndefined(b)) return getMergedValue(void 0, b);
|
|
32
|
+
else if (!utils_default.isUndefined(a)) return getMergedValue(void 0, a);
|
|
33
|
+
}
|
|
34
|
+
function mergeDirectKeys(a, b, prop) {
|
|
35
|
+
if (prop in config2) return getMergedValue(a, b);
|
|
36
|
+
else if (prop in config1) return getMergedValue(void 0, a);
|
|
37
|
+
}
|
|
38
|
+
const mergeMap = {
|
|
39
|
+
url: valueFromConfig2,
|
|
40
|
+
method: valueFromConfig2,
|
|
41
|
+
data: valueFromConfig2,
|
|
42
|
+
baseURL: defaultToConfig2,
|
|
43
|
+
transformRequest: defaultToConfig2,
|
|
44
|
+
transformResponse: defaultToConfig2,
|
|
45
|
+
paramsSerializer: defaultToConfig2,
|
|
46
|
+
timeout: defaultToConfig2,
|
|
47
|
+
timeoutMessage: defaultToConfig2,
|
|
48
|
+
withCredentials: defaultToConfig2,
|
|
49
|
+
withXSRFToken: defaultToConfig2,
|
|
50
|
+
adapter: defaultToConfig2,
|
|
51
|
+
responseType: defaultToConfig2,
|
|
52
|
+
xsrfCookieName: defaultToConfig2,
|
|
53
|
+
xsrfHeaderName: defaultToConfig2,
|
|
54
|
+
onUploadProgress: defaultToConfig2,
|
|
55
|
+
onDownloadProgress: defaultToConfig2,
|
|
56
|
+
decompress: defaultToConfig2,
|
|
57
|
+
maxContentLength: defaultToConfig2,
|
|
58
|
+
maxBodyLength: defaultToConfig2,
|
|
59
|
+
beforeRedirect: defaultToConfig2,
|
|
60
|
+
transport: defaultToConfig2,
|
|
61
|
+
httpAgent: defaultToConfig2,
|
|
62
|
+
httpsAgent: defaultToConfig2,
|
|
63
|
+
cancelToken: defaultToConfig2,
|
|
64
|
+
socketPath: defaultToConfig2,
|
|
65
|
+
responseEncoding: defaultToConfig2,
|
|
66
|
+
validateStatus: mergeDirectKeys,
|
|
67
|
+
headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
|
|
68
|
+
};
|
|
69
|
+
utils_default.forEach(Object.keys({
|
|
70
|
+
...config1,
|
|
71
|
+
...config2
|
|
72
|
+
}), function computeConfigValue(prop) {
|
|
73
|
+
if (prop === "__proto__" || prop === "constructor" || prop === "prototype") return;
|
|
74
|
+
const merge = utils_default.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
|
|
75
|
+
const configValue = merge(config1[prop], config2[prop], prop);
|
|
76
|
+
utils_default.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue);
|
|
77
|
+
});
|
|
78
|
+
return config;
|
|
79
|
+
}
|
|
80
|
+
//#endregion
|
|
81
|
+
export { mergeConfig as default };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import AxiosError from "./AxiosError.js";
|
|
2
|
+
//#region node_modules/.pnpm/axios@1.13.6/node_modules/axios/lib/core/settle.js
|
|
3
|
+
/**
|
|
4
|
+
* Resolve or reject a Promise based on response status.
|
|
5
|
+
*
|
|
6
|
+
* @param {Function} resolve A function that resolves the promise.
|
|
7
|
+
* @param {Function} reject A function that rejects the promise.
|
|
8
|
+
* @param {object} response The response.
|
|
9
|
+
*
|
|
10
|
+
* @returns {object} The response.
|
|
11
|
+
*/
|
|
12
|
+
function settle(resolve, reject, response) {
|
|
13
|
+
const validateStatus = response.config.validateStatus;
|
|
14
|
+
if (!response.status || !validateStatus || validateStatus(response.status)) resolve(response);
|
|
15
|
+
else reject(new AxiosError("Request failed with status code " + response.status, [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], response.config, response.request, response));
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { settle as default };
|