@faststore/graphql-utils
Advanced tools
Comparing version 1.9.14 to 1.10.4
@@ -6,2 +6,13 @@ # Change Log | ||
## [1.10.4](https://github.com/vtex/faststore/compare/v1.10.3...v1.10.4) (2022-07-04) | ||
### Bug Fixes | ||
* @faststore/graphql-utils ([#1394](https://github.com/vtex/faststore/issues/1394)) ([ea4b483](https://github.com/vtex/faststore/commit/ea4b4832b25fe257d8c5c0c67bc09fb04dc693cf)) | ||
## [1.9.14](https://github.com/vtex/faststore/compare/v1.9.13...v1.9.14) (2022-06-23) | ||
@@ -8,0 +19,0 @@ |
@@ -1,6 +0,8 @@ | ||
import { BREAK, parse, visit } from 'graphql'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const graphql_1 = require("graphql"); | ||
const GQL_TAGS = new Set(['gql']); | ||
const getOperationName = (query) => { | ||
let operationName = 'unknown'; | ||
visit(parse(query), { | ||
graphql_1.visit(graphql_1.parse(query), { | ||
OperationDefinition: (node) => { | ||
@@ -11,3 +13,3 @@ const operation = node.name?.value; | ||
} | ||
return BREAK; | ||
return graphql_1.BREAK; | ||
}, | ||
@@ -17,3 +19,3 @@ }); | ||
}; | ||
export default function babelGQLPlugin(babel) { | ||
function babelGQLPlugin(babel) { | ||
const { types } = babel; | ||
@@ -50,2 +52,3 @@ return { | ||
} | ||
exports.default = babelGQLPlugin; | ||
//# sourceMappingURL=babel.js.map |
@@ -1,6 +0,9 @@ | ||
import { optimizeDocuments } from '@graphql-tools/relay-operation-optimizer'; | ||
import { Kind, print } from 'graphql'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.plugin = void 0; | ||
const relay_operation_optimizer_1 = require("@graphql-tools/relay-operation-optimizer"); | ||
const graphql_1 = require("graphql"); | ||
const getOperationName = (document) => { | ||
for (const definition of document.definitions) { | ||
if (definition.kind === Kind.OPERATION_DEFINITION && | ||
if (definition.kind === graphql_1.Kind.OPERATION_DEFINITION && | ||
typeof definition.name?.value === 'string') { | ||
@@ -12,7 +15,7 @@ return definition.name.value; | ||
}; | ||
export const plugin = async (schema, files, _) => { | ||
const plugin = async (schema, files, _) => { | ||
const documents = files | ||
.map(({ document }) => document) | ||
.filter((d) => typeof d !== 'undefined'); | ||
const optimizedDocuments = optimizeDocuments(schema, documents, { | ||
const optimizedDocuments = relay_operation_optimizer_1.optimizeDocuments(schema, documents, { | ||
includeFragments: false, | ||
@@ -26,3 +29,3 @@ }); | ||
} | ||
acc[operationName] = print(doc); | ||
acc[operationName] = graphql_1.print(doc); | ||
} | ||
@@ -33,2 +36,3 @@ return acc; | ||
}; | ||
exports.plugin = plugin; | ||
//# sourceMappingURL=codegen.js.map |
@@ -1,4 +0,8 @@ | ||
export const gql = (_) => { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.request = exports.gql = void 0; | ||
const gql = (_) => { | ||
throw new Error(`[graphql-utils]: This should have been removed by the babel plugin. Please make sure the babel plugin is configured correctly`); | ||
}; | ||
exports.gql = gql; | ||
const DEFAULT_HEADERS_BY_VERB = { | ||
@@ -9,3 +13,3 @@ POST: { | ||
}; | ||
export const request = async (endpoint, { operationName, variables, fetchOptions }) => { | ||
const request = async (endpoint, { operationName, variables, fetchOptions }) => { | ||
// Uses method from fetchOptions. | ||
@@ -40,2 +44,3 @@ // If no one is passed, figure out with via heuristic | ||
}; | ||
exports.request = request; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@faststore/graphql-utils", | ||
"version": "1.9.14", | ||
"version": "1.10.4", | ||
"description": "GraphQL utilities", | ||
@@ -34,3 +34,3 @@ "repository": { | ||
}, | ||
"gitHead": "d37facb5b238781bb18ce48afb1b245e5c53038b" | ||
"gitHead": "d36bb24a69f08701be27ac2f98b07905cfe2d9dc" | ||
} |
{ | ||
"extends": "shared/tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "dist" | ||
"outDir": "dist", | ||
"module": "commonjs" | ||
}, | ||
"include": ["src"] | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
56418
313