@eventcatalog/core 4.10.4 → 4.10.6

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 = "4.10.4";
39
+ var version = "4.10.6";
40
40
 
41
41
  // src/constants.ts
42
42
  var VERSION = version;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "../chunk-6S2ZIVEV.js";
4
- import "../chunk-322TAIDG.js";
3
+ } from "../chunk-NECJFWMI.js";
4
+ import "../chunk-YSWJHMAX.js";
5
5
  export {
6
6
  raiseEvent
7
7
  };
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,16 +17,28 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // src/analytics/count-resources.js
21
31
  var count_resources_exports = {};
22
32
  __export(count_resources_exports, {
23
33
  countResources: () => countResources,
34
+ hashCatalogContent: () => hashCatalogContent,
24
35
  serializeCounts: () => serializeCounts
25
36
  });
26
37
  module.exports = __toCommonJS(count_resources_exports);
27
38
  var import_glob = require("glob");
39
+ var import_node_crypto = require("crypto");
40
+ var import_promises = require("fs/promises");
41
+ var import_node_path = __toESM(require("path"), 1);
28
42
  var RESOURCE_PATTERNS = {
29
43
  adrs: ["**/adrs/*/index.@(md|mdx)"],
30
44
  agents: ["**/agents/*/index.@(md|mdx)"],
@@ -65,11 +79,29 @@ async function countResources(projectDir) {
65
79
  }
66
80
  return counts;
67
81
  }
82
+ async function hashCatalogContent(projectDir) {
83
+ const hash = (0, import_node_crypto.createHash)("sha256");
84
+ const files = /* @__PURE__ */ new Set();
85
+ for (const pattern of Object.values(RESOURCE_PATTERNS).flat()) {
86
+ for (const file of await (0, import_glob.glob)(pattern, { cwd: projectDir, ignore: DEFAULT_IGNORES })) {
87
+ files.add(file);
88
+ }
89
+ }
90
+ for (const file of [...files].sort()) {
91
+ try {
92
+ hash.update(file);
93
+ hash.update(await (0, import_promises.readFile)(import_node_path.default.join(projectDir, file)));
94
+ } catch {
95
+ }
96
+ }
97
+ return hash.digest("hex").slice(0, 16);
98
+ }
68
99
  function serializeCounts(counts) {
69
100
  return Object.entries(counts).map(([k, v]) => `${k}:${v}`).join(",");
70
101
  }
71
102
  // Annotate the CommonJS export names for ESM import in node:
72
103
  0 && (module.exports = {
73
104
  countResources,
105
+ hashCatalogContent,
74
106
  serializeCounts
75
107
  });
@@ -4,6 +4,14 @@
4
4
  * @returns {Promise<Record<string, number>>} - Object with resource type counts
5
5
  */
6
6
  declare function countResources(projectDir: string): Promise<Record<string, number>>;
7
+ /**
8
+ * Digest of the catalog's documentation content. Resource counts only move when
9
+ * things are added or removed; this also changes when existing docs are edited,
10
+ * so telemetry can tell "docs changed" apart from a plain redeploy.
11
+ * @param {string} projectDir - Path to the catalog directory
12
+ * @returns {Promise<string>} - Short hex digest of the catalog content
13
+ */
14
+ declare function hashCatalogContent(projectDir: string): Promise<string>;
7
15
  /**
8
16
  * Serialize resource counts to a string for telemetry
9
17
  * @param {Record<string, number>} counts - Object with resource type counts
@@ -11,4 +19,4 @@ declare function countResources(projectDir: string): Promise<Record<string, numb
11
19
  */
12
20
  declare function serializeCounts(counts: Record<string, number>): string;
13
21
 
14
- export { countResources, serializeCounts };
22
+ export { countResources, hashCatalogContent, serializeCounts };
@@ -4,6 +4,14 @@
4
4
  * @returns {Promise<Record<string, number>>} - Object with resource type counts
5
5
  */
6
6
  declare function countResources(projectDir: string): Promise<Record<string, number>>;
7
+ /**
8
+ * Digest of the catalog's documentation content. Resource counts only move when
9
+ * things are added or removed; this also changes when existing docs are edited,
10
+ * so telemetry can tell "docs changed" apart from a plain redeploy.
11
+ * @param {string} projectDir - Path to the catalog directory
12
+ * @returns {Promise<string>} - Short hex digest of the catalog content
13
+ */
14
+ declare function hashCatalogContent(projectDir: string): Promise<string>;
7
15
  /**
8
16
  * Serialize resource counts to a string for telemetry
9
17
  * @param {Record<string, number>} counts - Object with resource type counts
@@ -11,4 +19,4 @@ declare function countResources(projectDir: string): Promise<Record<string, numb
11
19
  */
12
20
  declare function serializeCounts(counts: Record<string, number>): string;
13
21
 
14
- export { countResources, serializeCounts };
22
+ export { countResources, hashCatalogContent, serializeCounts };
@@ -1,8 +1,10 @@
1
1
  import {
2
2
  countResources,
3
+ hashCatalogContent,
3
4
  serializeCounts
4
- } from "../chunk-K2XIENVT.js";
5
+ } from "../chunk-ZAZHAVKB.js";
5
6
  export {
6
7
  countResources,
8
+ hashCatalogContent,
7
9
  serializeCounts
8
10
  };
@@ -140,7 +140,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
140
140
  var import_os = __toESM(require("os"), 1);
141
141
 
142
142
  // package.json
143
- var version = "4.10.4";
143
+ var version = "4.10.6";
144
144
 
145
145
  // src/constants.ts
146
146
  var VERSION = version;
@@ -178,6 +178,9 @@ async function raiseEvent(eventData) {
178
178
 
179
179
  // src/analytics/count-resources.js
180
180
  var import_glob = require("glob");
181
+ var import_node_crypto = require("crypto");
182
+ var import_promises2 = require("fs/promises");
183
+ var import_node_path2 = __toESM(require("path"), 1);
181
184
  var RESOURCE_PATTERNS = {
182
185
  adrs: ["**/adrs/*/index.@(md|mdx)"],
183
186
  agents: ["**/agents/*/index.@(md|mdx)"],
@@ -218,6 +221,23 @@ async function countResources(projectDir) {
218
221
  }
219
222
  return counts;
220
223
  }
224
+ async function hashCatalogContent(projectDir) {
225
+ const hash = (0, import_node_crypto.createHash)("sha256");
226
+ const files = /* @__PURE__ */ new Set();
227
+ for (const pattern of Object.values(RESOURCE_PATTERNS).flat()) {
228
+ for (const file of await (0, import_glob.glob)(pattern, { cwd: projectDir, ignore: DEFAULT_IGNORES })) {
229
+ files.add(file);
230
+ }
231
+ }
232
+ for (const file of [...files].sort()) {
233
+ try {
234
+ hash.update(file);
235
+ hash.update(await (0, import_promises2.readFile)(import_node_path2.default.join(projectDir, file)));
236
+ } catch {
237
+ }
238
+ }
239
+ return hash.digest("hex").slice(0, 16);
240
+ }
221
241
  function serializeCounts(counts) {
222
242
  return Object.entries(counts).map(([k, v]) => `${k}:${v}`).join(",");
223
243
  }
@@ -291,7 +311,7 @@ var reportCloudResourceInventory = async (configFile, resourceCounts) => {
291
311
  })
292
312
  });
293
313
  };
294
- var main = async (projectDir, { isEventCatalogStarterEnabled, isEventCatalogScaleEnabled, isBackstagePluginEnabled }) => {
314
+ var main = async (projectDir, { isEventCatalogStarterEnabled, isEventCatalogScaleEnabled, isBackstagePluginEnabled, command = "build" }) => {
295
315
  try {
296
316
  await verifyRequiredFieldsAreInCatalogConfigFile(projectDir);
297
317
  const configFile = await getEventCatalogConfigFile(projectDir);
@@ -308,11 +328,18 @@ var main = async (projectDir, { isEventCatalogStarterEnabled, isEventCatalogScal
308
328
  }
309
329
  const features = await getFeatures(configFile);
310
330
  const resourceCounts = await countResources(projectDir);
331
+ const contentHash = await hashCatalogContent(projectDir);
311
332
  await reportCloudResourceInventory(configFile, resourceCounts);
312
333
  await raiseEvent({
313
- command: "build",
334
+ command,
314
335
  org: organizationName,
315
336
  cId,
337
+ // CI redeploys and human-run builds are different signals; tag rather than suppress
338
+ ci: process.env.CI ? "true" : "false",
339
+ // The commercial plan, separate from the generators list, so telemetry joins cleanly to licensing
340
+ plan: isEventCatalogScaleEnabled ? "scale" : isEventCatalogStarterEnabled ? "starter" : "none",
341
+ backstage: isBackstagePluginEnabled ? "true" : "false",
342
+ contentHash,
316
343
  generators: generatorNames.toString(),
317
344
  features: Object.keys(features).map((feature) => `${feature}:${features[feature]}`).join(","),
318
345
  directorySources: serializeDirectorySources(configFile),
@@ -2,10 +2,11 @@
2
2
  *
3
3
  * @param {string} projectDir
4
4
  */
5
- declare function main(projectDir: string, { isEventCatalogStarterEnabled, isEventCatalogScaleEnabled, isBackstagePluginEnabled }: {
5
+ declare function main(projectDir: string, { isEventCatalogStarterEnabled, isEventCatalogScaleEnabled, isBackstagePluginEnabled, command }: {
6
6
  isEventCatalogStarterEnabled: any;
7
7
  isEventCatalogScaleEnabled: any;
8
8
  isBackstagePluginEnabled: any;
9
+ command?: string | undefined;
9
10
  }): Promise<void>;
10
11
 
11
12
  export { main as default };
@@ -2,10 +2,11 @@
2
2
  *
3
3
  * @param {string} projectDir
4
4
  */
5
- declare function main(projectDir: string, { isEventCatalogStarterEnabled, isEventCatalogScaleEnabled, isBackstagePluginEnabled }: {
5
+ declare function main(projectDir: string, { isEventCatalogStarterEnabled, isEventCatalogScaleEnabled, isBackstagePluginEnabled, command }: {
6
6
  isEventCatalogStarterEnabled: any;
7
7
  isEventCatalogScaleEnabled: any;
8
8
  isBackstagePluginEnabled: any;
9
+ command?: string | undefined;
9
10
  }): Promise<void>;
10
11
 
11
12
  export { main as default };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  log_build_default
3
- } from "../chunk-2SLBVVUZ.js";
4
- import "../chunk-6S2ZIVEV.js";
5
- import "../chunk-K2XIENVT.js";
6
- import "../chunk-322TAIDG.js";
3
+ } from "../chunk-EB43LSVE.js";
4
+ import "../chunk-NECJFWMI.js";
5
+ import "../chunk-ZAZHAVKB.js";
6
+ import "../chunk-YSWJHMAX.js";
7
7
  import "../chunk-6QENHZZP.js";
8
8
  export {
9
9
  log_build_default as default
@@ -1,10 +1,11 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "./chunk-6S2ZIVEV.js";
3
+ } from "./chunk-NECJFWMI.js";
4
4
  import {
5
5
  countResources,
6
+ hashCatalogContent,
6
7
  serializeCounts
7
- } from "./chunk-K2XIENVT.js";
8
+ } from "./chunk-ZAZHAVKB.js";
8
9
  import {
9
10
  getEventCatalogConfigFile,
10
11
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -79,7 +80,7 @@ var reportCloudResourceInventory = async (configFile, resourceCounts) => {
79
80
  })
80
81
  });
81
82
  };
82
- var main = async (projectDir, { isEventCatalogStarterEnabled, isEventCatalogScaleEnabled, isBackstagePluginEnabled }) => {
83
+ var main = async (projectDir, { isEventCatalogStarterEnabled, isEventCatalogScaleEnabled, isBackstagePluginEnabled, command = "build" }) => {
83
84
  try {
84
85
  await verifyRequiredFieldsAreInCatalogConfigFile(projectDir);
85
86
  const configFile = await getEventCatalogConfigFile(projectDir);
@@ -96,11 +97,18 @@ var main = async (projectDir, { isEventCatalogStarterEnabled, isEventCatalogScal
96
97
  }
97
98
  const features = await getFeatures(configFile);
98
99
  const resourceCounts = await countResources(projectDir);
100
+ const contentHash = await hashCatalogContent(projectDir);
99
101
  await reportCloudResourceInventory(configFile, resourceCounts);
100
102
  await raiseEvent({
101
- command: "build",
103
+ command,
102
104
  org: organizationName,
103
105
  cId,
106
+ // CI redeploys and human-run builds are different signals; tag rather than suppress
107
+ ci: process.env.CI ? "true" : "false",
108
+ // The commercial plan, separate from the generators list, so telemetry joins cleanly to licensing
109
+ plan: isEventCatalogScaleEnabled ? "scale" : isEventCatalogStarterEnabled ? "starter" : "none",
110
+ backstage: isBackstagePluginEnabled ? "true" : "false",
111
+ contentHash,
104
112
  generators: generatorNames.toString(),
105
113
  features: Object.keys(features).map((feature) => `${feature}:${features[feature]}`).join(","),
106
114
  directorySources: serializeDirectorySources(configFile),
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-322TAIDG.js";
3
+ } from "./chunk-YSWJHMAX.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
  VERSION
3
- } from "./chunk-322TAIDG.js";
3
+ } from "./chunk-YSWJHMAX.js";
4
4
 
5
5
  // src/analytics/analytics.js
6
6
  import os from "os";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logger
3
- } from "./chunk-T5XTOY52.js";
3
+ } from "./chunk-GMVJ4B2S.js";
4
4
  import {
5
5
  cleanup,
6
6
  getEventCatalogConfigFile
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "4.10.4";
2
+ var version = "4.10.6";
3
3
 
4
4
  // src/constants.ts
5
5
  var VERSION = version;
@@ -1,5 +1,8 @@
1
1
  // src/analytics/count-resources.js
2
2
  import { glob } from "glob";
3
+ import { createHash } from "crypto";
4
+ import { readFile } from "fs/promises";
5
+ import path from "path";
3
6
  var RESOURCE_PATTERNS = {
4
7
  adrs: ["**/adrs/*/index.@(md|mdx)"],
5
8
  agents: ["**/agents/*/index.@(md|mdx)"],
@@ -40,11 +43,29 @@ async function countResources(projectDir) {
40
43
  }
41
44
  return counts;
42
45
  }
46
+ async function hashCatalogContent(projectDir) {
47
+ const hash = createHash("sha256");
48
+ const files = /* @__PURE__ */ new Set();
49
+ for (const pattern of Object.values(RESOURCE_PATTERNS).flat()) {
50
+ for (const file of await glob(pattern, { cwd: projectDir, ignore: DEFAULT_IGNORES })) {
51
+ files.add(file);
52
+ }
53
+ }
54
+ for (const file of [...files].sort()) {
55
+ try {
56
+ hash.update(file);
57
+ hash.update(await readFile(path.join(projectDir, file)));
58
+ } catch {
59
+ }
60
+ }
61
+ return hash.digest("hex").slice(0, 16);
62
+ }
43
63
  function serializeCounts(counts) {
44
64
  return Object.entries(counts).map(([k, v]) => `${k}:${v}`).join(",");
45
65
  }
46
66
 
47
67
  export {
48
68
  countResources,
69
+ hashCatalogContent,
49
70
  serializeCounts
50
71
  };
@@ -25,7 +25,7 @@ __export(constants_exports, {
25
25
  module.exports = __toCommonJS(constants_exports);
26
26
 
27
27
  // package.json
28
- var version = "4.10.4";
28
+ var version = "4.10.6";
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-322TAIDG.js";
3
+ } from "./chunk-YSWJHMAX.js";
4
4
  export {
5
5
  VERSION
6
6
  };