Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/@graphql-hive_gateway-620-dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@graphql-hive/gateway': patch
---

dependencies updates:

- Updated dependency [`@graphql-tools/utils@^10.8.1` ↗︎](https://www.npmjs.com/package/@graphql-tools/utils/v/10.8.1) (from `^10.7.0`, in `dependencies`)
7 changes: 7 additions & 0 deletions .changeset/@graphql-hive_gateway-runtime-620-dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@graphql-hive/gateway-runtime': patch
---

dependencies updates:

- Updated dependency [`@graphql-tools/utils@^10.8.1` ↗︎](https://www.npmjs.com/package/@graphql-tools/utils/v/10.8.1) (from `^10.7.0`, in `dependencies`)
7 changes: 7 additions & 0 deletions .changeset/@graphql-mesh_fusion-runtime-620-dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@graphql-mesh/fusion-runtime': patch
---

dependencies updates:

- Updated dependency [`@graphql-tools/utils@^10.8.1` ↗︎](https://www.npmjs.com/package/@graphql-tools/utils/v/10.8.1) (from `^10.7.0`, in `dependencies`)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@graphql-mesh/hmac-upstream-signature': patch
---

dependencies updates:

- Updated dependency [`@graphql-tools/utils@^10.8.1` ↗︎](https://www.npmjs.com/package/@graphql-tools/utils/v/10.8.1) (from `^10.7.0`, in `dependencies`)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@graphql-mesh/plugin-opentelemetry': patch
---

dependencies updates:

- Updated dependency [`@graphql-tools/utils@^10.8.1` ↗︎](https://www.npmjs.com/package/@graphql-tools/utils/v/10.8.1) (from `^10.7.0`, in `dependencies`)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@graphql-mesh/plugin-prometheus': patch
---

dependencies updates:

- Updated dependency [`@graphql-tools/utils@^10.8.1` ↗︎](https://www.npmjs.com/package/@graphql-tools/utils/v/10.8.1) (from `^10.7.0`, in `dependencies`)
7 changes: 7 additions & 0 deletions .changeset/@graphql-mesh_transport-common-620-dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@graphql-mesh/transport-common': patch
---

dependencies updates:

- Updated dependency [`@graphql-tools/utils@^10.8.1` ↗︎](https://www.npmjs.com/package/@graphql-tools/utils/v/10.8.1) (from `^10.7.0`, in `dependencies`)
7 changes: 7 additions & 0 deletions .changeset/@graphql-mesh_transport-http-620-dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@graphql-mesh/transport-http': patch
---

dependencies updates:

- Updated dependency [`@graphql-tools/utils@^10.8.1` ↗︎](https://www.npmjs.com/package/@graphql-tools/utils/v/10.8.1) (from `^10.7.0`, in `dependencies`)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@graphql-mesh/transport-http-callback': patch
---

dependencies updates:

- Updated dependency [`@graphql-tools/utils@^10.8.1` ↗︎](https://www.npmjs.com/package/@graphql-tools/utils/v/10.8.1) (from `^10.7.0`, in `dependencies`)
7 changes: 7 additions & 0 deletions .changeset/@graphql-mesh_transport-ws-620-dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@graphql-mesh/transport-ws': patch
---

dependencies updates:

- Updated dependency [`@graphql-tools/utils@^10.8.1` ↗︎](https://www.npmjs.com/package/@graphql-tools/utils/v/10.8.1) (from `^10.7.0`, in `dependencies`)
7 changes: 7 additions & 0 deletions .changeset/@graphql-tools_batch-delegate-620-dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@graphql-tools/batch-delegate': patch
---

dependencies updates:

- Updated dependency [`@graphql-tools/utils@^10.8.1` ↗︎](https://www.npmjs.com/package/@graphql-tools/utils/v/10.8.1) (from `^10.7.0`, in `dependencies`)
7 changes: 7 additions & 0 deletions .changeset/@graphql-tools_batch-execute-620-dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@graphql-tools/batch-execute': patch
---

dependencies updates:

- Updated dependency [`@graphql-tools/utils@^10.8.1` ↗︎](https://www.npmjs.com/package/@graphql-tools/utils/v/10.8.1) (from `^10.7.0`, in `dependencies`)
7 changes: 7 additions & 0 deletions .changeset/@graphql-tools_delegate-620-dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@graphql-tools/delegate': patch
---

dependencies updates:

- Updated dependency [`@graphql-tools/utils@^10.8.1` ↗︎](https://www.npmjs.com/package/@graphql-tools/utils/v/10.8.1) (from `^10.7.0`, in `dependencies`)
7 changes: 7 additions & 0 deletions .changeset/@graphql-tools_executor-common-620-dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@graphql-tools/executor-common': patch
---

dependencies updates:

- Updated dependency [`@graphql-tools/utils@^10.8.1` ↗︎](https://www.npmjs.com/package/@graphql-tools/utils/v/10.8.1) (from `^10.7.0`, in `dependencies`)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@graphql-tools/executor-graphql-ws': patch
---

dependencies updates:

- Updated dependency [`@graphql-tools/utils@^10.8.1` ↗︎](https://www.npmjs.com/package/@graphql-tools/utils/v/10.8.1) (from `^10.7.0`, in `dependencies`)
7 changes: 7 additions & 0 deletions .changeset/@graphql-tools_executor-http-620-dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@graphql-tools/executor-http': patch
---

dependencies updates:

- Updated dependency [`@graphql-tools/utils@^10.8.1` ↗︎](https://www.npmjs.com/package/@graphql-tools/utils/v/10.8.1) (from `^10.7.0`, in `dependencies`)
7 changes: 7 additions & 0 deletions .changeset/@graphql-tools_federation-620-dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@graphql-tools/federation': patch
---

dependencies updates:

- Updated dependency [`@graphql-tools/utils@^10.8.1` ↗︎](https://www.npmjs.com/package/@graphql-tools/utils/v/10.8.1) (from `^10.7.0`, in `dependencies`)
7 changes: 7 additions & 0 deletions .changeset/@graphql-tools_stitch-620-dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@graphql-tools/stitch': patch
---

dependencies updates:

- Updated dependency [`@graphql-tools/utils@^10.8.1` ↗︎](https://www.npmjs.com/package/@graphql-tools/utils/v/10.8.1) (from `^10.7.0`, in `dependencies`)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@graphql-tools/stitching-directives': patch
---

dependencies updates:

- Updated dependency [`@graphql-tools/utils@^10.8.1` ↗︎](https://www.npmjs.com/package/@graphql-tools/utils/v/10.8.1) (from `^10.7.0`, in `dependencies`)
7 changes: 7 additions & 0 deletions .changeset/@graphql-tools_wrap-620-dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@graphql-tools/wrap': patch
---

dependencies updates:

- Updated dependency [`@graphql-tools/utils@^10.8.1` ↗︎](https://www.npmjs.com/package/@graphql-tools/utils/v/10.8.1) (from `^10.7.0`, in `dependencies`)
44 changes: 22 additions & 22 deletions e2e/federation-batching-plan/federation-batching-plan.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -492,17 +492,17 @@ it('should consistently explain the query plan', async () => {
"variables": {},
},
{
"query": "query TestQuery($_0__v0_representations: [_Any!]!, $_1__v0_representations: [_Any!]!) {
_0___typename: __typename
_0__entities: _entities(representations: $_0__v0_representations) {
"query": "query TestQuery($_v0_representations: [_Any!]!, $_v1_representations: [_Any!]!) {
_v0___typename: __typename
_v0__entities: _entities(representations: $_v0_representations) {
__typename
... on Product {
upc
inStock
}
}
_1___typename: __typename
_1__entities: _entities(representations: $_1__v0_representations) {
_v1___typename: __typename
_v1__entities: _entities(representations: $_v1_representations) {
__typename
... on Product {
upc
Expand All @@ -512,7 +512,7 @@ it('should consistently explain the query plan', async () => {
}",
"subgraphName": "inventory",
"variables": {
"_0__v0_representations": [
"_v0_representations": [
{
"__typename": "Product",
"price": 899,
Expand All @@ -532,7 +532,7 @@ it('should consistently explain the query plan', async () => {
"weight": 50,
},
],
"_1__v0_representations": [
"_v1_representations": [
{
"__typename": "Product",
"price": 899,
Expand All @@ -555,9 +555,9 @@ it('should consistently explain the query plan', async () => {
},
},
{
"query": "query TestQuery($_v0_first: Int) {
"query": "query TestQuery($first: Int) {
__typename
topProducts(first: $_v0_first) {
topProducts(first: $first) {
__typename
...Product
upc
Expand All @@ -576,13 +576,13 @@ it('should consistently explain the query plan', async () => {
}",
"subgraphName": "products",
"variables": {
"_v0_first": 5,
"first": 5,
},
},
{
"query": "query TestQuery($_v0_representations: [_Any!]!) {
"query": "query TestQuery($representations: [_Any!]!) {
__typename
_entities(representations: $_v0_representations) {
_entities(representations: $representations) {
__typename
... on Product {
upc
Expand All @@ -596,7 +596,7 @@ it('should consistently explain the query plan', async () => {
}",
"subgraphName": "products",
"variables": {
"_v0_representations": [
"representations": [
{
"__typename": "Product",
"upc": "1",
Expand All @@ -613,9 +613,9 @@ it('should consistently explain the query plan', async () => {
},
},
{
"query": "query TestQuery($_v0_representations: [_Any!]!) {
"query": "query TestQuery($representations: [_Any!]!) {
__typename
_entities(representations: $_v0_representations) {
_entities(representations: $representations) {
__typename
... on Product {
upc
Expand Down Expand Up @@ -662,7 +662,7 @@ it('should consistently explain the query plan', async () => {
}",
"subgraphName": "reviews",
"variables": {
"_v0_representations": [
"representations": [
{
"__typename": "Product",
"upc": "1",
Expand All @@ -679,9 +679,9 @@ it('should consistently explain the query plan', async () => {
},
},
{
"query": "query TestQuery($_v0_representations: [_Any!]!) {
"query": "query TestQuery($representations: [_Any!]!) {
__typename
_entities(representations: $_v0_representations) {
_entities(representations: $representations) {
__typename
... on User {
id
Expand Down Expand Up @@ -738,7 +738,7 @@ it('should consistently explain the query plan', async () => {
}",
"subgraphName": "reviews",
"variables": {
"_v0_representations": [
"representations": [
{
"__typename": "User",
"id": "1",
Expand All @@ -751,9 +751,9 @@ it('should consistently explain the query plan', async () => {
},
},
{
"query": "query TestQuery($_v0_representations: [_Any!]!) {
"query": "query TestQuery($representations: [_Any!]!) {
__typename
_entities(representations: $_v0_representations) {
_entities(representations: $representations) {
__typename
... on User {
id
Expand All @@ -764,7 +764,7 @@ it('should consistently explain the query plan', async () => {
}",
"subgraphName": "accounts",
"variables": {
"_v0_representations": [
"representations": [
{
"__typename": "User",
"id": "1",
Expand Down
2 changes: 1 addition & 1 deletion packages/batch-delegate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
},
"dependencies": {
"@graphql-tools/delegate": "workspace:^",
"@graphql-tools/utils": "^10.7.0",
"@graphql-tools/utils": "^10.8.1",
"dataloader": "^2.2.3",
"tslib": "^2.8.1"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/batch-execute/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
},
"dependencies": {
"@graphql-tools/utils": "^10.7.0",
"@graphql-tools/utils": "^10.8.1",
"dataloader": "^2.2.3",
"tslib": "^2.8.1"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/batch-execute/src/prefix.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// adapted from https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-source-graphql/src/batching/merge-queries.js

export function createPrefix(index: number): string {
return `_${index}_`;
return `_v${index}_`;
}

export type KeyMatch = { index: number; originalKey: string };

function matchKey(prefixedKey: string): KeyMatch | null {
const match = /^_(\d+)_(.*)$/.exec(prefixedKey);
const match = /^_v(\d+)_(.*)$/.exec(prefixedKey);
if (match && match.length === 3 && !isNaN(Number(match[1])) && match[2]) {
return { index: Number(match[1]), originalKey: match[2] };
}
Expand Down
18 changes: 9 additions & 9 deletions packages/batch-execute/tests/batchExecute.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ describe('batch execution', () => {

expect(first?.data).toEqual({ field3: '1' });
expect(second?.data).toEqual({ field3: '2' });
expect(executorVariables).toEqual({ _0_a: '1', _1_a: '2' });
expect(executorVariables).toEqual({ _v0_a: '1', _v1_a: '2' });
expect(executorCalls).toEqual(1);
});

Expand All @@ -155,8 +155,8 @@ describe('batch execution', () => {
])) as ExecutionResult[];

const squishedDoc = executorDocument?.replace(/\s+/g, ' ');
expect(squishedDoc).toMatch('... on Query { _0_field1: field1 }');
expect(squishedDoc).toMatch('... on Query { _1_field2: field2 }');
expect(squishedDoc).toMatch('... on Query { _v0_field1: field1 }');
expect(squishedDoc).toMatch('... on Query { _v1_field2: field2 }');
expect(first?.data).toEqual({ field1: '1' });
expect(second?.data).toEqual({ field2: '2' });
expect(executorCalls).toEqual(1);
Expand All @@ -177,10 +177,10 @@ describe('batch execution', () => {
])) as ExecutionResult[];

const squishedDoc = executorDocument?.replace(/\s+/g, ' ');
expect(squishedDoc).toMatch('_0_widget: widget { ..._0_A }');
expect(squishedDoc).toMatch('_1_widget: widget { ..._1_A }');
expect(squishedDoc).toMatch('fragment _0_A on Widget');
expect(squishedDoc).toMatch('fragment _1_A on Widget');
expect(squishedDoc).toMatch('_v0_widget: widget { ..._v0_A }');
expect(squishedDoc).toMatch('_v1_widget: widget { ..._v1_A }');
expect(squishedDoc).toMatch('fragment _v0_A on Widget');
expect(squishedDoc).toMatch('fragment _v1_A on Widget');
expect(first?.data).toEqual({ widget: { name: 'wingnut' } });
expect(second?.data).toEqual({ widget: { name: 'wingnut' } });
expect(executorCalls).toEqual(1);
Expand Down Expand Up @@ -261,12 +261,12 @@ describe('batch execution', () => {
const [first, second] = (await Promise.all([
batchExec({
document: parse(
'{ boomWithPath(message: "unexpected error", path: ["some-prefix", "_0_boomWithPath", "foo"]) }',
'{ boomWithPath(message: "unexpected error", path: ["some-prefix", "_v0_boomWithPath", "foo"]) }',
),
}),
batchExec({
document: parse(
'{ boomWithPath(message: "another unexpected error", path: ["some", "other", "prefix", "_1_boomWithPath", "bar"]) }',
'{ boomWithPath(message: "another unexpected error", path: ["some", "other", "prefix", "_v1_boomWithPath", "bar"]) }',
),
}),
])) as ExecutionResult[];
Expand Down
2 changes: 1 addition & 1 deletion packages/delegate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"@graphql-tools/batch-execute": "workspace:^",
"@graphql-tools/executor": "^1.3.10",
"@graphql-tools/schema": "^10.0.11",
"@graphql-tools/utils": "^10.7.0",
"@graphql-tools/utils": "^10.8.1",
"@repeaterjs/repeater": "^3.0.6",
"dataloader": "^2.2.3",
"dset": "^3.1.2",
Expand Down
Loading
Loading