@cedarjs/graphql-server 5.0.0-canary.2547 → 5.0.0-canary.2549

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.
@@ -1 +1 @@
1
- {"version":3,"file":"createGraphQLYoga.d.ts","sourceRoot":"","sources":["../../src/createGraphQLYoga.ts"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,kBAAkB,EAAuB,MAAM,YAAY,CAAA;AAEzE,eAAO,MAAM,iBAAiB,GAAU,iVAwBrC,kBAAkB;;;EAgLpB,CAAA"}
1
+ {"version":3,"file":"createGraphQLYoga.d.ts","sourceRoot":"","sources":["../../src/createGraphQLYoga.ts"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAAE,kBAAkB,EAAuB,MAAM,YAAY,CAAA;AAEzE,eAAO,MAAM,iBAAiB,GAAU,iVAwBrC,kBAAkB;;;EAuLpB,CAAA"}
@@ -106,6 +106,7 @@ const createGraphQLYoga = async ({
106
106
  const { useCedarRealtime } = await import("@cedarjs/realtime");
107
107
  plugins.push(useCedarRealtime(realtime));
108
108
  }
109
+ plugins.push((0, import_graphql_yoga.useExecutionCancellation)());
109
110
  const { disableIntrospection } = (0, import_introspection.configureGraphQLIntrospection)({
110
111
  allowIntrospection
111
112
  });
@@ -1 +1 @@
1
- {"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../../../src/functions/graphql.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EAEpB,OAAO,IAAI,aAAa,EACzB,MAAM,YAAY,CAAA;AAQnB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AA4CxD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,GAAI,iUAuBlC,qBAAqB,MA+HpB,OAAO,oBAAoB,EAC3B,SAAS,aAAa,KACrB,OAAO,CAAC,GAAG,CAcf,CAAA"}
1
+ {"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../../../src/functions/graphql.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EAEpB,OAAO,IAAI,aAAa,EACzB,MAAM,YAAY,CAAA;AAQnB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AA4CxD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,GAAI,iUAuBlC,qBAAqB,MA+IpB,OAAO,oBAAoB,EAC3B,SAAS,aAAa,KACrB,OAAO,CAAC,GAAG,CAcf,CAAA"}
@@ -159,15 +159,22 @@ const createGraphQLHandler = ({
159
159
  isBase64Encoded: false
160
160
  };
161
161
  } catch (e) {
162
- logger.error(e);
163
- if (onException) {
164
- onException();
162
+ if (!!e && typeof e === "object" && "code" in e && e.code === "ERR_STREAM_PREMATURE_CLOSE") {
163
+ lambdaResponse = {
164
+ body: JSON.stringify({ error: "Client disconnected" }),
165
+ statusCode: 499
166
+ };
167
+ } else {
168
+ logger.error(e);
169
+ if (onException) {
170
+ onException();
171
+ }
172
+ lambdaResponse = {
173
+ body: JSON.stringify({ error: "GraphQL execution failed" }),
174
+ statusCode: 200
175
+ // should be 500
176
+ };
165
177
  }
166
- lambdaResponse = {
167
- body: JSON.stringify({ error: "GraphQL execution failed" }),
168
- statusCode: 200
169
- // should be 500
170
- };
171
178
  }
172
179
  if (!lambdaResponse.headers) {
173
180
  lambdaResponse.headers = {};
@@ -1 +1 @@
1
- {"version":3,"file":"createGraphQLYoga.d.ts","sourceRoot":"","sources":["../src/createGraphQLYoga.ts"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,kBAAkB,EAAuB,MAAM,YAAY,CAAA;AAEzE,eAAO,MAAM,iBAAiB,GAAU,iVAwBrC,kBAAkB;;;EAgLpB,CAAA"}
1
+ {"version":3,"file":"createGraphQLYoga.d.ts","sourceRoot":"","sources":["../src/createGraphQLYoga.ts"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAAE,kBAAkB,EAAuB,MAAM,YAAY,CAAA;AAEzE,eAAO,MAAM,iBAAiB,GAAU,iVAwBrC,kBAAkB;;;EAuLpB,CAAA"}
@@ -1,7 +1,11 @@
1
1
  import { useDisableIntrospection } from "@envelop/disable-introspection";
2
2
  import { useFilterAllowedOperations } from "@envelop/filter-operation-type";
3
3
  import { OperationTypeNode } from "graphql";
4
- import { useReadinessCheck, createYoga } from "graphql-yoga";
4
+ import {
5
+ useReadinessCheck,
6
+ createYoga,
7
+ useExecutionCancellation
8
+ } from "graphql-yoga";
5
9
  import { mapRwCorsOptionsToYoga } from "./cors.js";
6
10
  import { makeDirectivesForPlugin } from "./directives/makeDirectives.js";
7
11
  import { configureGraphiQLPlayground } from "./graphiql.js";
@@ -83,6 +87,7 @@ const createGraphQLYoga = async ({
83
87
  const { useCedarRealtime } = await import("@cedarjs/realtime");
84
88
  plugins.push(useCedarRealtime(realtime));
85
89
  }
90
+ plugins.push(useExecutionCancellation());
86
91
  const { disableIntrospection } = configureGraphQLIntrospection({
87
92
  allowIntrospection
88
93
  });
@@ -1 +1 @@
1
- {"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../../src/functions/graphql.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EAEpB,OAAO,IAAI,aAAa,EACzB,MAAM,YAAY,CAAA;AAQnB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AA4CxD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,GAAI,iUAuBlC,qBAAqB,MA+HpB,OAAO,oBAAoB,EAC3B,SAAS,aAAa,KACrB,OAAO,CAAC,GAAG,CAcf,CAAA"}
1
+ {"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../../src/functions/graphql.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EAEpB,OAAO,IAAI,aAAa,EACzB,MAAM,YAAY,CAAA;AAQnB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AA4CxD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,GAAI,iUAuBlC,qBAAqB,MA+IpB,OAAO,oBAAoB,EAC3B,SAAS,aAAa,KACrB,OAAO,CAAC,GAAG,CAcf,CAAA"}
@@ -126,15 +126,22 @@ const createGraphQLHandler = ({
126
126
  isBase64Encoded: false
127
127
  };
128
128
  } catch (e) {
129
- logger.error(e);
130
- if (onException) {
131
- onException();
129
+ if (!!e && typeof e === "object" && "code" in e && e.code === "ERR_STREAM_PREMATURE_CLOSE") {
130
+ lambdaResponse = {
131
+ body: JSON.stringify({ error: "Client disconnected" }),
132
+ statusCode: 499
133
+ };
134
+ } else {
135
+ logger.error(e);
136
+ if (onException) {
137
+ onException();
138
+ }
139
+ lambdaResponse = {
140
+ body: JSON.stringify({ error: "GraphQL execution failed" }),
141
+ statusCode: 200
142
+ // should be 500
143
+ };
132
144
  }
133
- lambdaResponse = {
134
- body: JSON.stringify({ error: "GraphQL execution failed" }),
135
- statusCode: 200
136
- // should be 500
137
- };
138
145
  }
139
146
  if (!lambdaResponse.headers) {
140
147
  lambdaResponse.headers = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/graphql-server",
3
- "version": "5.0.0-canary.2547",
3
+ "version": "5.0.0-canary.2549",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/cedarjs/cedar.git",
@@ -37,8 +37,8 @@
37
37
  "test:watch": "yarn test --watch"
38
38
  },
39
39
  "dependencies": {
40
- "@cedarjs/api": "5.0.0-canary.2547",
41
- "@cedarjs/context": "5.0.0-canary.2547",
40
+ "@cedarjs/api": "5.0.0-canary.2549",
41
+ "@cedarjs/context": "5.0.0-canary.2549",
42
42
  "@envelop/core": "5.5.1",
43
43
  "@envelop/depth-limit": "4.0.0",
44
44
  "@envelop/disable-introspection": "6.0.0",
@@ -61,9 +61,9 @@
61
61
  "devDependencies": {
62
62
  "@babel/cli": "7.29.7",
63
63
  "@babel/core": "^7.26.10",
64
- "@cedarjs/framework-tools": "5.0.0-canary.2547",
65
- "@cedarjs/project-config": "5.0.0-canary.2547",
66
- "@cedarjs/realtime": "5.0.0-canary.2547",
64
+ "@cedarjs/framework-tools": "5.0.0-canary.2549",
65
+ "@cedarjs/project-config": "5.0.0-canary.2549",
66
+ "@cedarjs/realtime": "5.0.0-canary.2549",
67
67
  "@envelop/types": "5.2.1",
68
68
  "@types/aws-lambda": "8.10.162",
69
69
  "@types/jsonwebtoken": "9.0.10",