@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,57 @@
1
+ import { getFullCommandName } from "../../../../common/commander.js";
2
+ import { waspSays } from "../../../../common/terminal.js";
3
+ import { ensureWaspProjectIsBuilt } from "../../../../common/waspBuild.js";
4
+ import { createDeploymentInstructions } from "../../DeploymentInstructions.js";
5
+ import { railwaySetupCommand } from "../../index.js";
6
+ import { linkRailwayProjectToWaspProjectDir } from "../../railwayProject/cli.js";
7
+ import { getRailwayProjectStatus, ProjectStatus, } from "../../railwayProject/index.js";
8
+ import { deployClient } from "./client.js";
9
+ import { deployServer } from "./server.js";
10
+ export async function deploy(projectName, options) {
11
+ const deploymentInstructions = createDeploymentInstructions(projectName, options);
12
+ await ensureRailwayProjectForDirectory({
13
+ projectName,
14
+ waspProjectDir: options.waspProjectDir,
15
+ existingProjectId: options.existingProjectId,
16
+ railwayExe: options.railwayExe,
17
+ });
18
+ waspSays("Deploying your Wasp app to Railway!");
19
+ await ensureWaspProjectIsBuilt(options);
20
+ if (options.skipServer) {
21
+ waspSays("Skipping server deploy due to CLI option.");
22
+ }
23
+ else {
24
+ await deployServer(deploymentInstructions);
25
+ }
26
+ if (options.skipClient) {
27
+ waspSays("Skipping client deploy due to CLI option.");
28
+ }
29
+ else {
30
+ await deployClient(deploymentInstructions);
31
+ }
32
+ }
33
+ async function ensureRailwayProjectForDirectory({ railwayExe, projectName, waspProjectDir, existingProjectId, }) {
34
+ const { status, project } = await getRailwayProjectStatus({
35
+ projectName,
36
+ waspProjectDir,
37
+ railwayExe,
38
+ existingProjectId,
39
+ });
40
+ switch (status) {
41
+ case ProjectStatus.EXISTING_PROJECT_ALREADY_LINKED:
42
+ waspSays(`Using already linked project: "${projectName}"`);
43
+ return project;
44
+ case ProjectStatus.EXISTING_PROJECT_SHOULD_BE_LINKED:
45
+ waspSays(`Linking Railway project with name "${project.name}" to project directory.`);
46
+ return linkRailwayProjectToWaspProjectDir(project, {
47
+ railwayExe,
48
+ waspProjectDir,
49
+ });
50
+ case ProjectStatus.MISSING_PROJECT:
51
+ throw new Error(`No Railway project found. Run ${getFullCommandName(railwaySetupCommand)} first or provide an existing project ID with "--existing-project-id" option.`);
52
+ default:
53
+ status;
54
+ throw new Error(`Unhandled status: ${status}`);
55
+ }
56
+ }
57
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,17 @@
1
+ import { waspSays } from "../../../../common/terminal.js";
2
+ import { getServerBuildArtefactsDir } from "../../../../common/waspProject.js";
3
+ import { deployServiceWithStreamingLogs, ServiceDeploymentStatus, } from "./common.js";
4
+ export async function deployServer({ cmdOptions: options, serverServiceName, }) {
5
+ waspSays("Deploying your server now...");
6
+ const serverBuildArtefactsDir = getServerBuildArtefactsDir(options.waspProjectDir);
7
+ const deploymentStatus = await deployServiceWithStreamingLogs({
8
+ name: serverServiceName,
9
+ dirToDeploy: serverBuildArtefactsDir,
10
+ }, options);
11
+ const messages = {
12
+ [ServiceDeploymentStatus.SUCCESS]: "Server has been deployed!",
13
+ [ServiceDeploymentStatus.FAILED_TO_STREAM_LOGS]: "Server deployment started, but failed to stream build logs. Please check the Railway dashboard for build logs.",
14
+ };
15
+ waspSays(messages[deploymentStatus]);
16
+ }
17
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=LaunchCmdOptions.js.map
@@ -0,0 +1,9 @@
1
+ import { waspSays } from "../../../../common/terminal.js";
2
+ import { deploy } from "../deploy/index.js";
3
+ import { setup } from "../setup/setup.js";
4
+ export async function launch(projectName, options) {
5
+ waspSays("Launching your Wasp app to Railway!");
6
+ await setup(projectName, options);
7
+ await deploy(projectName, options);
8
+ }
9
+ //# sourceMappingURL=launch.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=SetupCmdOptions.js.map
@@ -0,0 +1,146 @@
1
+ import { $ } from "zx";
2
+ import { generateRandomHexString } from "../../../../common/random.js";
3
+ import { waspSays } from "../../../../common/terminal.js";
4
+ import { ensureWaspProjectIsBuilt } from "../../../../common/waspBuild.js";
5
+ import { getClientBuildDir, getServerBuildDir, } from "../../../../common/waspProject.js";
6
+ import { createCommandWithCwd } from "../../../../common/zx.js";
7
+ import { createDeploymentInstructions, } from "../../DeploymentInstructions.js";
8
+ import { clientAppPort, serverAppPort } from "../../ports.js";
9
+ import { initRailwayProject, linkRailwayProjectToWaspProjectDir, } from "../../railwayProject/cli.js";
10
+ import { getRailwayProjectStatus, ProjectStatus, } from "../../railwayProject/index.js";
11
+ import { generateServiceUrl } from "../../railwayService/url.js";
12
+ export async function setup(projectName, options) {
13
+ waspSays("Setting up your Wasp app with Railway!");
14
+ const deploymentInstructions = createDeploymentInstructions(projectName, options);
15
+ const project = await setupRailwayProjectForDirectory({
16
+ projectName,
17
+ existingProjectId: options.existingProjectId,
18
+ waspProjectDir: options.waspProjectDir,
19
+ railwayExe: options.railwayExe,
20
+ workspace: options.workspace,
21
+ });
22
+ await ensureWaspProjectIsBuilt(options);
23
+ if (project.doesServiceExist(deploymentInstructions.dbServiceName)) {
24
+ waspSays("Postgres service already exists. Skipping database setup.");
25
+ }
26
+ else {
27
+ await setupDb(deploymentInstructions);
28
+ }
29
+ if (project.doesServiceExist(deploymentInstructions.clientServiceName)) {
30
+ waspSays("Client service already exists. Skipping client setup.");
31
+ }
32
+ else {
33
+ await setupClient(deploymentInstructions);
34
+ }
35
+ if (project.doesServiceExist(deploymentInstructions.serverServiceName)) {
36
+ waspSays("Server service already exists. Skipping server setup.");
37
+ }
38
+ else {
39
+ await setupServer(deploymentInstructions);
40
+ }
41
+ }
42
+ async function setupRailwayProjectForDirectory({ railwayExe, projectName, waspProjectDir, existingProjectId, workspace, }) {
43
+ const { status, project } = await getRailwayProjectStatus({
44
+ projectName,
45
+ waspProjectDir,
46
+ railwayExe,
47
+ existingProjectId,
48
+ });
49
+ switch (status) {
50
+ case ProjectStatus.EXISTING_PROJECT_ALREADY_LINKED:
51
+ waspSays(`Project with name "${projectName}" already linked. Skipping project creation.`);
52
+ return project;
53
+ case ProjectStatus.EXISTING_PROJECT_SHOULD_BE_LINKED:
54
+ waspSays(`Linking project with name "${project.name}" to this directory`);
55
+ return linkRailwayProjectToWaspProjectDir(project, {
56
+ railwayExe,
57
+ waspProjectDir,
58
+ });
59
+ case ProjectStatus.MISSING_PROJECT:
60
+ waspSays(`Setting up Railway project with name "${projectName}"`);
61
+ return initRailwayProject({
62
+ projectName,
63
+ railwayExe,
64
+ waspProjectDir,
65
+ workspace,
66
+ });
67
+ default:
68
+ status;
69
+ throw new Error(`Unhandled status: ${status}`);
70
+ }
71
+ }
72
+ async function setupDb({ cmdOptions: options, dbServiceName, }) {
73
+ waspSays("Setting up database");
74
+ const railwayCli = createCommandWithCwd(options.railwayExe, options.waspProjectDir);
75
+ if (options.dbImage) {
76
+ waspSays(`Using custom database image: ${options.dbImage}`);
77
+ // When using a custom database image, Railway doesn't automatically set the default
78
+ // Postgres-related environment variables, so we need to set them ourselves.
79
+ await railwayCli([
80
+ "add",
81
+ ...["--service", dbServiceName],
82
+ ...["--image", options.dbImage],
83
+ ...["--variables", "POSTGRES_DB=railway"],
84
+ ...["--variables", "POSTGRES_USER=postgres"],
85
+ ...[
86
+ "--variables",
87
+ `POSTGRES_PASSWORD=${getRailwayEnvVarValueReference("secret()")}`,
88
+ ],
89
+ ...["--variables", "PORT=5432"],
90
+ ...["--variables", "PGDATA=/var/lib/postgresql/data/pgdata"],
91
+ ...[
92
+ "--variables",
93
+ `DATABASE_URL=postgresql://${getRailwayEnvVarValueReference("POSTGRES_USER")}:${getRailwayEnvVarValueReference("POSTGRES_PASSWORD")}@${getRailwayEnvVarValueReference("RAILWAY_PRIVATE_DOMAIN")}:${getRailwayEnvVarValueReference("PORT")}/${getRailwayEnvVarValueReference("POSTGRES_DB")}`,
94
+ ],
95
+ ]);
96
+ }
97
+ else {
98
+ // Use the default Railway Postgres template.
99
+ await railwayCli(["add", "-d", "postgres"]);
100
+ }
101
+ }
102
+ async function setupServer({ cmdOptions: options, serverServiceName, clientServiceName, dbServiceName, }) {
103
+ waspSays(`Setting up server app with name ${serverServiceName}`);
104
+ // The client service needs a URL so it can be referenced in the
105
+ // server service env variables.
106
+ await generateServiceUrl(clientServiceName, clientAppPort, options);
107
+ const serverBuildDir = getServerBuildDir(options.waspProjectDir);
108
+ const railwayCli = createCommandWithCwd(options.railwayExe, serverBuildDir);
109
+ const clientUrl = `https://${getRailwayEnvVarValueReference(`${clientServiceName}.RAILWAY_PUBLIC_DOMAIN`)}`;
110
+ // If we reference the service URL in its OWN env variables, we don't prefix it with the service name.
111
+ const serverUrl = `https://${getRailwayEnvVarValueReference("RAILWAY_PUBLIC_DOMAIN")}`;
112
+ const databaseUrl = getRailwayEnvVarValueReference(`${dbServiceName}.DATABASE_URL`);
113
+ const jwtSecret = generateRandomHexString();
114
+ await railwayCli([
115
+ "add",
116
+ ["--service", serverServiceName],
117
+ ["--variables", `PORT=${serverAppPort}`],
118
+ ["--variables", `JWT_SECRET=${jwtSecret}`],
119
+ ["--variables", `WASP_SERVER_URL=${serverUrl}`],
120
+ ["--variables", `WASP_WEB_CLIENT_URL=${clientUrl}`],
121
+ ["--variables", `DATABASE_URL=${databaseUrl}`],
122
+ ...options.serverSecret.map((secret) => ["--variables", secret]),
123
+ ].flat());
124
+ // The server service needs a URL so it can be referenced in the
125
+ // env variables, we can only generate it after the service is created.
126
+ await generateServiceUrl(serverServiceName, serverAppPort, options);
127
+ waspSays("Server setup complete!");
128
+ }
129
+ async function setupClient({ cmdOptions: options, clientServiceName, }) {
130
+ waspSays(`Setting up client app with name ${clientServiceName}`);
131
+ const clientBuildDir = getClientBuildDir(options.waspProjectDir);
132
+ const railwayCli = createCommandWithCwd(options.railwayExe, clientBuildDir);
133
+ // Having a Staticfile tells Railway to use a static file server.
134
+ await $({ cwd: clientBuildDir }) `touch Staticfile`;
135
+ await railwayCli([
136
+ "add",
137
+ ["--service", clientServiceName],
138
+ ["--variables", `PORT=${clientAppPort}`],
139
+ ...options.clientSecret.map((secret) => ["--variables", secret]),
140
+ ].flat());
141
+ waspSays("Client setup complete!");
142
+ }
143
+ function getRailwayEnvVarValueReference(name) {
144
+ return "${{" + name + "}}";
145
+ }
146
+ //# sourceMappingURL=setup.js.map
@@ -0,0 +1,83 @@
1
+ import { Command, Option } from "commander";
2
+ import { assertValidWaspProject, assertWaspProjectDirIsAbsoluteAndPresent, } from "../../common/waspProject.js";
3
+ import { deploy as deployFn } from "./commands/deploy/index.js";
4
+ import { launch as launchFn } from "./commands/launch/launch.js";
5
+ import { setup as setupFn } from "./commands/setup/setup.js";
6
+ import { assertRailwayProjectNameIsValid, ensureRailwayCliReady, } from "./railwayCli.js";
7
+ class RailwayCommand extends Command {
8
+ addProjectNameArgument() {
9
+ return this.argument("<project-name>", "project name to use on Railway");
10
+ }
11
+ addSecretsOptions() {
12
+ function collect(value, previous) {
13
+ return previous.concat([value]);
14
+ }
15
+ return this.option("--server-secret <serverSecret>", "secret to set on the server app (of form FOO=BAR)", collect, []).option("--client-secret <clientSecret>", "secret to set on the client app (of form FOO=BAR)", collect, []);
16
+ }
17
+ }
18
+ export const railwaySetupCommand = makeRailwaySetupCommand();
19
+ export const railwayDeployCommand = makeRailwayDeployCommand();
20
+ const railwayLaunchCommand = makeRailwayLaunchCommand();
21
+ export function createRailwayCommand() {
22
+ const railway = new Command("railway")
23
+ .description("Create and deploy Wasp apps on Railway")
24
+ .addCommand(railwaySetupCommand)
25
+ .addCommand(railwayDeployCommand)
26
+ .addCommand(railwayLaunchCommand)
27
+ .allowUnknownOption();
28
+ // Add global options and hooks to all commands.
29
+ // Add these hooks before any command-specific ones so they run first.
30
+ // NOTE: When we add another provider, consider pulling `--wasp-exe` and `--wasp-project-dir`
31
+ // up as a global option that every provider can use (if possible).
32
+ railway.commands.forEach((cmd) => {
33
+ cmd
34
+ .addOption(new Option("--wasp-exe <path>", "Wasp executable (either on PATH or absolute path)")
35
+ .hideHelp()
36
+ .makeOptionMandatory())
37
+ .addOption(new Option("--wasp-project-dir <dir>", "absolute path to Wasp project dir")
38
+ .hideHelp()
39
+ .makeOptionMandatory())
40
+ .addOption(new Option("--railway-exe <path>", "Railway command to run (either on PATH or absolute path)")
41
+ .hideHelp()
42
+ .default("railway"))
43
+ .hook("preAction", async (cmd) => {
44
+ const { waspProjectDir, waspExe, railwayExe } = cmd.opts();
45
+ const railwayProjectName = cmd.args[0];
46
+ await ensureRailwayCliReady(railwayExe);
47
+ assertRailwayProjectNameIsValid(railwayProjectName);
48
+ assertWaspProjectDirIsAbsoluteAndPresent(waspProjectDir);
49
+ await assertValidWaspProject(waspProjectDir, waspExe);
50
+ });
51
+ });
52
+ return railway;
53
+ }
54
+ function makeRailwaySetupCommand() {
55
+ return new RailwayCommand("setup")
56
+ .description("Configure a new app on Railway")
57
+ .addProjectNameArgument()
58
+ .addSecretsOptions()
59
+ .option("--existing-project-id [projectId]", "use existing project instead of creating a new one")
60
+ .option("--workspace [workspace]", "the Railway workspace to use if a new project needs to be created (if not provided, will ask interactively)")
61
+ .option("--db-image <dbImage>", "custom Docker image for the PostgreSQL database")
62
+ .action(setupFn);
63
+ }
64
+ function makeRailwayDeployCommand() {
65
+ return new RailwayCommand("deploy")
66
+ .description("Deploys the app to Railway")
67
+ .addProjectNameArgument()
68
+ .option("--skip-client", "do not deploy the web client")
69
+ .option("--skip-server", "do not deploy the server")
70
+ .option("--existing-project-id [projectId]", "use existing project for deployment")
71
+ .action(deployFn);
72
+ }
73
+ function makeRailwayLaunchCommand() {
74
+ return new RailwayCommand("launch")
75
+ .description("Launch a new app on Railway (calls setup and deploy)")
76
+ .addProjectNameArgument()
77
+ .addSecretsOptions()
78
+ .option("--existing-project-id [projectId]", "use existing project instead of creating a new one")
79
+ .option("--workspace [workspace]", "the Railway workspace to use if a new project needs to be created (if not provided, will ask interactively)")
80
+ .option("--db-image <dbImage>", "custom Docker image for the PostgreSQL database")
81
+ .action(launchFn);
82
+ }
83
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,19 @@
1
+ import * as z from "zod";
2
+ export const RailwayCliServiceSchema = z.object({
3
+ id: z.string(),
4
+ name: z.string(),
5
+ });
6
+ export const RailwayCliProjectSchema = z.object({
7
+ id: z.string(),
8
+ name: z.string(),
9
+ services: z.object({
10
+ edges: z.array(z.object({
11
+ node: RailwayCliServiceSchema,
12
+ })),
13
+ }),
14
+ });
15
+ export const RailwayProjectListSchema = z.array(RailwayCliProjectSchema);
16
+ export const RailwayCliDomainSchema = z.object({
17
+ domain: z.string(),
18
+ });
19
+ //# sourceMappingURL=jsonOutputSchemas.js.map
@@ -0,0 +1,6 @@
1
+ // Ports we decided to use for the server and client apps.
2
+ // These are arbitrary values that are used internally by
3
+ // Railway containers to run the apps.
4
+ export const serverAppPort = 8080;
5
+ export const clientAppPort = 8080;
6
+ //# sourceMappingURL=ports.js.map
@@ -0,0 +1,85 @@
1
+ import semver, { SemVer } from "semver";
2
+ import { $ } from "zx";
3
+ import { confirm } from "@inquirer/prompts";
4
+ import { serviceNameSuffixes } from "./railwayService/nameGenerator.js";
5
+ // Railway CLI version 4.0.1 includes a change that is needed for
6
+ // Wasp deploy command to work with Railway properly:
7
+ // https://github.com/railwayapp/cli/pull/596
8
+ const minSupportedRailwayCliVersion = new SemVer("4.6.3");
9
+ export async function ensureRailwayCliReady(railwayExe) {
10
+ const railwayCliVersion = await getRailwayCliVersion(railwayExe);
11
+ assertUsingMinimumSupportedRailwayCliVersion(railwayCliVersion);
12
+ await ensureUserLoggedIn(railwayExe);
13
+ }
14
+ async function ensureUserLoggedIn(railwayExe) {
15
+ const userLoggedIn = await isUserLoggedIn(railwayExe);
16
+ if (userLoggedIn) {
17
+ return;
18
+ }
19
+ await confirmUserWantsToLogin();
20
+ await loginToRailway(railwayExe);
21
+ }
22
+ async function isUserLoggedIn(railwayExe) {
23
+ const result = await $({ nothrow: true }) `${railwayExe} whoami`;
24
+ return result.exitCode === 0;
25
+ }
26
+ async function confirmUserWantsToLogin() {
27
+ const wantsToLogin = await confirm({
28
+ message: "You are not logged into Railway. Would you like to log in now?",
29
+ });
30
+ if (!wantsToLogin) {
31
+ throw new Error("Unable to continue without logging in to Railway.");
32
+ }
33
+ }
34
+ async function loginToRailway(railwayExe) {
35
+ // Login comand requires **interactive** terminal.
36
+ const loginCmdOptions = {
37
+ stdio: "inherit",
38
+ };
39
+ await $(loginCmdOptions) `${railwayExe} login`;
40
+ }
41
+ async function getRailwayCliVersion(railwayExe) {
42
+ const result = await $({ nothrow: true }) `${railwayExe} -V`;
43
+ if (result.exitCode !== 0) {
44
+ throw new Error([
45
+ "Failed to get Railway CLI version. Most likely the Railway CLI is not installed.",
46
+ "Read how to install the Railway CLI here: https://docs.railway.com/guides/cli",
47
+ ].join("\n"));
48
+ }
49
+ const match = result.stdout.match(/railway(?:app)? (.*)/);
50
+ if (match === null) {
51
+ throw new Error(`Failed to get Railway CLI version from output "${result.stdout.trim()}".`);
52
+ }
53
+ const version = semver.parse(match[1]);
54
+ if (version === null) {
55
+ throw new Error(`Unable to parse Railway CLI version "${match[1]}".`);
56
+ }
57
+ return version;
58
+ }
59
+ function assertUsingMinimumSupportedRailwayCliVersion(railwayCliVersion) {
60
+ if (!semver.gte(railwayCliVersion, minSupportedRailwayCliVersion)) {
61
+ const message = [
62
+ `Wasp expects at least Railway CLI version ${minSupportedRailwayCliVersion}.`,
63
+ "Read how to update the Railway CLI here: https://docs.railway.com/guides/cli",
64
+ ].join("\n");
65
+ throw new Error(message);
66
+ }
67
+ }
68
+ export function assertRailwayProjectNameIsValid(projectName) {
69
+ const maximumProjectNameLength = getMaximumProjectNameLength();
70
+ if (projectName.length > maximumProjectNameLength) {
71
+ throw new Error(`The project name "${projectName}" is too long (${projectName.length} characters). It must be at most ${maximumProjectNameLength} characters long.`);
72
+ }
73
+ }
74
+ function getMaximumProjectNameLength() {
75
+ // Railway has a limit of 32 characters for the service name.
76
+ // https://docs.railway.com/reference/services#constraints
77
+ const maximumServiceNameLength = 32;
78
+ // We construct service names by appending suffixes to the project name:
79
+ // ServiceNameLength = ProjectNameLength + SuffixLength.
80
+ return maximumServiceNameLength - getMaximumServiceSuffixLength();
81
+ }
82
+ function getMaximumServiceSuffixLength() {
83
+ return Math.max(...Object.values(serviceNameSuffixes).map((s) => s.length));
84
+ }
85
+ //# sourceMappingURL=railwayCli.js.map
@@ -0,0 +1,14 @@
1
+ export function createRailwayProject(cliProject) {
2
+ return {
3
+ id: cliProject.id,
4
+ name: cliProject.name,
5
+ services: cliProject.services.edges.map((edge) => ({
6
+ id: edge.node.id,
7
+ name: edge.node.name,
8
+ })),
9
+ doesServiceExist(serviceName) {
10
+ return this.services.some((s) => s.name === serviceName);
11
+ },
12
+ };
13
+ }
14
+ //# sourceMappingURL=RailwayProject.js.map
@@ -0,0 +1,80 @@
1
+ import { $ } from "zx";
2
+ import { waspSays } from "../../../common/terminal.js";
3
+ import { createCommandWithCwd } from "../../../common/zx.js";
4
+ import { RailwayCliProjectSchema, RailwayProjectListSchema, } from "../jsonOutputSchemas.js";
5
+ import { createRailwayProject } from "./RailwayProject.js";
6
+ /**
7
+ * Initializing a Railway project means creating a new project
8
+ * in Railway platform and linking it to the current
9
+ * Wasp project directory.
10
+ */
11
+ export async function initRailwayProject({ projectName, railwayExe, waspProjectDir, workspace, }) {
12
+ const railwayCli = createCommandWithCwd(railwayExe, waspProjectDir);
13
+ const workspaceArgs = workspace ? ["--workspace", workspace] : [];
14
+ await railwayCli(["init", "--name", projectName, ...workspaceArgs], {
15
+ // If there are multiple workspaces and the user has not specified which one
16
+ // they want, the CLI will ask for it **interactively**, so we need users to
17
+ // be able to interact with the command.
18
+ stdio: "inherit",
19
+ });
20
+ // Check if the project was created successfully...
21
+ const newRailwayProject = await getRailwayProjectForDirectory(railwayExe, waspProjectDir);
22
+ if (newRailwayProject === null) {
23
+ throw new Error("Railway project creation failed.");
24
+ }
25
+ waspSays("Railway project created successfully!");
26
+ return newRailwayProject;
27
+ }
28
+ /**
29
+ * Linking a Railway project means associating an existing
30
+ * Railway project with the current Wasp project directory.
31
+ */
32
+ export async function linkRailwayProjectToWaspProjectDir(project, { railwayExe, waspProjectDir, }) {
33
+ const railwayCli = createCommandWithCwd(railwayExe, waspProjectDir);
34
+ // Railway CLI quirk, if the project has services, we need to specify one of them,
35
+ // otherwise Railway will ask for it interactively. (Even though we are linking
36
+ // a project and not a service.)
37
+ const serviceArg = project.services.length > 0 ? ["-s", project.services[0].name] : [];
38
+ await railwayCli(["link", "-p", project.name, ...serviceArg]);
39
+ // Sometimes linking fails silently, so we need to check if the project
40
+ // was linked successfully.
41
+ const linkedRailwayProject = await getRailwayProjectForDirectory(railwayExe, waspProjectDir);
42
+ if (linkedRailwayProject === null || linkedRailwayProject.id !== project.id) {
43
+ throw new Error("Railway project linking failed.");
44
+ }
45
+ waspSays("Railway project linked successfully!");
46
+ return linkedRailwayProject;
47
+ }
48
+ export async function getRailwayProjectForDirectory(railwayExe, directoryPath) {
49
+ const railwayCli = createCommandWithCwd(railwayExe, directoryPath);
50
+ const result = await railwayCli(["status", "--json"], {
51
+ verbose: false,
52
+ nothrow: true,
53
+ });
54
+ if (result.exitCode === 0) {
55
+ return createRailwayProject(RailwayCliProjectSchema.parse(result.json()));
56
+ }
57
+ else {
58
+ return null;
59
+ }
60
+ }
61
+ export async function getRailwayProjectById(railwayExe, id) {
62
+ const projects = await getRailwayProjects(railwayExe);
63
+ return projects.find((project) => project.id === id) ?? null;
64
+ }
65
+ export async function getRailwayProjectByName(railwayExe, name) {
66
+ const projects = await getRailwayProjects(railwayExe);
67
+ return projects.find((project) => project.name === name) ?? null;
68
+ }
69
+ // TODO: Figure out how to specify the workspace when listing projects.
70
+ // This command lists all projects in all the workspaces the user has access to.
71
+ async function getRailwayProjects(railwayExe) {
72
+ const result = await $({
73
+ verbose: false,
74
+ }) `${railwayExe} list --json`;
75
+ const projects = RailwayProjectListSchema.parse(JSON.parse(result.stdout));
76
+ return projects.map((cliProject) => {
77
+ return createRailwayProject(cliProject);
78
+ });
79
+ }
80
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1,48 @@
1
+ import { getRailwayProjectById, getRailwayProjectByName, getRailwayProjectForDirectory, } from "./cli.js";
2
+ export var ProjectStatus;
3
+ (function (ProjectStatus) {
4
+ ProjectStatus["EXISTING_PROJECT_ALREADY_LINKED"] = "EXISTING_PROJECT_ALREADY_LINKED";
5
+ ProjectStatus["EXISTING_PROJECT_SHOULD_BE_LINKED"] = "EXISTING_PROJECT_SHOULD_BE_LINKED";
6
+ ProjectStatus["MISSING_PROJECT"] = "MISSING_PROJECT";
7
+ })(ProjectStatus || (ProjectStatus = {}));
8
+ export async function getRailwayProjectStatus({ projectName, waspProjectDir, railwayExe, existingProjectId, }) {
9
+ const projectLinkedToDir = await getRailwayProjectForDirectory(railwayExe, waspProjectDir);
10
+ if (projectLinkedToDir !== null) {
11
+ await assertProvidedProjectNameSameAsExistingProjectName(projectLinkedToDir, projectName);
12
+ return {
13
+ status: ProjectStatus.EXISTING_PROJECT_ALREADY_LINKED,
14
+ project: projectLinkedToDir,
15
+ };
16
+ }
17
+ if (existingProjectId) {
18
+ const existingProject = await getExistingProjectById(railwayExe, existingProjectId);
19
+ return {
20
+ status: ProjectStatus.EXISTING_PROJECT_SHOULD_BE_LINKED,
21
+ project: existingProject,
22
+ };
23
+ }
24
+ await assertUniqueProjectName(railwayExe, projectName);
25
+ return {
26
+ status: ProjectStatus.MISSING_PROJECT,
27
+ project: null,
28
+ };
29
+ }
30
+ async function getExistingProjectById(railwayExe, existingProjectId) {
31
+ const projectById = await getRailwayProjectById(railwayExe, existingProjectId);
32
+ if (projectById === null) {
33
+ throw new Error(`Project with ID "${existingProjectId}" does not exist.`);
34
+ }
35
+ return projectById;
36
+ }
37
+ async function assertProvidedProjectNameSameAsExistingProjectName(project, projectName) {
38
+ if (project.name !== projectName) {
39
+ throw new Error(`Project with a different name already linked to this directory: "${project.name}". Run "railway unlink" to unlink it.`);
40
+ }
41
+ }
42
+ async function assertUniqueProjectName(railwayExe, projectName) {
43
+ const project = await getRailwayProjectByName(railwayExe, projectName);
44
+ if (project !== null) {
45
+ throw new Error(`Project with name "${project.name}" already exists. Add "--existing-project-id ${project.id}" option to this command to link it or use a different name.`);
46
+ }
47
+ }
48
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,24 @@
1
+ export function createRailwayClientServiceName(projectName) {
2
+ return createRailwayServiceName(projectName, ServiceWithSuffixedName.Client);
3
+ }
4
+ export function createRailwayServerServiceName(projectName) {
5
+ return createRailwayServiceName(projectName, ServiceWithSuffixedName.Server);
6
+ }
7
+ function createRailwayServiceName(projectName, service) {
8
+ const serviceNameSuffix = serviceNameSuffixes[service];
9
+ return `${projectName}${serviceNameSuffix}`;
10
+ }
11
+ var ServiceWithSuffixedName;
12
+ (function (ServiceWithSuffixedName) {
13
+ ServiceWithSuffixedName["Client"] = "Client";
14
+ ServiceWithSuffixedName["Server"] = "Server";
15
+ })(ServiceWithSuffixedName || (ServiceWithSuffixedName = {}));
16
+ export const serviceNameSuffixes = {
17
+ [ServiceWithSuffixedName.Client]: "-client",
18
+ [ServiceWithSuffixedName.Server]: "-server",
19
+ };
20
+ export function createRailwayDbServiceName() {
21
+ // Railway doesn't allow us to choose the database service name.
22
+ return "Postgres";
23
+ }
24
+ //# sourceMappingURL=nameGenerator.js.map
@@ -0,0 +1,32 @@
1
+ import { createCommandWithCwd } from "../../../common/zx.js";
2
+ import { RailwayCliDomainSchema } from "../jsonOutputSchemas.js";
3
+ export var ServiceUrlStatus;
4
+ (function (ServiceUrlStatus) {
5
+ ServiceUrlStatus["URL_CREATED"] = "URL_CREATED";
6
+ ServiceUrlStatus["URL_ALREADY_EXISTS"] = "URL_ALREADY_EXISTS";
7
+ })(ServiceUrlStatus || (ServiceUrlStatus = {}));
8
+ export async function generateServiceUrl(serviceName, port, options) {
9
+ const railwayCli = createCommandWithCwd(options.railwayExe, options.waspProjectDir);
10
+ const result = await railwayCli(["domain", "--service", serviceName, "--port", port.toString(), "--json"], {
11
+ nothrow: true,
12
+ });
13
+ if (result.exitCode !== 0) {
14
+ throw new Error(`There was a problem getting a domain for ${serviceName}.`);
15
+ }
16
+ // NOTE: Railway CLI 4.11.2 fixed a typo and we want to stay backwards compatible
17
+ const domainAlreadyExistsPattern = /Domains already exists? on the service:/;
18
+ if (domainAlreadyExistsPattern.test(result.stdout)) {
19
+ return extractServiceUrlFromString(result.stdout);
20
+ }
21
+ else {
22
+ return RailwayCliDomainSchema.parse(result.json()).domain;
23
+ }
24
+ }
25
+ function extractServiceUrlFromString(text) {
26
+ const match = text.match(/https:\/\/[^\s]*/);
27
+ if (match === null) {
28
+ throw new Error("Failed to get service domain");
29
+ }
30
+ return match[0];
31
+ }
32
+ //# sourceMappingURL=url.js.map