Initialisation

Added the packages and files for the backend server
This commit is contained in:
jackbeeby
2024-12-15 17:48:45 +11:00
parent 25066e1ee8
commit b412dfe2ca
2732 changed files with 330572 additions and 0 deletions

119
node_modules/@apollo/server/dist/cjs/ApolloServer.d.ts generated vendored Normal file
View File

@@ -0,0 +1,119 @@
import type { GatewayExecutor } from '@apollo/server-gateway-interface';
import { type KeyValueCache } from '@apollo/utils.keyvaluecache';
import type { Logger } from '@apollo/utils.logger';
import type { WithRequired } from '@apollo/utils.withrequired';
import { type Resolvable } from './utils/resolvable.js';
import { type DocumentNode, type FormattedExecutionResult, type GraphQLFieldResolver, type GraphQLFormattedError, type GraphQLSchema, type ParseOptions, type TypedQueryDocumentNode, type ValidationRule } from 'graphql';
import type { ExecuteOperationOptions, VariableValues } from './externalTypes/graphql.js';
import type { ApolloConfig, ApolloServerOptions, ApolloServerPlugin, BaseContext, ContextThunk, DocumentStore, GraphQLRequest, GraphQLResponse, HTTPGraphQLHead, HTTPGraphQLRequest, HTTPGraphQLResponse, LandingPage, PersistedQueryOptions } from './externalTypes/index.js';
import type { GraphQLExperimentalIncrementalExecutionResults } from './incrementalDeliveryPolyfill.js';
import { SchemaManager } from './utils/schemaManager.js';
export type SchemaDerivedData = {
schema: GraphQLSchema;
documentStore: DocumentStore | null;
documentStoreKeyPrefix: string;
};
type RunningServerState = {
schemaManager: SchemaManager;
landingPage: LandingPage | null;
};
type ServerState = {
phase: 'initialized';
schemaManager: SchemaManager;
} | {
phase: 'starting';
barrier: Resolvable<void>;
schemaManager: SchemaManager;
startedInBackground: boolean;
} | {
phase: 'failed to start';
error: Error;
} | ({
phase: 'started';
drainServers: (() => Promise<void>) | null;
toDispose: (() => Promise<void>)[];
toDisposeLast: (() => Promise<void>)[];
} & RunningServerState) | ({
phase: 'draining';
barrier: Resolvable<void>;
} & RunningServerState) | {
phase: 'stopping';
barrier: Resolvable<void>;
} | {
phase: 'stopped';
stopError: Error | null;
};
export interface ApolloServerInternals<TContext extends BaseContext> {
state: ServerState;
gatewayExecutor: GatewayExecutor | null;
dangerouslyDisableValidation?: boolean;
formatError?: (formattedError: GraphQLFormattedError, error: unknown) => GraphQLFormattedError;
includeStacktraceInErrorResponses: boolean;
persistedQueries?: WithRequired<PersistedQueryOptions, 'cache'>;
nodeEnv: string;
allowBatchedHttpRequests: boolean;
apolloConfig: ApolloConfig;
plugins: ApolloServerPlugin<TContext>[];
parseOptions: ParseOptions;
stopOnTerminationSignals: boolean | undefined;
csrfPreventionRequestHeaders: string[] | null;
rootValue?: ((parsedQuery: DocumentNode) => unknown) | unknown;
validationRules: Array<ValidationRule>;
hideSchemaDetailsFromClientErrors: boolean;
fieldResolver?: GraphQLFieldResolver<any, TContext>;
status400ForVariableCoercionErrors?: boolean;
__testing_incrementalExecutionResults?: GraphQLExperimentalIncrementalExecutionResults;
stringifyResult: (value: FormattedExecutionResult) => string | Promise<string>;
}
export declare class ApolloServer<in out TContext extends BaseContext = BaseContext> {
private internals;
readonly cache: KeyValueCache<string>;
readonly logger: Logger;
constructor(config: ApolloServerOptions<TContext>);
start(): Promise<void>;
startInBackgroundHandlingStartupErrorsByLoggingAndFailingAllRequests(): void;
private _start;
private maybeRegisterTerminationSignalHandlers;
private _ensureStarted;
assertStarted(expressionForError: string): void;
private logStartupError;
private static constructSchema;
private static generateSchemaDerivedData;
stop(): Promise<void>;
private addDefaultPlugins;
addPlugin(plugin: ApolloServerPlugin<TContext>): void;
executeHTTPGraphQLRequest({ httpGraphQLRequest, context, }: {
httpGraphQLRequest: HTTPGraphQLRequest;
context: ContextThunk<TContext>;
}): Promise<HTTPGraphQLResponse>;
private errorResponse;
private prefersHTML;
executeOperation<TData = Record<string, unknown>, TVariables extends VariableValues = VariableValues>(this: ApolloServer<BaseContext>, request: Omit<GraphQLRequest<TVariables>, 'query'> & {
query?: string | DocumentNode | TypedQueryDocumentNode<TData, TVariables>;
}): Promise<GraphQLResponse<TData>>;
executeOperation<TData = Record<string, unknown>, TVariables extends VariableValues = VariableValues>(request: Omit<GraphQLRequest<TVariables>, 'query'> & {
query?: string | DocumentNode | TypedQueryDocumentNode<TData, TVariables>;
}, options?: ExecuteOperationOptions<TContext>): Promise<GraphQLResponse<TData>>;
}
export declare function internalExecuteOperation<TContext extends BaseContext>({ server, graphQLRequest, internals, schemaDerivedData, sharedResponseHTTPGraphQLHead, }: {
server: ApolloServer<TContext>;
graphQLRequest: GraphQLRequest;
internals: ApolloServerInternals<TContext>;
schemaDerivedData: SchemaDerivedData;
sharedResponseHTTPGraphQLHead: HTTPGraphQLHead | null;
}, options: ExecuteOperationOptions<TContext>): Promise<GraphQLResponse>;
export type ImplicitlyInstallablePlugin<TContext extends BaseContext> = ApolloServerPlugin<TContext> & {
__internal_installed_implicitly__: boolean;
};
export declare function isImplicitlyInstallablePlugin<TContext extends BaseContext>(p: ApolloServerPlugin<TContext>): p is ImplicitlyInstallablePlugin<TContext>;
export declare const MEDIA_TYPES: {
APPLICATION_JSON: string;
APPLICATION_JSON_GRAPHQL_CALLBACK: string;
APPLICATION_GRAPHQL_RESPONSE_JSON: string;
MULTIPART_MIXED_NO_DEFER_SPEC: string;
MULTIPART_MIXED_EXPERIMENTAL: string;
TEXT_HTML: string;
};
export declare function chooseContentTypeForSingleResultResponse(head: HTTPGraphQLHead): string | null;
export {};
//# sourceMappingURL=ApolloServer.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ApolloServer.d.ts","sourceRoot":"","sources":["../../src/ApolloServer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAExE,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAmB,EAAE,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAKL,KAAK,YAAY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C,EAAE,OAAO,CAAC;CAC5C,CAAC;AAEJ,wBAAgB,6BAA6B,CAAC,QAAQ,SAAS,WAAW,EACxE,CAAC,EAAE,kBAAkB,CAAC,QAAQ,CAAC,GAC9B,CAAC,IAAI,2BAA2B,CAAC,QAAQ,CAAC,CAE5C;AAED,eAAO,MAAM,WAAW;;;;;;;CAWvB,CAAC;AAEF,wBAAgB,wCAAwC,CACtD,IAAI,EAAE,eAAe,GACpB,MAAM,GAAG,IAAI,CAqBf"}

694
node_modules/@apollo/server/dist/cjs/ApolloServer.js generated vendored Normal file
View File

@@ -0,0 +1,694 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.chooseContentTypeForSingleResultResponse = exports.MEDIA_TYPES = exports.isImplicitlyInstallablePlugin = exports.internalExecuteOperation = exports.ApolloServer = void 0;
const utils_isnodelike_1 = require("@apollo/utils.isnodelike");
const utils_keyvaluecache_1 = require("@apollo/utils.keyvaluecache");
const schema_1 = require("@graphql-tools/schema");
const resolvable_js_1 = __importDefault(require("./utils/resolvable.js"));
const graphql_1 = require("graphql");
const loglevel_1 = __importDefault(require("loglevel"));
const negotiator_1 = __importDefault(require("negotiator"));
const cachePolicy_js_1 = require("./cachePolicy.js");
const determineApolloConfig_js_1 = require("./determineApolloConfig.js");
const errorNormalize_js_1 = require("./errorNormalize.js");
const index_js_1 = require("./errors/index.js");
const httpBatching_js_1 = require("./httpBatching.js");
const internalPlugin_js_1 = require("./internalPlugin.js");
const preventCsrf_js_1 = require("./preventCsrf.js");
const requestPipeline_js_1 = require("./requestPipeline.js");
const runHttpQuery_js_1 = require("./runHttpQuery.js");
const HeaderMap_js_1 = require("./utils/HeaderMap.js");
const UnreachableCaseError_js_1 = require("./utils/UnreachableCaseError.js");
const computeCoreSchemaHash_js_1 = require("./utils/computeCoreSchemaHash.js");
const isDefined_js_1 = require("./utils/isDefined.js");
const schemaManager_js_1 = require("./utils/schemaManager.js");
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', {
nodes: [node],
extensions: {
validationErrorCode: index_js_1.ApolloServerValidationErrorCode.INTROSPECTION_DISABLED,
},
}));
}
},
});
function defaultLogger() {
const loglevelLogger = loglevel_1.default.getLogger('apollo-server');
loglevelLogger.setLevel(loglevel_1.default.levels.INFO);
return loglevelLogger;
}
class ApolloServer {
constructor(config) {
const nodeEnv = config.nodeEnv ?? process.env.NODE_ENV ?? '';
this.logger = config.logger ?? defaultLogger();
const apolloConfig = (0, determineApolloConfig_js_1.determineApolloConfig)(config.apollo, this.logger);
const isDev = nodeEnv !== 'production';
if (config.cache &&
config.cache !== 'bounded' &&
utils_keyvaluecache_1.PrefixingKeyValueCache.prefixesAreUnnecessaryForIsolation(config.cache)) {
throw new Error('You cannot pass a cache returned from ' +
'`PrefixingKeyValueCache.cacheDangerouslyDoesNotNeedPrefixesForIsolation`' +
'to `new ApolloServer({ cache })`, because Apollo Server may use it for ' +
'multiple features whose cache keys must be distinct from each other.');
}
const state = config.gateway
?
{
phase: 'initialized',
schemaManager: new schemaManager_js_1.SchemaManager({
gateway: config.gateway,
apolloConfig,
schemaDerivedDataProvider: (schema) => ApolloServer.generateSchemaDerivedData(schema, config.documentStore),
logger: this.logger,
}),
}
:
{
phase: 'initialized',
schemaManager: new schemaManager_js_1.SchemaManager({
apiSchema: ApolloServer.constructSchema(config),
schemaDerivedDataProvider: (schema) => ApolloServer.generateSchemaDerivedData(schema, config.documentStore),
logger: this.logger,
}),
};
const introspectionEnabled = config.introspection ?? isDev;
const hideSchemaDetailsFromClientErrors = config.hideSchemaDetailsFromClientErrors ?? false;
this.cache =
config.cache === undefined || config.cache === 'bounded'
? new utils_keyvaluecache_1.InMemoryLRUCache()
: config.cache;
this.internals = {
formatError: config.formatError,
rootValue: config.rootValue,
validationRules: [
...(config.validationRules ?? []),
...(introspectionEnabled ? [] : [NoIntrospection]),
],
hideSchemaDetailsFromClientErrors,
dangerouslyDisableValidation: config.dangerouslyDisableValidation ?? false,
fieldResolver: config.fieldResolver,
includeStacktraceInErrorResponses: config.includeStacktraceInErrorResponses ??
(nodeEnv !== 'production' && nodeEnv !== 'test'),
persistedQueries: config.persistedQueries === false
? undefined
: {
...config.persistedQueries,
cache: new utils_keyvaluecache_1.PrefixingKeyValueCache(config.persistedQueries?.cache ?? this.cache, requestPipeline_js_1.APQ_CACHE_PREFIX),
},
nodeEnv,
allowBatchedHttpRequests: config.allowBatchedHttpRequests ?? false,
apolloConfig,
plugins: config.plugins ?? [],
parseOptions: config.parseOptions ?? {},
state,
stopOnTerminationSignals: config.stopOnTerminationSignals,
gatewayExecutor: null,
csrfPreventionRequestHeaders: config.csrfPrevention === true || config.csrfPrevention === undefined
? preventCsrf_js_1.recommendedCsrfPreventionRequestHeaders
: config.csrfPrevention === false
? null
: (config.csrfPrevention.requestHeaders ??
preventCsrf_js_1.recommendedCsrfPreventionRequestHeaders),
status400ForVariableCoercionErrors: config.status400ForVariableCoercionErrors ?? false,
__testing_incrementalExecutionResults: config.__testing_incrementalExecutionResults,
stringifyResult: config.stringifyResult ?? runHttpQuery_js_1.prettyJSONStringify,
};
}
async start() {
return await this._start(false);
}
startInBackgroundHandlingStartupErrorsByLoggingAndFailingAllRequests() {
this._start(true).catch((e) => this.logStartupError(e));
}
async _start(startedInBackground) {
if (this.internals.state.phase !== 'initialized') {
throw new Error(`You should only call 'start()' or ` +
`'startInBackgroundHandlingStartupErrorsByLoggingAndFailingAllRequests()' ` +
`once on your ApolloServer.`);
}
const schemaManager = this.internals.state.schemaManager;
const barrier = (0, resolvable_js_1.default)();
this.internals.state = {
phase: 'starting',
barrier,
schemaManager,
startedInBackground,
};
try {
await this.addDefaultPlugins();
const toDispose = [];
const executor = await schemaManager.start();
if (executor) {
this.internals.gatewayExecutor = executor;
}
toDispose.push(async () => {
await schemaManager.stop();
});
const schemaDerivedData = schemaManager.getSchemaDerivedData();
const service = {
logger: this.logger,
cache: this.cache,
schema: schemaDerivedData.schema,
apollo: this.internals.apolloConfig,
startedInBackground,
};
const taggedServerListeners = (await Promise.all(this.internals.plugins.map(async (plugin) => ({
serverListener: plugin.serverWillStart && (await plugin.serverWillStart(service)),
installedImplicitly: isImplicitlyInstallablePlugin(plugin) &&
plugin.__internal_installed_implicitly__,
})))).filter((maybeTaggedServerListener) => typeof maybeTaggedServerListener.serverListener === 'object');
taggedServerListeners.forEach(({ serverListener: { schemaDidLoadOrUpdate } }) => {
if (schemaDidLoadOrUpdate) {
schemaManager.onSchemaLoadOrUpdate(schemaDidLoadOrUpdate);
}
});
const serverWillStops = taggedServerListeners
.map((l) => l.serverListener.serverWillStop)
.filter(isDefined_js_1.isDefined);
if (serverWillStops.length) {
toDispose.push(async () => {
await Promise.all(serverWillStops.map((serverWillStop) => serverWillStop()));
});
}
const drainServerCallbacks = taggedServerListeners
.map((l) => l.serverListener.drainServer)
.filter(isDefined_js_1.isDefined);
const drainServers = drainServerCallbacks.length
? async () => {
await Promise.all(drainServerCallbacks.map((drainServer) => drainServer()));
}
: null;
let taggedServerListenersWithRenderLandingPage = taggedServerListeners.filter((l) => l.serverListener.renderLandingPage);
if (taggedServerListenersWithRenderLandingPage.length > 1) {
taggedServerListenersWithRenderLandingPage =
taggedServerListenersWithRenderLandingPage.filter((l) => !l.installedImplicitly);
}
let landingPage = null;
if (taggedServerListenersWithRenderLandingPage.length > 1) {
throw Error('Only one plugin can implement renderLandingPage.');
}
else if (taggedServerListenersWithRenderLandingPage.length) {
landingPage =
await taggedServerListenersWithRenderLandingPage[0].serverListener
.renderLandingPage();
}
const toDisposeLast = this.maybeRegisterTerminationSignalHandlers(['SIGINT', 'SIGTERM'], startedInBackground);
this.internals.state = {
phase: 'started',
schemaManager,
drainServers,
landingPage,
toDispose,
toDisposeLast,
};
}
catch (maybeError) {
const error = (0, errorNormalize_js_1.ensureError)(maybeError);
try {
await Promise.all(this.internals.plugins.map(async (plugin) => plugin.startupDidFail?.({ error })));
}
catch (pluginError) {
this.logger.error(`startupDidFail hook threw: ${pluginError}`);
}
this.internals.state = {
phase: 'failed to start',
error,
};
throw error;
}
finally {
barrier.resolve();
}
}
maybeRegisterTerminationSignalHandlers(signals, startedInBackground) {
const toDisposeLast = [];
if (this.internals.stopOnTerminationSignals === false ||
(this.internals.stopOnTerminationSignals === undefined &&
!(utils_isnodelike_1.isNodeLike &&
this.internals.nodeEnv !== 'test' &&
!startedInBackground))) {
return toDisposeLast;
}
let receivedSignal = false;
const signalHandler = async (signal) => {
if (receivedSignal) {
return;
}
receivedSignal = true;
try {
await this.stop();
}
catch (e) {
this.logger.error(`stop() threw during ${signal} shutdown`);
this.logger.error(e);
process.exit(1);
}
process.kill(process.pid, signal);
};
signals.forEach((signal) => {
process.on(signal, signalHandler);
toDisposeLast.push(async () => {
process.removeListener(signal, signalHandler);
});
});
return toDisposeLast;
}
async _ensureStarted() {
while (true) {
switch (this.internals.state.phase) {
case 'initialized':
throw new Error('You need to call `server.start()` before using your Apollo Server.');
case 'starting':
await this.internals.state.barrier;
break;
case 'failed to start':
this.logStartupError(this.internals.state.error);
throw new Error('This data graph is missing a valid configuration. More details may be available in the server logs.');
case 'started':
case 'draining':
return this.internals.state;
case 'stopping':
case 'stopped':
this.logger.warn('A GraphQL operation was received during server shutdown. The ' +
'operation will fail. Consider draining the HTTP server on shutdown; ' +
'see https://go.apollo.dev/s/drain for details.');
throw new Error(`Cannot execute GraphQL operations ${this.internals.state.phase === 'stopping'
? 'while the server is stopping'
: 'after the server has stopped'}.'`);
default:
throw new UnreachableCaseError_js_1.UnreachableCaseError(this.internals.state);
}
}
}
assertStarted(expressionForError) {
if (this.internals.state.phase !== 'started' &&
this.internals.state.phase !== 'draining' &&
!(this.internals.state.phase === 'starting' &&
this.internals.state.startedInBackground)) {
throw new Error('You must `await server.start()` before calling `' +
expressionForError +
'`');
}
}
logStartupError(err) {
this.logger.error('An error occurred during Apollo Server startup. All GraphQL requests ' +
'will now fail. The startup error was: ' +
(err?.message || err));
}
static constructSchema(config) {
if (config.schema) {
return config.schema;
}
const { typeDefs, resolvers } = config;
const augmentedTypeDefs = Array.isArray(typeDefs) ? typeDefs : [typeDefs];
return (0, schema_1.makeExecutableSchema)({
typeDefs: augmentedTypeDefs,
resolvers,
});
}
static generateSchemaDerivedData(schema, providedDocumentStore) {
(0, graphql_1.assertValidSchema)(schema);
return {
schema,
documentStore: providedDocumentStore === undefined
? new utils_keyvaluecache_1.InMemoryLRUCache()
: providedDocumentStore,
documentStoreKeyPrefix: providedDocumentStore
? `${(0, computeCoreSchemaHash_js_1.computeCoreSchemaHash)((0, graphql_1.printSchema)(schema))}:`
: '',
};
}
async stop() {
switch (this.internals.state.phase) {
case 'initialized':
case 'starting':
case 'failed to start':
throw Error('apolloServer.stop() should only be called after `await apolloServer.start()` has succeeded');
case 'stopped':
if (this.internals.state.stopError) {
throw this.internals.state.stopError;
}
return;
case 'stopping':
case 'draining': {
await this.internals.state.barrier;
const state = this.internals.state;
if (state.phase !== 'stopped') {
throw Error(`Surprising post-stopping state ${state.phase}`);
}
if (state.stopError) {
throw state.stopError;
}
return;
}
case 'started':
break;
default:
throw new UnreachableCaseError_js_1.UnreachableCaseError(this.internals.state);
}
const barrier = (0, resolvable_js_1.default)();
const { schemaManager, drainServers, landingPage, toDispose, toDisposeLast, } = this.internals.state;
this.internals.state = {
phase: 'draining',
barrier,
schemaManager,
landingPage,
};
try {
await drainServers?.();
this.internals.state = { phase: 'stopping', barrier };
await Promise.all([...toDispose].map((dispose) => dispose()));
await Promise.all([...toDisposeLast].map((dispose) => dispose()));
}
catch (stopError) {
this.internals.state = {
phase: 'stopped',
stopError: stopError,
};
barrier.resolve();
throw stopError;
}
this.internals.state = { phase: 'stopped', stopError: null };
}
async addDefaultPlugins() {
const { plugins, apolloConfig, nodeEnv, hideSchemaDetailsFromClientErrors, } = this.internals;
const isDev = nodeEnv !== 'production';
const alreadyHavePluginWithInternalId = (id) => plugins.some((p) => (0, internalPlugin_js_1.pluginIsInternal)(p) && p.__internal_plugin_id__ === id);
const pluginsByInternalID = new Map();
for (const p of plugins) {
if ((0, internalPlugin_js_1.pluginIsInternal)(p)) {
const id = p.__internal_plugin_id__;
if (!pluginsByInternalID.has(id)) {
pluginsByInternalID.set(id, {
sawDisabled: false,
sawNonDisabled: false,
});
}
const seen = pluginsByInternalID.get(id);
if (p.__is_disabled_plugin__) {
seen.sawDisabled = true;
}
else {
seen.sawNonDisabled = true;
}
if (seen.sawDisabled && seen.sawNonDisabled) {
throw new Error(`You have tried to install both ApolloServerPlugin${id} and ` +
`ApolloServerPlugin${id}Disabled in your server. Please choose ` +
`whether or not you want to disable the feature and install the ` +
`appropriate plugin for your use case.`);
}
}
}
{
if (!alreadyHavePluginWithInternalId('CacheControl')) {
const { ApolloServerPluginCacheControl } = await Promise.resolve().then(() => __importStar(require('./plugin/cacheControl/index.js')));
plugins.push(ApolloServerPluginCacheControl());
}
}
{
const alreadyHavePlugin = alreadyHavePluginWithInternalId('UsageReporting');
if (!alreadyHavePlugin && apolloConfig.key) {
if (apolloConfig.graphRef) {
const { ApolloServerPluginUsageReporting } = await Promise.resolve().then(() => __importStar(require('./plugin/usageReporting/index.js')));
plugins.unshift(ApolloServerPluginUsageReporting({
__onlyIfSchemaIsNotSubgraph: true,
}));
}
else {
this.logger.warn('You have specified an Apollo key but have not specified a graph ref; usage ' +
'reporting is disabled. To enable usage reporting, set the `APOLLO_GRAPH_REF` ' +
'environment variable to `your-graph-id@your-graph-variant`. To disable this ' +
'warning, install `ApolloServerPluginUsageReportingDisabled`.');
}
}
}
{
const alreadyHavePlugin = alreadyHavePluginWithInternalId('SchemaReporting');
const enabledViaEnvVar = process.env.APOLLO_SCHEMA_REPORTING === 'true';
if (!alreadyHavePlugin && enabledViaEnvVar) {
if (apolloConfig.key) {
const { ApolloServerPluginSchemaReporting } = await Promise.resolve().then(() => __importStar(require('./plugin/schemaReporting/index.js')));
plugins.push(ApolloServerPluginSchemaReporting());
}
else {
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})');
}
}
}
{
const alreadyHavePlugin = alreadyHavePluginWithInternalId('InlineTrace');
if (!alreadyHavePlugin) {
const { ApolloServerPluginInlineTrace } = await Promise.resolve().then(() => __importStar(require('./plugin/inlineTrace/index.js')));
plugins.push(ApolloServerPluginInlineTrace({ __onlyIfSchemaIsSubgraph: true }));
}
}
const alreadyHavePlugin = alreadyHavePluginWithInternalId('LandingPageDisabled');
if (!alreadyHavePlugin) {
const { ApolloServerPluginLandingPageLocalDefault, ApolloServerPluginLandingPageProductionDefault, } = await Promise.resolve().then(() => __importStar(require('./plugin/landingPage/default/index.js')));
const plugin = isDev
? ApolloServerPluginLandingPageLocalDefault()
: ApolloServerPluginLandingPageProductionDefault();
if (!isImplicitlyInstallablePlugin(plugin)) {
throw Error('default landing page plugin should be implicitly installable?');
}
plugin.__internal_installed_implicitly__ = true;
plugins.push(plugin);
}
{
const alreadyHavePlugin = alreadyHavePluginWithInternalId('DisableSuggestions');
if (hideSchemaDetailsFromClientErrors && !alreadyHavePlugin) {
const { ApolloServerPluginDisableSuggestions } = await Promise.resolve().then(() => __importStar(require('./plugin/disableSuggestions/index.js')));
plugins.push(ApolloServerPluginDisableSuggestions());
}
}
}
addPlugin(plugin) {
if (this.internals.state.phase !== 'initialized') {
throw new Error("Can't add plugins after the server has started");
}
this.internals.plugins.push(plugin);
}
async executeHTTPGraphQLRequest({ httpGraphQLRequest, context, }) {
try {
let runningServerState;
try {
runningServerState = await this._ensureStarted();
}
catch (error) {
return await this.errorResponse(error, httpGraphQLRequest);
}
if (runningServerState.landingPage &&
this.prefersHTML(httpGraphQLRequest)) {
let renderedHtml;
if (typeof runningServerState.landingPage.html === 'string') {
renderedHtml = runningServerState.landingPage.html;
}
else {
try {
renderedHtml = await runningServerState.landingPage.html();
}
catch (maybeError) {
const error = (0, errorNormalize_js_1.ensureError)(maybeError);
this.logger.error(`Landing page \`html\` function threw: ${error}`);
return await this.errorResponse(error, httpGraphQLRequest);
}
}
return {
headers: new HeaderMap_js_1.HeaderMap([['content-type', 'text/html']]),
body: {
kind: 'complete',
string: renderedHtml,
},
};
}
if (this.internals.csrfPreventionRequestHeaders) {
(0, preventCsrf_js_1.preventCsrf)(httpGraphQLRequest.headers, this.internals.csrfPreventionRequestHeaders);
}
let contextValue;
try {
contextValue = await context();
}
catch (maybeError) {
const error = (0, errorNormalize_js_1.ensureError)(maybeError);
try {
await Promise.all(this.internals.plugins.map(async (plugin) => plugin.contextCreationDidFail?.({
error,
})));
}
catch (pluginError) {
this.logger.error(`contextCreationDidFail hook threw: ${pluginError}`);
}
return await this.errorResponse((0, errorNormalize_js_1.ensureGraphQLError)(error, 'Context creation failed: '), httpGraphQLRequest);
}
return await (0, httpBatching_js_1.runPotentiallyBatchedHttpQuery)(this, httpGraphQLRequest, contextValue, runningServerState.schemaManager.getSchemaDerivedData(), this.internals);
}
catch (maybeError_) {
const maybeError = maybeError_;
if (maybeError instanceof graphql_1.GraphQLError &&
maybeError.extensions.code === index_js_1.ApolloServerErrorCode.BAD_REQUEST) {
try {
await Promise.all(this.internals.plugins.map(async (plugin) => plugin.invalidRequestWasReceived?.({ error: maybeError })));
}
catch (pluginError) {
this.logger.error(`invalidRequestWasReceived hook threw: ${pluginError}`);
}
}
return await this.errorResponse(maybeError, httpGraphQLRequest);
}
}
async errorResponse(error, requestHead) {
const { formattedErrors, httpFromErrors } = (0, errorNormalize_js_1.normalizeAndFormatErrors)([error], {
includeStacktraceInErrorResponses: this.internals.includeStacktraceInErrorResponses,
formatError: this.internals.formatError,
});
return {
status: httpFromErrors.status ?? 500,
headers: new HeaderMap_js_1.HeaderMap([
...httpFromErrors.headers,
[
'content-type',
chooseContentTypeForSingleResultResponse(requestHead) ??
exports.MEDIA_TYPES.APPLICATION_JSON,
],
]),
body: {
kind: 'complete',
string: await this.internals.stringifyResult({
errors: formattedErrors,
}),
},
};
}
prefersHTML(request) {
const acceptHeader = request.headers.get('accept');
return (request.method === 'GET' &&
!!acceptHeader &&
new negotiator_1.default({
headers: { accept: acceptHeader },
}).mediaType([
exports.MEDIA_TYPES.APPLICATION_JSON,
exports.MEDIA_TYPES.APPLICATION_GRAPHQL_RESPONSE_JSON,
exports.MEDIA_TYPES.MULTIPART_MIXED_EXPERIMENTAL,
exports.MEDIA_TYPES.MULTIPART_MIXED_NO_DEFER_SPEC,
exports.MEDIA_TYPES.TEXT_HTML,
]) === exports.MEDIA_TYPES.TEXT_HTML);
}
async executeOperation(request, options = {}) {
if (this.internals.state.phase === 'initialized') {
await this.start();
}
const schemaDerivedData = (await this._ensureStarted()).schemaManager.getSchemaDerivedData();
const graphQLRequest = {
...request,
query: request.query && typeof request.query !== 'string'
? (0, graphql_1.print)(request.query)
: request.query,
};
const response = await internalExecuteOperation({
server: this,
graphQLRequest,
internals: this.internals,
schemaDerivedData,
sharedResponseHTTPGraphQLHead: null,
}, options);
return response;
}
}
exports.ApolloServer = ApolloServer;
async function internalExecuteOperation({ server, graphQLRequest, internals, schemaDerivedData, sharedResponseHTTPGraphQLHead, }, options) {
const requestContext = {
logger: server.logger,
cache: server.cache,
schema: schemaDerivedData.schema,
request: graphQLRequest,
response: {
http: sharedResponseHTTPGraphQLHead ?? (0, runHttpQuery_js_1.newHTTPGraphQLHead)(),
},
contextValue: cloneObject(options?.contextValue ?? {}),
metrics: {},
overallCachePolicy: (0, cachePolicy_js_1.newCachePolicy)(),
requestIsBatched: sharedResponseHTTPGraphQLHead !== null,
};
try {
return await (0, requestPipeline_js_1.processGraphQLRequest)(schemaDerivedData, server, internals, requestContext);
}
catch (maybeError) {
const error = (0, errorNormalize_js_1.ensureError)(maybeError);
await Promise.all(internals.plugins.map(async (plugin) => plugin.unexpectedErrorProcessingRequest?.({
requestContext,
error,
})));
server.logger.error(`Unexpected error processing request: ${error}`);
throw new Error('Internal server error');
}
}
exports.internalExecuteOperation = internalExecuteOperation;
function isImplicitlyInstallablePlugin(p) {
return '__internal_installed_implicitly__' in p;
}
exports.isImplicitlyInstallablePlugin = isImplicitlyInstallablePlugin;
exports.MEDIA_TYPES = {
APPLICATION_JSON: 'application/json; charset=utf-8',
APPLICATION_JSON_GRAPHQL_CALLBACK: 'application/json; callbackSpec=1.0; charset=utf-8',
APPLICATION_GRAPHQL_RESPONSE_JSON: 'application/graphql-response+json; charset=utf-8',
MULTIPART_MIXED_NO_DEFER_SPEC: 'multipart/mixed',
MULTIPART_MIXED_EXPERIMENTAL: 'multipart/mixed; deferSpec=20220824',
TEXT_HTML: 'text/html',
};
function chooseContentTypeForSingleResultResponse(head) {
const acceptHeader = head.headers.get('accept');
if (!acceptHeader) {
return exports.MEDIA_TYPES.APPLICATION_JSON;
}
else {
const preferred = new negotiator_1.default({
headers: { accept: head.headers.get('accept') },
}).mediaType([
exports.MEDIA_TYPES.APPLICATION_JSON,
exports.MEDIA_TYPES.APPLICATION_GRAPHQL_RESPONSE_JSON,
exports.MEDIA_TYPES.APPLICATION_JSON_GRAPHQL_CALLBACK,
]);
if (preferred) {
return preferred;
}
else {
return null;
}
}
}
exports.chooseContentTypeForSingleResultResponse = chooseContentTypeForSingleResultResponse;
function cloneObject(object) {
return Object.assign(Object.create(Object.getPrototypeOf(object)), object);
}
//# sourceMappingURL=ApolloServer.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,3 @@
import type { CachePolicy } from '@apollo/cache-control-types';
export declare function newCachePolicy(): CachePolicy;
//# sourceMappingURL=cachePolicy.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"cachePolicy.d.ts","sourceRoot":"","sources":["../../src/cachePolicy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAa,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1E,wBAAgB,cAAc,IAAI,WAAW,CA8B5C"}

34
node_modules/@apollo/server/dist/cjs/cachePolicy.js generated vendored Normal file
View File

@@ -0,0 +1,34 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.newCachePolicy = void 0;
function newCachePolicy() {
return {
maxAge: undefined,
scope: undefined,
restrict(hint) {
if (hint.maxAge !== undefined &&
(this.maxAge === undefined || hint.maxAge < this.maxAge)) {
this.maxAge = hint.maxAge;
}
if (hint.scope !== undefined && this.scope !== 'PRIVATE') {
this.scope = hint.scope;
}
},
replace(hint) {
if (hint.maxAge !== undefined) {
this.maxAge = hint.maxAge;
}
if (hint.scope !== undefined) {
this.scope = hint.scope;
}
},
policyIfCacheable() {
if (this.maxAge === undefined || this.maxAge === 0) {
return null;
}
return { maxAge: this.maxAge, scope: this.scope ?? 'PUBLIC' };
},
};
}
exports.newCachePolicy = newCachePolicy;
//# sourceMappingURL=cachePolicy.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"cachePolicy.js","sourceRoot":"","sources":["../../src/cachePolicy.ts"],"names":[],"mappings":";;;AAEA,SAAgB,cAAc;IAC5B,OAAO;QACL,MAAM,EAAE,SAAS;QACjB,KAAK,EAAE,SAAS;QAChB,QAAQ,CAAC,IAAe;YACtB,IACE,IAAI,CAAC,MAAM,KAAK,SAAS;gBACzB,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS,IAAI,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,EACxD,CAAC;gBACD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;YAC5B,CAAC;YACD,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;gBACzD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;YAC1B,CAAC;QACH,CAAC;QACD,OAAO,CAAC,IAAe;YACrB,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;gBAC9B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;YAC5B,CAAC;YACD,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;gBAC7B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;YAC1B,CAAC;QACH,CAAC;QACD,iBAAiB;YACf,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACnD,OAAO,IAAI,CAAC;YACd,CAAC;YACD,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,QAAQ,EAAE,CAAC;QAChE,CAAC;KACF,CAAC;AACJ,CAAC;AA9BD,wCA8BC"}

View File

@@ -0,0 +1,4 @@
import type { ApolloConfig, ApolloConfigInput } from './externalTypes/index.js';
import type { Logger } from '@apollo/utils.logger';
export declare function determineApolloConfig(input: ApolloConfigInput | undefined, logger: Logger): ApolloConfig;
//# sourceMappingURL=determineApolloConfig.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"determineApolloConfig.d.ts","sourceRoot":"","sources":["../../src/determineApolloConfig.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAChF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAInD,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,iBAAiB,GAAG,SAAS,EACpC,MAAM,EAAE,MAAM,GACb,YAAY,CAuEd"}

View File

@@ -0,0 +1,59 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.determineApolloConfig = void 0;
const utils_createhash_1 = require("@apollo/utils.createhash");
function determineApolloConfig(input, logger) {
const apolloConfig = {};
const { APOLLO_KEY, APOLLO_GRAPH_REF, APOLLO_GRAPH_ID, APOLLO_GRAPH_VARIANT, } = process.env;
if (input?.key) {
apolloConfig.key = input.key.trim();
}
else if (APOLLO_KEY) {
apolloConfig.key = APOLLO_KEY.trim();
}
if ((input?.key ?? APOLLO_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 = (0, utils_createhash_1.createHash)('sha512')
.update(apolloConfig.key)
.digest('hex');
}
if (input?.graphRef) {
apolloConfig.graphRef = input.graphRef;
}
else if (APOLLO_GRAPH_REF) {
apolloConfig.graphRef = APOLLO_GRAPH_REF;
}
const graphId = input?.graphId ?? APOLLO_GRAPH_ID;
const graphVariant = input?.graphVariant ?? APOLLO_GRAPH_VARIANT;
if (apolloConfig.graphRef) {
if (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 (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 variant.');
}
}
else if (graphId) {
apolloConfig.graphRef = graphVariant
? `${graphId}@${graphVariant}`
: graphId;
}
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

View File

@@ -0,0 +1 @@
{"version":3,"file":"determineApolloConfig.js","sourceRoot":"","sources":["../../src/determineApolloConfig.ts"],"names":[],"mappings":";;;AAAA,+DAAsD;AAMtD,SAAgB,qBAAqB,CACnC,KAAoC,EACpC,MAAc;IAEd,MAAM,YAAY,GAAiB,EAAE,CAAC;IAEtC,MAAM,EACJ,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,oBAAoB,GACrB,GAAG,OAAO,CAAC,GAAG,CAAC;IAGhB,IAAI,KAAK,EAAE,GAAG,EAAE,CAAC;QACf,YAAY,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;IACtC,CAAC;SAAM,IAAI,UAAU,EAAE,CAAC;QACtB,YAAY,CAAC,GAAG,GAAG,UAAU,CAAC,IAAI,EAAE,CAAC;IACvC,CAAC;IACD,IAAI,CAAC,KAAK,EAAE,GAAG,IAAI,UAAU,CAAC,KAAK,YAAY,CAAC,GAAG,EAAE,CAAC;QACpD,MAAM,CAAC,IAAI,CACT,sEAAsE;YACpE,mDAAmD,CACtD,CAAC;IACJ,CAAC;IAID,IAAI,YAAY,CAAC,GAAG,EAAE,CAAC;QACrB,sBAAsB,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;IAC3C,CAAC;IAGD,IAAI,YAAY,CAAC,GAA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IAAI,CAC5K,IAAI,CACL,+IAA+I,CACjJ,CAAC;IACJ,CAAC;AACH,CAAC"}

View File

@@ -0,0 +1,12 @@
import { GraphQLError, type GraphQLFormattedError } from 'graphql';
import type { HTTPGraphQLHead } from './externalTypes/http.js';
export declare function normalizeAndFormatErrors(errors: ReadonlyArray<unknown>, options?: {
formatError?: (formattedError: GraphQLFormattedError, error: unknown) => GraphQLFormattedError;
includeStacktraceInErrorResponses?: boolean;
}): {
formattedErrors: Array<GraphQLFormattedError>;
httpFromErrors: HTTPGraphQLHead;
};
export declare function ensureError(maybeError: unknown): Error;
export declare function ensureGraphQLError(maybeError: unknown, messagePrefixIfNotGraphQLError?: string): GraphQLError;
//# sourceMappingURL=errorNormalize.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"errorNormalize.d.ts","sourceRoot":"","sources":["../../src/errorNormalize.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,YAAY,EAEZ,KAAK,qBAAqB,EAC3B,MAAM,SAAS,CAAC;AAEjB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAY/D,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,EAC9B,OAAO,GAAE;IACP,WAAW,CAAC,EAAE,CACZ,cAAc,EAAE,qBAAqB,EACrC,KAAK,EAAE,OAAO,KACX,qBAAqB,CAAC;IAC3B,iCAAiC,CAAC,EAAE,OAAO,CAAC;CACxC,GACL;IACD,eAAe,EAAE,KAAK,CAAC,qBAAqB,CAAC,CAAC;IAC9C,cAAc,EAAE,eAAe,CAAC;CACjC,CAqDA;AAED,wBAAgB,WAAW,CAAC,UAAU,EAAE,OAAO,GAAG,KAAK,CAItD;AAED,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,OAAO,EACnB,8BAA8B,GAAE,MAAW,GAC1C,YAAY,CAQd"}

72
node_modules/@apollo/server/dist/cjs/errorNormalize.js generated vendored Normal file
View File

@@ -0,0 +1,72 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ensureGraphQLError = exports.ensureError = exports.normalizeAndFormatErrors = void 0;
const graphql_1 = require("graphql");
const index_js_1 = require("./errors/index.js");
const runHttpQuery_js_1 = require("./runHttpQuery.js");
const HeaderMap_js_1 = require("./utils/HeaderMap.js");
function normalizeAndFormatErrors(errors, options = {}) {
const formatError = options.formatError ?? ((error) => error);
const httpFromErrors = (0, runHttpQuery_js_1.newHTTPGraphQLHead)();
return {
httpFromErrors,
formattedErrors: errors.map((error) => {
try {
return formatError(enrichError(error), error);
}
catch (formattingError) {
if (options.includeStacktraceInErrorResponses) {
return enrichError(formattingError);
}
else {
return {
message: 'Internal server error',
extensions: { code: index_js_1.ApolloServerErrorCode.INTERNAL_SERVER_ERROR },
};
}
}
}),
};
function enrichError(maybeError) {
const graphqlError = ensureGraphQLError(maybeError);
const extensions = {
...graphqlError.extensions,
code: graphqlError.extensions.code ??
index_js_1.ApolloServerErrorCode.INTERNAL_SERVER_ERROR,
};
if (isPartialHTTPGraphQLHead(extensions.http)) {
(0, runHttpQuery_js_1.mergeHTTPGraphQLHead)(httpFromErrors, {
headers: new HeaderMap_js_1.HeaderMap(),
...extensions.http,
});
delete extensions.http;
}
if (options.includeStacktraceInErrorResponses) {
extensions.stacktrace = graphqlError.stack?.split('\n');
}
return { ...graphqlError.toJSON(), extensions };
}
}
exports.normalizeAndFormatErrors = normalizeAndFormatErrors;
function ensureError(maybeError) {
return maybeError instanceof Error
? maybeError
: new graphql_1.GraphQLError('Unexpected error value: ' + String(maybeError));
}
exports.ensureError = ensureError;
function ensureGraphQLError(maybeError, messagePrefixIfNotGraphQLError = '') {
const error = ensureError(maybeError);
return error instanceof graphql_1.GraphQLError
? error
: new graphql_1.GraphQLError(messagePrefixIfNotGraphQLError + error.message, {
originalError: error,
});
}
exports.ensureGraphQLError = ensureGraphQLError;
function isPartialHTTPGraphQLHead(x) {
return (!!x &&
typeof x === 'object' &&
(!('status' in x) || typeof x.status === 'number') &&
(!('headers' in x) || x.headers instanceof Map));
}
//# sourceMappingURL=errorNormalize.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"errorNormalize.js","sourceRoot":"","sources":["../../src/errorNormalize.ts"],"names":[],"mappings":";;;AAEA,qCAIiB;AACjB,gDAA0D;AAE1D,uDAA6E;AAC7E,uDAAiD;AAUjD,SAAgB,wBAAwB,CACtC,MAA8B,EAC9B,UAMI,EAAE;IAKN,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;IAC9D,MAAM,cAAc,GAAG,IAAA,oCAAkB,GAAE,CAAC;IAE5C,OAAO;QACL,cAAc;QACd,eAAe,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;YACpC,IAAI,CAAC;gBACH,OAAO,WAAW,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC;YAChD,CAAC;YAAC,OAAO,eAAe,EAAE,CAAC;gBACzB,IAAI,OAAO,CAAC,iCAAiC,EAAE,CAAC;oBAG9C,OAAO,WAAW,CAAC,eAAe,CAAC,CAAC;gBACtC,CAAC;qBAAM,CAAC;oBAEN,OAAO;wBACL,OAAO,EAAE,uBAAuB;wBAChC,UAAU,EAAE,EAAE,IAAI,EAAE,gCAAqB,CAAC,qBAAqB,EAAE;qBAClE,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC,CAAC;KACH,CAAC;IAEF,SAAS,WAAW,CAAC,UAAmB;QACtC,MAAM,YAAY,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;QAEpD,MAAM,UAAU,GAA2B;YACzC,GAAG,YAAY,CAAC,UAAU;YAC1B,IAAI,EACF,YAAY,CAAC,UAAU,CAAC,IAAI;gBAC5B,gCAAqB,CAAC,qBAAqB;SAC9C,CAAC;QAEF,IAAI,wBAAwB,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;Y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AACJ,CAAC"}

15
node_modules/@apollo/server/dist/cjs/errors/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,15 @@
export declare enum ApolloServerErrorCode {
INTERNAL_SERVER_ERROR = "INTERNAL_SERVER_ERROR",
GRAPHQL_PARSE_FAILED = "GRAPHQL_PARSE_FAILED",
GRAPHQL_VALIDATION_FAILED = "GRAPHQL_VALIDATION_FAILED",
PERSISTED_QUERY_NOT_FOUND = "PERSISTED_QUERY_NOT_FOUND",
PERSISTED_QUERY_NOT_SUPPORTED = "PERSISTED_QUERY_NOT_SUPPORTED",
BAD_USER_INPUT = "BAD_USER_INPUT",
OPERATION_RESOLUTION_FAILURE = "OPERATION_RESOLUTION_FAILURE",
BAD_REQUEST = "BAD_REQUEST"
}
export declare enum ApolloServerValidationErrorCode {
INTROSPECTION_DISABLED = "INTROSPECTION_DISABLED"
}
export declare function unwrapResolverError(error: unknown): unknown;
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/errors/index.ts"],"names":[],"mappings":"AAEA,oBAAY,qBAAqB;IAC/B,qBAAqB,0BAA0B;IAC/C,oBAAoB,yBAAyB;IAC7C,yBAAyB,8BAA8B;IACvD,yBAAyB,8BAA8B;IACvD,6BAA6B,kCAAkC;IAC/D,cAAc,mBAAmB;IACjC,4BAA4B,iCAAiC;IAC7D,WAAW,gBAAgB;CAC5B;AAED,oBAAY,+BAA+B;IACzC,sBAAsB,2BAA2B;CAClD;AAWD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAK3D"}

27
node_modules/@apollo/server/dist/cjs/errors/index.js generated vendored Normal file
View File

@@ -0,0 +1,27 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.unwrapResolverError = exports.ApolloServerValidationErrorCode = exports.ApolloServerErrorCode = void 0;
const graphql_1 = require("graphql");
var ApolloServerErrorCode;
(function (ApolloServerErrorCode) {
ApolloServerErrorCode["INTERNAL_SERVER_ERROR"] = "INTERNAL_SERVER_ERROR";
ApolloServerErrorCode["GRAPHQL_PARSE_FAILED"] = "GRAPHQL_PARSE_FAILED";
ApolloServerErrorCode["GRAPHQL_VALIDATION_FAILED"] = "GRAPHQL_VALIDATION_FAILED";
ApolloServerErrorCode["PERSISTED_QUERY_NOT_FOUND"] = "PERSISTED_QUERY_NOT_FOUND";
ApolloServerErrorCode["PERSISTED_QUERY_NOT_SUPPORTED"] = "PERSISTED_QUERY_NOT_SUPPORTED";
ApolloServerErrorCode["BAD_USER_INPUT"] = "BAD_USER_INPUT";
ApolloServerErrorCode["OPERATION_RESOLUTION_FAILURE"] = "OPERATION_RESOLUTION_FAILURE";
ApolloServerErrorCode["BAD_REQUEST"] = "BAD_REQUEST";
})(ApolloServerErrorCode || (exports.ApolloServerErrorCode = ApolloServerErrorCode = {}));
var ApolloServerValidationErrorCode;
(function (ApolloServerValidationErrorCode) {
ApolloServerValidationErrorCode["INTROSPECTION_DISABLED"] = "INTROSPECTION_DISABLED";
})(ApolloServerValidationErrorCode || (exports.ApolloServerValidationErrorCode = ApolloServerValidationErrorCode = {}));
function unwrapResolverError(error) {
if (error instanceof graphql_1.GraphQLError && error.path && error.originalError) {
return error.originalError;
}
return error;
}
exports.unwrapResolverError = unwrapResolverError;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/errors/index.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AAEvC,IAAY,qBASX;AATD,WAAY,qBAAqB;IAC/B,wEAA+C,CAAA;IAC/C,sEAA6C,CAAA;IAC7C,gFAAuD,CAAA;IACvD,gFAAuD,CAAA;IACvD,wFAA+D,CAAA;IAC/D,0DAAiC,CAAA;IACjC,sFAA6D,CAAA;IAC7D,oDAA2B,CAAA;AAC7B,CAAC,EATW,qBAAqB,qCAArB,qBAAqB,QAShC;AAED,IAAY,+BAEX;AAFD,WAAY,+BAA+B;IACzC,oFAAiD,CAAA;AACnD,CAAC,EAFW,+BAA+B,+CAA/B,+BAA+B,QAE1C;AAWD,SAAgB,mBAAmB,CAAC,KAAc;IAChD,IAAI,KAAK,YAAY,sBAAY,IAAI,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,aAAa,EAAE,CAAC;QACvE,OAAO,KAAK,CAAC,aAAa,CAAC;IAC7B,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AALD,kDAKC"}

View File

@@ -0,0 +1,14 @@
import type { WithRequired } from '@apollo/utils.withrequired';
import type express from 'express';
import type { ApolloServer } from '../index.js';
import type { BaseContext, ContextFunction } from '../externalTypes/index.js';
export interface ExpressContextFunctionArgument {
req: express.Request;
res: express.Response;
}
export interface ExpressMiddlewareOptions<TContext extends BaseContext> {
context?: ContextFunction<[ExpressContextFunctionArgument], TContext>;
}
export declare function expressMiddleware(server: ApolloServer<BaseContext>, options?: ExpressMiddlewareOptions<BaseContext>): express.RequestHandler;
export declare function expressMiddleware<TContext extends BaseContext>(server: ApolloServer<TContext>, options: WithRequired<ExpressMiddlewareOptions<TContext>, 'context'>): express.RequestHandler;
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/express4/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EACV,WAAW,EACX,eAAe,EAEhB,MAAM,2BAA2B,CAAC;AAInC,MAAM,WAAW,8BAA8B;IAC7C,GAAG,EAAE,OAAO,CAAC,OAAO,CAAC;IACrB,GAAG,EAAE,OAAO,CAAC,QAAQ,CAAC;CACvB;AAED,MAAM,WAAW,wBAAwB,CAAC,QAAQ,SAAS,WAAW;IACpE,OAAO,CAAC,EAAE,eAAe,CAAC,CAAC,8BAA8B,CAAC,EAAE,QAAQ,CAAC,CAAC;CACvE;AAED,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,CAAC,WAAW,CAAC,EACjC,OAAO,CAAC,EAAE,wBAAwB,CAAC,WAAW,CAAC,GAC9C,OAAO,CAAC,cAAc,CAAC;AAC1B,wBAAgB,iBAAiB,CAAC,QAAQ,SAAS,WAAW,EAC5D,MAAM,EAAE,YAAY,CAAC,QAAQ,CAAC,EAC9B,OAAO,EAAE,YAAY,CAAC,wBAAwB,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,GACnE,OAAO,CAAC,cAAc,CAAC"}

55
node_modules/@apollo/server/dist/cjs/express4/index.js generated vendored Normal file
View File

@@ -0,0 +1,55 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.expressMiddleware = void 0;
const url_1 = require("url");
const HeaderMap_js_1 = require("../utils/HeaderMap.js");
function expressMiddleware(server, options) {
server.assertStarted('expressMiddleware()');
const defaultContext = async () => ({});
const context = options?.context ?? defaultContext;
return (req, res, next) => {
if (!req.body) {
res.status(500);
res.send('`req.body` is not set; this probably means you forgot to set up the ' +
'`json` middleware before the Apollo Server middleware.');
return;
}
const headers = new HeaderMap_js_1.HeaderMap();
for (const [key, value] of Object.entries(req.headers)) {
if (value !== undefined) {
headers.set(key, Array.isArray(value) ? value.join(', ') : value);
}
}
const httpGraphQLRequest = {
method: req.method.toUpperCase(),
headers,
search: (0, url_1.parse)(req.url).search ?? '',
body: req.body,
};
server
.executeHTTPGraphQLRequest({
httpGraphQLRequest,
context: () => context({ req, res }),
})
.then(async (httpGraphQLResponse) => {
for (const [key, value] of httpGraphQLResponse.headers) {
res.setHeader(key, value);
}
res.statusCode = httpGraphQLResponse.status || 200;
if (httpGraphQLResponse.body.kind === 'complete') {
res.send(httpGraphQLResponse.body.string);
return;
}
for await (const chunk of httpGraphQLResponse.body.asyncIterator) {
res.write(chunk);
if (typeof res.flush === 'function') {
res.flush();
}
}
res.end();
})
.catch(next);
};
}
exports.expressMiddleware = expressMiddleware;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/express4/index.ts"],"names":[],"mappings":";;;AAQA,6BAAwC;AACxC,wDAAkD;AAmBlD,SAAgB,iBAAiB,CAC/B,MAA8B,EAC9B,OAA4C;IAE5C,MAAM,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC;IAK5C,MAAM,cAAc,GAGhB,KAAK,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IAErB,MAAM,OAAO,GACX,OAAO,EAAE,OAAO,IAAI,cAAc,CAAC;IAErC,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QACxB,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;YAKd,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAChB,GAAG,CAAC,IAAI,CACN,sEAAsE;gBACpE,wDAAwD,CAC3D,CAAC;YACF,OAAO;QACT,CAAC;QAED,MAAM,OAAO,GAAG,IAAI,wBAAS,EAAE,CAAC;QAChC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;YACvD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBAOxB,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACpE,CAAC;QACH,CAAC;QAED,MAAM,kBAAkB,GAAuB;YAC7C,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE;YAChC,OAAO;YACP,MAAM,EAAE,IAAA,WAAQ,EAAC,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,IAAI,EAAE;YACtC,IAAI,EAAE,GAAG,CAAC,IAAI;SACf,CAAC;QAEF,MAAM;aACH,yBAAyB,CAAC;YACzB,kBAAkB;YAClB,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;SACrC,CAAC;aACD,IAAI,CAAC,KAAK,EAAE,mBAAmB,EAAE,EAAE;YAClC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,mBAAmB,CAAC,OAAO,EAAE,CAAC;gBACvD,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YAC5B,CAAC;YACD,GAAG,CAAC,UAAU,GAAG,mBAAmB,CAAC,MAAM,IAAI,GAAG,CAAC;YAEnD,IAAI,mBAAmB,CAAC,IAAI,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;gBACjD,GAAG,CAAC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBAC1C,OAAO;YACT,CAAC;YAED,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,mBAAmB,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;gBACjE,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBAMjB,IAAI,OAAQ,GAAW,CAAC,KAAK,KAAK,UAAU,EAAE,CAAC;oBAC5C,GAAW,CAAC,KAAK,EAAE,CAAC;gBACvB,CAAC;YACH,CAAC;YACD,GAAG,CAAC,GAAG,EAAE,CAAC;QACZ,CAAC,CAAC;aACD,KAAK,CAAC,IAAI,CAAC,CAAC;IACjB,CAAC,CAAC;AACJ,CAAC;AAlFD,8CAkFC"}

View File

@@ -0,0 +1,73 @@
import type { Logger } from '@apollo/utils.logger';
import type { IExecutableSchemaDefinition } from '@graphql-tools/schema';
import type { DocumentNode, FormattedExecutionResult, GraphQLFieldResolver, GraphQLFormattedError, GraphQLSchema, ParseOptions, ValidationRule } from 'graphql';
import type { KeyValueCache } from '@apollo/utils.keyvaluecache';
import type { GatewayInterface } from '@apollo/server-gateway-interface';
import type { ApolloServerPlugin } from './plugins.js';
import type { BaseContext } from './index.js';
import type { GraphQLExperimentalIncrementalExecutionResults } from '../incrementalDeliveryPolyfill.js';
export type DocumentStore = KeyValueCache<DocumentNode>;
export interface ApolloConfigInput {
key?: string;
graphRef?: string;
graphId?: string;
graphVariant?: string;
}
export interface ApolloConfig {
key?: string;
keyHash?: string;
graphRef?: string;
}
export interface PersistedQueryOptions {
cache?: KeyValueCache<string>;
ttl?: number | null;
}
export interface CSRFPreventionOptions {
requestHeaders?: string[];
}
interface ApolloServerOptionsBase<TContext extends BaseContext> {
formatError?: (formattedError: GraphQLFormattedError, error: unknown) => GraphQLFormattedError;
rootValue?: ((parsedQuery: DocumentNode) => unknown) | unknown;
validationRules?: Array<ValidationRule>;
fieldResolver?: GraphQLFieldResolver<any, TContext>;
cache?: KeyValueCache<string> | 'bounded';
includeStacktraceInErrorResponses?: boolean;
logger?: Logger;
allowBatchedHttpRequests?: boolean;
stringifyResult?: (value: FormattedExecutionResult) => string | Promise<string>;
introspection?: boolean;
hideSchemaDetailsFromClientErrors?: boolean;
plugins?: ApolloServerPlugin<TContext>[];
persistedQueries?: PersistedQueryOptions | false;
stopOnTerminationSignals?: boolean;
apollo?: ApolloConfigInput;
nodeEnv?: string;
documentStore?: DocumentStore | null;
dangerouslyDisableValidation?: boolean;
csrfPrevention?: CSRFPreventionOptions | boolean;
parseOptions?: ParseOptions;
status400ForVariableCoercionErrors?: boolean;
__testing_incrementalExecutionResults?: GraphQLExperimentalIncrementalExecutionResults;
}
export interface ApolloServerOptionsWithGateway<TContext extends BaseContext> extends ApolloServerOptionsBase<TContext> {
gateway: GatewayInterface;
schema?: undefined;
typeDefs?: undefined;
resolvers?: undefined;
}
export interface ApolloServerOptionsWithSchema<TContext extends BaseContext> extends ApolloServerOptionsBase<TContext> {
schema: GraphQLSchema;
gateway?: undefined;
typeDefs?: undefined;
resolvers?: undefined;
}
export interface ApolloServerOptionsWithTypeDefs<TContext extends BaseContext> extends ApolloServerOptionsBase<TContext> {
typeDefs: IExecutableSchemaDefinition<TContext>['typeDefs'];
resolvers?: IExecutableSchemaDefinition<TContext>['resolvers'];
gateway?: undefined;
schema?: undefined;
}
export type ApolloServerOptionsWithStaticSchema<TContext extends BaseContext> = ApolloServerOptionsWithSchema<TContext> | ApolloServerOptionsWithTypeDefs<TContext>;
export type ApolloServerOptions<TContext extends BaseContext> = ApolloServerOptionsWithGateway<TContext> | ApolloServerOptionsWithStaticSchema<TContext>;
export {};
//# sourceMappingURL=constructor.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"constructor.d.ts","sourceRoot":"","sources":["../../../src/externalTypes/constructor.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,KAAK,EACV,YAAY,EACZ,wBAAwB,EACxB,oBAAoB,EACpB,qBAAqB,EACrB,aAAa,EACb,YAAY,EACZ,cAAc,EACf,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,8CAA8C,EAAE,MAAM,mCAAmC,CAAC;AAExG,MAAM,MAAM,aAAa,GAAG,aAAa,CAAC,YAAY,CAAC,CAAC;AAKxD,MAAM,WAAW,iBAAiB;IAEhC,GAAG,CAAC,EAAE,MAAM,CAAC;IAKb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,OAAO,CAAC,EAAE,MAAM,CAAC;IAGjB,YAAY,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Q,CAAC,GACvC,+BAA+B,CAAC,QAAQ,CAAC,CAAC;AAE9C,MAAM,MAAM,mBAAmB,CAAC,QAAQ,SAAS,WAAW,IACxD,8BAA8B,CAAC,QAAQ,CAAC,GACxC,mCAAmC,CAAC,QAAQ,CAAC,CAAC"}

View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=constructor.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"constructor.js","sourceRoot":"","sources":["../../../src/externalTypes/constructor.ts"],"names":[],"mappings":""}

View File

@@ -0,0 +1,4 @@
export type BaseContext = {};
export type ContextFunction<TIntegrationSpecificArgs extends any[], TContext extends BaseContext = BaseContext> = (...integrationContext: TIntegrationSpecificArgs) => Promise<TContext>;
export type ContextThunk<TContext extends BaseContext = BaseContext> = () => Promise<TContext>;
//# sourceMappingURL=context.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/externalTypes/context.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,WAAW,GAAG,EAAE,CAAC;AAI7B,MAAM,MAAM,eAAe,CACzB,wBAAwB,SAAS,GAAG,EAAE,EACtC,QAAQ,SAAS,WAAW,GAAG,WAAW,IACxC,CAAC,GAAG,kBAAkB,EAAE,wBAAwB,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAM3E,MAAM,MAAM,YAAY,CAAC,QAAQ,SAAS,WAAW,GAAG,WAAW,IACjE,MAAM,OAAO,CAAC,QAAQ,CAAC,CAAC"}

View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=context.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/externalTypes/context.ts"],"names":[],"mappings":""}

View File

@@ -0,0 +1,32 @@
import type { FormattedExecutionResult } from 'graphql';
import type { BaseContext } from './context.js';
import type { HTTPGraphQLHead, HTTPGraphQLRequest } from './http.js';
import type { WithRequired } from '@apollo/utils.withrequired';
import type { GraphQLExperimentalFormattedInitialIncrementalExecutionResult, GraphQLExperimentalFormattedSubsequentIncrementalExecutionResult } from './incrementalDeliveryPolyfill.js';
export interface GraphQLRequest<TVariables extends VariableValues = VariableValues> {
query?: string;
operationName?: string;
variables?: TVariables;
extensions?: Record<string, any>;
http?: HTTPGraphQLRequest;
}
export type VariableValues = {
[name: string]: any;
};
export type GraphQLResponseBody<TData = Record<string, unknown>> = {
kind: 'single';
singleResult: FormattedExecutionResult<TData>;
} | {
kind: 'incremental';
initialResult: GraphQLExperimentalFormattedInitialIncrementalExecutionResult;
subsequentResults: AsyncIterable<GraphQLExperimentalFormattedSubsequentIncrementalExecutionResult>;
};
export type GraphQLInProgressResponse<TData = Record<string, unknown>> = {
http: HTTPGraphQLHead;
body?: GraphQLResponseBody<TData>;
};
export type GraphQLResponse<TData = Record<string, unknown>> = WithRequired<GraphQLInProgressResponse<TData>, 'body'>;
export interface ExecuteOperationOptions<TContext extends BaseContext> {
contextValue?: TContext;
}
//# sourceMappingURL=graphql.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../../../src/externalTypes/graphql.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACrE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EACV,6DAA6D,EAC7D,gEAAgE,EACjE,MAAM,kCAAkC,CAAC;AAE1C,MAAM,WAAW,cAAc,CAC7B,UAAU,SAAS,cAAc,GAAG,cAAc;IAElD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACjC,IAAI,CAAC,EAAE,kBAAkB,CAAC;CAC3B;AAED,MAAM,MAAM,cAAc,GAAG;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,CAAC;AAOrD,MAAM,MAAM,mBAAmB,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAC3D;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,YAAY,EAAE,wBAAwB,CAAC,KAAK,CAAC,CAAC;CAC/C,GACD;IACE,IAAI,EAAE,aAAa,CAAC;IACpB,aAAa,EAAE,6DAA6D,CAAC;IAC7E,iBAAiB,EAAE,aAAa,CAAC,gEAAgE,CAAC,CAAC;CACpG,CAAC;AAEN,MAAM,MAAM,yBAAyB,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IACvE,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,CAAC,EAAE,mBAAmB,CAAC,KAAK,CAAC,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,eAAe,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,YAAY,CACzE,yBAAyB,CAAC,KAAK,CAAC,EAChC,MAAM,CACP,CAAC;AACF,MAAM,WAAW,uBAAuB,CAAC,QAAQ,SAAS,WAAW;IACnE,YAAY,CAAC,EAAE,QAAQ,CAAC;CACzB"}

View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=graphql.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"graphql.js","sourceRoot":"","sources":["../../../src/externalTypes/graphql.ts"],"names":[],"mappings":""}

View File

@@ -0,0 +1,22 @@
import type { HeaderMap } from '../utils/HeaderMap.js';
export interface HTTPGraphQLRequest {
method: string;
headers: HeaderMap;
search: string;
body: unknown;
}
export interface HTTPGraphQLHead {
status?: number;
headers: HeaderMap;
}
export type HTTPGraphQLResponseBody = {
kind: 'complete';
string: string;
} | {
kind: 'chunked';
asyncIterator: AsyncIterableIterator<string>;
};
export type HTTPGraphQLResponse = HTTPGraphQLHead & {
body: HTTPGraphQLResponseBody;
};
//# sourceMappingURL=http.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/externalTypes/http.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,MAAM,WAAW,kBAAkB;IAEjC,MAAM,EAAE,MAAM,CAAC;IAGf,OAAO,EAAE,SAAS,CAAC;IAQnB,MAAM,EAAE,MAAM,CAAC;IAGf,IAAI,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,SAAS,CAAC;CACpB;AAQD,MAAM,MAAM,uBAAuB,GAC/B;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACpC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,aAAa,EAAE,qBAAqB,CAAC,MAAM,CAAC,CAAA;CAAE,CAAC;AAEtE,MAAM,MAAM,mBAAmB,GAAG,eAAe,GAAG;IAClD,IAAI,EAAE,uBAAuB,CAAC;CAC/B,CAAC"}

View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=http.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../../src/externalTypes/http.ts"],"names":[],"mappings":""}

View File

@@ -0,0 +1,28 @@
import type { FormattedExecutionResult, GraphQLFormattedError } from 'graphql';
interface ObjMap<T> {
[key: string]: T;
}
export interface GraphQLExperimentalFormattedInitialIncrementalExecutionResult<TData = ObjMap<unknown>, TExtensions = ObjMap<unknown>> extends FormattedExecutionResult<TData, TExtensions> {
hasNext: boolean;
incremental?: ReadonlyArray<GraphQLExperimentalFormattedIncrementalResult<TData, TExtensions>>;
extensions?: TExtensions;
}
export interface GraphQLExperimentalFormattedSubsequentIncrementalExecutionResult<TData = ObjMap<unknown>, TExtensions = ObjMap<unknown>> {
hasNext: boolean;
incremental?: ReadonlyArray<GraphQLExperimentalFormattedIncrementalResult<TData, TExtensions>>;
extensions?: TExtensions;
}
export type GraphQLExperimentalFormattedIncrementalResult<TData = ObjMap<unknown>, TExtensions = ObjMap<unknown>> = GraphQLExperimentalFormattedIncrementalDeferResult<TData, TExtensions> | GraphQLExperimentalFormattedIncrementalStreamResult<TData, TExtensions>;
export interface GraphQLExperimentalFormattedIncrementalDeferResult<TData = ObjMap<unknown>, TExtensions = ObjMap<unknown>> extends FormattedExecutionResult<TData, TExtensions> {
path?: ReadonlyArray<string | number>;
label?: string;
}
export interface GraphQLExperimentalFormattedIncrementalStreamResult<TData = Array<unknown>, TExtensions = ObjMap<unknown>> {
errors?: ReadonlyArray<GraphQLFormattedError>;
items?: TData | null;
path?: ReadonlyArray<string | number>;
label?: string;
extensions?: TExtensions;
}
export {};
//# sourceMappingURL=incrementalDeliveryPolyfill.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"incrementalDeliveryPolyfill.d.ts","sourceRoot":"","sources":["../../../src/externalTypes/incrementalDeliveryPolyfill.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAS/E,UAAU,MAAM,CAAC,CAAC;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC;CAClB;AAED,MAAM,WAAW,6DAA6D,CAC5E,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,EACvB,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,CAC7B,SAAQ,wBAAwB,CAAC,KAAK,EAAE,WAAW,C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IACf,UAAU,CAAC,EAAE,WAAW,CAAC;CAC1B"}

View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=incrementalDeliveryPolyfill.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"incrementalDeliveryPolyfill.js","sourceRoot":"","sources":["../../../src/externalTypes/incrementalDeliveryPolyfill.ts"],"names":[],"mappings":""}

View File

@@ -0,0 +1,8 @@
export type { BaseContext, ContextFunction, ContextThunk } from './context.js';
export type { GraphQLRequest, GraphQLResponse } from './graphql.js';
export type { HTTPGraphQLRequest, HTTPGraphQLResponse, HTTPGraphQLHead, } from './http.js';
export type { ApolloServerPlugin, GraphQLFieldResolverParams, GraphQLRequestExecutionListener, GraphQLRequestListener, GraphQLRequestListenerDidResolveField, GraphQLRequestListenerExecutionDidEnd, GraphQLRequestListenerParsingDidEnd, GraphQLRequestListenerValidationDidEnd, GraphQLSchemaContext, GraphQLServerListener, GraphQLServerContext, LandingPage, } from './plugins.js';
export type { GraphQLRequestContext, GraphQLRequestMetrics, GraphQLRequestContextDidEncounterErrors, GraphQLRequestContextDidResolveOperation, GraphQLRequestContextDidResolveSource, GraphQLRequestContextExecutionDidStart, GraphQLRequestContextParsingDidStart, GraphQLRequestContextResponseForOperation, GraphQLRequestContextValidationDidStart, GraphQLRequestContextWillSendResponse, } from './requestPipeline.js';
export type { DocumentStore, ApolloConfigInput, ApolloConfig, PersistedQueryOptions, CSRFPreventionOptions, ApolloServerOptionsWithSchema, ApolloServerOptionsWithTypeDefs, ApolloServerOptionsWithStaticSchema, ApolloServerOptionsWithGateway, ApolloServerOptions, } from './constructor.js';
export type { GraphQLExperimentalFormattedInitialIncrementalExecutionResult, GraphQLExperimentalFormattedSubsequentIncrementalExecutionResult, GraphQLExperimentalFormattedIncrementalResult, GraphQLExperimentalFormattedIncrementalDeferResult, GraphQLExperimentalFormattedIncrementalStreamResult, } from './incrementalDeliveryPolyfill.js';
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/externalTypes/index.ts"],"names":[],"mappings":"AAMA,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC/E,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpE,YAAY,EACV,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,GAChB,MAAM,WAAW,CAAC;AACnB,YAAY,EACV,kBAAkB,EAClB,0BAA0B,EAC1B,+BAA+B,EAC/B,sBAAsB,EACtB,qCAAqC,EACrC,qCAAqC,EACrC,mCAAmC,EACnC,sCAAsC,EACtC,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,WAAW,GACZ,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,qBAAqB,EACrB,qBAAqB,EACrB,uCAAuC,EACvC,wCAAwC,EACxC,qCAAqC,EACrC,sCAAsC,EACtC,oCAAoC,EACpC,yCAAyC,EACzC,uCAAuC,EACvC,qCAAqC,GACtC,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,qBAAqB,EACrB,qBAAqB,EACrB,6BAA6B,EAC7B,+BAA+B,EAC/B,mCAAmC,EACnC,8BAA8B,EAC9B,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACV,6DAA6D,EAC7D,gEAAgE,EAChE,6CAA6C,EAC7C,kDAAkD,EAClD,mDAAmD,GACpD,MAAM,kCAAkC,CAAC"}

View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/externalTypes/index.ts"],"names":[],"mappings":""}

View File

@@ -0,0 +1,74 @@
import type { KeyValueCache } from '@apollo/utils.keyvaluecache';
import type { Logger } from '@apollo/utils.logger';
import type { GraphQLError, GraphQLResolveInfo, GraphQLSchema } from 'graphql';
import type { ApolloConfig } from './constructor.js';
import type { BaseContext } from './context.js';
import type { GraphQLResponse } from './graphql.js';
import type { GraphQLExperimentalFormattedSubsequentIncrementalExecutionResult } from './incrementalDeliveryPolyfill.js';
import type { GraphQLRequestContext, GraphQLRequestContextDidEncounterErrors, GraphQLRequestContextDidEncounterSubsequentErrors, GraphQLRequestContextDidResolveOperation, GraphQLRequestContextDidResolveSource, GraphQLRequestContextExecutionDidStart, GraphQLRequestContextParsingDidStart, GraphQLRequestContextResponseForOperation, GraphQLRequestContextValidationDidStart, GraphQLRequestContextWillSendResponse, GraphQLRequestContextWillSendSubsequentPayload } from './requestPipeline.js';
export interface GraphQLServerContext {
readonly logger: Logger;
readonly cache: KeyValueCache<string>;
schema: GraphQLSchema;
apollo: ApolloConfig;
startedInBackground: boolean;
}
export interface GraphQLSchemaContext {
apiSchema: GraphQLSchema;
coreSupergraphSdl?: string;
}
export interface ApolloServerPlugin<in TContext extends BaseContext = BaseContext> {
serverWillStart?(service: GraphQLServerContext): Promise<GraphQLServerListener | void>;
requestDidStart?(requestContext: GraphQLRequestContext<TContext>): Promise<GraphQLRequestListener<TContext> | void>;
unexpectedErrorProcessingRequest?({ requestContext, error, }: {
requestContext: GraphQLRequestContext<TContext>;
error: Error;
}): Promise<void>;
contextCreationDidFail?({ error }: {
error: Error;
}): Promise<void>;
invalidRequestWasReceived?({ error }: {
error: Error;
}): Promise<void>;
startupDidFail?({ error }: {
error: Error;
}): Promise<void>;
}
export interface GraphQLServerListener {
schemaDidLoadOrUpdate?(schemaContext: GraphQLSchemaContext): void;
drainServer?(): Promise<void>;
serverWillStop?(): Promise<void>;
renderLandingPage?(): Promise<LandingPage>;
}
export interface LandingPage {
html: string | (() => Promise<string>);
}
export type GraphQLRequestListenerParsingDidEnd = (err?: Error) => Promise<void>;
export type GraphQLRequestListenerValidationDidEnd = (err?: ReadonlyArray<Error>) => Promise<void>;
export type GraphQLRequestListenerExecutionDidEnd = (err?: Error) => Promise<void>;
export type GraphQLRequestListenerDidResolveField = (error: Error | null, result?: any) => void;
export interface GraphQLRequestListener<TContext extends BaseContext> {
didResolveSource?(requestContext: GraphQLRequestContextDidResolveSource<TContext>): Promise<void>;
parsingDidStart?(requestContext: GraphQLRequestContextParsingDidStart<TContext>): Promise<GraphQLRequestListenerParsingDidEnd | void>;
validationDidStart?(requestContext: GraphQLRequestContextValidationDidStart<TContext>): Promise<GraphQLRequestListenerValidationDidEnd | void>;
didResolveOperation?(requestContext: GraphQLRequestContextDidResolveOperation<TContext>): Promise<void>;
didEncounterErrors?(requestContext: GraphQLRequestContextDidEncounterErrors<TContext>): Promise<void>;
responseForOperation?(requestContext: GraphQLRequestContextResponseForOperation<TContext>): Promise<GraphQLResponse | null>;
executionDidStart?(requestContext: GraphQLRequestContextExecutionDidStart<TContext>): Promise<GraphQLRequestExecutionListener<TContext> | void>;
willSendResponse?(requestContext: GraphQLRequestContextWillSendResponse<TContext>): Promise<void>;
didEncounterSubsequentErrors?(requestContext: GraphQLRequestContextDidEncounterSubsequentErrors<TContext>, errors: ReadonlyArray<GraphQLError>): Promise<void>;
willSendSubsequentPayload?(requestContext: GraphQLRequestContextWillSendSubsequentPayload<TContext>, payload: GraphQLExperimentalFormattedSubsequentIncrementalExecutionResult): Promise<void>;
}
export type GraphQLFieldResolverParams<TSource, TContext, TArgs = {
[argName: string]: any;
}> = {
source: TSource;
args: TArgs;
contextValue: TContext;
info: GraphQLResolveInfo;
};
export interface GraphQLRequestExecutionListener<TContext extends BaseContext> {
executionDidEnd?: GraphQLRequestListenerExecutionDidEnd;
willResolveField?(fieldResolverParams: GraphQLFieldResolverParams<any, TContext>): GraphQLRequestListenerDidResolveField | void;
}
//# sourceMappingURL=plugins.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../../src/externalTypes/plugins.ts"],"names":[],"mappings":"AAKA,OAAO,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,CAAC,CAAC;IAGjB,yBAAyB,CAAC,CACxB,cAAc,EAAE,8CAA8C,CAAC,QAAQ,CAAC,EACxE,OAAO,EAAE,gEAAgE,GACxE,OAAO,CAAC,IAAI,CAAC,CAAC;CAClB;AAYD,MAAM,MAAM,0BAA0B,CACpC,OAAO,EACP,QAAQ,EACR,KAAK,GAAG;IAAE,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,IAChC;IACF,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,KAAK,CAAC;IACZ,YAAY,EAAE,QAAQ,CAAC;IACvB,IAAI,EAAE,kBAAkB,CAAC;CAC1B,CAAC;AAEF,MAAM,WAAW,+BAA+B,CAAC,QAAQ,SAAS,WAAW;IAC3E,eAAe,CAAC,EAAE,qCAAqC,CAAC;IAOxD,gBAAgB,CAAC,CACf,mBAAmB,EAAE,0BAA0B,CAAC,GAAG,EAAE,QAAQ,CAAC,GAC7D,qCAAqC,GAAG,IAAI,CAAC;CACjD"}

View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=plugins.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../../src/externalTypes/plugins.ts"],"names":[],"mappings":""}

View File

@@ -0,0 +1,50 @@
import type { WithRequired } from '@apollo/utils.withrequired';
import type { Trace } from '@apollo/usage-reporting-protobuf';
import type { BaseContext } from './context.js';
import type { GraphQLInProgressResponse, GraphQLRequest, GraphQLResponse } from './graphql.js';
import type { Logger } from '@apollo/utils.logger';
import type { KeyValueCache } from '@apollo/utils.keyvaluecache';
import type { DocumentNode, GraphQLError, GraphQLSchema, OperationDefinitionNode } from 'graphql';
import type { CachePolicy } from '@apollo/cache-control-types';
import type { NonFtv1ErrorPath } from '@apollo/server-gateway-interface';
export interface GraphQLRequestMetrics {
captureTraces?: boolean;
persistedQueryHit?: boolean;
persistedQueryRegister?: boolean;
responseCacheHit?: boolean;
forbiddenOperation?: boolean;
registeredOperation?: boolean;
startHrTime?: [number, number];
queryPlanTrace?: Trace.QueryPlanNode;
nonFtv1ErrorPaths?: NonFtv1ErrorPath[];
}
export interface GraphQLRequestContext<TContext extends BaseContext> {
readonly logger: Logger;
readonly cache: KeyValueCache<string>;
readonly request: GraphQLRequest;
readonly response: GraphQLInProgressResponse;
readonly schema: GraphQLSchema;
readonly contextValue: TContext;
readonly queryHash?: string;
readonly document?: DocumentNode;
readonly source?: string;
readonly operationName?: string | null;
readonly operation?: OperationDefinitionNode;
readonly errors?: ReadonlyArray<GraphQLError>;
readonly metrics: GraphQLRequestMetrics;
readonly overallCachePolicy: CachePolicy;
readonly requestIsBatched: boolean;
}
export type GraphQLRequestContextDidResolveSource<TContext extends BaseContext> = WithRequired<GraphQLRequestContext<TContext>, 'source' | 'queryHash'>;
export type GraphQLRequestContextParsingDidStart<TContext extends BaseContext> = GraphQLRequestContextDidResolveSource<TContext>;
export type GraphQLRequestContextValidationDidStart<TContext extends BaseContext> = GraphQLRequestContextParsingDidStart<TContext> & WithRequired<GraphQLRequestContext<TContext>, 'document'>;
export type GraphQLRequestContextDidResolveOperation<TContext extends BaseContext> = GraphQLRequestContextValidationDidStart<TContext> & WithRequired<GraphQLRequestContext<TContext>, 'operationName'>;
export type GraphQLRequestContextDidEncounterErrors<TContext extends BaseContext> = WithRequired<GraphQLRequestContext<TContext>, 'errors'>;
export type GraphQLRequestContextResponseForOperation<TContext extends BaseContext> = WithRequired<GraphQLRequestContext<TContext>, 'source' | 'document' | 'operation' | 'operationName'>;
export type GraphQLRequestContextExecutionDidStart<TContext extends BaseContext> = GraphQLRequestContextParsingDidStart<TContext> & WithRequired<GraphQLRequestContext<TContext>, 'document' | 'operation' | 'operationName'>;
export type GraphQLRequestContextWillSendResponse<TContext extends BaseContext> = GraphQLRequestContextDidResolveSource<TContext> & {
readonly response: GraphQLResponse;
};
export type GraphQLRequestContextDidEncounterSubsequentErrors<TContext extends BaseContext> = GraphQLRequestContextWillSendResponse<TContext>;
export type GraphQLRequestContextWillSendSubsequentPayload<TContext extends BaseContext> = GraphQLRequestContextWillSendResponse<TContext>;
//# sourceMappingURL=requestPipeline.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"requestPipeline.d.ts","sourceRoot":"","sources":["../../../src/externalTypes/requestPipeline.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,eAAe,EAChB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,uBAAuB,EACxB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEzE,MAAM,WAAW,qBAAqB;IAKpC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACrC,iBAAiB,CAAC,EAAE,gBAAgB,EAAE,CAAC;CACxC;AAED,MAAM,W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SAAS,WAAW,IAC1B,uCAAuC,CAAC,QAAQ,CAAC,GACnD,YAAY,CAAC,qBAAqB,CAAC,QAAQ,CAAC,EAAE,eAAe,CAAC,CAAC;AACjE,MAAM,MAAM,uCAAuC,CACjD,QAAQ,SAAS,WAAW,IAC1B,YAAY,CAAC,qBAAqB,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC;AAC5D,MAAM,MAAM,yCAAyC,CACnD,QAAQ,SAAS,WAAW,IAC1B,YAAY,CACd,qBAAqB,CAAC,QAAQ,CAAC,EAC/B,QAAQ,GAAG,UAAU,GAAG,WAAW,GAAG,eAAe,CACtD,CAAC;AACF,MAAM,MAAM,sCAAsC,CAChD,QAAQ,SAAS,WAAW,IAC1B,oCAAoC,CAAC,QAAQ,CAAC,GAChD,YAAY,CACV,qBAAqB,CAAC,QAAQ,CAAC,EAC/B,UAAU,GAAG,WAAW,GAAG,eAAe,CAC3C,CAAC;AACJ,MAAM,MAAM,qCAAqC,CAC/C,QAAQ,SAAS,WAAW,IAC1B,qCAAqC,CAAC,QAAQ,CAAC,GAAG;IACpD,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;CACpC,CAAC;AACF,MAAM,MAAM,iDAAiD,CAC3D,QAAQ,SAAS,WAAW,IAC1B,qCAAqC,CAAC,QAAQ,CAAC,CAAC;AACpD,MAAM,MAAM,8CAA8C,CACxD,QAAQ,SAAS,WAAW,IAC1B,qCAAqC,CAAC,QAAQ,CAAC,CAAC"}

View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=requestPipeline.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"requestPipeline.js","sourceRoot":"","sources":["../../../src/externalTypes/requestPipeline.ts"],"names":[],"mappings":""}

View File

@@ -0,0 +1,2 @@
export declare const packageVersion = "4.11.2";
//# sourceMappingURL=packageVersion.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../../../src/generated/packageVersion.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,WAAW,CAAC"}

View File

@@ -0,0 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.packageVersion = void 0;
exports.packageVersion = "4.11.2";
//# sourceMappingURL=packageVersion.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../../../src/generated/packageVersion.ts"],"names":[],"mappings":";;;AAAa,QAAA,cAAc,GAAG,QAAQ,CAAC"}

View File

@@ -0,0 +1,4 @@
import type { BaseContext, HTTPGraphQLRequest, HTTPGraphQLResponse } from './externalTypes/index.js';
import type { ApolloServer, ApolloServerInternals, SchemaDerivedData } from './ApolloServer';
export declare function runPotentiallyBatchedHttpQuery<TContext extends BaseContext>(server: ApolloServer<TContext>, httpGraphQLRequest: HTTPGraphQLRequest, contextValue: TContext, schemaDerivedData: SchemaDerivedData, internals: ApolloServerInternals<TContext>): Promise<HTTPGraphQLResponse>;
//# sourceMappingURL=httpBatching.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"httpBatching.d.ts","sourceRoot":"","sources":["../../src/httpBatching.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EACV,YAAY,EACZ,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,gBAAgB,CAAC;AA4DxB,wBAAsB,8BAA8B,CAClD,QAAQ,SAAS,WAAW,EAE5B,MAAM,EAAE,YAAY,CAAC,QAAQ,CAAC,EAC9B,kBAAkB,EAAE,kBAAkB,EACtC,YAAY,EAAE,QAAQ,EACtB,iBAAiB,EAAE,iBAAiB,EACpC,SAAS,EAAE,qBAAqB,CAAC,QAAQ,CAAC,GACzC,OAAO,CAAC,mBAAmB,CAAC,CA2B9B"}

59
node_modules/@apollo/server/dist/cjs/httpBatching.js generated vendored Normal file
View File

@@ -0,0 +1,59 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.runPotentiallyBatchedHttpQuery = void 0;
const runHttpQuery_js_1 = require("./runHttpQuery.js");
const internalErrorClasses_js_1 = require("./internalErrorClasses.js");
async function runBatchedHttpQuery({ server, batchRequest, body, contextValue, schemaDerivedData, internals, }) {
if (body.length === 0) {
throw new internalErrorClasses_js_1.BadRequestError('No operations found in request.');
}
const sharedResponseHTTPGraphQLHead = (0, runHttpQuery_js_1.newHTTPGraphQLHead)();
const responseBodies = await Promise.all(body.map(async (bodyPiece) => {
const singleRequest = {
...batchRequest,
body: bodyPiece,
};
const response = await (0, runHttpQuery_js_1.runHttpQuery)({
server,
httpRequest: singleRequest,
contextValue,
schemaDerivedData,
internals,
sharedResponseHTTPGraphQLHead,
});
if (response.body.kind === 'chunked') {
throw Error('Incremental delivery is not implemented for batch requests');
}
return response.body.string;
}));
return {
...sharedResponseHTTPGraphQLHead,
body: { kind: 'complete', string: `[${responseBodies.join(',')}]` },
};
}
async function runPotentiallyBatchedHttpQuery(server, httpGraphQLRequest, contextValue, schemaDerivedData, internals) {
if (!(httpGraphQLRequest.method === 'POST' &&
Array.isArray(httpGraphQLRequest.body))) {
return await (0, runHttpQuery_js_1.runHttpQuery)({
server,
httpRequest: httpGraphQLRequest,
contextValue,
schemaDerivedData,
internals,
sharedResponseHTTPGraphQLHead: null,
});
}
if (internals.allowBatchedHttpRequests) {
return await runBatchedHttpQuery({
server,
batchRequest: httpGraphQLRequest,
body: httpGraphQLRequest.body,
contextValue,
schemaDerivedData,
internals,
});
}
throw new internalErrorClasses_js_1.BadRequestError('Operation batching disabled.');
}
exports.runPotentiallyBatchedHttpQuery = runPotentiallyBatchedHttpQuery;
//# sourceMappingURL=httpBatching.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"httpBatching.js","sourceRoot":"","sources":["../../src/httpBatching.ts"],"names":[],"mappings":";;;AAUA,uDAAqE;AACrE,uEAA4D;AAE5D,K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MAAM,IAAA,8BAAY,EAAC;YACxB,MAAM;YACN,WAAW,EAAE,kBAAkB;YAC/B,YAAY;YACZ,iBAAiB;YACjB,SAAS;YACT,6BAA6B,EAAE,IAAI;SACpC,CAAC,CAAC;IACL,CAAC;IACD,IAAI,SAAS,CAAC,wBAAwB,EAAE,CAAC;QACvC,OAAO,MAAM,mBAAmB,CAAC;YAC/B,MAAM;YACN,YAAY,EAAE,kBAAkB;YAChC,IAAI,EAAE,kBAAkB,CAAC,IAAiB;YAC1C,YAAY;YACZ,iBAAiB;YACjB,SAAS;SACV,CAAC,CAAC;IACL,CAAC;IACD,MAAM,IAAI,yCAAe,CAAC,8BAA8B,CAAC,CAAC;AAC5D,CAAC;AAnCD,wEAmCC"}

View File

@@ -0,0 +1,33 @@
import { type ExecutionArgs, type ExecutionResult, type GraphQLError } from 'graphql';
interface ObjMap<T> {
[key: string]: T;
}
export interface GraphQLExperimentalInitialIncrementalExecutionResult<TData = ObjMap<unknown>, TExtensions = ObjMap<unknown>> extends ExecutionResult<TData, TExtensions> {
hasNext: boolean;
incremental?: ReadonlyArray<GraphQLExperimentalIncrementalResult<TData, TExtensions>>;
extensions?: TExtensions;
}
export interface GraphQLExperimentalSubsequentIncrementalExecutionResult<TData = ObjMap<unknown>, TExtensions = ObjMap<unknown>> {
hasNext: boolean;
incremental?: ReadonlyArray<GraphQLExperimentalIncrementalResult<TData, TExtensions>>;
extensions?: TExtensions;
}
type GraphQLExperimentalIncrementalResult<TData = ObjMap<unknown>, TExtensions = ObjMap<unknown>> = GraphQLExperimentalIncrementalDeferResult<TData, TExtensions> | GraphQLExperimentalIncrementalStreamResult<TData, TExtensions>;
interface GraphQLExperimentalIncrementalDeferResult<TData = ObjMap<unknown>, TExtensions = ObjMap<unknown>> extends ExecutionResult<TData, TExtensions> {
path?: ReadonlyArray<string | number>;
label?: string;
}
interface GraphQLExperimentalIncrementalStreamResult<TData = Array<unknown>, TExtensions = ObjMap<unknown>> {
errors?: ReadonlyArray<GraphQLError>;
items?: TData | null;
path?: ReadonlyArray<string | number>;
label?: string;
extensions?: TExtensions;
}
export interface GraphQLExperimentalIncrementalExecutionResults<TData = ObjMap<unknown>, TExtensions = ObjMap<unknown>> {
initialResult: GraphQLExperimentalInitialIncrementalExecutionResult<TData, TExtensions>;
subsequentResults: AsyncGenerator<GraphQLExperimentalSubsequentIncrementalExecutionResult<TData, TExtensions>, void, void>;
}
export declare function executeIncrementally(args: ExecutionArgs): Promise<ExecutionResult | GraphQLExperimentalIncrementalExecutionResults>;
export {};
//# sourceMappingURL=incrementalDeliveryPolyfill.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"incrementalDeliveryPolyfill.d.ts","sourceRoot":"","sources":["../../src/incrementalDeliveryPolyfill.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,YAAY,EAClB,MAAM,SAAS,CAAC;AAOjB,UAAU,MAAM,CAAC,CAAC;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC;CAClB;AACD,MAAM,WAAW,oDAAoD,CACnE,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,EACvB,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,CAC7B,SAAQ,eAAe,CAAC,KAAK,EAAE,WAAW,CAAC;IAC3C,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,aAAa,CACzB,oCAAoC,CAAC,KAAK,EAAE,WAAW,CAAC,CACzD,CAAC;IACF,UAAU,CAAC,EAAE,WAAW,CAAC;CAC1B;AAED,MAAM,WAAW,uDAAuD,CACtE,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,EACvB,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC;IAE7B,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,aAAa,CACzB,oCAAoC,CAAC,KAAK,EAAE,WAAW,CAAC,CACzD,CAAC;IACF,UAAU,CAAC,EAAE,W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0,0 +1,50 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.executeIncrementally = void 0;
const graphql_1 = require("graphql");
let graphqlExperimentalExecuteIncrementally = undefined;
async function tryToLoadGraphQL17() {
if (graphqlExperimentalExecuteIncrementally !== undefined) {
return;
}
const graphql = await Promise.resolve().then(() => __importStar(require('graphql')));
if ('experimentalExecuteIncrementally' in graphql) {
graphqlExperimentalExecuteIncrementally = graphql
.experimentalExecuteIncrementally;
}
else {
graphqlExperimentalExecuteIncrementally = null;
}
}
async function executeIncrementally(args) {
await tryToLoadGraphQL17();
if (graphqlExperimentalExecuteIncrementally) {
return graphqlExperimentalExecuteIncrementally(args);
}
return (0, graphql_1.execute)(args);
}
exports.executeIncrementally = executeIncrementally;
//# sourceMappingURL=incrementalDeliveryPolyfill.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"incrementalDeliveryPolyfill.js","sourceRoot":"","sources":["../../src/incrementalDeliveryPolyfill.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAKiB;AA+EjB,IAAI,uCAAuC,GAO3B,SAAS,CAAC;AAE1B,KAAK,UAAU,kBAAkB;IAC/B,IAAI,uCAAuC,KAAK,SAAS,EAAE,CAAC;QAC1D,OAAO;IACT,CAAC;IACD,MAAM,OAAO,GAAG,wDAAa,SAAS,GAAC,CAAC;IACxC,IAAI,kCAAkC,IAAI,OAAO,EAAE,CAAC;QAClD,uCAAuC,GAAI,OAAe;aACvD,gCAAgC,CAAC;IACtC,CAAC;SAAM,CAAC;QACN,uCAAuC,GAAG,IAAI,CAAC;IACjD,CAAC;AACH,CAAC;AAEM,KAAK,UAAU,oBAAoB,CACxC,IAAmB;IAEnB,MAAM,kBAAkB,EAAE,CAAC;IAC3B,IAAI,uCAAuC,EAAE,CAAC;QAC5C,OAAO,uCAAuC,CAAC,IAAI,CAAC,CAAC;IACvD,CAAC;IACD,OAAO,IAAA,iBAAO,EAAC,IAAI,CAAC,CAAC;AACvB,CAAC;AARD,oDAQC"}

4
node_modules/@apollo/server/dist/cjs/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
export { ApolloServer } from './ApolloServer.js';
export { HeaderMap } from './utils/HeaderMap.js';
export * from './externalTypes/index.js';
//# sourceMappingURL=index.d.ts.map

1
node_modules/@apollo/server/dist/cjs/index.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,cAAc,0BAA0B,CAAC"}

23
node_modules/@apollo/server/dist/cjs/index.js generated vendored Normal file
View File

@@ -0,0 +1,23 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (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" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.HeaderMap = exports.ApolloServer = void 0;
var ApolloServer_js_1 = require("./ApolloServer.js");
Object.defineProperty(exports, "ApolloServer", { enumerable: true, get: function () { return ApolloServer_js_1.ApolloServer; } });
var HeaderMap_js_1 = require("./utils/HeaderMap.js");
Object.defineProperty(exports, "HeaderMap", { enumerable: true, get: function () { return HeaderMap_js_1.HeaderMap; } });
__exportStar(require("./externalTypes/index.js"), exports);
//# sourceMappingURL=index.js.map

1
node_modules/@apollo/server/dist/cjs/index.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qDAAiD;AAAxC,+GAAA,YAAY,OAAA;AACrB,qDAAiD;AAAxC,yGAAA,SAAS,OAAA;AAElB,2DAAyC"}

View File

@@ -0,0 +1,28 @@
import { GraphQLError, type GraphQLErrorOptions } from 'graphql';
import { ApolloServerErrorCode } from './errors/index.js';
declare class GraphQLErrorWithCode extends GraphQLError {
constructor(message: string, code: ApolloServerErrorCode, options?: GraphQLErrorOptions);
}
export declare class SyntaxError extends GraphQLErrorWithCode {
constructor(graphqlError: GraphQLError);
}
export declare class ValidationError extends GraphQLErrorWithCode {
constructor(graphqlError: GraphQLError);
}
export declare class PersistedQueryNotFoundError extends GraphQLErrorWithCode {
constructor();
}
export declare class PersistedQueryNotSupportedError extends GraphQLErrorWithCode {
constructor();
}
export declare class UserInputError extends GraphQLErrorWithCode {
constructor(graphqlError: GraphQLError);
}
export declare class OperationResolutionError extends GraphQLErrorWithCode {
constructor(graphqlError: GraphQLError);
}
export declare class BadRequestError extends GraphQLErrorWithCode {
constructor(message: string, options?: GraphQLErrorOptions);
}
export {};
//# sourceMappingURL=internalErrorClasses.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"internalErrorClasses.d.ts","sourceRoot":"","sources":["../../src/internalErrorClasses.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAO1D,cAAM,oBAAqB,SAAQ,YAAY;gBAE3C,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,qBAAqB,EAC3B,OAAO,CAAC,EAAE,mBAAmB;CAQhC;AAED,qBAAa,WAAY,SAAQ,oBAAoB;gBACvC,YAAY,EAAE,YAAY;CAQvC;AAED,qBAAa,eAAgB,SAAQ,oBAAoB;gBAC3C,YAAY,EAAE,YAAY;CAcvC;AAcD,qBAAa,2BAA4B,SAAQ,oBAAoB;;CAQpE;AAED,qBAAa,+BAAgC,SAAQ,oBAAoB;;CAYxE;AAED,qBAAa,cAAe,SAAQ,oBAAoB;gBAC1C,YAAY,EAAE,YAAY;CAOvC;AAED,qBAAa,wBAAyB,SAAQ,oBAAoB;gBACpD,YAAY,EAAE,YAAY;CAcvC;AAED,qBAAa,eAAgB,SAAQ,oBAAoB;gBAC3C,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB;CAQ3D"}

View File

@@ -0,0 +1,91 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BadRequestError = exports.OperationResolutionError = exports.UserInputError = exports.PersistedQueryNotSupportedError = exports.PersistedQueryNotFoundError = exports.ValidationError = exports.SyntaxError = void 0;
const graphql_1 = require("graphql");
const index_js_1 = require("./errors/index.js");
const runHttpQuery_js_1 = require("./runHttpQuery.js");
const HeaderMap_js_1 = require("./utils/HeaderMap.js");
class GraphQLErrorWithCode extends graphql_1.GraphQLError {
constructor(message, code, options) {
super(message, {
...options,
extensions: { ...options?.extensions, code },
});
this.name = this.constructor.name;
}
}
class SyntaxError extends GraphQLErrorWithCode {
constructor(graphqlError) {
super(graphqlError.message, index_js_1.ApolloServerErrorCode.GRAPHQL_PARSE_FAILED, {
source: graphqlError.source,
positions: graphqlError.positions,
extensions: { http: (0, runHttpQuery_js_1.newHTTPGraphQLHead)(400), ...graphqlError.extensions },
originalError: graphqlError,
});
}
}
exports.SyntaxError = SyntaxError;
class ValidationError extends GraphQLErrorWithCode {
constructor(graphqlError) {
super(graphqlError.message, index_js_1.ApolloServerErrorCode.GRAPHQL_VALIDATION_FAILED, {
nodes: graphqlError.nodes,
extensions: {
http: (0, runHttpQuery_js_1.newHTTPGraphQLHead)(400),
...graphqlError.extensions,
},
originalError: graphqlError.originalError ?? graphqlError,
});
}
}
exports.ValidationError = ValidationError;
const getPersistedQueryErrorHttp = () => ({
status: 200,
headers: new HeaderMap_js_1.HeaderMap([
['cache-control', 'private, no-cache, must-revalidate'],
]),
});
class PersistedQueryNotFoundError extends GraphQLErrorWithCode {
constructor() {
super('PersistedQueryNotFound', index_js_1.ApolloServerErrorCode.PERSISTED_QUERY_NOT_FOUND, { extensions: { http: getPersistedQueryErrorHttp() } });
}
}
exports.PersistedQueryNotFoundError = PersistedQueryNotFoundError;
class PersistedQueryNotSupportedError extends GraphQLErrorWithCode {
constructor() {
super('PersistedQueryNotSupported', index_js_1.ApolloServerErrorCode.PERSISTED_QUERY_NOT_SUPPORTED, { extensions: { http: getPersistedQueryErrorHttp() } });
}
}
exports.PersistedQueryNotSupportedError = PersistedQueryNotSupportedError;
class UserInputError extends GraphQLErrorWithCode {
constructor(graphqlError) {
super(graphqlError.message, index_js_1.ApolloServerErrorCode.BAD_USER_INPUT, {
nodes: graphqlError.nodes,
originalError: graphqlError.originalError ?? graphqlError,
extensions: graphqlError.extensions,
});
}
}
exports.UserInputError = UserInputError;
class OperationResolutionError extends GraphQLErrorWithCode {
constructor(graphqlError) {
super(graphqlError.message, index_js_1.ApolloServerErrorCode.OPERATION_RESOLUTION_FAILURE, {
nodes: graphqlError.nodes,
originalError: graphqlError.originalError ?? graphqlError,
extensions: {
http: (0, runHttpQuery_js_1.newHTTPGraphQLHead)(400),
...graphqlError.extensions,
},
});
}
}
exports.OperationResolutionError = OperationResolutionError;
class BadRequestError extends GraphQLErrorWithCode {
constructor(message, options) {
super(message, index_js_1.ApolloServerErrorCode.BAD_REQUEST, {
...options,
extensions: { http: (0, runHttpQuery_js_1.newHTTPGraphQLHead)(400), ...options?.extensions },
});
}
}
exports.BadRequestError = BadRequestError;
//# sourceMappingURL=internalErrorClasses.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"internalErrorClasses.js","sourceRoot":"","sources":["../../src/internalErrorClasses.ts"],"names":[],"mappings":";;;AAAA,qCAAiE;AACjE,gDAA0D;AAC1D,uDAAuD;AACvD,uDAAiD;AAKjD,MAAM,oBAAqB,SAAQ,sBAAY;IAC7C,YACE,OAAe,EACf,IAA2B,EAC3B,OAA6B;QAE7B,KAAK,CAAC,OAAO,EAAE;YACb,GAAG,OAAO;YACV,UAAU,EAAE,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE;SAC7C,CAAC,CAAC;QACH,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IACpC,CAAC;CACF;AAED,MAAa,WAAY,SAAQ,oBAAoB;IACnD,YAAY,YAA0B;QACpC,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,gCAAqB,CAAC,oBAAoB,EAAE;YACtE,MAAM,EAAE,YAAY,CAAC,MAAM;YAC3B,SAAS,EAAE,YAAY,CAAC,SAAS;YACjC,UAAU,EAAE,EAAE,IAAI,EAAE,IAAA,oCAAkB,EAAC,GAAG,CAAC,EAAE,GAAG,YAAY,CAAC,UAAU,EAAE;YACzE,aAAa,EAAE,YAAY;SAC5B,CAAC,CAAC;IACL,CAAC;CACF;AATD,kCASC;AAED,MAAa,eAAgB,SAAQ,oBAAoB;IACvD,Y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;IAChE,YAAY,YAA0B;QACpC,KAAK,CACH,YAAY,CAAC,OAAO,EACpB,gCAAqB,CAAC,4BAA4B,EAClD;YACE,KAAK,EAAE,YAAY,CAAC,KAAK;YACzB,aAAa,EAAE,YAAY,CAAC,aAAa,IAAI,YAAY;YACzD,UAAU,EAAE;gBACV,IAAI,EAAE,IAAA,oCAAkB,EAAC,GAAG,CAAC;gBAC7B,GAAG,YAAY,CAAC,UAAU;aAC3B;SACF,CACF,CAAC;IACJ,CAAC;CACF;AAfD,4DAeC;AAED,MAAa,eAAgB,SAAQ,oBAAoB;IACvD,YAAY,OAAe,EAAE,OAA6B;QACxD,KAAK,CAAC,OAAO,EAAE,gCAAqB,CAAC,WAAW,EAAE;YAChD,GAAG,OAAO;YAGV,UAAU,EAAE,EAAE,IAAI,EAAE,IAAA,oCAAkB,EAAC,GAAG,CAAC,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE;SACtE,CAAC,CAAC;IACL,CAAC;CACF;AATD,0CASC"}

View File

@@ -0,0 +1,9 @@
import type { BaseContext, ApolloServerPlugin } from './externalTypes/index.js';
export interface InternalApolloServerPlugin<TContext extends BaseContext> extends ApolloServerPlugin<TContext> {
__internal_plugin_id__: InternalPluginId;
__is_disabled_plugin__: boolean;
}
export declare function internalPlugin<TContext extends BaseContext>(p: InternalApolloServerPlugin<TContext>): ApolloServerPlugin<TContext>;
export type InternalPluginId = 'CacheControl' | 'LandingPageDisabled' | 'SchemaReporting' | 'InlineTrace' | 'UsageReporting' | 'DisableSuggestions';
export declare function pluginIsInternal<TContext extends BaseContext>(plugin: ApolloServerPlugin<TContext>): plugin is InternalApolloServerPlugin<TContext>;
//# sourceMappingURL=internalPlugin.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"internalPlugin.d.ts","sourceRoot":"","sources":["../../src/internalPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAShF,MAAM,WAAW,0BAA0B,CAAC,QAAQ,SAAS,WAAW,CACtE,SAAQ,kBAAkB,CAAC,QAAQ,CAAC;IAGpC,sBAAsB,EAAE,gBAAgB,CAAC;IACzC,sBAAsB,EAAE,OAAO,CAAC;CACjC;AAMD,wBAAgB,cAAc,CAAC,QAAQ,SAAS,WAAW,EACzD,CAAC,EAAE,0BAA0B,CAAC,QAAQ,CAAC,GACtC,kBAAkB,CAAC,QAAQ,CAAC,CAE9B;AAED,MAAM,MAAM,gBAAgB,GACxB,cAAc,GACd,qBAAqB,GACrB,iBAAiB,GACjB,aAAa,GACb,gBAAgB,GAChB,oBAAoB,CAAC;AAEzB,wBAAgB,gBAAgB,CAAC,QAAQ,SAAS,WAAW,EAC3D,MAAM,EAAE,kBAAkB,CAAC,QAAQ,CAAC,GACnC,MAAM,IAAI,0BAA0B,CAAC,QAAQ,CAAC,CAIhD"}

12
node_modules/@apollo/server/dist/cjs/internalPlugin.js generated vendored Normal file
View File

@@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.pluginIsInternal = exports.internalPlugin = void 0;
function internalPlugin(p) {
return p;
}
exports.internalPlugin = internalPlugin;
function pluginIsInternal(plugin) {
return '__internal_plugin_id__' in plugin;
}
exports.pluginIsInternal = pluginIsInternal;
//# sourceMappingURL=internalPlugin.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"internalPlugin.js","sourceRoot":"","sources":["../../src/internalPlugin.ts"],"names":[],"mappings":";;;AAqBA,SAAgB,cAAc,CAC5B,CAAuC;IAEvC,OAAO,CAAC,CAAC;AACX,CAAC;AAJD,wCAIC;AAUD,SAAgB,gBAAgB,CAC9B,MAAoC;IAIpC,OAAO,wBAAwB,IAAI,MAAM,CAAC;AAC5C,CAAC;AAND,4CAMC"}

1
node_modules/@apollo/server/dist/cjs/package.json generated vendored Normal file
View File

@@ -0,0 +1 @@
{"type":"commonjs"}

View File

@@ -0,0 +1,9 @@
import type { ApolloServerPlugin } from '../../externalTypes/index.js';
import type { CacheHint } from '@apollo/cache-control-types';
export interface ApolloServerPluginCacheControlOptions {
defaultMaxAge?: number;
calculateHttpHeaders?: boolean | 'if-cacheable';
__testing__cacheHints?: Map<string, CacheHint>;
}
export declare function ApolloServerPluginCacheControl(options?: ApolloServerPluginCacheControlOptions): ApolloServerPlugin;
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugin/cacheControl/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAcvE,OAAO,KAAK,EACV,SAAS,EAGV,MAAM,6BAA6B,CAAC;AAYrC,MAAM,WAAW,qCAAqC;IASpD,aAAa,CAAC,EAAE,MAAM,CAAC;IAUvB,oBAAoB,CAAC,EAAE,OAAO,GAAG,cAAc,CAAC;IAEhD,qBAAqB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CAChD;AAED,wBAAgB,8BAA8B,CAC5C,OAAO,GAAE,qCAA2D,GACnE,kBAAkB,CAyRpB"}

View File

@@ -0,0 +1,227 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApolloServerPluginCacheControl = void 0;
const graphql_1 = require("graphql");
const cachePolicy_js_1 = require("../../cachePolicy.js");
const internalPlugin_js_1 = require("../../internalPlugin.js");
const lru_cache_1 = __importDefault(require("lru-cache"));
function ApolloServerPluginCacheControl(options = Object.create(null)) {
let typeAnnotationCache;
let fieldAnnotationCache;
return (0, internalPlugin_js_1.internalPlugin)({
__internal_plugin_id__: 'CacheControl',
__is_disabled_plugin__: false,
async serverWillStart({ schema }) {
typeAnnotationCache = new lru_cache_1.default({
max: Object.values(schema.getTypeMap()).filter(graphql_1.isCompositeType)
.length,
});
fieldAnnotationCache = new lru_cache_1.default({
max: Object.values(schema.getTypeMap())
.filter(graphql_1.isObjectType)
.flatMap((t) => Object.values(t.getFields())).length +
Object.values(schema.getTypeMap())
.filter(graphql_1.isInterfaceType)
.flatMap((t) => Object.values(t.getFields())).length,
});
return undefined;
},
async requestDidStart(requestContext) {
function memoizedCacheAnnotationFromType(t) {
const existing = typeAnnotationCache.get(t);
if (existing) {
return existing;
}
const annotation = cacheAnnotationFromType(t);
typeAnnotationCache.set(t, annotation);
return annotation;
}
function memoizedCacheAnnotationFromField(field) {
const existing = fieldAnnotationCache.get(field);
if (existing) {
return existing;
}
const annotation = cacheAnnotationFromField(field);
fieldAnnotationCache.set(field, annotation);
return annotation;
}
const defaultMaxAge = options.defaultMaxAge ?? 0;
const calculateHttpHeaders = options.calculateHttpHeaders ?? true;
const { __testing__cacheHints } = options;
return {
async executionDidStart() {
if (isRestricted(requestContext.overallCachePolicy)) {
const fakeFieldPolicy = (0, cachePolicy_js_1.newCachePolicy)();
return {
willResolveField({ info }) {
info.cacheControl = {
setCacheHint: (dynamicHint) => {
fakeFieldPolicy.replace(dynamicHint);
},
cacheHint: fakeFieldPolicy,
cacheHintFromType: memoizedCacheAnnotationFromType,
};
},
};
}
return {
willResolveField({ info }) {
const fieldPolicy = (0, cachePolicy_js_1.newCachePolicy)();
let inheritMaxAge = false;
const targetType = (0, graphql_1.getNamedType)(info.returnType);
if ((0, graphql_1.isCompositeType)(targetType)) {
const typeAnnotation = memoizedCacheAnnotationFromType(targetType);
fieldPolicy.replace(typeAnnotation);
inheritMaxAge = !!typeAnnotation.inheritMaxAge;
}
const fieldAnnotation = memoizedCacheAnnotationFromField(info.parentType.getFields()[info.fieldName]);
if (fieldAnnotation.inheritMaxAge &&
fieldPolicy.maxAge === undefined) {
inheritMaxAge = true;
if (fieldAnnotation.scope) {
fieldPolicy.replace({ scope: fieldAnnotation.scope });
}
}
else {
fieldPolicy.replace(fieldAnnotation);
}
info.cacheControl = {
setCacheHint: (dynamicHint) => {
fieldPolicy.replace(dynamicHint);
},
cacheHint: fieldPolicy,
cacheHintFromType: memoizedCacheAnnotationFromType,
};
return () => {
if (fieldPolicy.maxAge === undefined &&
(((0, graphql_1.isCompositeType)(targetType) && !inheritMaxAge) ||
!info.path.prev)) {
fieldPolicy.restrict({ maxAge: defaultMaxAge });
}
if (__testing__cacheHints && isRestricted(fieldPolicy)) {
const path = (0, graphql_1.responsePathAsArray)(info.path).join('.');
if (__testing__cacheHints.has(path)) {
throw Error("shouldn't happen: addHint should only be called once per path");
}
__testing__cacheHints.set(path, {
maxAge: fieldPolicy.maxAge,
scope: fieldPolicy.scope,
});
}
requestContext.overallCachePolicy.restrict(fieldPolicy);
};
},
};
},
async willSendResponse(requestContext) {
if (!calculateHttpHeaders) {
return;
}
const { response, overallCachePolicy } = requestContext;
const existingCacheControlHeader = parseExistingCacheControlHeader(response.http.headers.get('cache-control'));
if (existingCacheControlHeader.kind === 'unparsable') {
return;
}
const cachePolicy = (0, cachePolicy_js_1.newCachePolicy)();
cachePolicy.replace(overallCachePolicy);
if (existingCacheControlHeader.kind === 'parsable-and-cacheable') {
cachePolicy.restrict(existingCacheControlHeader.hint);
}
const policyIfCacheable = cachePolicy.policyIfCacheable();
if (policyIfCacheable &&
existingCacheControlHeader.kind !== 'uncacheable' &&
response.body.kind === 'single' &&
!response.body.singleResult.errors) {
response.http.headers.set('cache-control', `max-age=${policyIfCacheable.maxAge}, ${policyIfCacheable.scope.toLowerCase()}`);
}
else if (calculateHttpHeaders !== 'if-cacheable') {
response.http.headers.set('cache-control', CACHE_CONTROL_HEADER_UNCACHEABLE);
}
},
};
},
});
}
exports.ApolloServerPluginCacheControl = ApolloServerPluginCacheControl;
const CACHE_CONTROL_HEADER_CACHEABLE_REGEXP = /^max-age=(\d+), (public|private)$/;
const CACHE_CONTROL_HEADER_UNCACHEABLE = 'no-store';
function parseExistingCacheControlHeader(header) {
if (!header) {
return { kind: 'no-header' };
}
if (header === CACHE_CONTROL_HEADER_UNCACHEABLE) {
return { kind: 'uncacheable' };
}
const match = CACHE_CONTROL_HEADER_CACHEABLE_REGEXP.exec(header);
if (!match) {
return { kind: 'unparsable' };
}
return {
kind: 'parsable-and-cacheable',
hint: {
maxAge: +match[1],
scope: match[2] === 'public' ? 'PUBLIC' : 'PRIVATE',
},
};
}
function cacheAnnotationFromDirectives(directives) {
if (!directives)
return undefined;
const cacheControlDirective = directives.find((directive) => directive.name.value === 'cacheControl');
if (!cacheControlDirective)
return undefined;
if (!cacheControlDirective.arguments)
return undefined;
const maxAgeArgument = cacheControlDirective.arguments.find((argument) => argument.name.value === 'maxAge');
const scopeArgument = cacheControlDirective.arguments.find((argument) => argument.name.value === 'scope');
const inheritMaxAgeArgument = cacheControlDirective.arguments.find((argument) => argument.name.value === 'inheritMaxAge');
const scopeString = scopeArgument?.value?.kind === 'EnumValue'
? scopeArgument.value.value
: undefined;
const scope = scopeString === 'PUBLIC' || scopeString === 'PRIVATE'
? scopeString
: undefined;
if (inheritMaxAgeArgument?.value?.kind === 'BooleanValue' &&
inheritMaxAgeArgument.value.value) {
return { inheritMaxAge: true, scope };
}
return {
maxAge: maxAgeArgument?.value?.kind === 'IntValue'
? parseInt(maxAgeArgument.value.value)
: undefined,
scope,
};
}
function cacheAnnotationFromType(t) {
if (t.astNode) {
const hint = cacheAnnotationFromDirectives(t.astNode.directives);
if (hint) {
return hint;
}
}
if (t.extensionASTNodes) {
for (const node of t.extensionASTNodes) {
const hint = cacheAnnotationFromDirectives(node.directives);
if (hint) {
return hint;
}
}
}
return {};
}
function cacheAnnotationFromField(field) {
if (field.astNode) {
const hint = cacheAnnotationFromDirectives(field.astNode.directives);
if (hint) {
return hint;
}
}
return {};
}
function isRestricted(hint) {
return hint.maxAge !== undefined || hint.scope !== undefined;
}
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,3 @@
import type { ApolloServerPlugin } from '../../externalTypes/index.js';
export declare function ApolloServerPluginDisableSuggestions(): ApolloServerPlugin;
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugin/disableSuggestions/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAGvE,wBAAgB,oCAAoC,IAAI,kBAAkB,CAmBzE"}

View File

@@ -0,0 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApolloServerPluginDisableSuggestions = void 0;
const internalPlugin_js_1 = require("../../internalPlugin.js");
function ApolloServerPluginDisableSuggestions() {
return (0, internalPlugin_js_1.internalPlugin)({
__internal_plugin_id__: 'DisableSuggestions',
__is_disabled_plugin__: false,
async requestDidStart() {
return {
async validationDidStart() {
return async (validationErrors) => {
validationErrors?.forEach((error) => {
error.message = error.message.replace(/ ?Did you mean(.+?)\?$/, '');
});
};
},
};
},
});
}
exports.ApolloServerPluginDisableSuggestions = ApolloServerPluginDisableSuggestions;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/plugin/disableSuggestions/index.ts"],"names":[],"mappings":";;;AACA,+DAAyD;AAEzD,SAAgB,oCAAoC;IAClD,OAAO,IAAA,kCAAc,EAAC;QACpB,sBAAsB,EAAE,oBAAoB;QAC5C,sBAAsB,EAAE,KAAK;QAC7B,KAAK,CAAC,eAAe;YACnB,OAAO;gBACL,KAAK,CAAC,kBAAkB;oBACtB,OAAO,KAAK,EAAE,gBAAgB,EAAE,EAAE;wBAChC,gBAAgB,EAAE,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;4BAClC,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CACnC,wBAAwB,EACxB,EAAE,CACH,CAAC;wBACJ,CAAC,CAAC,CAAC;oBACL,CAAC,CAAC;gBACJ,CAAC;aACF,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAnBD,oFAmBC"}

View File

@@ -0,0 +1,7 @@
import type { BaseContext, ApolloServerPlugin } from '../../index.js';
export declare function ApolloServerPluginCacheControlDisabled(): ApolloServerPlugin<BaseContext>;
export declare function ApolloServerPluginInlineTraceDisabled(): ApolloServerPlugin<BaseContext>;
export declare function ApolloServerPluginLandingPageDisabled(): ApolloServerPlugin<BaseContext>;
export declare function ApolloServerPluginSchemaReportingDisabled(): ApolloServerPlugin<BaseContext>;
export declare function ApolloServerPluginUsageReportingDisabled(): ApolloServerPlugin<BaseContext>;
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugin/disabled/index.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AActE,wBAAgB,sCAAsC,IAAI,kBAAkB,CAAC,WAAW,CAAC,CAExF;AAED,wBAAgB,qCAAqC,IAAI,kBAAkB,CAAC,WAAW,CAAC,CAEvF;AAED,wBAAgB,qCAAqC,IAAI,kBAAkB,CAAC,WAAW,CAAC,CAEvF;AAED,wBAAgB,yCAAyC,IAAI,kBAAkB,CAAC,WAAW,CAAC,CAE3F;AAED,wBAAgB,wCAAwC,IAAI,kBAAkB,CAAC,WAAW,CAAC,CAE1F"}

View File

@@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApolloServerPluginUsageReportingDisabled = exports.ApolloServerPluginSchemaReportingDisabled = exports.ApolloServerPluginLandingPageDisabled = exports.ApolloServerPluginInlineTraceDisabled = exports.ApolloServerPluginCacheControlDisabled = void 0;
function disabledPlugin(id) {
const plugin = {
__internal_plugin_id__: id,
__is_disabled_plugin__: true,
};
return plugin;
}
function ApolloServerPluginCacheControlDisabled() {
return disabledPlugin('CacheControl');
}
exports.ApolloServerPluginCacheControlDisabled = ApolloServerPluginCacheControlDisabled;
function ApolloServerPluginInlineTraceDisabled() {
return disabledPlugin('InlineTrace');
}
exports.ApolloServerPluginInlineTraceDisabled = ApolloServerPluginInlineTraceDisabled;
function ApolloServerPluginLandingPageDisabled() {
return disabledPlugin('LandingPageDisabled');
}
exports.ApolloServerPluginLandingPageDisabled = ApolloServerPluginLandingPageDisabled;
function ApolloServerPluginSchemaReportingDisabled() {
return disabledPlugin('SchemaReporting');
}
exports.ApolloServerPluginSchemaReportingDisabled = ApolloServerPluginSchemaReportingDisabled;
function ApolloServerPluginUsageReportingDisabled() {
return disabledPlugin('UsageReporting');
}
exports.ApolloServerPluginUsageReportingDisabled = ApolloServerPluginUsageReportingDisabled;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/plugin/disabled/index.ts"],"names":[],"mappings":";;;AAcA,SAAS,cAAc,CAAC,EAAoB;IAC1C,MAAM,MAAM,GAA4C;QACtD,sBAAsB,EAAE,EAAE;QAC1B,sBAAsB,EAAE,IAAI;KAC7B,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAgB,sCAAsC;IACpD,OAAO,cAAc,CAAC,cAAc,CAAC,CAAC;AACxC,CAAC;AAFD,wFAEC;AAED,SAAgB,qCAAqC;IACnD,OAAO,cAAc,CAAC,aAAa,CAAC,CAAC;AACvC,CAAC;AAFD,sFAEC;AAED,SAAgB,qCAAqC;IACnD,OAAO,cAAc,CAAC,qBAAqB,CAAC,CAAC;AAC/C,CAAC;AAFD,sFAEC;AAED,SAAgB,yCAAyC;IACvD,OAAO,cAAc,CAAC,iBAAiB,CAAC,CAAC;AAC3C,CAAC;AAFD,8FAEC;AAED,SAAgB,wCAAwC;IACtD,OAAO,cAAc,CAAC,gBAAgB,CAAC,CAAC;AAC1C,CAAC;AAFD,4FAEC"}

View File

@@ -0,0 +1,9 @@
/// <reference types="node" />
import type http from 'http';
import type { ApolloServerPlugin } from '../../externalTypes/index.js';
export interface ApolloServerPluginDrainHttpServerOptions {
httpServer: http.Server;
stopGracePeriodMillis?: number;
}
export declare function ApolloServerPluginDrainHttpServer(options: ApolloServerPluginDrainHttpServerOptions): ApolloServerPlugin;
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugin/drainHttpServer/index.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAMvE,MAAM,WAAW,wCAAwC;IAIvD,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC;IAKxB,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAQD,wBAAgB,iCAAiC,CAC/C,OAAO,EAAE,wCAAwC,GAChD,kBAAkB,CA2BpB"}

View File

@@ -0,0 +1,28 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApolloServerPluginDrainHttpServer = void 0;
const node_abort_controller_1 = require("node-abort-controller");
const stoppable_js_1 = require("./stoppable.js");
function ApolloServerPluginDrainHttpServer(options) {
const stopper = new stoppable_js_1.Stopper(options.httpServer);
return {
async serverWillStart() {
return {
async drainServer() {
const hardDestroyAbortController = new node_abort_controller_1.AbortController();
const stopGracePeriodMillis = options.stopGracePeriodMillis ?? 10000;
let timeout;
if (stopGracePeriodMillis < Infinity) {
timeout = setTimeout(() => hardDestroyAbortController.abort(), stopGracePeriodMillis);
}
await stopper.stop(hardDestroyAbortController.signal);
if (timeout) {
clearTimeout(timeout);
}
},
};
},
};
}
exports.ApolloServerPluginDrainHttpServer = ApolloServerPluginDrainHttpServer;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/plugin/drainHttpServer/index.ts"],"names":[],"mappings":";;;AACA,iEAAwD;AAExD,iDAAyC;AAuBzC,SAAgB,iCAAiC,CAC/C,OAAiD;IAEjD,MAAM,OAAO,GAAG,IAAI,sBAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAChD,OAAO;QACL,KAAK,CAAC,eAAe;YACnB,OAAO;gBACL,KAAK,CAAC,WAAW;oBAKf,MAAM,0BAA0B,GAAG,IAAI,uCAAe,EAAE,CAAC;oBACzD,MAAM,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,IAAI,KAAM,CAAC;oBACtE,IAAI,OAAmC,CAAC;oBACxC,IAAI,qBAAqB,GAAG,QAAQ,EAAE,CAAC;wBACrC,OAAO,GAAG,UAAU,CAClB,GAAG,EAAE,CAAC,0BAA0B,CAAC,KAAK,EAAE,EACxC,qBAAqB,CACtB,CAAC;oBACJ,CAAC;oBACD,MAAM,OAAO,CAAC,IAAI,CAAC,0BAA0B,CAAC,MAAM,CAAC,CAAC;oBACtD,IAAI,OAAO,EAAE,CAAC;wBACZ,YAAY,CAAC,OAAO,CAAC,CAAC;oBACxB,CAAC;gBACH,CAAC;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC;AA7BD,8EA6BC"}

View File

@@ -0,0 +1,13 @@
/// <reference types="node" />
/// <reference types="node" />
import type http from 'http';
import https from 'https';
import type { AbortSignal } from 'node-abort-controller';
export declare class Stopper {
private server;
private requestCountPerSocket;
private stopped;
constructor(server: http.Server | https.Server);
stop(hardDestroyAbortSignal?: AbortSignal): Promise<boolean>;
}
//# sourceMappingURL=stoppable.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"stoppable.d.ts","sourceRoot":"","sources":["../../../../src/plugin/drainHttpServer/stoppable.ts"],"names":[],"mappings":";;AA4BA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,qBAAa,OAAO;IAIN,OAAO,CAAC,MAAM;IAH1B,OAAO,CAAC,qBAAqB,CAA6B;IAC1D,OAAO,CAAC,OAAO,CAAS;gBAEJ,MAAM,EAAE,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM;IA+BhD,IAAI,CAAC,sBAAsB,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;CAyCnE"}

View File

@@ -0,0 +1,53 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Stopper = void 0;
const https_1 = __importDefault(require("https"));
class Stopper {
constructor(server) {
this.server = server;
this.requestCountPerSocket = new Map();
this.stopped = false;
server.on(server instanceof https_1.default.Server ? 'secureConnection' : 'connection', (socket) => {
this.requestCountPerSocket.set(socket, 0);
socket.once('close', () => this.requestCountPerSocket.delete(socket));
});
server.on('request', (req, res) => {
this.requestCountPerSocket.set(req.socket, (this.requestCountPerSocket.get(req.socket) ?? 0) + 1);
res.once('finish', () => {
const pending = (this.requestCountPerSocket.get(req.socket) ?? 0) - 1;
this.requestCountPerSocket.set(req.socket, pending);
if (this.stopped && pending === 0) {
req.socket.end();
}
});
});
}
async stop(hardDestroyAbortSignal) {
let gracefully = true;
await new Promise((resolve) => setImmediate(resolve));
this.stopped = true;
const onAbort = () => {
gracefully = false;
this.requestCountPerSocket.forEach((_, socket) => socket.end());
setImmediate(() => {
this.requestCountPerSocket.forEach((_, socket) => socket.destroy());
});
};
hardDestroyAbortSignal?.addEventListener('abort', onAbort);
const closePromise = new Promise((resolve) => this.server.close(() => {
hardDestroyAbortSignal?.removeEventListener('abort', onAbort);
resolve();
}));
this.requestCountPerSocket.forEach((requests, socket) => {
if (requests === 0)
socket.end();
});
await closePromise;
return gracefully;
}
}
exports.Stopper = Stopper;
//# sourceMappingURL=stoppable.js.map

Some files were not shown because too many files have changed in this diff Show More