@zwa73/utils 1.0.200 → 1.0.201
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/UtilCom.d.ts +12 -12
- package/package.json +1 -1
- package/src/UtilCom.ts +1 -1
package/dist/UtilCom.d.ts
CHANGED
|
@@ -100,7 +100,7 @@ export declare class UtilCom<D extends Partial<RequestOption> & Required<Pick<Re
|
|
|
100
100
|
headers: {
|
|
101
101
|
"Content-Type": "application/json";
|
|
102
102
|
};
|
|
103
|
-
}, SendProc<[JToken]>, AcceptProc<string, JToken>>;
|
|
103
|
+
}, SendProc<[JToken]>, AcceptProc<string, RequestResult<JToken> | undefined>>;
|
|
104
104
|
/**收发皆为json的post预设 */
|
|
105
105
|
postJson(): UtilCom<D & {
|
|
106
106
|
method: "POST";
|
|
@@ -108,15 +108,15 @@ export declare class UtilCom<D extends Partial<RequestOption> & Required<Pick<Re
|
|
|
108
108
|
headers: {
|
|
109
109
|
'Content-Type': "application/json";
|
|
110
110
|
};
|
|
111
|
-
}, SendProc<[JToken]>, AcceptProc<string, JToken>>;
|
|
111
|
+
}, SendProc<[JToken]>, AcceptProc<string, RequestResult<JToken> | undefined>>;
|
|
112
112
|
/**无查询参数获取json的get预设 */
|
|
113
113
|
getJson(): UtilCom<D & {
|
|
114
114
|
method: "GET";
|
|
115
|
-
}, SendProc<[]>, AcceptProc<string, JToken>>;
|
|
115
|
+
}, SendProc<[]>, AcceptProc<string, RequestResult<JToken> | undefined>>;
|
|
116
116
|
/**有查询参数获取json的get预设 */
|
|
117
117
|
queryJson(): UtilCom<D & {
|
|
118
118
|
method: "GET";
|
|
119
|
-
}, SendProc<[QueryRequestData]>, AcceptProc<string, JToken>>;
|
|
119
|
+
}, SendProc<[QueryRequestData]>, AcceptProc<string, RequestResult<JToken> | undefined>>;
|
|
120
120
|
/**收发皆为json的https-post预设 */
|
|
121
121
|
static httpsPostJson(): UtilCom<{
|
|
122
122
|
readonly protocol: "https:";
|
|
@@ -126,7 +126,7 @@ export declare class UtilCom<D extends Partial<RequestOption> & Required<Pick<Re
|
|
|
126
126
|
headers: {
|
|
127
127
|
'Content-Type': "application/json";
|
|
128
128
|
};
|
|
129
|
-
}, SendProc<[JToken]>, AcceptProc<string, JToken>>;
|
|
129
|
+
}, SendProc<[JToken]>, AcceptProc<string, RequestResult<JToken> | undefined>>;
|
|
130
130
|
/**收发皆为json的http-post预设 */
|
|
131
131
|
static httpPostJson(): UtilCom<{
|
|
132
132
|
readonly protocol: "http:";
|
|
@@ -136,37 +136,37 @@ export declare class UtilCom<D extends Partial<RequestOption> & Required<Pick<Re
|
|
|
136
136
|
headers: {
|
|
137
137
|
'Content-Type': "application/json";
|
|
138
138
|
};
|
|
139
|
-
}, SendProc<[JToken]>, AcceptProc<string, JToken>>;
|
|
139
|
+
}, SendProc<[JToken]>, AcceptProc<string, RequestResult<JToken> | undefined>>;
|
|
140
140
|
/**无查询参数获取json的https-get预设 */
|
|
141
141
|
static httpsGetJson(): UtilCom<{
|
|
142
142
|
readonly protocol: "https:";
|
|
143
143
|
} & {
|
|
144
144
|
method: "GET";
|
|
145
|
-
}, SendProc<[]>, AcceptProc<string, JToken>>;
|
|
145
|
+
}, SendProc<[]>, AcceptProc<string, RequestResult<JToken> | undefined>>;
|
|
146
146
|
/**有查询参数获取json的https-get预设 */
|
|
147
147
|
static httpsQueryJson(): UtilCom<{
|
|
148
148
|
readonly protocol: "http:";
|
|
149
149
|
} & {
|
|
150
150
|
method: "GET";
|
|
151
|
-
}, SendProc<[QueryRequestData]>, AcceptProc<string, JToken>>;
|
|
151
|
+
}, SendProc<[QueryRequestData]>, AcceptProc<string, RequestResult<JToken> | undefined>>;
|
|
152
152
|
/**无查询参数获取json的http-get预设 */
|
|
153
153
|
static httpGetJson(): UtilCom<{
|
|
154
154
|
readonly protocol: "http:";
|
|
155
155
|
} & {
|
|
156
156
|
method: "GET";
|
|
157
|
-
}, SendProc<[]>, AcceptProc<string, JToken>>;
|
|
157
|
+
}, SendProc<[]>, AcceptProc<string, RequestResult<JToken> | undefined>>;
|
|
158
158
|
/**有查询参数获取json的http-get预设 */
|
|
159
159
|
static httpQueryJson(): UtilCom<{
|
|
160
160
|
readonly protocol: "http:";
|
|
161
161
|
} & {
|
|
162
162
|
method: "GET";
|
|
163
|
-
}, SendProc<[QueryRequestData]>, AcceptProc<string, JToken>>;
|
|
163
|
+
}, SendProc<[QueryRequestData]>, AcceptProc<string, RequestResult<JToken> | undefined>>;
|
|
164
164
|
/**预设的接收数据类型*/
|
|
165
165
|
accept<T extends AcceptType>(t: T): {
|
|
166
|
-
readonly json: UtilCom<D, S, AcceptProc<string, JToken>>;
|
|
166
|
+
readonly json: UtilCom<D, S, AcceptProc<string, RequestResult<JToken> | undefined>>;
|
|
167
167
|
readonly string: UtilCom<D, S, AcceptProc<string, RequestResult<string> | undefined>>;
|
|
168
168
|
}[T];
|
|
169
|
-
acceptJson(): UtilCom<D, S, AcceptProc<string, JToken>>;
|
|
169
|
+
acceptJson(): UtilCom<D, S, AcceptProc<string, RequestResult<JToken> | undefined>>;
|
|
170
170
|
acceptString(): UtilCom<D, S, typeof AcceptStringProc>;
|
|
171
171
|
/**自定的接收数据类型*/
|
|
172
172
|
acceptRaw<AD, AT>(proc: AcceptProc<AD, AT>): UtilCom<D, S, typeof proc>;
|
package/package.json
CHANGED
package/src/UtilCom.ts
CHANGED
|
@@ -202,7 +202,7 @@ A extends AcceptProc<any,any>,
|
|
|
202
202
|
return map[t];
|
|
203
203
|
}
|
|
204
204
|
acceptJson(){
|
|
205
|
-
const proc:AcceptProc<string,JToken>={
|
|
205
|
+
const proc:AcceptProc<string,RequestResult<JToken>|undefined>={
|
|
206
206
|
init:'',
|
|
207
207
|
reduce:(acc,curr)=>acc+curr,
|
|
208
208
|
parse:(result)=>{
|