@kiwano/core 2.2.0-beta.2 → 3.0.0-beta.2
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 +21 -0
- package/dist/index.cjs +2250 -0
- package/dist/index.js +2118 -35
- package/dist/{Builder.d.ts → types/Builder.d.ts} +5 -5
- package/dist/{argument.d.ts → types/argument.d.ts} +3 -3
- package/dist/{common.d.ts → types/common.d.ts} +2 -2
- package/dist/{entity → types/entity}/createInputObjectType.d.ts +3 -3
- package/dist/{entity → types/entity}/entitySchema.d.ts +4 -4
- package/dist/{entity → types/entity}/updateInputObjectType.d.ts +3 -3
- package/dist/{enumType.d.ts → types/enumType.d.ts} +3 -3
- package/dist/{enumValue.d.ts → types/enumValue.d.ts} +3 -3
- package/dist/{field.d.ts → types/field.d.ts} +7 -7
- package/dist/{inputField.d.ts → types/inputField.d.ts} +3 -3
- package/dist/{inputObjectType.d.ts → types/inputObjectType.d.ts} +5 -5
- package/dist/{naming → types/naming}/common.d.ts +1 -2
- package/dist/{naming → types/naming}/compact.d.ts +1 -1
- package/dist/{naming → types/naming}/descriptive.d.ts +1 -1
- package/dist/{objectType.d.ts → types/objectType.d.ts} +4 -4
- package/dist/{plugin → types/plugin}/MultiPlugin.d.ts +14 -14
- package/dist/{plugin → types/plugin}/acl/acl.d.ts +5 -5
- package/dist/{plugin → types/plugin}/acl/middleware.d.ts +4 -4
- package/dist/{plugin → types/plugin}/common.d.ts +13 -13
- package/dist/{plugin → types/plugin}/filter/equals.d.ts +5 -5
- package/dist/{plugin → types/plugin}/filter/search.d.ts +3 -3
- package/dist/{plugin → types/plugin}/pagination/connection.d.ts +3 -3
- package/dist/{plugin → types/plugin}/pagination/firstAfter.d.ts +3 -3
- package/dist/{plugin → types/plugin}/pagination/items.d.ts +3 -3
- package/dist/{plugin → types/plugin}/pagination/offsetLimit.d.ts +3 -3
- package/dist/{plugin → types/plugin}/pagination/simple.d.ts +1 -1
- package/dist/{plugin → types/plugin}/sort/sort.d.ts +5 -5
- package/dist/{schema.d.ts → types/schema.d.ts} +9 -9
- package/dist/{unionType.d.ts → types/unionType.d.ts} +3 -3
- package/dist/{util.d.ts → types/util.d.ts} +4 -4
- package/package.json +43 -34
- package/dist/Builder.js +0 -113
- package/dist/argument.js +0 -100
- package/dist/common.js +0 -2
- package/dist/entity/createInputObjectType.js +0 -55
- package/dist/entity/entitySchema.js +0 -212
- package/dist/entity/index.js +0 -24
- package/dist/entity/updateInputObjectType.js +0 -55
- package/dist/enumType.js +0 -126
- package/dist/enumValue.js +0 -60
- package/dist/error/FrameworkError.js +0 -12
- package/dist/error/index.js +0 -18
- package/dist/error/resolver/DataError.js +0 -11
- package/dist/error/resolver/ForbiddenError.js +0 -11
- package/dist/error/resolver/InvalidInputError.js +0 -11
- package/dist/error/resolver/NotFoundError.js +0 -11
- package/dist/error/resolver/ResolverError.js +0 -11
- package/dist/error/resolver/index.js +0 -21
- package/dist/field.js +0 -193
- package/dist/inputField.js +0 -100
- package/dist/inputObjectType.js +0 -119
- package/dist/naming/common.js +0 -2
- package/dist/naming/compact.js +0 -54
- package/dist/naming/descriptive.js +0 -54
- package/dist/naming/index.js +0 -20
- package/dist/naming/util.js +0 -22
- package/dist/objectType.js +0 -140
- package/dist/plugin/MultiPlugin.js +0 -147
- package/dist/plugin/PluginError.js +0 -11
- package/dist/plugin/acl/acl.js +0 -205
- package/dist/plugin/acl/index.js +0 -18
- package/dist/plugin/acl/middleware.js +0 -48
- package/dist/plugin/common.js +0 -2
- package/dist/plugin/filter/equals.js +0 -124
- package/dist/plugin/filter/index.js +0 -18
- package/dist/plugin/filter/search.js +0 -24
- package/dist/plugin/index.js +0 -23
- package/dist/plugin/pagination/connection.js +0 -115
- package/dist/plugin/pagination/firstAfter.js +0 -19
- package/dist/plugin/pagination/index.js +0 -22
- package/dist/plugin/pagination/items.js +0 -78
- package/dist/plugin/pagination/offsetLimit.js +0 -19
- package/dist/plugin/pagination/relay.js +0 -26
- package/dist/plugin/pagination/simple.js +0 -20
- package/dist/plugin/sort/index.js +0 -22
- package/dist/plugin/sort/sort.js +0 -151
- package/dist/schema.js +0 -380
- package/dist/unionType.js +0 -75
- package/dist/util.js +0 -142
- /package/dist/{entity → types/entity}/index.d.ts +0 -0
- /package/dist/{error → types/error}/FrameworkError.d.ts +0 -0
- /package/dist/{error → types/error}/index.d.ts +0 -0
- /package/dist/{error → types/error}/resolver/DataError.d.ts +0 -0
- /package/dist/{error → types/error}/resolver/ForbiddenError.d.ts +0 -0
- /package/dist/{error → types/error}/resolver/InvalidInputError.d.ts +0 -0
- /package/dist/{error → types/error}/resolver/NotFoundError.d.ts +0 -0
- /package/dist/{error → types/error}/resolver/ResolverError.d.ts +0 -0
- /package/dist/{error → types/error}/resolver/index.d.ts +0 -0
- /package/dist/{index.d.ts → types/index.d.ts} +0 -0
- /package/dist/{naming → types/naming}/index.d.ts +0 -0
- /package/dist/{naming → types/naming}/util.d.ts +0 -0
- /package/dist/{plugin → types/plugin}/PluginError.d.ts +0 -0
- /package/dist/{plugin → types/plugin}/acl/index.d.ts +0 -0
- /package/dist/{plugin → types/plugin}/filter/index.d.ts +0 -0
- /package/dist/{plugin → types/plugin}/index.d.ts +0 -0
- /package/dist/{plugin → types/plugin}/pagination/index.d.ts +0 -0
- /package/dist/{plugin → types/plugin}/pagination/relay.d.ts +0 -0
- /package/dist/{plugin → types/plugin}/sort/index.d.ts +0 -0
|
@@ -1,78 +0,0 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.ItemsPaginationPlugin = void 0;
|
|
40
|
-
exports.itemsPaginationPlugin = itemsPaginationPlugin;
|
|
41
|
-
const objectType_1 = __importStar(require("../../objectType"));
|
|
42
|
-
const PluginError_1 = __importDefault(require("../PluginError"));
|
|
43
|
-
class ItemsPaginationPlugin {
|
|
44
|
-
beforeBuildField(builder, context, info) {
|
|
45
|
-
if (!info.list) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
const typeName = info.type.toString();
|
|
49
|
-
const targetType = context.rootSchema.findType(typeName, true);
|
|
50
|
-
if (!targetType) {
|
|
51
|
-
throw new PluginError_1.default(`Items target type "${typeName}" not found`);
|
|
52
|
-
}
|
|
53
|
-
if (!(targetType instanceof objectType_1.ObjectTypeBuilder)) {
|
|
54
|
-
throw new PluginError_1.default(`Items target "${typeName}" is not an object type`);
|
|
55
|
-
}
|
|
56
|
-
const targetObjectInfo = targetType.info();
|
|
57
|
-
const listObjectTypeName = `${typeName}List`;
|
|
58
|
-
const listObjectType = this._createListObjectType(listObjectTypeName, typeName);
|
|
59
|
-
// Adopt rules from type
|
|
60
|
-
listObjectType.allow(...Array.from(targetObjectInfo.allowedRoles));
|
|
61
|
-
listObjectType.deny(...Array.from(targetObjectInfo.deniedRoles));
|
|
62
|
-
context.schema.object(listObjectType);
|
|
63
|
-
builder
|
|
64
|
-
.type(listObjectTypeName)
|
|
65
|
-
.list(false);
|
|
66
|
-
}
|
|
67
|
-
_createListObjectType(name, typeName) {
|
|
68
|
-
return (0, objectType_1.default)(name)
|
|
69
|
-
.description(`Collection of ${typeName} nodes`)
|
|
70
|
-
.field('items', typeName, _ => _.list().nonNull().description('List of the queried nodes'))
|
|
71
|
-
.field('totalCount', 'Int', _ => _.nonNull().description('Total number of nodes'));
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
exports.ItemsPaginationPlugin = ItemsPaginationPlugin;
|
|
75
|
-
function itemsPaginationPlugin() {
|
|
76
|
-
return new ItemsPaginationPlugin();
|
|
77
|
-
}
|
|
78
|
-
exports.default = itemsPaginationPlugin;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OffsetLimitPaginationPlugin = void 0;
|
|
4
|
-
exports.offsetLimitPaginationPlugin = offsetLimitPaginationPlugin;
|
|
5
|
-
class OffsetLimitPaginationPlugin {
|
|
6
|
-
beforeBuildField(builder, context, info) {
|
|
7
|
-
if (!info.list) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
builder
|
|
11
|
-
.arg('offset', 'Int', _ => _.description('Offset for the nodes to return'))
|
|
12
|
-
.arg('limit', 'Int', _ => _.description('Number of nodes to return'));
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.OffsetLimitPaginationPlugin = OffsetLimitPaginationPlugin;
|
|
16
|
-
function offsetLimitPaginationPlugin() {
|
|
17
|
-
return new OffsetLimitPaginationPlugin();
|
|
18
|
-
}
|
|
19
|
-
exports.default = offsetLimitPaginationPlugin;
|
|
@@ -1,26 +0,0 @@
|
|
|
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.RelayPaginationPlugin = void 0;
|
|
7
|
-
exports.relayPaginationPlugin = relayPaginationPlugin;
|
|
8
|
-
const MultiPlugin_1 = __importDefault(require("../MultiPlugin"));
|
|
9
|
-
const connection_1 = require("./connection");
|
|
10
|
-
const firstAfter_1 = require("./firstAfter");
|
|
11
|
-
class RelayPaginationPlugin extends MultiPlugin_1.default {
|
|
12
|
-
getPlugins() {
|
|
13
|
-
this._firstAfterPlugin = new firstAfter_1.FirstAfterPaginationPlugin();
|
|
14
|
-
this._connectionPlugin = new connection_1.ConnectionPaginationPlugin();
|
|
15
|
-
return [this._firstAfterPlugin, this._connectionPlugin];
|
|
16
|
-
}
|
|
17
|
-
totalCount(totalCount = true) {
|
|
18
|
-
this._connectionPlugin.totalCount(totalCount);
|
|
19
|
-
return this;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
exports.RelayPaginationPlugin = RelayPaginationPlugin;
|
|
23
|
-
function relayPaginationPlugin() {
|
|
24
|
-
return new RelayPaginationPlugin();
|
|
25
|
-
}
|
|
26
|
-
exports.default = relayPaginationPlugin;
|
|
@@ -1,20 +0,0 @@
|
|
|
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.SimplePaginationPlugin = void 0;
|
|
7
|
-
exports.simplePaginationPlugin = simplePaginationPlugin;
|
|
8
|
-
const MultiPlugin_1 = __importDefault(require("../MultiPlugin"));
|
|
9
|
-
const offsetLimit_1 = require("./offsetLimit");
|
|
10
|
-
const items_1 = require("./items");
|
|
11
|
-
class SimplePaginationPlugin extends MultiPlugin_1.default {
|
|
12
|
-
getPlugins() {
|
|
13
|
-
return [new offsetLimit_1.OffsetLimitPaginationPlugin(), new items_1.ItemsPaginationPlugin()];
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
exports.SimplePaginationPlugin = SimplePaginationPlugin;
|
|
17
|
-
function simplePaginationPlugin() {
|
|
18
|
-
return new SimplePaginationPlugin();
|
|
19
|
-
}
|
|
20
|
-
exports.default = simplePaginationPlugin;
|
|
@@ -1,22 +0,0 @@
|
|
|
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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
-
};
|
|
19
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
const sort_1 = __importDefault(require("./sort"));
|
|
21
|
-
__exportStar(require("./sort"), exports);
|
|
22
|
-
exports.default = sort_1.default;
|
package/dist/plugin/sort/sort.js
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
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.SortPlugin = exports.defaultSortPluginOptions = exports.SortDirection = void 0;
|
|
7
|
-
exports.sortPlugin = sortPlugin;
|
|
8
|
-
const lodash_1 = require("lodash");
|
|
9
|
-
const inputObjectType_1 = __importDefault(require("../../inputObjectType"));
|
|
10
|
-
const enumType_1 = __importDefault(require("../../enumType"));
|
|
11
|
-
const objectType_1 = require("../../objectType");
|
|
12
|
-
const util_1 = require("../../util");
|
|
13
|
-
const PluginError_1 = __importDefault(require("../PluginError"));
|
|
14
|
-
var SortDirection;
|
|
15
|
-
(function (SortDirection) {
|
|
16
|
-
SortDirection["ASC"] = "ASC";
|
|
17
|
-
SortDirection["DESC"] = "DESC";
|
|
18
|
-
})(SortDirection || (exports.SortDirection = SortDirection = {}));
|
|
19
|
-
exports.defaultSortPluginOptions = {
|
|
20
|
-
multi: false,
|
|
21
|
-
directionEnumName: 'SortDirection',
|
|
22
|
-
argumentName: 'sort',
|
|
23
|
-
inputName: typeName => `${typeName}SortConfiguration`,
|
|
24
|
-
fieldEnumName: typeName => `${typeName}SortField`
|
|
25
|
-
};
|
|
26
|
-
class SortPlugin {
|
|
27
|
-
constructor(options) {
|
|
28
|
-
this._options = (0, lodash_1.defaults)(options || {}, exports.defaultSortPluginOptions, {
|
|
29
|
-
exclude: [],
|
|
30
|
-
include: []
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
multi(multi = true) {
|
|
34
|
-
this._options.multi = multi;
|
|
35
|
-
return this;
|
|
36
|
-
}
|
|
37
|
-
field(...fieldNames) {
|
|
38
|
-
if (!this._options.fields) {
|
|
39
|
-
this._options.fields = [];
|
|
40
|
-
}
|
|
41
|
-
fieldNames.forEach(name => this._options.fields.push(name));
|
|
42
|
-
return this;
|
|
43
|
-
}
|
|
44
|
-
exclude(...fieldNames) {
|
|
45
|
-
fieldNames.forEach(name => this._options.exclude.push(name));
|
|
46
|
-
return this;
|
|
47
|
-
}
|
|
48
|
-
include(...fieldNames) {
|
|
49
|
-
fieldNames.forEach(name => this._options.include.push(name));
|
|
50
|
-
return this;
|
|
51
|
-
}
|
|
52
|
-
directionEnumName(name) {
|
|
53
|
-
this._options.directionEnumName = name;
|
|
54
|
-
return this;
|
|
55
|
-
}
|
|
56
|
-
argumentName(name) {
|
|
57
|
-
this._options.argumentName = name;
|
|
58
|
-
return this;
|
|
59
|
-
}
|
|
60
|
-
inputName(nameFactory) {
|
|
61
|
-
this._options.inputName = nameFactory;
|
|
62
|
-
return this;
|
|
63
|
-
}
|
|
64
|
-
fieldEnumName(nameFactory) {
|
|
65
|
-
this._options.fieldEnumName = nameFactory;
|
|
66
|
-
return this;
|
|
67
|
-
}
|
|
68
|
-
beforeBuildField(builder, context, info) {
|
|
69
|
-
if (!info.list) {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
if (!context.schema.hasType(this._options.directionEnumName)) {
|
|
73
|
-
context.schema.enum(this._createSortDirectionEnum());
|
|
74
|
-
}
|
|
75
|
-
const typeName = info.type.toString();
|
|
76
|
-
const inputTypeName = this._options.inputName(typeName);
|
|
77
|
-
const fieldEnumName = this._options.fieldEnumName(typeName);
|
|
78
|
-
let targetObjectType;
|
|
79
|
-
if (!this._options.fields) {
|
|
80
|
-
targetObjectType = context.rootSchema.findType(typeName, true);
|
|
81
|
-
if (!targetObjectType) {
|
|
82
|
-
throw new PluginError_1.default(`Sort target object "${typeName}" not found`);
|
|
83
|
-
}
|
|
84
|
-
if (!(targetObjectType instanceof objectType_1.ObjectTypeBuilder)) {
|
|
85
|
-
throw new PluginError_1.default(`Sort target "${typeName}" is not an object type`);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
const enumType = this._createSortFieldEnum(context, fieldEnumName, typeName, targetObjectType);
|
|
89
|
-
context.schema.enum(enumType);
|
|
90
|
-
const inputType = this._createSortInputType(inputTypeName, fieldEnumName);
|
|
91
|
-
context.schema.inputObject(inputType);
|
|
92
|
-
builder.arg(this._options.argumentName, inputTypeName, _ => {
|
|
93
|
-
if (this._options.multi) {
|
|
94
|
-
_.list().description('Collection of sort configurations');
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
_.description('Sort configuration');
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
_createSortInputType(name, enumName) {
|
|
102
|
-
return (0, inputObjectType_1.default)(name)
|
|
103
|
-
.description(`Configuration for how the nodes should be sorted`)
|
|
104
|
-
.field('field', enumName, _ => _.nonNull().description('Field to sort on'))
|
|
105
|
-
.field('direction', this._options.directionEnumName, _ => _.nonNull().description('Direction to sort'));
|
|
106
|
-
}
|
|
107
|
-
_createSortFieldEnum(context, name, typeName, targetObjectType) {
|
|
108
|
-
const enumBuilder = (0, enumType_1.default)(name)
|
|
109
|
-
.description(`Field to sort ${typeName} on`);
|
|
110
|
-
let fields = new Set();
|
|
111
|
-
if (targetObjectType) {
|
|
112
|
-
for (let field of targetObjectType.info().fields) {
|
|
113
|
-
const fieldInfo = field.info();
|
|
114
|
-
if (!fieldInfo.list && (0, util_1.isTypeInput)(fieldInfo.type, context.rootSchema)) {
|
|
115
|
-
fields.add(field.name);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
else if (this._options.fields) {
|
|
120
|
-
this._options.fields.forEach(field => fields.add(field));
|
|
121
|
-
}
|
|
122
|
-
if (this._options.include) {
|
|
123
|
-
this._options.include.forEach(field => fields.add(field));
|
|
124
|
-
}
|
|
125
|
-
const extraValues = this._getExtraEnumValues(context, name, typeName, targetObjectType);
|
|
126
|
-
if (extraValues) {
|
|
127
|
-
extraValues.forEach(extraField => fields.add(extraField));
|
|
128
|
-
}
|
|
129
|
-
for (let field of fields) {
|
|
130
|
-
if (this._options.exclude && this._options.exclude.indexOf(field) >= 0) {
|
|
131
|
-
continue;
|
|
132
|
-
}
|
|
133
|
-
enumBuilder.value(field, field);
|
|
134
|
-
}
|
|
135
|
-
return enumBuilder;
|
|
136
|
-
}
|
|
137
|
-
_createSortDirectionEnum() {
|
|
138
|
-
return (0, enumType_1.default)(this._options.directionEnumName)
|
|
139
|
-
.description('Direction to sort')
|
|
140
|
-
.value(SortDirection.ASC, SortDirection.ASC, _ => _.description('Sort ascending'))
|
|
141
|
-
.value(SortDirection.DESC, SortDirection.DESC, _ => _.description('Sort descending'));
|
|
142
|
-
}
|
|
143
|
-
_getExtraEnumValues(context, name, typeName, targetObjectType) {
|
|
144
|
-
return null;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
exports.SortPlugin = SortPlugin;
|
|
148
|
-
function sortPlugin(options) {
|
|
149
|
-
return new SortPlugin(options);
|
|
150
|
-
}
|
|
151
|
-
exports.default = sortPlugin;
|