@kiwano/core 2.0.0 → 2.0.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/dist/Builder.js +2 -2
- package/dist/argument.js +2 -2
- package/dist/entity/createInputObjectType.d.ts +2 -0
- package/dist/entity/createInputObjectType.js +11 -3
- package/dist/entity/entitySchema.js +2 -2
- package/dist/entity/updateInputObjectType.d.ts +2 -0
- package/dist/entity/updateInputObjectType.js +11 -3
- package/dist/enumType.js +2 -2
- package/dist/enumValue.js +2 -2
- package/dist/field.js +3 -3
- package/dist/inputField.js +2 -2
- package/dist/inputObjectType.js +2 -2
- package/dist/naming/compact.js +2 -2
- package/dist/naming/descriptive.js +2 -2
- package/dist/naming/util.js +3 -3
- package/dist/objectType.js +4 -3
- package/dist/plugin/acl/acl.js +2 -2
- package/dist/plugin/acl/middleware.js +4 -4
- package/dist/plugin/filter/equals.d.ts +2 -2
- package/dist/plugin/filter/equals.js +14 -12
- package/dist/plugin/filter/search.js +2 -2
- package/dist/plugin/pagination/connection.js +2 -2
- package/dist/plugin/pagination/firstAfter.js +2 -2
- package/dist/plugin/pagination/items.js +2 -2
- package/dist/plugin/pagination/offsetLimit.js +2 -2
- package/dist/plugin/pagination/relay.js +2 -2
- package/dist/plugin/pagination/simple.js +2 -2
- package/dist/plugin/sort/sort.js +2 -2
- package/dist/schema.js +2 -2
- package/dist/unionType.js +2 -2
- package/dist/util.d.ts +4 -0
- package/dist/util.js +17 -10
- package/package.json +1 -1
package/dist/Builder.js
CHANGED
|
@@ -3,8 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.FinalizeContext = exports.BuildContext = exports.BuilderError = void 0;
|
|
7
|
-
exports.resolveName = resolveName;
|
|
6
|
+
exports.resolveName = exports.FinalizeContext = exports.BuildContext = exports.BuilderError = void 0;
|
|
8
7
|
const lodash_1 = require("lodash");
|
|
9
8
|
const graphql_1 = require("graphql");
|
|
10
9
|
const FrameworkError_1 = __importDefault(require("./error/FrameworkError"));
|
|
@@ -111,3 +110,4 @@ exports.FinalizeContext = FinalizeContext;
|
|
|
111
110
|
function resolveName(name) {
|
|
112
111
|
return (0, lodash_1.isFunction)(name) ? name() : name;
|
|
113
112
|
}
|
|
113
|
+
exports.resolveName = resolveName;
|
package/dist/argument.js
CHANGED
|
@@ -3,8 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ArgumentBuilder = void 0;
|
|
7
|
-
exports.argument = argument;
|
|
6
|
+
exports.argument = exports.ArgumentBuilder = void 0;
|
|
8
7
|
const lodash_1 = require("lodash");
|
|
9
8
|
const graphql_1 = require("graphql");
|
|
10
9
|
const Builder_1 = __importDefault(require("./Builder"));
|
|
@@ -97,4 +96,5 @@ exports.ArgumentBuilder = ArgumentBuilder;
|
|
|
97
96
|
function argument(name, type) {
|
|
98
97
|
return new ArgumentBuilder(name, type);
|
|
99
98
|
}
|
|
99
|
+
exports.argument = argument;
|
|
100
100
|
exports.default = argument;
|
|
@@ -4,8 +4,10 @@ import { EntityType } from "./entitySchema";
|
|
|
4
4
|
export declare class CreateInputObjectTypeBuilder extends InputObjectTypeBuilder {
|
|
5
5
|
protected _entityObjectType: EntityType;
|
|
6
6
|
protected _exclude: Set<string>;
|
|
7
|
+
protected _include: Set<string>;
|
|
7
8
|
constructor(name: BuilderName, entityType: EntityType);
|
|
8
9
|
exclude(...fieldNames: string[]): this;
|
|
10
|
+
include(...fieldNames: string[]): this;
|
|
9
11
|
finalizeInputObjectType(context: FinalizeContext, info: InputObjectTypeBuilderInfo): Promise<any>;
|
|
10
12
|
}
|
|
11
13
|
export declare function createInputObjectType(name: BuilderName, entityType: EntityType): CreateInputObjectTypeBuilder;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CreateInputObjectTypeBuilder = void 0;
|
|
4
|
-
exports.createInputObjectType = createInputObjectType;
|
|
3
|
+
exports.createInputObjectType = exports.CreateInputObjectTypeBuilder = void 0;
|
|
5
4
|
const inputObjectType_1 = require("../inputObjectType");
|
|
6
5
|
const objectType_1 = require("../objectType");
|
|
7
6
|
const inputField_1 = require("../inputField");
|
|
@@ -10,12 +9,17 @@ class CreateInputObjectTypeBuilder extends inputObjectType_1.InputObjectTypeBuil
|
|
|
10
9
|
constructor(name, entityType) {
|
|
11
10
|
super(name);
|
|
12
11
|
this._exclude = new Set();
|
|
12
|
+
this._include = new Set();
|
|
13
13
|
this._entityObjectType = entityType;
|
|
14
14
|
}
|
|
15
15
|
exclude(...fieldNames) {
|
|
16
16
|
fieldNames.forEach(name => this._exclude.add(name));
|
|
17
17
|
return this;
|
|
18
18
|
}
|
|
19
|
+
include(...fieldNames) {
|
|
20
|
+
fieldNames.forEach(name => this._include.add(name));
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
19
23
|
async finalizeInputObjectType(context, info) {
|
|
20
24
|
await super.finalizeInputObjectType(context, info);
|
|
21
25
|
const entity = this._entityObjectType instanceof objectType_1.ObjectTypeBuilder ? this._entityObjectType : this._entityObjectType();
|
|
@@ -23,7 +27,10 @@ class CreateInputObjectTypeBuilder extends inputObjectType_1.InputObjectTypeBuil
|
|
|
23
27
|
const existingFieldNames = info.fields.map(field => field.name);
|
|
24
28
|
for (let field of entityInfo.fields) {
|
|
25
29
|
const fieldInfo = field.info();
|
|
26
|
-
if (
|
|
30
|
+
if (!(0, util_1.isTypeInput)(fieldInfo.type, context.rootSchema) || (0, util_1.isFieldId)(fieldInfo) || existingFieldNames.indexOf(fieldInfo.name) >= 0) {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
if (this._exclude.has(fieldInfo.name) || (this._include.size > 0 && !this._include.has(fieldInfo.name))) {
|
|
27
34
|
continue;
|
|
28
35
|
}
|
|
29
36
|
const inputField = new inputField_1.InputFieldBuilder(fieldInfo.name, fieldInfo.type);
|
|
@@ -44,4 +51,5 @@ exports.CreateInputObjectTypeBuilder = CreateInputObjectTypeBuilder;
|
|
|
44
51
|
function createInputObjectType(name, entityType) {
|
|
45
52
|
return new CreateInputObjectTypeBuilder(name, entityType);
|
|
46
53
|
}
|
|
54
|
+
exports.createInputObjectType = createInputObjectType;
|
|
47
55
|
exports.default = createInputObjectType;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EntitySchemaBuilder = exports.AbstractEntitySchemaBuilder = exports.AbstractEntitySchemaBuilderBase = exports.entityFieldTypeExtensionName = exports.EntityFieldType = void 0;
|
|
4
|
-
exports.entitySchema = entitySchema;
|
|
3
|
+
exports.entitySchema = exports.EntitySchemaBuilder = exports.AbstractEntitySchemaBuilder = exports.AbstractEntitySchemaBuilderBase = exports.entityFieldTypeExtensionName = exports.EntityFieldType = void 0;
|
|
5
4
|
const objectType_1 = require("../objectType");
|
|
6
5
|
const field_1 = require("../field");
|
|
7
6
|
const naming_1 = require("../naming");
|
|
@@ -209,4 +208,5 @@ EntitySchemaBuilder.defaultNamingStrategy = (0, naming_1.compactNamingStrategy)(
|
|
|
209
208
|
function entitySchema(name) {
|
|
210
209
|
return new EntitySchemaBuilder(name);
|
|
211
210
|
}
|
|
211
|
+
exports.entitySchema = entitySchema;
|
|
212
212
|
exports.default = entitySchema;
|
|
@@ -4,8 +4,10 @@ import { EntityType } from "./entitySchema";
|
|
|
4
4
|
export declare class UpdateInputObjectTypeBuilder extends InputObjectTypeBuilder {
|
|
5
5
|
protected _entityObjectType: EntityType;
|
|
6
6
|
protected _exclude: Set<string>;
|
|
7
|
+
protected _include: Set<string>;
|
|
7
8
|
constructor(name: BuilderName, entityType: EntityType);
|
|
8
9
|
exclude(...fieldNames: string[]): this;
|
|
10
|
+
include(...fieldNames: string[]): this;
|
|
9
11
|
finalizeInputObjectType(context: FinalizeContext, info: InputObjectTypeBuilderInfo): Promise<any>;
|
|
10
12
|
}
|
|
11
13
|
export declare function updateInputObjectType(name: BuilderName, entityType: EntityType): UpdateInputObjectTypeBuilder;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UpdateInputObjectTypeBuilder = void 0;
|
|
4
|
-
exports.updateInputObjectType = updateInputObjectType;
|
|
3
|
+
exports.updateInputObjectType = exports.UpdateInputObjectTypeBuilder = void 0;
|
|
5
4
|
const inputObjectType_1 = require("../inputObjectType");
|
|
6
5
|
const objectType_1 = require("../objectType");
|
|
7
6
|
const inputField_1 = require("../inputField");
|
|
@@ -10,12 +9,17 @@ class UpdateInputObjectTypeBuilder extends inputObjectType_1.InputObjectTypeBuil
|
|
|
10
9
|
constructor(name, entityType) {
|
|
11
10
|
super(name);
|
|
12
11
|
this._exclude = new Set();
|
|
12
|
+
this._include = new Set();
|
|
13
13
|
this._entityObjectType = entityType;
|
|
14
14
|
}
|
|
15
15
|
exclude(...fieldNames) {
|
|
16
16
|
fieldNames.forEach(name => this._exclude.add(name));
|
|
17
17
|
return this;
|
|
18
18
|
}
|
|
19
|
+
include(...fieldNames) {
|
|
20
|
+
fieldNames.forEach(name => this._include.add(name));
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
19
23
|
async finalizeInputObjectType(context, info) {
|
|
20
24
|
await super.finalizeInputObjectType(context, info);
|
|
21
25
|
const entity = this._entityObjectType instanceof objectType_1.ObjectTypeBuilder ? this._entityObjectType : this._entityObjectType();
|
|
@@ -23,7 +27,10 @@ class UpdateInputObjectTypeBuilder extends inputObjectType_1.InputObjectTypeBuil
|
|
|
23
27
|
const existingFieldNames = info.fields.map(field => field.name);
|
|
24
28
|
for (let field of entityInfo.fields) {
|
|
25
29
|
const fieldInfo = field.info();
|
|
26
|
-
if (
|
|
30
|
+
if (!(0, util_1.isTypeInput)(fieldInfo.type, context.rootSchema) || existingFieldNames.indexOf(fieldInfo.name) >= 0) {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
if (this._exclude.has(fieldInfo.name) || (this._include.size > 0 && !this._include.has(fieldInfo.name))) {
|
|
27
34
|
continue;
|
|
28
35
|
}
|
|
29
36
|
const inputField = new inputField_1.InputFieldBuilder(fieldInfo.name, fieldInfo.type);
|
|
@@ -44,4 +51,5 @@ exports.UpdateInputObjectTypeBuilder = UpdateInputObjectTypeBuilder;
|
|
|
44
51
|
function updateInputObjectType(name, entityType) {
|
|
45
52
|
return new UpdateInputObjectTypeBuilder(name, entityType);
|
|
46
53
|
}
|
|
54
|
+
exports.updateInputObjectType = updateInputObjectType;
|
|
47
55
|
exports.default = updateInputObjectType;
|
package/dist/enumType.js
CHANGED
|
@@ -23,8 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.EnumTypeBuilder = void 0;
|
|
27
|
-
exports.enumType = enumType;
|
|
26
|
+
exports.enumType = exports.EnumTypeBuilder = void 0;
|
|
28
27
|
const lodash_1 = require("lodash");
|
|
29
28
|
const definition_1 = require("graphql/type/definition");
|
|
30
29
|
const Builder_1 = __importStar(require("./Builder"));
|
|
@@ -113,4 +112,5 @@ exports.EnumTypeBuilder = EnumTypeBuilder;
|
|
|
113
112
|
function enumType(name, valuesObject = null) {
|
|
114
113
|
return new EnumTypeBuilder(name, valuesObject);
|
|
115
114
|
}
|
|
115
|
+
exports.enumType = enumType;
|
|
116
116
|
exports.default = enumType;
|
package/dist/enumValue.js
CHANGED
|
@@ -3,8 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.EnumValueBuilder = void 0;
|
|
7
|
-
exports.enumValue = enumValue;
|
|
6
|
+
exports.enumValue = exports.EnumValueBuilder = void 0;
|
|
8
7
|
const lodash_1 = require("lodash");
|
|
9
8
|
const Builder_1 = __importDefault(require("./Builder"));
|
|
10
9
|
class EnumValueBuilder extends Builder_1.default {
|
|
@@ -57,4 +56,5 @@ exports.EnumValueBuilder = EnumValueBuilder;
|
|
|
57
56
|
function enumValue(name, value = null) {
|
|
58
57
|
return new EnumValueBuilder(name, value);
|
|
59
58
|
}
|
|
59
|
+
exports.enumValue = enumValue;
|
|
60
60
|
exports.default = enumValue;
|
package/dist/field.js
CHANGED
|
@@ -23,8 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.FieldBuilder = void 0;
|
|
27
|
-
exports.field = field;
|
|
26
|
+
exports.field = exports.FieldBuilder = void 0;
|
|
28
27
|
const lodash_1 = require("lodash");
|
|
29
28
|
const graphql_1 = require("graphql");
|
|
30
29
|
const argument_1 = require("./argument");
|
|
@@ -147,7 +146,7 @@ class FieldBuilder extends Builder_1.default {
|
|
|
147
146
|
type,
|
|
148
147
|
description: this._description,
|
|
149
148
|
args: builtArgs,
|
|
150
|
-
extensions: Object.assign({
|
|
149
|
+
extensions: Object.assign(Object.assign({}, (0, util_1.getAclExtension)(this._allowedRoles, this._deniedRoles)), Object.fromEntries(this._extensions)),
|
|
151
150
|
resolve: resolver
|
|
152
151
|
};
|
|
153
152
|
this._executePluginsSync('afterBuildField', plugin => plugin.afterBuildField(this, context, info, field));
|
|
@@ -174,4 +173,5 @@ exports.FieldBuilder = FieldBuilder;
|
|
|
174
173
|
function field(name, type = null) {
|
|
175
174
|
return new FieldBuilder(name, type);
|
|
176
175
|
}
|
|
176
|
+
exports.field = field;
|
|
177
177
|
exports.default = field;
|
package/dist/inputField.js
CHANGED
|
@@ -3,8 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.InputFieldBuilder = void 0;
|
|
7
|
-
exports.inputField = inputField;
|
|
6
|
+
exports.inputField = exports.InputFieldBuilder = void 0;
|
|
8
7
|
const lodash_1 = require("lodash");
|
|
9
8
|
const graphql_1 = require("graphql");
|
|
10
9
|
const Builder_1 = __importDefault(require("./Builder"));
|
|
@@ -97,4 +96,5 @@ exports.InputFieldBuilder = InputFieldBuilder;
|
|
|
97
96
|
function inputField(name, type) {
|
|
98
97
|
return new InputFieldBuilder(name, type);
|
|
99
98
|
}
|
|
99
|
+
exports.inputField = inputField;
|
|
100
100
|
exports.default = inputField;
|
package/dist/inputObjectType.js
CHANGED
|
@@ -23,8 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.InputObjectTypeBuilder = void 0;
|
|
27
|
-
exports.inputObjectType = inputObjectType;
|
|
26
|
+
exports.inputObjectType = exports.InputObjectTypeBuilder = void 0;
|
|
28
27
|
const lodash_1 = require("lodash");
|
|
29
28
|
const graphql_1 = require("graphql");
|
|
30
29
|
const inputField_1 = require("./inputField");
|
|
@@ -106,4 +105,5 @@ exports.InputObjectTypeBuilder = InputObjectTypeBuilder;
|
|
|
106
105
|
function inputObjectType(name) {
|
|
107
106
|
return new InputObjectTypeBuilder(name);
|
|
108
107
|
}
|
|
108
|
+
exports.inputObjectType = inputObjectType;
|
|
109
109
|
exports.default = inputObjectType;
|
package/dist/naming/compact.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CompactNamingStrategy = void 0;
|
|
4
|
-
exports.compactNamingStrategy = compactNamingStrategy;
|
|
3
|
+
exports.compactNamingStrategy = exports.CompactNamingStrategy = void 0;
|
|
5
4
|
const util_1 = require("./util");
|
|
6
5
|
class CompactNamingStrategy {
|
|
7
6
|
entityObject(schemaName) {
|
|
@@ -51,4 +50,5 @@ exports.CompactNamingStrategy = CompactNamingStrategy;
|
|
|
51
50
|
function compactNamingStrategy() {
|
|
52
51
|
return new CompactNamingStrategy();
|
|
53
52
|
}
|
|
53
|
+
exports.compactNamingStrategy = compactNamingStrategy;
|
|
54
54
|
exports.default = compactNamingStrategy;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DescriptiveNamingStrategy = void 0;
|
|
4
|
-
exports.descriptiveNamingStrategy = descriptiveNamingStrategy;
|
|
3
|
+
exports.descriptiveNamingStrategy = exports.DescriptiveNamingStrategy = void 0;
|
|
5
4
|
const util_1 = require("./util");
|
|
6
5
|
class DescriptiveNamingStrategy {
|
|
7
6
|
entityObject(schemaName) {
|
|
@@ -51,4 +50,5 @@ exports.DescriptiveNamingStrategy = DescriptiveNamingStrategy;
|
|
|
51
50
|
function descriptiveNamingStrategy() {
|
|
52
51
|
return new DescriptiveNamingStrategy();
|
|
53
52
|
}
|
|
53
|
+
exports.descriptiveNamingStrategy = descriptiveNamingStrategy;
|
|
54
54
|
exports.default = descriptiveNamingStrategy;
|
package/dist/naming/util.js
CHANGED
|
@@ -3,9 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.pluralize = void 0;
|
|
7
|
-
exports.ucFirst = ucFirst;
|
|
8
|
-
exports.lcFirst = lcFirst;
|
|
6
|
+
exports.pluralize = exports.lcFirst = exports.ucFirst = void 0;
|
|
9
7
|
const pluralize_1 = __importDefault(require("pluralize"));
|
|
10
8
|
exports.pluralize = pluralize_1.default;
|
|
11
9
|
function ucFirst(input) {
|
|
@@ -14,9 +12,11 @@ function ucFirst(input) {
|
|
|
14
12
|
}
|
|
15
13
|
return input.charAt(0).toUpperCase() + input.slice(1);
|
|
16
14
|
}
|
|
15
|
+
exports.ucFirst = ucFirst;
|
|
17
16
|
function lcFirst(input) {
|
|
18
17
|
if (input === null || input.length === 0) {
|
|
19
18
|
return null;
|
|
20
19
|
}
|
|
21
20
|
return input.charAt(0).toLowerCase() + input.slice(1);
|
|
22
21
|
}
|
|
22
|
+
exports.lcFirst = lcFirst;
|
package/dist/objectType.js
CHANGED
|
@@ -23,12 +23,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.ObjectTypeBuilder = void 0;
|
|
27
|
-
exports.objectType = objectType;
|
|
26
|
+
exports.objectType = exports.ObjectTypeBuilder = void 0;
|
|
28
27
|
const lodash_1 = require("lodash");
|
|
29
28
|
const graphql_1 = require("graphql");
|
|
30
29
|
const field_1 = require("./field");
|
|
31
30
|
const Builder_1 = __importStar(require("./Builder"));
|
|
31
|
+
const util_1 = require("./util");
|
|
32
32
|
class ObjectTypeBuilder extends Builder_1.default {
|
|
33
33
|
constructor() {
|
|
34
34
|
super(...arguments);
|
|
@@ -97,7 +97,7 @@ class ObjectTypeBuilder extends Builder_1.default {
|
|
|
97
97
|
const objectType = new graphql_1.GraphQLObjectType({
|
|
98
98
|
name: this.name,
|
|
99
99
|
description: this._description,
|
|
100
|
-
extensions: Object.assign({
|
|
100
|
+
extensions: Object.assign(Object.assign({}, (0, util_1.getAclExtension)(this._allowedRoles, this._deniedRoles)), Object.fromEntries(this._extensions)),
|
|
101
101
|
fields: () => {
|
|
102
102
|
let builtFields = {};
|
|
103
103
|
for (let field of this._fields) {
|
|
@@ -126,4 +126,5 @@ exports.ObjectTypeBuilder = ObjectTypeBuilder;
|
|
|
126
126
|
function objectType(name) {
|
|
127
127
|
return new ObjectTypeBuilder(name);
|
|
128
128
|
}
|
|
129
|
+
exports.objectType = objectType;
|
|
129
130
|
exports.default = objectType;
|
package/dist/plugin/acl/acl.js
CHANGED
|
@@ -3,8 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.AclPlugin = exports.defaultAclOptions = exports.AclAction = void 0;
|
|
7
|
-
exports.aclPlugin = aclPlugin;
|
|
6
|
+
exports.aclPlugin = exports.AclPlugin = exports.defaultAclOptions = exports.AclAction = void 0;
|
|
8
7
|
const lodash_1 = require("lodash");
|
|
9
8
|
const middleware_1 = require("./middleware");
|
|
10
9
|
const FrameworkError_1 = __importDefault(require("../../error/FrameworkError"));
|
|
@@ -202,4 +201,5 @@ exports.AclPlugin = AclPlugin;
|
|
|
202
201
|
function aclPlugin(options) {
|
|
203
202
|
return new AclPlugin(options);
|
|
204
203
|
}
|
|
204
|
+
exports.aclPlugin = aclPlugin;
|
|
205
205
|
exports.default = aclPlugin;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultAclMiddlewareOptions = void 0;
|
|
4
|
-
exports.expressAclMiddleware = expressAclMiddleware;
|
|
5
|
-
exports.graphQLAclMiddleware = graphQLAclMiddleware;
|
|
6
|
-
exports.getPathResource = getPathResource;
|
|
3
|
+
exports.getPathResource = exports.graphQLAclMiddleware = exports.expressAclMiddleware = exports.defaultAclMiddlewareOptions = void 0;
|
|
7
4
|
const lodash_1 = require("lodash");
|
|
8
5
|
const resolver_1 = require("../../error/resolver");
|
|
9
6
|
exports.defaultAclMiddlewareOptions = {
|
|
@@ -26,6 +23,7 @@ function expressAclMiddleware(acl, config = null, options = null) {
|
|
|
26
23
|
next();
|
|
27
24
|
};
|
|
28
25
|
}
|
|
26
|
+
exports.expressAclMiddleware = expressAclMiddleware;
|
|
29
27
|
function graphQLAclMiddleware(acl, schemaName, options = null) {
|
|
30
28
|
const fullOptions = getOptions(options);
|
|
31
29
|
return (resolve, root, args, context, info) => {
|
|
@@ -40,9 +38,11 @@ function graphQLAclMiddleware(acl, schemaName, options = null) {
|
|
|
40
38
|
return resolve(root, args, context, info);
|
|
41
39
|
};
|
|
42
40
|
}
|
|
41
|
+
exports.graphQLAclMiddleware = graphQLAclMiddleware;
|
|
43
42
|
function getPathResource(path) {
|
|
44
43
|
return [path.typename, path.key].join('.');
|
|
45
44
|
}
|
|
45
|
+
exports.getPathResource = getPathResource;
|
|
46
46
|
function getOptions(options) {
|
|
47
47
|
return (0, lodash_1.defaults)({}, options || {}, exports.defaultAclMiddlewareOptions);
|
|
48
48
|
}
|
|
@@ -8,7 +8,7 @@ export interface EqualsFilterPluginOptions {
|
|
|
8
8
|
multi?: boolean;
|
|
9
9
|
fields?: EqualsFilterPluginFieldConfig[];
|
|
10
10
|
exclude?: string[];
|
|
11
|
-
include?:
|
|
11
|
+
include?: string[];
|
|
12
12
|
argumentName?: string;
|
|
13
13
|
inputName?: (typeName: string) => string;
|
|
14
14
|
}
|
|
@@ -24,7 +24,7 @@ export declare class EqualsFilterPlugin implements Plugin {
|
|
|
24
24
|
multi(multi: boolean): this;
|
|
25
25
|
field(name: string, type: InputFieldType): this;
|
|
26
26
|
exclude(...fieldNames: string[]): this;
|
|
27
|
-
include(
|
|
27
|
+
include(...fieldNames: string[]): this;
|
|
28
28
|
argumentName(name: string): this;
|
|
29
29
|
inputName(nameFactory: (typeName: string) => string): this;
|
|
30
30
|
beforeBuildField(builder: FieldBuilder, context: BuildContext, info: FieldBuilderInfo): void;
|
|
@@ -3,8 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.EqualsFilterPlugin = exports.defaultEqualsFilterPluginOptions = void 0;
|
|
7
|
-
exports.equalsFilterPlugin = equalsFilterPlugin;
|
|
6
|
+
exports.equalsFilterPlugin = exports.EqualsFilterPlugin = exports.defaultEqualsFilterPluginOptions = void 0;
|
|
8
7
|
const lodash_1 = require("lodash");
|
|
9
8
|
const inputObjectType_1 = __importDefault(require("../../inputObjectType"));
|
|
10
9
|
const objectType_1 = require("../../objectType");
|
|
@@ -37,8 +36,8 @@ class EqualsFilterPlugin {
|
|
|
37
36
|
fieldNames.forEach(name => this._options.exclude.push(name));
|
|
38
37
|
return this;
|
|
39
38
|
}
|
|
40
|
-
include(
|
|
41
|
-
this._options.include.push(
|
|
39
|
+
include(...fieldNames) {
|
|
40
|
+
fieldNames.forEach(name => this._options.include.push(name));
|
|
42
41
|
return this;
|
|
43
42
|
}
|
|
44
43
|
argumentName(name) {
|
|
@@ -70,26 +69,28 @@ class EqualsFilterPlugin {
|
|
|
70
69
|
builder.arg(this._options.argumentName, inputTypeName, _ => _.description(`Configuration for how the nodes should be filtered`));
|
|
71
70
|
}
|
|
72
71
|
_createFilterInputType(context, name, targetObjectType) {
|
|
72
|
+
var _a;
|
|
73
73
|
const inputObjectType = (0, inputObjectType_1.default)(name)
|
|
74
74
|
.description(`Configuration for how the nodes should be filtered`);
|
|
75
75
|
let fields = new Set();
|
|
76
76
|
if (targetObjectType) {
|
|
77
77
|
for (let field of targetObjectType.info().fields) {
|
|
78
78
|
const fieldInfo = field.info();
|
|
79
|
-
if (
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
79
|
+
if (fieldInfo.list || !(0, util_1.isTypeInput)(fieldInfo.type, context.rootSchema)) {
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
if (((_a = this._options.include) === null || _a === void 0 ? void 0 : _a.length) && !this._options.include.includes(field.name)) {
|
|
83
|
+
continue;
|
|
84
84
|
}
|
|
85
|
+
fields.add({
|
|
86
|
+
name: field.name,
|
|
87
|
+
type: fieldInfo.type
|
|
88
|
+
});
|
|
85
89
|
}
|
|
86
90
|
}
|
|
87
91
|
else if (this._options.fields) {
|
|
88
92
|
this._options.fields.forEach(field => fields.add(field));
|
|
89
93
|
}
|
|
90
|
-
if (this._options.include) {
|
|
91
|
-
this._options.include.forEach(field => fields.add(field));
|
|
92
|
-
}
|
|
93
94
|
const extraFields = this._getExtraFieldConfigs(context, name, targetObjectType);
|
|
94
95
|
if (extraFields) {
|
|
95
96
|
extraFields.forEach(extraField => fields.add(extraField));
|
|
@@ -114,4 +115,5 @@ exports.EqualsFilterPlugin = EqualsFilterPlugin;
|
|
|
114
115
|
function equalsFilterPlugin(options) {
|
|
115
116
|
return new EqualsFilterPlugin(options);
|
|
116
117
|
}
|
|
118
|
+
exports.equalsFilterPlugin = equalsFilterPlugin;
|
|
117
119
|
exports.default = equalsFilterPlugin;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SearchFilterPlugin = exports.defaultSearchFilterPluginOptions = void 0;
|
|
4
|
-
exports.searchFilterPlugin = searchFilterPlugin;
|
|
3
|
+
exports.searchFilterPlugin = exports.SearchFilterPlugin = exports.defaultSearchFilterPluginOptions = void 0;
|
|
5
4
|
const lodash_1 = require("lodash");
|
|
6
5
|
exports.defaultSearchFilterPluginOptions = {
|
|
7
6
|
argumentName: 'search'
|
|
@@ -21,4 +20,5 @@ exports.SearchFilterPlugin = SearchFilterPlugin;
|
|
|
21
20
|
function searchFilterPlugin() {
|
|
22
21
|
return new SearchFilterPlugin();
|
|
23
22
|
}
|
|
23
|
+
exports.searchFilterPlugin = searchFilterPlugin;
|
|
24
24
|
exports.default = searchFilterPlugin;
|
|
@@ -26,8 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.ConnectionPaginationPlugin = void 0;
|
|
30
|
-
exports.connectionPaginationPlugin = connectionPaginationPlugin;
|
|
29
|
+
exports.connectionPaginationPlugin = exports.ConnectionPaginationPlugin = void 0;
|
|
31
30
|
const objectType_1 = __importStar(require("../../objectType"));
|
|
32
31
|
const PluginError_1 = __importDefault(require("../PluginError"));
|
|
33
32
|
const PageInfoObjectTypeName = "PageInfo";
|
|
@@ -102,4 +101,5 @@ exports.ConnectionPaginationPlugin = ConnectionPaginationPlugin;
|
|
|
102
101
|
function connectionPaginationPlugin() {
|
|
103
102
|
return new ConnectionPaginationPlugin();
|
|
104
103
|
}
|
|
104
|
+
exports.connectionPaginationPlugin = connectionPaginationPlugin;
|
|
105
105
|
exports.default = connectionPaginationPlugin;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FirstAfterPaginationPlugin = void 0;
|
|
4
|
-
exports.firstAfterPaginationPlugin = firstAfterPaginationPlugin;
|
|
3
|
+
exports.firstAfterPaginationPlugin = exports.FirstAfterPaginationPlugin = void 0;
|
|
5
4
|
class FirstAfterPaginationPlugin {
|
|
6
5
|
beforeBuildField(builder, context, info) {
|
|
7
6
|
if (!info.list) {
|
|
@@ -16,4 +15,5 @@ exports.FirstAfterPaginationPlugin = FirstAfterPaginationPlugin;
|
|
|
16
15
|
function firstAfterPaginationPlugin() {
|
|
17
16
|
return new FirstAfterPaginationPlugin();
|
|
18
17
|
}
|
|
18
|
+
exports.firstAfterPaginationPlugin = firstAfterPaginationPlugin;
|
|
19
19
|
exports.default = firstAfterPaginationPlugin;
|
|
@@ -26,8 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.ItemsPaginationPlugin = void 0;
|
|
30
|
-
exports.itemsPaginationPlugin = itemsPaginationPlugin;
|
|
29
|
+
exports.itemsPaginationPlugin = exports.ItemsPaginationPlugin = void 0;
|
|
31
30
|
const objectType_1 = __importStar(require("../../objectType"));
|
|
32
31
|
const PluginError_1 = __importDefault(require("../PluginError"));
|
|
33
32
|
class ItemsPaginationPlugin {
|
|
@@ -65,4 +64,5 @@ exports.ItemsPaginationPlugin = ItemsPaginationPlugin;
|
|
|
65
64
|
function itemsPaginationPlugin() {
|
|
66
65
|
return new ItemsPaginationPlugin();
|
|
67
66
|
}
|
|
67
|
+
exports.itemsPaginationPlugin = itemsPaginationPlugin;
|
|
68
68
|
exports.default = itemsPaginationPlugin;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OffsetLimitPaginationPlugin = void 0;
|
|
4
|
-
exports.offsetLimitPaginationPlugin = offsetLimitPaginationPlugin;
|
|
3
|
+
exports.offsetLimitPaginationPlugin = exports.OffsetLimitPaginationPlugin = void 0;
|
|
5
4
|
class OffsetLimitPaginationPlugin {
|
|
6
5
|
beforeBuildField(builder, context, info) {
|
|
7
6
|
if (!info.list) {
|
|
@@ -16,4 +15,5 @@ exports.OffsetLimitPaginationPlugin = OffsetLimitPaginationPlugin;
|
|
|
16
15
|
function offsetLimitPaginationPlugin() {
|
|
17
16
|
return new OffsetLimitPaginationPlugin();
|
|
18
17
|
}
|
|
18
|
+
exports.offsetLimitPaginationPlugin = offsetLimitPaginationPlugin;
|
|
19
19
|
exports.default = offsetLimitPaginationPlugin;
|
|
@@ -3,8 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.RelayPaginationPlugin = void 0;
|
|
7
|
-
exports.relayPaginationPlugin = relayPaginationPlugin;
|
|
6
|
+
exports.relayPaginationPlugin = exports.RelayPaginationPlugin = void 0;
|
|
8
7
|
const MultiPlugin_1 = __importDefault(require("../MultiPlugin"));
|
|
9
8
|
const connection_1 = require("./connection");
|
|
10
9
|
const firstAfter_1 = require("./firstAfter");
|
|
@@ -23,4 +22,5 @@ exports.RelayPaginationPlugin = RelayPaginationPlugin;
|
|
|
23
22
|
function relayPaginationPlugin() {
|
|
24
23
|
return new RelayPaginationPlugin();
|
|
25
24
|
}
|
|
25
|
+
exports.relayPaginationPlugin = relayPaginationPlugin;
|
|
26
26
|
exports.default = relayPaginationPlugin;
|
|
@@ -3,8 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.SimplePaginationPlugin = void 0;
|
|
7
|
-
exports.simplePaginationPlugin = simplePaginationPlugin;
|
|
6
|
+
exports.simplePaginationPlugin = exports.SimplePaginationPlugin = void 0;
|
|
8
7
|
const MultiPlugin_1 = __importDefault(require("../MultiPlugin"));
|
|
9
8
|
const offsetLimit_1 = require("./offsetLimit");
|
|
10
9
|
const items_1 = require("./items");
|
|
@@ -17,4 +16,5 @@ exports.SimplePaginationPlugin = SimplePaginationPlugin;
|
|
|
17
16
|
function simplePaginationPlugin() {
|
|
18
17
|
return new SimplePaginationPlugin();
|
|
19
18
|
}
|
|
19
|
+
exports.simplePaginationPlugin = simplePaginationPlugin;
|
|
20
20
|
exports.default = simplePaginationPlugin;
|
package/dist/plugin/sort/sort.js
CHANGED
|
@@ -3,8 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.SortPlugin = exports.defaultSortPluginOptions = exports.SortDirection = void 0;
|
|
7
|
-
exports.sortPlugin = sortPlugin;
|
|
6
|
+
exports.sortPlugin = exports.SortPlugin = exports.defaultSortPluginOptions = exports.SortDirection = void 0;
|
|
8
7
|
const lodash_1 = require("lodash");
|
|
9
8
|
const inputObjectType_1 = __importDefault(require("../../inputObjectType"));
|
|
10
9
|
const enumType_1 = __importDefault(require("../../enumType"));
|
|
@@ -148,4 +147,5 @@ exports.SortPlugin = SortPlugin;
|
|
|
148
147
|
function sortPlugin(options) {
|
|
149
148
|
return new SortPlugin(options);
|
|
150
149
|
}
|
|
150
|
+
exports.sortPlugin = sortPlugin;
|
|
151
151
|
exports.default = sortPlugin;
|
package/dist/schema.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SchemaBuilder = exports.AbstractSchemaBuilder = void 0;
|
|
4
|
-
exports.schema = schema;
|
|
3
|
+
exports.schema = exports.SchemaBuilder = exports.AbstractSchemaBuilder = void 0;
|
|
5
4
|
const lodash_1 = require("lodash");
|
|
6
5
|
const schema_1 = require("@graphql-tools/schema");
|
|
7
6
|
const graphql_middleware_1 = require("graphql-middleware");
|
|
@@ -377,4 +376,5 @@ exports.SchemaBuilder = SchemaBuilder;
|
|
|
377
376
|
function schema(name = null) {
|
|
378
377
|
return new SchemaBuilder(name);
|
|
379
378
|
}
|
|
379
|
+
exports.schema = schema;
|
|
380
380
|
exports.default = schema;
|
package/dist/unionType.js
CHANGED
|
@@ -3,8 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.UnionTypeBuilder = void 0;
|
|
7
|
-
exports.unionType = unionType;
|
|
6
|
+
exports.unionType = exports.UnionTypeBuilder = void 0;
|
|
8
7
|
const definition_1 = require("graphql/type/definition");
|
|
9
8
|
const lodash_1 = require("lodash");
|
|
10
9
|
const Builder_1 = __importDefault(require("./Builder"));
|
|
@@ -72,4 +71,5 @@ exports.UnionTypeBuilder = UnionTypeBuilder;
|
|
|
72
71
|
function unionType(name, types = null) {
|
|
73
72
|
return new UnionTypeBuilder(name, types);
|
|
74
73
|
}
|
|
74
|
+
exports.unionType = unionType;
|
|
75
75
|
exports.default = unionType;
|
package/dist/util.d.ts
CHANGED
|
@@ -22,4 +22,8 @@ export declare function isTypeInput(type: FieldType, schema: AbstractSchemaBuild
|
|
|
22
22
|
export declare function isTypeScalar(type: FieldType, schema: AbstractSchemaBuilder<any>): boolean;
|
|
23
23
|
export declare function isFieldId(info: FieldBuilderInfo): boolean;
|
|
24
24
|
export declare function ensureInstantiated(input: object, ...args: any[]): any;
|
|
25
|
+
export declare function getAclExtension(allowed: Set<string>, denied: Set<string>): {
|
|
26
|
+
allowedRoles: string;
|
|
27
|
+
deniedRoles: string;
|
|
28
|
+
};
|
|
25
29
|
export declare function camelize(text: any): any;
|
package/dist/util.js
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultScalarNames = void 0;
|
|
4
|
-
exports.resolveAutoBuilderArgs = resolveAutoBuilderArgs;
|
|
5
|
-
exports.resolveBuilderArgs = resolveBuilderArgs;
|
|
6
|
-
exports.resolveBuilder = resolveBuilder;
|
|
7
|
-
exports.resolveType = resolveType;
|
|
8
|
-
exports.isTypeInput = isTypeInput;
|
|
9
|
-
exports.isTypeScalar = isTypeScalar;
|
|
10
|
-
exports.isFieldId = isFieldId;
|
|
11
|
-
exports.ensureInstantiated = ensureInstantiated;
|
|
12
|
-
exports.camelize = camelize;
|
|
3
|
+
exports.camelize = exports.getAclExtension = exports.ensureInstantiated = exports.isFieldId = exports.isTypeScalar = exports.isTypeInput = exports.resolveType = exports.resolveBuilder = exports.resolveBuilderArgs = exports.resolveAutoBuilderArgs = exports.defaultScalarNames = void 0;
|
|
13
4
|
const lodash_1 = require("lodash");
|
|
14
5
|
const graphql_1 = require("graphql");
|
|
15
6
|
const definition_1 = require("graphql/type/definition");
|
|
@@ -35,6 +26,7 @@ function resolveAutoBuilderArgs(builderOrConfiguratorOrName, configuratorArg, bu
|
|
|
35
26
|
builder, name, configurator
|
|
36
27
|
};
|
|
37
28
|
}
|
|
29
|
+
exports.resolveAutoBuilderArgs = resolveAutoBuilderArgs;
|
|
38
30
|
function resolveBuilderArgs(builderOrName, configuratorArg, builderType) {
|
|
39
31
|
let builder = null;
|
|
40
32
|
let name = null;
|
|
@@ -51,6 +43,7 @@ function resolveBuilderArgs(builderOrName, configuratorArg, builderType) {
|
|
|
51
43
|
builder, name, configurator
|
|
52
44
|
};
|
|
53
45
|
}
|
|
46
|
+
exports.resolveBuilderArgs = resolveBuilderArgs;
|
|
54
47
|
function resolveBuilder(args, defaultBuilderGenerator) {
|
|
55
48
|
let resolvedBuilder = args.builder;
|
|
56
49
|
if (!resolvedBuilder) {
|
|
@@ -61,6 +54,7 @@ function resolveBuilder(args, defaultBuilderGenerator) {
|
|
|
61
54
|
}
|
|
62
55
|
return resolvedBuilder;
|
|
63
56
|
}
|
|
57
|
+
exports.resolveBuilder = resolveBuilder;
|
|
64
58
|
const nonNullTypePattern = /(.+)!$/;
|
|
65
59
|
const nonNullListTypePattern = /\[(.+)!]/;
|
|
66
60
|
const listTypePattern = /\[(.+)]/;
|
|
@@ -75,6 +69,7 @@ function resolveType(type) {
|
|
|
75
69
|
const baseMatches = baseTypePattern.exec(type);
|
|
76
70
|
return { nonNull, list, nonNullList, type: baseMatches[1] };
|
|
77
71
|
}
|
|
72
|
+
exports.resolveType = resolveType;
|
|
78
73
|
function isTypeInput(type, schema) {
|
|
79
74
|
if ((0, lodash_1.isString)(type)) {
|
|
80
75
|
const typeName = type;
|
|
@@ -93,6 +88,7 @@ function isTypeInput(type, schema) {
|
|
|
93
88
|
}
|
|
94
89
|
return false;
|
|
95
90
|
}
|
|
91
|
+
exports.isTypeInput = isTypeInput;
|
|
96
92
|
function isTypeScalar(type, schema) {
|
|
97
93
|
if ((0, lodash_1.isString)(type)) {
|
|
98
94
|
const typeName = type;
|
|
@@ -111,9 +107,11 @@ function isTypeScalar(type, schema) {
|
|
|
111
107
|
}
|
|
112
108
|
return false;
|
|
113
109
|
}
|
|
110
|
+
exports.isTypeScalar = isTypeScalar;
|
|
114
111
|
function isFieldId(info) {
|
|
115
112
|
return info.type === 'ID' && info.name === 'id';
|
|
116
113
|
}
|
|
114
|
+
exports.isFieldId = isFieldId;
|
|
117
115
|
function ensureInstantiated(input, ...args) {
|
|
118
116
|
if ((0, lodash_1.isFunction)(input)) {
|
|
119
117
|
try {
|
|
@@ -126,6 +124,14 @@ function ensureInstantiated(input, ...args) {
|
|
|
126
124
|
}
|
|
127
125
|
return input;
|
|
128
126
|
}
|
|
127
|
+
exports.ensureInstantiated = ensureInstantiated;
|
|
128
|
+
function getAclExtension(allowed, denied) {
|
|
129
|
+
return {
|
|
130
|
+
allowedRoles: Array.from(allowed).join(','),
|
|
131
|
+
deniedRoles: Array.from(denied).join(','),
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
exports.getAclExtension = getAclExtension;
|
|
129
135
|
function camelize(text) {
|
|
130
136
|
return text.replace(/^([A-Z])|[\s-_]+(\w)/g, function (match, p1, p2) {
|
|
131
137
|
if (p2)
|
|
@@ -133,3 +139,4 @@ function camelize(text) {
|
|
|
133
139
|
return p1.toLowerCase();
|
|
134
140
|
});
|
|
135
141
|
}
|
|
142
|
+
exports.camelize = camelize;
|