Initial Save
This commit is contained in:
15
node_modules/apollo-server-core/CHANGELOG.md
generated
vendored
Normal file
15
node_modules/apollo-server-core/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
# Changelog
|
||||
|
||||
### vNEXT
|
||||
|
||||
* `apollo-server-core`: Add persisted queries [PR#1149](https://github.com/apollographql/apollo-server/pull/1149)
|
||||
* `apollo-server-core`: added `BadUserInputError`
|
||||
* `apollo-server-core`: **breaking** gql is exported from gql-tag and ApolloServer requires a DocumentNode [PR#1146](https://github.com/apollographql/apollo-server/pull/1146)
|
||||
* `apollo-server-core`: accept `Request` object in `runQuery` [PR#1108](https://github.com/apollographql/apollo-server/pull/1108)
|
||||
* `apollo-server-core`: move query parse into runQuery and no longer accept GraphQL AST over the wire [PR#1097](https://github.com/apollographql/apollo-server/pull/1097)
|
||||
* `apollo-server-core`: custom errors allow instanceof checks [PR#1074](https://github.com/apollographql/apollo-server/pull/1074)
|
||||
* `apollo-server-core`: move subscriptions options into listen [PR#1059](https://github.com/apollographql/apollo-server/pull/1059)
|
||||
* `apollo-server-core`: Replace console.error with logFunction for opt-in logging [PR #1024](https://github.com/apollographql/apollo-server/pull/1024)
|
||||
* `apollo-server-core`: context creation can be async and errors are formatted to include error code [PR #1024](https://github.com/apollographql/apollo-server/pull/1024)
|
||||
* `apollo-server-core`: add `mocks` parameter to the base constructor(applies to all variants) [PR#1017](https://github.com/apollographql/apollo-server/pull/1017)
|
||||
* `apollo-server-core`: Remove printing of stack traces with `debug` option and include response in logging function[PR#1018](https://github.com/apollographql/apollo-server/pull/1018)
|
||||
21
node_modules/apollo-server-core/LICENSE
generated
vendored
Normal file
21
node_modules/apollo-server-core/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016-2020 Apollo Graph, Inc. (Formerly Meteor Development Group, Inc.)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
7
node_modules/apollo-server-core/README.md
generated
vendored
Normal file
7
node_modules/apollo-server-core/README.md
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
# apollo-server-core
|
||||
|
||||
[](https://badge.fury.io/js/apollo-server-core)
|
||||
[](https://circleci.com/gh/apollographql/apollo-server)
|
||||
|
||||
This is the core module of the Apollo community GraphQL Server. [Read the docs.](https://www.apollographql.com/docs/apollo-server/)
|
||||
[Read the CHANGELOG.](https://github.com/apollographql/apollo-server/blob/main/CHANGELOG.md)
|
||||
56
node_modules/apollo-server-core/dist/ApolloServer.d.ts
generated
vendored
Normal file
56
node_modules/apollo-server-core/dist/ApolloServer.d.ts
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
/// <reference types="node" />
|
||||
import { Server as HttpServer } from 'http';
|
||||
import { Http2Server, Http2SecureServer } from 'http2';
|
||||
import { Server as HttpsServer } from 'https';
|
||||
import { GraphQLSchema, DocumentNode } from 'graphql';
|
||||
import { ApolloServerPlugin } from 'apollo-server-plugin-base';
|
||||
import type WebSocket from 'ws';
|
||||
import { GraphQLServerOptions } from './graphqlOptions';
|
||||
import { Config, SubscriptionServerOptions, FileUploadOptions } from './types';
|
||||
import { PlaygroundRenderPageOptions } from './playground';
|
||||
import { GraphQLRequest } from './requestPipeline';
|
||||
export declare class ApolloServerBase {
|
||||
private logger;
|
||||
subscriptionsPath?: string;
|
||||
graphqlPath: string;
|
||||
requestOptions: Partial<GraphQLServerOptions<any>>;
|
||||
private context?;
|
||||
private apolloConfig;
|
||||
protected plugins: ApolloServerPlugin[];
|
||||
protected subscriptionServerOptions?: SubscriptionServerOptions;
|
||||
protected uploadsConfig?: FileUploadOptions;
|
||||
private disableUploadsIfSchemaDoesNotUseUploadScalar;
|
||||
private subscriptionServer?;
|
||||
protected playgroundOptions?: PlaygroundRenderPageOptions;
|
||||
private parseOptions;
|
||||
private config;
|
||||
private state;
|
||||
protected schema?: GraphQLSchema;
|
||||
private toDispose;
|
||||
private toDisposeLast;
|
||||
private experimental_approximateDocumentStoreMiB;
|
||||
constructor(config: Config);
|
||||
setGraphQLPath(path: string): void;
|
||||
start(): Promise<void>;
|
||||
protected _start(): Promise<void>;
|
||||
protected willStart(): Promise<void>;
|
||||
private ensureStarted;
|
||||
protected ensureStarting(): void;
|
||||
private logStartupError;
|
||||
private startGatewayAndLoadSchema;
|
||||
private constructSchema;
|
||||
private generateSchemaDerivedData;
|
||||
disableUploads(): boolean;
|
||||
stop(): Promise<void>;
|
||||
installSubscriptionHandlers(server: HttpServer | HttpsServer | Http2Server | Http2SecureServer | WebSocket.Server): void;
|
||||
protected supportsSubscriptions(): boolean;
|
||||
protected supportsUploads(): boolean;
|
||||
protected serverlessFramework(): boolean;
|
||||
private ensurePluginInstantiation;
|
||||
private initializeDocumentStore;
|
||||
protected graphQLServerOptions(integrationContextArgument?: Record<string, any>): Promise<GraphQLServerOptions>;
|
||||
executeOperation(request: Omit<GraphQLRequest, 'query'> & {
|
||||
query?: string | DocumentNode;
|
||||
}, integrationContextArgument?: Record<string, any>): Promise<import("apollo-server-types").GraphQLResponse>;
|
||||
}
|
||||
//# sourceMappingURL=ApolloServer.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/ApolloServer.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/ApolloServer.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ApolloServer.d.ts","sourceRoot":"","sources":["../src/ApolloServer.ts"],"names":[],"mappings":";AAOA,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,MAAM,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,OAAO,CAAC;AAE9C,OAAO,EAEL,aAAa,EAOb,YAAY,EAKb,MAAM,SAAS,CAAC;AAOjB,OAAO,EACL,kBAAkB,EAGnB,MAAM,2BAA2B,CAAC;AAQnC,OAAO,KAAK,SAAS,MAAM,IAAI,CAAC;AAGhC,OAAO,EAAE,oBAAoB,EAAyB,MAAM,kBAAkB,CAAC;AAE/E,OAAO,EACL,MAAM,EAGN,yBAAyB,EACzB,iBAAiB,EAGlB,MAAM,SAAS,CAAC;AAIjB,OAAO,EAEL,2BAA2B,EAC5B,MAAM,cAAc,CAAC;AAItB,OAAO,EAGL,cAAc,EAEf,MAAM,mBAAmB,CAAC;AA+E3B,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAAS;IAChB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAc;IACjC,cAAc,EAAE,OAAO,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAEvD;IAEF,OAAO,CAAC,OAAO,CAAC,CAA4B;IAC5C,OAAO,CAAC,YAAY,CAAe;IACnC,SAAS,CAAC,OAAO,EAAE,kBAAkB,EAAE,CAAM;IAE7C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,CAAC,cAAc,EAAE,OAAO,CAAC,GAAG;QACvC,KAAK,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;KAC/B,EACD,0BAA0B,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAwCnD"}
|
||||
776
node_modules/apollo-server-core/dist/ApolloServer.js
generated
vendored
Normal file
776
node_modules/apollo-server-core/dist/ApolloServer.js
generated
vendored
Normal file
@@ -0,0 +1,776 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __rest = (this && this.__rest) || function (s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ApolloServerBase = void 0;
|
||||
const graphql_tools_1 = require("graphql-tools");
|
||||
const net_1 = require("net");
|
||||
const tls_1 = require("tls");
|
||||
const loglevel_1 = __importDefault(require("loglevel"));
|
||||
const graphql_1 = require("graphql");
|
||||
const resolvable_1 = __importDefault(require("@josephg/resolvable"));
|
||||
const apollo_server_caching_1 = require("apollo-server-caching");
|
||||
const runtimeSupportsUploads_1 = __importDefault(require("./utils/runtimeSupportsUploads"));
|
||||
const apollo_server_errors_1 = require("apollo-server-errors");
|
||||
const index_1 = require("./index");
|
||||
const playground_1 = require("./playground");
|
||||
const schemaHash_1 = require("./utils/schemaHash");
|
||||
const isDirectiveDefined_1 = require("./utils/isDirectiveDefined");
|
||||
const requestPipeline_1 = require("./requestPipeline");
|
||||
const apollo_server_env_1 = require("apollo-server-env");
|
||||
const apollo_tools_1 = require("@apollographql/apollo-tools");
|
||||
const apollo_tracing_1 = require("apollo-tracing");
|
||||
const apollo_cache_control_1 = require("apollo-cache-control");
|
||||
const runHttpQuery_1 = require("./runHttpQuery");
|
||||
const isNodeLike_1 = __importDefault(require("./utils/isNodeLike"));
|
||||
const determineApolloConfig_1 = require("./determineApolloConfig");
|
||||
const plugin_1 = require("./plugin");
|
||||
const internalPlugin_1 = require("./plugin/internalPlugin");
|
||||
const NoIntrospection = (context) => ({
|
||||
Field(node) {
|
||||
if (node.name.value === '__schema' || node.name.value === '__type') {
|
||||
context.reportError(new graphql_1.GraphQLError('GraphQL introspection is not allowed by Apollo Server, but the query contained __schema or __type. To enable introspection, pass introspection: true to ApolloServer in production', [node]));
|
||||
}
|
||||
},
|
||||
});
|
||||
const forbidUploadsForTesting = process && process.env.NODE_ENV === 'test' && !runtimeSupportsUploads_1.default;
|
||||
function approximateObjectSize(obj) {
|
||||
return Buffer.byteLength(JSON.stringify(obj), 'utf8');
|
||||
}
|
||||
class UnreachableCaseError extends Error {
|
||||
constructor(val) {
|
||||
super(`Unreachable case: ${val}`);
|
||||
}
|
||||
}
|
||||
class ApolloServerBase {
|
||||
constructor(config) {
|
||||
this.graphqlPath = '/graphql';
|
||||
this.requestOptions = Object.create(null);
|
||||
this.plugins = [];
|
||||
this.toDispose = new Set();
|
||||
this.toDisposeLast = new Set();
|
||||
if (!config)
|
||||
throw new Error('ApolloServer requires options.');
|
||||
this.config = config;
|
||||
const { context, resolvers, schema, schemaDirectives, modules, typeDefs, parseOptions = {}, introspection, mocks, mockEntireSchema, extensions, subscriptions, uploads, playground, plugins, gateway, cacheControl, experimental_approximateDocumentStoreMiB, stopOnTerminationSignals, apollo, engine } = config, requestOptions = __rest(config, ["context", "resolvers", "schema", "schemaDirectives", "modules", "typeDefs", "parseOptions", "introspection", "mocks", "mockEntireSchema", "extensions", "subscriptions", "uploads", "playground", "plugins", "gateway", "cacheControl", "experimental_approximateDocumentStoreMiB", "stopOnTerminationSignals", "apollo", "engine"]);
|
||||
if (engine !== undefined && apollo) {
|
||||
throw new Error('You cannot provide both `engine` and `apollo` to `new ApolloServer()`. ' +
|
||||
'For details on how to migrate all of your options out of `engine`, see ' +
|
||||
'https://go.apollo.dev/s/migration-engine-plugins');
|
||||
}
|
||||
if (config.logger) {
|
||||
this.logger = config.logger;
|
||||
}
|
||||
else {
|
||||
const loglevelLogger = loglevel_1.default.getLogger('apollo-server');
|
||||
if (this.config.debug === true) {
|
||||
loglevelLogger.setLevel(loglevel_1.default.levels.DEBUG);
|
||||
}
|
||||
else {
|
||||
loglevelLogger.setLevel(loglevel_1.default.levels.INFO);
|
||||
}
|
||||
this.logger = loglevelLogger;
|
||||
}
|
||||
this.apolloConfig = determineApolloConfig_1.determineApolloConfig(apollo, engine, this.logger);
|
||||
if (gateway && (modules || schema || typeDefs || resolvers)) {
|
||||
throw new Error('Cannot define both `gateway` and any of: `modules`, `schema`, `typeDefs`, or `resolvers`');
|
||||
}
|
||||
this.parseOptions = parseOptions;
|
||||
this.context = context;
|
||||
const isDev = process.env.NODE_ENV !== 'production';
|
||||
if ((typeof introspection === 'boolean' && !introspection) ||
|
||||
(introspection === undefined && !isDev)) {
|
||||
const noIntro = [NoIntrospection];
|
||||
requestOptions.validationRules = requestOptions.validationRules
|
||||
? requestOptions.validationRules.concat(noIntro)
|
||||
: noIntro;
|
||||
}
|
||||
if (!requestOptions.cache) {
|
||||
requestOptions.cache = new apollo_server_caching_1.InMemoryLRUCache();
|
||||
}
|
||||
if (requestOptions.persistedQueries !== false) {
|
||||
const _a = requestOptions.persistedQueries || Object.create(null), { cache: apqCache = requestOptions.cache } = _a, apqOtherOptions = __rest(_a, ["cache"]);
|
||||
requestOptions.persistedQueries = Object.assign({ cache: new apollo_server_caching_1.PrefixingKeyValueCache(apqCache, requestPipeline_1.APQ_CACHE_PREFIX) }, apqOtherOptions);
|
||||
}
|
||||
else {
|
||||
delete requestOptions.persistedQueries;
|
||||
}
|
||||
this.requestOptions = requestOptions;
|
||||
this.disableUploadsIfSchemaDoesNotUseUploadScalar = false;
|
||||
if (uploads !== false && !forbidUploadsForTesting) {
|
||||
if (this.supportsUploads()) {
|
||||
if (!runtimeSupportsUploads_1.default) {
|
||||
printNodeFileUploadsMessage(this.logger);
|
||||
throw new Error('`graphql-upload` is no longer supported on Node.js < v8.5.0. ' +
|
||||
'See https://bit.ly/gql-upload-node-6.');
|
||||
}
|
||||
if (uploads === true) {
|
||||
this.uploadsConfig = {};
|
||||
warnAboutUploads(this.logger, false);
|
||||
}
|
||||
else if (typeof uploads === 'undefined') {
|
||||
this.uploadsConfig = {};
|
||||
this.disableUploadsIfSchemaDoesNotUseUploadScalar = true;
|
||||
}
|
||||
else {
|
||||
this.uploadsConfig = uploads;
|
||||
warnAboutUploads(this.logger, false);
|
||||
}
|
||||
}
|
||||
else if (uploads) {
|
||||
throw new Error('This implementation of ApolloServer does not support file uploads because the environment cannot accept multi-part forms');
|
||||
}
|
||||
}
|
||||
if (gateway && subscriptions !== false) {
|
||||
throw new Error([
|
||||
'Subscriptions are not yet compatible with the gateway.',
|
||||
"Set `subscriptions: false` in Apollo Server's constructor to",
|
||||
'explicitly disable subscriptions (which are on by default)',
|
||||
'and allow for gateway functionality.',
|
||||
].join(' '));
|
||||
}
|
||||
else if (subscriptions !== false) {
|
||||
if (this.supportsSubscriptions()) {
|
||||
if (subscriptions === true || typeof subscriptions === 'undefined') {
|
||||
this.subscriptionServerOptions = {
|
||||
path: this.graphqlPath,
|
||||
};
|
||||
}
|
||||
else if (typeof subscriptions === 'string') {
|
||||
this.subscriptionServerOptions = { path: subscriptions };
|
||||
}
|
||||
else {
|
||||
this.subscriptionServerOptions = Object.assign({ path: this.graphqlPath }, subscriptions);
|
||||
}
|
||||
this.subscriptionsPath = this.subscriptionServerOptions.path;
|
||||
}
|
||||
else if (subscriptions) {
|
||||
throw new Error('This implementation of ApolloServer does not support GraphQL subscriptions.');
|
||||
}
|
||||
}
|
||||
this.playgroundOptions = playground_1.createPlaygroundOptions(playground);
|
||||
this.ensurePluginInstantiation(plugins);
|
||||
if (typeof stopOnTerminationSignals === 'boolean'
|
||||
? stopOnTerminationSignals
|
||||
: typeof engine === 'object' &&
|
||||
typeof engine.handleSignals === 'boolean'
|
||||
? engine.handleSignals
|
||||
: isNodeLike_1.default && process.env.NODE_ENV !== 'test') {
|
||||
const signals = ['SIGINT', 'SIGTERM'];
|
||||
let receivedSignal = false;
|
||||
signals.forEach((signal) => {
|
||||
const handler = () => __awaiter(this, void 0, void 0, function* () {
|
||||
if (receivedSignal) {
|
||||
return;
|
||||
}
|
||||
receivedSignal = true;
|
||||
try {
|
||||
yield this.stop();
|
||||
}
|
||||
catch (e) {
|
||||
this.logger.error(`stop() threw during ${signal} shutdown`);
|
||||
this.logger.error(e);
|
||||
process.exit(1);
|
||||
}
|
||||
process.kill(process.pid, signal);
|
||||
});
|
||||
process.on(signal, handler);
|
||||
this.toDisposeLast.add(() => __awaiter(this, void 0, void 0, function* () {
|
||||
process.removeListener(signal, handler);
|
||||
}));
|
||||
});
|
||||
}
|
||||
if (gateway) {
|
||||
this.state = { phase: 'initialized with gateway', gateway };
|
||||
this.requestOptions.executor = gateway.executor;
|
||||
}
|
||||
else {
|
||||
this.state = {
|
||||
phase: 'initialized with schema',
|
||||
schemaDerivedData: this.generateSchemaDerivedData(this.constructSchema()),
|
||||
};
|
||||
this.schema = this.state.schemaDerivedData.schema;
|
||||
}
|
||||
if (this.serverlessFramework()) {
|
||||
this.ensureStarting();
|
||||
}
|
||||
}
|
||||
setGraphQLPath(path) {
|
||||
this.graphqlPath = path;
|
||||
}
|
||||
start() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (this.serverlessFramework()) {
|
||||
throw new Error('When using an ApolloServer subclass from a serverless framework ' +
|
||||
"package, you don't need to call start(); just call createHandler().");
|
||||
}
|
||||
return yield this._start();
|
||||
});
|
||||
}
|
||||
_start() {
|
||||
var _a;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const initialState = this.state;
|
||||
if (initialState.phase !== 'initialized with gateway' &&
|
||||
initialState.phase !== 'initialized with schema') {
|
||||
throw new Error(`called start() with surprising state ${initialState.phase}`);
|
||||
}
|
||||
const barrier = resolvable_1.default();
|
||||
this.state = { phase: 'starting', barrier };
|
||||
let loadedSchema = false;
|
||||
try {
|
||||
const schemaDerivedData = initialState.phase === 'initialized with schema'
|
||||
? initialState.schemaDerivedData
|
||||
: this.generateSchemaDerivedData(yield this.startGatewayAndLoadSchema(initialState.gateway));
|
||||
loadedSchema = true;
|
||||
this.state = {
|
||||
phase: 'invoking serverWillStart',
|
||||
barrier,
|
||||
schemaDerivedData,
|
||||
};
|
||||
const service = {
|
||||
logger: this.logger,
|
||||
schema: schemaDerivedData.schema,
|
||||
schemaHash: schemaDerivedData.schemaHash,
|
||||
apollo: this.apolloConfig,
|
||||
serverlessFramework: this.serverlessFramework(),
|
||||
engine: {
|
||||
serviceID: this.apolloConfig.graphId,
|
||||
apiKeyHash: this.apolloConfig.keyHash,
|
||||
},
|
||||
};
|
||||
if ((_a = this.requestOptions.persistedQueries) === null || _a === void 0 ? void 0 : _a.cache) {
|
||||
service.persistedQueries = {
|
||||
cache: this.requestOptions.persistedQueries.cache,
|
||||
};
|
||||
}
|
||||
const serverListeners = (yield Promise.all(this.plugins.map((plugin) => plugin.serverWillStart && plugin.serverWillStart(service)))).filter((maybeServerListener) => typeof maybeServerListener === 'object' &&
|
||||
!!maybeServerListener.serverWillStop);
|
||||
this.toDispose.add(() => __awaiter(this, void 0, void 0, function* () {
|
||||
yield Promise.all(serverListeners.map(({ serverWillStop }) => serverWillStop === null || serverWillStop === void 0 ? void 0 : serverWillStop()));
|
||||
}));
|
||||
this.state = { phase: 'started', schemaDerivedData };
|
||||
}
|
||||
catch (error) {
|
||||
this.state = { phase: 'failed to start', error, loadedSchema };
|
||||
throw error;
|
||||
}
|
||||
finally {
|
||||
barrier.resolve();
|
||||
}
|
||||
});
|
||||
}
|
||||
willStart() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
this.ensureStarting();
|
||||
});
|
||||
}
|
||||
ensureStarted() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
while (true) {
|
||||
switch (this.state.phase) {
|
||||
case 'initialized with gateway':
|
||||
case 'initialized with schema':
|
||||
try {
|
||||
yield this._start();
|
||||
}
|
||||
catch (_a) {
|
||||
}
|
||||
break;
|
||||
case 'starting':
|
||||
case 'invoking serverWillStart':
|
||||
yield this.state.barrier;
|
||||
break;
|
||||
case 'failed to start':
|
||||
this.logStartupError(this.state.error);
|
||||
throw new Error('This data graph is missing a valid configuration. More details may be available in the server logs.');
|
||||
case 'started':
|
||||
return this.state.schemaDerivedData;
|
||||
case 'stopping':
|
||||
throw new Error('Cannot execute GraphQL operations while the server is stopping.');
|
||||
case 'stopped':
|
||||
throw new Error('Cannot execute GraphQL operations after the server has stopped.');
|
||||
default:
|
||||
throw new UnreachableCaseError(this.state);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
ensureStarting() {
|
||||
if (this.state.phase === 'initialized with gateway' ||
|
||||
this.state.phase === 'initialized with schema') {
|
||||
this._start().catch((e) => this.logStartupError(e));
|
||||
}
|
||||
}
|
||||
logStartupError(err) {
|
||||
const prelude = this.serverlessFramework()
|
||||
? 'An error occurred during Apollo Server startup.'
|
||||
: 'Apollo Server was started implicitly and an error occurred during startup. ' +
|
||||
'(Consider calling `await server.start()` immediately after ' +
|
||||
'`server = new ApolloServer()` so you can handle these errors directly before ' +
|
||||
'starting your web server.)';
|
||||
this.logger.error(prelude +
|
||||
' All GraphQL requests will now fail. The startup error ' +
|
||||
'was: ' +
|
||||
((err && err.message) || err));
|
||||
}
|
||||
startGatewayAndLoadSchema(gateway) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const unsubscriber = gateway.onSchemaChange((schema) => {
|
||||
if (this.state.phase === 'started') {
|
||||
this.state.schemaDerivedData = this.generateSchemaDerivedData(schema);
|
||||
}
|
||||
});
|
||||
this.toDispose.add(() => __awaiter(this, void 0, void 0, function* () { return unsubscriber(); }));
|
||||
const engineConfig = this.apolloConfig.keyHash && this.apolloConfig.graphId
|
||||
? {
|
||||
apiKeyHash: this.apolloConfig.keyHash,
|
||||
graphId: this.apolloConfig.graphId,
|
||||
graphVariant: this.apolloConfig.graphVariant,
|
||||
}
|
||||
: undefined;
|
||||
const config = yield gateway.load({
|
||||
apollo: this.apolloConfig,
|
||||
engine: engineConfig,
|
||||
});
|
||||
this.toDispose.add(() => __awaiter(this, void 0, void 0, function* () { var _a; return yield ((_a = gateway.stop) === null || _a === void 0 ? void 0 : _a.call(gateway)); }));
|
||||
return config.schema;
|
||||
});
|
||||
}
|
||||
constructSchema() {
|
||||
const { schema, modules, typeDefs, resolvers, schemaDirectives, parseOptions, } = this.config;
|
||||
if (schema) {
|
||||
return schema;
|
||||
}
|
||||
if (modules) {
|
||||
const { schema, errors } = apollo_tools_1.buildServiceDefinition(modules);
|
||||
if (errors && errors.length > 0) {
|
||||
throw new Error(errors.map((error) => error.message).join('\n\n'));
|
||||
}
|
||||
return schema;
|
||||
}
|
||||
if (!typeDefs) {
|
||||
throw Error('Apollo Server requires either an existing schema, modules or typeDefs');
|
||||
}
|
||||
const augmentedTypeDefs = Array.isArray(typeDefs) ? typeDefs : [typeDefs];
|
||||
if (!isDirectiveDefined_1.isDirectiveDefined(augmentedTypeDefs, 'cacheControl')) {
|
||||
augmentedTypeDefs.push(index_1.gql `
|
||||
enum CacheControlScope {
|
||||
PUBLIC
|
||||
PRIVATE
|
||||
}
|
||||
|
||||
directive @cacheControl(
|
||||
maxAge: Int
|
||||
scope: CacheControlScope
|
||||
) on FIELD_DEFINITION | OBJECT | INTERFACE
|
||||
`);
|
||||
}
|
||||
if (this.uploadsConfig) {
|
||||
const { GraphQLUpload } = require('@apollographql/graphql-upload-8-fork');
|
||||
if (Array.isArray(resolvers)) {
|
||||
if (resolvers.every((resolver) => !resolver.Upload)) {
|
||||
resolvers.push({ Upload: GraphQLUpload });
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (resolvers && !resolvers.Upload) {
|
||||
resolvers.Upload = GraphQLUpload;
|
||||
}
|
||||
}
|
||||
augmentedTypeDefs.push(index_1.gql `
|
||||
scalar Upload
|
||||
`);
|
||||
}
|
||||
return graphql_tools_1.makeExecutableSchema({
|
||||
typeDefs: augmentedTypeDefs,
|
||||
schemaDirectives,
|
||||
resolvers,
|
||||
parseOptions,
|
||||
});
|
||||
}
|
||||
generateSchemaDerivedData(schema) {
|
||||
const schemaHash = schemaHash_1.generateSchemaHash(schema);
|
||||
const { mocks, mockEntireSchema, extensions: _extensions } = this.config;
|
||||
if (mocks || (typeof mockEntireSchema !== 'undefined' && mocks !== false)) {
|
||||
graphql_tools_1.addMockFunctionsToSchema({
|
||||
schema,
|
||||
mocks: typeof mocks === 'boolean' || typeof mocks === 'undefined'
|
||||
? {}
|
||||
: mocks,
|
||||
preserveResolvers: typeof mockEntireSchema === 'undefined' ? false : !mockEntireSchema,
|
||||
});
|
||||
}
|
||||
const extensions = [];
|
||||
extensions.push(...(_extensions || []));
|
||||
const documentStore = this.initializeDocumentStore();
|
||||
let disableUploads = false;
|
||||
if (this.disableUploadsIfSchemaDoesNotUseUploadScalar) {
|
||||
const ast = graphql_1.parse(graphql_1.printSchema(schema));
|
||||
disableUploads = true;
|
||||
graphql_1.visit(ast, {
|
||||
NamedType(node) {
|
||||
if (node.name.value === 'Upload') {
|
||||
disableUploads = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
if (!disableUploads) {
|
||||
warnAboutUploads(this.logger, true);
|
||||
}
|
||||
}
|
||||
return {
|
||||
schema,
|
||||
schemaHash,
|
||||
extensions,
|
||||
documentStore,
|
||||
disableUploads,
|
||||
};
|
||||
}
|
||||
disableUploads() {
|
||||
return this.state.phase !== 'started' || this.state.schemaDerivedData.disableUploads;
|
||||
}
|
||||
stop() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (this.state.phase === 'stopped') {
|
||||
if (this.state.stopError) {
|
||||
throw this.state.stopError;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (this.state.phase === 'stopping') {
|
||||
yield this.state.barrier;
|
||||
const state = this.state;
|
||||
if (state.phase !== 'stopped') {
|
||||
throw Error(`Surprising post-stopping state ${state.phase}`);
|
||||
}
|
||||
if (state.stopError) {
|
||||
throw state.stopError;
|
||||
}
|
||||
return;
|
||||
}
|
||||
this.state = { phase: 'stopping', barrier: resolvable_1.default() };
|
||||
try {
|
||||
yield Promise.all([...this.toDispose].map((dispose) => dispose()));
|
||||
if (this.subscriptionServer)
|
||||
this.subscriptionServer.close();
|
||||
yield Promise.all([...this.toDisposeLast].map((dispose) => dispose()));
|
||||
}
|
||||
catch (stopError) {
|
||||
this.state = { phase: 'stopped', stopError };
|
||||
return;
|
||||
}
|
||||
this.state = { phase: 'stopped', stopError: null };
|
||||
});
|
||||
}
|
||||
installSubscriptionHandlers(server) {
|
||||
if (!this.subscriptionServerOptions) {
|
||||
if (this.config.gateway) {
|
||||
throw Error('Subscriptions are not supported when operating as a gateway');
|
||||
}
|
||||
if (this.supportsSubscriptions()) {
|
||||
throw Error('Subscriptions are disabled, due to subscriptions set to false in the ApolloServer constructor');
|
||||
}
|
||||
else {
|
||||
throw Error('Subscriptions are not supported, choose an integration, such as apollo-server-express that allows persistent connections');
|
||||
}
|
||||
}
|
||||
const { SubscriptionServer } = require('subscriptions-transport-ws');
|
||||
const { onDisconnect, onConnect, keepAlive, path, } = this.subscriptionServerOptions;
|
||||
let schema;
|
||||
switch (this.state.phase) {
|
||||
case 'initialized with schema':
|
||||
case 'invoking serverWillStart':
|
||||
case 'started':
|
||||
schema = this.state.schemaDerivedData.schema;
|
||||
break;
|
||||
case 'initialized with gateway':
|
||||
case 'starting':
|
||||
case 'failed to start':
|
||||
case 'stopping':
|
||||
case 'stopped':
|
||||
throw new Error(`Can't install subscription handlers when state is ${this.state.phase}`);
|
||||
default:
|
||||
throw new UnreachableCaseError(this.state);
|
||||
}
|
||||
this.subscriptionServer = SubscriptionServer.create({
|
||||
schema,
|
||||
execute: graphql_1.execute,
|
||||
subscribe: graphql_1.subscribe,
|
||||
onConnect: onConnect
|
||||
? onConnect
|
||||
: (connectionParams) => (Object.assign({}, connectionParams)),
|
||||
onDisconnect: onDisconnect,
|
||||
onOperation: (message, connection) => __awaiter(this, void 0, void 0, function* () {
|
||||
connection.formatResponse = (value) => (Object.assign(Object.assign({}, value), { errors: value.errors &&
|
||||
apollo_server_errors_1.formatApolloErrors([...value.errors], {
|
||||
formatter: this.requestOptions.formatError,
|
||||
debug: this.requestOptions.debug,
|
||||
}) }));
|
||||
connection.formatError = this.requestOptions.formatError;
|
||||
let context = this.context ? this.context : { connection };
|
||||
try {
|
||||
context =
|
||||
typeof this.context === 'function'
|
||||
? yield this.context({ connection, payload: message.payload })
|
||||
: context;
|
||||
}
|
||||
catch (e) {
|
||||
throw apollo_server_errors_1.formatApolloErrors([e], {
|
||||
formatter: this.requestOptions.formatError,
|
||||
debug: this.requestOptions.debug,
|
||||
})[0];
|
||||
}
|
||||
return Object.assign(Object.assign({}, connection), { context });
|
||||
}),
|
||||
keepAlive,
|
||||
validationRules: this.requestOptions.validationRules,
|
||||
}, server instanceof net_1.Server || server instanceof tls_1.Server
|
||||
? {
|
||||
server,
|
||||
path,
|
||||
}
|
||||
: server);
|
||||
}
|
||||
supportsSubscriptions() {
|
||||
return false;
|
||||
}
|
||||
supportsUploads() {
|
||||
return false;
|
||||
}
|
||||
serverlessFramework() {
|
||||
return false;
|
||||
}
|
||||
ensurePluginInstantiation(plugins = []) {
|
||||
var _a, _b;
|
||||
const pluginsToInit = [];
|
||||
if (this.config.tracing) {
|
||||
pluginsToInit.push(apollo_tracing_1.plugin());
|
||||
}
|
||||
if (this.config.cacheControl !== false) {
|
||||
let cacheControlOptions = {};
|
||||
if (typeof this.config.cacheControl === 'boolean' &&
|
||||
this.config.cacheControl === true) {
|
||||
cacheControlOptions = {
|
||||
stripFormattedExtensions: false,
|
||||
calculateHttpHeaders: false,
|
||||
defaultMaxAge: 0,
|
||||
};
|
||||
}
|
||||
else {
|
||||
cacheControlOptions = Object.assign({ stripFormattedExtensions: true, calculateHttpHeaders: true, defaultMaxAge: 0 }, this.config.cacheControl);
|
||||
}
|
||||
pluginsToInit.push(apollo_cache_control_1.plugin(cacheControlOptions));
|
||||
}
|
||||
pluginsToInit.push(...plugins);
|
||||
this.plugins = pluginsToInit.map((plugin) => {
|
||||
if (typeof plugin === 'function') {
|
||||
return plugin();
|
||||
}
|
||||
return plugin;
|
||||
});
|
||||
const alreadyHavePluginWithInternalId = (id) => this.plugins.some((p) => internalPlugin_1.pluginIsInternal(p) && p.__internal_plugin_id__() === id);
|
||||
{
|
||||
const alreadyHavePlugin = alreadyHavePluginWithInternalId('UsageReporting');
|
||||
const { engine } = this.config;
|
||||
const disabledViaLegacyOption = engine === false ||
|
||||
(typeof engine === 'object' && engine.reportTiming === false);
|
||||
if (alreadyHavePlugin) {
|
||||
if (engine !== undefined) {
|
||||
throw Error("You can't combine the legacy `new ApolloServer({engine})` option with directly " +
|
||||
'creating an ApolloServerPluginUsageReporting plugin. See ' +
|
||||
'https://go.apollo.dev/s/migration-engine-plugins');
|
||||
}
|
||||
}
|
||||
else if (this.apolloConfig.key && !disabledViaLegacyOption) {
|
||||
this.plugins.unshift(typeof engine === 'object'
|
||||
? plugin_1.ApolloServerPluginUsageReportingFromLegacyOptions(engine)
|
||||
: plugin_1.ApolloServerPluginUsageReporting());
|
||||
}
|
||||
}
|
||||
{
|
||||
const alreadyHavePlugin = alreadyHavePluginWithInternalId('SchemaReporting');
|
||||
const enabledViaEnvVar = process.env.APOLLO_SCHEMA_REPORTING === 'true';
|
||||
const { engine } = this.config;
|
||||
const enabledViaLegacyOption = typeof engine === 'object' &&
|
||||
(engine.reportSchema || engine.experimental_schemaReporting);
|
||||
if (alreadyHavePlugin || enabledViaEnvVar || enabledViaLegacyOption) {
|
||||
if (this.config.gateway) {
|
||||
throw new Error([
|
||||
"Schema reporting is not yet compatible with the gateway. If you're",
|
||||
'interested in using schema reporting with the gateway, please',
|
||||
'contact Apollo support. To set up managed federation, see',
|
||||
'https://go.apollo.dev/s/managed-federation',
|
||||
].join(' '));
|
||||
}
|
||||
}
|
||||
if (alreadyHavePlugin) {
|
||||
if (engine !== undefined) {
|
||||
throw Error("You can't combine the legacy `new ApolloServer({engine})` option with directly " +
|
||||
'creating an ApolloServerPluginSchemaReporting plugin. See ' +
|
||||
'https://go.apollo.dev/s/migration-engine-plugins');
|
||||
}
|
||||
}
|
||||
else if (!this.apolloConfig.key) {
|
||||
if (enabledViaEnvVar) {
|
||||
throw new Error("You've enabled schema reporting by setting the APOLLO_SCHEMA_REPORTING " +
|
||||
'environment variable to true, but you also need to provide your ' +
|
||||
'Apollo API key, via the APOLLO_KEY environment ' +
|
||||
'variable or via `new ApolloServer({apollo: {key})');
|
||||
}
|
||||
if (enabledViaLegacyOption) {
|
||||
throw new Error("You've enabled schema reporting in the `engine` argument to `new ApolloServer()`, " +
|
||||
'but you also need to provide your Apollo API key, via the APOLLO_KEY environment ' +
|
||||
'variable or via `new ApolloServer({apollo: {key})');
|
||||
}
|
||||
}
|
||||
else if (enabledViaEnvVar || enabledViaLegacyOption) {
|
||||
const options = {};
|
||||
if (typeof engine === 'object') {
|
||||
options.initialDelayMaxMs = (_a = engine.schemaReportingInitialDelayMaxMs) !== null && _a !== void 0 ? _a : engine.experimental_schemaReportingInitialDelayMaxMs;
|
||||
options.overrideReportedSchema = (_b = engine.overrideReportedSchema) !== null && _b !== void 0 ? _b : engine.experimental_overrideReportedSchema;
|
||||
options.endpointUrl = engine.schemaReportingUrl;
|
||||
}
|
||||
this.plugins.push(plugin_1.ApolloServerPluginSchemaReporting(options));
|
||||
}
|
||||
}
|
||||
{
|
||||
const alreadyHavePlugin = alreadyHavePluginWithInternalId('InlineTrace');
|
||||
const { engine } = this.config;
|
||||
if (alreadyHavePlugin) {
|
||||
if (engine !== undefined) {
|
||||
throw Error("You can't combine the legacy `new ApolloServer({engine})` option with directly " +
|
||||
'creating an ApolloServerPluginInlineTrace plugin. See ' +
|
||||
'https://go.apollo.dev/s/migration-engine-plugins');
|
||||
}
|
||||
}
|
||||
else if (this.config.engine !== false) {
|
||||
const options = {
|
||||
__onlyIfSchemaIsFederated: true,
|
||||
};
|
||||
if (typeof engine === 'object') {
|
||||
options.rewriteError = engine.rewriteError;
|
||||
}
|
||||
this.plugins.push(plugin_1.ApolloServerPluginInlineTrace(options));
|
||||
}
|
||||
}
|
||||
}
|
||||
initializeDocumentStore() {
|
||||
return new apollo_server_caching_1.InMemoryLRUCache({
|
||||
maxSize: Math.pow(2, 20) * (this.experimental_approximateDocumentStoreMiB || 30),
|
||||
sizeCalculator: approximateObjectSize,
|
||||
});
|
||||
}
|
||||
graphQLServerOptions(integrationContextArgument) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const { schema, schemaHash, documentStore, extensions, } = yield this.ensureStarted();
|
||||
let context = this.context ? this.context : {};
|
||||
try {
|
||||
context =
|
||||
typeof this.context === 'function'
|
||||
? yield this.context(integrationContextArgument || {})
|
||||
: context;
|
||||
}
|
||||
catch (error) {
|
||||
context = () => {
|
||||
throw error;
|
||||
};
|
||||
}
|
||||
return Object.assign({ schema,
|
||||
schemaHash, logger: this.logger, plugins: this.plugins, documentStore,
|
||||
extensions,
|
||||
context, persistedQueries: this.requestOptions
|
||||
.persistedQueries, fieldResolver: this.requestOptions.fieldResolver, parseOptions: this.parseOptions }, this.requestOptions);
|
||||
});
|
||||
}
|
||||
executeOperation(request, integrationContextArgument) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const options = yield this.graphQLServerOptions(integrationContextArgument);
|
||||
if (typeof options.context === 'function') {
|
||||
options.context = options.context();
|
||||
}
|
||||
else if (typeof options.context === 'object') {
|
||||
options.context = runHttpQuery_1.cloneObject(options.context);
|
||||
}
|
||||
const requestCtx = {
|
||||
logger: this.logger,
|
||||
schema: options.schema,
|
||||
schemaHash: options.schemaHash,
|
||||
request: Object.assign(Object.assign({}, request), { query: request.query && typeof request.query !== 'string'
|
||||
? graphql_1.print(request.query)
|
||||
: request.query }),
|
||||
context: options.context || Object.create(null),
|
||||
cache: options.cache,
|
||||
metrics: {},
|
||||
response: {
|
||||
http: {
|
||||
headers: new apollo_server_env_1.Headers(),
|
||||
},
|
||||
},
|
||||
debug: options.debug,
|
||||
};
|
||||
return requestPipeline_1.processGraphQLRequest(options, requestCtx);
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.ApolloServerBase = ApolloServerBase;
|
||||
function printNodeFileUploadsMessage(logger) {
|
||||
logger.error([
|
||||
'*****************************************************************',
|
||||
'* *',
|
||||
'* ERROR! Manual intervention is necessary for Node.js < v8.5.0! *',
|
||||
'* *',
|
||||
'*****************************************************************',
|
||||
'',
|
||||
'The third-party `graphql-upload` package, which is used to implement',
|
||||
'file uploads in Apollo Server 2.x, no longer supports Node.js LTS',
|
||||
'versions prior to Node.js v8.5.0.',
|
||||
'',
|
||||
'Deployments which NEED file upload capabilities should update to',
|
||||
'Node.js >= v8.5.0 to continue using uploads.',
|
||||
'',
|
||||
'If this server DOES NOT NEED file uploads and wishes to continue',
|
||||
'using this version of Node.js, uploads can be disabled by adding:',
|
||||
'',
|
||||
' uploads: false,',
|
||||
'',
|
||||
'...to the options for Apollo Server and re-deploying the server.',
|
||||
'',
|
||||
'For more information, see https://bit.ly/gql-upload-node-6.',
|
||||
'',
|
||||
].join('\n'));
|
||||
}
|
||||
function warnAboutUploads(logger, implicit) {
|
||||
logger.error([
|
||||
'The third-party `graphql-upload` package is enabled in your server',
|
||||
(implicit
|
||||
? 'because you use the `Upload` scalar in your schema.'
|
||||
: 'because you explicitly enabled it with the `uploads` option.'),
|
||||
'This package is vulnerable to Cross-Site Request Forgery (CSRF) attacks.',
|
||||
'We recommend you either disable uploads if it is not a necessary part of',
|
||||
'your server, or upgrade to Apollo Server 3.7 and enable CSRF prevention.',
|
||||
'See https://go.apollo.dev/s/graphql-upload-csrf for more details.',
|
||||
].join('\n'));
|
||||
}
|
||||
//# sourceMappingURL=ApolloServer.js.map
|
||||
1
node_modules/apollo-server-core/dist/ApolloServer.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/ApolloServer.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
4
node_modules/apollo-server-core/dist/determineApolloConfig.d.ts
generated
vendored
Normal file
4
node_modules/apollo-server-core/dist/determineApolloConfig.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import { ApolloConfig, ApolloConfigInput, Logger } from 'apollo-server-types';
|
||||
import type { EngineReportingOptions } from './plugin';
|
||||
export declare function determineApolloConfig(input: ApolloConfigInput | undefined, engine: EngineReportingOptions<any> | boolean | undefined, logger: Logger): ApolloConfig;
|
||||
//# sourceMappingURL=determineApolloConfig.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/determineApolloConfig.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/determineApolloConfig.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"determineApolloConfig.d.ts","sourceRoot":"","sources":["../src/determineApolloConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE9E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AASvD,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,iBAAiB,GAAG,SAAS,EAGpC,MAAM,EAAE,sBAAsB,CAAC,GAAG,CAAC,GAAG,OAAO,GAAG,SAAS,EACzD,MAAM,EAAE,MAAM,GACb,YAAY,CAwJd"}
|
||||
129
node_modules/apollo-server-core/dist/determineApolloConfig.js
generated
vendored
Normal file
129
node_modules/apollo-server-core/dist/determineApolloConfig.js
generated
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.determineApolloConfig = void 0;
|
||||
const createSHA_1 = __importDefault(require("./utils/createSHA"));
|
||||
function determineApolloConfig(input, engine, logger) {
|
||||
var _a, _b;
|
||||
if (input && engine !== undefined) {
|
||||
throw Error('Cannot pass both `apollo` and `engine`');
|
||||
}
|
||||
const apolloConfig = {};
|
||||
const { APOLLO_KEY, APOLLO_GRAPH_REF, APOLLO_GRAPH_ID, APOLLO_GRAPH_VARIANT, ENGINE_API_KEY, ENGINE_SCHEMA_TAG, } = process.env;
|
||||
if (input === null || input === void 0 ? void 0 : input.key) {
|
||||
apolloConfig.key = input.key.trim();
|
||||
}
|
||||
else if (typeof engine === 'object' && engine.apiKey) {
|
||||
apolloConfig.key = engine.apiKey.trim();
|
||||
}
|
||||
else if (APOLLO_KEY) {
|
||||
if (ENGINE_API_KEY) {
|
||||
logger.warn('Using `APOLLO_KEY` since `ENGINE_API_KEY` (deprecated) is also set in the environment.');
|
||||
}
|
||||
apolloConfig.key = APOLLO_KEY.trim();
|
||||
}
|
||||
else if (ENGINE_API_KEY) {
|
||||
logger.warn('[deprecated] The `ENGINE_API_KEY` environment variable has been renamed to `APOLLO_KEY`.');
|
||||
apolloConfig.key = ENGINE_API_KEY.trim();
|
||||
}
|
||||
if (((_b = (_a = input === null || input === void 0 ? void 0 : input.key) !== null && _a !== void 0 ? _a : APOLLO_KEY) !== null && _b !== void 0 ? _b : ENGINE_API_KEY) !== apolloConfig.key) {
|
||||
logger.warn('The provided API key has unexpected leading or trailing whitespace. ' +
|
||||
'Apollo Server will trim the key value before use.');
|
||||
}
|
||||
if (apolloConfig.key) {
|
||||
assertValidHeaderValue(apolloConfig.key);
|
||||
}
|
||||
if (apolloConfig.key) {
|
||||
apolloConfig.keyHash = createSHA_1.default('sha512')
|
||||
.update(apolloConfig.key)
|
||||
.digest('hex');
|
||||
}
|
||||
if (input === null || input === void 0 ? void 0 : input.graphRef) {
|
||||
apolloConfig.graphRef = input.graphRef;
|
||||
}
|
||||
else if (APOLLO_GRAPH_REF) {
|
||||
apolloConfig.graphRef = APOLLO_GRAPH_REF;
|
||||
}
|
||||
if (input === null || input === void 0 ? void 0 : input.graphId) {
|
||||
apolloConfig.graphId = input.graphId;
|
||||
}
|
||||
else if (APOLLO_GRAPH_ID) {
|
||||
apolloConfig.graphId = APOLLO_GRAPH_ID;
|
||||
}
|
||||
if (input === null || input === void 0 ? void 0 : input.graphVariant) {
|
||||
apolloConfig.graphVariant = input.graphVariant;
|
||||
}
|
||||
else if (typeof engine === 'object' && engine.graphVariant) {
|
||||
if (engine.schemaTag) {
|
||||
throw new Error('Cannot set more than one of apollo.graphVariant, ' +
|
||||
'engine.graphVariant, and engine.schemaTag. Please use apollo.graphVariant.');
|
||||
}
|
||||
apolloConfig.graphVariant = engine.graphVariant;
|
||||
}
|
||||
else if (typeof engine === 'object' && engine.schemaTag) {
|
||||
logger.warn('[deprecated] The `engine.schemaTag` option has been renamed to `apollo.graphVariant` ' +
|
||||
'(or you may set it with the `APOLLO_GRAPH_VARIANT` environment variable).');
|
||||
apolloConfig.graphVariant = engine.schemaTag;
|
||||
}
|
||||
else if (APOLLO_GRAPH_VARIANT) {
|
||||
if (ENGINE_SCHEMA_TAG) {
|
||||
throw new Error('`APOLLO_GRAPH_VARIANT` and `ENGINE_SCHEMA_TAG` (deprecated) environment variables must not both be set.');
|
||||
}
|
||||
apolloConfig.graphVariant = APOLLO_GRAPH_VARIANT;
|
||||
}
|
||||
else if (ENGINE_SCHEMA_TAG) {
|
||||
logger.warn('[deprecated] The `ENGINE_SCHEMA_TAG` environment variable has been renamed to `APOLLO_GRAPH_VARIANT`.');
|
||||
apolloConfig.graphVariant = ENGINE_SCHEMA_TAG;
|
||||
}
|
||||
if (apolloConfig.graphRef) {
|
||||
if (apolloConfig.graphId) {
|
||||
throw new Error('Cannot specify both graph ref and graph ID. Please use ' +
|
||||
'`apollo.graphRef` or `APOLLO_GRAPH_REF` without also setting the graph ID.');
|
||||
}
|
||||
if (apolloConfig.graphVariant) {
|
||||
throw new Error('Cannot specify both graph ref and graph variant. Please use ' +
|
||||
'`apollo.graphRef` or `APOLLO_GRAPH_REF` without also setting the graph ID.');
|
||||
}
|
||||
const at = apolloConfig.graphRef.indexOf('@');
|
||||
if (at === -1) {
|
||||
apolloConfig.graphId = apolloConfig.graphRef;
|
||||
apolloConfig.graphVariant = 'current';
|
||||
}
|
||||
else {
|
||||
apolloConfig.graphId = apolloConfig.graphRef.substring(0, at);
|
||||
apolloConfig.graphVariant = apolloConfig.graphRef.substring(at + 1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!apolloConfig.graphId && apolloConfig.key) {
|
||||
const parts = apolloConfig.key.split(':', 2);
|
||||
if (parts[0] === 'service') {
|
||||
apolloConfig.graphId = parts[1];
|
||||
}
|
||||
else {
|
||||
throw Error('You have specified an API key in `apollo.key` or `APOLLO_KEY`, ' +
|
||||
'but you have not specified your graph ref or graph ID and the key ' +
|
||||
'does not start with `service:`. Please specify your graph ref; for ' +
|
||||
'example, set `APOLLO_GRAPH_REF` to `my-graph-id@my-graph-variant`.');
|
||||
}
|
||||
}
|
||||
if (!apolloConfig.graphVariant) {
|
||||
apolloConfig.graphVariant = 'current';
|
||||
}
|
||||
if (apolloConfig.graphId) {
|
||||
apolloConfig.graphRef = `${apolloConfig.graphId}@${apolloConfig.graphVariant}`;
|
||||
}
|
||||
}
|
||||
return apolloConfig;
|
||||
}
|
||||
exports.determineApolloConfig = determineApolloConfig;
|
||||
function assertValidHeaderValue(value) {
|
||||
const invalidHeaderCharRegex = /[^\t\x20-\x7e\x80-\xff]/g;
|
||||
if (invalidHeaderCharRegex.test(value)) {
|
||||
const invalidChars = value.match(invalidHeaderCharRegex);
|
||||
throw new Error(`The API key provided to Apollo Server contains characters which are invalid as HTTP header values. The following characters found in the key are invalid: ${invalidChars.join(', ')}. Valid header values may only contain ASCII visible characters. If you think there is an issue with your key, please contact Apollo support.`);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=determineApolloConfig.js.map
|
||||
1
node_modules/apollo-server-core/dist/determineApolloConfig.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/determineApolloConfig.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"determineApolloConfig.js","sourceRoot":"","sources":["../src/determineApolloConfig.ts"],"names":[],"mappings":";;;;;;AACA,kEAA0C;AAU1C,SAAgB,qBAAqB,CACnC,KAAoC,EAGpC,MAAyD,EACzD,MAAc;;IAEd,IAAI,KAAK,IAAI,MAAM,KAAK,SAAS,EAAE;QAEjC,MAAM,KAAK,CAAC,wCAAwC,CAAC,CAAC;KACvD;IACD,MAAM,YAAY,GAA0B,EAAE,CAAC;IAE/C,MAAM,EACJ,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EAEpB,cAAc,EACd,iBAAiB,GAClB,GAAG,OAAO,CAAC,GAAG,CAAC;IAGhB,IAAI,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,GAAG,EAAE;QACd,YAAY,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;KACrC;SAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,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ACb,6JAA6J,YAAY,CAAC,IAAI,CAC5K,IAAI,CACL,+IAA+I,CACjJ,CAAC;KACH;AACH,CAAC"}
|
||||
40
node_modules/apollo-server-core/dist/graphqlOptions.d.ts
generated
vendored
Normal file
40
node_modules/apollo-server-core/dist/graphqlOptions.d.ts
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
import { GraphQLSchema, ValidationContext, GraphQLFieldResolver, DocumentNode, GraphQLError, GraphQLFormattedError } from 'graphql';
|
||||
import { GraphQLExtension } from 'graphql-extensions';
|
||||
import { CacheControlExtensionOptions } from 'apollo-cache-control';
|
||||
import { KeyValueCache, InMemoryLRUCache } from 'apollo-server-caching';
|
||||
import { DataSource } from 'apollo-datasource';
|
||||
import { ApolloServerPlugin } from 'apollo-server-plugin-base';
|
||||
import { GraphQLParseOptions } from 'graphql-tools';
|
||||
import { GraphQLExecutor, ValueOrPromise, GraphQLResponse, GraphQLRequestContext, Logger, SchemaHash } from 'apollo-server-types';
|
||||
export interface GraphQLServerOptions<TContext = Record<string, any>, TRootValue = any> {
|
||||
schema: GraphQLSchema;
|
||||
schemaHash: SchemaHash;
|
||||
logger?: Logger;
|
||||
formatError?: (error: GraphQLError) => GraphQLFormattedError;
|
||||
rootValue?: ((parsedQuery: DocumentNode) => TRootValue) | TRootValue;
|
||||
context?: TContext | (() => never);
|
||||
validationRules?: Array<(context: ValidationContext) => any>;
|
||||
executor?: GraphQLExecutor;
|
||||
formatResponse?: (response: GraphQLResponse, requestContext: GraphQLRequestContext<TContext>) => GraphQLResponse | null;
|
||||
fieldResolver?: GraphQLFieldResolver<any, TContext>;
|
||||
debug?: boolean;
|
||||
tracing?: boolean;
|
||||
cacheControl?: CacheControlExtensionOptions;
|
||||
extensions?: Array<() => GraphQLExtension>;
|
||||
dataSources?: () => DataSources<TContext>;
|
||||
cache?: KeyValueCache;
|
||||
persistedQueries?: PersistedQueryOptions;
|
||||
plugins?: ApolloServerPlugin[];
|
||||
documentStore?: InMemoryLRUCache<DocumentNode>;
|
||||
parseOptions?: GraphQLParseOptions;
|
||||
}
|
||||
export declare type DataSources<TContext> = {
|
||||
[name: string]: DataSource<TContext>;
|
||||
};
|
||||
export interface PersistedQueryOptions {
|
||||
cache?: KeyValueCache;
|
||||
ttl?: number | null;
|
||||
}
|
||||
export default GraphQLServerOptions;
|
||||
export declare function resolveGraphqlOptions(options: GraphQLServerOptions | ((...args: Array<any>) => ValueOrPromise<GraphQLServerOptions>), ...args: Array<any>): Promise<GraphQLServerOptions>;
|
||||
//# sourceMappingURL=graphqlOptions.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/graphqlOptions.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/graphqlOptions.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"graphqlOptions.d.ts","sourceRoot":"","sources":["../src/graphqlOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,oBAAoB,EACpB,YAAY,EACZ,YAAY,EACZ,qBAAqB,EACtB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EACL,eAAe,EACf,cAAc,EACd,eAAe,EACf,qBAAqB,EACrB,MAAM,EACN,UAAU,EACX,MAAM,qBAAqB,CAAC;AAkB7B,MAAM,WAAW,oBAAoB,CACnC,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC9B,UAAU,GAAG,GAAG;IAEhB,MAAM,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qBAAqB;IACpC,KAAK,CAAC,EAAE,aAAa,CAAC;IAQtB,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED,eAAe,oBAAoB,CAAC;AAEpC,wBAAsB,qBAAqB,CACzC,OAAO,EACH,oBAAoB,GACpB,CAAC,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,cAAc,CAAC,oBAAoB,CAAC,CAAC,EACnE,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,GAClB,OAAO,CAAC,oBAAoB,CAAC,CAM/B"}
|
||||
24
node_modules/apollo-server-core/dist/graphqlOptions.js
generated
vendored
Normal file
24
node_modules/apollo-server-core/dist/graphqlOptions.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.resolveGraphqlOptions = void 0;
|
||||
function resolveGraphqlOptions(options, ...args) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (typeof options === 'function') {
|
||||
return yield options(...args);
|
||||
}
|
||||
else {
|
||||
return options;
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.resolveGraphqlOptions = resolveGraphqlOptions;
|
||||
//# sourceMappingURL=graphqlOptions.js.map
|
||||
1
node_modules/apollo-server-core/dist/graphqlOptions.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/graphqlOptions.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"graphqlOptions.js","sourceRoot":"","sources":["../src/graphqlOptions.ts"],"names":[],"mappings":";;;;;;;;;;;;AAsFA,SAAsB,qBAAqB,CACzC,OAEmE,EACnE,GAAG,IAAgB;;QAEnB,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE;YACjC,OAAO,MAAM,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;SAC/B;aAAM;YACL,OAAO,OAAO,CAAC;SAChB;IACH,CAAC;CAAA;AAXD,sDAWC"}
|
||||
16
node_modules/apollo-server-core/dist/index.d.ts
generated
vendored
Normal file
16
node_modules/apollo-server-core/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import 'apollo-server-env';
|
||||
export { runHttpQuery, HttpQueryRequest, HttpQueryError } from './runHttpQuery';
|
||||
export { default as GraphQLOptions, resolveGraphqlOptions, PersistedQueryOptions, } from './graphqlOptions';
|
||||
export { ApolloError, toApolloError, SyntaxError, ValidationError, AuthenticationError, ForbiddenError, UserInputError, formatApolloErrors, } from 'apollo-server-errors';
|
||||
export { convertNodeHttpToRequest } from './nodeHttpToRequest';
|
||||
export { createPlaygroundOptions, PlaygroundConfig, defaultPlaygroundOptions, PlaygroundRenderPageOptions, } from './playground';
|
||||
export { ApolloServerBase } from './ApolloServer';
|
||||
export * from './types';
|
||||
export * from './requestPipelineAPI';
|
||||
import { DocumentNode } from 'graphql';
|
||||
export declare const gql: (template: TemplateStringsArray | string, ...substitutions: any[]) => DocumentNode;
|
||||
import { GraphQLScalarType } from 'graphql';
|
||||
export { default as processFileUploads } from './processFileUploads';
|
||||
export declare const GraphQLUpload: GraphQLScalarType | undefined;
|
||||
export * from './plugin';
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/index.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAC;AAE3B,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhF,OAAO,EACL,OAAO,IAAI,cAAc,EACzB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,WAAW,EACX,aAAa,EACb,WAAW,EACX,eAAe,EACf,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAE/D,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EAChB,wBAAwB,EACxB,2BAA2B,GAC5B,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,cAAc,SAAS,CAAC;AACxB,cAAc,sBAAsB,CAAC;AAIrC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,eAAO,MAAM,GAAG,EAAE,CAChB,QAAQ,EAAE,oBAAoB,GAAG,MAAM,EACvC,GAAG,aAAa,EAAE,GAAG,EAAE,KACpB,YAAqB,CAAC;AAG3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAUrE,eAAO,MAAM,aAAa,+BAGb,CAAC;AAEd,cAAc,UAAU,CAAC"}
|
||||
51
node_modules/apollo-server-core/dist/index.js
generated
vendored
Normal file
51
node_modules/apollo-server-core/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.GraphQLUpload = exports.gql = void 0;
|
||||
require("apollo-server-env");
|
||||
var runHttpQuery_1 = require("./runHttpQuery");
|
||||
Object.defineProperty(exports, "runHttpQuery", { enumerable: true, get: function () { return runHttpQuery_1.runHttpQuery; } });
|
||||
Object.defineProperty(exports, "HttpQueryError", { enumerable: true, get: function () { return runHttpQuery_1.HttpQueryError; } });
|
||||
var graphqlOptions_1 = require("./graphqlOptions");
|
||||
Object.defineProperty(exports, "resolveGraphqlOptions", { enumerable: true, get: function () { return graphqlOptions_1.resolveGraphqlOptions; } });
|
||||
var apollo_server_errors_1 = require("apollo-server-errors");
|
||||
Object.defineProperty(exports, "ApolloError", { enumerable: true, get: function () { return apollo_server_errors_1.ApolloError; } });
|
||||
Object.defineProperty(exports, "toApolloError", { enumerable: true, get: function () { return apollo_server_errors_1.toApolloError; } });
|
||||
Object.defineProperty(exports, "SyntaxError", { enumerable: true, get: function () { return apollo_server_errors_1.SyntaxError; } });
|
||||
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return apollo_server_errors_1.ValidationError; } });
|
||||
Object.defineProperty(exports, "AuthenticationError", { enumerable: true, get: function () { return apollo_server_errors_1.AuthenticationError; } });
|
||||
Object.defineProperty(exports, "ForbiddenError", { enumerable: true, get: function () { return apollo_server_errors_1.ForbiddenError; } });
|
||||
Object.defineProperty(exports, "UserInputError", { enumerable: true, get: function () { return apollo_server_errors_1.UserInputError; } });
|
||||
Object.defineProperty(exports, "formatApolloErrors", { enumerable: true, get: function () { return apollo_server_errors_1.formatApolloErrors; } });
|
||||
var nodeHttpToRequest_1 = require("./nodeHttpToRequest");
|
||||
Object.defineProperty(exports, "convertNodeHttpToRequest", { enumerable: true, get: function () { return nodeHttpToRequest_1.convertNodeHttpToRequest; } });
|
||||
var playground_1 = require("./playground");
|
||||
Object.defineProperty(exports, "createPlaygroundOptions", { enumerable: true, get: function () { return playground_1.createPlaygroundOptions; } });
|
||||
Object.defineProperty(exports, "defaultPlaygroundOptions", { enumerable: true, get: function () { return playground_1.defaultPlaygroundOptions; } });
|
||||
var ApolloServer_1 = require("./ApolloServer");
|
||||
Object.defineProperty(exports, "ApolloServerBase", { enumerable: true, get: function () { return ApolloServer_1.ApolloServerBase; } });
|
||||
__exportStar(require("./types"), exports);
|
||||
__exportStar(require("./requestPipelineAPI"), exports);
|
||||
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
||||
exports.gql = graphql_tag_1.default;
|
||||
const runtimeSupportsUploads_1 = __importDefault(require("./utils/runtimeSupportsUploads"));
|
||||
var processFileUploads_1 = require("./processFileUploads");
|
||||
Object.defineProperty(exports, "processFileUploads", { enumerable: true, get: function () { return processFileUploads_1.default; } });
|
||||
exports.GraphQLUpload = runtimeSupportsUploads_1.default
|
||||
? require('@apollographql/graphql-upload-8-fork')
|
||||
.GraphQLUpload
|
||||
: undefined;
|
||||
__exportStar(require("./plugin"), exports);
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/apollo-server-core/dist/index.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6BAA2B;AAE3B,+CAAgF;AAAvE,4GAAA,YAAY,OAAA;AAAoB,8GAAA,cAAc,OAAA;AAEvD,mDAI0B;AAFxB,uHAAA,qBAAqB,OAAA;AAIvB,6DAS8B;AAR5B,mHAAA,WAAW,OAAA;AACX,qHAAA,aAAa,OAAA;AACb,mHAAA,WAAW,OAAA;AACX,uHAAA,eAAe,OAAA;AACf,2HAAA,mBAAmB,OAAA;AACnB,sHAAA,cAAc,OAAA;AACd,sHAAA,cAAc,OAAA;AACd,0HAAA,kBAAkB,OAAA;AAGpB,yDAA+D;AAAtD,6HAAA,wBAAwB,OAAA;AAEjC,2CAKsB;AAJpB,qHAAA,uBAAuB,OAAA;AAEvB,sHAAA,wBAAwB,OAAA;AAK1B,+CAAkD;AAAzC,gHAAA,gBAAgB,OAAA;AACzB,0CAAwB;AACxB,uDAAqC;AAKrC,8DAAiC;AACpB,QAAA,GAAG,GAGI,qBAAM,CAAC;AAE3B,4FAAoE;AAEpE,2DAAqE;AAA5D,wHAAA,OAAO,OAAsB;AAUzB,QAAA,aAAa,GAAG,gCAAsB;IACjD,CAAC,CAAE,OAAO,CAAC,sCAAsC,CAAC;SAC7C,aAAmC;IACxC,CAAC,CAAC,SAAS,CAAC;AAEd,2CAAyB"}
|
||||
5
node_modules/apollo-server-core/dist/nodeHttpToRequest.d.ts
generated
vendored
Normal file
5
node_modules/apollo-server-core/dist/nodeHttpToRequest.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/// <reference types="node" />
|
||||
import { IncomingMessage } from 'http';
|
||||
import { Request } from 'apollo-server-env';
|
||||
export declare function convertNodeHttpToRequest(req: IncomingMessage): Request;
|
||||
//# sourceMappingURL=nodeHttpToRequest.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/nodeHttpToRequest.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/nodeHttpToRequest.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"nodeHttpToRequest.d.ts","sourceRoot":"","sources":["../src/nodeHttpToRequest.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,EAAE,OAAO,EAAW,MAAM,mBAAmB,CAAC;AAErD,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,eAAe,GAAG,OAAO,CAetE"}
|
||||
22
node_modules/apollo-server-core/dist/nodeHttpToRequest.js
generated
vendored
Normal file
22
node_modules/apollo-server-core/dist/nodeHttpToRequest.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.convertNodeHttpToRequest = void 0;
|
||||
const apollo_server_env_1 = require("apollo-server-env");
|
||||
function convertNodeHttpToRequest(req) {
|
||||
const headers = new apollo_server_env_1.Headers();
|
||||
Object.keys(req.headers).forEach(key => {
|
||||
const values = req.headers[key];
|
||||
if (Array.isArray(values)) {
|
||||
values.forEach(value => headers.append(key, value));
|
||||
}
|
||||
else {
|
||||
headers.append(key, values);
|
||||
}
|
||||
});
|
||||
return new apollo_server_env_1.Request(req.url, {
|
||||
headers,
|
||||
method: req.method,
|
||||
});
|
||||
}
|
||||
exports.convertNodeHttpToRequest = convertNodeHttpToRequest;
|
||||
//# sourceMappingURL=nodeHttpToRequest.js.map
|
||||
1
node_modules/apollo-server-core/dist/nodeHttpToRequest.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/nodeHttpToRequest.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"nodeHttpToRequest.js","sourceRoot":"","sources":["../src/nodeHttpToRequest.ts"],"names":[],"mappings":";;;AACA,yDAAqD;AAErD,SAAgB,wBAAwB,CAAC,GAAoB;IAC3D,MAAM,OAAO,GAAG,IAAI,2BAAO,EAAE,CAAC;IAC9B,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QACrC,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAE,CAAC;QACjC,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;YACzB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;SACrD;aAAM;YACL,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;SAC7B;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,IAAI,2BAAO,CAAC,GAAG,CAAC,GAAI,EAAE;QAC3B,OAAO;QACP,MAAM,EAAE,GAAG,CAAC,MAAM;KACnB,CAAC,CAAC;AACL,CAAC;AAfD,4DAeC"}
|
||||
22
node_modules/apollo-server-core/dist/playground.d.ts
generated
vendored
Normal file
22
node_modules/apollo-server-core/dist/playground.d.ts
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
import { CursorShape, RenderPageOptions as PlaygroundRenderPageOptions, Theme } from '@apollographql/graphql-playground-html/dist/render-playground-page';
|
||||
export { RenderPageOptions as PlaygroundRenderPageOptions, } from '@apollographql/graphql-playground-html/dist/render-playground-page';
|
||||
declare type RecursivePartial<T> = {
|
||||
[P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends (object | undefined) ? RecursivePartial<T[P]> : T[P];
|
||||
};
|
||||
export declare type PlaygroundConfig = RecursivePartial<PlaygroundRenderPageOptions> | boolean;
|
||||
export declare const defaultPlaygroundOptions: {
|
||||
version: string;
|
||||
settings: {
|
||||
'general.betaUpdates': boolean;
|
||||
'editor.theme': Theme;
|
||||
'editor.cursorShape': CursorShape;
|
||||
'editor.reuseHeaders': boolean;
|
||||
'tracing.hideTracingResponse': boolean;
|
||||
'queryPlan.hideQueryPlanResponse': boolean;
|
||||
'editor.fontSize': number;
|
||||
'editor.fontFamily': string;
|
||||
'request.credentials': string;
|
||||
};
|
||||
};
|
||||
export declare function createPlaygroundOptions(playground?: PlaygroundConfig): PlaygroundRenderPageOptions | undefined;
|
||||
//# sourceMappingURL=playground.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/playground.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/playground.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../src/playground.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,iBAAiB,IAAI,2BAA2B,EAChD,KAAK,EACN,MAAM,oEAAoE,CAAC;AAC5E,OAAO,EACL,iBAAiB,IAAI,2BAA2B,GACjD,MAAM,oEAAoE,CAAC;AAe5E,aAAK,gBAAgB,CAAC,CAAC,IAAI;KACxB,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GACrC,gBAAgB,CAAC,CAAC,CAAC,EAAE,GACrB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC,GACjC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GACtB,CAAC,CAAC,CAAC,CAAC;CACT,CAAC;AAEF,oBAAY,gBAAgB,GACxB,gBAAgB,CAAC,2BAA2B,CAAC,GAC7C,OAAO,CAAC;AAEZ,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;CAapC,CAAC;AAEF,wBAAgB,uBAAuB,CACrC,UAAU,CAAC,EAAE,gBAAgB,GAC5B,2BAA2B,GAAG,SAAS,CA4BzC"}
|
||||
35
node_modules/apollo-server-core/dist/playground.js
generated
vendored
Normal file
35
node_modules/apollo-server-core/dist/playground.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.createPlaygroundOptions = exports.defaultPlaygroundOptions = void 0;
|
||||
const playgroundVersion = '1.7.42';
|
||||
exports.defaultPlaygroundOptions = {
|
||||
version: playgroundVersion,
|
||||
settings: {
|
||||
'general.betaUpdates': false,
|
||||
'editor.theme': 'dark',
|
||||
'editor.cursorShape': 'line',
|
||||
'editor.reuseHeaders': true,
|
||||
'tracing.hideTracingResponse': true,
|
||||
'queryPlan.hideQueryPlanResponse': true,
|
||||
'editor.fontSize': 14,
|
||||
'editor.fontFamily': `'Source Code Pro', 'Consolas', 'Inconsolata', 'Droid Sans Mono', 'Monaco', monospace`,
|
||||
'request.credentials': 'omit',
|
||||
},
|
||||
};
|
||||
function createPlaygroundOptions(playground) {
|
||||
const isDev = process.env.NODE_ENV !== 'production';
|
||||
const enabled = typeof playground !== 'undefined' ? !!playground : isDev;
|
||||
if (!enabled) {
|
||||
return undefined;
|
||||
}
|
||||
const playgroundOverrides = typeof playground === 'boolean' ? {} : playground || {};
|
||||
const settingsOverrides = playgroundOverrides.hasOwnProperty('settings')
|
||||
? {
|
||||
settings: Object.assign(Object.assign({}, exports.defaultPlaygroundOptions.settings), playgroundOverrides.settings),
|
||||
}
|
||||
: { settings: undefined };
|
||||
const playgroundOptions = Object.assign(Object.assign(Object.assign({}, exports.defaultPlaygroundOptions), playgroundOverrides), settingsOverrides);
|
||||
return playgroundOptions;
|
||||
}
|
||||
exports.createPlaygroundOptions = createPlaygroundOptions;
|
||||
//# sourceMappingURL=playground.js.map
|
||||
1
node_modules/apollo-server-core/dist/playground.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/playground.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"playground.js","sourceRoot":"","sources":["../src/playground.ts"],"names":[],"mappings":";;;AAmBA,MAAM,iBAAiB,GAAG,QAAQ,CAAC;AAetB,QAAA,wBAAwB,GAAG;IACtC,OAAO,EAAE,iBAAiB;IAC1B,QAAQ,EAAE;QACR,qBAAqB,EAAE,KAAK;QAC5B,cAAc,EAAE,MAAe;QAC/B,oBAAoB,EAAE,MAAqB;QAC3C,qBAAqB,EAAE,IAAI;QAC3B,6BAA6B,EAAE,IAAI;QACnC,iCAAiC,EAAE,IAAI;QACvC,iBAAiB,EAAE,EAAE;QACrB,mBAAmB,EAAE,sFAAsF;QAC3G,qBAAqB,EAAE,MAAM;KAC9B;CACF,CAAC;AAEF,SAAgB,uBAAuB,CACrC,UAA6B;IAE7B,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,CAAC;IACpD,MAAM,OAAO,GACX,OAAO,UAAU,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC;IAE3D,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,mBAAmB,GACvB,OAAO,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,IAAI,EAAE,CAAC;IAE1D,MAAM,iBAAiB,GAAG,mBAAmB,CAAC,cAAc,CAAC,UAAU,CAAC;QACtE,CAAC,CAAC;YACE,QAAQ,kCACH,gCAAwB,CAAC,QAAQ,GACjC,mBAAmB,CAAC,QAAQ,CAChC;SACF;QACH,CAAC,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IAE5B,MAAM,iBAAiB,iDAClB,gCAAwB,GACxB,mBAAmB,GACnB,iBAAiB,CACrB,CAAC;IAEF,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AA9BD,0DA8BC"}
|
||||
14
node_modules/apollo-server-core/dist/plugin/index.d.ts
generated
vendored
Normal file
14
node_modules/apollo-server-core/dist/plugin/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import type { ApolloServerPlugin } from 'apollo-server-plugin-base';
|
||||
import type { ApolloServerPluginUsageReportingOptions, EngineReportingOptions } from './usageReporting';
|
||||
export type { ApolloServerPluginUsageReportingOptions, SendValuesBaseOptions, VariableValueOptions, ClientInfo, GenerateClientInfo, EngineReportingOptions, } from './usageReporting';
|
||||
import type { ApolloServerPluginSchemaReportingOptions } from './schemaReporting';
|
||||
export type { ApolloServerPluginSchemaReportingOptions } from './schemaReporting';
|
||||
import type { ApolloServerPluginInlineTraceOptions } from './inlineTrace';
|
||||
export type { ApolloServerPluginInlineTraceOptions } from './inlineTrace';
|
||||
export declare function ApolloServerPluginUsageReporting<TContext>(options?: ApolloServerPluginUsageReportingOptions<TContext>): ApolloServerPlugin;
|
||||
export declare function ApolloServerPluginUsageReportingDisabled(): ApolloServerPlugin;
|
||||
export declare function ApolloServerPluginUsageReportingFromLegacyOptions<TContext>(options?: EngineReportingOptions<TContext>): ApolloServerPlugin;
|
||||
export declare function ApolloServerPluginSchemaReporting(options?: ApolloServerPluginSchemaReportingOptions): ApolloServerPlugin;
|
||||
export declare function ApolloServerPluginInlineTrace(options?: ApolloServerPluginInlineTraceOptions): ApolloServerPlugin;
|
||||
export declare function ApolloServerPluginInlineTraceDisabled(): ApolloServerPlugin;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/index.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin/index.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,OAAO,KAAK,EACV,uCAAuC,EACvC,sBAAsB,EACvB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,uCAAuC,EACvC,qBAAqB,EACrB,oBAAoB,EACpB,UAAU,EACV,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,wCAAwC,EAAE,MAAM,mBAAmB,CAAC;AAClF,YAAY,EAAE,wCAAwC,EAAE,MAAM,mBAAmB,CAAC;AAClF,OAAO,KAAK,EAAE,oCAAoC,EAAE,MAAM,eAAe,CAAC;AAC1E,YAAY,EAAE,oCAAoC,EAAE,MAAM,eAAe,CAAC;AAG1E,wBAAgB,gCAAgC,CAAC,QAAQ,EACvD,OAAO,GAAE,uCAAuC,CAAC,QAAQ,CAExD,GACA,kBAAkB,CAEpB;AACD,wBAAgB,wCAAwC,IAAI,kBAAkB,CAE7E;AACD,wBAAgB,iDAAiD,CAAC,QAAQ,EACxE,OAAO,GAAE,sBAAsB,CAAC,QAAQ,CAAuB,GAC9D,kBAAkB,CAIpB;AAID,wBAAgB,iCAAiC,CAC/C,OAAO,GAAE,wCAA8D,GACtE,kBAAkB,CAIpB;AAID,wBAAgB,6BAA6B,CAC3C,OAAO,GAAE,oCAA0D,GAClE,kBAAkB,CAEpB;AACD,wBAAgB,qCAAqC,IAAI,kBAAkB,CAE1E"}
|
||||
28
node_modules/apollo-server-core/dist/plugin/index.js
generated
vendored
Normal file
28
node_modules/apollo-server-core/dist/plugin/index.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ApolloServerPluginInlineTraceDisabled = exports.ApolloServerPluginInlineTrace = exports.ApolloServerPluginSchemaReporting = exports.ApolloServerPluginUsageReportingFromLegacyOptions = exports.ApolloServerPluginUsageReportingDisabled = exports.ApolloServerPluginUsageReporting = void 0;
|
||||
function ApolloServerPluginUsageReporting(options = Object.create(null)) {
|
||||
return require('./usageReporting').ApolloServerPluginUsageReporting(options);
|
||||
}
|
||||
exports.ApolloServerPluginUsageReporting = ApolloServerPluginUsageReporting;
|
||||
function ApolloServerPluginUsageReportingDisabled() {
|
||||
return require('./usageReporting').ApolloServerPluginUsageReportingDisabled();
|
||||
}
|
||||
exports.ApolloServerPluginUsageReportingDisabled = ApolloServerPluginUsageReportingDisabled;
|
||||
function ApolloServerPluginUsageReportingFromLegacyOptions(options = Object.create(null)) {
|
||||
return require('./usageReporting').ApolloServerPluginUsageReportingFromLegacyOptions(options);
|
||||
}
|
||||
exports.ApolloServerPluginUsageReportingFromLegacyOptions = ApolloServerPluginUsageReportingFromLegacyOptions;
|
||||
function ApolloServerPluginSchemaReporting(options = Object.create(null)) {
|
||||
return require('./schemaReporting').ApolloServerPluginSchemaReporting(options);
|
||||
}
|
||||
exports.ApolloServerPluginSchemaReporting = ApolloServerPluginSchemaReporting;
|
||||
function ApolloServerPluginInlineTrace(options = Object.create(null)) {
|
||||
return require('./inlineTrace').ApolloServerPluginInlineTrace(options);
|
||||
}
|
||||
exports.ApolloServerPluginInlineTrace = ApolloServerPluginInlineTrace;
|
||||
function ApolloServerPluginInlineTraceDisabled() {
|
||||
return require('./inlineTrace').ApolloServerPluginInlineTraceDisabled();
|
||||
}
|
||||
exports.ApolloServerPluginInlineTraceDisabled = ApolloServerPluginInlineTraceDisabled;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/index.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/plugin/index.ts"],"names":[],"mappings":";;;AAsCA,SAAgB,gCAAgC,CAC9C,UAA6D,MAAM,CAAC,MAAM,CACxE,IAAI,CACL;IAED,OAAO,OAAO,CAAC,kBAAkB,CAAC,CAAC,gCAAgC,CAAC,OAAO,CAAC,CAAC;AAC/E,CAAC;AAND,4EAMC;AACD,SAAgB,wCAAwC;IACtD,OAAO,OAAO,CAAC,kBAAkB,CAAC,CAAC,wCAAwC,EAAE,CAAC;AAChF,CAAC;AAFD,4FAEC;AACD,SAAgB,iDAAiD,CAC/D,UAA4C,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;IAE/D,OAAO,OAAO,CAAC,kBAAkB,CAAC,CAAC,iDAAiD,CAClF,OAAO,CACR,CAAC;AACJ,CAAC;AAND,8GAMC;AAID,SAAgB,iCAAiC,CAC/C,UAAoD,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;IAEvE,OAAO,OAAO,CAAC,mBAAmB,CAAC,CAAC,iCAAiC,CACnE,OAAO,CACR,CAAC;AACJ,CAAC;AAND,8EAMC;AAID,SAAgB,6BAA6B,CAC3C,UAAgD,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;IAEnE,OAAO,OAAO,CAAC,eAAe,CAAC,CAAC,6BAA6B,CAAC,OAAO,CAAC,CAAC;AACzE,CAAC;AAJD,sEAIC;AACD,SAAgB,qCAAqC;IACnD,OAAO,OAAO,CAAC,eAAe,CAAC,CAAC,qCAAqC,EAAE,CAAC;AAC1E,CAAC;AAFD,sFAEC"}
|
||||
9
node_modules/apollo-server-core/dist/plugin/inlineTrace/index.d.ts
generated
vendored
Normal file
9
node_modules/apollo-server-core/dist/plugin/inlineTrace/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import type { ApolloServerPluginUsageReportingOptions } from '../usageReporting/options';
|
||||
import type { InternalApolloServerPlugin } from '../internalPlugin';
|
||||
export interface ApolloServerPluginInlineTraceOptions {
|
||||
rewriteError?: ApolloServerPluginUsageReportingOptions<never>['rewriteError'];
|
||||
__onlyIfSchemaIsFederated?: boolean;
|
||||
}
|
||||
export declare function ApolloServerPluginInlineTrace(options?: ApolloServerPluginInlineTraceOptions): InternalApolloServerPlugin;
|
||||
export declare function ApolloServerPluginInlineTraceDisabled(): InternalApolloServerPlugin;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/inlineTrace/index.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/inlineTrace/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugin/inlineTrace/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uCAAuC,EAAE,MAAM,2BAA2B,CAAC;AACzF,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAGpE,MAAM,WAAW,oCAAoC;IAOnD,YAAY,CAAC,EAAE,uCAAuC,CAAC,KAAK,CAAC,CAAC,cAAc,CAAC,CAAC;IAW9E,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC;AAOD,wBAAgB,6BAA6B,CAC3C,OAAO,GAAE,oCAA0D,GAClE,0BAA0B,CA0E5B;AAID,wBAAgB,qCAAqC,IAAI,0BAA0B,CAMlF"}
|
||||
65
node_modules/apollo-server-core/dist/plugin/inlineTrace/index.js
generated
vendored
Normal file
65
node_modules/apollo-server-core/dist/plugin/inlineTrace/index.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ApolloServerPluginInlineTraceDisabled = exports.ApolloServerPluginInlineTrace = void 0;
|
||||
const apollo_reporting_protobuf_1 = require("apollo-reporting-protobuf");
|
||||
const traceTreeBuilder_1 = require("../traceTreeBuilder");
|
||||
const schemaIsFederated_1 = require("../schemaIsFederated");
|
||||
function ApolloServerPluginInlineTrace(options = Object.create(null)) {
|
||||
let enabled = options.__onlyIfSchemaIsFederated ? null : true;
|
||||
return {
|
||||
__internal_plugin_id__() {
|
||||
return 'InlineTrace';
|
||||
},
|
||||
serverWillStart({ schema, logger }) {
|
||||
if (enabled === null) {
|
||||
enabled = schemaIsFederated_1.schemaIsFederated(schema);
|
||||
if (enabled) {
|
||||
logger.info('Enabling inline tracing for this federated service. To disable, use ' +
|
||||
'ApolloServerPluginInlineTraceDisabled.');
|
||||
}
|
||||
}
|
||||
},
|
||||
requestDidStart({ request: { http } }) {
|
||||
if (!enabled) {
|
||||
return;
|
||||
}
|
||||
const treeBuilder = new traceTreeBuilder_1.TraceTreeBuilder({
|
||||
rewriteError: options.rewriteError,
|
||||
});
|
||||
if ((http === null || http === void 0 ? void 0 : http.headers.get('apollo-federation-include-trace')) !== 'ftv1') {
|
||||
return;
|
||||
}
|
||||
treeBuilder.startTiming();
|
||||
return {
|
||||
executionDidStart: () => ({
|
||||
willResolveField({ info }) {
|
||||
return treeBuilder.willResolveField(info);
|
||||
},
|
||||
}),
|
||||
didEncounterErrors({ errors }) {
|
||||
treeBuilder.didEncounterErrors(errors);
|
||||
},
|
||||
willSendResponse({ response }) {
|
||||
treeBuilder.stopTiming();
|
||||
const encodedUint8Array = apollo_reporting_protobuf_1.Trace.encode(treeBuilder.trace).finish();
|
||||
const encodedBuffer = Buffer.from(encodedUint8Array, encodedUint8Array.byteOffset, encodedUint8Array.byteLength);
|
||||
const extensions = response.extensions || (response.extensions = Object.create(null));
|
||||
if (typeof extensions.ftv1 !== 'undefined') {
|
||||
throw new Error('The `ftv1` extension was already present.');
|
||||
}
|
||||
extensions.ftv1 = encodedBuffer.toString('base64');
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
}
|
||||
exports.ApolloServerPluginInlineTrace = ApolloServerPluginInlineTrace;
|
||||
function ApolloServerPluginInlineTraceDisabled() {
|
||||
return {
|
||||
__internal_plugin_id__() {
|
||||
return 'InlineTrace';
|
||||
},
|
||||
};
|
||||
}
|
||||
exports.ApolloServerPluginInlineTraceDisabled = ApolloServerPluginInlineTraceDisabled;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/inlineTrace/index.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/inlineTrace/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugin/inlineTrace/index.ts"],"names":[],"mappings":";;;AAAA,yEAAkD;AAClD,0DAAuD;AAGvD,4DAAyD;AA4BzD,SAAgB,6BAA6B,CAC3C,UAAgD,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;IAEnE,IAAI,OAAO,GAAmB,OAAO,CAAC,yBAAyB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IAC9E,OAAO;QACL,sBAAsB;YACpB,OAAO,aAAa,CAAC;QACvB,CAAC;QACD,eAAe,CAAC,EAAE,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AAI,CAAC,QAAQ,CAAC,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;oBAIrE,IAAI,OAAO,UAAU,CAAC,IAAI,KAAK,WAAW,EAAE;wBAC1C,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;qBAC9D;oBAED,UAAU,CAAC,IAAI,GAAG,aAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;gBACrD,CAAC;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC;AA5ED,sEA4EC;AAID,SAAgB,qCAAqC;IACnD,OAAO;QACL,sBAAsB;YACpB,OAAO,aAAa,CAAC;QACvB,CAAC;KACF,CAAC;AACJ,CAAC;AAND,sFAMC"}
|
||||
8
node_modules/apollo-server-core/dist/plugin/internalPlugin.d.ts
generated
vendored
Normal file
8
node_modules/apollo-server-core/dist/plugin/internalPlugin.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import type { BaseContext } from 'apollo-server-types';
|
||||
import type { ApolloServerPlugin } from 'apollo-server-plugin-base';
|
||||
export interface InternalApolloServerPlugin<TContext extends BaseContext = BaseContext> extends ApolloServerPlugin<TContext> {
|
||||
__internal_plugin_id__(): InternalPluginId;
|
||||
}
|
||||
export declare type InternalPluginId = 'SchemaReporting' | 'InlineTrace' | 'UsageReporting';
|
||||
export declare function pluginIsInternal(plugin: ApolloServerPlugin): plugin is InternalApolloServerPlugin;
|
||||
//# sourceMappingURL=internalPlugin.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/internalPlugin.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/internalPlugin.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"internalPlugin.d.ts","sourceRoot":"","sources":["../../src/plugin/internalPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AASpE,MAAM,WAAW,0BAA0B,CACzC,QAAQ,SAAS,WAAW,GAAG,WAAW,CAC1C,SAAQ,kBAAkB,CAAC,QAAQ,CAAC;IAGpC,sBAAsB,IAAI,gBAAgB,CAAC;CAC5C;AAED,oBAAY,gBAAgB,GACxB,iBAAiB,GACjB,aAAa,GACb,gBAAgB,CAAC;AAErB,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,kBAAkB,GACzB,MAAM,IAAI,0BAA0B,CAItC"}
|
||||
8
node_modules/apollo-server-core/dist/plugin/internalPlugin.js
generated
vendored
Normal file
8
node_modules/apollo-server-core/dist/plugin/internalPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.pluginIsInternal = void 0;
|
||||
function pluginIsInternal(plugin) {
|
||||
return '__internal_plugin_id__' in plugin;
|
||||
}
|
||||
exports.pluginIsInternal = pluginIsInternal;
|
||||
//# sourceMappingURL=internalPlugin.js.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/internalPlugin.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/internalPlugin.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"internalPlugin.js","sourceRoot":"","sources":["../../src/plugin/internalPlugin.ts"],"names":[],"mappings":";;;AAuBA,SAAgB,gBAAgB,CAC9B,MAA0B;IAI1B,OAAO,wBAAwB,IAAI,MAAM,CAAC;AAC5C,CAAC;AAND,4CAMC"}
|
||||
3
node_modules/apollo-server-core/dist/plugin/schemaIsFederated.d.ts
generated
vendored
Normal file
3
node_modules/apollo-server-core/dist/plugin/schemaIsFederated.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import { GraphQLSchema } from 'graphql';
|
||||
export declare function schemaIsFederated(schema: GraphQLSchema): boolean;
|
||||
//# sourceMappingURL=schemaIsFederated.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/schemaIsFederated.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/schemaIsFederated.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"schemaIsFederated.d.ts","sourceRoot":"","sources":["../../src/plugin/schemaIsFederated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA8B,MAAM,SAAS,CAAC;AAkBpE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAchE"}
|
||||
21
node_modules/apollo-server-core/dist/plugin/schemaIsFederated.js
generated
vendored
Normal file
21
node_modules/apollo-server-core/dist/plugin/schemaIsFederated.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.schemaIsFederated = void 0;
|
||||
const graphql_1 = require("graphql");
|
||||
function schemaIsFederated(schema) {
|
||||
const serviceType = schema.getType('_Service');
|
||||
if (!(serviceType && graphql_1.isObjectType(serviceType))) {
|
||||
return false;
|
||||
}
|
||||
const sdlField = serviceType.getFields().sdl;
|
||||
if (!sdlField) {
|
||||
return false;
|
||||
}
|
||||
const sdlFieldType = sdlField.type;
|
||||
if (!graphql_1.isScalarType(sdlFieldType)) {
|
||||
return false;
|
||||
}
|
||||
return sdlFieldType.name == 'String';
|
||||
}
|
||||
exports.schemaIsFederated = schemaIsFederated;
|
||||
//# sourceMappingURL=schemaIsFederated.js.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/schemaIsFederated.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/schemaIsFederated.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"schemaIsFederated.js","sourceRoot":"","sources":["../../src/plugin/schemaIsFederated.ts"],"names":[],"mappings":";;;AAAA,qCAAoE;AAkBpE,SAAgB,iBAAiB,CAAC,MAAqB;IACrD,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAC/C,IAAI,CAAC,CAAC,WAAW,IAAI,sBAAY,CAAC,WAAW,CAAC,CAAC,EAAE;QAC/C,OAAO,KAAK,CAAC;KACd;IACD,MAAM,QAAQ,GAAG,WAAW,CAAC,SAAS,EAAE,CAAC,GAAG,CAAC;IAC7C,IAAI,CAAC,QAAQ,EAAE;QACb,OAAO,KAAK,CAAC;KACd;IACD,MAAM,YAAY,GAAG,QAAQ,CAAC,IAAI,CAAC;IACnC,IAAI,CAAC,sBAAY,CAAC,YAAY,CAAC,EAAE;QAC/B,OAAO,KAAK,CAAC;KACd;IACD,OAAO,YAAY,CAAC,IAAI,IAAI,QAAQ,CAAC;AACvC,CAAC;AAdD,8CAcC"}
|
||||
11
node_modules/apollo-server-core/dist/plugin/schemaReporting/index.d.ts
generated
vendored
Normal file
11
node_modules/apollo-server-core/dist/plugin/schemaReporting/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import type { InternalApolloServerPlugin } from '../internalPlugin';
|
||||
import type { fetch } from 'apollo-server-env';
|
||||
export interface ApolloServerPluginSchemaReportingOptions {
|
||||
initialDelayMaxMs?: number;
|
||||
overrideReportedSchema?: string;
|
||||
endpointUrl?: string;
|
||||
fetcher?: typeof fetch;
|
||||
}
|
||||
export declare function ApolloServerPluginSchemaReporting({ initialDelayMaxMs, overrideReportedSchema, endpointUrl, fetcher, }?: ApolloServerPluginSchemaReportingOptions): InternalApolloServerPlugin;
|
||||
export declare function computeCoreSchemaHash(schema: string): string;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/schemaReporting/index.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/schemaReporting/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugin/schemaReporting/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAGpE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAM/C,MAAM,WAAW,wCAAwC;IAavD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAuB3B,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAKhC,WAAW,CAAC,EAAE,MAAM,CAAC;IAIrB,OAAO,CAAC,EAAE,OAAO,KAAK,CAAC;CACxB;AAED,wBAAgB,iCAAiC,CAC/C,EACE,iBAAiB,EACjB,sBAAsB,EACtB,WAAW,EACX,OAAO,GACR,GAAE,wCAA8D,GAChE,0BAA0B,CAwH5B;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE5D"}
|
||||
107
node_modules/apollo-server-core/dist/plugin/schemaReporting/index.js
generated
vendored
Normal file
107
node_modules/apollo-server-core/dist/plugin/schemaReporting/index.js
generated
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.computeCoreSchemaHash = exports.ApolloServerPluginSchemaReporting = void 0;
|
||||
const os_1 = __importDefault(require("os"));
|
||||
const uuid_1 = require("uuid");
|
||||
const graphql_1 = require("graphql");
|
||||
const schemaReporter_1 = require("./schemaReporter");
|
||||
const createSHA_1 = __importDefault(require("../../utils/createSHA"));
|
||||
const schemaIsFederated_1 = require("../schemaIsFederated");
|
||||
function ApolloServerPluginSchemaReporting({ initialDelayMaxMs, overrideReportedSchema, endpointUrl, fetcher, } = Object.create(null)) {
|
||||
const bootId = uuid_1.v4();
|
||||
return {
|
||||
__internal_plugin_id__() {
|
||||
return 'SchemaReporting';
|
||||
},
|
||||
serverWillStart({ apollo, schema, logger }) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const { key, graphRef } = apollo;
|
||||
if (!key) {
|
||||
throw Error('To use ApolloServerPluginSchemaReporting, you must provide an Apollo API ' +
|
||||
'key, via the APOLLO_KEY environment variable or via `new ApolloServer({apollo: {key})`');
|
||||
}
|
||||
if (!graphRef) {
|
||||
throw Error('To use ApolloServerPluginSchemaReporting, you must provide your graph ref (eg, ' +
|
||||
"'my-graph-id@my-graph-variant'). Try setting the APOLLO_GRAPH_REF environment " +
|
||||
'variable or passing `new ApolloServer({apollo: {graphRef}})`.');
|
||||
}
|
||||
if (overrideReportedSchema) {
|
||||
try {
|
||||
const validationErrors = graphql_1.validateSchema(graphql_1.buildSchema(overrideReportedSchema, { noLocation: true }));
|
||||
if (validationErrors.length) {
|
||||
throw new Error(validationErrors.map((error) => error.message).join('\n'));
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
throw new Error('The schema provided to overrideReportedSchema failed to parse or ' +
|
||||
`validate: ${err.message}`);
|
||||
}
|
||||
}
|
||||
if (schemaIsFederated_1.schemaIsFederated(schema)) {
|
||||
throw Error([
|
||||
'Schema reporting is not yet compatible with federated services.',
|
||||
"If you're interested in using schema reporting with federated",
|
||||
'services, please contact Apollo support. To set up managed federation, see',
|
||||
'https://go.apollo.dev/s/managed-federation',
|
||||
].join(' '));
|
||||
}
|
||||
const coreSchema = overrideReportedSchema !== null && overrideReportedSchema !== void 0 ? overrideReportedSchema : graphql_1.printSchema(schema);
|
||||
const coreSchemaHash = computeCoreSchemaHash(coreSchema);
|
||||
if (overrideReportedSchema !== undefined) {
|
||||
logger.info('Apollo schema reporting: schema to report has been overridden');
|
||||
}
|
||||
if (endpointUrl !== undefined) {
|
||||
logger.info(`Apollo schema reporting: schema reporting URL override: ${endpointUrl}`);
|
||||
}
|
||||
const schemaReport = {
|
||||
bootId,
|
||||
graphRef,
|
||||
platform: process.env.APOLLO_SERVER_PLATFORM || 'local',
|
||||
runtimeVersion: `node ${process.version}`,
|
||||
coreSchemaHash,
|
||||
userVersion: process.env.APOLLO_SERVER_USER_VERSION,
|
||||
serverId: process.env.APOLLO_SERVER_ID || process.env.HOSTNAME || os_1.default.hostname(),
|
||||
libraryVersion: `apollo-server-core@${require('../../../package.json').version}`,
|
||||
};
|
||||
logger.info('Apollo schema reporting starting! See your graph at ' +
|
||||
`https://studio.apollographql.com/graph/${encodeURI(graphRef)}/ with server info ${JSON.stringify(schemaReport)}`);
|
||||
const schemaReporter = new schemaReporter_1.SchemaReporter({
|
||||
schemaReport,
|
||||
coreSchema,
|
||||
apiKey: key,
|
||||
endpointUrl,
|
||||
logger,
|
||||
initialReportingDelayInMs: Math.floor(Math.random() * (initialDelayMaxMs !== null && initialDelayMaxMs !== void 0 ? initialDelayMaxMs : 10000)),
|
||||
fallbackReportingDelayInMs: 20000,
|
||||
fetcher,
|
||||
});
|
||||
schemaReporter.start();
|
||||
return {
|
||||
serverWillStop() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
schemaReporter.stop();
|
||||
});
|
||||
},
|
||||
};
|
||||
});
|
||||
},
|
||||
};
|
||||
}
|
||||
exports.ApolloServerPluginSchemaReporting = ApolloServerPluginSchemaReporting;
|
||||
function computeCoreSchemaHash(schema) {
|
||||
return createSHA_1.default('sha256').update(schema).digest('hex');
|
||||
}
|
||||
exports.computeCoreSchemaHash = computeCoreSchemaHash;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/schemaReporting/index.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/schemaReporting/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugin/schemaReporting/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAoB;AAEpB,+BAAoC;AACpC,qCAAmE;AAEnE,qDAAkD;AAClD,sEAA8C;AAC9C,4DAAyD;AAmDzD,SAAgB,iCAAiC,CAC/C,EACE,iBAAiB,EACjB,sBAAsB,EACtB,WAAW,EACX,OAAO,MACqC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;IAEjE,MAAM,MAAM,GAAG,SAAM,EAAE,CAAC;IAExB,OAAO;QACL,sBAAsB;YACpB,OAAO,iBAAiB,CAAC;QAC3B,CAAC;QACK,eAAe,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE;;gBAC9C,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;gBACjC,IAAI,CAAC,GAAG,EAAE;oBACR,MAAM,KAAK,CACT,2EAA2E;wBACzE,wFAAwF,CAC3F,CAAC;iBACH;gBACD,IAAI,CAAC,QAAQ,EAAE;oBAGb,MAAM,KAAK,CACT,iFAAiF;wBAC/E,gFAAgF;wBAChF,+DAA+D,CAClE,CAAC;iBACH;gBAGD,IAAI,sBAAsB,EAAE;oBAC1B,IAAI;wBACF,MAAM,gBAAgB,GAAG,wBAAc,CACrC,qBAAW,CAAC,sBAAsB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAC1D,CAAC;wBACF,IAAI,gBAAgB,CAAC,MAAM,EAAE;4BAC3B,MAAM,IAAI,KAAK,CACb,gBAAgB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAC1D,CA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S,CAAC,YAAY,CAAC,EAAE,CACxD,CAAC;gBAEF,MAAM,cAAc,GAAG,IAAI,+BAAc,CAAC;oBACxC,YAAY;oBACZ,UAAU;oBACV,MAAM,EAAE,GAAG;oBACX,WAAW;oBACX,MAAM;oBAEN,yBAAyB,EAAE,IAAI,CAAC,KAAK,CACnC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,iBAAiB,aAAjB,iBAAiB,cAAjB,iBAAiB,GAAI,KAAM,CAAC,CAC9C;oBACD,0BAA0B,EAAE,KAAM;oBAClC,OAAO;iBACR,CAAC,CAAC;gBAEH,cAAc,CAAC,KAAK,EAAE,CAAC;gBAEvB,OAAO;oBACC,cAAc;;4BAClB,cAAc,CAAC,IAAI,EAAE,CAAC;wBACxB,CAAC;qBAAA;iBACF,CAAC;YACJ,CAAC;SAAA;KACF,CAAC;AACJ,CAAC;AA/HD,8EA+HC;AAED,SAAgB,qBAAqB,CAAC,MAAc;IAClD,OAAO,mBAAS,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC1D,CAAC;AAFD,sDAEC"}
|
||||
33
node_modules/apollo-server-core/dist/plugin/schemaReporting/schemaReporter.d.ts
generated
vendored
Normal file
33
node_modules/apollo-server-core/dist/plugin/schemaReporting/schemaReporter.d.ts
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
import { fetch } from 'apollo-server-env';
|
||||
import { Logger } from 'apollo-server-types';
|
||||
import { SchemaReport, ReportSchemaResponse } from './operations';
|
||||
export declare const schemaReportGql: string;
|
||||
export declare class SchemaReporter {
|
||||
private readonly schemaReport;
|
||||
private readonly coreSchema;
|
||||
private readonly endpointUrl;
|
||||
private readonly logger;
|
||||
private readonly initialReportingDelayInMs;
|
||||
private readonly fallbackReportingDelayInMs;
|
||||
private readonly fetcher;
|
||||
private isStopped;
|
||||
private pollTimer?;
|
||||
private readonly headers;
|
||||
constructor(options: {
|
||||
schemaReport: SchemaReport;
|
||||
coreSchema: string;
|
||||
apiKey: string;
|
||||
endpointUrl: string | undefined;
|
||||
logger: Logger;
|
||||
initialReportingDelayInMs: number;
|
||||
fallbackReportingDelayInMs: number;
|
||||
fetcher?: typeof fetch;
|
||||
});
|
||||
stopped(): Boolean;
|
||||
start(): void;
|
||||
stop(): void;
|
||||
private sendOneReportAndScheduleNext;
|
||||
reportSchema(withCoreSchema: boolean): Promise<ReportSchemaResponse | null>;
|
||||
private apolloQuery;
|
||||
}
|
||||
//# sourceMappingURL=schemaReporter.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/schemaReporting/schemaReporter.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/schemaReporting/schemaReporter.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"schemaReporter.d.ts","sourceRoot":"","sources":["../../../src/plugin/schemaReporting/schemaReporter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAoB,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAkB,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,EACL,YAAY,EAGZ,oBAAoB,EACrB,MAAM,cAAc,CAAC;AAEtB,eAAO,MAAM,eAAe,QAc1B,CAAC;AAGH,qBAAa,cAAc;IAEzB,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAe;IAC5C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAAS;IACnD,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CAAS;IACpD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAe;IAEvC,OAAO,CAAC,SAAS,CAAU;IAC3B,OAAO,CAAC,SAAS,CAAC,CAAe;IACjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;gBAEtB,OAAO,EAAE;QACnB,YAAY,EAAE,YAAY,CAAC;QAC3B,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,EAAE,MAAM,CAAC;QACf,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;QAChC,MAAM,EAAE,MAAM,CAAC;QACf,yBAAyB,EAAE,MAAM,CAAC;QAClC,0BAA0B,EAAE,MAAM,CAAC;QACnC,OAAO,CAAC,EAAE,OAAO,KAAK,CAAC;KACxB;IA0BM,OAAO,IAAI,OAAO;IAIlB,KAAK;IAOL,IAAI;YAQG,4BAA4B;IAiC7B,YAAY,CACvB,cAAc,EAAE,OAAO,GACtB,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;YAwCzB,WAAW;CAuC1B"}
|
||||
155
node_modules/apollo-server-core/dist/plugin/schemaReporting/schemaReporter.js
generated
vendored
Normal file
155
node_modules/apollo-server-core/dist/plugin/schemaReporting/schemaReporter.js
generated
vendored
Normal file
@@ -0,0 +1,155 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SchemaReporter = exports.schemaReportGql = void 0;
|
||||
const __1 = require("../..");
|
||||
const apollo_server_env_1 = require("apollo-server-env");
|
||||
const graphql_1 = require("graphql");
|
||||
exports.schemaReportGql = graphql_1.print(__1.gql `
|
||||
mutation SchemaReport($report: SchemaReport!, $coreSchema: String) {
|
||||
reportSchema(report: $report, coreSchema: $coreSchema) {
|
||||
__typename
|
||||
... on ReportSchemaError {
|
||||
message
|
||||
code
|
||||
}
|
||||
... on ReportSchemaResponse {
|
||||
inSeconds
|
||||
withCoreSchema
|
||||
}
|
||||
}
|
||||
}
|
||||
`);
|
||||
class SchemaReporter {
|
||||
constructor(options) {
|
||||
var _a;
|
||||
this.headers = new apollo_server_env_1.Headers();
|
||||
this.headers.set('Content-Type', 'application/json');
|
||||
this.headers.set('x-api-key', options.apiKey);
|
||||
this.headers.set('apollographql-client-name', 'ApolloServerPluginSchemaReporting');
|
||||
this.headers.set('apollographql-client-version', require('../../../package.json').version);
|
||||
this.endpointUrl =
|
||||
options.endpointUrl ||
|
||||
'https://schema-reporting.api.apollographql.com/api/graphql';
|
||||
this.schemaReport = options.schemaReport;
|
||||
this.coreSchema = options.coreSchema;
|
||||
this.isStopped = false;
|
||||
this.logger = options.logger;
|
||||
this.initialReportingDelayInMs = options.initialReportingDelayInMs;
|
||||
this.fallbackReportingDelayInMs = options.fallbackReportingDelayInMs;
|
||||
this.fetcher = (_a = options.fetcher) !== null && _a !== void 0 ? _a : apollo_server_env_1.fetch;
|
||||
}
|
||||
stopped() {
|
||||
return this.isStopped;
|
||||
}
|
||||
start() {
|
||||
this.pollTimer = setTimeout(() => this.sendOneReportAndScheduleNext(false), this.initialReportingDelayInMs);
|
||||
}
|
||||
stop() {
|
||||
this.isStopped = true;
|
||||
if (this.pollTimer) {
|
||||
clearTimeout(this.pollTimer);
|
||||
this.pollTimer = undefined;
|
||||
}
|
||||
}
|
||||
sendOneReportAndScheduleNext(sendNextWithCoreSchema) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
this.pollTimer = undefined;
|
||||
if (this.stopped())
|
||||
return;
|
||||
try {
|
||||
const result = yield this.reportSchema(sendNextWithCoreSchema);
|
||||
if (!result) {
|
||||
return;
|
||||
}
|
||||
if (!this.stopped()) {
|
||||
this.pollTimer = setTimeout(() => this.sendOneReportAndScheduleNext(result.withCoreSchema), result.inSeconds * 1000);
|
||||
}
|
||||
return;
|
||||
}
|
||||
catch (error) {
|
||||
this.logger.error(`Error reporting server info to Apollo during schema reporting: ${error}`);
|
||||
if (!this.stopped()) {
|
||||
this.pollTimer = setTimeout(() => this.sendOneReportAndScheduleNext(false), this.fallbackReportingDelayInMs);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
reportSchema(withCoreSchema) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const { data, errors } = yield this.apolloQuery({
|
||||
report: this.schemaReport,
|
||||
coreSchema: withCoreSchema ? this.coreSchema : null,
|
||||
});
|
||||
if (errors) {
|
||||
throw new Error(errors.map((x) => x.message).join('\n'));
|
||||
}
|
||||
function msgForUnexpectedResponse(data) {
|
||||
return [
|
||||
'Unexpected response shape from Apollo when',
|
||||
'reporting schema. If this continues, please reach',
|
||||
'out to support@apollographql.com.',
|
||||
'Received response:',
|
||||
JSON.stringify(data),
|
||||
].join(' ');
|
||||
}
|
||||
if (!data || !data.reportSchema) {
|
||||
throw new Error(msgForUnexpectedResponse(data));
|
||||
}
|
||||
if (data.reportSchema.__typename === 'ReportSchemaResponse') {
|
||||
return data.reportSchema;
|
||||
}
|
||||
else if (data.reportSchema.__typename === 'ReportSchemaError') {
|
||||
this.logger.error([
|
||||
'Received input validation error from Apollo:',
|
||||
data.reportSchema.message,
|
||||
'Stopping reporting. Please fix the input errors.',
|
||||
].join(' '));
|
||||
this.stop();
|
||||
return null;
|
||||
}
|
||||
throw new Error(msgForUnexpectedResponse(data));
|
||||
});
|
||||
}
|
||||
apolloQuery(variables) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const request = {
|
||||
query: exports.schemaReportGql,
|
||||
variables,
|
||||
};
|
||||
const httpRequest = new apollo_server_env_1.Request(this.endpointUrl, {
|
||||
method: 'POST',
|
||||
headers: this.headers,
|
||||
body: JSON.stringify(request),
|
||||
});
|
||||
const httpResponse = yield this.fetcher(httpRequest);
|
||||
if (!httpResponse.ok) {
|
||||
throw new Error([
|
||||
`An unexpected HTTP status code (${httpResponse.status}) was`,
|
||||
'encountered during schema reporting.',
|
||||
].join(' '));
|
||||
}
|
||||
try {
|
||||
return yield httpResponse.json();
|
||||
}
|
||||
catch (error) {
|
||||
throw new Error([
|
||||
"Couldn't report schema to Apollo.",
|
||||
'Parsing response as JSON failed.',
|
||||
'If this continues please reach out to support@apollographql.com',
|
||||
error,
|
||||
].join(' '));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.SchemaReporter = SchemaReporter;
|
||||
//# sourceMappingURL=schemaReporter.js.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/schemaReporting/schemaReporter.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/schemaReporting/schemaReporter.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"schemaReporter.js","sourceRoot":"","sources":["../../../src/plugin/schemaReporting/schemaReporter.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6BAA4B;AAC5B,yDAA4D;AAE5D,qCAAgC;AAQnB,QAAA,eAAe,GAAG,eAAK,CAAC,OAAG,CAAA;;;;;;;;;;;;;;CAcvC,CAAC,CAAC;AAGH,MAAa,cAAc;IAczB,YAAY,OASX;;QACC,IAAI,CAAC,OAAO,GAAG,IAAI,2BAAO,EAAE,CAAC;QAC7B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;QACrD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QAC9C,IAAI,CAAC,OAAO,CAAC,GAAG,CACd,2BAA2B,EAC3B,mCAAmC,CACpC,CAAC;QACF,IAAI,CAAC,OAAO,CAAC,GAAG,CACd,8BAA8B,EAC9B,OAAO,CAAC,uBAAuB,CAAC,CAAC,OAAO,CACzC,CAAC;QAEF,IAAI,CAAC,WAAW;YACd,OA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AC,CACZ,CAAC;aACH;QACH,CAAC;KAAA;CACF;AAtLD,wCAsLC"}
|
||||
26
node_modules/apollo-server-core/dist/plugin/traceTreeBuilder.d.ts
generated
vendored
Normal file
26
node_modules/apollo-server-core/dist/plugin/traceTreeBuilder.d.ts
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
import { GraphQLError, GraphQLResolveInfo } from 'graphql';
|
||||
import { Trace, google } from 'apollo-reporting-protobuf';
|
||||
import { Logger } from 'apollo-server-types';
|
||||
export declare class TraceTreeBuilder {
|
||||
private rootNode;
|
||||
private logger;
|
||||
trace: Trace;
|
||||
startHrTime?: [number, number];
|
||||
private stopped;
|
||||
private nodes;
|
||||
private readonly rewriteError?;
|
||||
constructor(options: {
|
||||
logger?: Logger;
|
||||
rewriteError?: (err: GraphQLError) => GraphQLError | null;
|
||||
});
|
||||
startTiming(): void;
|
||||
stopTiming(): void;
|
||||
willResolveField(info: GraphQLResolveInfo): () => void;
|
||||
didEncounterErrors(errors: readonly GraphQLError[]): void;
|
||||
private addProtobufError;
|
||||
private newNode;
|
||||
private ensureParentNode;
|
||||
private rewriteAndNormalizeError;
|
||||
}
|
||||
export declare function dateToProtoTimestamp(date: Date): google.protobuf.Timestamp;
|
||||
//# sourceMappingURL=traceTreeBuilder.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/traceTreeBuilder.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/traceTreeBuilder.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"traceTreeBuilder.d.ts","sourceRoot":"","sources":["../../src/plugin/traceTreeBuilder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAgB,MAAM,SAAS,CAAC;AACzE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAM7C,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAoB;IACpC,OAAO,CAAC,MAAM,CAAmB;IAC1B,KAAK,QAAsC;IAC3C,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,KAAK,CAEV;IACH,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAA6C;gBAExD,OAAO,EAAE;QAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,YAAY,KAAK,YAAY,GAAG,IAAI,CAAC;KAC3D;IAKM,WAAW;IAWX,UAAU;IAeV,gBAAgB,CAAC,IAAI,EAAE,kBAAkB,GAAG,MAAM,IAAI;IAuBtD,kBAAkB,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE;IA6BzD,OAAO,CAAC,gBAAgB;IA+BxB,OAAO,CAAC,OAAO;IAcf,OAAO,CAAC,gBAAgB;IAWxB,OAAO,CAAC,wBAAwB;CAmDjC;AAiDD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,SAAS,CAO1E"}
|
||||
160
node_modules/apollo-server-core/dist/plugin/traceTreeBuilder.js
generated
vendored
Normal file
160
node_modules/apollo-server-core/dist/plugin/traceTreeBuilder.js
generated
vendored
Normal file
@@ -0,0 +1,160 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.dateToProtoTimestamp = exports.TraceTreeBuilder = void 0;
|
||||
const graphql_1 = require("graphql");
|
||||
const apollo_reporting_protobuf_1 = require("apollo-reporting-protobuf");
|
||||
function internalError(message) {
|
||||
return new Error(`[internal apollo-server error] ${message}`);
|
||||
}
|
||||
class TraceTreeBuilder {
|
||||
constructor(options) {
|
||||
this.rootNode = new apollo_reporting_protobuf_1.Trace.Node();
|
||||
this.logger = console;
|
||||
this.trace = new apollo_reporting_protobuf_1.Trace({ root: this.rootNode });
|
||||
this.stopped = false;
|
||||
this.nodes = new Map([
|
||||
[responsePathAsString(), this.rootNode],
|
||||
]);
|
||||
this.rewriteError = options.rewriteError;
|
||||
if (options.logger)
|
||||
this.logger = options.logger;
|
||||
}
|
||||
startTiming() {
|
||||
if (this.startHrTime) {
|
||||
throw internalError('startTiming called twice!');
|
||||
}
|
||||
if (this.stopped) {
|
||||
throw internalError('startTiming called after stopTiming!');
|
||||
}
|
||||
this.trace.startTime = dateToProtoTimestamp(new Date());
|
||||
this.startHrTime = process.hrtime();
|
||||
}
|
||||
stopTiming() {
|
||||
if (!this.startHrTime) {
|
||||
throw internalError('stopTiming called before startTiming!');
|
||||
}
|
||||
if (this.stopped) {
|
||||
throw internalError('stopTiming called twice!');
|
||||
}
|
||||
this.trace.durationNs = durationHrTimeToNanos(process.hrtime(this.startHrTime));
|
||||
this.trace.endTime = dateToProtoTimestamp(new Date());
|
||||
this.stopped = true;
|
||||
}
|
||||
willResolveField(info) {
|
||||
if (!this.startHrTime) {
|
||||
throw internalError('willResolveField called before startTiming!');
|
||||
}
|
||||
if (this.stopped) {
|
||||
throw internalError('willResolveField called after stopTiming!');
|
||||
}
|
||||
const path = info.path;
|
||||
const node = this.newNode(path);
|
||||
node.type = info.returnType.toString();
|
||||
node.parentType = info.parentType.toString();
|
||||
node.startTime = durationHrTimeToNanos(process.hrtime(this.startHrTime));
|
||||
if (typeof path.key === 'string' && path.key !== info.fieldName) {
|
||||
node.originalFieldName = info.fieldName;
|
||||
}
|
||||
return () => {
|
||||
node.endTime = durationHrTimeToNanos(process.hrtime(this.startHrTime));
|
||||
};
|
||||
}
|
||||
didEncounterErrors(errors) {
|
||||
errors.forEach((err) => {
|
||||
if (err.extensions && err.extensions.serviceName) {
|
||||
return;
|
||||
}
|
||||
const errorForReporting = this.rewriteAndNormalizeError(err);
|
||||
if (errorForReporting === null) {
|
||||
return;
|
||||
}
|
||||
this.addProtobufError(errorForReporting.path, errorToProtobufError(errorForReporting));
|
||||
});
|
||||
}
|
||||
addProtobufError(path, error) {
|
||||
if (!this.startHrTime) {
|
||||
throw internalError('addProtobufError called before startTiming!');
|
||||
}
|
||||
if (this.stopped) {
|
||||
throw internalError('addProtobufError called after stopTiming!');
|
||||
}
|
||||
let node = this.rootNode;
|
||||
if (Array.isArray(path)) {
|
||||
const specificNode = this.nodes.get(path.join('.'));
|
||||
if (specificNode) {
|
||||
node = specificNode;
|
||||
}
|
||||
else {
|
||||
this.logger.warn(`Could not find node with path ${path.join('.')}; defaulting to put errors on root node.`);
|
||||
}
|
||||
}
|
||||
node.error.push(error);
|
||||
}
|
||||
newNode(path) {
|
||||
const node = new apollo_reporting_protobuf_1.Trace.Node();
|
||||
const id = path.key;
|
||||
if (typeof id === 'number') {
|
||||
node.index = id;
|
||||
}
|
||||
else {
|
||||
node.responseName = id;
|
||||
}
|
||||
this.nodes.set(responsePathAsString(path), node);
|
||||
const parentNode = this.ensureParentNode(path);
|
||||
parentNode.child.push(node);
|
||||
return node;
|
||||
}
|
||||
ensureParentNode(path) {
|
||||
const parentPath = responsePathAsString(path.prev);
|
||||
const parentNode = this.nodes.get(parentPath);
|
||||
if (parentNode) {
|
||||
return parentNode;
|
||||
}
|
||||
return this.newNode(path.prev);
|
||||
}
|
||||
rewriteAndNormalizeError(err) {
|
||||
if (this.rewriteError) {
|
||||
const clonedError = Object.assign(Object.create(Object.getPrototypeOf(err)), err);
|
||||
const rewrittenError = this.rewriteError(clonedError);
|
||||
if (rewrittenError === null) {
|
||||
return null;
|
||||
}
|
||||
if (!(rewrittenError instanceof graphql_1.GraphQLError)) {
|
||||
return err;
|
||||
}
|
||||
return new graphql_1.GraphQLError(rewrittenError.message, err.nodes, err.source, err.positions, err.path, err.originalError, rewrittenError.extensions || err.extensions);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
}
|
||||
exports.TraceTreeBuilder = TraceTreeBuilder;
|
||||
function durationHrTimeToNanos(hrtime) {
|
||||
return hrtime[0] * 1e9 + hrtime[1];
|
||||
}
|
||||
function responsePathAsString(p) {
|
||||
if (p === undefined) {
|
||||
return '';
|
||||
}
|
||||
let res = String(p.key);
|
||||
while ((p = p.prev) !== undefined) {
|
||||
res = `${p.key}.${res}`;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
function errorToProtobufError(error) {
|
||||
return new apollo_reporting_protobuf_1.Trace.Error({
|
||||
message: error.message,
|
||||
location: (error.locations || []).map(({ line, column }) => new apollo_reporting_protobuf_1.Trace.Location({ line, column })),
|
||||
json: JSON.stringify(error),
|
||||
});
|
||||
}
|
||||
function dateToProtoTimestamp(date) {
|
||||
const totalMillis = +date;
|
||||
const millis = totalMillis % 1000;
|
||||
return new apollo_reporting_protobuf_1.google.protobuf.Timestamp({
|
||||
seconds: (totalMillis - millis) / 1000,
|
||||
nanos: millis * 1e6,
|
||||
});
|
||||
}
|
||||
exports.dateToProtoTimestamp = dateToProtoTimestamp;
|
||||
//# sourceMappingURL=traceTreeBuilder.js.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/traceTreeBuilder.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/traceTreeBuilder.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
node_modules/apollo-server-core/dist/plugin/usageReporting/defaultSendOperationsAsTrace.d.ts
generated
vendored
Normal file
3
node_modules/apollo-server-core/dist/plugin/usageReporting/defaultSendOperationsAsTrace.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { Trace } from 'apollo-reporting-protobuf';
|
||||
export declare function defaultSendOperationsAsTrace(): (trace: Trace, statsReportKey: string) => boolean;
|
||||
//# sourceMappingURL=defaultSendOperationsAsTrace.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/defaultSendOperationsAsTrace.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/defaultSendOperationsAsTrace.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"defaultSendOperationsAsTrace.d.ts","sourceRoot":"","sources":["../../../src/plugin/usageReporting/defaultSendOperationsAsTrace.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAIvD,wBAAgB,4BAA4B,YAwB3B,KAAK,kBAAkB,MAAM,KAAG,OAAO,CAyBvD"}
|
||||
50
node_modules/apollo-server-core/dist/plugin/usageReporting/defaultSendOperationsAsTrace.js
generated
vendored
Normal file
50
node_modules/apollo-server-core/dist/plugin/usageReporting/defaultSendOperationsAsTrace.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.defaultSendOperationsAsTrace = void 0;
|
||||
const lru_cache_1 = __importDefault(require("lru-cache"));
|
||||
const iterateOverTrace_1 = require("./iterateOverTrace");
|
||||
const durationHistogram_1 = require("./durationHistogram");
|
||||
function defaultSendOperationsAsTrace() {
|
||||
const cache = new lru_cache_1.default({
|
||||
max: Math.pow(2, 20),
|
||||
length: (_val, key) => {
|
||||
return (key && Buffer.byteLength(key)) || 0;
|
||||
},
|
||||
});
|
||||
return (trace, statsReportKey) => {
|
||||
var _a;
|
||||
const endTimeSeconds = (_a = trace.endTime) === null || _a === void 0 ? void 0 : _a.seconds;
|
||||
if (endTimeSeconds == null) {
|
||||
throw Error('programming error: endTime not set on trace');
|
||||
}
|
||||
const hasErrors = traceHasErrors(trace);
|
||||
const cacheKey = JSON.stringify([
|
||||
statsReportKey,
|
||||
durationHistogram_1.DurationHistogram.durationToBucket(trace.durationNs),
|
||||
Math.floor(endTimeSeconds / 60),
|
||||
hasErrors ? Math.floor(endTimeSeconds / 5) : '',
|
||||
]);
|
||||
if (cache.get(cacheKey)) {
|
||||
return false;
|
||||
}
|
||||
cache.set(cacheKey, true);
|
||||
return true;
|
||||
};
|
||||
}
|
||||
exports.defaultSendOperationsAsTrace = defaultSendOperationsAsTrace;
|
||||
function traceHasErrors(trace) {
|
||||
let hasErrors = false;
|
||||
function traceNodeStats(node) {
|
||||
var _a, _b;
|
||||
if (((_b = (_a = node.error) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0) {
|
||||
hasErrors = true;
|
||||
}
|
||||
return hasErrors;
|
||||
}
|
||||
iterateOverTrace_1.iterateOverTrace(trace, traceNodeStats, false);
|
||||
return hasErrors;
|
||||
}
|
||||
//# sourceMappingURL=defaultSendOperationsAsTrace.js.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/defaultSendOperationsAsTrace.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/defaultSendOperationsAsTrace.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"defaultSendOperationsAsTrace.js","sourceRoot":"","sources":["../../../src/plugin/usageReporting/defaultSendOperationsAsTrace.ts"],"names":[],"mappings":";;;;;;AAAA,0DAAiC;AAEjC,yDAAsD;AACtD,2DAAwD;AAExD,SAAgB,4BAA4B;IAO1C,MAAM,KAAK,GAAG,IAAI,mBAAQ,CAAe;QAWvC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC;QACpB,MAAM,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;YACpB,OAAO,CAAC,GAAG,IAAI,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC;QAC9C,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,CAAC,KAAY,EAAE,cAAsB,EAAW,EAAE;;QACvD,MAAM,cAAc,SAAG,KAAK,CAAC,OAAO,0CAAE,OAAO,CAAC;QAC9C,IAAI,cAAc,IAAI,IAAI,EAAE;YAC1B,MAAM,KAAK,CAAC,6CAA6C,CAAC,CAAC;SAC5D;QAED,MAAM,SAAS,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;QACxC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC;YAC9B,cAAc;YACd,qCAAiB,CAAC,gBAAgB,CAAC,KAAK,CAAC,UAAU,CAAC;YAEpD,IAAI,CAAC,KAAK,CAAC,cAAc,GAAG,EAAE,CAAC;YAG/B,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;SAChD,CAAC,CAAC;QAGH,IAAI,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;YACvB,OAAO,KAAK,CAAC;SACd;QAED,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC1B,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AAjDD,oEAiDC;AAID,SAAS,cAAc,CAAC,KAAY;IAClC,IAAI,SAAS,GAAG,KAAK,CAAC;IAEtB,SAAS,cAAc,CAAC,IAAiB;;QACvC,IAAI,aAAC,IAAI,CAAC,KAAK,0CAAE,MAAM,mCAAI,CAAC,CAAC,GAAG,CAAC,EAAE;YACjC,SAAS,GAAG,IAAI,CAAC;SAClB;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,mCAAgB,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,CAAC,CAAC;IAC/C,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
||||
16
node_modules/apollo-server-core/dist/plugin/usageReporting/durationHistogram.d.ts
generated
vendored
Normal file
16
node_modules/apollo-server-core/dist/plugin/usageReporting/durationHistogram.d.ts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
export interface DurationHistogramOptions {
|
||||
initSize?: number;
|
||||
buckets?: number[];
|
||||
}
|
||||
export declare class DurationHistogram {
|
||||
private readonly buckets;
|
||||
static readonly BUCKET_COUNT = 384;
|
||||
static readonly EXPONENT_LOG: number;
|
||||
toArray(): number[];
|
||||
static durationToBucket(durationNs: number): number;
|
||||
incrementDuration(durationNs: number): DurationHistogram;
|
||||
incrementBucket(bucket: number, value?: number): void;
|
||||
combine(otherHistogram: DurationHistogram): void;
|
||||
constructor(options?: DurationHistogramOptions);
|
||||
}
|
||||
//# sourceMappingURL=durationHistogram.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/durationHistogram.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/durationHistogram.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"durationHistogram.d.ts","sourceRoot":"","sources":["../../../src/plugin/usageReporting/durationHistogram.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AACD,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAW;IACnC,MAAM,CAAC,QAAQ,CAAC,YAAY,OAAO;IACnC,MAAM,CAAC,QAAQ,CAAC,YAAY,SAAiB;IAE7C,OAAO,IAAI,MAAM,EAAE;IAoBnB,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;IAYnD,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,iBAAiB;IAKxD,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,SAAI;IAgBzC,OAAO,CAAC,cAAc,EAAE,iBAAiB;gBAM7B,OAAO,CAAC,EAAE,wBAAwB;CAY/C"}
|
||||
67
node_modules/apollo-server-core/dist/plugin/usageReporting/durationHistogram.js
generated
vendored
Normal file
67
node_modules/apollo-server-core/dist/plugin/usageReporting/durationHistogram.js
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.DurationHistogram = void 0;
|
||||
class DurationHistogram {
|
||||
constructor(options) {
|
||||
const initSize = (options === null || options === void 0 ? void 0 : options.initSize) || 74;
|
||||
const buckets = options === null || options === void 0 ? void 0 : options.buckets;
|
||||
const arrayInitSize = Math.max((buckets === null || buckets === void 0 ? void 0 : buckets.length) || 0, initSize);
|
||||
this.buckets = Array(arrayInitSize).fill(0);
|
||||
if (buckets) {
|
||||
buckets.forEach((val, index) => (this.buckets[index] = val));
|
||||
}
|
||||
}
|
||||
toArray() {
|
||||
let bufferedZeroes = 0;
|
||||
const outputArray = [];
|
||||
for (const value of this.buckets) {
|
||||
if (value === 0) {
|
||||
bufferedZeroes++;
|
||||
}
|
||||
else {
|
||||
if (bufferedZeroes === 1) {
|
||||
outputArray.push(0);
|
||||
}
|
||||
else if (bufferedZeroes !== 0) {
|
||||
outputArray.push(-bufferedZeroes);
|
||||
}
|
||||
outputArray.push(value);
|
||||
bufferedZeroes = 0;
|
||||
}
|
||||
}
|
||||
return outputArray;
|
||||
}
|
||||
static durationToBucket(durationNs) {
|
||||
const log = Math.log(durationNs / 1000.0);
|
||||
const unboundedBucket = Math.ceil(log / DurationHistogram.EXPONENT_LOG);
|
||||
return unboundedBucket <= 0 || Number.isNaN(unboundedBucket)
|
||||
? 0
|
||||
: unboundedBucket >= DurationHistogram.BUCKET_COUNT
|
||||
? DurationHistogram.BUCKET_COUNT - 1
|
||||
: unboundedBucket;
|
||||
}
|
||||
incrementDuration(durationNs) {
|
||||
this.incrementBucket(DurationHistogram.durationToBucket(durationNs));
|
||||
return this;
|
||||
}
|
||||
incrementBucket(bucket, value = 1) {
|
||||
if (bucket >= DurationHistogram.BUCKET_COUNT) {
|
||||
throw Error('Bucket is out of bounds of the buckets array');
|
||||
}
|
||||
if (bucket >= this.buckets.length) {
|
||||
const oldLength = this.buckets.length;
|
||||
this.buckets.length = bucket + 1;
|
||||
this.buckets.fill(0, oldLength);
|
||||
}
|
||||
this.buckets[bucket] += value;
|
||||
}
|
||||
combine(otherHistogram) {
|
||||
for (let i = 0; i < otherHistogram.buckets.length; i++) {
|
||||
this.incrementBucket(i, otherHistogram.buckets[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.DurationHistogram = DurationHistogram;
|
||||
DurationHistogram.BUCKET_COUNT = 384;
|
||||
DurationHistogram.EXPONENT_LOG = Math.log(1.1);
|
||||
//# sourceMappingURL=durationHistogram.js.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/durationHistogram.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/durationHistogram.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"durationHistogram.js","sourceRoot":"","sources":["../../../src/plugin/usageReporting/durationHistogram.ts"],"names":[],"mappings":";;;AAIA,MAAa,iBAAiB;IAgE5B,YAAY,OAAkC;QAC5C,MAAM,QAAQ,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,KAAI,EAAE,CAAC;QACzC,MAAM,OAAO,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,CAAC;QAEjC,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,KAAI,CAAC,EAAE,QAAQ,CAAC,CAAC;QAE/D,IAAI,CAAC,OAAO,GAAG,KAAK,CAAS,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAEpD,IAAI,OAAO,EAAE;YACX,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;SAC9D;IACH,CAAC;IAtED,OAAO;QACL,IAAI,cAAc,GAAG,CAAC,CAAC;QACvB,MAAM,WAAW,GAAa,EAAE,CAAC;QAEjC,KAAK,MAAM,KAAK,IAAI,IAAI,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AAS,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;YACtC,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC;YACjC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;SACjC;QAED,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC;IAChC,CAAC;IAED,OAAO,CAAC,cAAiC;QACvC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACtD,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;SACpD;IACH,CAAC;;AA9DH,8CA4EC;AA1EiB,8BAAY,GAAG,GAAG,CAAC;AACnB,8BAAY,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC"}
|
||||
4
node_modules/apollo-server-core/dist/plugin/usageReporting/index.d.ts
generated
vendored
Normal file
4
node_modules/apollo-server-core/dist/plugin/usageReporting/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export { ApolloServerPluginUsageReporting, ApolloServerPluginUsageReportingDisabled, } from './plugin';
|
||||
export { ApolloServerPluginUsageReportingOptions, SendValuesBaseOptions, VariableValueOptions, ClientInfo, GenerateClientInfo, } from './options';
|
||||
export { ApolloServerPluginUsageReportingFromLegacyOptions, EngineReportingOptions, } from './legacyOptions';
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/index.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugin/usageReporting/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gCAAgC,EAChC,wCAAwC,GACzC,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,uCAAuC,EACvC,qBAAqB,EACrB,oBAAoB,EACpB,UAAU,EACV,kBAAkB,GACnB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,iDAAiD,EACjD,sBAAsB,GACvB,MAAM,iBAAiB,CAAC"}
|
||||
8
node_modules/apollo-server-core/dist/plugin/usageReporting/index.js
generated
vendored
Normal file
8
node_modules/apollo-server-core/dist/plugin/usageReporting/index.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var plugin_1 = require("./plugin");
|
||||
Object.defineProperty(exports, "ApolloServerPluginUsageReporting", { enumerable: true, get: function () { return plugin_1.ApolloServerPluginUsageReporting; } });
|
||||
Object.defineProperty(exports, "ApolloServerPluginUsageReportingDisabled", { enumerable: true, get: function () { return plugin_1.ApolloServerPluginUsageReportingDisabled; } });
|
||||
var legacyOptions_1 = require("./legacyOptions");
|
||||
Object.defineProperty(exports, "ApolloServerPluginUsageReportingFromLegacyOptions", { enumerable: true, get: function () { return legacyOptions_1.ApolloServerPluginUsageReportingFromLegacyOptions; } });
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/index.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugin/usageReporting/index.ts"],"names":[],"mappings":";;AAAA,mCAGkB;AAFhB,0HAAA,gCAAgC,OAAA;AAChC,kIAAA,wCAAwC,OAAA;AAS1C,iDAGyB;AAFvB,kJAAA,iDAAiD,OAAA"}
|
||||
7
node_modules/apollo-server-core/dist/plugin/usageReporting/iterateOverTrace.d.ts
generated
vendored
Normal file
7
node_modules/apollo-server-core/dist/plugin/usageReporting/iterateOverTrace.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import { Trace } from 'apollo-reporting-protobuf';
|
||||
export declare function iterateOverTrace(trace: Trace, f: (node: Trace.INode, path: ResponseNamePath) => boolean, includePath: boolean): void;
|
||||
export interface ResponseNamePath {
|
||||
toArray(): string[];
|
||||
child(responseName: string): ResponseNamePath;
|
||||
}
|
||||
//# sourceMappingURL=iterateOverTrace.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/iterateOverTrace.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/iterateOverTrace.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"iterateOverTrace.d.ts","sourceRoot":"","sources":["../../../src/plugin/usageReporting/iterateOverTrace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAoBlD,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,KAAK,EACZ,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,gBAAgB,KAAK,OAAO,EACzD,WAAW,EAAE,OAAO,QAYrB;AA8DD,MAAM,WAAW,gBAAgB;IAC/B,OAAO,IAAI,MAAM,EAAE,CAAC;IACpB,KAAK,CAAC,YAAY,EAAE,MAAM,GAAG,gBAAgB,CAAC;CAC/C"}
|
||||
82
node_modules/apollo-server-core/dist/plugin/usageReporting/iterateOverTrace.js
generated
vendored
Normal file
82
node_modules/apollo-server-core/dist/plugin/usageReporting/iterateOverTrace.js
generated
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.iterateOverTrace = void 0;
|
||||
function iterateOverTrace(trace, f, includePath) {
|
||||
const rootPath = includePath
|
||||
? new RootCollectingPathsResponseNamePath()
|
||||
: notCollectingPathsResponseNamePath;
|
||||
if (trace.root) {
|
||||
if (iterateOverTraceNode(trace.root, rootPath, f))
|
||||
return;
|
||||
}
|
||||
if (trace.queryPlan) {
|
||||
if (iterateOverQueryPlan(trace.queryPlan, rootPath, f))
|
||||
return;
|
||||
}
|
||||
}
|
||||
exports.iterateOverTrace = iterateOverTrace;
|
||||
function iterateOverQueryPlan(node, rootPath, f) {
|
||||
var _a, _b, _c, _d, _e;
|
||||
if (!node)
|
||||
return false;
|
||||
if (((_b = (_a = node.fetch) === null || _a === void 0 ? void 0 : _a.trace) === null || _b === void 0 ? void 0 : _b.root) && node.fetch.serviceName) {
|
||||
return iterateOverTraceNode(node.fetch.trace.root, rootPath.child(`service:${node.fetch.serviceName}`), f);
|
||||
}
|
||||
if ((_c = node.flatten) === null || _c === void 0 ? void 0 : _c.node) {
|
||||
return iterateOverQueryPlan(node.flatten.node, rootPath, f);
|
||||
}
|
||||
if ((_d = node.parallel) === null || _d === void 0 ? void 0 : _d.nodes) {
|
||||
return node.parallel.nodes.some((node) => iterateOverQueryPlan(node, rootPath, f));
|
||||
}
|
||||
if ((_e = node.sequence) === null || _e === void 0 ? void 0 : _e.nodes) {
|
||||
return node.sequence.nodes.some((node) => iterateOverQueryPlan(node, rootPath, f));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function iterateOverTraceNode(node, path, f) {
|
||||
var _a, _b;
|
||||
if (f(node, path)) {
|
||||
return true;
|
||||
}
|
||||
return ((_b = (_a = node.child) === null || _a === void 0 ? void 0 : _a.some((child) => {
|
||||
const childPath = child.responseName
|
||||
? path.child(child.responseName)
|
||||
: path;
|
||||
return iterateOverTraceNode(child, childPath, f);
|
||||
})) !== null && _b !== void 0 ? _b : false);
|
||||
}
|
||||
const notCollectingPathsResponseNamePath = {
|
||||
toArray() {
|
||||
throw Error('not collecting paths!');
|
||||
},
|
||||
child() {
|
||||
return this;
|
||||
},
|
||||
};
|
||||
class RootCollectingPathsResponseNamePath {
|
||||
toArray() {
|
||||
return [];
|
||||
}
|
||||
child(responseName) {
|
||||
return new ChildCollectingPathsResponseNamePath(responseName, this);
|
||||
}
|
||||
}
|
||||
class ChildCollectingPathsResponseNamePath {
|
||||
constructor(responseName, prev) {
|
||||
this.responseName = responseName;
|
||||
this.prev = prev;
|
||||
}
|
||||
toArray() {
|
||||
const out = [];
|
||||
let curr = this;
|
||||
while (curr instanceof ChildCollectingPathsResponseNamePath) {
|
||||
out.push(curr.responseName);
|
||||
curr = curr.prev;
|
||||
}
|
||||
return out.reverse();
|
||||
}
|
||||
child(responseName) {
|
||||
return new ChildCollectingPathsResponseNamePath(responseName, this);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=iterateOverTrace.js.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/iterateOverTrace.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/iterateOverTrace.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"iterateOverTrace.js","sourceRoot":"","sources":["../../../src/plugin/usageReporting/iterateOverTrace.ts"],"names":[],"mappings":";;;AAoBA,SAAgB,gBAAgB,CAC9B,KAAY,EACZ,CAAyD,EACzD,WAAoB;IAEpB,MAAM,QAAQ,GAAG,WAAW;QAC1B,CAAC,CAAC,IAAI,mCAAmC,EAAE;QAC3C,CAAC,CAAC,kCAAkC,CAAC;IACvC,IAAI,KAAK,CAAC,IAAI,EAAE;QACd,IAAI,oBAAoB,CAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;YAAE,OAAO;KAC3D;IAED,IAAI,KAAK,CAAC,SAAS,EAAE;QACnB,IAAI,oBAAoB,CAAC,KAAK,CAAC,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC;YAAE,OAAO;KAChE;AACH,CAAC;AAfD,4CAeC;AAGD,SAAS,oBAAoB,CAC3B,IAA0B,EAC1B,QAA0B,EAC1B,CAAyD;;IAEzD,IAAI,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC;IAExB,IAAI,aAAA,IAAI,CAAC,K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oB,CAAC,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;IACnD,CAAC,oCAAK,KAAK,CACZ,CAAC;AACJ,CAAC;AAOD,MAAM,kCAAkC,GAAqB;IAC3D,OAAO;QACL,MAAM,KAAK,CAAC,uBAAuB,CAAC,CAAC;IACvC,CAAC;IACD,KAAK;QACH,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAC;AAKF,MAAM,mCAAmC;IACvC,OAAO;QACL,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,KAAK,CAAC,YAAoB;QACxB,OAAO,IAAI,oCAAoC,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;IACtE,CAAC;CACF;AACD,MAAM,oCAAoC;IACxC,YACW,YAAoB,EACpB,IAAqC;QADrC,iBAAY,GAAZ,YAAY,CAAQ;QACpB,SAAI,GAAJ,IAAI,CAAiC;IAC7C,CAAC;IACJ,OAAO;QACL,MAAM,GAAG,GAAG,EAAE,CAAC;QACf,IAAI,IAAI,GAAoC,IAAI,CAAC;QACjD,OAAO,IAAI,YAAY,oCAAoC,EAAE;YAC3D,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAC5B,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;SAClB;QACD,OAAO,GAAG,CAAC,OAAO,EAAE,CAAC;IACvB,CAAC;IACD,KAAK,CAAC,YAAoB;QACxB,OAAO,IAAI,oCAAoC,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;IACtE,CAAC;CACF"}
|
||||
42
node_modules/apollo-server-core/dist/plugin/usageReporting/legacyOptions.d.ts
generated
vendored
Normal file
42
node_modules/apollo-server-core/dist/plugin/usageReporting/legacyOptions.d.ts
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
import { DocumentNode, GraphQLError } from 'graphql';
|
||||
import { RequestAgent } from 'apollo-server-env';
|
||||
import { Logger, GraphQLRequestContextDidResolveOperation, GraphQLRequestContextDidEncounterErrors } from 'apollo-server-types';
|
||||
import { ApolloServerPluginUsageReportingOptions, VariableValueOptions, SendValuesBaseOptions, GenerateClientInfo } from './options';
|
||||
import { ApolloServerPlugin } from 'apollo-server-plugin-base';
|
||||
export interface EngineReportingOptions<TContext> {
|
||||
apiKey?: string;
|
||||
calculateSignature?: (ast: DocumentNode, operationName: string) => string;
|
||||
reportIntervalMs?: number;
|
||||
maxUncompressedReportSize?: number;
|
||||
endpointUrl?: string;
|
||||
tracesEndpointUrl?: string;
|
||||
debugPrintReports?: boolean;
|
||||
requestAgent?: RequestAgent | false;
|
||||
maxAttempts?: number;
|
||||
minimumRetryDelayMs?: number;
|
||||
reportErrorFunction?: (err: Error) => void;
|
||||
sendVariableValues?: VariableValueOptions;
|
||||
reportTiming?: ReportTimingOptions<TContext>;
|
||||
privateVariables?: Array<String> | boolean;
|
||||
sendHeaders?: SendValuesBaseOptions;
|
||||
privateHeaders?: Array<String> | boolean;
|
||||
handleSignals?: boolean;
|
||||
sendReportsImmediately?: boolean;
|
||||
maskErrorDetails?: boolean;
|
||||
rewriteError?: (err: GraphQLError) => GraphQLError | null;
|
||||
schemaTag?: string;
|
||||
graphVariant?: string;
|
||||
generateClientInfo?: GenerateClientInfo<TContext>;
|
||||
reportSchema?: boolean;
|
||||
overrideReportedSchema?: string;
|
||||
schemaReportingInitialDelayMaxMs?: number;
|
||||
schemaReportingUrl?: string;
|
||||
logger?: Logger;
|
||||
experimental_schemaReporting?: boolean;
|
||||
experimental_overrideReportedSchema?: string;
|
||||
experimental_schemaReportingInitialDelayMaxMs?: number;
|
||||
}
|
||||
export declare type ReportTimingOptions<TContext> = ((request: GraphQLRequestContextDidResolveOperation<TContext> | GraphQLRequestContextDidEncounterErrors<TContext>) => Promise<boolean>) | boolean;
|
||||
export declare function ApolloServerPluginUsageReportingFromLegacyOptions<TContext>(options?: EngineReportingOptions<TContext>): ApolloServerPlugin;
|
||||
export declare function legacyOptionsToPluginOptions(engine: EngineReportingOptions<any>): ApolloServerPluginUsageReportingOptions<any>;
|
||||
//# sourceMappingURL=legacyOptions.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/legacyOptions.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/legacyOptions.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"legacyOptions.d.ts","sourceRoot":"","sources":["../../../src/plugin/usageReporting/legacyOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EACL,MAAM,EACN,wCAAwC,EACxC,uCAAuC,EACxC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,uCAAuC,EACvC,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAY/D,MAAM,WAAW,sBAAsB,CAAC,QAAQ;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kBAAkB,CAAC,EAAE,CAAC,GAAG,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,KAAK,MAAM,CAAC;IAC1E,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,YAAY,CAAC,EAAE,YAAY,GAAG,KAAK,CAAC;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,CAAC;IAC3C,kBAAkB,CAAC,EAAE,oBAAoB,CAAC;IAC1C,YA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AAC,GAAG,CAAC,CA0E9C"}
|
||||
82
node_modules/apollo-server-core/dist/plugin/usageReporting/legacyOptions.js
generated
vendored
Normal file
82
node_modules/apollo-server-core/dist/plugin/usageReporting/legacyOptions.js
generated
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.legacyOptionsToPluginOptions = exports.ApolloServerPluginUsageReportingFromLegacyOptions = void 0;
|
||||
const graphql_1 = require("graphql");
|
||||
const plugin_1 = require("./plugin");
|
||||
function ApolloServerPluginUsageReportingFromLegacyOptions(options = Object.create(null)) {
|
||||
return plugin_1.ApolloServerPluginUsageReporting(legacyOptionsToPluginOptions(options));
|
||||
}
|
||||
exports.ApolloServerPluginUsageReportingFromLegacyOptions = ApolloServerPluginUsageReportingFromLegacyOptions;
|
||||
function legacyOptionsToPluginOptions(engine) {
|
||||
var _a;
|
||||
const pluginOptions = {};
|
||||
pluginOptions.calculateSignature = engine.calculateSignature;
|
||||
pluginOptions.reportIntervalMs = engine.reportIntervalMs;
|
||||
pluginOptions.maxUncompressedReportSize = engine.maxUncompressedReportSize;
|
||||
pluginOptions.endpointUrl = (_a = engine.tracesEndpointUrl) !== null && _a !== void 0 ? _a : engine.endpointUrl;
|
||||
pluginOptions.debugPrintReports = engine.debugPrintReports;
|
||||
pluginOptions.requestAgent = engine.requestAgent;
|
||||
pluginOptions.maxAttempts = engine.maxAttempts;
|
||||
pluginOptions.minimumRetryDelayMs = engine.minimumRetryDelayMs;
|
||||
pluginOptions.reportErrorFunction = engine.reportErrorFunction;
|
||||
pluginOptions.sendVariableValues = engine.sendVariableValues;
|
||||
if (typeof engine.reportTiming === 'function') {
|
||||
pluginOptions.includeRequest = engine.reportTiming;
|
||||
}
|
||||
pluginOptions.sendHeaders = engine.sendHeaders;
|
||||
pluginOptions.sendReportsImmediately = engine.sendReportsImmediately;
|
||||
if (engine.maskErrorDetails && engine.rewriteError) {
|
||||
throw new Error("Can't set both maskErrorDetails and rewriteError!");
|
||||
}
|
||||
else if (engine.rewriteError && typeof engine.rewriteError !== 'function') {
|
||||
throw new Error('rewriteError must be a function');
|
||||
}
|
||||
else if (engine.maskErrorDetails) {
|
||||
pluginOptions.rewriteError = () => new graphql_1.GraphQLError('<masked>');
|
||||
delete engine.maskErrorDetails;
|
||||
}
|
||||
else if (engine.rewriteError) {
|
||||
pluginOptions.rewriteError = engine.rewriteError;
|
||||
}
|
||||
pluginOptions.generateClientInfo = engine.generateClientInfo;
|
||||
pluginOptions.logger = engine.logger;
|
||||
if (typeof engine.privateVariables !== 'undefined' &&
|
||||
engine.sendVariableValues) {
|
||||
throw new Error("You have set both the 'sendVariableValues' and the deprecated 'privateVariables' options. " +
|
||||
"Please only set 'sendVariableValues' (ideally, when calling `ApolloServerPluginUsageReporting` " +
|
||||
'instead of the deprecated `engine` option to the `ApolloServer` constructor).');
|
||||
}
|
||||
else if (typeof engine.privateVariables !== 'undefined') {
|
||||
if (engine.privateVariables !== null) {
|
||||
pluginOptions.sendVariableValues = makeSendValuesBaseOptionsFromLegacy(engine.privateVariables);
|
||||
}
|
||||
}
|
||||
else {
|
||||
pluginOptions.sendVariableValues = engine.sendVariableValues;
|
||||
}
|
||||
if (typeof engine.privateHeaders !== 'undefined' && engine.sendHeaders) {
|
||||
throw new Error("You have set both the 'sendHeaders' and the deprecated 'privateVariables' options. " +
|
||||
"Please only set 'sendHeaders' (ideally, when calling `ApolloServerPluginUsageReporting` " +
|
||||
'instead of the deprecated `engine` option to the `ApolloServer` constructor).');
|
||||
}
|
||||
else if (typeof engine.privateHeaders !== 'undefined') {
|
||||
if (engine.privateHeaders !== null) {
|
||||
pluginOptions.sendHeaders = makeSendValuesBaseOptionsFromLegacy(engine.privateHeaders);
|
||||
}
|
||||
}
|
||||
else {
|
||||
pluginOptions.sendHeaders = engine.sendHeaders;
|
||||
}
|
||||
return pluginOptions;
|
||||
}
|
||||
exports.legacyOptionsToPluginOptions = legacyOptionsToPluginOptions;
|
||||
function makeSendValuesBaseOptionsFromLegacy(legacyPrivateOption) {
|
||||
return Array.isArray(legacyPrivateOption)
|
||||
? {
|
||||
exceptNames: legacyPrivateOption,
|
||||
}
|
||||
: legacyPrivateOption
|
||||
? { none: true }
|
||||
: { all: true };
|
||||
}
|
||||
//# sourceMappingURL=legacyOptions.js.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/legacyOptions.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/legacyOptions.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"legacyOptions.js","sourceRoot":"","sources":["../../../src/plugin/usageReporting/legacyOptions.ts"],"names":[],"mappings":";;;AAAA,qCAAqD;AAcrD,qCAA4D;AAqD5D,SAAgB,iDAAiD,CAC/D,UAA4C,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;IAE/D,OAAO,yCAAgC,CACrC,4BAA4B,CAAC,OAAO,CAAC,CACtC,CAAC;AACJ,CAAC;AAND,8GAMC;AAOD,SAAgB,4BAA4B,CAC1C,MAAmC;;IAEnC,MAAM,aAAa,GAAiD,EAAE,CAAC;IAIvE,aAAa,CAAC,kBAAkB,GAAG,MAAM,CAAC,kBAAkB,CAAC;IAC7D,aAAa,CAAC,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC;IACzD,aAAa,CAAC,yBAAyB,GAAG,MAAM,CAAC,yBAAyB,CAAC;IAC3E,aAAa,CAAC,WAAW,SAAG,MAAM,CAAC,iBAAiB,mCAAI,MAAM,CAAC,WAAW,CAAC;IAC3E,aAAa,CAAC,iBAAiB,GAAG,MAAM,CAAC,iBAAiB,CAAC;IAC3D,aAAa,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;IACjD,aAAa,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;IAC/C,aAAa,CAAC,mBAAmB,GAAG,MAAM,CAAC,mBAAmB,CAAC;IAC/D,aAAa,CAAC,mBA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AAE;YACpC,aAAa,CAAC,kBAAkB,GAAG,mCAAmC,CACpE,MAAM,CAAC,gBAAgB,CACxB,CAAC;SACH;KACF;SAAM;QACL,aAAa,CAAC,kBAAkB,GAAG,MAAM,CAAC,kBAAkB,CAAC;KAC9D;IAGD,IAAI,OAAO,MAAM,CAAC,cAAc,KAAK,WAAW,IAAI,MAAM,CAAC,WAAW,EAAE;QACtE,MAAM,IAAI,KAAK,CACb,qFAAqF;YACnF,0FAA0F;YAC1F,+EAA+E,CAClF,CAAC;KACH;SAAM,IAAI,OAAO,MAAM,CAAC,cAAc,KAAK,WAAW,EAAE;QACvD,IAAI,MAAM,CAAC,cAAc,KAAK,IAAI,EAAE;YAClC,aAAa,CAAC,WAAW,GAAG,mCAAmC,CAC7D,MAAM,CAAC,cAAc,CACtB,CAAC;SACH;KACF;SAAM;QACL,aAAa,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;KAChD;IACD,OAAO,aAAa,CAAC;AACvB,CAAC;AA5ED,oEA4EC;AAKD,SAAS,mCAAmC,CAC1C,mBAA4C;IAE5C,OAAO,KAAK,CAAC,OAAO,CAAC,mBAAmB,CAAC;QACvC,CAAC,CAAC;YACE,WAAW,EAAE,mBAAmB;SACjC;QACH,CAAC,CAAC,mBAAmB;YACrB,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE;YAChB,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;AACpB,CAAC"}
|
||||
51
node_modules/apollo-server-core/dist/plugin/usageReporting/options.d.ts
generated
vendored
Normal file
51
node_modules/apollo-server-core/dist/plugin/usageReporting/options.d.ts
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
import { GraphQLError, DocumentNode } from 'graphql';
|
||||
import { GraphQLRequestContextDidResolveOperation, GraphQLRequestContextDidEncounterErrors, Logger, GraphQLRequestContext } from 'apollo-server-types';
|
||||
import type { fetch, RequestAgent } from 'apollo-server-env';
|
||||
import type { Trace } from 'apollo-reporting-protobuf';
|
||||
export interface ApolloServerPluginUsageReportingOptions<TContext> {
|
||||
sendVariableValues?: VariableValueOptions;
|
||||
sendHeaders?: SendValuesBaseOptions;
|
||||
rewriteError?: (err: GraphQLError) => GraphQLError | null;
|
||||
includeRequest?: (request: GraphQLRequestContextDidResolveOperation<TContext> | GraphQLRequestContextDidEncounterErrors<TContext>) => Promise<boolean>;
|
||||
generateClientInfo?: GenerateClientInfo<TContext>;
|
||||
overrideReportedSchema?: string;
|
||||
sendUnexecutableOperationDocuments?: boolean;
|
||||
experimental_sendOperationAsTrace?: (trace: Trace, statsReportKey: string) => boolean;
|
||||
sendReportsImmediately?: boolean;
|
||||
requestAgent?: RequestAgent | false;
|
||||
fetcher?: typeof fetch;
|
||||
reportIntervalMs?: number;
|
||||
maxUncompressedReportSize?: number;
|
||||
maxAttempts?: number;
|
||||
minimumRetryDelayMs?: number;
|
||||
logger?: Logger;
|
||||
reportErrorFunction?: (err: Error) => void;
|
||||
endpointUrl?: string;
|
||||
debugPrintReports?: boolean;
|
||||
calculateSignature?: (ast: DocumentNode, operationName: string) => string;
|
||||
internal_includeTracesContributingToStats?: boolean;
|
||||
}
|
||||
export declare type SendValuesBaseOptions = {
|
||||
onlyNames: Array<String>;
|
||||
} | {
|
||||
exceptNames: Array<String>;
|
||||
} | {
|
||||
all: true;
|
||||
} | {
|
||||
none: true;
|
||||
};
|
||||
declare type VariableValueTransformOptions = {
|
||||
variables: Record<string, any>;
|
||||
operationString?: string;
|
||||
};
|
||||
export declare type VariableValueOptions = {
|
||||
transform: (options: VariableValueTransformOptions) => Record<string, any>;
|
||||
} | SendValuesBaseOptions;
|
||||
export interface ClientInfo {
|
||||
clientName?: string;
|
||||
clientVersion?: string;
|
||||
clientReferenceId?: string;
|
||||
}
|
||||
export declare type GenerateClientInfo<TContext> = (requestContext: GraphQLRequestContext<TContext>) => ClientInfo;
|
||||
export {};
|
||||
//# sourceMappingURL=options.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/options.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/options.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/plugin/usageReporting/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EACL,wCAAwC,EACxC,uCAAuC,EACvC,MAAM,EACN,qBAAqB,EACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAEvD,MAAM,WAAW,uCAAuC,CAAC,QAAQ;IAiB/D,kBAAkB,CAAC,EAAE,oBAAoB,CAAC;IAiB1C,WAAW,CAAC,EAAE,qBAAqB,CAAC;IAOpC,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,YAAY,KAAK,YAAY,GAAG,IAAI,CAAC;IAwC1D,cAAc,CAAC,EAAE,CACf,OAAO,EACH,wCAAwC,CAAC,QAAQ,CAAC,GAClD,uCAAuC,CAAC,QAAQ,CAAC,KAClD,OAAO,CAAC,OAAO,CAAC,CAAC;IAQtB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAQlD,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAShC,kCAAkC,CAAC,EAAE,OAAO,CAAC;IAgB7C,iCAAiC,CAAC,EAAE,CAClC,KAAK,EAAE,KAAK,EACZ,cAAc,EAAE,MAAM,KACnB,OAAO,CAAC;IAab,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAKjC,YAAY,CAAC,EAAE,YAAY,GAAG,KAAK,CAAC;IAIpC,OAAO,CAAC,EAAE,OAAO,KAAK,CAAC;IAKvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAO1B,yBA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ageReporting/options.js
generated
vendored
Normal file
3
node_modules/apollo-server-core/dist/plugin/usageReporting/options.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=options.js.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/options.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/options.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../../src/plugin/usageReporting/options.ts"],"names":[],"mappings":""}
|
||||
8
node_modules/apollo-server-core/dist/plugin/usageReporting/plugin.d.ts
generated
vendored
Normal file
8
node_modules/apollo-server-core/dist/plugin/usageReporting/plugin.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import { Trace } from 'apollo-reporting-protobuf';
|
||||
import { Headers } from 'apollo-server-env';
|
||||
import { ApolloServerPluginUsageReportingOptions, SendValuesBaseOptions } from './options';
|
||||
import type { InternalApolloServerPlugin } from '../internalPlugin';
|
||||
export declare function ApolloServerPluginUsageReporting<TContext>(options?: ApolloServerPluginUsageReportingOptions<TContext>): InternalApolloServerPlugin;
|
||||
export declare function makeHTTPRequestHeaders(http: Trace.IHTTP, headers: Headers, sendHeaders?: SendValuesBaseOptions): void;
|
||||
export declare function ApolloServerPluginUsageReportingDisabled(): InternalApolloServerPlugin;
|
||||
//# sourceMappingURL=plugin.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/plugin.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/plugin.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/plugin/usageReporting/plugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAwB,KAAK,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAmB,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAc7D,OAAO,EACL,uCAAuC,EACvC,qBAAqB,EACtB,MAAM,WAAW,CAAC;AAKnB,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AA+BpE,wBAAgB,gCAAgC,CAAC,QAAQ,EACvD,OAAO,GAAE,uCAAuC,CAAC,QAAQ,CAExD,GACA,0BAA0B,CAspB5B;AAED,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,KAAK,CAAC,KAAK,EACjB,OAAO,EAAE,OAAO,EAChB,WAAW,CAAC,EAAE,qBAAqB,GAClC,IAAI,CAsCN;AA+BD,wBAAgB,wCAAwC,IAAI,0BAA0B,CAMrF"}
|
||||
470
node_modules/apollo-server-core/dist/plugin/usageReporting/plugin.js
generated
vendored
Normal file
470
node_modules/apollo-server-core/dist/plugin/usageReporting/plugin.js
generated
vendored
Normal file
@@ -0,0 +1,470 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ApolloServerPluginUsageReportingDisabled = exports.makeHTTPRequestHeaders = exports.ApolloServerPluginUsageReporting = void 0;
|
||||
const os_1 = __importDefault(require("os"));
|
||||
const zlib_1 = require("zlib");
|
||||
const async_retry_1 = __importDefault(require("async-retry"));
|
||||
const apollo_graphql_1 = require("apollo-graphql");
|
||||
const apollo_reporting_protobuf_1 = require("apollo-reporting-protobuf");
|
||||
const apollo_server_env_1 = require("apollo-server-env");
|
||||
const signatureCache_1 = require("./signatureCache");
|
||||
const traceTreeBuilder_1 = require("../traceTreeBuilder");
|
||||
const traceDetails_1 = require("./traceDetails");
|
||||
const graphql_1 = require("graphql");
|
||||
const schemaReporting_1 = require("../schemaReporting");
|
||||
const stats_1 = require("./stats");
|
||||
const apollo_cache_control_1 = require("apollo-cache-control");
|
||||
const defaultSendOperationsAsTrace_1 = require("./defaultSendOperationsAsTrace");
|
||||
const reportHeaderDefaults = {
|
||||
hostname: os_1.default.hostname(),
|
||||
agentVersion: `apollo-server-core@${require('../../../package.json').version}`,
|
||||
runtimeVersion: `node ${process.version}`,
|
||||
uname: `${os_1.default.platform()}, ${os_1.default.type()}, ${os_1.default.release()}, ${os_1.default.arch()})`,
|
||||
};
|
||||
class ReportData {
|
||||
constructor(executableSchemaId, graphRef) {
|
||||
this.header = new apollo_reporting_protobuf_1.ReportHeader(Object.assign(Object.assign({}, reportHeaderDefaults), { executableSchemaId,
|
||||
graphRef }));
|
||||
this.reset();
|
||||
}
|
||||
reset() {
|
||||
this.report = new stats_1.OurReport(this.header);
|
||||
}
|
||||
}
|
||||
function ApolloServerPluginUsageReporting(options = Object.create(null)) {
|
||||
let requestDidStartHandler;
|
||||
return {
|
||||
__internal_plugin_id__() {
|
||||
return 'UsageReporting';
|
||||
},
|
||||
requestDidStart(requestContext) {
|
||||
if (!requestDidStartHandler) {
|
||||
throw Error('The usage reporting plugin has been asked to handle a request before the ' +
|
||||
'server has started. See https://github.com/apollographql/apollo-server/issues/4588 ' +
|
||||
'for more details.');
|
||||
}
|
||||
return requestDidStartHandler(requestContext);
|
||||
},
|
||||
serverWillStart({ logger: serverLogger, apollo, serverlessFramework, }) {
|
||||
var _a, _b, _c, _d;
|
||||
const logger = (_a = options.logger) !== null && _a !== void 0 ? _a : serverLogger;
|
||||
const { key, graphRef } = apollo;
|
||||
if (!(key && graphRef)) {
|
||||
throw new Error("You've enabled usage reporting via ApolloServerPluginUsageReporting, " +
|
||||
'but you also need to provide your Apollo API key and graph ref, via ' +
|
||||
'the APOLLO_KEY/APOLLO_GRAPH_REF environment ' +
|
||||
'variables or via `new ApolloServer({apollo: {key, graphRef})`.');
|
||||
}
|
||||
logger.info('Apollo usage reporting starting! See your graph at ' +
|
||||
`https://studio.apollographql.com/graph/${encodeURI(graphRef)}/`);
|
||||
const sendReportsImmediately = (_b = options.sendReportsImmediately) !== null && _b !== void 0 ? _b : serverlessFramework;
|
||||
const signatureCache = signatureCache_1.createSignatureCache({ logger });
|
||||
const reportDataByExecutableSchemaId = Object.create(null);
|
||||
const overriddenExecutableSchemaId = options.overrideReportedSchema
|
||||
? schemaReporting_1.computeCoreSchemaHash(options.overrideReportedSchema)
|
||||
: undefined;
|
||||
let lastSeenExecutableSchemaToId;
|
||||
let reportTimer;
|
||||
if (!sendReportsImmediately) {
|
||||
reportTimer = setInterval(() => sendAllReportsAndReportErrors(), options.reportIntervalMs || 10 * 1000);
|
||||
}
|
||||
let graphMightSupportTraces = true;
|
||||
const sendOperationAsTrace = (_c = options.experimental_sendOperationAsTrace) !== null && _c !== void 0 ? _c : defaultSendOperationsAsTrace_1.defaultSendOperationsAsTrace();
|
||||
const includeTracesContributingToStats = (_d = options.internal_includeTracesContributingToStats) !== null && _d !== void 0 ? _d : false;
|
||||
let stopped = false;
|
||||
function executableSchemaIdForSchema(schema) {
|
||||
if ((lastSeenExecutableSchemaToId === null || lastSeenExecutableSchemaToId === void 0 ? void 0 : lastSeenExecutableSchemaToId.executableSchema) === schema) {
|
||||
return lastSeenExecutableSchemaToId.executableSchemaId;
|
||||
}
|
||||
const id = schemaReporting_1.computeCoreSchemaHash(graphql_1.printSchema(schema));
|
||||
lastSeenExecutableSchemaToId = {
|
||||
executableSchema: schema,
|
||||
executableSchemaId: id,
|
||||
};
|
||||
return id;
|
||||
}
|
||||
const getReportData = (executableSchemaId) => {
|
||||
const existing = reportDataByExecutableSchemaId[executableSchemaId];
|
||||
if (existing) {
|
||||
return existing;
|
||||
}
|
||||
const reportData = new ReportData(executableSchemaId, graphRef);
|
||||
reportDataByExecutableSchemaId[executableSchemaId] = reportData;
|
||||
return reportData;
|
||||
};
|
||||
function sendAllReportsAndReportErrors() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield Promise.all(Object.keys(reportDataByExecutableSchemaId).map((executableSchemaId) => sendReportAndReportErrors(executableSchemaId)));
|
||||
});
|
||||
}
|
||||
function sendReportAndReportErrors(executableSchemaId) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return sendReport(executableSchemaId).catch((err) => {
|
||||
if (options.reportErrorFunction) {
|
||||
options.reportErrorFunction(err);
|
||||
}
|
||||
else {
|
||||
logger.error(err.message);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
const sendReport = (executableSchemaId) => __awaiter(this, void 0, void 0, function* () {
|
||||
var _e, _f;
|
||||
const reportData = getReportData(executableSchemaId);
|
||||
const { report } = reportData;
|
||||
reportData.reset();
|
||||
if (Object.keys(report.tracesPerQuery).length === 0) {
|
||||
return;
|
||||
}
|
||||
report.endTime = traceTreeBuilder_1.dateToProtoTimestamp(new Date());
|
||||
const protobufError = apollo_reporting_protobuf_1.Report.verify(report);
|
||||
if (protobufError) {
|
||||
throw new Error(`Error encoding report: ${protobufError}`);
|
||||
}
|
||||
const message = apollo_reporting_protobuf_1.Report.encode(report).finish();
|
||||
if (options.debugPrintReports) {
|
||||
const decodedReport = apollo_reporting_protobuf_1.Report.decode(message);
|
||||
logger.warn(`Apollo usage report: ${JSON.stringify(decodedReport.toJSON())}`);
|
||||
}
|
||||
const compressed = yield new Promise((resolve, reject) => {
|
||||
const messageBuffer = Buffer.from(message.buffer, message.byteOffset, message.byteLength);
|
||||
zlib_1.gzip(messageBuffer, (err, gzipResult) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
}
|
||||
else {
|
||||
resolve(gzipResult);
|
||||
}
|
||||
});
|
||||
});
|
||||
const fetcher = (_e = options.fetcher) !== null && _e !== void 0 ? _e : apollo_server_env_1.fetch;
|
||||
const response = yield async_retry_1.default(() => __awaiter(this, void 0, void 0, function* () {
|
||||
const curResponse = yield fetcher((options.endpointUrl ||
|
||||
'https://usage-reporting.api.apollographql.com') +
|
||||
'/api/ingress/traces', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'user-agent': 'ApolloServerPluginUsageReporting',
|
||||
'x-api-key': key,
|
||||
'content-encoding': 'gzip',
|
||||
accept: 'application/json',
|
||||
},
|
||||
body: compressed,
|
||||
agent: options.requestAgent,
|
||||
});
|
||||
if (curResponse.status >= 500 && curResponse.status < 600) {
|
||||
throw new Error(`HTTP status ${curResponse.status}, ${(yield curResponse.text()) || '(no body)'}`);
|
||||
}
|
||||
else {
|
||||
return curResponse;
|
||||
}
|
||||
}), {
|
||||
retries: (options.maxAttempts || 5) - 1,
|
||||
minTimeout: options.minimumRetryDelayMs || 100,
|
||||
factor: 2,
|
||||
}).catch((err) => {
|
||||
throw new Error(`Error sending report to Apollo servers: ${err.message}`);
|
||||
});
|
||||
if (response.status < 200 || response.status >= 300) {
|
||||
throw new Error(`Error sending report to Apollo servers: HTTP status ${response.status}, ${(yield response.text()) || '(no body)'}`);
|
||||
}
|
||||
if (graphMightSupportTraces &&
|
||||
response.status === 200 && ((_f = response.headers
|
||||
.get('content-type')) === null || _f === void 0 ? void 0 : _f.match(/^\s*application\/json\s*(?:;|$)/i))) {
|
||||
const body = yield response.text();
|
||||
let parsedBody;
|
||||
try {
|
||||
parsedBody = JSON.parse(body);
|
||||
}
|
||||
catch (e) {
|
||||
throw new Error(`Error parsing response from Apollo servers: ${e}`);
|
||||
}
|
||||
if (parsedBody.tracesIgnored === true) {
|
||||
logger.debug("This graph's organization does not have access to traces; sending all " +
|
||||
'subsequent operations as traces.');
|
||||
graphMightSupportTraces = false;
|
||||
}
|
||||
}
|
||||
if (options.debugPrintReports) {
|
||||
logger.warn(`Apollo usage report: status ${response.status}`);
|
||||
}
|
||||
});
|
||||
requestDidStartHandler = ({ logger: requestLogger, metrics, schema, request: { http, variables }, }) => {
|
||||
var _a;
|
||||
const logger = (_a = requestLogger !== null && requestLogger !== void 0 ? requestLogger : options.logger) !== null && _a !== void 0 ? _a : serverLogger;
|
||||
const treeBuilder = new traceTreeBuilder_1.TraceTreeBuilder({
|
||||
rewriteError: options.rewriteError,
|
||||
logger,
|
||||
});
|
||||
treeBuilder.startTiming();
|
||||
metrics.startHrTime = treeBuilder.startHrTime;
|
||||
let graphqlValidationFailure = false;
|
||||
let graphqlUnknownOperationName = false;
|
||||
if (http) {
|
||||
treeBuilder.trace.http = new apollo_reporting_protobuf_1.Trace.HTTP({
|
||||
method: apollo_reporting_protobuf_1.Trace.HTTP.Method[http.method] || apollo_reporting_protobuf_1.Trace.HTTP.Method.UNKNOWN,
|
||||
host: null,
|
||||
path: null,
|
||||
});
|
||||
if (options.sendHeaders) {
|
||||
makeHTTPRequestHeaders(treeBuilder.trace.http, http.headers, options.sendHeaders);
|
||||
}
|
||||
}
|
||||
function shouldIncludeRequest(requestContext) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (metrics.captureTraces !== undefined)
|
||||
return;
|
||||
if (typeof options.includeRequest !== 'function') {
|
||||
metrics.captureTraces = true;
|
||||
return;
|
||||
}
|
||||
metrics.captureTraces = yield options.includeRequest(requestContext);
|
||||
if (typeof metrics.captureTraces !== 'boolean') {
|
||||
logger.warn("The 'includeRequest' async predicate function must return a boolean value.");
|
||||
metrics.captureTraces = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
let endDone = false;
|
||||
function didEnd(requestContext) {
|
||||
if (endDone)
|
||||
return;
|
||||
endDone = true;
|
||||
treeBuilder.stopTiming();
|
||||
if (metrics.captureTraces === undefined) {
|
||||
logger.warn('captureTrace is undefined at the end of the request. This is a bug in ApolloServerPluginUsageReporting.');
|
||||
}
|
||||
if (metrics.captureTraces === false)
|
||||
return;
|
||||
treeBuilder.trace.fullQueryCacheHit = !!metrics.responseCacheHit;
|
||||
treeBuilder.trace.forbiddenOperation = !!metrics.forbiddenOperation;
|
||||
treeBuilder.trace.registeredOperation = !!metrics.registeredOperation;
|
||||
if (requestContext.overallCachePolicy) {
|
||||
treeBuilder.trace.cachePolicy = new apollo_reporting_protobuf_1.Trace.CachePolicy({
|
||||
scope: requestContext.overallCachePolicy.scope === apollo_cache_control_1.CacheScope.Private
|
||||
? apollo_reporting_protobuf_1.Trace.CachePolicy.Scope.PRIVATE
|
||||
: requestContext.overallCachePolicy.scope ===
|
||||
apollo_cache_control_1.CacheScope.Public
|
||||
? apollo_reporting_protobuf_1.Trace.CachePolicy.Scope.PUBLIC
|
||||
: apollo_reporting_protobuf_1.Trace.CachePolicy.Scope.UNKNOWN,
|
||||
maxAgeNs: requestContext.overallCachePolicy.maxAge * 1e9,
|
||||
});
|
||||
}
|
||||
const operationName = requestContext.operationName ||
|
||||
requestContext.request.operationName ||
|
||||
'';
|
||||
if (metrics.queryPlanTrace) {
|
||||
treeBuilder.trace.queryPlan = metrics.queryPlanTrace;
|
||||
}
|
||||
addTrace().catch(logger.error);
|
||||
function addTrace() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (stopped) {
|
||||
return;
|
||||
}
|
||||
yield new Promise((res) => setImmediate(res));
|
||||
const executableSchemaId = overriddenExecutableSchemaId !== null && overriddenExecutableSchemaId !== void 0 ? overriddenExecutableSchemaId : executableSchemaIdForSchema(schema);
|
||||
const reportData = getReportData(executableSchemaId);
|
||||
const { report } = reportData;
|
||||
const { trace } = treeBuilder;
|
||||
let statsReportKey = undefined;
|
||||
if (!requestContext.document) {
|
||||
statsReportKey = `## GraphQLParseFailure\n`;
|
||||
}
|
||||
else if (graphqlValidationFailure) {
|
||||
statsReportKey = `## GraphQLValidationFailure\n`;
|
||||
}
|
||||
else if (graphqlUnknownOperationName) {
|
||||
statsReportKey = `## GraphQLUnknownOperationName\n`;
|
||||
}
|
||||
if (statsReportKey) {
|
||||
if (options.sendUnexecutableOperationDocuments) {
|
||||
trace.unexecutedOperationBody = requestContext.source;
|
||||
trace.unexecutedOperationName = operationName;
|
||||
}
|
||||
}
|
||||
else {
|
||||
const signature = getTraceSignature();
|
||||
statsReportKey = `# ${operationName || '-'}\n${signature}`;
|
||||
}
|
||||
const protobufError = apollo_reporting_protobuf_1.Trace.verify(trace);
|
||||
if (protobufError) {
|
||||
throw new Error(`Error encoding trace: ${protobufError}`);
|
||||
}
|
||||
report.addTrace({
|
||||
statsReportKey,
|
||||
trace,
|
||||
asTrace: graphMightSupportTraces &&
|
||||
sendOperationAsTrace(trace, statsReportKey),
|
||||
includeTracesContributingToStats,
|
||||
});
|
||||
if (sendReportsImmediately ||
|
||||
report.sizeEstimator.bytes >=
|
||||
(options.maxUncompressedReportSize || 4 * 1024 * 1024)) {
|
||||
yield sendReportAndReportErrors(executableSchemaId);
|
||||
}
|
||||
});
|
||||
}
|
||||
function getTraceSignature() {
|
||||
if (!requestContext.document) {
|
||||
throw new Error('No document?');
|
||||
}
|
||||
const cacheKey = signatureCache_1.signatureCacheKey(requestContext.queryHash, operationName);
|
||||
const cachedSignature = signatureCache.get(cacheKey);
|
||||
if (cachedSignature) {
|
||||
return cachedSignature;
|
||||
}
|
||||
const generatedSignature = (options.calculateSignature || apollo_graphql_1.defaultUsageReportingSignature)(requestContext.document, operationName);
|
||||
signatureCache.set(cacheKey, generatedSignature);
|
||||
return generatedSignature;
|
||||
}
|
||||
}
|
||||
let didResolveSource = false;
|
||||
return {
|
||||
didResolveSource(requestContext) {
|
||||
didResolveSource = true;
|
||||
if (metrics.persistedQueryHit) {
|
||||
treeBuilder.trace.persistedQueryHit = true;
|
||||
}
|
||||
if (metrics.persistedQueryRegister) {
|
||||
treeBuilder.trace.persistedQueryRegister = true;
|
||||
}
|
||||
if (variables) {
|
||||
treeBuilder.trace.details = traceDetails_1.makeTraceDetails(variables, options.sendVariableValues, requestContext.source);
|
||||
}
|
||||
const clientInfo = (options.generateClientInfo || defaultGenerateClientInfo)(requestContext);
|
||||
if (clientInfo) {
|
||||
const { clientName, clientVersion, clientReferenceId, } = clientInfo;
|
||||
treeBuilder.trace.clientVersion = clientVersion || '';
|
||||
treeBuilder.trace.clientReferenceId = clientReferenceId || '';
|
||||
treeBuilder.trace.clientName = clientName || '';
|
||||
}
|
||||
},
|
||||
validationDidStart() {
|
||||
return (validationErrors) => {
|
||||
graphqlValidationFailure = validationErrors
|
||||
? validationErrors.length !== 0
|
||||
: false;
|
||||
};
|
||||
},
|
||||
didResolveOperation(requestContext) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
graphqlUnknownOperationName =
|
||||
requestContext.operation === undefined;
|
||||
yield shouldIncludeRequest(requestContext);
|
||||
if (metrics.captureTraces === false) {
|
||||
didEnd(requestContext);
|
||||
}
|
||||
});
|
||||
},
|
||||
executionDidStart() {
|
||||
if (endDone)
|
||||
return;
|
||||
return {
|
||||
willResolveField({ info }) {
|
||||
return treeBuilder.willResolveField(info);
|
||||
},
|
||||
};
|
||||
},
|
||||
willSendResponse(requestContext) {
|
||||
didEnd(requestContext);
|
||||
},
|
||||
didEncounterErrors(requestContext) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!didResolveSource || endDone)
|
||||
return;
|
||||
treeBuilder.didEncounterErrors(requestContext.errors);
|
||||
yield shouldIncludeRequest(requestContext);
|
||||
didEnd(requestContext);
|
||||
});
|
||||
},
|
||||
};
|
||||
};
|
||||
return {
|
||||
serverWillStop() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (reportTimer) {
|
||||
clearInterval(reportTimer);
|
||||
reportTimer = undefined;
|
||||
}
|
||||
stopped = true;
|
||||
yield sendAllReportsAndReportErrors();
|
||||
});
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
}
|
||||
exports.ApolloServerPluginUsageReporting = ApolloServerPluginUsageReporting;
|
||||
function makeHTTPRequestHeaders(http, headers, sendHeaders) {
|
||||
if (!sendHeaders ||
|
||||
('none' in sendHeaders && sendHeaders.none) ||
|
||||
('all' in sendHeaders && !sendHeaders.all)) {
|
||||
return;
|
||||
}
|
||||
for (const [key, value] of headers) {
|
||||
const lowerCaseKey = key.toLowerCase();
|
||||
if (('exceptNames' in sendHeaders &&
|
||||
sendHeaders.exceptNames.some((exceptHeader) => {
|
||||
return exceptHeader.toLowerCase() === lowerCaseKey;
|
||||
})) ||
|
||||
('onlyNames' in sendHeaders &&
|
||||
!sendHeaders.onlyNames.some((header) => {
|
||||
return header.toLowerCase() === lowerCaseKey;
|
||||
}))) {
|
||||
continue;
|
||||
}
|
||||
switch (key) {
|
||||
case 'authorization':
|
||||
case 'cookie':
|
||||
case 'set-cookie':
|
||||
break;
|
||||
default:
|
||||
http.requestHeaders[key] = new apollo_reporting_protobuf_1.Trace.HTTP.Values({
|
||||
value: [value],
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.makeHTTPRequestHeaders = makeHTTPRequestHeaders;
|
||||
function defaultGenerateClientInfo({ request }) {
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
||||
const clientNameHeaderKey = 'apollographql-client-name';
|
||||
const clientReferenceIdHeaderKey = 'apollographql-client-reference-id';
|
||||
const clientVersionHeaderKey = 'apollographql-client-version';
|
||||
if (((_b = (_a = request.http) === null || _a === void 0 ? void 0 : _a.headers) === null || _b === void 0 ? void 0 : _b.get(clientNameHeaderKey)) || ((_d = (_c = request.http) === null || _c === void 0 ? void 0 : _c.headers) === null || _d === void 0 ? void 0 : _d.get(clientVersionHeaderKey)) || ((_f = (_e = request.http) === null || _e === void 0 ? void 0 : _e.headers) === null || _f === void 0 ? void 0 : _f.get(clientReferenceIdHeaderKey))) {
|
||||
return {
|
||||
clientName: (_h = (_g = request.http) === null || _g === void 0 ? void 0 : _g.headers) === null || _h === void 0 ? void 0 : _h.get(clientNameHeaderKey),
|
||||
clientVersion: (_k = (_j = request.http) === null || _j === void 0 ? void 0 : _j.headers) === null || _k === void 0 ? void 0 : _k.get(clientVersionHeaderKey),
|
||||
clientReferenceId: (_m = (_l = request.http) === null || _l === void 0 ? void 0 : _l.headers) === null || _m === void 0 ? void 0 : _m.get(clientReferenceIdHeaderKey),
|
||||
};
|
||||
}
|
||||
else if ((_o = request.extensions) === null || _o === void 0 ? void 0 : _o.clientInfo) {
|
||||
return request.extensions.clientInfo;
|
||||
}
|
||||
else {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
function ApolloServerPluginUsageReportingDisabled() {
|
||||
return {
|
||||
__internal_plugin_id__() {
|
||||
return 'UsageReporting';
|
||||
},
|
||||
};
|
||||
}
|
||||
exports.ApolloServerPluginUsageReportingDisabled = ApolloServerPluginUsageReportingDisabled;
|
||||
//# sourceMappingURL=plugin.js.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/plugin.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/plugin.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
7
node_modules/apollo-server-core/dist/plugin/usageReporting/signatureCache.d.ts
generated
vendored
Normal file
7
node_modules/apollo-server-core/dist/plugin/usageReporting/signatureCache.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import LRUCache from 'lru-cache';
|
||||
import { Logger } from 'apollo-server-types';
|
||||
export declare function createSignatureCache({ logger, }: {
|
||||
logger: Logger;
|
||||
}): LRUCache<string, string>;
|
||||
export declare function signatureCacheKey(queryHash: string, operationName: string): string;
|
||||
//# sourceMappingURL=signatureCache.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/signatureCache.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/signatureCache.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"signatureCache.d.ts","sourceRoot":"","sources":["../../../src/plugin/usageReporting/signatureCache.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,wBAAgB,oBAAoB,CAAC,EACnC,MAAM,GACP,EAAE;IACD,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CA4C3B;AAED,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,UAEzE"}
|
||||
38
node_modules/apollo-server-core/dist/plugin/usageReporting/signatureCache.js
generated
vendored
Normal file
38
node_modules/apollo-server-core/dist/plugin/usageReporting/signatureCache.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.signatureCacheKey = exports.createSignatureCache = void 0;
|
||||
const lru_cache_1 = __importDefault(require("lru-cache"));
|
||||
function createSignatureCache({ logger, }) {
|
||||
let lastSignatureCacheWarn;
|
||||
let lastSignatureCacheDisposals = 0;
|
||||
return new lru_cache_1.default({
|
||||
length(obj) {
|
||||
return Buffer.byteLength(JSON.stringify(obj), 'utf8');
|
||||
},
|
||||
max: Math.pow(2, 20) * 3,
|
||||
dispose() {
|
||||
lastSignatureCacheDisposals++;
|
||||
if (!lastSignatureCacheWarn ||
|
||||
new Date().getTime() - lastSignatureCacheWarn.getTime() > 60000) {
|
||||
lastSignatureCacheWarn = new Date();
|
||||
logger.warn([
|
||||
'This server is processing a high number of unique operations. ',
|
||||
`A total of ${lastSignatureCacheDisposals} records have been `,
|
||||
'ejected from the ApolloServerPluginUsageReporting signature cache in the past ',
|
||||
'interval. If you see this warning frequently, please open an ',
|
||||
'issue on the Apollo Server repository.',
|
||||
].join(''));
|
||||
lastSignatureCacheDisposals = 0;
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
exports.createSignatureCache = createSignatureCache;
|
||||
function signatureCacheKey(queryHash, operationName) {
|
||||
return `${queryHash}${operationName && ':' + operationName}`;
|
||||
}
|
||||
exports.signatureCacheKey = signatureCacheKey;
|
||||
//# sourceMappingURL=signatureCache.js.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/signatureCache.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/signatureCache.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"signatureCache.js","sourceRoot":"","sources":["../../../src/plugin/usageReporting/signatureCache.ts"],"names":[],"mappings":";;;;;;AAAA,0DAAiC;AAGjC,SAAgB,oBAAoB,CAAC,EACnC,MAAM,GAGP;IACC,IAAI,sBAA4B,CAAC;IACjC,IAAI,2BAA2B,GAAW,CAAC,CAAC;IAC5C,OAAO,IAAI,mBAAQ,CAAiB;QAElC,MAAM,CAAC,GAAG;YACR,OAAO,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;QACxD,CAAC;QAUD,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC;QACxB,OAAO;YAEL,2BAA2B,EAAE,CAAC;YAG9B,IACE,CAAC,sBAAsB;gBACvB,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,sBAAsB,CAAC,OAAO,EAAE,GAAG,KAAK,EAC/D;gBAEA,sBAAsB,GAAG,IAAI,IAAI,EAAE,CAAC;gBACpC,MAAM,CAAC,IAAI,CACT;oBACE,iEAAiE;oBACjE,cAAc,2BAA2B,qBAAqB;oBAC9D,gFAAgF;oBAChF,gEAAgE;oBAChE,wCAAwC;iBACzC,CAAC,IAAI,CAAC,EAAE,CAAC,CACX,CAAC;gBAGF,2BAA2B,GAAG,CAAC,CAAC;aACjC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAhDD,oDAgDC;AAED,SAAgB,iBAAiB,CAAC,SAAiB,EAAE,aAAqB;IACxE,OAAO,GAAG,SAAS,GAAG,aAAa,IAAI,GAAG,GAAG,aAAa,EAAE,CAAC;AAC/D,CAAC;AAFD,8CAEC"}
|
||||
80
node_modules/apollo-server-core/dist/plugin/usageReporting/stats.d.ts
generated
vendored
Normal file
80
node_modules/apollo-server-core/dist/plugin/usageReporting/stats.d.ts
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
import { DurationHistogram } from './durationHistogram';
|
||||
import { IFieldStat, IPathErrorStats, IQueryLatencyStats, IStatsContext, Trace, ITypeStat, IContextualizedStats, ReportHeader, google, ITracesAndStats, IReport } from 'apollo-reporting-protobuf';
|
||||
export declare class SizeEstimator {
|
||||
bytes: number;
|
||||
}
|
||||
export declare class OurReport implements Required<IReport> {
|
||||
readonly header: ReportHeader;
|
||||
constructor(header: ReportHeader);
|
||||
readonly tracesPerQuery: Record<string, OurTracesAndStats>;
|
||||
endTime: google.protobuf.ITimestamp | null;
|
||||
readonly sizeEstimator: SizeEstimator;
|
||||
addTrace({ statsReportKey, trace, asTrace, includeTracesContributingToStats, }: {
|
||||
statsReportKey: string;
|
||||
trace: Trace;
|
||||
asTrace: boolean;
|
||||
includeTracesContributingToStats: boolean;
|
||||
}): void;
|
||||
private getTracesAndStats;
|
||||
}
|
||||
declare class OurTracesAndStats implements Required<ITracesAndStats> {
|
||||
readonly trace: Uint8Array[];
|
||||
readonly statsWithContext: StatsByContext;
|
||||
readonly internalTracesContributingToStats: Uint8Array[];
|
||||
}
|
||||
declare class StatsByContext {
|
||||
readonly map: {
|
||||
[k: string]: OurContextualizedStats;
|
||||
};
|
||||
toArray(): IContextualizedStats[];
|
||||
addTrace(trace: Trace, sizeEstimator: SizeEstimator): void;
|
||||
private getContextualizedStats;
|
||||
}
|
||||
export declare class OurContextualizedStats implements Required<IContextualizedStats> {
|
||||
readonly context: IStatsContext;
|
||||
queryLatencyStats: OurQueryLatencyStats;
|
||||
perTypeStat: {
|
||||
[k: string]: OurTypeStat;
|
||||
};
|
||||
constructor(context: IStatsContext);
|
||||
addTrace(trace: Trace, sizeEstimator: SizeEstimator): void;
|
||||
getTypeStat(parentType: string, sizeEstimator: SizeEstimator): OurTypeStat;
|
||||
}
|
||||
declare class OurQueryLatencyStats implements Required<IQueryLatencyStats> {
|
||||
latencyCount: DurationHistogram;
|
||||
requestCount: number;
|
||||
cacheHits: number;
|
||||
persistedQueryHits: number;
|
||||
persistedQueryMisses: number;
|
||||
cacheLatencyCount: DurationHistogram;
|
||||
rootErrorStats: OurPathErrorStats;
|
||||
requestsWithErrorsCount: number;
|
||||
publicCacheTtlCount: DurationHistogram;
|
||||
privateCacheTtlCount: DurationHistogram;
|
||||
registeredOperationCount: number;
|
||||
forbiddenOperationCount: number;
|
||||
}
|
||||
declare class OurPathErrorStats implements Required<IPathErrorStats> {
|
||||
children: {
|
||||
[k: string]: OurPathErrorStats;
|
||||
};
|
||||
errorsCount: number;
|
||||
requestsWithErrorsCount: number;
|
||||
getChild(subPath: string, sizeEstimator: SizeEstimator): OurPathErrorStats;
|
||||
}
|
||||
declare class OurTypeStat implements Required<ITypeStat> {
|
||||
perFieldStat: {
|
||||
[k: string]: OurFieldStat;
|
||||
};
|
||||
getFieldStat(fieldName: string, returnType: string, sizeEstimator: SizeEstimator): OurFieldStat;
|
||||
}
|
||||
declare class OurFieldStat implements Required<IFieldStat> {
|
||||
readonly returnType: string;
|
||||
errorsCount: number;
|
||||
count: number;
|
||||
requestsWithErrorsCount: number;
|
||||
latencyCount: DurationHistogram;
|
||||
constructor(returnType: string);
|
||||
}
|
||||
export {};
|
||||
//# sourceMappingURL=stats.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/stats.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/stats.d.ts.map
generated
vendored
Normal file
@@ -0,0 +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,CAAC,SAAS,CAAC;IAC9C,YAAY,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,YAAY,CAAA;KAAE,CAAuB;IAElE,YAAY,CACV,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,aAAa,GAC3B,YAAY;CAchB;AAED,cAAM,YAAa,YAAW,QAAQ,CAAC,UAAU,CAAC;IAMpC,QAAQ,CAAC,UAAU,EAAE,MAAM;IALvC,WAAW,EAAE,MAAM,CAAK;IACxB,KAAK,EAAE,MAAM,CAAK;IAClB,uBAAuB,EAAE,MAAM,CAAK;IACpC,YAAY,EAAE,iBAAiB,CAA2B;gBAErC,UAAU,EAAE,MAAM;CACxC"}
|
||||
231
node_modules/apollo-server-core/dist/plugin/usageReporting/stats.js
generated
vendored
Normal file
231
node_modules/apollo-server-core/dist/plugin/usageReporting/stats.js
generated
vendored
Normal file
@@ -0,0 +1,231 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.OurContextualizedStats = exports.OurReport = exports.SizeEstimator = void 0;
|
||||
const durationHistogram_1 = require("./durationHistogram");
|
||||
const apollo_reporting_protobuf_1 = require("apollo-reporting-protobuf");
|
||||
const iterateOverTrace_1 = require("./iterateOverTrace");
|
||||
class SizeEstimator {
|
||||
constructor() {
|
||||
this.bytes = 0;
|
||||
}
|
||||
}
|
||||
exports.SizeEstimator = SizeEstimator;
|
||||
class OurReport {
|
||||
constructor(header) {
|
||||
this.header = header;
|
||||
this.tracesPerQuery = Object.create(null);
|
||||
this.endTime = null;
|
||||
this.sizeEstimator = new SizeEstimator();
|
||||
}
|
||||
addTrace({ statsReportKey, trace, asTrace, includeTracesContributingToStats, }) {
|
||||
const tracesAndStats = this.getTracesAndStats(statsReportKey);
|
||||
if (asTrace) {
|
||||
const encodedTrace = apollo_reporting_protobuf_1.Trace.encode(trace).finish();
|
||||
tracesAndStats.trace.push(encodedTrace);
|
||||
this.sizeEstimator.bytes += 2 + encodedTrace.length;
|
||||
}
|
||||
else {
|
||||
tracesAndStats.statsWithContext.addTrace(trace, this.sizeEstimator);
|
||||
if (includeTracesContributingToStats) {
|
||||
const encodedTrace = apollo_reporting_protobuf_1.Trace.encode(trace).finish();
|
||||
tracesAndStats.internalTracesContributingToStats.push(encodedTrace);
|
||||
this.sizeEstimator.bytes += 2 + encodedTrace.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
getTracesAndStats(statsReportKey) {
|
||||
const existing = this.tracesPerQuery[statsReportKey];
|
||||
if (existing) {
|
||||
return existing;
|
||||
}
|
||||
this.sizeEstimator.bytes += estimatedBytesForString(statsReportKey);
|
||||
return (this.tracesPerQuery[statsReportKey] = new OurTracesAndStats());
|
||||
}
|
||||
}
|
||||
exports.OurReport = OurReport;
|
||||
class OurTracesAndStats {
|
||||
constructor() {
|
||||
this.trace = [];
|
||||
this.statsWithContext = new StatsByContext();
|
||||
this.internalTracesContributingToStats = [];
|
||||
}
|
||||
}
|
||||
class StatsByContext {
|
||||
constructor() {
|
||||
this.map = Object.create(null);
|
||||
}
|
||||
toArray() {
|
||||
return Object.values(this.map);
|
||||
}
|
||||
addTrace(trace, sizeEstimator) {
|
||||
this.getContextualizedStats(trace, sizeEstimator).addTrace(trace, sizeEstimator);
|
||||
}
|
||||
getContextualizedStats(trace, sizeEstimator) {
|
||||
const statsContext = {
|
||||
clientName: trace.clientName,
|
||||
clientVersion: trace.clientVersion,
|
||||
clientReferenceId: trace.clientReferenceId,
|
||||
};
|
||||
const statsContextKey = JSON.stringify(statsContext);
|
||||
const existing = this.map[statsContextKey];
|
||||
if (existing) {
|
||||
return existing;
|
||||
}
|
||||
sizeEstimator.bytes +=
|
||||
20 +
|
||||
estimatedBytesForString(trace.clientName) +
|
||||
estimatedBytesForString(trace.clientVersion) +
|
||||
estimatedBytesForString(trace.clientReferenceId);
|
||||
const contextualizedStats = new OurContextualizedStats(statsContext);
|
||||
this.map[statsContextKey] = contextualizedStats;
|
||||
return contextualizedStats;
|
||||
}
|
||||
}
|
||||
class OurContextualizedStats {
|
||||
constructor(context) {
|
||||
this.context = context;
|
||||
this.queryLatencyStats = new OurQueryLatencyStats();
|
||||
this.perTypeStat = Object.create(null);
|
||||
}
|
||||
addTrace(trace, sizeEstimator) {
|
||||
var _a;
|
||||
this.queryLatencyStats.requestCount++;
|
||||
if (trace.fullQueryCacheHit) {
|
||||
this.queryLatencyStats.cacheLatencyCount.incrementDuration(trace.durationNs);
|
||||
this.queryLatencyStats.cacheHits++;
|
||||
}
|
||||
else {
|
||||
this.queryLatencyStats.latencyCount.incrementDuration(trace.durationNs);
|
||||
}
|
||||
if (!trace.fullQueryCacheHit && ((_a = trace.cachePolicy) === null || _a === void 0 ? void 0 : _a.maxAgeNs) != null) {
|
||||
switch (trace.cachePolicy.scope) {
|
||||
case apollo_reporting_protobuf_1.Trace.CachePolicy.Scope.PRIVATE:
|
||||
this.queryLatencyStats.privateCacheTtlCount.incrementDuration(trace.cachePolicy.maxAgeNs);
|
||||
break;
|
||||
case apollo_reporting_protobuf_1.Trace.CachePolicy.Scope.PUBLIC:
|
||||
this.queryLatencyStats.publicCacheTtlCount.incrementDuration(trace.cachePolicy.maxAgeNs);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (trace.persistedQueryHit) {
|
||||
this.queryLatencyStats.persistedQueryHits++;
|
||||
}
|
||||
if (trace.persistedQueryRegister) {
|
||||
this.queryLatencyStats.persistedQueryMisses++;
|
||||
}
|
||||
if (trace.forbiddenOperation) {
|
||||
this.queryLatencyStats.forbiddenOperationCount++;
|
||||
}
|
||||
if (trace.registeredOperation) {
|
||||
this.queryLatencyStats.registeredOperationCount++;
|
||||
}
|
||||
let hasError = false;
|
||||
const traceNodeStats = (node, path) => {
|
||||
var _a, _b, _c, _d, _e;
|
||||
if ((_a = node.error) === null || _a === void 0 ? void 0 : _a.length) {
|
||||
hasError = true;
|
||||
let currPathErrorStats = this.queryLatencyStats.rootErrorStats;
|
||||
path.toArray().forEach((subPath) => {
|
||||
currPathErrorStats = currPathErrorStats.getChild(subPath, sizeEstimator);
|
||||
});
|
||||
currPathErrorStats.requestsWithErrorsCount += 1;
|
||||
currPathErrorStats.errorsCount += node.error.length;
|
||||
}
|
||||
const fieldName = node.originalFieldName || node.responseName;
|
||||
if (node.parentType &&
|
||||
fieldName &&
|
||||
node.type &&
|
||||
node.endTime != null &&
|
||||
node.startTime != null &&
|
||||
node.endTime >= node.startTime) {
|
||||
const typeStat = this.getTypeStat(node.parentType, sizeEstimator);
|
||||
const fieldStat = typeStat.getFieldStat(fieldName, node.type, sizeEstimator);
|
||||
fieldStat.errorsCount += (_c = (_b = node.error) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0;
|
||||
fieldStat.count++;
|
||||
fieldStat.requestsWithErrorsCount +=
|
||||
((_e = (_d = node.error) === null || _d === void 0 ? void 0 : _d.length) !== null && _e !== void 0 ? _e : 0) > 0 ? 1 : 0;
|
||||
fieldStat.latencyCount.incrementDuration(node.endTime - node.startTime);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
iterateOverTrace_1.iterateOverTrace(trace, traceNodeStats, true);
|
||||
if (hasError) {
|
||||
this.queryLatencyStats.requestsWithErrorsCount++;
|
||||
}
|
||||
}
|
||||
getTypeStat(parentType, sizeEstimator) {
|
||||
const existing = this.perTypeStat[parentType];
|
||||
if (existing) {
|
||||
return existing;
|
||||
}
|
||||
sizeEstimator.bytes += estimatedBytesForString(parentType);
|
||||
const typeStat = new OurTypeStat();
|
||||
this.perTypeStat[parentType] = typeStat;
|
||||
return typeStat;
|
||||
}
|
||||
}
|
||||
exports.OurContextualizedStats = OurContextualizedStats;
|
||||
class OurQueryLatencyStats {
|
||||
constructor() {
|
||||
this.latencyCount = new durationHistogram_1.DurationHistogram();
|
||||
this.requestCount = 0;
|
||||
this.cacheHits = 0;
|
||||
this.persistedQueryHits = 0;
|
||||
this.persistedQueryMisses = 0;
|
||||
this.cacheLatencyCount = new durationHistogram_1.DurationHistogram();
|
||||
this.rootErrorStats = new OurPathErrorStats();
|
||||
this.requestsWithErrorsCount = 0;
|
||||
this.publicCacheTtlCount = new durationHistogram_1.DurationHistogram();
|
||||
this.privateCacheTtlCount = new durationHistogram_1.DurationHistogram();
|
||||
this.registeredOperationCount = 0;
|
||||
this.forbiddenOperationCount = 0;
|
||||
}
|
||||
}
|
||||
class OurPathErrorStats {
|
||||
constructor() {
|
||||
this.children = Object.create(null);
|
||||
this.errorsCount = 0;
|
||||
this.requestsWithErrorsCount = 0;
|
||||
}
|
||||
getChild(subPath, sizeEstimator) {
|
||||
const existing = this.children[subPath];
|
||||
if (existing) {
|
||||
return existing;
|
||||
}
|
||||
const child = new OurPathErrorStats();
|
||||
this.children[subPath] = child;
|
||||
sizeEstimator.bytes += estimatedBytesForString(subPath) + 4;
|
||||
return child;
|
||||
}
|
||||
}
|
||||
class OurTypeStat {
|
||||
constructor() {
|
||||
this.perFieldStat = Object.create(null);
|
||||
}
|
||||
getFieldStat(fieldName, returnType, sizeEstimator) {
|
||||
const existing = this.perFieldStat[fieldName];
|
||||
if (existing) {
|
||||
return existing;
|
||||
}
|
||||
sizeEstimator.bytes +=
|
||||
estimatedBytesForString(fieldName) +
|
||||
estimatedBytesForString(returnType) +
|
||||
10;
|
||||
const fieldStat = new OurFieldStat(returnType);
|
||||
this.perFieldStat[fieldName] = fieldStat;
|
||||
return fieldStat;
|
||||
}
|
||||
}
|
||||
class OurFieldStat {
|
||||
constructor(returnType) {
|
||||
this.returnType = returnType;
|
||||
this.errorsCount = 0;
|
||||
this.count = 0;
|
||||
this.requestsWithErrorsCount = 0;
|
||||
this.latencyCount = new durationHistogram_1.DurationHistogram();
|
||||
}
|
||||
}
|
||||
function estimatedBytesForString(s) {
|
||||
return 2 + Buffer.byteLength(s);
|
||||
}
|
||||
//# sourceMappingURL=stats.js.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/stats.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/stats.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
4
node_modules/apollo-server-core/dist/plugin/usageReporting/traceDetails.d.ts
generated
vendored
Normal file
4
node_modules/apollo-server-core/dist/plugin/usageReporting/traceDetails.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import { Trace } from 'apollo-reporting-protobuf';
|
||||
import { VariableValueOptions } from './options';
|
||||
export declare function makeTraceDetails(variables: Record<string, any>, sendVariableValues?: VariableValueOptions, operationString?: string): Trace.Details;
|
||||
//# sourceMappingURL=traceDetails.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/traceDetails.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/traceDetails.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"traceDetails.d.ts","sourceRoot":"","sources":["../../../src/plugin/usageReporting/traceDetails.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AASjD,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC9B,kBAAkB,CAAC,EAAE,oBAAoB,EACzC,eAAe,CAAC,EAAE,MAAM,GACvB,KAAK,CAAC,OAAO,CA0Df"}
|
||||
64
node_modules/apollo-server-core/dist/plugin/usageReporting/traceDetails.js
generated
vendored
Normal file
64
node_modules/apollo-server-core/dist/plugin/usageReporting/traceDetails.js
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.makeTraceDetails = void 0;
|
||||
const apollo_reporting_protobuf_1 = require("apollo-reporting-protobuf");
|
||||
function makeTraceDetails(variables, sendVariableValues, operationString) {
|
||||
const details = new apollo_reporting_protobuf_1.Trace.Details();
|
||||
const variablesToRecord = (() => {
|
||||
if (sendVariableValues && 'transform' in sendVariableValues) {
|
||||
const originalKeys = Object.keys(variables);
|
||||
try {
|
||||
const modifiedVariables = sendVariableValues.transform({
|
||||
variables: variables,
|
||||
operationString: operationString,
|
||||
});
|
||||
return cleanModifiedVariables(originalKeys, modifiedVariables);
|
||||
}
|
||||
catch (e) {
|
||||
return handleVariableValueTransformError(originalKeys);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return variables;
|
||||
}
|
||||
})();
|
||||
Object.keys(variablesToRecord).forEach((name) => {
|
||||
if (!sendVariableValues ||
|
||||
('none' in sendVariableValues && sendVariableValues.none) ||
|
||||
('all' in sendVariableValues && !sendVariableValues.all) ||
|
||||
('exceptNames' in sendVariableValues &&
|
||||
sendVariableValues.exceptNames.includes(name)) ||
|
||||
('onlyNames' in sendVariableValues &&
|
||||
!sendVariableValues.onlyNames.includes(name))) {
|
||||
details.variablesJson[name] = '';
|
||||
}
|
||||
else {
|
||||
try {
|
||||
details.variablesJson[name] =
|
||||
typeof variablesToRecord[name] === 'undefined'
|
||||
? ''
|
||||
: JSON.stringify(variablesToRecord[name]);
|
||||
}
|
||||
catch (e) {
|
||||
details.variablesJson[name] = JSON.stringify('[Unable to convert value to JSON]');
|
||||
}
|
||||
}
|
||||
});
|
||||
return details;
|
||||
}
|
||||
exports.makeTraceDetails = makeTraceDetails;
|
||||
function handleVariableValueTransformError(variableNames) {
|
||||
const modifiedVariables = Object.create(null);
|
||||
variableNames.forEach((name) => {
|
||||
modifiedVariables[name] = '[PREDICATE_FUNCTION_ERROR]';
|
||||
});
|
||||
return modifiedVariables;
|
||||
}
|
||||
function cleanModifiedVariables(originalKeys, modifiedVariables) {
|
||||
const cleanedVariables = Object.create(null);
|
||||
originalKeys.forEach((name) => {
|
||||
cleanedVariables[name] = modifiedVariables[name];
|
||||
});
|
||||
return cleanedVariables;
|
||||
}
|
||||
//# sourceMappingURL=traceDetails.js.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/traceDetails.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/traceDetails.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"traceDetails.js","sourceRoot":"","sources":["../../../src/plugin/usageReporting/traceDetails.ts"],"names":[],"mappings":";;;AAAA,yEAAkD;AAUlD,SAAgB,gBAAgB,CAC9B,SAA8B,EAC9B,kBAAyC,EACzC,eAAwB;IAExB,MAAM,OAAO,GAAG,IAAI,iCAAK,CAAC,OAAO,EAAE,CAAC;IACpC,MAAM,iBAAiB,GAAG,CAAC,GAAG,EAAE;QAC9B,IAAI,kBAAkB,IAAI,WAAW,IAAI,kBAAkB,EAAE;YAC3D,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC5C,IAAI;gBAEF,MAAM,iBAAiB,GAAG,kBAAkB,CAAC,SAAS,CAAC;oBACrD,SAAS,EAAE,SAAS;oBACpB,eAAe,EAAE,eAAe;iBACjC,CAAC,CAAC;gBACH,OAAO,sBAAsB,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAAC;aAChE;YAAC,OAAO,CAAC,EAAE;gBAGV,OAAO,iCAAiC,CAAC,YAAY,CAAC,CAAC;aACxD;SACF;aAAM;YACL,OAAO,SAAS,CAAC;SAClB;IACH,CAAC,CAAC,EAAE,CAAC;IAOL,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAC9C,IACE,CAAC,kBAAkB;YACnB,CAAC,MAAM,IAAI,kBAAkB,IAAI,kBAAkB,CAAC,IAAI,CAAC;YACzD,CAAC,KAAK,IAAI,kBAAkB,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC;YACxD,CAAC,aAAa,IAAI,kBAAkB;gBAIlC,kBAAkB,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAChD,CAAC,WAAW,IAAI,kBAAk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-core/dist/processFileUploads.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
declare const processFileUploads: typeof import('@apollographql/graphql-upload-8-fork').processRequest | undefined;
|
||||
export default processFileUploads;
|
||||
//# sourceMappingURL=processFileUploads.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/processFileUploads.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/processFileUploads.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"processFileUploads.d.ts","sourceRoot":"","sources":["../src/processFileUploads.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,kBAAkB,EACpB,cAAc,sCAAsC,EAAE,cAAc,GACpE,SAMA,CAAC;AAEL,eAAe,kBAAkB,CAAC"}
|
||||
15
node_modules/apollo-server-core/dist/processFileUploads.js
generated
vendored
Normal file
15
node_modules/apollo-server-core/dist/processFileUploads.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const runtimeSupportsUploads_1 = __importDefault(require("./utils/runtimeSupportsUploads"));
|
||||
const processFileUploads = (() => {
|
||||
if (runtimeSupportsUploads_1.default) {
|
||||
return require('@apollographql/graphql-upload-8-fork')
|
||||
.processRequest;
|
||||
}
|
||||
return undefined;
|
||||
})();
|
||||
exports.default = processFileUploads;
|
||||
//# sourceMappingURL=processFileUploads.js.map
|
||||
1
node_modules/apollo-server-core/dist/processFileUploads.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/processFileUploads.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"processFileUploads.js","sourceRoot":"","sources":["../src/processFileUploads.ts"],"names":[],"mappings":";;;;;AAAA,4FAAoE;AAKpE,MAAM,kBAAkB,GAER,CAAC,GAAG,EAAE;IACpB,IAAI,gCAAsB,EAAE;QAC1B,OAAO,OAAO,CAAC,sCAAsC,CAAC;aACnD,cAAsF,CAAC;KAC3F;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC,EAAE,CAAC;AAEL,kBAAe,kBAAkB,CAAC"}
|
||||
33
node_modules/apollo-server-core/dist/requestPipeline.d.ts
generated
vendored
Normal file
33
node_modules/apollo-server-core/dist/requestPipeline.d.ts
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
import { GraphQLSchema, GraphQLFieldResolver, DocumentNode, GraphQLError, GraphQLFormattedError } from 'graphql';
|
||||
import { GraphQLExtension } from 'graphql-extensions';
|
||||
import { DataSource } from 'apollo-datasource';
|
||||
import { PersistedQueryOptions } from './graphqlOptions';
|
||||
import { GraphQLRequest, GraphQLResponse, GraphQLRequestContext, GraphQLExecutor, InvalidGraphQLRequestError, ValidationRule } from 'apollo-server-types';
|
||||
import { ApolloServerPlugin } from 'apollo-server-plugin-base';
|
||||
import { InMemoryLRUCache } from 'apollo-server-caching';
|
||||
import { GraphQLParseOptions } from 'graphql-tools';
|
||||
export { GraphQLRequest, GraphQLResponse, GraphQLRequestContext, InvalidGraphQLRequestError, };
|
||||
export declare const APQ_CACHE_PREFIX = "apq:";
|
||||
export interface GraphQLRequestPipelineConfig<TContext> {
|
||||
schema: GraphQLSchema;
|
||||
rootValue?: ((document: DocumentNode) => any) | any;
|
||||
validationRules?: ValidationRule[];
|
||||
executor?: GraphQLExecutor;
|
||||
fieldResolver?: GraphQLFieldResolver<any, TContext>;
|
||||
dataSources?: () => DataSources<TContext>;
|
||||
extensions?: Array<() => GraphQLExtension>;
|
||||
persistedQueries?: PersistedQueryOptions;
|
||||
formatError?: (error: GraphQLError) => GraphQLFormattedError;
|
||||
formatResponse?: (response: GraphQLResponse, requestContext: GraphQLRequestContext<TContext>) => GraphQLResponse | null;
|
||||
plugins?: ApolloServerPlugin[];
|
||||
documentStore?: InMemoryLRUCache<DocumentNode>;
|
||||
parseOptions?: GraphQLParseOptions;
|
||||
}
|
||||
export declare type DataSources<TContext> = {
|
||||
[name: string]: DataSource<TContext>;
|
||||
};
|
||||
declare type Mutable<T> = {
|
||||
-readonly [P in keyof T]: T[P];
|
||||
};
|
||||
export declare function processGraphQLRequest<TContext>(config: GraphQLRequestPipelineConfig<TContext>, requestContext: Mutable<GraphQLRequestContext<TContext>>): Promise<GraphQLResponse>;
|
||||
//# sourceMappingURL=requestPipeline.d.ts.map
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user