@ldsg/field-type 0.1.0-alpha.18
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/LICENSE +22 -0
- package/README.md +1 -0
- package/dist/constants.d.ts +13 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +25 -0
- package/dist/handler.d.ts +8 -0
- package/dist/handler.d.ts.map +1 -0
- package/dist/handler.js +5 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/instantiate-resource.d.ts +6 -0
- package/dist/instantiate-resource.d.ts.map +1 -0
- package/dist/instantiate-resource.js +13 -0
- package/dist/resource.d.ts +5 -0
- package/dist/resource.d.ts.map +1 -0
- package/dist/resource.js +7 -0
- package/dist/resource.spec.d.ts +2 -0
- package/dist/resource.spec.d.ts.map +1 -0
- package/dist/resource.spec.js +47 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +17 -0
- package/dist/types/specific-resource-settings.d.ts +12 -0
- package/dist/types/specific-resource-settings.d.ts.map +1 -0
- package/dist/types/specific-resource-settings.js +2 -0
- package/package.json +31 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# LDSG Graphql Resource
|
|
@@ -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":"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,uBAClB,CAAC;AAE3C,eAAO,MAAM,8CAA8C,EAAE,0CAI1D,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
exports.HANDLER_GENERAL_RESOURCE_SETTINGS = {
|
|
5
|
+
title: "字段类型类型资源处理程序",
|
|
6
|
+
description: "",
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Handler Resource Settings
|
|
10
|
+
* 此类型资源的子级处理程序资源的配置
|
|
11
|
+
* 如无或为 undefined,则说明无需子级处理程序。
|
|
12
|
+
*/
|
|
13
|
+
exports.HANDLER_SPECIFIC_RESOURCE_SETTINGS = {
|
|
14
|
+
code: `export * from "@ldsg/field-type";`,
|
|
15
|
+
dependencies: [
|
|
16
|
+
{
|
|
17
|
+
name: "@ldsg/field-type",
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
};
|
|
21
|
+
exports.RESOURCE_DEFINITION_GENERAL_RESOURCE_SETTINGS = { title: "字段类型类型资源定义", description: "" };
|
|
22
|
+
exports.RESOURCE_DEFINITION_SPECIFIC_RESOURCE_SETTINGS = {
|
|
23
|
+
kind: "FIELD_TYPE",
|
|
24
|
+
subKinds: [],
|
|
25
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Handler, HandlerExtendedResourceSettings } from "@ldsg/handler";
|
|
2
|
+
import { InstantiateResourceParams, InstantiateResourceRes } from "@ldsg/resource";
|
|
3
|
+
import { FieldTypeResource } from "./resource";
|
|
4
|
+
import { FieldTypeSpecificResourceSettings } from "./types";
|
|
5
|
+
export declare const handler: Handler<[
|
|
6
|
+
InstantiateResourceParams<HandlerExtendedResourceSettings<FieldTypeSpecificResourceSettings>>
|
|
7
|
+
], InstantiateResourceRes<FieldTypeResource>>;
|
|
8
|
+
//# sourceMappingURL=handler.d.ts.map
|
|
@@ -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,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,iCAAiC,EAAE,MAAM,SAAS,CAAC;AAE5D,eAAO,MAAM,OAAO,EAAE,OAAO,CAC3B;IACE,yBAAyB,CACvB,+BAA+B,CAAC,iCAAiC,CAAC,CACnE;CACF,EACD,sBAAsB,CAAC,iBAAiB,CAAC,CACpB,CAAC"}
|
package/dist/handler.js
ADDED
package/dist/index.d.ts
ADDED
|
@@ -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"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./constants"), exports);
|
|
18
|
+
__exportStar(require("./handler"), exports);
|
|
19
|
+
__exportStar(require("./instantiate-resource"), exports);
|
|
20
|
+
__exportStar(require("./resource"), exports);
|
|
21
|
+
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { HandlerExtendedResourceSettings } from "@ldsg/handler";
|
|
2
|
+
import { InstantiateResource } from "@ldsg/resource";
|
|
3
|
+
import { FieldTypeResource } from "./resource";
|
|
4
|
+
import { FieldTypeSpecificResourceSettings } from "./types";
|
|
5
|
+
export declare const instantiateResource: InstantiateResource<HandlerExtendedResourceSettings<FieldTypeSpecificResourceSettings>, FieldTypeResource>;
|
|
6
|
+
//# sourceMappingURL=instantiate-resource.d.ts.map
|
|
@@ -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,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,iCAAiC,EAAE,MAAM,SAAS,CAAC;AAE5D,eAAO,MAAM,mBAAmB,EAAE,mBAAmB,CACnD,+BAA+B,CAAC,iCAAiC,CAAC,EAClE,iBAAiB,CAWlB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.instantiateResource = void 0;
|
|
4
|
+
const resource_1 = require("./resource");
|
|
5
|
+
const instantiateResource = (params) => {
|
|
6
|
+
const { resourceConstructorParams } = params;
|
|
7
|
+
const resource = new resource_1.FieldTypeResource(resourceConstructorParams);
|
|
8
|
+
const res = {
|
|
9
|
+
resource,
|
|
10
|
+
};
|
|
11
|
+
return res;
|
|
12
|
+
};
|
|
13
|
+
exports.instantiateResource = instantiateResource;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../src/resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,iCAAiC,EAAE,MAAM,SAAS,CAAC;AAE5D,qBAAa,iBAAkB,SAAQ,QAAQ,CAAC,iCAAiC,CAAC;CAAG"}
|
package/dist/resource.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FieldTypeResource = void 0;
|
|
4
|
+
const resource_1 = require("@ldsg/resource");
|
|
5
|
+
class FieldTypeResource extends resource_1.Resource {
|
|
6
|
+
}
|
|
7
|
+
exports.FieldTypeResource = FieldTypeResource;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource.spec.d.ts","sourceRoot":"","sources":["../src/resource.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,47 @@
|
|
|
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 supertest_1 = __importDefault(require("supertest"));
|
|
17
|
+
const resource_1 = require("./resource");
|
|
18
|
+
test("application", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
|
+
const applicationResource = new application_1.ApplicationResource({
|
|
20
|
+
id: "application",
|
|
21
|
+
kind: "APPLICATION",
|
|
22
|
+
parentId: "ROOT",
|
|
23
|
+
settings: {
|
|
24
|
+
title: "应用",
|
|
25
|
+
description: "应用根资源",
|
|
26
|
+
name: "测试应用",
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
new resource_1.FieldTypeResource({
|
|
30
|
+
id: "object-field",
|
|
31
|
+
kind: "OBJECT_FIELD",
|
|
32
|
+
parentId: "application",
|
|
33
|
+
settings: {
|
|
34
|
+
title: "",
|
|
35
|
+
description: "",
|
|
36
|
+
name: "string",
|
|
37
|
+
platformTypeMap: {},
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
const app = yield applicationResource.createExpressApp();
|
|
41
|
+
const response = yield (0, supertest_1.default)(app).get("/");
|
|
42
|
+
expect(response.statusCode).toBe(200);
|
|
43
|
+
expect(response.text).toBe("Hello, 测试应用!");
|
|
44
|
+
const response2 = yield (0, supertest_1.default)(app).get("/test-fieldtype");
|
|
45
|
+
expect(response2.statusCode).toBe(200);
|
|
46
|
+
expect(response2.text).toMatchSnapshot();
|
|
47
|
+
}));
|
|
@@ -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,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./specific-resource-settings"), exports);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SpecificResourceSettings } from "@ldsg/types";
|
|
2
|
+
export interface FieldTypeSpecificResourceSettings extends SpecificResourceSettings {
|
|
3
|
+
/**
|
|
4
|
+
* field type name
|
|
5
|
+
*/
|
|
6
|
+
name: string;
|
|
7
|
+
/**
|
|
8
|
+
* Platform Type Map
|
|
9
|
+
*/
|
|
10
|
+
platformTypeMap: Record<string, any>;
|
|
11
|
+
}
|
|
12
|
+
//# 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,iCACf,SAAQ,wBAAwB;IAChC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACtC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ldsg/field-type",
|
|
3
|
+
"version": "0.1.0-alpha.18",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist/"
|
|
8
|
+
],
|
|
9
|
+
"types": "dist",
|
|
10
|
+
"keywords": [],
|
|
11
|
+
"author": "wanxger",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@ldsg/resource": "0.1.0-alpha.18",
|
|
18
|
+
"@ldsg/handler": "0.1.0-alpha.18",
|
|
19
|
+
"@ldsg/resource-definition": "0.1.0-alpha.18"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@types/supertest": "^6.0.0",
|
|
23
|
+
"supertest": "^6.3.4",
|
|
24
|
+
"@ldsg/application": "0.1.0-alpha.18",
|
|
25
|
+
"@ldsg/types": "0.1.0-alpha.18"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "pnpm clean && tsc --project tsconfig.build.json",
|
|
29
|
+
"clean": "rm -rf dist"
|
|
30
|
+
}
|
|
31
|
+
}
|