@kiwano/core 0.0.7 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Builder.js +1 -1
- package/argument.js +11 -7
- package/entity/createInputObjectType.js +1 -1
- package/entity/entitySchema.js +18 -18
- package/entity/index.js +5 -1
- package/entity/updateInputObjectType.js +2 -2
- package/enumType.js +8 -4
- package/enumValue.js +6 -2
- package/error/index.js +5 -1
- package/error/resolver/index.js +5 -1
- package/field.js +13 -9
- package/index.js +5 -1
- package/inputField.js +11 -7
- package/inputObjectType.js +8 -4
- package/naming/compact.js +8 -8
- package/naming/descriptive.js +8 -8
- package/naming/index.js +5 -1
- package/objectType.js +8 -4
- package/package.json +8 -8
- package/plugin/acl/acl.js +10 -10
- package/plugin/acl/index.js +5 -1
- package/plugin/acl/middleware.js +3 -3
- package/plugin/filter/equals.js +3 -3
- package/plugin/filter/index.js +5 -1
- package/plugin/filter/search.js +1 -1
- package/plugin/index.js +5 -1
- package/plugin/pagination/connection.js +8 -4
- package/plugin/pagination/index.js +5 -1
- package/plugin/pagination/items.js +6 -2
- package/plugin/sort/index.js +5 -1
- package/plugin/sort/sort.js +5 -5
- package/schema.js +22 -22
- package/unionType.js +7 -3
- package/util.js +6 -6
package/Builder.js
CHANGED
|
@@ -109,6 +109,6 @@ class FinalizeContext {
|
|
|
109
109
|
}
|
|
110
110
|
exports.FinalizeContext = FinalizeContext;
|
|
111
111
|
function resolveName(name) {
|
|
112
|
-
return lodash_1.isFunction(name) ? name() : name;
|
|
112
|
+
return (0, lodash_1.isFunction)(name) ? name() : name;
|
|
113
113
|
}
|
|
114
114
|
exports.resolveName = resolveName;
|
package/argument.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -34,7 +38,7 @@ class ArgumentBuilder extends Builder_1.default {
|
|
|
34
38
|
this.type(type);
|
|
35
39
|
}
|
|
36
40
|
type(type) {
|
|
37
|
-
const resolvedType = util_1.resolveType(type);
|
|
41
|
+
const resolvedType = (0, util_1.resolveType)(type);
|
|
38
42
|
this._type = resolvedType.type;
|
|
39
43
|
if (resolvedType.nonNull)
|
|
40
44
|
this.nonNull();
|
|
@@ -77,15 +81,15 @@ class ArgumentBuilder extends Builder_1.default {
|
|
|
77
81
|
build(context) {
|
|
78
82
|
const info = this.info();
|
|
79
83
|
this._executePluginsSync('beforeBuildArgument', plugin => plugin.beforeBuildArgument(this, context, info));
|
|
80
|
-
let type = lodash_1.isString(this._type) ? context.getType(this._type) : this._type;
|
|
84
|
+
let type = (0, lodash_1.isString)(this._type) ? context.getType(this._type) : this._type;
|
|
81
85
|
if (this._list) {
|
|
82
86
|
if (this._nonNullList) {
|
|
83
|
-
type = graphql_1.GraphQLNonNull(type);
|
|
87
|
+
type = (0, graphql_1.GraphQLNonNull)(type);
|
|
84
88
|
}
|
|
85
|
-
type = graphql_1.GraphQLList(type);
|
|
89
|
+
type = (0, graphql_1.GraphQLList)(type);
|
|
86
90
|
}
|
|
87
91
|
if (this._nonNull) {
|
|
88
|
-
type = graphql_1.GraphQLNonNull(type);
|
|
92
|
+
type = (0, graphql_1.GraphQLNonNull)(type);
|
|
89
93
|
}
|
|
90
94
|
const argument = {
|
|
91
95
|
type,
|
|
@@ -104,7 +108,7 @@ class ArgumentBuilder extends Builder_1.default {
|
|
|
104
108
|
nonNull: this._nonNull,
|
|
105
109
|
nonNullList: this._nonNullList,
|
|
106
110
|
list: this._list,
|
|
107
|
-
plugins: lodash_1.clone(this._plugins)
|
|
111
|
+
plugins: (0, lodash_1.clone)(this._plugins)
|
|
108
112
|
};
|
|
109
113
|
}
|
|
110
114
|
}
|
|
@@ -21,7 +21,7 @@ class CreateInputObjectTypeBuilder extends inputObjectType_1.InputObjectTypeBuil
|
|
|
21
21
|
const entityInfo = entity.info();
|
|
22
22
|
for (let field of entityInfo.fields) {
|
|
23
23
|
const fieldInfo = field.info();
|
|
24
|
-
if (this._exclude.has(fieldInfo.name) || !util_1.isTypeInput(fieldInfo.type, context.rootSchema) || util_1.isFieldId(fieldInfo)) {
|
|
24
|
+
if (this._exclude.has(fieldInfo.name) || !(0, util_1.isTypeInput)(fieldInfo.type, context.rootSchema) || (0, util_1.isFieldId)(fieldInfo)) {
|
|
25
25
|
continue;
|
|
26
26
|
}
|
|
27
27
|
const inputField = new inputField_1.InputFieldBuilder(fieldInfo.name, fieldInfo.type);
|
package/entity/entitySchema.js
CHANGED
|
@@ -25,39 +25,39 @@ class AbstractEntitySchemaBuilderBase extends schema_1.AbstractSchemaBuilder {
|
|
|
25
25
|
this._deniedEntityRoles = new Set();
|
|
26
26
|
}
|
|
27
27
|
entity(builderOrConfiguratorOrName, configurator = null) {
|
|
28
|
-
let resolvedArgs = util_1.resolveAutoBuilderArgs(builderOrConfiguratorOrName, configurator, objectType_1.ObjectTypeBuilder);
|
|
28
|
+
let resolvedArgs = (0, util_1.resolveAutoBuilderArgs)(builderOrConfiguratorOrName, configurator, objectType_1.ObjectTypeBuilder);
|
|
29
29
|
const defaultName = () => this.namingStrategy.entityObject(this.name);
|
|
30
|
-
this._entityObjectType = util_1.resolveBuilder(resolvedArgs, name => this.createEntityObjectType(name || defaultName));
|
|
30
|
+
this._entityObjectType = (0, util_1.resolveBuilder)(resolvedArgs, name => this.createEntityObjectType(name || defaultName));
|
|
31
31
|
return this;
|
|
32
32
|
}
|
|
33
33
|
all(builderOrConfiguratorOrName = null, configurator = null) {
|
|
34
|
-
let resolvedArgs = util_1.resolveAutoBuilderArgs(builderOrConfiguratorOrName, configurator, field_1.FieldBuilder);
|
|
34
|
+
let resolvedArgs = (0, util_1.resolveAutoBuilderArgs)(builderOrConfiguratorOrName, configurator, field_1.FieldBuilder);
|
|
35
35
|
const defaultName = () => this.namingStrategy.allField(this.name);
|
|
36
|
-
this._allField = util_1.resolveBuilder(resolvedArgs, name => this.createAllField(name || defaultName));
|
|
36
|
+
this._allField = (0, util_1.resolveBuilder)(resolvedArgs, name => this.createAllField(name || defaultName));
|
|
37
37
|
return this;
|
|
38
38
|
}
|
|
39
39
|
find(builderOrConfiguratorOrName = null, configurator = null) {
|
|
40
|
-
let resolvedArgs = util_1.resolveAutoBuilderArgs(builderOrConfiguratorOrName, configurator, field_1.FieldBuilder);
|
|
40
|
+
let resolvedArgs = (0, util_1.resolveAutoBuilderArgs)(builderOrConfiguratorOrName, configurator, field_1.FieldBuilder);
|
|
41
41
|
const defaultName = () => this.namingStrategy.findField(this.name);
|
|
42
|
-
this._findField = util_1.resolveBuilder(resolvedArgs, name => this.createFindField(name || defaultName));
|
|
42
|
+
this._findField = (0, util_1.resolveBuilder)(resolvedArgs, name => this.createFindField(name || defaultName));
|
|
43
43
|
return this;
|
|
44
44
|
}
|
|
45
45
|
create(builderOrConfiguratorOrName = null, configurator = null) {
|
|
46
|
-
let resolvedArgs = util_1.resolveAutoBuilderArgs(builderOrConfiguratorOrName, configurator, field_1.FieldBuilder);
|
|
46
|
+
let resolvedArgs = (0, util_1.resolveAutoBuilderArgs)(builderOrConfiguratorOrName, configurator, field_1.FieldBuilder);
|
|
47
47
|
const defaultName = () => this.namingStrategy.createField(this.name);
|
|
48
|
-
this._createField = util_1.resolveBuilder(resolvedArgs, name => this.createCreateField(name || defaultName));
|
|
48
|
+
this._createField = (0, util_1.resolveBuilder)(resolvedArgs, name => this.createCreateField(name || defaultName));
|
|
49
49
|
return this;
|
|
50
50
|
}
|
|
51
51
|
update(builderOrConfiguratorOrName = null, configurator = null) {
|
|
52
|
-
let resolvedArgs = util_1.resolveAutoBuilderArgs(builderOrConfiguratorOrName, configurator, field_1.FieldBuilder);
|
|
52
|
+
let resolvedArgs = (0, util_1.resolveAutoBuilderArgs)(builderOrConfiguratorOrName, configurator, field_1.FieldBuilder);
|
|
53
53
|
const defaultName = () => this.namingStrategy.updateField(this.name);
|
|
54
|
-
this._updateField = util_1.resolveBuilder(resolvedArgs, name => this.createUpdateField(name || defaultName));
|
|
54
|
+
this._updateField = (0, util_1.resolveBuilder)(resolvedArgs, name => this.createUpdateField(name || defaultName));
|
|
55
55
|
return this;
|
|
56
56
|
}
|
|
57
57
|
delete(builderOrConfiguratorOrName = null, configurator = null) {
|
|
58
|
-
let resolvedArgs = util_1.resolveAutoBuilderArgs(builderOrConfiguratorOrName, configurator, field_1.FieldBuilder);
|
|
58
|
+
let resolvedArgs = (0, util_1.resolveAutoBuilderArgs)(builderOrConfiguratorOrName, configurator, field_1.FieldBuilder);
|
|
59
59
|
const defaultName = () => this.namingStrategy.deleteField(this.name);
|
|
60
|
-
this._deleteField = util_1.resolveBuilder(resolvedArgs, name => this.createDeleteField(name || defaultName));
|
|
60
|
+
this._deleteField = (0, util_1.resolveBuilder)(resolvedArgs, name => this.createDeleteField(name || defaultName));
|
|
61
61
|
return this;
|
|
62
62
|
}
|
|
63
63
|
allowEntity(...roles) {
|
|
@@ -108,22 +108,22 @@ class AbstractEntitySchemaBuilderBase extends schema_1.AbstractSchemaBuilder {
|
|
|
108
108
|
}
|
|
109
109
|
// Entity resolvers
|
|
110
110
|
if (this._entityResolvers) {
|
|
111
|
-
this._resolvers = Object.assign({ [this._entityObjectType.name]: util_1.ensureInstantiated(this._entityResolvers) }, this._resolvers);
|
|
111
|
+
this._resolvers = Object.assign({ [this._entityObjectType.name]: (0, util_1.ensureInstantiated)(this._entityResolvers) }, this._resolvers);
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
exports.AbstractEntitySchemaBuilderBase = AbstractEntitySchemaBuilderBase;
|
|
116
116
|
class AbstractEntitySchemaBuilder extends AbstractEntitySchemaBuilderBase {
|
|
117
117
|
createInput(builderOrConfiguratorOrName = null, configurator = null) {
|
|
118
|
-
let resolvedArgs = util_1.resolveAutoBuilderArgs(builderOrConfiguratorOrName, configurator, field_1.FieldBuilder);
|
|
118
|
+
let resolvedArgs = (0, util_1.resolveAutoBuilderArgs)(builderOrConfiguratorOrName, configurator, field_1.FieldBuilder);
|
|
119
119
|
const defaultName = () => this.namingStrategy.createInputObject(this.name);
|
|
120
|
-
this._createInputObject = util_1.resolveBuilder(resolvedArgs, name => this.createCreateInputObject(name || defaultName));
|
|
120
|
+
this._createInputObject = (0, util_1.resolveBuilder)(resolvedArgs, name => this.createCreateInputObject(name || defaultName));
|
|
121
121
|
return this;
|
|
122
122
|
}
|
|
123
123
|
updateInput(builderOrConfiguratorOrName = null, configurator = null) {
|
|
124
|
-
let resolvedArgs = util_1.resolveAutoBuilderArgs(builderOrConfiguratorOrName, configurator, field_1.FieldBuilder);
|
|
124
|
+
let resolvedArgs = (0, util_1.resolveAutoBuilderArgs)(builderOrConfiguratorOrName, configurator, field_1.FieldBuilder);
|
|
125
125
|
const defaultName = () => this.namingStrategy.updateInputObject(this.name);
|
|
126
|
-
this._updateInputObject = util_1.resolveBuilder(resolvedArgs, name => this.createUpdateInputObject(name || defaultName));
|
|
126
|
+
this._updateInputObject = (0, util_1.resolveBuilder)(resolvedArgs, name => this.createUpdateInputObject(name || defaultName));
|
|
127
127
|
return this;
|
|
128
128
|
}
|
|
129
129
|
async finalizeSchema() {
|
|
@@ -182,7 +182,7 @@ class EntitySchemaBuilder extends AbstractEntitySchemaBuilder {
|
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
exports.EntitySchemaBuilder = EntitySchemaBuilder;
|
|
185
|
-
EntitySchemaBuilder.defaultNamingStrategy = naming_1.compactNamingStrategy();
|
|
185
|
+
EntitySchemaBuilder.defaultNamingStrategy = (0, naming_1.compactNamingStrategy)();
|
|
186
186
|
function entitySchema(name) {
|
|
187
187
|
return new EntitySchemaBuilder(name);
|
|
188
188
|
}
|
package/entity/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -21,11 +21,11 @@ class UpdateInputObjectTypeBuilder extends inputObjectType_1.InputObjectTypeBuil
|
|
|
21
21
|
const entityInfo = entity.info();
|
|
22
22
|
for (let field of entityInfo.fields) {
|
|
23
23
|
const fieldInfo = field.info();
|
|
24
|
-
if (this._exclude.has(fieldInfo.name) || !util_1.isTypeInput(fieldInfo.type, context.rootSchema)) {
|
|
24
|
+
if (this._exclude.has(fieldInfo.name) || !(0, util_1.isTypeInput)(fieldInfo.type, context.rootSchema)) {
|
|
25
25
|
continue;
|
|
26
26
|
}
|
|
27
27
|
const inputField = new inputField_1.InputFieldBuilder(fieldInfo.name, fieldInfo.type);
|
|
28
|
-
if (util_1.isFieldId(fieldInfo)) {
|
|
28
|
+
if ((0, util_1.isFieldId)(fieldInfo)) {
|
|
29
29
|
inputField.nonNull();
|
|
30
30
|
}
|
|
31
31
|
if (fieldInfo.list) {
|
package/enumType.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -46,7 +50,7 @@ class EnumTypeBuilder extends Builder_1.default {
|
|
|
46
50
|
if (builderOrName instanceof enumValue_1.EnumValueBuilder) {
|
|
47
51
|
valueBuilder = builderOrName;
|
|
48
52
|
}
|
|
49
|
-
else if (lodash_1.isString(builderOrName)) {
|
|
53
|
+
else if ((0, lodash_1.isString)(builderOrName)) {
|
|
50
54
|
valueBuilder = new enumValue_1.EnumValueBuilder(builderOrName, value);
|
|
51
55
|
if (configurator) {
|
|
52
56
|
configurator(valueBuilder);
|
|
@@ -98,9 +102,9 @@ class EnumTypeBuilder extends Builder_1.default {
|
|
|
98
102
|
return {
|
|
99
103
|
name: this.name,
|
|
100
104
|
description: this._description,
|
|
101
|
-
values: lodash_1.clone(this._values),
|
|
105
|
+
values: (0, lodash_1.clone)(this._values),
|
|
102
106
|
extensions: new Map(this._extensions),
|
|
103
|
-
plugins: lodash_1.clone(this._plugins)
|
|
107
|
+
plugins: (0, lodash_1.clone)(this._plugins)
|
|
104
108
|
};
|
|
105
109
|
}
|
|
106
110
|
}
|
package/enumValue.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -64,7 +68,7 @@ class EnumValueBuilder extends Builder_1.default {
|
|
|
64
68
|
value: this._value,
|
|
65
69
|
description: this._description,
|
|
66
70
|
extensions: new Map(this._extensions),
|
|
67
|
-
plugins: lodash_1.clone(this._plugins)
|
|
71
|
+
plugins: (0, lodash_1.clone)(this._plugins)
|
|
68
72
|
};
|
|
69
73
|
}
|
|
70
74
|
}
|
package/error/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/error/resolver/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/field.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -38,7 +42,7 @@ class FieldBuilder extends Builder_1.default {
|
|
|
38
42
|
this.type(type);
|
|
39
43
|
}
|
|
40
44
|
type(type) {
|
|
41
|
-
const resolvedType = util_1.resolveType(type);
|
|
45
|
+
const resolvedType = (0, util_1.resolveType)(type);
|
|
42
46
|
this._type = resolvedType.type;
|
|
43
47
|
if (resolvedType.nonNull)
|
|
44
48
|
this.nonNull();
|
|
@@ -61,7 +65,7 @@ class FieldBuilder extends Builder_1.default {
|
|
|
61
65
|
if (argOrName instanceof argument_1.ArgumentBuilder) {
|
|
62
66
|
argument = argOrName;
|
|
63
67
|
}
|
|
64
|
-
else if (lodash_1.isString(argOrName) && type) {
|
|
68
|
+
else if ((0, lodash_1.isString)(argOrName) && type) {
|
|
65
69
|
argument = new argument_1.ArgumentBuilder(argOrName, type);
|
|
66
70
|
if (configurator) {
|
|
67
71
|
configurator(argument);
|
|
@@ -124,18 +128,18 @@ class FieldBuilder extends Builder_1.default {
|
|
|
124
128
|
for (let arg of this._arguments) {
|
|
125
129
|
builtArgs[arg.name] = arg.build(context);
|
|
126
130
|
}
|
|
127
|
-
let type = lodash_1.isString(this._type) ? context.getType(this._type) : this._type;
|
|
131
|
+
let type = (0, lodash_1.isString)(this._type) ? context.getType(this._type) : this._type;
|
|
128
132
|
if (type === null) {
|
|
129
133
|
throw new Builder_1.BuilderError(`Type "${this._type}" of field "${this.name}" not found`);
|
|
130
134
|
}
|
|
131
135
|
if (this._list) {
|
|
132
136
|
if (this._nonNullList) {
|
|
133
|
-
type = graphql_1.GraphQLNonNull(type);
|
|
137
|
+
type = (0, graphql_1.GraphQLNonNull)(type);
|
|
134
138
|
}
|
|
135
|
-
type = graphql_1.GraphQLList(type);
|
|
139
|
+
type = (0, graphql_1.GraphQLList)(type);
|
|
136
140
|
}
|
|
137
141
|
if (this._nonNull) {
|
|
138
|
-
type = graphql_1.GraphQLNonNull(type);
|
|
142
|
+
type = (0, graphql_1.GraphQLNonNull)(type);
|
|
139
143
|
}
|
|
140
144
|
const resolver = this._resolver || context.getResolver(parentBuilder.name, this.name);
|
|
141
145
|
const field = {
|
|
@@ -153,7 +157,7 @@ class FieldBuilder extends Builder_1.default {
|
|
|
153
157
|
name: this.name,
|
|
154
158
|
type: this._type,
|
|
155
159
|
description: this._description,
|
|
156
|
-
arguments: lodash_1.clone(this._arguments),
|
|
160
|
+
arguments: (0, lodash_1.clone)(this._arguments),
|
|
157
161
|
extensions: new Map(this._extensions),
|
|
158
162
|
nonNull: this._nonNull,
|
|
159
163
|
nonNullList: this._nonNullList,
|
|
@@ -161,7 +165,7 @@ class FieldBuilder extends Builder_1.default {
|
|
|
161
165
|
allowedRoles: new Set(this._allowedRoles),
|
|
162
166
|
deniedRoles: new Set(this._deniedRoles),
|
|
163
167
|
resolver: this._resolver,
|
|
164
|
-
plugins: lodash_1.clone(this._plugins)
|
|
168
|
+
plugins: (0, lodash_1.clone)(this._plugins)
|
|
165
169
|
};
|
|
166
170
|
}
|
|
167
171
|
}
|
package/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/inputField.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -34,7 +38,7 @@ class InputFieldBuilder extends Builder_1.default {
|
|
|
34
38
|
this.type(type);
|
|
35
39
|
}
|
|
36
40
|
type(type) {
|
|
37
|
-
const resolvedType = util_1.resolveType(type);
|
|
41
|
+
const resolvedType = (0, util_1.resolveType)(type);
|
|
38
42
|
this._type = resolvedType.type;
|
|
39
43
|
if (resolvedType.nonNull)
|
|
40
44
|
this.nonNull();
|
|
@@ -77,15 +81,15 @@ class InputFieldBuilder extends Builder_1.default {
|
|
|
77
81
|
build(context) {
|
|
78
82
|
const info = this.info();
|
|
79
83
|
this._executePluginsSync('beforeBuildInputField', plugin => plugin.beforeBuildInputField(this, context, info));
|
|
80
|
-
let type = lodash_1.isString(this._type) ? context.getType(this._type) : this._type;
|
|
84
|
+
let type = (0, lodash_1.isString)(this._type) ? context.getType(this._type) : this._type;
|
|
81
85
|
if (this._list) {
|
|
82
86
|
if (this._nonNullList) {
|
|
83
|
-
type = graphql_1.GraphQLNonNull(type);
|
|
87
|
+
type = (0, graphql_1.GraphQLNonNull)(type);
|
|
84
88
|
}
|
|
85
|
-
type = graphql_1.GraphQLList(type);
|
|
89
|
+
type = (0, graphql_1.GraphQLList)(type);
|
|
86
90
|
}
|
|
87
91
|
if (this._nonNull) {
|
|
88
|
-
type = graphql_1.GraphQLNonNull(type);
|
|
92
|
+
type = (0, graphql_1.GraphQLNonNull)(type);
|
|
89
93
|
}
|
|
90
94
|
const inputField = {
|
|
91
95
|
type,
|
|
@@ -104,7 +108,7 @@ class InputFieldBuilder extends Builder_1.default {
|
|
|
104
108
|
nonNull: this._nonNull,
|
|
105
109
|
nonNullList: this._nonNullList,
|
|
106
110
|
list: this._list,
|
|
107
|
-
plugins: lodash_1.clone(this._plugins)
|
|
111
|
+
plugins: (0, lodash_1.clone)(this._plugins)
|
|
108
112
|
};
|
|
109
113
|
}
|
|
110
114
|
}
|
package/inputObjectType.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -43,7 +47,7 @@ class InputObjectTypeBuilder extends Builder_1.default {
|
|
|
43
47
|
if (fieldOrName instanceof inputField_1.InputFieldBuilder) {
|
|
44
48
|
field = fieldOrName;
|
|
45
49
|
}
|
|
46
|
-
else if (lodash_1.isString(fieldOrName) && type) {
|
|
50
|
+
else if ((0, lodash_1.isString)(fieldOrName) && type) {
|
|
47
51
|
field = new inputField_1.InputFieldBuilder(fieldOrName, type);
|
|
48
52
|
if (configurator) {
|
|
49
53
|
configurator(field);
|
|
@@ -91,9 +95,9 @@ class InputObjectTypeBuilder extends Builder_1.default {
|
|
|
91
95
|
return {
|
|
92
96
|
name: this.name,
|
|
93
97
|
description: this._description,
|
|
94
|
-
fields: lodash_1.clone(this._fields),
|
|
98
|
+
fields: (0, lodash_1.clone)(this._fields),
|
|
95
99
|
extensions: new Map(this._extensions),
|
|
96
|
-
plugins: lodash_1.clone(this._plugins)
|
|
100
|
+
plugins: (0, lodash_1.clone)(this._plugins)
|
|
97
101
|
};
|
|
98
102
|
}
|
|
99
103
|
}
|
package/naming/compact.js
CHANGED
|
@@ -4,22 +4,22 @@ exports.compactNamingStrategy = exports.CompactNamingStrategy = void 0;
|
|
|
4
4
|
const util_1 = require("./util");
|
|
5
5
|
class CompactNamingStrategy {
|
|
6
6
|
entityObject(schemaName) {
|
|
7
|
-
return util_1.ucFirst(schemaName);
|
|
7
|
+
return (0, util_1.ucFirst)(schemaName);
|
|
8
8
|
}
|
|
9
9
|
allField(schemaName) {
|
|
10
|
-
return util_1.pluralize(util_1.lcFirst(schemaName));
|
|
10
|
+
return (0, util_1.pluralize)((0, util_1.lcFirst)(schemaName));
|
|
11
11
|
}
|
|
12
12
|
findField(schemaName) {
|
|
13
|
-
return util_1.lcFirst(schemaName);
|
|
13
|
+
return (0, util_1.lcFirst)(schemaName);
|
|
14
14
|
}
|
|
15
15
|
createField(schemaName) {
|
|
16
|
-
return `create${util_1.ucFirst(schemaName)}`;
|
|
16
|
+
return `create${(0, util_1.ucFirst)(schemaName)}`;
|
|
17
17
|
}
|
|
18
18
|
updateField(schemaName) {
|
|
19
|
-
return `update${util_1.ucFirst(schemaName)}`;
|
|
19
|
+
return `update${(0, util_1.ucFirst)(schemaName)}`;
|
|
20
20
|
}
|
|
21
21
|
deleteField(schemaName) {
|
|
22
|
-
return `delete${util_1.ucFirst(schemaName)}`;
|
|
22
|
+
return `delete${(0, util_1.ucFirst)(schemaName)}`;
|
|
23
23
|
}
|
|
24
24
|
findFieldIdArgument(schemaName) {
|
|
25
25
|
return 'id';
|
|
@@ -28,13 +28,13 @@ class CompactNamingStrategy {
|
|
|
28
28
|
return 'id';
|
|
29
29
|
}
|
|
30
30
|
createInputObject(schemaName) {
|
|
31
|
-
return `Create${util_1.ucFirst(schemaName)}Input`;
|
|
31
|
+
return `Create${(0, util_1.ucFirst)(schemaName)}Input`;
|
|
32
32
|
}
|
|
33
33
|
createFieldInputArgument(schemaName) {
|
|
34
34
|
return 'input';
|
|
35
35
|
}
|
|
36
36
|
updateInputObject(schemaName) {
|
|
37
|
-
return `Update${util_1.ucFirst(schemaName)}Input`;
|
|
37
|
+
return `Update${(0, util_1.ucFirst)(schemaName)}Input`;
|
|
38
38
|
}
|
|
39
39
|
updateFieldInputArgument(schemaName) {
|
|
40
40
|
return 'input';
|
package/naming/descriptive.js
CHANGED
|
@@ -4,22 +4,22 @@ exports.descriptiveNamingStrategy = exports.DescriptiveNamingStrategy = void 0;
|
|
|
4
4
|
const util_1 = require("./util");
|
|
5
5
|
class DescriptiveNamingStrategy {
|
|
6
6
|
entityObject(schemaName) {
|
|
7
|
-
return util_1.ucFirst(schemaName);
|
|
7
|
+
return (0, util_1.ucFirst)(schemaName);
|
|
8
8
|
}
|
|
9
9
|
allField(schemaName) {
|
|
10
|
-
return `all${util_1.pluralize(util_1.ucFirst(schemaName))}`;
|
|
10
|
+
return `all${(0, util_1.pluralize)((0, util_1.ucFirst)(schemaName))}`;
|
|
11
11
|
}
|
|
12
12
|
findField(schemaName) {
|
|
13
|
-
return `find${util_1.ucFirst(schemaName)}`;
|
|
13
|
+
return `find${(0, util_1.ucFirst)(schemaName)}`;
|
|
14
14
|
}
|
|
15
15
|
createField(schemaName) {
|
|
16
|
-
return `create${util_1.ucFirst(schemaName)}`;
|
|
16
|
+
return `create${(0, util_1.ucFirst)(schemaName)}`;
|
|
17
17
|
}
|
|
18
18
|
updateField(schemaName) {
|
|
19
|
-
return `update${util_1.ucFirst(schemaName)}`;
|
|
19
|
+
return `update${(0, util_1.ucFirst)(schemaName)}`;
|
|
20
20
|
}
|
|
21
21
|
deleteField(schemaName) {
|
|
22
|
-
return `delete${util_1.ucFirst(schemaName)}`;
|
|
22
|
+
return `delete${(0, util_1.ucFirst)(schemaName)}`;
|
|
23
23
|
}
|
|
24
24
|
findFieldIdArgument(schemaName) {
|
|
25
25
|
return 'id';
|
|
@@ -28,13 +28,13 @@ class DescriptiveNamingStrategy {
|
|
|
28
28
|
return 'id';
|
|
29
29
|
}
|
|
30
30
|
createInputObject(schemaName) {
|
|
31
|
-
return `Create${util_1.ucFirst(schemaName)}Input`;
|
|
31
|
+
return `Create${(0, util_1.ucFirst)(schemaName)}Input`;
|
|
32
32
|
}
|
|
33
33
|
createFieldInputArgument(schemaName) {
|
|
34
34
|
return 'input';
|
|
35
35
|
}
|
|
36
36
|
updateInputObject(schemaName) {
|
|
37
|
-
return `Update${util_1.ucFirst(schemaName)}Input`;
|
|
37
|
+
return `Update${(0, util_1.ucFirst)(schemaName)}Input`;
|
|
38
38
|
}
|
|
39
39
|
updateFieldInputArgument(schemaName) {
|
|
40
40
|
return 'input';
|
package/naming/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/objectType.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -52,7 +56,7 @@ class ObjectTypeBuilder extends Builder_1.default {
|
|
|
52
56
|
if (fieldOrName instanceof field_1.FieldBuilder) {
|
|
53
57
|
field = fieldOrName;
|
|
54
58
|
}
|
|
55
|
-
else if (lodash_1.isString(fieldOrName) && type) {
|
|
59
|
+
else if ((0, lodash_1.isString)(fieldOrName) && type) {
|
|
56
60
|
field = new field_1.FieldBuilder(fieldOrName, type);
|
|
57
61
|
if (configurator) {
|
|
58
62
|
configurator(field);
|
|
@@ -108,12 +112,12 @@ class ObjectTypeBuilder extends Builder_1.default {
|
|
|
108
112
|
return {
|
|
109
113
|
name: this.name,
|
|
110
114
|
description: this._description,
|
|
111
|
-
fields: lodash_1.clone(this._fields),
|
|
115
|
+
fields: (0, lodash_1.clone)(this._fields),
|
|
112
116
|
extensions: new Map(this._extensions),
|
|
113
117
|
allowedRoles: new Set(this._allowedRoles),
|
|
114
118
|
deniedRoles: new Set(this._deniedRoles),
|
|
115
119
|
resolvers: this._resolvers,
|
|
116
|
-
plugins: lodash_1.clone(this._plugins)
|
|
120
|
+
plugins: (0, lodash_1.clone)(this._plugins)
|
|
117
121
|
};
|
|
118
122
|
}
|
|
119
123
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kiwano/core",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
@@ -20,22 +20,22 @@
|
|
|
20
20
|
"url": "https://github.com/kiwano-js/kiwano/issues"
|
|
21
21
|
},
|
|
22
22
|
"engines": {
|
|
23
|
-
"node": ">=
|
|
23
|
+
"node": ">= 14.0.0"
|
|
24
24
|
},
|
|
25
25
|
"homepage": "https://github.com/kiwano-js/kiwano#readme",
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"access": "public"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@types/lodash": "^4.14.
|
|
31
|
-
"graphql": "^15.
|
|
30
|
+
"@types/lodash": "^4.14.182",
|
|
31
|
+
"graphql": "^15.8.0",
|
|
32
32
|
"rimraf": "^3.0.2",
|
|
33
|
-
"ts-node": "
|
|
34
|
-
"typescript": "^4.
|
|
33
|
+
"ts-node": "^10.7.0",
|
|
34
|
+
"typescript": "^4.6.3"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@graphql-tools/schema": "^8.
|
|
38
|
-
"graphql-middleware": "^6.
|
|
37
|
+
"@graphql-tools/schema": "^8.3.9",
|
|
38
|
+
"graphql-middleware": "^6.1.24",
|
|
39
39
|
"lodash": "^4.17.21",
|
|
40
40
|
"pluralize": "^8.0.0"
|
|
41
41
|
},
|
package/plugin/acl/acl.js
CHANGED
|
@@ -21,7 +21,7 @@ class AclPlugin {
|
|
|
21
21
|
this._roles = new Map();
|
|
22
22
|
this._allowRules = new Map();
|
|
23
23
|
this._denyRules = new Map();
|
|
24
|
-
this._options = lodash_1.defaults(options || {}, middleware_1.defaultAclMiddlewareOptions, exports.defaultAclOptions);
|
|
24
|
+
this._options = (0, lodash_1.defaults)(options || {}, middleware_1.defaultAclMiddlewareOptions, exports.defaultAclOptions);
|
|
25
25
|
}
|
|
26
26
|
defaultAction(action) {
|
|
27
27
|
this._options.defaultAction = action;
|
|
@@ -38,7 +38,7 @@ class AclPlugin {
|
|
|
38
38
|
return this;
|
|
39
39
|
}
|
|
40
40
|
allow(resource, roles) {
|
|
41
|
-
const parsedRoles = new Set(lodash_1.isArray(roles) ? roles : [roles]);
|
|
41
|
+
const parsedRoles = new Set((0, lodash_1.isArray)(roles) ? roles : [roles]);
|
|
42
42
|
if (this._options.learn) {
|
|
43
43
|
this._learnRoles(parsedRoles);
|
|
44
44
|
}
|
|
@@ -52,7 +52,7 @@ class AclPlugin {
|
|
|
52
52
|
return this;
|
|
53
53
|
}
|
|
54
54
|
deny(resource, roles) {
|
|
55
|
-
const parsedRoles = new Set(lodash_1.isArray(roles) ? roles : [roles]);
|
|
55
|
+
const parsedRoles = new Set((0, lodash_1.isArray)(roles) ? roles : [roles]);
|
|
56
56
|
if (this._options.learn) {
|
|
57
57
|
this._learnRoles(parsedRoles);
|
|
58
58
|
}
|
|
@@ -69,7 +69,7 @@ class AclPlugin {
|
|
|
69
69
|
let determinedAction = this._options.defaultAction;
|
|
70
70
|
const allowRules = this._findRules(resource, this._allowRules);
|
|
71
71
|
const denyRules = this._findRules(resource, this._denyRules);
|
|
72
|
-
const rules = lodash_1.sortBy([
|
|
72
|
+
const rules = (0, lodash_1.sortBy)([
|
|
73
73
|
...allowRules.map(rule => ({ rule, action: AclAction.ALLOW })),
|
|
74
74
|
...denyRules.map(rule => ({ rule, action: AclAction.DENY })),
|
|
75
75
|
], rule => rule.rule.name.length);
|
|
@@ -98,10 +98,10 @@ class AclPlugin {
|
|
|
98
98
|
}
|
|
99
99
|
validate(config, role = null) {
|
|
100
100
|
let parsedConfig;
|
|
101
|
-
if (lodash_1.isArray(config)) {
|
|
101
|
+
if ((0, lodash_1.isArray)(config)) {
|
|
102
102
|
parsedConfig = { allowedRoles: config };
|
|
103
103
|
}
|
|
104
|
-
else if (lodash_1.isString(config) || lodash_1.isNumber(config)) {
|
|
104
|
+
else if ((0, lodash_1.isString)(config) || (0, lodash_1.isNumber)(config)) {
|
|
105
105
|
parsedConfig = { allowedRoles: [config] };
|
|
106
106
|
}
|
|
107
107
|
else if (config) {
|
|
@@ -119,7 +119,7 @@ class AclPlugin {
|
|
|
119
119
|
return allowed;
|
|
120
120
|
}
|
|
121
121
|
middleware(config = null) {
|
|
122
|
-
return middleware_1.expressAclMiddleware(this, config, this._options);
|
|
122
|
+
return (0, middleware_1.expressAclMiddleware)(this, config, this._options);
|
|
123
123
|
}
|
|
124
124
|
rolePath(path) {
|
|
125
125
|
this._options.rolePath = path;
|
|
@@ -131,7 +131,7 @@ class AclPlugin {
|
|
|
131
131
|
}
|
|
132
132
|
beforeBuildSchema(builder) {
|
|
133
133
|
// Add middleware
|
|
134
|
-
builder.use(middleware_1.graphQLAclMiddleware(this, null, this._options));
|
|
134
|
+
builder.use((0, middleware_1.graphQLAclMiddleware)(this, null, this._options));
|
|
135
135
|
}
|
|
136
136
|
afterBuildSchema(builder, schema) {
|
|
137
137
|
// Add rules
|
|
@@ -155,7 +155,7 @@ class AclPlugin {
|
|
|
155
155
|
_findRules(resource, collection) {
|
|
156
156
|
const allRules = Array.from(collection.values());
|
|
157
157
|
return allRules.filter(rule => {
|
|
158
|
-
if (lodash_1.isString(rule.resource)) {
|
|
158
|
+
if ((0, lodash_1.isString)(rule.resource)) {
|
|
159
159
|
return rule.resource === resource;
|
|
160
160
|
}
|
|
161
161
|
else if (rule.resource instanceof RegExp) {
|
|
@@ -186,7 +186,7 @@ class AclPlugin {
|
|
|
186
186
|
_getRuleConfig(name, roles) {
|
|
187
187
|
let resource = name;
|
|
188
188
|
if (name.indexOf('*') >= 0) {
|
|
189
|
-
const pattern = lodash_1.escapeRegExp(name).replace('\\*', '(.*)');
|
|
189
|
+
const pattern = (0, lodash_1.escapeRegExp)(name).replace('\\*', '(.*)');
|
|
190
190
|
resource = new RegExp(`^${pattern}$`);
|
|
191
191
|
}
|
|
192
192
|
return {
|
package/plugin/acl/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/plugin/acl/middleware.js
CHANGED
|
@@ -15,7 +15,7 @@ function expressAclMiddleware(acl, config = null, options = null) {
|
|
|
15
15
|
if (!config) {
|
|
16
16
|
config = { resource: fullPath };
|
|
17
17
|
}
|
|
18
|
-
const role = (_a = lodash_1.get(req, fullOptions.rolePath)) !== null && _a !== void 0 ? _a : null;
|
|
18
|
+
const role = (_a = (0, lodash_1.get)(req, fullOptions.rolePath)) !== null && _a !== void 0 ? _a : null;
|
|
19
19
|
const allowed = acl.validate(config, role);
|
|
20
20
|
if (!allowed) {
|
|
21
21
|
fullOptions.onForbidden(fullPath);
|
|
@@ -33,7 +33,7 @@ function graphQLAclMiddleware(acl, config = null, options = null) {
|
|
|
33
33
|
if (!config) {
|
|
34
34
|
parsedConfig = { resource: pathResource };
|
|
35
35
|
}
|
|
36
|
-
const role = (_a = lodash_1.get(context, fullOptions.rolePath)) !== null && _a !== void 0 ? _a : null;
|
|
36
|
+
const role = (_a = (0, lodash_1.get)(context, fullOptions.rolePath)) !== null && _a !== void 0 ? _a : null;
|
|
37
37
|
const allowed = acl.validate(parsedConfig, role);
|
|
38
38
|
if (!allowed) {
|
|
39
39
|
fullOptions.onForbidden(pathResource);
|
|
@@ -47,5 +47,5 @@ function getPathResource(path) {
|
|
|
47
47
|
}
|
|
48
48
|
exports.getPathResource = getPathResource;
|
|
49
49
|
function getOptions(options) {
|
|
50
|
-
return lodash_1.defaults({}, options || {}, exports.defaultAclMiddlewareOptions);
|
|
50
|
+
return (0, lodash_1.defaults)({}, options || {}, exports.defaultAclMiddlewareOptions);
|
|
51
51
|
}
|
package/plugin/filter/equals.js
CHANGED
|
@@ -16,7 +16,7 @@ exports.defaultEqualsFilterPluginOptions = {
|
|
|
16
16
|
};
|
|
17
17
|
class EqualsFilterPlugin {
|
|
18
18
|
constructor(options) {
|
|
19
|
-
this._options = lodash_1.defaults(options || {}, exports.defaultEqualsFilterPluginOptions, {
|
|
19
|
+
this._options = (0, lodash_1.defaults)(options || {}, exports.defaultEqualsFilterPluginOptions, {
|
|
20
20
|
exclude: [],
|
|
21
21
|
include: []
|
|
22
22
|
});
|
|
@@ -69,13 +69,13 @@ class EqualsFilterPlugin {
|
|
|
69
69
|
builder.arg(this._options.argumentName, inputTypeName, _ => _.description(`Configuration for how the nodes should be filtered`));
|
|
70
70
|
}
|
|
71
71
|
_createFilterInputType(context, name, targetObjectType) {
|
|
72
|
-
const inputObjectType = inputObjectType_1.default(name)
|
|
72
|
+
const inputObjectType = (0, inputObjectType_1.default)(name)
|
|
73
73
|
.description(`Configuration for how the nodes should be filtered`);
|
|
74
74
|
let fields = new Set();
|
|
75
75
|
if (targetObjectType) {
|
|
76
76
|
for (let field of targetObjectType.info().fields) {
|
|
77
77
|
const fieldInfo = field.info();
|
|
78
|
-
if (!fieldInfo.list && util_1.isTypeInput(fieldInfo.type, context.rootSchema)) {
|
|
78
|
+
if (!fieldInfo.list && (0, util_1.isTypeInput)(fieldInfo.type, context.rootSchema)) {
|
|
79
79
|
fields.add({
|
|
80
80
|
name: field.name,
|
|
81
81
|
type: fieldInfo.type
|
package/plugin/filter/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/plugin/filter/search.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.defaultSearchFilterPluginOptions = {
|
|
|
7
7
|
};
|
|
8
8
|
class SearchFilterPlugin {
|
|
9
9
|
constructor(options) {
|
|
10
|
-
this._options = lodash_1.defaults(options || {}, exports.defaultSearchFilterPluginOptions);
|
|
10
|
+
this._options = (0, lodash_1.defaults)(options || {}, exports.defaultSearchFilterPluginOptions);
|
|
11
11
|
}
|
|
12
12
|
beforeBuildField(builder, context, info) {
|
|
13
13
|
if (!info.list) {
|
package/plugin/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -69,7 +73,7 @@ class ConnectionPaginationPlugin {
|
|
|
69
73
|
.list(false);
|
|
70
74
|
}
|
|
71
75
|
_createPageInfoObjectType() {
|
|
72
|
-
return objectType_1.default(PageInfoObjectTypeName)
|
|
76
|
+
return (0, objectType_1.default)(PageInfoObjectTypeName)
|
|
73
77
|
.description('Provides information about the paging state')
|
|
74
78
|
.field('hasNextPage', 'Boolean', _ => _.nonNull().description('Indicates whether there is a next page'))
|
|
75
79
|
.field('hasPreviousPage', 'Boolean', _ => _.nonNull().description('Indicates whether there is a previous page'))
|
|
@@ -77,7 +81,7 @@ class ConnectionPaginationPlugin {
|
|
|
77
81
|
.field('endCursor', 'String', _ => _.description('Cursor for the last node'));
|
|
78
82
|
}
|
|
79
83
|
_createConnectionObjectType(name, edgeTypeName) {
|
|
80
|
-
const type = objectType_1.default(name)
|
|
84
|
+
const type = (0, objectType_1.default)(name)
|
|
81
85
|
.description(`Connection with ${edgeTypeName}`)
|
|
82
86
|
.field('pageInfo', PageInfoObjectTypeName, _ => _.nonNull().description('Provides information about the paging state'))
|
|
83
87
|
.field('edges', edgeTypeName, _ => _.list().description('List of the queried edges'));
|
|
@@ -87,7 +91,7 @@ class ConnectionPaginationPlugin {
|
|
|
87
91
|
return type;
|
|
88
92
|
}
|
|
89
93
|
_createEdgeObjectType(name, typeName) {
|
|
90
|
-
return objectType_1.default(name)
|
|
94
|
+
return (0, objectType_1.default)(name)
|
|
91
95
|
.description(`${typeName} edge`)
|
|
92
96
|
.field('node', typeName, _ => _.description('Current node'))
|
|
93
97
|
.field('cursor', 'String', _ => _.nonNull().description('Cursor for the current node'));
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -50,7 +54,7 @@ class ItemsPaginationPlugin {
|
|
|
50
54
|
.list(false);
|
|
51
55
|
}
|
|
52
56
|
_createListObjectType(name, typeName) {
|
|
53
|
-
return objectType_1.default(name)
|
|
57
|
+
return (0, objectType_1.default)(name)
|
|
54
58
|
.description(`Collection of ${typeName} nodes`)
|
|
55
59
|
.field('items', typeName, _ => _.list().nonNull().description('List of the queried nodes'))
|
|
56
60
|
.field('totalCount', 'Int', _ => _.nonNull().description('Total number of nodes'));
|
package/plugin/sort/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/plugin/sort/sort.js
CHANGED
|
@@ -24,7 +24,7 @@ exports.defaultSortPluginOptions = {
|
|
|
24
24
|
};
|
|
25
25
|
class SortPlugin {
|
|
26
26
|
constructor(options) {
|
|
27
|
-
this._options = lodash_1.defaults(options || {}, exports.defaultSortPluginOptions, {
|
|
27
|
+
this._options = (0, lodash_1.defaults)(options || {}, exports.defaultSortPluginOptions, {
|
|
28
28
|
exclude: [],
|
|
29
29
|
include: []
|
|
30
30
|
});
|
|
@@ -98,19 +98,19 @@ class SortPlugin {
|
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
100
|
_createSortInputType(name, enumName) {
|
|
101
|
-
return inputObjectType_1.default(name)
|
|
101
|
+
return (0, inputObjectType_1.default)(name)
|
|
102
102
|
.description(`Configuration for how the nodes should be sorted`)
|
|
103
103
|
.field('field', enumName, _ => _.nonNull().description('Field to sort on'))
|
|
104
104
|
.field('direction', this._options.directionEnumName, _ => _.nonNull().description('Direction to sort'));
|
|
105
105
|
}
|
|
106
106
|
_createSortFieldEnum(context, name, typeName, targetObjectType) {
|
|
107
|
-
const enumBuilder = enumType_1.default(name)
|
|
107
|
+
const enumBuilder = (0, enumType_1.default)(name)
|
|
108
108
|
.description(`Field to sort ${typeName} on`);
|
|
109
109
|
let fields = new Set();
|
|
110
110
|
if (targetObjectType) {
|
|
111
111
|
for (let field of targetObjectType.info().fields) {
|
|
112
112
|
const fieldInfo = field.info();
|
|
113
|
-
if (!fieldInfo.list && util_1.isTypeInput(fieldInfo.type, context.rootSchema)) {
|
|
113
|
+
if (!fieldInfo.list && (0, util_1.isTypeInput)(fieldInfo.type, context.rootSchema)) {
|
|
114
114
|
fields.add(field.name);
|
|
115
115
|
}
|
|
116
116
|
}
|
|
@@ -134,7 +134,7 @@ class SortPlugin {
|
|
|
134
134
|
return enumBuilder;
|
|
135
135
|
}
|
|
136
136
|
_createSortDirectionEnum() {
|
|
137
|
-
return enumType_1.default(this._options.directionEnumName)
|
|
137
|
+
return (0, enumType_1.default)(this._options.directionEnumName)
|
|
138
138
|
.description('Direction to sort')
|
|
139
139
|
.value(SortDirection.ASC, SortDirection.ASC, _ => _.description('Sort ascending'))
|
|
140
140
|
.value(SortDirection.DESC, SortDirection.DESC, _ => _.description('Sort descending'));
|
package/schema.js
CHANGED
|
@@ -43,17 +43,17 @@ class AbstractSchemaBuilder {
|
|
|
43
43
|
return this._namingStrategy || this._defaultNamingStrategy;
|
|
44
44
|
}
|
|
45
45
|
object(objectOrName, configurator = null) {
|
|
46
|
-
const resolvedArgs = util_1.resolveBuilderArgs(objectOrName, configurator, objectType_1.ObjectTypeBuilder);
|
|
47
|
-
const resolvedBuilder = util_1.resolveBuilder(resolvedArgs, name => new objectType_1.ObjectTypeBuilder(name));
|
|
46
|
+
const resolvedArgs = (0, util_1.resolveBuilderArgs)(objectOrName, configurator, objectType_1.ObjectTypeBuilder);
|
|
47
|
+
const resolvedBuilder = (0, util_1.resolveBuilder)(resolvedArgs, name => new objectType_1.ObjectTypeBuilder(name));
|
|
48
48
|
this._objectTypes.set(resolvedBuilder.name, resolvedBuilder);
|
|
49
49
|
return this;
|
|
50
50
|
}
|
|
51
51
|
getObjectTypes() {
|
|
52
|
-
return lodash_1.compact([this._queryObject, this._mutationObject, ...Array.from(this._objectTypes.values())]);
|
|
52
|
+
return (0, lodash_1.compact)([this._queryObject, this._mutationObject, ...Array.from(this._objectTypes.values())]);
|
|
53
53
|
}
|
|
54
54
|
inputObject(objectOrName, configurator = null) {
|
|
55
|
-
const resolvedArgs = util_1.resolveBuilderArgs(objectOrName, configurator, inputObjectType_1.InputObjectTypeBuilder);
|
|
56
|
-
const resolvedBuilder = util_1.resolveBuilder(resolvedArgs, name => new inputObjectType_1.InputObjectTypeBuilder(name));
|
|
55
|
+
const resolvedArgs = (0, util_1.resolveBuilderArgs)(objectOrName, configurator, inputObjectType_1.InputObjectTypeBuilder);
|
|
56
|
+
const resolvedBuilder = (0, util_1.resolveBuilder)(resolvedArgs, name => new inputObjectType_1.InputObjectTypeBuilder(name));
|
|
57
57
|
this._inputObjectTypes.set(resolvedBuilder.name, resolvedBuilder);
|
|
58
58
|
return this;
|
|
59
59
|
}
|
|
@@ -67,13 +67,13 @@ class AbstractSchemaBuilder {
|
|
|
67
67
|
let valuesObject = null;
|
|
68
68
|
if (enumOrName instanceof enumType_1.EnumTypeBuilder) {
|
|
69
69
|
builder = enumOrName;
|
|
70
|
-
if (lodash_1.isFunction(configuratorOrValuesObject)) {
|
|
70
|
+
if ((0, lodash_1.isFunction)(configuratorOrValuesObject)) {
|
|
71
71
|
configurator = configuratorOrValuesObject;
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
else if (lodash_1.isString(enumOrName)) {
|
|
74
|
+
else if ((0, lodash_1.isString)(enumOrName)) {
|
|
75
75
|
name = enumOrName;
|
|
76
|
-
if (lodash_1.isFunction(configuratorOrValuesObject)) {
|
|
76
|
+
if ((0, lodash_1.isFunction)(configuratorOrValuesObject)) {
|
|
77
77
|
configurator = configuratorOrValuesObject;
|
|
78
78
|
}
|
|
79
79
|
else {
|
|
@@ -81,7 +81,7 @@ class AbstractSchemaBuilder {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
const resolvedArgs = { builder, name, configurator };
|
|
84
|
-
const resolvedBuilder = util_1.resolveBuilder(resolvedArgs, name => new enumType_1.EnumTypeBuilder(name, valuesObject));
|
|
84
|
+
const resolvedBuilder = (0, util_1.resolveBuilder)(resolvedArgs, name => new enumType_1.EnumTypeBuilder(name, valuesObject));
|
|
85
85
|
this._enumTypes.set(resolvedBuilder.name, resolvedBuilder);
|
|
86
86
|
return this;
|
|
87
87
|
}
|
|
@@ -95,21 +95,21 @@ class AbstractSchemaBuilder {
|
|
|
95
95
|
let resolvedTypes = null;
|
|
96
96
|
if (objectOrName instanceof unionType_1.UnionTypeBuilder) {
|
|
97
97
|
builder = objectOrName;
|
|
98
|
-
if (lodash_1.isFunction(configuratorOrTypes)) {
|
|
98
|
+
if ((0, lodash_1.isFunction)(configuratorOrTypes)) {
|
|
99
99
|
configurator = configuratorOrTypes;
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
-
else if (lodash_1.isString(objectOrName)) {
|
|
102
|
+
else if ((0, lodash_1.isString)(objectOrName)) {
|
|
103
103
|
name = objectOrName;
|
|
104
|
-
if (lodash_1.isFunction(configuratorOrTypes)) {
|
|
104
|
+
if ((0, lodash_1.isFunction)(configuratorOrTypes)) {
|
|
105
105
|
configurator = configuratorOrTypes;
|
|
106
106
|
}
|
|
107
|
-
else if (lodash_1.isArray(configuratorOrTypes)) {
|
|
107
|
+
else if ((0, lodash_1.isArray)(configuratorOrTypes)) {
|
|
108
108
|
resolvedTypes = configuratorOrTypes;
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
const resolvedArgs = { builder, name, configurator };
|
|
112
|
-
const resolvedBuilder = util_1.resolveBuilder(resolvedArgs, name => new unionType_1.UnionTypeBuilder(name, resolvedTypes));
|
|
112
|
+
const resolvedBuilder = (0, util_1.resolveBuilder)(resolvedArgs, name => new unionType_1.UnionTypeBuilder(name, resolvedTypes));
|
|
113
113
|
this._unionTypes.set(resolvedBuilder.name, resolvedBuilder);
|
|
114
114
|
return this;
|
|
115
115
|
}
|
|
@@ -173,10 +173,10 @@ class AbstractSchemaBuilder {
|
|
|
173
173
|
}
|
|
174
174
|
use(...middlewareOrPlugins) {
|
|
175
175
|
for (let item of middlewareOrPlugins) {
|
|
176
|
-
if (lodash_1.isObjectLike(item)) {
|
|
176
|
+
if ((0, lodash_1.isObjectLike)(item)) {
|
|
177
177
|
this._plugins.push(item);
|
|
178
178
|
}
|
|
179
|
-
else if (lodash_1.isFunction(item)) {
|
|
179
|
+
else if ((0, lodash_1.isFunction)(item)) {
|
|
180
180
|
this._middleware.push(item);
|
|
181
181
|
}
|
|
182
182
|
}
|
|
@@ -221,7 +221,7 @@ class AbstractSchemaBuilder {
|
|
|
221
221
|
return resolver;
|
|
222
222
|
}
|
|
223
223
|
get name() {
|
|
224
|
-
return Builder_1.resolveName(this._name);
|
|
224
|
+
return (0, Builder_1.resolveName)(this._name);
|
|
225
225
|
}
|
|
226
226
|
async finalize(rootSchema) {
|
|
227
227
|
const resolvedRootSchema = rootSchema || this;
|
|
@@ -313,25 +313,25 @@ class AbstractSchemaBuilder {
|
|
|
313
313
|
}
|
|
314
314
|
const schema = new graphql_1.GraphQLSchema(schemaConfig);
|
|
315
315
|
// Create full schema
|
|
316
|
-
const fullSchema = graphql_middleware_1.applyMiddleware(schema, ...this._middleware);
|
|
316
|
+
const fullSchema = (0, graphql_middleware_1.applyMiddleware)(schema, ...this._middleware);
|
|
317
317
|
const builtSubSchemas = [];
|
|
318
318
|
for (let subSchema of this._subSchemas) {
|
|
319
319
|
const builtSchema = await subSchema.buildSchema(resolvedTypes, resolvedRootSchema);
|
|
320
320
|
builtSubSchemas.push(builtSchema);
|
|
321
321
|
}
|
|
322
|
-
const mergedSchema = schema_1.mergeSchemas({
|
|
322
|
+
const mergedSchema = (0, schema_1.mergeSchemas)({
|
|
323
323
|
schemas: [fullSchema, ...builtSubSchemas]
|
|
324
324
|
});
|
|
325
325
|
this._executePluginsSync('afterBuildSchema', plugin => plugin.afterBuildSchema(this, mergedSchema));
|
|
326
326
|
return mergedSchema;
|
|
327
327
|
}
|
|
328
328
|
get compiledResolvers() {
|
|
329
|
-
let resolvers = this._resolvers ? lodash_1.clone(this._resolvers) : {};
|
|
329
|
+
let resolvers = this._resolvers ? (0, lodash_1.clone)(this._resolvers) : {};
|
|
330
330
|
if (this._queryResolvers) {
|
|
331
|
-
resolvers['Query'] = util_1.ensureInstantiated(this._queryResolvers);
|
|
331
|
+
resolvers['Query'] = (0, util_1.ensureInstantiated)(this._queryResolvers);
|
|
332
332
|
}
|
|
333
333
|
if (this._mutationResolvers && this._mutationObject) {
|
|
334
|
-
resolvers['Mutation'] = util_1.ensureInstantiated(this._mutationResolvers);
|
|
334
|
+
resolvers['Mutation'] = (0, util_1.ensureInstantiated)(this._mutationResolvers);
|
|
335
335
|
}
|
|
336
336
|
for (let objectType of this._objectTypes.values()) {
|
|
337
337
|
const objectResolvers = objectType.getResolvers();
|
package/unionType.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -58,7 +62,7 @@ class UnionTypeBuilder extends Builder_1.default {
|
|
|
58
62
|
types: () => {
|
|
59
63
|
let resolvedTypes = [];
|
|
60
64
|
for (let type of this._types) {
|
|
61
|
-
if (lodash_1.isString(type)) {
|
|
65
|
+
if ((0, lodash_1.isString)(type)) {
|
|
62
66
|
const resolved = context.getType(type);
|
|
63
67
|
resolvedTypes.push(resolved);
|
|
64
68
|
}
|
|
@@ -79,7 +83,7 @@ class UnionTypeBuilder extends Builder_1.default {
|
|
|
79
83
|
types: new Set(this._types),
|
|
80
84
|
description: this._description,
|
|
81
85
|
extensions: new Map(this._extensions),
|
|
82
|
-
plugins: lodash_1.clone(this._plugins)
|
|
86
|
+
plugins: (0, lodash_1.clone)(this._plugins)
|
|
83
87
|
};
|
|
84
88
|
}
|
|
85
89
|
}
|
package/util.js
CHANGED
|
@@ -15,7 +15,7 @@ function resolveAutoBuilderArgs(builderOrConfiguratorOrName, configuratorArg, bu
|
|
|
15
15
|
builder = builderOrConfiguratorOrName;
|
|
16
16
|
configurator = configuratorArg;
|
|
17
17
|
}
|
|
18
|
-
else if (lodash_1.isString(builderOrConfiguratorOrName)) {
|
|
18
|
+
else if ((0, lodash_1.isString)(builderOrConfiguratorOrName)) {
|
|
19
19
|
name = builderOrConfiguratorOrName;
|
|
20
20
|
configurator = configuratorArg;
|
|
21
21
|
}
|
|
@@ -35,7 +35,7 @@ function resolveBuilderArgs(builderOrName, configuratorArg, builderType) {
|
|
|
35
35
|
builder = builderOrName;
|
|
36
36
|
configurator = configuratorArg;
|
|
37
37
|
}
|
|
38
|
-
else if (lodash_1.isString(builderOrName)) {
|
|
38
|
+
else if ((0, lodash_1.isString)(builderOrName)) {
|
|
39
39
|
name = builderOrName;
|
|
40
40
|
configurator = configuratorArg;
|
|
41
41
|
}
|
|
@@ -60,7 +60,7 @@ const nonNullListTypePattern = /\[(.+)!]/;
|
|
|
60
60
|
const listTypePattern = /\[(.+)]/;
|
|
61
61
|
const baseTypePattern = /\[?(\w+)]?!?/;
|
|
62
62
|
function resolveType(type) {
|
|
63
|
-
if (!lodash_1.isString(type)) {
|
|
63
|
+
if (!(0, lodash_1.isString)(type)) {
|
|
64
64
|
return { type, nonNull: false, nonNullList: false, list: false };
|
|
65
65
|
}
|
|
66
66
|
const nonNull = nonNullTypePattern.test(type);
|
|
@@ -71,7 +71,7 @@ function resolveType(type) {
|
|
|
71
71
|
}
|
|
72
72
|
exports.resolveType = resolveType;
|
|
73
73
|
function isTypeInput(type, schema) {
|
|
74
|
-
if (lodash_1.isString(type)) {
|
|
74
|
+
if ((0, lodash_1.isString)(type)) {
|
|
75
75
|
const typeName = type;
|
|
76
76
|
if (exports.defaultScalarNames.indexOf(typeName) >= 0) {
|
|
77
77
|
return true;
|
|
@@ -90,7 +90,7 @@ function isTypeInput(type, schema) {
|
|
|
90
90
|
}
|
|
91
91
|
exports.isTypeInput = isTypeInput;
|
|
92
92
|
function isTypeScalar(type, schema) {
|
|
93
|
-
if (lodash_1.isString(type)) {
|
|
93
|
+
if ((0, lodash_1.isString)(type)) {
|
|
94
94
|
const typeName = type;
|
|
95
95
|
if (exports.defaultScalarNames.indexOf(typeName) >= 0) {
|
|
96
96
|
return true;
|
|
@@ -113,7 +113,7 @@ function isFieldId(info) {
|
|
|
113
113
|
}
|
|
114
114
|
exports.isFieldId = isFieldId;
|
|
115
115
|
function ensureInstantiated(input, ...args) {
|
|
116
|
-
if (lodash_1.isFunction(input)) {
|
|
116
|
+
if ((0, lodash_1.isFunction)(input)) {
|
|
117
117
|
try {
|
|
118
118
|
let inputClass = input;
|
|
119
119
|
return new inputClass(...args);
|