@salesforce/lds-luvio-onestore-graphql-parser 1.400.0 → 1.402.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +53 -1
- package/package.json +2 -2
package/dist/main.js
CHANGED
|
@@ -3171,5 +3171,57 @@ function gql(literals, ...subs) {
|
|
|
3171
3171
|
}
|
|
3172
3172
|
return updateReferenceMapAndGetKey(insertFragments(document, inputSubstitutionFragments));
|
|
3173
3173
|
}
|
|
3174
|
+
function findExecutableOperation(document, operationName) {
|
|
3175
|
+
const operations = document.definitions.filter(
|
|
3176
|
+
(def) => def.kind === Kind.OPERATION_DEFINITION
|
|
3177
|
+
);
|
|
3178
|
+
if (operations.length === 0) {
|
|
3179
|
+
return void 0;
|
|
3180
|
+
}
|
|
3181
|
+
if (operations.length === 1 && !operationName) {
|
|
3182
|
+
return operations[0];
|
|
3183
|
+
}
|
|
3184
|
+
if (operationName) {
|
|
3185
|
+
return operations.find((op) => {
|
|
3186
|
+
var _a;
|
|
3187
|
+
return ((_a = op.name) == null ? void 0 : _a.value) === operationName;
|
|
3188
|
+
});
|
|
3189
|
+
}
|
|
3190
|
+
return void 0;
|
|
3191
|
+
}
|
|
3192
|
+
function validateGraphQLOperations(config, options) {
|
|
3193
|
+
const executableOperation = findExecutableOperation(config.query, config.operationName);
|
|
3194
|
+
if (executableOperation) {
|
|
3195
|
+
const operationType = executableOperation.operation;
|
|
3196
|
+
if (!options.acceptedOperations.includes(operationType)) {
|
|
3197
|
+
const operationTypeCapitalized = operationType.charAt(0).toUpperCase() + operationType.slice(1);
|
|
3198
|
+
throw new Error(
|
|
3199
|
+
`${operationTypeCapitalized} operations are not supported in this context`
|
|
3200
|
+
);
|
|
3201
|
+
}
|
|
3202
|
+
}
|
|
3203
|
+
}
|
|
3204
|
+
function resolveAst(ast) {
|
|
3205
|
+
if (ast === null || ast === void 0) {
|
|
3206
|
+
return;
|
|
3207
|
+
}
|
|
3208
|
+
const result = astResolver(ast);
|
|
3209
|
+
if (result === void 0) {
|
|
3210
|
+
throw new Error("Could not resolve AST. Did you parse the query with gql?");
|
|
3211
|
+
}
|
|
3212
|
+
return result;
|
|
3213
|
+
}
|
|
3214
|
+
function wrapConfigAndVerify(config, options) {
|
|
3215
|
+
if (config == null ? void 0 : config.query) {
|
|
3216
|
+
config = { ...config, query: resolveAst(config.query) };
|
|
3217
|
+
if (config.query === void 0) {
|
|
3218
|
+
throw new Error("Internal error in GraphQL adapter occurred: Unable to resolve query");
|
|
3219
|
+
}
|
|
3220
|
+
validateGraphQLOperations(config, {
|
|
3221
|
+
acceptedOperations: (options == null ? void 0 : options.acceptedOperations) ?? ["query"]
|
|
3222
|
+
});
|
|
3223
|
+
}
|
|
3224
|
+
return config;
|
|
3225
|
+
}
|
|
3174
3226
|
|
|
3175
|
-
export { Kind, astResolver, gql, parse, print, visit };
|
|
3227
|
+
export { Kind, astResolver, gql, parse, print, resolveAst, validateGraphQLOperations, visit, wrapConfigAndVerify };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-luvio-onestore-graphql-parser",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.402.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"description": "Re-export of the @conduit-client/graphql package for use in adapters",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"test:debug": "node --inspect-brk ../../node_modules/.bin/jest --runInBand"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@conduit-client/onestore-graphql-parser": "2.0
|
|
31
|
+
"@conduit-client/onestore-graphql-parser": "3.2.0"
|
|
32
32
|
},
|
|
33
33
|
"nx": {
|
|
34
34
|
"targets": {
|