@ldsg/route 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/__tests__/e2e.js +27 -27
- package/dist/constants.d.ts +3 -3
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +13 -13
- package/dist/handler.d.ts +4 -4
- package/dist/index.d.ts +5 -5
- package/dist/instantiate-resource.d.ts +4 -4
- package/dist/instantiate-resource.js +1 -1
- package/dist/resource.d.ts +3 -3
- package/dist/resource.js +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/types/resource-extended-handler.d.ts +2 -2
- package/dist/types/resource-extended-handler.d.ts.map +1 -1
- package/dist/types/specific-resource-settings.d.ts +1 -1
- package/dist/types/specific-resource-settings.js +1 -1
- package/package.json +10 -6
package/dist/__tests__/e2e.js
CHANGED
|
@@ -9,44 +9,44 @@ const supertest_1 = __importDefault(require("supertest"));
|
|
|
9
9
|
const resource_1 = require("../resource");
|
|
10
10
|
const handler = (params) => {
|
|
11
11
|
const { res } = params;
|
|
12
|
-
res.send(
|
|
12
|
+
res.send("Hello, World!");
|
|
13
13
|
};
|
|
14
|
-
test(
|
|
14
|
+
test("application", async () => {
|
|
15
15
|
const applicationResource = new application_1.ApplicationResource({
|
|
16
|
-
id:
|
|
17
|
-
kind:
|
|
18
|
-
parentId:
|
|
16
|
+
id: "application",
|
|
17
|
+
kind: "application",
|
|
18
|
+
parentId: "root",
|
|
19
19
|
settings: {
|
|
20
|
-
title:
|
|
21
|
-
description:
|
|
22
|
-
name:
|
|
23
|
-
}
|
|
20
|
+
title: "应用",
|
|
21
|
+
description: "应用根资源",
|
|
22
|
+
name: "测试应用",
|
|
23
|
+
},
|
|
24
24
|
});
|
|
25
25
|
new resource_1.RouteResource({
|
|
26
|
-
id:
|
|
27
|
-
kind:
|
|
28
|
-
parentId:
|
|
26
|
+
id: "route",
|
|
27
|
+
kind: "route",
|
|
28
|
+
parentId: "application",
|
|
29
29
|
settings: {
|
|
30
|
-
title:
|
|
31
|
-
description:
|
|
32
|
-
path:
|
|
33
|
-
handlerResourceId:
|
|
34
|
-
}
|
|
30
|
+
title: "应用",
|
|
31
|
+
description: "应用根资源",
|
|
32
|
+
path: "/test",
|
|
33
|
+
handlerResourceId: "route-test-app-test-handler",
|
|
34
|
+
},
|
|
35
35
|
});
|
|
36
36
|
new handler_1.HandlerResource({
|
|
37
|
-
id:
|
|
38
|
-
kind:
|
|
39
|
-
parentId:
|
|
37
|
+
id: "route-test-app-test-handler",
|
|
38
|
+
kind: "handler",
|
|
39
|
+
parentId: "root",
|
|
40
40
|
settings: {
|
|
41
|
-
title:
|
|
42
|
-
description:
|
|
43
|
-
code:
|
|
41
|
+
title: "应用",
|
|
42
|
+
description: "应用根资源",
|
|
43
|
+
code: "",
|
|
44
44
|
dependencies: [],
|
|
45
|
-
handler
|
|
46
|
-
}
|
|
45
|
+
handler,
|
|
46
|
+
},
|
|
47
47
|
});
|
|
48
48
|
const app = applicationResource.createExpressApp();
|
|
49
|
-
const response = await (0, supertest_1.default)(app).get(
|
|
49
|
+
const response = await (0, supertest_1.default)(app).get("/test");
|
|
50
50
|
expect(response.statusCode).toBe(200);
|
|
51
|
-
expect(response.text).toBe(
|
|
51
|
+
expect(response.text).toBe("Hello, World!");
|
|
52
52
|
});
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { HandlerSpecificResourceSettings } from
|
|
2
|
-
import { ResourceDefinitionSpecificResourceSettings } from
|
|
3
|
-
import { GeneralResourceSettings } from
|
|
1
|
+
import { HandlerSpecificResourceSettings } from "@ldsg/handler";
|
|
2
|
+
import { ResourceDefinitionSpecificResourceSettings } from "@ldsg/resource-definition";
|
|
3
|
+
import { GeneralResourceSettings } from "@ldsg/types";
|
|
4
4
|
/**
|
|
5
5
|
* Instantiate Resource Handler General Resource Settings
|
|
6
6
|
* 实例化资源处理程序普通资源配置
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,0CAA0C,EAAE,MAAM,2BAA2B,CAAC;AACvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD;;;GAGG;AACH,eAAO,MAAM,sDAAsD,EAAE,uBAGpE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,uDAAuD,EAAE,+
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,0CAA0C,EAAE,MAAM,2BAA2B,CAAC;AACvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD;;;GAGG;AACH,eAAO,MAAM,sDAAsD,EAAE,uBAGpE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,uDAAuD,EAAE,+BAQnE,CAAC;AAEJ,eAAO,MAAM,6CAA6C,EAAE,uBAG3D,CAAC;AAEF,eAAO,MAAM,8CAA8C,EAAE,0CAG1D,CAAC;AAEJ;;;GAGG;AACH,eAAO,MAAM,kDAAkD,EAAE,uBAGhE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mDAAmD,EAAE,+BAc/D,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -6,8 +6,8 @@ exports.DEFAULT_EXTENDED_HANDLER_SPECIFIC_RESOURCE_SETTINGS = exports.DEFAULT_EX
|
|
|
6
6
|
* 实例化资源处理程序普通资源配置
|
|
7
7
|
*/
|
|
8
8
|
exports.INSTANTIATE_RESOURCE_HANDLER_GENERAL_RESOURCE_SETTINGS = {
|
|
9
|
-
title:
|
|
10
|
-
description:
|
|
9
|
+
title: "路由实例化资源处理程序",
|
|
10
|
+
description: "",
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
13
|
* Instantiate Resource Handler Specific Resource Settings
|
|
@@ -18,24 +18,24 @@ exports.INSTANTIATE_RESOURCE_HANDLER_SPECIFIC_RESOURCE_SETTINGS = {
|
|
|
18
18
|
code: `export * from "@ldsg/route";`,
|
|
19
19
|
dependencies: [
|
|
20
20
|
{
|
|
21
|
-
name:
|
|
22
|
-
}
|
|
23
|
-
]
|
|
21
|
+
name: "@ldsg/route",
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
24
|
};
|
|
25
25
|
exports.RESOURCE_DEFINITION_GENERAL_RESOURCE_SETTINGS = {
|
|
26
|
-
title:
|
|
27
|
-
description:
|
|
26
|
+
title: "路由资源定义",
|
|
27
|
+
description: "",
|
|
28
28
|
};
|
|
29
29
|
exports.RESOURCE_DEFINITION_SPECIFIC_RESOURCE_SETTINGS = {
|
|
30
|
-
kind:
|
|
30
|
+
kind: "route",
|
|
31
31
|
};
|
|
32
32
|
/**
|
|
33
33
|
* Default Extended Handler General Resource Settings
|
|
34
34
|
* 默认扩展处理程序普通资源配置
|
|
35
35
|
*/
|
|
36
36
|
exports.DEFAULT_EXTENDED_HANDLER_GENERAL_RESOURCE_SETTINGS = {
|
|
37
|
-
title:
|
|
38
|
-
description:
|
|
37
|
+
title: "路由默认扩展处理程序",
|
|
38
|
+
description: "",
|
|
39
39
|
};
|
|
40
40
|
/**
|
|
41
41
|
* Default Extended Handler Specific Resource Settings
|
|
@@ -51,7 +51,7 @@ export const handler: RouteResourceExtendedHandler = (params) => {
|
|
|
51
51
|
};`,
|
|
52
52
|
dependencies: [
|
|
53
53
|
{
|
|
54
|
-
name:
|
|
55
|
-
}
|
|
56
|
-
]
|
|
54
|
+
name: "express",
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
57
|
};
|
package/dist/handler.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Handler, HandlerExtendedResourceSettings } from
|
|
2
|
-
import { InstantiateResourceParams, InstantiateResourceRes } from
|
|
3
|
-
import { RouteResource } from
|
|
4
|
-
import { RouteSpecificResourceSettings } from
|
|
1
|
+
import { Handler, HandlerExtendedResourceSettings } from "@ldsg/handler";
|
|
2
|
+
import { InstantiateResourceParams, InstantiateResourceRes } from "@ldsg/resource";
|
|
3
|
+
import { RouteResource } from "./resource";
|
|
4
|
+
import { RouteSpecificResourceSettings } from "./types";
|
|
5
5
|
export declare const handler: Handler<InstantiateResourceParams<HandlerExtendedResourceSettings<RouteSpecificResourceSettings>>, InstantiateResourceRes<RouteResource>>;
|
|
6
6
|
//# sourceMappingURL=handler.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
1
|
+
export * from "./constants";
|
|
2
|
+
export * from "./handler";
|
|
3
|
+
export * from "./instantiate-resource";
|
|
4
|
+
export * from "./resource";
|
|
5
|
+
export * from "./types";
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { HandlerExtendedResourceSettings } from
|
|
2
|
-
import { InstantiateResource } from
|
|
3
|
-
import { RouteResource } from
|
|
4
|
-
import { RouteSpecificResourceSettings } from
|
|
1
|
+
import { HandlerExtendedResourceSettings } from "@ldsg/handler";
|
|
2
|
+
import { InstantiateResource } from "@ldsg/resource";
|
|
3
|
+
import { RouteResource } from "./resource";
|
|
4
|
+
import { RouteSpecificResourceSettings } from "./types";
|
|
5
5
|
export declare const instantiateResource: InstantiateResource<HandlerExtendedResourceSettings<RouteSpecificResourceSettings>, RouteResource>;
|
|
6
6
|
//# sourceMappingURL=instantiate-resource.d.ts.map
|
package/dist/resource.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ExtendExpressApp } from
|
|
2
|
-
import { HandlerExtendedResource } from
|
|
3
|
-
import { RouteSpecificResourceSettings } from
|
|
1
|
+
import { ExtendExpressApp } from "@ldsg/application";
|
|
2
|
+
import { HandlerExtendedResource } from "@ldsg/handler";
|
|
3
|
+
import { RouteSpecificResourceSettings } from "./types";
|
|
4
4
|
export declare class RouteResource extends HandlerExtendedResource<RouteSpecificResourceSettings> {
|
|
5
5
|
extendExpressApp: ExtendExpressApp;
|
|
6
6
|
}
|
package/dist/resource.js
CHANGED
|
@@ -7,11 +7,11 @@ class RouteResource extends handler_1.HandlerExtendedResource {
|
|
|
7
7
|
super(...arguments);
|
|
8
8
|
this.extendExpressApp = async (params) => {
|
|
9
9
|
const { app } = params;
|
|
10
|
-
const { settings: { path }, executeExtendedHandler } = this;
|
|
10
|
+
const { settings: { path }, executeExtendedHandler, } = this;
|
|
11
11
|
app.all(path, async (req, res) => {
|
|
12
12
|
await executeExtendedHandler({
|
|
13
13
|
req,
|
|
14
|
-
res
|
|
14
|
+
res,
|
|
15
15
|
});
|
|
16
16
|
});
|
|
17
17
|
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
1
|
+
export * from "./resource-extended-handler";
|
|
2
|
+
export * from "./specific-resource-settings";
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ResourceExtendedHandler } from
|
|
2
|
-
import { Request, Response } from
|
|
1
|
+
import { ResourceExtendedHandler } from "@ldsg/handler";
|
|
2
|
+
import { Request, Response } from "express";
|
|
3
3
|
interface RouteResourceExtendedHandlerParams {
|
|
4
4
|
req: Request;
|
|
5
5
|
res: Response;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-extended-handler.d.ts","sourceRoot":"","sources":["../../src/types/resource-extended-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE5C,UAAU,kCAAkC;IAC1C,GAAG,EAAE,OAAO,CAAC;IACb,GAAG,EAAE,QAAQ,CAAC;CACf;AAED,MAAM,MAAM,4BAA4B,GAAG,uBAAuB,
|
|
1
|
+
{"version":3,"file":"resource-extended-handler.d.ts","sourceRoot":"","sources":["../../src/types/resource-extended-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE5C,UAAU,kCAAkC;IAC1C,GAAG,EAAE,OAAO,CAAC;IACb,GAAG,EAAE,QAAQ,CAAC;CACf;AAED,MAAM,MAAM,4BAA4B,GAAG,uBAAuB,CAChE,kCAAkC,EAClC,IAAI,CACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ldsg/route",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.32",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
],
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"zod": "^4.1.11",
|
|
15
|
-
"@ldsg/handler": "0.3.
|
|
16
|
-
"@ldsg/resource": "0.3.
|
|
17
|
-
"@ldsg/resource-definition": "0.3.
|
|
15
|
+
"@ldsg/handler": "0.3.32",
|
|
16
|
+
"@ldsg/resource": "0.3.32",
|
|
17
|
+
"@ldsg/resource-definition": "0.3.32"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@types/express": "^4.17.17",
|
|
@@ -22,12 +22,14 @@
|
|
|
22
22
|
"@types/supertest": "^6.0.0",
|
|
23
23
|
"express": "^4.18.2",
|
|
24
24
|
"jest": "^29.5.0",
|
|
25
|
+
"oxfmt": "latest",
|
|
26
|
+
"oxlint": "latest",
|
|
25
27
|
"supertest": "^6.3.4",
|
|
26
28
|
"ts-jest": "^29.1.5",
|
|
27
29
|
"ts-node": "^10.9.2",
|
|
28
30
|
"typescript": "^5.8.3",
|
|
29
|
-
"@ldsg/
|
|
30
|
-
"@ldsg/
|
|
31
|
+
"@ldsg/application": "0.3.32",
|
|
32
|
+
"@ldsg/types": "0.3.32"
|
|
31
33
|
},
|
|
32
34
|
"publishConfig": {
|
|
33
35
|
"access": "public"
|
|
@@ -35,6 +37,8 @@
|
|
|
35
37
|
"scripts": {
|
|
36
38
|
"build": "tsc --project tsconfig.build.json",
|
|
37
39
|
"clean": "rm -rf dist",
|
|
40
|
+
"format": "oxfmt --write src/",
|
|
41
|
+
"lint": "oxlint src/",
|
|
38
42
|
"test": "jest"
|
|
39
43
|
}
|
|
40
44
|
}
|