Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/wincloud_gateway/node_modules/graphql-tools/dist/generate/ drwxr-xr-x | |
| Viewing file: Select action/file-type: Object.defineProperty(exports, "__esModule", { value: true });
var graphql_1 = require("graphql");
var deprecated_decorator_1 = require("deprecated-decorator");
var _1 = require(".");
// takes a GraphQL-JS schema and an object of connectors, then attaches
// the connectors to the context by wrapping each query or mutation resolve
// function with a function that attaches connectors if they don't exist.
// attaches connectors only once to make sure they are singletons
var attachConnectorsToContext = deprecated_decorator_1.deprecated({
version: '0.7.0',
url: 'https://github.com/apollostack/graphql-tools/issues/140',
}, function (schema, connectors) {
if (!schema || !(schema instanceof graphql_1.GraphQLSchema)) {
throw new Error('schema must be an instance of GraphQLSchema. ' +
'This error could be caused by installing more than one version of GraphQL-JS');
}
if (typeof connectors !== 'object') {
var connectorType = typeof connectors;
throw new Error("Expected connectors to be of type object, got " + connectorType);
}
if (Object.keys(connectors).length === 0) {
throw new Error('Expected connectors to not be an empty object');
}
if (Array.isArray(connectors)) {
throw new Error('Expected connectors to be of type object, got Array');
}
if (schema['_apolloConnectorsAttached']) {
throw new Error('Connectors already attached to context, cannot attach more than once');
}
schema['_apolloConnectorsAttached'] = true;
var attachconnectorFn = function (root, args, ctx) {
if (typeof ctx !== 'object') {
// if in any way possible, we should throw an error when the attachconnectors
// function is called, not when a query is executed.
var contextType = typeof ctx;
throw new Error("Cannot attach connector because context is not an object: " + contextType);
}
if (typeof ctx.connectors === 'undefined') {
ctx.connectors = {};
}
Object.keys(connectors).forEach(function (connectorName) {
var connector = connectors[connectorName];
if (!!connector.prototype) {
ctx.connectors[connectorName] = new connector(ctx);
}
else {
throw new Error("Connector must be a function or an class");
}
});
return root;
};
_1.addSchemaLevelResolveFunction(schema, attachconnectorFn);
});
exports.default = attachConnectorsToContext;
//# sourceMappingURL=attachConnectorsToContext.js.map |
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0373 ]-- |