@eventcatalog/core 5.0.0-beta.21 → 5.0.0-beta.23
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/dist/analytics/analytics.cjs +1 -1
- package/dist/analytics/analytics.js +2 -2
- package/dist/analytics/log-build.cjs +1 -1
- package/dist/analytics/log-build.js +3 -3
- package/dist/{chunk-I7F7CPDC.js → chunk-BCPFKOYS.js} +1 -1
- package/dist/{chunk-RIRRWE7D.js → chunk-PL47QVH5.js} +1 -1
- package/dist/{chunk-WHYRRLHE.js → chunk-UEVX7NA7.js} +1 -1
- package/dist/{chunk-OVWDUANF.js → chunk-WTC4GUXU.js} +1 -1
- package/dist/{chunk-W6KDW6ZC.js → chunk-XM7GHRDU.js} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog.cjs +1 -1
- package/dist/eventcatalog.js +5 -5
- package/dist/generate.cjs +1 -1
- package/dist/generate.js +3 -3
- package/dist/utils/cli-logger.cjs +1 -1
- package/dist/utils/cli-logger.js +2 -2
- package/eventcatalog/src/content.config.ts +19 -2
- package/eventcatalog/src/pages/architecture/[type]/[id]/[version]/_index.data.spec.ts +2 -3
- package/eventcatalog/src/pages/architecture/[type]/[id]/[version]/_index.data.ts +0 -7
- package/eventcatalog/src/pages/architecture/[type]/[id]/[version]/index.astro +3 -1
- package/eventcatalog/src/pages/diagrams/[id]/[version]/_index.data.ts +0 -7
- package/eventcatalog/src/pages/diagrams/[id]/[version]/embed.astro +1 -0
- package/eventcatalog/src/pages/diagrams/[id]/[version]/index.astro +1 -0
- package/eventcatalog/src/pages/directory/[type]/_index.data.ts +5 -7
- package/eventcatalog/src/pages/directory/[type]/index.astro +3 -1
- package/eventcatalog/src/pages/discover/[type]/_index.data.ts +5 -7
- package/eventcatalog/src/pages/discover/[type]/index.astro +3 -1
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/[docVersion]/_index.data.ts +0 -7
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/[docVersion]/index.astro +1 -0
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/_index.data.ts +0 -7
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/index.astro +1 -0
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/_index.data.ts +0 -7
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/asyncapi/[filename].astro +3 -1
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/asyncapi/_[filename].data.ts +0 -7
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/changelog/_index.data.ts +0 -7
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/changelog/index.astro +1 -0
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/examples/[...filename].astro +1 -0
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/examples/_[...filename].data.ts +0 -4
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/field-lineage/_index.data.ts +0 -7
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/field-lineage/index.astro +1 -0
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/graphql/[filename].astro +3 -1
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/graphql/_[filename].data.ts +0 -7
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +1 -0
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/resources/_index.data.spec.ts +2 -3
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/resources/_index.data.ts +0 -7
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/resources/index.astro +1 -0
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/spec/[filename].astro +1 -0
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/spec/_[filename].data.ts +0 -7
- package/eventcatalog/src/pages/docs/[type]/[id]/_index.data.ts +0 -7
- package/eventcatalog/src/pages/docs/[type]/[id]/index.astro +1 -0
- package/eventcatalog/src/pages/docs/[type]/[id]/language/[dictionaryId]/_index.data.ts +0 -7
- package/eventcatalog/src/pages/docs/[type]/[id]/language/[dictionaryId]/index.astro +1 -0
- package/eventcatalog/src/pages/docs/[type]/[id]/language/_index.data.ts +0 -7
- package/eventcatalog/src/pages/docs/[type]/[id]/language/index.astro +1 -0
- package/eventcatalog/src/pages/docs/custom/[...path]/_index.data.ts +0 -7
- package/eventcatalog/src/pages/docs/custom/[...path]/index.astro +1 -0
- package/eventcatalog/src/pages/docs/services/[id]/[docType]/[docId]/index.astro +1 -1
- package/eventcatalog/src/pages/docs/services/[id]/[version]/resources/index.astro +1 -0
- package/eventcatalog/src/pages/docs/services/[id]/asyncapi/[filename].astro +1 -1
- package/eventcatalog/src/pages/docs/services/[id]/changelog/index.astro +1 -1
- package/eventcatalog/src/pages/docs/services/[id]/graphql/[filename].astro +1 -1
- package/eventcatalog/src/pages/docs/services/[id]/spec/[filename].astro +1 -1
- package/eventcatalog/src/pages/docs/teams/[id]/_index.data.ts +0 -7
- package/eventcatalog/src/pages/docs/teams/[id]/index.astro +1 -0
- package/eventcatalog/src/pages/docs/users/[id]/_index.data.ts +0 -7
- package/eventcatalog/src/pages/docs/users/[id]/index.astro +1 -0
- package/eventcatalog/src/pages/schemas/[type]/[id]/[version]/_index.data.ts +0 -7
- package/eventcatalog/src/pages/schemas/[type]/[id]/[version]/index.astro +1 -0
- package/eventcatalog/src/pages/schemas/explorer/_index.data.ts +0 -7
- package/eventcatalog/src/pages/schemas/explorer/index.astro +3 -1
- package/eventcatalog/src/pages/triggers/[type]/[id]/[version]/_index.data.ts +0 -7
- package/eventcatalog/src/pages/triggers/[type]/[id]/[version]/index.astro +1 -0
- package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/_index.data.ts +0 -7
- package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/data/_index.data.ts +0 -7
- package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/data/index.astro +1 -0
- package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/entity-map/_index.data.ts +0 -7
- package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/entity-map/index.astro +1 -0
- package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/index.astro +1 -0
- package/eventcatalog/src/pages/visualiser/[type]/[id]/_index.data.ts +38 -0
- package/eventcatalog/src/pages/visualiser/[type]/[id]/index.astro +17 -40
- package/eventcatalog/src/pages/visualiser/designs/[id]/_index.data.ts +0 -7
- package/eventcatalog/src/pages/visualiser/designs/[id]/index.astro +2 -1
- package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/entity-map/_index.data.ts +0 -7
- package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/entity-map/index.astro +1 -0
- package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/index.astro +1 -0
- package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/systems-context/_index.data.ts +0 -7
- package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/systems-context/index.astro +1 -0
- package/eventcatalog/src/pages/visualiser/systems/[id]/[version]/context/_index.data.ts +0 -7
- package/eventcatalog/src/pages/visualiser/systems/[id]/[version]/context/index.astro +1 -0
- package/eventcatalog/src/pages/visualiser/systems/[id]/[version]/index.astro +1 -0
- package/eventcatalog/src/utils/page-loaders/hybrid-page.ts +4 -15
- package/package.json +2 -2
|
@@ -176,7 +176,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
|
|
|
176
176
|
var import_os = __toESM(require("os"), 1);
|
|
177
177
|
|
|
178
178
|
// package.json
|
|
179
|
-
var version = "5.0.0-beta.
|
|
179
|
+
var version = "5.0.0-beta.23";
|
|
180
180
|
|
|
181
181
|
// src/constants.ts
|
|
182
182
|
var VERSION = version;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
log_build_default
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-BCPFKOYS.js";
|
|
4
4
|
import "../chunk-AWOO63ME.js";
|
|
5
5
|
import "../chunk-ZAZHAVKB.js";
|
|
6
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-UEVX7NA7.js";
|
|
7
7
|
import "../chunk-CPW6G62V.js";
|
|
8
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-PL47QVH5.js";
|
|
9
9
|
import "../chunk-RFIXKATC.js";
|
|
10
10
|
export {
|
|
11
11
|
log_build_default as default
|
package/dist/constants.cjs
CHANGED
package/dist/constants.js
CHANGED
package/dist/eventcatalog.cjs
CHANGED
|
@@ -181,7 +181,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
|
|
|
181
181
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
182
182
|
|
|
183
183
|
// package.json
|
|
184
|
-
var version = "5.0.0-beta.
|
|
184
|
+
var version = "5.0.0-beta.23";
|
|
185
185
|
|
|
186
186
|
// src/constants.ts
|
|
187
187
|
var VERSION = version;
|
package/dist/eventcatalog.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "./chunk-S5GWAUG5.js";
|
|
8
8
|
import {
|
|
9
9
|
log_build_default
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-BCPFKOYS.js";
|
|
11
11
|
import {
|
|
12
12
|
getLicenseStatus,
|
|
13
13
|
printLicenseStatus
|
|
@@ -36,10 +36,10 @@ import {
|
|
|
36
36
|
} from "./chunk-MDWB5HLO.js";
|
|
37
37
|
import {
|
|
38
38
|
generate
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-WTC4GUXU.js";
|
|
40
40
|
import {
|
|
41
41
|
logger
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-XM7GHRDU.js";
|
|
43
43
|
import {
|
|
44
44
|
resolve_catalog_dependencies_default
|
|
45
45
|
} from "./chunk-36RYTYT5.js";
|
|
@@ -53,7 +53,7 @@ import {
|
|
|
53
53
|
import {
|
|
54
54
|
watch
|
|
55
55
|
} from "./chunk-U63GDPPY.js";
|
|
56
|
-
import "./chunk-
|
|
56
|
+
import "./chunk-UEVX7NA7.js";
|
|
57
57
|
import "./chunk-CPW6G62V.js";
|
|
58
58
|
import {
|
|
59
59
|
getAstroConfigPath
|
|
@@ -70,7 +70,7 @@ import {
|
|
|
70
70
|
} from "./chunk-LFQJXLHG.js";
|
|
71
71
|
import {
|
|
72
72
|
VERSION
|
|
73
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-PL47QVH5.js";
|
|
74
74
|
import {
|
|
75
75
|
getEventCatalogConfigFile,
|
|
76
76
|
verifyRequiredFieldsAreInCatalogConfigFile
|
package/dist/generate.cjs
CHANGED
|
@@ -112,7 +112,7 @@ var getEventCatalogConfigFile = async (projectDirectory) => {
|
|
|
112
112
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
113
113
|
|
|
114
114
|
// package.json
|
|
115
|
-
var version = "5.0.0-beta.
|
|
115
|
+
var version = "5.0.0-beta.23";
|
|
116
116
|
|
|
117
117
|
// src/constants.ts
|
|
118
118
|
var VERSION = version;
|
package/dist/generate.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
generate
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-WTC4GUXU.js";
|
|
4
|
+
import "./chunk-XM7GHRDU.js";
|
|
5
|
+
import "./chunk-PL47QVH5.js";
|
|
6
6
|
import "./chunk-RFIXKATC.js";
|
|
7
7
|
export {
|
|
8
8
|
generate
|
package/dist/utils/cli-logger.js
CHANGED
|
@@ -502,7 +502,24 @@ const agents = defineCollection({
|
|
|
502
502
|
),
|
|
503
503
|
});
|
|
504
504
|
|
|
505
|
-
|
|
505
|
+
// ADRs need a status and a date, and say so when they're missing or invalid. Astro's own message for
|
|
506
|
+
// a missing or unreadable date was "Expected type date, received object", with the field name garbled.
|
|
507
|
+
const adrStatus = z.enum(ADR_STATUS_VALUES, {
|
|
508
|
+
error: (issue) =>
|
|
509
|
+
issue.input === undefined ? `Required: one of ${ADR_STATUS_VALUES.map((value) => `"${value}"`).join(', ')}` : undefined,
|
|
510
|
+
});
|
|
511
|
+
const adrDate = z.preprocess(
|
|
512
|
+
// Converted to a date only when it's set: a missing date coerced first became an invalid date
|
|
513
|
+
(value) => (value == null ? value : new Date(value as string | number | Date)),
|
|
514
|
+
z.date({
|
|
515
|
+
error: (issue) =>
|
|
516
|
+
issue.input === undefined
|
|
517
|
+
? 'Required: a date, e.g. 2026-06-01'
|
|
518
|
+
: issue.input instanceof Date
|
|
519
|
+
? 'Invalid date: use a date, e.g. 2026-06-01'
|
|
520
|
+
: undefined,
|
|
521
|
+
})
|
|
522
|
+
);
|
|
506
523
|
|
|
507
524
|
const adrPointer = z.object({
|
|
508
525
|
id: z.string(),
|
|
@@ -539,7 +556,7 @@ const adrs = defineCollection({
|
|
|
539
556
|
z
|
|
540
557
|
.object({
|
|
541
558
|
status: adrStatus,
|
|
542
|
-
date:
|
|
559
|
+
date: adrDate,
|
|
543
560
|
decisionMakers: z.array(ownerReference).optional(),
|
|
544
561
|
appliesTo: z.array(adrResourcePointer).optional(),
|
|
545
562
|
supersedes: z.array(adrPointer).optional(),
|
|
@@ -68,10 +68,9 @@ describe('architecture page redirects', () => {
|
|
|
68
68
|
it('returns not found for resources without an architecture page', async () => {
|
|
69
69
|
mocks.isSSR.mockReturnValue(true);
|
|
70
70
|
|
|
71
|
+
// Nothing found: the page answers with the 404 page
|
|
71
72
|
await expect(
|
|
72
73
|
Page.getData({ params: { type: 'events', id: 'order-created', version: '1.0.0' }, props: {} } as any)
|
|
73
|
-
).
|
|
74
|
-
status: 404,
|
|
75
|
-
});
|
|
74
|
+
).resolves.toBeUndefined();
|
|
76
75
|
});
|
|
77
76
|
});
|
|
@@ -61,11 +61,4 @@ export class Page extends HybridPage {
|
|
|
61
61
|
|
|
62
62
|
return { type, data: { id, name: match.item.data.name, version }, redirectPath: match.redirectPath };
|
|
63
63
|
}
|
|
64
|
-
|
|
65
|
-
protected static createNotFoundResponse(): Response {
|
|
66
|
-
return new Response(null, {
|
|
67
|
-
status: 404,
|
|
68
|
-
statusText: 'Documentation not found',
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
64
|
}
|
|
@@ -9,7 +9,9 @@ import { Page } from './_index.data';
|
|
|
9
9
|
export const prerender = Page.prerender;
|
|
10
10
|
export const getStaticPaths = Page.getStaticPaths;
|
|
11
11
|
|
|
12
|
-
const
|
|
12
|
+
const pageData = await Page.getData(Astro);
|
|
13
|
+
if (!pageData) return Astro.rewrite('/404');
|
|
14
|
+
const { data, redirectPath } = pageData;
|
|
13
15
|
const redirectUrl = buildUrl(redirectPath);
|
|
14
16
|
|
|
15
17
|
if (isSSR()) {
|
|
@@ -10,6 +10,7 @@ export const prerender = Page.prerender;
|
|
|
10
10
|
export const getStaticPaths = Page.getStaticPaths;
|
|
11
11
|
|
|
12
12
|
const props = await Page.getData(Astro);
|
|
13
|
+
if (!props) return Astro.rewrite('/404');
|
|
13
14
|
const { Content } = await render(props);
|
|
14
15
|
|
|
15
16
|
const currentVersion = props.data.version;
|
|
@@ -15,6 +15,7 @@ export const prerender = Page.prerender;
|
|
|
15
15
|
export const getStaticPaths = Page.getStaticPaths;
|
|
16
16
|
|
|
17
17
|
const props = await Page.getData(Astro);
|
|
18
|
+
if (!props) return Astro.rewrite('/404');
|
|
18
19
|
const { Content, headings } = await render(props);
|
|
19
20
|
|
|
20
21
|
const pageTitle = `Diagram | ${props.data.name}`;
|
|
@@ -45,6 +45,11 @@ export class Page extends HybridPage {
|
|
|
45
45
|
teams: getTeams,
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
+
// An unknown type (e.g. a mistyped URL) has no directory page
|
|
49
|
+
if (!Object.hasOwn(loaders, type)) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
|
|
48
53
|
// Get all items of the specified type
|
|
49
54
|
const items = await loaders[type as keyof typeof loaders]();
|
|
50
55
|
|
|
@@ -53,11 +58,4 @@ export class Page extends HybridPage {
|
|
|
53
58
|
data: items,
|
|
54
59
|
};
|
|
55
60
|
}
|
|
56
|
-
|
|
57
|
-
protected static createNotFoundResponse(): Response {
|
|
58
|
-
return new Response(null, {
|
|
59
|
-
status: 404,
|
|
60
|
-
statusText: 'Directory type not found',
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
61
|
}
|
|
@@ -7,7 +7,9 @@ import { Page } from './_index.data';
|
|
|
7
7
|
export const prerender = Page.prerender;
|
|
8
8
|
export const getStaticPaths = Page.getStaticPaths;
|
|
9
9
|
|
|
10
|
-
const
|
|
10
|
+
const pageData = await Page.getData(Astro);
|
|
11
|
+
if (!pageData) return Astro.rewrite('/404');
|
|
12
|
+
const { type, data } = pageData;
|
|
11
13
|
|
|
12
14
|
function mapToItem(i: any) {
|
|
13
15
|
return {
|
|
@@ -81,6 +81,11 @@ export class Page extends HybridPage {
|
|
|
81
81
|
'data-products': getDataProducts,
|
|
82
82
|
};
|
|
83
83
|
|
|
84
|
+
// An unknown type (e.g. a mistyped URL) has no discover page
|
|
85
|
+
if (!Object.hasOwn(loaders, type)) {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
|
|
84
89
|
// @ts-ignore
|
|
85
90
|
const items = await loaders[type]();
|
|
86
91
|
|
|
@@ -89,11 +94,4 @@ export class Page extends HybridPage {
|
|
|
89
94
|
data: items,
|
|
90
95
|
};
|
|
91
96
|
}
|
|
92
|
-
|
|
93
|
-
protected static createNotFoundResponse(): Response {
|
|
94
|
-
return new Response(null, {
|
|
95
|
-
status: 404,
|
|
96
|
-
statusText: 'Collection type not found',
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
97
|
}
|
|
@@ -27,7 +27,9 @@ import { Page } from './_index.data';
|
|
|
27
27
|
export const prerender = Page.prerender;
|
|
28
28
|
export const getStaticPaths = Page.getStaticPaths;
|
|
29
29
|
|
|
30
|
-
const
|
|
30
|
+
const pageData = await Page.getData(Astro);
|
|
31
|
+
if (!pageData) return Astro.rewrite('/404');
|
|
32
|
+
const { type, data } = pageData;
|
|
31
33
|
|
|
32
34
|
const events = await getEvents();
|
|
33
35
|
const queries = await getQueries();
|
package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/[docVersion]/index.astro
CHANGED
|
@@ -19,6 +19,7 @@ export const prerender = Page.prerender;
|
|
|
19
19
|
export const getStaticPaths = Page.getStaticPaths;
|
|
20
20
|
|
|
21
21
|
const props = await Page.getData(Astro);
|
|
22
|
+
if (!props) return Astro.rewrite('/404');
|
|
22
23
|
const { Content, headings } = await render(props);
|
|
23
24
|
|
|
24
25
|
const title = props.data.title || props.data.id;
|
|
@@ -19,6 +19,7 @@ export const prerender = Page.prerender;
|
|
|
19
19
|
export const getStaticPaths = Page.getStaticPaths;
|
|
20
20
|
|
|
21
21
|
const props = await Page.getData(Astro);
|
|
22
|
+
if (!props) return Astro.rewrite('/404');
|
|
22
23
|
const { Content, headings } = await render(props);
|
|
23
24
|
|
|
24
25
|
const title = props.data.title || props.data.id;
|
|
@@ -21,7 +21,9 @@ export const prerender = Page.prerender;
|
|
|
21
21
|
export const getStaticPaths = Page.getStaticPaths;
|
|
22
22
|
|
|
23
23
|
// Get data
|
|
24
|
-
const
|
|
24
|
+
const pageData = await Page.getData(Astro);
|
|
25
|
+
if (!pageData) return Astro.rewrite('/404');
|
|
26
|
+
const { collection, data, filePath, filename, path: relativeSpecPath, headers = {} } = pageData;
|
|
25
27
|
|
|
26
28
|
const fileName = filename || 'asyncapi.yaml';
|
|
27
29
|
const pathToSpec = getAbsoluteFilePathForAstroFile(filePath, fileName);
|
|
@@ -12,6 +12,7 @@ export const prerender = Page.prerender;
|
|
|
12
12
|
export const getStaticPaths = Page.getStaticPaths;
|
|
13
13
|
|
|
14
14
|
const props = await Page.getData(Astro);
|
|
15
|
+
if (!props) return Astro.rewrite('/404');
|
|
15
16
|
const { collection, data, example } = props;
|
|
16
17
|
|
|
17
18
|
const pageTitle = `${collection} | ${data.name} | ${example.title}`.replace(/^\w/, (c: string) => c.toUpperCase());
|
|
@@ -16,7 +16,9 @@ export const prerender = Page.prerender;
|
|
|
16
16
|
export const getStaticPaths = Page.getStaticPaths;
|
|
17
17
|
|
|
18
18
|
// Get data
|
|
19
|
-
const
|
|
19
|
+
const pageData = await Page.getData(Astro);
|
|
20
|
+
if (!pageData) return Astro.rewrite('/404');
|
|
21
|
+
const { collection, data, filePath, filename, path: relativeSpecPath } = pageData;
|
|
20
22
|
|
|
21
23
|
const fileName = filename || 'schema.graphql';
|
|
22
24
|
const pathToSpec = getAbsoluteFilePathForAstroFile(filePath, fileName);
|
|
@@ -81,6 +81,7 @@ export const getStaticPaths = Page.getStaticPaths;
|
|
|
81
81
|
|
|
82
82
|
// Get data
|
|
83
83
|
const props = await Page.getData(Astro);
|
|
84
|
+
if (!props) return Astro.rewrite('/404');
|
|
84
85
|
|
|
85
86
|
const { Content, headings } = await render(props);
|
|
86
87
|
const isAdrPage = isAdrCollection(props.collection);
|
|
@@ -38,9 +38,8 @@ describe('Resources routes', () => {
|
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
it('returns not found for types without a Resources page on a server request', async () => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
});
|
|
41
|
+
// Nothing found: the page answers with the 404 page
|
|
42
|
+
await expect(Page.getData({ params: { type: 'entities', id: 'Order', version: '1.0.0' }, props: {} } as any)).resolves.toBeUndefined();
|
|
44
43
|
expect(mocks.findOwnerWithResources).not.toHaveBeenCalled();
|
|
45
44
|
});
|
|
46
45
|
});
|
|
@@ -57,13 +57,6 @@ const createResourcesPage = ({
|
|
|
57
57
|
|
|
58
58
|
return findOwnerWithResources(type as ResourceOwnerCollection, id, version);
|
|
59
59
|
}
|
|
60
|
-
|
|
61
|
-
protected static createNotFoundResponse(): Response {
|
|
62
|
-
return new Response(null, {
|
|
63
|
-
status: 404,
|
|
64
|
-
statusText: 'Resources not found',
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
60
|
};
|
|
68
61
|
|
|
69
62
|
export const Page = createResourcesPage({
|
|
@@ -7,6 +7,7 @@ export const prerender = Page.prerender;
|
|
|
7
7
|
export const getStaticPaths = Page.getStaticPaths;
|
|
8
8
|
|
|
9
9
|
const props = await Page.getData(Astro);
|
|
10
|
+
if (!props) return Astro.rewrite('/404');
|
|
10
11
|
|
|
11
12
|
const pageTitle = `${props.collection} | ${props.data.name}`.replace(/^\w/, (c) => c.toUpperCase());
|
|
12
13
|
|