@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.
Files changed (93) hide show
  1. package/dist/analytics/analytics.cjs +1 -1
  2. package/dist/analytics/analytics.js +2 -2
  3. package/dist/analytics/log-build.cjs +1 -1
  4. package/dist/analytics/log-build.js +3 -3
  5. package/dist/{chunk-I7F7CPDC.js → chunk-BCPFKOYS.js} +1 -1
  6. package/dist/{chunk-RIRRWE7D.js → chunk-PL47QVH5.js} +1 -1
  7. package/dist/{chunk-WHYRRLHE.js → chunk-UEVX7NA7.js} +1 -1
  8. package/dist/{chunk-OVWDUANF.js → chunk-WTC4GUXU.js} +1 -1
  9. package/dist/{chunk-W6KDW6ZC.js → chunk-XM7GHRDU.js} +1 -1
  10. package/dist/constants.cjs +1 -1
  11. package/dist/constants.js +1 -1
  12. package/dist/eventcatalog.cjs +1 -1
  13. package/dist/eventcatalog.js +5 -5
  14. package/dist/generate.cjs +1 -1
  15. package/dist/generate.js +3 -3
  16. package/dist/utils/cli-logger.cjs +1 -1
  17. package/dist/utils/cli-logger.js +2 -2
  18. package/eventcatalog/src/content.config.ts +19 -2
  19. package/eventcatalog/src/pages/architecture/[type]/[id]/[version]/_index.data.spec.ts +2 -3
  20. package/eventcatalog/src/pages/architecture/[type]/[id]/[version]/_index.data.ts +0 -7
  21. package/eventcatalog/src/pages/architecture/[type]/[id]/[version]/index.astro +3 -1
  22. package/eventcatalog/src/pages/diagrams/[id]/[version]/_index.data.ts +0 -7
  23. package/eventcatalog/src/pages/diagrams/[id]/[version]/embed.astro +1 -0
  24. package/eventcatalog/src/pages/diagrams/[id]/[version]/index.astro +1 -0
  25. package/eventcatalog/src/pages/directory/[type]/_index.data.ts +5 -7
  26. package/eventcatalog/src/pages/directory/[type]/index.astro +3 -1
  27. package/eventcatalog/src/pages/discover/[type]/_index.data.ts +5 -7
  28. package/eventcatalog/src/pages/discover/[type]/index.astro +3 -1
  29. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/[docVersion]/_index.data.ts +0 -7
  30. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/[docVersion]/index.astro +1 -0
  31. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/_index.data.ts +0 -7
  32. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/index.astro +1 -0
  33. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/_index.data.ts +0 -7
  34. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/asyncapi/[filename].astro +3 -1
  35. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/asyncapi/_[filename].data.ts +0 -7
  36. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/changelog/_index.data.ts +0 -7
  37. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/changelog/index.astro +1 -0
  38. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/examples/[...filename].astro +1 -0
  39. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/examples/_[...filename].data.ts +0 -4
  40. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/field-lineage/_index.data.ts +0 -7
  41. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/field-lineage/index.astro +1 -0
  42. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/graphql/[filename].astro +3 -1
  43. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/graphql/_[filename].data.ts +0 -7
  44. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +1 -0
  45. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/resources/_index.data.spec.ts +2 -3
  46. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/resources/_index.data.ts +0 -7
  47. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/resources/index.astro +1 -0
  48. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/spec/[filename].astro +1 -0
  49. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/spec/_[filename].data.ts +0 -7
  50. package/eventcatalog/src/pages/docs/[type]/[id]/_index.data.ts +0 -7
  51. package/eventcatalog/src/pages/docs/[type]/[id]/index.astro +1 -0
  52. package/eventcatalog/src/pages/docs/[type]/[id]/language/[dictionaryId]/_index.data.ts +0 -7
  53. package/eventcatalog/src/pages/docs/[type]/[id]/language/[dictionaryId]/index.astro +1 -0
  54. package/eventcatalog/src/pages/docs/[type]/[id]/language/_index.data.ts +0 -7
  55. package/eventcatalog/src/pages/docs/[type]/[id]/language/index.astro +1 -0
  56. package/eventcatalog/src/pages/docs/custom/[...path]/_index.data.ts +0 -7
  57. package/eventcatalog/src/pages/docs/custom/[...path]/index.astro +1 -0
  58. package/eventcatalog/src/pages/docs/services/[id]/[docType]/[docId]/index.astro +1 -1
  59. package/eventcatalog/src/pages/docs/services/[id]/[version]/resources/index.astro +1 -0
  60. package/eventcatalog/src/pages/docs/services/[id]/asyncapi/[filename].astro +1 -1
  61. package/eventcatalog/src/pages/docs/services/[id]/changelog/index.astro +1 -1
  62. package/eventcatalog/src/pages/docs/services/[id]/graphql/[filename].astro +1 -1
  63. package/eventcatalog/src/pages/docs/services/[id]/spec/[filename].astro +1 -1
  64. package/eventcatalog/src/pages/docs/teams/[id]/_index.data.ts +0 -7
  65. package/eventcatalog/src/pages/docs/teams/[id]/index.astro +1 -0
  66. package/eventcatalog/src/pages/docs/users/[id]/_index.data.ts +0 -7
  67. package/eventcatalog/src/pages/docs/users/[id]/index.astro +1 -0
  68. package/eventcatalog/src/pages/schemas/[type]/[id]/[version]/_index.data.ts +0 -7
  69. package/eventcatalog/src/pages/schemas/[type]/[id]/[version]/index.astro +1 -0
  70. package/eventcatalog/src/pages/schemas/explorer/_index.data.ts +0 -7
  71. package/eventcatalog/src/pages/schemas/explorer/index.astro +3 -1
  72. package/eventcatalog/src/pages/triggers/[type]/[id]/[version]/_index.data.ts +0 -7
  73. package/eventcatalog/src/pages/triggers/[type]/[id]/[version]/index.astro +1 -0
  74. package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/_index.data.ts +0 -7
  75. package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/data/_index.data.ts +0 -7
  76. package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/data/index.astro +1 -0
  77. package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/entity-map/_index.data.ts +0 -7
  78. package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/entity-map/index.astro +1 -0
  79. package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/index.astro +1 -0
  80. package/eventcatalog/src/pages/visualiser/[type]/[id]/_index.data.ts +38 -0
  81. package/eventcatalog/src/pages/visualiser/[type]/[id]/index.astro +17 -40
  82. package/eventcatalog/src/pages/visualiser/designs/[id]/_index.data.ts +0 -7
  83. package/eventcatalog/src/pages/visualiser/designs/[id]/index.astro +2 -1
  84. package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/entity-map/_index.data.ts +0 -7
  85. package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/entity-map/index.astro +1 -0
  86. package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/index.astro +1 -0
  87. package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/systems-context/_index.data.ts +0 -7
  88. package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/systems-context/index.astro +1 -0
  89. package/eventcatalog/src/pages/visualiser/systems/[id]/[version]/context/_index.data.ts +0 -7
  90. package/eventcatalog/src/pages/visualiser/systems/[id]/[version]/context/index.astro +1 -0
  91. package/eventcatalog/src/pages/visualiser/systems/[id]/[version]/index.astro +1 -0
  92. package/eventcatalog/src/utils/page-loaders/hybrid-page.ts +4 -15
  93. package/package.json +2 -2
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(analytics_exports);
36
36
  var import_os = __toESM(require("os"), 1);
37
37
 
38
38
  // package.json
39
- var version = "5.0.0-beta.21";
39
+ var version = "5.0.0-beta.23";
40
40
 
41
41
  // src/constants.ts
42
42
  var VERSION = version;
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "../chunk-WHYRRLHE.js";
3
+ } from "../chunk-UEVX7NA7.js";
4
4
  import "../chunk-CPW6G62V.js";
5
- import "../chunk-RIRRWE7D.js";
5
+ import "../chunk-PL47QVH5.js";
6
6
  export {
7
7
  raiseEvent
8
8
  };
@@ -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.21";
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-I7F7CPDC.js";
3
+ } from "../chunk-BCPFKOYS.js";
4
4
  import "../chunk-AWOO63ME.js";
5
5
  import "../chunk-ZAZHAVKB.js";
6
- import "../chunk-WHYRRLHE.js";
6
+ import "../chunk-UEVX7NA7.js";
7
7
  import "../chunk-CPW6G62V.js";
8
- import "../chunk-RIRRWE7D.js";
8
+ import "../chunk-PL47QVH5.js";
9
9
  import "../chunk-RFIXKATC.js";
10
10
  export {
11
11
  log_build_default as default
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-ZAZHAVKB.js";
9
9
  import {
10
10
  raiseEvent
11
- } from "./chunk-WHYRRLHE.js";
11
+ } from "./chunk-UEVX7NA7.js";
12
12
  import {
13
13
  TELEMETRY_REQUEST_TIMEOUT_MS,
14
14
  isTelemetryDisabled
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "5.0.0-beta.21";
2
+ var version = "5.0.0-beta.23";
3
3
 
4
4
  // src/constants.ts
5
5
  var VERSION = version;
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-CPW6G62V.js";
5
5
  import {
6
6
  VERSION
7
- } from "./chunk-RIRRWE7D.js";
7
+ } from "./chunk-PL47QVH5.js";
8
8
 
9
9
  // src/analytics/analytics.js
10
10
  import os from "os";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logger
3
- } from "./chunk-W6KDW6ZC.js";
3
+ } from "./chunk-XM7GHRDU.js";
4
4
  import {
5
5
  cleanup,
6
6
  getEventCatalogConfigFile
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-RIRRWE7D.js";
3
+ } from "./chunk-PL47QVH5.js";
4
4
 
5
5
  // src/utils/cli-logger.ts
6
6
  import pc from "picocolors";
@@ -25,7 +25,7 @@ __export(constants_exports, {
25
25
  module.exports = __toCommonJS(constants_exports);
26
26
 
27
27
  // package.json
28
- var version = "5.0.0-beta.21";
28
+ var version = "5.0.0-beta.23";
29
29
 
30
30
  // src/constants.ts
31
31
  var VERSION = version;
package/dist/constants.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-RIRRWE7D.js";
3
+ } from "./chunk-PL47QVH5.js";
4
4
  export {
5
5
  VERSION
6
6
  };
@@ -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.21";
184
+ var version = "5.0.0-beta.23";
185
185
 
186
186
  // src/constants.ts
187
187
  var VERSION = version;
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-S5GWAUG5.js";
8
8
  import {
9
9
  log_build_default
10
- } from "./chunk-I7F7CPDC.js";
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-OVWDUANF.js";
39
+ } from "./chunk-WTC4GUXU.js";
40
40
  import {
41
41
  logger
42
- } from "./chunk-W6KDW6ZC.js";
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-WHYRRLHE.js";
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-RIRRWE7D.js";
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.21";
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-OVWDUANF.js";
4
- import "./chunk-W6KDW6ZC.js";
5
- import "./chunk-RIRRWE7D.js";
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
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(cli_logger_exports);
36
36
  var import_picocolors = __toESM(require("picocolors"), 1);
37
37
 
38
38
  // package.json
39
- var version = "5.0.0-beta.21";
39
+ var version = "5.0.0-beta.23";
40
40
 
41
41
  // src/constants.ts
42
42
  var VERSION = version;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  logger
3
- } from "../chunk-W6KDW6ZC.js";
4
- import "../chunk-RIRRWE7D.js";
3
+ } from "../chunk-XM7GHRDU.js";
4
+ import "../chunk-PL47QVH5.js";
5
5
  export {
6
6
  logger
7
7
  };
@@ -502,7 +502,24 @@ const agents = defineCollection({
502
502
  ),
503
503
  });
504
504
 
505
- const adrStatus = z.enum(ADR_STATUS_VALUES);
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: z.coerce.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
- ).rejects.toMatchObject({
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 { data, redirectPath } = await Page.getData(Astro);
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()) {
@@ -47,11 +47,4 @@ export class Page extends HybridPage {
47
47
  allVersions,
48
48
  };
49
49
  }
50
-
51
- protected static createNotFoundResponse(): Response {
52
- return new Response(null, {
53
- status: 404,
54
- statusText: 'Diagram not found',
55
- });
56
- }
57
50
  }
@@ -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 { type, data } = await Page.getData(Astro);
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 { type, data } = await Page.getData(Astro);
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();
@@ -71,11 +71,4 @@ export class Page extends HybridPage {
71
71
 
72
72
  return doc;
73
73
  }
74
-
75
- protected static createNotFoundResponse(): Response {
76
- return new Response(null, {
77
- status: 404,
78
- statusText: 'Resource documentation not found',
79
- });
80
- }
81
74
  }
@@ -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;
@@ -72,11 +72,4 @@ export class Page extends HybridPage {
72
72
 
73
73
  return doc;
74
74
  }
75
-
76
- protected static createNotFoundResponse(): Response {
77
- return new Response(null, {
78
- status: 404,
79
- statusText: 'Resource documentation not found',
80
- });
81
- }
82
75
  }
@@ -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;
@@ -63,11 +63,4 @@ export class Page extends HybridPage {
63
63
  ...item,
64
64
  };
65
65
  }
66
-
67
- protected static createNotFoundResponse(): Response {
68
- return new Response(null, {
69
- status: 404,
70
- statusText: 'Documentation not found',
71
- });
72
- }
73
66
  }
@@ -21,7 +21,9 @@ export const prerender = Page.prerender;
21
21
  export const getStaticPaths = Page.getStaticPaths;
22
22
 
23
23
  // Get data
24
- const { collection, data, filePath, filename, path: relativeSpecPath, headers = {} } = await Page.getData(Astro);
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);
@@ -90,11 +90,4 @@ export class Page extends HybridPage {
90
90
  ...item,
91
91
  };
92
92
  }
93
-
94
- protected static createNotFoundResponse(): Response {
95
- return new Response(null, {
96
- status: 404,
97
- statusText: 'AsyncAPI specification not found',
98
- });
99
- }
100
93
  }
@@ -59,11 +59,4 @@ export class Page extends HybridPage {
59
59
  ...item,
60
60
  };
61
61
  }
62
-
63
- protected static createNotFoundResponse(): Response {
64
- return new Response(null, {
65
- status: 404,
66
- statusText: 'Changelog not found',
67
- });
68
- }
69
62
  }
@@ -20,6 +20,7 @@ export const getStaticPaths = Page.getStaticPaths;
20
20
 
21
21
  // Get data
22
22
  const props = await Page.getData(Astro);
23
+ if (!props) return Astro.rewrite('/404');
23
24
 
24
25
  let collectionItem = props;
25
26
  const logs = await getChangeLogs(props);
@@ -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());
@@ -56,8 +56,4 @@ export class Page extends HybridPage {
56
56
 
57
57
  return { type, example, ...item };
58
58
  }
59
-
60
- protected static createNotFoundResponse(): Response {
61
- return new Response(null, { status: 404, statusText: 'Example not found' });
62
- }
63
59
  }
@@ -63,11 +63,4 @@ export class Page extends HybridPage {
63
63
  ...item,
64
64
  };
65
65
  }
66
-
67
- protected static createNotFoundResponse(): Response {
68
- return new Response(null, {
69
- status: 404,
70
- statusText: 'Field usage not found',
71
- });
72
- }
73
66
  }
@@ -18,6 +18,7 @@ export const getStaticPaths = Page.getStaticPaths;
18
18
 
19
19
  // Get data
20
20
  const props = await Page.getData(Astro);
21
+ if (!props) return Astro.rewrite('/404');
21
22
 
22
23
  const { data, collection } = props;
23
24
  const messageId = data.id;
@@ -16,7 +16,9 @@ export const prerender = Page.prerender;
16
16
  export const getStaticPaths = Page.getStaticPaths;
17
17
 
18
18
  // Get data
19
- const { collection, data, filePath, filename, path: relativeSpecPath } = await Page.getData(Astro);
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);
@@ -90,11 +90,4 @@ export class Page extends HybridPage {
90
90
  ...item,
91
91
  };
92
92
  }
93
-
94
- protected static createNotFoundResponse(): Response {
95
- return new Response(null, {
96
- status: 404,
97
- statusText: 'GraphQL specification not found',
98
- });
99
- }
100
93
  }
@@ -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
- await expect(Page.getData({ params: { type: 'entities', id: 'Order', version: '1.0.0' }, props: {} } as any)).rejects.toMatchObject({
42
- status: 404,
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({
@@ -6,6 +6,7 @@ export const prerender = Page.prerender;
6
6
  export const getStaticPaths = Page.getStaticPaths;
7
7
 
8
8
  const resourceOwner = await Page.getData(Astro);
9
+ if (!resourceOwner) return Astro.rewrite('/404');
9
10
  ---
10
11
 
11
12
  <ResourcesPage resourceOwner={resourceOwner} />
@@ -16,6 +16,7 @@ export const getStaticPaths = Page.getStaticPaths;
16
16
 
17
17
  // Get data
18
18
  const props = await Page.getData(Astro);
19
+ if (!props) return Astro.rewrite('/404');
19
20
 
20
21
  // @ts-ignore
21
22
  const { collection, data, filePath, filename, path: relativeSpecPath } = props;
@@ -91,11 +91,4 @@ export class Page extends HybridPage {
91
91
  ...item,
92
92
  };
93
93
  }
94
-
95
- protected static createNotFoundResponse(): Response {
96
- return new Response(null, {
97
- status: 404,
98
- statusText: 'OpenAPI specification not found',
99
- });
100
- }
101
94
  }
@@ -59,11 +59,4 @@ export class Page extends HybridPage {
59
59
  ...item,
60
60
  };
61
61
  }
62
-
63
- protected static createNotFoundResponse(): Response {
64
- return new Response(null, {
65
- status: 404,
66
- statusText: 'Documentation not found',
67
- });
68
- }
69
62
  }
@@ -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