@ldsg/application 0.1.0-alpha.9 → 0.2.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.
Files changed (35) hide show
  1. package/README.md +1 -1
  2. package/dist/__tests__/e2e.d.ts +6 -0
  3. package/dist/__tests__/e2e.d.ts.map +1 -0
  4. package/dist/__tests__/e2e.js +46 -0
  5. package/dist/constants.d.ts +13 -0
  6. package/dist/constants.d.ts.map +1 -0
  7. package/dist/constants.js +26 -0
  8. package/dist/handler.d.ts +2 -2
  9. package/dist/handler.d.ts.map +1 -1
  10. package/dist/index.d.ts +1 -2
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +1 -2
  13. package/dist/instantiate-resource.d.ts +2 -2
  14. package/dist/instantiate-resource.d.ts.map +1 -1
  15. package/dist/resource.d.ts +10 -3
  16. package/dist/resource.d.ts.map +1 -1
  17. package/dist/resource.js +14 -3
  18. package/dist/types/index.d.ts +1 -1
  19. package/dist/types/index.d.ts.map +1 -1
  20. package/dist/types/index.js +1 -1
  21. package/dist/types/specific-resource-settings.d.ts +8 -0
  22. package/dist/types/specific-resource-settings.d.ts.map +1 -0
  23. package/package.json +7 -4
  24. package/dist/handler-resource-settings.d.ts +0 -8
  25. package/dist/handler-resource-settings.d.ts.map +0 -1
  26. package/dist/handler-resource-settings.js +0 -18
  27. package/dist/resource-definition-resource-settings.d.ts +0 -3
  28. package/dist/resource-definition-resource-settings.d.ts.map +0 -1
  29. package/dist/resource-definition-resource-settings.js +0 -9
  30. package/dist/resource.spec.d.ts +0 -2
  31. package/dist/resource.spec.d.ts.map +0 -1
  32. package/dist/resource.spec.js +0 -31
  33. package/dist/types/resource-settings.d.ts +0 -4
  34. package/dist/types/resource-settings.d.ts.map +0 -1
  35. /package/dist/types/{resource-settings.js → specific-resource-settings.js} +0 -0
package/README.md CHANGED
@@ -1 +1 @@
1
- # Application Resource
1
+ # LDSG Application Resource
@@ -0,0 +1,6 @@
1
+ import { Resource } from "@ldsg/resource";
2
+ import { ExtendExpressApp } from "../resource";
3
+ export declare class AResource extends Resource {
4
+ extendExpressApp: ExtendExpressApp;
5
+ }
6
+ //# sourceMappingURL=e2e.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"e2e.d.ts","sourceRoot":"","sources":["../../src/__tests__/e2e.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAuB,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpE,qBAAa,SAAU,SAAQ,QAAQ;IACrC,gBAAgB,EAAE,gBAAgB,CAMhC;CACH"}
@@ -0,0 +1,46 @@
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
+ exports.AResource = void 0;
7
+ const resource_1 = require("@ldsg/resource");
8
+ const supertest_1 = __importDefault(require("supertest"));
9
+ const resource_2 = require("../resource");
10
+ class AResource extends resource_1.Resource {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.extendExpressApp = (params) => {
14
+ const { app } = params;
15
+ app.get("/", (req, res) => {
16
+ res.send("Hello, World!");
17
+ });
18
+ };
19
+ }
20
+ }
21
+ exports.AResource = AResource;
22
+ test("application", async () => {
23
+ const application = new resource_2.ApplicationResource({
24
+ id: "test-application",
25
+ kind: "application",
26
+ parentId: "ROOT",
27
+ settings: {
28
+ title: "测试应用",
29
+ description: "",
30
+ name: "",
31
+ },
32
+ });
33
+ new AResource({
34
+ id: "test-a",
35
+ kind: "a",
36
+ parentId: "test-application",
37
+ settings: {
38
+ title: "",
39
+ description: "",
40
+ },
41
+ });
42
+ const app = application.createExpressApp();
43
+ const response = await (0, supertest_1.default)(app).get("/");
44
+ expect(response.statusCode).toBe(200);
45
+ expect(response.text).toBe("Hello, World!");
46
+ });
@@ -0,0 +1,13 @@
1
+ import { HandlerSpecificResourceSettings } from "@ldsg/handler";
2
+ import { ResourceDefinitionSpecificResourceSettings } from "@ldsg/resource-definition";
3
+ import { GeneralResourceSettings } from "@ldsg/types";
4
+ export declare const HANDLER_GENERAL_RESOURCE_SETTINGS: GeneralResourceSettings;
5
+ /**
6
+ * Handler Resource Settings
7
+ * 此类型资源的子级处理程序资源的配置
8
+ * 如无或为 undefined,则说明无需子级处理程序。
9
+ */
10
+ export declare const HANDLER_SPECIFIC_RESOURCE_SETTINGS: HandlerSpecificResourceSettings;
11
+ export declare const RESOURCE_DEFINITION_GENERAL_RESOURCE_SETTINGS: GeneralResourceSettings;
12
+ export declare const RESOURCE_DEFINITION_SPECIFIC_RESOURCE_SETTINGS: ResourceDefinitionSpecificResourceSettings;
13
+ //# sourceMappingURL=constants.d.ts.map
@@ -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"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
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 constants_1 = require("@ldsg/constants");
5
+ exports.HANDLER_GENERAL_RESOURCE_SETTINGS = {
6
+ title: "应用类型资源处理程序",
7
+ description: "",
8
+ };
9
+ /**
10
+ * Handler Resource Settings
11
+ * 此类型资源的子级处理程序资源的配置
12
+ * 如无或为 undefined,则说明无需子级处理程序。
13
+ */
14
+ exports.HANDLER_SPECIFIC_RESOURCE_SETTINGS = {
15
+ code: `export * from "@ldsg/application";`,
16
+ dependencies: [
17
+ {
18
+ name: "@ldsg/application",
19
+ },
20
+ ],
21
+ };
22
+ exports.RESOURCE_DEFINITION_GENERAL_RESOURCE_SETTINGS = { title: "应用类型资源定义", description: "" };
23
+ exports.RESOURCE_DEFINITION_SPECIFIC_RESOURCE_SETTINGS = {
24
+ kind: "application",
25
+ parentKind: constants_1.ROOT_RESOURCE_KIND,
26
+ };
package/dist/handler.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { Handler } from "@ldsg/handler";
2
2
  import { InstantiateResourceParams, InstantiateResourceRes } from "@ldsg/resource";
3
3
  import { ApplicationResource } from "./resource";
4
- import { ApplicationResourceSettings } from "./types";
4
+ import { ApplicationSpecificResourceSettings } from "./types";
5
5
  export declare const handler: Handler<[
6
- InstantiateResourceParams<ApplicationResourceSettings>
6
+ InstantiateResourceParams<ApplicationSpecificResourceSettings>
7
7
  ], InstantiateResourceRes<ApplicationResource>>;
8
8
  //# sourceMappingURL=handler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../src/handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EACL,yBAAyB,EACzB,sBAAsB,EACvB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAEtD,eAAO,MAAM,OAAO,EAAE,OAAO,CAC3B;IAAC,yBAAyB,CAAC,2BAA2B,CAAC;CAAC,EACxD,sBAAsB,CAAC,mBAAmB,CAAC,CACtB,CAAC"}
1
+ {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../src/handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EACL,yBAAyB,EACzB,sBAAsB,EACvB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,mCAAmC,EAAE,MAAM,SAAS,CAAC;AAE9D,eAAO,MAAM,OAAO,EAAE,OAAO,CAC3B;IAAC,yBAAyB,CAAC,mCAAmC,CAAC;CAAC,EAChE,sBAAsB,CAAC,mBAAmB,CAAC,CACtB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
+ export * from "./constants";
1
2
  export * from "./handler";
2
- export * from "./handler-resource-settings";
3
3
  export * from "./instantiate-resource";
4
4
  export * from "./resource";
5
- export * from "./resource-definition-resource-settings";
6
5
  export * from "./types";
7
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,YAAY,CAAC;AAC3B,cAAc,yCAAyC,CAAC;AACxD,cAAc,SAAS,CAAC"}
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"}
package/dist/index.js CHANGED
@@ -14,9 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./constants"), exports);
17
18
  __exportStar(require("./handler"), exports);
18
- __exportStar(require("./handler-resource-settings"), exports);
19
19
  __exportStar(require("./instantiate-resource"), exports);
20
20
  __exportStar(require("./resource"), exports);
21
- __exportStar(require("./resource-definition-resource-settings"), exports);
22
21
  __exportStar(require("./types"), exports);
@@ -1,5 +1,5 @@
1
1
  import { InstantiateResource } from "@ldsg/resource";
2
2
  import { ApplicationResource } from "./resource";
3
- import { ApplicationResourceSettings } from "./types";
4
- export declare const instantiateResource: InstantiateResource<ApplicationResourceSettings, ApplicationResource>;
3
+ import { ApplicationSpecificResourceSettings } from "./types";
4
+ export declare const instantiateResource: InstantiateResource<ApplicationSpecificResourceSettings, ApplicationResource>;
5
5
  //# sourceMappingURL=instantiate-resource.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"instantiate-resource.d.ts","sourceRoot":"","sources":["../src/instantiate-resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAEtD,eAAO,MAAM,mBAAmB,EAAE,mBAAmB,CACnD,2BAA2B,EAC3B,mBAAmB,CAWpB,CAAC"}
1
+ {"version":3,"file":"instantiate-resource.d.ts","sourceRoot":"","sources":["../src/instantiate-resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,mCAAmC,EAAE,MAAM,SAAS,CAAC;AAE9D,eAAO,MAAM,mBAAmB,EAAE,mBAAmB,CACnD,mCAAmC,EACnC,mBAAmB,CAWpB,CAAC"}
@@ -1,7 +1,14 @@
1
1
  import { Resource } from "@ldsg/resource";
2
2
  import { Express } from "express";
3
- import { ApplicationResourceSettings } from "./types";
4
- export declare class ApplicationResource extends Resource<ApplicationResourceSettings> {
5
- createApp: () => Express;
3
+ import { ApplicationSpecificResourceSettings } from "./types";
4
+ type CreateExpressApp = () => Express;
5
+ interface ExtendExpressAppParams {
6
+ app: Express;
6
7
  }
8
+ export type ExtendExpressApp = (params: ExtendExpressAppParams) => void;
9
+ export declare class ApplicationResource extends Resource<ApplicationSpecificResourceSettings> {
10
+ createExpressApp: CreateExpressApp;
11
+ extendExpressApp: ExtendExpressApp;
12
+ }
13
+ export {};
7
14
  //# sourceMappingURL=resource.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../src/resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAgB,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAEtD,qBAAa,mBAAoB,SAAQ,QAAQ,CAAC,2BAA2B,CAAC;IAC5E,SAAS,EAAE,MAAM,OAAO,CAQtB;CACH"}
1
+ {"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../src/resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAgB,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,mCAAmC,EAAE,MAAM,SAAS,CAAC;AAE9D,KAAK,gBAAgB,GAAG,MAAM,OAAO,CAAC;AAEtC,UAAU,sBAAsB;IAC9B,GAAG,EAAE,OAAO,CAAC;CACd;AAED,MAAM,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,sBAAsB,KAAK,IAAI,CAAC;AAExE,qBAAa,mBAAoB,SAAQ,QAAQ,CAAC,mCAAmC,CAAC;IACpF,gBAAgB,EAAE,gBAAgB,CAQhC;IAEF,gBAAgB,EAAE,gBAAgB,CAchC;CACH"}
package/dist/resource.js CHANGED
@@ -9,13 +9,24 @@ const express_1 = __importDefault(require("express"));
9
9
  class ApplicationResource extends resource_1.Resource {
10
10
  constructor() {
11
11
  super(...arguments);
12
- this.createApp = () => {
12
+ this.createExpressApp = () => {
13
13
  const app = (0, express_1.default)();
14
- app.get("/", (req, res) => {
15
- res.send("Hello, World!");
14
+ this.extendExpressApp({
15
+ app,
16
16
  });
17
17
  return app;
18
18
  };
19
+ this.extendExpressApp = (params) => {
20
+ const { id, getFilteredResources } = this;
21
+ const getFilteredResourcesRes = getFilteredResources({
22
+ parentId: id,
23
+ });
24
+ const { resources } = getFilteredResourcesRes;
25
+ resources.forEach((resource) => {
26
+ var _a;
27
+ (_a = resource.extendExpressApp) === null || _a === void 0 ? void 0 : _a.call(resource, params);
28
+ });
29
+ };
19
30
  }
20
31
  }
21
32
  exports.ApplicationResource = ApplicationResource;
@@ -1,2 +1,2 @@
1
- export * from "./resource-settings";
1
+ export * from "./specific-resource-settings";
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC"}
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./resource-settings"), exports);
17
+ __exportStar(require("./specific-resource-settings"), exports);
@@ -0,0 +1,8 @@
1
+ import { SpecificResourceSettings } from "@ldsg/types";
2
+ export interface ApplicationSpecificResourceSettings extends SpecificResourceSettings {
3
+ /**
4
+ * Application Name
5
+ */
6
+ name?: string;
7
+ }
8
+ //# sourceMappingURL=specific-resource-settings.d.ts.map
@@ -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,mCACf,SAAQ,wBAAwB;IAChC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ldsg/application",
3
- "version": "0.1.0-alpha.9",
3
+ "version": "0.2.1",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -15,8 +15,10 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "express": "^4.18.2",
18
- "@ldsg/handler": "0.1.0-alpha.9",
19
- "@ldsg/resource": "0.1.0-alpha.9"
18
+ "@ldsg/handler": "0.2.1",
19
+ "@ldsg/resource": "0.2.1",
20
+ "@ldsg/types": "0.2.1",
21
+ "@ldsg/resource-definition": "0.2.1"
20
22
  },
21
23
  "devDependencies": {
22
24
  "@types/express": "^4.17.17",
@@ -25,6 +27,7 @@
25
27
  "supertest": "^6.3.4"
26
28
  },
27
29
  "scripts": {
28
- "build": "rm -rf dist && tsc --project tsconfig.build.json"
30
+ "build": "pnpm clean && tsc --project tsconfig.build.json",
31
+ "clean": "rm -rf dist"
29
32
  }
30
33
  }
@@ -1,8 +0,0 @@
1
- import { HandlerResourceSettings } from "@ldsg/handler";
2
- /**
3
- * Current Kind Resource Handler Resource Settings
4
- * 此类型资源的子级处理程序资源的配置
5
- * 如无或为 undefined,则说明无需子级处理程序。
6
- */
7
- export declare const handlerResourceSettings: HandlerResourceSettings;
8
- //# sourceMappingURL=handler-resource-settings.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"handler-resource-settings.d.ts","sourceRoot":"","sources":["../src/handler-resource-settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAExD;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,EAAE,uBASrC,CAAC"}
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.handlerResourceSettings = void 0;
4
- /**
5
- * Current Kind Resource Handler Resource Settings
6
- * 此类型资源的子级处理程序资源的配置
7
- * 如无或为 undefined,则说明无需子级处理程序。
8
- */
9
- exports.handlerResourceSettings = {
10
- title: "应用类型资源处理程序",
11
- description: "",
12
- code: `export * from "@ldsg/application";`,
13
- dependencies: [
14
- {
15
- name: "@ldsg/application",
16
- },
17
- ],
18
- };
@@ -1,3 +0,0 @@
1
- import { ResourceDefinitionResourceSettings } from "@ldsg/resource";
2
- export declare const resourceDefinitionResourceSettings: ResourceDefinitionResourceSettings;
3
- //# sourceMappingURL=resource-definition-resource-settings.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resource-definition-resource-settings.d.ts","sourceRoot":"","sources":["../src/resource-definition-resource-settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kCAAkC,EAAE,MAAM,gBAAgB,CAAC;AAEpE,eAAO,MAAM,kCAAkC,EAAE,kCAM9C,CAAC"}
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resourceDefinitionResourceSettings = void 0;
4
- exports.resourceDefinitionResourceSettings = {
5
- title: "应用类型资源定义",
6
- description: "",
7
- kind: "APPLICATION",
8
- subKinds: [],
9
- };
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=resource.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resource.spec.d.ts","sourceRoot":"","sources":["../src/resource.spec.ts"],"names":[],"mappings":""}
@@ -1,31 +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 supertest_1 = __importDefault(require("supertest"));
16
- const resource_1 = require("./resource");
17
- test("application", () => __awaiter(void 0, void 0, void 0, function* () {
18
- const application = new resource_1.ApplicationResource({
19
- id: "APPLICATION",
20
- kind: "APPLICATION",
21
- parentId: "ROOT",
22
- settings: {
23
- title: "应用",
24
- description: "应用根资源",
25
- },
26
- });
27
- const app = application.createApp();
28
- const response = yield (0, supertest_1.default)(app).get("/");
29
- expect(response.statusCode).toBe(200);
30
- expect(response.text).toBe("Hello, World!");
31
- }));
@@ -1,4 +0,0 @@
1
- import { Manifest } from "@ldsg/resource";
2
- export interface ApplicationResourceSettings extends Manifest.ResourceSettings {
3
- }
4
- //# sourceMappingURL=resource-settings.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resource-settings.d.ts","sourceRoot":"","sources":["../../src/types/resource-settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,WAAW,2BACf,SAAQ,QAAQ,CAAC,gBAAgB;CAAG"}