@publinx/mihomo-st-api 1.1.1 → 1.1.2
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.d.ts +19 -19
- package/dist/index.js +14 -11
- package/package.json +9 -9
- package/LICENSE +0 -21
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
//#region src/resources/version.d.ts
|
|
2
|
-
type VersionInfo = {
|
|
3
|
-
name: string;
|
|
4
|
-
version: string;
|
|
5
|
-
};
|
|
6
|
-
//#endregion
|
|
7
|
-
//#region src/resources/digest.d.ts
|
|
8
|
-
type DigestRequest = Record<string, unknown>;
|
|
9
|
-
type DigestResponse = {
|
|
10
|
-
digest: string;
|
|
11
|
-
};
|
|
12
|
-
//#endregion
|
|
13
1
|
//#region ../../node_modules/.pnpm/type-fest@5.7.0/node_modules/type-fest/source/primitive.d.ts
|
|
14
2
|
/**
|
|
15
3
|
Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
|
|
@@ -959,6 +947,12 @@ type RuntimeConfig = {
|
|
|
959
947
|
download: RequiredDeep<DownloadRequest>;
|
|
960
948
|
};
|
|
961
949
|
//#endregion
|
|
950
|
+
//#region src/resources/digest.d.ts
|
|
951
|
+
type DigestRequest = Record<string, unknown>;
|
|
952
|
+
type DigestResponse = {
|
|
953
|
+
digest: string;
|
|
954
|
+
};
|
|
955
|
+
//#endregion
|
|
962
956
|
//#region src/resources/proxies/index.d.ts
|
|
963
957
|
type ProxyInfo = {
|
|
964
958
|
type: string;
|
|
@@ -995,6 +989,12 @@ type ProxyRequest = {
|
|
|
995
989
|
body?: string;
|
|
996
990
|
};
|
|
997
991
|
//#endregion
|
|
992
|
+
//#region src/resources/version.d.ts
|
|
993
|
+
type VersionInfo = {
|
|
994
|
+
name: string;
|
|
995
|
+
version: string;
|
|
996
|
+
};
|
|
997
|
+
//#endregion
|
|
998
998
|
//#region src/http.d.ts
|
|
999
999
|
interface HttpOptions {
|
|
1000
1000
|
baseURL?: string;
|
|
@@ -1002,17 +1002,14 @@ interface HttpOptions {
|
|
|
1002
1002
|
}
|
|
1003
1003
|
//#endregion
|
|
1004
1004
|
//#region src/client.d.ts
|
|
1005
|
-
declare const createApiClient: (options
|
|
1006
|
-
version: {
|
|
1007
|
-
get: () => Promise<import("axios").AxiosResponse<VersionInfo, any, {}>>;
|
|
1008
|
-
};
|
|
1009
|
-
digest: {
|
|
1010
|
-
create: (request: DigestRequest) => Promise<import("axios").AxiosResponse<DigestResponse, any, {}>>;
|
|
1011
|
-
};
|
|
1005
|
+
declare const createApiClient: (options?: HttpOptions) => {
|
|
1012
1006
|
config: {
|
|
1013
1007
|
get: () => Promise<import("axios").AxiosResponse<RuntimeConfig, any, {}>>;
|
|
1014
1008
|
update: (config: PartialDeep<RuntimeConfig>) => Promise<import("axios").AxiosResponse<RuntimeConfig, any, {}>>;
|
|
1015
1009
|
};
|
|
1010
|
+
digest: {
|
|
1011
|
+
create: (request: DigestRequest) => Promise<import("axios").AxiosResponse<DigestResponse, any, {}>>;
|
|
1012
|
+
};
|
|
1016
1013
|
proxies: {
|
|
1017
1014
|
list: () => Promise<import("axios").AxiosResponse<ProxyListResult, any, {}>>;
|
|
1018
1015
|
import: (request: ProxyImportRequest) => Promise<import("axios").AxiosResponse<ProxyImportResult, any, {}>>;
|
|
@@ -1023,6 +1020,9 @@ declare const createApiClient: (options: HttpOptions) => {
|
|
|
1023
1020
|
downloads: (request?: DownloadRequest) => Promise<import("axios").AxiosResponse<DownloadsResult, any, {}>>;
|
|
1024
1021
|
proxy: (digest: string, request: ProxyRequest) => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
1025
1022
|
};
|
|
1023
|
+
version: {
|
|
1024
|
+
get: () => Promise<import("axios").AxiosResponse<VersionInfo, any, {}>>;
|
|
1025
|
+
};
|
|
1026
1026
|
};
|
|
1027
1027
|
//#endregion
|
|
1028
1028
|
export { createApiClient };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
2
|
//#region src/http.ts
|
|
3
3
|
const createHttp = (options) => {
|
|
4
|
-
return axios.create({
|
|
4
|
+
return axios.create({
|
|
5
|
+
baseURL: options?.baseURL || "http://127.0.0.1:32198",
|
|
6
|
+
timeout: options?.timeout
|
|
7
|
+
});
|
|
5
8
|
};
|
|
6
9
|
//#endregion
|
|
7
10
|
//#region src/resources/config.ts
|
|
@@ -16,13 +19,6 @@ const createConfigApi = (instance) => {
|
|
|
16
19
|
};
|
|
17
20
|
};
|
|
18
21
|
//#endregion
|
|
19
|
-
//#region src/resources/version.ts
|
|
20
|
-
const createVersionApi = (instance) => {
|
|
21
|
-
return { get: () => {
|
|
22
|
-
return instance.get("/version");
|
|
23
|
-
} };
|
|
24
|
-
};
|
|
25
|
-
//#endregion
|
|
26
22
|
//#region src/resources/digest.ts
|
|
27
23
|
const createDigestApi = (instance) => {
|
|
28
24
|
return { create: (request) => {
|
|
@@ -63,14 +59,21 @@ const createProxiesApi = (instance) => {
|
|
|
63
59
|
};
|
|
64
60
|
};
|
|
65
61
|
//#endregion
|
|
62
|
+
//#region src/resources/version.ts
|
|
63
|
+
const createVersionApi = (instance) => {
|
|
64
|
+
return { get: () => {
|
|
65
|
+
return instance.get("/version");
|
|
66
|
+
} };
|
|
67
|
+
};
|
|
68
|
+
//#endregion
|
|
66
69
|
//#region src/client.ts
|
|
67
70
|
const createApiClient = (options) => {
|
|
68
71
|
const http = createHttp(options);
|
|
69
72
|
return {
|
|
70
|
-
version: createVersionApi(http),
|
|
71
|
-
digest: createDigestApi(http),
|
|
72
73
|
config: createConfigApi(http),
|
|
73
|
-
|
|
74
|
+
digest: createDigestApi(http),
|
|
75
|
+
proxies: createProxiesApi(http),
|
|
76
|
+
version: createVersionApi(http)
|
|
74
77
|
};
|
|
75
78
|
};
|
|
76
79
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@publinx/mihomo-st-api",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "A TypeScript API Library for mihomo-st",
|
|
5
|
-
"
|
|
5
|
+
"homepage": "https://github.com/publinx/mihomo-st/tree/main/packages/api",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "git+https://github.com/publinx/mihomo-st.git"
|
|
10
10
|
},
|
|
11
|
-
"
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"type": "module",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": "./dist/index.js"
|
|
17
|
+
},
|
|
12
18
|
"scripts": {
|
|
13
19
|
"dev": "rolldown -c --watch",
|
|
14
20
|
"build": "rolldown -c"
|
|
15
21
|
},
|
|
16
|
-
"exports": {
|
|
17
|
-
".": "./dist/index.js"
|
|
18
|
-
},
|
|
19
|
-
"files": [
|
|
20
|
-
"dist"
|
|
21
|
-
],
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"axios": "^1.18.1"
|
|
24
24
|
},
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 publinx
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|