Initial Save
This commit is contained in:
14
node_modules/apollo-server-core/dist/plugin/index.d.ts
generated
vendored
Normal file
14
node_modules/apollo-server-core/dist/plugin/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import type { ApolloServerPlugin } from 'apollo-server-plugin-base';
|
||||
import type { ApolloServerPluginUsageReportingOptions, EngineReportingOptions } from './usageReporting';
|
||||
export type { ApolloServerPluginUsageReportingOptions, SendValuesBaseOptions, VariableValueOptions, ClientInfo, GenerateClientInfo, EngineReportingOptions, } from './usageReporting';
|
||||
import type { ApolloServerPluginSchemaReportingOptions } from './schemaReporting';
|
||||
export type { ApolloServerPluginSchemaReportingOptions } from './schemaReporting';
|
||||
import type { ApolloServerPluginInlineTraceOptions } from './inlineTrace';
|
||||
export type { ApolloServerPluginInlineTraceOptions } from './inlineTrace';
|
||||
export declare function ApolloServerPluginUsageReporting<TContext>(options?: ApolloServerPluginUsageReportingOptions<TContext>): ApolloServerPlugin;
|
||||
export declare function ApolloServerPluginUsageReportingDisabled(): ApolloServerPlugin;
|
||||
export declare function ApolloServerPluginUsageReportingFromLegacyOptions<TContext>(options?: EngineReportingOptions<TContext>): ApolloServerPlugin;
|
||||
export declare function ApolloServerPluginSchemaReporting(options?: ApolloServerPluginSchemaReportingOptions): ApolloServerPlugin;
|
||||
export declare function ApolloServerPluginInlineTrace(options?: ApolloServerPluginInlineTraceOptions): ApolloServerPlugin;
|
||||
export declare function ApolloServerPluginInlineTraceDisabled(): ApolloServerPlugin;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/index.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin/index.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,OAAO,KAAK,EACV,uCAAuC,EACvC,sBAAsB,EACvB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,uCAAuC,EACvC,qBAAqB,EACrB,oBAAoB,EACpB,UAAU,EACV,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,wCAAwC,EAAE,MAAM,mBAAmB,CAAC;AAClF,YAAY,EAAE,wCAAwC,EAAE,MAAM,mBAAmB,CAAC;AAClF,OAAO,KAAK,EAAE,oCAAoC,EAAE,MAAM,eAAe,CAAC;AAC1E,YAAY,EAAE,oCAAoC,EAAE,MAAM,eAAe,CAAC;AAG1E,wBAAgB,gCAAgC,CAAC,QAAQ,EACvD,OAAO,GAAE,uCAAuC,CAAC,QAAQ,CAExD,GACA,kBAAkB,CAEpB;AACD,wBAAgB,wCAAwC,IAAI,kBAAkB,CAE7E;AACD,wBAAgB,iDAAiD,CAAC,QAAQ,EACxE,OAAO,GAAE,sBAAsB,CAAC,QAAQ,CAAuB,GAC9D,kBAAkB,CAIpB;AAID,wBAAgB,iCAAiC,CAC/C,OAAO,GAAE,wCAA8D,GACtE,kBAAkB,CAIpB;AAID,wBAAgB,6BAA6B,CAC3C,OAAO,GAAE,oCAA0D,GAClE,kBAAkB,CAEpB;AACD,wBAAgB,qCAAqC,IAAI,kBAAkB,CAE1E"}
|
||||
28
node_modules/apollo-server-core/dist/plugin/index.js
generated
vendored
Normal file
28
node_modules/apollo-server-core/dist/plugin/index.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ApolloServerPluginInlineTraceDisabled = exports.ApolloServerPluginInlineTrace = exports.ApolloServerPluginSchemaReporting = exports.ApolloServerPluginUsageReportingFromLegacyOptions = exports.ApolloServerPluginUsageReportingDisabled = exports.ApolloServerPluginUsageReporting = void 0;
|
||||
function ApolloServerPluginUsageReporting(options = Object.create(null)) {
|
||||
return require('./usageReporting').ApolloServerPluginUsageReporting(options);
|
||||
}
|
||||
exports.ApolloServerPluginUsageReporting = ApolloServerPluginUsageReporting;
|
||||
function ApolloServerPluginUsageReportingDisabled() {
|
||||
return require('./usageReporting').ApolloServerPluginUsageReportingDisabled();
|
||||
}
|
||||
exports.ApolloServerPluginUsageReportingDisabled = ApolloServerPluginUsageReportingDisabled;
|
||||
function ApolloServerPluginUsageReportingFromLegacyOptions(options = Object.create(null)) {
|
||||
return require('./usageReporting').ApolloServerPluginUsageReportingFromLegacyOptions(options);
|
||||
}
|
||||
exports.ApolloServerPluginUsageReportingFromLegacyOptions = ApolloServerPluginUsageReportingFromLegacyOptions;
|
||||
function ApolloServerPluginSchemaReporting(options = Object.create(null)) {
|
||||
return require('./schemaReporting').ApolloServerPluginSchemaReporting(options);
|
||||
}
|
||||
exports.ApolloServerPluginSchemaReporting = ApolloServerPluginSchemaReporting;
|
||||
function ApolloServerPluginInlineTrace(options = Object.create(null)) {
|
||||
return require('./inlineTrace').ApolloServerPluginInlineTrace(options);
|
||||
}
|
||||
exports.ApolloServerPluginInlineTrace = ApolloServerPluginInlineTrace;
|
||||
function ApolloServerPluginInlineTraceDisabled() {
|
||||
return require('./inlineTrace').ApolloServerPluginInlineTraceDisabled();
|
||||
}
|
||||
exports.ApolloServerPluginInlineTraceDisabled = ApolloServerPluginInlineTraceDisabled;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/index.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/plugin/index.ts"],"names":[],"mappings":";;;AAsCA,SAAgB,gCAAgC,CAC9C,UAA6D,MAAM,CAAC,MAAM,CACxE,IAAI,CACL;IAED,OAAO,OAAO,CAAC,kBAAkB,CAAC,CAAC,gCAAgC,CAAC,OAAO,CAAC,CAAC;AAC/E,CAAC;AAND,4EAMC;AACD,SAAgB,wCAAwC;IACtD,OAAO,OAAO,CAAC,kBAAkB,CAAC,CAAC,wCAAwC,EAAE,CAAC;AAChF,CAAC;AAFD,4FAEC;AACD,SAAgB,iDAAiD,CAC/D,UAA4C,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;IAE/D,OAAO,OAAO,CAAC,kBAAkB,CAAC,CAAC,iDAAiD,CAClF,OAAO,CACR,CAAC;AACJ,CAAC;AAND,8GAMC;AAID,SAAgB,iCAAiC,CAC/C,UAAoD,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;IAEvE,OAAO,OAAO,CAAC,mBAAmB,CAAC,CAAC,iCAAiC,CACnE,OAAO,CACR,CAAC;AACJ,CAAC;AAND,8EAMC;AAID,SAAgB,6BAA6B,CAC3C,UAAgD,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;IAEnE,OAAO,OAAO,CAAC,eAAe,CAAC,CAAC,6BAA6B,CAAC,OAAO,CAAC,CAAC;AACzE,CAAC;AAJD,sEAIC;AACD,SAAgB,qCAAqC;IACnD,OAAO,OAAO,CAAC,eAAe,CAAC,CAAC,qCAAqC,EAAE,CAAC;AAC1E,CAAC;AAFD,sFAEC"}
|
||||
9
node_modules/apollo-server-core/dist/plugin/inlineTrace/index.d.ts
generated
vendored
Normal file
9
node_modules/apollo-server-core/dist/plugin/inlineTrace/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import type { ApolloServerPluginUsageReportingOptions } from '../usageReporting/options';
|
||||
import type { InternalApolloServerPlugin } from '../internalPlugin';
|
||||
export interface ApolloServerPluginInlineTraceOptions {
|
||||
rewriteError?: ApolloServerPluginUsageReportingOptions<never>['rewriteError'];
|
||||
__onlyIfSchemaIsFederated?: boolean;
|
||||
}
|
||||
export declare function ApolloServerPluginInlineTrace(options?: ApolloServerPluginInlineTraceOptions): InternalApolloServerPlugin;
|
||||
export declare function ApolloServerPluginInlineTraceDisabled(): InternalApolloServerPlugin;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/inlineTrace/index.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/inlineTrace/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugin/inlineTrace/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uCAAuC,EAAE,MAAM,2BAA2B,CAAC;AACzF,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAGpE,MAAM,WAAW,oCAAoC;IAOnD,YAAY,CAAC,EAAE,uCAAuC,CAAC,KAAK,CAAC,CAAC,cAAc,CAAC,CAAC;IAW9E,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC;AAOD,wBAAgB,6BAA6B,CAC3C,OAAO,GAAE,oCAA0D,GAClE,0BAA0B,CA0E5B;AAID,wBAAgB,qCAAqC,IAAI,0BAA0B,CAMlF"}
|
||||
65
node_modules/apollo-server-core/dist/plugin/inlineTrace/index.js
generated
vendored
Normal file
65
node_modules/apollo-server-core/dist/plugin/inlineTrace/index.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ApolloServerPluginInlineTraceDisabled = exports.ApolloServerPluginInlineTrace = void 0;
|
||||
const apollo_reporting_protobuf_1 = require("apollo-reporting-protobuf");
|
||||
const traceTreeBuilder_1 = require("../traceTreeBuilder");
|
||||
const schemaIsFederated_1 = require("../schemaIsFederated");
|
||||
function ApolloServerPluginInlineTrace(options = Object.create(null)) {
|
||||
let enabled = options.__onlyIfSchemaIsFederated ? null : true;
|
||||
return {
|
||||
__internal_plugin_id__() {
|
||||
return 'InlineTrace';
|
||||
},
|
||||
serverWillStart({ schema, logger }) {
|
||||
if (enabled === null) {
|
||||
enabled = schemaIsFederated_1.schemaIsFederated(schema);
|
||||
if (enabled) {
|
||||
logger.info('Enabling inline tracing for this federated service. To disable, use ' +
|
||||
'ApolloServerPluginInlineTraceDisabled.');
|
||||
}
|
||||
}
|
||||
},
|
||||
requestDidStart({ request: { http } }) {
|
||||
if (!enabled) {
|
||||
return;
|
||||
}
|
||||
const treeBuilder = new traceTreeBuilder_1.TraceTreeBuilder({
|
||||
rewriteError: options.rewriteError,
|
||||
});
|
||||
if ((http === null || http === void 0 ? void 0 : http.headers.get('apollo-federation-include-trace')) !== 'ftv1') {
|
||||
return;
|
||||
}
|
||||
treeBuilder.startTiming();
|
||||
return {
|
||||
executionDidStart: () => ({
|
||||
willResolveField({ info }) {
|
||||
return treeBuilder.willResolveField(info);
|
||||
},
|
||||
}),
|
||||
didEncounterErrors({ errors }) {
|
||||
treeBuilder.didEncounterErrors(errors);
|
||||
},
|
||||
willSendResponse({ response }) {
|
||||
treeBuilder.stopTiming();
|
||||
const encodedUint8Array = apollo_reporting_protobuf_1.Trace.encode(treeBuilder.trace).finish();
|
||||
const encodedBuffer = Buffer.from(encodedUint8Array, encodedUint8Array.byteOffset, encodedUint8Array.byteLength);
|
||||
const extensions = response.extensions || (response.extensions = Object.create(null));
|
||||
if (typeof extensions.ftv1 !== 'undefined') {
|
||||
throw new Error('The `ftv1` extension was already present.');
|
||||
}
|
||||
extensions.ftv1 = encodedBuffer.toString('base64');
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
}
|
||||
exports.ApolloServerPluginInlineTrace = ApolloServerPluginInlineTrace;
|
||||
function ApolloServerPluginInlineTraceDisabled() {
|
||||
return {
|
||||
__internal_plugin_id__() {
|
||||
return 'InlineTrace';
|
||||
},
|
||||
};
|
||||
}
|
||||
exports.ApolloServerPluginInlineTraceDisabled = ApolloServerPluginInlineTraceDisabled;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/inlineTrace/index.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/inlineTrace/index.js.map
generated
vendored
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WAAW,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;gBACzC,CAAC;gBAED,gBAAgB,CAAC,EAAE,QAAQ,EAAE;oBAG3B,WAAW,CAAC,UAAU,EAAE,CAAC;oBAEzB,MAAM,iBAAiB,GAAG,iCAAK,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC;oBACnE,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAC/B,iBAAiB,EACjB,iBAAiB,CAAC,UAAU,EAC5B,iBAAiB,CAAC,UAAU,CAC7B,CAAC;oBAEF,MAAM,UAAU,GACd,QAAQ,CAAC,UAAU,IAAI,CAAC,QAAQ,CAAC,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;oBAIrE,IAAI,OAAO,UAAU,CAAC,IAAI,KAAK,WAAW,EAAE;wBAC1C,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;qBAC9D;oBAED,UAAU,CAAC,IAAI,GAAG,aAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;gBACrD,CAAC;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC;AA5ED,sEA4EC;AAID,SAAgB,qCAAqC;IACnD,OAAO;QACL,sBAAsB;YACpB,OAAO,aAAa,CAAC;QACvB,CAAC;KACF,CAAC;AACJ,CAAC;AAND,sFAMC"}
|
||||
8
node_modules/apollo-server-core/dist/plugin/internalPlugin.d.ts
generated
vendored
Normal file
8
node_modules/apollo-server-core/dist/plugin/internalPlugin.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import type { BaseContext } from 'apollo-server-types';
|
||||
import type { ApolloServerPlugin } from 'apollo-server-plugin-base';
|
||||
export interface InternalApolloServerPlugin<TContext extends BaseContext = BaseContext> extends ApolloServerPlugin<TContext> {
|
||||
__internal_plugin_id__(): InternalPluginId;
|
||||
}
|
||||
export declare type InternalPluginId = 'SchemaReporting' | 'InlineTrace' | 'UsageReporting';
|
||||
export declare function pluginIsInternal(plugin: ApolloServerPlugin): plugin is InternalApolloServerPlugin;
|
||||
//# sourceMappingURL=internalPlugin.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/internalPlugin.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/internalPlugin.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"internalPlugin.d.ts","sourceRoot":"","sources":["../../src/plugin/internalPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AASpE,MAAM,WAAW,0BAA0B,CACzC,QAAQ,SAAS,WAAW,GAAG,WAAW,CAC1C,SAAQ,kBAAkB,CAAC,QAAQ,CAAC;IAGpC,sBAAsB,IAAI,gBAAgB,CAAC;CAC5C;AAED,oBAAY,gBAAgB,GACxB,iBAAiB,GACjB,aAAa,GACb,gBAAgB,CAAC;AAErB,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,kBAAkB,GACzB,MAAM,IAAI,0BAA0B,CAItC"}
|
||||
8
node_modules/apollo-server-core/dist/plugin/internalPlugin.js
generated
vendored
Normal file
8
node_modules/apollo-server-core/dist/plugin/internalPlugin.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.pluginIsInternal = void 0;
|
||||
function pluginIsInternal(plugin) {
|
||||
return '__internal_plugin_id__' in plugin;
|
||||
}
|
||||
exports.pluginIsInternal = pluginIsInternal;
|
||||
//# sourceMappingURL=internalPlugin.js.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/internalPlugin.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/internalPlugin.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"internalPlugin.js","sourceRoot":"","sources":["../../src/plugin/internalPlugin.ts"],"names":[],"mappings":";;;AAuBA,SAAgB,gBAAgB,CAC9B,MAA0B;IAI1B,OAAO,wBAAwB,IAAI,MAAM,CAAC;AAC5C,CAAC;AAND,4CAMC"}
|
||||
3
node_modules/apollo-server-core/dist/plugin/schemaIsFederated.d.ts
generated
vendored
Normal file
3
node_modules/apollo-server-core/dist/plugin/schemaIsFederated.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import { GraphQLSchema } from 'graphql';
|
||||
export declare function schemaIsFederated(schema: GraphQLSchema): boolean;
|
||||
//# sourceMappingURL=schemaIsFederated.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/schemaIsFederated.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/schemaIsFederated.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"schemaIsFederated.d.ts","sourceRoot":"","sources":["../../src/plugin/schemaIsFederated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA8B,MAAM,SAAS,CAAC;AAkBpE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAchE"}
|
||||
21
node_modules/apollo-server-core/dist/plugin/schemaIsFederated.js
generated
vendored
Normal file
21
node_modules/apollo-server-core/dist/plugin/schemaIsFederated.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.schemaIsFederated = void 0;
|
||||
const graphql_1 = require("graphql");
|
||||
function schemaIsFederated(schema) {
|
||||
const serviceType = schema.getType('_Service');
|
||||
if (!(serviceType && graphql_1.isObjectType(serviceType))) {
|
||||
return false;
|
||||
}
|
||||
const sdlField = serviceType.getFields().sdl;
|
||||
if (!sdlField) {
|
||||
return false;
|
||||
}
|
||||
const sdlFieldType = sdlField.type;
|
||||
if (!graphql_1.isScalarType(sdlFieldType)) {
|
||||
return false;
|
||||
}
|
||||
return sdlFieldType.name == 'String';
|
||||
}
|
||||
exports.schemaIsFederated = schemaIsFederated;
|
||||
//# sourceMappingURL=schemaIsFederated.js.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/schemaIsFederated.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/schemaIsFederated.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"schemaIsFederated.js","sourceRoot":"","sources":["../../src/plugin/schemaIsFederated.ts"],"names":[],"mappings":";;;AAAA,qCAAoE;AAkBpE,SAAgB,iBAAiB,CAAC,MAAqB;IACrD,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAC/C,IAAI,CAAC,CAAC,WAAW,IAAI,sBAAY,CAAC,WAAW,CAAC,CAAC,EAAE;QAC/C,OAAO,KAAK,CAAC;KACd;IACD,MAAM,QAAQ,GAAG,WAAW,CAAC,SAAS,EAAE,CAAC,GAAG,CAAC;IAC7C,IAAI,CAAC,QAAQ,EAAE;QACb,OAAO,KAAK,CAAC;KACd;IACD,MAAM,YAAY,GAAG,QAAQ,CAAC,IAAI,CAAC;IACnC,IAAI,CAAC,sBAAY,CAAC,YAAY,CAAC,EAAE;QAC/B,OAAO,KAAK,CAAC;KACd;IACD,OAAO,YAAY,CAAC,IAAI,IAAI,QAAQ,CAAC;AACvC,CAAC;AAdD,8CAcC"}
|
||||
11
node_modules/apollo-server-core/dist/plugin/schemaReporting/index.d.ts
generated
vendored
Normal file
11
node_modules/apollo-server-core/dist/plugin/schemaReporting/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import type { InternalApolloServerPlugin } from '../internalPlugin';
|
||||
import type { fetch } from 'apollo-server-env';
|
||||
export interface ApolloServerPluginSchemaReportingOptions {
|
||||
initialDelayMaxMs?: number;
|
||||
overrideReportedSchema?: string;
|
||||
endpointUrl?: string;
|
||||
fetcher?: typeof fetch;
|
||||
}
|
||||
export declare function ApolloServerPluginSchemaReporting({ initialDelayMaxMs, overrideReportedSchema, endpointUrl, fetcher, }?: ApolloServerPluginSchemaReportingOptions): InternalApolloServerPlugin;
|
||||
export declare function computeCoreSchemaHash(schema: string): string;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/schemaReporting/index.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/schemaReporting/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugin/schemaReporting/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAGpE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAM/C,MAAM,WAAW,wCAAwC;IAavD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAuB3B,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAKhC,WAAW,CAAC,EAAE,MAAM,CAAC;IAIrB,OAAO,CAAC,EAAE,OAAO,KAAK,CAAC;CACxB;AAED,wBAAgB,iCAAiC,CAC/C,EACE,iBAAiB,EACjB,sBAAsB,EACtB,WAAW,EACX,OAAO,GACR,GAAE,wCAA8D,GAChE,0BAA0B,CAwH5B;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE5D"}
|
||||
107
node_modules/apollo-server-core/dist/plugin/schemaReporting/index.js
generated
vendored
Normal file
107
node_modules/apollo-server-core/dist/plugin/schemaReporting/index.js
generated
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.computeCoreSchemaHash = exports.ApolloServerPluginSchemaReporting = void 0;
|
||||
const os_1 = __importDefault(require("os"));
|
||||
const uuid_1 = require("uuid");
|
||||
const graphql_1 = require("graphql");
|
||||
const schemaReporter_1 = require("./schemaReporter");
|
||||
const createSHA_1 = __importDefault(require("../../utils/createSHA"));
|
||||
const schemaIsFederated_1 = require("../schemaIsFederated");
|
||||
function ApolloServerPluginSchemaReporting({ initialDelayMaxMs, overrideReportedSchema, endpointUrl, fetcher, } = Object.create(null)) {
|
||||
const bootId = uuid_1.v4();
|
||||
return {
|
||||
__internal_plugin_id__() {
|
||||
return 'SchemaReporting';
|
||||
},
|
||||
serverWillStart({ apollo, schema, logger }) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const { key, graphRef } = apollo;
|
||||
if (!key) {
|
||||
throw Error('To use ApolloServerPluginSchemaReporting, you must provide an Apollo API ' +
|
||||
'key, via the APOLLO_KEY environment variable or via `new ApolloServer({apollo: {key})`');
|
||||
}
|
||||
if (!graphRef) {
|
||||
throw Error('To use ApolloServerPluginSchemaReporting, you must provide your graph ref (eg, ' +
|
||||
"'my-graph-id@my-graph-variant'). Try setting the APOLLO_GRAPH_REF environment " +
|
||||
'variable or passing `new ApolloServer({apollo: {graphRef}})`.');
|
||||
}
|
||||
if (overrideReportedSchema) {
|
||||
try {
|
||||
const validationErrors = graphql_1.validateSchema(graphql_1.buildSchema(overrideReportedSchema, { noLocation: true }));
|
||||
if (validationErrors.length) {
|
||||
throw new Error(validationErrors.map((error) => error.message).join('\n'));
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
throw new Error('The schema provided to overrideReportedSchema failed to parse or ' +
|
||||
`validate: ${err.message}`);
|
||||
}
|
||||
}
|
||||
if (schemaIsFederated_1.schemaIsFederated(schema)) {
|
||||
throw Error([
|
||||
'Schema reporting is not yet compatible with federated services.',
|
||||
"If you're interested in using schema reporting with federated",
|
||||
'services, please contact Apollo support. To set up managed federation, see',
|
||||
'https://go.apollo.dev/s/managed-federation',
|
||||
].join(' '));
|
||||
}
|
||||
const coreSchema = overrideReportedSchema !== null && overrideReportedSchema !== void 0 ? overrideReportedSchema : graphql_1.printSchema(schema);
|
||||
const coreSchemaHash = computeCoreSchemaHash(coreSchema);
|
||||
if (overrideReportedSchema !== undefined) {
|
||||
logger.info('Apollo schema reporting: schema to report has been overridden');
|
||||
}
|
||||
if (endpointUrl !== undefined) {
|
||||
logger.info(`Apollo schema reporting: schema reporting URL override: ${endpointUrl}`);
|
||||
}
|
||||
const schemaReport = {
|
||||
bootId,
|
||||
graphRef,
|
||||
platform: process.env.APOLLO_SERVER_PLATFORM || 'local',
|
||||
runtimeVersion: `node ${process.version}`,
|
||||
coreSchemaHash,
|
||||
userVersion: process.env.APOLLO_SERVER_USER_VERSION,
|
||||
serverId: process.env.APOLLO_SERVER_ID || process.env.HOSTNAME || os_1.default.hostname(),
|
||||
libraryVersion: `apollo-server-core@${require('../../../package.json').version}`,
|
||||
};
|
||||
logger.info('Apollo schema reporting starting! See your graph at ' +
|
||||
`https://studio.apollographql.com/graph/${encodeURI(graphRef)}/ with server info ${JSON.stringify(schemaReport)}`);
|
||||
const schemaReporter = new schemaReporter_1.SchemaReporter({
|
||||
schemaReport,
|
||||
coreSchema,
|
||||
apiKey: key,
|
||||
endpointUrl,
|
||||
logger,
|
||||
initialReportingDelayInMs: Math.floor(Math.random() * (initialDelayMaxMs !== null && initialDelayMaxMs !== void 0 ? initialDelayMaxMs : 10000)),
|
||||
fallbackReportingDelayInMs: 20000,
|
||||
fetcher,
|
||||
});
|
||||
schemaReporter.start();
|
||||
return {
|
||||
serverWillStop() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
schemaReporter.stop();
|
||||
});
|
||||
},
|
||||
};
|
||||
});
|
||||
},
|
||||
};
|
||||
}
|
||||
exports.ApolloServerPluginSchemaReporting = ApolloServerPluginSchemaReporting;
|
||||
function computeCoreSchemaHash(schema) {
|
||||
return createSHA_1.default('sha256').update(schema).digest('hex');
|
||||
}
|
||||
exports.computeCoreSchemaHash = computeCoreSchemaHash;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/schemaReporting/index.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/schemaReporting/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugin/schemaReporting/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAoB;AAEpB,+BAAoC;AACpC,qCAAmE;AAEnE,qDAAkD;AAClD,sEAA8C;AAC9C,4DAAyD;AAmDzD,SAAgB,iCAAiC,CAC/C,EACE,iBAAiB,EACjB,sBAAsB,EACtB,WAAW,EACX,OAAO,MACqC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;IAEjE,MAAM,MAAM,GAAG,SAAM,EAAE,CAAC;IAExB,OAAO;QACL,sBAAsB;YACpB,OAAO,iBAAiB,CAAC;QAC3B,CAAC;QACK,eAAe,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE;;gBAC9C,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;gBACjC,IAAI,CAAC,GAAG,EAAE;oBACR,MAAM,KAAK,CACT,2EAA2E;wBACzE,wFAAwF,CAC3F,CAAC;iBACH;gBACD,IAAI,CAAC,QAAQ,EAAE;oBAGb,MAAM,KAAK,CACT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,EAAE,QAAQ,OAAO,CAAC,OAAO,EAAE;oBACzC,cAAc;oBAGd,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,0BAA0B;oBAEnD,QAAQ,EACN,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,YAAE,CAAC,QAAQ,EAAE;oBACvE,cAAc,EAAE,sBACd,OAAO,CAAC,uBAAuB,CAAC,CAAC,OACnC,EAAE;iBACH,CAAC;gBAEF,MAAM,CAAC,IAAI,CACT,sDAAsD;oBACpD,0CAA0C,SAAS,CACjD,QAAQ,CACT,sBAAsB,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE,CACxD,CAAC;gBAEF,MAAM,cAAc,GAAG,IAAI,+BAAc,CAAC;oBACxC,YAAY;oBACZ,UAAU;oBACV,MAAM,EAAE,GAAG;oBACX,WAAW;oBACX,MAAM;oBAEN,yBAAyB,EAAE,IAAI,CAAC,KAAK,CACnC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,iBAAiB,aAAjB,iBAAiB,cAAjB,iBAAiB,GAAI,KAAM,CAAC,CAC9C;oBACD,0BAA0B,EAAE,KAAM;oBAClC,OAAO;iBACR,CAAC,CAAC;gBAEH,cAAc,CAAC,KAAK,EAAE,CAAC;gBAEvB,OAAO;oBACC,cAAc;;4BAClB,cAAc,CAAC,IAAI,EAAE,CAAC;wBACxB,CAAC;qBAAA;iBACF,CAAC;YACJ,CAAC;SAAA;KACF,CAAC;AACJ,CAAC;AA/HD,8EA+HC;AAED,SAAgB,qBAAqB,CAAC,MAAc;IAClD,OAAO,mBAAS,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC1D,CAAC;AAFD,sDAEC"}
|
||||
33
node_modules/apollo-server-core/dist/plugin/schemaReporting/schemaReporter.d.ts
generated
vendored
Normal file
33
node_modules/apollo-server-core/dist/plugin/schemaReporting/schemaReporter.d.ts
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
import { fetch } from 'apollo-server-env';
|
||||
import { Logger } from 'apollo-server-types';
|
||||
import { SchemaReport, ReportSchemaResponse } from './operations';
|
||||
export declare const schemaReportGql: string;
|
||||
export declare class SchemaReporter {
|
||||
private readonly schemaReport;
|
||||
private readonly coreSchema;
|
||||
private readonly endpointUrl;
|
||||
private readonly logger;
|
||||
private readonly initialReportingDelayInMs;
|
||||
private readonly fallbackReportingDelayInMs;
|
||||
private readonly fetcher;
|
||||
private isStopped;
|
||||
private pollTimer?;
|
||||
private readonly headers;
|
||||
constructor(options: {
|
||||
schemaReport: SchemaReport;
|
||||
coreSchema: string;
|
||||
apiKey: string;
|
||||
endpointUrl: string | undefined;
|
||||
logger: Logger;
|
||||
initialReportingDelayInMs: number;
|
||||
fallbackReportingDelayInMs: number;
|
||||
fetcher?: typeof fetch;
|
||||
});
|
||||
stopped(): Boolean;
|
||||
start(): void;
|
||||
stop(): void;
|
||||
private sendOneReportAndScheduleNext;
|
||||
reportSchema(withCoreSchema: boolean): Promise<ReportSchemaResponse | null>;
|
||||
private apolloQuery;
|
||||
}
|
||||
//# sourceMappingURL=schemaReporter.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/schemaReporting/schemaReporter.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/schemaReporting/schemaReporter.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"schemaReporter.d.ts","sourceRoot":"","sources":["../../../src/plugin/schemaReporting/schemaReporter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAoB,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAkB,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,EACL,YAAY,EAGZ,oBAAoB,EACrB,MAAM,cAAc,CAAC;AAEtB,eAAO,MAAM,eAAe,QAc1B,CAAC;AAGH,qBAAa,cAAc;IAEzB,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAe;IAC5C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAAS;IACnD,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CAAS;IACpD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAe;IAEvC,OAAO,CAAC,SAAS,CAAU;IAC3B,OAAO,CAAC,SAAS,CAAC,CAAe;IACjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;gBAEtB,OAAO,EAAE;QACnB,YAAY,EAAE,YAAY,CAAC;QAC3B,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,EAAE,MAAM,CAAC;QACf,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;QAChC,MAAM,EAAE,MAAM,CAAC;QACf,yBAAyB,EAAE,MAAM,CAAC;QAClC,0BAA0B,EAAE,MAAM,CAAC;QACnC,OAAO,CAAC,EAAE,OAAO,KAAK,CAAC;KACxB;IA0BM,OAAO,IAAI,OAAO;IAIlB,KAAK;IAOL,IAAI;YAQG,4BAA4B;IAiC7B,YAAY,CACvB,cAAc,EAAE,OAAO,GACtB,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;YAwCzB,WAAW;CAuC1B"}
|
||||
155
node_modules/apollo-server-core/dist/plugin/schemaReporting/schemaReporter.js
generated
vendored
Normal file
155
node_modules/apollo-server-core/dist/plugin/schemaReporting/schemaReporter.js
generated
vendored
Normal file
@@ -0,0 +1,155 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SchemaReporter = exports.schemaReportGql = void 0;
|
||||
const __1 = require("../..");
|
||||
const apollo_server_env_1 = require("apollo-server-env");
|
||||
const graphql_1 = require("graphql");
|
||||
exports.schemaReportGql = graphql_1.print(__1.gql `
|
||||
mutation SchemaReport($report: SchemaReport!, $coreSchema: String) {
|
||||
reportSchema(report: $report, coreSchema: $coreSchema) {
|
||||
__typename
|
||||
... on ReportSchemaError {
|
||||
message
|
||||
code
|
||||
}
|
||||
... on ReportSchemaResponse {
|
||||
inSeconds
|
||||
withCoreSchema
|
||||
}
|
||||
}
|
||||
}
|
||||
`);
|
||||
class SchemaReporter {
|
||||
constructor(options) {
|
||||
var _a;
|
||||
this.headers = new apollo_server_env_1.Headers();
|
||||
this.headers.set('Content-Type', 'application/json');
|
||||
this.headers.set('x-api-key', options.apiKey);
|
||||
this.headers.set('apollographql-client-name', 'ApolloServerPluginSchemaReporting');
|
||||
this.headers.set('apollographql-client-version', require('../../../package.json').version);
|
||||
this.endpointUrl =
|
||||
options.endpointUrl ||
|
||||
'https://schema-reporting.api.apollographql.com/api/graphql';
|
||||
this.schemaReport = options.schemaReport;
|
||||
this.coreSchema = options.coreSchema;
|
||||
this.isStopped = false;
|
||||
this.logger = options.logger;
|
||||
this.initialReportingDelayInMs = options.initialReportingDelayInMs;
|
||||
this.fallbackReportingDelayInMs = options.fallbackReportingDelayInMs;
|
||||
this.fetcher = (_a = options.fetcher) !== null && _a !== void 0 ? _a : apollo_server_env_1.fetch;
|
||||
}
|
||||
stopped() {
|
||||
return this.isStopped;
|
||||
}
|
||||
start() {
|
||||
this.pollTimer = setTimeout(() => this.sendOneReportAndScheduleNext(false), this.initialReportingDelayInMs);
|
||||
}
|
||||
stop() {
|
||||
this.isStopped = true;
|
||||
if (this.pollTimer) {
|
||||
clearTimeout(this.pollTimer);
|
||||
this.pollTimer = undefined;
|
||||
}
|
||||
}
|
||||
sendOneReportAndScheduleNext(sendNextWithCoreSchema) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
this.pollTimer = undefined;
|
||||
if (this.stopped())
|
||||
return;
|
||||
try {
|
||||
const result = yield this.reportSchema(sendNextWithCoreSchema);
|
||||
if (!result) {
|
||||
return;
|
||||
}
|
||||
if (!this.stopped()) {
|
||||
this.pollTimer = setTimeout(() => this.sendOneReportAndScheduleNext(result.withCoreSchema), result.inSeconds * 1000);
|
||||
}
|
||||
return;
|
||||
}
|
||||
catch (error) {
|
||||
this.logger.error(`Error reporting server info to Apollo during schema reporting: ${error}`);
|
||||
if (!this.stopped()) {
|
||||
this.pollTimer = setTimeout(() => this.sendOneReportAndScheduleNext(false), this.fallbackReportingDelayInMs);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
reportSchema(withCoreSchema) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const { data, errors } = yield this.apolloQuery({
|
||||
report: this.schemaReport,
|
||||
coreSchema: withCoreSchema ? this.coreSchema : null,
|
||||
});
|
||||
if (errors) {
|
||||
throw new Error(errors.map((x) => x.message).join('\n'));
|
||||
}
|
||||
function msgForUnexpectedResponse(data) {
|
||||
return [
|
||||
'Unexpected response shape from Apollo when',
|
||||
'reporting schema. If this continues, please reach',
|
||||
'out to support@apollographql.com.',
|
||||
'Received response:',
|
||||
JSON.stringify(data),
|
||||
].join(' ');
|
||||
}
|
||||
if (!data || !data.reportSchema) {
|
||||
throw new Error(msgForUnexpectedResponse(data));
|
||||
}
|
||||
if (data.reportSchema.__typename === 'ReportSchemaResponse') {
|
||||
return data.reportSchema;
|
||||
}
|
||||
else if (data.reportSchema.__typename === 'ReportSchemaError') {
|
||||
this.logger.error([
|
||||
'Received input validation error from Apollo:',
|
||||
data.reportSchema.message,
|
||||
'Stopping reporting. Please fix the input errors.',
|
||||
].join(' '));
|
||||
this.stop();
|
||||
return null;
|
||||
}
|
||||
throw new Error(msgForUnexpectedResponse(data));
|
||||
});
|
||||
}
|
||||
apolloQuery(variables) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const request = {
|
||||
query: exports.schemaReportGql,
|
||||
variables,
|
||||
};
|
||||
const httpRequest = new apollo_server_env_1.Request(this.endpointUrl, {
|
||||
method: 'POST',
|
||||
headers: this.headers,
|
||||
body: JSON.stringify(request),
|
||||
});
|
||||
const httpResponse = yield this.fetcher(httpRequest);
|
||||
if (!httpResponse.ok) {
|
||||
throw new Error([
|
||||
`An unexpected HTTP status code (${httpResponse.status}) was`,
|
||||
'encountered during schema reporting.',
|
||||
].join(' '));
|
||||
}
|
||||
try {
|
||||
return yield httpResponse.json();
|
||||
}
|
||||
catch (error) {
|
||||
throw new Error([
|
||||
"Couldn't report schema to Apollo.",
|
||||
'Parsing response as JSON failed.',
|
||||
'If this continues please reach out to support@apollographql.com',
|
||||
error,
|
||||
].join(' '));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.SchemaReporter = SchemaReporter;
|
||||
//# sourceMappingURL=schemaReporter.js.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/schemaReporting/schemaReporter.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/schemaReporting/schemaReporter.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"schemaReporter.js","sourceRoot":"","sources":["../../../src/plugin/schemaReporting/schemaReporter.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6BAA4B;AAC5B,yDAA4D;AAE5D,qCAAgC;AAQnB,QAAA,eAAe,GAAG,eAAK,CAAC,OAAG,CAAA;;;;;;;;;;;;;;CAcvC,CAAC,CAAC;AAGH,MAAa,cAAc;IAczB,YAAY,OASX;;QACC,IAAI,CAAC,OAA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AAW,CAAC,CAAC;YAErD,IAAI,CAAC,YAAY,CAAC,EAAE,EAAE;gBACpB,MAAM,IAAI,KAAK,CACb;oBACE,mCAAmC,YAAY,CAAC,MAAM,OAAO;oBAC7D,sCAAsC;iBACvC,CAAC,IAAI,CAAC,GAAG,CAAC,CACZ,CAAC;aACH;YAED,IAAI;gBAGF,OAAO,MAAM,YAAY,CAAC,IAAI,EAAE,CAAC;aAClC;YAAC,OAAO,KAAK,EAAE;gBACd,MAAM,IAAI,KAAK,CACb;oBACE,mCAAmC;oBACnC,kCAAkC;oBAClC,iEAAiE;oBACjE,KAAK;iBACN,CAAC,IAAI,CAAC,GAAG,CAAC,CACZ,CAAC;aACH;QACH,CAAC;KAAA;CACF;AAtLD,wCAsLC"}
|
||||
26
node_modules/apollo-server-core/dist/plugin/traceTreeBuilder.d.ts
generated
vendored
Normal file
26
node_modules/apollo-server-core/dist/plugin/traceTreeBuilder.d.ts
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
import { GraphQLError, GraphQLResolveInfo } from 'graphql';
|
||||
import { Trace, google } from 'apollo-reporting-protobuf';
|
||||
import { Logger } from 'apollo-server-types';
|
||||
export declare class TraceTreeBuilder {
|
||||
private rootNode;
|
||||
private logger;
|
||||
trace: Trace;
|
||||
startHrTime?: [number, number];
|
||||
private stopped;
|
||||
private nodes;
|
||||
private readonly rewriteError?;
|
||||
constructor(options: {
|
||||
logger?: Logger;
|
||||
rewriteError?: (err: GraphQLError) => GraphQLError | null;
|
||||
});
|
||||
startTiming(): void;
|
||||
stopTiming(): void;
|
||||
willResolveField(info: GraphQLResolveInfo): () => void;
|
||||
didEncounterErrors(errors: readonly GraphQLError[]): void;
|
||||
private addProtobufError;
|
||||
private newNode;
|
||||
private ensureParentNode;
|
||||
private rewriteAndNormalizeError;
|
||||
}
|
||||
export declare function dateToProtoTimestamp(date: Date): google.protobuf.Timestamp;
|
||||
//# sourceMappingURL=traceTreeBuilder.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/traceTreeBuilder.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/traceTreeBuilder.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"traceTreeBuilder.d.ts","sourceRoot":"","sources":["../../src/plugin/traceTreeBuilder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAgB,MAAM,SAAS,CAAC;AACzE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAM7C,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAoB;IACpC,OAAO,CAAC,MAAM,CAAmB;IAC1B,KAAK,QAAsC;IAC3C,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,KAAK,CAEV;IACH,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAA6C;gBAExD,OAAO,EAAE;QAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,YAAY,KAAK,YAAY,GAAG,IAAI,CAAC;KAC3D;IAKM,WAAW;IAWX,UAAU;IAeV,gBAAgB,CAAC,IAAI,EAAE,kBAAkB,GAAG,MAAM,IAAI;IAuBtD,kBAAkB,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE;IA6BzD,OAAO,CAAC,gBAAgB;IA+BxB,OAAO,CAAC,OAAO;IAcf,OAAO,CAAC,gBAAgB;IAWxB,OAAO,CAAC,wBAAwB;CAmDjC;AAiDD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,SAAS,CAO1E"}
|
||||
160
node_modules/apollo-server-core/dist/plugin/traceTreeBuilder.js
generated
vendored
Normal file
160
node_modules/apollo-server-core/dist/plugin/traceTreeBuilder.js
generated
vendored
Normal file
@@ -0,0 +1,160 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.dateToProtoTimestamp = exports.TraceTreeBuilder = void 0;
|
||||
const graphql_1 = require("graphql");
|
||||
const apollo_reporting_protobuf_1 = require("apollo-reporting-protobuf");
|
||||
function internalError(message) {
|
||||
return new Error(`[internal apollo-server error] ${message}`);
|
||||
}
|
||||
class TraceTreeBuilder {
|
||||
constructor(options) {
|
||||
this.rootNode = new apollo_reporting_protobuf_1.Trace.Node();
|
||||
this.logger = console;
|
||||
this.trace = new apollo_reporting_protobuf_1.Trace({ root: this.rootNode });
|
||||
this.stopped = false;
|
||||
this.nodes = new Map([
|
||||
[responsePathAsString(), this.rootNode],
|
||||
]);
|
||||
this.rewriteError = options.rewriteError;
|
||||
if (options.logger)
|
||||
this.logger = options.logger;
|
||||
}
|
||||
startTiming() {
|
||||
if (this.startHrTime) {
|
||||
throw internalError('startTiming called twice!');
|
||||
}
|
||||
if (this.stopped) {
|
||||
throw internalError('startTiming called after stopTiming!');
|
||||
}
|
||||
this.trace.startTime = dateToProtoTimestamp(new Date());
|
||||
this.startHrTime = process.hrtime();
|
||||
}
|
||||
stopTiming() {
|
||||
if (!this.startHrTime) {
|
||||
throw internalError('stopTiming called before startTiming!');
|
||||
}
|
||||
if (this.stopped) {
|
||||
throw internalError('stopTiming called twice!');
|
||||
}
|
||||
this.trace.durationNs = durationHrTimeToNanos(process.hrtime(this.startHrTime));
|
||||
this.trace.endTime = dateToProtoTimestamp(new Date());
|
||||
this.stopped = true;
|
||||
}
|
||||
willResolveField(info) {
|
||||
if (!this.startHrTime) {
|
||||
throw internalError('willResolveField called before startTiming!');
|
||||
}
|
||||
if (this.stopped) {
|
||||
throw internalError('willResolveField called after stopTiming!');
|
||||
}
|
||||
const path = info.path;
|
||||
const node = this.newNode(path);
|
||||
node.type = info.returnType.toString();
|
||||
node.parentType = info.parentType.toString();
|
||||
node.startTime = durationHrTimeToNanos(process.hrtime(this.startHrTime));
|
||||
if (typeof path.key === 'string' && path.key !== info.fieldName) {
|
||||
node.originalFieldName = info.fieldName;
|
||||
}
|
||||
return () => {
|
||||
node.endTime = durationHrTimeToNanos(process.hrtime(this.startHrTime));
|
||||
};
|
||||
}
|
||||
didEncounterErrors(errors) {
|
||||
errors.forEach((err) => {
|
||||
if (err.extensions && err.extensions.serviceName) {
|
||||
return;
|
||||
}
|
||||
const errorForReporting = this.rewriteAndNormalizeError(err);
|
||||
if (errorForReporting === null) {
|
||||
return;
|
||||
}
|
||||
this.addProtobufError(errorForReporting.path, errorToProtobufError(errorForReporting));
|
||||
});
|
||||
}
|
||||
addProtobufError(path, error) {
|
||||
if (!this.startHrTime) {
|
||||
throw internalError('addProtobufError called before startTiming!');
|
||||
}
|
||||
if (this.stopped) {
|
||||
throw internalError('addProtobufError called after stopTiming!');
|
||||
}
|
||||
let node = this.rootNode;
|
||||
if (Array.isArray(path)) {
|
||||
const specificNode = this.nodes.get(path.join('.'));
|
||||
if (specificNode) {
|
||||
node = specificNode;
|
||||
}
|
||||
else {
|
||||
this.logger.warn(`Could not find node with path ${path.join('.')}; defaulting to put errors on root node.`);
|
||||
}
|
||||
}
|
||||
node.error.push(error);
|
||||
}
|
||||
newNode(path) {
|
||||
const node = new apollo_reporting_protobuf_1.Trace.Node();
|
||||
const id = path.key;
|
||||
if (typeof id === 'number') {
|
||||
node.index = id;
|
||||
}
|
||||
else {
|
||||
node.responseName = id;
|
||||
}
|
||||
this.nodes.set(responsePathAsString(path), node);
|
||||
const parentNode = this.ensureParentNode(path);
|
||||
parentNode.child.push(node);
|
||||
return node;
|
||||
}
|
||||
ensureParentNode(path) {
|
||||
const parentPath = responsePathAsString(path.prev);
|
||||
const parentNode = this.nodes.get(parentPath);
|
||||
if (parentNode) {
|
||||
return parentNode;
|
||||
}
|
||||
return this.newNode(path.prev);
|
||||
}
|
||||
rewriteAndNormalizeError(err) {
|
||||
if (this.rewriteError) {
|
||||
const clonedError = Object.assign(Object.create(Object.getPrototypeOf(err)), err);
|
||||
const rewrittenError = this.rewriteError(clonedError);
|
||||
if (rewrittenError === null) {
|
||||
return null;
|
||||
}
|
||||
if (!(rewrittenError instanceof graphql_1.GraphQLError)) {
|
||||
return err;
|
||||
}
|
||||
return new graphql_1.GraphQLError(rewrittenError.message, err.nodes, err.source, err.positions, err.path, err.originalError, rewrittenError.extensions || err.extensions);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
}
|
||||
exports.TraceTreeBuilder = TraceTreeBuilder;
|
||||
function durationHrTimeToNanos(hrtime) {
|
||||
return hrtime[0] * 1e9 + hrtime[1];
|
||||
}
|
||||
function responsePathAsString(p) {
|
||||
if (p === undefined) {
|
||||
return '';
|
||||
}
|
||||
let res = String(p.key);
|
||||
while ((p = p.prev) !== undefined) {
|
||||
res = `${p.key}.${res}`;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
function errorToProtobufError(error) {
|
||||
return new apollo_reporting_protobuf_1.Trace.Error({
|
||||
message: error.message,
|
||||
location: (error.locations || []).map(({ line, column }) => new apollo_reporting_protobuf_1.Trace.Location({ line, column })),
|
||||
json: JSON.stringify(error),
|
||||
});
|
||||
}
|
||||
function dateToProtoTimestamp(date) {
|
||||
const totalMillis = +date;
|
||||
const millis = totalMillis % 1000;
|
||||
return new apollo_reporting_protobuf_1.google.protobuf.Timestamp({
|
||||
seconds: (totalMillis - millis) / 1000,
|
||||
nanos: millis * 1e6,
|
||||
});
|
||||
}
|
||||
exports.dateToProtoTimestamp = dateToProtoTimestamp;
|
||||
//# sourceMappingURL=traceTreeBuilder.js.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/traceTreeBuilder.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/traceTreeBuilder.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
node_modules/apollo-server-core/dist/plugin/usageReporting/defaultSendOperationsAsTrace.d.ts
generated
vendored
Normal file
3
node_modules/apollo-server-core/dist/plugin/usageReporting/defaultSendOperationsAsTrace.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { Trace } from 'apollo-reporting-protobuf';
|
||||
export declare function defaultSendOperationsAsTrace(): (trace: Trace, statsReportKey: string) => boolean;
|
||||
//# sourceMappingURL=defaultSendOperationsAsTrace.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/defaultSendOperationsAsTrace.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/defaultSendOperationsAsTrace.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"defaultSendOperationsAsTrace.d.ts","sourceRoot":"","sources":["../../../src/plugin/usageReporting/defaultSendOperationsAsTrace.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAIvD,wBAAgB,4BAA4B,YAwB3B,KAAK,kBAAkB,MAAM,KAAG,OAAO,CAyBvD"}
|
||||
50
node_modules/apollo-server-core/dist/plugin/usageReporting/defaultSendOperationsAsTrace.js
generated
vendored
Normal file
50
node_modules/apollo-server-core/dist/plugin/usageReporting/defaultSendOperationsAsTrace.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.defaultSendOperationsAsTrace = void 0;
|
||||
const lru_cache_1 = __importDefault(require("lru-cache"));
|
||||
const iterateOverTrace_1 = require("./iterateOverTrace");
|
||||
const durationHistogram_1 = require("./durationHistogram");
|
||||
function defaultSendOperationsAsTrace() {
|
||||
const cache = new lru_cache_1.default({
|
||||
max: Math.pow(2, 20),
|
||||
length: (_val, key) => {
|
||||
return (key && Buffer.byteLength(key)) || 0;
|
||||
},
|
||||
});
|
||||
return (trace, statsReportKey) => {
|
||||
var _a;
|
||||
const endTimeSeconds = (_a = trace.endTime) === null || _a === void 0 ? void 0 : _a.seconds;
|
||||
if (endTimeSeconds == null) {
|
||||
throw Error('programming error: endTime not set on trace');
|
||||
}
|
||||
const hasErrors = traceHasErrors(trace);
|
||||
const cacheKey = JSON.stringify([
|
||||
statsReportKey,
|
||||
durationHistogram_1.DurationHistogram.durationToBucket(trace.durationNs),
|
||||
Math.floor(endTimeSeconds / 60),
|
||||
hasErrors ? Math.floor(endTimeSeconds / 5) : '',
|
||||
]);
|
||||
if (cache.get(cacheKey)) {
|
||||
return false;
|
||||
}
|
||||
cache.set(cacheKey, true);
|
||||
return true;
|
||||
};
|
||||
}
|
||||
exports.defaultSendOperationsAsTrace = defaultSendOperationsAsTrace;
|
||||
function traceHasErrors(trace) {
|
||||
let hasErrors = false;
|
||||
function traceNodeStats(node) {
|
||||
var _a, _b;
|
||||
if (((_b = (_a = node.error) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0) {
|
||||
hasErrors = true;
|
||||
}
|
||||
return hasErrors;
|
||||
}
|
||||
iterateOverTrace_1.iterateOverTrace(trace, traceNodeStats, false);
|
||||
return hasErrors;
|
||||
}
|
||||
//# sourceMappingURL=defaultSendOperationsAsTrace.js.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/defaultSendOperationsAsTrace.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/defaultSendOperationsAsTrace.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"defaultSendOperationsAsTrace.js","sourceRoot":"","sources":["../../../src/plugin/usageReporting/defaultSendOperationsAsTrace.ts"],"names":[],"mappings":";;;;;;AAAA,0DAAiC;AAEjC,yDAAsD;AACtD,2DAAwD;AAExD,SAAgB,4BAA4B;IAO1C,MAAM,KAAK,GAAG,IAAI,mBAAQ,CAAe;QAWvC,GAAG,EAAE,IAAI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B,CAAC;IAED,mCAAgB,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,CAAC,CAAC;IAC/C,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
||||
16
node_modules/apollo-server-core/dist/plugin/usageReporting/durationHistogram.d.ts
generated
vendored
Normal file
16
node_modules/apollo-server-core/dist/plugin/usageReporting/durationHistogram.d.ts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
export interface DurationHistogramOptions {
|
||||
initSize?: number;
|
||||
buckets?: number[];
|
||||
}
|
||||
export declare class DurationHistogram {
|
||||
private readonly buckets;
|
||||
static readonly BUCKET_COUNT = 384;
|
||||
static readonly EXPONENT_LOG: number;
|
||||
toArray(): number[];
|
||||
static durationToBucket(durationNs: number): number;
|
||||
incrementDuration(durationNs: number): DurationHistogram;
|
||||
incrementBucket(bucket: number, value?: number): void;
|
||||
combine(otherHistogram: DurationHistogram): void;
|
||||
constructor(options?: DurationHistogramOptions);
|
||||
}
|
||||
//# sourceMappingURL=durationHistogram.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/durationHistogram.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/durationHistogram.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"durationHistogram.d.ts","sourceRoot":"","sources":["../../../src/plugin/usageReporting/durationHistogram.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AACD,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAW;IACnC,MAAM,CAAC,QAAQ,CAAC,YAAY,OAAO;IACnC,MAAM,CAAC,QAAQ,CAAC,YAAY,SAAiB;IAE7C,OAAO,IAAI,MAAM,EAAE;IAoBnB,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;IAYnD,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,iBAAiB;IAKxD,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,SAAI;IAgBzC,OAAO,CAAC,cAAc,EAAE,iBAAiB;gBAM7B,OAAO,CAAC,EAAE,wBAAwB;CAY/C"}
|
||||
67
node_modules/apollo-server-core/dist/plugin/usageReporting/durationHistogram.js
generated
vendored
Normal file
67
node_modules/apollo-server-core/dist/plugin/usageReporting/durationHistogram.js
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.DurationHistogram = void 0;
|
||||
class DurationHistogram {
|
||||
constructor(options) {
|
||||
const initSize = (options === null || options === void 0 ? void 0 : options.initSize) || 74;
|
||||
const buckets = options === null || options === void 0 ? void 0 : options.buckets;
|
||||
const arrayInitSize = Math.max((buckets === null || buckets === void 0 ? void 0 : buckets.length) || 0, initSize);
|
||||
this.buckets = Array(arrayInitSize).fill(0);
|
||||
if (buckets) {
|
||||
buckets.forEach((val, index) => (this.buckets[index] = val));
|
||||
}
|
||||
}
|
||||
toArray() {
|
||||
let bufferedZeroes = 0;
|
||||
const outputArray = [];
|
||||
for (const value of this.buckets) {
|
||||
if (value === 0) {
|
||||
bufferedZeroes++;
|
||||
}
|
||||
else {
|
||||
if (bufferedZeroes === 1) {
|
||||
outputArray.push(0);
|
||||
}
|
||||
else if (bufferedZeroes !== 0) {
|
||||
outputArray.push(-bufferedZeroes);
|
||||
}
|
||||
outputArray.push(value);
|
||||
bufferedZeroes = 0;
|
||||
}
|
||||
}
|
||||
return outputArray;
|
||||
}
|
||||
static durationToBucket(durationNs) {
|
||||
const log = Math.log(durationNs / 1000.0);
|
||||
const unboundedBucket = Math.ceil(log / DurationHistogram.EXPONENT_LOG);
|
||||
return unboundedBucket <= 0 || Number.isNaN(unboundedBucket)
|
||||
? 0
|
||||
: unboundedBucket >= DurationHistogram.BUCKET_COUNT
|
||||
? DurationHistogram.BUCKET_COUNT - 1
|
||||
: unboundedBucket;
|
||||
}
|
||||
incrementDuration(durationNs) {
|
||||
this.incrementBucket(DurationHistogram.durationToBucket(durationNs));
|
||||
return this;
|
||||
}
|
||||
incrementBucket(bucket, value = 1) {
|
||||
if (bucket >= DurationHistogram.BUCKET_COUNT) {
|
||||
throw Error('Bucket is out of bounds of the buckets array');
|
||||
}
|
||||
if (bucket >= this.buckets.length) {
|
||||
const oldLength = this.buckets.length;
|
||||
this.buckets.length = bucket + 1;
|
||||
this.buckets.fill(0, oldLength);
|
||||
}
|
||||
this.buckets[bucket] += value;
|
||||
}
|
||||
combine(otherHistogram) {
|
||||
for (let i = 0; i < otherHistogram.buckets.length; i++) {
|
||||
this.incrementBucket(i, otherHistogram.buckets[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.DurationHistogram = DurationHistogram;
|
||||
DurationHistogram.BUCKET_COUNT = 384;
|
||||
DurationHistogram.EXPONENT_LOG = Math.log(1.1);
|
||||
//# sourceMappingURL=durationHistogram.js.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/durationHistogram.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/durationHistogram.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"durationHistogram.js","sourceRoot":"","sources":["../../../src/plugin/usageReporting/durationHistogram.ts"],"names":[],"mappings":";;;AAIA,MAAa,iBAAiB;IAgE5B,YAAY,OAAkC;QAC5C,MAAM,QAAQ,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,KAAI,EAAE,CAAC;QACzC,MAAM,OAAO,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,CAAC;QAEjC,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,KAAI,CAAC,EAAE,QAAQ,C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ACpC,CAAC,CAAC,eAAe,CAAC;IACtB,CAAC;IAED,iBAAiB,CAAC,UAAkB;QAClC,IAAI,CAAC,eAAe,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC,CAAC;QACrE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,eAAe,CAAC,MAAc,EAAE,KAAK,GAAG,CAAC;QACvC,IAAI,MAAM,IAAI,iBAAiB,CAAC,YAAY,EAAE;YAE5C,MAAM,KAAK,CAAC,8CAA8C,CAAC,CAAC;SAC7D;QAGD,IAAI,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;YACjC,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;YACtC,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC;YACjC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;SACjC;QAED,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC;IAChC,CAAC;IAED,OAAO,CAAC,cAAiC;QACvC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACtD,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;SACpD;IACH,CAAC;;AA9DH,8CA4EC;AA1EiB,8BAAY,GAAG,GAAG,CAAC;AACnB,8BAAY,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC"}
|
||||
4
node_modules/apollo-server-core/dist/plugin/usageReporting/index.d.ts
generated
vendored
Normal file
4
node_modules/apollo-server-core/dist/plugin/usageReporting/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export { ApolloServerPluginUsageReporting, ApolloServerPluginUsageReportingDisabled, } from './plugin';
|
||||
export { ApolloServerPluginUsageReportingOptions, SendValuesBaseOptions, VariableValueOptions, ClientInfo, GenerateClientInfo, } from './options';
|
||||
export { ApolloServerPluginUsageReportingFromLegacyOptions, EngineReportingOptions, } from './legacyOptions';
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/index.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugin/usageReporting/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gCAAgC,EAChC,wCAAwC,GACzC,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,uCAAuC,EACvC,qBAAqB,EACrB,oBAAoB,EACpB,UAAU,EACV,kBAAkB,GACnB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,iDAAiD,EACjD,sBAAsB,GACvB,MAAM,iBAAiB,CAAC"}
|
||||
8
node_modules/apollo-server-core/dist/plugin/usageReporting/index.js
generated
vendored
Normal file
8
node_modules/apollo-server-core/dist/plugin/usageReporting/index.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var plugin_1 = require("./plugin");
|
||||
Object.defineProperty(exports, "ApolloServerPluginUsageReporting", { enumerable: true, get: function () { return plugin_1.ApolloServerPluginUsageReporting; } });
|
||||
Object.defineProperty(exports, "ApolloServerPluginUsageReportingDisabled", { enumerable: true, get: function () { return plugin_1.ApolloServerPluginUsageReportingDisabled; } });
|
||||
var legacyOptions_1 = require("./legacyOptions");
|
||||
Object.defineProperty(exports, "ApolloServerPluginUsageReportingFromLegacyOptions", { enumerable: true, get: function () { return legacyOptions_1.ApolloServerPluginUsageReportingFromLegacyOptions; } });
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/index.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugin/usageReporting/index.ts"],"names":[],"mappings":";;AAAA,mCAGkB;AAFhB,0HAAA,gCAAgC,OAAA;AAChC,kIAAA,wCAAwC,OAAA;AAS1C,iDAGyB;AAFvB,kJAAA,iDAAiD,OAAA"}
|
||||
7
node_modules/apollo-server-core/dist/plugin/usageReporting/iterateOverTrace.d.ts
generated
vendored
Normal file
7
node_modules/apollo-server-core/dist/plugin/usageReporting/iterateOverTrace.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import { Trace } from 'apollo-reporting-protobuf';
|
||||
export declare function iterateOverTrace(trace: Trace, f: (node: Trace.INode, path: ResponseNamePath) => boolean, includePath: boolean): void;
|
||||
export interface ResponseNamePath {
|
||||
toArray(): string[];
|
||||
child(responseName: string): ResponseNamePath;
|
||||
}
|
||||
//# sourceMappingURL=iterateOverTrace.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/iterateOverTrace.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/iterateOverTrace.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"iterateOverTrace.d.ts","sourceRoot":"","sources":["../../../src/plugin/usageReporting/iterateOverTrace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAoBlD,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,KAAK,EACZ,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,gBAAgB,KAAK,OAAO,EACzD,WAAW,EAAE,OAAO,QAYrB;AA8DD,MAAM,WAAW,gBAAgB;IAC/B,OAAO,IAAI,MAAM,EAAE,CAAC;IACpB,KAAK,CAAC,YAAY,EAAE,MAAM,GAAG,gBAAgB,CAAC;CAC/C"}
|
||||
82
node_modules/apollo-server-core/dist/plugin/usageReporting/iterateOverTrace.js
generated
vendored
Normal file
82
node_modules/apollo-server-core/dist/plugin/usageReporting/iterateOverTrace.js
generated
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.iterateOverTrace = void 0;
|
||||
function iterateOverTrace(trace, f, includePath) {
|
||||
const rootPath = includePath
|
||||
? new RootCollectingPathsResponseNamePath()
|
||||
: notCollectingPathsResponseNamePath;
|
||||
if (trace.root) {
|
||||
if (iterateOverTraceNode(trace.root, rootPath, f))
|
||||
return;
|
||||
}
|
||||
if (trace.queryPlan) {
|
||||
if (iterateOverQueryPlan(trace.queryPlan, rootPath, f))
|
||||
return;
|
||||
}
|
||||
}
|
||||
exports.iterateOverTrace = iterateOverTrace;
|
||||
function iterateOverQueryPlan(node, rootPath, f) {
|
||||
var _a, _b, _c, _d, _e;
|
||||
if (!node)
|
||||
return false;
|
||||
if (((_b = (_a = node.fetch) === null || _a === void 0 ? void 0 : _a.trace) === null || _b === void 0 ? void 0 : _b.root) && node.fetch.serviceName) {
|
||||
return iterateOverTraceNode(node.fetch.trace.root, rootPath.child(`service:${node.fetch.serviceName}`), f);
|
||||
}
|
||||
if ((_c = node.flatten) === null || _c === void 0 ? void 0 : _c.node) {
|
||||
return iterateOverQueryPlan(node.flatten.node, rootPath, f);
|
||||
}
|
||||
if ((_d = node.parallel) === null || _d === void 0 ? void 0 : _d.nodes) {
|
||||
return node.parallel.nodes.some((node) => iterateOverQueryPlan(node, rootPath, f));
|
||||
}
|
||||
if ((_e = node.sequence) === null || _e === void 0 ? void 0 : _e.nodes) {
|
||||
return node.sequence.nodes.some((node) => iterateOverQueryPlan(node, rootPath, f));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function iterateOverTraceNode(node, path, f) {
|
||||
var _a, _b;
|
||||
if (f(node, path)) {
|
||||
return true;
|
||||
}
|
||||
return ((_b = (_a = node.child) === null || _a === void 0 ? void 0 : _a.some((child) => {
|
||||
const childPath = child.responseName
|
||||
? path.child(child.responseName)
|
||||
: path;
|
||||
return iterateOverTraceNode(child, childPath, f);
|
||||
})) !== null && _b !== void 0 ? _b : false);
|
||||
}
|
||||
const notCollectingPathsResponseNamePath = {
|
||||
toArray() {
|
||||
throw Error('not collecting paths!');
|
||||
},
|
||||
child() {
|
||||
return this;
|
||||
},
|
||||
};
|
||||
class RootCollectingPathsResponseNamePath {
|
||||
toArray() {
|
||||
return [];
|
||||
}
|
||||
child(responseName) {
|
||||
return new ChildCollectingPathsResponseNamePath(responseName, this);
|
||||
}
|
||||
}
|
||||
class ChildCollectingPathsResponseNamePath {
|
||||
constructor(responseName, prev) {
|
||||
this.responseName = responseName;
|
||||
this.prev = prev;
|
||||
}
|
||||
toArray() {
|
||||
const out = [];
|
||||
let curr = this;
|
||||
while (curr instanceof ChildCollectingPathsResponseNamePath) {
|
||||
out.push(curr.responseName);
|
||||
curr = curr.prev;
|
||||
}
|
||||
return out.reverse();
|
||||
}
|
||||
child(responseName) {
|
||||
return new ChildCollectingPathsResponseNamePath(responseName, this);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=iterateOverTrace.js.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/iterateOverTrace.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/iterateOverTrace.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"iterateOverTrace.js","sourceRoot":"","sources":["../../../src/plugin/usageReporting/iterateOverTrace.ts"],"names":[],"mappings":";;;AAoBA,SAAgB,gBAAgB,CAC9B,KAAY,EACZ,CAAyD,EACzD,WAAoB;IAEpB,MAAM,QAAQ,GAAG,WAAW;QAC1B,CAAC,CAAC,IAAI,mCAAmC,EAAE;QAC3C,CAAC,CAAC,kCAAkC,CAAC;IACvC,IAAI,KAAK,C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AC;IACvB,CAAC;IACD,KAAK,CAAC,YAAoB;QACxB,OAAO,IAAI,oCAAoC,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;IACtE,CAAC;CACF"}
|
||||
42
node_modules/apollo-server-core/dist/plugin/usageReporting/legacyOptions.d.ts
generated
vendored
Normal file
42
node_modules/apollo-server-core/dist/plugin/usageReporting/legacyOptions.d.ts
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
import { DocumentNode, GraphQLError } from 'graphql';
|
||||
import { RequestAgent } from 'apollo-server-env';
|
||||
import { Logger, GraphQLRequestContextDidResolveOperation, GraphQLRequestContextDidEncounterErrors } from 'apollo-server-types';
|
||||
import { ApolloServerPluginUsageReportingOptions, VariableValueOptions, SendValuesBaseOptions, GenerateClientInfo } from './options';
|
||||
import { ApolloServerPlugin } from 'apollo-server-plugin-base';
|
||||
export interface EngineReportingOptions<TContext> {
|
||||
apiKey?: string;
|
||||
calculateSignature?: (ast: DocumentNode, operationName: string) => string;
|
||||
reportIntervalMs?: number;
|
||||
maxUncompressedReportSize?: number;
|
||||
endpointUrl?: string;
|
||||
tracesEndpointUrl?: string;
|
||||
debugPrintReports?: boolean;
|
||||
requestAgent?: RequestAgent | false;
|
||||
maxAttempts?: number;
|
||||
minimumRetryDelayMs?: number;
|
||||
reportErrorFunction?: (err: Error) => void;
|
||||
sendVariableValues?: VariableValueOptions;
|
||||
reportTiming?: ReportTimingOptions<TContext>;
|
||||
privateVariables?: Array<String> | boolean;
|
||||
sendHeaders?: SendValuesBaseOptions;
|
||||
privateHeaders?: Array<String> | boolean;
|
||||
handleSignals?: boolean;
|
||||
sendReportsImmediately?: boolean;
|
||||
maskErrorDetails?: boolean;
|
||||
rewriteError?: (err: GraphQLError) => GraphQLError | null;
|
||||
schemaTag?: string;
|
||||
graphVariant?: string;
|
||||
generateClientInfo?: GenerateClientInfo<TContext>;
|
||||
reportSchema?: boolean;
|
||||
overrideReportedSchema?: string;
|
||||
schemaReportingInitialDelayMaxMs?: number;
|
||||
schemaReportingUrl?: string;
|
||||
logger?: Logger;
|
||||
experimental_schemaReporting?: boolean;
|
||||
experimental_overrideReportedSchema?: string;
|
||||
experimental_schemaReportingInitialDelayMaxMs?: number;
|
||||
}
|
||||
export declare type ReportTimingOptions<TContext> = ((request: GraphQLRequestContextDidResolveOperation<TContext> | GraphQLRequestContextDidEncounterErrors<TContext>) => Promise<boolean>) | boolean;
|
||||
export declare function ApolloServerPluginUsageReportingFromLegacyOptions<TContext>(options?: EngineReportingOptions<TContext>): ApolloServerPlugin;
|
||||
export declare function legacyOptionsToPluginOptions(engine: EngineReportingOptions<any>): ApolloServerPluginUsageReportingOptions<any>;
|
||||
//# sourceMappingURL=legacyOptions.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/legacyOptions.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/legacyOptions.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"legacyOptions.d.ts","sourceRoot":"","sources":["../../../src/plugin/usageReporting/legacyOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EACL,MAAM,EACN,wCAAwC,EACxC,uCAAuC,EACxC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,uCAAuC,EACvC,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAY/D,MAAM,WAAW,sBAAsB,CAAC,QAAQ;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kBAAkB,CAAC,EAAE,CAAC,GAAG,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,KAAK,MAAM,CAAC;IAC1E,gBAAgB,CAAC,EAAE,MA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C,6CAA6C,CAAC,EAAE,MAAM,CAAC;CACxD;AAED,oBAAY,mBAAmB,CAAC,QAAQ,IACpC,CAAC,CACC,OAAO,EACH,wCAAwC,CAAC,QAAQ,CAAC,GAClD,uCAAuC,CAAC,QAAQ,CAAC,KAClD,OAAO,CAAC,OAAO,CAAC,CAAC,GACtB,OAAO,CAAC;AAEZ,wBAAgB,iDAAiD,CAAC,QAAQ,EACxE,OAAO,GAAE,sBAAsB,CAAC,QAAQ,CAAuB,GAC9D,kBAAkB,CAIpB;AAOD,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,sBAAsB,CAAC,GAAG,CAAC,GAClC,uCAAuC,CAAC,GAAG,CAAC,CA0E9C"}
|
||||
82
node_modules/apollo-server-core/dist/plugin/usageReporting/legacyOptions.js
generated
vendored
Normal file
82
node_modules/apollo-server-core/dist/plugin/usageReporting/legacyOptions.js
generated
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.legacyOptionsToPluginOptions = exports.ApolloServerPluginUsageReportingFromLegacyOptions = void 0;
|
||||
const graphql_1 = require("graphql");
|
||||
const plugin_1 = require("./plugin");
|
||||
function ApolloServerPluginUsageReportingFromLegacyOptions(options = Object.create(null)) {
|
||||
return plugin_1.ApolloServerPluginUsageReporting(legacyOptionsToPluginOptions(options));
|
||||
}
|
||||
exports.ApolloServerPluginUsageReportingFromLegacyOptions = ApolloServerPluginUsageReportingFromLegacyOptions;
|
||||
function legacyOptionsToPluginOptions(engine) {
|
||||
var _a;
|
||||
const pluginOptions = {};
|
||||
pluginOptions.calculateSignature = engine.calculateSignature;
|
||||
pluginOptions.reportIntervalMs = engine.reportIntervalMs;
|
||||
pluginOptions.maxUncompressedReportSize = engine.maxUncompressedReportSize;
|
||||
pluginOptions.endpointUrl = (_a = engine.tracesEndpointUrl) !== null && _a !== void 0 ? _a : engine.endpointUrl;
|
||||
pluginOptions.debugPrintReports = engine.debugPrintReports;
|
||||
pluginOptions.requestAgent = engine.requestAgent;
|
||||
pluginOptions.maxAttempts = engine.maxAttempts;
|
||||
pluginOptions.minimumRetryDelayMs = engine.minimumRetryDelayMs;
|
||||
pluginOptions.reportErrorFunction = engine.reportErrorFunction;
|
||||
pluginOptions.sendVariableValues = engine.sendVariableValues;
|
||||
if (typeof engine.reportTiming === 'function') {
|
||||
pluginOptions.includeRequest = engine.reportTiming;
|
||||
}
|
||||
pluginOptions.sendHeaders = engine.sendHeaders;
|
||||
pluginOptions.sendReportsImmediately = engine.sendReportsImmediately;
|
||||
if (engine.maskErrorDetails && engine.rewriteError) {
|
||||
throw new Error("Can't set both maskErrorDetails and rewriteError!");
|
||||
}
|
||||
else if (engine.rewriteError && typeof engine.rewriteError !== 'function') {
|
||||
throw new Error('rewriteError must be a function');
|
||||
}
|
||||
else if (engine.maskErrorDetails) {
|
||||
pluginOptions.rewriteError = () => new graphql_1.GraphQLError('<masked>');
|
||||
delete engine.maskErrorDetails;
|
||||
}
|
||||
else if (engine.rewriteError) {
|
||||
pluginOptions.rewriteError = engine.rewriteError;
|
||||
}
|
||||
pluginOptions.generateClientInfo = engine.generateClientInfo;
|
||||
pluginOptions.logger = engine.logger;
|
||||
if (typeof engine.privateVariables !== 'undefined' &&
|
||||
engine.sendVariableValues) {
|
||||
throw new Error("You have set both the 'sendVariableValues' and the deprecated 'privateVariables' options. " +
|
||||
"Please only set 'sendVariableValues' (ideally, when calling `ApolloServerPluginUsageReporting` " +
|
||||
'instead of the deprecated `engine` option to the `ApolloServer` constructor).');
|
||||
}
|
||||
else if (typeof engine.privateVariables !== 'undefined') {
|
||||
if (engine.privateVariables !== null) {
|
||||
pluginOptions.sendVariableValues = makeSendValuesBaseOptionsFromLegacy(engine.privateVariables);
|
||||
}
|
||||
}
|
||||
else {
|
||||
pluginOptions.sendVariableValues = engine.sendVariableValues;
|
||||
}
|
||||
if (typeof engine.privateHeaders !== 'undefined' && engine.sendHeaders) {
|
||||
throw new Error("You have set both the 'sendHeaders' and the deprecated 'privateVariables' options. " +
|
||||
"Please only set 'sendHeaders' (ideally, when calling `ApolloServerPluginUsageReporting` " +
|
||||
'instead of the deprecated `engine` option to the `ApolloServer` constructor).');
|
||||
}
|
||||
else if (typeof engine.privateHeaders !== 'undefined') {
|
||||
if (engine.privateHeaders !== null) {
|
||||
pluginOptions.sendHeaders = makeSendValuesBaseOptionsFromLegacy(engine.privateHeaders);
|
||||
}
|
||||
}
|
||||
else {
|
||||
pluginOptions.sendHeaders = engine.sendHeaders;
|
||||
}
|
||||
return pluginOptions;
|
||||
}
|
||||
exports.legacyOptionsToPluginOptions = legacyOptionsToPluginOptions;
|
||||
function makeSendValuesBaseOptionsFromLegacy(legacyPrivateOption) {
|
||||
return Array.isArray(legacyPrivateOption)
|
||||
? {
|
||||
exceptNames: legacyPrivateOption,
|
||||
}
|
||||
: legacyPrivateOption
|
||||
? { none: true }
|
||||
: { all: true };
|
||||
}
|
||||
//# sourceMappingURL=legacyOptions.js.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/legacyOptions.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/legacyOptions.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"legacyOptions.js","sourceRoot":"","sources":["../../../src/plugin/usageReporting/legacyOptions.ts"],"names":[],"mappings":";;;AAAA,qCAAqD;AAcrD,qCAA4D;AAqD5D,SAAgB,iDAAiD,CAC/D,UAA4C,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;IAE/D,OAAO,yCAAgC,CACrC,4BAA4B,CAAC,OAAO,CAAC,CACtC,CAAC;AACJ,CAAC;AAND,8GAMC;AAOD,SAAgB,4BAA4B,CAC1C,MAAmC;;IAEnC,MAAM,aAAa,GAAiD,EAAE,CAAC;IAIvE,aAAa,CAAC,kBAAkB,GAAG,MAAM,CAAC,kBAAkB,CAAC;IAC7D,aAAa,CAAC,gBAAgB,GAAG,MAAM,CAAC,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EAAE,IAAI,EAAE;YAChB,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;AACpB,CAAC"}
|
||||
51
node_modules/apollo-server-core/dist/plugin/usageReporting/options.d.ts
generated
vendored
Normal file
51
node_modules/apollo-server-core/dist/plugin/usageReporting/options.d.ts
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
import { GraphQLError, DocumentNode } from 'graphql';
|
||||
import { GraphQLRequestContextDidResolveOperation, GraphQLRequestContextDidEncounterErrors, Logger, GraphQLRequestContext } from 'apollo-server-types';
|
||||
import type { fetch, RequestAgent } from 'apollo-server-env';
|
||||
import type { Trace } from 'apollo-reporting-protobuf';
|
||||
export interface ApolloServerPluginUsageReportingOptions<TContext> {
|
||||
sendVariableValues?: VariableValueOptions;
|
||||
sendHeaders?: SendValuesBaseOptions;
|
||||
rewriteError?: (err: GraphQLError) => GraphQLError | null;
|
||||
includeRequest?: (request: GraphQLRequestContextDidResolveOperation<TContext> | GraphQLRequestContextDidEncounterErrors<TContext>) => Promise<boolean>;
|
||||
generateClientInfo?: GenerateClientInfo<TContext>;
|
||||
overrideReportedSchema?: string;
|
||||
sendUnexecutableOperationDocuments?: boolean;
|
||||
experimental_sendOperationAsTrace?: (trace: Trace, statsReportKey: string) => boolean;
|
||||
sendReportsImmediately?: boolean;
|
||||
requestAgent?: RequestAgent | false;
|
||||
fetcher?: typeof fetch;
|
||||
reportIntervalMs?: number;
|
||||
maxUncompressedReportSize?: number;
|
||||
maxAttempts?: number;
|
||||
minimumRetryDelayMs?: number;
|
||||
logger?: Logger;
|
||||
reportErrorFunction?: (err: Error) => void;
|
||||
endpointUrl?: string;
|
||||
debugPrintReports?: boolean;
|
||||
calculateSignature?: (ast: DocumentNode, operationName: string) => string;
|
||||
internal_includeTracesContributingToStats?: boolean;
|
||||
}
|
||||
export declare type SendValuesBaseOptions = {
|
||||
onlyNames: Array<String>;
|
||||
} | {
|
||||
exceptNames: Array<String>;
|
||||
} | {
|
||||
all: true;
|
||||
} | {
|
||||
none: true;
|
||||
};
|
||||
declare type VariableValueTransformOptions = {
|
||||
variables: Record<string, any>;
|
||||
operationString?: string;
|
||||
};
|
||||
export declare type VariableValueOptions = {
|
||||
transform: (options: VariableValueTransformOptions) => Record<string, any>;
|
||||
} | SendValuesBaseOptions;
|
||||
export interface ClientInfo {
|
||||
clientName?: string;
|
||||
clientVersion?: string;
|
||||
clientReferenceId?: string;
|
||||
}
|
||||
export declare type GenerateClientInfo<TContext> = (requestContext: GraphQLRequestContext<TContext>) => ClientInfo;
|
||||
export {};
|
||||
//# sourceMappingURL=options.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/options.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/options.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/plugin/usageReporting/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EACL,wCAAwC,EACxC,uCAAuC,EACvC,MAAM,EACN,qBAAqB,EACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAEvD,MAAM,WAAW,uCAAuC,CAAC,QAAQ;IAiB/D,kBAAkB,CAAC,EAAE,oBAAoB,CAAC;IAiB1C,WAAW,CAAC,EAAE,qBAAqB,CAAC;IAOpC,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,YAAY,KAAK,YAAY,GAAG,IAAI,CAAC;IAwC1D,cAAc,CAAC,EAAE,CACf,OAAO,EACH,wCAAwC,CAAC,QAAQ,CAAC,GAClD,uCAAuC,CAAC,QAAQ,CAAC,KAClD,OAAO,CAAC,OAAO,CAAC,CAAC;IAQtB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,GAC5B;IACE,SAAS,EAAE,CACT,OAAO,EAAE,6BAA6B,KACnC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC1B,GACD,qBAAqB,CAAC;AAE1B,MAAM,WAAW,UAAU;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AACD,oBAAY,kBAAkB,CAAC,QAAQ,IAAI,CACzC,cAAc,EAAE,qBAAqB,CAAC,QAAQ,CAAC,KAC5C,UAAU,CAAC"}
|
||||
3
node_modules/apollo-server-core/dist/plugin/usageReporting/options.js
generated
vendored
Normal file
3
node_modules/apollo-server-core/dist/plugin/usageReporting/options.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=options.js.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/options.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/options.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../../src/plugin/usageReporting/options.ts"],"names":[],"mappings":""}
|
||||
8
node_modules/apollo-server-core/dist/plugin/usageReporting/plugin.d.ts
generated
vendored
Normal file
8
node_modules/apollo-server-core/dist/plugin/usageReporting/plugin.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import { Trace } from 'apollo-reporting-protobuf';
|
||||
import { Headers } from 'apollo-server-env';
|
||||
import { ApolloServerPluginUsageReportingOptions, SendValuesBaseOptions } from './options';
|
||||
import type { InternalApolloServerPlugin } from '../internalPlugin';
|
||||
export declare function ApolloServerPluginUsageReporting<TContext>(options?: ApolloServerPluginUsageReportingOptions<TContext>): InternalApolloServerPlugin;
|
||||
export declare function makeHTTPRequestHeaders(http: Trace.IHTTP, headers: Headers, sendHeaders?: SendValuesBaseOptions): void;
|
||||
export declare function ApolloServerPluginUsageReportingDisabled(): InternalApolloServerPlugin;
|
||||
//# sourceMappingURL=plugin.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/plugin.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/plugin.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/plugin/usageReporting/plugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAwB,KAAK,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAmB,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAc7D,OAAO,EACL,uCAAuC,EACvC,qBAAqB,EACtB,MAAM,WAAW,CAAC;AAKnB,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AA+BpE,wBAAgB,gCAAgC,CAAC,QAAQ,EACvD,OAAO,GAAE,uCAAuC,CAAC,QAAQ,CAExD,GACA,0BAA0B,CAspB5B;AAED,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,KAAK,CAAC,KAAK,EACjB,OAAO,EAAE,OAAO,EAChB,WAAW,CAAC,EAAE,qBAAqB,GAClC,IAAI,CAsCN;AA+BD,wBAAgB,wCAAwC,IAAI,0BAA0B,CAMrF"}
|
||||
470
node_modules/apollo-server-core/dist/plugin/usageReporting/plugin.js
generated
vendored
Normal file
470
node_modules/apollo-server-core/dist/plugin/usageReporting/plugin.js
generated
vendored
Normal file
@@ -0,0 +1,470 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ApolloServerPluginUsageReportingDisabled = exports.makeHTTPRequestHeaders = exports.ApolloServerPluginUsageReporting = void 0;
|
||||
const os_1 = __importDefault(require("os"));
|
||||
const zlib_1 = require("zlib");
|
||||
const async_retry_1 = __importDefault(require("async-retry"));
|
||||
const apollo_graphql_1 = require("apollo-graphql");
|
||||
const apollo_reporting_protobuf_1 = require("apollo-reporting-protobuf");
|
||||
const apollo_server_env_1 = require("apollo-server-env");
|
||||
const signatureCache_1 = require("./signatureCache");
|
||||
const traceTreeBuilder_1 = require("../traceTreeBuilder");
|
||||
const traceDetails_1 = require("./traceDetails");
|
||||
const graphql_1 = require("graphql");
|
||||
const schemaReporting_1 = require("../schemaReporting");
|
||||
const stats_1 = require("./stats");
|
||||
const apollo_cache_control_1 = require("apollo-cache-control");
|
||||
const defaultSendOperationsAsTrace_1 = require("./defaultSendOperationsAsTrace");
|
||||
const reportHeaderDefaults = {
|
||||
hostname: os_1.default.hostname(),
|
||||
agentVersion: `apollo-server-core@${require('../../../package.json').version}`,
|
||||
runtimeVersion: `node ${process.version}`,
|
||||
uname: `${os_1.default.platform()}, ${os_1.default.type()}, ${os_1.default.release()}, ${os_1.default.arch()})`,
|
||||
};
|
||||
class ReportData {
|
||||
constructor(executableSchemaId, graphRef) {
|
||||
this.header = new apollo_reporting_protobuf_1.ReportHeader(Object.assign(Object.assign({}, reportHeaderDefaults), { executableSchemaId,
|
||||
graphRef }));
|
||||
this.reset();
|
||||
}
|
||||
reset() {
|
||||
this.report = new stats_1.OurReport(this.header);
|
||||
}
|
||||
}
|
||||
function ApolloServerPluginUsageReporting(options = Object.create(null)) {
|
||||
let requestDidStartHandler;
|
||||
return {
|
||||
__internal_plugin_id__() {
|
||||
return 'UsageReporting';
|
||||
},
|
||||
requestDidStart(requestContext) {
|
||||
if (!requestDidStartHandler) {
|
||||
throw Error('The usage reporting plugin has been asked to handle a request before the ' +
|
||||
'server has started. See https://github.com/apollographql/apollo-server/issues/4588 ' +
|
||||
'for more details.');
|
||||
}
|
||||
return requestDidStartHandler(requestContext);
|
||||
},
|
||||
serverWillStart({ logger: serverLogger, apollo, serverlessFramework, }) {
|
||||
var _a, _b, _c, _d;
|
||||
const logger = (_a = options.logger) !== null && _a !== void 0 ? _a : serverLogger;
|
||||
const { key, graphRef } = apollo;
|
||||
if (!(key && graphRef)) {
|
||||
throw new Error("You've enabled usage reporting via ApolloServerPluginUsageReporting, " +
|
||||
'but you also need to provide your Apollo API key and graph ref, via ' +
|
||||
'the APOLLO_KEY/APOLLO_GRAPH_REF environment ' +
|
||||
'variables or via `new ApolloServer({apollo: {key, graphRef})`.');
|
||||
}
|
||||
logger.info('Apollo usage reporting starting! See your graph at ' +
|
||||
`https://studio.apollographql.com/graph/${encodeURI(graphRef)}/`);
|
||||
const sendReportsImmediately = (_b = options.sendReportsImmediately) !== null && _b !== void 0 ? _b : serverlessFramework;
|
||||
const signatureCache = signatureCache_1.createSignatureCache({ logger });
|
||||
const reportDataByExecutableSchemaId = Object.create(null);
|
||||
const overriddenExecutableSchemaId = options.overrideReportedSchema
|
||||
? schemaReporting_1.computeCoreSchemaHash(options.overrideReportedSchema)
|
||||
: undefined;
|
||||
let lastSeenExecutableSchemaToId;
|
||||
let reportTimer;
|
||||
if (!sendReportsImmediately) {
|
||||
reportTimer = setInterval(() => sendAllReportsAndReportErrors(), options.reportIntervalMs || 10 * 1000);
|
||||
}
|
||||
let graphMightSupportTraces = true;
|
||||
const sendOperationAsTrace = (_c = options.experimental_sendOperationAsTrace) !== null && _c !== void 0 ? _c : defaultSendOperationsAsTrace_1.defaultSendOperationsAsTrace();
|
||||
const includeTracesContributingToStats = (_d = options.internal_includeTracesContributingToStats) !== null && _d !== void 0 ? _d : false;
|
||||
let stopped = false;
|
||||
function executableSchemaIdForSchema(schema) {
|
||||
if ((lastSeenExecutableSchemaToId === null || lastSeenExecutableSchemaToId === void 0 ? void 0 : lastSeenExecutableSchemaToId.executableSchema) === schema) {
|
||||
return lastSeenExecutableSchemaToId.executableSchemaId;
|
||||
}
|
||||
const id = schemaReporting_1.computeCoreSchemaHash(graphql_1.printSchema(schema));
|
||||
lastSeenExecutableSchemaToId = {
|
||||
executableSchema: schema,
|
||||
executableSchemaId: id,
|
||||
};
|
||||
return id;
|
||||
}
|
||||
const getReportData = (executableSchemaId) => {
|
||||
const existing = reportDataByExecutableSchemaId[executableSchemaId];
|
||||
if (existing) {
|
||||
return existing;
|
||||
}
|
||||
const reportData = new ReportData(executableSchemaId, graphRef);
|
||||
reportDataByExecutableSchemaId[executableSchemaId] = reportData;
|
||||
return reportData;
|
||||
};
|
||||
function sendAllReportsAndReportErrors() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield Promise.all(Object.keys(reportDataByExecutableSchemaId).map((executableSchemaId) => sendReportAndReportErrors(executableSchemaId)));
|
||||
});
|
||||
}
|
||||
function sendReportAndReportErrors(executableSchemaId) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return sendReport(executableSchemaId).catch((err) => {
|
||||
if (options.reportErrorFunction) {
|
||||
options.reportErrorFunction(err);
|
||||
}
|
||||
else {
|
||||
logger.error(err.message);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
const sendReport = (executableSchemaId) => __awaiter(this, void 0, void 0, function* () {
|
||||
var _e, _f;
|
||||
const reportData = getReportData(executableSchemaId);
|
||||
const { report } = reportData;
|
||||
reportData.reset();
|
||||
if (Object.keys(report.tracesPerQuery).length === 0) {
|
||||
return;
|
||||
}
|
||||
report.endTime = traceTreeBuilder_1.dateToProtoTimestamp(new Date());
|
||||
const protobufError = apollo_reporting_protobuf_1.Report.verify(report);
|
||||
if (protobufError) {
|
||||
throw new Error(`Error encoding report: ${protobufError}`);
|
||||
}
|
||||
const message = apollo_reporting_protobuf_1.Report.encode(report).finish();
|
||||
if (options.debugPrintReports) {
|
||||
const decodedReport = apollo_reporting_protobuf_1.Report.decode(message);
|
||||
logger.warn(`Apollo usage report: ${JSON.stringify(decodedReport.toJSON())}`);
|
||||
}
|
||||
const compressed = yield new Promise((resolve, reject) => {
|
||||
const messageBuffer = Buffer.from(message.buffer, message.byteOffset, message.byteLength);
|
||||
zlib_1.gzip(messageBuffer, (err, gzipResult) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
}
|
||||
else {
|
||||
resolve(gzipResult);
|
||||
}
|
||||
});
|
||||
});
|
||||
const fetcher = (_e = options.fetcher) !== null && _e !== void 0 ? _e : apollo_server_env_1.fetch;
|
||||
const response = yield async_retry_1.default(() => __awaiter(this, void 0, void 0, function* () {
|
||||
const curResponse = yield fetcher((options.endpointUrl ||
|
||||
'https://usage-reporting.api.apollographql.com') +
|
||||
'/api/ingress/traces', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'user-agent': 'ApolloServerPluginUsageReporting',
|
||||
'x-api-key': key,
|
||||
'content-encoding': 'gzip',
|
||||
accept: 'application/json',
|
||||
},
|
||||
body: compressed,
|
||||
agent: options.requestAgent,
|
||||
});
|
||||
if (curResponse.status >= 500 && curResponse.status < 600) {
|
||||
throw new Error(`HTTP status ${curResponse.status}, ${(yield curResponse.text()) || '(no body)'}`);
|
||||
}
|
||||
else {
|
||||
return curResponse;
|
||||
}
|
||||
}), {
|
||||
retries: (options.maxAttempts || 5) - 1,
|
||||
minTimeout: options.minimumRetryDelayMs || 100,
|
||||
factor: 2,
|
||||
}).catch((err) => {
|
||||
throw new Error(`Error sending report to Apollo servers: ${err.message}`);
|
||||
});
|
||||
if (response.status < 200 || response.status >= 300) {
|
||||
throw new Error(`Error sending report to Apollo servers: HTTP status ${response.status}, ${(yield response.text()) || '(no body)'}`);
|
||||
}
|
||||
if (graphMightSupportTraces &&
|
||||
response.status === 200 && ((_f = response.headers
|
||||
.get('content-type')) === null || _f === void 0 ? void 0 : _f.match(/^\s*application\/json\s*(?:;|$)/i))) {
|
||||
const body = yield response.text();
|
||||
let parsedBody;
|
||||
try {
|
||||
parsedBody = JSON.parse(body);
|
||||
}
|
||||
catch (e) {
|
||||
throw new Error(`Error parsing response from Apollo servers: ${e}`);
|
||||
}
|
||||
if (parsedBody.tracesIgnored === true) {
|
||||
logger.debug("This graph's organization does not have access to traces; sending all " +
|
||||
'subsequent operations as traces.');
|
||||
graphMightSupportTraces = false;
|
||||
}
|
||||
}
|
||||
if (options.debugPrintReports) {
|
||||
logger.warn(`Apollo usage report: status ${response.status}`);
|
||||
}
|
||||
});
|
||||
requestDidStartHandler = ({ logger: requestLogger, metrics, schema, request: { http, variables }, }) => {
|
||||
var _a;
|
||||
const logger = (_a = requestLogger !== null && requestLogger !== void 0 ? requestLogger : options.logger) !== null && _a !== void 0 ? _a : serverLogger;
|
||||
const treeBuilder = new traceTreeBuilder_1.TraceTreeBuilder({
|
||||
rewriteError: options.rewriteError,
|
||||
logger,
|
||||
});
|
||||
treeBuilder.startTiming();
|
||||
metrics.startHrTime = treeBuilder.startHrTime;
|
||||
let graphqlValidationFailure = false;
|
||||
let graphqlUnknownOperationName = false;
|
||||
if (http) {
|
||||
treeBuilder.trace.http = new apollo_reporting_protobuf_1.Trace.HTTP({
|
||||
method: apollo_reporting_protobuf_1.Trace.HTTP.Method[http.method] || apollo_reporting_protobuf_1.Trace.HTTP.Method.UNKNOWN,
|
||||
host: null,
|
||||
path: null,
|
||||
});
|
||||
if (options.sendHeaders) {
|
||||
makeHTTPRequestHeaders(treeBuilder.trace.http, http.headers, options.sendHeaders);
|
||||
}
|
||||
}
|
||||
function shouldIncludeRequest(requestContext) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (metrics.captureTraces !== undefined)
|
||||
return;
|
||||
if (typeof options.includeRequest !== 'function') {
|
||||
metrics.captureTraces = true;
|
||||
return;
|
||||
}
|
||||
metrics.captureTraces = yield options.includeRequest(requestContext);
|
||||
if (typeof metrics.captureTraces !== 'boolean') {
|
||||
logger.warn("The 'includeRequest' async predicate function must return a boolean value.");
|
||||
metrics.captureTraces = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
let endDone = false;
|
||||
function didEnd(requestContext) {
|
||||
if (endDone)
|
||||
return;
|
||||
endDone = true;
|
||||
treeBuilder.stopTiming();
|
||||
if (metrics.captureTraces === undefined) {
|
||||
logger.warn('captureTrace is undefined at the end of the request. This is a bug in ApolloServerPluginUsageReporting.');
|
||||
}
|
||||
if (metrics.captureTraces === false)
|
||||
return;
|
||||
treeBuilder.trace.fullQueryCacheHit = !!metrics.responseCacheHit;
|
||||
treeBuilder.trace.forbiddenOperation = !!metrics.forbiddenOperation;
|
||||
treeBuilder.trace.registeredOperation = !!metrics.registeredOperation;
|
||||
if (requestContext.overallCachePolicy) {
|
||||
treeBuilder.trace.cachePolicy = new apollo_reporting_protobuf_1.Trace.CachePolicy({
|
||||
scope: requestContext.overallCachePolicy.scope === apollo_cache_control_1.CacheScope.Private
|
||||
? apollo_reporting_protobuf_1.Trace.CachePolicy.Scope.PRIVATE
|
||||
: requestContext.overallCachePolicy.scope ===
|
||||
apollo_cache_control_1.CacheScope.Public
|
||||
? apollo_reporting_protobuf_1.Trace.CachePolicy.Scope.PUBLIC
|
||||
: apollo_reporting_protobuf_1.Trace.CachePolicy.Scope.UNKNOWN,
|
||||
maxAgeNs: requestContext.overallCachePolicy.maxAge * 1e9,
|
||||
});
|
||||
}
|
||||
const operationName = requestContext.operationName ||
|
||||
requestContext.request.operationName ||
|
||||
'';
|
||||
if (metrics.queryPlanTrace) {
|
||||
treeBuilder.trace.queryPlan = metrics.queryPlanTrace;
|
||||
}
|
||||
addTrace().catch(logger.error);
|
||||
function addTrace() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (stopped) {
|
||||
return;
|
||||
}
|
||||
yield new Promise((res) => setImmediate(res));
|
||||
const executableSchemaId = overriddenExecutableSchemaId !== null && overriddenExecutableSchemaId !== void 0 ? overriddenExecutableSchemaId : executableSchemaIdForSchema(schema);
|
||||
const reportData = getReportData(executableSchemaId);
|
||||
const { report } = reportData;
|
||||
const { trace } = treeBuilder;
|
||||
let statsReportKey = undefined;
|
||||
if (!requestContext.document) {
|
||||
statsReportKey = `## GraphQLParseFailure\n`;
|
||||
}
|
||||
else if (graphqlValidationFailure) {
|
||||
statsReportKey = `## GraphQLValidationFailure\n`;
|
||||
}
|
||||
else if (graphqlUnknownOperationName) {
|
||||
statsReportKey = `## GraphQLUnknownOperationName\n`;
|
||||
}
|
||||
if (statsReportKey) {
|
||||
if (options.sendUnexecutableOperationDocuments) {
|
||||
trace.unexecutedOperationBody = requestContext.source;
|
||||
trace.unexecutedOperationName = operationName;
|
||||
}
|
||||
}
|
||||
else {
|
||||
const signature = getTraceSignature();
|
||||
statsReportKey = `# ${operationName || '-'}\n${signature}`;
|
||||
}
|
||||
const protobufError = apollo_reporting_protobuf_1.Trace.verify(trace);
|
||||
if (protobufError) {
|
||||
throw new Error(`Error encoding trace: ${protobufError}`);
|
||||
}
|
||||
report.addTrace({
|
||||
statsReportKey,
|
||||
trace,
|
||||
asTrace: graphMightSupportTraces &&
|
||||
sendOperationAsTrace(trace, statsReportKey),
|
||||
includeTracesContributingToStats,
|
||||
});
|
||||
if (sendReportsImmediately ||
|
||||
report.sizeEstimator.bytes >=
|
||||
(options.maxUncompressedReportSize || 4 * 1024 * 1024)) {
|
||||
yield sendReportAndReportErrors(executableSchemaId);
|
||||
}
|
||||
});
|
||||
}
|
||||
function getTraceSignature() {
|
||||
if (!requestContext.document) {
|
||||
throw new Error('No document?');
|
||||
}
|
||||
const cacheKey = signatureCache_1.signatureCacheKey(requestContext.queryHash, operationName);
|
||||
const cachedSignature = signatureCache.get(cacheKey);
|
||||
if (cachedSignature) {
|
||||
return cachedSignature;
|
||||
}
|
||||
const generatedSignature = (options.calculateSignature || apollo_graphql_1.defaultUsageReportingSignature)(requestContext.document, operationName);
|
||||
signatureCache.set(cacheKey, generatedSignature);
|
||||
return generatedSignature;
|
||||
}
|
||||
}
|
||||
let didResolveSource = false;
|
||||
return {
|
||||
didResolveSource(requestContext) {
|
||||
didResolveSource = true;
|
||||
if (metrics.persistedQueryHit) {
|
||||
treeBuilder.trace.persistedQueryHit = true;
|
||||
}
|
||||
if (metrics.persistedQueryRegister) {
|
||||
treeBuilder.trace.persistedQueryRegister = true;
|
||||
}
|
||||
if (variables) {
|
||||
treeBuilder.trace.details = traceDetails_1.makeTraceDetails(variables, options.sendVariableValues, requestContext.source);
|
||||
}
|
||||
const clientInfo = (options.generateClientInfo || defaultGenerateClientInfo)(requestContext);
|
||||
if (clientInfo) {
|
||||
const { clientName, clientVersion, clientReferenceId, } = clientInfo;
|
||||
treeBuilder.trace.clientVersion = clientVersion || '';
|
||||
treeBuilder.trace.clientReferenceId = clientReferenceId || '';
|
||||
treeBuilder.trace.clientName = clientName || '';
|
||||
}
|
||||
},
|
||||
validationDidStart() {
|
||||
return (validationErrors) => {
|
||||
graphqlValidationFailure = validationErrors
|
||||
? validationErrors.length !== 0
|
||||
: false;
|
||||
};
|
||||
},
|
||||
didResolveOperation(requestContext) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
graphqlUnknownOperationName =
|
||||
requestContext.operation === undefined;
|
||||
yield shouldIncludeRequest(requestContext);
|
||||
if (metrics.captureTraces === false) {
|
||||
didEnd(requestContext);
|
||||
}
|
||||
});
|
||||
},
|
||||
executionDidStart() {
|
||||
if (endDone)
|
||||
return;
|
||||
return {
|
||||
willResolveField({ info }) {
|
||||
return treeBuilder.willResolveField(info);
|
||||
},
|
||||
};
|
||||
},
|
||||
willSendResponse(requestContext) {
|
||||
didEnd(requestContext);
|
||||
},
|
||||
didEncounterErrors(requestContext) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!didResolveSource || endDone)
|
||||
return;
|
||||
treeBuilder.didEncounterErrors(requestContext.errors);
|
||||
yield shouldIncludeRequest(requestContext);
|
||||
didEnd(requestContext);
|
||||
});
|
||||
},
|
||||
};
|
||||
};
|
||||
return {
|
||||
serverWillStop() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (reportTimer) {
|
||||
clearInterval(reportTimer);
|
||||
reportTimer = undefined;
|
||||
}
|
||||
stopped = true;
|
||||
yield sendAllReportsAndReportErrors();
|
||||
});
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
}
|
||||
exports.ApolloServerPluginUsageReporting = ApolloServerPluginUsageReporting;
|
||||
function makeHTTPRequestHeaders(http, headers, sendHeaders) {
|
||||
if (!sendHeaders ||
|
||||
('none' in sendHeaders && sendHeaders.none) ||
|
||||
('all' in sendHeaders && !sendHeaders.all)) {
|
||||
return;
|
||||
}
|
||||
for (const [key, value] of headers) {
|
||||
const lowerCaseKey = key.toLowerCase();
|
||||
if (('exceptNames' in sendHeaders &&
|
||||
sendHeaders.exceptNames.some((exceptHeader) => {
|
||||
return exceptHeader.toLowerCase() === lowerCaseKey;
|
||||
})) ||
|
||||
('onlyNames' in sendHeaders &&
|
||||
!sendHeaders.onlyNames.some((header) => {
|
||||
return header.toLowerCase() === lowerCaseKey;
|
||||
}))) {
|
||||
continue;
|
||||
}
|
||||
switch (key) {
|
||||
case 'authorization':
|
||||
case 'cookie':
|
||||
case 'set-cookie':
|
||||
break;
|
||||
default:
|
||||
http.requestHeaders[key] = new apollo_reporting_protobuf_1.Trace.HTTP.Values({
|
||||
value: [value],
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.makeHTTPRequestHeaders = makeHTTPRequestHeaders;
|
||||
function defaultGenerateClientInfo({ request }) {
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
||||
const clientNameHeaderKey = 'apollographql-client-name';
|
||||
const clientReferenceIdHeaderKey = 'apollographql-client-reference-id';
|
||||
const clientVersionHeaderKey = 'apollographql-client-version';
|
||||
if (((_b = (_a = request.http) === null || _a === void 0 ? void 0 : _a.headers) === null || _b === void 0 ? void 0 : _b.get(clientNameHeaderKey)) || ((_d = (_c = request.http) === null || _c === void 0 ? void 0 : _c.headers) === null || _d === void 0 ? void 0 : _d.get(clientVersionHeaderKey)) || ((_f = (_e = request.http) === null || _e === void 0 ? void 0 : _e.headers) === null || _f === void 0 ? void 0 : _f.get(clientReferenceIdHeaderKey))) {
|
||||
return {
|
||||
clientName: (_h = (_g = request.http) === null || _g === void 0 ? void 0 : _g.headers) === null || _h === void 0 ? void 0 : _h.get(clientNameHeaderKey),
|
||||
clientVersion: (_k = (_j = request.http) === null || _j === void 0 ? void 0 : _j.headers) === null || _k === void 0 ? void 0 : _k.get(clientVersionHeaderKey),
|
||||
clientReferenceId: (_m = (_l = request.http) === null || _l === void 0 ? void 0 : _l.headers) === null || _m === void 0 ? void 0 : _m.get(clientReferenceIdHeaderKey),
|
||||
};
|
||||
}
|
||||
else if ((_o = request.extensions) === null || _o === void 0 ? void 0 : _o.clientInfo) {
|
||||
return request.extensions.clientInfo;
|
||||
}
|
||||
else {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
function ApolloServerPluginUsageReportingDisabled() {
|
||||
return {
|
||||
__internal_plugin_id__() {
|
||||
return 'UsageReporting';
|
||||
},
|
||||
};
|
||||
}
|
||||
exports.ApolloServerPluginUsageReportingDisabled = ApolloServerPluginUsageReportingDisabled;
|
||||
//# sourceMappingURL=plugin.js.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/plugin.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/plugin.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
7
node_modules/apollo-server-core/dist/plugin/usageReporting/signatureCache.d.ts
generated
vendored
Normal file
7
node_modules/apollo-server-core/dist/plugin/usageReporting/signatureCache.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import LRUCache from 'lru-cache';
|
||||
import { Logger } from 'apollo-server-types';
|
||||
export declare function createSignatureCache({ logger, }: {
|
||||
logger: Logger;
|
||||
}): LRUCache<string, string>;
|
||||
export declare function signatureCacheKey(queryHash: string, operationName: string): string;
|
||||
//# sourceMappingURL=signatureCache.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/signatureCache.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/signatureCache.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"signatureCache.d.ts","sourceRoot":"","sources":["../../../src/plugin/usageReporting/signatureCache.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,wBAAgB,oBAAoB,CAAC,EACnC,MAAM,GACP,EAAE;IACD,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CA4C3B;AAED,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,UAEzE"}
|
||||
38
node_modules/apollo-server-core/dist/plugin/usageReporting/signatureCache.js
generated
vendored
Normal file
38
node_modules/apollo-server-core/dist/plugin/usageReporting/signatureCache.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.signatureCacheKey = exports.createSignatureCache = void 0;
|
||||
const lru_cache_1 = __importDefault(require("lru-cache"));
|
||||
function createSignatureCache({ logger, }) {
|
||||
let lastSignatureCacheWarn;
|
||||
let lastSignatureCacheDisposals = 0;
|
||||
return new lru_cache_1.default({
|
||||
length(obj) {
|
||||
return Buffer.byteLength(JSON.stringify(obj), 'utf8');
|
||||
},
|
||||
max: Math.pow(2, 20) * 3,
|
||||
dispose() {
|
||||
lastSignatureCacheDisposals++;
|
||||
if (!lastSignatureCacheWarn ||
|
||||
new Date().getTime() - lastSignatureCacheWarn.getTime() > 60000) {
|
||||
lastSignatureCacheWarn = new Date();
|
||||
logger.warn([
|
||||
'This server is processing a high number of unique operations. ',
|
||||
`A total of ${lastSignatureCacheDisposals} records have been `,
|
||||
'ejected from the ApolloServerPluginUsageReporting signature cache in the past ',
|
||||
'interval. If you see this warning frequently, please open an ',
|
||||
'issue on the Apollo Server repository.',
|
||||
].join(''));
|
||||
lastSignatureCacheDisposals = 0;
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
exports.createSignatureCache = createSignatureCache;
|
||||
function signatureCacheKey(queryHash, operationName) {
|
||||
return `${queryHash}${operationName && ':' + operationName}`;
|
||||
}
|
||||
exports.signatureCacheKey = signatureCacheKey;
|
||||
//# sourceMappingURL=signatureCache.js.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/signatureCache.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/signatureCache.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"signatureCache.js","sourceRoot":"","sources":["../../../src/plugin/usageReporting/signatureCache.ts"],"names":[],"mappings":";;;;;;AAAA,0DAAiC;AAGjC,SAAgB,oBAAoB,CAAC,EACnC,MAAM,GAGP;IACC,IAAI,sBAA4B,CAAC;IACjC,IAAI,2BAA2B,GAAW,CAAC,CAAC;IAC5C,OAAO,IAAI,mBAAQ,CAAiB;QAElC,MAAM,CAAC,GAAG;YACR,OAAO,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;QACxD,CAAC;QAUD,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC;QACxB,OAAO;YAEL,2BAA2B,EAAE,CAAC;YAG9B,IACE,CAAC,sBAAsB;gBACvB,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,sBAAsB,CAAC,OAAO,EAAE,GAAG,KAAK,EAC/D;gBAEA,sBAAsB,GAAG,IAAI,IAAI,EAAE,CAAC;gBACpC,MAAM,CAAC,IAAI,CACT;oBACE,iEAAiE;oBACjE,cAAc,2BAA2B,qBAAqB;oBAC9D,gFAAgF;oBAChF,gEAAgE;oBAChE,wCAAwC;iBACzC,CAAC,IAAI,CAAC,EAAE,CAAC,CACX,CAAC;gBAGF,2BAA2B,GAAG,CAAC,CAAC;aACjC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAhDD,oDAgDC;AAED,SAAgB,iBAAiB,CAAC,SAAiB,EAAE,aAAqB;IACxE,OAAO,GAAG,SAAS,GAAG,aAAa,IAAI,GAAG,GAAG,aAAa,EAAE,CAAC;AAC/D,CAAC;AAFD,8CAEC"}
|
||||
80
node_modules/apollo-server-core/dist/plugin/usageReporting/stats.d.ts
generated
vendored
Normal file
80
node_modules/apollo-server-core/dist/plugin/usageReporting/stats.d.ts
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
import { DurationHistogram } from './durationHistogram';
|
||||
import { IFieldStat, IPathErrorStats, IQueryLatencyStats, IStatsContext, Trace, ITypeStat, IContextualizedStats, ReportHeader, google, ITracesAndStats, IReport } from 'apollo-reporting-protobuf';
|
||||
export declare class SizeEstimator {
|
||||
bytes: number;
|
||||
}
|
||||
export declare class OurReport implements Required<IReport> {
|
||||
readonly header: ReportHeader;
|
||||
constructor(header: ReportHeader);
|
||||
readonly tracesPerQuery: Record<string, OurTracesAndStats>;
|
||||
endTime: google.protobuf.ITimestamp | null;
|
||||
readonly sizeEstimator: SizeEstimator;
|
||||
addTrace({ statsReportKey, trace, asTrace, includeTracesContributingToStats, }: {
|
||||
statsReportKey: string;
|
||||
trace: Trace;
|
||||
asTrace: boolean;
|
||||
includeTracesContributingToStats: boolean;
|
||||
}): void;
|
||||
private getTracesAndStats;
|
||||
}
|
||||
declare class OurTracesAndStats implements Required<ITracesAndStats> {
|
||||
readonly trace: Uint8Array[];
|
||||
readonly statsWithContext: StatsByContext;
|
||||
readonly internalTracesContributingToStats: Uint8Array[];
|
||||
}
|
||||
declare class StatsByContext {
|
||||
readonly map: {
|
||||
[k: string]: OurContextualizedStats;
|
||||
};
|
||||
toArray(): IContextualizedStats[];
|
||||
addTrace(trace: Trace, sizeEstimator: SizeEstimator): void;
|
||||
private getContextualizedStats;
|
||||
}
|
||||
export declare class OurContextualizedStats implements Required<IContextualizedStats> {
|
||||
readonly context: IStatsContext;
|
||||
queryLatencyStats: OurQueryLatencyStats;
|
||||
perTypeStat: {
|
||||
[k: string]: OurTypeStat;
|
||||
};
|
||||
constructor(context: IStatsContext);
|
||||
addTrace(trace: Trace, sizeEstimator: SizeEstimator): void;
|
||||
getTypeStat(parentType: string, sizeEstimator: SizeEstimator): OurTypeStat;
|
||||
}
|
||||
declare class OurQueryLatencyStats implements Required<IQueryLatencyStats> {
|
||||
latencyCount: DurationHistogram;
|
||||
requestCount: number;
|
||||
cacheHits: number;
|
||||
persistedQueryHits: number;
|
||||
persistedQueryMisses: number;
|
||||
cacheLatencyCount: DurationHistogram;
|
||||
rootErrorStats: OurPathErrorStats;
|
||||
requestsWithErrorsCount: number;
|
||||
publicCacheTtlCount: DurationHistogram;
|
||||
privateCacheTtlCount: DurationHistogram;
|
||||
registeredOperationCount: number;
|
||||
forbiddenOperationCount: number;
|
||||
}
|
||||
declare class OurPathErrorStats implements Required<IPathErrorStats> {
|
||||
children: {
|
||||
[k: string]: OurPathErrorStats;
|
||||
};
|
||||
errorsCount: number;
|
||||
requestsWithErrorsCount: number;
|
||||
getChild(subPath: string, sizeEstimator: SizeEstimator): OurPathErrorStats;
|
||||
}
|
||||
declare class OurTypeStat implements Required<ITypeStat> {
|
||||
perFieldStat: {
|
||||
[k: string]: OurFieldStat;
|
||||
};
|
||||
getFieldStat(fieldName: string, returnType: string, sizeEstimator: SizeEstimator): OurFieldStat;
|
||||
}
|
||||
declare class OurFieldStat implements Required<IFieldStat> {
|
||||
readonly returnType: string;
|
||||
errorsCount: number;
|
||||
count: number;
|
||||
requestsWithErrorsCount: number;
|
||||
latencyCount: DurationHistogram;
|
||||
constructor(returnType: string);
|
||||
}
|
||||
export {};
|
||||
//# sourceMappingURL=stats.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/stats.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/stats.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../../src/plugin/usageReporting/stats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EACL,UAAU,EACV,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,KAAK,EACL,SAAS,EACT,oBAAoB,EACpB,YAAY,EACZ,MAAM,EACN,eAAe,EACf,OAAO,EACR,MAAM,2BAA2B,CAAC;AAkBnC,qBAAa,aAAa;IACxB,KAAK,SAAK;CACX;AACD,qBAAa,SAAU,YAAW,QAAQ,CAAC,OAAO,CAAC;IACrC,QAAQ,CAAC,MAAM,EAAE,YAAY;gBAApB,MAAM,EAAE,YAAY;IACzC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAExD;IACF,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,UAAU,GAAG,IAAI,CAAQ;IAWlD,QAAQ,CAAC,aAAa,gBAAuB;IAE7C,QAAQ,CAAC,EACP,cAAc,EACd,KAAK,EACL,OAAO,EACP,gCAAgC,GACjC,EAAE;QACD,cAAc,EAAE,MAAM,CAAC;QACvB,KAAK,EAAE,KAAK,CAAC;QACb,OAAO,EAAE,OAAO,CAAC;QACjB,gCAAgC,E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AAoB,EAAE,iBAAiB,CAA2B;IAClE,wBAAwB,EAAE,MAAM,CAAK;IACrC,uBAAuB,EAAE,MAAM,CAAK;CACrC;AAED,cAAM,iBAAkB,YAAW,QAAQ,CAAC,eAAe,CAAC;IAC1D,QAAQ,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,iBAAiB,CAAA;KAAE,CAAuB;IACnE,WAAW,EAAE,MAAM,CAAK;IACxB,uBAAuB,EAAE,MAAM,CAAK;IAEpC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,GAAG,iBAAiB;CAW3E;AAED,cAAM,WAAY,YAAW,QAAQ,CAAC,SAAS,CAAC;IAC9C,YAAY,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,YAAY,CAAA;KAAE,CAAuB;IAElE,YAAY,CACV,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,aAAa,GAC3B,YAAY;CAchB;AAED,cAAM,YAAa,YAAW,QAAQ,CAAC,UAAU,CAAC;IAMpC,QAAQ,CAAC,UAAU,EAAE,MAAM;IALvC,WAAW,EAAE,MAAM,CAAK;IACxB,KAAK,EAAE,MAAM,CAAK;IAClB,uBAAuB,EAAE,MAAM,CAAK;IACpC,YAAY,EAAE,iBAAiB,CAA2B;gBAErC,UAAU,EAAE,MAAM;CACxC"}
|
||||
231
node_modules/apollo-server-core/dist/plugin/usageReporting/stats.js
generated
vendored
Normal file
231
node_modules/apollo-server-core/dist/plugin/usageReporting/stats.js
generated
vendored
Normal file
@@ -0,0 +1,231 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.OurContextualizedStats = exports.OurReport = exports.SizeEstimator = void 0;
|
||||
const durationHistogram_1 = require("./durationHistogram");
|
||||
const apollo_reporting_protobuf_1 = require("apollo-reporting-protobuf");
|
||||
const iterateOverTrace_1 = require("./iterateOverTrace");
|
||||
class SizeEstimator {
|
||||
constructor() {
|
||||
this.bytes = 0;
|
||||
}
|
||||
}
|
||||
exports.SizeEstimator = SizeEstimator;
|
||||
class OurReport {
|
||||
constructor(header) {
|
||||
this.header = header;
|
||||
this.tracesPerQuery = Object.create(null);
|
||||
this.endTime = null;
|
||||
this.sizeEstimator = new SizeEstimator();
|
||||
}
|
||||
addTrace({ statsReportKey, trace, asTrace, includeTracesContributingToStats, }) {
|
||||
const tracesAndStats = this.getTracesAndStats(statsReportKey);
|
||||
if (asTrace) {
|
||||
const encodedTrace = apollo_reporting_protobuf_1.Trace.encode(trace).finish();
|
||||
tracesAndStats.trace.push(encodedTrace);
|
||||
this.sizeEstimator.bytes += 2 + encodedTrace.length;
|
||||
}
|
||||
else {
|
||||
tracesAndStats.statsWithContext.addTrace(trace, this.sizeEstimator);
|
||||
if (includeTracesContributingToStats) {
|
||||
const encodedTrace = apollo_reporting_protobuf_1.Trace.encode(trace).finish();
|
||||
tracesAndStats.internalTracesContributingToStats.push(encodedTrace);
|
||||
this.sizeEstimator.bytes += 2 + encodedTrace.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
getTracesAndStats(statsReportKey) {
|
||||
const existing = this.tracesPerQuery[statsReportKey];
|
||||
if (existing) {
|
||||
return existing;
|
||||
}
|
||||
this.sizeEstimator.bytes += estimatedBytesForString(statsReportKey);
|
||||
return (this.tracesPerQuery[statsReportKey] = new OurTracesAndStats());
|
||||
}
|
||||
}
|
||||
exports.OurReport = OurReport;
|
||||
class OurTracesAndStats {
|
||||
constructor() {
|
||||
this.trace = [];
|
||||
this.statsWithContext = new StatsByContext();
|
||||
this.internalTracesContributingToStats = [];
|
||||
}
|
||||
}
|
||||
class StatsByContext {
|
||||
constructor() {
|
||||
this.map = Object.create(null);
|
||||
}
|
||||
toArray() {
|
||||
return Object.values(this.map);
|
||||
}
|
||||
addTrace(trace, sizeEstimator) {
|
||||
this.getContextualizedStats(trace, sizeEstimator).addTrace(trace, sizeEstimator);
|
||||
}
|
||||
getContextualizedStats(trace, sizeEstimator) {
|
||||
const statsContext = {
|
||||
clientName: trace.clientName,
|
||||
clientVersion: trace.clientVersion,
|
||||
clientReferenceId: trace.clientReferenceId,
|
||||
};
|
||||
const statsContextKey = JSON.stringify(statsContext);
|
||||
const existing = this.map[statsContextKey];
|
||||
if (existing) {
|
||||
return existing;
|
||||
}
|
||||
sizeEstimator.bytes +=
|
||||
20 +
|
||||
estimatedBytesForString(trace.clientName) +
|
||||
estimatedBytesForString(trace.clientVersion) +
|
||||
estimatedBytesForString(trace.clientReferenceId);
|
||||
const contextualizedStats = new OurContextualizedStats(statsContext);
|
||||
this.map[statsContextKey] = contextualizedStats;
|
||||
return contextualizedStats;
|
||||
}
|
||||
}
|
||||
class OurContextualizedStats {
|
||||
constructor(context) {
|
||||
this.context = context;
|
||||
this.queryLatencyStats = new OurQueryLatencyStats();
|
||||
this.perTypeStat = Object.create(null);
|
||||
}
|
||||
addTrace(trace, sizeEstimator) {
|
||||
var _a;
|
||||
this.queryLatencyStats.requestCount++;
|
||||
if (trace.fullQueryCacheHit) {
|
||||
this.queryLatencyStats.cacheLatencyCount.incrementDuration(trace.durationNs);
|
||||
this.queryLatencyStats.cacheHits++;
|
||||
}
|
||||
else {
|
||||
this.queryLatencyStats.latencyCount.incrementDuration(trace.durationNs);
|
||||
}
|
||||
if (!trace.fullQueryCacheHit && ((_a = trace.cachePolicy) === null || _a === void 0 ? void 0 : _a.maxAgeNs) != null) {
|
||||
switch (trace.cachePolicy.scope) {
|
||||
case apollo_reporting_protobuf_1.Trace.CachePolicy.Scope.PRIVATE:
|
||||
this.queryLatencyStats.privateCacheTtlCount.incrementDuration(trace.cachePolicy.maxAgeNs);
|
||||
break;
|
||||
case apollo_reporting_protobuf_1.Trace.CachePolicy.Scope.PUBLIC:
|
||||
this.queryLatencyStats.publicCacheTtlCount.incrementDuration(trace.cachePolicy.maxAgeNs);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (trace.persistedQueryHit) {
|
||||
this.queryLatencyStats.persistedQueryHits++;
|
||||
}
|
||||
if (trace.persistedQueryRegister) {
|
||||
this.queryLatencyStats.persistedQueryMisses++;
|
||||
}
|
||||
if (trace.forbiddenOperation) {
|
||||
this.queryLatencyStats.forbiddenOperationCount++;
|
||||
}
|
||||
if (trace.registeredOperation) {
|
||||
this.queryLatencyStats.registeredOperationCount++;
|
||||
}
|
||||
let hasError = false;
|
||||
const traceNodeStats = (node, path) => {
|
||||
var _a, _b, _c, _d, _e;
|
||||
if ((_a = node.error) === null || _a === void 0 ? void 0 : _a.length) {
|
||||
hasError = true;
|
||||
let currPathErrorStats = this.queryLatencyStats.rootErrorStats;
|
||||
path.toArray().forEach((subPath) => {
|
||||
currPathErrorStats = currPathErrorStats.getChild(subPath, sizeEstimator);
|
||||
});
|
||||
currPathErrorStats.requestsWithErrorsCount += 1;
|
||||
currPathErrorStats.errorsCount += node.error.length;
|
||||
}
|
||||
const fieldName = node.originalFieldName || node.responseName;
|
||||
if (node.parentType &&
|
||||
fieldName &&
|
||||
node.type &&
|
||||
node.endTime != null &&
|
||||
node.startTime != null &&
|
||||
node.endTime >= node.startTime) {
|
||||
const typeStat = this.getTypeStat(node.parentType, sizeEstimator);
|
||||
const fieldStat = typeStat.getFieldStat(fieldName, node.type, sizeEstimator);
|
||||
fieldStat.errorsCount += (_c = (_b = node.error) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0;
|
||||
fieldStat.count++;
|
||||
fieldStat.requestsWithErrorsCount +=
|
||||
((_e = (_d = node.error) === null || _d === void 0 ? void 0 : _d.length) !== null && _e !== void 0 ? _e : 0) > 0 ? 1 : 0;
|
||||
fieldStat.latencyCount.incrementDuration(node.endTime - node.startTime);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
iterateOverTrace_1.iterateOverTrace(trace, traceNodeStats, true);
|
||||
if (hasError) {
|
||||
this.queryLatencyStats.requestsWithErrorsCount++;
|
||||
}
|
||||
}
|
||||
getTypeStat(parentType, sizeEstimator) {
|
||||
const existing = this.perTypeStat[parentType];
|
||||
if (existing) {
|
||||
return existing;
|
||||
}
|
||||
sizeEstimator.bytes += estimatedBytesForString(parentType);
|
||||
const typeStat = new OurTypeStat();
|
||||
this.perTypeStat[parentType] = typeStat;
|
||||
return typeStat;
|
||||
}
|
||||
}
|
||||
exports.OurContextualizedStats = OurContextualizedStats;
|
||||
class OurQueryLatencyStats {
|
||||
constructor() {
|
||||
this.latencyCount = new durationHistogram_1.DurationHistogram();
|
||||
this.requestCount = 0;
|
||||
this.cacheHits = 0;
|
||||
this.persistedQueryHits = 0;
|
||||
this.persistedQueryMisses = 0;
|
||||
this.cacheLatencyCount = new durationHistogram_1.DurationHistogram();
|
||||
this.rootErrorStats = new OurPathErrorStats();
|
||||
this.requestsWithErrorsCount = 0;
|
||||
this.publicCacheTtlCount = new durationHistogram_1.DurationHistogram();
|
||||
this.privateCacheTtlCount = new durationHistogram_1.DurationHistogram();
|
||||
this.registeredOperationCount = 0;
|
||||
this.forbiddenOperationCount = 0;
|
||||
}
|
||||
}
|
||||
class OurPathErrorStats {
|
||||
constructor() {
|
||||
this.children = Object.create(null);
|
||||
this.errorsCount = 0;
|
||||
this.requestsWithErrorsCount = 0;
|
||||
}
|
||||
getChild(subPath, sizeEstimator) {
|
||||
const existing = this.children[subPath];
|
||||
if (existing) {
|
||||
return existing;
|
||||
}
|
||||
const child = new OurPathErrorStats();
|
||||
this.children[subPath] = child;
|
||||
sizeEstimator.bytes += estimatedBytesForString(subPath) + 4;
|
||||
return child;
|
||||
}
|
||||
}
|
||||
class OurTypeStat {
|
||||
constructor() {
|
||||
this.perFieldStat = Object.create(null);
|
||||
}
|
||||
getFieldStat(fieldName, returnType, sizeEstimator) {
|
||||
const existing = this.perFieldStat[fieldName];
|
||||
if (existing) {
|
||||
return existing;
|
||||
}
|
||||
sizeEstimator.bytes +=
|
||||
estimatedBytesForString(fieldName) +
|
||||
estimatedBytesForString(returnType) +
|
||||
10;
|
||||
const fieldStat = new OurFieldStat(returnType);
|
||||
this.perFieldStat[fieldName] = fieldStat;
|
||||
return fieldStat;
|
||||
}
|
||||
}
|
||||
class OurFieldStat {
|
||||
constructor(returnType) {
|
||||
this.returnType = returnType;
|
||||
this.errorsCount = 0;
|
||||
this.count = 0;
|
||||
this.requestsWithErrorsCount = 0;
|
||||
this.latencyCount = new durationHistogram_1.DurationHistogram();
|
||||
}
|
||||
}
|
||||
function estimatedBytesForString(s) {
|
||||
return 2 + Buffer.byteLength(s);
|
||||
}
|
||||
//# sourceMappingURL=stats.js.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/stats.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/stats.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
4
node_modules/apollo-server-core/dist/plugin/usageReporting/traceDetails.d.ts
generated
vendored
Normal file
4
node_modules/apollo-server-core/dist/plugin/usageReporting/traceDetails.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import { Trace } from 'apollo-reporting-protobuf';
|
||||
import { VariableValueOptions } from './options';
|
||||
export declare function makeTraceDetails(variables: Record<string, any>, sendVariableValues?: VariableValueOptions, operationString?: string): Trace.Details;
|
||||
//# sourceMappingURL=traceDetails.d.ts.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/traceDetails.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/traceDetails.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"traceDetails.d.ts","sourceRoot":"","sources":["../../../src/plugin/usageReporting/traceDetails.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AASjD,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC9B,kBAAkB,CAAC,EAAE,oBAAoB,EACzC,eAAe,CAAC,EAAE,MAAM,GACvB,KAAK,CAAC,OAAO,CA0Df"}
|
||||
64
node_modules/apollo-server-core/dist/plugin/usageReporting/traceDetails.js
generated
vendored
Normal file
64
node_modules/apollo-server-core/dist/plugin/usageReporting/traceDetails.js
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.makeTraceDetails = void 0;
|
||||
const apollo_reporting_protobuf_1 = require("apollo-reporting-protobuf");
|
||||
function makeTraceDetails(variables, sendVariableValues, operationString) {
|
||||
const details = new apollo_reporting_protobuf_1.Trace.Details();
|
||||
const variablesToRecord = (() => {
|
||||
if (sendVariableValues && 'transform' in sendVariableValues) {
|
||||
const originalKeys = Object.keys(variables);
|
||||
try {
|
||||
const modifiedVariables = sendVariableValues.transform({
|
||||
variables: variables,
|
||||
operationString: operationString,
|
||||
});
|
||||
return cleanModifiedVariables(originalKeys, modifiedVariables);
|
||||
}
|
||||
catch (e) {
|
||||
return handleVariableValueTransformError(originalKeys);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return variables;
|
||||
}
|
||||
})();
|
||||
Object.keys(variablesToRecord).forEach((name) => {
|
||||
if (!sendVariableValues ||
|
||||
('none' in sendVariableValues && sendVariableValues.none) ||
|
||||
('all' in sendVariableValues && !sendVariableValues.all) ||
|
||||
('exceptNames' in sendVariableValues &&
|
||||
sendVariableValues.exceptNames.includes(name)) ||
|
||||
('onlyNames' in sendVariableValues &&
|
||||
!sendVariableValues.onlyNames.includes(name))) {
|
||||
details.variablesJson[name] = '';
|
||||
}
|
||||
else {
|
||||
try {
|
||||
details.variablesJson[name] =
|
||||
typeof variablesToRecord[name] === 'undefined'
|
||||
? ''
|
||||
: JSON.stringify(variablesToRecord[name]);
|
||||
}
|
||||
catch (e) {
|
||||
details.variablesJson[name] = JSON.stringify('[Unable to convert value to JSON]');
|
||||
}
|
||||
}
|
||||
});
|
||||
return details;
|
||||
}
|
||||
exports.makeTraceDetails = makeTraceDetails;
|
||||
function handleVariableValueTransformError(variableNames) {
|
||||
const modifiedVariables = Object.create(null);
|
||||
variableNames.forEach((name) => {
|
||||
modifiedVariables[name] = '[PREDICATE_FUNCTION_ERROR]';
|
||||
});
|
||||
return modifiedVariables;
|
||||
}
|
||||
function cleanModifiedVariables(originalKeys, modifiedVariables) {
|
||||
const cleanedVariables = Object.create(null);
|
||||
originalKeys.forEach((name) => {
|
||||
cleanedVariables[name] = modifiedVariables[name];
|
||||
});
|
||||
return cleanedVariables;
|
||||
}
|
||||
//# sourceMappingURL=traceDetails.js.map
|
||||
1
node_modules/apollo-server-core/dist/plugin/usageReporting/traceDetails.js.map
generated
vendored
Normal file
1
node_modules/apollo-server-core/dist/plugin/usageReporting/traceDetails.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"traceDetails.js","sourceRoot":"","sources":["../../../src/plugin/usageReporting/traceDetails.ts"],"names":[],"mappings":";;;AAAA,yEAAkD;AAUlD,SAAgB,gBAAgB,CAC9B,SAA8B,EAC9B,kBAAyC,EACzC,eAAwB;IAExB,MAAM,OAAO,GAAG,IAAI,iCAAK,CAAC,OAAO,EAAE,CAAC;IACpC,MAAM,iBAAiB,GAAG,CAAC,GAAG,EAAE;QAC9B,IAAI,kBAAkB,IAAI,WAAW,IAAI,kBAAkB,EAAE;YAC3D,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC5C,IAAI;gBAEF,MAAM,iBAAiB,GAAG,kBAAkB,CAAC,SAAS,CAAC;oBACrD,SAAS,EAAE,SAAS;oBACpB,eAAe,EAAE,eAAe;iBACjC,CAAC,CAAC;gBACH,OAAO,sBAAsB,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAAC;aAChE;YAAC,OAAO,CAAC,EAAE;gBAGV,OAAO,iCAAiC,CAAC,YAAY,CAAC,CAAC;aACxD;SACF;aAAM;YACL,OAAO,SAAS,CAAC;SACl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