@cedarjs/api-server 4.2.1-next.0 → 4.2.1-next.258

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
@@ -20,6 +20,9 @@ function getAPIHost() {
20
20
  function getAPIPort() {
21
21
  return process.env.REDWOOD_API_PORT ? parseInt(process.env.REDWOOD_API_PORT) : getConfig().api.port;
22
22
  }
23
+ function getAPIRootPath() {
24
+ return process.env.CEDAR_API_ROOT_PATH ?? "/";
25
+ }
23
26
  function getWebHost() {
24
27
  let host = process.env.REDWOOD_WEB_HOST;
25
28
  host ??= getConfig().web.host;
@@ -107,7 +110,7 @@ var init_createServerHelpers = __esm({
107
110
  "use strict";
108
111
  init_cliHelpers();
109
112
  getDefaultCreateServerOptions = () => ({
110
- apiRootPath: "/",
113
+ apiRootPath: getAPIRootPath(),
111
114
  logger: {
112
115
  level: process.env.LOG_LEVEL ?? (process.env.NODE_ENV === "development" ? "debug" : "warn")
113
116
  },
@@ -349,7 +352,7 @@ var init_lambdaLoader = __esm({
349
352
  const imports = foundFunctions.map(async (fnPath) => {
350
353
  const ts = Date.now();
351
354
  const routeName = path2.basename(fnPath).replace(".js", "");
352
- const routePath = routeName === "graphql" ? "/graphql" : `/${routeName}`;
355
+ const routePath = `/${routeName}`;
353
356
  const fnImport = await import(pathToFileURL2(fnPath).href);
354
357
  const handler3 = (() => {
355
358
  if ("handler" in fnImport) {
@@ -561,11 +564,11 @@ async function redwoodFastifyGraphQLServer(fastify2, options) {
561
564
  absolute: true
562
565
  });
563
566
  const filePath = pathToFileURL3(graphqlFunctionPath).href;
564
- const { __rw_graphqlOptions } = await import(filePath);
565
- if (!__rw_graphqlOptions) {
567
+ const { __cedar_graphqlOptions } = await import(filePath);
568
+ if (!__cedar_graphqlOptions) {
566
569
  return;
567
570
  }
568
- redwoodOptions.graphql = __rw_graphqlOptions;
571
+ redwoodOptions.graphql = __cedar_graphqlOptions;
569
572
  }
570
573
  const graphqlOptions = redwoodOptions.graphql;
571
574
  if (graphqlOptions?.realtime?.subscriptions) {
@@ -578,17 +581,24 @@ async function redwoodFastifyGraphQLServer(fastify2, options) {
578
581
  fastify2.route({
579
582
  url: `${redwoodOptions.apiRootPath}${graphqlEndpoint}${routePath}`,
580
583
  method,
581
- handler: async (req, _reply) => {
582
- const request = createFetchRequest(req);
584
+ handler: async (req, reply) => {
585
+ const request = createFetchRequest(req, reply);
583
586
  const cedarContext = await buildCedarContext2(request, {
584
587
  authDecoder: graphqlOptions.authDecoder
585
588
  });
586
- return yoga.handle(request, {
587
- request,
588
- cedarContext,
589
- event: lambdaEventForFastifyRequest(req),
590
- requestContext: void 0
591
- });
589
+ try {
590
+ return await yoga.handle(request, {
591
+ request,
592
+ cedarContext,
593
+ event: lambdaEventForFastifyRequest(req),
594
+ requestContext: void 0
595
+ });
596
+ } catch (e) {
597
+ if (!!e && typeof e === "object" && "code" in e && e.code === "ERR_STREAM_PREMATURE_CLOSE") {
598
+ return new Response(null, { status: 499 });
599
+ }
600
+ throw e;
601
+ }
592
602
  }
593
603
  });
594
604
  }
@@ -609,13 +619,20 @@ async function redwoodFastifyGraphQLServer(fastify2, options) {
609
619
  function trimSlashes(path5) {
610
620
  return path5.replace(/^\/|\/$/g, "");
611
621
  }
612
- function createFetchRequest(req) {
622
+ function createFetchRequest(req, reply) {
623
+ const controller = new AbortController();
624
+ reply.raw.on("close", () => {
625
+ if (!reply.raw.writableFinished) {
626
+ controller.abort();
627
+ }
628
+ });
613
629
  const requestBody = req.method === "GET" || req.method === "HEAD" ? void 0 : typeof req.body === "string" ? req.body : req.body ? JSON.stringify(req.body) : void 0;
614
630
  const href = `${req.protocol}://${req.hostname}${req.raw.url ?? "/"}`;
615
631
  return new Request(href, {
616
632
  method: req.method,
617
633
  headers: req.headers,
618
- body: requestBody
634
+ body: requestBody,
635
+ signal: controller.signal
619
636
  });
620
637
  }
621
638
  var init_graphql = __esm({
@@ -695,11 +712,11 @@ async function createServer(options = {}) {
695
712
  });
696
713
  if (graphqlFunctionPath) {
697
714
  const { redwoodFastifyGraphQLServer: redwoodFastifyGraphQLServer2 } = await Promise.resolve().then(() => (init_graphql(), graphql_exports));
698
- const { __rw_graphqlOptions } = await import(pathToFileURL4(graphqlFunctionPath).href);
715
+ const { __cedar_graphqlOptions } = await import(pathToFileURL4(graphqlFunctionPath).href);
699
716
  await server.register(redwoodFastifyGraphQLServer2, {
700
717
  redwood: {
701
718
  apiRootPath,
702
- graphql: __rw_graphqlOptions
719
+ graphql: __cedar_graphqlOptions
703
720
  }
704
721
  });
705
722
  }
package/dist/cjs/bin.js CHANGED
@@ -40,6 +40,9 @@ function getAPIHost() {
40
40
  function getAPIPort() {
41
41
  return process.env.REDWOOD_API_PORT ? parseInt(process.env.REDWOOD_API_PORT) : (0, import_project_config.getConfig)().api.port;
42
42
  }
43
+ function getAPIRootPath() {
44
+ return process.env.CEDAR_API_ROOT_PATH ?? "/";
45
+ }
43
46
  function getWebHost() {
44
47
  let host = process.env.REDWOOD_WEB_HOST;
45
48
  host ??= (0, import_project_config.getConfig)().web.host;
@@ -129,7 +132,7 @@ var init_createServerHelpers = __esm({
129
132
  import_helpers = require("@cedarjs/fastify-web/dist/helpers.js");
130
133
  init_cliHelpers();
131
134
  getDefaultCreateServerOptions = () => ({
132
- apiRootPath: "/",
135
+ apiRootPath: getAPIRootPath(),
133
136
  logger: {
134
137
  level: process.env.LOG_LEVEL ?? (process.env.NODE_ENV === "development" ? "debug" : "warn")
135
138
  },
@@ -371,7 +374,7 @@ var init_lambdaLoader = __esm({
371
374
  const imports = foundFunctions.map(async (fnPath) => {
372
375
  const ts = Date.now();
373
376
  const routeName = import_node_path.default.basename(fnPath).replace(".js", "");
374
- const routePath = routeName === "graphql" ? "/graphql" : `/${routeName}`;
377
+ const routePath = `/${routeName}`;
375
378
  const fnImport = await import((0, import_node_url.pathToFileURL)(fnPath).href);
376
379
  const handler3 = (() => {
377
380
  if ("handler" in fnImport) {
@@ -575,11 +578,11 @@ async function redwoodFastifyGraphQLServer(fastify2, options) {
575
578
  absolute: true
576
579
  });
577
580
  const filePath = (0, import_node_url2.pathToFileURL)(graphqlFunctionPath).href;
578
- const { __rw_graphqlOptions } = await import(filePath);
579
- if (!__rw_graphqlOptions) {
581
+ const { __cedar_graphqlOptions } = await import(filePath);
582
+ if (!__cedar_graphqlOptions) {
580
583
  return;
581
584
  }
582
- redwoodOptions.graphql = __rw_graphqlOptions;
585
+ redwoodOptions.graphql = __cedar_graphqlOptions;
583
586
  }
584
587
  const graphqlOptions = redwoodOptions.graphql;
585
588
  if (graphqlOptions?.realtime?.subscriptions) {
@@ -592,17 +595,24 @@ async function redwoodFastifyGraphQLServer(fastify2, options) {
592
595
  fastify2.route({
593
596
  url: `${redwoodOptions.apiRootPath}${graphqlEndpoint}${routePath}`,
594
597
  method,
595
- handler: async (req, _reply) => {
596
- const request = createFetchRequest(req);
598
+ handler: async (req, reply) => {
599
+ const request = createFetchRequest(req, reply);
597
600
  const cedarContext = await (0, import_runtime2.buildCedarContext)(request, {
598
601
  authDecoder: graphqlOptions.authDecoder
599
602
  });
600
- return yoga.handle(request, {
601
- request,
602
- cedarContext,
603
- event: lambdaEventForFastifyRequest(req),
604
- requestContext: void 0
605
- });
603
+ try {
604
+ return await yoga.handle(request, {
605
+ request,
606
+ cedarContext,
607
+ event: lambdaEventForFastifyRequest(req),
608
+ requestContext: void 0
609
+ });
610
+ } catch (e) {
611
+ if (!!e && typeof e === "object" && "code" in e && e.code === "ERR_STREAM_PREMATURE_CLOSE") {
612
+ return new Response(null, { status: 499 });
613
+ }
614
+ throw e;
615
+ }
606
616
  }
607
617
  });
608
618
  }
@@ -623,13 +633,20 @@ async function redwoodFastifyGraphQLServer(fastify2, options) {
623
633
  function trimSlashes(path5) {
624
634
  return path5.replace(/^\/|\/$/g, "");
625
635
  }
626
- function createFetchRequest(req) {
636
+ function createFetchRequest(req, reply) {
637
+ const controller = new AbortController();
638
+ reply.raw.on("close", () => {
639
+ if (!reply.raw.writableFinished) {
640
+ controller.abort();
641
+ }
642
+ });
627
643
  const requestBody = req.method === "GET" || req.method === "HEAD" ? void 0 : typeof req.body === "string" ? req.body : req.body ? JSON.stringify(req.body) : void 0;
628
644
  const href = `${req.protocol}://${req.hostname}${req.raw.url ?? "/"}`;
629
645
  return new Request(href, {
630
646
  method: req.method,
631
647
  headers: req.headers,
632
- body: requestBody
648
+ body: requestBody,
649
+ signal: controller.signal
633
650
  });
634
651
  }
635
652
  var import_node_url2, import_multipart, import_url_data2, import_fast_glob2, import_runtime2, import_store3, import_helpers3, import_graphql_server, import_project_config4;
@@ -710,11 +727,11 @@ async function createServer(options = {}) {
710
727
  });
711
728
  if (graphqlFunctionPath) {
712
729
  const { redwoodFastifyGraphQLServer: redwoodFastifyGraphQLServer2 } = await Promise.resolve().then(() => (init_graphql(), graphql_exports));
713
- const { __rw_graphqlOptions } = await import((0, import_node_url3.pathToFileURL)(graphqlFunctionPath).href);
730
+ const { __cedar_graphqlOptions } = await import((0, import_node_url3.pathToFileURL)(graphqlFunctionPath).href);
714
731
  await server.register(redwoodFastifyGraphQLServer2, {
715
732
  redwood: {
716
733
  apiRootPath,
717
- graphql: __rw_graphqlOptions
734
+ graphql: __cedar_graphqlOptions
718
735
  }
719
736
  });
720
737
  }
@@ -1,5 +1,6 @@
1
1
  export declare function getAPIHost(): string;
2
2
  export declare function getAPIPort(): number;
3
+ export declare function getAPIRootPath(): string;
3
4
  export declare function getWebHost(): string;
4
5
  export declare function getWebPort(): number;
5
6
  //# sourceMappingURL=cliHelpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cliHelpers.d.ts","sourceRoot":"","sources":["../../src/cliHelpers.ts"],"names":[],"mappings":"AAEA,wBAAgB,UAAU,WAKzB;AAED,wBAAgB,UAAU,WAIzB;AAED,wBAAgB,UAAU,WAKzB;AAED,wBAAgB,UAAU,WAIzB"}
1
+ {"version":3,"file":"cliHelpers.d.ts","sourceRoot":"","sources":["../../src/cliHelpers.ts"],"names":[],"mappings":"AAEA,wBAAgB,UAAU,WAKzB;AAED,wBAAgB,UAAU,WAIzB;AAED,wBAAgB,cAAc,WAE7B;AAED,wBAAgB,UAAU,WAKzB;AAED,wBAAgB,UAAU,WAIzB"}
@@ -20,6 +20,7 @@ var cliHelpers_exports = {};
20
20
  __export(cliHelpers_exports, {
21
21
  getAPIHost: () => getAPIHost,
22
22
  getAPIPort: () => getAPIPort,
23
+ getAPIRootPath: () => getAPIRootPath,
23
24
  getWebHost: () => getWebHost,
24
25
  getWebPort: () => getWebPort
25
26
  });
@@ -34,6 +35,9 @@ function getAPIHost() {
34
35
  function getAPIPort() {
35
36
  return process.env.REDWOOD_API_PORT ? parseInt(process.env.REDWOOD_API_PORT) : (0, import_project_config.getConfig)().api.port;
36
37
  }
38
+ function getAPIRootPath() {
39
+ return process.env.CEDAR_API_ROOT_PATH ?? "/";
40
+ }
37
41
  function getWebHost() {
38
42
  let host = process.env.REDWOOD_WEB_HOST;
39
43
  host ??= (0, import_project_config.getConfig)().web.host;
@@ -47,6 +51,7 @@ function getWebPort() {
47
51
  0 && (module.exports = {
48
52
  getAPIHost,
49
53
  getAPIPort,
54
+ getAPIRootPath,
50
55
  getWebHost,
51
56
  getWebPort
52
57
  });
@@ -110,11 +110,11 @@ async function createServer(options = {}) {
110
110
  });
111
111
  if (graphqlFunctionPath) {
112
112
  const { redwoodFastifyGraphQLServer } = await import("./plugins/graphql.js");
113
- const { __rw_graphqlOptions } = await import((0, import_node_url.pathToFileURL)(graphqlFunctionPath).href);
113
+ const { __cedar_graphqlOptions } = await import((0, import_node_url.pathToFileURL)(graphqlFunctionPath).href);
114
114
  await server.register(redwoodFastifyGraphQLServer, {
115
115
  redwood: {
116
116
  apiRootPath,
117
- graphql: __rw_graphqlOptions
117
+ graphql: __cedar_graphqlOptions
118
118
  }
119
119
  });
120
120
  }
@@ -26,7 +26,7 @@ var import_util = require("util");
26
26
  var import_helpers = require("@cedarjs/fastify-web/dist/helpers.js");
27
27
  var import_cliHelpers = require("./cliHelpers.js");
28
28
  const getDefaultCreateServerOptions = () => ({
29
- apiRootPath: "/",
29
+ apiRootPath: (0, import_cliHelpers.getAPIRootPath)(),
30
30
  logger: {
31
31
  level: process.env.LOG_LEVEL ?? (process.env.NODE_ENV === "development" ? "debug" : "warn")
32
32
  },
@@ -11,7 +11,7 @@ export declare const formatData: (data?: Record<string, unknown>) => string | un
11
11
  export declare const formatDate: (instant: Date) => string;
12
12
  export declare const formatErrorProp: (errorPropValue: Record<string, unknown>) => string;
13
13
  export declare const formatLevel: (level: any) => string;
14
- export declare const formatLoadTime: (elapsedTime: any) => string;
14
+ export declare const formatLoadTime: (elapsedTime: string) => string;
15
15
  export declare const formatMessage: (logData: any) => string | undefined;
16
16
  export declare const formatMethod: (method: string) => string;
17
17
  export declare const formatRequestId: (requestId: string) => string;
@@ -1 +1 @@
1
- {"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../../src/logFormatter/formatters.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,OAAO,OAAO,CAAA;AAE3B,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAO3C,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,MAAM,EASrC,CAAA;AAED,eAAO,MAAM,QAAQ,GAAI,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,wBAExD,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,wBAE7D,CAAA;AAED,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,wBAEtD,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,WAAW,MAAM,YAE5C,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,QAAQ,MAAM,WAI9C,CAAA;AAED,eAAO,MAAM,YAAY,GAAI,QAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,uBAgB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,eAAO,MAAM,eAAe,GAAI,WAAW,MAAM,WAEhD,CAAA;AAED,eAAO,MAAM,QAAQ,GAAI,IAAI,MAAM,WAElC,CAAA;AAED,eAAO,MAAM,UAAU,GAAI,MAAM,MAAM,WAEtC,CAAA;AAED,eAAO,MAAM,iBAAiB,GAAI,SAAS,MAAM,WAYhD,CAAA;AAED,eAAO,MAAM,mBAAmB,GAAI,eAAe,MAAM,WAExD,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,QAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,uBAQ1D,CAAA;AAED,eAAO,MAAM,mBAAmB,GAC9B,gBAAgB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,uBAYxC,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,YAAY,MAAM,WAGlD,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,QAAQ,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,WAMnE,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,uBAQ3D,CAAA;AAED,eAAO,MAAM,SAAS,GAAI,KAAK,MAAM,WAEpC,CAAA;AAED,eAAO,MAAM,eAAe,GAAI,WAAW,MAAM,WAEhD,CAAA;AAED,eAAO,MAAM,OAAO,GAAI,OAAO,GAAG,YAEjC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/logFormatter/index.ts"],"names":[],"mappings":"AA8BA,eAAO,MAAM,YAAY,oBACG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,WA0L3D,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/logFormatter/index.ts"],"names":[],"mappings":"AA8BA,eAAO,MAAM,YAAY,oBACG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,WA6L3D,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../../../src/plugins/graphql.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAA+B,MAAM,SAAS,CAAA;AAO3E,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,iBAuGtC"}
1
+ {"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../../../src/plugins/graphql.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,eAAe,EAIhB,MAAM,SAAS,CAAA;AAOhB,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,iBAuHtC"}
@@ -58,11 +58,11 @@ async function redwoodFastifyGraphQLServer(fastify, options) {
58
58
  absolute: true
59
59
  });
60
60
  const filePath = (0, import_node_url.pathToFileURL)(graphqlFunctionPath).href;
61
- const { __rw_graphqlOptions } = await import(filePath);
62
- if (!__rw_graphqlOptions) {
61
+ const { __cedar_graphqlOptions } = await import(filePath);
62
+ if (!__cedar_graphqlOptions) {
63
63
  return;
64
64
  }
65
- redwoodOptions.graphql = __rw_graphqlOptions;
65
+ redwoodOptions.graphql = __cedar_graphqlOptions;
66
66
  }
67
67
  const graphqlOptions = redwoodOptions.graphql;
68
68
  if (graphqlOptions?.realtime?.subscriptions) {
@@ -75,17 +75,24 @@ async function redwoodFastifyGraphQLServer(fastify, options) {
75
75
  fastify.route({
76
76
  url: `${redwoodOptions.apiRootPath}${graphqlEndpoint}${routePath}`,
77
77
  method,
78
- handler: async (req, _reply) => {
79
- const request = createFetchRequest(req);
78
+ handler: async (req, reply) => {
79
+ const request = createFetchRequest(req, reply);
80
80
  const cedarContext = await (0, import_runtime.buildCedarContext)(request, {
81
81
  authDecoder: graphqlOptions.authDecoder
82
82
  });
83
- return yoga.handle(request, {
84
- request,
85
- cedarContext,
86
- event: (0, import_awsLambdaFastify.lambdaEventForFastifyRequest)(req),
87
- requestContext: void 0
88
- });
83
+ try {
84
+ return await yoga.handle(request, {
85
+ request,
86
+ cedarContext,
87
+ event: (0, import_awsLambdaFastify.lambdaEventForFastifyRequest)(req),
88
+ requestContext: void 0
89
+ });
90
+ } catch (e) {
91
+ if (!!e && typeof e === "object" && "code" in e && e.code === "ERR_STREAM_PREMATURE_CLOSE") {
92
+ return new Response(null, { status: 499 });
93
+ }
94
+ throw e;
95
+ }
89
96
  }
90
97
  });
91
98
  }
@@ -106,13 +113,20 @@ async function redwoodFastifyGraphQLServer(fastify, options) {
106
113
  function trimSlashes(path) {
107
114
  return path.replace(/^\/|\/$/g, "");
108
115
  }
109
- function createFetchRequest(req) {
116
+ function createFetchRequest(req, reply) {
117
+ const controller = new AbortController();
118
+ reply.raw.on("close", () => {
119
+ if (!reply.raw.writableFinished) {
120
+ controller.abort();
121
+ }
122
+ });
110
123
  const requestBody = req.method === "GET" || req.method === "HEAD" ? void 0 : typeof req.body === "string" ? req.body : req.body ? JSON.stringify(req.body) : void 0;
111
124
  const href = `${req.protocol}://${req.hostname}${req.raw.url ?? "/"}`;
112
125
  return new Request(href, {
113
126
  method: req.method,
114
127
  headers: req.headers,
115
- body: requestBody
128
+ body: requestBody,
129
+ signal: controller.signal
116
130
  });
117
131
  }
118
132
  // Annotate the CommonJS export names for ESM import in node:
@@ -58,7 +58,7 @@ const setLambdaFunctions = async (foundFunctions) => {
58
58
  const imports = foundFunctions.map(async (fnPath) => {
59
59
  const ts = Date.now();
60
60
  const routeName = import_node_path.default.basename(fnPath).replace(".js", "");
61
- const routePath = routeName === "graphql" ? "/graphql" : `/${routeName}`;
61
+ const routePath = `/${routeName}`;
62
62
  const fnImport = await import((0, import_node_url.pathToFileURL)(fnPath).href);
63
63
  const handler = (() => {
64
64
  if ("handler" in fnImport) {
@@ -1,5 +1,6 @@
1
1
  export declare function getAPIHost(): string;
2
2
  export declare function getAPIPort(): number;
3
+ export declare function getAPIRootPath(): string;
3
4
  export declare function getWebHost(): string;
4
5
  export declare function getWebPort(): number;
5
6
  //# sourceMappingURL=cliHelpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cliHelpers.d.ts","sourceRoot":"","sources":["../src/cliHelpers.ts"],"names":[],"mappings":"AAEA,wBAAgB,UAAU,WAKzB;AAED,wBAAgB,UAAU,WAIzB;AAED,wBAAgB,UAAU,WAKzB;AAED,wBAAgB,UAAU,WAIzB"}
1
+ {"version":3,"file":"cliHelpers.d.ts","sourceRoot":"","sources":["../src/cliHelpers.ts"],"names":[],"mappings":"AAEA,wBAAgB,UAAU,WAKzB;AAED,wBAAgB,UAAU,WAIzB;AAED,wBAAgB,cAAc,WAE7B;AAED,wBAAgB,UAAU,WAKzB;AAED,wBAAgB,UAAU,WAIzB"}
@@ -8,6 +8,9 @@ function getAPIHost() {
8
8
  function getAPIPort() {
9
9
  return process.env.REDWOOD_API_PORT ? parseInt(process.env.REDWOOD_API_PORT) : getConfig().api.port;
10
10
  }
11
+ function getAPIRootPath() {
12
+ return process.env.CEDAR_API_ROOT_PATH ?? "/";
13
+ }
11
14
  function getWebHost() {
12
15
  let host = process.env.REDWOOD_WEB_HOST;
13
16
  host ??= getConfig().web.host;
@@ -20,6 +23,7 @@ function getWebPort() {
20
23
  export {
21
24
  getAPIHost,
22
25
  getAPIPort,
26
+ getAPIRootPath,
23
27
  getWebHost,
24
28
  getWebPort
25
29
  };
@@ -77,11 +77,11 @@ async function createServer(options = {}) {
77
77
  });
78
78
  if (graphqlFunctionPath) {
79
79
  const { redwoodFastifyGraphQLServer } = await import("./plugins/graphql.js");
80
- const { __rw_graphqlOptions } = await import(pathToFileURL(graphqlFunctionPath).href);
80
+ const { __cedar_graphqlOptions } = await import(pathToFileURL(graphqlFunctionPath).href);
81
81
  await server.register(redwoodFastifyGraphQLServer, {
82
82
  redwood: {
83
83
  apiRootPath,
84
- graphql: __rw_graphqlOptions
84
+ graphql: __cedar_graphqlOptions
85
85
  }
86
86
  });
87
87
  }
@@ -1,8 +1,8 @@
1
1
  import { parseArgs } from "util";
2
2
  import { coerceRootPath } from "@cedarjs/fastify-web/dist/helpers.js";
3
- import { getAPIHost, getAPIPort } from "./cliHelpers.js";
3
+ import { getAPIHost, getAPIPort, getAPIRootPath } from "./cliHelpers.js";
4
4
  const getDefaultCreateServerOptions = () => ({
5
- apiRootPath: "/",
5
+ apiRootPath: getAPIRootPath(),
6
6
  logger: {
7
7
  level: process.env.LOG_LEVEL ?? (process.env.NODE_ENV === "development" ? "debug" : "warn")
8
8
  },
@@ -11,7 +11,7 @@ export declare const formatData: (data?: Record<string, unknown>) => string | un
11
11
  export declare const formatDate: (instant: Date) => string;
12
12
  export declare const formatErrorProp: (errorPropValue: Record<string, unknown>) => string;
13
13
  export declare const formatLevel: (level: any) => string;
14
- export declare const formatLoadTime: (elapsedTime: any) => string;
14
+ export declare const formatLoadTime: (elapsedTime: string) => string;
15
15
  export declare const formatMessage: (logData: any) => string | undefined;
16
16
  export declare const formatMethod: (method: string) => string;
17
17
  export declare const formatRequestId: (requestId: string) => string;
@@ -1 +1 @@
1
- {"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../src/logFormatter/formatters.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,OAAO,OAAO,CAAA;AAE3B,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAO3C,CAAA;AAED,eAAO,MAAM,i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MAAM,eAAe,GAAI,WAAW,MAAM,WAEhD,CAAA;AAED,eAAO,MAAM,OAAO,GAAI,OAAO,GAAG,YAEjC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logFormatter/index.ts"],"names":[],"mappings":"AA8BA,eAAO,MAAM,YAAY,oBACG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,WA0L3D,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logFormatter/index.ts"],"names":[],"mappings":"AA8BA,eAAO,MAAM,YAAY,oBACG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,WA6L3D,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../../src/plugins/graphql.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAA+B,MAAM,SAAS,CAAA;AAO3E,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,iBAuGtC"}
1
+ {"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../../src/plugins/graphql.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,eAAe,EAIhB,MAAM,SAAS,CAAA;AAOhB,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,iBAuHtC"}
@@ -25,11 +25,11 @@ async function redwoodFastifyGraphQLServer(fastify, options) {
25
25
  absolute: true
26
26
  });
27
27
  const filePath = pathToFileURL(graphqlFunctionPath).href;
28
- const { __rw_graphqlOptions } = await import(filePath);
29
- if (!__rw_graphqlOptions) {
28
+ const { __cedar_graphqlOptions } = await import(filePath);
29
+ if (!__cedar_graphqlOptions) {
30
30
  return;
31
31
  }
32
- redwoodOptions.graphql = __rw_graphqlOptions;
32
+ redwoodOptions.graphql = __cedar_graphqlOptions;
33
33
  }
34
34
  const graphqlOptions = redwoodOptions.graphql;
35
35
  if (graphqlOptions?.realtime?.subscriptions) {
@@ -42,17 +42,24 @@ async function redwoodFastifyGraphQLServer(fastify, options) {
42
42
  fastify.route({
43
43
  url: `${redwoodOptions.apiRootPath}${graphqlEndpoint}${routePath}`,
44
44
  method,
45
- handler: async (req, _reply) => {
46
- const request = createFetchRequest(req);
45
+ handler: async (req, reply) => {
46
+ const request = createFetchRequest(req, reply);
47
47
  const cedarContext = await buildCedarContext(request, {
48
48
  authDecoder: graphqlOptions.authDecoder
49
49
  });
50
- return yoga.handle(request, {
51
- request,
52
- cedarContext,
53
- event: lambdaEventForFastifyRequest(req),
54
- requestContext: void 0
55
- });
50
+ try {
51
+ return await yoga.handle(request, {
52
+ request,
53
+ cedarContext,
54
+ event: lambdaEventForFastifyRequest(req),
55
+ requestContext: void 0
56
+ });
57
+ } catch (e) {
58
+ if (!!e && typeof e === "object" && "code" in e && e.code === "ERR_STREAM_PREMATURE_CLOSE") {
59
+ return new Response(null, { status: 499 });
60
+ }
61
+ throw e;
62
+ }
56
63
  }
57
64
  });
58
65
  }
@@ -73,13 +80,20 @@ async function redwoodFastifyGraphQLServer(fastify, options) {
73
80
  function trimSlashes(path) {
74
81
  return path.replace(/^\/|\/$/g, "");
75
82
  }
76
- function createFetchRequest(req) {
83
+ function createFetchRequest(req, reply) {
84
+ const controller = new AbortController();
85
+ reply.raw.on("close", () => {
86
+ if (!reply.raw.writableFinished) {
87
+ controller.abort();
88
+ }
89
+ });
77
90
  const requestBody = req.method === "GET" || req.method === "HEAD" ? void 0 : typeof req.body === "string" ? req.body : req.body ? JSON.stringify(req.body) : void 0;
78
91
  const href = `${req.protocol}://${req.hostname}${req.raw.url ?? "/"}`;
79
92
  return new Request(href, {
80
93
  method: req.method,
81
94
  headers: req.headers,
82
- body: requestBody
95
+ body: requestBody,
96
+ signal: controller.signal
83
97
  });
84
98
  }
85
99
  export {
@@ -20,7 +20,7 @@ const setLambdaFunctions = async (foundFunctions) => {
20
20
  const imports = foundFunctions.map(async (fnPath) => {
21
21
  const ts = Date.now();
22
22
  const routeName = path.basename(fnPath).replace(".js", "");
23
- const routePath = routeName === "graphql" ? "/graphql" : `/${routeName}`;
23
+ const routePath = `/${routeName}`;
24
24
  const fnImport = await import(pathToFileURL(fnPath).href);
25
25
  const handler = (() => {
26
26
  if ("handler" in fnImport) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/api-server",
3
- "version": "4.2.1-next.0",
3
+ "version": "4.2.1-next.258",
4
4
  "description": "CedarJS's HTTP server for Serverless Functions",
5
5
  "repository": {
6
6
  "type": "git",
@@ -83,12 +83,6 @@
83
83
  "default": "./dist/cjs/fastify.js"
84
84
  }
85
85
  },
86
- "./udFetchable": {
87
- "import": {
88
- "types": "./dist/udFetchable.d.ts",
89
- "default": "./dist/udFetchable.js"
90
- }
91
- },
92
86
  "./watch": {
93
87
  "import": {
94
88
  "types": "./dist/watch.d.ts",
@@ -131,7 +125,7 @@
131
125
  "build:types": "tsc --build --verbose tsconfig.build.json",
132
126
  "build:types-cjs": "tsc --build --verbose tsconfig.cjs.json",
133
127
  "build:watch": "nodemon --watch src --ext \"js,jsx,ts,tsx\" --ignore dist --exec \"yarn build && yarn fix:permissions\"",
134
- "check:attw": "yarn attw -P",
128
+ "check:attw": "yarn cedar-fwtools-attw",
135
129
  "check:package": "concurrently npm:check:attw yarn:publint",
136
130
  "fix:permissions": "chmod +x dist/index.js; chmod +x dist/watch.js",
137
131
  "prepublishOnly": "NODE_ENV=production yarn build",
@@ -146,7 +140,6 @@
146
140
  "@cedarjs/web-server": "4.2.0",
147
141
  "@fastify/multipart": "9.4.0",
148
142
  "@fastify/url-data": "6.0.3",
149
- "@universal-deploy/node": "^0.1.6",
150
143
  "ansis": "4.2.0",
151
144
  "chokidar": "3.6.0",
152
145
  "dotenv-defaults": "5.0.2",
@@ -163,16 +156,18 @@
163
156
  },
164
157
  "devDependencies": {
165
158
  "@cedarjs/framework-tools": "4.2.0",
166
- "@types/aws-lambda": "8.10.161",
159
+ "@types/aws-lambda": "8.10.162",
167
160
  "@types/dotenv-defaults": "^5.0.0",
168
161
  "@types/split2": "4.2.3",
169
162
  "@types/yargs": "17.0.35",
170
- "graphql-yoga": "5.21.0",
171
- "memfs": "4.57.2",
163
+ "concurrently": "9.2.1",
164
+ "graphql-yoga": "5.21.2",
165
+ "memfs": "4.57.7",
172
166
  "pino-abstract-transport": "1.2.0",
173
- "tsx": "4.21.0",
167
+ "publint": "0.3.21",
168
+ "tsx": "4.22.4",
174
169
  "typescript": "5.9.3",
175
- "vitest": "3.2.4"
170
+ "vitest": "3.2.6"
176
171
  },
177
172
  "peerDependencies": {
178
173
  "@cedarjs/graphql-server": "4.2.0"
@@ -1,12 +0,0 @@
1
- import type { CedarHandler } from '@cedarjs/api/runtime';
2
- export interface Fetchable {
3
- fetch(request: Request): Response | Promise<Response>;
4
- }
5
- /**
6
- * Wraps a CedarHandler in a WinterTC-compatible Fetchable.
7
- *
8
- * The Fetchable calls buildCedarContext to produce a CedarRequestContext,
9
- * then delegates to the handler.
10
- */
11
- export declare function createCedarFetchable(handler: CedarHandler): Fetchable;
12
- //# sourceMappingURL=udFetchable.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"udFetchable.d.ts","sourceRoot":"","sources":["../../src/udFetchable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAGxD,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,OAAO,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;CACtD;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,YAAY,GAAG,SAAS,CAOrE"}
@@ -1,36 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var udFetchable_exports = {};
20
- __export(udFetchable_exports, {
21
- createCedarFetchable: () => createCedarFetchable
22
- });
23
- module.exports = __toCommonJS(udFetchable_exports);
24
- var import_runtime = require("@cedarjs/api/runtime");
25
- function createCedarFetchable(handler) {
26
- return {
27
- async fetch(request) {
28
- const ctx = await (0, import_runtime.buildCedarContext)(request);
29
- return handler(request, ctx);
30
- }
31
- };
32
- }
33
- // Annotate the CommonJS export names for ESM import in node:
34
- 0 && (module.exports = {
35
- createCedarFetchable
36
- });
@@ -1,12 +0,0 @@
1
- import type { CedarHandler } from '@cedarjs/api/runtime';
2
- export interface Fetchable {
3
- fetch(request: Request): Response | Promise<Response>;
4
- }
5
- /**
6
- * Wraps a CedarHandler in a WinterTC-compatible Fetchable.
7
- *
8
- * The Fetchable calls buildCedarContext to produce a CedarRequestContext,
9
- * then delegates to the handler.
10
- */
11
- export declare function createCedarFetchable(handler: CedarHandler): Fetchable;
12
- //# sourceMappingURL=udFetchable.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"udFetchable.d.ts","sourceRoot":"","sources":["../src/udFetchable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAGxD,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,OAAO,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;CACtD;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,YAAY,GAAG,SAAS,CAOrE"}
@@ -1,12 +0,0 @@
1
- import { buildCedarContext } from "@cedarjs/api/runtime";
2
- function createCedarFetchable(handler) {
3
- return {
4
- async fetch(request) {
5
- const ctx = await buildCedarContext(request);
6
- return handler(request, ctx);
7
- }
8
- };
9
- }
10
- export {
11
- createCedarFetchable
12
- };