@ldsg/route 0.1.0-alpha.18 → 0.2.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/__tests__/e2e.d.ts +2 -0
- package/dist/__tests__/e2e.d.ts.map +1 -0
- package/dist/__tests__/e2e.js +51 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/{src/constants.js → constants.js} +3 -2
- package/dist/handler.d.ts.map +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/instantiate-resource.d.ts.map +1 -0
- package/dist/resource.d.ts.map +1 -0
- package/dist/resource.js +16 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/specific-resource-settings.d.ts.map +1 -0
- package/package.json +13 -6
- package/apps/test-app/handlers/test-route/dist/index.d.ts +0 -3
- package/apps/test-app/handlers/test-route/dist/index.d.ts.map +0 -1
- package/apps/test-app/handlers/test-route/dist/index.js +0 -7
- package/apps/test-app/handlers/test-route/package.json +0 -24
- package/apps/test-app/handlers/test-route/src/index.ts +0 -5
- package/apps/test-app/handlers/test-route/tsconfig.build.json +0 -4
- package/apps/test-app/handlers/test-route/tsconfig.json +0 -111
- package/apps/test-app/node_modules/.bin/tsc +0 -17
- package/apps/test-app/node_modules/.bin/tsserver +0 -17
- package/apps/test-app/node_modules/.bin/webpack +0 -17
- package/apps/test-app/package.json +0 -22
- package/apps/test-app/resource.spec.ts +0 -55
- package/dist/apps/test-app/handlers/test-route/src/index.d.ts +0 -3
- package/dist/apps/test-app/handlers/test-route/src/index.d.ts.map +0 -1
- package/dist/apps/test-app/handlers/test-route/src/index.js +0 -7
- package/dist/apps/test-app/resource.spec.d.ts +0 -2
- package/dist/apps/test-app/resource.spec.d.ts.map +0 -1
- package/dist/apps/test-app/resource.spec.js +0 -59
- package/dist/src/constants.d.ts.map +0 -1
- package/dist/src/handler.d.ts.map +0 -1
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/instantiate-resource.d.ts.map +0 -1
- package/dist/src/resource.d.ts.map +0 -1
- package/dist/src/resource.js +0 -25
- package/dist/src/types/index.d.ts.map +0 -1
- package/dist/src/types/specific-resource-settings.d.ts.map +0 -1
- package/src/constants.ts +0 -32
- package/src/handler.ts +0 -17
- package/src/index.ts +0 -5
- package/src/instantiate-resource.ts +0 -19
- package/src/resource.ts +0 -18
- package/src/types/index.ts +0 -1
- package/src/types/specific-resource-settings.ts +0 -9
- package/tsconfig.build.json +0 -4
- package/tsconfig.json +0 -111
- /package/dist/{src/constants.d.ts → constants.d.ts} +0 -0
- /package/dist/{src/handler.d.ts → handler.d.ts} +0 -0
- /package/dist/{src/handler.js → handler.js} +0 -0
- /package/dist/{src/index.d.ts → index.d.ts} +0 -0
- /package/dist/{src/index.js → index.js} +0 -0
- /package/dist/{src/instantiate-resource.d.ts → instantiate-resource.d.ts} +0 -0
- /package/dist/{src/instantiate-resource.js → instantiate-resource.js} +0 -0
- /package/dist/{src/resource.d.ts → resource.d.ts} +0 -0
- /package/dist/{src/types → types}/index.d.ts +0 -0
- /package/dist/{src/types → types}/index.js +0 -0
- /package/dist/{src/types → types}/specific-resource-settings.d.ts +0 -0
- /package/dist/{src/types → types}/specific-resource-settings.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"e2e.d.ts","sourceRoot":"","sources":["../../src/__tests__/e2e.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const application_1 = require("@ldsg/application");
|
|
7
|
+
const handler_1 = require("@ldsg/handler");
|
|
8
|
+
const supertest_1 = __importDefault(require("supertest"));
|
|
9
|
+
const resource_1 = require("../resource");
|
|
10
|
+
const handler = (req, res) => {
|
|
11
|
+
res.send("Hello, World!");
|
|
12
|
+
};
|
|
13
|
+
test("application", async () => {
|
|
14
|
+
const applicationResource = new application_1.ApplicationResource({
|
|
15
|
+
id: "application",
|
|
16
|
+
kind: "application",
|
|
17
|
+
parentId: "root",
|
|
18
|
+
settings: {
|
|
19
|
+
title: "应用",
|
|
20
|
+
description: "应用根资源",
|
|
21
|
+
name: "测试应用",
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
new resource_1.RouteResource({
|
|
25
|
+
id: "route",
|
|
26
|
+
kind: "route",
|
|
27
|
+
parentId: "application",
|
|
28
|
+
settings: {
|
|
29
|
+
title: "应用",
|
|
30
|
+
description: "应用根资源",
|
|
31
|
+
path: "/test",
|
|
32
|
+
handlerResourceId: "route-test-app-test-handler",
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
new handler_1.HandlerResource({
|
|
36
|
+
id: "route-test-app-test-handler",
|
|
37
|
+
kind: "handler",
|
|
38
|
+
parentId: "root",
|
|
39
|
+
settings: {
|
|
40
|
+
title: "应用",
|
|
41
|
+
description: "应用根资源",
|
|
42
|
+
code: "",
|
|
43
|
+
dependencies: [],
|
|
44
|
+
handler,
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
const app = applicationResource.createExpressApp();
|
|
48
|
+
const response = await (0, supertest_1.default)(app).get("/test");
|
|
49
|
+
expect(response.statusCode).toBe(200);
|
|
50
|
+
expect(response.text).toBe("Hello, World!");
|
|
51
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AACA,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,eAAO,MAAM,iCAAiC,EAAE,uBAG/C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kCAAkC,EAAE,+BAQ9C,CAAC;AAEJ,eAAO,MAAM,6CAA6C,EAAE,uBACpB,CAAC;AAEzC,eAAO,MAAM,8CAA8C,EAAE,0CAI1D,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RESOURCE_DEFINITION_SPECIFIC_RESOURCE_SETTINGS = exports.RESOURCE_DEFINITION_GENERAL_RESOURCE_SETTINGS = exports.HANDLER_SPECIFIC_RESOURCE_SETTINGS = exports.HANDLER_GENERAL_RESOURCE_SETTINGS = void 0;
|
|
4
|
+
const application_1 = require("@ldsg/application");
|
|
4
5
|
exports.HANDLER_GENERAL_RESOURCE_SETTINGS = {
|
|
5
6
|
title: "路由类型资源处理程序",
|
|
6
7
|
description: "",
|
|
@@ -20,6 +21,6 @@ exports.HANDLER_SPECIFIC_RESOURCE_SETTINGS = {
|
|
|
20
21
|
};
|
|
21
22
|
exports.RESOURCE_DEFINITION_GENERAL_RESOURCE_SETTINGS = { title: "路由类型资源定义", description: "" };
|
|
22
23
|
exports.RESOURCE_DEFINITION_SPECIFIC_RESOURCE_SETTINGS = {
|
|
23
|
-
kind: "
|
|
24
|
-
|
|
24
|
+
kind: "route",
|
|
25
|
+
parentKind: application_1.RESOURCE_DEFINITION_SPECIFIC_RESOURCE_SETTINGS.kind,
|
|
25
26
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../src/handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EACL,yBAAyB,EACzB,sBAAsB,EACvB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AAExD,eAAO,MAAM,OAAO,EAAE,OAAO,CAC3B;IACE,yBAAyB,CACvB,+BAA+B,CAAC,6BAA6B,CAAC,CAC/D;CACF,EACD,sBAAsB,CAAC,aAAa,CAAC,CAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,wBAAwB,CAAC;AACvC,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instantiate-resource.d.ts","sourceRoot":"","sources":["../src/instantiate-resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AAExD,eAAO,MAAM,mBAAmB,EAAE,mBAAmB,CACnD,+BAA+B,CAAC,6BAA6B,CAAC,EAC9D,aAAa,CAWd,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../src/resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AAExD,qBAAa,aAAc,SAAQ,uBAAuB,CAAC,6BAA6B,CAAC;IACvF,gBAAgB,EAAE,gBAAgB,CAWhC;CACH"}
|
package/dist/resource.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RouteResource = void 0;
|
|
4
|
+
const handler_1 = require("@ldsg/handler");
|
|
5
|
+
class RouteResource extends handler_1.HandlerExtendedResource {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.extendExpressApp = async (params) => {
|
|
9
|
+
const { app } = params;
|
|
10
|
+
const { settings: { path }, getExtendedHandler, } = this;
|
|
11
|
+
const extendedHandler = getExtendedHandler();
|
|
12
|
+
app.all(path, extendedHandler);
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.RouteResource = RouteResource;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"specific-resource-settings.d.ts","sourceRoot":"","sources":["../../src/types/specific-resource-settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEvD,MAAM,WAAW,6BACf,SAAQ,wBAAwB;IAChC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ldsg/route",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist/"
|
|
8
|
+
],
|
|
9
|
+
"types": "dist",
|
|
5
10
|
"keywords": [],
|
|
6
11
|
"author": "wanxger",
|
|
7
12
|
"license": "MIT",
|
|
@@ -9,15 +14,17 @@
|
|
|
9
14
|
"access": "public"
|
|
10
15
|
},
|
|
11
16
|
"dependencies": {
|
|
12
|
-
"@ldsg/handler": "0.
|
|
13
|
-
"@ldsg/resource": "0.
|
|
14
|
-
"@ldsg/resource-definition": "0.
|
|
17
|
+
"@ldsg/handler": "0.2.0",
|
|
18
|
+
"@ldsg/resource": "0.2.0",
|
|
19
|
+
"@ldsg/resource-definition": "0.2.0"
|
|
15
20
|
},
|
|
16
21
|
"devDependencies": {
|
|
22
|
+
"@types/express": "^5.0.1",
|
|
17
23
|
"@types/supertest": "^6.0.0",
|
|
18
24
|
"supertest": "^6.3.4",
|
|
19
|
-
"
|
|
20
|
-
"@ldsg/
|
|
25
|
+
"express": "^5.1.0",
|
|
26
|
+
"@ldsg/application": "0.2.0",
|
|
27
|
+
"@ldsg/types": "0.2.0"
|
|
21
28
|
},
|
|
22
29
|
"scripts": {
|
|
23
30
|
"build": "pnpm clean && tsc --project tsconfig.build.json",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,eAAO,MAAM,OAAO,EAAE,cAErB,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "test-route",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"files": [
|
|
7
|
-
"dist/"
|
|
8
|
-
],
|
|
9
|
-
"types": "dist",
|
|
10
|
-
"scripts": {
|
|
11
|
-
"build": "pnpm clean && tsc --project tsconfig.json",
|
|
12
|
-
"clean": "rm -f index.js"
|
|
13
|
-
},
|
|
14
|
-
"keywords": [],
|
|
15
|
-
"author": "",
|
|
16
|
-
"license": "ISC",
|
|
17
|
-
"packageManager": "pnpm@10.9.0",
|
|
18
|
-
"dependencies": {
|
|
19
|
-
"express": "^5.1.0"
|
|
20
|
-
},
|
|
21
|
-
"devDependencies": {
|
|
22
|
-
"@types/express": "^5.0.1"
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
/* Visit https://aka.ms/tsconfig to read more about this file */
|
|
4
|
-
|
|
5
|
-
/* Projects */
|
|
6
|
-
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
|
7
|
-
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
8
|
-
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
|
9
|
-
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
|
10
|
-
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
|
11
|
-
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
12
|
-
|
|
13
|
-
/* Language and Environment */
|
|
14
|
-
"target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
|
15
|
-
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
16
|
-
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
17
|
-
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
|
18
|
-
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
19
|
-
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
|
20
|
-
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
21
|
-
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
|
22
|
-
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
|
23
|
-
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
24
|
-
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
25
|
-
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
|
26
|
-
|
|
27
|
-
/* Modules */
|
|
28
|
-
"module": "commonjs" /* Specify what module code is generated. */,
|
|
29
|
-
// "rootDir": "./", /* Specify the root folder within your source files. */
|
|
30
|
-
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
31
|
-
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
32
|
-
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
33
|
-
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
34
|
-
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
|
35
|
-
"types": [
|
|
36
|
-
"jest"
|
|
37
|
-
] /* Specify type package names to be included without being referenced in a source file. */,
|
|
38
|
-
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
39
|
-
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
|
40
|
-
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
|
|
41
|
-
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
|
|
42
|
-
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
|
43
|
-
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
|
44
|
-
"resolveJsonModule": true /* Enable importing .json files. */,
|
|
45
|
-
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
|
46
|
-
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
|
47
|
-
|
|
48
|
-
/* JavaScript Support */
|
|
49
|
-
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
|
50
|
-
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
51
|
-
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
|
52
|
-
|
|
53
|
-
/* Emit */
|
|
54
|
-
"declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */,
|
|
55
|
-
"declarationMap": true /* Create sourcemaps for d.ts files. */,
|
|
56
|
-
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
57
|
-
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
58
|
-
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
59
|
-
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
|
60
|
-
"outDir": "./dist" /* Specify an output folder for all emitted files. */,
|
|
61
|
-
// "removeComments": true, /* Disable emitting comments. */
|
|
62
|
-
// "noEmit": true, /* Disable emitting files from a compilation. */
|
|
63
|
-
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
64
|
-
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
|
|
65
|
-
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
66
|
-
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
67
|
-
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
68
|
-
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
69
|
-
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
70
|
-
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
71
|
-
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
|
72
|
-
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
|
73
|
-
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
74
|
-
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
|
75
|
-
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
76
|
-
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
|
77
|
-
|
|
78
|
-
/* Interop Constraints */
|
|
79
|
-
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
80
|
-
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
|
|
81
|
-
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
82
|
-
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
|
|
83
|
-
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
84
|
-
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
|
|
85
|
-
|
|
86
|
-
/* Type Checking */
|
|
87
|
-
"strict": true /* Enable all strict type-checking options. */,
|
|
88
|
-
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
|
89
|
-
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
|
90
|
-
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
91
|
-
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
|
92
|
-
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
93
|
-
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
|
94
|
-
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
|
95
|
-
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
96
|
-
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
|
97
|
-
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
|
98
|
-
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
99
|
-
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
100
|
-
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
101
|
-
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
|
102
|
-
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
103
|
-
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
|
104
|
-
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
105
|
-
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
106
|
-
|
|
107
|
-
/* Completeness */
|
|
108
|
-
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
109
|
-
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
110
|
-
}
|
|
111
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
-
|
|
4
|
-
case `uname` in
|
|
5
|
-
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
6
|
-
esac
|
|
7
|
-
|
|
8
|
-
if [ -z "$NODE_PATH" ]; then
|
|
9
|
-
export NODE_PATH="/workspaces/ldsg/node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/bin/node_modules:/workspaces/ldsg/node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/node_modules:/workspaces/ldsg/node_modules/.pnpm/typescript@5.8.3/node_modules:/workspaces/ldsg/node_modules/.pnpm/node_modules"
|
|
10
|
-
else
|
|
11
|
-
export NODE_PATH="/workspaces/ldsg/node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/bin/node_modules:/workspaces/ldsg/node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/node_modules:/workspaces/ldsg/node_modules/.pnpm/typescript@5.8.3/node_modules:/workspaces/ldsg/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
12
|
-
fi
|
|
13
|
-
if [ -x "$basedir/node" ]; then
|
|
14
|
-
exec "$basedir/node" "$basedir/../typescript/bin/tsc" "$@"
|
|
15
|
-
else
|
|
16
|
-
exec node "$basedir/../typescript/bin/tsc" "$@"
|
|
17
|
-
fi
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
-
|
|
4
|
-
case `uname` in
|
|
5
|
-
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
6
|
-
esac
|
|
7
|
-
|
|
8
|
-
if [ -z "$NODE_PATH" ]; then
|
|
9
|
-
export NODE_PATH="/workspaces/ldsg/node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/bin/node_modules:/workspaces/ldsg/node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/node_modules:/workspaces/ldsg/node_modules/.pnpm/typescript@5.8.3/node_modules:/workspaces/ldsg/node_modules/.pnpm/node_modules"
|
|
10
|
-
else
|
|
11
|
-
export NODE_PATH="/workspaces/ldsg/node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/bin/node_modules:/workspaces/ldsg/node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/node_modules:/workspaces/ldsg/node_modules/.pnpm/typescript@5.8.3/node_modules:/workspaces/ldsg/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
12
|
-
fi
|
|
13
|
-
if [ -x "$basedir/node" ]; then
|
|
14
|
-
exec "$basedir/node" "$basedir/../typescript/bin/tsserver" "$@"
|
|
15
|
-
else
|
|
16
|
-
exec node "$basedir/../typescript/bin/tsserver" "$@"
|
|
17
|
-
fi
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
-
|
|
4
|
-
case `uname` in
|
|
5
|
-
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
6
|
-
esac
|
|
7
|
-
|
|
8
|
-
if [ -z "$NODE_PATH" ]; then
|
|
9
|
-
export NODE_PATH="/workspaces/ldsg/node_modules/.pnpm/webpack@5.97.1_webpack-cli@5.1.4/node_modules/webpack/bin/node_modules:/workspaces/ldsg/node_modules/.pnpm/webpack@5.97.1_webpack-cli@5.1.4/node_modules/webpack/node_modules:/workspaces/ldsg/node_modules/.pnpm/webpack@5.97.1_webpack-cli@5.1.4/node_modules:/workspaces/ldsg/node_modules/.pnpm/node_modules"
|
|
10
|
-
else
|
|
11
|
-
export NODE_PATH="/workspaces/ldsg/node_modules/.pnpm/webpack@5.97.1_webpack-cli@5.1.4/node_modules/webpack/bin/node_modules:/workspaces/ldsg/node_modules/.pnpm/webpack@5.97.1_webpack-cli@5.1.4/node_modules/webpack/node_modules:/workspaces/ldsg/node_modules/.pnpm/webpack@5.97.1_webpack-cli@5.1.4/node_modules:/workspaces/ldsg/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
12
|
-
fi
|
|
13
|
-
if [ -x "$basedir/node" ]; then
|
|
14
|
-
exec "$basedir/node" "$basedir/../../../../../../node_modules/.pnpm/webpack@5.97.1_webpack-cli@5.1.4/node_modules/webpack/bin/webpack.js" "$@"
|
|
15
|
-
else
|
|
16
|
-
exec node "$basedir/../../../../../../node_modules/.pnpm/webpack@5.97.1_webpack-cli@5.1.4/node_modules/webpack/bin/webpack.js" "$@"
|
|
17
|
-
fi
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "ldsg-app",
|
|
3
|
-
"version": "0.0.0",
|
|
4
|
-
"description": "",
|
|
5
|
-
"author": "",
|
|
6
|
-
"private": true,
|
|
7
|
-
"license": "UNLICENSED",
|
|
8
|
-
"dependencies": {
|
|
9
|
-
"@ldsg/create-app": "workspace:*",
|
|
10
|
-
"@ldsg/route": "workspace:*",
|
|
11
|
-
"graphql": "^16.9.0",
|
|
12
|
-
"graphql-middleware": "^6.1.35",
|
|
13
|
-
"graphql-shield": "^7.6.5",
|
|
14
|
-
"test-route": "link:handlers/test-route"
|
|
15
|
-
},
|
|
16
|
-
"devDependencies": {
|
|
17
|
-
"@types/node": "^22.1.0",
|
|
18
|
-
"ts-loader": "^9.5.1",
|
|
19
|
-
"tslib": "^2.6.3",
|
|
20
|
-
"typescript": "^5.5.4"
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { ApplicationResource } from "@ldsg/application";
|
|
2
|
-
import { HandlerResource } from "@ldsg/handler";
|
|
3
|
-
import request from "supertest";
|
|
4
|
-
import { RouteResource } from "../../src/resource";
|
|
5
|
-
|
|
6
|
-
test("application", async () => {
|
|
7
|
-
const applicationResource = new ApplicationResource({
|
|
8
|
-
id: "application",
|
|
9
|
-
kind: "APPLICATION",
|
|
10
|
-
parentId: "root",
|
|
11
|
-
settings: {
|
|
12
|
-
title: "应用",
|
|
13
|
-
description: "应用根资源",
|
|
14
|
-
name: "测试应用",
|
|
15
|
-
},
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
new RouteResource({
|
|
19
|
-
id: "route",
|
|
20
|
-
kind: "ROUTE",
|
|
21
|
-
parentId: "application",
|
|
22
|
-
settings: {
|
|
23
|
-
title: "应用",
|
|
24
|
-
description: "应用根资源",
|
|
25
|
-
path: "/test",
|
|
26
|
-
handlerResourceId: "test-route",
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
new HandlerResource({
|
|
31
|
-
id: "test-route",
|
|
32
|
-
kind: "HANDLER",
|
|
33
|
-
parentId: "root",
|
|
34
|
-
settings: {
|
|
35
|
-
title: "应用",
|
|
36
|
-
description: "应用根资源",
|
|
37
|
-
code: "",
|
|
38
|
-
dependencies: [],
|
|
39
|
-
},
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
const app = await applicationResource.createExpressApp();
|
|
43
|
-
|
|
44
|
-
const response = await request(app).get("/");
|
|
45
|
-
|
|
46
|
-
expect(response.statusCode).toBe(200);
|
|
47
|
-
|
|
48
|
-
expect(response.text).toBe("Hello, 测试应用!");
|
|
49
|
-
|
|
50
|
-
const response2 = await request(app).get("/test");
|
|
51
|
-
|
|
52
|
-
expect(response2.statusCode).toBe(200);
|
|
53
|
-
|
|
54
|
-
expect(response2.text).toBe("Hello, World!");
|
|
55
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../apps/test-app/handlers/test-route/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,eAAO,MAAM,OAAO,EAAE,cAErB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resource.spec.d.ts","sourceRoot":"","sources":["../../../apps/test-app/resource.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1,59 +0,0 @@
|
|
|
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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const application_1 = require("@ldsg/application");
|
|
16
|
-
const handler_1 = require("@ldsg/handler");
|
|
17
|
-
const supertest_1 = __importDefault(require("supertest"));
|
|
18
|
-
const resource_1 = require("../../src/resource");
|
|
19
|
-
test("application", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
-
const applicationResource = new application_1.ApplicationResource({
|
|
21
|
-
id: "application",
|
|
22
|
-
kind: "APPLICATION",
|
|
23
|
-
parentId: "root",
|
|
24
|
-
settings: {
|
|
25
|
-
title: "应用",
|
|
26
|
-
description: "应用根资源",
|
|
27
|
-
name: "测试应用",
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
new resource_1.RouteResource({
|
|
31
|
-
id: "route",
|
|
32
|
-
kind: "ROUTE",
|
|
33
|
-
parentId: "application",
|
|
34
|
-
settings: {
|
|
35
|
-
title: "应用",
|
|
36
|
-
description: "应用根资源",
|
|
37
|
-
path: "/test",
|
|
38
|
-
handlerResourceId: "test-route",
|
|
39
|
-
},
|
|
40
|
-
});
|
|
41
|
-
new handler_1.HandlerResource({
|
|
42
|
-
id: "test-route",
|
|
43
|
-
kind: "HANDLER",
|
|
44
|
-
parentId: "root",
|
|
45
|
-
settings: {
|
|
46
|
-
title: "应用",
|
|
47
|
-
description: "应用根资源",
|
|
48
|
-
code: "",
|
|
49
|
-
dependencies: [],
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
const app = yield applicationResource.createExpressApp();
|
|
53
|
-
const response = yield (0, supertest_1.default)(app).get("/");
|
|
54
|
-
expect(response.statusCode).toBe(200);
|
|
55
|
-
expect(response.text).toBe("Hello, 测试应用!");
|
|
56
|
-
const response2 = yield (0, supertest_1.default)(app).get("/test");
|
|
57
|
-
expect(response2.statusCode).toBe(200);
|
|
58
|
-
expect(response2.text).toBe("Hello, World!");
|
|
59
|
-
}));
|
|
@@ -1 +0,0 @@
|
|
|
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,eAAO,MAAM,iCAAiC,EAAE,uBAG/C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kCAAkC,EAAE,+BAQ9C,CAAC;AAEJ,eAAO,MAAM,6CAA6C,EAAE,uBACpB,CAAC;AAEzC,eAAO,MAAM,8CAA8C,EAAE,0CAI1D,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EACL,yBAAyB,EACzB,sBAAsB,EACvB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AAExD,eAAO,MAAM,OAAO,EAAE,OAAO,CAC3B;IACE,yBAAyB,CACvB,+BAA+B,CAAC,6BAA6B,CAAC,CAC/D;CACF,EACD,sBAAsB,CAAC,aAAa,CAAC,CAChB,CAAC"}
|
package/dist/src/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,wBAAwB,CAAC;AACvC,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"instantiate-resource.d.ts","sourceRoot":"","sources":["../../src/instantiate-resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AAExD,eAAO,MAAM,mBAAmB,EAAE,mBAAmB,CACnD,+BAA+B,CAAC,6BAA6B,CAAC,EAC9D,aAAa,CAWd,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../src/resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AAExD,qBAAa,aAAc,SAAQ,uBAAuB,CAAC,6BAA6B,CAAC;IACvF,gBAAgB,EAAE,gBAAgB,CAWhC;CACH"}
|
package/dist/src/resource.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
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
|
-
exports.RouteResource = void 0;
|
|
13
|
-
const handler_1 = require("@ldsg/handler");
|
|
14
|
-
class RouteResource extends handler_1.HandlerExtendedResource {
|
|
15
|
-
constructor() {
|
|
16
|
-
super(...arguments);
|
|
17
|
-
this.extendExpressApp = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
18
|
-
const { app } = params;
|
|
19
|
-
const { settings: { path }, getHandler, } = this;
|
|
20
|
-
const handler = getHandler();
|
|
21
|
-
app.all(path, handler);
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
exports.RouteResource = RouteResource;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"specific-resource-settings.d.ts","sourceRoot":"","sources":["../../../src/types/specific-resource-settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEvD,MAAM,WAAW,6BACf,SAAQ,wBAAwB;IAChC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd"}
|
package/src/constants.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { HandlerSpecificResourceSettings } from "@ldsg/handler";
|
|
2
|
-
import { ResourceDefinitionSpecificResourceSettings } from "@ldsg/resource-definition";
|
|
3
|
-
import { GeneralResourceSettings } from "@ldsg/types";
|
|
4
|
-
|
|
5
|
-
export const HANDLER_GENERAL_RESOURCE_SETTINGS: GeneralResourceSettings = {
|
|
6
|
-
title: "路由类型资源处理程序",
|
|
7
|
-
description: "",
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Handler Resource Settings
|
|
12
|
-
* 此类型资源的子级处理程序资源的配置
|
|
13
|
-
* 如无或为 undefined,则说明无需子级处理程序。
|
|
14
|
-
*/
|
|
15
|
-
export const HANDLER_SPECIFIC_RESOURCE_SETTINGS: HandlerSpecificResourceSettings =
|
|
16
|
-
{
|
|
17
|
-
code: `export * from "@ldsg/route";`,
|
|
18
|
-
dependencies: [
|
|
19
|
-
{
|
|
20
|
-
name: "@ldsg/route",
|
|
21
|
-
},
|
|
22
|
-
],
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const RESOURCE_DEFINITION_GENERAL_RESOURCE_SETTINGS: GeneralResourceSettings =
|
|
26
|
-
{ title: "路由类型资源定义", description: "" };
|
|
27
|
-
|
|
28
|
-
export const RESOURCE_DEFINITION_SPECIFIC_RESOURCE_SETTINGS: ResourceDefinitionSpecificResourceSettings =
|
|
29
|
-
{
|
|
30
|
-
kind: "ROUTE",
|
|
31
|
-
subKinds: [],
|
|
32
|
-
};
|
package/src/handler.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Handler, HandlerExtendedResourceSettings } from "@ldsg/handler";
|
|
2
|
-
import {
|
|
3
|
-
InstantiateResourceParams,
|
|
4
|
-
InstantiateResourceRes,
|
|
5
|
-
} from "@ldsg/resource";
|
|
6
|
-
import { instantiateResource } from "./instantiate-resource";
|
|
7
|
-
import { RouteResource } from "./resource";
|
|
8
|
-
import { RouteSpecificResourceSettings } from "./types";
|
|
9
|
-
|
|
10
|
-
export const handler: Handler<
|
|
11
|
-
[
|
|
12
|
-
InstantiateResourceParams<
|
|
13
|
-
HandlerExtendedResourceSettings<RouteSpecificResourceSettings>
|
|
14
|
-
>
|
|
15
|
-
],
|
|
16
|
-
InstantiateResourceRes<RouteResource>
|
|
17
|
-
> = instantiateResource;
|
package/src/index.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { HandlerExtendedResourceSettings } from "@ldsg/handler";
|
|
2
|
-
import { InstantiateResource } from "@ldsg/resource";
|
|
3
|
-
import { RouteResource } from "./resource";
|
|
4
|
-
import { RouteSpecificResourceSettings } from "./types";
|
|
5
|
-
|
|
6
|
-
export const instantiateResource: InstantiateResource<
|
|
7
|
-
HandlerExtendedResourceSettings<RouteSpecificResourceSettings>,
|
|
8
|
-
RouteResource
|
|
9
|
-
> = (params) => {
|
|
10
|
-
const { resourceConstructorParams } = params;
|
|
11
|
-
|
|
12
|
-
const resource = new RouteResource(resourceConstructorParams);
|
|
13
|
-
|
|
14
|
-
const res = {
|
|
15
|
-
resource,
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
return res;
|
|
19
|
-
};
|
package/src/resource.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ExtendExpressApp } from "@ldsg/application";
|
|
2
|
-
import { HandlerExtendedResource } from "@ldsg/handler";
|
|
3
|
-
import { RouteSpecificResourceSettings } from "./types";
|
|
4
|
-
|
|
5
|
-
export class RouteResource extends HandlerExtendedResource<RouteSpecificResourceSettings> {
|
|
6
|
-
extendExpressApp: ExtendExpressApp = async (params) => {
|
|
7
|
-
const { app } = params;
|
|
8
|
-
|
|
9
|
-
const {
|
|
10
|
-
settings: { path },
|
|
11
|
-
getHandler,
|
|
12
|
-
} = this;
|
|
13
|
-
|
|
14
|
-
const handler = getHandler();
|
|
15
|
-
|
|
16
|
-
app.all(path, handler);
|
|
17
|
-
};
|
|
18
|
-
}
|
package/src/types/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./specific-resource-settings";
|
package/tsconfig.build.json
DELETED
package/tsconfig.json
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
/* Visit https://aka.ms/tsconfig to read more about this file */
|
|
4
|
-
|
|
5
|
-
/* Projects */
|
|
6
|
-
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
|
7
|
-
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
8
|
-
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
|
9
|
-
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
|
10
|
-
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
|
11
|
-
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
12
|
-
|
|
13
|
-
/* Language and Environment */
|
|
14
|
-
"target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
|
15
|
-
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
16
|
-
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
17
|
-
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
|
18
|
-
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
19
|
-
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
|
20
|
-
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
21
|
-
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
|
22
|
-
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
|
23
|
-
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
24
|
-
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
25
|
-
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
|
26
|
-
|
|
27
|
-
/* Modules */
|
|
28
|
-
"module": "commonjs" /* Specify what module code is generated. */,
|
|
29
|
-
// "rootDir": "./", /* Specify the root folder within your source files. */
|
|
30
|
-
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
31
|
-
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
32
|
-
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
33
|
-
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
34
|
-
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
|
35
|
-
"types": [
|
|
36
|
-
"jest"
|
|
37
|
-
] /* Specify type package names to be included without being referenced in a source file. */,
|
|
38
|
-
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
39
|
-
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
|
40
|
-
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
|
|
41
|
-
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
|
|
42
|
-
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
|
43
|
-
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
|
44
|
-
"resolveJsonModule": true /* Enable importing .json files. */,
|
|
45
|
-
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
|
46
|
-
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
|
47
|
-
|
|
48
|
-
/* JavaScript Support */
|
|
49
|
-
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
|
50
|
-
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
51
|
-
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
|
52
|
-
|
|
53
|
-
/* Emit */
|
|
54
|
-
"declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */,
|
|
55
|
-
"declarationMap": true /* Create sourcemaps for d.ts files. */,
|
|
56
|
-
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
57
|
-
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
58
|
-
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
59
|
-
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
|
60
|
-
"outDir": "./dist" /* Specify an output folder for all emitted files. */,
|
|
61
|
-
// "removeComments": true, /* Disable emitting comments. */
|
|
62
|
-
// "noEmit": true, /* Disable emitting files from a compilation. */
|
|
63
|
-
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
64
|
-
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
|
|
65
|
-
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
66
|
-
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
67
|
-
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
68
|
-
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
69
|
-
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
70
|
-
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
71
|
-
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
|
72
|
-
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
|
73
|
-
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
74
|
-
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
|
75
|
-
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
76
|
-
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
|
77
|
-
|
|
78
|
-
/* Interop Constraints */
|
|
79
|
-
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
80
|
-
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
|
|
81
|
-
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
82
|
-
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
|
|
83
|
-
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
84
|
-
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
|
|
85
|
-
|
|
86
|
-
/* Type Checking */
|
|
87
|
-
"strict": true /* Enable all strict type-checking options. */,
|
|
88
|
-
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
|
89
|
-
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
|
90
|
-
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
91
|
-
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
|
92
|
-
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
93
|
-
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
|
94
|
-
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
|
95
|
-
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
96
|
-
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
|
97
|
-
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
|
98
|
-
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
99
|
-
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
100
|
-
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
101
|
-
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
|
102
|
-
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
103
|
-
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
|
104
|
-
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
105
|
-
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
106
|
-
|
|
107
|
-
/* Completeness */
|
|
108
|
-
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
109
|
-
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
110
|
-
}
|
|
111
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|