@cedarjs/api-server 5.0.3 → 5.0.4-next.167

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.
Files changed (72) hide show
  1. package/dist/bin.js +7 -2
  2. package/package.json +40 -71
  3. package/dist/cjs/apiCLIConfig.d.ts +0 -6
  4. package/dist/cjs/apiCLIConfig.d.ts.map +0 -1
  5. package/dist/cjs/apiCLIConfig.js +0 -71
  6. package/dist/cjs/apiCLIConfigHandler.d.ts +0 -3
  7. package/dist/cjs/apiCLIConfigHandler.d.ts.map +0 -1
  8. package/dist/cjs/apiCLIConfigHandler.js +0 -67
  9. package/dist/cjs/bin.d.ts +0 -2
  10. package/dist/cjs/bin.d.ts.map +0 -1
  11. package/dist/cjs/bin.js +0 -1002
  12. package/dist/cjs/bothCLIConfig.d.ts +0 -6
  13. package/dist/cjs/bothCLIConfig.d.ts.map +0 -1
  14. package/dist/cjs/bothCLIConfig.js +0 -76
  15. package/dist/cjs/bothCLIConfigHandler.d.ts +0 -3
  16. package/dist/cjs/bothCLIConfigHandler.d.ts.map +0 -1
  17. package/dist/cjs/bothCLIConfigHandler.js +0 -107
  18. package/dist/cjs/buildManager.d.ts +0 -15
  19. package/dist/cjs/buildManager.d.ts.map +0 -1
  20. package/dist/cjs/buildManager.js +0 -79
  21. package/dist/cjs/cliHelpers.d.ts +0 -6
  22. package/dist/cjs/cliHelpers.d.ts.map +0 -1
  23. package/dist/cjs/cliHelpers.js +0 -57
  24. package/dist/cjs/createServer.d.ts +0 -30
  25. package/dist/cjs/createServer.d.ts.map +0 -1
  26. package/dist/cjs/createServer.js +0 -145
  27. package/dist/cjs/createServerHelpers.d.ts +0 -38
  28. package/dist/cjs/createServerHelpers.d.ts.map +0 -1
  29. package/dist/cjs/createServerHelpers.js +0 -112
  30. package/dist/cjs/fastify.d.ts +0 -13
  31. package/dist/cjs/fastify.d.ts.map +0 -1
  32. package/dist/cjs/fastify.js +0 -96
  33. package/dist/cjs/logFormatter/ambient.d.js +0 -1
  34. package/dist/cjs/logFormatter/bin.d.ts +0 -2
  35. package/dist/cjs/logFormatter/bin.d.ts.map +0 -1
  36. package/dist/cjs/logFormatter/bin.js +0 -369
  37. package/dist/cjs/logFormatter/formatters.d.ts +0 -30
  38. package/dist/cjs/logFormatter/formatters.d.ts.map +0 -1
  39. package/dist/cjs/logFormatter/formatters.js +0 -275
  40. package/dist/cjs/logFormatter/index.d.ts +0 -2
  41. package/dist/cjs/logFormatter/index.d.ts.map +0 -1
  42. package/dist/cjs/logFormatter/index.js +0 -184
  43. package/dist/cjs/package.json +0 -1
  44. package/dist/cjs/plugins/api.d.ts +0 -14
  45. package/dist/cjs/plugins/api.d.ts.map +0 -1
  46. package/dist/cjs/plugins/api.js +0 -78
  47. package/dist/cjs/plugins/graphql.d.ts +0 -10
  48. package/dist/cjs/plugins/graphql.d.ts.map +0 -1
  49. package/dist/cjs/plugins/graphql.js +0 -135
  50. package/dist/cjs/plugins/lambdaLoader.d.ts +0 -34
  51. package/dist/cjs/plugins/lambdaLoader.d.ts.map +0 -1
  52. package/dist/cjs/plugins/lambdaLoader.js +0 -199
  53. package/dist/cjs/requestHandlers/awsLambdaFastify.d.ts +0 -5
  54. package/dist/cjs/requestHandlers/awsLambdaFastify.d.ts.map +0 -1
  55. package/dist/cjs/requestHandlers/awsLambdaFastify.js +0 -105
  56. package/dist/cjs/requestHandlers/utils.d.ts +0 -26
  57. package/dist/cjs/requestHandlers/utils.d.ts.map +0 -1
  58. package/dist/cjs/requestHandlers/utils.js +0 -55
  59. package/dist/cjs/serverManager.d.ts +0 -8
  60. package/dist/cjs/serverManager.d.ts.map +0 -1
  61. package/dist/cjs/serverManager.js +0 -137
  62. package/dist/cjs/types.d.ts +0 -19
  63. package/dist/cjs/types.d.ts.map +0 -1
  64. package/dist/cjs/utils.d.ts +0 -6
  65. package/dist/cjs/utils.d.ts.map +0 -1
  66. package/dist/cjs/utils.js +0 -58
  67. package/dist/cjs/watch.d.ts +0 -10
  68. package/dist/cjs/watch.d.ts.map +0 -1
  69. package/dist/cjs/watch.js +0 -399
  70. package/dist/cjs/watchPaths.d.ts +0 -3
  71. package/dist/cjs/watchPaths.d.ts.map +0 -1
  72. package/dist/cjs/watchPaths.js +0 -140
package/dist/bin.js CHANGED
@@ -1,8 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __esm = (fn, res) => function __init() {
5
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
4
+ var __esm = (fn, res, err) => function __init() {
5
+ if (err) throw err[0];
6
+ try {
7
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
8
+ } catch (e) {
9
+ throw err = [e], e;
10
+ }
6
11
  };
7
12
  var __export = (target, all) => {
8
13
  for (var name in all)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/api-server",
3
- "version": "5.0.3",
3
+ "version": "5.0.4-next.167",
4
4
  "description": "CedarJS's HTTP server for Serverless Functions",
5
5
  "repository": {
6
6
  "type": "git",
@@ -11,110 +11,78 @@
11
11
  "type": "module",
12
12
  "exports": {
13
13
  ".": {
14
- "import": {
14
+ "default": {
15
15
  "types": "./dist/createServer.d.ts",
16
16
  "default": "./dist/createServer.js"
17
- },
18
- "require": {
19
- "types": "./dist/cjs/createServer.d.ts",
20
- "default": "./dist/cjs/createServer.js"
21
17
  }
22
18
  },
23
19
  "./package.json": "./package.json",
24
20
  "./apiCliConfig": {
25
- "import": {
21
+ "default": {
26
22
  "types": "./dist/apiCLIConfig.d.ts",
27
23
  "default": "./dist/apiCLIConfig.js"
28
- },
29
- "require": {
30
- "types": "./dist/cjs/apiCLIConfig.d.ts",
31
- "default": "./dist/cjs/apiCLIConfig.js"
32
24
  }
33
25
  },
34
26
  "./bothCliConfig": {
35
- "import": {
27
+ "default": {
36
28
  "types": "./dist/bothCLIConfig.d.ts",
37
29
  "default": "./dist/bothCLIConfig.js"
38
- },
39
- "require": {
40
- "types": "./dist/cjs/bothCLIConfig.d.ts",
41
- "default": "./dist/cjs/bothCLIConfig.js"
42
30
  }
43
31
  },
44
32
  "./apiCliConfigHandler": {
45
- "import": {
33
+ "default": {
46
34
  "types": "./dist/apiCLIConfigHandler.d.ts",
47
35
  "default": "./dist/apiCLIConfigHandler.js"
48
- },
49
- "require": {
50
- "types": "./dist/cjs/apiCLIConfigHandler.d.ts",
51
- "default": "./dist/cjs/apiCLIConfigHandler.js"
36
+ }
37
+ },
38
+ "./bothCliConfigHandler": {
39
+ "default": {
40
+ "types": "./dist/bothCLIConfigHandler.d.ts",
41
+ "default": "./dist/bothCLIConfigHandler.js"
52
42
  }
53
43
  },
54
44
  "./cliHelpers": {
55
- "import": {
45
+ "default": {
56
46
  "types": "./dist/cliHelpers.d.ts",
57
47
  "default": "./dist/cliHelpers.js"
58
- },
59
- "require": {
60
- "types": "./dist/cjs/cliHelpers.d.ts",
61
- "default": "./dist/cjs/cliHelpers.js"
62
48
  }
63
49
  },
64
- "./cjs/apiCliConfigHandler": {
65
- "types": "./dist/cjs/apiCLIConfigHandler.d.ts",
66
- "default": "./dist/cjs/apiCLIConfigHandler.js"
67
- },
68
- "./cjs/cliHelpers": {
69
- "types": "./dist/cjs/cliHelpers.d.ts",
70
- "default": "./dist/cjs/cliHelpers.js"
71
- },
72
- "./cjs/bothCliConfigHandler": {
73
- "types": "./dist/cjs/bothCLIConfigHandler.d.ts",
74
- "default": "./dist/cjs/bothCLIConfigHandler.js"
75
- },
76
50
  "./fastify": {
77
- "import": {
51
+ "default": {
78
52
  "types": "./dist/fastify.d.ts",
79
53
  "default": "./dist/fastify.js"
80
- },
81
- "require": {
82
- "types": "./dist/cjs/fastify.d.ts",
83
- "default": "./dist/cjs/fastify.js"
84
54
  }
85
55
  },
86
56
  "./watch": {
87
- "import": {
57
+ "default": {
88
58
  "types": "./dist/watch.d.ts",
89
59
  "default": "./dist/watch.js"
90
- },
91
- "require": {
92
- "types": "./dist/cjs/watch.d.ts",
93
- "default": "./dist/cjs/watch.js"
60
+ }
61
+ },
62
+ "./logFormatter": {
63
+ "default": {
64
+ "types": "./dist/logFormatter/index.d.ts",
65
+ "default": "./dist/logFormatter/index.js"
94
66
  }
95
67
  },
96
68
  "./requestHandlers": {
97
- "import": {
69
+ "default": {
98
70
  "types": "./dist/requestHandlers/awsLambdaFastify.d.ts",
99
71
  "default": "./dist/requestHandlers/awsLambdaFastify.js"
100
- },
101
- "require": {
102
- "types": "./dist/cjs/requestHandlers/awsLambdaFastify.d.ts",
103
- "default": "./dist/cjs/requestHandlers/awsLambdaFastify.js"
104
72
  }
105
73
  }
106
74
  },
107
75
  "main": "./dist/createServer.js",
108
76
  "types": "./dist/createServer.d.ts",
109
77
  "bin": {
110
- "cedar-api-server-watch": "./dist/cjs/watch.js",
111
- "cedar-log-formatter": "./dist/cjs/logFormatter/bin.js",
112
- "cedar-server": "./dist/cjs/bin.js",
78
+ "cedar-api-server-watch": "./dist/watch.js",
79
+ "cedar-log-formatter": "./dist/logFormatter/bin.js",
80
+ "cedar-server": "./dist/bin.js",
113
81
  "cedarjs-api-server-watch": "./dist/watch.js",
114
82
  "cedarjs-log-formatter": "./dist/logFormatter/bin.js",
115
83
  "cedarjs-server": "./dist/bin.js",
116
- "rw-log-formatter": "./dist/cjs/logFormatter/bin.js",
117
- "rw-server": "./dist/cjs/bin.js"
84
+ "rw-log-formatter": "./dist/logFormatter/bin.js",
85
+ "rw-server": "./dist/bin.js"
118
86
  },
119
87
  "files": [
120
88
  "dist"
@@ -123,7 +91,6 @@
123
91
  "build": "node ./build.mts",
124
92
  "build:pack": "yarn pack -o cedarjs-api-server.tgz",
125
93
  "build:types": "tsc --build --verbose tsconfig.build.json",
126
- "build:types-cjs": "tsc --build --verbose tsconfig.cjs.json",
127
94
  "build:watch": "nodemon --watch src --ext \"js,jsx,ts,tsx\" --ignore dist --exec \"yarn build && yarn fix:permissions\"",
128
95
  "check:attw": "yarn cedar-fwtools-attw",
129
96
  "check:package": "concurrently npm:check:attw yarn:publint",
@@ -133,19 +100,20 @@
133
100
  "test:watch": "vitest watch"
134
101
  },
135
102
  "dependencies": {
136
- "@cedarjs/context": "5.0.3",
137
- "@cedarjs/fastify-web": "5.0.3",
138
- "@cedarjs/internal": "5.0.3",
139
- "@cedarjs/project-config": "5.0.3",
140
- "@cedarjs/web-server": "5.0.3",
103
+ "@cedarjs/api": "5.0.4-next.167",
104
+ "@cedarjs/context": "5.0.4-next.167",
105
+ "@cedarjs/fastify-web": "5.0.4-next.167",
106
+ "@cedarjs/internal": "5.0.4-next.167",
107
+ "@cedarjs/project-config": "5.0.4-next.167",
108
+ "@cedarjs/web-server": "5.0.4-next.167",
141
109
  "@fastify/multipart": "9.4.0",
142
110
  "@fastify/url-data": "6.0.3",
143
- "ansis": "4.2.0",
111
+ "ansis": "4.3.1",
144
112
  "chokidar": "3.6.0",
145
113
  "dotenv-defaults": "5.0.2",
146
114
  "fast-glob": "3.3.3",
147
115
  "fast-json-parse": "1.0.3",
148
- "fastify": "5.8.5",
116
+ "fastify": "5.10.0",
149
117
  "fastify-raw-body": "5.0.0",
150
118
  "picoquery": "2.5.0",
151
119
  "pretty-bytes": "5.6.0",
@@ -155,21 +123,22 @@
155
123
  "yargs": "17.7.3"
156
124
  },
157
125
  "devDependencies": {
158
- "@cedarjs/framework-tools": "5.0.3",
126
+ "@cedarjs/framework-tools": "5.0.4-next.167",
159
127
  "@types/aws-lambda": "8.10.162",
160
128
  "@types/dotenv-defaults": "^5.0.0",
161
129
  "@types/split2": "4.2.3",
162
130
  "@types/yargs": "17.0.35",
163
131
  "concurrently": "9.2.4",
164
- "graphql-yoga": "5.21.2",
132
+ "esbuild": "0.28.1",
165
133
  "memfs": "4.64.0",
134
+ "pino": "9.7.0",
166
135
  "pino-abstract-transport": "1.2.0",
167
- "publint": "0.3.21",
136
+ "publint": "0.3.22",
168
137
  "typescript": "5.9.3",
169
- "vitest": "3.2.6"
138
+ "vitest": "4.1.10"
170
139
  },
171
140
  "peerDependencies": {
172
- "@cedarjs/graphql-server": "5.0.3"
141
+ "@cedarjs/graphql-server": "5.0.4-next.167"
173
142
  },
174
143
  "peerDependenciesMeta": {
175
144
  "@cedarjs/graphql-server": {
@@ -1,6 +0,0 @@
1
- import type { Argv } from 'yargs';
2
- import type { APIParsedOptions } from './types.js';
3
- export declare const description = "Start a server for serving the api side";
4
- export declare function builder(yargs: Argv<APIParsedOptions>): void;
5
- export declare function handler(options: APIParsedOptions): Promise<void>;
6
- //# sourceMappingURL=apiCLIConfig.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"apiCLIConfig.d.ts","sourceRoot":"","sources":["../../src/apiCLIConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAEjC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD,eAAO,MAAM,WAAW,4CAA4C,CAAA;AAEpE,wBAAgB,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,gBAAgB,CAAC,QA0BpD;AAED,wBAAsB,OAAO,CAAC,OAAO,EAAE,gBAAgB,iBAGtD"}
@@ -1,71 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var apiCLIConfig_exports = {};
30
- __export(apiCLIConfig_exports, {
31
- builder: () => builder,
32
- description: () => description,
33
- handler: () => handler
34
- });
35
- module.exports = __toCommonJS(apiCLIConfig_exports);
36
- const description = "Start a server for serving the api side";
37
- function builder(yargs) {
38
- yargs.options({
39
- port: {
40
- description: "The port to listen at",
41
- type: "number",
42
- alias: "p"
43
- },
44
- host: {
45
- description: "The host to listen at. Note that you most likely want this to be '0.0.0.0' in production",
46
- type: "string"
47
- },
48
- apiRootPath: {
49
- description: "Root path where your api functions are served",
50
- type: "string",
51
- alias: ["api-root-path", "rootPath", "root-path"],
52
- default: "/"
53
- },
54
- // This became a no-op in v7 because env files weren't loaded by default
55
- // but removing it would break yargs parsing for older projects,
56
- // so leaving it here so that yargs doesn't throw an error
57
- loadEnvFiles: {
58
- hidden: true
59
- }
60
- });
61
- }
62
- async function handler(options) {
63
- const { handler: handler2 } = await import("./apiCLIConfigHandler.js");
64
- await handler2(options);
65
- }
66
- // Annotate the CommonJS export names for ESM import in node:
67
- 0 && (module.exports = {
68
- builder,
69
- description,
70
- handler
71
- });
@@ -1,3 +0,0 @@
1
- import type { APIParsedOptions } from './types.js';
2
- export declare function handler(options?: APIParsedOptions): Promise<void>;
3
- //# sourceMappingURL=apiCLIConfigHandler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"apiCLIConfigHandler.d.ts","sourceRoot":"","sources":["../../src/apiCLIConfigHandler.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD,wBAAsB,OAAO,CAAC,OAAO,GAAE,gBAAqB,iBAoC3D"}
@@ -1,67 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var apiCLIConfigHandler_exports = {};
30
- __export(apiCLIConfigHandler_exports, {
31
- handler: () => handler
32
- });
33
- module.exports = __toCommonJS(apiCLIConfigHandler_exports);
34
- var import_ansis = __toESM(require("ansis"), 1);
35
- var import_fastify_web = require("@cedarjs/fastify-web");
36
- var import_createServer = require("./createServer.js");
37
- async function handler(options = {}) {
38
- const timeStart = Date.now();
39
- console.log(import_ansis.default.dim.italic("Starting API Server..."));
40
- options.apiRootPath = (0, import_fastify_web.coerceRootPath)(options.apiRootPath ?? "/");
41
- const fastify = await (0, import_createServer.createServer)({
42
- apiRootPath: options.apiRootPath,
43
- apiHost: options.host,
44
- apiPort: options.port
45
- });
46
- await fastify.start();
47
- fastify.log.trace(
48
- { custom: { ...fastify.initialConfig } },
49
- "Fastify server configuration"
50
- );
51
- fastify.log.trace(`Registered plugins
52
- ${fastify.printPlugins()}`);
53
- console.log(import_ansis.default.dim.italic("Took " + (Date.now() - timeStart) + " ms"));
54
- let address = fastify.listeningOrigin;
55
- if (process.env.NODE_ENV !== "production") {
56
- address = address.replace(/http:\/\/\[::\]/, "http://localhost");
57
- }
58
- const apiServer = import_ansis.default.magenta(`${address}${options.apiRootPath}`);
59
- const graphqlEndpoint = import_ansis.default.magenta(`${apiServer}graphql`);
60
- console.log(`API server listening at ${apiServer}`);
61
- console.log(`GraphQL endpoint at ${graphqlEndpoint}`);
62
- process?.send?.("ready");
63
- }
64
- // Annotate the CommonJS export names for ESM import in node:
65
- 0 && (module.exports = {
66
- handler
67
- });
package/dist/cjs/bin.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=bin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../../src/bin.ts"],"names":[],"mappings":""}