@cedarjs/api-server 5.0.6 → 5.0.7-next.219

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 (116) 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 +130 -43
  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 +21 -4
  12. package/dist/cliHelpers.d.ts.map +1 -1
  13. package/dist/cliHelpers.js +39 -11
  14. package/dist/createServer.d.ts.map +1 -1
  15. package/dist/createServer.js +4 -4
  16. package/dist/createServerHelpers.d.ts.map +1 -1
  17. package/dist/createServerHelpers.js +6 -2
  18. package/dist/logFormatter/formatters.d.ts.map +1 -1
  19. package/dist/plugins/api.d.ts +1 -1
  20. package/dist/plugins/api.d.ts.map +1 -1
  21. package/dist/plugins/api.js +1 -1
  22. package/dist/plugins/graphql.d.ts +3 -3
  23. package/dist/plugins/graphql.d.ts.map +1 -1
  24. package/dist/plugins/graphql.js +14 -12
  25. package/dist/plugins/lambdaLoader.d.ts.map +1 -1
  26. package/dist/serverFile.d.ts +23 -0
  27. package/dist/serverFile.d.ts.map +1 -0
  28. package/dist/serverFile.js +35 -0
  29. package/dist/types.d.ts +3 -3
  30. package/dist/types.d.ts.map +1 -1
  31. package/dist/utils.d.ts +0 -3
  32. package/dist/utils.d.ts.map +1 -1
  33. package/dist/utils.js +0 -20
  34. package/package.json +36 -77
  35. package/dist/buildManager.d.ts +0 -15
  36. package/dist/buildManager.d.ts.map +0 -1
  37. package/dist/buildManager.js +0 -55
  38. package/dist/cjs/apiCLIConfig.d.ts +0 -6
  39. package/dist/cjs/apiCLIConfig.d.ts.map +0 -1
  40. package/dist/cjs/apiCLIConfig.js +0 -71
  41. package/dist/cjs/apiCLIConfigHandler.d.ts +0 -3
  42. package/dist/cjs/apiCLIConfigHandler.d.ts.map +0 -1
  43. package/dist/cjs/apiCLIConfigHandler.js +0 -67
  44. package/dist/cjs/bin.d.ts +0 -2
  45. package/dist/cjs/bin.d.ts.map +0 -1
  46. package/dist/cjs/bin.js +0 -1002
  47. package/dist/cjs/bothCLIConfig.d.ts +0 -6
  48. package/dist/cjs/bothCLIConfig.d.ts.map +0 -1
  49. package/dist/cjs/bothCLIConfig.js +0 -76
  50. package/dist/cjs/bothCLIConfigHandler.d.ts +0 -3
  51. package/dist/cjs/bothCLIConfigHandler.d.ts.map +0 -1
  52. package/dist/cjs/bothCLIConfigHandler.js +0 -107
  53. package/dist/cjs/buildManager.d.ts +0 -15
  54. package/dist/cjs/buildManager.d.ts.map +0 -1
  55. package/dist/cjs/buildManager.js +0 -79
  56. package/dist/cjs/cliHelpers.d.ts +0 -6
  57. package/dist/cjs/cliHelpers.d.ts.map +0 -1
  58. package/dist/cjs/cliHelpers.js +0 -57
  59. package/dist/cjs/createServer.d.ts +0 -30
  60. package/dist/cjs/createServer.d.ts.map +0 -1
  61. package/dist/cjs/createServer.js +0 -145
  62. package/dist/cjs/createServerHelpers.d.ts +0 -38
  63. package/dist/cjs/createServerHelpers.d.ts.map +0 -1
  64. package/dist/cjs/createServerHelpers.js +0 -112
  65. package/dist/cjs/fastify.d.ts +0 -13
  66. package/dist/cjs/fastify.d.ts.map +0 -1
  67. package/dist/cjs/fastify.js +0 -96
  68. package/dist/cjs/logFormatter/ambient.d.js +0 -1
  69. package/dist/cjs/logFormatter/bin.d.ts +0 -2
  70. package/dist/cjs/logFormatter/bin.d.ts.map +0 -1
  71. package/dist/cjs/logFormatter/bin.js +0 -369
  72. package/dist/cjs/logFormatter/formatters.d.ts +0 -30
  73. package/dist/cjs/logFormatter/formatters.d.ts.map +0 -1
  74. package/dist/cjs/logFormatter/formatters.js +0 -275
  75. package/dist/cjs/logFormatter/index.d.ts +0 -2
  76. package/dist/cjs/logFormatter/index.d.ts.map +0 -1
  77. package/dist/cjs/logFormatter/index.js +0 -184
  78. package/dist/cjs/package.json +0 -1
  79. package/dist/cjs/plugins/api.d.ts +0 -14
  80. package/dist/cjs/plugins/api.d.ts.map +0 -1
  81. package/dist/cjs/plugins/api.js +0 -78
  82. package/dist/cjs/plugins/graphql.d.ts +0 -10
  83. package/dist/cjs/plugins/graphql.d.ts.map +0 -1
  84. package/dist/cjs/plugins/graphql.js +0 -135
  85. package/dist/cjs/plugins/lambdaLoader.d.ts +0 -34
  86. package/dist/cjs/plugins/lambdaLoader.d.ts.map +0 -1
  87. package/dist/cjs/plugins/lambdaLoader.js +0 -199
  88. package/dist/cjs/requestHandlers/awsLambdaFastify.d.ts +0 -5
  89. package/dist/cjs/requestHandlers/awsLambdaFastify.d.ts.map +0 -1
  90. package/dist/cjs/requestHandlers/awsLambdaFastify.js +0 -105
  91. package/dist/cjs/requestHandlers/utils.d.ts +0 -26
  92. package/dist/cjs/requestHandlers/utils.d.ts.map +0 -1
  93. package/dist/cjs/requestHandlers/utils.js +0 -55
  94. package/dist/cjs/serverManager.d.ts +0 -8
  95. package/dist/cjs/serverManager.d.ts.map +0 -1
  96. package/dist/cjs/serverManager.js +0 -137
  97. package/dist/cjs/types.d.ts +0 -19
  98. package/dist/cjs/types.d.ts.map +0 -1
  99. package/dist/cjs/utils.d.ts +0 -6
  100. package/dist/cjs/utils.d.ts.map +0 -1
  101. package/dist/cjs/utils.js +0 -58
  102. package/dist/cjs/watch.d.ts +0 -10
  103. package/dist/cjs/watch.d.ts.map +0 -1
  104. package/dist/cjs/watch.js +0 -399
  105. package/dist/cjs/watchPaths.d.ts +0 -3
  106. package/dist/cjs/watchPaths.d.ts.map +0 -1
  107. package/dist/cjs/watchPaths.js +0 -140
  108. package/dist/serverManager.d.ts +0 -8
  109. package/dist/serverManager.d.ts.map +0 -1
  110. package/dist/serverManager.js +0 -102
  111. package/dist/watch.d.ts +0 -10
  112. package/dist/watch.d.ts.map +0 -1
  113. package/dist/watch.js +0 -375
  114. package/dist/watchPaths.d.ts +0 -3
  115. package/dist/watchPaths.d.ts.map +0 -1
  116. package/dist/watchPaths.js +0 -109
@@ -1,109 +0,0 @@
1
- import fs from "node:fs";
2
- import path from "node:path";
3
- import {
4
- getDbDir,
5
- getPaths,
6
- importStatementPath
7
- } from "@cedarjs/project-config";
8
- async function workspacePackagesPaths() {
9
- const cedarPaths = getPaths();
10
- const packagesDir = path.join(cedarPaths.packages);
11
- const packages = [];
12
- try {
13
- const rootPackageJsonPath = path.join(cedarPaths.base, "package.json");
14
- const rootPackageJson = JSON.parse(
15
- fs.readFileSync(rootPackageJsonPath, "utf8")
16
- );
17
- const hasPackageJsonWorkspaces = Array.isArray(rootPackageJson.workspaces) && rootPackageJson.workspaces.some((w) => w.startsWith("packages/"));
18
- if (!hasPackageJsonWorkspaces || !fs.existsSync(packagesDir)) {
19
- return [];
20
- }
21
- const globPattern = path.join(packagesDir, "*").replaceAll("\\", "/");
22
- const packageDirs = await Array.fromAsync(fs.promises.glob(globPattern));
23
- const apiPackageJsonPath = path.join(cedarPaths.api.base, "package.json");
24
- const apiPackageJson = JSON.parse(
25
- fs.readFileSync(apiPackageJsonPath, "utf8")
26
- );
27
- const deps = {
28
- ...apiPackageJson.dependencies ?? {},
29
- ...apiPackageJson.devDependencies ?? {},
30
- ...apiPackageJson.peerDependencies ?? {}
31
- };
32
- const workspaceDepNames = /* @__PURE__ */ new Set();
33
- for (const [name, version] of Object.entries(deps)) {
34
- if (String(version).startsWith("workspace:")) {
35
- workspaceDepNames.add(name);
36
- }
37
- }
38
- for (const packageDir of packageDirs) {
39
- const packageJsonPath = path.join(packageDir, "package.json");
40
- if (!fs.existsSync(packageJsonPath)) {
41
- continue;
42
- }
43
- const pkgJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
44
- if (workspaceDepNames.has(pkgJson.name)) {
45
- packages.push(path.join(packageDir, "dist"));
46
- }
47
- }
48
- } catch {
49
- }
50
- return packages;
51
- }
52
- async function apiIgnorePaths() {
53
- const cedarPaths = getPaths();
54
- const dbDir = await getDbDir(cedarPaths.api.prismaConfig);
55
- if (dbDir === cedarPaths.api.base) {
56
- throw new Error(
57
- "Database directory cannot be the same as the API directory"
58
- );
59
- }
60
- const ignoredApiPaths = [
61
- // TODO: Is this still true?
62
- // use this, because using cedarPaths.api.dist seems to not ignore on first
63
- // build
64
- "api/dist",
65
- cedarPaths.api.types,
66
- dbDir
67
- ];
68
- return ignoredApiPaths;
69
- }
70
- async function getIgnoreFunction() {
71
- const cedarPaths = getPaths();
72
- const ignoredApiPaths = await apiIgnorePaths();
73
- const ignoredExtensions = [
74
- ".DS_Store",
75
- ".db",
76
- ".sqlite",
77
- "-journal",
78
- ".test.js",
79
- ".test.ts",
80
- ".scenarios.ts",
81
- ".scenarios.js",
82
- ".d.ts",
83
- ".log"
84
- ];
85
- return (file) => {
86
- if (file.includes("node_modules")) {
87
- return true;
88
- }
89
- if (ignoredExtensions.some((ext) => file.endsWith(ext))) {
90
- return true;
91
- }
92
- if (file.includes(importStatementPath(cedarPaths.packages)) && file.includes("/src/")) {
93
- return true;
94
- }
95
- if (ignoredApiPaths.some((ignoredPath) => file.includes(ignoredPath))) {
96
- return true;
97
- }
98
- return false;
99
- };
100
- }
101
- async function pathsToWatch() {
102
- const cedarPaths = getPaths();
103
- const watchPaths = [cedarPaths.api.src, ...await workspacePackagesPaths()];
104
- return watchPaths.map((p) => importStatementPath(p));
105
- }
106
- export {
107
- getIgnoreFunction,
108
- pathsToWatch
109
- };