@boxfoxs/biztalk 0.0.10 → 1.0.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/dist/esm/requester.js +1 -1
- package/dist/requester.js +1 -1
- package/package.json +3 -3
- package/src/requester.ts +5 -5
package/dist/esm/requester.js
CHANGED
|
@@ -41,7 +41,7 @@ function injectToken(requester, token) {
|
|
|
41
41
|
requester.interceptors.request.use(function (payload) {
|
|
42
42
|
const tokenValue = token.get();
|
|
43
43
|
if (tokenValue) {
|
|
44
|
-
payload.headers
|
|
44
|
+
payload.headers.set("bt-token", tokenValue);
|
|
45
45
|
}
|
|
46
46
|
return payload;
|
|
47
47
|
});
|
package/dist/requester.js
CHANGED
|
@@ -50,7 +50,7 @@ function injectToken(requester, token) {
|
|
|
50
50
|
requester.interceptors.request.use(function (payload) {
|
|
51
51
|
const tokenValue = token.get();
|
|
52
52
|
if (tokenValue) {
|
|
53
|
-
payload.headers
|
|
53
|
+
payload.headers.set("bt-token", tokenValue);
|
|
54
54
|
}
|
|
55
55
|
return payload;
|
|
56
56
|
});
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@boxfoxs/biztalk",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "biztalk api",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
|
-
"module": "dist/esm",
|
|
7
|
+
"module": "dist/esm/index.js",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"build": "rm -rf dist && tsc -p tsconfig.json && tsc -p tsconfig.esm.json",
|
|
10
|
-
"deploy": "yarn build &&
|
|
10
|
+
"deploy": "yarn build && npm publish --access=public"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
13
|
"typescript": "^4.6.2"
|
package/src/requester.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import axios, { AxiosInstance,
|
|
1
|
+
import axios, { AxiosInstance, InternalAxiosRequestConfig } from "axios";
|
|
2
2
|
|
|
3
3
|
export interface BiztalkRequester extends AxiosInstance {
|
|
4
4
|
token: Token;
|
|
@@ -8,7 +8,7 @@ export function createBiztalkRequester(senderKey: string) {
|
|
|
8
8
|
const clinet = axios.create({
|
|
9
9
|
baseURL: "https://www.biztalk-api.com",
|
|
10
10
|
});
|
|
11
|
-
clinet.interceptors.request.use(function (config:
|
|
11
|
+
clinet.interceptors.request.use(function (config: InternalAxiosRequestConfig) {
|
|
12
12
|
config.data = { senderKey, ...config.data };
|
|
13
13
|
return config;
|
|
14
14
|
});
|
|
@@ -20,7 +20,7 @@ export function createBiztalkBypassRequester(
|
|
|
20
20
|
senderKey: string
|
|
21
21
|
) {
|
|
22
22
|
const clinet = axios.create({ baseURL: bypassUrl });
|
|
23
|
-
clinet.interceptors.request.use(function (config:
|
|
23
|
+
clinet.interceptors.request.use(function (config: InternalAxiosRequestConfig) {
|
|
24
24
|
config.data = {
|
|
25
25
|
url: `https://www.biztalk-api.com/${config.url}`,
|
|
26
26
|
data: { senderKey, ...config.data },
|
|
@@ -54,10 +54,10 @@ class Token {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
function injectToken(requester: AxiosInstance, token: Token) {
|
|
57
|
-
requester.interceptors.request.use(function (payload:
|
|
57
|
+
requester.interceptors.request.use(function (payload: InternalAxiosRequestConfig) {
|
|
58
58
|
const tokenValue = token.get();
|
|
59
59
|
if (tokenValue) {
|
|
60
|
-
payload.headers
|
|
60
|
+
payload.headers.set("bt-token", tokenValue);
|
|
61
61
|
}
|
|
62
62
|
return payload;
|
|
63
63
|
});
|