@seayoo-web/kms 2.0.2 → 3.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/index.js +46 -6
- package/package.json +3 -17
- package/types/index.d.ts +1 -4
- package/types/src/dsi.d.ts +4 -4
- package/dist/dsi-IrAVonhd.js +0 -50
- package/dist/wx.js +0 -10
- package/types/wx.d.ts +0 -4
package/dist/index.js
CHANGED
|
@@ -1,10 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
var L = Object.defineProperty;
|
|
2
|
+
var D = (t, r, i) => r in t ? L(t, r, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[r] = i;
|
|
3
|
+
var w = (t, r, i) => D(t, typeof r != "symbol" ? r + "" : r, i);
|
|
4
|
+
import { jsonp as k, jsonx as z } from "@seayoo-web/request";
|
|
5
|
+
function y(t) {
|
|
6
|
+
const r = {}, { group: i, filter: a, filterLogic: s, range: l, created: j, updated: d, size: m, page: A, sort: e } = t, { sn: $, fields: o, dataFields: n, multi: h, combo: v, pure: g = "items", label: c, value: f, option: b } = t;
|
|
7
|
+
if ($ && (r.sn = $), i && (r.g = Array.isArray(i) ? i.join(",") : i), a) {
|
|
8
|
+
const q = s === "or" ? "|" : "+", x = Object.keys(a);
|
|
9
|
+
r.filter = x.map((p) => {
|
|
10
|
+
const u = a[p];
|
|
11
|
+
return Array.isArray(u) ? `${p}:${u.join(",")}` : `${p}:${u}`;
|
|
12
|
+
}).join(q);
|
|
13
|
+
}
|
|
14
|
+
return l && (r.r = l), j && (r.created = j.join("-")), d && (r.updated = d.join("-")), e && (r.sort = Array.isArray(e) ? e.join(",") : e), h === !1 && (r.m = "n"), m && (r.s = `${m}`), A && (r.p = `${A}`), o && (r.f = Array.isArray(o) ? o.join(",") : o), n && (r.df = Array.isArray(n) ? n.join(",") : n), v === !0 && (o ? r.c = "y" : console.warn("设置 combo:true 必须要同步设置 fields")), g && (r.pure = g === "items" ? "items" : "y"), c && (r.label = Array.isArray(c) ? c.join(",") : c), f && (r.value = Array.isArray(f) ? f.join(",") : f), b && (r.option = b), r;
|
|
15
|
+
}
|
|
16
|
+
function C(t) {
|
|
17
|
+
return t.replace(/(?:^https?:\/\/|\/*$)/gi, "").toLowerCase();
|
|
18
|
+
}
|
|
19
|
+
class K {
|
|
20
|
+
constructor(r, i) {
|
|
21
|
+
w(this, "req");
|
|
22
|
+
this.req = i({ baseURL: `https://${C(r)}`, timeout: 1e4 });
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* 查询 Dsi 数据接口并返回接口响应
|
|
26
|
+
*/
|
|
27
|
+
async query({ key: r, query: i, guard: a }) {
|
|
28
|
+
const { data: s } = await this.req.get(r, a, { params: y(i) });
|
|
29
|
+
return s;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* 通过 jsonp 方式加载 dsi 数据
|
|
33
|
+
*
|
|
34
|
+
* ⚠️ 微信环境下不支持
|
|
35
|
+
*/
|
|
36
|
+
async jsonp({ key: r, query: i, guard: a }) {
|
|
37
|
+
return await k(`${r}/jsonp`, a, y(i));
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* 通过 jsonx(script) 方式加载 dsi 数据
|
|
41
|
+
*
|
|
42
|
+
* ⚠️ 微信环境下不支持
|
|
43
|
+
*/
|
|
44
|
+
async jsonx({ key: r, query: i, guard: a }) {
|
|
45
|
+
return await z(`${r}/script`, a, y(i));
|
|
6
46
|
}
|
|
7
47
|
}
|
|
8
48
|
export {
|
|
9
|
-
|
|
49
|
+
K as KMSDsi
|
|
10
50
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seayoo-web/kms",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "agent for seayoo.kms",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "index.ts",
|
|
@@ -12,30 +12,16 @@
|
|
|
12
12
|
"types",
|
|
13
13
|
"README.md"
|
|
14
14
|
],
|
|
15
|
-
"exports": {
|
|
16
|
-
".": {
|
|
17
|
-
"types": "./types/index.d.ts",
|
|
18
|
-
"import": "./dist/index.js",
|
|
19
|
-
"default": "./dist/index.js"
|
|
20
|
-
},
|
|
21
|
-
"./wx": {
|
|
22
|
-
"types": "./types/wx.d.ts",
|
|
23
|
-
"import": "./dist/wx.js",
|
|
24
|
-
"default": "./dist/wx.js"
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
15
|
"author": "web@seayoo.com",
|
|
28
16
|
"license": "MIT",
|
|
29
17
|
"publishConfig": {
|
|
30
18
|
"access": "public"
|
|
31
19
|
},
|
|
32
20
|
"devDependencies": {
|
|
33
|
-
"@seayoo-web/request": "^2.0
|
|
21
|
+
"@seayoo-web/request": "^2.1.0",
|
|
22
|
+
"@seayoo-web/scripts": "^1.2.5",
|
|
34
23
|
"@seayoo-web/tsconfig": "^1.0.2"
|
|
35
24
|
},
|
|
36
|
-
"peerDependencies": {
|
|
37
|
-
"@seayoo-web/request": "^2.0.8"
|
|
38
|
-
},
|
|
39
25
|
"scripts": {
|
|
40
26
|
"build": "vite build && tsc --emitDeclarationOnly",
|
|
41
27
|
"prepublish": "pnpm build"
|
package/types/index.d.ts
CHANGED
package/types/src/dsi.d.ts
CHANGED
|
@@ -150,23 +150,23 @@ export interface DsiQueryOption<T> {
|
|
|
150
150
|
guard: (data: unknown) => data is T;
|
|
151
151
|
}
|
|
152
152
|
export declare class KMSDsi {
|
|
153
|
-
|
|
153
|
+
req: ReturnType<NetRequestFactory>;
|
|
154
154
|
constructor(endpoint: string, request: NetRequestFactory);
|
|
155
155
|
/**
|
|
156
156
|
* 查询 Dsi 数据接口并返回接口响应
|
|
157
157
|
*/
|
|
158
|
-
|
|
158
|
+
query<T = unknown>({ key, query, guard }: DsiQueryOption<T>): Promise<T | null>;
|
|
159
159
|
/**
|
|
160
160
|
* 通过 jsonp 方式加载 dsi 数据
|
|
161
161
|
*
|
|
162
162
|
* ⚠️ 微信环境下不支持
|
|
163
163
|
*/
|
|
164
|
-
|
|
164
|
+
jsonp<T = unknown>({ key, query, guard }: DsiQueryOption<T>): Promise<T | null>;
|
|
165
165
|
/**
|
|
166
166
|
* 通过 jsonx(script) 方式加载 dsi 数据
|
|
167
167
|
*
|
|
168
168
|
* ⚠️ 微信环境下不支持
|
|
169
169
|
*/
|
|
170
|
-
|
|
170
|
+
jsonx<T = unknown>({ key, query, guard }: DsiQueryOption<T>): Promise<T | null>;
|
|
171
171
|
}
|
|
172
172
|
export {};
|
package/dist/dsi-IrAVonhd.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
var x = Object.defineProperty;
|
|
2
|
-
var L = (t, r, i) => r in t ? x(t, r, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[r] = i;
|
|
3
|
-
var w = (t, r, i) => L(t, typeof r != "symbol" ? r + "" : r, i);
|
|
4
|
-
import { jsonp as K, jsonx as k } from "@seayoo-web/request";
|
|
5
|
-
function y(t) {
|
|
6
|
-
const r = {}, { group: i, filter: a, filterLogic: s, range: l, created: j, updated: d, size: m, page: A, sort: e } = t, { sn: $, fields: o, dataFields: n, multi: D, combo: h, pure: g = "items", label: c, value: f, option: b } = t;
|
|
7
|
-
if ($ && (r.sn = $), i && (r.g = Array.isArray(i) ? i.join(",") : i), a) {
|
|
8
|
-
const v = s === "or" ? "|" : "+", q = Object.keys(a);
|
|
9
|
-
r.filter = q.map((p) => {
|
|
10
|
-
const u = a[p];
|
|
11
|
-
return Array.isArray(u) ? `${p}:${u.join(",")}` : `${p}:${u}`;
|
|
12
|
-
}).join(v);
|
|
13
|
-
}
|
|
14
|
-
return l && (r.r = l), j && (r.created = j.join("-")), d && (r.updated = d.join("-")), e && (r.sort = Array.isArray(e) ? e.join(",") : e), D === !1 && (r.m = "n"), m && (r.s = `${m}`), A && (r.p = `${A}`), o && (r.f = Array.isArray(o) ? o.join(",") : o), n && (r.df = Array.isArray(n) ? n.join(",") : n), h === !0 && (o ? r.c = "y" : console.warn("设置 combo:true 必须要同步设置 fields")), g && (r.pure = g === "items" ? "items" : "y"), c && (r.label = Array.isArray(c) ? c.join(",") : c), f && (r.value = Array.isArray(f) ? f.join(",") : f), b && (r.option = b), r;
|
|
15
|
-
}
|
|
16
|
-
function z(t) {
|
|
17
|
-
return t.replace(/(?:^https?:\/\/|\/*$)/gi, "").toLowerCase();
|
|
18
|
-
}
|
|
19
|
-
class F {
|
|
20
|
-
constructor(r, i) {
|
|
21
|
-
w(this, "req");
|
|
22
|
-
this.req = i({ baseURL: `https://${z(r)}`, timeout: 1e4 });
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* 查询 Dsi 数据接口并返回接口响应
|
|
26
|
-
*/
|
|
27
|
-
async queryDsi({ key: r, query: i, guard: a }) {
|
|
28
|
-
const { data: s } = await this.req.get(r, a, { params: y(i) });
|
|
29
|
-
return s;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* 通过 jsonp 方式加载 dsi 数据
|
|
33
|
-
*
|
|
34
|
-
* ⚠️ 微信环境下不支持
|
|
35
|
-
*/
|
|
36
|
-
async jsonpDsi({ key: r, query: i, guard: a }) {
|
|
37
|
-
return await K(`${r}/jsonp`, a, y(i));
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* 通过 jsonx(script) 方式加载 dsi 数据
|
|
41
|
-
*
|
|
42
|
-
* ⚠️ 微信环境下不支持
|
|
43
|
-
*/
|
|
44
|
-
async jsonxDsi({ key: r, query: i, guard: a }) {
|
|
45
|
-
return await k(`${r}/script`, a, y(i));
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
export {
|
|
49
|
-
F as K
|
|
50
|
-
};
|
package/dist/wx.js
DELETED
package/types/wx.d.ts
DELETED