@wasp.sh/wasp-cli-darwin-x64-unknown 0.25.0 → 0.26.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 (255) hide show
  1. package/data/Cli/starters/README.md +2 -0
  2. package/data/Cli/starters/basic/README.md +3 -3
  3. package/data/Cli/starters/basic/src/tags/components/CreateTagForm.tsx +2 -3
  4. package/data/Cli/starters/basic/vite.config.ts +0 -3
  5. package/data/Cli/starters/minimal/package.json +4 -1
  6. package/data/Cli/starters/minimal/vite.config.ts +0 -3
  7. package/data/Cli/starters/skeleton/AGENTS.md +6 -0
  8. package/data/Cli/starters/skeleton/CLAUDE.md +6 -0
  9. package/data/Cli/starters/skeleton/tsconfig.src.json +1 -11
  10. package/data/Generator/libs/auth/wasp.sh-lib-auth-0.26.0.tgz +0 -0
  11. package/data/Generator/libs/sdk-core/node_modules/@wasp.sh/lib-auth/wasp.sh-lib-auth-0.26.0.tgz +0 -0
  12. package/data/Generator/libs/sdk-core/wasp.sh-lib-sdk-core-0.26.0.tgz +0 -0
  13. package/data/Generator/libs/vite-ssr/{wasp.sh-lib-vite-ssr-0.25.0.tgz → wasp.sh-lib-vite-ssr-0.26.0.tgz} +0 -0
  14. package/data/Generator/templates/Dockerfile +1 -0
  15. package/data/Generator/templates/sdk/wasp/api/index.ts +5 -86
  16. package/data/Generator/templates/sdk/wasp/auth/email/actions/login.ts +2 -2
  17. package/data/Generator/templates/sdk/wasp/auth/email/actions/passwordReset.ts +1 -1
  18. package/data/Generator/templates/sdk/wasp/auth/email/actions/signup.ts +7 -6
  19. package/data/Generator/templates/sdk/wasp/auth/email/actions/verifyEmail.ts +1 -1
  20. package/data/Generator/templates/sdk/wasp/auth/forms/Auth.tsx +12 -6
  21. package/data/Generator/templates/sdk/wasp/auth/forms/ForgotPassword.tsx +2 -1
  22. package/data/Generator/templates/sdk/wasp/auth/forms/Login.tsx +2 -1
  23. package/data/Generator/templates/sdk/wasp/auth/forms/ResetPassword.tsx +2 -1
  24. package/data/Generator/templates/sdk/wasp/auth/forms/Signup.tsx +5 -5
  25. package/data/Generator/templates/sdk/wasp/auth/forms/VerifyEmail.tsx +2 -1
  26. package/data/Generator/templates/sdk/wasp/auth/forms/internal/common/LoginSignupForm.tsx +34 -33
  27. package/data/Generator/templates/sdk/wasp/auth/forms/internal/email/DummyEmailSenderNotice.module.css +11 -0
  28. package/data/Generator/templates/sdk/wasp/auth/forms/internal/email/DummyEmailSenderNotice.tsx +17 -0
  29. package/data/Generator/templates/sdk/wasp/auth/forms/internal/email/ForgotPasswordForm.tsx +9 -13
  30. package/data/Generator/templates/sdk/wasp/auth/forms/internal/email/ResetPasswordForm.tsx +8 -9
  31. package/data/Generator/templates/sdk/wasp/auth/forms/internal/email/VerifyEmailForm.tsx +4 -8
  32. package/data/Generator/templates/sdk/wasp/auth/forms/internal/email/useEmail.ts +5 -5
  33. package/data/Generator/templates/sdk/wasp/auth/forms/internal/usernameAndPassword/useUsernameAndPassword.ts +6 -5
  34. package/data/Generator/templates/sdk/wasp/auth/forms/types.ts +0 -59
  35. package/data/Generator/templates/sdk/wasp/auth/helpers/_Provider.tsx +2 -2
  36. package/data/Generator/templates/sdk/wasp/auth/index.ts +1 -1
  37. package/data/Generator/templates/sdk/wasp/auth/logout.ts +1 -1
  38. package/data/Generator/templates/sdk/wasp/auth/providers/index.ts +4 -4
  39. package/data/Generator/templates/sdk/wasp/auth/providers/types.ts +20 -24
  40. package/data/Generator/templates/sdk/wasp/auth/useAuth.ts +5 -5
  41. package/data/Generator/templates/sdk/wasp/auth/user.ts +147 -14
  42. package/data/Generator/templates/sdk/wasp/auth/username/actions/login.ts +2 -2
  43. package/data/Generator/templates/sdk/wasp/auth/username/actions/signup.ts +6 -5
  44. package/data/Generator/templates/sdk/wasp/auth/validation.ts +1 -83
  45. package/data/Generator/templates/sdk/wasp/client/app/pages/OAuthCallback.tsx +8 -5
  46. package/data/Generator/templates/sdk/wasp/client/app/pages/createAuthRequiredPage.jsx +6 -4
  47. package/data/Generator/templates/sdk/wasp/client/app/router.tsx +2 -2
  48. package/data/Generator/templates/sdk/wasp/client/auth/ui.ts +2 -2
  49. package/data/Generator/templates/sdk/wasp/client/auth/username.ts +2 -2
  50. package/data/Generator/templates/sdk/wasp/client/config.ts +1 -6
  51. package/data/Generator/templates/sdk/wasp/client/crud/_crud.ts +129 -75
  52. package/data/Generator/templates/sdk/wasp/client/env/schema.ts +14 -7
  53. package/data/Generator/templates/sdk/wasp/client/env.ts +4 -3
  54. package/data/Generator/templates/sdk/wasp/client/index.ts +3 -12
  55. package/data/Generator/templates/sdk/wasp/client/operations/actions/core.ts +14 -10
  56. package/data/Generator/templates/sdk/wasp/client/operations/actions/index.ts +7 -4
  57. package/data/Generator/templates/sdk/wasp/client/operations/index.ts +5 -5
  58. package/data/Generator/templates/sdk/wasp/client/operations/internal/index.ts +1 -8
  59. package/data/Generator/templates/sdk/wasp/client/operations/queries/core.ts +13 -55
  60. package/data/Generator/templates/sdk/wasp/client/operations/queries/index.ts +7 -7
  61. package/data/Generator/templates/sdk/wasp/client/router/Link.tsx +8 -8
  62. package/data/Generator/templates/sdk/wasp/client/router/NavLink.tsx +8 -8
  63. package/data/Generator/templates/sdk/wasp/client/router/index.ts +15 -15
  64. package/data/Generator/templates/sdk/wasp/client/test/index.ts +2 -1
  65. package/data/Generator/templates/sdk/wasp/client/test/vitest/helpers.tsx +5 -36
  66. package/data/Generator/templates/sdk/wasp/client/vite/index.ts +2 -1
  67. package/data/Generator/templates/sdk/wasp/client/vite/plugins/virtualUserModules.ts +43 -0
  68. package/data/Generator/templates/sdk/wasp/client/vite/plugins/{virtualModules.ts → virtualWaspModules.ts} +4 -4
  69. package/data/Generator/templates/sdk/wasp/client/vite/plugins/wasp.ts +17 -14
  70. package/data/Generator/templates/sdk/wasp/client/vite/plugins/waspConfig.ts +60 -18
  71. package/data/Generator/templates/sdk/wasp/client/vite/virtual-files/files/client-entry.tsx +1 -1
  72. package/data/Generator/templates/sdk/wasp/client/vite/virtual-files/files/routes.tsx +1 -1
  73. package/data/Generator/templates/sdk/wasp/client/vite/virtual-files/files/ssr-entry.tsx +1 -1
  74. package/data/Generator/templates/sdk/wasp/client/webSocket/WebSocketProvider.tsx +3 -3
  75. package/data/Generator/templates/sdk/wasp/client/webSocket/index.ts +1 -1
  76. package/data/Generator/templates/sdk/wasp/core/serialization/index.ts +2 -47
  77. package/data/Generator/templates/sdk/wasp/core/serialization/prisma.ts +0 -1
  78. package/data/Generator/templates/sdk/wasp/entities/index.ts +6 -6
  79. package/data/Generator/templates/sdk/wasp/env/index.ts +1 -9
  80. package/data/Generator/templates/sdk/wasp/package.json +150 -104
  81. package/data/Generator/templates/sdk/wasp/server/_types/index.ts +8 -10
  82. package/data/Generator/templates/sdk/wasp/server/_types/taggedEntities.ts +4 -4
  83. package/data/Generator/templates/sdk/wasp/server/api/index.ts +5 -5
  84. package/data/Generator/templates/sdk/wasp/server/auth/email/index.ts +2 -12
  85. package/data/Generator/templates/sdk/wasp/server/auth/email/utils.ts +8 -30
  86. package/data/Generator/templates/sdk/wasp/server/auth/hooks.ts +5 -2
  87. package/data/Generator/templates/sdk/wasp/server/auth/index.ts +3 -3
  88. package/data/Generator/templates/sdk/wasp/{auth → server/auth}/jwt.ts +1 -1
  89. package/data/Generator/templates/sdk/wasp/{auth → server/auth}/lucia.ts +4 -4
  90. package/data/Generator/templates/sdk/wasp/server/auth/oauth/oneTimeCode.ts +1 -1
  91. package/data/Generator/templates/sdk/wasp/server/auth/oauth/providers/discord.ts +1 -1
  92. package/data/Generator/templates/sdk/wasp/server/auth/oauth/providers/github.ts +1 -1
  93. package/data/Generator/templates/sdk/wasp/server/auth/oauth/providers/google.ts +1 -1
  94. package/data/Generator/templates/sdk/wasp/server/auth/oauth/providers/keycloak.ts +1 -1
  95. package/data/Generator/templates/sdk/wasp/server/auth/oauth/providers/microsoft.ts +1 -1
  96. package/data/Generator/templates/sdk/wasp/server/auth/oauth/providers/slack.ts +1 -1
  97. package/data/Generator/templates/sdk/wasp/{auth → server/auth}/session.ts +17 -6
  98. package/data/Generator/templates/sdk/wasp/{auth → server/auth}/utils.ts +40 -183
  99. package/data/Generator/templates/sdk/wasp/server/config.ts +1 -1
  100. package/data/Generator/templates/sdk/wasp/{core → server/core}/auth.ts +3 -3
  101. package/data/Generator/templates/sdk/wasp/server/crud/_operationTypes.ts +16 -63
  102. package/data/Generator/templates/sdk/wasp/server/dbClient.ts +15 -17
  103. package/data/Generator/templates/sdk/wasp/server/email/core/helpers.ts +3 -20
  104. package/data/Generator/templates/sdk/wasp/server/email/core/providers/dummy.ts +2 -2
  105. package/data/Generator/templates/sdk/wasp/server/email/core/providers/resend.ts +2 -1
  106. package/data/Generator/templates/sdk/wasp/server/email/core/providers/smtp.ts +2 -1
  107. package/data/Generator/templates/sdk/wasp/server/email/core/types.ts +2 -45
  108. package/data/Generator/templates/sdk/wasp/server/email/index.ts +1 -1
  109. package/data/Generator/templates/sdk/wasp/server/env.ts +20 -11
  110. package/data/Generator/templates/sdk/wasp/server/index.ts +3 -3
  111. package/data/Generator/templates/sdk/wasp/server/jobs/_job.ts +1 -1
  112. package/data/Generator/templates/sdk/wasp/server/jobs/core/pgBoss/index.ts +1 -1
  113. package/data/Generator/templates/sdk/wasp/server/jobs/core/pgBoss/pgBossJob.ts +4 -4
  114. package/data/Generator/templates/sdk/wasp/server/jobs/core/pgBoss/types.ts +1 -1
  115. package/data/Generator/templates/sdk/wasp/server/middleware/index.ts +1 -1
  116. package/data/Generator/templates/sdk/wasp/server/operations/actions/index.ts +14 -8
  117. package/data/Generator/templates/sdk/wasp/server/operations/actions/types.ts +5 -5
  118. package/data/Generator/templates/sdk/wasp/server/operations/queries/index.ts +14 -8
  119. package/data/Generator/templates/sdk/wasp/server/operations/queries/types.ts +5 -5
  120. package/data/Generator/templates/sdk/wasp/server/operations/wrappers.ts +40 -14
  121. package/data/Generator/templates/sdk/wasp/server/types/index.ts +1 -11
  122. package/data/Generator/templates/sdk/wasp/server/utils.ts +5 -20
  123. package/data/Generator/templates/sdk/wasp/server/webSocket/index.ts +7 -7
  124. package/data/Generator/templates/sdk/wasp/tsconfig.json +20 -46
  125. package/data/Generator/templates/sdk/wasp/types/index.ts +8 -0
  126. package/data/Generator/templates/sdk/wasp/types/register.ts +21 -0
  127. package/data/Generator/templates/sdk/wasp/vite-env.d.ts +0 -9
  128. package/data/Generator/templates/sdk/wasp/wasp-ssr.d.ts +8 -0
  129. package/data/Generator/templates/sdk/wasp/wasp-user-virtual-modules.d.ts +20 -0
  130. package/data/Generator/templates/server/package.json +2 -1
  131. package/data/Generator/templates/server/rollup.config.js +2 -43
  132. package/data/Generator/templates/server/rollup.dbSeed.config.js +3 -0
  133. package/data/Generator/templates/server/src/app.js +2 -2
  134. package/data/Generator/templates/server/src/auth/providers/config/email.ts +5 -5
  135. package/data/Generator/templates/server/src/auth/providers/email/login.ts +4 -4
  136. package/data/Generator/templates/server/src/auth/providers/email/requestPasswordReset.ts +4 -4
  137. package/data/Generator/templates/server/src/auth/providers/email/resetPassword.ts +13 -5
  138. package/data/Generator/templates/server/src/auth/providers/email/signup.ts +29 -18
  139. package/data/Generator/templates/server/src/auth/providers/email/verifyEmail.ts +7 -2
  140. package/data/Generator/templates/server/src/auth/providers/oauth/cookies.ts +5 -1
  141. package/data/Generator/templates/server/src/auth/providers/oauth/handler.ts +1 -1
  142. package/data/Generator/templates/server/src/auth/providers/oauth/oneTimeCode.ts +2 -2
  143. package/data/Generator/templates/server/src/auth/providers/oauth/state.ts +55 -13
  144. package/data/Generator/templates/server/src/auth/providers/oauth/user.ts +6 -3
  145. package/data/Generator/templates/server/src/auth/providers/username/login.ts +4 -4
  146. package/data/Generator/templates/server/src/auth/providers/username/signup.ts +12 -4
  147. package/data/Generator/templates/server/src/createRollupBundle.js +47 -0
  148. package/data/Generator/templates/server/src/crud/_operations.ts +16 -16
  149. package/data/Generator/templates/server/src/plugins/virtualUserModules.js +40 -0
  150. package/data/Generator/templates/server/src/routes/apis/index.ts +3 -3
  151. package/data/Generator/templates/server/src/routes/auth/index.js +1 -1
  152. package/data/Generator/templates/server/src/routes/auth/logout.ts +2 -2
  153. package/data/Generator/templates/server/src/routes/crud/_crud.ts +1 -1
  154. package/data/Generator/templates/server/src/routes/index.js +18 -18
  155. package/data/Generator/templates/server/src/routes/operations/index.js +1 -1
  156. package/data/Generator/templates/server/src/webSocket/initialization.ts +1 -1
  157. package/data/Generator/templates/server/tsconfig.json +7 -13
  158. package/data/Generator/templates/types/app/sdk/register.ts +57 -0
  159. package/data/packages/deploy/dist/common/cliVersion.js +17 -0
  160. package/data/packages/deploy/dist/common/waspProject.js +1 -1
  161. package/data/packages/deploy/dist/common/zx.js +24 -6
  162. package/data/packages/deploy/dist/providers/fly/commands/createDb/createDb.js +13 -5
  163. package/data/packages/deploy/dist/providers/fly/flyCli.js +29 -17
  164. package/data/packages/deploy/dist/providers/fly/index.js +16 -8
  165. package/data/packages/deploy/dist/providers/railway/commands/setup/setup.js +19 -31
  166. package/data/packages/deploy/dist/providers/railway/index.js +11 -2
  167. package/data/packages/deploy/dist/providers/railway/jsonOutputSchemas.js +19 -34
  168. package/data/packages/deploy/dist/providers/railway/railwayCli.js +11 -20
  169. package/data/packages/deploy/dist/providers/railway/railwayEnvironment/cli.js +20 -0
  170. package/data/packages/deploy/dist/providers/railway/railwayProject/RailwayProject.js +4 -1
  171. package/data/packages/deploy/dist/providers/railway/railwayProject/cli.js +6 -14
  172. package/data/packages/deploy/dist/providers/railway/railwayService/database.js +88 -0
  173. package/data/packages/deploy/dist/providers/railway/railwayService/deployment.js +12 -25
  174. package/data/packages/deploy/dist/providers/railway/railwayService/nameGenerator.js +5 -4
  175. package/data/packages/deploy/dist/providers/railway/railwayService/serviceInstance.js +48 -0
  176. package/data/packages/deploy/dist/providers/railway/railwayService/url.js +9 -30
  177. package/data/packages/deploy/package-lock.json +2 -2
  178. package/data/packages/deploy/package.json +1 -1
  179. package/data/packages/prisma/package-lock.json +2 -2
  180. package/data/packages/prisma/package.json +1 -1
  181. package/data/packages/spec/dist/__tests__/spec/mapApp.unit.test.js +19 -15
  182. package/data/packages/spec/dist/__tests__/spec/tsAppSpec.test-d.js +6 -0
  183. package/data/packages/spec/dist/src/appSpec.d.ts +15 -2
  184. package/data/packages/spec/dist/src/appSpec.d.ts.map +1 -1
  185. package/data/packages/spec/dist/src/spec/mapper/app.d.ts +1 -0
  186. package/data/packages/spec/dist/src/spec/mapper/app.d.ts.map +1 -1
  187. package/data/packages/spec/dist/src/spec/mapper/app.js +8 -2
  188. package/data/packages/spec/dist/src/spec/mapper/context.js +4 -4
  189. package/data/packages/spec/dist/src/spec/mapper/specElements.js +9 -9
  190. package/data/packages/spec/dist/src/spec/publicApi/constructors.d.ts +11 -11
  191. package/data/packages/spec/dist/src/spec/publicApi/constructors.js +11 -11
  192. package/data/packages/spec/dist/src/spec/publicApi/register.d.ts +1 -1
  193. package/data/packages/spec/dist/src/spec/publicApi/waspSpec.d.ts +58 -38
  194. package/data/packages/spec/dist/src/spec/publicApi/waspSpec.d.ts.map +1 -1
  195. package/data/packages/spec/package-lock.json +2 -2
  196. package/data/packages/spec/package.json +1 -1
  197. package/data/packages/studio/package-lock.json +15 -23
  198. package/data/packages/studio/package.json +2 -2
  199. package/package.json +1 -1
  200. package/wasp-bin +0 -0
  201. package/data/Generator/libs/auth/wasp.sh-lib-auth-0.25.0.tgz +0 -0
  202. package/data/Generator/templates/sdk/wasp/api/events.ts +0 -11
  203. package/data/Generator/templates/sdk/wasp/auth/email/index.ts +0 -5
  204. package/data/Generator/templates/sdk/wasp/auth/forms/internal/Form.module.css +0 -99
  205. package/data/Generator/templates/sdk/wasp/auth/forms/internal/Form.tsx +0 -74
  206. package/data/Generator/templates/sdk/wasp/auth/forms/internal/Message.module.css +0 -22
  207. package/data/Generator/templates/sdk/wasp/auth/forms/internal/Message.tsx +0 -34
  208. package/data/Generator/templates/sdk/wasp/auth/forms/internal/auth-styles.css +0 -30
  209. package/data/Generator/templates/sdk/wasp/auth/forms/internal/social/SocialButton.module.css +0 -33
  210. package/data/Generator/templates/sdk/wasp/auth/forms/internal/social/SocialButton.tsx +0 -14
  211. package/data/Generator/templates/sdk/wasp/auth/forms/internal/social/SocialIcons.module.css +0 -4
  212. package/data/Generator/templates/sdk/wasp/auth/forms/internal/social/SocialIcons.tsx +0 -85
  213. package/data/Generator/templates/sdk/wasp/auth/forms/internal/util.ts +0 -16
  214. package/data/Generator/templates/sdk/wasp/auth/helpers/user.ts +0 -15
  215. package/data/Generator/templates/sdk/wasp/auth/responseSchemas.ts +0 -10
  216. package/data/Generator/templates/sdk/wasp/auth/types.ts +0 -2
  217. package/data/Generator/templates/sdk/wasp/auth/username/index.ts +0 -2
  218. package/data/Generator/templates/sdk/wasp/client/app/components/DefaultRootErrorBoundary.tsx +0 -16
  219. package/data/Generator/templates/sdk/wasp/client/app/components/FullPageWrapper.tsx +0 -21
  220. package/data/Generator/templates/sdk/wasp/client/app/components/Loader.module.css +0 -37
  221. package/data/Generator/templates/sdk/wasp/client/app/components/Loader.tsx +0 -12
  222. package/data/Generator/templates/sdk/wasp/client/app/components/Message.tsx +0 -86
  223. package/data/Generator/templates/sdk/wasp/client/crud/operationsHelpers.ts +0 -21
  224. package/data/Generator/templates/sdk/wasp/client/hooks.ts +0 -19
  225. package/data/Generator/templates/sdk/wasp/client/operations/hooks.ts +0 -347
  226. package/data/Generator/templates/sdk/wasp/client/operations/internal/resources.js +0 -85
  227. package/data/Generator/templates/sdk/wasp/client/operations/internal/updateHandlersMap.js +0 -37
  228. package/data/Generator/templates/sdk/wasp/client/operations/queryClient.ts +0 -34
  229. package/data/Generator/templates/sdk/wasp/client/operations/rpc.ts +0 -96
  230. package/data/Generator/templates/sdk/wasp/client/router/linkHelpers.ts +0 -48
  231. package/data/Generator/templates/sdk/wasp/client/router/types.ts +0 -98
  232. package/data/Generator/templates/sdk/wasp/client/vite/plugins/detectServerImports.ts +0 -50
  233. package/data/Generator/templates/sdk/wasp/client/vite/plugins/envFile.ts +0 -112
  234. package/data/Generator/templates/sdk/wasp/client/vite/plugins/typescriptCheck.ts +0 -36
  235. package/data/Generator/templates/sdk/wasp/client/vite/plugins/validateEnv.ts +0 -88
  236. package/data/Generator/templates/sdk/wasp/client/vite/virtual-files/resolver.ts +0 -35
  237. package/data/Generator/templates/sdk/wasp/core/serialization/custom-register.ts +0 -21
  238. package/data/Generator/templates/sdk/wasp/core/storage.ts +0 -73
  239. package/data/Generator/templates/sdk/wasp/env/validation.ts +0 -44
  240. package/data/Generator/templates/sdk/wasp/server/HttpError.ts +0 -30
  241. package/data/Generator/templates/sdk/wasp/server/auth/oauth/provider.ts +0 -20
  242. package/data/Generator/templates/sdk/wasp/server/auth/user.ts +0 -154
  243. package/data/Generator/templates/sdk/wasp/server/auth/username.ts +0 -1
  244. package/data/Generator/templates/sdk/wasp/server/jobs/core/job.ts +0 -28
  245. package/data/Generator/templates/sdk/wasp/server/middleware/globalMiddleware.ts +0 -8
  246. package/data/Generator/templates/sdk/wasp/universal/ansiColors.ts +0 -58
  247. package/data/Generator/templates/sdk/wasp/universal/predicates.ts +0 -3
  248. package/data/Generator/templates/sdk/wasp/universal/types.ts +0 -74
  249. package/data/Generator/templates/sdk/wasp/universal/url.ts +0 -9
  250. package/data/Generator/templates/sdk/wasp/universal/validators.ts +0 -21
  251. package/data/packages/ts-inspect/dist/exports.js +0 -82
  252. package/data/packages/ts-inspect/dist/index.js +0 -28
  253. package/data/packages/ts-inspect/package-lock.json +0 -4724
  254. package/data/packages/ts-inspect/package.json +0 -31
  255. /package/data/Generator/templates/sdk/wasp/{auth → server/auth}/password.ts +0 -0
@@ -7,7 +7,7 @@ export { ForgotPasswordForm } from '../../auth/forms/ForgotPassword'
7
7
  export { VerifyEmailForm } from '../../auth/forms/VerifyEmail'
8
8
  export { ResetPasswordForm } from '../../auth/forms/ResetPassword'
9
9
  {=/ isEmailAuthEnabled =}
10
- export type { CustomizationOptions } from '../../auth/forms/types'
10
+ export type { CustomizationOptions } from '@wasp.sh/lib-sdk-core/browser'
11
11
  {=# isSlackAuthEnabled =}
12
12
  export { SignInButton as SlackSignInButton } from '../../auth/helpers/Slack'
13
13
  {=/ isSlackAuthEnabled =}
@@ -32,4 +32,4 @@ export {
32
32
  FormTextarea,
33
33
  FormItemGroup,
34
34
  FormLabel,
35
- } from '../../auth/forms/internal/Form'
35
+ } from '@wasp.sh/lib-sdk-core/browser'
@@ -1,2 +1,2 @@
1
- export { login, signup } from '../../auth/username'
2
-
1
+ export { login } from '../../auth/username/actions/login'
2
+ export { signup } from '../../auth/username/actions/signup'
@@ -1,14 +1,9 @@
1
1
  {{={= =}=}}
2
- import { stripTrailingSlash } from '../universal/url.js'
2
+ import { stripTrailingSlash, type ClientConfig } from '@wasp.sh/lib-sdk-core'
3
3
  import { env } from './env.js'
4
4
 
5
5
  const apiUrl = stripTrailingSlash(env["{= serverUrlEnvVarName =}"])
6
6
 
7
- // PUBLIC API
8
- export type ClientConfig = {
9
- apiUrl: string,
10
- }
11
-
12
7
  // PUBLIC API
13
8
  export const config: ClientConfig = {
14
9
  apiUrl,
@@ -1,89 +1,143 @@
1
1
  {{={= =}=}}
2
- import { createAction } from "../operations/actions/core.js";
3
- import { createQuery } from "../operations/queries/core.js";
4
- import { makeUseActionFor, makeUseQueryFor } from "./operationsHelpers.js";
2
+ import { createAction } from "../operations/actions/core";
3
+ import { createQuery } from "../operations/queries/core";
4
+ import { makeUseActionFor, makeUseQueryFor, type ActionFor, type QueryFor, type UseActionFor, type UseQueryFor } from "@wasp.sh/lib-sdk-core/browser";
5
5
  import type {
6
- {=# operations.Get =}
7
- GetQueryResolved,
8
- {=/ operations.Get =}
9
- {=# operations.GetAll =}
10
- GetAllQueryResolved,
11
- {=/ operations.GetAll =}
12
- {=# operations.Create =}
13
- CreateActionResolved,
14
- {=/ operations.Create =}
15
- {=# operations.Update =}
16
- UpdateActionResolved,
17
- {=/ operations.Update =}
18
- {=# operations.Delete =}
19
- DeleteActionResolved,
20
- {=/ operations.Delete =}
21
- } from '../../server/crud/{= name =}.js'
6
+ {=# operations.Get =}
7
+ RegisteredGetQuery,
8
+ {=/ operations.Get =}
9
+ {=# operations.GetAll =}
10
+ RegisteredGetAllQuery,
11
+ {=/ operations.GetAll =}
12
+ {=# operations.Create =}
13
+ RegisteredCreateAction,
14
+ {=/ operations.Create =}
15
+ {=# operations.Update =}
16
+ RegisteredUpdateAction,
17
+ {=/ operations.Update =}
18
+ {=# operations.Delete =}
19
+ RegisteredDeleteAction,
20
+ {=/ operations.Delete =}
21
+ } from "../../server/crud/{= name =}";
22
+
23
+ // PUBLIC API
24
+ export const {= name =}: {= entityUpper =}Crud = createCrud();
25
+
26
+ // PUBLIC API
27
+ export interface {= entityUpper =}Crud {
28
+ {=# operations.Get =}
29
+ get: {= entityUpper =}Get;
30
+ {=/ operations.Get =}
31
+ {=# operations.GetAll =}
32
+ getAll: {= entityUpper =}GetAll;
33
+ {=/ operations.GetAll =}
34
+ {=# operations.Create =}
35
+ create: {= entityUpper =}Create;
36
+ {=/ operations.Create =}
37
+ {=# operations.Update =}
38
+ update: {= entityUpper =}Update;
39
+ {=/ operations.Update =}
40
+ {=# operations.Delete =}
41
+ delete: {= entityUpper =}Delete;
42
+ {=/ operations.Delete =}
43
+ };
44
+ {=# operations.Get =}
45
+
46
+ export interface {= entityUpper =}Get {
47
+ query: QueryFor<RegisteredGetQuery>;
48
+ useQuery: UseQueryFor<RegisteredGetQuery>;
49
+ }
50
+ {=/ operations.Get =}
51
+ {=# operations.GetAll =}
52
+
53
+ export interface {= entityUpper =}GetAll {
54
+ query: QueryFor<RegisteredGetAllQuery>;
55
+ useQuery: UseQueryFor<RegisteredGetAllQuery>;
56
+ };
57
+ {=/ operations.GetAll =}
58
+ {=# operations.Create =}
22
59
 
23
- function createCrud() {
60
+ export interface {= entityUpper =}Create {
61
+ action: ActionFor<RegisteredCreateAction>;
62
+ useAction: UseActionFor<RegisteredCreateAction>;
63
+ };
64
+ {=/ operations.Create =}
65
+ {=# operations.Update =}
66
+
67
+ export interface {= entityUpper =}Update {
68
+ action: ActionFor<RegisteredUpdateAction>;
69
+ useAction: UseActionFor<RegisteredUpdateAction>;
70
+ };
71
+ {=/ operations.Update =}
72
+ {=# operations.Delete =}
73
+
74
+ export interface {= entityUpper =}Delete {
75
+ action: ActionFor<RegisteredDeleteAction>;
76
+ useAction: UseActionFor<RegisteredDeleteAction>;
77
+ };
78
+ {=/ operations.Delete =}
79
+
80
+ function createCrud(): {= entityUpper =}Crud {
81
+ {=# operations.Get =}
82
+ const crudGetQuery = createQuery<RegisteredGetQuery>(
83
+ '{= fullPath =}',
84
+ {=& entitiesArray =}
85
+ )
86
+ {=/ operations.Get =}
87
+ {=# operations.GetAll =}
88
+ const crudGetAllQuery = createQuery<RegisteredGetAllQuery>(
89
+ '{= fullPath =}',
90
+ {=& entitiesArray =}
91
+ )
92
+ {=/ operations.GetAll =}
93
+ {=# operations.Create =}
94
+ const crudCreateAction = createAction<RegisteredCreateAction>(
95
+ '{= fullPath =}',
96
+ {=& entitiesArray =}
97
+ )
98
+ {=/ operations.Create =}
99
+ {=# operations.Update =}
100
+ const crudUpdateAction = createAction<RegisteredUpdateAction>(
101
+ '{= fullPath =}',
102
+ {=& entitiesArray =}
103
+ )
104
+ {=/ operations.Update =}
105
+ {=# operations.Delete =}
106
+ const crudDeleteAction = createAction<RegisteredDeleteAction>(
107
+ '{= fullPath =}',
108
+ {=& entitiesArray =}
109
+ )
110
+ {=/ operations.Delete =}
111
+ return {
24
112
  {=# operations.Get =}
25
- const crudGetQuery = createQuery<GetQueryResolved>(
26
- '{= fullPath =}',
27
- {=& entitiesArray =}
28
- )
113
+ get: {
114
+ query: crudGetQuery,
115
+ useQuery: makeUseQueryFor(crudGetQuery)
116
+ },
29
117
  {=/ operations.Get =}
30
118
  {=# operations.GetAll =}
31
- const crudGetAllQuery = createQuery<GetAllQueryResolved>(
32
- '{= fullPath =}',
33
- {=& entitiesArray =}
34
- )
119
+ getAll: {
120
+ query: crudGetAllQuery,
121
+ useQuery: makeUseQueryFor(crudGetAllQuery)
122
+ },
35
123
  {=/ operations.GetAll =}
36
124
  {=# operations.Create =}
37
- const crudCreateAction = createAction<CreateActionResolved>(
38
- '{= fullPath =}',
39
- {=& entitiesArray =}
40
- )
125
+ create: {
126
+ action: crudCreateAction,
127
+ useAction: makeUseActionFor(crudCreateAction)
128
+ },
41
129
  {=/ operations.Create =}
42
130
  {=# operations.Update =}
43
- const crudUpdateAction = createAction<UpdateActionResolved>(
44
- '{= fullPath =}',
45
- {=& entitiesArray =}
46
- )
131
+ update: {
132
+ action: crudUpdateAction,
133
+ useAction: makeUseActionFor(crudUpdateAction)
134
+ },
47
135
  {=/ operations.Update =}
48
136
  {=# operations.Delete =}
49
- const crudDeleteAction = createAction<DeleteActionResolved>(
50
- '{= fullPath =}',
51
- {=& entitiesArray =}
52
- )
137
+ delete: {
138
+ action: crudDeleteAction,
139
+ useAction: makeUseActionFor(crudDeleteAction)
140
+ },
53
141
  {=/ operations.Delete =}
54
- return {
55
- {=# operations.Get =}
56
- get: {
57
- query: crudGetQuery,
58
- useQuery: makeUseQueryFor(crudGetQuery)
59
- },
60
- {=/ operations.Get =}
61
- {=# operations.GetAll =}
62
- getAll: {
63
- query: crudGetAllQuery,
64
- useQuery: makeUseQueryFor(crudGetAllQuery)
65
- },
66
- {=/ operations.GetAll =}
67
- {=# operations.Create =}
68
- create: {
69
- action: crudCreateAction,
70
- useAction: makeUseActionFor(crudCreateAction)
71
- },
72
- {=/ operations.Create =}
73
- {=# operations.Update =}
74
- update: {
75
- action: crudUpdateAction,
76
- useAction: makeUseActionFor(crudUpdateAction)
77
- },
78
- {=/ operations.Update =}
79
- {=# operations.Delete =}
80
- delete: {
81
- action: crudDeleteAction,
82
- useAction: makeUseActionFor(crudDeleteAction)
83
- },
84
- {=/ operations.Delete =}
85
- }
142
+ }
86
143
  }
87
-
88
- // PUBLIC API
89
- export const {= name =} = createCrud();
@@ -1,12 +1,18 @@
1
1
  {{={= =}=}}
2
2
  import * as z from "zod"
3
-
3
+ import type { FromRegister } from "../../types/register";
4
4
  {=# envValidationSchema.isDefined =}
5
5
  {=& envValidationSchema.importStatement =}
6
- const userClientEnvSchema = {= envValidationSchema.importIdentifier =};
6
+ {=/ envValidationSchema.isDefined =}
7
+
8
+ export type RegisteredClientEnvValidationSchema = FromRegister<"clientEnvValidationSchema", z.ZodObject<{}>>;
9
+ type UserClientEnvSchema = RegisteredClientEnvValidationSchema;
10
+
11
+ {=# envValidationSchema.isDefined =}
12
+ const userClientEnvSchema: UserClientEnvSchema = {= envValidationSchema.importIdentifier =};
7
13
  {=/ envValidationSchema.isDefined =}
8
14
  {=^ envValidationSchema.isDefined =}
9
- const userClientEnvSchema = z.object({});
15
+ const userClientEnvSchema: UserClientEnvSchema = z.object({});
10
16
  {=/ envValidationSchema.isDefined =}
11
17
 
12
18
  const serverUrlSchema =
@@ -20,8 +26,7 @@ const serverUrlSchema =
20
26
  )
21
27
 
22
28
  const waspDevClientEnvSchema = z.object({
23
- "{= serverUrlEnvVarName =}": serverUrlSchema
24
- .default("{= defaultServerUrl =}"),
29
+ "{= serverUrlEnvVarName =}": serverUrlSchema,
25
30
  });
26
31
 
27
32
  const waspProdClientEnvSchema = z.object({
@@ -32,8 +37,10 @@ const waspClientEnvSchema = import.meta.env.MODE === "production"
32
37
  ? waspProdClientEnvSchema
33
38
  : waspDevClientEnvSchema;
34
39
 
40
+ export type CompleteClientEnvSchema = z.ZodObject<typeof waspClientEnvSchema["shape"] & UserClientEnvSchema["shape"]>;
41
+
35
42
  // PRIVATE API (sdk, Vite config)
36
- export const clientEnvSchema = z.object({
43
+ export const clientEnvSchema: CompleteClientEnvSchema = z.object({
37
44
  ...userClientEnvSchema.shape,
38
- ...waspClientEnvSchema.shape,
45
+ ...waspClientEnvSchema.shape
39
46
  });
@@ -1,8 +1,9 @@
1
- import { ensureEnvSchema } from "../env/validation.js";
2
- import { clientEnvSchema } from "./env/schema.js";
1
+ import type * as z from "zod";
2
+ import { ensureEnvSchema } from "@wasp.sh/lib-sdk-core";
3
+ import { type CompleteClientEnvSchema, clientEnvSchema } from "./env/schema";
3
4
 
4
5
  // PUBLIC API
5
- export const env = ensureEnvSchema(
6
+ export const env: z.infer<CompleteClientEnvSchema> = ensureEnvSchema(
6
7
  import.meta.env,
7
8
  clientEnvSchema,
8
9
  );
@@ -1,17 +1,8 @@
1
1
  // PUBLIC API
2
- // NOTE: This is enough to cover Operations and our APIs (src/Wasp/AppSpec/Api.hs).
3
- export enum HttpMethod {
4
- Get = 'GET',
5
- Post = 'POST',
6
- Put = 'PUT',
7
- Delete = 'DELETE',
8
- }
2
+ export { HttpMethod, type ClientConfig, type Route } from '@wasp.sh/lib-sdk-core'
9
3
 
10
4
  // PUBLIC API
11
- export type Route = { method: HttpMethod; path: string }
5
+ export { config } from './config';
12
6
 
13
7
  // PUBLIC API
14
- export { config, ClientConfig } from './config.js'
15
-
16
- // PUBLIC API
17
- export { env } from './env.js'
8
+ export { env } from './env';
@@ -1,10 +1,15 @@
1
- import type { _Awaited, _ReturnType } from '../../../universal/types.js'
2
- import type { OperationRpcFor, GenericBackendOperation } from '../rpc.js'
3
- import { callOperation, makeOperationRoute } from '../internal/index.js'
4
1
  import {
2
+ type ActionFor,
3
+ type SpecificOptimisticUpdateDefinition,
5
4
  registerActionInProgress,
6
5
  registerActionDone,
7
- } from '../internal/resources.js'
6
+ } from '@wasp.sh/lib-sdk-core/browser'
7
+ import {
8
+ makeOperationRoute,
9
+ type OperationRpcFor,
10
+ type GenericBackendOperation,
11
+ } from '@wasp.sh/lib-sdk-core'
12
+ import { callOperation } from '../internal/index.js'
8
13
 
9
14
  // PRIVATE API
10
15
  export function createAction<BackendAction extends GenericBackendOperation>(
@@ -13,7 +18,10 @@ export function createAction<BackendAction extends GenericBackendOperation>(
13
18
  ): ActionFor<BackendAction> {
14
19
  const actionRoute = makeOperationRoute(relativeActionRoute)
15
20
 
16
- async function internalAction(args, specificOptimisticUpdateDefinitions) {
21
+ async function internalAction<CachedData>(
22
+ args: unknown,
23
+ specificOptimisticUpdateDefinitions: SpecificOptimisticUpdateDefinition<CachedData>[]
24
+ ): Promise<unknown> {
17
25
  registerActionInProgress(specificOptimisticUpdateDefinitions)
18
26
  try {
19
27
  // The `return await` is not redundant here. If we removed the await, the
@@ -34,7 +42,7 @@ export function createAction<BackendAction extends GenericBackendOperation>(
34
42
  // While it does technically allow our users to access the interal API, it
35
43
  // shouldn't be a problem in practice. Still, if it turns out to be a problem,
36
44
  // we can always hide it using a Symbol.
37
- const action = (args) => internalAction(args, [])
45
+ const action = (args: unknown) => internalAction(args, [])
38
46
  action.internal = internalAction
39
47
 
40
48
  // NOTE: I'm not sure why unknown is necessary here,
@@ -43,7 +51,3 @@ export function createAction<BackendAction extends GenericBackendOperation>(
43
51
  // https://www.typescriptlang.org/play/?#code/MYewdgzgLgBCBGArGBeGBvGBDAXDA5AGYgj4wC+AUAogHTyoHxYBO+llA9JzIQK5hgUAJbhsAG3EgA7hGxgYAUwBuIccuFgA5jCgBPAA6KY8PrBqKhMACYhFcsCCiVQkWPwVoAFAEpUAPgJiUkoPekZ8ZjYgA
44
52
  return action as unknown as ActionFor<BackendAction>
45
53
  }
46
-
47
- // PRIVATE API
48
- export type ActionFor<BackendAction extends GenericBackendOperation> =
49
- OperationRpcFor<BackendAction>
@@ -1,13 +1,16 @@
1
1
  {{={= =}=}}
2
- import { type ActionFor, createAction } from './core'
2
+ import type { ActionFor } from '@wasp.sh/lib-sdk-core/browser'
3
+ import { createAction } from "./core";
4
+ import type {
3
5
  {=# actions =}
4
- {=& operationTypeImportStmt =}
6
+ {= registeredOperationTypeName =},
5
7
  {=/ actions =}
8
+ } from "../../../server/operations/actions/index";
6
9
  {=# actions =}
7
10
 
8
11
  // PUBLIC API
9
- export const {= operationName =}: ActionFor<{= operationTypeName =}> = createAction<{= operationTypeName =}>(
10
- '{= actionRoute =}',
12
+ export const {= operationName =}: ActionFor<{= registeredOperationTypeName =}> = createAction<{= registeredOperationTypeName =}>(
13
+ "{= actionRoute =}",
11
14
  {=& entitiesArray =},
12
15
  )
13
16
  {=/ actions =}
@@ -10,7 +10,7 @@ export {
10
10
  useQuery,
11
11
  // PUBLIC API
12
12
  type OptimisticUpdateDefinition,
13
- } from './hooks'
13
+ } from '@wasp.sh/lib-sdk-core/browser'
14
14
 
15
15
  export {
16
16
  // PUBLIC API
@@ -19,9 +19,9 @@ export {
19
19
  initializeQueryClient,
20
20
  // PRIVATE API (framework code)
21
21
  queryClientInitialized
22
- } from './queryClient'
22
+ } from '@wasp.sh/lib-sdk-core/browser'
23
23
 
24
- export {
24
+ export type {
25
25
  // PUBLIC API
26
- type QueryMetadata,
27
- } from './rpc'
26
+ QueryMetadata,
27
+ } from '@wasp.sh/lib-sdk-core'
@@ -1,10 +1,8 @@
1
+ import type { OperationRoute } from '@wasp.sh/lib-sdk-core'
1
2
  import { api, handleApiError } from '../../../api/index.js'
2
3
  import { HttpMethod } from '../../index.js'
3
4
  import { serialize, deserialize } from '../../../core/serialization/index.js'
4
5
 
5
- // PRIVATE API
6
- export type OperationRoute = { method: HttpMethod.Post, path: string }
7
-
8
6
  // PRIVATE API
9
7
  export async function callOperation(operationRoute: OperationRoute, args: any) {
10
8
  try {
@@ -17,8 +15,3 @@ export async function callOperation(operationRoute: OperationRoute, args: any) {
17
15
  throw handleApiError(error)
18
16
  }
19
17
  }
20
-
21
- // PRIVATE API
22
- export function makeOperationRoute(relativeOperationRoute: string): OperationRoute {
23
- return { method: HttpMethod.Post, path: `/${relativeOperationRoute}` }
24
- }
@@ -1,31 +1,18 @@
1
- import { Route } from '../../index.js'
2
- import type { _Awaited, _ReturnType } from '../../../universal/types.js'
3
- import type {
4
- GenericBackendOperation,
5
- GenericOperationRpc,
6
- OperationRpcFor,
7
- Query,
8
- QueryMetadata,
9
- } from '../rpc.js'
10
- import { callOperation, makeOperationRoute } from '../internal/index.js'
11
1
  import {
2
+ makeQueryCacheKey,
3
+ buildAndRegisterQuery,
4
+ type QueryFor,
12
5
  addResourcesUsedByQuery,
13
6
  getActiveOptimisticUpdates,
14
- } from '../internal/resources'
15
-
16
- // PRIVATE API (used in the SDK)
17
- // todo: find ways to remove this duplication and make the type more precise.
18
- // Details here: https://github.com/wasp-lang/wasp/issues/2017
19
- export function makeQueryCacheKey<Input, Output>(
20
- query: Query<Input, Output>,
21
- payload: Input
22
- ): (string | Input)[] {
23
- return payload !== undefined ?
24
- [...query.queryCacheKey, payload]
25
- : query.queryCacheKey
26
- }
7
+ } from '@wasp.sh/lib-sdk-core/browser'
8
+ import {
9
+ makeOperationRoute,
10
+ type GenericBackendOperation,
11
+ type OperationRpcFor,
12
+ } from '@wasp.sh/lib-sdk-core'
13
+ import { callOperation } from '../internal/index.js'
27
14
 
28
- // PRIVATE API (unsed in SDK)
15
+ // PRIVATE API (used in SDK)
29
16
  export function createQuery<BackendQuery extends GenericBackendOperation>(
30
17
  relativeQueryPath: string,
31
18
  entitiesUsed: string[]
@@ -33,14 +20,14 @@ export function createQuery<BackendQuery extends GenericBackendOperation>(
33
20
  const queryRoute = makeOperationRoute(relativeQueryPath)
34
21
  const queryCacheKey = [relativeQueryPath]
35
22
 
36
- const queryFn = (async (queryArgs) => {
23
+ const queryFn = (async (queryArgs: Parameters<BackendQuery>[0]) => {
37
24
  const serverResult = await callOperation(queryRoute, queryArgs)
38
25
  // todo: The full queryCacheKey is constructed in two places, both here and
39
26
  // inside the useQuery hook. See
40
27
  // https://github.com/wasp-lang/wasp/issues/2017
41
28
  const queryCacheKey = makeQueryCacheKey(queryFn as QueryFor<BackendQuery>, queryArgs)
42
29
  return getActiveOptimisticUpdates(queryCacheKey).reduce(
43
- (result, update) => update(result),
30
+ (result: unknown, update: (data: unknown) => unknown) => update(result),
44
31
  serverResult,
45
32
  )
46
33
  // This assertion is necessary because, when the Input is void, we want to
@@ -54,38 +41,9 @@ export function createQuery<BackendQuery extends GenericBackendOperation>(
54
41
  )
55
42
  }
56
43
 
57
- // PRIVATE API (used in SDK)
58
- export function buildAndRegisterQuery<QF extends GenericOperationRpc>(
59
- queryFn: QF,
60
- { queryCacheKey, queryRoute, entitiesUsed }:
61
- { queryCacheKey: string[], queryRoute: Route, entitiesUsed: string[] }
62
- ): QueryForFunction<QF> {
63
- const query = queryFn as QueryForFunction<QF>
64
-
65
- query.queryCacheKey = queryCacheKey
66
- query.route = queryRoute
67
- addResourcesUsedByQuery(query.queryCacheKey, entitiesUsed)
68
-
69
- return query
70
- }
71
-
72
- // PRIVATE API (but should maybe be public, users define values of this type)
73
- /**
74
- * Constructs the client Query object type from the type of the Query's definition
75
- * on the backend.
76
- */
77
- export type QueryFor<BackendQuery extends GenericBackendOperation> =
78
- QueryForFunction<QueryFunctionFor<BackendQuery>>
79
-
80
44
  /**
81
45
  * Constructs the client Query function type from the type of the Query's
82
46
  * definition on the backend.
83
47
  */
84
48
  type QueryFunctionFor<BackendQuery extends GenericBackendOperation> =
85
49
  OperationRpcFor<BackendQuery>
86
-
87
- /**
88
- * Returns the appropriate client Query object type for the provided client
89
- * Query function type.
90
- */
91
- type QueryForFunction<QF extends GenericOperationRpc> = QF & QueryMetadata
@@ -1,16 +1,16 @@
1
1
  {{={= =}=}}
2
- import { type QueryFor, createQuery } from './core'
2
+ import type { QueryFor } from '@wasp.sh/lib-sdk-core/browser'
3
+ import { createQuery } from "./core";
4
+ import type {
3
5
  {=# queries =}
4
- {=& operationTypeImportStmt =}
6
+ {= registeredOperationTypeName =},
5
7
  {=/ queries =}
8
+ } from "../../../server/operations/queries/index";
6
9
  {=# queries =}
7
10
 
8
11
  // PUBLIC API
9
- export const {= operationName =}: QueryFor<{= operationTypeName =}> = createQuery<{= operationTypeName =}>(
10
- '{= queryRoute =}',
12
+ export const {= operationName =}: QueryFor<{= registeredOperationTypeName =}> = createQuery<{= registeredOperationTypeName =}>(
13
+ "{= queryRoute =}",
11
14
  {=& entitiesArray =},
12
15
  )
13
16
  {=/ queries =}
14
-
15
- // PRIVATE API (used in SDK)
16
- export { buildAndRegisterQuery } from './core'
@@ -1,18 +1,18 @@
1
1
  import { useMemo } from 'react'
2
2
  import { Link as RouterLink } from 'react-router'
3
- import { interpolatePath } from './linkHelpers'
4
- import { type Routes } from './index'
3
+ import { interpolatePath, type OptionalRouteOptions } from '@wasp.sh/lib-sdk-core'
4
+ import type { Routes } from './index'
5
5
 
6
6
  type RouterLinkProps = Parameters<typeof RouterLink>[0]
7
7
 
8
8
  // PUBLIC API
9
- export function Link(
10
- { to, params, search, hash, ...restOfProps }: Omit<RouterLinkProps, "to">
11
- & {
12
- search?: Record<string, string>;
13
- hash?: string;
14
- }
9
+ export type LinkProps = Omit<RouterLinkProps, "to">
10
+ & OptionalRouteOptions
15
11
  & Routes
12
+
13
+ // PUBLIC API
14
+ export function Link(
15
+ { to, params, search, hash, ...restOfProps }: LinkProps
16
16
  ): React.JSX.Element {
17
17
  const toPropWithParams = useMemo(() => {
18
18
  return interpolatePath(to, params, search, hash)
@@ -1,18 +1,18 @@
1
1
  import { useMemo } from 'react'
2
2
  import { NavLink as RouterNavLink } from 'react-router'
3
- import { interpolatePath } from './linkHelpers'
4
- import { type Routes } from './index'
3
+ import { interpolatePath, type OptionalRouteOptions } from '@wasp.sh/lib-sdk-core'
4
+ import type { Routes } from './index'
5
5
 
6
6
  type RouterNavLinkProps = Parameters<typeof RouterNavLink>[0]
7
7
 
8
8
  // PUBLIC API
9
- export function NavLink(
10
- { to, params, search, hash, ...restOfProps }: Omit<RouterNavLinkProps, "to">
11
- & {
12
- search?: Record<string, string>;
13
- hash?: string;
14
- }
9
+ export type NavLinkProps = Omit<RouterNavLinkProps, "to">
10
+ & OptionalRouteOptions
15
11
  & Routes
12
+
13
+ // PUBLIC API
14
+ export function NavLink(
15
+ { to, params, search, hash, ...restOfProps }: NavLinkProps
16
16
  ): React.JSX.Element {
17
17
  const toPropWithParams = useMemo(() => {
18
18
  return interpolatePath(to, params, search, hash)