@graphql-hive/gateway-runtime 2.1.0 → 2.1.1-alpha-698fc3cbff9e05bc1120bc3a4f3b0fbc9179f954
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/CHANGELOG.md +10 -0
- package/dist/index.cjs +29 -0
- package/dist/index.js +29 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @graphql-hive/gateway-runtime
|
|
2
2
|
|
|
3
|
+
## 2.1.1-alpha-698fc3cbff9e05bc1120bc3a4f3b0fbc9179f954
|
|
4
|
+
### Patch Changes
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
- [#1468](https://github.com/graphql-hive/gateway/pull/1468) [`e43a6c1`](https://github.com/graphql-hive/gateway/commit/e43a6c1917d3c195bc31b20b3caee2b0deaa9c7b) Thanks [@ardatan](https://github.com/ardatan)! - When using the custom store mode for persisted operations, the Hive's `documentId` spec wasn't supported by default.
|
|
9
|
+
|
|
10
|
+
- Updated dependencies []:
|
|
11
|
+
- @graphql-mesh/hmac-upstream-signature@2.0.1
|
|
12
|
+
|
|
3
13
|
## 2.1.0
|
|
4
14
|
### Minor Changes
|
|
5
15
|
|
package/dist/index.cjs
CHANGED
|
@@ -328,6 +328,34 @@ function getDirectiveNameForFederationDirective({
|
|
|
328
328
|
}
|
|
329
329
|
return normalizedDirectiveName;
|
|
330
330
|
}
|
|
331
|
+
const specs = [
|
|
332
|
+
function extractPersistedOperationIdByApolloSpec(params) {
|
|
333
|
+
const persistedQuery = params.extensions?.["persistedQuery"];
|
|
334
|
+
if (persistedQuery != null && typeof persistedQuery === "object" && persistedQuery["version"] === 1 && typeof persistedQuery["sha256Hash"] === "string") {
|
|
335
|
+
return persistedQuery["sha256Hash"];
|
|
336
|
+
}
|
|
337
|
+
return null;
|
|
338
|
+
},
|
|
339
|
+
function extractPersistedOperationIdByHiveSpec(params, request, _context) {
|
|
340
|
+
if ("documentId" in params && typeof params.documentId === "string") {
|
|
341
|
+
return params.documentId;
|
|
342
|
+
}
|
|
343
|
+
const documentId = new URL(request.url).searchParams.get("documentId");
|
|
344
|
+
if (documentId) {
|
|
345
|
+
return documentId;
|
|
346
|
+
}
|
|
347
|
+
return null;
|
|
348
|
+
}
|
|
349
|
+
];
|
|
350
|
+
const defaultExtractPersistedOperationId = function defaultExtractPersistedOperationId2(params, request, context) {
|
|
351
|
+
for (const spec of specs) {
|
|
352
|
+
const id = spec(params, request, context);
|
|
353
|
+
if (id) {
|
|
354
|
+
return id;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
return null;
|
|
358
|
+
};
|
|
331
359
|
|
|
332
360
|
const defaultLoadedPlacePrefix = "GraphOS Managed Federation";
|
|
333
361
|
function decideMaxRetries({
|
|
@@ -1987,6 +2015,7 @@ function createGatewayRuntime(config) {
|
|
|
1987
2015
|
});
|
|
1988
2016
|
} else if (config.persistedDocuments && "getPersistedOperation" in config.persistedDocuments) {
|
|
1989
2017
|
const plugin = pluginPersistedOperations.usePersistedOperations({
|
|
2018
|
+
extractPersistedOperationId: defaultExtractPersistedOperationId,
|
|
1990
2019
|
...configContext,
|
|
1991
2020
|
...config.persistedDocuments
|
|
1992
2021
|
});
|
package/dist/index.js
CHANGED
|
@@ -327,6 +327,34 @@ function getDirectiveNameForFederationDirective({
|
|
|
327
327
|
}
|
|
328
328
|
return normalizedDirectiveName;
|
|
329
329
|
}
|
|
330
|
+
const specs = [
|
|
331
|
+
function extractPersistedOperationIdByApolloSpec(params) {
|
|
332
|
+
const persistedQuery = params.extensions?.["persistedQuery"];
|
|
333
|
+
if (persistedQuery != null && typeof persistedQuery === "object" && persistedQuery["version"] === 1 && typeof persistedQuery["sha256Hash"] === "string") {
|
|
334
|
+
return persistedQuery["sha256Hash"];
|
|
335
|
+
}
|
|
336
|
+
return null;
|
|
337
|
+
},
|
|
338
|
+
function extractPersistedOperationIdByHiveSpec(params, request, _context) {
|
|
339
|
+
if ("documentId" in params && typeof params.documentId === "string") {
|
|
340
|
+
return params.documentId;
|
|
341
|
+
}
|
|
342
|
+
const documentId = new URL(request.url).searchParams.get("documentId");
|
|
343
|
+
if (documentId) {
|
|
344
|
+
return documentId;
|
|
345
|
+
}
|
|
346
|
+
return null;
|
|
347
|
+
}
|
|
348
|
+
];
|
|
349
|
+
const defaultExtractPersistedOperationId = function defaultExtractPersistedOperationId2(params, request, context) {
|
|
350
|
+
for (const spec of specs) {
|
|
351
|
+
const id = spec(params, request, context);
|
|
352
|
+
if (id) {
|
|
353
|
+
return id;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
return null;
|
|
357
|
+
};
|
|
330
358
|
|
|
331
359
|
const defaultLoadedPlacePrefix = "GraphOS Managed Federation";
|
|
332
360
|
function decideMaxRetries({
|
|
@@ -1986,6 +2014,7 @@ function createGatewayRuntime(config) {
|
|
|
1986
2014
|
});
|
|
1987
2015
|
} else if (config.persistedDocuments && "getPersistedOperation" in config.persistedDocuments) {
|
|
1988
2016
|
const plugin = usePersistedOperations({
|
|
2017
|
+
extractPersistedOperationId: defaultExtractPersistedOperationId,
|
|
1989
2018
|
...configContext,
|
|
1990
2019
|
...config.persistedDocuments
|
|
1991
2020
|
});
|