@ldsg/application 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.d.ts +2 -2
- package/dist/__tests__/e2e.js +18 -18
- package/dist/constants.d.ts +3 -3
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +8 -8
- package/dist/handler.d.ts +4 -4
- package/dist/index.d.ts +5 -5
- package/dist/instantiate-resource.d.ts +3 -3
- package/dist/instantiate-resource.js +1 -1
- package/dist/resource.d.ts +3 -3
- package/dist/resource.js +4 -4
- package/dist/types/index.d.ts +1 -1
- package/dist/types/specific-resource-settings.d.ts +1 -1
- package/dist/types/specific-resource-settings.d.ts.map +1 -1
- package/dist/types/specific-resource-settings.js +1 -1
- package/package.json +10 -6
package/dist/__tests__/e2e.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Resource } from
|
|
2
|
-
import { ExtendExpressApp } from
|
|
1
|
+
import { Resource } from "@ldsg/resource";
|
|
2
|
+
import { ExtendExpressApp } from "../resource";
|
|
3
3
|
export declare class AResource extends Resource {
|
|
4
4
|
extendExpressApp: ExtendExpressApp;
|
|
5
5
|
}
|
package/dist/__tests__/e2e.js
CHANGED
|
@@ -12,35 +12,35 @@ class AResource extends resource_1.Resource {
|
|
|
12
12
|
super(...arguments);
|
|
13
13
|
this.extendExpressApp = (params) => {
|
|
14
14
|
const { app } = params;
|
|
15
|
-
app.get(
|
|
16
|
-
res.send(
|
|
15
|
+
app.get("/", (req, res) => {
|
|
16
|
+
res.send("Hello, World!");
|
|
17
17
|
});
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
exports.AResource = AResource;
|
|
22
|
-
test(
|
|
22
|
+
test("application", async () => {
|
|
23
23
|
const application = new resource_2.ApplicationResource({
|
|
24
|
-
id:
|
|
25
|
-
kind:
|
|
26
|
-
parentId:
|
|
24
|
+
id: "test-application",
|
|
25
|
+
kind: "application",
|
|
26
|
+
parentId: "ROOT",
|
|
27
27
|
settings: {
|
|
28
|
-
title:
|
|
29
|
-
description:
|
|
30
|
-
name:
|
|
31
|
-
}
|
|
28
|
+
title: "测试应用",
|
|
29
|
+
description: "",
|
|
30
|
+
name: "",
|
|
31
|
+
},
|
|
32
32
|
});
|
|
33
33
|
new AResource({
|
|
34
|
-
id:
|
|
35
|
-
kind:
|
|
36
|
-
parentId:
|
|
34
|
+
id: "test-a",
|
|
35
|
+
kind: "a",
|
|
36
|
+
parentId: "test-application",
|
|
37
37
|
settings: {
|
|
38
|
-
title:
|
|
39
|
-
description:
|
|
40
|
-
}
|
|
38
|
+
title: "",
|
|
39
|
+
description: "",
|
|
40
|
+
},
|
|
41
41
|
});
|
|
42
42
|
const app = application.createExpressApp();
|
|
43
|
-
const response = await (0, supertest_1.default)(app).get(
|
|
43
|
+
const response = await (0, supertest_1.default)(app).get("/");
|
|
44
44
|
expect(response.statusCode).toBe(200);
|
|
45
|
-
expect(response.text).toBe(
|
|
45
|
+
expect(response.text).toBe("Hello, World!");
|
|
46
46
|
});
|
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"}
|
package/dist/constants.js
CHANGED
|
@@ -6,8 +6,8 @@ exports.RESOURCE_DEFINITION_SPECIFIC_RESOURCE_SETTINGS = exports.RESOURCE_DEFINI
|
|
|
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,14 +18,14 @@ exports.INSTANTIATE_RESOURCE_HANDLER_SPECIFIC_RESOURCE_SETTINGS = {
|
|
|
18
18
|
code: `export * from "@ldsg/application";`,
|
|
19
19
|
dependencies: [
|
|
20
20
|
{
|
|
21
|
-
name:
|
|
22
|
-
}
|
|
23
|
-
]
|
|
21
|
+
name: "@ldsg/application",
|
|
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: "application",
|
|
31
31
|
};
|
package/dist/handler.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Handler } from
|
|
2
|
-
import { InstantiateResourceParams, InstantiateResourceRes } from
|
|
3
|
-
import { ApplicationResource } from
|
|
4
|
-
import { ApplicationSpecificResourceSettings } from
|
|
1
|
+
import { Handler } from "@ldsg/handler";
|
|
2
|
+
import { InstantiateResourceParams, InstantiateResourceRes } from "@ldsg/resource";
|
|
3
|
+
import { ApplicationResource } from "./resource";
|
|
4
|
+
import { ApplicationSpecificResourceSettings } from "./types";
|
|
5
5
|
export declare const handler: Handler<InstantiateResourceParams<ApplicationSpecificResourceSettings>, InstantiateResourceRes<ApplicationResource>>;
|
|
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,5 +1,5 @@
|
|
|
1
|
-
import { InstantiateResource } from
|
|
2
|
-
import { ApplicationResource } from
|
|
3
|
-
import { ApplicationSpecificResourceSettings } from
|
|
1
|
+
import { InstantiateResource } from "@ldsg/resource";
|
|
2
|
+
import { ApplicationResource } from "./resource";
|
|
3
|
+
import { ApplicationSpecificResourceSettings } from "./types";
|
|
4
4
|
export declare const instantiateResource: InstantiateResource<ApplicationSpecificResourceSettings, ApplicationResource>;
|
|
5
5
|
//# sourceMappingURL=instantiate-resource.d.ts.map
|
package/dist/resource.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Resource } from
|
|
2
|
-
import { Express } from
|
|
3
|
-
import { ApplicationSpecificResourceSettings } from
|
|
1
|
+
import { Resource } from "@ldsg/resource";
|
|
2
|
+
import { Express } from "express";
|
|
3
|
+
import { ApplicationSpecificResourceSettings } from "./types";
|
|
4
4
|
type CreateExpressApp = () => Express;
|
|
5
5
|
interface ExtendExpressAppParams {
|
|
6
6
|
app: Express;
|
package/dist/resource.js
CHANGED
|
@@ -12,18 +12,18 @@ class ApplicationResource extends resource_1.Resource {
|
|
|
12
12
|
this.createExpressApp = () => {
|
|
13
13
|
const app = (0, express_1.default)();
|
|
14
14
|
// 中间件:解析 application/x-www-form-urlencoded
|
|
15
|
-
app.use(express_1.default.urlencoded({ extended: true, limit:
|
|
15
|
+
app.use(express_1.default.urlencoded({ extended: true, limit: "50mb" }));
|
|
16
16
|
// 中间件:解析 application/json
|
|
17
|
-
app.use(express_1.default.json({ limit:
|
|
17
|
+
app.use(express_1.default.json({ limit: "50mb" }));
|
|
18
18
|
this.extendExpressApp({
|
|
19
|
-
app
|
|
19
|
+
app,
|
|
20
20
|
});
|
|
21
21
|
return app;
|
|
22
22
|
};
|
|
23
23
|
this.extendExpressApp = (params) => {
|
|
24
24
|
const { id, getFilteredResources } = this;
|
|
25
25
|
const getFilteredResourcesRes = getFilteredResources({
|
|
26
|
-
parentId: id
|
|
26
|
+
parentId: id,
|
|
27
27
|
});
|
|
28
28
|
const { resources } = getFilteredResourcesRes;
|
|
29
29
|
resources.forEach((resource) => {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "./specific-resource-settings";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"specific-resource-settings.d.ts","sourceRoot":"","sources":["../../src/types/specific-resource-settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,yCAAyC;;8BAOlC,CAAC;AAErB,eAAO,MAAM,8BAA8B;;8BAA4C,CAAC;AACxF,MAAM,MAAM,mCAAmC,GAAG,CAAC,CAAC,KAAK,
|
|
1
|
+
{"version":3,"file":"specific-resource-settings.d.ts","sourceRoot":"","sources":["../../src/types/specific-resource-settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,yCAAyC;;8BAOlC,CAAC;AAErB,eAAO,MAAM,8BAA8B;;8BAA4C,CAAC;AACxF,MAAM,MAAM,mCAAmC,GAAG,CAAC,CAAC,KAAK,CACvD,OAAO,yCAAyC,CACjD,CAAC"}
|
|
@@ -7,7 +7,7 @@ exports.ApplicationSpecificResourceSettingsSchema = zod_1.z
|
|
|
7
7
|
/**
|
|
8
8
|
* Application Name
|
|
9
9
|
*/
|
|
10
|
-
name: zod_1.z.string().optional()
|
|
10
|
+
name: zod_1.z.string().optional(),
|
|
11
11
|
})
|
|
12
12
|
.catchall(zod_1.z.any());
|
|
13
13
|
exports.SpecificResourceSettingsSchema = exports.ApplicationSpecificResourceSettingsSchema;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ldsg/application",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.32",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"express": "^4.18.2",
|
|
15
15
|
"zod": "^4.1.11",
|
|
16
|
-
"@ldsg/
|
|
17
|
-
"@ldsg/
|
|
18
|
-
"@ldsg/resource
|
|
19
|
-
"@ldsg/
|
|
20
|
-
"@ldsg/types": "0.3.
|
|
16
|
+
"@ldsg/handler": "0.3.32",
|
|
17
|
+
"@ldsg/constants": "0.3.32",
|
|
18
|
+
"@ldsg/resource": "0.3.32",
|
|
19
|
+
"@ldsg/resource-definition": "0.3.32",
|
|
20
|
+
"@ldsg/types": "0.3.32"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@types/express": "^4.17.17",
|
|
@@ -25,6 +25,8 @@
|
|
|
25
25
|
"@types/node": "^20.13.0",
|
|
26
26
|
"@types/supertest": "^6.0.0",
|
|
27
27
|
"jest": "^29.5.0",
|
|
28
|
+
"oxfmt": "latest",
|
|
29
|
+
"oxlint": "latest",
|
|
28
30
|
"supertest": "^6.3.4",
|
|
29
31
|
"ts-jest": "^29.1.5",
|
|
30
32
|
"ts-node": "^10.9.2",
|
|
@@ -36,6 +38,8 @@
|
|
|
36
38
|
"scripts": {
|
|
37
39
|
"build": "tsc --project tsconfig.build.json",
|
|
38
40
|
"clean": "rm -rf dist",
|
|
41
|
+
"format": "oxfmt --write src/",
|
|
42
|
+
"lint": "oxlint src/",
|
|
39
43
|
"test": "jest"
|
|
40
44
|
}
|
|
41
45
|
}
|