wingbot 3.65.9 → 3.65.11
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/package.json +2 -2
- package/plugins/index.js +7 -7
- package/src/graphApi/GraphApi.js +25 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wingbot",
|
|
3
|
-
"version": "3.65.
|
|
3
|
+
"version": "3.65.11",
|
|
4
4
|
"description": "Enterprise Messaging Bot Conversation Engine",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"compress-json": "^2.1.2",
|
|
58
58
|
"deep-extend": "^0.6.0",
|
|
59
59
|
"form-data": "^4.0.0",
|
|
60
|
-
"graphql": "^
|
|
60
|
+
"graphql": "^16.8.0",
|
|
61
61
|
"jsonwebtoken": "^9.0.0",
|
|
62
62
|
"node-fetch": "^2.6.7",
|
|
63
63
|
"path-to-regexp": "^6.2.1",
|
package/plugins/index.js
CHANGED
|
@@ -8,14 +8,14 @@ const pluginsJson = require('./plugins.json');
|
|
|
8
8
|
const plugins = new Map();
|
|
9
9
|
|
|
10
10
|
for (const plugin of pluginsJson.plugins) {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
plugins.set(plugin.id, {
|
|
12
|
+
pluginFactory: (...args) => {
|
|
13
|
+
// @ts-ignore
|
|
14
|
+
const fn = module.require(`./${plugin.id}/plugin`);
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
plugins.set(plugin.id, fn);
|
|
18
|
-
}
|
|
16
|
+
return plugin.isFactory ? fn(...args) : fn;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
module.exports = plugins;
|
package/src/graphApi/GraphApi.js
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
'use strict';
|
|
5
5
|
|
|
6
6
|
const assert = require('assert');
|
|
7
|
-
const { graphql, buildSchema } = require('graphql');
|
|
8
7
|
const WingbotApiConnector = require('./WingbotApiConnector');
|
|
9
8
|
// @ts-ignore
|
|
10
9
|
const packageJson = require('../../package.json');
|
|
@@ -21,6 +20,7 @@ const DEFAULT_CACHE = 86400000; // 24 hours
|
|
|
21
20
|
*/
|
|
22
21
|
|
|
23
22
|
/** @typedef {import('../CallbackAuditLog')} AuditLog */
|
|
23
|
+
/** @typedef {import('graphql')} GqlLib */
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Experimental chatbot API
|
|
@@ -81,6 +81,19 @@ class GraphApi {
|
|
|
81
81
|
cacheKeys: opts.cacheKeys,
|
|
82
82
|
useBundledGql: opts.useBundledGql
|
|
83
83
|
});
|
|
84
|
+
|
|
85
|
+
this._lib = null;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* @returns {GqlLib}
|
|
90
|
+
*/
|
|
91
|
+
get _gql () {
|
|
92
|
+
if (this._lib === null) {
|
|
93
|
+
// eslint-disable-next-line global-require
|
|
94
|
+
this._lib = require('graphql');
|
|
95
|
+
}
|
|
96
|
+
return this._lib;
|
|
84
97
|
}
|
|
85
98
|
|
|
86
99
|
/**
|
|
@@ -139,8 +152,16 @@ class GraphApi {
|
|
|
139
152
|
audit
|
|
140
153
|
};
|
|
141
154
|
|
|
142
|
-
|
|
143
|
-
|
|
155
|
+
const response = await this._gql.graphql({
|
|
156
|
+
schema,
|
|
157
|
+
source: body.query,
|
|
158
|
+
rootValue: this._root,
|
|
159
|
+
contextValue: ctx,
|
|
160
|
+
variableValues: body.variables,
|
|
161
|
+
operationName: body.operationName
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
return response;
|
|
144
165
|
}
|
|
145
166
|
|
|
146
167
|
async _schema () {
|
|
@@ -151,7 +172,7 @@ class GraphApi {
|
|
|
151
172
|
|
|
152
173
|
if (!schemaIsSame) {
|
|
153
174
|
this._originalSchema = loadedSchema;
|
|
154
|
-
this._cachedSchema = buildSchema(loadedSchema);
|
|
175
|
+
this._cachedSchema = this._gql.buildSchema(loadedSchema);
|
|
155
176
|
}
|
|
156
177
|
return this._cachedSchema;
|
|
157
178
|
}
|