@luvio/graphql 0.142.1 → 0.142.2
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/luvioGraphql.js +15 -0
- package/dist/luvioGraphql.mjs +15 -1
- package/dist/types/document.d.ts +8 -0
- package/dist/types/main.d.ts +1 -0
- package/package.json +3 -3
package/dist/luvioGraphql.js
CHANGED
|
@@ -116,8 +116,23 @@ function buildQueryTypeStructuredKey(args) {
|
|
|
116
116
|
});
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
+
/**
|
|
120
|
+
* @description Spec compliant way to retrieve the correct Operation from the Document that Luvio should operate on. https://spec.graphql.org/June2018/#sec-Named-Operation-Definitions
|
|
121
|
+
* @param document
|
|
122
|
+
* @param operationName
|
|
123
|
+
* @returns The Operation in the GraphQL document we should use for the current call.
|
|
124
|
+
*/
|
|
125
|
+
function getOperationFromDocument(document, operationName) {
|
|
126
|
+
const operations = document.definitions.filter((def) => def.kind === 'OperationDefinition');
|
|
127
|
+
if (operationName) {
|
|
128
|
+
return operations.find((def) => def.name !== undefined && def.name.value === operationName);
|
|
129
|
+
}
|
|
130
|
+
return operations[0]; // If a named operation is not provided, we return the first one
|
|
131
|
+
}
|
|
132
|
+
|
|
119
133
|
exports.buildQueryTypeStringKey = buildQueryTypeStringKey;
|
|
120
134
|
exports.buildQueryTypeStructuredKey = buildQueryTypeStructuredKey;
|
|
121
135
|
exports.createFragmentMap = createFragmentMap;
|
|
136
|
+
exports.getOperationFromDocument = getOperationFromDocument;
|
|
122
137
|
exports.serializeFieldArguments = serializeFieldArguments;
|
|
123
138
|
exports.serializeOperationNode = serializeOperationNode;
|
package/dist/luvioGraphql.mjs
CHANGED
|
@@ -114,4 +114,18 @@ function buildQueryTypeStructuredKey(args) {
|
|
|
114
114
|
});
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
/**
|
|
118
|
+
* @description Spec compliant way to retrieve the correct Operation from the Document that Luvio should operate on. https://spec.graphql.org/June2018/#sec-Named-Operation-Definitions
|
|
119
|
+
* @param document
|
|
120
|
+
* @param operationName
|
|
121
|
+
* @returns The Operation in the GraphQL document we should use for the current call.
|
|
122
|
+
*/
|
|
123
|
+
function getOperationFromDocument(document, operationName) {
|
|
124
|
+
const operations = document.definitions.filter((def) => def.kind === 'OperationDefinition');
|
|
125
|
+
if (operationName) {
|
|
126
|
+
return operations.find((def) => def.name !== undefined && def.name.value === operationName);
|
|
127
|
+
}
|
|
128
|
+
return operations[0]; // If a named operation is not provided, we return the first one
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export { buildQueryTypeStringKey, buildQueryTypeStructuredKey, createFragmentMap, getOperationFromDocument, serializeFieldArguments, serializeOperationNode };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DocumentNode, OperationDefinitionNode } from '@luvio/graphql-parser';
|
|
2
|
+
/**
|
|
3
|
+
* @description Spec compliant way to retrieve the correct Operation from the Document that Luvio should operate on. https://spec.graphql.org/June2018/#sec-Named-Operation-Definitions
|
|
4
|
+
* @param document
|
|
5
|
+
* @param operationName
|
|
6
|
+
* @returns The Operation in the GraphQL document we should use for the current call.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getOperationFromDocument(document: DocumentNode, operationName?: string): OperationDefinitionNode | undefined;
|
package/dist/types/main.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luvio/graphql",
|
|
3
|
-
"version": "0.142.
|
|
3
|
+
"version": "0.142.2",
|
|
4
4
|
"description": "GraphQL utilities for Luvio GraphQL adapter support",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"test:size": "luvioBundlesize"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@luvio/engine": "^0.142.
|
|
31
|
-
"@luvio/graphql-parser": "^0.142.
|
|
30
|
+
"@luvio/engine": "^0.142.2",
|
|
31
|
+
"@luvio/graphql-parser": "^0.142.2"
|
|
32
32
|
},
|
|
33
33
|
"volta": {
|
|
34
34
|
"extends": "../../../package.json"
|