@wasp.sh/wasp-cli-darwin-x64-unknown 0.20.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 (410) hide show
  1. package/data/Cli/starters/README.md +22 -0
  2. package/data/Cli/starters/basic/README.md +35 -0
  3. package/data/Cli/starters/basic/eslint.config.js +24 -0
  4. package/data/Cli/starters/basic/main.wasp +100 -0
  5. package/data/Cli/starters/basic/package.json +29 -0
  6. package/data/Cli/starters/basic/postcss.config.js +6 -0
  7. package/data/Cli/starters/basic/schema.prisma +42 -0
  8. package/data/Cli/starters/basic/src/App.css +13 -0
  9. package/data/Cli/starters/basic/src/App.tsx +12 -0
  10. package/data/Cli/starters/basic/src/assets/logo.svg +1 -0
  11. package/data/Cli/starters/basic/src/auth/AuthLayout.tsx +10 -0
  12. package/data/Cli/starters/basic/src/auth/email/EmailVerificationPage.tsx +19 -0
  13. package/data/Cli/starters/basic/src/auth/email/LoginPage.tsx +27 -0
  14. package/data/Cli/starters/basic/src/auth/email/PasswordResetPage.tsx +19 -0
  15. package/data/Cli/starters/basic/src/auth/email/RequestPasswordResetPage.tsx +10 -0
  16. package/data/Cli/starters/basic/src/auth/email/SignupPage.tsx +34 -0
  17. package/data/Cli/starters/basic/src/auth/email/userSignupFields.ts +13 -0
  18. package/data/Cli/starters/basic/src/shared/components/Button.tsx +90 -0
  19. package/data/Cli/starters/basic/src/shared/components/Dialog.tsx +85 -0
  20. package/data/Cli/starters/basic/src/shared/components/Header.tsx +39 -0
  21. package/data/Cli/starters/basic/src/shared/components/Input.tsx +36 -0
  22. package/data/Cli/starters/basic/src/shared/components/Portal.tsx +26 -0
  23. package/data/Cli/starters/basic/src/tags/actions.ts +23 -0
  24. package/data/Cli/starters/basic/src/tags/components/ColorRadioButton.tsx +44 -0
  25. package/data/Cli/starters/basic/src/tags/components/ColorRadioButtons.tsx +59 -0
  26. package/data/Cli/starters/basic/src/tags/components/CreateTagDialog.tsx +50 -0
  27. package/data/Cli/starters/basic/src/tags/components/CreateTagForm.tsx +100 -0
  28. package/data/Cli/starters/basic/src/tags/components/TagLabel.tsx +55 -0
  29. package/data/Cli/starters/basic/src/tags/components/colors.ts +8 -0
  30. package/data/Cli/starters/basic/src/tags/queries.ts +14 -0
  31. package/data/Cli/starters/basic/src/tasks/TasksPage.tsx +19 -0
  32. package/data/Cli/starters/basic/src/tasks/actions.ts +71 -0
  33. package/data/Cli/starters/basic/src/tasks/components/CreateTaskForm.tsx +103 -0
  34. package/data/Cli/starters/basic/src/tasks/components/TaskList.tsx +68 -0
  35. package/data/Cli/starters/basic/src/tasks/components/TaskListItem.tsx +56 -0
  36. package/data/Cli/starters/basic/src/tasks/queries.ts +21 -0
  37. package/data/Cli/starters/basic/tailwind.config.js +30 -0
  38. package/data/Cli/starters/basic/vite.config.ts +7 -0
  39. package/data/Cli/starters/minimal/main.wasp +14 -0
  40. package/data/Cli/starters/minimal/package.json +18 -0
  41. package/data/Cli/starters/minimal/schema.prisma +10 -0
  42. package/data/Cli/starters/minimal/src/Main.css +103 -0
  43. package/data/Cli/starters/minimal/src/MainPage.tsx +37 -0
  44. package/data/Cli/starters/minimal/src/assets/logo.svg +1 -0
  45. package/data/Cli/starters/minimal/vite.config.ts +7 -0
  46. package/data/Cli/starters/skeleton/public/favicon.ico +0 -0
  47. package/data/Cli/starters/skeleton/src/vite-env.d.ts +7 -0
  48. package/data/Cli/starters/skeleton/tsconfig.json +28 -0
  49. package/data/Generator/templates/Dockerfile +78 -0
  50. package/data/Generator/templates/db/schema.prisma +24 -0
  51. package/data/Generator/templates/dockerignore +2 -0
  52. package/data/Generator/templates/react-app/README.md +21 -0
  53. package/data/Generator/templates/react-app/gitignore +23 -0
  54. package/data/Generator/templates/react-app/index.html +22 -0
  55. package/data/Generator/templates/react-app/netlify.toml +8 -0
  56. package/data/Generator/templates/react-app/npmrc +1 -0
  57. package/data/Generator/templates/react-app/package.json +31 -0
  58. package/data/Generator/templates/react-app/public/manifest.json +15 -0
  59. package/data/Generator/templates/react-app/src/auth/pages/OAuthCallback.tsx +93 -0
  60. package/data/Generator/templates/react-app/src/auth/pages/createAuthRequiredPage.jsx +40 -0
  61. package/data/Generator/templates/react-app/src/components/DefaultRootErrorBoundary.tsx +16 -0
  62. package/data/Generator/templates/react-app/src/components/FullPageWrapper.tsx +21 -0
  63. package/data/Generator/templates/react-app/src/components/Loader.module.css +37 -0
  64. package/data/Generator/templates/react-app/src/components/Loader.tsx +12 -0
  65. package/data/Generator/templates/react-app/src/components/Message.tsx +86 -0
  66. package/data/Generator/templates/react-app/src/index.tsx +47 -0
  67. package/data/Generator/templates/react-app/src/logo.png +0 -0
  68. package/data/Generator/templates/react-app/src/router.tsx +59 -0
  69. package/data/Generator/templates/react-app/src/test/vitest/setup.ts +8 -0
  70. package/data/Generator/templates/react-app/src/utils.js +3 -0
  71. package/data/Generator/templates/react-app/src/vite-env.d.ts +1 -0
  72. package/data/Generator/templates/react-app/tsconfig.app.json +28 -0
  73. package/data/Generator/templates/react-app/tsconfig.json +11 -0
  74. package/data/Generator/templates/react-app/tsconfig.vite.json +16 -0
  75. package/data/Generator/templates/react-app/vite/detectServerImports.ts +53 -0
  76. package/data/Generator/templates/react-app/vite/validateEnv.ts +45 -0
  77. package/data/Generator/templates/react-app/vite.config.ts +74 -0
  78. package/data/Generator/templates/sdk/wasp/api/events.ts +11 -0
  79. package/data/Generator/templates/sdk/wasp/api/index.ts +136 -0
  80. package/data/Generator/templates/sdk/wasp/auth/email/actions/login.ts +13 -0
  81. package/data/Generator/templates/sdk/wasp/auth/email/actions/passwordReset.ts +22 -0
  82. package/data/Generator/templates/sdk/wasp/auth/email/actions/signup.ts +20 -0
  83. package/data/Generator/templates/sdk/wasp/auth/email/actions/verifyEmail.ts +14 -0
  84. package/data/Generator/templates/sdk/wasp/auth/email/index.ts +5 -0
  85. package/data/Generator/templates/sdk/wasp/auth/forms/Auth.module.css +16 -0
  86. package/data/Generator/templates/sdk/wasp/auth/forms/Auth.tsx +94 -0
  87. package/data/Generator/templates/sdk/wasp/auth/forms/ForgotPassword.tsx +18 -0
  88. package/data/Generator/templates/sdk/wasp/auth/forms/Login.tsx +18 -0
  89. package/data/Generator/templates/sdk/wasp/auth/forms/ResetPassword.tsx +18 -0
  90. package/data/Generator/templates/sdk/wasp/auth/forms/Signup.tsx +24 -0
  91. package/data/Generator/templates/sdk/wasp/auth/forms/VerifyEmail.tsx +18 -0
  92. package/data/Generator/templates/sdk/wasp/auth/forms/internal/Form.module.css +99 -0
  93. package/data/Generator/templates/sdk/wasp/auth/forms/internal/Form.tsx +74 -0
  94. package/data/Generator/templates/sdk/wasp/auth/forms/internal/Message.module.css +22 -0
  95. package/data/Generator/templates/sdk/wasp/auth/forms/internal/Message.tsx +34 -0
  96. package/data/Generator/templates/sdk/wasp/auth/forms/internal/auth-styles.css +30 -0
  97. package/data/Generator/templates/sdk/wasp/auth/forms/internal/common/LoginSignupForm.module.css +55 -0
  98. package/data/Generator/templates/sdk/wasp/auth/forms/internal/common/LoginSignupForm.tsx +291 -0
  99. package/data/Generator/templates/sdk/wasp/auth/forms/internal/email/ForgotPasswordForm.tsx +52 -0
  100. package/data/Generator/templates/sdk/wasp/auth/forms/internal/email/ResetPasswordForm.tsx +82 -0
  101. package/data/Generator/templates/sdk/wasp/auth/forms/internal/email/VerifyEmailForm.tsx +43 -0
  102. package/data/Generator/templates/sdk/wasp/auth/forms/internal/email/useEmail.ts +33 -0
  103. package/data/Generator/templates/sdk/wasp/auth/forms/internal/social/SocialButton.module.css +33 -0
  104. package/data/Generator/templates/sdk/wasp/auth/forms/internal/social/SocialButton.tsx +14 -0
  105. package/data/Generator/templates/sdk/wasp/auth/forms/internal/social/SocialIcons.module.css +4 -0
  106. package/data/Generator/templates/sdk/wasp/auth/forms/internal/social/SocialIcons.tsx +74 -0
  107. package/data/Generator/templates/sdk/wasp/auth/forms/internal/usernameAndPassword/useUsernameAndPassword.ts +29 -0
  108. package/data/Generator/templates/sdk/wasp/auth/forms/internal/util.ts +16 -0
  109. package/data/Generator/templates/sdk/wasp/auth/forms/types.ts +77 -0
  110. package/data/Generator/templates/sdk/wasp/auth/helpers/_Provider.tsx +17 -0
  111. package/data/Generator/templates/sdk/wasp/auth/helpers/user.ts +15 -0
  112. package/data/Generator/templates/sdk/wasp/auth/index.ts +9 -0
  113. package/data/Generator/templates/sdk/wasp/auth/jwt.ts +22 -0
  114. package/data/Generator/templates/sdk/wasp/auth/logout.ts +18 -0
  115. package/data/Generator/templates/sdk/wasp/auth/lucia.ts +53 -0
  116. package/data/Generator/templates/sdk/wasp/auth/password.ts +36 -0
  117. package/data/Generator/templates/sdk/wasp/auth/providers/index.ts +9 -0
  118. package/data/Generator/templates/sdk/wasp/auth/providers/types.ts +68 -0
  119. package/data/Generator/templates/sdk/wasp/auth/session.ts +78 -0
  120. package/data/Generator/templates/sdk/wasp/auth/types.ts +2 -0
  121. package/data/Generator/templates/sdk/wasp/auth/useAuth.ts +37 -0
  122. package/data/Generator/templates/sdk/wasp/auth/user.ts +63 -0
  123. package/data/Generator/templates/sdk/wasp/auth/username/actions/login.ts +13 -0
  124. package/data/Generator/templates/sdk/wasp/auth/username/actions/signup.ts +20 -0
  125. package/data/Generator/templates/sdk/wasp/auth/username/index.ts +2 -0
  126. package/data/Generator/templates/sdk/wasp/auth/utils.ts +369 -0
  127. package/data/Generator/templates/sdk/wasp/auth/validation.ts +83 -0
  128. package/data/Generator/templates/sdk/wasp/client/auth/discord.ts +2 -0
  129. package/data/Generator/templates/sdk/wasp/client/auth/email.ts +5 -0
  130. package/data/Generator/templates/sdk/wasp/client/auth/github.ts +2 -0
  131. package/data/Generator/templates/sdk/wasp/client/auth/google.ts +2 -0
  132. package/data/Generator/templates/sdk/wasp/client/auth/index.ts +29 -0
  133. package/data/Generator/templates/sdk/wasp/client/auth/keycloak.ts +2 -0
  134. package/data/Generator/templates/sdk/wasp/client/auth/slack.ts +2 -0
  135. package/data/Generator/templates/sdk/wasp/client/auth/ui.ts +32 -0
  136. package/data/Generator/templates/sdk/wasp/client/auth/username.ts +2 -0
  137. package/data/Generator/templates/sdk/wasp/client/config.ts +15 -0
  138. package/data/Generator/templates/sdk/wasp/client/crud/_crud.ts +89 -0
  139. package/data/Generator/templates/sdk/wasp/client/crud/index.ts +4 -0
  140. package/data/Generator/templates/sdk/wasp/client/crud/operationsHelpers.ts +21 -0
  141. package/data/Generator/templates/sdk/wasp/client/env/schema.ts +22 -0
  142. package/data/Generator/templates/sdk/wasp/client/env.ts +5 -0
  143. package/data/Generator/templates/sdk/wasp/client/hooks.ts +19 -0
  144. package/data/Generator/templates/sdk/wasp/client/index.ts +17 -0
  145. package/data/Generator/templates/sdk/wasp/client/operations/actions/core.ts +49 -0
  146. package/data/Generator/templates/sdk/wasp/client/operations/actions/index.ts +13 -0
  147. package/data/Generator/templates/sdk/wasp/client/operations/hooks.ts +347 -0
  148. package/data/Generator/templates/sdk/wasp/client/operations/index.ts +22 -0
  149. package/data/Generator/templates/sdk/wasp/client/operations/internal/index.ts +22 -0
  150. package/data/Generator/templates/sdk/wasp/client/operations/internal/resources.js +83 -0
  151. package/data/Generator/templates/sdk/wasp/client/operations/internal/updateHandlersMap.js +37 -0
  152. package/data/Generator/templates/sdk/wasp/client/operations/queries/core.ts +91 -0
  153. package/data/Generator/templates/sdk/wasp/client/operations/queries/index.ts +16 -0
  154. package/data/Generator/templates/sdk/wasp/client/operations/queryClient.ts +34 -0
  155. package/data/Generator/templates/sdk/wasp/client/operations/rpc.ts +96 -0
  156. package/data/Generator/templates/sdk/wasp/client/router/Link.tsx +21 -0
  157. package/data/Generator/templates/sdk/wasp/client/router/index.ts +53 -0
  158. package/data/Generator/templates/sdk/wasp/client/router/linkHelpers.ts +48 -0
  159. package/data/Generator/templates/sdk/wasp/client/router/types.ts +98 -0
  160. package/data/Generator/templates/sdk/wasp/client/test/index.ts +1 -0
  161. package/data/Generator/templates/sdk/wasp/client/test/vitest/helpers.tsx +95 -0
  162. package/data/Generator/templates/sdk/wasp/client/webSocket/WebSocketProvider.tsx +77 -0
  163. package/data/Generator/templates/sdk/wasp/client/webSocket/index.ts +39 -0
  164. package/data/Generator/templates/sdk/wasp/core/auth.ts +40 -0
  165. package/data/Generator/templates/sdk/wasp/core/serialization/custom-register.ts +21 -0
  166. package/data/Generator/templates/sdk/wasp/core/serialization/index.ts +56 -0
  167. package/data/Generator/templates/sdk/wasp/core/serialization/prisma.ts +54 -0
  168. package/data/Generator/templates/sdk/wasp/core/storage.ts +50 -0
  169. package/data/Generator/templates/sdk/wasp/dev/index.ts +19 -0
  170. package/data/Generator/templates/sdk/wasp/entities/index.ts +28 -0
  171. package/data/Generator/templates/sdk/wasp/env/index.ts +9 -0
  172. package/data/Generator/templates/sdk/wasp/env/validation.ts +38 -0
  173. package/data/Generator/templates/sdk/wasp/package.json +152 -0
  174. package/data/Generator/templates/sdk/wasp/prisma-runtime-library.d.ts +17 -0
  175. package/data/Generator/templates/sdk/wasp/scripts/copy-assets.js +14 -0
  176. package/data/Generator/templates/sdk/wasp/server/HttpError.ts +30 -0
  177. package/data/Generator/templates/sdk/wasp/server/_types/index.ts +105 -0
  178. package/data/Generator/templates/sdk/wasp/server/_types/taggedEntities.ts +26 -0
  179. package/data/Generator/templates/sdk/wasp/server/api/index.ts +44 -0
  180. package/data/Generator/templates/sdk/wasp/server/auth/email/index.ts +20 -0
  181. package/data/Generator/templates/sdk/wasp/server/auth/email/utils.ts +104 -0
  182. package/data/Generator/templates/sdk/wasp/server/auth/hooks.ts +188 -0
  183. package/data/Generator/templates/sdk/wasp/server/auth/index.ts +49 -0
  184. package/data/Generator/templates/sdk/wasp/server/auth/oauth/index.ts +38 -0
  185. package/data/Generator/templates/sdk/wasp/server/auth/oauth/oneTimeCode.ts +50 -0
  186. package/data/Generator/templates/sdk/wasp/server/auth/oauth/provider.ts +20 -0
  187. package/data/Generator/templates/sdk/wasp/server/auth/oauth/providers/discord.ts +22 -0
  188. package/data/Generator/templates/sdk/wasp/server/auth/oauth/providers/github.ts +20 -0
  189. package/data/Generator/templates/sdk/wasp/server/auth/oauth/providers/google.ts +22 -0
  190. package/data/Generator/templates/sdk/wasp/server/auth/oauth/providers/keycloak.ts +23 -0
  191. package/data/Generator/templates/sdk/wasp/server/auth/oauth/providers/slack.ts +22 -0
  192. package/data/Generator/templates/sdk/wasp/server/auth/oauth/redirect.ts +43 -0
  193. package/data/Generator/templates/sdk/wasp/server/auth/user.ts +148 -0
  194. package/data/Generator/templates/sdk/wasp/server/auth/username.ts +1 -0
  195. package/data/Generator/templates/sdk/wasp/server/config.ts +47 -0
  196. package/data/Generator/templates/sdk/wasp/server/crud/_operationTypes.ts +134 -0
  197. package/data/Generator/templates/sdk/wasp/server/crud/index.ts +5 -0
  198. package/data/Generator/templates/sdk/wasp/server/dbClient.ts +35 -0
  199. package/data/Generator/templates/sdk/wasp/server/email/core/helpers.ts +40 -0
  200. package/data/Generator/templates/sdk/wasp/server/email/core/index.ts +17 -0
  201. package/data/Generator/templates/sdk/wasp/server/email/core/providers/dummy.ts +34 -0
  202. package/data/Generator/templates/sdk/wasp/server/email/core/providers/mailgun.ts +31 -0
  203. package/data/Generator/templates/sdk/wasp/server/email/core/providers/sendgrid.ts +44 -0
  204. package/data/Generator/templates/sdk/wasp/server/email/core/providers/smtp.ts +29 -0
  205. package/data/Generator/templates/sdk/wasp/server/email/core/types.ts +59 -0
  206. package/data/Generator/templates/sdk/wasp/server/email/index.ts +39 -0
  207. package/data/Generator/templates/sdk/wasp/server/env.ts +173 -0
  208. package/data/Generator/templates/sdk/wasp/server/index.ts +17 -0
  209. package/data/Generator/templates/sdk/wasp/server/jobs/_job.ts +39 -0
  210. package/data/Generator/templates/sdk/wasp/server/jobs/core/job.ts +28 -0
  211. package/data/Generator/templates/sdk/wasp/server/jobs/core/pgBoss/index.ts +3 -0
  212. package/data/Generator/templates/sdk/wasp/server/jobs/core/pgBoss/pgBoss.ts +76 -0
  213. package/data/Generator/templates/sdk/wasp/server/jobs/core/pgBoss/pgBossJob.ts +230 -0
  214. package/data/Generator/templates/sdk/wasp/server/jobs/core/pgBoss/types.ts +9 -0
  215. package/data/Generator/templates/sdk/wasp/server/jobs/index.ts +5 -0
  216. package/data/Generator/templates/sdk/wasp/server/middleware/globalMiddleware.ts +8 -0
  217. package/data/Generator/templates/sdk/wasp/server/middleware/index.ts +1 -0
  218. package/data/Generator/templates/sdk/wasp/server/operations/actions/index.ts +41 -0
  219. package/data/Generator/templates/sdk/wasp/server/operations/actions/types.ts +35 -0
  220. package/data/Generator/templates/sdk/wasp/server/operations/index.ts +13 -0
  221. package/data/Generator/templates/sdk/wasp/server/operations/queries/index.ts +42 -0
  222. package/data/Generator/templates/sdk/wasp/server/operations/queries/types.ts +36 -0
  223. package/data/Generator/templates/sdk/wasp/server/operations/wrappers.ts +242 -0
  224. package/data/Generator/templates/sdk/wasp/server/types/index.ts +11 -0
  225. package/data/Generator/templates/sdk/wasp/server/utils.ts +38 -0
  226. package/data/Generator/templates/sdk/wasp/server/webSocket/index.ts +57 -0
  227. package/data/Generator/templates/sdk/wasp/tsconfig.json +102 -0
  228. package/data/Generator/templates/sdk/wasp/universal/ansiColors.ts +14 -0
  229. package/data/Generator/templates/sdk/wasp/universal/predicates.ts +3 -0
  230. package/data/Generator/templates/sdk/wasp/universal/types.ts +74 -0
  231. package/data/Generator/templates/sdk/wasp/universal/url.ts +9 -0
  232. package/data/Generator/templates/sdk/wasp/universal/validators.ts +21 -0
  233. package/data/Generator/templates/sdk/wasp/vite-env.d.ts +1 -0
  234. package/data/Generator/templates/server/README.md +1 -0
  235. package/data/Generator/templates/server/gitignore +6 -0
  236. package/data/Generator/templates/server/nodemon.json +13 -0
  237. package/data/Generator/templates/server/npmrc +1 -0
  238. package/data/Generator/templates/server/package.json +27 -0
  239. package/data/Generator/templates/server/rollup.config.js +44 -0
  240. package/data/Generator/templates/server/src/actions/_action.ts +18 -0
  241. package/data/Generator/templates/server/src/app.js +36 -0
  242. package/data/Generator/templates/server/src/auth/hooks.ts +135 -0
  243. package/data/Generator/templates/server/src/auth/providers/config/discord.ts +69 -0
  244. package/data/Generator/templates/server/src/auth/providers/config/email.ts +96 -0
  245. package/data/Generator/templates/server/src/auth/providers/config/github.ts +78 -0
  246. package/data/Generator/templates/server/src/auth/providers/config/google.ts +65 -0
  247. package/data/Generator/templates/server/src/auth/providers/config/keycloak.ts +67 -0
  248. package/data/Generator/templates/server/src/auth/providers/config/slack.ts +65 -0
  249. package/data/Generator/templates/server/src/auth/providers/config/username.ts +33 -0
  250. package/data/Generator/templates/server/src/auth/providers/email/login.ts +66 -0
  251. package/data/Generator/templates/server/src/auth/providers/email/requestPasswordReset.ts +74 -0
  252. package/data/Generator/templates/server/src/auth/providers/email/resetPassword.ts +48 -0
  253. package/data/Generator/templates/server/src/auth/providers/email/signup.ts +165 -0
  254. package/data/Generator/templates/server/src/auth/providers/email/verifyEmail.ts +42 -0
  255. package/data/Generator/templates/server/src/auth/providers/index.ts +32 -0
  256. package/data/Generator/templates/server/src/auth/providers/oauth/config.ts +19 -0
  257. package/data/Generator/templates/server/src/auth/providers/oauth/cookies.ts +35 -0
  258. package/data/Generator/templates/server/src/auth/providers/oauth/handler.ts +130 -0
  259. package/data/Generator/templates/server/src/auth/providers/oauth/oneTimeCode.ts +39 -0
  260. package/data/Generator/templates/server/src/auth/providers/oauth/state.ts +144 -0
  261. package/data/Generator/templates/server/src/auth/providers/oauth/types.ts +7 -0
  262. package/data/Generator/templates/server/src/auth/providers/oauth/user.ts +139 -0
  263. package/data/Generator/templates/server/src/auth/providers/username/login.ts +64 -0
  264. package/data/Generator/templates/server/src/auth/providers/username/signup.ts +59 -0
  265. package/data/Generator/templates/server/src/crud/_operations.ts +184 -0
  266. package/data/Generator/templates/server/src/dbSeed.ts +37 -0
  267. package/data/Generator/templates/server/src/jobs/_job.ts +9 -0
  268. package/data/Generator/templates/server/src/jobs/core/allJobs.ts +8 -0
  269. package/data/Generator/templates/server/src/middleware/globalMiddleware.ts +45 -0
  270. package/data/Generator/templates/server/src/middleware/index.ts +1 -0
  271. package/data/Generator/templates/server/src/middleware/operations.ts +28 -0
  272. package/data/Generator/templates/server/src/queries/_query.ts +18 -0
  273. package/data/Generator/templates/server/src/routes/apis/index.ts +67 -0
  274. package/data/Generator/templates/server/src/routes/auth/index.js +16 -0
  275. package/data/Generator/templates/server/src/routes/auth/logout.ts +12 -0
  276. package/data/Generator/templates/server/src/routes/auth/me.ts +10 -0
  277. package/data/Generator/templates/server/src/routes/crud/_crud.ts +46 -0
  278. package/data/Generator/templates/server/src/routes/crud/index.ts +12 -0
  279. package/data/Generator/templates/server/src/routes/index.js +55 -0
  280. package/data/Generator/templates/server/src/routes/operations/_action.js +5 -0
  281. package/data/Generator/templates/server/src/routes/operations/_query.js +5 -0
  282. package/data/Generator/templates/server/src/routes/operations/index.js +18 -0
  283. package/data/Generator/templates/server/src/server.ts +76 -0
  284. package/data/Generator/templates/server/src/views/wrong-port.ts +123 -0
  285. package/data/Generator/templates/server/src/webSocket/initialization.ts +59 -0
  286. package/data/Generator/templates/server/tsconfig.json +41 -0
  287. package/data/Lsp/templates/ts/action.fn.ts +12 -0
  288. package/data/Lsp/templates/ts/operation.fn.js +7 -0
  289. package/data/Lsp/templates/ts/page.component.jsx +9 -0
  290. package/data/Lsp/templates/ts/query.fn.ts +12 -0
  291. package/data/packages/deploy/dist/common/brandedTypes.js +2 -0
  292. package/data/packages/deploy/dist/common/clientApp.js +26 -0
  293. package/data/packages/deploy/dist/common/commander.js +8 -0
  294. package/data/packages/deploy/dist/common/random.js +5 -0
  295. package/data/packages/deploy/dist/common/terminal.js +24 -0
  296. package/data/packages/deploy/dist/common/typeUtils.js +2 -0
  297. package/data/packages/deploy/dist/common/validation.js +14 -0
  298. package/data/packages/deploy/dist/common/waspBuild.js +21 -0
  299. package/data/packages/deploy/dist/common/waspProject.js +43 -0
  300. package/data/packages/deploy/dist/common/zx.js +10 -0
  301. package/data/packages/deploy/dist/index.js +30 -0
  302. package/data/packages/deploy/dist/providers/fly/CommonCmdOptions.js +2 -0
  303. package/data/packages/deploy/dist/providers/fly/CommonOps.js +36 -0
  304. package/data/packages/deploy/dist/providers/fly/DeploymentInstructions.js +12 -0
  305. package/data/packages/deploy/dist/providers/fly/commands/cmd/CmdCmdOptions.js +2 -0
  306. package/data/packages/deploy/dist/providers/fly/commands/cmd/cmd.js +29 -0
  307. package/data/packages/deploy/dist/providers/fly/commands/createDb/CreateDbCmdOptions.js +2 -0
  308. package/data/packages/deploy/dist/providers/fly/commands/createDb/createDb.js +55 -0
  309. package/data/packages/deploy/dist/providers/fly/commands/deploy/DeployCmdOptions.js +2 -0
  310. package/data/packages/deploy/dist/providers/fly/commands/deploy/deploy.js +88 -0
  311. package/data/packages/deploy/dist/providers/fly/commands/launch/LaunchCmdOptions.js +2 -0
  312. package/data/packages/deploy/dist/providers/fly/commands/launch/launch.js +17 -0
  313. package/data/packages/deploy/dist/providers/fly/commands/setup/SetupCmdOptions.js +2 -0
  314. package/data/packages/deploy/dist/providers/fly/commands/setup/setup.js +141 -0
  315. package/data/packages/deploy/dist/providers/fly/flyAppUrl.js +4 -0
  316. package/data/packages/deploy/dist/providers/fly/flyCli.js +74 -0
  317. package/data/packages/deploy/dist/providers/fly/index.js +121 -0
  318. package/data/packages/deploy/dist/providers/fly/jsonOutputSchemas.js +37 -0
  319. package/data/packages/deploy/dist/providers/fly/tomlFile.js +65 -0
  320. package/data/packages/deploy/dist/providers/railway/DeploymentInstructions.js +11 -0
  321. package/data/packages/deploy/dist/providers/railway/brandedTypes.js +2 -0
  322. package/data/packages/deploy/dist/providers/railway/commands/deploy/DeployCmdOptions.js +2 -0
  323. package/data/packages/deploy/dist/providers/railway/commands/deploy/client.js +22 -0
  324. package/data/packages/deploy/dist/providers/railway/commands/deploy/common.js +40 -0
  325. package/data/packages/deploy/dist/providers/railway/commands/deploy/index.js +57 -0
  326. package/data/packages/deploy/dist/providers/railway/commands/deploy/server.js +17 -0
  327. package/data/packages/deploy/dist/providers/railway/commands/launch/LaunchCmdOptions.js +2 -0
  328. package/data/packages/deploy/dist/providers/railway/commands/launch/launch.js +9 -0
  329. package/data/packages/deploy/dist/providers/railway/commands/setup/SetupCmdOptions.js +2 -0
  330. package/data/packages/deploy/dist/providers/railway/commands/setup/setup.js +146 -0
  331. package/data/packages/deploy/dist/providers/railway/index.js +83 -0
  332. package/data/packages/deploy/dist/providers/railway/jsonOutputSchemas.js +19 -0
  333. package/data/packages/deploy/dist/providers/railway/ports.js +6 -0
  334. package/data/packages/deploy/dist/providers/railway/railwayCli.js +85 -0
  335. package/data/packages/deploy/dist/providers/railway/railwayProject/RailwayProject.js +14 -0
  336. package/data/packages/deploy/dist/providers/railway/railwayProject/cli.js +80 -0
  337. package/data/packages/deploy/dist/providers/railway/railwayProject/index.js +48 -0
  338. package/data/packages/deploy/dist/providers/railway/railwayService/nameGenerator.js +24 -0
  339. package/data/packages/deploy/dist/providers/railway/railwayService/url.js +32 -0
  340. package/data/packages/deploy/package-lock.json +3536 -0
  341. package/data/packages/deploy/package.json +29 -0
  342. package/data/packages/prisma/dist/format.js +35 -0
  343. package/data/packages/prisma/dist/index.js +33 -0
  344. package/data/packages/prisma/package-lock.json +5101 -0
  345. package/data/packages/prisma/package.json +30 -0
  346. package/data/packages/studio/dist/index.js +48 -0
  347. package/data/packages/studio/dist/public/assets/Flow-b5112d3d.js +26 -0
  348. package/data/packages/studio/dist/public/assets/index-17ce6ed4.css +1 -0
  349. package/data/packages/studio/dist/public/assets/index-62a9d21a.js +120 -0
  350. package/data/packages/studio/dist/public/index.html +14 -0
  351. package/data/packages/studio/package-lock.json +1866 -0
  352. package/data/packages/studio/package.json +33 -0
  353. package/data/packages/ts-inspect/dist/exports.js +82 -0
  354. package/data/packages/ts-inspect/dist/index.js +28 -0
  355. package/data/packages/ts-inspect/package-lock.json +4947 -0
  356. package/data/packages/ts-inspect/package.json +31 -0
  357. package/data/packages/wasp-config/dist/__tests__/appAnalyzer.unit.test.d.ts +2 -0
  358. package/data/packages/wasp-config/dist/__tests__/appAnalyzer.unit.test.d.ts.map +1 -0
  359. package/data/packages/wasp-config/dist/__tests__/appAnalyzer.unit.test.js +59 -0
  360. package/data/packages/wasp-config/dist/__tests__/cli.unit.test.d.ts +2 -0
  361. package/data/packages/wasp-config/dist/__tests__/cli.unit.test.d.ts.map +1 -0
  362. package/data/packages/wasp-config/dist/__tests__/cli.unit.test.js +65 -0
  363. package/data/packages/wasp-config/dist/__tests__/mapTsAppSpecToAppSpecDecls.integration.test.d.ts +2 -0
  364. package/data/packages/wasp-config/dist/__tests__/mapTsAppSpecToAppSpecDecls.integration.test.d.ts.map +1 -0
  365. package/data/packages/wasp-config/dist/__tests__/mapTsAppSpecToAppSpecDecls.integration.test.js +126 -0
  366. package/data/packages/wasp-config/dist/__tests__/mapTsAppSpecToAppSpecDecls.unit.test.d.ts +2 -0
  367. package/data/packages/wasp-config/dist/__tests__/mapTsAppSpecToAppSpecDecls.unit.test.d.ts.map +1 -0
  368. package/data/packages/wasp-config/dist/__tests__/mapTsAppSpecToAppSpecDecls.unit.test.js +743 -0
  369. package/data/packages/wasp-config/dist/__tests__/testFixtures.d.ts +224 -0
  370. package/data/packages/wasp-config/dist/__tests__/testFixtures.d.ts.map +1 -0
  371. package/data/packages/wasp-config/dist/__tests__/testFixtures.js +656 -0
  372. package/data/packages/wasp-config/dist/__tests__/testFixtures.test-d.d.ts +2 -0
  373. package/data/packages/wasp-config/dist/__tests__/testFixtures.test-d.d.ts.map +1 -0
  374. package/data/packages/wasp-config/dist/__tests__/testFixtures.test-d.js +57 -0
  375. package/data/packages/wasp-config/dist/src/_private.d.ts +2 -0
  376. package/data/packages/wasp-config/dist/src/_private.d.ts.map +1 -0
  377. package/data/packages/wasp-config/dist/src/_private.js +1 -0
  378. package/data/packages/wasp-config/dist/src/appAnalyzer.d.ts +16 -0
  379. package/data/packages/wasp-config/dist/src/appAnalyzer.d.ts.map +1 -0
  380. package/data/packages/wasp-config/dist/src/appAnalyzer.js +34 -0
  381. package/data/packages/wasp-config/dist/src/appSpec.d.ts +223 -0
  382. package/data/packages/wasp-config/dist/src/appSpec.d.ts.map +1 -0
  383. package/data/packages/wasp-config/dist/src/appSpec.js +6 -0
  384. package/data/packages/wasp-config/dist/src/branded.d.ts +7 -0
  385. package/data/packages/wasp-config/dist/src/branded.d.ts.map +1 -0
  386. package/data/packages/wasp-config/dist/src/branded.js +1 -0
  387. package/data/packages/wasp-config/dist/src/cli.d.ts +6 -0
  388. package/data/packages/wasp-config/dist/src/cli.d.ts.map +1 -0
  389. package/data/packages/wasp-config/dist/src/cli.js +24 -0
  390. package/data/packages/wasp-config/dist/src/index.d.ts +8 -0
  391. package/data/packages/wasp-config/dist/src/index.d.ts.map +1 -0
  392. package/data/packages/wasp-config/dist/src/index.js +1 -0
  393. package/data/packages/wasp-config/dist/src/mapTsAppSpecToAppSpecDecls.d.ts +38 -0
  394. package/data/packages/wasp-config/dist/src/mapTsAppSpecToAppSpecDecls.d.ts.map +1 -0
  395. package/data/packages/wasp-config/dist/src/mapTsAppSpecToAppSpecDecls.js +294 -0
  396. package/data/packages/wasp-config/dist/src/publicApi/App.d.ts +24 -0
  397. package/data/packages/wasp-config/dist/src/publicApi/App.d.ts.map +1 -0
  398. package/data/packages/wasp-config/dist/src/publicApi/App.js +75 -0
  399. package/data/packages/wasp-config/dist/src/publicApi/tsAppSpec.d.ts +171 -0
  400. package/data/packages/wasp-config/dist/src/publicApi/tsAppSpec.d.ts.map +1 -0
  401. package/data/packages/wasp-config/dist/src/publicApi/tsAppSpec.js +1 -0
  402. package/data/packages/wasp-config/dist/src/run.d.ts +3 -0
  403. package/data/packages/wasp-config/dist/src/run.d.ts.map +1 -0
  404. package/data/packages/wasp-config/dist/src/run.js +18 -0
  405. package/data/packages/wasp-config/package-lock.json +3992 -0
  406. package/data/packages/wasp-config/package.json +39 -0
  407. package/main.js +9 -0
  408. package/package.json +1 -0
  409. package/readme.md +3 -0
  410. package/wasp-bin +0 -0
@@ -0,0 +1,40 @@
1
+ import { getSessionAndUserFromBearerToken } from 'wasp/auth/session'
2
+ import { createInvalidCredentialsError } from 'wasp/auth/utils'
3
+ import { defineHandler } from 'wasp/server/utils'
4
+
5
+ /**
6
+ * Auth middleware
7
+ *
8
+ * If the request includes an `Authorization` header it will try to authenticate the request,
9
+ * otherwise it will let the request through.
10
+ *
11
+ * - If authentication succeeds it sets `req.sessionId` and `req.user`
12
+ * - `req.user` is the user that made the request and it's used in
13
+ * all Wasp features that need to know the user that made the request.
14
+ * - `req.sessionId` is the ID of the session that authenticated the request.
15
+ * - If the request is not authenticated, it throws an error.
16
+ */
17
+ const auth = defineHandler(async (req, res, next) => {
18
+ const authHeader = req.get('Authorization')
19
+ // NOTE(matija): for now we let tokenless requests through and make it operation's
20
+ // responsibility to verify whether the request is authenticated or not. In the future
21
+ // we will develop our own system at Wasp-level for that.
22
+ if (!authHeader) {
23
+ req.sessionId = null
24
+ req.user = null
25
+ return next()
26
+ }
27
+
28
+ const sessionAndUser = await getSessionAndUserFromBearerToken(req)
29
+
30
+ if (sessionAndUser === null) {
31
+ throw createInvalidCredentialsError()
32
+ }
33
+
34
+ req.sessionId = sessionAndUser.session.id
35
+ req.user = sessionAndUser.user
36
+
37
+ next()
38
+ })
39
+
40
+ export default auth
@@ -0,0 +1,21 @@
1
+ import type { WaspInternal_CustomSerializableJSONValue_Register } from "superjson"
2
+
3
+ /*
4
+ This is a workaround for declaring custom types through side-effects in
5
+ TypeScript. This way a bare import, like `import "./prisma"` will register
6
+ itself as a custom serialization in the type-level, like it does at the
7
+ runtime-level.
8
+
9
+ This declaration creates an empty interface. Implementations of custom
10
+ serialization types can extend this interface through augmentation
11
+ (https://www.typescriptlang.org/docs/handbook/declaration-merging.html#merging-interfaces).
12
+ We can later inspect this interface to see which custom types are registered.
13
+
14
+ This approach is copied from TanStack Router's `Register` interface
15
+ https://github.com/TanStack/router/blob/v1.124.1/docs/router/framework/react/guide/creating-a-router.md#router-type-safety
16
+ */
17
+ declare module "superjson" {
18
+ interface WaspInternal_CustomSerializableJSONValue_Register {}
19
+ }
20
+
21
+ export type CustomSerializableJSONValue = WaspInternal_CustomSerializableJSONValue_Register[keyof WaspInternal_CustomSerializableJSONValue_Register]
@@ -0,0 +1,56 @@
1
+ {{={= =}=}}
2
+ import { deserialize, serialize } from "superjson"
3
+ import { CustomSerializableJSONValue } from "./custom-register"
4
+
5
+ {=# entitiesExist =}
6
+ import "./prisma"
7
+ {=/ entitiesExist =}
8
+
9
+ export type Payload = void | SuperJSONValue;
10
+
11
+ // The part below was copied from SuperJSON and slightly modified:
12
+ // https://github.com/blitz-js/superjson/blob/ae7dbcefe5d3ece5b04be0c6afe6b40f3a44a22a/src/types.ts
13
+ //
14
+ // We couldn't use SuperJSON's types directly because:
15
+ // 1. They have a weird quirk that turns `SuperJSONValue` into `any`.
16
+ // See why here:
17
+ // https://github.com/blitz-js/superjson/pull/36#issuecomment-669239876
18
+ // 2. We need to add our own custom types to the serialization process.
19
+ //
20
+ // We changed the code as little as possible to make future comparisons easier.
21
+ export type JSONValue = PrimitiveJSONValue | JSONArray | JSONObject;
22
+
23
+ export interface JSONObject {
24
+ [key: string]: JSONValue;
25
+ }
26
+
27
+ type PrimitiveJSONValue = string | number | boolean | undefined | null;
28
+
29
+ export interface JSONArray extends Array<JSONValue> {}
30
+
31
+ // Removed `Symbol` since we don't explicitly register any symbol to be serialized
32
+ // Added custom types from `CustomSerializableJSONValue`
33
+ export type SerializableJSONValue =
34
+ | Set<SuperJSONValue>
35
+ | Map<SuperJSONValue, SuperJSONValue>
36
+ | undefined
37
+ | bigint
38
+ | Date
39
+ | RegExp
40
+ | CustomSerializableJSONValue;
41
+
42
+ // Here's where we excluded `ClassInstance` (which was `any`) from the union.
43
+ export type SuperJSONValue =
44
+ | JSONValue
45
+ | SerializableJSONValue
46
+ | SuperJSONArray
47
+ | SuperJSONObject;
48
+
49
+ export interface SuperJSONArray extends Array<SuperJSONValue> {}
50
+
51
+ export interface SuperJSONObject {
52
+ [key: string]: SuperJSONValue;
53
+ }
54
+
55
+ export { deserialize, serialize }
56
+
@@ -0,0 +1,54 @@
1
+ import { Prisma } from "@prisma/client"
2
+ import { registerCustom } from "superjson"
3
+ import "./custom-register"
4
+
5
+ // This file is only added if there are (Prisma) entities in the AppSpec.
6
+
7
+ /*
8
+ == ADDING SUPPORT FOR PRISMA DECIMAL TYPE ==
9
+ We add support for the Decima Prisma type as listed here:
10
+ https://www.prisma.io/docs/orm/prisma-client/special-fields-and-types
11
+ */
12
+
13
+ /*
14
+ == Why this strange declaration? ==
15
+
16
+ You can usually get `Decimal` from Prisma in two ways:
17
+ a. `import("@prisma/client").Prisma.Decimal`
18
+ b. `import("@prisma/client/runtime/library").Decimal`
19
+
20
+ The problem is that (a) is only available in the case that the Prisma schema is using Decimal
21
+ somewhere, and doesn't exist at all otherwise, not even as `undefined`. And (b) is always
22
+ available, but the code at `@prisma/client/runtime/library` fails when imported from the
23
+ client (and this file can be imported from either client or server).
24
+
25
+ What we do here is tell TypeScript that `Prisma` (option a) can have an optional `Decimal`
26
+ property, and give it the `Decimal` type that we take from option (b). Importantly, we only
27
+ do a type import from (b) so we don't trigger the runtime error when importing from the client.
28
+ */
29
+ type DecimalClass = typeof import("@prisma/client/runtime/library").Decimal;
30
+ type DecimalInstance = InstanceType<DecimalClass>;
31
+ const Decimal = (Prisma as { Decimal?: DecimalClass }).Decimal;
32
+
33
+ /*
34
+ And finally, if we have the `Decimal` type because the Prisma schema is using it,
35
+ we register it as a custom type with SuperJSON.
36
+ Based on https://github.com/flightcontrolhq/superjson/blob/v2.2.2/README.md#decimaljs--prismadecimal
37
+ */
38
+ if (Decimal) {
39
+ registerCustom<DecimalInstance, string>(
40
+ {
41
+ isApplicable: (v): v is DecimalInstance => Decimal.isDecimal(v),
42
+ serialize: (v) => v.toJSON(),
43
+ deserialize: (v) => new Decimal(v),
44
+ },
45
+ "prisma.decimal",
46
+ );
47
+ }
48
+
49
+ // We add the `Decimal` to this interface so that it is registered as a custom serialization type
50
+ declare module "superjson" {
51
+ interface WaspInternal_CustomSerializableJSONValue_Register {
52
+ Decimal: DecimalInstance;
53
+ }
54
+ }
@@ -0,0 +1,50 @@
1
+ export type DataStore = {
2
+ getPrefixedKey(key: string): string
3
+ set(key: string, value: unknown): void
4
+ get(key: string): unknown
5
+ remove(key: string): void
6
+ clear(): void
7
+ }
8
+
9
+ function createLocalStorageDataStore(prefix: string): DataStore {
10
+ function getPrefixedKey(key: string): string {
11
+ return `${prefix}:${key}`
12
+ }
13
+
14
+ return {
15
+ getPrefixedKey,
16
+ set(key, value) {
17
+ ensureLocalStorageIsAvailable()
18
+ localStorage.setItem(getPrefixedKey(key), JSON.stringify(value))
19
+ },
20
+ get(key) {
21
+ ensureLocalStorageIsAvailable()
22
+ const value = localStorage.getItem(getPrefixedKey(key))
23
+ try {
24
+ return value ? JSON.parse(value) : undefined
25
+ } catch (e: any) {
26
+ return undefined
27
+ }
28
+ },
29
+ remove(key) {
30
+ ensureLocalStorageIsAvailable()
31
+ localStorage.removeItem(getPrefixedKey(key))
32
+ },
33
+ clear() {
34
+ ensureLocalStorageIsAvailable()
35
+ Object.keys(localStorage).forEach((key) => {
36
+ if (key.startsWith(prefix)) {
37
+ localStorage.removeItem(key)
38
+ }
39
+ })
40
+ },
41
+ }
42
+ }
43
+
44
+ export const storage = createLocalStorageDataStore('wasp')
45
+
46
+ function ensureLocalStorageIsAvailable(): void {
47
+ if (!window.localStorage) {
48
+ throw new Error('Local storage is not available.')
49
+ }
50
+ }
@@ -0,0 +1,19 @@
1
+ {{={= =}=}}
2
+ /**
3
+ * Code found in this module is not meant to be used in user's server or client
4
+ * code. It is used by the Wasp tooling e.g. in the Tailwind config to resolve
5
+ * paths to the project root directory.
6
+ */
7
+
8
+ import { join as joinPaths } from 'path'
9
+
10
+ // PUBLIC API
11
+ /**
12
+ * Wasp runs the client code in the `web-app` directory which is nested in the
13
+ * .wasp/out/web-app directory. This function resolves a project root dir path
14
+ * to be relative to the `web-app` directory i.e. `../../../projectDirPath`.
15
+ */
16
+ export function resolveProjectPath(path: string): string {
17
+ const waspProjectDirFromWebAppDir = '{= waspProjectDirFromWebAppDir =}'
18
+ return joinPaths(waspProjectDirFromWebAppDir, path)
19
+ }
@@ -0,0 +1,28 @@
1
+ {{={= =}=}}
2
+ import {
3
+ {=# entities =}
4
+ type {= name =},
5
+ {=/ entities =}
6
+ } from "@prisma/client"
7
+
8
+ export {
9
+ {=# entities =}
10
+ type {= name =},
11
+ {=/ entities =}
12
+ {=# isAuthEnabled =}
13
+ type {= authEntityName =},
14
+ type {= authIdentityEntityName =},
15
+ {=/ isAuthEnabled =}
16
+ } from "@prisma/client"
17
+
18
+ export type Entity =
19
+ {=# entities =}
20
+ | {= name =}
21
+ {=/ entities =}
22
+ | never
23
+
24
+ export type EntityName =
25
+ {=# entities =}
26
+ | "{= name =}"
27
+ {=/ entities =}
28
+ | never
@@ -0,0 +1,9 @@
1
+ import * as z from 'zod'
2
+
3
+ // PUBLIC API
4
+ export function defineEnvValidationSchema<Schema extends z.ZodObject<any>>(
5
+ schema: Schema,
6
+ ): Schema {
7
+ return schema
8
+ }
9
+
@@ -0,0 +1,38 @@
1
+ import * as z from 'zod'
2
+
3
+ import { getColorizedConsoleFormatString } from 'wasp/universal/ansiColors'
4
+
5
+ const redColorFormatString = getColorizedConsoleFormatString('red');
6
+
7
+ // PRIVATE API (SDK)
8
+ export function ensureEnvSchema<Schema extends z.ZodTypeAny>(
9
+ data: unknown,
10
+ schema: Schema
11
+ ): z.infer<Schema> {
12
+ const result = getValidatedEnvOrError(data, schema)
13
+ if (result.success) {
14
+ return result.data
15
+ } else {
16
+ console.error(`${redColorFormatString}${formatZodEnvErrors(result.error.issues)}`)
17
+ throw new Error('Error parsing environment variables')
18
+ }
19
+ }
20
+
21
+ // PRIVATE API (SDK, Vite config)
22
+ export function getValidatedEnvOrError<Schema extends z.ZodTypeAny>(
23
+ env: unknown,
24
+ schema: Schema
25
+ ): z.SafeParseReturnType<unknown, z.infer<Schema>> {
26
+ return schema.safeParse(env)
27
+ }
28
+
29
+ // PRIVATE API (SDK, Vite config)
30
+ export function formatZodEnvErrors(issues: z.ZodIssue[]): string {
31
+ const errorOutput = ['', '══ Env vars validation failed ══', '']
32
+ for (const error of issues) {
33
+ errorOutput.push(` - ${error.message}`)
34
+ }
35
+ errorOutput.push('')
36
+ errorOutput.push('════════════════════════════════')
37
+ return errorOutput.join('\n')
38
+ }
@@ -0,0 +1,152 @@
1
+ {{={= =}=}}
2
+ {
3
+ "name": "wasp",
4
+ "version": "1.0.0",
5
+ "private": true,
6
+ "type": "module",
7
+ "scripts": {
8
+ "build": "tsc && node ./scripts/copy-assets.js",
9
+ "test": "echo \"Error: no test specified\" && exit 1",
10
+ "types": "tsc --declaration --emitDeclarationOnly --stripInternal --declarationDir dist"
11
+ },
12
+ {=! IMPORTANT: If you modify this list, remember to update the spreadsheet at =}
13
+ {=! https://docs.google.com/spreadsheets/d/1QW-_16KRGTOaKXx9NYUtjk6m2TQ0nUMOA74hBthTH3g/edit =}
14
+ "exports": {
15
+ {=! todo(filip): Check all exports when done with SDK generation =}
16
+ {=! Some of the statements in the comments might become incorrect. =}
17
+ {=! "our code" means: "web-app", "server" or "SDK", or "some combination of the three". =}
18
+ {=! Used by our code, undocumented (but accessible) for users. =}
19
+ "./core/storage": "./dist/core/storage.js",
20
+ {=! Used by our code, undocumented (but accessible) for users. =}
21
+ "./core/serialization": "./dist/core/serialization/index.js",
22
+ "./core/auth": "./dist/core/auth.js",
23
+ {=! Used by our code, undocumented (but accessible) for users. =}
24
+ "./auth/helpers/user": "./dist/auth/helpers/user.js",
25
+ {=! Used by our code, undocumented (but accessible) for users. =}
26
+ "./auth/session": "./dist/auth/session.js",
27
+ {=! Used by our code, undocumented (but accessible) for users. =}
28
+ "./auth/user": "./dist/auth/user.js",
29
+ {=! Used by our code, undocumented (but accessible) for users. =}
30
+ "./auth/providers/types": "./dist/auth/providers/types.js",
31
+ {=! Used by our code, undocumented (but accessible) for users. =}
32
+ "./auth/types": "./dist/auth/types.js",
33
+ {=! Used by users, documented. =}
34
+ "./auth/utils": "./dist/auth/utils.js",
35
+ {=! Used by our code, undocumented (but accessible) for users. =}
36
+ "./auth/password": "./dist/auth/password.js",
37
+ {=! Used by our code, undocumented (but accessible) for users. =}
38
+ "./auth/jwt": "./dist/auth/jwt.js",
39
+ {=! Used by user, documented. =}
40
+ "./auth/validation": "./dist/auth/validation.js",
41
+ {=! Used by our code, undocumented (but accessible) for users. =}
42
+ "./auth/pages/createAuthRequiredPage": "./dist/auth/pages/createAuthRequiredPage.jsx",
43
+ {=! Used by our framework code (Websockets), undocumented (but accessible) for users. =}
44
+ "./api/events": "./dist/api/events.js",
45
+ {=! Used by users, documented. =}
46
+ "./operations": "./dist/operations/index.js",
47
+ {=! If we import a symbol like "import something form 'wasp/something'", we must =}
48
+ {=! expose it here (which leaks it to our users). We could avoid this by =}
49
+ {=! using relative imports inside SDK code (instead of library imports), =}
50
+ {=! but I didn't have time to implement it. =}
51
+ "./src/*": "./dist/src/*.js",
52
+ {=! Used by our code, undocumented (but accessible) for users. =}
53
+ "./operations/*": "./dist/operations/*",
54
+ {=! Used by our code, undocumented (but accessible) for users. =}
55
+ "./universal/url": "./dist/universal/url.js",
56
+ {=! Used by our code, undocumented (but accessible) for users. =}
57
+ "./universal/types": "./dist/universal/types.js",
58
+ {=! Used by our code, undocumented (but accessible) for users. =}
59
+ "./universal/validators": "./dist/universal/validators.js",
60
+ {=! Used by our code, undocumented (but accessible) for users. =}
61
+ "./universal/ansiColors": "./dist/universal/ansiColors.js",
62
+ {=! Parts are used by users, documented. Parts are probably used by our code, undocumented (but accessible). =}
63
+ "./server/utils": "./dist/server/utils.js",
64
+ {=! Used by our code, undocumented (but accessible) for users. =}
65
+ "./server/auth/email": "./dist/server/auth/email/index.js",
66
+ {=! Used by our code, undocumented (but accessible) for users. =}
67
+ "./client/test/*": "./dist/client/test/*.js",
68
+ {=! Used by our code, undocumented (but accessible) for users. =}
69
+ "./server/crud/*": "./dist/server/crud/*.js",
70
+ {=! Used by our code, undocumented (but accessible) for users. =}
71
+ "./server/email/core/types": "./dist/server/email/core/types.js",
72
+ {=! Used by our code, undocumented (but accessible) for users. =}
73
+ "./server/auth/email/utils": "./dist/server/auth/email/utils.js",
74
+ {=! Used by our code, undocumented (but accessible) for users. =}
75
+ "./server/jobs/*": "./dist/server/jobs/*.js",
76
+ {=! Used by our code, undocumented (but accessible) for users. =}
77
+ {=! Todo(filip): This export becomes problematic once we start supporting different executors =}
78
+ "./server/jobs/core/pgBoss": "./dist/server/jobs/core/pgBoss/index.js",
79
+
80
+ {=! Used by the framework client code, reconsider during refactoring. =}
81
+ "./client/webSocket/WebSocketProvider": "./dist/client/webSocket/WebSocketProvider.jsx",
82
+ {=! Still needed, reconsider during refactoring. =}
83
+ "./server/types": "./dist/server/types/index.js",
84
+ {=! Used by the framework server code, reconsider during refactoring. =}
85
+ "./server/middleware": "./dist/server/middleware/index.js",
86
+
87
+ {=! ================= NEW API HERE =================== =}
88
+ {=! Public: { config, prisma, type ServerSetupFn, HttpError, type DbSeedFn, type MiddlewareConfigFn } =}
89
+ {=! Private: [] =}
90
+ "./server": "./dist/server/index.js",
91
+ {=! Public: { type MyApiRoute1, type MyApiRoute2, ... } =}
92
+ {=! Private: [] =}
93
+ "./server/api": "./dist/server/api/index.js",
94
+ {=! Public: { api } =}
95
+ {=! Private: [sdk] =}
96
+ "./client/api": "./dist/api/index.js",
97
+ {=! Public: { type ServerToClientPayload, type ClientToServerPayload, useSocket, useSocketListener } =}
98
+ {=! Private: [] =}
99
+ "./client/webSocket": "./dist/client/webSocket/index.js",
100
+ {=! Public: { type WebSocketDefinition, type WaspSocketData } =}
101
+ {=! Private: [server, sdk] =}
102
+ "./server/webSocket": "./dist/server/webSocket/index.js",
103
+ "./entities": "./dist/entities/index.js",
104
+ "./auth": "./dist/auth/index.js",
105
+ "./auth/providers": "./dist/auth/providers/index.js",
106
+ "./client/auth": "./dist/client/auth/index.js",
107
+ "./client/operations": "./dist/client/operations/index.js",
108
+ "./server/auth": "./dist/server/auth/index.js",
109
+ "./server/crud": "./dist/server/crud/index.js",
110
+ "./client/crud": "./dist/client/crud/index.js",
111
+ "./server/email": "./dist/server/email/index.js",
112
+ "./server/jobs": "./dist/server/jobs/index.js",
113
+ "./server/operations": "./dist/server/operations/index.js",
114
+ "./client/router": "./dist/client/router/index.js",
115
+ "./client/test": "./dist/client/test/index.js",
116
+ "./client/hooks": "./dist/client/hooks.js",
117
+ "./client": "./dist/client/index.js",
118
+ "./dev": "./dist/dev/index.js",
119
+ "./env": "./dist/env/index.js",
120
+ {=! Private: [client] =}
121
+ "./env/validation": "./dist/env/validation.js",
122
+ {=! Private: [client, sdk] =}
123
+ "./client/env/schema": "./dist/client/env/schema.js",
124
+
125
+ {=! todo(filip): Fixes below are for type errors in 0.13.1, remove ASAP =}
126
+ {=! Used by our code (SDK for full-stack type safety), undocumented (but accessible) for users. =}
127
+ "./client/operations/rpc": "./dist/client/operations/rpc.js",
128
+ "./server/operations/actions": "./dist/server/operations/actions/index.js",
129
+ "./server/operations/queries": "./dist/server/operations/queries/index.js",
130
+ "./server/_types": "./dist/server/_types/index.js"
131
+
132
+ },
133
+ {=!
134
+ TypeScript doesn't care about the redirects we define above in "exports" field; those
135
+ are used only in runtime. TypeScript instead follows exact path as stated in an import when
136
+ trying to find the type declarations. Therefore, when "exports" redirect doesn't match the path
137
+ it redirects to, we need to also let TypeScript know about it, and that can be done with
138
+ `typesVersions` field below.
139
+ =}
140
+ "typesVersions": {
141
+ "*": {
142
+ "client/api": ["api/index.ts"]
143
+ }
144
+ },
145
+ "license": "ISC",
146
+ "include": [
147
+ "src/**/*"
148
+ ],
149
+ {=& depsChunk =},
150
+ {=& devDepsChunk =},
151
+ {=& peerDepsChunk =}
152
+ }
@@ -0,0 +1,17 @@
1
+ // Without this import, Prisma types are resolved incorrectly.
2
+ import * as runtime from '@prisma/client/runtime';
3
+
4
+ // Prisma generated types which we use as default input and output types for CRUD
5
+ // operations internally use interfaces for some types.
6
+ // Our SuperJSON serialization types throw a type error when used with interfaces
7
+ // because interfaces don't have an implicit index signature.
8
+ // Read more https://github.com/microsoft/TypeScript/issues/15300#issuecomment-1320528385
9
+ // Here's a playground demonstrating the behaviour difference: https://tsplay.dev/interface_vs_type_index
10
+
11
+ // Luckily, only one interface is problematic for us: `FieldRef` which we can augment
12
+ // to have an index signature:
13
+ declare module '@prisma/client/runtime/library.js' {
14
+ export interface FieldRef<Model, FieldType> {
15
+ [key: string]: any;
16
+ }
17
+ }
@@ -0,0 +1,14 @@
1
+ import * as fs from "node:fs/promises"
2
+ import * as path from "node:path"
3
+
4
+ const base = path.resolve(import.meta.dirname, "..");
5
+
6
+ const globs = ["./auth/forms/**/*.css"];
7
+
8
+ for await (const file of fs.glob(globs, { cwd: base })) {
9
+ const src = path.join(base, file);
10
+ const dest = path.join(base, "dist", file);
11
+
12
+ await fs.mkdir(path.dirname(dest), { recursive: true });
13
+ await fs.copyFile(src, dest);
14
+ }
@@ -0,0 +1,30 @@
1
+ export class HttpError extends Error {
2
+ public statusCode: number
3
+ public data: unknown
4
+
5
+ constructor(
6
+ statusCode: number,
7
+ message?: string,
8
+ data?: Record<string, unknown>,
9
+ options?: ErrorOptions
10
+ ) {
11
+ super(message, options)
12
+
13
+ if (Error.captureStackTrace) {
14
+ Error.captureStackTrace(this, HttpError)
15
+ }
16
+
17
+ this.name = this.constructor.name
18
+
19
+ if (
20
+ !(Number.isInteger(statusCode) && statusCode >= 400 && statusCode < 600)
21
+ ) {
22
+ throw new Error('statusCode has to be integer in range [400, 600).')
23
+ }
24
+ this.statusCode = statusCode
25
+
26
+ if (data) {
27
+ this.data = data
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,105 @@
1
+ {{={= =}=}}
2
+ import { type Expand } from 'wasp/universal/types'
3
+ import { type Request, type Response } from 'express'
4
+ import {
5
+ type ParamsDictionary as ExpressParams,
6
+ type Query as ExpressQuery,
7
+ } from 'express-serve-static-core'
8
+ import { prisma } from 'wasp/server'
9
+ {=# isAuthEnabled =}
10
+ import { type AuthUser } from 'wasp/auth'
11
+ {=/ isAuthEnabled =}
12
+ import { type _Entity } from './taggedEntities'
13
+ import { type Payload } from 'wasp/core/serialization'
14
+
15
+ export * from "./taggedEntities"
16
+ export * from "wasp/core/serialization"
17
+
18
+ export type UnauthenticatedQueryDefinition<
19
+ Entities extends _Entity[],
20
+ Input extends Payload,
21
+ Output extends Payload
22
+ > = UnauthenticatedOperationDefinition<Entities, Input, Output>
23
+
24
+ export type UnauthenticatedActionDefinition<
25
+ Entities extends _Entity[],
26
+ Input extends Payload,
27
+ Output extends Payload
28
+ > = UnauthenticatedOperationDefinition<Entities, Input, Output>
29
+
30
+ {=# isAuthEnabled =}
31
+ export type AuthenticatedQueryDefinition<
32
+ Entities extends _Entity[],
33
+ Input extends Payload,
34
+ Output extends Payload
35
+ > = AuthenticatedOperationDefinition<Entities, Input, Output>
36
+
37
+ export type AuthenticatedActionDefinition<
38
+ Entities extends _Entity[],
39
+ Input extends Payload,
40
+ Output extends Payload
41
+ > = AuthenticatedOperationDefinition<Entities, Input, Output>
42
+
43
+ export type AuthenticatedOperationDefinition<
44
+ Entities extends _Entity[],
45
+ Input extends Payload,
46
+ Output extends Payload
47
+ > = (
48
+ args: Input,
49
+ context: ContextWithUser<Entities>
50
+ ) => Output | Promise<Output>
51
+
52
+ export type AuthenticatedApi<
53
+ Entities extends _Entity[],
54
+ Params extends ExpressParams,
55
+ ResBody,
56
+ ReqBody,
57
+ ReqQuery extends ExpressQuery,
58
+ Locals extends Record<string, any>
59
+ > = (
60
+ req: Request<Params, ResBody, ReqBody, ReqQuery, Locals>,
61
+ res: Response<ResBody, Locals>,
62
+ context: ContextWithUser<Entities>,
63
+ ) => void
64
+
65
+ {=/ isAuthEnabled =}
66
+ export type UnauthenticatedOperationDefinition<
67
+ Entities extends _Entity[],
68
+ Input extends Payload,
69
+ Output extends Payload
70
+ > = (args: Input, context: Context<Entities>) => Output | Promise<Output>
71
+
72
+ export type Api<
73
+ Entities extends _Entity[],
74
+ Params extends ExpressParams,
75
+ ResBody,
76
+ ReqBody,
77
+ ReqQuery extends ExpressQuery,
78
+ Locals extends Record<string, any>
79
+ > = (
80
+ req: Request<Params, ResBody, ReqBody, ReqQuery, Locals>,
81
+ res: Response<ResBody, Locals>,
82
+ context: Context<Entities>,
83
+ ) => void
84
+
85
+ export type EntityMap<Entities extends _Entity[]> = {
86
+ [EntityName in Entities[number]["_entityName"]]: PrismaDelegate[EntityName]
87
+ }
88
+
89
+ export type PrismaDelegate = {
90
+ {=# entities =}
91
+ "{= name =}": typeof prisma.{= prismaIdentifier =},
92
+ {=/ entities =}
93
+ }
94
+
95
+ type Context<Entities extends _Entity[]> = Expand<{
96
+ entities: Expand<EntityMap<Entities>>
97
+ }>
98
+
99
+ {=# isAuthEnabled =}
100
+ type ContextWithUser<Entities extends _Entity[]> = Expand<
101
+ Context<Entities> & { user?: AuthUser }
102
+ >
103
+
104
+ export type { ProviderName } from 'wasp/auth/utils'
105
+ {=/ isAuthEnabled =}