@wasp.sh/wasp-cli-darwin-arm64-unknown 0.24.0 → 0.25.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/basic/main.wasp.ts +1 -1
- package/data/Cli/starters/basic/package.json +5 -5
- package/data/Cli/starters/basic/src/App.css +12 -11
- package/data/Cli/starters/basic/src/assets/wasp-logo-rounded.svg +1 -0
- package/data/Cli/starters/basic/src/shared/components/Header.tsx +3 -3
- package/data/Cli/starters/minimal/main.wasp.ts +1 -1
- package/data/Cli/starters/minimal/package.json +4 -4
- package/data/Cli/starters/minimal/src/Main.css +5 -5
- package/data/Cli/starters/minimal/src/MainPage.tsx +2 -2
- package/data/Cli/starters/minimal/src/assets/wasp-logo-rounded.svg +1 -0
- package/data/Cli/starters/skeleton/public/favicon.ico +0 -0
- package/data/Cli/starters/skeleton/tsconfig.src.json +2 -1
- package/data/Cli/starters/skeleton/tsconfig.wasp.json +3 -2
- package/data/Generator/libs/auth/wasp.sh-lib-auth-0.25.0.tgz +0 -0
- package/data/Generator/libs/vite-ssr/wasp.sh-lib-vite-ssr-0.25.0.tgz +0 -0
- package/data/Generator/templates/sdk/wasp/api/index.ts +2 -2
- package/data/Generator/templates/sdk/wasp/auth/email/actions/login.ts +1 -1
- package/data/Generator/templates/sdk/wasp/auth/email/actions/passwordReset.ts +1 -1
- package/data/Generator/templates/sdk/wasp/auth/email/actions/signup.ts +1 -1
- package/data/Generator/templates/sdk/wasp/auth/email/actions/verifyEmail.ts +1 -1
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/auth-styles.css +2 -2
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/common/LoginSignupForm.tsx +1 -1
- package/data/Generator/templates/sdk/wasp/auth/helpers/_Provider.tsx +1 -1
- package/data/Generator/templates/sdk/wasp/auth/helpers/user.ts +1 -1
- package/data/Generator/templates/sdk/wasp/auth/jwt.ts +1 -1
- package/data/Generator/templates/sdk/wasp/auth/logout.ts +1 -1
- package/data/Generator/templates/sdk/wasp/auth/lucia.ts +2 -2
- package/data/Generator/templates/sdk/wasp/auth/providers/types.ts +1 -1
- package/data/Generator/templates/sdk/wasp/auth/session.ts +1 -1
- package/data/Generator/templates/sdk/wasp/auth/types.ts +1 -1
- package/data/Generator/templates/sdk/wasp/auth/useAuth.ts +5 -5
- package/data/Generator/templates/sdk/wasp/auth/username/actions/login.ts +1 -1
- package/data/Generator/templates/sdk/wasp/auth/username/actions/signup.ts +1 -1
- package/data/Generator/templates/sdk/wasp/auth/utils.ts +3 -3
- package/data/Generator/templates/sdk/wasp/auth/validation.ts +1 -1
- package/data/Generator/templates/sdk/wasp/client/app/layout.tsx +55 -46
- package/data/Generator/templates/sdk/wasp/client/app/router.tsx +2 -5
- package/data/Generator/templates/sdk/wasp/client/crud/_crud.ts +2 -2
- package/data/Generator/templates/sdk/wasp/client/operations/actions/core.ts +1 -1
- package/data/Generator/templates/sdk/wasp/client/operations/index.ts +5 -0
- package/data/Generator/templates/sdk/wasp/client/operations/internal/index.ts +3 -3
- package/data/Generator/templates/sdk/wasp/client/operations/internal/resources.js +4 -2
- package/data/Generator/templates/sdk/wasp/client/operations/queries/core.ts +2 -2
- package/data/Generator/templates/sdk/wasp/client/operations/rpc.ts +2 -2
- package/data/Generator/templates/sdk/wasp/client/test/vitest/helpers.tsx +3 -4
- package/data/Generator/templates/sdk/wasp/client/vite/plugins/validateEnv.ts +14 -8
- package/data/Generator/templates/sdk/wasp/client/vite/virtual-files/files/client-entry.tsx +31 -11
- package/data/Generator/templates/sdk/wasp/client/vite/virtual-files/files/routes.tsx +26 -20
- package/data/Generator/templates/sdk/wasp/client/vite/virtual-files/files/ssr-entry.tsx +29 -24
- package/data/Generator/templates/sdk/wasp/client/vite/virtual-files/resolver.ts +12 -5
- package/data/Generator/templates/sdk/wasp/client/webSocket/WebSocketProvider.tsx +4 -4
- package/data/Generator/templates/sdk/wasp/client/webSocket/index.ts +1 -1
- package/data/Generator/templates/sdk/wasp/core/auth.ts +3 -3
- package/data/Generator/templates/sdk/wasp/env/validation.ts +1 -1
- package/data/Generator/templates/sdk/wasp/package.json +2 -42
- package/data/Generator/templates/sdk/wasp/serialization/index.ts +11 -0
- package/data/Generator/templates/sdk/wasp/server/_types/index.ts +6 -6
- package/data/Generator/templates/sdk/wasp/server/_types/taggedEntities.ts +1 -1
- package/data/Generator/templates/sdk/wasp/server/auth/email/utils.ts +6 -6
- package/data/Generator/templates/sdk/wasp/server/crud/_operationTypes.ts +2 -2
- package/data/Generator/templates/sdk/wasp/server/email/core/index.ts +4 -0
- package/data/Generator/templates/sdk/wasp/server/email/core/providers/dummy.ts +1 -1
- package/data/Generator/templates/sdk/wasp/server/email/core/providers/resend.ts +31 -0
- package/data/Generator/templates/sdk/wasp/server/email/core/types.ts +7 -1
- package/data/Generator/templates/sdk/wasp/server/email/index.ts +6 -0
- package/data/Generator/templates/sdk/wasp/server/env.ts +5 -0
- package/data/Generator/templates/sdk/wasp/server/jobs/_job.ts +2 -2
- package/data/Generator/templates/sdk/wasp/server/jobs/core/pgBoss/pgBossJob.ts +3 -3
- package/data/Generator/templates/sdk/wasp/server/jobs/core/pgBoss/types.ts +2 -2
- package/data/Generator/templates/sdk/wasp/server/operations/actions/index.ts +1 -1
- package/data/Generator/templates/sdk/wasp/server/operations/actions/types.ts +2 -2
- package/data/Generator/templates/sdk/wasp/server/operations/queries/index.ts +1 -1
- package/data/Generator/templates/sdk/wasp/server/operations/queries/types.ts +2 -2
- package/data/Generator/templates/sdk/wasp/server/operations/wrappers.ts +1 -1
- package/data/Generator/templates/sdk/wasp/server/webSocket/index.ts +2 -3
- package/data/Generator/templates/sdk/wasp/tsconfig.json +1 -0
- package/data/Generator/templates/server/tsconfig.json +2 -1
- package/data/packages/deploy/package-lock.json +2015 -2285
- package/data/packages/deploy/package.json +7 -6
- package/data/packages/prisma/package-lock.json +1730 -2131
- package/data/packages/prisma/package.json +6 -6
- package/data/packages/spec/dist/__tests__/spec/appAnalyzer.unit.test.js +4 -4
- package/data/packages/spec/dist/__tests__/spec/mapApp.unit.test.js +161 -129
- package/data/packages/spec/dist/__tests__/spec/normalizePrerender.unit.test.d.ts +2 -0
- package/data/packages/spec/dist/__tests__/spec/normalizePrerender.unit.test.d.ts.map +1 -0
- package/data/packages/spec/dist/__tests__/spec/normalizePrerender.unit.test.js +15 -0
- package/data/packages/spec/dist/__tests__/spec/refObject.unit.test.js +2 -2
- package/data/packages/spec/dist/__tests__/spec/refObjectPath.unit.test.js +3 -3
- package/data/packages/spec/dist/__tests__/spec-pipeline/pipeline.integration.test.js +38 -7
- package/data/packages/spec/dist/__tests__/spec-pipeline/transformWaspTsSpecFile/imports.unit.test.js +5 -5
- package/data/packages/spec/dist/__tests__/spec-pipeline/transformWaspTsSpecFile/refHelper.unit.test.js +2 -2
- package/data/packages/spec/dist/src/appSpec.d.ts +2 -2
- package/data/packages/spec/dist/src/appSpec.d.ts.map +1 -1
- package/data/packages/spec/dist/src/normalizePrerender.d.ts +11 -0
- package/data/packages/spec/dist/src/normalizePrerender.d.ts.map +1 -0
- package/data/packages/spec/dist/src/normalizePrerender.js +18 -0
- package/data/packages/spec/dist/src/run.js +2 -2
- package/data/packages/spec/dist/src/spec/appAnalyzer.js +5 -5
- package/data/packages/spec/dist/src/spec/mapper/app.d.ts +17 -0
- package/data/packages/spec/dist/src/spec/mapper/app.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec/mapper/app.js +119 -0
- package/data/packages/spec/dist/src/spec/mapper/context.d.ts +19 -0
- package/data/packages/spec/dist/src/spec/mapper/context.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec/mapper/context.js +65 -0
- package/data/packages/spec/dist/src/spec/mapper/index.d.ts +7 -0
- package/data/packages/spec/dist/src/spec/mapper/index.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec/mapper/index.js +20 -0
- package/data/packages/spec/dist/src/spec/mapper/specElements.d.ts +28 -0
- package/data/packages/spec/dist/src/spec/mapper/specElements.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec/mapper/specElements.js +162 -0
- package/data/packages/spec/dist/src/spec/publicApi/constructors.d.ts +54 -13
- package/data/packages/spec/dist/src/spec/publicApi/constructors.d.ts.map +1 -1
- package/data/packages/spec/dist/src/spec/publicApi/constructors.js +10 -7
- package/data/packages/spec/dist/src/spec/publicApi/index.d.ts +2 -0
- package/data/packages/spec/dist/src/spec/publicApi/index.d.ts.map +1 -1
- package/data/packages/spec/dist/src/spec/publicApi/index.js +1 -0
- package/data/packages/spec/dist/src/spec/publicApi/waspSpec.d.ts +23 -10
- package/data/packages/spec/dist/src/spec/publicApi/waspSpec.d.ts.map +1 -1
- package/data/packages/spec/dist/src/spec/refObject.js +4 -4
- package/data/packages/spec/dist/src/spec/refObjectPath.js +2 -2
- package/data/packages/spec/dist/src/spec/waspSpecUserError.d.ts +31 -0
- package/data/packages/spec/dist/src/spec/waspSpecUserError.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec/waspSpecUserError.js +30 -0
- package/data/packages/spec/dist/src/spec-pipeline/loadWaspTsSpec.d.ts.map +1 -1
- package/data/packages/spec/dist/src/spec-pipeline/loadWaspTsSpec.js +18 -15
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/apply.js +2 -2
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/check.js +2 -2
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/plan.js +2 -2
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/check.js +2 -2
- package/data/packages/spec/dist/src/spec-pipeline/typecheckPlugin/index.js +2 -2
- package/data/packages/spec/package-lock.json +189 -169
- package/data/packages/spec/package.json +30 -7
- package/data/packages/studio/dist/public/assets/Flow-CyIU6UP_.js +26 -0
- package/data/packages/studio/dist/public/assets/dist-CttM53IC.js +1 -0
- package/data/packages/studio/dist/public/assets/index-Cb2AqsRv.js +20 -0
- package/data/packages/studio/dist/public/assets/index-Cq-JJ-zI.css +1 -0
- package/data/packages/studio/dist/public/index.html +2 -2
- package/data/packages/studio/package-lock.json +6 -6
- package/data/packages/studio/package.json +2 -2
- package/data/packages/ts-inspect/package-lock.json +1918 -2142
- package/data/packages/ts-inspect/package.json +6 -6
- package/package.json +1 -1
- package/wasp-bin +0 -0
- package/data/Cli/starters/basic/src/assets/logo.svg +0 -1
- package/data/Cli/starters/minimal/src/assets/logo.svg +0 -1
- package/data/Cli/starters/skeleton/public/.gitkeep +0 -0
- package/data/Generator/libs/auth/wasp.sh-lib-auth-0.24.0.tgz +0 -0
- package/data/Generator/libs/vite-ssr/wasp.sh-lib-vite-ssr-0.24.0.tgz +0 -0
- package/data/Generator/templates/sdk/wasp/client/app/hooks/useIsClient.ts +0 -16
- package/data/packages/spec/dist/__tests__/legacy/appAnalyzer.unit.test.d.ts +0 -2
- package/data/packages/spec/dist/__tests__/legacy/appAnalyzer.unit.test.d.ts.map +0 -1
- package/data/packages/spec/dist/__tests__/legacy/appAnalyzer.unit.test.js +0 -72
- package/data/packages/spec/dist/__tests__/legacy/mapTsAppSpecToAppSpecDecls.integration.test.d.ts +0 -2
- package/data/packages/spec/dist/__tests__/legacy/mapTsAppSpecToAppSpecDecls.integration.test.d.ts.map +0 -1
- package/data/packages/spec/dist/__tests__/legacy/mapTsAppSpecToAppSpecDecls.integration.test.js +0 -126
- package/data/packages/spec/dist/__tests__/legacy/mapTsAppSpecToAppSpecDecls.unit.test.d.ts +0 -2
- package/data/packages/spec/dist/__tests__/legacy/mapTsAppSpecToAppSpecDecls.unit.test.d.ts.map +0 -1
- package/data/packages/spec/dist/__tests__/legacy/mapTsAppSpecToAppSpecDecls.unit.test.js +0 -732
- package/data/packages/spec/dist/__tests__/legacy/testFixtures.d.ts +0 -224
- package/data/packages/spec/dist/__tests__/legacy/testFixtures.d.ts.map +0 -1
- package/data/packages/spec/dist/__tests__/legacy/testFixtures.js +0 -659
- package/data/packages/spec/dist/__tests__/legacy/testFixtures.test-d.d.ts +0 -2
- package/data/packages/spec/dist/__tests__/legacy/testFixtures.test-d.d.ts.map +0 -1
- package/data/packages/spec/dist/__tests__/legacy/testFixtures.test-d.js +0 -57
- package/data/packages/spec/dist/src/legacy/_private.d.ts +0 -2
- package/data/packages/spec/dist/src/legacy/_private.d.ts.map +0 -1
- package/data/packages/spec/dist/src/legacy/_private.js +0 -1
- package/data/packages/spec/dist/src/legacy/appAnalyzer.d.ts +0 -16
- package/data/packages/spec/dist/src/legacy/appAnalyzer.d.ts.map +0 -1
- package/data/packages/spec/dist/src/legacy/appAnalyzer.js +0 -34
- package/data/packages/spec/dist/src/legacy/mapTsAppSpecToAppSpecDecls.d.ts +0 -38
- package/data/packages/spec/dist/src/legacy/mapTsAppSpecToAppSpecDecls.d.ts.map +0 -1
- package/data/packages/spec/dist/src/legacy/mapTsAppSpecToAppSpecDecls.js +0 -294
- package/data/packages/spec/dist/src/legacy/publicApi/App.d.ts +0 -24
- package/data/packages/spec/dist/src/legacy/publicApi/App.d.ts.map +0 -1
- package/data/packages/spec/dist/src/legacy/publicApi/App.js +0 -75
- package/data/packages/spec/dist/src/legacy/publicApi/tsAppSpec.d.ts +0 -174
- package/data/packages/spec/dist/src/legacy/publicApi/tsAppSpec.d.ts.map +0 -1
- package/data/packages/spec/dist/src/legacy/publicApi/tsAppSpec.js +0 -1
- package/data/packages/spec/dist/src/spec/mapApp.d.ts +0 -54
- package/data/packages/spec/dist/src/spec/mapApp.d.ts.map +0 -1
- package/data/packages/spec/dist/src/spec/mapApp.js +0 -336
- package/data/packages/spec/dist/src/spec/specUserError.d.ts +0 -9
- package/data/packages/spec/dist/src/spec/specUserError.d.ts.map +0 -1
- package/data/packages/spec/dist/src/spec/specUserError.js +0 -8
- package/data/packages/studio/dist/public/assets/Flow-_d98T2dd.js +0 -26
- package/data/packages/studio/dist/public/assets/index-B6X8EdJH.js +0 -21
- package/data/packages/studio/dist/public/assets/index-CXlD_bzV.js +0 -1
- package/data/packages/studio/dist/public/assets/index-IWX3d-Jz.css +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wasp-prisma",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "Wasp Team",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@types/node": "^22.17.0",
|
|
22
22
|
"@types/tmp": "^0.2.3",
|
|
23
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
24
|
-
"@typescript-eslint/parser": "^
|
|
25
|
-
"eslint": "^8.
|
|
26
|
-
"typescript": "^
|
|
27
|
-
"vitest": "^4.
|
|
23
|
+
"@typescript-eslint/eslint-plugin": "^8.32.1",
|
|
24
|
+
"@typescript-eslint/parser": "^8.32.1",
|
|
25
|
+
"eslint": "^8.57.0",
|
|
26
|
+
"typescript": "^6.0.3",
|
|
27
|
+
"vitest": "^4.1.9"
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { afterEach, describe, expect, test, vi } from "vitest";
|
|
2
2
|
import { loadWaspTsSpecDefaultExport } from "../../src/spec-pipeline/loadWaspTsSpec.js";
|
|
3
3
|
import { analyzeApp } from "../../src/spec/appAnalyzer.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { convertWaspSpecToAppSpec } from "../../src/spec/mapper/index.js";
|
|
5
|
+
import { WaspSpecUserError } from "../../src/spec/waspSpecUserError.js";
|
|
6
6
|
import * as Fixtures from "./testFixtures.js";
|
|
7
7
|
vi.mock("../../src/spec-pipeline/loadWaspTsSpec.js", () => ({
|
|
8
8
|
loadWaspTsSpecDefaultExport: vi.fn(),
|
|
@@ -50,11 +50,11 @@ describe("analyzeApp", () => {
|
|
|
50
50
|
entityNames: entities,
|
|
51
51
|
});
|
|
52
52
|
if (shouldReturnError) {
|
|
53
|
-
await expect(analyze()).rejects.toThrowError(
|
|
53
|
+
await expect(analyze()).rejects.toThrowError(WaspSpecUserError);
|
|
54
54
|
}
|
|
55
55
|
else {
|
|
56
56
|
const result = await analyze();
|
|
57
|
-
const expected =
|
|
57
|
+
const expected = convertWaspSpecToAppSpec(app, {
|
|
58
58
|
entityNames: entities,
|
|
59
59
|
projectRootDir: "/project",
|
|
60
60
|
});
|
|
@@ -1,25 +1,39 @@
|
|
|
1
1
|
import { describe, expect, test } from "vitest";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import { normalizePrerender } from "../../src/normalizePrerender.js";
|
|
3
|
+
import * as AppSpecMapper from "../../src/spec/mapper/app.js";
|
|
4
|
+
import { makeRefParser, } from "../../src/spec/mapper/context.js";
|
|
5
|
+
import { convertWaspSpecToAppSpec } from "../../src/spec/mapper/index.js";
|
|
6
|
+
import * as SpecElementMapper from "../../src/spec/mapper/specElements.js";
|
|
7
|
+
import { api, app, page, query, route, } from "../../src/spec/publicApi/index.js";
|
|
4
8
|
import { getRefObjectDeclarationName, mapRefObject, } from "../../src/spec/refObject.js";
|
|
5
9
|
import * as Fixtures from "./testFixtures.js";
|
|
6
10
|
function mapRefObjectForMockProjectDir(refObject) {
|
|
7
11
|
return mapRefObject(refObject, { projectRootDir: Fixtures.MOCK_PROJECT_DIR });
|
|
8
12
|
}
|
|
9
13
|
function makeMapperContext({ entityNames = [], routeNames = [], } = {}) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
const ctx = {
|
|
15
|
+
resolveEntityRef: makeRefParser("Entity", entityNames),
|
|
16
|
+
resolveRouteRef: makeRefParser("Route", routeNames),
|
|
17
|
+
parseRefObject: mapRefObjectForMockProjectDir,
|
|
18
|
+
// For testing, the individual mapper functions only need the `AppSpec.Ref`.
|
|
19
|
+
collectSpecElement(specElement) {
|
|
20
|
+
const decl = SpecElementMapper.mapSpecElement(specElement, ctx);
|
|
21
|
+
return SpecElementMapper.declToRef(decl);
|
|
22
|
+
},
|
|
14
23
|
};
|
|
24
|
+
return ctx;
|
|
25
|
+
}
|
|
26
|
+
function getSpecElementDeclName(specElement) {
|
|
27
|
+
return SpecElementMapper.mapSpecElement(specElement, makeMapperContext())
|
|
28
|
+
.declName;
|
|
15
29
|
}
|
|
16
30
|
function mapMockApp(app, entityNames) {
|
|
17
|
-
return
|
|
31
|
+
return convertWaspSpecToAppSpec(app, {
|
|
18
32
|
entityNames,
|
|
19
33
|
projectRootDir: Fixtures.MOCK_PROJECT_DIR,
|
|
20
34
|
});
|
|
21
35
|
}
|
|
22
|
-
describe("
|
|
36
|
+
describe("convertWaspSpecToAppSpec", () => {
|
|
23
37
|
test("should map minimal app correctly", () => {
|
|
24
38
|
const entityNames = Fixtures.getEntities("minimal");
|
|
25
39
|
const app = Fixtures.getApp("minimal");
|
|
@@ -89,12 +103,8 @@ describe("mapApp", () => {
|
|
|
89
103
|
entityNames,
|
|
90
104
|
routeNames: [emailVerifyRoute.name, passwordResetRoute.name],
|
|
91
105
|
});
|
|
92
|
-
//
|
|
93
|
-
//
|
|
94
|
-
// higher-level name-derivation system: either a part-agnostic
|
|
95
|
-
// `deriveDeclName(part)`, or a part-specific dispatch (mirroring how we
|
|
96
|
-
// have one mapper per kind). The test should delegate to whatever
|
|
97
|
-
// surfaces.
|
|
106
|
+
// Decls come out in registration order: each `spec` element in listing
|
|
107
|
+
// order, with a route's page registered right before the route itself.
|
|
98
108
|
expect(result).toStrictEqual([
|
|
99
109
|
{
|
|
100
110
|
declType: "App",
|
|
@@ -111,67 +121,23 @@ describe("mapApp", () => {
|
|
|
111
121
|
webSocket: AppSpecMapper.mapWebSocket(webSocket, ctx),
|
|
112
122
|
},
|
|
113
123
|
},
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
declType: "Page",
|
|
126
|
-
declName: getRefObjectDeclarationName(passwordResetRoute.page.component),
|
|
127
|
-
declValue: AppSpecMapper.mapPage(passwordResetRoute.page, ctx),
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
declType: "Route",
|
|
131
|
-
declName: route.name,
|
|
132
|
-
declValue: AppSpecMapper.mapRoute(route),
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
declType: "Route",
|
|
136
|
-
declName: emailVerifyRoute.name,
|
|
137
|
-
declValue: AppSpecMapper.mapRoute(emailVerifyRoute),
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
declType: "Route",
|
|
141
|
-
declName: passwordResetRoute.name,
|
|
142
|
-
declValue: AppSpecMapper.mapRoute(passwordResetRoute),
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
declType: "Query",
|
|
146
|
-
declName: getRefObjectDeclarationName(query.fn),
|
|
147
|
-
declValue: AppSpecMapper.mapQuery(query, ctx),
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
declType: "Api",
|
|
151
|
-
declName: getRefObjectDeclarationName(api.fn),
|
|
152
|
-
declValue: AppSpecMapper.mapApi(api, ctx),
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
declType: "ApiNamespace",
|
|
156
|
-
declName: getRefObjectDeclarationName(apiNamespace.middlewareConfigFn),
|
|
157
|
-
declValue: AppSpecMapper.mapApiNamespace(apiNamespace, ctx),
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
declType: "Job",
|
|
161
|
-
declName: getRefObjectDeclarationName(job.fn),
|
|
162
|
-
declValue: AppSpecMapper.mapJob(job, ctx),
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
declType: "Crud",
|
|
166
|
-
declName: crud.name,
|
|
167
|
-
declValue: AppSpecMapper.mapCrud(crud, ctx),
|
|
168
|
-
},
|
|
124
|
+
SpecElementMapper.mapPageSpec(page, ctx),
|
|
125
|
+
SpecElementMapper.mapRouteSpec(route, ctx),
|
|
126
|
+
SpecElementMapper.mapQuerySpec(query, ctx),
|
|
127
|
+
SpecElementMapper.mapApiSpec(api, ctx),
|
|
128
|
+
SpecElementMapper.mapApiNamespaceSpec(apiNamespace, ctx),
|
|
129
|
+
SpecElementMapper.mapJobSpec(job, ctx),
|
|
130
|
+
SpecElementMapper.mapCrudSpec(crud, ctx),
|
|
131
|
+
SpecElementMapper.mapPageSpec(emailVerifyRoute.page, ctx),
|
|
132
|
+
SpecElementMapper.mapRouteSpec(emailVerifyRoute, ctx),
|
|
133
|
+
SpecElementMapper.mapPageSpec(passwordResetRoute.page, ctx),
|
|
134
|
+
SpecElementMapper.mapRouteSpec(passwordResetRoute, ctx),
|
|
169
135
|
]);
|
|
170
136
|
});
|
|
171
137
|
test("dedups a page referenced explicitly twice", () => {
|
|
172
138
|
const refObject = Fixtures.getRefObject("minimal", "default");
|
|
173
|
-
const pageName = getRefObjectDeclarationName(refObject);
|
|
174
139
|
const page1 = page(refObject);
|
|
140
|
+
const pageName = getSpecElementDeclName(page1);
|
|
175
141
|
const page2 = page(refObject);
|
|
176
142
|
const app = Fixtures.getMinimalAppWithSpec([page1, page2]);
|
|
177
143
|
const decls = mapMockApp(app, []);
|
|
@@ -182,8 +148,8 @@ describe("mapApp", () => {
|
|
|
182
148
|
});
|
|
183
149
|
test("dedups a page referenced via a route shorthand twice", () => {
|
|
184
150
|
const refObject = Fixtures.getRefObject("minimal", "default");
|
|
185
|
-
const pageName = getRefObjectDeclarationName(refObject);
|
|
186
151
|
const page1 = page(refObject);
|
|
152
|
+
const pageName = getSpecElementDeclName(page1);
|
|
187
153
|
const page2 = page(refObject);
|
|
188
154
|
const route1 = route("Route1", "/", page1);
|
|
189
155
|
const route2 = route("Route2", "/", page2);
|
|
@@ -196,8 +162,8 @@ describe("mapApp", () => {
|
|
|
196
162
|
});
|
|
197
163
|
test("dedups a page referenced explicitly and via a route shorthand", () => {
|
|
198
164
|
const refObject = Fixtures.getRefObject("minimal", "default");
|
|
199
|
-
const pageName = getRefObjectDeclarationName(refObject);
|
|
200
165
|
const page1 = page(refObject);
|
|
166
|
+
const pageName = getSpecElementDeclName(page1);
|
|
201
167
|
const page2 = page(refObject);
|
|
202
168
|
const route1 = route("Route1", "/", page2);
|
|
203
169
|
const app = Fixtures.getMinimalAppWithSpec([page1, route1]);
|
|
@@ -209,16 +175,16 @@ describe("mapApp", () => {
|
|
|
209
175
|
});
|
|
210
176
|
test("throws when the same page name is produced with differing configs explicitly", () => {
|
|
211
177
|
const refObject = Fixtures.getRefObject("minimal", "default");
|
|
212
|
-
const pageName = getRefObjectDeclarationName(refObject);
|
|
213
178
|
const page1 = page(refObject);
|
|
179
|
+
const pageName = getSpecElementDeclName(page1);
|
|
214
180
|
const page2 = page(refObject, { authRequired: true });
|
|
215
181
|
const app = Fixtures.getMinimalAppWithSpec([page1, page2]);
|
|
216
182
|
expect(() => mapMockApp(app, [])).toThrow(`Conflicting configurations for the page \`${pageName}\``);
|
|
217
183
|
});
|
|
218
184
|
test("throws when the same page name is produced with differing configs via a route shorthand twice", () => {
|
|
219
185
|
const refObject = Fixtures.getRefObject("minimal", "default");
|
|
220
|
-
const pageName = getRefObjectDeclarationName(refObject);
|
|
221
186
|
const page1 = page(refObject);
|
|
187
|
+
const pageName = getSpecElementDeclName(page1);
|
|
222
188
|
const page2 = page(refObject, { authRequired: true });
|
|
223
189
|
const route1 = route("Route1", "/", page1);
|
|
224
190
|
const route2 = route("Route2", "/", page2);
|
|
@@ -227,14 +193,41 @@ describe("mapApp", () => {
|
|
|
227
193
|
});
|
|
228
194
|
test("throws when the same page name is produced with differing configs explicitly and via a route shorthand", () => {
|
|
229
195
|
const refObject = Fixtures.getRefObject("minimal", "default");
|
|
230
|
-
const pageName = getRefObjectDeclarationName(refObject);
|
|
231
196
|
const page1 = page(refObject);
|
|
197
|
+
const pageName = getSpecElementDeclName(page1);
|
|
232
198
|
const page2 = page(refObject, { authRequired: true });
|
|
233
199
|
const route1 = route("Route2", "/", page2);
|
|
234
200
|
const app = Fixtures.getMinimalAppWithSpec([page1, route1]);
|
|
235
201
|
expect(() => mapMockApp(app, [])).toThrow(`Conflicting configurations for the page \`${pageName}\``);
|
|
236
202
|
});
|
|
237
|
-
|
|
203
|
+
test("allows decls of different types to share a name", () => {
|
|
204
|
+
const refObject = Fixtures.getRefObject("minimal", "named");
|
|
205
|
+
const query1 = query(refObject);
|
|
206
|
+
const api1 = api("GET", "/foo/bar", refObject);
|
|
207
|
+
const app = Fixtures.getMinimalAppWithSpec([query1, api1]);
|
|
208
|
+
const decls = mapMockApp(app, []);
|
|
209
|
+
const declTypes = decls.map((d) => d.declType);
|
|
210
|
+
expect(declTypes).toEqual(["App", "Query", "Api"]);
|
|
211
|
+
expect(getSpecElementDeclName(query1)).toBe(getSpecElementDeclName(api1));
|
|
212
|
+
});
|
|
213
|
+
test("dedups a query listed twice with identical configs", () => {
|
|
214
|
+
const refObject = Fixtures.getRefObject("minimal", "named");
|
|
215
|
+
const query1 = query(refObject);
|
|
216
|
+
const query2 = query(refObject);
|
|
217
|
+
const app = Fixtures.getMinimalAppWithSpec([query1, query2]);
|
|
218
|
+
const decls = mapMockApp(app, []);
|
|
219
|
+
const queryNames = decls
|
|
220
|
+
.filter((d) => d.declType === "Query")
|
|
221
|
+
.map((d) => d.declName);
|
|
222
|
+
expect(queryNames).toEqual([getSpecElementDeclName(query1)]);
|
|
223
|
+
});
|
|
224
|
+
test("throws when two queries share a name with differing configs", () => {
|
|
225
|
+
const refObject = Fixtures.getRefObject("minimal", "named");
|
|
226
|
+
const query1 = query(refObject);
|
|
227
|
+
const query2 = query(refObject, { auth: true });
|
|
228
|
+
const app = Fixtures.getMinimalAppWithSpec([query1, query2]);
|
|
229
|
+
expect(() => mapMockApp(app, [])).toThrow(`Conflicting configurations for the query \`${getSpecElementDeclName(query1)}\``);
|
|
230
|
+
});
|
|
238
231
|
});
|
|
239
232
|
describe("mapPage", () => {
|
|
240
233
|
test("should map minimal config correctly", () => {
|
|
@@ -245,10 +238,14 @@ describe("mapPage", () => {
|
|
|
245
238
|
});
|
|
246
239
|
function testMapPage(page) {
|
|
247
240
|
const ctx = makeMapperContext();
|
|
248
|
-
const result =
|
|
241
|
+
const result = SpecElementMapper.mapPageSpec(page, ctx);
|
|
249
242
|
expect(result).toStrictEqual({
|
|
250
|
-
|
|
251
|
-
|
|
243
|
+
declType: "Page",
|
|
244
|
+
declName: getRefObjectDeclarationName(page.component),
|
|
245
|
+
declValue: {
|
|
246
|
+
component: mapRefObjectForMockProjectDir(page.component),
|
|
247
|
+
authRequired: page.authRequired,
|
|
248
|
+
},
|
|
252
249
|
});
|
|
253
250
|
}
|
|
254
251
|
});
|
|
@@ -259,16 +256,27 @@ describe("mapRoute", () => {
|
|
|
259
256
|
test("should map full config correctly", () => {
|
|
260
257
|
testMapRoute(Fixtures.getRoute("full"));
|
|
261
258
|
});
|
|
259
|
+
test("should expand prerender: true to the route's own path", () => {
|
|
260
|
+
const result = SpecElementMapper.mapRouteSpec(route("LandingRoute", "/landing", Fixtures.getPage("minimal"), {
|
|
261
|
+
prerender: true,
|
|
262
|
+
}), makeMapperContext());
|
|
263
|
+
expect(result.declValue.prerender).toEqual(["/landing"]);
|
|
264
|
+
});
|
|
262
265
|
function testMapRoute(route) {
|
|
263
|
-
const
|
|
266
|
+
const ctx = makeMapperContext();
|
|
267
|
+
const result = SpecElementMapper.mapRouteSpec(route, ctx);
|
|
264
268
|
expect(result).toStrictEqual({
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
+
declType: "Route",
|
|
270
|
+
declName: route.name,
|
|
271
|
+
declValue: {
|
|
272
|
+
path: route.path,
|
|
273
|
+
to: {
|
|
274
|
+
name: getRefObjectDeclarationName(route.page.component),
|
|
275
|
+
declType: "Page",
|
|
276
|
+
},
|
|
277
|
+
prerender: normalizePrerender(route.prerender, route.path),
|
|
278
|
+
lazy: route.lazy,
|
|
269
279
|
},
|
|
270
|
-
prerender: route.prerender,
|
|
271
|
-
lazy: route.lazy,
|
|
272
280
|
});
|
|
273
281
|
}
|
|
274
282
|
});
|
|
@@ -282,15 +290,19 @@ describe("mapQuery", () => {
|
|
|
282
290
|
test("should throw if entity ref is not provided", () => {
|
|
283
291
|
const query = Fixtures.getQuery("full");
|
|
284
292
|
const ctx = makeMapperContext({ entityNames: [] });
|
|
285
|
-
expect(() =>
|
|
293
|
+
expect(() => SpecElementMapper.mapQuerySpec(query, ctx)).toThrow();
|
|
286
294
|
});
|
|
287
295
|
function testMapQuery(query) {
|
|
288
296
|
const ctx = makeMapperContext({ entityNames: query.entities ?? [] });
|
|
289
|
-
const result =
|
|
297
|
+
const result = SpecElementMapper.mapQuerySpec(query, ctx);
|
|
290
298
|
expect(result).toStrictEqual({
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
299
|
+
declType: "Query",
|
|
300
|
+
declName: getRefObjectDeclarationName(query.fn),
|
|
301
|
+
declValue: {
|
|
302
|
+
fn: mapRefObjectForMockProjectDir(query.fn),
|
|
303
|
+
entities: query.entities?.map(ctx.resolveEntityRef),
|
|
304
|
+
auth: query.auth,
|
|
305
|
+
},
|
|
294
306
|
});
|
|
295
307
|
}
|
|
296
308
|
});
|
|
@@ -304,15 +316,19 @@ describe("mapAction", () => {
|
|
|
304
316
|
test("should throw if entity ref is not provided", () => {
|
|
305
317
|
const action = Fixtures.getAction("full");
|
|
306
318
|
const ctx = makeMapperContext({ entityNames: [] });
|
|
307
|
-
expect(() =>
|
|
319
|
+
expect(() => SpecElementMapper.mapActionSpec(action, ctx)).toThrow();
|
|
308
320
|
});
|
|
309
321
|
function testMapAction(action) {
|
|
310
322
|
const ctx = makeMapperContext({ entityNames: action.entities ?? [] });
|
|
311
|
-
const result =
|
|
323
|
+
const result = SpecElementMapper.mapActionSpec(action, ctx);
|
|
312
324
|
expect(result).toStrictEqual({
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
325
|
+
declType: "Action",
|
|
326
|
+
declName: getRefObjectDeclarationName(action.fn),
|
|
327
|
+
declValue: {
|
|
328
|
+
fn: mapRefObjectForMockProjectDir(action.fn),
|
|
329
|
+
entities: action.entities?.map(ctx.resolveEntityRef),
|
|
330
|
+
auth: action.auth,
|
|
331
|
+
},
|
|
316
332
|
});
|
|
317
333
|
}
|
|
318
334
|
});
|
|
@@ -365,7 +381,7 @@ describe("mapAuth", () => {
|
|
|
365
381
|
}
|
|
366
382
|
const result = AppSpecMapper.mapAuth(auth, ctx);
|
|
367
383
|
expect(result).toStrictEqual({
|
|
368
|
-
userEntity: ctx.
|
|
384
|
+
userEntity: ctx.resolveEntityRef(auth.userEntity),
|
|
369
385
|
methods: AppSpecMapper.mapAuthMethods(auth.methods, ctx),
|
|
370
386
|
onAuthFailedRedirectTo: auth.onAuthFailedRedirectTo,
|
|
371
387
|
onAuthSucceededRedirectTo: auth.onAuthSucceededRedirectTo,
|
|
@@ -518,7 +534,7 @@ describe("mapEmailFlow", () => {
|
|
|
518
534
|
}
|
|
519
535
|
const result = AppSpecMapper.mapEmailFlow(emailFlow, ctx);
|
|
520
536
|
expect(result).toStrictEqual({
|
|
521
|
-
clientRoute: ctx.
|
|
537
|
+
clientRoute: ctx.resolveRouteRef(emailFlow.clientRoute),
|
|
522
538
|
getEmailContentFn: emailFlow.getEmailContentFn &&
|
|
523
539
|
mapRefObjectForMockProjectDir(emailFlow.getEmailContentFn),
|
|
524
540
|
});
|
|
@@ -568,18 +584,22 @@ describe("mapApi", () => {
|
|
|
568
584
|
test("should throw if entity refs are not provided", () => {
|
|
569
585
|
const api = Fixtures.getApi("full");
|
|
570
586
|
const ctx = makeMapperContext({ entityNames: [] });
|
|
571
|
-
expect(() =>
|
|
587
|
+
expect(() => SpecElementMapper.mapApiSpec(api, ctx)).toThrow();
|
|
572
588
|
});
|
|
573
589
|
function testMapApi(api) {
|
|
574
590
|
const ctx = makeMapperContext({ entityNames: api.entities ?? [] });
|
|
575
|
-
const result =
|
|
591
|
+
const result = SpecElementMapper.mapApiSpec(api, ctx);
|
|
576
592
|
expect(result).toStrictEqual({
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
593
|
+
declType: "Api",
|
|
594
|
+
declName: getRefObjectDeclarationName(api.fn),
|
|
595
|
+
declValue: {
|
|
596
|
+
fn: mapRefObjectForMockProjectDir(api.fn),
|
|
597
|
+
middlewareConfigFn: api.middlewareConfigFn &&
|
|
598
|
+
mapRefObjectForMockProjectDir(api.middlewareConfigFn),
|
|
599
|
+
entities: api.entities?.map(ctx.resolveEntityRef),
|
|
600
|
+
httpRoute: [api.method, api.path],
|
|
601
|
+
auth: api.auth,
|
|
602
|
+
},
|
|
583
603
|
});
|
|
584
604
|
}
|
|
585
605
|
});
|
|
@@ -592,10 +612,14 @@ describe("mapApiNamespace", () => {
|
|
|
592
612
|
});
|
|
593
613
|
function testMapApiNamespace(apiNamespace) {
|
|
594
614
|
const ctx = makeMapperContext();
|
|
595
|
-
const result =
|
|
615
|
+
const result = SpecElementMapper.mapApiNamespaceSpec(apiNamespace, ctx);
|
|
596
616
|
expect(result).toStrictEqual({
|
|
597
|
-
|
|
598
|
-
|
|
617
|
+
declType: "ApiNamespace",
|
|
618
|
+
declName: getRefObjectDeclarationName(apiNamespace.middlewareConfigFn),
|
|
619
|
+
declValue: {
|
|
620
|
+
middlewareConfigFn: mapRefObjectForMockProjectDir(apiNamespace.middlewareConfigFn),
|
|
621
|
+
path: apiNamespace.path,
|
|
622
|
+
},
|
|
599
623
|
});
|
|
600
624
|
}
|
|
601
625
|
});
|
|
@@ -711,19 +735,23 @@ describe("mapJob", () => {
|
|
|
711
735
|
test("should throw if entity ref is not provided", () => {
|
|
712
736
|
const job = Fixtures.getJob("full");
|
|
713
737
|
const ctx = makeMapperContext({ entityNames: [] });
|
|
714
|
-
expect(() =>
|
|
738
|
+
expect(() => SpecElementMapper.mapJobSpec(job, ctx)).toThrow();
|
|
715
739
|
});
|
|
716
740
|
function testMapJob(job) {
|
|
717
741
|
const ctx = makeMapperContext({ entityNames: job.entities ?? [] });
|
|
718
|
-
const result =
|
|
742
|
+
const result = SpecElementMapper.mapJobSpec(job, ctx);
|
|
719
743
|
expect(result).toStrictEqual({
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
744
|
+
declType: "Job",
|
|
745
|
+
declName: getRefObjectDeclarationName(job.fn),
|
|
746
|
+
declValue: {
|
|
747
|
+
executor: job.executor,
|
|
748
|
+
perform: {
|
|
749
|
+
fn: mapRefObjectForMockProjectDir(job.fn),
|
|
750
|
+
executorOptions: job.performExecutorOptions,
|
|
751
|
+
},
|
|
752
|
+
schedule: job.schedule && SpecElementMapper.mapSchedule(job.schedule),
|
|
753
|
+
entities: job.entities?.map(ctx.resolveEntityRef),
|
|
724
754
|
},
|
|
725
|
-
schedule: job.schedule && AppSpecMapper.mapSchedule(job.schedule),
|
|
726
|
-
entities: job.entities?.map(ctx.entityRefParser),
|
|
727
755
|
});
|
|
728
756
|
}
|
|
729
757
|
});
|
|
@@ -737,14 +765,18 @@ describe("mapCrud", () => {
|
|
|
737
765
|
test("should throw if entity ref is not provided", () => {
|
|
738
766
|
const crudDecl = Fixtures.getCrud("full");
|
|
739
767
|
const ctx = makeMapperContext({ entityNames: [] });
|
|
740
|
-
expect(() =>
|
|
768
|
+
expect(() => SpecElementMapper.mapCrudSpec(crudDecl, ctx)).toThrow();
|
|
741
769
|
});
|
|
742
770
|
function testMapCrud(crudDecl) {
|
|
743
771
|
const ctx = makeMapperContext({ entityNames: [crudDecl.entity] });
|
|
744
|
-
const result =
|
|
772
|
+
const result = SpecElementMapper.mapCrudSpec(crudDecl, ctx);
|
|
745
773
|
expect(result).toStrictEqual({
|
|
746
|
-
|
|
747
|
-
|
|
774
|
+
declType: "Crud",
|
|
775
|
+
declName: crudDecl.name,
|
|
776
|
+
declValue: {
|
|
777
|
+
entity: ctx.resolveEntityRef(crudDecl.entity),
|
|
778
|
+
operations: SpecElementMapper.mapCrudOperations(crudDecl.operations, ctx),
|
|
779
|
+
},
|
|
748
780
|
});
|
|
749
781
|
}
|
|
750
782
|
});
|
|
@@ -757,18 +789,18 @@ describe("mapCrudOperations", () => {
|
|
|
757
789
|
});
|
|
758
790
|
function testMapCrudOperations(crudOperations) {
|
|
759
791
|
const ctx = makeMapperContext();
|
|
760
|
-
const result =
|
|
792
|
+
const result = SpecElementMapper.mapCrudOperations(crudOperations, ctx);
|
|
761
793
|
expect(result).toStrictEqual({
|
|
762
794
|
get: crudOperations.get &&
|
|
763
|
-
|
|
795
|
+
SpecElementMapper.mapCrudOperationOptions(crudOperations.get, ctx),
|
|
764
796
|
getAll: crudOperations.getAll &&
|
|
765
|
-
|
|
797
|
+
SpecElementMapper.mapCrudOperationOptions(crudOperations.getAll, ctx),
|
|
766
798
|
create: crudOperations.create &&
|
|
767
|
-
|
|
799
|
+
SpecElementMapper.mapCrudOperationOptions(crudOperations.create, ctx),
|
|
768
800
|
update: crudOperations.update &&
|
|
769
|
-
|
|
801
|
+
SpecElementMapper.mapCrudOperationOptions(crudOperations.update, ctx),
|
|
770
802
|
delete: crudOperations.delete &&
|
|
771
|
-
|
|
803
|
+
SpecElementMapper.mapCrudOperationOptions(crudOperations.delete, ctx),
|
|
772
804
|
});
|
|
773
805
|
}
|
|
774
806
|
});
|
|
@@ -781,7 +813,7 @@ describe("mapCrudOperationOptions", () => {
|
|
|
781
813
|
});
|
|
782
814
|
function testMapCrudOperationOptions(crudOperationOptions) {
|
|
783
815
|
const ctx = makeMapperContext();
|
|
784
|
-
const result =
|
|
816
|
+
const result = SpecElementMapper.mapCrudOperationOptions(crudOperationOptions, ctx);
|
|
785
817
|
expect(result).toStrictEqual({
|
|
786
818
|
isPublic: crudOperationOptions.isPublic,
|
|
787
819
|
overrideFn: crudOperationOptions.overrideFn &&
|
|
@@ -797,7 +829,7 @@ describe("mapSchedule", () => {
|
|
|
797
829
|
testMapSchedule(Fixtures.getSchedule("full"));
|
|
798
830
|
});
|
|
799
831
|
function testMapSchedule(schedule) {
|
|
800
|
-
const result =
|
|
832
|
+
const result = SpecElementMapper.mapSchedule(schedule);
|
|
801
833
|
expect(result).toStrictEqual({
|
|
802
834
|
cron: schedule.cron,
|
|
803
835
|
args: schedule.args,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalizePrerender.unit.test.d.ts","sourceRoot":"","sources":["../../../__tests__/spec/normalizePrerender.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { describe, expect, test } from "vitest";
|
|
2
|
+
import { normalizePrerender } from "../../src/normalizePrerender.js";
|
|
3
|
+
describe("normalizePrerender", () => {
|
|
4
|
+
test("returns an empty list when prerendering is disabled", () => {
|
|
5
|
+
expect(normalizePrerender(undefined, "/foo")).toEqual([]);
|
|
6
|
+
expect(normalizePrerender(false, "/foo")).toEqual([]);
|
|
7
|
+
expect(normalizePrerender([], "/foo")).toEqual([]);
|
|
8
|
+
});
|
|
9
|
+
test("expands `true` to the route's own path", () => {
|
|
10
|
+
expect(normalizePrerender(true, "/foo")).toEqual(["/foo"]);
|
|
11
|
+
});
|
|
12
|
+
test("keeps an explicit list of paths as-is", () => {
|
|
13
|
+
expect(normalizePrerender(["/a", "/b"], "/foo")).toEqual(["/a", "/b"]);
|
|
14
|
+
});
|
|
15
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, expect, test } from "vitest";
|
|
2
2
|
import { mapRefObject } from "../../src/spec/refObject.js";
|
|
3
|
-
import {
|
|
3
|
+
import { WaspSpecUserError } from "../../src/spec/waspSpecUserError.js";
|
|
4
4
|
import * as Fixtures from "./testFixtures.js";
|
|
5
5
|
describe("mapRefObject", () => {
|
|
6
6
|
test("should map minimal named import correctly", () => {
|
|
@@ -20,7 +20,7 @@ describe("mapRefObject", () => {
|
|
|
20
20
|
{ refObject: { parse: () => ({}) } },
|
|
21
21
|
{ refObject: { from: "./src/external" } },
|
|
22
22
|
])("returns an error for invalid runtime values", ({ refObject }) => {
|
|
23
|
-
expect(() => mapRefObjectForProject(refObject)).toThrow(
|
|
23
|
+
expect(() => mapRefObjectForProject(refObject)).toThrow(WaspSpecUserError);
|
|
24
24
|
expect(() => mapRefObjectForProject(refObject)).toThrow("Got an import in the Wasp file that we couldn't process");
|
|
25
25
|
});
|
|
26
26
|
function testMapRefObject(refObject) {
|
|
@@ -55,7 +55,7 @@ import * as os from "node:os";
|
|
|
55
55
|
import * as path from "node:path/posix"; // Module paths are always `/`-delimited
|
|
56
56
|
import { describe, expect, test } from "vitest";
|
|
57
57
|
import { normalizeRefObjectPath } from "../../src/spec/refObjectPath.js";
|
|
58
|
-
import {
|
|
58
|
+
import { WaspSpecUserError } from "../../src/spec/waspSpecUserError.js";
|
|
59
59
|
describe("normalizeRefObjectPath", () => {
|
|
60
60
|
test("maps a top-level spec ref import targeting src", () => {
|
|
61
61
|
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
@@ -137,7 +137,7 @@ describe("normalizeRefObjectPath", () => {
|
|
|
137
137
|
importPath: "./helpers/helper",
|
|
138
138
|
importingFilePath: path.join(project.rootDir, "main.wasp.ts"),
|
|
139
139
|
projectRootDir: project.rootDir,
|
|
140
|
-
})).toThrow(
|
|
140
|
+
})).toThrow(WaspSpecUserError);
|
|
141
141
|
expect(() => normalizeRefObjectPath({
|
|
142
142
|
importPath: "./helpers/helper",
|
|
143
143
|
importingFilePath: path.join(project.rootDir, "main.wasp.ts"),
|
|
@@ -160,7 +160,7 @@ describe("normalizeRefObjectPath", () => {
|
|
|
160
160
|
importPath: "./src",
|
|
161
161
|
importingFilePath: path.join(project.rootDir, "main.wasp.ts"),
|
|
162
162
|
projectRootDir: project.rootDir,
|
|
163
|
-
})).toThrow(
|
|
163
|
+
})).toThrow(WaspSpecUserError);
|
|
164
164
|
expect(() => normalizeRefObjectPath({
|
|
165
165
|
importPath: "./src",
|
|
166
166
|
importingFilePath: path.join(project.rootDir, "main.wasp.ts"),
|