@kiwano/core 1.4.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Builder.d.ts +0 -1
- package/dist/Builder.js +1 -2
- package/dist/argument.js +4 -24
- package/dist/enumType.js +1 -1
- package/dist/enumValue.js +4 -24
- package/dist/field.js +1 -1
- package/dist/inputField.js +4 -24
- package/dist/inputObjectType.js +1 -1
- package/dist/objectType.js +2 -1
- package/dist/unionType.js +4 -24
- package/dist/util.d.ts +4 -0
- package/dist/util.js +8 -1
- package/package.json +1 -1
package/dist/Builder.d.ts
CHANGED
|
@@ -8,7 +8,6 @@ export declare class BuilderError extends FrameworkError {
|
|
|
8
8
|
}
|
|
9
9
|
export type BuilderOrConfiguratorOrName<T> = T | Configurator<T> | string;
|
|
10
10
|
export type BuilderName = string | (() => string);
|
|
11
|
-
export declare const builderInfoExtensionName = "$builder";
|
|
12
11
|
export default abstract class Builder<RT> {
|
|
13
12
|
protected _name?: BuilderName;
|
|
14
13
|
protected _plugins: Plugin[];
|
package/dist/Builder.js
CHANGED
|
@@ -3,14 +3,13 @@ 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.resolveName = exports.FinalizeContext = exports.BuildContext = exports.
|
|
6
|
+
exports.resolveName = exports.FinalizeContext = exports.BuildContext = exports.BuilderError = void 0;
|
|
7
7
|
const lodash_1 = require("lodash");
|
|
8
8
|
const graphql_1 = require("graphql");
|
|
9
9
|
const FrameworkError_1 = __importDefault(require("./error/FrameworkError"));
|
|
10
10
|
class BuilderError extends FrameworkError_1.default {
|
|
11
11
|
}
|
|
12
12
|
exports.BuilderError = BuilderError;
|
|
13
|
-
exports.builderInfoExtensionName = "$builder";
|
|
14
13
|
class Builder {
|
|
15
14
|
constructor(name = null) {
|
|
16
15
|
this._plugins = [];
|
package/dist/argument.js
CHANGED
|
@@ -1,32 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
4
|
};
|
|
25
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
6
|
exports.argument = exports.ArgumentBuilder = void 0;
|
|
27
7
|
const lodash_1 = require("lodash");
|
|
28
8
|
const graphql_1 = require("graphql");
|
|
29
|
-
const Builder_1 =
|
|
9
|
+
const Builder_1 = __importDefault(require("./Builder"));
|
|
30
10
|
const util_1 = require("./util");
|
|
31
11
|
class ArgumentBuilder extends Builder_1.default {
|
|
32
12
|
constructor(name, type) {
|
|
@@ -94,7 +74,7 @@ class ArgumentBuilder extends Builder_1.default {
|
|
|
94
74
|
const argument = {
|
|
95
75
|
type,
|
|
96
76
|
description: this._description,
|
|
97
|
-
extensions: Object.assign({
|
|
77
|
+
extensions: Object.assign({}, Object.fromEntries(this._extensions))
|
|
98
78
|
};
|
|
99
79
|
this._executePluginsSync('afterBuildArgument', plugin => plugin.afterBuildArgument(this, context, info, argument));
|
|
100
80
|
return argument;
|
package/dist/enumType.js
CHANGED
|
@@ -93,7 +93,7 @@ class EnumTypeBuilder extends Builder_1.default {
|
|
|
93
93
|
name: this.name,
|
|
94
94
|
description: this._description,
|
|
95
95
|
values: builtValues,
|
|
96
|
-
extensions: Object.assign({
|
|
96
|
+
extensions: Object.assign({}, Object.fromEntries(this._extensions))
|
|
97
97
|
});
|
|
98
98
|
this._executePluginsSync('afterBuildEnumType', plugin => plugin.afterBuildEnumType(this, context, info, enumType));
|
|
99
99
|
return enumType;
|
package/dist/enumValue.js
CHANGED
|
@@ -1,31 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
4
|
};
|
|
25
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
6
|
exports.enumValue = exports.EnumValueBuilder = void 0;
|
|
27
7
|
const lodash_1 = require("lodash");
|
|
28
|
-
const Builder_1 =
|
|
8
|
+
const Builder_1 = __importDefault(require("./Builder"));
|
|
29
9
|
class EnumValueBuilder extends Builder_1.default {
|
|
30
10
|
constructor(name, value = null) {
|
|
31
11
|
super(name);
|
|
@@ -57,7 +37,7 @@ class EnumValueBuilder extends Builder_1.default {
|
|
|
57
37
|
const enumValue = {
|
|
58
38
|
value: this._value,
|
|
59
39
|
description: this._description,
|
|
60
|
-
extensions: Object.assign({
|
|
40
|
+
extensions: Object.assign({}, Object.fromEntries(this._extensions))
|
|
61
41
|
};
|
|
62
42
|
this._executePluginsSync('afterBuildEnumValue', plugin => plugin.afterBuildEnumValue(this, context, info, enumValue));
|
|
63
43
|
return enumValue;
|
package/dist/field.js
CHANGED
|
@@ -146,7 +146,7 @@ class FieldBuilder extends Builder_1.default {
|
|
|
146
146
|
type,
|
|
147
147
|
description: this._description,
|
|
148
148
|
args: builtArgs,
|
|
149
|
-
extensions: Object.assign({
|
|
149
|
+
extensions: Object.assign(Object.assign({}, (0, util_1.getAclExtension)(this._allowedRoles, this._deniedRoles)), Object.fromEntries(this._extensions)),
|
|
150
150
|
resolve: resolver
|
|
151
151
|
};
|
|
152
152
|
this._executePluginsSync('afterBuildField', plugin => plugin.afterBuildField(this, context, info, field));
|
package/dist/inputField.js
CHANGED
|
@@ -1,32 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
4
|
};
|
|
25
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
6
|
exports.inputField = exports.InputFieldBuilder = void 0;
|
|
27
7
|
const lodash_1 = require("lodash");
|
|
28
8
|
const graphql_1 = require("graphql");
|
|
29
|
-
const Builder_1 =
|
|
9
|
+
const Builder_1 = __importDefault(require("./Builder"));
|
|
30
10
|
const util_1 = require("./util");
|
|
31
11
|
class InputFieldBuilder extends Builder_1.default {
|
|
32
12
|
constructor(name, type) {
|
|
@@ -94,7 +74,7 @@ class InputFieldBuilder extends Builder_1.default {
|
|
|
94
74
|
const inputField = {
|
|
95
75
|
type,
|
|
96
76
|
description: this._description,
|
|
97
|
-
extensions: Object.assign({
|
|
77
|
+
extensions: Object.assign({}, Object.fromEntries(this._extensions))
|
|
98
78
|
};
|
|
99
79
|
this._executePluginsSync('afterBuildInputField', plugin => plugin.afterBuildInputField(this, context, info, inputField));
|
|
100
80
|
return inputField;
|
package/dist/inputObjectType.js
CHANGED
|
@@ -79,7 +79,7 @@ class InputObjectTypeBuilder extends Builder_1.default {
|
|
|
79
79
|
const inputObjectType = new graphql_1.GraphQLInputObjectType({
|
|
80
80
|
name: this.name,
|
|
81
81
|
description: this._description,
|
|
82
|
-
extensions: Object.assign({
|
|
82
|
+
extensions: Object.assign({}, Object.fromEntries(this._extensions)),
|
|
83
83
|
fields: () => {
|
|
84
84
|
let builtFields = {};
|
|
85
85
|
for (let field of this._fields) {
|
package/dist/objectType.js
CHANGED
|
@@ -28,6 +28,7 @@ const lodash_1 = require("lodash");
|
|
|
28
28
|
const graphql_1 = require("graphql");
|
|
29
29
|
const field_1 = require("./field");
|
|
30
30
|
const Builder_1 = __importStar(require("./Builder"));
|
|
31
|
+
const util_1 = require("./util");
|
|
31
32
|
class ObjectTypeBuilder extends Builder_1.default {
|
|
32
33
|
constructor() {
|
|
33
34
|
super(...arguments);
|
|
@@ -96,7 +97,7 @@ class ObjectTypeBuilder extends Builder_1.default {
|
|
|
96
97
|
const objectType = new graphql_1.GraphQLObjectType({
|
|
97
98
|
name: this.name,
|
|
98
99
|
description: this._description,
|
|
99
|
-
extensions: Object.assign({
|
|
100
|
+
extensions: Object.assign(Object.assign({}, (0, util_1.getAclExtension)(this._allowedRoles, this._deniedRoles)), Object.fromEntries(this._extensions)),
|
|
100
101
|
fields: () => {
|
|
101
102
|
let builtFields = {};
|
|
102
103
|
for (let field of this._fields) {
|
package/dist/unionType.js
CHANGED
|
@@ -1,32 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
4
|
};
|
|
25
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
6
|
exports.unionType = exports.UnionTypeBuilder = void 0;
|
|
27
7
|
const definition_1 = require("graphql/type/definition");
|
|
28
8
|
const lodash_1 = require("lodash");
|
|
29
|
-
const Builder_1 =
|
|
9
|
+
const Builder_1 = __importDefault(require("./Builder"));
|
|
30
10
|
class UnionTypeBuilder extends Builder_1.default {
|
|
31
11
|
constructor(name, types = null) {
|
|
32
12
|
super(name);
|
|
@@ -72,7 +52,7 @@ class UnionTypeBuilder extends Builder_1.default {
|
|
|
72
52
|
}
|
|
73
53
|
return resolvedTypes;
|
|
74
54
|
},
|
|
75
|
-
extensions: Object.assign({
|
|
55
|
+
extensions: Object.assign({}, Object.fromEntries(this._extensions))
|
|
76
56
|
});
|
|
77
57
|
this._executePluginsSync('afterBuildUnionType', plugin => plugin.afterBuildUnionType(this, context, info, unionType));
|
|
78
58
|
return 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,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.camelize = exports.ensureInstantiated = exports.isFieldId = exports.isTypeScalar = exports.isTypeInput = exports.resolveType = exports.resolveBuilder = exports.resolveBuilderArgs = exports.resolveAutoBuilderArgs = exports.defaultScalarNames = void 0;
|
|
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;
|
|
4
4
|
const lodash_1 = require("lodash");
|
|
5
5
|
const graphql_1 = require("graphql");
|
|
6
6
|
const definition_1 = require("graphql/type/definition");
|
|
@@ -125,6 +125,13 @@ function ensureInstantiated(input, ...args) {
|
|
|
125
125
|
return input;
|
|
126
126
|
}
|
|
127
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;
|
|
128
135
|
function camelize(text) {
|
|
129
136
|
return text.replace(/^([A-Z])|[\s-_]+(\w)/g, function (match, p1, p2) {
|
|
130
137
|
if (p2)
|