@wasp.sh/wasp-cli-darwin-arm64-unknown 0.24.0 → 0.25.0

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 (189) hide show
  1. package/data/Cli/starters/basic/main.wasp.ts +1 -1
  2. package/data/Cli/starters/basic/package.json +5 -5
  3. package/data/Cli/starters/basic/src/App.css +12 -11
  4. package/data/Cli/starters/basic/src/assets/wasp-logo-rounded.svg +1 -0
  5. package/data/Cli/starters/basic/src/shared/components/Header.tsx +3 -3
  6. package/data/Cli/starters/minimal/main.wasp.ts +1 -1
  7. package/data/Cli/starters/minimal/package.json +4 -4
  8. package/data/Cli/starters/minimal/src/Main.css +5 -5
  9. package/data/Cli/starters/minimal/src/MainPage.tsx +2 -2
  10. package/data/Cli/starters/minimal/src/assets/wasp-logo-rounded.svg +1 -0
  11. package/data/Cli/starters/skeleton/public/favicon.ico +0 -0
  12. package/data/Cli/starters/skeleton/tsconfig.src.json +2 -1
  13. package/data/Cli/starters/skeleton/tsconfig.wasp.json +3 -2
  14. package/data/Generator/libs/auth/wasp.sh-lib-auth-0.25.0.tgz +0 -0
  15. package/data/Generator/libs/vite-ssr/wasp.sh-lib-vite-ssr-0.25.0.tgz +0 -0
  16. package/data/Generator/templates/sdk/wasp/api/index.ts +2 -2
  17. package/data/Generator/templates/sdk/wasp/auth/email/actions/login.ts +1 -1
  18. package/data/Generator/templates/sdk/wasp/auth/email/actions/passwordReset.ts +1 -1
  19. package/data/Generator/templates/sdk/wasp/auth/email/actions/signup.ts +1 -1
  20. package/data/Generator/templates/sdk/wasp/auth/email/actions/verifyEmail.ts +1 -1
  21. package/data/Generator/templates/sdk/wasp/auth/forms/internal/auth-styles.css +2 -2
  22. package/data/Generator/templates/sdk/wasp/auth/forms/internal/common/LoginSignupForm.tsx +1 -1
  23. package/data/Generator/templates/sdk/wasp/auth/helpers/_Provider.tsx +1 -1
  24. package/data/Generator/templates/sdk/wasp/auth/helpers/user.ts +1 -1
  25. package/data/Generator/templates/sdk/wasp/auth/jwt.ts +1 -1
  26. package/data/Generator/templates/sdk/wasp/auth/logout.ts +1 -1
  27. package/data/Generator/templates/sdk/wasp/auth/lucia.ts +2 -2
  28. package/data/Generator/templates/sdk/wasp/auth/providers/types.ts +1 -1
  29. package/data/Generator/templates/sdk/wasp/auth/session.ts +1 -1
  30. package/data/Generator/templates/sdk/wasp/auth/types.ts +1 -1
  31. package/data/Generator/templates/sdk/wasp/auth/useAuth.ts +5 -5
  32. package/data/Generator/templates/sdk/wasp/auth/username/actions/login.ts +1 -1
  33. package/data/Generator/templates/sdk/wasp/auth/username/actions/signup.ts +1 -1
  34. package/data/Generator/templates/sdk/wasp/auth/utils.ts +3 -3
  35. package/data/Generator/templates/sdk/wasp/auth/validation.ts +1 -1
  36. package/data/Generator/templates/sdk/wasp/client/app/layout.tsx +55 -46
  37. package/data/Generator/templates/sdk/wasp/client/app/router.tsx +2 -5
  38. package/data/Generator/templates/sdk/wasp/client/crud/_crud.ts +2 -2
  39. package/data/Generator/templates/sdk/wasp/client/operations/actions/core.ts +1 -1
  40. package/data/Generator/templates/sdk/wasp/client/operations/index.ts +5 -0
  41. package/data/Generator/templates/sdk/wasp/client/operations/internal/index.ts +3 -3
  42. package/data/Generator/templates/sdk/wasp/client/operations/internal/resources.js +4 -2
  43. package/data/Generator/templates/sdk/wasp/client/operations/queries/core.ts +2 -2
  44. package/data/Generator/templates/sdk/wasp/client/operations/rpc.ts +2 -2
  45. package/data/Generator/templates/sdk/wasp/client/test/vitest/helpers.tsx +3 -4
  46. package/data/Generator/templates/sdk/wasp/client/vite/plugins/validateEnv.ts +14 -8
  47. package/data/Generator/templates/sdk/wasp/client/vite/virtual-files/files/client-entry.tsx +31 -11
  48. package/data/Generator/templates/sdk/wasp/client/vite/virtual-files/files/routes.tsx +26 -20
  49. package/data/Generator/templates/sdk/wasp/client/vite/virtual-files/files/ssr-entry.tsx +29 -24
  50. package/data/Generator/templates/sdk/wasp/client/vite/virtual-files/resolver.ts +12 -5
  51. package/data/Generator/templates/sdk/wasp/client/webSocket/WebSocketProvider.tsx +4 -4
  52. package/data/Generator/templates/sdk/wasp/client/webSocket/index.ts +1 -1
  53. package/data/Generator/templates/sdk/wasp/core/auth.ts +3 -3
  54. package/data/Generator/templates/sdk/wasp/env/validation.ts +1 -1
  55. package/data/Generator/templates/sdk/wasp/package.json +2 -42
  56. package/data/Generator/templates/sdk/wasp/serialization/index.ts +11 -0
  57. package/data/Generator/templates/sdk/wasp/server/_types/index.ts +6 -6
  58. package/data/Generator/templates/sdk/wasp/server/_types/taggedEntities.ts +1 -1
  59. package/data/Generator/templates/sdk/wasp/server/auth/email/utils.ts +6 -6
  60. package/data/Generator/templates/sdk/wasp/server/crud/_operationTypes.ts +2 -2
  61. package/data/Generator/templates/sdk/wasp/server/email/core/index.ts +4 -0
  62. package/data/Generator/templates/sdk/wasp/server/email/core/providers/dummy.ts +1 -1
  63. package/data/Generator/templates/sdk/wasp/server/email/core/providers/resend.ts +31 -0
  64. package/data/Generator/templates/sdk/wasp/server/email/core/types.ts +7 -1
  65. package/data/Generator/templates/sdk/wasp/server/email/index.ts +6 -0
  66. package/data/Generator/templates/sdk/wasp/server/env.ts +5 -0
  67. package/data/Generator/templates/sdk/wasp/server/jobs/_job.ts +2 -2
  68. package/data/Generator/templates/sdk/wasp/server/jobs/core/pgBoss/pgBossJob.ts +3 -3
  69. package/data/Generator/templates/sdk/wasp/server/jobs/core/pgBoss/types.ts +2 -2
  70. package/data/Generator/templates/sdk/wasp/server/operations/actions/index.ts +1 -1
  71. package/data/Generator/templates/sdk/wasp/server/operations/actions/types.ts +2 -2
  72. package/data/Generator/templates/sdk/wasp/server/operations/queries/index.ts +1 -1
  73. package/data/Generator/templates/sdk/wasp/server/operations/queries/types.ts +2 -2
  74. package/data/Generator/templates/sdk/wasp/server/operations/wrappers.ts +1 -1
  75. package/data/Generator/templates/sdk/wasp/server/webSocket/index.ts +2 -3
  76. package/data/Generator/templates/sdk/wasp/tsconfig.json +1 -0
  77. package/data/Generator/templates/server/tsconfig.json +2 -1
  78. package/data/packages/deploy/package-lock.json +2015 -2285
  79. package/data/packages/deploy/package.json +7 -6
  80. package/data/packages/prisma/package-lock.json +1730 -2131
  81. package/data/packages/prisma/package.json +6 -6
  82. package/data/packages/spec/dist/__tests__/spec/appAnalyzer.unit.test.js +4 -4
  83. package/data/packages/spec/dist/__tests__/spec/mapApp.unit.test.js +161 -129
  84. package/data/packages/spec/dist/__tests__/spec/normalizePrerender.unit.test.d.ts +2 -0
  85. package/data/packages/spec/dist/__tests__/spec/normalizePrerender.unit.test.d.ts.map +1 -0
  86. package/data/packages/spec/dist/__tests__/spec/normalizePrerender.unit.test.js +15 -0
  87. package/data/packages/spec/dist/__tests__/spec/refObject.unit.test.js +2 -2
  88. package/data/packages/spec/dist/__tests__/spec/refObjectPath.unit.test.js +3 -3
  89. package/data/packages/spec/dist/__tests__/spec-pipeline/pipeline.integration.test.js +38 -7
  90. package/data/packages/spec/dist/__tests__/spec-pipeline/transformWaspTsSpecFile/imports.unit.test.js +5 -5
  91. package/data/packages/spec/dist/__tests__/spec-pipeline/transformWaspTsSpecFile/refHelper.unit.test.js +2 -2
  92. package/data/packages/spec/dist/src/appSpec.d.ts +2 -2
  93. package/data/packages/spec/dist/src/appSpec.d.ts.map +1 -1
  94. package/data/packages/spec/dist/src/normalizePrerender.d.ts +11 -0
  95. package/data/packages/spec/dist/src/normalizePrerender.d.ts.map +1 -0
  96. package/data/packages/spec/dist/src/normalizePrerender.js +18 -0
  97. package/data/packages/spec/dist/src/run.js +2 -2
  98. package/data/packages/spec/dist/src/spec/appAnalyzer.js +5 -5
  99. package/data/packages/spec/dist/src/spec/mapper/app.d.ts +17 -0
  100. package/data/packages/spec/dist/src/spec/mapper/app.d.ts.map +1 -0
  101. package/data/packages/spec/dist/src/spec/mapper/app.js +119 -0
  102. package/data/packages/spec/dist/src/spec/mapper/context.d.ts +19 -0
  103. package/data/packages/spec/dist/src/spec/mapper/context.d.ts.map +1 -0
  104. package/data/packages/spec/dist/src/spec/mapper/context.js +65 -0
  105. package/data/packages/spec/dist/src/spec/mapper/index.d.ts +7 -0
  106. package/data/packages/spec/dist/src/spec/mapper/index.d.ts.map +1 -0
  107. package/data/packages/spec/dist/src/spec/mapper/index.js +20 -0
  108. package/data/packages/spec/dist/src/spec/mapper/specElements.d.ts +28 -0
  109. package/data/packages/spec/dist/src/spec/mapper/specElements.d.ts.map +1 -0
  110. package/data/packages/spec/dist/src/spec/mapper/specElements.js +162 -0
  111. package/data/packages/spec/dist/src/spec/publicApi/constructors.d.ts +54 -13
  112. package/data/packages/spec/dist/src/spec/publicApi/constructors.d.ts.map +1 -1
  113. package/data/packages/spec/dist/src/spec/publicApi/constructors.js +10 -7
  114. package/data/packages/spec/dist/src/spec/publicApi/index.d.ts +2 -0
  115. package/data/packages/spec/dist/src/spec/publicApi/index.d.ts.map +1 -1
  116. package/data/packages/spec/dist/src/spec/publicApi/index.js +1 -0
  117. package/data/packages/spec/dist/src/spec/publicApi/waspSpec.d.ts +23 -10
  118. package/data/packages/spec/dist/src/spec/publicApi/waspSpec.d.ts.map +1 -1
  119. package/data/packages/spec/dist/src/spec/refObject.js +4 -4
  120. package/data/packages/spec/dist/src/spec/refObjectPath.js +2 -2
  121. package/data/packages/spec/dist/src/spec/waspSpecUserError.d.ts +31 -0
  122. package/data/packages/spec/dist/src/spec/waspSpecUserError.d.ts.map +1 -0
  123. package/data/packages/spec/dist/src/spec/waspSpecUserError.js +30 -0
  124. package/data/packages/spec/dist/src/spec-pipeline/loadWaspTsSpec.d.ts.map +1 -1
  125. package/data/packages/spec/dist/src/spec-pipeline/loadWaspTsSpec.js +18 -15
  126. package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/apply.js +2 -2
  127. package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/check.js +2 -2
  128. package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/plan.js +2 -2
  129. package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/check.js +2 -2
  130. package/data/packages/spec/dist/src/spec-pipeline/typecheckPlugin/index.js +2 -2
  131. package/data/packages/spec/package-lock.json +189 -169
  132. package/data/packages/spec/package.json +30 -7
  133. package/data/packages/studio/dist/public/assets/Flow-CyIU6UP_.js +26 -0
  134. package/data/packages/studio/dist/public/assets/dist-CttM53IC.js +1 -0
  135. package/data/packages/studio/dist/public/assets/index-Cb2AqsRv.js +20 -0
  136. package/data/packages/studio/dist/public/assets/index-Cq-JJ-zI.css +1 -0
  137. package/data/packages/studio/dist/public/index.html +2 -2
  138. package/data/packages/studio/package-lock.json +6 -6
  139. package/data/packages/studio/package.json +2 -2
  140. package/data/packages/ts-inspect/package-lock.json +1918 -2142
  141. package/data/packages/ts-inspect/package.json +6 -6
  142. package/package.json +1 -1
  143. package/wasp-bin +0 -0
  144. package/data/Cli/starters/basic/src/assets/logo.svg +0 -1
  145. package/data/Cli/starters/minimal/src/assets/logo.svg +0 -1
  146. package/data/Cli/starters/skeleton/public/.gitkeep +0 -0
  147. package/data/Generator/libs/auth/wasp.sh-lib-auth-0.24.0.tgz +0 -0
  148. package/data/Generator/libs/vite-ssr/wasp.sh-lib-vite-ssr-0.24.0.tgz +0 -0
  149. package/data/Generator/templates/sdk/wasp/client/app/hooks/useIsClient.ts +0 -16
  150. package/data/packages/spec/dist/__tests__/legacy/appAnalyzer.unit.test.d.ts +0 -2
  151. package/data/packages/spec/dist/__tests__/legacy/appAnalyzer.unit.test.d.ts.map +0 -1
  152. package/data/packages/spec/dist/__tests__/legacy/appAnalyzer.unit.test.js +0 -72
  153. package/data/packages/spec/dist/__tests__/legacy/mapTsAppSpecToAppSpecDecls.integration.test.d.ts +0 -2
  154. package/data/packages/spec/dist/__tests__/legacy/mapTsAppSpecToAppSpecDecls.integration.test.d.ts.map +0 -1
  155. package/data/packages/spec/dist/__tests__/legacy/mapTsAppSpecToAppSpecDecls.integration.test.js +0 -126
  156. package/data/packages/spec/dist/__tests__/legacy/mapTsAppSpecToAppSpecDecls.unit.test.d.ts +0 -2
  157. package/data/packages/spec/dist/__tests__/legacy/mapTsAppSpecToAppSpecDecls.unit.test.d.ts.map +0 -1
  158. package/data/packages/spec/dist/__tests__/legacy/mapTsAppSpecToAppSpecDecls.unit.test.js +0 -732
  159. package/data/packages/spec/dist/__tests__/legacy/testFixtures.d.ts +0 -224
  160. package/data/packages/spec/dist/__tests__/legacy/testFixtures.d.ts.map +0 -1
  161. package/data/packages/spec/dist/__tests__/legacy/testFixtures.js +0 -659
  162. package/data/packages/spec/dist/__tests__/legacy/testFixtures.test-d.d.ts +0 -2
  163. package/data/packages/spec/dist/__tests__/legacy/testFixtures.test-d.d.ts.map +0 -1
  164. package/data/packages/spec/dist/__tests__/legacy/testFixtures.test-d.js +0 -57
  165. package/data/packages/spec/dist/src/legacy/_private.d.ts +0 -2
  166. package/data/packages/spec/dist/src/legacy/_private.d.ts.map +0 -1
  167. package/data/packages/spec/dist/src/legacy/_private.js +0 -1
  168. package/data/packages/spec/dist/src/legacy/appAnalyzer.d.ts +0 -16
  169. package/data/packages/spec/dist/src/legacy/appAnalyzer.d.ts.map +0 -1
  170. package/data/packages/spec/dist/src/legacy/appAnalyzer.js +0 -34
  171. package/data/packages/spec/dist/src/legacy/mapTsAppSpecToAppSpecDecls.d.ts +0 -38
  172. package/data/packages/spec/dist/src/legacy/mapTsAppSpecToAppSpecDecls.d.ts.map +0 -1
  173. package/data/packages/spec/dist/src/legacy/mapTsAppSpecToAppSpecDecls.js +0 -294
  174. package/data/packages/spec/dist/src/legacy/publicApi/App.d.ts +0 -24
  175. package/data/packages/spec/dist/src/legacy/publicApi/App.d.ts.map +0 -1
  176. package/data/packages/spec/dist/src/legacy/publicApi/App.js +0 -75
  177. package/data/packages/spec/dist/src/legacy/publicApi/tsAppSpec.d.ts +0 -174
  178. package/data/packages/spec/dist/src/legacy/publicApi/tsAppSpec.d.ts.map +0 -1
  179. package/data/packages/spec/dist/src/legacy/publicApi/tsAppSpec.js +0 -1
  180. package/data/packages/spec/dist/src/spec/mapApp.d.ts +0 -54
  181. package/data/packages/spec/dist/src/spec/mapApp.d.ts.map +0 -1
  182. package/data/packages/spec/dist/src/spec/mapApp.js +0 -336
  183. package/data/packages/spec/dist/src/spec/specUserError.d.ts +0 -9
  184. package/data/packages/spec/dist/src/spec/specUserError.d.ts.map +0 -1
  185. package/data/packages/spec/dist/src/spec/specUserError.js +0 -8
  186. package/data/packages/studio/dist/public/assets/Flow-_d98T2dd.js +0 -26
  187. package/data/packages/studio/dist/public/assets/index-B6X8EdJH.js +0 -21
  188. package/data/packages/studio/dist/public/assets/index-CXlD_bzV.js +0 -1
  189. package/data/packages/studio/dist/public/assets/index-IWX3d-Jz.css +0 -1
@@ -111,7 +111,7 @@ describe("Wasp TS spec pipeline", () => {
111
111
  __disposeResources(env_1);
112
112
  }
113
113
  });
114
- test("surfaces type errors in the spec as a SpecUserError with formatted diagnostics", () => {
114
+ test("surfaces type errors in the spec as a WaspSpecUserError with formatted diagnostics", () => {
115
115
  const env_2 = { stack: [], error: void 0, hasError: false };
116
116
  try {
117
117
  const project = __addDisposableResource(env_2, makeTempProject("wasp-spec-pipeline-type-error-"), false);
@@ -140,10 +140,41 @@ describe("Wasp TS spec pipeline", () => {
140
140
  __disposeResources(env_2);
141
141
  }
142
142
  });
143
- test("rejects namespace ref imports with a SpecUserError", () => {
143
+ test("surfaces a WaspSpecUserError thrown by the user's spec as a clean error", () => {
144
144
  const env_3 = { stack: [], error: void 0, hasError: false };
145
145
  try {
146
- const project = __addDisposableResource(env_3, makeTempProject("wasp-spec-pipeline-namespace-"), false);
146
+ const project = __addDisposableResource(env_3, makeTempProject("wasp-spec-pipeline-user-error-"), false);
147
+ const result = project.analyzeSpec([
148
+ `import { app, WaspSpecUserError } from "@wasp.sh/spec";`,
149
+ ``,
150
+ `function requireEnv(name: string): string {`,
151
+ ` throw new WaspSpecUserError(\`Missing environment variable '\${name}'.\`);`,
152
+ `}`,
153
+ ``,
154
+ `export default app({`,
155
+ ` name: "demo",`,
156
+ ` title: requireEnv("MY_SECRET"),`,
157
+ ` wasp: { version: "^0.16.0" },`,
158
+ ` spec: [],`,
159
+ `});`,
160
+ ].join("\n"));
161
+ expect(result).toEqual({
162
+ status: "error",
163
+ error: "Missing environment variable 'MY_SECRET'.",
164
+ });
165
+ }
166
+ catch (e_3) {
167
+ env_3.error = e_3;
168
+ env_3.hasError = true;
169
+ }
170
+ finally {
171
+ __disposeResources(env_3);
172
+ }
173
+ });
174
+ test("rejects namespace ref imports with a WaspSpecUserError", () => {
175
+ const env_4 = { stack: [], error: void 0, hasError: false };
176
+ try {
177
+ const project = __addDisposableResource(env_4, makeTempProject("wasp-spec-pipeline-namespace-"), false);
147
178
  project.writeProjectFile("src/operations.ts", `export async function archive() { return null; }\n`);
148
179
  const result = project.analyzeSpec([
149
180
  `import { app } from "@wasp.sh/spec";`,
@@ -161,12 +192,12 @@ describe("Wasp TS spec pipeline", () => {
161
192
  error: expect.stringContaining("Namespace imports are not supported for reference imports"),
162
193
  });
163
194
  }
164
- catch (e_3) {
165
- env_3.error = e_3;
166
- env_3.hasError = true;
195
+ catch (e_4) {
196
+ env_4.error = e_4;
197
+ env_4.hasError = true;
167
198
  }
168
199
  finally {
169
- __disposeResources(env_3);
200
+ __disposeResources(env_4);
170
201
  }
171
202
  });
172
203
  });
@@ -2,7 +2,7 @@ import { RolldownMagicString } from "rolldown";
2
2
  import { parseAst } from "rolldown/parseAst";
3
3
  import { describe, expect, test } from "vitest";
4
4
  import { transformRefImports_mutate } from "../../../src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/index.js";
5
- import { SpecUserError } from "../../../src/spec/specUserError.js";
5
+ import { WaspSpecUserError } from "../../../src/spec/waspSpecUserError.js";
6
6
  describe("transformRefImports", () => {
7
7
  test("leaves files without ref imports untouched", () => {
8
8
  expect(transformImports([`const title = "Demo";`, ``].join("\n"))).toBe([`const title = "Demo";`, ``].join("\n"));
@@ -65,11 +65,11 @@ describe("transformRefImports", () => {
65
65
  ])("transforms $caseName", ({ sourceLines, expectedLines }) => {
66
66
  expect(transformImports(sourceLines.join("\n"))).toBe(expectedLines.join("\n"));
67
67
  });
68
- test("rejects namespace ref imports with a SpecUserError", () => {
68
+ test("rejects namespace ref imports with a WaspSpecUserError", () => {
69
69
  expect(() => transformImports([
70
70
  `import * as adminOperations from "../adminOperations" with { type: "ref" };`,
71
71
  ``,
72
- ].join("\n"))).toThrow(SpecUserError);
72
+ ].join("\n"))).toThrow(WaspSpecUserError);
73
73
  });
74
74
  test("mentions the offending namespace binding in the error", () => {
75
75
  expect(() => transformImports([
@@ -141,7 +141,7 @@ describe("transformRefImports", () => {
141
141
  source: `import {} from "./operations" with { type: "ref" };`,
142
142
  },
143
143
  ])("rejects $caseName", ({ source }) => {
144
- expect(() => transformImports(source)).toThrow(SpecUserError);
144
+ expect(() => transformImports(source)).toThrow(WaspSpecUserError);
145
145
  expect(() => transformImports(source)).toThrow("must import at least one binding");
146
146
  });
147
147
  });
@@ -163,7 +163,7 @@ describe("transformRefImports", () => {
163
163
  ].join("\n"));
164
164
  });
165
165
  test("throws when transforming re-exports with ref imports", () => {
166
- expect(() => transformImports(`export { MainPage } from "./src/MainPage" with { type: "ref" };`)).toThrow(SpecUserError);
166
+ expect(() => transformImports(`export { MainPage } from "./src/MainPage" with { type: "ref" };`)).toThrow(WaspSpecUserError);
167
167
  });
168
168
  });
169
169
  function transformImports(sourceText) {
@@ -2,7 +2,7 @@ import { RolldownMagicString } from "rolldown";
2
2
  import { parseAst } from "rolldown/parseAst";
3
3
  import { describe, expect, test } from "vitest";
4
4
  import { transformRefHelper_mutate } from "../../../src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/index.js";
5
- import { SpecUserError } from "../../../src/spec/specUserError.js";
5
+ import { WaspSpecUserError } from "../../../src/spec/waspSpecUserError.js";
6
6
  describe("transformRefHelper", () => {
7
7
  test("leaves files without a public ref import untouched", () => {
8
8
  expect(transformRefHelper([`const title = "Demo";`, ``].join("\n"))).toBe([`const title = "Demo";`, ``].join("\n"));
@@ -108,7 +108,7 @@ describe("transformRefHelper", () => {
108
108
  ].join("\n"));
109
109
  });
110
110
  test("throws when transforming re-exports of the ref helper", () => {
111
- expect(() => transformRefHelper(`export { ref } from "@wasp.sh/spec";`)).toThrow(SpecUserError);
111
+ expect(() => transformRefHelper(`export { ref } from "@wasp.sh/spec";`)).toThrow(WaspSpecUserError);
112
112
  });
113
113
  });
114
114
  function transformRefHelper(sourceText) {
@@ -32,7 +32,7 @@ export type Page = {
32
32
  export type Route = {
33
33
  path: string;
34
34
  to: Ref<"Page">;
35
- prerender: Optional<boolean>;
35
+ prerender: string[];
36
36
  lazy: Optional<boolean>;
37
37
  };
38
38
  export type Action = {
@@ -158,7 +158,7 @@ export type EmailSender = {
158
158
  provider: EmailProvider;
159
159
  defaultFrom: Optional<EmailFromField>;
160
160
  };
161
- export type EmailProvider = "SMTP" | "SendGrid" | "Mailgun" | "Dummy";
161
+ export type EmailProvider = "SMTP" | "SendGrid" | "Mailgun" | "Resend" | "Dummy";
162
162
  export type EmailFromField = {
163
163
  name: Optional<string>;
164
164
  email: string;
@@ -1 +1 @@
1
- {"version":3,"file":"appSpec.d.ts","sourceRoot":"","sources":["../../src/appSpec.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,IAAI,GAAG;KAChB,IAAI,IAAI,MAAM,eAAe,GAAG;QAC/B,QAAQ,EAAE,IAAI,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,eAAe,CAAC,IAAI,CAAC,CAAC;KAClC;CACF,CAAC,MAAM,eAAe,CAAC,CAAC;AAEzB,MAAM,MAAM,eAAe,GAAG;IAC5B,GAAG,EAAE,GAAG,CAAC;IACT,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,EAAE,KAAK,CAAC;IAC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AM,GAAG;IACnB,OAAO,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC7B,aAAa,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;IACnC,OAAO,EAAE,QAAQ,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC;IAChC,mBAAmB,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,EAAE,GAAG;IACf,KAAK,EAAE,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC;IAC7B,aAAa,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,EAAE,EAAE,SAAS,CAAC;IACd,WAAW,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;CAChC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,KAAK,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Normalizes the public `prerender` route option into the AppSpec
3
+ * representation: the list of concrete paths to prerender at build time (empty
4
+ * when prerendering is disabled).
5
+ *
6
+ * - `true` is shorthand for "prerender this route's own path".
7
+ * - `false`/`undefined`/`[]` disable prerendering (empty list).
8
+ * - A list of paths is used as-is.
9
+ */
10
+ export declare function normalizePrerender(prerender: boolean | readonly string[] | undefined, routePath: string): string[];
11
+ //# sourceMappingURL=normalizePrerender.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalizePrerender.d.ts","sourceRoot":"","sources":["../../src/normalizePrerender.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,OAAO,GAAG,SAAS,MAAM,EAAE,GAAG,SAAS,EAClD,SAAS,EAAE,MAAM,GAChB,MAAM,EAAE,CAQV"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Normalizes the public `prerender` route option into the AppSpec
3
+ * representation: the list of concrete paths to prerender at build time (empty
4
+ * when prerendering is disabled).
5
+ *
6
+ * - `true` is shorthand for "prerender this route's own path".
7
+ * - `false`/`undefined`/`[]` disable prerendering (empty list).
8
+ * - A list of paths is used as-is.
9
+ */
10
+ export function normalizePrerender(prerender, routePath) {
11
+ if (!prerender) {
12
+ return [];
13
+ }
14
+ if (prerender === true) {
15
+ return [routePath];
16
+ }
17
+ return [...prerender];
18
+ }
@@ -2,7 +2,7 @@
2
2
  import { writeFileSync } from "fs";
3
3
  import { parseProcessArgsOrThrow } from "./cli.js";
4
4
  import { analyzeApp } from "./spec/appAnalyzer.js";
5
- import { SpecUserError } from "./spec/specUserError.js";
5
+ import { WaspSpecUserError } from "./spec/waspSpecUserError.js";
6
6
  await main(process.argv);
7
7
  async function main(args) {
8
8
  const { waspTsSpecPath, tsconfigPath, projectRootDir, specResultPath, entityNames, } = parseProcessArgsOrThrow(args);
@@ -20,7 +20,7 @@ async function analyze(args) {
20
20
  return { status: "ok", value: decls };
21
21
  }
22
22
  catch (error) {
23
- if (error instanceof SpecUserError) {
23
+ if (error instanceof WaspSpecUserError) {
24
24
  return { status: "error", error: error.message };
25
25
  }
26
26
  throw error;
@@ -1,22 +1,22 @@
1
1
  import { basename } from "path";
2
2
  import { loadWaspTsSpecDefaultExport } from "../spec-pipeline/loadWaspTsSpec.js";
3
- import { mapApp } from "./mapApp.js";
4
- import { SpecUserError } from "./specUserError.js";
3
+ import { convertWaspSpecToAppSpec } from "./mapper/index.js";
4
+ import { WaspSpecUserError } from "./waspSpecUserError.js";
5
5
  export async function analyzeApp({ waspTsSpecPath, tsconfigPath, projectRootDir, entityNames, }) {
6
6
  const waspTsDefaultExport = await loadWaspTsSpecDefaultExport({
7
7
  specPath: waspTsSpecPath,
8
8
  tsconfigPath,
9
9
  });
10
10
  const app = getApp(basename(waspTsSpecPath), waspTsDefaultExport);
11
- return mapApp(app, { entityNames, projectRootDir });
11
+ return convertWaspSpecToAppSpec(app, { entityNames, projectRootDir });
12
12
  }
13
13
  function getApp(waspTsSpecFile, waspTsDefaultExport) {
14
14
  if (!waspTsDefaultExport) {
15
- throw new SpecUserError("Could not load your app config. " +
15
+ throw new WaspSpecUserError("Could not load your app config. " +
16
16
  `Make sure '${waspTsSpecFile}' includes a default export of the app.`);
17
17
  }
18
18
  if (!isApp(waspTsDefaultExport)) {
19
- throw new SpecUserError(`The default export of '${waspTsSpecFile}' file must be of type 'App'` +
19
+ throw new WaspSpecUserError(`The default export of '${waspTsSpecFile}' file must be of type 'App'. ` +
20
20
  "Make sure you export the result of calling 'app({ ... })'");
21
21
  }
22
22
  return waspTsDefaultExport;
@@ -0,0 +1,17 @@
1
+ import * as AppSpec from "../../appSpec.js";
2
+ import * as WaspSpec from "../publicApi/waspSpec.js";
3
+ import { AppMapperContext } from "./context.js";
4
+ export declare function mapAppSpec(app: WaspSpec.App, ctx: AppMapperContext): AppSpec.GetDeclForType<"App">;
5
+ export declare function mapAuth(auth: WaspSpec.Auth, ctx: AppMapperContext): AppSpec.Auth;
6
+ export declare function mapAuthMethods(methods: WaspSpec.AuthMethods, ctx: AppMapperContext): AppSpec.AuthMethods;
7
+ export declare function mapUsernameAndPassword(usernameAndPassword: WaspSpec.UsernameAndPasswordConfig, ctx: AppMapperContext): AppSpec.UsernameAndPasswordConfig;
8
+ export declare function mapSocialAuth(socialAuth: WaspSpec.SocialAuthConfig, ctx: AppMapperContext): AppSpec.ExternalAuthConfig;
9
+ export declare function mapEmailAuth(emailAuth: WaspSpec.EmailAuthConfig, ctx: AppMapperContext): AppSpec.EmailAuthConfig;
10
+ export declare function mapEmailFlow(emailFlow: WaspSpec.EmailFlowConfig, ctx: AppMapperContext): AppSpec.EmailVerificationConfig;
11
+ export declare function mapServer(server: WaspSpec.Server, ctx: AppMapperContext): AppSpec.Server;
12
+ export declare function mapClient(client: WaspSpec.Client, ctx: AppMapperContext): AppSpec.Client;
13
+ export declare function mapDb(db: WaspSpec.Db, ctx: AppMapperContext): AppSpec.Db;
14
+ export declare function mapEmailSender(emailSender: WaspSpec.EmailSender): AppSpec.EmailSender;
15
+ export declare function mapEmailFromField(emailFromField: WaspSpec.EmailFromField): AppSpec.EmailFromField;
16
+ export declare function mapWebSocket(webSocket: WaspSpec.WebSocket, ctx: AppMapperContext): AppSpec.WebSocket;
17
+ //# sourceMappingURL=app.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../../src/spec/mapper/app.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,QAAQ,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,wBAAgB,UAAU,CACxB,GAAG,EAAE,QAAQ,CAAC,GAAG,EACjB,GAAG,EAAE,gBAAgB,GACpB,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CA6B/B;AAED,wBAAgB,OAAO,CACrB,IAAI,EAAE,QAAQ,CAAC,IAAI,EACnB,GAAG,EAAE,gBAAgB,GACpB,OAAO,CAAC,IAAI,CA4Bd;AAED,wBAAgB,cAAc,CAC5B,OAAO,EAAE,QAAQ,CAAC,WAAW,EAC7B,GAAG,EAAE,gBAAgB,GACpB,OAAO,CAAC,WAAW,CAsBrB;AAED,wBAAgB,sBAAsB,CACpC,mBAAmB,EAAE,QAAQ,CAAC,yBAAyB,EACvD,GAAG,EAAE,gBAAgB,GACpB,OAAO,CAAC,yBAAyB,CAKnC;AAED,wBAAgB,aAAa,CAC3B,UAAU,EAAE,QAAQ,CAAC,gBAAgB,EACrC,GAAG,EAAE,gBAAgB,GACpB,OAAO,CAAC,kBAAkB,CAM5B;AAED,wBAAgB,YAAY,CAC1B,SAAS,EAAE,QAAQ,CAAC,eAAe,EACnC,GAAG,EAAE,gBAAgB,GACpB,OAAO,CAAC,eAAe,CASzB;AAED,wBAAgB,YAAY,CAC1B,SAAS,EAAE,QAAQ,CAAC,eAAe,EACnC,GAAG,EAAE,gBAAgB,GACpB,OAAO,CAAC,uBAAuB,CAOjC;AAED,wBAAgB,SAAS,CACvB,MAAM,EAAE,QAAQ,CAAC,MAAM,EACvB,GAAG,EAAE,gBAAgB,GACpB,OAAO,CAAC,MAAM,CAShB;AAED,wBAAgB,SAAS,CACvB,MAAM,EAAE,QAAQ,CAAC,MAAM,EACvB,GAAG,EAAE,gBAAgB,GACpB,OAAO,CAAC,MAAM,CAShB;AAED,wBAAgB,KAAK,CAAC,EAAE,EAAE,QAAQ,CAAC,EAAE,EAAE,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,EAAE,CAMxE;AAED,wBAAgB,cAAc,CAC5B,WAAW,EAAE,QAAQ,CAAC,WAAW,GAChC,OAAO,CAAC,WAAW,CAMrB;AAED,wBAAgB,iBAAiB,CAC/B,cAAc,EAAE,QAAQ,CAAC,cAAc,GACtC,OAAO,CAAC,cAAc,CAKxB;AAED,wBAAgB,YAAY,CAC1B,SAAS,EAAE,QAAQ,CAAC,SAAS,EAC7B,GAAG,EAAE,gBAAgB,GACpB,OAAO,CAAC,SAAS,CAMnB"}
@@ -0,0 +1,119 @@
1
+ export function mapAppSpec(app, ctx) {
2
+ const { name, wasp, title, head, auth, server, client, db, emailSender, webSocket, } = app;
3
+ return {
4
+ declType: "App",
5
+ declName: name,
6
+ declValue: {
7
+ wasp,
8
+ title,
9
+ head,
10
+ auth: auth && mapAuth(auth, ctx),
11
+ server: server && mapServer(server, ctx),
12
+ client: client && mapClient(client, ctx),
13
+ db: db && mapDb(db, ctx),
14
+ emailSender: emailSender && mapEmailSender(emailSender),
15
+ webSocket: webSocket && mapWebSocket(webSocket, ctx),
16
+ },
17
+ };
18
+ }
19
+ export function mapAuth(auth, ctx) {
20
+ const { userEntity, methods, onAuthFailedRedirectTo, onAuthSucceededRedirectTo, onBeforeSignup, onAfterSignup, onAfterEmailVerified, onBeforeOAuthRedirect, onBeforeLogin, onAfterLogin, } = auth;
21
+ return {
22
+ userEntity: ctx.resolveEntityRef(userEntity),
23
+ methods: mapAuthMethods(methods, ctx),
24
+ onAuthFailedRedirectTo,
25
+ onAuthSucceededRedirectTo,
26
+ onBeforeSignup: onBeforeSignup && ctx.parseRefObject(onBeforeSignup),
27
+ onAfterSignup: onAfterSignup && ctx.parseRefObject(onAfterSignup),
28
+ onAfterEmailVerified: onAfterEmailVerified && ctx.parseRefObject(onAfterEmailVerified),
29
+ onBeforeOAuthRedirect: onBeforeOAuthRedirect && ctx.parseRefObject(onBeforeOAuthRedirect),
30
+ onBeforeLogin: onBeforeLogin && ctx.parseRefObject(onBeforeLogin),
31
+ onAfterLogin: onAfterLogin && ctx.parseRefObject(onAfterLogin),
32
+ };
33
+ }
34
+ export function mapAuthMethods(methods, ctx) {
35
+ const { usernameAndPassword, slack, discord, google, gitHub, keycloak, microsoft, email, } = methods;
36
+ return {
37
+ usernameAndPassword: usernameAndPassword && mapUsernameAndPassword(usernameAndPassword, ctx),
38
+ slack: slack && mapSocialAuth(slack, ctx),
39
+ discord: discord && mapSocialAuth(discord, ctx),
40
+ google: google && mapSocialAuth(google, ctx),
41
+ gitHub: gitHub && mapSocialAuth(gitHub, ctx),
42
+ keycloak: keycloak && mapSocialAuth(keycloak, ctx),
43
+ microsoft: microsoft && mapSocialAuth(microsoft, ctx),
44
+ email: email && mapEmailAuth(email, ctx),
45
+ };
46
+ }
47
+ export function mapUsernameAndPassword(usernameAndPassword, ctx) {
48
+ const { userSignupFields } = usernameAndPassword;
49
+ return {
50
+ userSignupFields: userSignupFields && ctx.parseRefObject(userSignupFields),
51
+ };
52
+ }
53
+ export function mapSocialAuth(socialAuth, ctx) {
54
+ const { configFn, userSignupFields } = socialAuth;
55
+ return {
56
+ configFn: configFn && ctx.parseRefObject(configFn),
57
+ userSignupFields: userSignupFields && ctx.parseRefObject(userSignupFields),
58
+ };
59
+ }
60
+ export function mapEmailAuth(emailAuth, ctx) {
61
+ const { userSignupFields, fromField, emailVerification, passwordReset } = emailAuth;
62
+ return {
63
+ userSignupFields: userSignupFields && ctx.parseRefObject(userSignupFields),
64
+ fromField: mapEmailFromField(fromField),
65
+ emailVerification: mapEmailFlow(emailVerification, ctx),
66
+ passwordReset: mapEmailFlow(passwordReset, ctx),
67
+ };
68
+ }
69
+ export function mapEmailFlow(emailFlow, ctx) {
70
+ const { getEmailContentFn, clientRoute } = emailFlow;
71
+ return {
72
+ getEmailContentFn: getEmailContentFn && ctx.parseRefObject(getEmailContentFn),
73
+ clientRoute: ctx.resolveRouteRef(clientRoute),
74
+ };
75
+ }
76
+ export function mapServer(server, ctx) {
77
+ const { setupFn, middlewareConfigFn, envValidationSchema } = server;
78
+ return {
79
+ setupFn: setupFn && ctx.parseRefObject(setupFn),
80
+ middlewareConfigFn: middlewareConfigFn && ctx.parseRefObject(middlewareConfigFn),
81
+ envValidationSchema: envValidationSchema && ctx.parseRefObject(envValidationSchema),
82
+ };
83
+ }
84
+ export function mapClient(client, ctx) {
85
+ const { rootComponent, setupFn, baseDir, envValidationSchema } = client;
86
+ return {
87
+ rootComponent: rootComponent && ctx.parseRefObject(rootComponent),
88
+ setupFn: setupFn && ctx.parseRefObject(setupFn),
89
+ baseDir,
90
+ envValidationSchema: envValidationSchema && ctx.parseRefObject(envValidationSchema),
91
+ };
92
+ }
93
+ export function mapDb(db, ctx) {
94
+ const { seeds, prismaSetupFn } = db;
95
+ return {
96
+ seeds: seeds?.map(ctx.parseRefObject),
97
+ prismaSetupFn: prismaSetupFn && ctx.parseRefObject(prismaSetupFn),
98
+ };
99
+ }
100
+ export function mapEmailSender(emailSender) {
101
+ const { provider, defaultFrom } = emailSender;
102
+ return {
103
+ provider,
104
+ defaultFrom: defaultFrom && mapEmailFromField(defaultFrom),
105
+ };
106
+ }
107
+ export function mapEmailFromField(emailFromField) {
108
+ return {
109
+ name: emailFromField.name,
110
+ email: emailFromField.email,
111
+ };
112
+ }
113
+ export function mapWebSocket(webSocket, ctx) {
114
+ const { fn, autoConnect } = webSocket;
115
+ return {
116
+ fn: ctx.parseRefObject(fn),
117
+ autoConnect,
118
+ };
119
+ }
@@ -0,0 +1,19 @@
1
+ import * as AppSpec from "../../appSpec.js";
2
+ import * as WaspSpec from "../publicApi/waspSpec.js";
3
+ import { AppSpecDeclTypeForWaspSpecElement } from "./specElements.js";
4
+ export interface AppMapperContext {
5
+ parseRefObject(refObject: WaspSpec.Reference<unknown>): AppSpec.ExtImport;
6
+ resolveEntityRef(name: string): AppSpec.Ref<"Entity">;
7
+ resolveRouteRef(name: string): AppSpec.Ref<"Route">;
8
+ collectSpecElement<SpecElement extends WaspSpec.SpecElement>(specElement: SpecElement): AppSpec.Ref<AppSpecDeclTypeForWaspSpecElement<SpecElement>>;
9
+ }
10
+ export declare function makeAppMapperContext({ entityNames, projectRootDir, specElements, }: {
11
+ entityNames: string[];
12
+ projectRootDir: string;
13
+ specElements: WaspSpec.SpecElement[];
14
+ }): {
15
+ ctx: AppMapperContext;
16
+ collectedDeclsByKey: ReadonlyMap<string, AppSpec.Decl>;
17
+ };
18
+ export declare function makeRefParser<T extends AppSpec.DeclType>(declType: T, declNames: string[]): (name: string) => AppSpec.Ref<T>;
19
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/spec/mapper/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,QAAQ,MAAM,0BAA0B,CAAC;AAGrD,OAAO,EACL,iCAAiC,EAGlC,MAAM,mBAAmB,CAAC;AAE3B,MAAM,WAAW,gBAAgB;IAC/B,cAAc,CAAC,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;IAE1E,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACtD,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAEpD,kBAAkB,CAAC,WAAW,SAAS,QAAQ,CAAC,WAAW,EACzD,WAAW,EAAE,WAAW,GACvB,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,WAAW,CAAC,CAAC,CAAC;CAChE;AAED,wBAAgB,oBAAoB,CAAC,EACnC,WAAW,EACX,cAAc,EACd,YAAY,GACb,EAAE;IACD,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,QAAQ,CAAC,WAAW,EAAE,CAAC;CACtC,GAAG;IACF,GAAG,EAAE,gBAAgB,CAAC;IACtB,mBAAmB,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;CACxD,CAoCA;AAQD,wBAAgB,aAAa,CAAC,CAAC,SAAS,OAAO,CAAC,QAAQ,EACtD,QAAQ,EAAE,CAAC,EACX,SAAS,EAAE,MAAM,EAAE,GAClB,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAalC"}
@@ -0,0 +1,65 @@
1
+ import { isEqual } from "es-toolkit";
2
+ import { mapRefObject } from "../refObject.js";
3
+ import { WaspSpecUserError } from "../waspSpecUserError.js";
4
+ import { declToRef, mapSpecElement, } from "./specElements.js";
5
+ export function makeAppMapperContext({ entityNames, projectRootDir, specElements, }) {
6
+ const collectedDeclsByKey = new Map();
7
+ const ctx = {
8
+ resolveEntityRef: makeRefParser("Entity", entityNames),
9
+ parseRefObject: (refObject) => mapRefObject(refObject, {
10
+ projectRootDir,
11
+ }),
12
+ resolveRouteRef: makeRefParser("Route", specElements
13
+ .filter((el) => el.kind === "route")
14
+ .map((route) => route.name)),
15
+ collectSpecElement: (specElement) => {
16
+ const newDecl = mapSpecElement(specElement, ctx);
17
+ const declKey = makeKeyForDecl(newDecl);
18
+ const existingDecl = collectedDeclsByKey.get(declKey);
19
+ if (existingDecl && !isEqual(existingDecl, newDecl)) {
20
+ throw makeConflictingDeclsError(existingDecl, newDecl);
21
+ }
22
+ collectedDeclsByKey.set(declKey, newDecl);
23
+ return declToRef(newDecl);
24
+ },
25
+ };
26
+ return { ctx, collectedDeclsByKey };
27
+ }
28
+ function makeKeyForDecl(decl) {
29
+ // We're keying by type+name since waspc allows Decls with the same name
30
+ // if they are different types.
31
+ return `${decl.declType}:${decl.declName}`;
32
+ }
33
+ export function makeRefParser(declType, declNames) {
34
+ return function parseRef(potentialRef) {
35
+ if (!declNames.includes(potentialRef)) {
36
+ throw new WaspSpecUserError(`Invalid \`${declType}\` reference: \`${potentialRef}\`\n` +
37
+ `Please make sure that \`${potentialRef}\` is actually defined.`);
38
+ }
39
+ return {
40
+ name: potentialRef,
41
+ declType,
42
+ };
43
+ };
44
+ }
45
+ function makeConflictingDeclsError(existingDecl, incomingDecl) {
46
+ return new WaspSpecUserError(`Conflicting configurations for the ${declTypeDisplayNames[existingDecl.declType]} \`${existingDecl.declName}\`:\n\n` +
47
+ `\`${existingDecl.declName}\` (A):\n${showDecl(existingDecl)}\n\n` +
48
+ `\`${incomingDecl.declName}\` (B):\n${showDecl(incomingDecl)}\n\n` +
49
+ `All definitions with the same name must produce the same configuration.\n` +
50
+ "If the duplication was intentional, please use a different name to differentiate them.");
51
+ }
52
+ const declTypeDisplayNames = {
53
+ App: "app",
54
+ Page: "page",
55
+ Route: "route",
56
+ Query: "query",
57
+ Action: "action",
58
+ Api: "API",
59
+ ApiNamespace: "API namespace",
60
+ Job: "job",
61
+ Crud: "CRUD",
62
+ };
63
+ function showDecl(decl) {
64
+ return JSON.stringify(decl.declValue, null, 2);
65
+ }
@@ -0,0 +1,7 @@
1
+ import * as AppSpec from "../../appSpec.js";
2
+ import * as WaspSpec from "../publicApi/waspSpec.js";
3
+ export declare function convertWaspSpecToAppSpec(app: WaspSpec.App, { projectRootDir, entityNames, }: {
4
+ projectRootDir: string;
5
+ entityNames: string[];
6
+ }): AppSpec.Decl[];
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/spec/mapper/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,QAAQ,MAAM,0BAA0B,CAAC;AAIrD,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,QAAQ,CAAC,GAAG,EACjB,EACE,cAAc,EACd,WAAW,GACZ,EAAE;IACD,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,GACA,OAAO,CAAC,IAAI,EAAE,CAgBhB"}
@@ -0,0 +1,20 @@
1
+ import { mapAppSpec } from "./app.js";
2
+ import { makeAppMapperContext } from "./context.js";
3
+ export function convertWaspSpecToAppSpec(app, { projectRootDir, entityNames, }) {
4
+ const specElements = flattenSpecElements(app.spec);
5
+ const { ctx, collectedDeclsByKey } = makeAppMapperContext({
6
+ entityNames,
7
+ projectRootDir,
8
+ specElements,
9
+ });
10
+ for (const specElement of specElements) {
11
+ ctx.collectSpecElement(specElement);
12
+ }
13
+ const appDecl = mapAppSpec(app, ctx);
14
+ return [appDecl, ...collectedDeclsByKey.values()];
15
+ }
16
+ function flattenSpecElements(spec) {
17
+ // We assert the `[spec]` as a `SpecElement[]` to avoid
18
+ // infinite recursion of the `WaspSpec.Spec` type.
19
+ return [spec].flat(Infinity);
20
+ }
@@ -0,0 +1,28 @@
1
+ import * as AppSpec from "../../appSpec.js";
2
+ import * as WaspSpec from "../publicApi/waspSpec.js";
3
+ import type { AppMapperContext } from "./context.js";
4
+ export declare const AppSpecDeclTypeForWaspSpecElementKind: {
5
+ readonly page: "Page";
6
+ readonly route: "Route";
7
+ readonly query: "Query";
8
+ readonly action: "Action";
9
+ readonly api: "Api";
10
+ readonly apiNamespace: "ApiNamespace";
11
+ readonly job: "Job";
12
+ readonly crud: "Crud";
13
+ };
14
+ export type AppSpecDeclTypeForWaspSpecElement<SpecElement extends WaspSpec.SpecElement> = (typeof AppSpecDeclTypeForWaspSpecElementKind)[SpecElement["kind"]];
15
+ export declare function declToRef<SpecElement extends WaspSpec.SpecElement>(decl: AppSpec.Decl): AppSpec.Ref<AppSpecDeclTypeForWaspSpecElement<SpecElement>>;
16
+ export declare function mapSpecElement<T extends WaspSpec.SpecElement>(el: T, ctx: AppMapperContext): AppSpec.Decl;
17
+ export declare function mapPageSpec(page: WaspSpec.Page, ctx: AppMapperContext): AppSpec.GetDeclForType<"Page">;
18
+ export declare function mapRouteSpec(route: WaspSpec.Route, ctx: AppMapperContext): AppSpec.GetDeclForType<"Route">;
19
+ export declare function mapQuerySpec(query: WaspSpec.Query, ctx: AppMapperContext): AppSpec.GetDeclForType<"Query">;
20
+ export declare function mapActionSpec(action: WaspSpec.Action, ctx: AppMapperContext): AppSpec.GetDeclForType<"Action">;
21
+ export declare function mapApiSpec(api: WaspSpec.Api, ctx: AppMapperContext): AppSpec.GetDeclForType<"Api">;
22
+ export declare function mapApiNamespaceSpec(apiNamespace: WaspSpec.ApiNamespace, ctx: AppMapperContext): AppSpec.GetDeclForType<"ApiNamespace">;
23
+ export declare function mapJobSpec(job: WaspSpec.Job, ctx: AppMapperContext): AppSpec.GetDeclForType<"Job">;
24
+ export declare function mapSchedule(schedule: WaspSpec.Schedule): AppSpec.Schedule;
25
+ export declare function mapCrudSpec(crud: WaspSpec.Crud, ctx: AppMapperContext): AppSpec.GetDeclForType<"Crud">;
26
+ export declare function mapCrudOperations(operations: WaspSpec.CrudOperations, ctx: AppMapperContext): AppSpec.CrudOperations;
27
+ export declare function mapCrudOperationOptions(options: WaspSpec.CrudOperationOptions, ctx: AppMapperContext): AppSpec.CrudOperationOptions;
28
+ //# sourceMappingURL=specElements.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"specElements.d.ts","sourceRoot":"","sources":["../../../../src/spec/mapper/specElements.ts"],"names":[],"m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