@graphql-yoga/plugin-apollo-usage-report
Advanced tools
Comparing version 0.5.7-alpha-20250114100629-0c81a3088551143abce54173b1b5c39daf2ee80c to 0.5.7-alpha-20250114102918-2505ba3e9d1ec3326005ff881fdb33e3f1824150
@@ -15,3 +15,3 @@ "use strict"; | ||
const [instrumentation, ctxForReq] = (0, plugin_apollo_inline_trace_1.useApolloInstrumentation)(options); | ||
let schemaId$; | ||
let schemaIdSet$; | ||
let schemaId; | ||
@@ -46,12 +46,11 @@ let yoga; | ||
if (schema) { | ||
schemaId$ = hashSHA256((0, graphql_1.printSchema)(schema)); | ||
} | ||
}, | ||
onRequestParse() { | ||
if (!schemaId) { | ||
return schemaId$.then(id => { | ||
schemaIdSet$ = hashSHA256((0, graphql_1.printSchema)(schema), yoga.fetchAPI).then(id => { | ||
schemaId = id; | ||
schemaIdSet$ = undefined; | ||
}); | ||
} | ||
}, | ||
onRequestParse() { | ||
return schemaIdSet$; | ||
}, | ||
onParse() { | ||
@@ -58,0 +57,0 @@ return function onParseEnd({ result, context }) { |
@@ -11,3 +11,3 @@ import { getOperationAST, Kind, printSchema, stripIgnoredCharacters } from 'graphql'; | ||
const [instrumentation, ctxForReq] = useApolloInstrumentation(options); | ||
let schemaId$; | ||
let schemaIdSet$; | ||
let schemaId; | ||
@@ -42,12 +42,11 @@ let yoga; | ||
if (schema) { | ||
schemaId$ = hashSHA256(printSchema(schema)); | ||
} | ||
}, | ||
onRequestParse() { | ||
if (!schemaId) { | ||
return schemaId$.then(id => { | ||
schemaIdSet$ = hashSHA256(printSchema(schema), yoga.fetchAPI).then(id => { | ||
schemaId = id; | ||
schemaIdSet$ = undefined; | ||
}); | ||
} | ||
}, | ||
onRequestParse() { | ||
return schemaIdSet$; | ||
}, | ||
onParse() { | ||
@@ -54,0 +53,0 @@ return function onParseEnd({ result, context }) { |
{ | ||
"name": "@graphql-yoga/plugin-apollo-usage-report", | ||
"version": "0.5.7-alpha-20250114100629-0c81a3088551143abce54173b1b5c39daf2ee80c", | ||
"version": "0.5.7-alpha-20250114102918-2505ba3e9d1ec3326005ff881fdb33e3f1824150", | ||
"description": "Apollo's GraphOS usage report plugin for GraphQL Yoga.", | ||
@@ -5,0 +5,0 @@ "peerDependencies": { |
21873
366
1