@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.
- package/data/Cli/starters/README.md +2 -0
- package/data/Cli/starters/basic/README.md +3 -3
- package/data/Cli/starters/basic/src/tags/components/CreateTagForm.tsx +2 -3
- package/data/Cli/starters/basic/vite.config.ts +0 -3
- package/data/Cli/starters/minimal/package.json +4 -1
- package/data/Cli/starters/minimal/vite.config.ts +0 -3
- package/data/Cli/starters/skeleton/AGENTS.md +6 -0
- package/data/Cli/starters/skeleton/CLAUDE.md +6 -0
- package/data/Cli/starters/skeleton/tsconfig.src.json +1 -11
- package/data/Generator/libs/auth/wasp.sh-lib-auth-0.26.0.tgz +0 -0
- package/data/Generator/libs/sdk-core/node_modules/@wasp.sh/lib-auth/wasp.sh-lib-auth-0.26.0.tgz +0 -0
- package/data/Generator/libs/sdk-core/wasp.sh-lib-sdk-core-0.26.0.tgz +0 -0
- 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
- package/data/Generator/templates/Dockerfile +1 -0
- package/data/Generator/templates/sdk/wasp/api/index.ts +5 -86
- package/data/Generator/templates/sdk/wasp/auth/email/actions/login.ts +2 -2
- package/data/Generator/templates/sdk/wasp/auth/email/actions/passwordReset.ts +1 -1
- package/data/Generator/templates/sdk/wasp/auth/email/actions/signup.ts +7 -6
- package/data/Generator/templates/sdk/wasp/auth/email/actions/verifyEmail.ts +1 -1
- package/data/Generator/templates/sdk/wasp/auth/forms/Auth.tsx +12 -6
- package/data/Generator/templates/sdk/wasp/auth/forms/ForgotPassword.tsx +2 -1
- package/data/Generator/templates/sdk/wasp/auth/forms/Login.tsx +2 -1
- package/data/Generator/templates/sdk/wasp/auth/forms/ResetPassword.tsx +2 -1
- package/data/Generator/templates/sdk/wasp/auth/forms/Signup.tsx +5 -5
- package/data/Generator/templates/sdk/wasp/auth/forms/VerifyEmail.tsx +2 -1
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/common/LoginSignupForm.tsx +34 -33
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/email/DummyEmailSenderNotice.module.css +11 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/email/DummyEmailSenderNotice.tsx +17 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/email/ForgotPasswordForm.tsx +9 -13
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/email/ResetPasswordForm.tsx +8 -9
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/email/VerifyEmailForm.tsx +4 -8
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/email/useEmail.ts +5 -5
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/usernameAndPassword/useUsernameAndPassword.ts +6 -5
- package/data/Generator/templates/sdk/wasp/auth/forms/types.ts +0 -59
- package/data/Generator/templates/sdk/wasp/auth/helpers/_Provider.tsx +2 -2
- package/data/Generator/templates/sdk/wasp/auth/index.ts +1 -1
- package/data/Generator/templates/sdk/wasp/auth/logout.ts +1 -1
- package/data/Generator/templates/sdk/wasp/auth/providers/index.ts +4 -4
- package/data/Generator/templates/sdk/wasp/auth/providers/types.ts +20 -24
- package/data/Generator/templates/sdk/wasp/auth/useAuth.ts +5 -5
- package/data/Generator/templates/sdk/wasp/auth/user.ts +147 -14
- package/data/Generator/templates/sdk/wasp/auth/username/actions/login.ts +2 -2
- package/data/Generator/templates/sdk/wasp/auth/username/actions/signup.ts +6 -5
- package/data/Generator/templates/sdk/wasp/auth/validation.ts +1 -83
- package/data/Generator/templates/sdk/wasp/client/app/pages/OAuthCallback.tsx +8 -5
- package/data/Generator/templates/sdk/wasp/client/app/pages/createAuthRequiredPage.jsx +6 -4
- package/data/Generator/templates/sdk/wasp/client/app/router.tsx +2 -2
- package/data/Generator/templates/sdk/wasp/client/auth/ui.ts +2 -2
- package/data/Generator/templates/sdk/wasp/client/auth/username.ts +2 -2
- package/data/Generator/templates/sdk/wasp/client/config.ts +1 -6
- package/data/Generator/templates/sdk/wasp/client/crud/_crud.ts +129 -75
- package/data/Generator/templates/sdk/wasp/client/env/schema.ts +14 -7
- package/data/Generator/templates/sdk/wasp/client/env.ts +4 -3
- package/data/Generator/templates/sdk/wasp/client/index.ts +3 -12
- package/data/Generator/templates/sdk/wasp/client/operations/actions/core.ts +14 -10
- package/data/Generator/templates/sdk/wasp/client/operations/actions/index.ts +7 -4
- package/data/Generator/templates/sdk/wasp/client/operations/index.ts +5 -5
- package/data/Generator/templates/sdk/wasp/client/operations/internal/index.ts +1 -8
- package/data/Generator/templates/sdk/wasp/client/operations/queries/core.ts +13 -55
- package/data/Generator/templates/sdk/wasp/client/operations/queries/index.ts +7 -7
- package/data/Generator/templates/sdk/wasp/client/router/Link.tsx +8 -8
- package/data/Generator/templates/sdk/wasp/client/router/NavLink.tsx +8 -8
- package/data/Generator/templates/sdk/wasp/client/router/index.ts +15 -15
- package/data/Generator/templates/sdk/wasp/client/test/index.ts +2 -1
- package/data/Generator/templates/sdk/wasp/client/test/vitest/helpers.tsx +5 -36
- package/data/Generator/templates/sdk/wasp/client/vite/index.ts +2 -1
- package/data/Generator/templates/sdk/wasp/client/vite/plugins/virtualUserModules.ts +43 -0
- package/data/Generator/templates/sdk/wasp/client/vite/plugins/{virtualModules.ts → virtualWaspModules.ts} +4 -4
- package/data/Generator/templates/sdk/wasp/client/vite/plugins/wasp.ts +17 -14
- package/data/Generator/templates/sdk/wasp/client/vite/plugins/waspConfig.ts +60 -18
- package/data/Generator/templates/sdk/wasp/client/vite/virtual-files/files/client-entry.tsx +1 -1
- package/data/Generator/templates/sdk/wasp/client/vite/virtual-files/files/routes.tsx +1 -1
- package/data/Generator/templates/sdk/wasp/client/vite/virtual-files/files/ssr-entry.tsx +1 -1
- package/data/Generator/templates/sdk/wasp/client/webSocket/WebSocketProvider.tsx +3 -3
- package/data/Generator/templates/sdk/wasp/client/webSocket/index.ts +1 -1
- package/data/Generator/templates/sdk/wasp/core/serialization/index.ts +2 -47
- package/data/Generator/templates/sdk/wasp/core/serialization/prisma.ts +0 -1
- package/data/Generator/templates/sdk/wasp/entities/index.ts +6 -6
- package/data/Generator/templates/sdk/wasp/env/index.ts +1 -9
- package/data/Generator/templates/sdk/wasp/package.json +150 -104
- package/data/Generator/templates/sdk/wasp/server/_types/index.ts +8 -10
- package/data/Generator/templates/sdk/wasp/server/_types/taggedEntities.ts +4 -4
- package/data/Generator/templates/sdk/wasp/server/api/index.ts +5 -5
- package/data/Generator/templates/sdk/wasp/server/auth/email/index.ts +2 -12
- package/data/Generator/templates/sdk/wasp/server/auth/email/utils.ts +8 -30
- package/data/Generator/templates/sdk/wasp/server/auth/hooks.ts +5 -2
- package/data/Generator/templates/sdk/wasp/server/auth/index.ts +3 -3
- package/data/Generator/templates/sdk/wasp/{auth → server/auth}/jwt.ts +1 -1
- package/data/Generator/templates/sdk/wasp/{auth → server/auth}/lucia.ts +4 -4
- package/data/Generator/templates/sdk/wasp/server/auth/oauth/oneTimeCode.ts +1 -1
- package/data/Generator/templates/sdk/wasp/server/auth/oauth/providers/discord.ts +1 -1
- package/data/Generator/templates/sdk/wasp/server/auth/oauth/providers/github.ts +1 -1
- package/data/Generator/templates/sdk/wasp/server/auth/oauth/providers/google.ts +1 -1
- package/data/Generator/templates/sdk/wasp/server/auth/oauth/providers/keycloak.ts +1 -1
- package/data/Generator/templates/sdk/wasp/server/auth/oauth/providers/microsoft.ts +1 -1
- package/data/Generator/templates/sdk/wasp/server/auth/oauth/providers/slack.ts +1 -1
- package/data/Generator/templates/sdk/wasp/{auth → server/auth}/session.ts +17 -6
- package/data/Generator/templates/sdk/wasp/{auth → server/auth}/utils.ts +40 -183
- package/data/Generator/templates/sdk/wasp/server/config.ts +1 -1
- package/data/Generator/templates/sdk/wasp/{core → server/core}/auth.ts +3 -3
- package/data/Generator/templates/sdk/wasp/server/crud/_operationTypes.ts +16 -63
- package/data/Generator/templates/sdk/wasp/server/dbClient.ts +15 -17
- package/data/Generator/templates/sdk/wasp/server/email/core/helpers.ts +3 -20
- package/data/Generator/templates/sdk/wasp/server/email/core/providers/dummy.ts +2 -2
- package/data/Generator/templates/sdk/wasp/server/email/core/providers/resend.ts +2 -1
- package/data/Generator/templates/sdk/wasp/server/email/core/providers/smtp.ts +2 -1
- package/data/Generator/templates/sdk/wasp/server/email/core/types.ts +2 -45
- package/data/Generator/templates/sdk/wasp/server/email/index.ts +1 -1
- package/data/Generator/templates/sdk/wasp/server/env.ts +20 -11
- package/data/Generator/templates/sdk/wasp/server/index.ts +3 -3
- package/data/Generator/templates/sdk/wasp/server/jobs/_job.ts +1 -1
- package/data/Generator/templates/sdk/wasp/server/jobs/core/pgBoss/index.ts +1 -1
- package/data/Generator/templates/sdk/wasp/server/jobs/core/pgBoss/pgBossJob.ts +4 -4
- package/data/Generator/templates/sdk/wasp/server/jobs/core/pgBoss/types.ts +1 -1
- package/data/Generator/templates/sdk/wasp/server/middleware/index.ts +1 -1
- package/data/Generator/templates/sdk/wasp/server/operations/actions/index.ts +14 -8
- package/data/Generator/templates/sdk/wasp/server/operations/actions/types.ts +5 -5
- package/data/Generator/templates/sdk/wasp/server/operations/queries/index.ts +14 -8
- package/data/Generator/templates/sdk/wasp/server/operations/queries/types.ts +5 -5
- package/data/Generator/templates/sdk/wasp/server/operations/wrappers.ts +40 -14
- package/data/Generator/templates/sdk/wasp/server/types/index.ts +1 -11
- package/data/Generator/templates/sdk/wasp/server/utils.ts +5 -20
- package/data/Generator/templates/sdk/wasp/server/webSocket/index.ts +7 -7
- package/data/Generator/templates/sdk/wasp/tsconfig.json +20 -46
- package/data/Generator/templates/sdk/wasp/types/index.ts +8 -0
- package/data/Generator/templates/sdk/wasp/types/register.ts +21 -0
- package/data/Generator/templates/sdk/wasp/vite-env.d.ts +0 -9
- package/data/Generator/templates/sdk/wasp/wasp-ssr.d.ts +8 -0
- package/data/Generator/templates/sdk/wasp/wasp-user-virtual-modules.d.ts +20 -0
- package/data/Generator/templates/server/package.json +2 -1
- package/data/Generator/templates/server/rollup.config.js +2 -43
- package/data/Generator/templates/server/rollup.dbSeed.config.js +3 -0
- package/data/Generator/templates/server/src/app.js +2 -2
- package/data/Generator/templates/server/src/auth/providers/config/email.ts +5 -5
- package/data/Generator/templates/server/src/auth/providers/email/login.ts +4 -4
- package/data/Generator/templates/server/src/auth/providers/email/requestPasswordReset.ts +4 -4
- package/data/Generator/templates/server/src/auth/providers/email/resetPassword.ts +13 -5
- package/data/Generator/templates/server/src/auth/providers/email/signup.ts +29 -18
- package/data/Generator/templates/server/src/auth/providers/email/verifyEmail.ts +7 -2
- package/data/Generator/templates/server/src/auth/providers/oauth/cookies.ts +5 -1
- package/data/Generator/templates/server/src/auth/providers/oauth/handler.ts +1 -1
- package/data/Generator/templates/server/src/auth/providers/oauth/oneTimeCode.ts +2 -2
- package/data/Generator/templates/server/src/auth/providers/oauth/state.ts +55 -13
- package/data/Generator/templates/server/src/auth/providers/oauth/user.ts +6 -3
- package/data/Generator/templates/server/src/auth/providers/username/login.ts +4 -4
- package/data/Generator/templates/server/src/auth/providers/username/signup.ts +12 -4
- package/data/Generator/templates/server/src/createRollupBundle.js +47 -0
- package/data/Generator/templates/server/src/crud/_operations.ts +16 -16
- package/data/Generator/templates/server/src/plugins/virtualUserModules.js +40 -0
- package/data/Generator/templates/server/src/routes/apis/index.ts +3 -3
- package/data/Generator/templates/server/src/routes/auth/index.js +1 -1
- package/data/Generator/templates/server/src/routes/auth/logout.ts +2 -2
- package/data/Generator/templates/server/src/routes/crud/_crud.ts +1 -1
- package/data/Generator/templates/server/src/routes/index.js +18 -18
- package/data/Generator/templates/server/src/routes/operations/index.js +1 -1
- package/data/Generator/templates/server/src/webSocket/initialization.ts +1 -1
- package/data/Generator/templates/server/tsconfig.json +7 -13
- package/data/Generator/templates/types/app/sdk/register.ts +57 -0
- package/data/packages/deploy/dist/common/cliVersion.js +17 -0
- package/data/packages/deploy/dist/common/waspProject.js +1 -1
- package/data/packages/deploy/dist/common/zx.js +24 -6
- package/data/packages/deploy/dist/providers/fly/commands/createDb/createDb.js +13 -5
- package/data/packages/deploy/dist/providers/fly/flyCli.js +29 -17
- package/data/packages/deploy/dist/providers/fly/index.js +16 -8
- package/data/packages/deploy/dist/providers/railway/commands/setup/setup.js +19 -31
- package/data/packages/deploy/dist/providers/railway/index.js +11 -2
- package/data/packages/deploy/dist/providers/railway/jsonOutputSchemas.js +19 -34
- package/data/packages/deploy/dist/providers/railway/railwayCli.js +11 -20
- package/data/packages/deploy/dist/providers/railway/railwayEnvironment/cli.js +20 -0
- package/data/packages/deploy/dist/providers/railway/railwayProject/RailwayProject.js +4 -1
- package/data/packages/deploy/dist/providers/railway/railwayProject/cli.js +6 -14
- package/data/packages/deploy/dist/providers/railway/railwayService/database.js +88 -0
- package/data/packages/deploy/dist/providers/railway/railwayService/deployment.js +12 -25
- package/data/packages/deploy/dist/providers/railway/railwayService/nameGenerator.js +5 -4
- package/data/packages/deploy/dist/providers/railway/railwayService/serviceInstance.js +48 -0
- package/data/packages/deploy/dist/providers/railway/railwayService/url.js +9 -30
- package/data/packages/deploy/package-lock.json +2 -2
- package/data/packages/deploy/package.json +1 -1
- package/data/packages/prisma/package-lock.json +2 -2
- package/data/packages/prisma/package.json +1 -1
- package/data/packages/spec/dist/__tests__/spec/mapApp.unit.test.js +19 -15
- package/data/packages/spec/dist/__tests__/spec/tsAppSpec.test-d.js +6 -0
- package/data/packages/spec/dist/src/appSpec.d.ts +15 -2
- package/data/packages/spec/dist/src/appSpec.d.ts.map +1 -1
- package/data/packages/spec/dist/src/spec/mapper/app.d.ts +1 -0
- package/data/packages/spec/dist/src/spec/mapper/app.d.ts.map +1 -1
- package/data/packages/spec/dist/src/spec/mapper/app.js +8 -2
- package/data/packages/spec/dist/src/spec/mapper/context.js +4 -4
- package/data/packages/spec/dist/src/spec/mapper/specElements.js +9 -9
- package/data/packages/spec/dist/src/spec/publicApi/constructors.d.ts +11 -11
- package/data/packages/spec/dist/src/spec/publicApi/constructors.js +11 -11
- package/data/packages/spec/dist/src/spec/publicApi/register.d.ts +1 -1
- package/data/packages/spec/dist/src/spec/publicApi/waspSpec.d.ts +58 -38
- package/data/packages/spec/dist/src/spec/publicApi/waspSpec.d.ts.map +1 -1
- package/data/packages/spec/package-lock.json +2 -2
- package/data/packages/spec/package.json +1 -1
- package/data/packages/studio/package-lock.json +15 -23
- package/data/packages/studio/package.json +2 -2
- package/package.json +1 -1
- package/wasp-bin +0 -0
- package/data/Generator/libs/auth/wasp.sh-lib-auth-0.25.0.tgz +0 -0
- package/data/Generator/templates/sdk/wasp/api/events.ts +0 -11
- package/data/Generator/templates/sdk/wasp/auth/email/index.ts +0 -5
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/Form.module.css +0 -99
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/Form.tsx +0 -74
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/Message.module.css +0 -22
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/Message.tsx +0 -34
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/auth-styles.css +0 -30
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/social/SocialButton.module.css +0 -33
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/social/SocialButton.tsx +0 -14
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/social/SocialIcons.module.css +0 -4
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/social/SocialIcons.tsx +0 -85
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/util.ts +0 -16
- package/data/Generator/templates/sdk/wasp/auth/helpers/user.ts +0 -15
- package/data/Generator/templates/sdk/wasp/auth/responseSchemas.ts +0 -10
- package/data/Generator/templates/sdk/wasp/auth/types.ts +0 -2
- package/data/Generator/templates/sdk/wasp/auth/username/index.ts +0 -2
- package/data/Generator/templates/sdk/wasp/client/app/components/DefaultRootErrorBoundary.tsx +0 -16
- package/data/Generator/templates/sdk/wasp/client/app/components/FullPageWrapper.tsx +0 -21
- package/data/Generator/templates/sdk/wasp/client/app/components/Loader.module.css +0 -37
- package/data/Generator/templates/sdk/wasp/client/app/components/Loader.tsx +0 -12
- package/data/Generator/templates/sdk/wasp/client/app/components/Message.tsx +0 -86
- package/data/Generator/templates/sdk/wasp/client/crud/operationsHelpers.ts +0 -21
- package/data/Generator/templates/sdk/wasp/client/hooks.ts +0 -19
- package/data/Generator/templates/sdk/wasp/client/operations/hooks.ts +0 -347
- package/data/Generator/templates/sdk/wasp/client/operations/internal/resources.js +0 -85
- package/data/Generator/templates/sdk/wasp/client/operations/internal/updateHandlersMap.js +0 -37
- package/data/Generator/templates/sdk/wasp/client/operations/queryClient.ts +0 -34
- package/data/Generator/templates/sdk/wasp/client/operations/rpc.ts +0 -96
- package/data/Generator/templates/sdk/wasp/client/router/linkHelpers.ts +0 -48
- package/data/Generator/templates/sdk/wasp/client/router/types.ts +0 -98
- package/data/Generator/templates/sdk/wasp/client/vite/plugins/detectServerImports.ts +0 -50
- package/data/Generator/templates/sdk/wasp/client/vite/plugins/envFile.ts +0 -112
- package/data/Generator/templates/sdk/wasp/client/vite/plugins/typescriptCheck.ts +0 -36
- package/data/Generator/templates/sdk/wasp/client/vite/plugins/validateEnv.ts +0 -88
- package/data/Generator/templates/sdk/wasp/client/vite/virtual-files/resolver.ts +0 -35
- package/data/Generator/templates/sdk/wasp/core/serialization/custom-register.ts +0 -21
- package/data/Generator/templates/sdk/wasp/core/storage.ts +0 -73
- package/data/Generator/templates/sdk/wasp/env/validation.ts +0 -44
- package/data/Generator/templates/sdk/wasp/server/HttpError.ts +0 -30
- package/data/Generator/templates/sdk/wasp/server/auth/oauth/provider.ts +0 -20
- package/data/Generator/templates/sdk/wasp/server/auth/user.ts +0 -154
- package/data/Generator/templates/sdk/wasp/server/auth/username.ts +0 -1
- package/data/Generator/templates/sdk/wasp/server/jobs/core/job.ts +0 -28
- package/data/Generator/templates/sdk/wasp/server/middleware/globalMiddleware.ts +0 -8
- package/data/Generator/templates/sdk/wasp/universal/ansiColors.ts +0 -58
- package/data/Generator/templates/sdk/wasp/universal/predicates.ts +0 -3
- package/data/Generator/templates/sdk/wasp/universal/types.ts +0 -74
- package/data/Generator/templates/sdk/wasp/universal/url.ts +0 -9
- package/data/Generator/templates/sdk/wasp/universal/validators.ts +0 -21
- package/data/packages/ts-inspect/dist/exports.js +0 -82
- package/data/packages/ts-inspect/dist/index.js +0 -28
- package/data/packages/ts-inspect/package-lock.json +0 -4724
- package/data/packages/ts-inspect/package.json +0 -31
- /package/data/Generator/templates/sdk/wasp/{auth → server/auth}/password.ts +0 -0
|
@@ -5,112 +5,158 @@
|
|
|
5
5
|
"private": true,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
{=!
|
|
13
|
-
|
|
8
|
+
"build": "tsc && node ./scripts/copy-assets.js",
|
|
9
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
10
|
+
"types": "tsc --declaration --emitDeclarationOnly --stripInternal --declarationDir dist"
|
|
11
|
+
},
|
|
12
|
+
{=!
|
|
13
|
+
IMPORTANT: If you modify this list, remember to update the spreadsheet at:
|
|
14
|
+
https://docs.google.com/spreadsheets/d/1QW-_16KRGTOaKXx9NYUtjk6m2TQ0nUMOA74hBthTH3g/edit
|
|
15
|
+
=}
|
|
16
|
+
{=!
|
|
17
|
+
TYPE PORTABILITY CONSTRAINT:
|
|
18
|
+
Any type that can appear in a user's inferred exported types must be
|
|
19
|
+
declared in a module reachable through this exports map. Some exports
|
|
20
|
+
below exist only to satisfy this, so don't remove an export just
|
|
21
|
+
because nothing imports it directly.
|
|
22
|
+
|
|
23
|
+
Why?
|
|
24
|
+
Server's and client's TypeScript project files reference the user's
|
|
25
|
+
TypeScript project through project references. This forces the user's
|
|
26
|
+
tsconfig to set `composite: true` flag which automatically implies
|
|
27
|
+
`declaration: true`.
|
|
28
|
+
|
|
29
|
+
When declaration emit is enabled, every exported binding without an
|
|
30
|
+
explicit type annotation gets its inferred type serialized into a
|
|
31
|
+
`.d.ts` file. A common example is users defining operations while
|
|
32
|
+
typing them with the `satisfies` keyword:
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import type { GetNumberOfTasks } from "wasp/server/operations";
|
|
36
|
+
|
|
37
|
+
export const getNumberOfTasks = (async (_args, context) => {
|
|
38
|
+
return context.entities.Task.count();
|
|
39
|
+
}) satisfies GetNumberOfTasks<void>;
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
If that inferred type structurally contains a type symbol from this
|
|
43
|
+
package, `tsc` must synthesize a portable reference to that symbol.
|
|
44
|
+
E.g., an authenticated operation's context contains a type symbol
|
|
45
|
+
for `AuthUser`. So we must be able to create a portable reference
|
|
46
|
+
to `AuthUser`.
|
|
47
|
+
|
|
48
|
+
Because `AuthUser` is declared in an exports-reachable module
|
|
49
|
+
("./auth/user"), `tsc` can always create a portable reference to it,
|
|
50
|
+
no matter what the user's code imports. If it were declared in a
|
|
51
|
+
non-exported module (e.g. `wasp/server/auth/user`), `tsc` could name
|
|
52
|
+
it only when the user's program happened to load some module
|
|
53
|
+
re-exporting it, which is not guaranteed, and declaration emit
|
|
54
|
+
would fail.
|
|
55
|
+
=}
|
|
14
56
|
"exports": {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
57
|
+
{=!
|
|
58
|
+
===============================================================
|
|
59
|
+
Public API for users. Documented.
|
|
60
|
+
These are the modules that users import in their own code.
|
|
61
|
+
Some of the modules are also imported by the generated server project.
|
|
62
|
+
Those have additioanl comments saying which exports user/server uses.
|
|
63
|
+
===============================================================
|
|
64
|
+
=}
|
|
65
|
+
"./auth": "./dist/auth/index.js",
|
|
66
|
+
{=! FIXME: Documented only in example apps, not in docs. Also re-exported through `wasp/server/auth`.=}
|
|
67
|
+
{=! FIXME: Candidate for removal? =}
|
|
68
|
+
{=! Users: validators in custom auth actions. =}
|
|
69
|
+
{=! Server: the same validators in auth provider routes. =}
|
|
70
|
+
"./auth/validation": "./dist/auth/validation.js",
|
|
71
|
+
"./client": "./dist/client/index.js",
|
|
72
|
+
"./client/api": "./dist/api/index.js",
|
|
73
|
+
"./client/auth": "./dist/client/auth/index.js",
|
|
74
|
+
"./client/crud": "./dist/client/crud/index.js",
|
|
75
|
+
{=! Users: operation functions and hooks. =}
|
|
76
|
+
{=! Client: initializeQueryClient in the app entry. =}
|
|
77
|
+
"./client/operations": "./dist/client/operations/index.js",
|
|
78
|
+
"./client/router": "./dist/client/router/index.js",
|
|
79
|
+
"./client/test": "./dist/client/test/index.js",
|
|
80
|
+
"./client/vite": "./dist/client/vite/index.js",
|
|
81
|
+
"./client/webSocket": "./dist/client/webSocket/index.js",
|
|
82
|
+
{=! Users: entity types. =}
|
|
83
|
+
{=! Server: the auth entity type. =}
|
|
84
|
+
"./entities": "./dist/entities/index.js",
|
|
85
|
+
"./env": "./dist/env/index.js",
|
|
86
|
+
{=! FIXME: Documented only in example apps, not in docs. =}
|
|
87
|
+
"./serialization": "./dist/serialization/index.js",
|
|
88
|
+
{=! Users: config, prisma, env, HttpError, type ServerSetupFn, type DbSeedFn, type MiddlewareConfigFn. =}
|
|
89
|
+
{=! Server: config, prisma, env, HttpError, ServerSetupFn, DbSeedFn. =}
|
|
90
|
+
"./server": "./dist/server/index.js",
|
|
91
|
+
"./server/api": "./dist/server/api/index.js",
|
|
92
|
+
{=! Users: signup field helpers and validators. =}
|
|
93
|
+
{=! Server: OAuth provider definitions, tokenStore, OAuthData. =}
|
|
94
|
+
"./server/auth": "./dist/server/auth/index.js",
|
|
95
|
+
"./server/crud": "./dist/server/crud/index.js",
|
|
96
|
+
"./server/email": "./dist/server/email/index.js",
|
|
97
|
+
"./server/jobs": "./dist/server/jobs/index.js",
|
|
98
|
+
"./server/operations": "./dist/server/operations/index.js",
|
|
99
|
+
{=! Users: type WebSocketDefinition, type WaspSocketData. =}
|
|
100
|
+
{=! Server: type ServerType. =}
|
|
101
|
+
"./server/webSocket": "./dist/server/webSocket/index.js",
|
|
51
102
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
103
|
+
{=!
|
|
104
|
+
===============================================================
|
|
105
|
+
Internal runtime agnostic API. Undocumented.
|
|
106
|
+
===============================================================
|
|
107
|
+
=}
|
|
108
|
+
"./auth/user": "./dist/auth/user.js",
|
|
109
|
+
"./core/serialization": "./dist/core/serialization/index.js",
|
|
110
|
+
"./auth/providers": "./dist/auth/providers/index.js",
|
|
111
|
+
"./auth/providers/types": "./dist/auth/providers/types.js",
|
|
112
|
+
"./types": "./dist/types/index.js",
|
|
56
113
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
"./client/operations": "./dist/client/operations/index.js",
|
|
77
|
-
"./server/auth": "./dist/server/auth/index.js",
|
|
78
|
-
"./server/crud": "./dist/server/crud/index.js",
|
|
79
|
-
"./client/crud": "./dist/client/crud/index.js",
|
|
80
|
-
"./server/email": "./dist/server/email/index.js",
|
|
81
|
-
"./server/jobs": "./dist/server/jobs/index.js",
|
|
82
|
-
"./server/operations": "./dist/server/operations/index.js",
|
|
83
|
-
"./client/router": "./dist/client/router/index.js",
|
|
84
|
-
"./client/test": "./dist/client/test/index.js",
|
|
85
|
-
"./client/test/setup": "./dist/client/test/setup.js",
|
|
86
|
-
"./client": "./dist/client/index.js",
|
|
87
|
-
"./env": "./dist/env/index.js",
|
|
88
|
-
"./serialization": "./dist/serialization/index.js",
|
|
89
|
-
{=! Private: [client] =}
|
|
90
|
-
"./client/app": "./dist/client/app/index.jsx",
|
|
91
|
-
"./client/app/layout": "./dist/client/app/layout.jsx",
|
|
92
|
-
"./client/app/router": "./dist/client/app/router.jsx",
|
|
93
|
-
{=! Private: [client] =}
|
|
94
|
-
"./client/vite": "./dist/client/vite/index.js"
|
|
114
|
+
{=!
|
|
115
|
+
===============================================================
|
|
116
|
+
Internal server runtime API. Undocumented.
|
|
117
|
+
===============================================================
|
|
118
|
+
=}
|
|
119
|
+
"./server/auth/jwt": "./dist/server/auth/jwt.js",
|
|
120
|
+
"./server/auth/password": "./dist/server/auth/password.js",
|
|
121
|
+
"./server/auth/session": "./dist/server/auth/session.js",
|
|
122
|
+
"./server/auth/utils": "./dist/server/auth/utils.js",
|
|
123
|
+
"./server/core/auth": "./dist/server/core/auth.js",
|
|
124
|
+
"./server/crud/*": "./dist/server/crud/*.js",
|
|
125
|
+
"./server/email/core/types": "./dist/server/email/core/types.js",
|
|
126
|
+
{=! Todo(filip): This export becomes problematic once we start supporting different executors =}
|
|
127
|
+
"./server/jobs/core/pgBoss": "./dist/server/jobs/core/pgBoss/index.js",
|
|
128
|
+
{=! FIXME: Reconsider during refactoring whether this is still needed. =}
|
|
129
|
+
"./server/middleware": "./dist/server/middleware/index.js",
|
|
130
|
+
{=! FIXME: Reconsider during refactoring whether this is still needed. =}
|
|
131
|
+
"./server/types": "./dist/server/types/index.js",
|
|
132
|
+
"./server/utils": "./dist/server/utils.js",
|
|
95
133
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
134
|
+
{=!
|
|
135
|
+
===============================================================
|
|
136
|
+
Internal client runtime API. Undocumented.
|
|
137
|
+
Client is hidden in Wasp's vite plugin virtual modules.
|
|
138
|
+
===============================================================
|
|
139
|
+
=}
|
|
140
|
+
"./client/app": "./dist/client/app/index.jsx",
|
|
141
|
+
"./client/app/layout": "./dist/client/app/layout.jsx",
|
|
142
|
+
"./client/app/router": "./dist/client/app/router.jsx",
|
|
143
|
+
{=! Injected as a vitest setupFiles entry by the vite plugin. =}
|
|
144
|
+
"./client/test/setup": "./dist/client/test/setup.js"
|
|
145
|
+
},
|
|
146
|
+
{=!
|
|
147
|
+
TypeScript doesn't care about the redirects we define above in "exports" field; those
|
|
148
|
+
are used only in runtime. TypeScript instead follows exact path as stated in an import when
|
|
149
|
+
trying to find the type declarations. Therefore, when "exports" redirect doesn't match the path
|
|
150
|
+
it redirects to, we need to also let TypeScript know about it, and that can be done with
|
|
151
|
+
`typesVersions` field below.
|
|
152
|
+
=}
|
|
153
|
+
"typesVersions": {
|
|
154
|
+
"*": {
|
|
155
|
+
"client/api": ["api/index.ts"]
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
"license": "ISC",
|
|
159
|
+
{=& depsChunk =},
|
|
160
|
+
{=& devDepsChunk =},
|
|
161
|
+
{=& peerDepsChunk =}
|
|
116
162
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{{={= =}=}}
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import type { Expand } from '@wasp.sh/lib-sdk-core'
|
|
3
|
+
import type { Request, Response } from 'express'
|
|
4
|
+
import type {
|
|
5
|
+
ParamsDictionary as ExpressParams,
|
|
6
|
+
Query as ExpressQuery,
|
|
7
7
|
} from 'express-serve-static-core'
|
|
8
8
|
import { prisma } from '../index.js'
|
|
9
9
|
{=# isAuthEnabled =}
|
|
10
|
-
import {
|
|
10
|
+
import type { AuthUser } from '../../auth/user.js'
|
|
11
11
|
{=/ isAuthEnabled =}
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
12
|
+
import type { _Entity } from './taggedEntities'
|
|
13
|
+
import type { Payload } from '../../core/serialization/index.js'
|
|
14
14
|
|
|
15
15
|
export * from "./taggedEntities"
|
|
16
16
|
export * from "../../core/serialization/index.js"
|
|
@@ -100,6 +100,4 @@ type Context<Entities extends _Entity[]> = Expand<{
|
|
|
100
100
|
type ContextWithUser<Entities extends _Entity[]> = Expand<
|
|
101
101
|
Context<Entities> & { user?: AuthUser }
|
|
102
102
|
>
|
|
103
|
-
|
|
104
|
-
export type { ProviderName } from '../../auth/utils.js'
|
|
105
103
|
{=/ isAuthEnabled =}
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
//
|
|
5
5
|
// We must explicitly tag all entities with their name to avoid issues with
|
|
6
6
|
// structural typing. See https://github.com/wasp-lang/wasp/pull/982 for details.
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
import type {
|
|
8
|
+
Entity,
|
|
9
|
+
EntityName,
|
|
10
10
|
{=# entities =}
|
|
11
|
-
|
|
11
|
+
{= name =},
|
|
12
12
|
{=/ entities =}
|
|
13
13
|
} from '../../entities/index.js'
|
|
14
14
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{{={= =}=}}
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import type { ParamsDictionary as ExpressParams, Query as ExpressQuery } from 'express-serve-static-core'
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import type {
|
|
6
6
|
{=# allEntities =}
|
|
7
|
-
|
|
7
|
+
{= internalTypeName =},
|
|
8
8
|
{=/ allEntities =}
|
|
9
9
|
{=# shouldImportNonAuthenticatedApi =}
|
|
10
|
-
|
|
10
|
+
Api,
|
|
11
11
|
{=/ shouldImportNonAuthenticatedApi =}
|
|
12
12
|
{=# shouldImportAuthenticatedApi =}
|
|
13
|
-
|
|
13
|
+
AuthenticatedApi,
|
|
14
14
|
{=/ shouldImportAuthenticatedApi =}
|
|
15
15
|
} from '../_types'
|
|
16
16
|
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export type GetVerificationEmailContentFn = (params: { verificationLink: string }) => EmailContent;
|
|
3
|
-
|
|
4
|
-
// PUBLIC API
|
|
5
|
-
export type GetPasswordResetEmailContentFn = (params: { passwordResetLink: string }) => EmailContent;
|
|
6
|
-
|
|
7
|
-
type EmailContent = {
|
|
8
|
-
subject: string;
|
|
9
|
-
html: string;
|
|
10
|
-
text: string;
|
|
11
|
-
}
|
|
1
|
+
export { type GetPasswordResetEmailContentFn, type GetVerificationEmailContentFn } from '@wasp.sh/lib-sdk-core/node'
|
|
12
2
|
|
|
13
3
|
export {
|
|
14
4
|
createEmailVerificationLink,
|
|
@@ -17,4 +7,4 @@ export {
|
|
|
17
7
|
sendPasswordResetEmail,
|
|
18
8
|
isEmailResendAllowed,
|
|
19
9
|
} from './utils.js'
|
|
20
|
-
export { ensureValidEmail } from '
|
|
10
|
+
export { ensureValidEmail } from '@wasp.sh/lib-sdk-core'
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
{{={= =}=}}
|
|
2
|
-
import {
|
|
2
|
+
import { isEmailResendAllowed } from '@wasp.sh/lib-sdk-core'
|
|
3
|
+
// PUBLIC API
|
|
4
|
+
export { isEmailResendAllowed } from '@wasp.sh/lib-sdk-core'
|
|
5
|
+
|
|
6
|
+
import { createJWT, TimeSpan } from '../jwt.js'
|
|
3
7
|
import { emailSender } from '../../email/index.js';
|
|
4
|
-
import { Email } from '../../email/core/types.js';
|
|
8
|
+
import type { Email } from '../../email/core/types.js';
|
|
5
9
|
import {
|
|
6
10
|
createProviderId,
|
|
7
11
|
updateAuthIdentityProviderData,
|
|
8
12
|
findAuthIdentity,
|
|
9
13
|
getProviderDataWithPassword,
|
|
10
14
|
type EmailProviderData,
|
|
11
|
-
} from '
|
|
15
|
+
} from '../utils.js';
|
|
12
16
|
import { config as waspServerConfig } from '../../index.js';
|
|
13
|
-
import
|
|
17
|
+
import type { {= userEntityUpper =}, {= authEntityUpper =} } from '../../../entities/index.js'
|
|
14
18
|
|
|
15
19
|
// PUBLIC API
|
|
16
20
|
export async function createEmailVerificationLink(
|
|
@@ -76,29 +80,3 @@ async function sendEmailAndSaveMetadata(
|
|
|
76
80
|
console.error('Failed to send email', e);
|
|
77
81
|
});
|
|
78
82
|
}
|
|
79
|
-
|
|
80
|
-
// PUBLIC API
|
|
81
|
-
export function isEmailResendAllowed<Field extends 'emailVerificationSentAt' | 'passwordResetSentAt'>(
|
|
82
|
-
fields: {
|
|
83
|
-
[field in Field]: string | null
|
|
84
|
-
},
|
|
85
|
-
field: Field,
|
|
86
|
-
resendInterval: number = 1000 * 60,
|
|
87
|
-
): {
|
|
88
|
-
isResendAllowed: boolean;
|
|
89
|
-
timeLeft: number;
|
|
90
|
-
} {
|
|
91
|
-
const sentAt = fields[field];
|
|
92
|
-
if (!sentAt) {
|
|
93
|
-
return {
|
|
94
|
-
isResendAllowed: true,
|
|
95
|
-
timeLeft: 0,
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
const now = new Date();
|
|
99
|
-
const diff = now.getTime() - new Date(sentAt).getTime();
|
|
100
|
-
const isResendAllowed = diff > resendInterval;
|
|
101
|
-
// Time left in seconds
|
|
102
|
-
const timeLeft = isResendAllowed ? 0 : Math.round((resendInterval - diff) / 1000);
|
|
103
|
-
return { isResendAllowed, timeLeft };
|
|
104
|
-
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{{={= =}=}}
|
|
2
2
|
import type { Request as ExpressRequest } from 'express'
|
|
3
|
-
import {
|
|
3
|
+
import type { ProviderId, CreateUserResult, FindAuthWithUserResult } from './utils.js'
|
|
4
4
|
import { prisma } from '../index.js'
|
|
5
|
-
import { Expand } from '
|
|
5
|
+
import type { Expand } from '@wasp.sh/lib-sdk-core'
|
|
6
6
|
|
|
7
7
|
// PUBLIC API
|
|
8
8
|
export type OnBeforeSignupHook = (
|
|
@@ -187,5 +187,8 @@ export type OAuthData = {
|
|
|
187
187
|
{=# enabledProviders.isMicrosoftAuthEnabled =}
|
|
188
188
|
| { providerName: 'microsoft'; tokens: import('arctic').MicrosoftEntraIdTokens }
|
|
189
189
|
{=/ enabledProviders.isMicrosoftAuthEnabled =}
|
|
190
|
+
{=# enabledProviders.isSlackAuthEnabled =}
|
|
191
|
+
| { providerName: 'slack'; tokens: import('arctic').SlackTokens }
|
|
192
|
+
{=/ enabledProviders.isSlackAuthEnabled =}
|
|
190
193
|
| never
|
|
191
194
|
)
|
|
@@ -17,13 +17,13 @@ export {
|
|
|
17
17
|
type EmailProviderData,
|
|
18
18
|
type UsernameProviderData,
|
|
19
19
|
type OAuthProviderData,
|
|
20
|
-
} from '
|
|
20
|
+
} from './utils.js'
|
|
21
21
|
|
|
22
22
|
export {
|
|
23
23
|
ensurePasswordIsPresent,
|
|
24
24
|
ensureValidPassword,
|
|
25
25
|
ensureTokenIsPresent,
|
|
26
|
-
} from '
|
|
26
|
+
} from '@wasp.sh/lib-sdk-core'
|
|
27
27
|
|
|
28
28
|
export type {
|
|
29
29
|
OnBeforeSignupHook,
|
|
@@ -45,5 +45,5 @@ export * from './email/index.js'
|
|
|
45
45
|
{=/ enabledProviders.isEmailAuthEnabled =}
|
|
46
46
|
|
|
47
47
|
{=# enabledProviders.isUsernameAndPasswordAuthEnabled =}
|
|
48
|
-
export
|
|
48
|
+
export { ensureValidUsername } from '@wasp.sh/lib-sdk-core'
|
|
49
49
|
{=/ enabledProviders.isUsernameAndPasswordAuthEnabled =}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{{={= =}=}}
|
|
2
2
|
import { Lucia } from "lucia";
|
|
3
3
|
import { PrismaAdapter } from "@lucia-auth/adapter-prisma";
|
|
4
|
-
import { prisma } from '../
|
|
5
|
-
import
|
|
4
|
+
import { prisma } from '../index.js'
|
|
5
|
+
import type { {= userEntityUpper =} } from "../../entities/index.js"
|
|
6
6
|
|
|
7
7
|
const prismaAdapter = new PrismaAdapter(
|
|
8
8
|
prisma.{= sessionEntityLower =},
|
|
@@ -22,7 +22,7 @@ const prismaAdapter = new PrismaAdapter(
|
|
|
22
22
|
* make fetching the User easier.
|
|
23
23
|
*/
|
|
24
24
|
export const auth = new Lucia<{}, {
|
|
25
|
-
userId: {= userEntityUpper =}['id']
|
|
25
|
+
userId: {= userEntityUpper =}['id'] | null
|
|
26
26
|
}>(prismaAdapter, {
|
|
27
27
|
// Since we are not using cookies, we don't need to set any cookie options.
|
|
28
28
|
// But in the future, if we decide to use cookies, we can set them here.
|
|
@@ -47,7 +47,7 @@ declare module "lucia" {
|
|
|
47
47
|
Lucia: typeof auth;
|
|
48
48
|
DatabaseSessionAttributes: {};
|
|
49
49
|
DatabaseUserAttributes: {
|
|
50
|
-
userId: {= userEntityUpper =}['id']
|
|
50
|
+
userId: {= userEntityUpper =}['id'] | null
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
53
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{{={= =}=}}
|
|
2
2
|
import { Discord } from 'arctic';
|
|
3
3
|
|
|
4
|
-
import { defineProvider } from '
|
|
4
|
+
import { defineProvider } from '@wasp.sh/lib-sdk-core/node';
|
|
5
5
|
import { getRedirectUriForCallback } from '../redirect.js';
|
|
6
6
|
import { env } from '../../../env.js';
|
|
7
7
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Google } from 'arctic';
|
|
3
3
|
|
|
4
4
|
import { getRedirectUriForCallback } from '../redirect.js';
|
|
5
|
-
import { defineProvider } from '
|
|
5
|
+
import { defineProvider } from '@wasp.sh/lib-sdk-core/node';
|
|
6
6
|
import { env } from '../../../env.js';
|
|
7
7
|
|
|
8
8
|
const id = '{= providerId =}';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Keycloak } from 'arctic';
|
|
3
3
|
|
|
4
4
|
import { getRedirectUriForCallback } from '../redirect.js';
|
|
5
|
-
import { defineProvider } from '
|
|
5
|
+
import { defineProvider } from '@wasp.sh/lib-sdk-core/node';
|
|
6
6
|
import { env } from '../../../env.js';
|
|
7
7
|
|
|
8
8
|
const id = '{= providerId =}';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { MicrosoftEntraId } from 'arctic';
|
|
3
3
|
|
|
4
4
|
import { getRedirectUriForCallback } from '../redirect.js';
|
|
5
|
-
import { defineProvider } from '
|
|
5
|
+
import { defineProvider } from '@wasp.sh/lib-sdk-core/node';
|
|
6
6
|
import { env } from '../../../env.js';
|
|
7
7
|
|
|
8
8
|
const id = '{= providerId =}';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{{={= =}=}}
|
|
2
2
|
import { Slack } from 'arctic';
|
|
3
3
|
|
|
4
|
-
import { defineProvider } from '
|
|
4
|
+
import { defineProvider } from '@wasp.sh/lib-sdk-core/node';
|
|
5
5
|
import { getRedirectUriForCallback } from '../redirect.js';
|
|
6
6
|
import { env } from '../../../env.js';
|
|
7
7
|
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{{={= =}=}}
|
|
2
|
-
import { Request as ExpressRequest } from "express";
|
|
2
|
+
import type { Request as ExpressRequest } from "express";
|
|
3
3
|
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
4
|
+
import type { {= userEntityUpper =} } from '../../entities/index.js';
|
|
5
|
+
import type { AuthUserData } from '../../auth/user.js';
|
|
6
6
|
|
|
7
7
|
import { auth } from "./lucia.js";
|
|
8
8
|
import type { Session } from "lucia";
|
|
9
|
-
import { createInvalidCredentialsError } from "
|
|
9
|
+
import { createInvalidCredentialsError } from "@wasp.sh/lib-sdk-core/node";
|
|
10
10
|
|
|
11
|
-
import { prisma } from '../
|
|
12
|
-
import { createAuthUserData } from "
|
|
11
|
+
import { prisma } from '../index.js';
|
|
12
|
+
import { createAuthUserData } from "../../auth/user.js";
|
|
13
13
|
|
|
14
14
|
// PRIVATE API
|
|
15
15
|
// Creates a new session for the `authId` in the database
|
|
@@ -46,6 +46,11 @@ export async function getSessionAndUserFromSessionId(sessionId: string): Promise
|
|
|
46
46
|
return null;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
// Such a session can't identify a user, so we treat it as unauthenticated.
|
|
50
|
+
if (authEntity.userId === null) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
|
|
49
54
|
return {
|
|
50
55
|
session,
|
|
51
56
|
user: await getAuthUserData(authEntity.userId)
|
|
@@ -76,3 +81,9 @@ async function getAuthUserData(userId: {= userEntityUpper =}['id']): Promise<Aut
|
|
|
76
81
|
export function invalidateSession(sessionId: string): Promise<void> {
|
|
77
82
|
return auth.invalidateSession(sessionId);
|
|
78
83
|
}
|
|
84
|
+
|
|
85
|
+
// PRIVATE API
|
|
86
|
+
// Invalidates all sessions belonging to the `authId` in the database
|
|
87
|
+
export function invalidateAllSessionsForAuthId(authId: string): Promise<void> {
|
|
88
|
+
return auth.invalidateUserSessions(authId);
|
|
89
|
+
}
|