@eventcatalog/core 5.0.0-beta.20 → 5.0.0-beta.22

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 (98) 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-R2X4ZEF6.js → chunk-3R4YXM3W.js} +1 -1
  6. package/dist/{chunk-FWH5T6U4.js → chunk-I7QC5DRU.js} +1 -1
  7. package/dist/{chunk-5ZUN2TXB.js → chunk-KYQBCP3A.js} +1 -1
  8. package/dist/chunk-S5GWAUG5.js +29 -0
  9. package/dist/{chunk-F236OJZD.js → chunk-UKD35J77.js} +1 -1
  10. package/dist/{chunk-3VQSVQTU.js → chunk-US5TWRHO.js} +1 -1
  11. package/dist/constants.cjs +1 -1
  12. package/dist/constants.js +1 -1
  13. package/dist/eventcatalog.cjs +32 -3
  14. package/dist/eventcatalog.js +16 -10
  15. package/dist/federation/federate.js +2 -2
  16. package/dist/generate.cjs +1 -1
  17. package/dist/generate.js +3 -3
  18. package/dist/utils/child-process-signals.cjs +53 -0
  19. package/dist/utils/child-process-signals.d.cts +19 -0
  20. package/dist/utils/child-process-signals.d.ts +19 -0
  21. package/dist/utils/child-process-signals.js +6 -0
  22. package/dist/utils/cli-logger.cjs +1 -1
  23. package/dist/utils/cli-logger.js +2 -2
  24. package/eventcatalog/src/pages/architecture/[type]/[id]/[version]/_index.data.spec.ts +2 -3
  25. package/eventcatalog/src/pages/architecture/[type]/[id]/[version]/_index.data.ts +0 -7
  26. package/eventcatalog/src/pages/architecture/[type]/[id]/[version]/index.astro +3 -1
  27. package/eventcatalog/src/pages/diagrams/[id]/[version]/_index.data.ts +0 -7
  28. package/eventcatalog/src/pages/diagrams/[id]/[version]/embed.astro +1 -0
  29. package/eventcatalog/src/pages/diagrams/[id]/[version]/index.astro +1 -0
  30. package/eventcatalog/src/pages/directory/[type]/_index.data.ts +5 -7
  31. package/eventcatalog/src/pages/directory/[type]/index.astro +3 -1
  32. package/eventcatalog/src/pages/discover/[type]/_index.data.ts +5 -7
  33. package/eventcatalog/src/pages/discover/[type]/index.astro +3 -1
  34. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/[docVersion]/_index.data.ts +0 -7
  35. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/[docVersion]/index.astro +1 -0
  36. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/_index.data.ts +0 -7
  37. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/index.astro +1 -0
  38. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/_index.data.ts +0 -7
  39. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/asyncapi/[filename].astro +3 -1
  40. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/asyncapi/_[filename].data.ts +0 -7
  41. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/changelog/_index.data.ts +0 -7
  42. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/changelog/index.astro +1 -0
  43. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/examples/[...filename].astro +1 -0
  44. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/examples/_[...filename].data.ts +0 -4
  45. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/field-lineage/_index.data.ts +0 -7
  46. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/field-lineage/index.astro +1 -0
  47. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/graphql/[filename].astro +3 -1
  48. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/graphql/_[filename].data.ts +0 -7
  49. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +1 -0
  50. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/resources/_index.data.spec.ts +2 -3
  51. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/resources/_index.data.ts +0 -7
  52. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/resources/index.astro +1 -0
  53. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/spec/[filename].astro +1 -0
  54. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/spec/_[filename].data.ts +0 -7
  55. package/eventcatalog/src/pages/docs/[type]/[id]/_index.data.ts +0 -7
  56. package/eventcatalog/src/pages/docs/[type]/[id]/index.astro +1 -0
  57. package/eventcatalog/src/pages/docs/[type]/[id]/language/[dictionaryId]/_index.data.ts +0 -7
  58. package/eventcatalog/src/pages/docs/[type]/[id]/language/[dictionaryId]/index.astro +1 -0
  59. package/eventcatalog/src/pages/docs/[type]/[id]/language/_index.data.ts +0 -7
  60. package/eventcatalog/src/pages/docs/[type]/[id]/language/index.astro +1 -0
  61. package/eventcatalog/src/pages/docs/custom/[...path]/_index.data.ts +0 -7
  62. package/eventcatalog/src/pages/docs/custom/[...path]/index.astro +1 -0
  63. package/eventcatalog/src/pages/docs/services/[id]/[docType]/[docId]/index.astro +1 -1
  64. package/eventcatalog/src/pages/docs/services/[id]/[version]/resources/index.astro +1 -0
  65. package/eventcatalog/src/pages/docs/services/[id]/asyncapi/[filename].astro +1 -1
  66. package/eventcatalog/src/pages/docs/services/[id]/changelog/index.astro +1 -1
  67. package/eventcatalog/src/pages/docs/services/[id]/graphql/[filename].astro +1 -1
  68. package/eventcatalog/src/pages/docs/services/[id]/spec/[filename].astro +1 -1
  69. package/eventcatalog/src/pages/docs/teams/[id]/_index.data.ts +0 -7
  70. package/eventcatalog/src/pages/docs/teams/[id]/index.astro +1 -0
  71. package/eventcatalog/src/pages/docs/users/[id]/_index.data.ts +0 -7
  72. package/eventcatalog/src/pages/docs/users/[id]/index.astro +1 -0
  73. package/eventcatalog/src/pages/schemas/[type]/[id]/[version]/_index.data.ts +0 -7
  74. package/eventcatalog/src/pages/schemas/[type]/[id]/[version]/index.astro +1 -0
  75. package/eventcatalog/src/pages/schemas/explorer/_index.data.ts +0 -7
  76. package/eventcatalog/src/pages/schemas/explorer/index.astro +3 -1
  77. package/eventcatalog/src/pages/triggers/[type]/[id]/[version]/_index.data.ts +0 -7
  78. package/eventcatalog/src/pages/triggers/[type]/[id]/[version]/index.astro +1 -0
  79. package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/_index.data.ts +0 -7
  80. package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/data/_index.data.ts +0 -7
  81. package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/data/index.astro +1 -0
  82. package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/entity-map/_index.data.ts +0 -7
  83. package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/entity-map/index.astro +1 -0
  84. package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/index.astro +1 -0
  85. package/eventcatalog/src/pages/visualiser/[type]/[id]/_index.data.ts +38 -0
  86. package/eventcatalog/src/pages/visualiser/[type]/[id]/index.astro +17 -40
  87. package/eventcatalog/src/pages/visualiser/designs/[id]/_index.data.ts +0 -7
  88. package/eventcatalog/src/pages/visualiser/designs/[id]/index.astro +2 -1
  89. package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/entity-map/_index.data.ts +0 -7
  90. package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/entity-map/index.astro +1 -0
  91. package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/index.astro +1 -0
  92. package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/systems-context/_index.data.ts +0 -7
  93. package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/systems-context/index.astro +1 -0
  94. package/eventcatalog/src/pages/visualiser/systems/[id]/[version]/context/_index.data.ts +0 -7
  95. package/eventcatalog/src/pages/visualiser/systems/[id]/[version]/context/index.astro +1 -0
  96. package/eventcatalog/src/pages/visualiser/systems/[id]/[version]/index.astro +1 -0
  97. package/eventcatalog/src/utils/page-loaders/hybrid-page.ts +4 -15
  98. package/package.json +1 -1
@@ -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.20";
39
+ var version = "5.0.0-beta.22";
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-FWH5T6U4.js";
3
+ } from "../chunk-I7QC5DRU.js";
4
4
  import "../chunk-CPW6G62V.js";
5
- import "../chunk-R2X4ZEF6.js";
5
+ import "../chunk-3R4YXM3W.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.20";
179
+ var version = "5.0.0-beta.22";
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-5ZUN2TXB.js";
3
+ } from "../chunk-KYQBCP3A.js";
4
4
  import "../chunk-AWOO63ME.js";
5
5
  import "../chunk-ZAZHAVKB.js";
6
- import "../chunk-FWH5T6U4.js";
6
+ import "../chunk-I7QC5DRU.js";
7
7
  import "../chunk-CPW6G62V.js";
8
- import "../chunk-R2X4ZEF6.js";
8
+ import "../chunk-3R4YXM3W.js";
9
9
  import "../chunk-RFIXKATC.js";
10
10
  export {
11
11
  log_build_default as default
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "5.0.0-beta.20";
2
+ var version = "5.0.0-beta.22";
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-R2X4ZEF6.js";
7
+ } from "./chunk-3R4YXM3W.js";
8
8
 
9
9
  // src/analytics/analytics.js
10
10
  import os from "os";
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-ZAZHAVKB.js";
9
9
  import {
10
10
  raiseEvent
11
- } from "./chunk-FWH5T6U4.js";
11
+ } from "./chunk-I7QC5DRU.js";
12
12
  import {
13
13
  TELEMETRY_REQUEST_TIMEOUT_MS,
14
14
  isTelemetryDisabled
@@ -0,0 +1,29 @@
1
+ // src/utils/child-process-signals.ts
2
+ import { constants } from "os";
3
+ var FORWARDED_SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
4
+ var isRunning = (child) => child.exitCode === null && child.signalCode === null;
5
+ var stopChildWithParent = (child, parent = process) => {
6
+ let received;
7
+ const onSignal = (signal) => {
8
+ received = signal;
9
+ if (isRunning(child)) child.kill(signal);
10
+ };
11
+ const onExit = () => {
12
+ if (isRunning(child)) child.kill("SIGTERM");
13
+ };
14
+ for (const signal of FORWARDED_SIGNALS) parent.on(signal, onSignal);
15
+ parent.on("exit", onExit);
16
+ return {
17
+ childClosed: () => {
18
+ for (const signal of FORWARDED_SIGNALS) parent.off(signal, onSignal);
19
+ parent.off("exit", onExit);
20
+ if (!received) return false;
21
+ parent.exit(128 + constants.signals[received]);
22
+ return true;
23
+ }
24
+ };
25
+ };
26
+
27
+ export {
28
+ stopChildWithParent
29
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-R2X4ZEF6.js";
3
+ } from "./chunk-3R4YXM3W.js";
4
4
 
5
5
  // src/utils/cli-logger.ts
6
6
  import pc from "picocolors";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logger
3
- } from "./chunk-F236OJZD.js";
3
+ } from "./chunk-UKD35J77.js";
4
4
  import {
5
5
  cleanup,
6
6
  getEventCatalogConfigFile
@@ -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.20";
28
+ var version = "5.0.0-beta.22";
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-R2X4ZEF6.js";
3
+ } from "./chunk-3R4YXM3W.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.20";
184
+ var version = "5.0.0-beta.22";
185
185
 
186
186
  // src/constants.ts
187
187
  var VERSION = version;
@@ -965,6 +965,32 @@ var runMigrations = async (dir2) => {
965
965
  await message_channels_to_service_channels_default(dir2);
966
966
  };
967
967
 
968
+ // src/utils/child-process-signals.ts
969
+ var import_node_os3 = require("os");
970
+ var FORWARDED_SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
971
+ var isRunning = (child) => child.exitCode === null && child.signalCode === null;
972
+ var stopChildWithParent = (child, parent = process) => {
973
+ let received;
974
+ const onSignal = (signal) => {
975
+ received = signal;
976
+ if (isRunning(child)) child.kill(signal);
977
+ };
978
+ const onExit = () => {
979
+ if (isRunning(child)) child.kill("SIGTERM");
980
+ };
981
+ for (const signal of FORWARDED_SIGNALS) parent.on(signal, onSignal);
982
+ parent.on("exit", onExit);
983
+ return {
984
+ childClosed: () => {
985
+ for (const signal of FORWARDED_SIGNALS) parent.off(signal, onSignal);
986
+ parent.off("exit", onExit);
987
+ if (!received) return false;
988
+ parent.exit(128 + import_node_os3.constants.signals[received]);
989
+ return true;
990
+ }
991
+ };
992
+ };
993
+
968
994
  // eventcatalog/src/features/fields/field-indexer.ts
969
995
  var import_node_path10 = __toESM(require("path"), 1);
970
996
  var import_node_fs7 = __toESM(require("fs"), 1);
@@ -2553,7 +2579,7 @@ var createFileSystemSourceProvider = (projectDirectory) => ({
2553
2579
  // src/federation/github-source-provider.ts
2554
2580
  var import_node_child_process = require("child_process");
2555
2581
  var import_promises9 = __toESM(require("fs/promises"), 1);
2556
- var import_node_os3 = __toESM(require("os"), 1);
2582
+ var import_node_os4 = __toESM(require("os"), 1);
2557
2583
  var import_node_path18 = __toESM(require("path"), 1);
2558
2584
  var import_node_util = require("util");
2559
2585
  var import_sdk2 = __toESM(require("@eventcatalog/sdk"), 1);
@@ -2610,7 +2636,7 @@ var getGitEnvironment = (token) => {
2610
2636
  var createCheckout = (executeFile, token) => async (source, ref, callback) => {
2611
2637
  const { owner, repository } = parseGitHubSource(source);
2612
2638
  const catalogPath = import_node_path18.default.posix.normalize(source.path ?? ".");
2613
- const directory = await import_promises9.default.mkdtemp(import_node_path18.default.join(import_node_os3.default.tmpdir(), "eventcatalog-federation-"));
2639
+ const directory = await import_promises9.default.mkdtemp(import_node_path18.default.join(import_node_os4.default.tmpdir(), "eventcatalog-federation-"));
2614
2640
  const env = getGitEnvironment(token);
2615
2641
  try {
2616
2642
  const git = (args) => executeFile("git", args, { cwd: directory, env, encoding: "utf8" });
@@ -3097,6 +3123,7 @@ var runCommandWithFilteredOutput = async ({
3097
3123
  },
3098
3124
  stdio: ["inherit", "pipe", "pipe"]
3099
3125
  });
3126
+ const signals = stopChildWithParent(child);
3100
3127
  let stdoutBuffer = "";
3101
3128
  let stderrBuffer = "";
3102
3129
  const flush = (buffer, writer, isFinal = false) => {
@@ -3124,11 +3151,13 @@ var runCommandWithFilteredOutput = async ({
3124
3151
  stderrBuffer = flush(stderrBuffer, process.stderr);
3125
3152
  });
3126
3153
  child.on("error", (error) => {
3154
+ signals.childClosed();
3127
3155
  reject(error);
3128
3156
  });
3129
3157
  child.on("close", (code) => {
3130
3158
  stdoutBuffer = flush(stdoutBuffer, process.stdout, true);
3131
3159
  stderrBuffer = flush(stderrBuffer, process.stderr, true);
3160
+ if (signals.childClosed()) return;
3132
3161
  if (code === 0) {
3133
3162
  resolve2();
3134
3163
  return;
@@ -1,15 +1,18 @@
1
1
  import {
2
- runMigrations
3
- } from "./chunk-XUAF2H54.js";
4
- import "./chunk-CA4U2JP7.js";
2
+ stopChildWithParent
3
+ } from "./chunk-S5GWAUG5.js";
5
4
  import {
6
5
  log_build_default
7
- } from "./chunk-5ZUN2TXB.js";
6
+ } from "./chunk-KYQBCP3A.js";
8
7
  import {
9
8
  getLicenseStatus,
10
9
  printLicenseStatus
11
10
  } from "./chunk-AWOO63ME.js";
12
11
  import "./chunk-ZAZHAVKB.js";
12
+ import {
13
+ runMigrations
14
+ } from "./chunk-XUAF2H54.js";
15
+ import "./chunk-CA4U2JP7.js";
13
16
  import {
14
17
  FederationConflictError,
15
18
  FederationDiagnosticError,
@@ -18,13 +21,13 @@ import {
18
21
  import "./chunk-WRNH5C3U.js";
19
22
  import "./chunk-5EPNFDT5.js";
20
23
  import "./chunk-A2RZR3U4.js";
24
+ import "./chunk-SDZQJTJW.js";
25
+ import "./chunk-352FGP6W.js";
21
26
  import "./chunk-R7Z5ALYI.js";
22
27
  import {
23
28
  getFederationDiagnosticCounts,
24
29
  getVisibleFederationDiagnostics
25
30
  } from "./chunk-JJPB6EOZ.js";
26
- import "./chunk-SDZQJTJW.js";
27
- import "./chunk-352FGP6W.js";
28
31
  import {
29
32
  getProjectOutDir,
30
33
  isAuthEnabled,
@@ -33,10 +36,10 @@ import {
33
36
  } from "./chunk-MDWB5HLO.js";
34
37
  import {
35
38
  generate
36
- } from "./chunk-3VQSVQTU.js";
39
+ } from "./chunk-US5TWRHO.js";
37
40
  import {
38
41
  logger
39
- } from "./chunk-F236OJZD.js";
42
+ } from "./chunk-UKD35J77.js";
40
43
  import {
41
44
  resolve_catalog_dependencies_default
42
45
  } from "./chunk-36RYTYT5.js";
@@ -50,7 +53,7 @@ import {
50
53
  import {
51
54
  watch
52
55
  } from "./chunk-U63GDPPY.js";
53
- import "./chunk-FWH5T6U4.js";
56
+ import "./chunk-I7QC5DRU.js";
54
57
  import "./chunk-CPW6G62V.js";
55
58
  import {
56
59
  getAstroConfigPath
@@ -67,7 +70,7 @@ import {
67
70
  } from "./chunk-LFQJXLHG.js";
68
71
  import {
69
72
  VERSION
70
- } from "./chunk-R2X4ZEF6.js";
73
+ } from "./chunk-3R4YXM3W.js";
71
74
  import {
72
75
  getEventCatalogConfigFile,
73
76
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -786,6 +789,7 @@ var runCommandWithFilteredOutput = async ({
786
789
  },
787
790
  stdio: ["inherit", "pipe", "pipe"]
788
791
  });
792
+ const signals = stopChildWithParent(child);
789
793
  let stdoutBuffer = "";
790
794
  let stderrBuffer = "";
791
795
  const flush = (buffer, writer, isFinal = false) => {
@@ -813,11 +817,13 @@ var runCommandWithFilteredOutput = async ({
813
817
  stderrBuffer = flush(stderrBuffer, process.stderr);
814
818
  });
815
819
  child.on("error", (error) => {
820
+ signals.childClosed();
816
821
  reject(error);
817
822
  });
818
823
  child.on("close", (code) => {
819
824
  stdoutBuffer = flush(stdoutBuffer, process.stdout, true);
820
825
  stderrBuffer = flush(stderrBuffer, process.stderr, true);
826
+ if (signals.childClosed()) return;
821
827
  if (code === 0) {
822
828
  resolve();
823
829
  return;
@@ -6,10 +6,10 @@ import {
6
6
  import "../chunk-WRNH5C3U.js";
7
7
  import "../chunk-5EPNFDT5.js";
8
8
  import "../chunk-A2RZR3U4.js";
9
- import "../chunk-R7Z5ALYI.js";
10
- import "../chunk-JJPB6EOZ.js";
11
9
  import "../chunk-SDZQJTJW.js";
12
10
  import "../chunk-352FGP6W.js";
11
+ import "../chunk-R7Z5ALYI.js";
12
+ import "../chunk-JJPB6EOZ.js";
13
13
  import "../chunk-RFIXKATC.js";
14
14
  export {
15
15
  FederationConflictError,
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.20";
115
+ var version = "5.0.0-beta.22";
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-3VQSVQTU.js";
4
- import "./chunk-F236OJZD.js";
5
- import "./chunk-R2X4ZEF6.js";
3
+ } from "./chunk-US5TWRHO.js";
4
+ import "./chunk-UKD35J77.js";
5
+ import "./chunk-3R4YXM3W.js";
6
6
  import "./chunk-RFIXKATC.js";
7
7
  export {
8
8
  generate
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/utils/child-process-signals.ts
21
+ var child_process_signals_exports = {};
22
+ __export(child_process_signals_exports, {
23
+ stopChildWithParent: () => stopChildWithParent
24
+ });
25
+ module.exports = __toCommonJS(child_process_signals_exports);
26
+ var import_node_os = require("os");
27
+ var FORWARDED_SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
28
+ var isRunning = (child) => child.exitCode === null && child.signalCode === null;
29
+ var stopChildWithParent = (child, parent = process) => {
30
+ let received;
31
+ const onSignal = (signal) => {
32
+ received = signal;
33
+ if (isRunning(child)) child.kill(signal);
34
+ };
35
+ const onExit = () => {
36
+ if (isRunning(child)) child.kill("SIGTERM");
37
+ };
38
+ for (const signal of FORWARDED_SIGNALS) parent.on(signal, onSignal);
39
+ parent.on("exit", onExit);
40
+ return {
41
+ childClosed: () => {
42
+ for (const signal of FORWARDED_SIGNALS) parent.off(signal, onSignal);
43
+ parent.off("exit", onExit);
44
+ if (!received) return false;
45
+ parent.exit(128 + import_node_os.constants.signals[received]);
46
+ return true;
47
+ }
48
+ };
49
+ };
50
+ // Annotate the CommonJS export names for ESM import in node:
51
+ 0 && (module.exports = {
52
+ stopChildWithParent
53
+ });
@@ -0,0 +1,19 @@
1
+ import { ChildProcess } from 'node:child_process';
2
+
3
+ type Child = Pick<ChildProcess, 'kill' | 'exitCode' | 'signalCode'>;
4
+ type Parent = Pick<NodeJS.Process, 'on' | 'off' | 'exit'>;
5
+ /**
6
+ * Stops a child process along with the CLI. Without this, `kill` or a container stopping the CLI
7
+ * stopped the CLI only: its child (e.g. the server `eventcatalog start` runs) kept running and holding
8
+ * its port. A signal the CLI receives is passed to the child, which can finish what it's doing; the
9
+ * CLI then exits as the signal would have stopped it (128 + the signal's number). It exits explicitly
10
+ * rather than raising the signal again, which a container's first process (PID 1) would ignore.
11
+ *
12
+ * Call `childClosed` once the child has closed: it returns true when the CLI is exiting because of a
13
+ * signal, so the caller shouldn't report the child's exit as a failure.
14
+ */
15
+ declare const stopChildWithParent: (child: Child, parent?: Parent) => {
16
+ childClosed: () => boolean;
17
+ };
18
+
19
+ export { stopChildWithParent };
@@ -0,0 +1,19 @@
1
+ import { ChildProcess } from 'node:child_process';
2
+
3
+ type Child = Pick<ChildProcess, 'kill' | 'exitCode' | 'signalCode'>;
4
+ type Parent = Pick<NodeJS.Process, 'on' | 'off' | 'exit'>;
5
+ /**
6
+ * Stops a child process along with the CLI. Without this, `kill` or a container stopping the CLI
7
+ * stopped the CLI only: its child (e.g. the server `eventcatalog start` runs) kept running and holding
8
+ * its port. A signal the CLI receives is passed to the child, which can finish what it's doing; the
9
+ * CLI then exits as the signal would have stopped it (128 + the signal's number). It exits explicitly
10
+ * rather than raising the signal again, which a container's first process (PID 1) would ignore.
11
+ *
12
+ * Call `childClosed` once the child has closed: it returns true when the CLI is exiting because of a
13
+ * signal, so the caller shouldn't report the child's exit as a failure.
14
+ */
15
+ declare const stopChildWithParent: (child: Child, parent?: Parent) => {
16
+ childClosed: () => boolean;
17
+ };
18
+
19
+ export { stopChildWithParent };
@@ -0,0 +1,6 @@
1
+ import {
2
+ stopChildWithParent
3
+ } from "../chunk-S5GWAUG5.js";
4
+ export {
5
+ stopChildWithParent
6
+ };
@@ -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.20";
39
+ var version = "5.0.0-beta.22";
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-F236OJZD.js";
4
- import "../chunk-R2X4ZEF6.js";
3
+ } from "../chunk-UKD35J77.js";
4
+ import "../chunk-3R4YXM3W.js";
5
5
  export {
6
6
  logger
7
7
  };
@@ -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
  }