@ldsg/core 0.3.31 → 0.3.32
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
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "./service";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/service/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ServiceLevel } from
|
|
2
|
-
import { GetProperty, GetService, GetServices, GetSettings, GetSettingsSchema, GetUriInfo, ServiceProperties, Settings, SettingsSchema } from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
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
5
|
export declare class Service implements ServiceProperties {
|
|
6
6
|
/**
|
|
7
7
|
* id
|
package/dist/service/index.js
CHANGED
|
@@ -50,14 +50,14 @@ class Service {
|
|
|
50
50
|
this.getId = () => {
|
|
51
51
|
const id = this.id;
|
|
52
52
|
if (!id) {
|
|
53
|
-
throw new Error(
|
|
53
|
+
throw new Error("id is required");
|
|
54
54
|
}
|
|
55
55
|
return id;
|
|
56
56
|
};
|
|
57
57
|
this.getType = () => {
|
|
58
58
|
const type = this.type;
|
|
59
59
|
if (!type) {
|
|
60
|
-
throw new Error(
|
|
60
|
+
throw new Error("type is required");
|
|
61
61
|
}
|
|
62
62
|
return type;
|
|
63
63
|
};
|
|
@@ -134,7 +134,7 @@ class Service {
|
|
|
134
134
|
const settings = this.getSettings();
|
|
135
135
|
const { alias } = settings;
|
|
136
136
|
if (!alias) {
|
|
137
|
-
throw new Error(
|
|
137
|
+
throw new Error("alias in settings is required");
|
|
138
138
|
}
|
|
139
139
|
return alias;
|
|
140
140
|
};
|
|
@@ -148,7 +148,7 @@ class Service {
|
|
|
148
148
|
const { name, params: paramsParams } = params;
|
|
149
149
|
const property = lodash_1.default.get(this, name);
|
|
150
150
|
let res = property;
|
|
151
|
-
if (typeof property ===
|
|
151
|
+
if (typeof property === "function") {
|
|
152
152
|
if (paramsParams) {
|
|
153
153
|
res = property(paramsParams);
|
|
154
154
|
}
|
|
@@ -162,7 +162,7 @@ class Service {
|
|
|
162
162
|
const settings = this.getSettings();
|
|
163
163
|
const { uri } = settings;
|
|
164
164
|
if (!uri) {
|
|
165
|
-
throw new Error(
|
|
165
|
+
throw new Error("uri in settings is required");
|
|
166
166
|
}
|
|
167
167
|
const res = URI.parse(uri);
|
|
168
168
|
return res;
|
|
@@ -170,7 +170,7 @@ class Service {
|
|
|
170
170
|
this.getChildHandlerServiceHandler = () => {
|
|
171
171
|
const handlerService = this.getService({
|
|
172
172
|
level: enum_1.ServiceLevel.CHILD,
|
|
173
|
-
type:
|
|
173
|
+
type: "HANDLER",
|
|
174
174
|
});
|
|
175
175
|
if (!handlerService) {
|
|
176
176
|
return;
|
package/dist/service/types.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ISchema } from
|
|
2
|
-
import { JSONSchema7 } from
|
|
3
|
-
import URI from
|
|
4
|
-
import { Service } from
|
|
5
|
-
import { ServiceLevel } from
|
|
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
6
|
type PickStartWithXProperties<T> = Pick<T, {
|
|
7
7
|
[K in keyof T]: K extends `x-${string}` ? K : never;
|
|
8
8
|
}[keyof T]>;
|
|
@@ -11,7 +11,7 @@ export interface RichJsonSchemaOption {
|
|
|
11
11
|
value: string;
|
|
12
12
|
}
|
|
13
13
|
export type RichJsonSchemaOptions = RichJsonSchemaOption[];
|
|
14
|
-
export type RichJsonSchema = Omit<JSONSchema7,
|
|
14
|
+
export type RichJsonSchema = Omit<JSONSchema7, "properties"> & PickStartWithXProperties<ISchema> & {
|
|
15
15
|
properties?: Record<string, RichJsonSchema>;
|
|
16
16
|
options?: RichJsonSchemaOptions;
|
|
17
17
|
items?: RichJsonSchema;
|
|
@@ -1 +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,
|
|
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,M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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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ldsg/core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.32",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "wanxger",
|
|
@@ -20,6 +20,8 @@
|
|
|
20
20
|
"@types/json-schema": "^7.0.15",
|
|
21
21
|
"@types/lodash": "^4.14.202",
|
|
22
22
|
"jest": "^29.5.0",
|
|
23
|
+
"oxfmt": "latest",
|
|
24
|
+
"oxlint": "latest",
|
|
23
25
|
"supertest": "^6.3.4",
|
|
24
26
|
"ts-jest": "^29.1.5",
|
|
25
27
|
"ts-node": "^10.9.2",
|
|
@@ -31,6 +33,8 @@
|
|
|
31
33
|
},
|
|
32
34
|
"scripts": {
|
|
33
35
|
"build": "tsc --project tsconfig.build.json",
|
|
34
|
-
"clean": "rm -rf dist"
|
|
36
|
+
"clean": "rm -rf dist",
|
|
37
|
+
"format": "oxfmt --write src/",
|
|
38
|
+
"lint": "oxlint src/"
|
|
35
39
|
}
|
|
36
40
|
}
|