@cedarjs/api-server 9.0.0-canary.1784 → 9.0.0-canary.3124

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 (127) hide show
  1. package/README.md +0 -1
  2. package/dist/apiCLIConfig.d.ts.map +1 -1
  3. package/dist/apiCLIConfig.js +1 -1
  4. package/dist/apiCLIConfigHandler.d.ts.map +1 -1
  5. package/dist/apiCLIConfigHandler.js +5 -0
  6. package/dist/bin.js +316 -98
  7. package/dist/bothCLIConfig.d.ts.map +1 -1
  8. package/dist/bothCLIConfig.js +2 -2
  9. package/dist/bothCLIConfigHandler.d.ts.map +1 -1
  10. package/dist/bothCLIConfigHandler.js +8 -2
  11. package/dist/cliHelpers.d.ts +22 -4
  12. package/dist/cliHelpers.d.ts.map +1 -1
  13. package/dist/cliHelpers.js +43 -11
  14. package/dist/createServer.d.ts +19 -3
  15. package/dist/createServer.d.ts.map +1 -1
  16. package/dist/createServer.js +18 -11
  17. package/dist/createServerHelpers.d.ts +15 -2
  18. package/dist/createServerHelpers.d.ts.map +1 -1
  19. package/dist/createServerHelpers.js +14 -4
  20. package/dist/fastify.d.ts.map +1 -1
  21. package/dist/fastify.js +5 -0
  22. package/dist/logFormatter/formatters.d.ts +1 -1
  23. package/dist/logFormatter/formatters.d.ts.map +1 -1
  24. package/dist/logFormatter/index.d.ts.map +1 -1
  25. package/dist/plugins/api.d.ts +4 -5
  26. package/dist/plugins/api.d.ts.map +1 -1
  27. package/dist/plugins/api.js +15 -15
  28. package/dist/plugins/graphql.d.ts +20 -3
  29. package/dist/plugins/graphql.d.ts.map +1 -1
  30. package/dist/plugins/graphql.js +69 -28
  31. package/dist/plugins/lambdaLoader.d.ts +16 -6
  32. package/dist/plugins/lambdaLoader.d.ts.map +1 -1
  33. package/dist/plugins/lambdaLoader.js +73 -10
  34. package/dist/requestHandlers/awsLambdaFastify.d.ts.map +1 -1
  35. package/dist/requestHandlers/awsLambdaFastify.js +16 -4
  36. package/dist/serverFile.d.ts +23 -0
  37. package/dist/serverFile.d.ts.map +1 -0
  38. package/dist/serverFile.js +35 -0
  39. package/dist/types.d.ts +4 -4
  40. package/dist/types.d.ts.map +1 -1
  41. package/dist/utils.d.ts +0 -3
  42. package/dist/utils.d.ts.map +1 -1
  43. package/dist/utils.js +0 -20
  44. package/package.json +56 -72
  45. package/LICENSE +0 -21
  46. package/dist/buildManager.d.ts +0 -15
  47. package/dist/buildManager.d.ts.map +0 -1
  48. package/dist/buildManager.js +0 -50
  49. package/dist/cjs/apiCLIConfig.d.ts +0 -6
  50. package/dist/cjs/apiCLIConfig.d.ts.map +0 -1
  51. package/dist/cjs/apiCLIConfig.js +0 -71
  52. package/dist/cjs/apiCLIConfigHandler.d.ts +0 -3
  53. package/dist/cjs/apiCLIConfigHandler.d.ts.map +0 -1
  54. package/dist/cjs/apiCLIConfigHandler.js +0 -67
  55. package/dist/cjs/bin.d.ts +0 -2
  56. package/dist/cjs/bin.d.ts.map +0 -1
  57. package/dist/cjs/bin.js +0 -896
  58. package/dist/cjs/bothCLIConfig.d.ts +0 -6
  59. package/dist/cjs/bothCLIConfig.d.ts.map +0 -1
  60. package/dist/cjs/bothCLIConfig.js +0 -76
  61. package/dist/cjs/bothCLIConfigHandler.d.ts +0 -3
  62. package/dist/cjs/bothCLIConfigHandler.d.ts.map +0 -1
  63. package/dist/cjs/bothCLIConfigHandler.js +0 -107
  64. package/dist/cjs/buildManager.d.ts +0 -15
  65. package/dist/cjs/buildManager.d.ts.map +0 -1
  66. package/dist/cjs/buildManager.js +0 -74
  67. package/dist/cjs/cliHelpers.d.ts +0 -5
  68. package/dist/cjs/cliHelpers.d.ts.map +0 -1
  69. package/dist/cjs/cliHelpers.js +0 -52
  70. package/dist/cjs/createServer.d.ts +0 -30
  71. package/dist/cjs/createServer.d.ts.map +0 -1
  72. package/dist/cjs/createServer.js +0 -144
  73. package/dist/cjs/createServerHelpers.d.ts +0 -38
  74. package/dist/cjs/createServerHelpers.d.ts.map +0 -1
  75. package/dist/cjs/createServerHelpers.js +0 -112
  76. package/dist/cjs/fastify.d.ts +0 -13
  77. package/dist/cjs/fastify.d.ts.map +0 -1
  78. package/dist/cjs/fastify.js +0 -91
  79. package/dist/cjs/logFormatter/ambient.d.js +0 -1
  80. package/dist/cjs/logFormatter/bin.d.ts +0 -2
  81. package/dist/cjs/logFormatter/bin.d.ts.map +0 -1
  82. package/dist/cjs/logFormatter/bin.js +0 -369
  83. package/dist/cjs/logFormatter/formatters.d.ts +0 -30
  84. package/dist/cjs/logFormatter/formatters.d.ts.map +0 -1
  85. package/dist/cjs/logFormatter/formatters.js +0 -275
  86. package/dist/cjs/logFormatter/index.d.ts +0 -2
  87. package/dist/cjs/logFormatter/index.d.ts.map +0 -1
  88. package/dist/cjs/logFormatter/index.js +0 -184
  89. package/dist/cjs/package.json +0 -1
  90. package/dist/cjs/plugins/api.d.ts +0 -14
  91. package/dist/cjs/plugins/api.d.ts.map +0 -1
  92. package/dist/cjs/plugins/api.js +0 -78
  93. package/dist/cjs/plugins/graphql.d.ts +0 -10
  94. package/dist/cjs/plugins/graphql.d.ts.map +0 -1
  95. package/dist/cjs/plugins/graphql.js +0 -109
  96. package/dist/cjs/plugins/lambdaLoader.d.ts +0 -24
  97. package/dist/cjs/plugins/lambdaLoader.d.ts.map +0 -1
  98. package/dist/cjs/plugins/lambdaLoader.js +0 -134
  99. package/dist/cjs/requestHandlers/awsLambdaFastify.d.ts +0 -5
  100. package/dist/cjs/requestHandlers/awsLambdaFastify.d.ts.map +0 -1
  101. package/dist/cjs/requestHandlers/awsLambdaFastify.js +0 -103
  102. package/dist/cjs/requestHandlers/utils.d.ts +0 -26
  103. package/dist/cjs/requestHandlers/utils.d.ts.map +0 -1
  104. package/dist/cjs/requestHandlers/utils.js +0 -55
  105. package/dist/cjs/serverManager.d.ts +0 -8
  106. package/dist/cjs/serverManager.d.ts.map +0 -1
  107. package/dist/cjs/serverManager.js +0 -137
  108. package/dist/cjs/types.d.ts +0 -19
  109. package/dist/cjs/types.d.ts.map +0 -1
  110. package/dist/cjs/utils.d.ts +0 -6
  111. package/dist/cjs/utils.d.ts.map +0 -1
  112. package/dist/cjs/utils.js +0 -58
  113. package/dist/cjs/watch.d.ts +0 -10
  114. package/dist/cjs/watch.d.ts.map +0 -1
  115. package/dist/cjs/watch.js +0 -394
  116. package/dist/cjs/watchPaths.d.ts +0 -3
  117. package/dist/cjs/watchPaths.d.ts.map +0 -1
  118. package/dist/cjs/watchPaths.js +0 -140
  119. package/dist/serverManager.d.ts +0 -8
  120. package/dist/serverManager.d.ts.map +0 -1
  121. package/dist/serverManager.js +0 -102
  122. package/dist/watch.d.ts +0 -10
  123. package/dist/watch.d.ts.map +0 -1
  124. package/dist/watch.js +0 -370
  125. package/dist/watchPaths.d.ts +0 -3
  126. package/dist/watchPaths.d.ts.map +0 -1
  127. package/dist/watchPaths.js +0 -109
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/api-server",
3
- "version": "9.0.0-canary.1784+baa47810a",
3
+ "version": "9.0.0-canary.3124",
4
4
  "description": "CedarJS's HTTP server for Serverless Functions",
5
5
  "repository": {
6
6
  "type": "git",
@@ -11,141 +11,125 @@
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"
50
+ "./fastify": {
51
+ "default": {
52
+ "types": "./dist/fastify.d.ts",
53
+ "default": "./dist/fastify.js"
54
+ }
71
55
  },
72
- "./cjs/bothCliConfigHandler": {
73
- "types": "./dist/cjs/bothCLIConfigHandler.d.ts",
74
- "default": "./dist/cjs/bothCLIConfigHandler.js"
56
+ "./logFormatter": {
57
+ "default": {
58
+ "types": "./dist/logFormatter/index.d.ts",
59
+ "default": "./dist/logFormatter/index.js"
60
+ }
75
61
  },
76
- "./watch": {
77
- "import": {
78
- "types": "./dist/watch.d.ts",
79
- "default": "./dist/watch.js"
80
- },
81
- "require": {
82
- "types": "./dist/cjs/watch.d.ts",
83
- "default": "./dist/cjs/watch.js"
62
+ "./requestHandlers": {
63
+ "default": {
64
+ "types": "./dist/requestHandlers/awsLambdaFastify.d.ts",
65
+ "default": "./dist/requestHandlers/awsLambdaFastify.js"
84
66
  }
85
67
  }
86
68
  },
87
69
  "main": "./dist/createServer.js",
88
70
  "types": "./dist/createServer.d.ts",
89
71
  "bin": {
90
- "cedarjs-api-server-watch": "./dist/watch.js",
72
+ "cedar-log-formatter": "./dist/logFormatter/bin.js",
73
+ "cedar-server": "./dist/bin.js",
91
74
  "cedarjs-log-formatter": "./dist/logFormatter/bin.js",
92
75
  "cedarjs-server": "./dist/bin.js",
93
- "rw-api-server-watch": "./dist/cjs/watch.js",
94
- "rw-log-formatter": "./dist/cjs/logFormatter/bin.js",
95
- "rw-server": "./dist/cjs/bin.js"
76
+ "rw-log-formatter": "./dist/logFormatter/bin.js",
77
+ "rw-server": "./dist/bin.js"
96
78
  },
97
79
  "files": [
98
80
  "dist"
99
81
  ],
100
82
  "scripts": {
101
- "build": "tsx ./build.mts",
83
+ "build": "node ./build.mts",
102
84
  "build:pack": "yarn pack -o cedarjs-api-server.tgz",
103
85
  "build:types": "tsc --build --verbose tsconfig.build.json",
104
- "build:types-cjs": "tsc --build --verbose tsconfig.cjs.json",
105
86
  "build:watch": "nodemon --watch src --ext \"js,jsx,ts,tsx\" --ignore dist --exec \"yarn build && yarn fix:permissions\"",
106
- "check:attw": "yarn attw -P",
87
+ "check:attw": "yarn cedar-fwtools-attw",
107
88
  "check:package": "concurrently npm:check:attw yarn:publint",
108
- "fix:permissions": "chmod +x dist/index.js; chmod +x dist/watch.js",
89
+ "fix:permissions": "chmod +x dist/index.js",
109
90
  "prepublishOnly": "NODE_ENV=production yarn build",
110
91
  "test": "vitest run",
111
92
  "test:watch": "vitest watch"
112
93
  },
113
94
  "dependencies": {
114
- "@cedarjs/context": "9.0.0-canary.1784",
115
- "@cedarjs/fastify-web": "9.0.0-canary.1784",
116
- "@cedarjs/internal": "9.0.0-canary.1784",
117
- "@cedarjs/project-config": "9.0.0-canary.1784",
118
- "@cedarjs/web-server": "9.0.0-canary.1784",
95
+ "@cedarjs/api": "9.0.0-canary.3124",
96
+ "@cedarjs/context": "9.0.0-canary.3124",
97
+ "@cedarjs/fastify-web": "9.0.0-canary.3124",
98
+ "@cedarjs/project-config": "9.0.0-canary.3124",
99
+ "@cedarjs/web-server": "9.0.0-canary.3124",
119
100
  "@fastify/multipart": "9.4.0",
120
- "@fastify/url-data": "6.0.3",
121
- "ansis": "4.2.0",
122
- "chokidar": "3.6.0",
101
+ "@fastify/url-data": "6.0.4",
102
+ "ansis": "4.3.1",
123
103
  "dotenv-defaults": "5.0.2",
124
104
  "fast-glob": "3.3.3",
125
105
  "fast-json-parse": "1.0.3",
126
- "fastify": "5.7.4",
106
+ "fastify": "5.12.3",
127
107
  "fastify-raw-body": "5.0.0",
108
+ "picoquery": "2.5.0",
128
109
  "pretty-bytes": "5.6.0",
129
110
  "pretty-ms": "7.0.1",
130
- "qs": "6.14.1",
131
111
  "split2": "4.2.0",
132
- "yargs": "17.7.2"
112
+ "termi-link": "1.1.0",
113
+ "yargs": "17.7.3"
133
114
  },
134
115
  "devDependencies": {
135
- "@cedarjs/framework-tools": "9.0.0-canary.1784",
136
- "@types/aws-lambda": "8.10.160",
116
+ "@cedarjs/framework-tools": "9.0.0-canary.3124",
117
+ "@fastify/compress": "9.2.0",
118
+ "@types/aws-lambda": "8.10.163",
137
119
  "@types/dotenv-defaults": "^5.0.0",
138
- "@types/qs": "6.14.0",
139
120
  "@types/split2": "4.2.3",
140
121
  "@types/yargs": "17.0.35",
141
- "memfs": "4.56.10",
142
- "pino-abstract-transport": "1.2.0",
143
- "tsx": "4.21.0",
122
+ "concurrently": "9.2.4",
123
+ "esbuild": "0.28.2",
124
+ "memfs": "4.68.2",
125
+ "pino": "10.3.1",
126
+ "pino-abstract-transport": "3.0.0",
127
+ "publint": "0.3.24",
144
128
  "typescript": "5.9.3",
145
- "vitest": "3.2.4"
129
+ "vitest": "4.1.11"
146
130
  },
147
131
  "peerDependencies": {
148
- "@cedarjs/graphql-server": "9.0.0-canary.1784"
132
+ "@cedarjs/graphql-server": "9.0.0-canary.3124"
149
133
  },
150
134
  "peerDependenciesMeta": {
151
135
  "@cedarjs/graphql-server": {
@@ -155,5 +139,5 @@
155
139
  "publishConfig": {
156
140
  "access": "public"
157
141
  },
158
- "gitHead": "baa47810a7defb73de27fdf513b815d679509b5e"
142
+ "gitHead": "3905ed045508b861b495f8d5630d76c7a157d8f1"
159
143
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Cedar
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,15 +0,0 @@
1
- export type BuildAndRestartOptions = {
2
- rebuild?: boolean;
3
- clean?: boolean;
4
- };
5
- declare class BuildManager {
6
- private shouldRebuild;
7
- private shouldClean;
8
- private debouncedBuild;
9
- private buildFn;
10
- constructor(buildFn: (options: BuildAndRestartOptions) => Promise<void>);
11
- run(options: BuildAndRestartOptions): Promise<void>;
12
- cancelScheduledBuild(): void;
13
- }
14
- export { BuildManager };
15
- //# sourceMappingURL=buildManager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"buildManager.d.ts","sourceRoot":"","sources":["../src/buildManager.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB,CAAA;AAED,cAAM,YAAY;IAChB,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,cAAc,CAA6B;IACnD,OAAO,CAAC,OAAO,CAAoD;gBAEvD,OAAO,EAAE,CAAC,OAAO,EAAE,sBAAsB,KAAK,OAAO,CAAC,IAAI,CAAC;IAgCjE,GAAG,CAAC,OAAO,EAAE,sBAAsB;IAWzC,oBAAoB;CAGrB;AAED,OAAO,EAAE,YAAY,EAAE,CAAA"}
@@ -1,50 +0,0 @@
1
- import { debounce } from "./utils.js";
2
- class BuildManager {
3
- shouldRebuild;
4
- shouldClean;
5
- debouncedBuild;
6
- buildFn;
7
- constructor(buildFn) {
8
- this.shouldRebuild = true;
9
- this.shouldClean = false;
10
- this.buildFn = buildFn;
11
- const delay = process.env.CEDAR_DELAY_API_RESTART || process.env.RWJS_DELAY_RESTART;
12
- this.debouncedBuild = debounce(
13
- async (options) => {
14
- try {
15
- await this.buildFn({
16
- ...options,
17
- rebuild: this.shouldRebuild,
18
- clean: this.shouldClean
19
- });
20
- } finally {
21
- this.shouldRebuild = true;
22
- this.shouldClean = false;
23
- }
24
- },
25
- // We want to delay execution when multiple files are modified on the
26
- // filesystem. This usually happens when running Cedar generator commands.
27
- // Local writes are very fast, but writes in e2e environments are not, so
28
- // allow the default to be adjusted with an env-var.
29
- delay ? parseInt(delay, 10) : 500
30
- );
31
- }
32
- // Wrapper method to handle options and set precedence flags.
33
- // If we ever see a `rebuild: false` option while debouncing, we never want to rebuild.
34
- // If we ever see a `clean: true` option, we always want to clean.
35
- async run(options) {
36
- if (options.rebuild === false) {
37
- this.shouldRebuild = false;
38
- }
39
- if (options.clean) {
40
- this.shouldClean = true;
41
- }
42
- await this.debouncedBuild(options);
43
- }
44
- cancelScheduledBuild() {
45
- this.debouncedBuild.cancel();
46
- }
47
- }
48
- export {
49
- BuildManager
50
- };
@@ -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":""}