@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,123 @@
1
+ /*
2
+ This template gets rendered when you visit the root route on the server (i.e.
3
+ http://localhost:3001/) in development mode.
4
+
5
+ Some of the data passed to this template is known at runtime and not compile
6
+ time, so we need to craft the string at runtime with a JS template string. We
7
+ explicitly do not use Wasp mustaches here so we don't have to reason about two
8
+ different templating systems.
9
+
10
+ For now, we don't serve any other static files in our routes, so all the
11
+ resources needed (CSS, images, etc.) must be inlined into the file.
12
+ */
13
+
14
+ // The /* HTML */ comment is a hint to `prettier` to format this string as HTML.
15
+ export const makeWrongPortPage = ({
16
+ appName,
17
+ frontendUrl,
18
+ }: {
19
+ appName: string;
20
+ frontendUrl: string;
21
+ }): string => /* HTML */ `
22
+ <!doctype html>
23
+ <html lang="en">
24
+ <head>
25
+ <meta charset="UTF-8" />
26
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
27
+ <title>${appName} API Server</title>
28
+
29
+ <style>
30
+ :root {
31
+ --page-background: #f0f0f0;
32
+ --wrapper-background: white;
33
+ --wasp-yellow: #f5cc05;
34
+ --main-link-color: #1a73e8;
35
+ }
36
+
37
+ .wrapper {
38
+ font-family: system-ui, sans-serif;
39
+ width: 90%;
40
+ max-width: 600px;
41
+ margin: 2em auto;
42
+ }
43
+
44
+ h1,
45
+ h2 {
46
+ margin: 0;
47
+ }
48
+
49
+ .main-link {
50
+ text-align: center;
51
+ font-size: 1.5em;
52
+ font-weight: bold;
53
+ font-family: ui-monospace, monospace;
54
+ }
55
+
56
+ .icon {
57
+ width: 1em;
58
+ height: 1em;
59
+ }
60
+
61
+ .wasp-title {
62
+ margin: 0.5em 0;
63
+ display: flex;
64
+ align-items: center;
65
+ gap: 0.2em;
66
+ }
67
+
68
+ body {
69
+ background-color: var(--page-background);
70
+ }
71
+
72
+ main {
73
+ background-color: var(--wrapper-background);
74
+ padding: 1.5em;
75
+ border-radius: 10px;
76
+ }
77
+
78
+ a,
79
+ a:visited {
80
+ color: var(--main-link-color);
81
+ }
82
+ </style>
83
+ </head>
84
+ <body>
85
+ <div class="wrapper">
86
+ <header>
87
+ <h2 class="wasp-title">
88
+ <svg viewBox="0 0 161 161" class="icon" alt="Wasp Logo">
89
+ <circle cx="80.5" cy="80.5" r="79" fill="var(--wasp-yellow)" />
90
+ <path
91
+ d="M88.67 114.33h2.91q6 0 7.87-1.89c1.22-1.25 1.83-3.9 1.83-7.93V93.89c0-4.46.65-7.7 1.93-9.73s3.51-3.43 6.67-4.2q-4.69-1.08-6.65-4.12c-1.3-2-2-5.28-2-9.77V55.44q0-6-1.83-7.93t-7.87-1.88h-2.86V39.5h2.65q10.65 0 14.24 3.15t3.59 12.62v10.29c0 4.28.77 7.24 2.29 8.87s4.3 2.44 8.32 2.44h2.74V83h-2.74q-6 0-8.32 2.49c-1.52 1.65-2.29 4.64-2.29 9v10.25q0 9.47-3.59 12.64t-14.24 3.12h-2.65Z"
92
+ />
93
+ <path d="M38.5 85.15h37.33v7.58H38.5Zm0-17.88h37.33v7.49H38.5Z" />
94
+ </svg>
95
+ Wasp
96
+ </h2>
97
+ </header>
98
+
99
+ <main>
100
+ <h1>${appName} API Server</h1>
101
+ <p>
102
+ The server is up and running. This is the backend part of your Wasp
103
+ application.
104
+ </p>
105
+ <p>
106
+ If you want to visit your frontend application, go to this URL in
107
+ your browser:
108
+ </p>
109
+ <a href="${frontendUrl}" class="main-link">
110
+ <p>${frontendUrl}</p>
111
+ </a>
112
+ <p>
113
+ <small>
114
+ This message is shown because you are running the server in
115
+ development mode. In production, this route would not show
116
+ anything.
117
+ </small>
118
+ </p>
119
+ </main>
120
+ </div>
121
+ </body>
122
+ </html>
123
+ `;
@@ -0,0 +1,59 @@
1
+ {{={= =}=}}
2
+
3
+ import http from 'http'
4
+ import { Server, Socket } from 'socket.io'
5
+ import type { ServerType } from 'wasp/server/webSocket'
6
+
7
+ import { config, prisma } from 'wasp/server'
8
+
9
+ {=# isAuthEnabled =}
10
+ import { getSessionAndUserFromSessionId } from 'wasp/auth/session'
11
+ import { makeAuthUserIfPossible } from 'wasp/auth/user'
12
+ {=/ isAuthEnabled =}
13
+
14
+ {=& userWebSocketFn.importStatement =}
15
+
16
+ // Initializes the WebSocket server and invokes the user's WebSocket function.
17
+ export async function init(server: http.Server): Promise<void> {
18
+ // TODO: In the future, we can consider allowing a clustering option.
19
+ // Ref: https://github.com/wasp-lang/wasp/issues/1228
20
+
21
+ // TODO: Uncomment the type annotation once we make sure that the types between different packages are aligned.
22
+ // Ref: https://github.com/wasp-lang/wasp/issues/2726
23
+ const io /* : ServerType */ = new Server(server, {
24
+ cors: {
25
+ origin: config.frontendUrl,
26
+ }
27
+ })
28
+
29
+ {=# isAuthEnabled =}
30
+ io.use(addUserToSocketDataIfAuthenticated)
31
+ {=/ isAuthEnabled =}
32
+
33
+ const context = {
34
+ entities: {
35
+ {=# allEntities =}
36
+ {= name =}: prisma.{= prismaIdentifier =},
37
+ {=/ allEntities =}
38
+ }
39
+ }
40
+
41
+ await ({= userWebSocketFn.importIdentifier =} as any)(io, context)
42
+ }
43
+
44
+ {=# isAuthEnabled =}
45
+ async function addUserToSocketDataIfAuthenticated(socket: Socket, next: (err?: Error) => void) {
46
+ const sessionId = socket.handshake.auth.sessionId
47
+ if (sessionId) {
48
+ try {
49
+ const sessionAndUser = await getSessionAndUserFromSessionId(sessionId)
50
+ const user = sessionAndUser ? makeAuthUserIfPossible(sessionAndUser.user) : null
51
+ socket.data = {
52
+ ...socket.data,
53
+ user,
54
+ }
55
+ } catch (err) { }
56
+ }
57
+ next()
58
+ }
59
+ {=/ isAuthEnabled =}
@@ -0,0 +1,41 @@
1
+ {{={= =}=}}
2
+ {
3
+ "extends": "@tsconfig/node{= majorNodeVersion =}/tsconfig.json",
4
+ "compilerOptions": {
5
+ // Overriding this until we implement more complete TypeScript support.
6
+ "strict": false,
7
+ "allowJs": true,
8
+
9
+ // This property currently doesn't matter because we haven't been running
10
+ // TSC on server code since https://github.com/wasp-lang/wasp/pull/1714.
11
+ //
12
+ // When we start running TSC again (after we fix all current errors and
13
+ // make project references work for the TS config), then I believe the
14
+ // correct configuration is "rootDir": "." (the project reference should
15
+ // take care of the user code), but we should double-check.
16
+ //
17
+ // Before changing this property, ensure you're aware of the implications:
18
+ // - https://github.com/wasp-lang/wasp/pull/1584#discussion_r1404019301
19
+ // - https://github.com/wasp-lang/wasp/pull/1713/files#diff-58191eecd9cc55f71c73de89420df8b1866dce38ad35f4ef0f6f8874616eda77R32
20
+ "rootDir": ".",
21
+ // Enable source map for debugging
22
+ "sourceMap": true,
23
+ // We are using rollup and extensionless imports, our module and module
24
+ // resolution reflect that.
25
+ "module": "preserve",
26
+ "moduleResolution": "bundler",
27
+ // The remaining settings should match the extended nodeXY/tsconfig.json, but I kept
28
+ // them here to be explicit.
29
+ "esModuleInterop": true,
30
+ "skipLibCheck": true,
31
+ "outDir": "dist",
32
+ "target": "es2022",
33
+ "lib" : ["es2023"]
34
+ },
35
+ "include": [
36
+ "src"
37
+ ],
38
+ "references": [
39
+ { "path": "{= srcTsConfigPath =}" }
40
+ ]
41
+ }
@@ -0,0 +1,12 @@
1
+ import { type {{upperDeclName}} } from 'wasp/server/operations'
2
+
3
+ type {{upperDeclName}}Input = void
4
+ type {{upperDeclName}}Output = void
5
+
6
+ {{#named?}}export {{/named?}}const {{name}}: {{upperDeclName}}<{{upperDeclName}}Input, {{upperDeclName}}Output> = async (args, context) => {
7
+ // Implementation goes here
8
+ }
9
+
10
+ {{#default?}}
11
+ export default {{name}}
12
+ {{/default?}}
@@ -0,0 +1,7 @@
1
+ {{#named?}}export {{/named?}}const {{name}} = async (args, context) => {
2
+ // Implementation goes here
3
+ }
4
+
5
+ {{#default?}}
6
+ export default {{name}}
7
+ {{/default?}}
@@ -0,0 +1,9 @@
1
+ {{#named?}}export {{/named?}}function {{name}}() {
2
+ return (
3
+ <div>Hello world!</div>
4
+ )
5
+ }
6
+
7
+ {{#default?}}
8
+ export default {{name}}
9
+ {{/default?}}
@@ -0,0 +1,12 @@
1
+ import { type {{upperDeclName}} } from 'wasp/server/operations'
2
+
3
+ type {{upperDeclName}}Input = void
4
+ type {{upperDeclName}}Output = void
5
+
6
+ {{#named?}}export {{/named?}}const {{name}}: {{upperDeclName}}<{{upperDeclName}}Input, {{upperDeclName}}Output> = async (args, context) => {
7
+ // Implementation goes here
8
+ }
9
+
10
+ {{#default?}}
11
+ export default {{name}}
12
+ {{/default?}}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=brandedTypes.js.map
@@ -0,0 +1,26 @@
1
+ import { waspSays } from "./terminal.js";
2
+ import { getClientBuildArtefactsDir, getClientBuildDir, } from "./waspProject.js";
3
+ import { createCommandWithCwd } from "./zx.js";
4
+ export const serverUrlEnvVarName = "REACT_APP_API_URL";
5
+ export async function buildClient(defaultServerAppUrl, { waspProjectDir }) {
6
+ waspSays("Building web client for production...");
7
+ waspSays(`If you configured a custom domain for the server, you should run the command with an env variable: ${serverUrlEnvVarName}=https://serverUrl.com <command>`);
8
+ const clientBuildDir = getClientBuildDir(waspProjectDir);
9
+ const npmCli = createCommandWithCwd("npm", clientBuildDir);
10
+ await npmCli(["install"]);
11
+ const serverUrl = getServerAppUrlEnvValue() ?? defaultServerAppUrl;
12
+ await npmCli(["run", "build"], {
13
+ env: {
14
+ ...process.env,
15
+ [serverUrlEnvVarName]: serverUrl,
16
+ },
17
+ });
18
+ return getClientBuildArtefactsDir(waspProjectDir);
19
+ }
20
+ // We allow users to specify the server URL that the client will connect to
21
+ // using an environment variable.
22
+ // TODO: improve this API to allow specifying the server URL via options or a config file.
23
+ function getServerAppUrlEnvValue() {
24
+ return process.env[serverUrlEnvVarName];
25
+ }
26
+ //# sourceMappingURL=clientApp.js.map
@@ -0,0 +1,8 @@
1
+ export function getFullCommandName(command) {
2
+ const fullCommandNameParts = [command.name()];
3
+ for (let parent = command.parent; parent; parent = parent.parent) {
4
+ fullCommandNameParts.unshift(parent.name());
5
+ }
6
+ return fullCommandNameParts.join(" ");
7
+ }
8
+ //# sourceMappingURL=commander.js.map
@@ -0,0 +1,5 @@
1
+ import crypto from "crypto";
2
+ export function generateRandomHexString(sizeBytes = 32) {
3
+ return crypto.randomBytes(sizeBytes).toString("hex");
4
+ }
5
+ //# sourceMappingURL=random.js.map
@@ -0,0 +1,24 @@
1
+ import { chalk } from "zx";
2
+ export function waspSays(str) {
3
+ const formattedStr = str
4
+ .split("\n")
5
+ .map((line) => `🚀 ${line}`)
6
+ .join("\n");
7
+ console.log(chalk.yellow(formattedStr));
8
+ }
9
+ export function displayWaspRocketImage() {
10
+ // Escaping backslashes makes it look weird here, but it works in console.
11
+ const asciiArt = `
12
+
13
+ __
14
+ // \\
15
+ \\\\_/ //
16
+ _ -(||)(')
17
+ \\ \\____///_____
18
+ #########[==__DEPLOYED__}
19
+ /_/
20
+
21
+ `;
22
+ console.log(asciiArt);
23
+ }
24
+ //# sourceMappingURL=terminal.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=typeUtils.js.map
@@ -0,0 +1,14 @@
1
+ import fs from "fs";
2
+ import path from "node:path";
3
+ export function assertDirPathIsAbsolute(dirPath, dirNameInError) {
4
+ if (!path.isAbsolute(dirPath)) {
5
+ throw new Error(`The ${dirNameInError} path must be absolute.`);
6
+ }
7
+ }
8
+ export function assertDirExists(dirPath, dirNameInError) {
9
+ const dirExists = fs.existsSync(dirPath);
10
+ if (!dirExists) {
11
+ throw new Error(`The ${dirNameInError} does not exist.`);
12
+ }
13
+ }
14
+ //# sourceMappingURL=validation.js.map
@@ -0,0 +1,21 @@
1
+ import { waspSays } from "./terminal.js";
2
+ import { createCommandWithCwd } from "./zx.js";
3
+ export const ensureWaspProjectIsBuilt = createEnsureWaspProjectIsBuilt();
4
+ function createEnsureWaspProjectIsBuilt() {
5
+ async function buildWaspApp({ waspProjectDir, waspExe, }) {
6
+ waspSays("Building your Wasp app...");
7
+ const waspCli = createCommandWithCwd(waspExe, waspProjectDir);
8
+ return waspCli(["build"]);
9
+ }
10
+ // We want to build the Wasp project only once per CLI invocation.
11
+ // Sometimes `ensureWaspProjectIsBuilt` is called multiple times
12
+ // (e.g. in `setup` command, we call it and then again when deploying).
13
+ let cachedWaspBuildResult = undefined;
14
+ return (...params) => {
15
+ if (cachedWaspBuildResult === undefined) {
16
+ cachedWaspBuildResult = buildWaspApp(...params);
17
+ }
18
+ return cachedWaspBuildResult;
19
+ };
20
+ }
21
+ //# sourceMappingURL=waspBuild.js.map
@@ -0,0 +1,43 @@
1
+ import fs from "fs";
2
+ import path from "node:path";
3
+ import { assertDirExists, assertDirPathIsAbsolute } from "./validation.js";
4
+ import { createCommandWithCwd } from "./zx.js";
5
+ export async function assertValidWaspProject(waspProjectDir, waspExe) {
6
+ const waspCli = createCommandWithCwd(waspExe, waspProjectDir);
7
+ const result = await waspCli(["info"], {
8
+ quiet: true,
9
+ nothrow: true,
10
+ });
11
+ if (result.exitCode !== 0) {
12
+ throw new Error([
13
+ "The supplied Wasp directory does not appear to be a valid Wasp project.",
14
+ "Please double check your Wasp project directory.",
15
+ ].join("\n"));
16
+ }
17
+ }
18
+ export function assertWaspProjectDirIsAbsoluteAndPresent(waspProjectDir) {
19
+ const dirNameInError = "Wasp project directory";
20
+ assertDirPathIsAbsolute(waspProjectDir, dirNameInError);
21
+ assertDirExists(waspProjectDir, dirNameInError);
22
+ }
23
+ export function buildDirExists(waspProjectDir) {
24
+ return fs.existsSync(getWaspBuildDir(waspProjectDir));
25
+ }
26
+ export function getServerBuildArtefactsDir(waspProjectDir) {
27
+ return getServerBuildDir(waspProjectDir);
28
+ }
29
+ export function getClientBuildArtefactsDir(waspProjectDir) {
30
+ const clientBuildDir = getClientBuildDir(waspProjectDir);
31
+ return path.join(clientBuildDir, "build");
32
+ }
33
+ function getWaspBuildDir(waspProjectDir) {
34
+ return path.join(waspProjectDir, ".wasp", "build");
35
+ }
36
+ export function getServerBuildDir(waspProjectDir) {
37
+ // The server is built from the Wasp build directory.
38
+ return path.join(getWaspBuildDir(waspProjectDir), ".");
39
+ }
40
+ export function getClientBuildDir(waspProjectDir) {
41
+ return path.join(getWaspBuildDir(waspProjectDir), "web-app");
42
+ }
43
+ //# sourceMappingURL=waspProject.js.map
@@ -0,0 +1,10 @@
1
+ import { $ } from "zx";
2
+ export function createCommandWithCwd(command, cwd) {
3
+ return (commandArgs, options) => {
4
+ return $({
5
+ cwd,
6
+ ...(options ?? {}),
7
+ }) `${command} ${commandArgs}`;
8
+ };
9
+ }
10
+ //# sourceMappingURL=zx.js.map
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from "commander";
3
+ import { $, syncProcessCwd } from "zx";
4
+ import { waspSays } from "./common/terminal.js";
5
+ import { createFlyCommand } from "./providers/fly/index.js";
6
+ import { createRailwayCommand } from "./providers/railway/index.js";
7
+ const program = new Command();
8
+ program
9
+ .name("wasp deploy")
10
+ .description("CLI for deploying Wasp apps to various clouds")
11
+ .allowUnknownOption();
12
+ // We want to see the output of commands by default
13
+ $.verbose = true;
14
+ // Keeps the process.cwd() in sync with the internal $ current working directory
15
+ // if it is changed via cd().
16
+ syncProcessCwd();
17
+ program.addCommand(createFlyCommand());
18
+ program.addCommand(createRailwayCommand());
19
+ try {
20
+ // parseAsync not only parses the command line arguments but also
21
+ // executes the command and it will throw an error if the command fails.
22
+ await program.parseAsync();
23
+ }
24
+ catch (error) {
25
+ if (error instanceof Error && error.message) {
26
+ waspSays(error.message);
27
+ }
28
+ process.exit(1);
29
+ }
30
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=CommonCmdOptions.js.map
@@ -0,0 +1,36 @@
1
+ import { cd } from "zx";
2
+ import { getClientBuildDir, getServerBuildDir, } from "../../common/waspProject.js";
3
+ import { clientTomlExistsInProject, copyLocalClientTomlToProject, copyLocalServerTomlToProject, copyProjectClientTomlLocally, copyProjectServerTomlLocally, serverTomlExistsInProject, } from "./tomlFile.js";
4
+ export var ContextOption;
5
+ (function (ContextOption) {
6
+ ContextOption["Client"] = "client";
7
+ ContextOption["Server"] = "server";
8
+ })(ContextOption || (ContextOption = {}));
9
+ export function getCommonOps(context, waspProjectDir, paths) {
10
+ const commonOps = {
11
+ [ContextOption.Client]: createClientCommonOps(waspProjectDir, paths),
12
+ [ContextOption.Server]: createServerCommonOps(waspProjectDir, paths),
13
+ };
14
+ return commonOps[context];
15
+ }
16
+ function createClientCommonOps(waspProjectDir, paths) {
17
+ return {
18
+ waspProjectDir,
19
+ paths,
20
+ cdToBuildDir: () => cd(getClientBuildDir(waspProjectDir)),
21
+ tomlExistsInProject: () => clientTomlExistsInProject(paths),
22
+ copyLocalTomlToProject: () => copyLocalClientTomlToProject(paths),
23
+ copyProjectTomlLocally: () => copyProjectClientTomlLocally(paths),
24
+ };
25
+ }
26
+ function createServerCommonOps(waspProjectDir, paths) {
27
+ return {
28
+ waspProjectDir,
29
+ paths,
30
+ cdToBuildDir: () => cd(getServerBuildDir(waspProjectDir)),
31
+ tomlExistsInProject: () => serverTomlExistsInProject(paths),
32
+ copyLocalTomlToProject: () => copyLocalServerTomlToProject(paths),
33
+ copyProjectTomlLocally: () => copyProjectServerTomlLocally(paths),
34
+ };
35
+ }
36
+ //# sourceMappingURL=CommonOps.js.map
@@ -0,0 +1,12 @@
1
+ export function createDeploymentInstructions({ baseName, cmdOptions, tomlFilePaths, region, }) {
2
+ return Object.freeze({
3
+ baseName,
4
+ region,
5
+ cmdOptions,
6
+ tomlFilePaths,
7
+ clientFlyAppName: `${baseName}-client`,
8
+ serverFlyAppName: `${baseName}-server`,
9
+ dbName: `${baseName}-db`,
10
+ });
11
+ }
12
+ //# sourceMappingURL=DeploymentInstructions.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=CmdCmdOptions.js.map
@@ -0,0 +1,29 @@
1
+ import { $ } from "zx";
2
+ import { waspSays } from "../../../../common/terminal.js";
3
+ import { ensureWaspProjectIsBuilt } from "../../../../common/waspBuild.js";
4
+ import { getCommonOps } from "../../CommonOps.js";
5
+ import { deleteLocalToml, getTomlFilePaths, localTomlExists, } from "../../tomlFile.js";
6
+ // Runs a command by copying down the project toml files, executing it, and copying it back up (just in case).
7
+ // If the toml file does not exist, some commands will not run with additional args (e.g. -a <appname>).
8
+ export async function cmd(flyctlArgs, cmdOptions) {
9
+ if (cmdOptions.org) {
10
+ flyctlArgs.push("--org", cmdOptions.org);
11
+ }
12
+ waspSays(`Running ${cmdOptions.context} command: flyctl ${flyctlArgs.join(" ")}`);
13
+ await ensureWaspProjectIsBuilt(cmdOptions);
14
+ const tomlFilePaths = getTomlFilePaths(cmdOptions);
15
+ const commonOps = getCommonOps(cmdOptions.context, cmdOptions.waspProjectDir, tomlFilePaths);
16
+ await runFlyctlCommand(commonOps, flyctlArgs);
17
+ }
18
+ async function runFlyctlCommand(commonOps, flyctlArgs) {
19
+ commonOps.cdToBuildDir();
20
+ deleteLocalToml();
21
+ if (commonOps.tomlExistsInProject()) {
22
+ commonOps.copyProjectTomlLocally();
23
+ }
24
+ await $ `flyctl ${flyctlArgs}`;
25
+ if (localTomlExists()) {
26
+ commonOps.copyLocalTomlToProject();
27
+ }
28
+ }
29
+ //# sourceMappingURL=cmd.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=CreateDbCmdOptions.js.map
@@ -0,0 +1,55 @@
1
+ import { $, ProcessOutput, question } from "zx";
2
+ import { getFullCommandName } from "../../../../common/commander.js";
3
+ import { waspSays } from "../../../../common/terminal.js";
4
+ import { createDeploymentInstructions } from "../../DeploymentInstructions.js";
5
+ import { flyDeployCommand, flySetupCommand } from "../../index.js";
6
+ import { getInferredBasenameFromServerToml, getTomlFilePaths, serverTomlExistsInProject, } from "../../tomlFile.js";
7
+ export async function createDb(region, cmdOptions) {
8
+ waspSays("Creating your DB on Fly.io!");
9
+ const tomlFilePaths = getTomlFilePaths(cmdOptions);
10
+ if (!serverTomlExistsInProject(tomlFilePaths)) {
11
+ throw new Error(`${tomlFilePaths.serverTomlPath} missing. Skipping DB creation. Perhaps you need to run "${getFullCommandName(flySetupCommand)}" first?`);
12
+ }
13
+ const inferredBaseName = getInferredBasenameFromServerToml(tomlFilePaths);
14
+ const deploymentInstructions = createDeploymentInstructions({
15
+ baseName: inferredBaseName,
16
+ region,
17
+ cmdOptions,
18
+ tomlFilePaths,
19
+ });
20
+ // Creates a DB, waits for it to come up, then links it to the app.
21
+ // The attachment process shares the DATABASE_URL secret.
22
+ const createArgs = [
23
+ "--name",
24
+ deploymentInstructions.dbName,
25
+ "--region",
26
+ deploymentInstructions.region,
27
+ "--vm-size",
28
+ cmdOptions.vmSize,
29
+ "--initial-cluster-size",
30
+ cmdOptions.initialClusterSize,
31
+ "--volume-size",
32
+ cmdOptions.volumeSize,
33
+ ];
34
+ if (cmdOptions.dbImage) {
35
+ createArgs.push("--image-ref", cmdOptions.dbImage);
36
+ }
37
+ if (deploymentInstructions.cmdOptions.org) {
38
+ createArgs.push("--org", deploymentInstructions.cmdOptions.org);
39
+ }
40
+ try {
41
+ await $ `flyctl postgres create ${createArgs}`;
42
+ await $ `flyctl postgres attach ${deploymentInstructions.dbName} -a ${deploymentInstructions.serverFlyAppName}`;
43
+ }
44
+ catch (error) {
45
+ if (error instanceof ProcessOutput) {
46
+ throw new Error(error.stderr.trim());
47
+ }
48
+ else {
49
+ throw error;
50
+ }
51
+ }
52
+ await question("Please take note of your database credentials above, as they will not be available in plaintext again. Press any key to continue.");
53
+ waspSays(`Don't forget to deploy your app by running "${getFullCommandName(flyDeployCommand)}".`);
54
+ }
55
+ //# sourceMappingURL=createDb.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=DeployCmdOptions.js.map