ziya-utils 1.1.5 → 1.1.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/ziya-utils.js +1 -1
- package/es/async/index.js +57 -0
- package/es/document/index.d.ts +6 -0
- package/es/document/index.js +6 -0
- package/es/document/script-dom-builder.d.ts +80 -0
- package/es/document/script-dom-builder.js +366 -0
- package/es/form/index.d.ts +8 -2
- package/es/form/index.js +11 -3
- package/es/index.d.ts +1 -0
- package/es/index.js +3 -1
- package/es/node_modules/tslib/tslib.es6.js +13 -1
- package/es/xhr/index.d.ts +2 -2
- package/es/xhr/index.js +2 -2
- package/lib/async/index.js +59 -0
- package/lib/document/index.d.ts +6 -0
- package/lib/document/index.js +6 -0
- package/lib/document/script-dom-builder.d.ts +80 -0
- package/lib/document/script-dom-builder.js +368 -0
- package/lib/form/index.d.ts +8 -2
- package/lib/form/index.js +11 -2
- package/lib/index.d.ts +1 -0
- package/lib/index.js +5 -0
- package/lib/node_modules/tslib/tslib.es6.js +13 -0
- package/lib/xhr/index.d.ts +2 -2
- package/lib/xhr/index.js +2 -2
- package/package.json +1 -1
|
@@ -17,6 +17,18 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
|
17
17
|
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
18
18
|
|
|
19
19
|
|
|
20
|
+
function __rest(s, e) {
|
|
21
|
+
var t = {};
|
|
22
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
23
|
+
t[p] = s[p];
|
|
24
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
25
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
26
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
27
|
+
t[p[i]] = s[p[i]];
|
|
28
|
+
}
|
|
29
|
+
return t;
|
|
30
|
+
}
|
|
31
|
+
|
|
20
32
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
21
33
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
22
34
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -33,3 +45,4 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
33
45
|
};
|
|
34
46
|
|
|
35
47
|
exports.__awaiter = __awaiter;
|
|
48
|
+
exports.__rest = __rest;
|
package/lib/xhr/index.d.ts
CHANGED
|
@@ -10,9 +10,9 @@ interface InterceptRule {
|
|
|
10
10
|
/** 拦截的 URL,模糊匹配 */
|
|
11
11
|
url: string;
|
|
12
12
|
/** 拦截响应的回调函数 */
|
|
13
|
-
responseCallback: (data: any) => any;
|
|
13
|
+
responseCallback: (data: any, url: string) => any;
|
|
14
14
|
/** 拦截请求的回调函数 */
|
|
15
|
-
requestCallback?: (data: any) => any;
|
|
15
|
+
requestCallback?: (data: any, url: string) => any;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* 拦截器配置
|
package/lib/xhr/index.js
CHANGED
|
@@ -48,7 +48,7 @@ class XHRInterceptor {
|
|
|
48
48
|
let processedBody = body;
|
|
49
49
|
if (matchingRule.requestCallback && body) {
|
|
50
50
|
try {
|
|
51
|
-
processedBody = matchingRule.requestCallback(body);
|
|
51
|
+
processedBody = matchingRule.requestCallback(body, requestUrl);
|
|
52
52
|
}
|
|
53
53
|
catch (error) {
|
|
54
54
|
console.error('XHR请求拦截器处理失败:', error);
|
|
@@ -64,7 +64,7 @@ class XHRInterceptor {
|
|
|
64
64
|
// 解析原始响应
|
|
65
65
|
const originalData = JSON.parse(xhr.responseText);
|
|
66
66
|
// 使用回调函数处理响应数据
|
|
67
|
-
const modifiedData = matchingRule.responseCallback(originalData);
|
|
67
|
+
const modifiedData = matchingRule.responseCallback(originalData, requestUrl);
|
|
68
68
|
// 重写响应属性
|
|
69
69
|
Object.defineProperty(xhr, "responseText", {
|
|
70
70
|
writable: true,
|