@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,11 +5,11 @@ export { default as config } from './config.js'
|
|
|
5
5
|
// PUBLIC API
|
|
6
6
|
export { default as prisma, type PrismaClient } from './dbClient.js'
|
|
7
7
|
// PUBLIC API
|
|
8
|
-
export {
|
|
8
|
+
export type { ServerSetupFn } from './types/index.js'
|
|
9
9
|
// PUBLIC API
|
|
10
|
-
export { HttpError } from '
|
|
10
|
+
export { HttpError } from '@wasp.sh/lib-sdk-core'
|
|
11
11
|
// PUBLIC API
|
|
12
|
-
export { MiddlewareConfigFn } from './middleware/index.js'
|
|
12
|
+
export type { MiddlewareConfigFn } from './middleware/index.js'
|
|
13
13
|
// PUBLIC API
|
|
14
14
|
export { env } from './env.js'
|
|
15
15
|
|
|
@@ -14,7 +14,7 @@ export type {= typeName =}<Input extends JSONObject, Output extends JSONValue |
|
|
|
14
14
|
|
|
15
15
|
{=# jobSchedule.isDefined =}
|
|
16
16
|
const jobSchedule = {
|
|
17
|
-
cron:
|
|
17
|
+
cron: {=& jobSchedule.cron =},
|
|
18
18
|
{=# jobSchedule.args.isDefined =}
|
|
19
19
|
args: {=& jobSchedule.args.json =},
|
|
20
20
|
{=/ jobSchedule.args.isDefined =}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { PG_BOSS_EXECUTOR_NAME } from '@wasp.sh/lib-sdk-core/node'
|
|
2
|
+
export { PG_BOSS_EXECUTOR_NAME } from '@wasp.sh/lib-sdk-core/node'
|
|
1
3
|
import PgBoss from 'pg-boss'
|
|
2
4
|
import { pgBossStarted } from './pgBoss.js'
|
|
3
|
-
import { Job, SubmittedJob } from '
|
|
5
|
+
import { Job, SubmittedJob } from '@wasp.sh/lib-sdk-core'
|
|
4
6
|
import type { JSONValue, JSONObject } from '../../../../core/serialization/index.js'
|
|
5
|
-
import { PrismaDelegate } from '../../../_types/index.js'
|
|
7
|
+
import type { PrismaDelegate } from '../../../_types/index.js'
|
|
6
8
|
import type { JobFn } from './types.js'
|
|
7
9
|
|
|
8
|
-
export const PG_BOSS_EXECUTOR_NAME = Symbol('PgBoss')
|
|
9
|
-
|
|
10
10
|
type JobSchedule = {
|
|
11
11
|
cron: Parameters<PgBoss['schedule']>[1]
|
|
12
12
|
options: Parameters<PgBoss['schedule']>[3]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { type MiddlewareConfig, type MiddlewareConfigFn } from '@wasp.sh/lib-sdk-core/node'
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
{=! TODO: This will generate multiple import statements even though they're
|
|
6
6
|
importing symbols from the same file. We should improve our importing machinery
|
|
7
7
|
to support multiple imports from the same file =}
|
|
8
|
-
import { prisma } from '../../index
|
|
8
|
+
import { prisma } from '../../index'
|
|
9
9
|
import {
|
|
10
10
|
type UnauthenticatedOperationFor,
|
|
11
11
|
createUnauthenticatedOperation,
|
|
@@ -13,25 +13,31 @@ import {
|
|
|
13
13
|
type AuthenticatedOperationFor,
|
|
14
14
|
createAuthenticatedOperation,
|
|
15
15
|
{=/ isAuthEnabled =}
|
|
16
|
-
} from '../wrappers
|
|
16
|
+
} from '../wrappers'
|
|
17
|
+
import type { FromRegisterPath } from '../../../types/register'
|
|
18
|
+
import type {
|
|
19
|
+
{=# operations =}
|
|
20
|
+
{= genericOperationDefinitionTypeName =},
|
|
21
|
+
{=/ operations =}
|
|
22
|
+
} from './types'
|
|
17
23
|
{=# operations =}
|
|
18
24
|
{=& jsFn.importStatement =}
|
|
19
25
|
{=/ operations =}
|
|
20
26
|
{=# operations =}
|
|
21
27
|
|
|
22
28
|
// PRIVATE API
|
|
23
|
-
export type {=
|
|
29
|
+
export type {= registeredOperationTypeName =} = FromRegisterPath<['operations', '{= operationName =}'], {= genericOperationDefinitionTypeName =}>
|
|
24
30
|
|
|
25
31
|
// PUBLIC API
|
|
26
32
|
{=# usesAuth =}
|
|
27
|
-
export const {= operationName =}: AuthenticatedOperationFor<{=
|
|
28
|
-
createAuthenticatedOperation(
|
|
33
|
+
export const {= operationName =}: AuthenticatedOperationFor<{= registeredOperationTypeName =}> =
|
|
34
|
+
createAuthenticatedOperation<{= registeredOperationTypeName =}>(
|
|
29
35
|
{=/ usesAuth =}
|
|
30
36
|
{=^ usesAuth =}
|
|
31
|
-
export const {= operationName =}: UnauthenticatedOperationFor<{=
|
|
32
|
-
createUnauthenticatedOperation(
|
|
37
|
+
export const {= operationName =}: UnauthenticatedOperationFor<{= registeredOperationTypeName =}> =
|
|
38
|
+
createUnauthenticatedOperation<{= registeredOperationTypeName =}>(
|
|
33
39
|
{=/ usesAuth =}
|
|
34
|
-
{= jsFn.importIdentifier =},
|
|
40
|
+
() => {= jsFn.importIdentifier =},
|
|
35
41
|
{
|
|
36
42
|
{=# entities =}
|
|
37
43
|
{= name =}: prisma.{= prismaIdentifier =},
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{{={= =}=}}
|
|
2
2
|
{=! TODO: This template is exactly the same at the moment as one for query
|
|
3
3
|
types, consider whether it makes sense to address this in the future. =}
|
|
4
|
-
import {
|
|
4
|
+
import type {
|
|
5
5
|
{=# allEntities =}
|
|
6
|
-
|
|
6
|
+
{= internalTypeName =},
|
|
7
7
|
{=/ allEntities =}
|
|
8
8
|
{=# shouldImportNonAuthenticatedOperation =}
|
|
9
|
-
|
|
9
|
+
UnauthenticatedActionDefinition,
|
|
10
10
|
{=/ shouldImportNonAuthenticatedOperation =}
|
|
11
11
|
{=# shouldImportAuthenticatedOperation =}
|
|
12
|
-
|
|
12
|
+
AuthenticatedActionDefinition,
|
|
13
13
|
{=/ shouldImportAuthenticatedOperation =}
|
|
14
|
-
|
|
14
|
+
Payload,
|
|
15
15
|
} from '../../_types/index.js'
|
|
16
16
|
|
|
17
17
|
{=# operations =}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
{=! TODO: This will generate multiple import statements even though they're
|
|
6
6
|
importing symbols from the same file. We should improve our importing machinery
|
|
7
7
|
to support multiple imports from the same file =}
|
|
8
|
-
import { prisma } from '../../index
|
|
8
|
+
import { prisma } from '../../index'
|
|
9
9
|
import {
|
|
10
10
|
type UnauthenticatedOperationFor,
|
|
11
11
|
createUnauthenticatedOperation,
|
|
@@ -13,25 +13,31 @@ import {
|
|
|
13
13
|
type AuthenticatedOperationFor,
|
|
14
14
|
createAuthenticatedOperation,
|
|
15
15
|
{=/ isAuthEnabled =}
|
|
16
|
-
} from '../wrappers
|
|
16
|
+
} from '../wrappers'
|
|
17
|
+
import type { FromRegisterPath } from '../../../types/register'
|
|
18
|
+
import type {
|
|
19
|
+
{=# operations =}
|
|
20
|
+
{= genericOperationDefinitionTypeName =},
|
|
21
|
+
{=/ operations =}
|
|
22
|
+
} from './types'
|
|
17
23
|
{=# operations =}
|
|
18
24
|
{=& jsFn.importStatement =}
|
|
19
25
|
{=/ operations =}
|
|
20
26
|
{=# operations =}
|
|
21
27
|
|
|
22
28
|
// PRIVATE API
|
|
23
|
-
export type {=
|
|
29
|
+
export type {= registeredOperationTypeName =} = FromRegisterPath<['operations', '{= operationName =}'], {= genericOperationDefinitionTypeName =}>
|
|
24
30
|
|
|
25
31
|
// PUBLIC API
|
|
26
32
|
{=# usesAuth =}
|
|
27
|
-
export const {= operationName =}: AuthenticatedOperationFor<{=
|
|
28
|
-
createAuthenticatedOperation(
|
|
33
|
+
export const {= operationName =}: AuthenticatedOperationFor<{= registeredOperationTypeName =}> =
|
|
34
|
+
createAuthenticatedOperation<{= registeredOperationTypeName =}>(
|
|
29
35
|
{=/ usesAuth =}
|
|
30
36
|
{=^ usesAuth =}
|
|
31
|
-
export const {= operationName =}: UnauthenticatedOperationFor<{=
|
|
32
|
-
createUnauthenticatedOperation(
|
|
37
|
+
export const {= operationName =}: UnauthenticatedOperationFor<{= registeredOperationTypeName =}> =
|
|
38
|
+
createUnauthenticatedOperation<{= registeredOperationTypeName =}>(
|
|
33
39
|
{=/ usesAuth =}
|
|
34
|
-
{= jsFn.importIdentifier =},
|
|
40
|
+
() => {= jsFn.importIdentifier =},
|
|
35
41
|
{
|
|
36
42
|
{=# entities =}
|
|
37
43
|
{= name =}: prisma.{= prismaIdentifier =},
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
{=! TODO: This template is exactly the same at the moment as one for action
|
|
3
3
|
types, consider whether it makes sense to address this in the future. =}
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import type {
|
|
6
6
|
{=# allEntities =}
|
|
7
|
-
|
|
7
|
+
{= internalTypeName =},
|
|
8
8
|
{=/ allEntities =}
|
|
9
9
|
{=# shouldImportNonAuthenticatedOperation =}
|
|
10
|
-
|
|
10
|
+
UnauthenticatedQueryDefinition,
|
|
11
11
|
{=/ shouldImportNonAuthenticatedOperation =}
|
|
12
12
|
{=# shouldImportAuthenticatedOperation =}
|
|
13
|
-
|
|
13
|
+
AuthenticatedQueryDefinition,
|
|
14
14
|
{=/ shouldImportAuthenticatedOperation =}
|
|
15
|
-
|
|
15
|
+
Payload,
|
|
16
16
|
} from '../../_types/index.js'
|
|
17
17
|
|
|
18
18
|
{=# operations =}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{{={= =}=}}
|
|
2
|
-
import { IfAny, _Awaited,
|
|
2
|
+
import type { IfAny, _Awaited, _Parameters, _ReturnType } from '@wasp.sh/lib-sdk-core'
|
|
3
3
|
|
|
4
4
|
{=# isAuthEnabled =}
|
|
5
|
-
import {
|
|
5
|
+
import type { AuthUser } from '../../auth/user.js'
|
|
6
6
|
{=/ isAuthEnabled =}
|
|
7
|
-
import {
|
|
7
|
+
import type {
|
|
8
8
|
_Entity,
|
|
9
9
|
{=# isAuthEnabled =}
|
|
10
10
|
AuthenticatedOperationDefinition,
|
|
@@ -39,19 +39,43 @@ export type UnauthenticatedOperationFor<
|
|
|
39
39
|
/**
|
|
40
40
|
* Creates the server-side API for an unauthenticated operation.
|
|
41
41
|
*
|
|
42
|
+
* The operation definition is accepted through a getter instead of directly to
|
|
43
|
+
* prevent "use before initialization" errors. When a user's operation definition
|
|
44
|
+
* imports another operation's server-side API (i.e., imports from `"wasp/server/operations"`),
|
|
45
|
+
* that module and ours form a cycle. Depending on which side of the cycle the
|
|
46
|
+
* bundler enters first, it can emit our {@link createUnauthenticatedOperation}
|
|
47
|
+
* wrapper calls above the user's operation definitions:
|
|
48
|
+
* ```ts
|
|
49
|
+
* function badCreateOperation(fn: Function) {
|
|
50
|
+
* return () => fn();
|
|
51
|
+
* }
|
|
52
|
+
* const badServerOperation = badCreateOperation(someUserOperation);
|
|
53
|
+
* ^! ReferenceError: Cannot access 'someUserOperation' before initialization
|
|
54
|
+
* const someUserOperation = () => 1;
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* The getter defers the read until the operation is called, by which point every
|
|
58
|
+
* module is initialized:
|
|
59
|
+
* ```ts
|
|
60
|
+
* function goodCreateOperation(fn: () => Function) {
|
|
61
|
+
* return () => fn()();
|
|
62
|
+
* }
|
|
63
|
+
* const goodServerOperation = goodCreateOperation(() => someUserOperation);
|
|
64
|
+
* const someUserOperation = () => 1;
|
|
65
|
+
* ```
|
|
42
66
|
* @template OperationDefinition The type of the unauthenticated operation's definition.
|
|
43
|
-
* @param
|
|
44
|
-
* @param entities The unauthenticated operation's entity map
|
|
67
|
+
* @param getUserOperation Returns the unauthenticated operation's definition.
|
|
68
|
+
* @param entities The unauthenticated operation's entity map.
|
|
45
69
|
* @returns The server-side API for the provided unauthenticated operation.
|
|
46
70
|
*/
|
|
47
71
|
export function createUnauthenticatedOperation<
|
|
48
72
|
OperationDefinition extends GenericUnauthenticatedOperationDefinition
|
|
49
73
|
>(
|
|
50
|
-
|
|
74
|
+
getUserOperation: () => OperationDefinition,
|
|
51
75
|
entities: EntityMapFor<OperationDefinition>
|
|
52
76
|
): UnauthenticatedOperationFor<OperationDefinition> {
|
|
53
77
|
async function operation(payload: Parameters<OperationDefinition>[0]) {
|
|
54
|
-
return
|
|
78
|
+
return getUserOperation()(payload, {
|
|
55
79
|
entities,
|
|
56
80
|
})
|
|
57
81
|
}
|
|
@@ -93,16 +117,18 @@ export type AuthenticatedOperationContext = { user: AuthUser }
|
|
|
93
117
|
// PRIVATE API (used in SDK)
|
|
94
118
|
/**
|
|
95
119
|
* Creates the server-side API for an authenticated operation.
|
|
96
|
-
*
|
|
120
|
+
* For an explanation of why we accept an operation definition getter instead
|
|
121
|
+
* of the value directly, check {@link createUnauthenticatedOperation}.
|
|
122
|
+
*
|
|
97
123
|
* @template OperationDefinition The type of the authenticated operation's definition.
|
|
98
|
-
* @param
|
|
99
|
-
* @param entities The authenticated operation's entity map
|
|
124
|
+
* @param getUserOperation Returns the authenticated operation's definition.
|
|
125
|
+
* @param entities The authenticated operation's entity map.
|
|
100
126
|
* @returns The server-side API for the provided authenticated operation.
|
|
101
127
|
*/
|
|
102
128
|
export function createAuthenticatedOperation<
|
|
103
129
|
OperationDefinition extends GenericAuthenticatedOperationDefinition
|
|
104
130
|
>(
|
|
105
|
-
|
|
131
|
+
getUserOperation: () => OperationDefinition,
|
|
106
132
|
entities: EntityMapFor<OperationDefinition>
|
|
107
133
|
): AuthenticatedOperationFor<OperationDefinition> {
|
|
108
134
|
async function operation(...args: AuthenticatedOperationArgsFor<OperationDefinition>) {
|
|
@@ -113,20 +139,20 @@ export function createAuthenticatedOperation<
|
|
|
113
139
|
throw new Error(`
|
|
114
140
|
You called the operation without arguments, which is a mistake.
|
|
115
141
|
Check your definition and read the docs to understand what you need to send:
|
|
116
|
-
https://wasp.sh/docs/data
|
|
142
|
+
https://wasp.sh/docs/features/data/operations/overview
|
|
117
143
|
`
|
|
118
144
|
)
|
|
119
145
|
} else if (includesPayload(args)) {
|
|
120
146
|
// Two arguments sent -> the first argument is the payload, the second is the context.
|
|
121
147
|
const [payload, context] = args
|
|
122
|
-
return
|
|
148
|
+
return getUserOperation()(payload as Parameters<OperationDefinition>[0], {
|
|
123
149
|
...context,
|
|
124
150
|
entities,
|
|
125
151
|
})
|
|
126
152
|
} else {
|
|
127
153
|
// One argument sent -> the first and only argument is the user.
|
|
128
154
|
const [context] = args
|
|
129
|
-
return
|
|
155
|
+
return getUserOperation()(undefined as Parameters<OperationDefinition>[0], {
|
|
130
156
|
...context,
|
|
131
157
|
entities,
|
|
132
158
|
})
|
|
@@ -1,11 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { Server } from 'http'
|
|
3
|
-
|
|
4
|
-
// PUBLIC API
|
|
5
|
-
export type ServerSetupFn = (context: ServerSetupFnContext) => Promise<void>
|
|
6
|
-
|
|
7
|
-
// PRIVATE API (server)
|
|
8
|
-
export type ServerSetupFnContext = {
|
|
9
|
-
app: Application,
|
|
10
|
-
server: Server,
|
|
11
|
-
}
|
|
1
|
+
export { type ServerSetupFn, type ServerSetupFnContext } from '@wasp.sh/lib-sdk-core/node'
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{{={= =}=}}
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
export { defineHandler, redirect } from '@wasp.sh/lib-sdk-core/node'
|
|
4
|
+
|
|
5
|
+
export { sleep } from '@wasp.sh/lib-sdk-core'
|
|
3
6
|
|
|
4
7
|
{=# isAuthEnabled =}
|
|
5
|
-
import {
|
|
8
|
+
import type { AuthUserData } from '../auth/user.js'
|
|
6
9
|
{=/ isAuthEnabled =}
|
|
7
10
|
|
|
8
11
|
// This is explicitly how Express expects extensions to their
|
|
@@ -18,21 +21,3 @@ declare global {
|
|
|
18
21
|
}
|
|
19
22
|
}
|
|
20
23
|
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Simple helper to give the correct types for Express handlers.
|
|
24
|
-
* We define it in the same file as our extension to Request
|
|
25
|
-
* so that it is picked up by TypeScript.
|
|
26
|
-
*/
|
|
27
|
-
export const defineHandler = <T extends RequestHandler>(
|
|
28
|
-
middleware: T
|
|
29
|
-
): T => middleware
|
|
30
|
-
|
|
31
|
-
export const sleep = (ms: number): Promise<unknown> => new Promise((r) => setTimeout(r, ms))
|
|
32
|
-
|
|
33
|
-
export function redirect(res: Response, redirectUri: string) {
|
|
34
|
-
return res
|
|
35
|
-
.status(302)
|
|
36
|
-
.setHeader("Location", redirectUri)
|
|
37
|
-
.end();
|
|
38
|
-
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{{={= =}=}}
|
|
2
2
|
|
|
3
|
-
import { Server } from 'socket.io'
|
|
4
|
-
import { EventsMap, DefaultEventsMap } from '@socket.io/component-emitter'
|
|
3
|
+
import type { Server } from 'socket.io'
|
|
4
|
+
import type { EventsMap, DefaultEventsMap } from '@socket.io/component-emitter'
|
|
5
5
|
|
|
6
|
-
import { prisma } from '../index
|
|
6
|
+
import type { prisma } from '../index'
|
|
7
|
+
import type { FromRegister } from '../../types/register'
|
|
7
8
|
{=# isAuthEnabled =}
|
|
8
|
-
import {
|
|
9
|
+
import type { AuthUser } from '../../auth/user.js'
|
|
9
10
|
{=/ isAuthEnabled =}
|
|
10
11
|
|
|
11
|
-
{=& userWebSocketFn.importStatement =}
|
|
12
12
|
|
|
13
13
|
// Public API
|
|
14
14
|
export type WebSocketDefinition<
|
|
@@ -40,14 +40,14 @@ export interface WaspSocketData {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
// PRIVATE API (framework)
|
|
43
|
-
export type ServerType = Parameters<
|
|
43
|
+
export type ServerType = Parameters<RegisteredWebSocketFn>[0]
|
|
44
44
|
|
|
45
45
|
// PRIVATE API (sdk)
|
|
46
46
|
export type ClientToServerEvents = Events[0]
|
|
47
47
|
// PRIVATE API (sdk)
|
|
48
48
|
export type ServerToClientEvents = Events[1]
|
|
49
49
|
|
|
50
|
-
type
|
|
50
|
+
type RegisteredWebSocketFn = FromRegister<'webSocketFn', WebSocketDefinition>;
|
|
51
51
|
type Events = ServerType extends Server<
|
|
52
52
|
infer ClientToServerEvents,
|
|
53
53
|
infer ServerToClientEvents
|
|
@@ -15,25 +15,14 @@
|
|
|
15
15
|
"outDir": "dist",
|
|
16
16
|
|
|
17
17
|
/* Strictness and type checking */
|
|
18
|
-
/*
|
|
19
|
-
User code was compiled using `"strict": true`, so we know we can use it
|
|
20
|
-
here as well. We override some of strict's options because parts of the SDK
|
|
21
|
-
code don't respect them. This only makes the SDK ruleset more permissive than
|
|
22
|
-
the user's ruleset. Therefore, we can sefely include users code inside the
|
|
23
|
-
SDK without casuing errors during the SDK build step.
|
|
24
|
-
Reference: https://github.com/wasp-lang/wasp/issues/1938
|
|
25
|
-
*/
|
|
26
18
|
"strict": true,
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
*/
|
|
35
|
-
"noUncheckedIndexedAccess": false,
|
|
36
|
-
"noImplicitOverride": false,
|
|
19
|
+
"noUncheckedIndexedAccess": true,
|
|
20
|
+
"noImplicitOverride": true,
|
|
21
|
+
"noFallthroughCasesInSwitch": true,
|
|
22
|
+
"noImplicitReturns": true,
|
|
23
|
+
"noUnusedParameters": true,
|
|
24
|
+
"allowUnreachableCode": false,
|
|
25
|
+
"allowUnusedLabels": false,
|
|
37
26
|
|
|
38
27
|
/* DX */
|
|
39
28
|
"declaration": true, // Allows users to consume the SDK as a library, enables autocomplete
|
|
@@ -43,37 +32,22 @@
|
|
|
43
32
|
/* Modules */
|
|
44
33
|
"module": "esnext",
|
|
45
34
|
"esModuleInterop": true,
|
|
46
|
-
|
|
47
|
-
//
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
server code and web app code (which directly import the user code).
|
|
54
|
-
- The SDK code must disable it because parts of the SDK code rely on
|
|
55
|
-
such features. Since we build the SDK with TSC before bundling it,
|
|
56
|
-
these features don't cause problems.
|
|
57
|
-
More details in https://github.com/wasp-lang/wasp/issues/2150
|
|
58
|
-
*/
|
|
59
|
-
"isolatedModules": false,
|
|
60
|
-
// `verbatimModuleSyntax` is disabled because we don't yet want to
|
|
61
|
-
// force user code into using `type` imports.
|
|
62
|
-
"verbatimModuleSyntax": false,
|
|
35
|
+
"resolveJsonModule": true,
|
|
36
|
+
// `isolatedModules` rejects code that single-file transpilers (like esbuild)
|
|
37
|
+
// can't handle. The SDK gets bundled, so it must not rely on such code.
|
|
38
|
+
"isolatedModules": true,
|
|
39
|
+
// `verbatimModuleSyntax` makes type-only imports explicit, so single-file
|
|
40
|
+
// transpilers can drop them without having to know what they refer to.
|
|
41
|
+
"verbatimModuleSyntax": true,
|
|
63
42
|
"moduleDetection": "force", // Assume all files are modules
|
|
64
43
|
/*
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
These requirements force us to bundle user code and, because we copy user
|
|
70
|
-
code into the SDK code, they force us to bundle the SDK too.
|
|
44
|
+
The SDK code uses extensionless relative imports and imports its own
|
|
45
|
+
modules through the `wasp/*` package exports. TSC emits those imports
|
|
46
|
+
as-is, and only a bundler can resolve them at runtime.
|
|
71
47
|
|
|
72
|
-
|
|
73
|
-
the
|
|
74
|
-
|
|
75
|
-
`tsconfig.json` file must reflect that (which means `moduleResolution:
|
|
76
|
-
bundler`).
|
|
48
|
+
The SDK output is never run directly: it's bundled into the server and
|
|
49
|
+
the client (https://github.com/wasp-lang/wasp/issues/2150), so this
|
|
50
|
+
`tsconfig.json` must resolve modules the way a bundler does.
|
|
77
51
|
*/
|
|
78
52
|
"moduleResolution": "bundler",
|
|
79
53
|
/*
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Register for type augmentation via declaration merging.
|
|
3
|
+
*
|
|
4
|
+
* Declared here to work around stale TypeScript incremental diagnostics
|
|
5
|
+
* when augmenting a re-exported interface.
|
|
6
|
+
* See https://github.com/wasp-lang/wasp/pull/4885.
|
|
7
|
+
*/
|
|
8
|
+
export interface Register {}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Register } from "./index";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Safely reads a value from {@link Register} by following {@link Path}.
|
|
5
|
+
* Returns the registered type, or {@link Fallback} if any step of the path is missing.
|
|
6
|
+
* The path can be of any depth.
|
|
7
|
+
*/
|
|
8
|
+
export type FromRegisterPath<Path extends readonly string[], Fallback> =
|
|
9
|
+
WalkRegisterPath<Register, Path, Fallback>;
|
|
10
|
+
|
|
11
|
+
type WalkRegisterPath<Current, Path extends readonly string[], Fallback> =
|
|
12
|
+
Path extends readonly [infer Key extends string, ...infer Rest extends readonly string[]]
|
|
13
|
+
? Key extends keyof Current
|
|
14
|
+
? WalkRegisterPath<Current[Key], Rest, Fallback>
|
|
15
|
+
: Fallback
|
|
16
|
+
: Current;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Shorthand for reading a top-level {@link Register} value.
|
|
20
|
+
*/
|
|
21
|
+
export type FromRegister<Key extends string, Fallback> = FromRegisterPath<[Key], Fallback>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{{={= =}=}}
|
|
2
|
+
/**
|
|
3
|
+
* Declares the virtual user modules the SDK imports.
|
|
4
|
+
*
|
|
5
|
+
* The types are written as inline `import("...")` types on purpose.
|
|
6
|
+
* Ambient module declarations can't reach another module through a
|
|
7
|
+
* relative import statement (TS2439).
|
|
8
|
+
*/
|
|
9
|
+
{=# virtualUserModules =}
|
|
10
|
+
|
|
11
|
+
declare module {=& virtualModuleId =} {
|
|
12
|
+
{=# isDefaultExport =}
|
|
13
|
+
const _default: {=& declaredType =};
|
|
14
|
+
export default _default;
|
|
15
|
+
{=/ isDefaultExport =}
|
|
16
|
+
{=^ isDefaultExport =}
|
|
17
|
+
export const {=& exportName =}: {=& declaredType =};
|
|
18
|
+
{=/ isDefaultExport =}
|
|
19
|
+
}
|
|
20
|
+
{=/ virtualUserModules =}
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"start": "node --enable-source-maps -r dotenv/config bundle/server.js",
|
|
11
11
|
"bundle-and-start": "npm run bundle && npm run start",
|
|
12
12
|
"watch": "nodemon --exec 'npm run bundle-and-start || exit 1'",
|
|
13
|
-
"db-seed": "
|
|
13
|
+
"bundle-db-seed": "tsc --build && rollup --config rollup.dbSeed.config.js --silent",
|
|
14
|
+
"db-seed": "npm run bundle-db-seed && node --enable-source-maps -r dotenv/config bundle/dbSeed.js",
|
|
14
15
|
"db-migrate-prod": "prisma migrate deploy --schema=../db/schema.prisma",
|
|
15
16
|
"start-production": "{=& startProductionScript =}"
|
|
16
17
|
},
|
|
@@ -1,44 +1,3 @@
|
|
|
1
|
-
{
|
|
2
|
-
import esbuild from 'rollup-plugin-esbuild'
|
|
3
|
-
import resolve from '@rollup/plugin-node-resolve';
|
|
1
|
+
import { createRollupBundle } from "./src/createRollupBundle.js";
|
|
4
2
|
|
|
5
|
-
export default
|
|
6
|
-
createBundle('src/server.ts', 'bundle/server.js'),
|
|
7
|
-
{=# areDbSeedsDefined =}
|
|
8
|
-
createBundle('src/dbSeed.ts', 'bundle/dbSeed.js'),
|
|
9
|
-
{=/ areDbSeedsDefined =}
|
|
10
|
-
]
|
|
11
|
-
|
|
12
|
-
function createBundle(inputFilePath, outputFilePath) {
|
|
13
|
-
return {
|
|
14
|
-
input: inputFilePath,
|
|
15
|
-
output: {
|
|
16
|
-
file: outputFilePath,
|
|
17
|
-
format: 'es',
|
|
18
|
-
sourcemap: true,
|
|
19
|
-
},
|
|
20
|
-
plugins: [
|
|
21
|
-
resolve(),
|
|
22
|
-
esbuild({
|
|
23
|
-
target: 'esnext',
|
|
24
|
-
}),
|
|
25
|
-
],
|
|
26
|
-
// We don't want to bundle any of the node_module deps because we want to
|
|
27
|
-
// keep them as external dependencies.
|
|
28
|
-
external: /node_modules/,
|
|
29
|
-
// 'preserveSymlinks: false' tells Rollup to fully follow symlinks when
|
|
30
|
-
// resolving modules. This is the default option, but we're setting it
|
|
31
|
-
// explicitly because we rely on it.
|
|
32
|
-
//
|
|
33
|
-
// With this set to 'false', the 'wasp' package resolves to
|
|
34
|
-
// '.wasp/out/sdk/wasp' (not 'node_modules/wasp'), preventing Rollup from
|
|
35
|
-
// viewing it as an external dependency and ensuring it gets bundled.
|
|
36
|
-
//
|
|
37
|
-
// We need to bundle 'wasp' to support fully extensionless relative
|
|
38
|
-
// imports. See https://github.com/wasp-lang/wasp/issues/2492 for more
|
|
39
|
-
// details.
|
|
40
|
-
//
|
|
41
|
-
// Source: https://rollupjs.org/configuration-options/#preservesymlinks
|
|
42
|
-
preserveSymlinks: false,
|
|
43
|
-
}
|
|
44
|
-
}
|
|
3
|
+
export default createRollupBundle("src/server.ts", "bundle/server.js");
|
|
@@ -13,7 +13,7 @@ const app = express()
|
|
|
13
13
|
app.use('/', indexRouter)
|
|
14
14
|
|
|
15
15
|
// Custom error handler.
|
|
16
|
-
app.use((err, _req, res, next) => {
|
|
16
|
+
app.use(/** @type {import('express').ErrorRequestHandler} */ ((err, _req, res, next) => {
|
|
17
17
|
// As by expressjs documentation, when the headers have already
|
|
18
18
|
// been sent to the client, we must delegate to the default error handler.
|
|
19
19
|
if (res.headersSent) { return next(err) }
|
|
@@ -31,6 +31,6 @@ app.use((err, _req, res, next) => {
|
|
|
31
31
|
// In development it will also share the error stack though, which is useful.
|
|
32
32
|
// If the user wants to put more information about the error into the response, they should use HttpError.
|
|
33
33
|
return next(err)
|
|
34
|
-
})
|
|
34
|
+
}))
|
|
35
35
|
|
|
36
36
|
export default app
|