@ldsg/core 0.0.1
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/LICENSE +22 -0
- package/README.md +3 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/service/enum.d.ts +22 -0
- package/dist/service/enum.d.ts.map +1 -0
- package/dist/service/enum.js +25 -0
- package/dist/service/index.d.ts +43 -0
- package/dist/service/index.d.ts.map +1 -0
- package/dist/service/index.js +179 -0
- package/dist/service/index.spec.d.ts +2 -0
- package/dist/service/index.spec.d.ts.map +1 -0
- package/dist/service/index.spec.js +22 -0
- package/dist/service/types.d.ts +75 -0
- package/dist/service/types.d.ts.map +1 -0
- package/dist/service/types.js +2 -0
- package/package.json +27 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./service"), exports);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* service level
|
|
3
|
+
*/
|
|
4
|
+
export declare enum ServiceLevel {
|
|
5
|
+
/**
|
|
6
|
+
* 自身
|
|
7
|
+
*/
|
|
8
|
+
SELF = "SELF",
|
|
9
|
+
/**
|
|
10
|
+
* 父级
|
|
11
|
+
*/
|
|
12
|
+
PARENT = "PARENT",
|
|
13
|
+
/**
|
|
14
|
+
* 同级
|
|
15
|
+
*/
|
|
16
|
+
PEER = "PEER",
|
|
17
|
+
/**
|
|
18
|
+
* 子级
|
|
19
|
+
*/
|
|
20
|
+
CHILD = "CHILD"
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=enum.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enum.d.ts","sourceRoot":"","sources":["../../src/service/enum.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,YAAY;IACtB;;OAEG;IACH,IAAI,SAAS;IAEb;;OAEG;IACH,MAAM,WAAW;IAEjB;;OAEG;IACH,IAAI,SAAS;IAEb;;OAEG;IACH,KAAK,UAAU;CAChB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ServiceLevel = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* service level
|
|
6
|
+
*/
|
|
7
|
+
var ServiceLevel;
|
|
8
|
+
(function (ServiceLevel) {
|
|
9
|
+
/**
|
|
10
|
+
* 自身
|
|
11
|
+
*/
|
|
12
|
+
ServiceLevel["SELF"] = "SELF";
|
|
13
|
+
/**
|
|
14
|
+
* 父级
|
|
15
|
+
*/
|
|
16
|
+
ServiceLevel["PARENT"] = "PARENT";
|
|
17
|
+
/**
|
|
18
|
+
* 同级
|
|
19
|
+
*/
|
|
20
|
+
ServiceLevel["PEER"] = "PEER";
|
|
21
|
+
/**
|
|
22
|
+
* 子级
|
|
23
|
+
*/
|
|
24
|
+
ServiceLevel["CHILD"] = "CHILD";
|
|
25
|
+
})(ServiceLevel || (exports.ServiceLevel = ServiceLevel = {}));
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ServiceLevel } from "./enum";
|
|
2
|
+
import { GetProperty, GetService, GetServices, GetSettings, GetSettingsSchema, GetUriInfo, ServiceProperties, Settings, SettingsSchema } from "./types";
|
|
3
|
+
export * from "./enum";
|
|
4
|
+
export * from "./types";
|
|
5
|
+
export declare class Service implements ServiceProperties {
|
|
6
|
+
/**
|
|
7
|
+
* id
|
|
8
|
+
*/
|
|
9
|
+
id?: string;
|
|
10
|
+
type?: string;
|
|
11
|
+
/**
|
|
12
|
+
* parent id
|
|
13
|
+
*/
|
|
14
|
+
parentId?: string;
|
|
15
|
+
level?: ServiceLevel;
|
|
16
|
+
settings?: Settings;
|
|
17
|
+
settingsSchema?: SettingsSchema;
|
|
18
|
+
services?: Service[];
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
constructor(params?: ServiceProperties);
|
|
21
|
+
getId: () => string;
|
|
22
|
+
getType: () => string;
|
|
23
|
+
getParentId: () => string | undefined;
|
|
24
|
+
getService: GetService;
|
|
25
|
+
getServices: GetServices;
|
|
26
|
+
/**
|
|
27
|
+
* 获取当前层级服务设置
|
|
28
|
+
* @returns 服务设置
|
|
29
|
+
*/
|
|
30
|
+
getSettings: GetSettings;
|
|
31
|
+
/**
|
|
32
|
+
* 获取当前服务配置结构
|
|
33
|
+
* @returns 服务配置结构
|
|
34
|
+
*/
|
|
35
|
+
getSettingsSchema: GetSettingsSchema;
|
|
36
|
+
getAlias: () => any;
|
|
37
|
+
getCamelCaseAlias: () => string;
|
|
38
|
+
getPascalAlias: () => string;
|
|
39
|
+
getProperty: GetProperty;
|
|
40
|
+
getUriInfo: GetUriInfo;
|
|
41
|
+
getChildHandlerServiceHandler: () => any;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/service/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EACL,WAAW,EACX,UAAU,EACV,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,UAAU,EACV,iBAAiB,EACjB,QAAQ,EACR,cAAc,EACf,MAAM,SAAS,CAAC;AAEjB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AAExB,qBAAa,OAAQ,YAAW,iBAAiB;IAC/C;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,KAAK,CAAC,EAAE,YAAY,CAAC;IAErB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB,cAAc,CAAC,EAAE,cAAc,CAAC;IAEhC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IAErB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;gBAEP,MAAM,CAAC,EAAE,iBAAiB;IAYtC,KAAK,eAQH;IAEF,OAAO,eAQL;IAEF,WAAW,2BAIT;IAEF,UAAU,EAAE,UAAU,CAIpB;IAEF,WAAW,EAAE,WAAW,CA0DtB;IAEF;;;OAGG;IACH,WAAW,EAAE,WAAW,CAItB;IAEF;;;OAGG;IACH,iBAAiB,EAAE,iBAAiB,CAIlC;IAEF,QAAQ,YAUN;IAEF,iBAAiB,eAEf;IAEF,cAAc,eAEZ;IAEF,WAAW,EAAE,WAAW,CAgBtB;IAEF,UAAU,EAAE,UAAU,CAYpB;IAEF,6BAA6B,YAW3B;CACH"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
26
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
|
+
};
|
|
28
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
|
+
};
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
exports.Service = void 0;
|
|
33
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
34
|
+
const URI = __importStar(require("uri-js"));
|
|
35
|
+
const enum_1 = require("./enum");
|
|
36
|
+
__exportStar(require("./enum"), exports);
|
|
37
|
+
__exportStar(require("./types"), exports);
|
|
38
|
+
class Service {
|
|
39
|
+
constructor(params) {
|
|
40
|
+
this.getId = () => {
|
|
41
|
+
const id = this.id;
|
|
42
|
+
if (!id) {
|
|
43
|
+
throw new Error("id is required");
|
|
44
|
+
}
|
|
45
|
+
return id;
|
|
46
|
+
};
|
|
47
|
+
this.getType = () => {
|
|
48
|
+
const type = this.type;
|
|
49
|
+
if (!type) {
|
|
50
|
+
throw new Error("type is required");
|
|
51
|
+
}
|
|
52
|
+
return type;
|
|
53
|
+
};
|
|
54
|
+
this.getParentId = () => {
|
|
55
|
+
const parentId = this.parentId;
|
|
56
|
+
return parentId;
|
|
57
|
+
};
|
|
58
|
+
this.getService = (params) => {
|
|
59
|
+
const getServicesResult = this.getServices(params);
|
|
60
|
+
return getServicesResult[0];
|
|
61
|
+
};
|
|
62
|
+
this.getServices = (params) => {
|
|
63
|
+
const { id, level, type, settings } = params || {};
|
|
64
|
+
const { services } = this;
|
|
65
|
+
const filterPredicate = {};
|
|
66
|
+
let filterRes = [];
|
|
67
|
+
if (id) {
|
|
68
|
+
filterPredicate.id = id;
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
if (type) {
|
|
72
|
+
filterPredicate.type = type;
|
|
73
|
+
}
|
|
74
|
+
if (settings) {
|
|
75
|
+
filterPredicate.settings = settings;
|
|
76
|
+
}
|
|
77
|
+
switch (level) {
|
|
78
|
+
case enum_1.ServiceLevel.CHILD: {
|
|
79
|
+
filterPredicate.parentId = this.getId();
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
case enum_1.ServiceLevel.PARENT: {
|
|
83
|
+
filterPredicate.id = this.getParentId();
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
case enum_1.ServiceLevel.PEER: {
|
|
87
|
+
filterPredicate.parentId = this.getParentId();
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
case enum_1.ServiceLevel.SELF: {
|
|
91
|
+
filterPredicate.id = this.getId();
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
default: {
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (!filterRes.length) {
|
|
100
|
+
filterRes = lodash_1.default.filter(services, filterPredicate);
|
|
101
|
+
}
|
|
102
|
+
const res = filterRes;
|
|
103
|
+
return res;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* 获取当前层级服务设置
|
|
107
|
+
* @returns 服务设置
|
|
108
|
+
*/
|
|
109
|
+
this.getSettings = () => {
|
|
110
|
+
var _a;
|
|
111
|
+
const settings = (_a = this.settings) !== null && _a !== void 0 ? _a : {};
|
|
112
|
+
return settings;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* 获取当前服务配置结构
|
|
116
|
+
* @returns 服务配置结构
|
|
117
|
+
*/
|
|
118
|
+
this.getSettingsSchema = () => {
|
|
119
|
+
var _a;
|
|
120
|
+
const settingsSchema = (_a = this.settingsSchema) !== null && _a !== void 0 ? _a : {};
|
|
121
|
+
return settingsSchema;
|
|
122
|
+
};
|
|
123
|
+
this.getAlias = () => {
|
|
124
|
+
const settings = this.getSettings();
|
|
125
|
+
const { alias } = settings;
|
|
126
|
+
if (!alias) {
|
|
127
|
+
throw new Error("alias in settings is required");
|
|
128
|
+
}
|
|
129
|
+
return alias;
|
|
130
|
+
};
|
|
131
|
+
this.getCamelCaseAlias = () => {
|
|
132
|
+
return lodash_1.default.camelCase(this.getAlias());
|
|
133
|
+
};
|
|
134
|
+
this.getPascalAlias = () => {
|
|
135
|
+
return lodash_1.default.upperFirst(this.getCamelCaseAlias());
|
|
136
|
+
};
|
|
137
|
+
this.getProperty = (params) => {
|
|
138
|
+
const { name, params: paramsParams } = params;
|
|
139
|
+
const property = lodash_1.default.get(this, name);
|
|
140
|
+
let res = property;
|
|
141
|
+
if (typeof property === "function") {
|
|
142
|
+
if (paramsParams) {
|
|
143
|
+
res = property(paramsParams);
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
res = property();
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return res;
|
|
150
|
+
};
|
|
151
|
+
this.getUriInfo = () => {
|
|
152
|
+
const settings = this.getSettings();
|
|
153
|
+
const { uri } = settings;
|
|
154
|
+
if (!uri) {
|
|
155
|
+
throw new Error("uri in settings is required");
|
|
156
|
+
}
|
|
157
|
+
const res = URI.parse(uri);
|
|
158
|
+
return res;
|
|
159
|
+
};
|
|
160
|
+
this.getChildHandlerServiceHandler = () => {
|
|
161
|
+
const handlerService = this.getService({
|
|
162
|
+
level: enum_1.ServiceLevel.CHILD,
|
|
163
|
+
type: "HANDLER",
|
|
164
|
+
});
|
|
165
|
+
if (!handlerService) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
return handlerService.getHandler();
|
|
169
|
+
};
|
|
170
|
+
const keys = lodash_1.default.keys(params);
|
|
171
|
+
keys.forEach((key) => {
|
|
172
|
+
const value = params === null || params === void 0 ? void 0 : params[key];
|
|
173
|
+
if (value) {
|
|
174
|
+
this[key] = value;
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
exports.Service = Service;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.spec.d.ts","sourceRoot":"","sources":["../../src/service/index.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const _1 = require(".");
|
|
13
|
+
describe("service", () => {
|
|
14
|
+
test("getUriInfo", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
const service = new _1.Service({
|
|
16
|
+
settings: {
|
|
17
|
+
uri: "uri://user:pass@example.com:123/one/two.three?q1=a1&q2=a2#body",
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
expect(service.getUriInfo()).toMatchSnapshot();
|
|
21
|
+
}));
|
|
22
|
+
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { ISchema } from "@formily/json-schema";
|
|
2
|
+
import { JSONSchema7 } from "json-schema";
|
|
3
|
+
import URI from "uri-js";
|
|
4
|
+
import { Service } from ".";
|
|
5
|
+
import { ServiceLevel } from "./enum";
|
|
6
|
+
type PickStartWithXProperties<T> = Pick<T, {
|
|
7
|
+
[K in keyof T]: K extends `x-${string}` ? K : never;
|
|
8
|
+
}[keyof T]>;
|
|
9
|
+
export interface RichJsonSchemaOption {
|
|
10
|
+
label: string;
|
|
11
|
+
value: string;
|
|
12
|
+
}
|
|
13
|
+
export type RichJsonSchemaOptions = RichJsonSchemaOption[];
|
|
14
|
+
export type RichJsonSchema = Omit<JSONSchema7, "properties"> & PickStartWithXProperties<ISchema> & {
|
|
15
|
+
properties?: Record<string, RichJsonSchema>;
|
|
16
|
+
options?: RichJsonSchemaOptions;
|
|
17
|
+
items?: RichJsonSchema;
|
|
18
|
+
};
|
|
19
|
+
export type Settings = Record<string, any>;
|
|
20
|
+
export type SettingsSchema = RichJsonSchema;
|
|
21
|
+
export interface ServiceProperties {
|
|
22
|
+
/**
|
|
23
|
+
* id
|
|
24
|
+
*/
|
|
25
|
+
id?: string;
|
|
26
|
+
/**
|
|
27
|
+
* type
|
|
28
|
+
*/
|
|
29
|
+
type?: string;
|
|
30
|
+
/**
|
|
31
|
+
* parent id
|
|
32
|
+
*/
|
|
33
|
+
parentId?: string;
|
|
34
|
+
/**
|
|
35
|
+
* settings
|
|
36
|
+
*/
|
|
37
|
+
settings?: Settings;
|
|
38
|
+
/**
|
|
39
|
+
* settings schema
|
|
40
|
+
*/
|
|
41
|
+
settingsSchema?: SettingsSchema;
|
|
42
|
+
/**
|
|
43
|
+
* services
|
|
44
|
+
*/
|
|
45
|
+
services?: Service[];
|
|
46
|
+
[key: string]: any;
|
|
47
|
+
}
|
|
48
|
+
export type GetSettings = () => Settings;
|
|
49
|
+
export type GetSettingsSchema = () => SettingsSchema;
|
|
50
|
+
interface GetServiceParams extends ServiceProperties {
|
|
51
|
+
level?: ServiceLevel;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* get service
|
|
55
|
+
*/
|
|
56
|
+
export type GetService = (params?: GetServiceParams) => Service;
|
|
57
|
+
/**
|
|
58
|
+
* get services
|
|
59
|
+
*/
|
|
60
|
+
export type GetServices = (params?: GetServiceParams) => Service[];
|
|
61
|
+
export interface GetPropertyParams {
|
|
62
|
+
/**
|
|
63
|
+
* 名称
|
|
64
|
+
*/
|
|
65
|
+
name: string;
|
|
66
|
+
/**
|
|
67
|
+
* 参数
|
|
68
|
+
* 函数类型属性参数可能需要使用
|
|
69
|
+
*/
|
|
70
|
+
params?: Record<string, any>;
|
|
71
|
+
}
|
|
72
|
+
export type GetProperty = (params: GetPropertyParams) => any;
|
|
73
|
+
export type GetUriInfo = () => URI.URIComponents;
|
|
74
|
+
export {};
|
|
75
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/service/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,GAAG,MAAM,QAAQ,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,KAAK,wBAAwB,CAAC,CAAC,IAAI,IAAI,CACrC,CAAC,EACD;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,SAAS,KAAK,MAAM,EAAE,GAAG,CAAC,GAAG,KAAK;CAAE,CAAC,MAAM,CAAC,CAAC,CACjE,CAAC;AAEF,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,qBAAqB,GAAG,oBAAoB,EAAE,CAAC;AAE3D,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,WAAW,EAAE,YAAY,CAAC,GAC1D,wBAAwB,CAAC,OAAO,CAAC,GAAG;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC5C,OAAO,CAAC,EAAE,qBAAqB,CAAC;IAChC,KAAK,CAAC,EAAE,cAAc,CAAC;CACxB,CAAC;AAEJ,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAE3C,MAAM,MAAM,cAAc,GAAG,cAAc,CAAC;AAE5C,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB;;OAEG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;IAEhC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IAErB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,MAAM,WAAW,GAAG,MAAM,QAAQ,CAAC;AAEzC,MAAM,MAAM,iBAAiB,GAAG,MAAM,cAAc,CAAC;AAErD,UAAU,gBAAiB,SAAQ,iBAAiB;IAClD,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,MAAM,CAAC,EAAE,gBAAgB,KAAK,OAAO,CAAC;AAEhE;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,MAAM,CAAC,EAAE,gBAAgB,KAAK,OAAO,EAAE,CAAC;AAEnE,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC9B;AAED,MAAM,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,iBAAiB,KAAK,GAAG,CAAC;AAE7D,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,CAAC,aAAa,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ldsg/core",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"files": [
|
|
6
|
+
"dist/"
|
|
7
|
+
],
|
|
8
|
+
"types": "dist",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "rm -rf dist && tsc --project tsconfig.build.json"
|
|
11
|
+
},
|
|
12
|
+
"author": "wanxger",
|
|
13
|
+
"license": "ISC",
|
|
14
|
+
"description": "",
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@formily/json-schema": "^2.3.1",
|
|
17
|
+
"json-schema": "^0.4.0",
|
|
18
|
+
"lodash": "^4.17.21",
|
|
19
|
+
"uri-js": "^4.4.1"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@types/json-schema": "^7.0.15",
|
|
23
|
+
"@types/lodash": "^4.14.202",
|
|
24
|
+
"tslib": "^2.6.2",
|
|
25
|
+
"typescript": "^5.4.5"
|
|
26
|
+
}
|
|
27
|
+
}
|