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

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.
@@ -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.21";
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-WHYRRLHE.js";
4
4
  import "../chunk-CPW6G62V.js";
5
- import "../chunk-R2X4ZEF6.js";
5
+ import "../chunk-RIRRWE7D.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.21";
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-I7F7CPDC.js";
4
4
  import "../chunk-AWOO63ME.js";
5
5
  import "../chunk-ZAZHAVKB.js";
6
- import "../chunk-FWH5T6U4.js";
6
+ import "../chunk-WHYRRLHE.js";
7
7
  import "../chunk-CPW6G62V.js";
8
- import "../chunk-R2X4ZEF6.js";
8
+ import "../chunk-RIRRWE7D.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-FWH5T6U4.js";
11
+ } from "./chunk-WHYRRLHE.js";
12
12
  import {
13
13
  TELEMETRY_REQUEST_TIMEOUT_MS,
14
14
  isTelemetryDisabled
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logger
3
- } from "./chunk-F236OJZD.js";
3
+ } from "./chunk-W6KDW6ZC.js";
4
4
  import {
5
5
  cleanup,
6
6
  getEventCatalogConfigFile
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "5.0.0-beta.20";
2
+ var version = "5.0.0-beta.21";
3
3
 
4
4
  // src/constants.ts
5
5
  var VERSION = version;
@@ -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-RIRRWE7D.js";
4
4
 
5
5
  // src/utils/cli-logger.ts
6
6
  import pc from "picocolors";
@@ -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-RIRRWE7D.js";
8
8
 
9
9
  // src/analytics/analytics.js
10
10
  import os from "os";
@@ -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.21";
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-RIRRWE7D.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.21";
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;
@@ -2,9 +2,12 @@ import {
2
2
  runMigrations
3
3
  } from "./chunk-XUAF2H54.js";
4
4
  import "./chunk-CA4U2JP7.js";
5
+ import {
6
+ stopChildWithParent
7
+ } from "./chunk-S5GWAUG5.js";
5
8
  import {
6
9
  log_build_default
7
- } from "./chunk-5ZUN2TXB.js";
10
+ } from "./chunk-I7F7CPDC.js";
8
11
  import {
9
12
  getLicenseStatus,
10
13
  printLicenseStatus
@@ -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-OVWDUANF.js";
37
40
  import {
38
41
  logger
39
- } from "./chunk-F236OJZD.js";
42
+ } from "./chunk-W6KDW6ZC.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-WHYRRLHE.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-RIRRWE7D.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;
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.21";
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-OVWDUANF.js";
4
+ import "./chunk-W6KDW6ZC.js";
5
+ import "./chunk-RIRRWE7D.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.21";
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-W6KDW6ZC.js";
4
+ import "../chunk-RIRRWE7D.js";
5
5
  export {
6
6
  logger
7
7
  };
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  },
8
8
  "license": "BUSL-1.1",
9
9
  "type": "module",
10
- "version": "5.0.0-beta.20",
10
+ "version": "5.0.0-beta.21",
11
11
  "publishConfig": {
12
12
  "access": "public"
13
13
  },
@@ -141,9 +141,9 @@
141
141
  "y-protocols": "^1.0.7",
142
142
  "yjs": "^13.6.33",
143
143
  "zod": "^4.3.6",
144
- "@eventcatalog/linter": "1.2.0-beta.3",
144
+ "@eventcatalog/sdk": "2.30.0-beta.1",
145
145
  "@eventcatalog/visualiser": "^5.0.0-beta.6",
146
- "@eventcatalog/sdk": "2.30.0-beta.1"
146
+ "@eventcatalog/linter": "1.2.0-beta.3"
147
147
  },
148
148
  "devDependencies": {
149
149
  "@astrojs/check": "^0.9.10",