@cedarjs/api-server 2.3.0 → 2.3.1-next.79

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/bin.js CHANGED
@@ -500,27 +500,17 @@ async function redwoodFastifyGraphQLServer(fastify2, options) {
500
500
  }
501
501
  }
502
502
  const { yoga } = createGraphQLYoga(graphqlOptions);
503
- const graphQLYogaHandler = async (req, reply) => {
504
- const response = await yoga.handleNodeRequest(req, {
505
- req,
506
- reply,
507
- event: lambdaEventForFastifyRequest(req),
508
- requestContext: {}
509
- });
510
- for (const [name, value] of response.headers) {
511
- reply.header(name, value);
512
- }
513
- reply.status(response.status);
514
- reply.send(response.body);
515
- return reply;
516
- };
517
503
  const graphqlEndpoint = trimSlashes(yoga.graphqlEndpoint);
518
504
  const routePaths = ["", "/health", "/readiness", "/stream"];
519
505
  for (const routePath of routePaths) {
520
506
  fastify2.route({
521
507
  url: `${redwoodOptions.apiRootPath}${graphqlEndpoint}${routePath}`,
522
508
  method,
523
- handler: (req, reply) => graphQLYogaHandler(req, reply)
509
+ handler: (req, reply) => yoga.handleNodeRequestAndResponse(req, reply, {
510
+ req,
511
+ reply,
512
+ event: lambdaEventForFastifyRequest(req)
513
+ })
524
514
  });
525
515
  }
526
516
  fastify2.addHook("onReady", (done) => {
package/dist/cjs/bin.js CHANGED
@@ -516,27 +516,17 @@ async function redwoodFastifyGraphQLServer(fastify2, options) {
516
516
  }
517
517
  }
518
518
  const { yoga } = (0, import_graphql_server.createGraphQLYoga)(graphqlOptions);
519
- const graphQLYogaHandler = async (req, reply) => {
520
- const response = await yoga.handleNodeRequest(req, {
521
- req,
522
- reply,
523
- event: lambdaEventForFastifyRequest(req),
524
- requestContext: {}
525
- });
526
- for (const [name, value] of response.headers) {
527
- reply.header(name, value);
528
- }
529
- reply.status(response.status);
530
- reply.send(response.body);
531
- return reply;
532
- };
533
519
  const graphqlEndpoint = trimSlashes(yoga.graphqlEndpoint);
534
520
  const routePaths = ["", "/health", "/readiness", "/stream"];
535
521
  for (const routePath of routePaths) {
536
522
  fastify2.route({
537
523
  url: `${redwoodOptions.apiRootPath}${graphqlEndpoint}${routePath}`,
538
524
  method,
539
- handler: (req, reply) => graphQLYogaHandler(req, reply)
525
+ handler: (req, reply) => yoga.handleNodeRequestAndResponse(req, reply, {
526
+ req,
527
+ reply,
528
+ event: lambdaEventForFastifyRequest(req)
529
+ })
540
530
  });
541
531
  }
542
532
  fastify2.addHook("onReady", (done) => {
@@ -1 +1 @@
1
- {"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../../../src/plugins/graphql.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,eAAe,EAIhB,MAAM,SAAS,CAAA;AAMhB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAKjE,MAAM,WAAW,4BAA4B;IAC3C,OAAO,EAAE;QACP,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,OAAO,CAAC,EAAE,kBAAkB,CAAA;KAC7B,CAAA;CACF;AAED,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,eAAe,EACxB,OAAO,EAAE,4BAA4B,iBA8GtC"}
1
+ {"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../../../src/plugins/graphql.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAe,MAAM,SAAS,CAAA;AAM3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAKjE,MAAM,WAAW,4BAA4B;IAC3C,OAAO,EAAE;QACP,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,OAAO,CAAC,EAAE,kBAAkB,CAAA;KAC7B,CAAA;CACF;AAED,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,eAAe,EACxB,OAAO,EAAE,4BAA4B,iBA8FtC"}
@@ -73,27 +73,17 @@ async function redwoodFastifyGraphQLServer(fastify, options) {
73
73
  }
74
74
  }
75
75
  const { yoga } = (0, import_graphql_server.createGraphQLYoga)(graphqlOptions);
76
- const graphQLYogaHandler = async (req, reply) => {
77
- const response = await yoga.handleNodeRequest(req, {
78
- req,
79
- reply,
80
- event: (0, import_awsLambdaFastify.lambdaEventForFastifyRequest)(req),
81
- requestContext: {}
82
- });
83
- for (const [name, value] of response.headers) {
84
- reply.header(name, value);
85
- }
86
- reply.status(response.status);
87
- reply.send(response.body);
88
- return reply;
89
- };
90
76
  const graphqlEndpoint = trimSlashes(yoga.graphqlEndpoint);
91
77
  const routePaths = ["", "/health", "/readiness", "/stream"];
92
78
  for (const routePath of routePaths) {
93
79
  fastify.route({
94
80
  url: `${redwoodOptions.apiRootPath}${graphqlEndpoint}${routePath}`,
95
81
  method,
96
- handler: (req, reply) => graphQLYogaHandler(req, reply)
82
+ handler: (req, reply) => yoga.handleNodeRequestAndResponse(req, reply, {
83
+ req,
84
+ reply,
85
+ event: (0, import_awsLambdaFastify.lambdaEventForFastifyRequest)(req)
86
+ })
97
87
  });
98
88
  }
99
89
  fastify.addHook("onReady", (done) => {
@@ -1 +1 @@
1
- {"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../../src/plugins/graphql.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,eAAe,EAIhB,MAAM,SAAS,CAAA;AAMhB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAKjE,MAAM,WAAW,4BAA4B;IAC3C,OAAO,EAAE;QACP,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,OAAO,CAAC,EAAE,kBAAkB,CAAA;KAC7B,CAAA;CACF;AAED,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,eAAe,EACxB,OAAO,EAAE,4BAA4B,iBA8GtC"}
1
+ {"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../../src/plugins/graphql.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAe,MAAM,SAAS,CAAA;AAM3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAKjE,MAAM,WAAW,4BAA4B;IAC3C,OAAO,EAAE;QACP,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,OAAO,CAAC,EAAE,kBAAkB,CAAA;KAC7B,CAAA;CACF;AAED,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,eAAe,EACxB,OAAO,EAAE,4BAA4B,iBA8FtC"}
@@ -40,27 +40,17 @@ async function redwoodFastifyGraphQLServer(fastify, options) {
40
40
  }
41
41
  }
42
42
  const { yoga } = createGraphQLYoga(graphqlOptions);
43
- const graphQLYogaHandler = async (req, reply) => {
44
- const response = await yoga.handleNodeRequest(req, {
45
- req,
46
- reply,
47
- event: lambdaEventForFastifyRequest(req),
48
- requestContext: {}
49
- });
50
- for (const [name, value] of response.headers) {
51
- reply.header(name, value);
52
- }
53
- reply.status(response.status);
54
- reply.send(response.body);
55
- return reply;
56
- };
57
43
  const graphqlEndpoint = trimSlashes(yoga.graphqlEndpoint);
58
44
  const routePaths = ["", "/health", "/readiness", "/stream"];
59
45
  for (const routePath of routePaths) {
60
46
  fastify.route({
61
47
  url: `${redwoodOptions.apiRootPath}${graphqlEndpoint}${routePath}`,
62
48
  method,
63
- handler: (req, reply) => graphQLYogaHandler(req, reply)
49
+ handler: (req, reply) => yoga.handleNodeRequestAndResponse(req, reply, {
50
+ req,
51
+ reply,
52
+ event: lambdaEventForFastifyRequest(req)
53
+ })
64
54
  });
65
55
  }
66
56
  fastify.addHook("onReady", (done) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/api-server",
3
- "version": "2.3.0",
3
+ "version": "2.3.1-next.79+a599dc0f9",
4
4
  "description": "CedarJS's HTTP server for Serverless Functions",
5
5
  "repository": {
6
6
  "type": "git",
@@ -111,11 +111,11 @@
111
111
  "test:watch": "vitest watch"
112
112
  },
113
113
  "dependencies": {
114
- "@cedarjs/context": "2.3.0",
115
- "@cedarjs/fastify-web": "2.3.0",
116
- "@cedarjs/internal": "2.3.0",
117
- "@cedarjs/project-config": "2.3.0",
118
- "@cedarjs/web-server": "2.3.0",
114
+ "@cedarjs/context": "2.3.1-next.79+a599dc0f9",
115
+ "@cedarjs/fastify-web": "2.3.1-next.79+a599dc0f9",
116
+ "@cedarjs/internal": "2.3.1-next.79+a599dc0f9",
117
+ "@cedarjs/project-config": "2.3.1-next.79+a599dc0f9",
118
+ "@cedarjs/web-server": "2.3.1-next.79+a599dc0f9",
119
119
  "@fastify/multipart": "9.3.0",
120
120
  "@fastify/url-data": "6.0.3",
121
121
  "ansis": "4.2.0",
@@ -155,5 +155,5 @@
155
155
  "publishConfig": {
156
156
  "access": "public"
157
157
  },
158
- "gitHead": "510b35f25fcee3577246502a9e1b6f16f5682f9f"
158
+ "gitHead": "a599dc0f911b124b122d1862cabf32635e53540a"
159
159
  }