New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@apollo/server

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@apollo/server - npm Package Compare versions

Comparing version 4.0.0-alpha.0 to 4.0.0-alpha.1

dist/cjs/errorNormalize.js

16

dist/cjs/ApolloServer.js

@@ -40,3 +40,4 @@ "use strict";

const determineApolloConfig_js_1 = require("./determineApolloConfig.js");
const errors_js_1 = require("./errors.js");
const errorNormalize_js_1 = require("./errorNormalize.js");
const index_js_1 = require("./errors/index.js");
const httpBatching_js_1 = require("./httpBatching.js");

@@ -219,3 +220,3 @@ const internalPlugin_js_1 = require("./internalPlugin.js");

catch (maybeError) {
const error = (0, errors_js_1.ensureError)(maybeError);
const error = (0, errorNormalize_js_1.ensureError)(maybeError);
try {

@@ -479,3 +480,3 @@ await Promise.all(this.internals.plugins.map(async (plugin) => plugin.startupDidFail?.({ error })));

catch (maybeError) {
const error = (0, errors_js_1.ensureError)(maybeError);
const error = (0, errorNormalize_js_1.ensureError)(maybeError);
try {

@@ -492,3 +493,3 @@ await Promise.all(this.internals.plugins.map(async (plugin) => plugin.contextCreationDidFail?.({

error.extensions.code &&
error.extensions.code !== 'INTERNAL_SERVER_ERROR'
error.extensions.code !== index_js_1.ApolloServerErrorCode.INTERNAL_SERVER_ERROR
? 400

@@ -502,3 +503,4 @@ : 500;

const maybeError = maybeError_;
if (maybeError instanceof errors_js_1.BadRequestError) {
if (maybeError instanceof graphql_1.GraphQLError &&
maybeError.extensions.code === index_js_1.ApolloServerErrorCode.BAD_REQUEST) {
try {

@@ -528,3 +530,3 @@ await Promise.all(this.internals.plugins.map(async (plugin) => plugin.invalidRequestWasReceived?.({ error: maybeError })));

completeBody: (0, runHttpQuery_js_1.prettyJSONStringify)({
errors: (0, errors_js_1.normalizeAndFormatErrors)([error], {
errors: (0, errorNormalize_js_1.normalizeAndFormatErrors)([error], {
includeStackTracesInErrorResponses: this.internals.includeStackTracesInErrorResponses,

@@ -581,3 +583,3 @@ formatError: this.internals.formatError,

catch (maybeError) {
const error = (0, errors_js_1.ensureError)(maybeError);
const error = (0, errorNormalize_js_1.ensureError)(maybeError);
await Promise.all(internals.plugins.map(async (plugin) => plugin.unexpectedErrorProcessingRequest?.({

@@ -584,0 +586,0 @@ requestContext,

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.expressMiddleware = void 0;
const url_1 = require("url");
function expressMiddleware(server, options) {

@@ -24,3 +25,3 @@ server.assertStarted('expressMiddleware()');

headers,
searchParams: req.query,
search: (0, url_1.parse)(req.url).search ?? '',
body: req.body,

@@ -27,0 +28,0 @@ };

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

@@ -5,4 +5,4 @@ "use strict";

const runHttpQuery_js_1 = require("./runHttpQuery.js");
const errors_js_1 = require("./errors.js");
async function runBatchHttpQuery(server, batchRequest, contextValue, schemaDerivedData, internals) {
const internalErrorClasses_js_1 = require("./internalErrorClasses.js");
async function runBatchHttpQuery(server, batchRequest, body, contextValue, schemaDerivedData, internals) {
const combinedResponse = {

@@ -13,6 +13,6 @@ headers: new runHttpQuery_js_1.HeaderMap(),

};
const responseBodies = await Promise.all(batchRequest.body.map(async (body) => {
const responseBodies = await Promise.all(body.map(async (bodyPiece) => {
const singleRequest = {
...batchRequest,
body,
body: bodyPiece,
};

@@ -40,7 +40,7 @@ const response = await (0, runHttpQuery_js_1.runHttpQuery)(server, singleRequest, contextValue, schemaDerivedData, internals, server.logger);

if (internals.allowBatchedHttpRequests) {
return await runBatchHttpQuery(server, httpGraphQLRequest, contextValue, schemaDerivedData, internals);
return await runBatchHttpQuery(server, httpGraphQLRequest, httpGraphQLRequest.body, contextValue, schemaDerivedData, internals);
}
throw new errors_js_1.BadRequestError('Operation batching disabled.');
throw new internalErrorClasses_js_1.BadRequestError('Operation batching disabled.');
}
exports.runPotentiallyBatchedHttpQuery = runPotentiallyBatchedHttpQuery;
//# sourceMappingURL=httpBatching.js.map

@@ -17,13 +17,6 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.PersistedQueryNotFoundError = exports.UserInputError = exports.ForbiddenError = exports.AuthenticationError = exports.ValidationError = exports.SyntaxError = exports.ApolloServer = void 0;
exports.ApolloServer = void 0;
var ApolloServer_js_1 = require("./ApolloServer.js");
Object.defineProperty(exports, "ApolloServer", { enumerable: true, get: function () { return ApolloServer_js_1.ApolloServer; } });
__exportStar(require("./externalTypes/index.js"), exports);
var errors_js_1 = require("./errors.js");
Object.defineProperty(exports, "SyntaxError", { enumerable: true, get: function () { return errors_js_1.SyntaxError; } });
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return errors_js_1.ValidationError; } });
Object.defineProperty(exports, "AuthenticationError", { enumerable: true, get: function () { return errors_js_1.AuthenticationError; } });
Object.defineProperty(exports, "ForbiddenError", { enumerable: true, get: function () { return errors_js_1.ForbiddenError; } });
Object.defineProperty(exports, "UserInputError", { enumerable: true, get: function () { return errors_js_1.UserInputError; } });
Object.defineProperty(exports, "PersistedQueryNotFoundError", { enumerable: true, get: function () { return errors_js_1.PersistedQueryNotFoundError; } });
//# sourceMappingURL=index.js.map

@@ -8,3 +8,3 @@ "use strict";

const whatwg_mimetype_1 = __importDefault(require("whatwg-mimetype"));
const errors_js_1 = require("./errors.js");
const internalErrorClasses_js_1 = require("./internalErrorClasses.js");
exports.recommendedCsrfPreventionRequestHeaders = [

@@ -36,3 +36,3 @@ 'x-apollo-operation-name',

}
throw new errors_js_1.BadRequestError(`This operation has been blocked as a potential Cross-Site Request Forgery ` +
throw new internalErrorClasses_js_1.BadRequestError(`This operation has been blocked as a potential Cross-Site Request Forgery ` +
`(CSRF). Please either specify a 'content-type' header (with a type that ` +

@@ -39,0 +39,0 @@ `is not one of ${NON_PREFLIGHTED_CONTENT_TYPES.join(', ')}) or provide ` +

@@ -7,3 +7,4 @@ "use strict";

const schemaInstrumentation_js_1 = require("./utils/schemaInstrumentation.js");
const errors_js_1 = require("./errors.js");
const internalErrorClasses_js_1 = require("./internalErrorClasses.js");
const errorNormalize_js_1 = require("./errorNormalize.js");
const invokeHooks_js_1 = require("./utils/invokeHooks.js");

@@ -38,3 +39,3 @@ const runHttpQuery_js_1 = require("./runHttpQuery.js");

if (!internals.persistedQueries) {
return await sendErrorResponse([new errors_js_1.PersistedQueryNotSupportedError()], getPersistedQueryErrorHttp());
return await sendErrorResponse([new internalErrorClasses_js_1.PersistedQueryNotSupportedError()], getPersistedQueryErrorHttp());
}

@@ -53,3 +54,3 @@ else if (extensions.persistedQuery.version !== 1) {

else {
return await sendErrorResponse([new errors_js_1.PersistedQueryNotFoundError()], getPersistedQueryErrorHttp());
return await sendErrorResponse([new internalErrorClasses_js_1.PersistedQueryNotFoundError()], getPersistedQueryErrorHttp());
}

@@ -72,3 +73,3 @@ }

return await sendErrorResponse([
new errors_js_1.BadRequestError('GraphQL operations must contain a non-empty `query` or a `persistedQuery` extension.'),
new internalErrorClasses_js_1.BadRequestError('GraphQL operations must contain a non-empty `query` or a `persistedQuery` extension.'),
]);

@@ -85,3 +86,3 @@ }

logger.warn('An error occurred while attempting to read from the documentStore. ' +
(0, errors_js_1.ensureError)(err).message);
(0, errorNormalize_js_1.ensureError)(err).message);
}

@@ -95,6 +96,6 @@ }

catch (syntaxMaybeError) {
const error = (0, errors_js_1.ensureError)(syntaxMaybeError);
const error = (0, errorNormalize_js_1.ensureError)(syntaxMaybeError);
await parsingDidEnd(error);
return await sendErrorResponse([
new errors_js_1.SyntaxError((0, errors_js_1.ensureGraphQLError)(error)),
new internalErrorClasses_js_1.SyntaxError((0, errorNormalize_js_1.ensureGraphQLError)(error)),
]);

@@ -110,3 +111,3 @@ }

await validationDidEnd(validationErrors);
return await sendErrorResponse(validationErrors.map((error) => new errors_js_1.ValidationError(error)));
return await sendErrorResponse(validationErrors.map((error) => new internalErrorClasses_js_1.ValidationError(error)));
}

@@ -124,3 +125,3 @@ if (schemaDerivedData.documentStore) {

return await sendErrorResponse([
new errors_js_1.BadRequestError(`GET requests only support query operations, not ${operation.operation} operations`),
new internalErrorClasses_js_1.BadRequestError(`GET requests only support query operations, not ${operation.operation} operations`),
], { statusCode: 405, headers: new runHttpQuery_js_1.HeaderMap([['allow', 'POST']]) });

@@ -132,3 +133,3 @@ }

catch (err) {
return await sendErrorResponse([(0, errors_js_1.ensureGraphQLError)(err)], (0, runHttpQuery_js_1.newHTTPGraphQLHead)(500));
return await sendErrorResponse([(0, errorNormalize_js_1.ensureGraphQLError)(err)], (0, runHttpQuery_js_1.newHTTPGraphQLHead)(500));
}

@@ -160,2 +161,3 @@ if (requestContext.metrics.persistedQueryRegister &&

}
let statusCodeIfExecuteThrows = 500;
try {

@@ -167,16 +169,8 @@ const result = await execute(requestContext);

}
const error = result.errors[0];
throw new errors_js_1.OperationResolutionError(error.message, {
nodes: error.nodes,
originalError: error.originalError,
extensions: error.extensions,
});
statusCodeIfExecuteThrows = 400;
throw new internalErrorClasses_js_1.OperationResolutionError(result.errors[0]);
}
const resultErrors = result.errors?.map((e) => {
if (isBadUserInputGraphQLError(e)) {
return new errors_js_1.UserInputError(e.message, {
nodes: e.nodes,
originalError: e.originalError,
extensions: e.extensions,
});
return new internalErrorClasses_js_1.UserInputError(e);
}

@@ -195,6 +189,5 @@ return e;

catch (executionMaybeError) {
const executionError = (0, errors_js_1.ensureError)(executionMaybeError);
const executionError = (0, errorNormalize_js_1.ensureError)(executionMaybeError);
await Promise.all(executionListeners.map((l) => l.executionDidEnd?.(executionError)));
const errorStatusCode = executionMaybeError instanceof errors_js_1.OperationResolutionError ? 400 : 500;
return await sendErrorResponse([(0, errors_js_1.ensureGraphQLError)(executionError)], (0, runHttpQuery_js_1.newHTTPGraphQLHead)(errorStatusCode));
return await sendErrorResponse([(0, errorNormalize_js_1.ensureGraphQLError)(executionError)], (0, runHttpQuery_js_1.newHTTPGraphQLHead)(statusCodeIfExecuteThrows));
}

@@ -250,3 +243,3 @@ }

function formatErrors(errors) {
return (0, errors_js_1.normalizeAndFormatErrors)(errors, {
return (0, errorNormalize_js_1.normalizeAndFormatErrors)(errors, {
formatError: internals.formatError,

@@ -253,0 +246,0 @@ includeStackTracesInErrorResponses: internals.includeStackTracesInErrorResponses,

@@ -5,3 +5,5 @@ "use strict";

const ApolloServer_js_1 = require("./ApolloServer.js");
const errors_js_1 = require("./errors.js");
const graphql_1 = require("graphql");
const internalErrorClasses_js_1 = require("./internalErrorClasses.js");
const url_1 = require("url");
class HeaderMap extends Map {

@@ -17,26 +19,40 @@ set(key, value) {

function fieldIfString(o, fieldName) {
if (typeof o[fieldName] === 'string') {
return o[fieldName];
const value = o[fieldName];
if (typeof value === 'string') {
return value;
}
return undefined;
}
function jsonParsedFieldIfNonEmptyString(o, fieldName) {
if (typeof o[fieldName] === 'string' && o[fieldName]) {
let hopefullyRecord;
try {
hopefullyRecord = JSON.parse(o[fieldName]);
}
catch {
throw new errors_js_1.BadRequestError(`The ${fieldName} search parameter contains invalid JSON.`);
}
if (!isStringRecord(hopefullyRecord)) {
throw new errors_js_1.BadRequestError(`The ${fieldName} search parameter should contain a JSON-encoded object.`);
}
return hopefullyRecord;
function searchParamIfSpecifiedOnce(searchParams, paramName) {
const values = searchParams.getAll(paramName);
switch (values.length) {
case 0:
return undefined;
case 1:
return values[0];
default:
throw new internalErrorClasses_js_1.BadRequestError(`The '${paramName}' search parameter may only be specified once.`);
}
return undefined;
}
function jsonParsedSearchParamIfSpecifiedOnce(searchParams, fieldName) {
const value = searchParamIfSpecifiedOnce(searchParams, fieldName);
if (value === undefined) {
return undefined;
}
let hopefullyRecord;
try {
hopefullyRecord = JSON.parse(value);
}
catch {
throw new internalErrorClasses_js_1.BadRequestError(`The ${fieldName} search parameter contains invalid JSON.`);
}
if (!isStringRecord(hopefullyRecord)) {
throw new internalErrorClasses_js_1.BadRequestError(`The ${fieldName} search parameter should contain a JSON-encoded object.`);
}
return hopefullyRecord;
}
function fieldIfRecord(o, fieldName) {
if (isStringRecord(o[fieldName])) {
return o[fieldName];
const value = o[fieldName];
if (isStringRecord(value)) {
return value;
}

@@ -46,3 +62,3 @@ return undefined;

function isStringRecord(o) {
return o && typeof o === 'object' && !Buffer.isBuffer(o) && !Array.isArray(o);
return (!!o && typeof o === 'object' && !Buffer.isBuffer(o) && !Array.isArray(o));
}

@@ -56,4 +72,4 @@ function isNonEmptyStringRecord(o) {

}
if (query.kind === 'Document') {
throw new errors_js_1.BadRequestError("GraphQL queries must be strings. It looks like you're sending the " +
if (query.kind === graphql_1.Kind.DOCUMENT) {
throw new internalErrorClasses_js_1.BadRequestError("GraphQL queries must be strings. It looks like you're sending the " +
'internal graphql-js representation of a parsed query in your ' +

@@ -66,3 +82,3 @@ 'request instead of a request in the GraphQL query language. You ' +

else {
throw new errors_js_1.BadRequestError('GraphQL queries must be strings.');
throw new internalErrorClasses_js_1.BadRequestError('GraphQL queries must be strings.');
}

@@ -74,12 +90,12 @@ }

switch (httpRequest.method) {
case 'POST':
case 'POST': {
if (!isNonEmptyStringRecord(httpRequest.body)) {
throw new errors_js_1.BadRequestError('POST body missing, invalid Content-Type, or JSON object has no keys.');
throw new internalErrorClasses_js_1.BadRequestError('POST body missing, invalid Content-Type, or JSON object has no keys.');
}
ensureQueryIsStringOrMissing(httpRequest.body.query);
if (typeof httpRequest.body.variables === 'string') {
throw new errors_js_1.BadRequestError('`variables` in a POST body should be provided as an object, not a recursively JSON-encoded string.');
throw new internalErrorClasses_js_1.BadRequestError('`variables` in a POST body should be provided as an object, not a recursively JSON-encoded string.');
}
if (typeof httpRequest.body.extensions === 'string') {
throw new errors_js_1.BadRequestError('`extensions` in a POST body should be provided as an object, not a recursively JSON-encoded string.');
throw new internalErrorClasses_js_1.BadRequestError('`extensions` in a POST body should be provided as an object, not a recursively JSON-encoded string.');
}

@@ -94,17 +110,16 @@ graphQLRequest = {

break;
case 'GET':
if (!isStringRecord(httpRequest.searchParams)) {
throw new errors_js_1.BadRequestError('GET query missing.');
}
ensureQueryIsStringOrMissing(httpRequest.searchParams.query);
}
case 'GET': {
const searchParams = new url_1.URLSearchParams(httpRequest.search);
graphQLRequest = {
query: fieldIfString(httpRequest.searchParams, 'query'),
operationName: fieldIfString(httpRequest.searchParams, 'operationName'),
variables: jsonParsedFieldIfNonEmptyString(httpRequest.searchParams, 'variables'),
extensions: jsonParsedFieldIfNonEmptyString(httpRequest.searchParams, 'extensions'),
query: searchParamIfSpecifiedOnce(searchParams, 'query'),
operationName: searchParamIfSpecifiedOnce(searchParams, 'operationName'),
variables: jsonParsedSearchParamIfSpecifiedOnce(searchParams, 'variables'),
extensions: jsonParsedSearchParamIfSpecifiedOnce(searchParams, 'extensions'),
http: httpRequest,
};
break;
}
default:
throw new errors_js_1.BadRequestError(exports.badMethodErrorMessage);
throw new internalErrorClasses_js_1.BadRequestError(exports.badMethodErrorMessage);
}

@@ -120,3 +135,2 @@ const graphQLResponse = await (0, ApolloServer_js_1.internalExecuteOperation)({

const body = prettyJSONStringify(orderExecutionResultFields(graphQLResponse.result));
graphQLResponse.http.headers.set('content-length', Buffer.byteLength(body, 'utf8').toString());
return {

@@ -123,0 +137,0 @@ ...graphQLResponse.http,

@@ -11,3 +11,4 @@ import { isNodeLike } from '@apollo/utils.isnodelike';

import { determineApolloConfig } from './determineApolloConfig.js';
import { BadRequestError, ensureError, normalizeAndFormatErrors, } from './errors.js';
import { ensureError, normalizeAndFormatErrors } from './errorNormalize.js';
import { ApolloServerErrorCode } from './errors/index.js';
import { runPotentiallyBatchedHttpQuery } from './httpBatching.js';

@@ -461,3 +462,3 @@ import { pluginIsInternal } from './internalPlugin.js';

error.extensions.code &&
error.extensions.code !== 'INTERNAL_SERVER_ERROR'
error.extensions.code !== ApolloServerErrorCode.INTERNAL_SERVER_ERROR
? 400

@@ -471,3 +472,4 @@ : 500;

const maybeError = maybeError_;
if (maybeError instanceof BadRequestError) {
if (maybeError instanceof GraphQLError &&
maybeError.extensions.code === ApolloServerErrorCode.BAD_REQUEST) {
try {

@@ -474,0 +476,0 @@ await Promise.all(this.internals.plugins.map(async (plugin) => plugin.invalidRequestWasReceived?.({ error: maybeError })));

@@ -0,1 +1,2 @@

import { parse as urlParse } from 'url';
export function expressMiddleware(server, options) {

@@ -21,3 +22,3 @@ server.assertStarted('expressMiddleware()');

headers,
searchParams: req.query,
search: urlParse(req.url).search ?? '',
body: req.body,

@@ -24,0 +25,0 @@ };

export interface HTTPGraphQLRequest {
method: string;
headers: Map<string, string>;
searchParams: any;
body: any;
search: string;
body: unknown;
}

@@ -7,0 +7,0 @@ interface HTTPGraphQLResponseChunk {

@@ -1,2 +0,2 @@

export declare const packageVersion = "4.0.0-alpha.0";
export declare const packageVersion = "4.0.0-alpha.1";
//# sourceMappingURL=packageVersion.d.ts.map

@@ -1,2 +0,2 @@

export const packageVersion = "4.0.0-alpha.0";
export const packageVersion = "4.0.0-alpha.1";
//# sourceMappingURL=packageVersion.js.map
import type { BaseContext, HTTPGraphQLRequest, HTTPGraphQLResponse } from './externalTypes';
import type { ApolloServer, ApolloServerInternals, SchemaDerivedData } from './ApolloServer';
export declare function runBatchHttpQuery<TContext extends BaseContext>(server: ApolloServer<TContext>, batchRequest: Omit<HTTPGraphQLRequest, 'body'> & {
body: any[];
}, contextValue: TContext, schemaDerivedData: SchemaDerivedData, internals: ApolloServerInternals<TContext>): Promise<HTTPGraphQLResponse>;
export declare function runBatchHttpQuery<TContext extends BaseContext>(server: ApolloServer<TContext>, batchRequest: HTTPGraphQLRequest, body: unknown[], contextValue: TContext, schemaDerivedData: SchemaDerivedData, internals: ApolloServerInternals<TContext>): Promise<HTTPGraphQLResponse>;
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
import { HeaderMap, runHttpQuery } from './runHttpQuery.js';
import { BadRequestError } from './errors.js';
export async function runBatchHttpQuery(server, batchRequest, contextValue, schemaDerivedData, internals) {
import { BadRequestError } from './internalErrorClasses.js';
export async function runBatchHttpQuery(server, batchRequest, body, contextValue, schemaDerivedData, internals) {
const combinedResponse = {

@@ -9,6 +9,6 @@ headers: new HeaderMap(),

};
const responseBodies = await Promise.all(batchRequest.body.map(async (body) => {
const responseBodies = await Promise.all(body.map(async (bodyPiece) => {
const singleRequest = {
...batchRequest,
body,
body: bodyPiece,
};

@@ -35,3 +35,3 @@ const response = await runHttpQuery(server, singleRequest, contextValue, schemaDerivedData, internals, server.logger);

if (internals.allowBatchedHttpRequests) {
return await runBatchHttpQuery(server, httpGraphQLRequest, contextValue, schemaDerivedData, internals);
return await runBatchHttpQuery(server, httpGraphQLRequest, httpGraphQLRequest.body, contextValue, schemaDerivedData, internals);
}

@@ -38,0 +38,0 @@ throw new BadRequestError('Operation batching disabled.');

export { ApolloServer } from './ApolloServer.js';
export * from './externalTypes/index.js';
export { SyntaxError, ValidationError, AuthenticationError, ForbiddenError, UserInputError, PersistedQueryNotFoundError, } from './errors.js';
//# sourceMappingURL=index.d.ts.map
export { ApolloServer } from './ApolloServer.js';
export * from './externalTypes/index.js';
export { SyntaxError, ValidationError, AuthenticationError, ForbiddenError, UserInputError, PersistedQueryNotFoundError, } from './errors.js';
//# sourceMappingURL=index.js.map
import MIMEType from 'whatwg-mimetype';
import { BadRequestError } from './errors.js';
import { BadRequestError } from './internalErrorClasses.js';
export const recommendedCsrfPreventionRequestHeaders = [

@@ -4,0 +4,0 @@ 'x-apollo-operation-name',

import { createHash } from '@apollo/utils.createhash';
import { specifiedRules, getOperationAST, GraphQLError, validate, parse, execute as graphqlExecute, Kind, } from 'graphql';
import { symbolExecutionDispatcherWillResolveField, enablePluginsForSchemaResolvers, symbolUserFieldResolver, } from './utils/schemaInstrumentation.js';
import { PersistedQueryNotSupportedError, PersistedQueryNotFoundError, UserInputError, BadRequestError, ValidationError, SyntaxError, ensureError, normalizeAndFormatErrors, OperationResolutionError, ensureGraphQLError, } from './errors.js';
import { PersistedQueryNotSupportedError, PersistedQueryNotFoundError, UserInputError, BadRequestError, ValidationError, SyntaxError, OperationResolutionError, } from './internalErrorClasses.js';
import { ensureError, normalizeAndFormatErrors, ensureGraphQLError, } from './errorNormalize.js';
import { invokeDidStartHook, invokeHooksUntilDefinedAndNonNull, invokeSyncDidStartHook, } from './utils/invokeHooks.js';

@@ -148,2 +149,3 @@ import { HeaderMap, newHTTPGraphQLHead } from './runHttpQuery.js';

}
let statusCodeIfExecuteThrows = 500;
try {

@@ -155,16 +157,8 @@ const result = await execute(requestContext);

}
const error = result.errors[0];
throw new OperationResolutionError(error.message, {
nodes: error.nodes,
originalError: error.originalError,
extensions: error.extensions,
});
statusCodeIfExecuteThrows = 400;
throw new OperationResolutionError(result.errors[0]);
}
const resultErrors = result.errors?.map((e) => {
if (isBadUserInputGraphQLError(e)) {
return new UserInputError(e.message, {
nodes: e.nodes,
originalError: e.originalError,
extensions: e.extensions,
});
return new UserInputError(e);
}

@@ -185,4 +179,3 @@ return e;

await Promise.all(executionListeners.map((l) => l.executionDidEnd?.(executionError)));
const errorStatusCode = executionMaybeError instanceof OperationResolutionError ? 400 : 500;
return await sendErrorResponse([ensureGraphQLError(executionError)], newHTTPGraphQLHead(errorStatusCode));
return await sendErrorResponse([ensureGraphQLError(executionError)], newHTTPGraphQLHead(statusCodeIfExecuteThrows));
}

@@ -189,0 +182,0 @@ }

import type { BaseContext, HTTPGraphQLHead, HTTPGraphQLRequest, HTTPGraphQLResponse } from './externalTypes';
import { ApolloServer, ApolloServerInternals, SchemaDerivedData } from './ApolloServer.js';
import { FormattedExecutionResult } from 'graphql';
import type { Logger } from '@apollo/utils.logger';

@@ -9,5 +10,5 @@ export declare class HeaderMap extends Map<string, string> {

export declare function runHttpQuery<TContext extends BaseContext>(server: ApolloServer<TContext>, httpRequest: HTTPGraphQLRequest, contextValue: TContext, schemaDerivedData: SchemaDerivedData, internals: ApolloServerInternals<TContext>, logger: Logger): Promise<HTTPGraphQLResponse>;
export declare function prettyJSONStringify(value: any): string;
export declare function prettyJSONStringify(value: FormattedExecutionResult): string;
export declare function cloneObject<T extends Object>(object: T): T;
export declare function newHTTPGraphQLHead(statusCode?: number): HTTPGraphQLHead;
//# sourceMappingURL=runHttpQuery.d.ts.map
import { internalExecuteOperation, } from './ApolloServer.js';
import { BadRequestError } from './errors.js';
import { Kind } from 'graphql';
import { BadRequestError } from './internalErrorClasses.js';
import { URLSearchParams } from 'url';
export class HeaderMap extends Map {

@@ -12,26 +14,40 @@ set(key, value) {

function fieldIfString(o, fieldName) {
if (typeof o[fieldName] === 'string') {
return o[fieldName];
const value = o[fieldName];
if (typeof value === 'string') {
return value;
}
return undefined;
}
function jsonParsedFieldIfNonEmptyString(o, fieldName) {
if (typeof o[fieldName] === 'string' && o[fieldName]) {
let hopefullyRecord;
try {
hopefullyRecord = JSON.parse(o[fieldName]);
}
catch {
throw new BadRequestError(`The ${fieldName} search parameter contains invalid JSON.`);
}
if (!isStringRecord(hopefullyRecord)) {
throw new BadRequestError(`The ${fieldName} search parameter should contain a JSON-encoded object.`);
}
return hopefullyRecord;
function searchParamIfSpecifiedOnce(searchParams, paramName) {
const values = searchParams.getAll(paramName);
switch (values.length) {
case 0:
return undefined;
case 1:
return values[0];
default:
throw new BadRequestError(`The '${paramName}' search parameter may only be specified once.`);
}
return undefined;
}
function jsonParsedSearchParamIfSpecifiedOnce(searchParams, fieldName) {
const value = searchParamIfSpecifiedOnce(searchParams, fieldName);
if (value === undefined) {
return undefined;
}
let hopefullyRecord;
try {
hopefullyRecord = JSON.parse(value);
}
catch {
throw new BadRequestError(`The ${fieldName} search parameter contains invalid JSON.`);
}
if (!isStringRecord(hopefullyRecord)) {
throw new BadRequestError(`The ${fieldName} search parameter should contain a JSON-encoded object.`);
}
return hopefullyRecord;
}
function fieldIfRecord(o, fieldName) {
if (isStringRecord(o[fieldName])) {
return o[fieldName];
const value = o[fieldName];
if (isStringRecord(value)) {
return value;
}

@@ -41,3 +57,3 @@ return undefined;

function isStringRecord(o) {
return o && typeof o === 'object' && !Buffer.isBuffer(o) && !Array.isArray(o);
return (!!o && typeof o === 'object' && !Buffer.isBuffer(o) && !Array.isArray(o));
}

@@ -51,3 +67,3 @@ function isNonEmptyStringRecord(o) {

}
if (query.kind === 'Document') {
if (query.kind === Kind.DOCUMENT) {
throw new BadRequestError("GraphQL queries must be strings. It looks like you're sending the " +

@@ -68,3 +84,3 @@ 'internal graphql-js representation of a parsed query in your ' +

switch (httpRequest.method) {
case 'POST':
case 'POST': {
if (!isNonEmptyStringRecord(httpRequest.body)) {

@@ -88,15 +104,14 @@ throw new BadRequestError('POST body missing, invalid Content-Type, or JSON object has no keys.');

break;
case 'GET':
if (!isStringRecord(httpRequest.searchParams)) {
throw new BadRequestError('GET query missing.');
}
ensureQueryIsStringOrMissing(httpRequest.searchParams.query);
}
case 'GET': {
const searchParams = new URLSearchParams(httpRequest.search);
graphQLRequest = {
query: fieldIfString(httpRequest.searchParams, 'query'),
operationName: fieldIfString(httpRequest.searchParams, 'operationName'),
variables: jsonParsedFieldIfNonEmptyString(httpRequest.searchParams, 'variables'),
extensions: jsonParsedFieldIfNonEmptyString(httpRequest.searchParams, 'extensions'),
query: searchParamIfSpecifiedOnce(searchParams, 'query'),
operationName: searchParamIfSpecifiedOnce(searchParams, 'operationName'),
variables: jsonParsedSearchParamIfSpecifiedOnce(searchParams, 'variables'),
extensions: jsonParsedSearchParamIfSpecifiedOnce(searchParams, 'extensions'),
http: httpRequest,
};
break;
}
default:

@@ -114,3 +129,2 @@ throw new BadRequestError(badMethodErrorMessage);

const body = prettyJSONStringify(orderExecutionResultFields(graphQLResponse.result));
graphQLResponse.http.headers.set('content-length', Buffer.byteLength(body, 'utf8').toString());
return {

@@ -117,0 +131,0 @@ ...graphQLResponse.http,

{
"name": "@apollo/server",
"version": "4.0.0-alpha.0",
"version": "4.0.0-alpha.1",
"description": "Core engine for Apollo GraphQL server",

@@ -15,2 +15,7 @@ "type": "module",

},
"./errors": {
"types": "./dist/esm/errors/index.d.ts",
"import": "./dist/esm/errors/index.js",
"require": "./dist/cjs/errors/index.js"
},
"./express4": {

@@ -88,3 +93,3 @@ "types": "./dist/esm/express4/index.d.ts",

"dependencies": {
"@apollo/usage-reporting-protobuf": "^4.0.0-alpha.0",
"@apollo/usage-reporting-protobuf": "^4.0.0-alpha.1",
"@apollo/utils.createhash": "^1.1.0",

@@ -91,0 +96,0 @@ "@apollo/utils.fetcher": "^1.0.0",

@@ -1,11 +0,144 @@

# apollo-server-core
# `@apollo/server`
[![npm version](https://badge.fury.io/js/apollo-server-core.svg)](https://badge.fury.io/js/apollo-server-core)
[![Build Status](https://circleci.com/gh/apollographql/apollo-server/tree/main.svg?style=svg)](https://circleci.com/gh/apollographql/apollo-server)
## A TypeScript/JavaScript GraphQL server
This package implements the core logic of Apollo Server. It exports a base version of `ApolloServer`. Typically you do not use this class directly but instead use an `ApolloServer` imported from the batteries-included `apollo-server` package or one of the integration packages like `apollo-server-express`.
> Apollo Server 4 is currently in the alpha phase. Further changes (including backwards-incompatible changes) may be made before v4.0.0 is released. Docs for this version are available at https://www.apollographql.com/docs/apollo-server/v4/
It also exports a set of plugins such as `ApolloServerPluginUsageReporting` which you can provide to the `plugins` option to the `ApolloServer` constructor.
**Apollo Server is an [open-source](https://github.com/apollographql/apollo-server), spec-compliant GraphQL server** that's compatible with any GraphQL client, including [Apollo Client](https://www.apollographql.com/docs/react). It's the best way to build a production-ready, self-documenting GraphQL API that can use data from any source.
[Read the docs.](https://www.apollographql.com/docs/apollo-server/)
[Read the CHANGELOG.](https://github.com/apollographql/apollo-server/blob/main/CHANGELOG.md)
You can use Apollo Server as:
* A stand-alone GraphQL server
* The GraphQL server for a [subgraph](https://www.apollographql.com/docs/federation/subgraphs/) in a federated supergraph
* The gateway for a [federated supergraph](https://www.apollographql.com/docs/federation/)
Apollo Server provides a simple API for integrating with any Node.js web framework or serverless environment. The `@apollo/server` package itself ships with a standalone zero-dependency web server, and a middleware implementation for [the Express web framework](https://expressjs.com/). Integrations with other environments are community-maintained.
Apollo Server provides:
* **Straightforward setup**, so your client developers can start fetching data quickly
* **Incremental adoption**, enabling you to add features as they're needed
* **Universal compatibility** with any data source, any build tool, and any GraphQL client
* **Production readiness**, enabling you to confidently run your graph in production
This `@apollo/server` package is new with Apollo Server 4. Previous major versions of Apollo Server used a set of package names starting with `apollo-server`, such as `apollo-server`, `apollo-server-express`, `apollo-server-core`, etc.
## Documentation
Full documentation for Apollo Server is available on [our documentation site](https://www.apollographql.com/docs/apollo-server/). This README shows the basics of getting a server running (both standalone and with Express), but most features are only documented on our docs site.
## Getting started: standalone server
> You can also check out the [getting started](https://www.apollographql.com/docs/apollo-server/getting-started) guide in the Apollo Server docs for more details, including examples in both TypeScript and JavaScript.
Apollo Server's standalone server lets you get a GraphQL server up and running quickly without needing to set up an HTTP server yourself. It allows all the same configuration of GraphQL logic as the Express integration, but does not provide the ability to make fine-grained tweaks to the HTTP-specific behavior of your server.
First, install Apollo Server and the JavaScript implementation of the core GraphQL algorithms:
```
npm install @apollo/server graphql
```
Then, write the following to `server.mjs`. (By using the `.mjs` extension, Node lets you use the `await` keyword at the top level.)
```js
import { ApolloServer } from '@apollo/server';
import { startStandaloneServer } from '@apollo/server/standalone';
// The GraphQL schema
const typeDefs = `#graphql
type Query {
hello: String
}
`;
// A map of functions which return data for the schema.
const resolvers = {
Query: {
hello: () => 'world',
},
};
const server = new ApolloServer({
typeDefs,
resolvers,
});
const { url } = await startStandaloneServer(server);
console.log(`🚀 Server ready at ${url}`);
```
Now run your server with:
```
node server.mjs
```
Open the URL it prints in a web browser. It will show [Apollo Sandbox](https://www.apollographql.com/docs/studio/explorer/sandbox/), a web-based tool for running GraphQL operations. Try running the operation `query { hello }`!
## Getting started: Express middleware
Apollo Server's built-in Express middleware lets you run your GraphQL server as part of an app built with [Express](https://expressjs.com/), the most popular web framework for Node.
First, install Apollo Server, the JavaScript implementation of the core GraphQL algorithms, Express, and two common Express middleware packages:
```
npm install @apollo/server graphql express cors body-parser
```
Then, write the following to `server.mjs`. (By using the `.mjs` extension, Node lets you use the `await` keyword at the top level.)
```js
import { ApolloServer } from '@apollo/server';
import { expressMiddleware } from '@apollo/server/express4';
import { ApolloServerPluginDrainHttpServer } from '@apollo/server/plugin/drainHttpServer'
import express from 'express';
import http from 'http';
import cors from 'cors';
import bodyParser from 'body-parser';
// The GraphQL schema
const typeDefs = `#graphql
type Query {
hello: String
}
`;
// A map of functions which return data for the schema.
const resolvers = {
Query: {
hello: () => 'world',
},
};
const app = express();
const httpServer = http.createServer(app);
// Set up Apollo Server
const server = new ApolloServer({
typeDefs,
resolvers,
plugins: [ApolloServerPluginDrainHttpServer({ httpServer })],
});
await server.start();
app.use(
cors(),
bodyParser.json(),
expressMiddleware(server),
);
await new Promise((resolve) => httpServer.listen({ port: 4000 }, resolve));
console.log(`🚀 Server ready at http://localhost:4000`);
```
Now run your server with:
```
node server.mjs
```
Open the URL it prints in a web browser. It will show [Apollo Sandbox](https://www.apollographql.com/docs/studio/explorer/sandbox/), a web-based tool for running GraphQL operations. Try running the operation `query { hello }`!

@@ -27,7 +27,4 @@ import { isNodeLike } from '@apollo/utils.isnodelike';

import { determineApolloConfig } from './determineApolloConfig.js';
import {
BadRequestError,
ensureError,
normalizeAndFormatErrors,
} from './errors.js';
import { ensureError, normalizeAndFormatErrors } from './errorNormalize.js';
import { ApolloServerErrorCode } from './errors/index.js';
import type {

@@ -1007,3 +1004,3 @@ ApolloServerPlugin,

error.extensions.code &&
error.extensions.code !== 'INTERNAL_SERVER_ERROR'
error.extensions.code !== ApolloServerErrorCode.INTERNAL_SERVER_ERROR
? 400

@@ -1023,3 +1020,6 @@ : 500;

const maybeError = maybeError_; // fixes inference because catch vars are not const
if (maybeError instanceof BadRequestError) {
if (
maybeError instanceof GraphQLError &&
maybeError.extensions.code === ApolloServerErrorCode.BAD_REQUEST
) {
try {

@@ -1026,0 +1026,0 @@ await Promise.all(

@@ -9,2 +9,3 @@ import type { WithRequired } from '@apollo/utils.withrequired';

} from '../externalTypes';
import { parse as urlParse } from 'url';

@@ -78,3 +79,3 @@ export interface ExpressContextFunctionArgument {

headers,
searchParams: req.query,
search: urlParse(req.url).search ?? '',
body: req.body,

@@ -81,0 +82,0 @@ };

@@ -8,10 +8,13 @@ // TODO(AS4): Document this interface.

headers: Map<string, string>;
// no name normalization. can theoretically have deeply nested stuff if you
// use a search parameter parser like `qs` (used by `express` by default) that does
// that and you want to look for that in your own plugin. AS itself will only
// look for a handful of keys and will validate their value types.
searchParams: any;
/**
* The part of the URL after the question mark (not including the #fragment),
* or the empty string if there is no question mark. Including the question
* mark in this string is allowed but not required. Do not %-decode this
* string. You can get this from a standard Node request with
* `url.parse(request.url).search ?? ''`.
*/
search: string;
// read by your body-parser or whatever. we poke at it to make it into
// the right real type.
body: any;
body: unknown;
}

@@ -18,0 +21,0 @@

@@ -1,1 +0,1 @@

export const packageVersion = "4.0.0-alpha.0";
export const packageVersion = "4.0.0-alpha.1";

@@ -12,7 +12,8 @@ import type {

import { HeaderMap, runHttpQuery } from './runHttpQuery.js';
import { BadRequestError } from './errors.js';
import { BadRequestError } from './internalErrorClasses.js';
export async function runBatchHttpQuery<TContext extends BaseContext>(
server: ApolloServer<TContext>,
batchRequest: Omit<HTTPGraphQLRequest, 'body'> & { body: any[] },
batchRequest: HTTPGraphQLRequest,
body: unknown[],
contextValue: TContext,

@@ -30,6 +31,6 @@ schemaDerivedData: SchemaDerivedData,

const responseBodies = await Promise.all(
batchRequest.body.map(async (body: any) => {
body.map(async (bodyPiece: unknown) => {
const singleRequest: HTTPGraphQLRequest = {
...batchRequest,
body,
body: bodyPiece,
};

@@ -90,2 +91,3 @@

httpGraphQLRequest,
httpGraphQLRequest.body as unknown[],
contextValue,

@@ -92,0 +94,0 @@ schemaDerivedData,

export { ApolloServer } from './ApolloServer.js';
// Note that this is purely a type export.
export * from './externalTypes/index.js';
// TODO(AS4): consider moving to `@apollo/server/errors`
export {
SyntaxError,
ValidationError,
AuthenticationError,
ForbiddenError,
UserInputError,
PersistedQueryNotFoundError,
} from './errors.js';
import MIMEType from 'whatwg-mimetype';
import { BadRequestError } from './errors.js';
import { BadRequestError } from './internalErrorClasses.js';

@@ -4,0 +4,0 @@ // Our recommended set of CSRF prevention headers. Operations that do not

@@ -25,7 +25,9 @@ import { createHash } from '@apollo/utils.createhash';

SyntaxError,
OperationResolutionError,
} from './internalErrorClasses.js';
import {
ensureError,
normalizeAndFormatErrors,
OperationResolutionError,
ensureGraphQLError,
} from './errors.js';
} from './errorNormalize.js';
import type {

@@ -411,2 +413,3 @@ GraphQLRequestContext,

let statusCodeIfExecuteThrows = 500;
try {

@@ -426,8 +429,4 @@ const result = await execute(

}
const error = result.errors[0];
throw new OperationResolutionError(error.message, {
nodes: error.nodes,
originalError: error.originalError,
extensions: error.extensions,
});
statusCodeIfExecuteThrows = 400;
throw new OperationResolutionError(result.errors[0]);
}

@@ -448,7 +447,3 @@

if (isBadUserInputGraphQLError(e)) {
return new UserInputError(e.message, {
nodes: e.nodes,
originalError: e.originalError,
extensions: e.extensions,
});
return new UserInputError(e);
}

@@ -474,7 +469,5 @@ return e;

const errorStatusCode =
executionMaybeError instanceof OperationResolutionError ? 400 : 500;
return await sendErrorResponse(
[ensureGraphQLError(executionError)],
newHTTPGraphQLHead(errorStatusCode),
newHTTPGraphQLHead(statusCodeIfExecuteThrows),
);

@@ -481,0 +474,0 @@ }

@@ -14,5 +14,6 @@ import type {

} from './ApolloServer.js';
import type { FormattedExecutionResult } from 'graphql';
import { BadRequestError } from './errors.js';
import { FormattedExecutionResult, Kind } from 'graphql';
import { BadRequestError } from './internalErrorClasses.js';
import type { Logger } from '@apollo/utils.logger';
import { URLSearchParams } from 'url';

@@ -33,7 +34,8 @@ // TODO(AS4): keep rethinking whether Map is what we want or if we just

function fieldIfString(
o: Record<string, any>,
o: Record<string, unknown>,
fieldName: string,
): string | undefined {
if (typeof o[fieldName] === 'string') {
return o[fieldName];
const value = o[fieldName];
if (typeof value === 'string') {
return value;
}

@@ -43,31 +45,50 @@ return undefined;

function jsonParsedFieldIfNonEmptyString(
o: Record<string, any>,
fieldName: string,
): Record<string, any> | undefined {
if (typeof o[fieldName] === 'string' && o[fieldName]) {
let hopefullyRecord;
try {
hopefullyRecord = JSON.parse(o[fieldName]);
} catch {
function searchParamIfSpecifiedOnce(
searchParams: URLSearchParams,
paramName: string,
) {
const values = searchParams.getAll(paramName);
switch (values.length) {
case 0:
return undefined;
case 1:
return values[0];
default:
throw new BadRequestError(
`The ${fieldName} search parameter contains invalid JSON.`,
`The '${paramName}' search parameter may only be specified once.`,
);
}
if (!isStringRecord(hopefullyRecord)) {
throw new BadRequestError(
`The ${fieldName} search parameter should contain a JSON-encoded object.`,
);
}
return hopefullyRecord;
}
return undefined;
}
function jsonParsedSearchParamIfSpecifiedOnce(
searchParams: URLSearchParams,
fieldName: string,
): Record<string, unknown> | undefined {
const value = searchParamIfSpecifiedOnce(searchParams, fieldName);
if (value === undefined) {
return undefined;
}
let hopefullyRecord;
try {
hopefullyRecord = JSON.parse(value);
} catch {
throw new BadRequestError(
`The ${fieldName} search parameter contains invalid JSON.`,
);
}
if (!isStringRecord(hopefullyRecord)) {
throw new BadRequestError(
`The ${fieldName} search parameter should contain a JSON-encoded object.`,
);
}
return hopefullyRecord;
}
function fieldIfRecord(
o: Record<string, any>,
o: Record<string, unknown>,
fieldName: string,
): Record<string, any> | undefined {
if (isStringRecord(o[fieldName])) {
return o[fieldName];
): Record<string, unknown> | undefined {
const value = o[fieldName];
if (isStringRecord(value)) {
return value;
}

@@ -77,11 +98,13 @@ return undefined;

function isStringRecord(o: any): o is Record<string, any> {
return o && typeof o === 'object' && !Buffer.isBuffer(o) && !Array.isArray(o);
function isStringRecord(o: unknown): o is Record<string, unknown> {
return (
!!o && typeof o === 'object' && !Buffer.isBuffer(o) && !Array.isArray(o)
);
}
function isNonEmptyStringRecord(o: any): o is Record<string, any> {
function isNonEmptyStringRecord(o: unknown): o is Record<string, unknown> {
return isStringRecord(o) && Object.keys(o).length > 0;
}
function ensureQueryIsStringOrMissing(query: any) {
function ensureQueryIsStringOrMissing(query: unknown) {
if (!query || typeof query === 'string') {

@@ -91,3 +114,3 @@ return;

// Check for a common error first.
if (query.kind === 'Document') {
if ((query as any).kind === Kind.DOCUMENT) {
throw new BadRequestError(

@@ -120,3 +143,3 @@ "GraphQL queries must be strings. It looks like you're sending the " +

switch (httpRequest.method) {
case 'POST':
case 'POST': {
// TODO(AS4): If it's an array, some error about enabling batching?

@@ -154,18 +177,19 @@ if (!isNonEmptyStringRecord(httpRequest.body)) {

break;
case 'GET':
if (!isStringRecord(httpRequest.searchParams)) {
throw new BadRequestError('GET query missing.');
}
}
ensureQueryIsStringOrMissing(httpRequest.searchParams.query);
case 'GET': {
const searchParams = new URLSearchParams(httpRequest.search);
graphQLRequest = {
query: fieldIfString(httpRequest.searchParams, 'query'),
operationName: fieldIfString(httpRequest.searchParams, 'operationName'),
variables: jsonParsedFieldIfNonEmptyString(
httpRequest.searchParams,
query: searchParamIfSpecifiedOnce(searchParams, 'query'),
operationName: searchParamIfSpecifiedOnce(
searchParams,
'operationName',
),
variables: jsonParsedSearchParamIfSpecifiedOnce(
searchParams,
'variables',
),
extensions: jsonParsedFieldIfNonEmptyString(
httpRequest.searchParams,
extensions: jsonParsedSearchParamIfSpecifiedOnce(
searchParams,
'extensions',

@@ -177,2 +201,3 @@ ),

break;
}
default:

@@ -195,7 +220,2 @@ throw new BadRequestError(badMethodErrorMessage);

graphQLResponse.http.headers.set(
'content-length',
Buffer.byteLength(body, 'utf8').toString(),
);
return {

@@ -221,3 +241,3 @@ ...graphQLResponse.http,

// The result of a curl does not appear well in the terminal, so we add an extra new line
export function prettyJSONStringify(value: any) {
export function prettyJSONStringify(value: FormattedExecutionResult) {
return JSON.stringify(value) + '\n';

@@ -224,0 +244,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc