@eventcatalog/core 3.40.0 → 3.40.1

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.
@@ -37,7 +37,7 @@ var import_axios = __toESM(require("axios"), 1);
37
37
  var import_os = __toESM(require("os"), 1);
38
38
 
39
39
  // package.json
40
- var version = "3.40.0";
40
+ var version = "3.40.1";
41
41
 
42
42
  // src/constants.ts
43
43
  var VERSION = version;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "../chunk-WFNAWDCB.js";
4
- import "../chunk-UPI6QQEZ.js";
3
+ } from "../chunk-4OEF5W6Y.js";
4
+ import "../chunk-HNG4KOYQ.js";
5
5
  export {
6
6
  raiseEvent
7
7
  };
@@ -111,7 +111,7 @@ var import_axios = __toESM(require("axios"), 1);
111
111
  var import_os = __toESM(require("os"), 1);
112
112
 
113
113
  // package.json
114
- var version = "3.40.0";
114
+ var version = "3.40.1";
115
115
 
116
116
  // src/constants.ts
117
117
  var VERSION = version;
@@ -187,6 +187,42 @@ var getFeatures = async (configFile) => {
187
187
  output: configFile.output || "static"
188
188
  };
189
189
  };
190
+ var CLOUD_ANALYTICS_ENDPOINT = "https://api.ecingest.dev/v1/analytics/ingest";
191
+ var toCloudResourceCounts = (counts) => ({
192
+ domains: counts.domains || 0,
193
+ services: counts.services || 0,
194
+ events: counts.events || 0,
195
+ commands: counts.commands || 0,
196
+ queries: counts.queries || 0,
197
+ flows: counts.flows || 0,
198
+ channels: counts.channels || 0,
199
+ entities: counts.entities || 0,
200
+ containers: counts.containers || 0,
201
+ dataProducts: counts["data-products"] || 0,
202
+ teams: counts.teams || 0,
203
+ users: counts.users || 0,
204
+ designs: counts.designs || 0,
205
+ diagrams: counts.diagrams || 0,
206
+ ubiquitousLanguages: counts.ubiquitousLanguages || 0
207
+ });
208
+ var reportCloudResourceInventory = async (configFile, resourceCounts) => {
209
+ const analytics = configFile.cloud?.analytics;
210
+ if (!analytics?.enabled || !analytics.trackingId || !analytics.writeKey) return;
211
+ const endpoint = analytics.endpoint || CLOUD_ANALYTICS_ENDPOINT;
212
+ await fetch(endpoint, {
213
+ method: "POST",
214
+ headers: {
215
+ "Content-Type": "application/json",
216
+ "X-EventCatalog-Analytics-Key": analytics.writeKey
217
+ },
218
+ body: JSON.stringify({
219
+ trackingId: analytics.trackingId,
220
+ event: "catalog.resource_inventory_reported",
221
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
222
+ counts: toCloudResourceCounts(resourceCounts)
223
+ })
224
+ });
225
+ };
190
226
  var main = async (projectDir, { isEventCatalogStarterEnabled, isEventCatalogScaleEnabled, isBackstagePluginEnabled }) => {
191
227
  if (process.env.NODE_ENV === "CI") return;
192
228
  try {
@@ -205,6 +241,7 @@ var main = async (projectDir, { isEventCatalogStarterEnabled, isEventCatalogScal
205
241
  }
206
242
  const features = await getFeatures(configFile);
207
243
  const resourceCounts = await countResources(projectDir);
244
+ await reportCloudResourceInventory(configFile, resourceCounts);
208
245
  await raiseEvent({
209
246
  command: "build",
210
247
  org: organizationName,
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  log_build_default
3
- } from "../chunk-72BKUYSR.js";
4
- import "../chunk-WFNAWDCB.js";
3
+ } from "../chunk-7UR72UMK.js";
5
4
  import "../chunk-4UVFXLPI.js";
6
- import "../chunk-UPI6QQEZ.js";
5
+ import "../chunk-4OEF5W6Y.js";
6
+ import "../chunk-HNG4KOYQ.js";
7
7
  import "../chunk-5T63CXKU.js";
8
8
  export {
9
9
  log_build_default as default
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-UPI6QQEZ.js";
3
+ } from "./chunk-HNG4KOYQ.js";
4
4
 
5
5
  // src/analytics/analytics.js
6
6
  import axios from "axios";
@@ -1,10 +1,10 @@
1
- import {
2
- raiseEvent
3
- } from "./chunk-WFNAWDCB.js";
4
1
  import {
5
2
  countResources,
6
3
  serializeCounts
7
4
  } from "./chunk-4UVFXLPI.js";
5
+ import {
6
+ raiseEvent
7
+ } from "./chunk-4OEF5W6Y.js";
8
8
  import {
9
9
  getEventCatalogConfigFile,
10
10
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -19,6 +19,42 @@ var getFeatures = async (configFile) => {
19
19
  output: configFile.output || "static"
20
20
  };
21
21
  };
22
+ var CLOUD_ANALYTICS_ENDPOINT = "https://api.ecingest.dev/v1/analytics/ingest";
23
+ var toCloudResourceCounts = (counts) => ({
24
+ domains: counts.domains || 0,
25
+ services: counts.services || 0,
26
+ events: counts.events || 0,
27
+ commands: counts.commands || 0,
28
+ queries: counts.queries || 0,
29
+ flows: counts.flows || 0,
30
+ channels: counts.channels || 0,
31
+ entities: counts.entities || 0,
32
+ containers: counts.containers || 0,
33
+ dataProducts: counts["data-products"] || 0,
34
+ teams: counts.teams || 0,
35
+ users: counts.users || 0,
36
+ designs: counts.designs || 0,
37
+ diagrams: counts.diagrams || 0,
38
+ ubiquitousLanguages: counts.ubiquitousLanguages || 0
39
+ });
40
+ var reportCloudResourceInventory = async (configFile, resourceCounts) => {
41
+ const analytics = configFile.cloud?.analytics;
42
+ if (!analytics?.enabled || !analytics.trackingId || !analytics.writeKey) return;
43
+ const endpoint = analytics.endpoint || CLOUD_ANALYTICS_ENDPOINT;
44
+ await fetch(endpoint, {
45
+ method: "POST",
46
+ headers: {
47
+ "Content-Type": "application/json",
48
+ "X-EventCatalog-Analytics-Key": analytics.writeKey
49
+ },
50
+ body: JSON.stringify({
51
+ trackingId: analytics.trackingId,
52
+ event: "catalog.resource_inventory_reported",
53
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
54
+ counts: toCloudResourceCounts(resourceCounts)
55
+ })
56
+ });
57
+ };
22
58
  var main = async (projectDir, { isEventCatalogStarterEnabled, isEventCatalogScaleEnabled, isBackstagePluginEnabled }) => {
23
59
  if (process.env.NODE_ENV === "CI") return;
24
60
  try {
@@ -37,6 +73,7 @@ var main = async (projectDir, { isEventCatalogStarterEnabled, isEventCatalogScal
37
73
  }
38
74
  const features = await getFeatures(configFile);
39
75
  const resourceCounts = await countResources(projectDir);
76
+ await reportCloudResourceInventory(configFile, resourceCounts);
40
77
  await raiseEvent({
41
78
  command: "build",
42
79
  org: organizationName,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logger
3
- } from "./chunk-J5CG7FRO.js";
3
+ } from "./chunk-OIVICT4V.js";
4
4
  import {
5
5
  cleanup,
6
6
  getEventCatalogConfigFile
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "3.40.0";
2
+ var version = "3.40.1";
3
3
 
4
4
  // src/constants.ts
5
5
  var VERSION = version;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-UPI6QQEZ.js";
3
+ } from "./chunk-HNG4KOYQ.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 = "3.40.0";
28
+ var version = "3.40.1";
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-UPI6QQEZ.js";
3
+ } from "./chunk-HNG4KOYQ.js";
4
4
  export {
5
5
  VERSION
6
6
  };
@@ -114,7 +114,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
114
114
  var import_picocolors = __toESM(require("picocolors"), 1);
115
115
 
116
116
  // package.json
117
- var version = "3.40.0";
117
+ var version = "3.40.1";
118
118
 
119
119
  // src/constants.ts
120
120
  var VERSION = version;
@@ -282,6 +282,42 @@ var getFeatures = async (configFile) => {
282
282
  output: configFile.output || "static"
283
283
  };
284
284
  };
285
+ var CLOUD_ANALYTICS_ENDPOINT = "https://api.ecingest.dev/v1/analytics/ingest";
286
+ var toCloudResourceCounts = (counts) => ({
287
+ domains: counts.domains || 0,
288
+ services: counts.services || 0,
289
+ events: counts.events || 0,
290
+ commands: counts.commands || 0,
291
+ queries: counts.queries || 0,
292
+ flows: counts.flows || 0,
293
+ channels: counts.channels || 0,
294
+ entities: counts.entities || 0,
295
+ containers: counts.containers || 0,
296
+ dataProducts: counts["data-products"] || 0,
297
+ teams: counts.teams || 0,
298
+ users: counts.users || 0,
299
+ designs: counts.designs || 0,
300
+ diagrams: counts.diagrams || 0,
301
+ ubiquitousLanguages: counts.ubiquitousLanguages || 0
302
+ });
303
+ var reportCloudResourceInventory = async (configFile, resourceCounts) => {
304
+ const analytics = configFile.cloud?.analytics;
305
+ if (!analytics?.enabled || !analytics.trackingId || !analytics.writeKey) return;
306
+ const endpoint = analytics.endpoint || CLOUD_ANALYTICS_ENDPOINT;
307
+ await fetch(endpoint, {
308
+ method: "POST",
309
+ headers: {
310
+ "Content-Type": "application/json",
311
+ "X-EventCatalog-Analytics-Key": analytics.writeKey
312
+ },
313
+ body: JSON.stringify({
314
+ trackingId: analytics.trackingId,
315
+ event: "catalog.resource_inventory_reported",
316
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
317
+ counts: toCloudResourceCounts(resourceCounts)
318
+ })
319
+ });
320
+ };
285
321
  var main = async (projectDir, { isEventCatalogStarterEnabled: isEventCatalogStarterEnabled2, isEventCatalogScaleEnabled: isEventCatalogScaleEnabled2, isBackstagePluginEnabled }) => {
286
322
  if (process.env.NODE_ENV === "CI") return;
287
323
  try {
@@ -300,6 +336,7 @@ var main = async (projectDir, { isEventCatalogStarterEnabled: isEventCatalogStar
300
336
  }
301
337
  const features = await getFeatures(configFile);
302
338
  const resourceCounts = await countResources(projectDir);
339
+ await reportCloudResourceInventory(configFile, resourceCounts);
303
340
  await raiseEvent({
304
341
  command: "build",
305
342
  org: organizationName,
@@ -98,6 +98,16 @@ type PostHogConfig = {
98
98
  apiKey: string;
99
99
  apiHost?: string;
100
100
  };
101
+ type EventCatalogCloudAnalyticsConfig = {
102
+ enabled: boolean;
103
+ trackingId: string;
104
+ writeKey?: string;
105
+ endpoint?: string;
106
+ debug?: boolean;
107
+ };
108
+ type EventCatalogCloudConfig = {
109
+ analytics?: EventCatalogCloudAnalyticsConfig;
110
+ };
101
111
  type IntegrationsConfig = {
102
112
  ga4?: GA4Config;
103
113
  gtm?: GTMConfig;
@@ -243,6 +253,7 @@ interface Config {
243
253
  queries?: {
244
254
  tableConfiguration?: TableConfiguration;
245
255
  };
256
+ cloud?: EventCatalogCloudConfig;
246
257
  integrations?: IntegrationsConfig;
247
258
  scalarConfiguration?: ScalarConfiguration;
248
259
  }
@@ -98,6 +98,16 @@ type PostHogConfig = {
98
98
  apiKey: string;
99
99
  apiHost?: string;
100
100
  };
101
+ type EventCatalogCloudAnalyticsConfig = {
102
+ enabled: boolean;
103
+ trackingId: string;
104
+ writeKey?: string;
105
+ endpoint?: string;
106
+ debug?: boolean;
107
+ };
108
+ type EventCatalogCloudConfig = {
109
+ analytics?: EventCatalogCloudAnalyticsConfig;
110
+ };
101
111
  type IntegrationsConfig = {
102
112
  ga4?: GA4Config;
103
113
  gtm?: GTMConfig;
@@ -243,6 +253,7 @@ interface Config {
243
253
  queries?: {
244
254
  tableConfiguration?: TableConfiguration;
245
255
  };
256
+ cloud?: EventCatalogCloudConfig;
246
257
  integrations?: IntegrationsConfig;
247
258
  scalarConfiguration?: ScalarConfiguration;
248
259
  }
@@ -1,7 +1,7 @@
1
1
  import {
2
- runMigrations
3
- } from "./chunk-XUAF2H54.js";
4
- import "./chunk-CA4U2JP7.js";
2
+ log_build_default
3
+ } from "./chunk-7UR72UMK.js";
4
+ import "./chunk-4UVFXLPI.js";
5
5
  import {
6
6
  resolve_catalog_dependencies_default
7
7
  } from "./chunk-WAJIJEI3.js";
@@ -12,10 +12,10 @@ import {
12
12
  watch
13
13
  } from "./chunk-K3ZVEX2Y.js";
14
14
  import {
15
- log_build_default
16
- } from "./chunk-72BKUYSR.js";
17
- import "./chunk-WFNAWDCB.js";
18
- import "./chunk-4UVFXLPI.js";
15
+ runMigrations
16
+ } from "./chunk-XUAF2H54.js";
17
+ import "./chunk-CA4U2JP7.js";
18
+ import "./chunk-4OEF5W6Y.js";
19
19
  import {
20
20
  catalogToAstro
21
21
  } from "./chunk-YDXB3BD2.js";
@@ -28,13 +28,13 @@ import {
28
28
  } from "./chunk-ULZYHF3V.js";
29
29
  import {
30
30
  generate
31
- } from "./chunk-K762FILQ.js";
31
+ } from "./chunk-BRMLU4PR.js";
32
32
  import {
33
33
  logger
34
- } from "./chunk-J5CG7FRO.js";
34
+ } from "./chunk-OIVICT4V.js";
35
35
  import {
36
36
  VERSION
37
- } from "./chunk-UPI6QQEZ.js";
37
+ } from "./chunk-HNG4KOYQ.js";
38
38
  import {
39
39
  getEventCatalogConfigFile,
40
40
  verifyRequiredFieldsAreInCatalogConfigFile
package/dist/generate.cjs CHANGED
@@ -78,7 +78,7 @@ var getEventCatalogConfigFile = async (projectDirectory) => {
78
78
  var import_picocolors = __toESM(require("picocolors"), 1);
79
79
 
80
80
  // package.json
81
- var version = "3.40.0";
81
+ var version = "3.40.1";
82
82
 
83
83
  // src/constants.ts
84
84
  var VERSION = version;
package/dist/generate.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  generate
3
- } from "./chunk-K762FILQ.js";
4
- import "./chunk-J5CG7FRO.js";
5
- import "./chunk-UPI6QQEZ.js";
3
+ } from "./chunk-BRMLU4PR.js";
4
+ import "./chunk-OIVICT4V.js";
5
+ import "./chunk-HNG4KOYQ.js";
6
6
  import "./chunk-5T63CXKU.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 = "3.40.0";
39
+ var version = "3.40.1";
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-J5CG7FRO.js";
4
- import "../chunk-UPI6QQEZ.js";
3
+ } from "../chunk-OIVICT4V.js";
4
+ import "../chunk-HNG4KOYQ.js";
5
5
  export {
6
6
  logger
7
7
  };
@@ -3,11 +3,15 @@ import config from '@config';
3
3
  import { isIntegrationsEnabled } from '@utils/feature';
4
4
 
5
5
  const integrations = config.integrations;
6
+ const cloudAnalytics = config.cloud?.analytics;
6
7
  const enabled = isIntegrationsEnabled() && integrations;
7
8
  const hasProviders = enabled && (integrations?.ga4 || integrations?.gtm || integrations?.posthog);
8
9
  const debug = integrations?.debug ?? false;
10
+ const cloudDebug = cloudAnalytics?.debug ?? debug;
11
+ const cloudAnalyticsEndpoint = cloudAnalytics?.endpoint || 'https://api.ecingest.dev/v1/analytics/ingest';
12
+ const isCloudAnalyticsEnabled = cloudAnalytics?.enabled === true && !!cloudAnalytics?.trackingId;
9
13
  // Render the manager if there are providers OR if debug mode is on (so users can verify the pipeline)
10
- const shouldRender = enabled && (hasProviders || debug);
14
+ const shouldRender = isCloudAnalyticsEnabled || (enabled && (hasProviders || debug));
11
15
 
12
16
  // Build script contents in frontmatter to avoid Prettier/JSX parsing issues with braces in inline scripts
13
17
  const ga4ConfigScript = integrations?.ga4
@@ -35,6 +39,7 @@ posthog.init(${posthogApiKey}, {api_host: ${posthogApiHost}, person_profiles: 'i
35
39
  const hasGA4 = !!integrations?.ga4;
36
40
  const hasGTM = !!integrations?.gtm;
37
41
  const hasPostHog = !!integrations?.posthog;
42
+ const hasCloudAnalytics = !!isCloudAnalyticsEnabled;
38
43
 
39
44
  const managerScript = `(function() {
40
45
  function AnalyticsManager(opts) {
@@ -57,6 +62,28 @@ AnalyticsManager.prototype.pageView = function(url, props) {
57
62
  try { this.adapters[i].pageView(url, props); } catch(e) {}
58
63
  }
59
64
  };
65
+ function createId(prefix) {
66
+ var bytes = new Uint8Array(16);
67
+ if (window.crypto && window.crypto.getRandomValues) {
68
+ window.crypto.getRandomValues(bytes);
69
+ } else {
70
+ for (var i = 0; i < bytes.length; i++) bytes[i] = Math.floor(Math.random() * 256);
71
+ }
72
+ return prefix + '_' + Array.prototype.map.call(bytes, function(byte) {
73
+ return byte.toString(16).padStart(2, '0');
74
+ }).join('');
75
+ }
76
+ function getStoredId(storage, key, prefix) {
77
+ try {
78
+ var existing = storage.getItem(key);
79
+ if (existing) return existing;
80
+ var id = createId(prefix);
81
+ storage.setItem(key, id);
82
+ return id;
83
+ } catch(e) {
84
+ return createId(prefix);
85
+ }
86
+ }
60
87
  var manager = new AnalyticsManager({ debug: ${debug} });
61
88
  ${
62
89
  hasGA4
@@ -85,6 +112,56 @@ ${
85
112
  });`
86
113
  : ''
87
114
  }
115
+ ${
116
+ hasCloudAnalytics
117
+ ? `var eventCatalogCloudLastPath;
118
+ manager.register({
119
+ name: 'eventcatalog-cloud',
120
+ track: function(event, props) {
121
+ if (event !== 'catalog.page_viewed' && event !== 'catalog.built' && event !== 'catalog.resource_inventory_reported') return;
122
+
123
+ var payload = Object.assign({
124
+ trackingId: ${JSON.stringify(cloudAnalytics?.trackingId || '')},
125
+ event: event,
126
+ anonymousId: getStoredId(window.localStorage, 'eventcatalog-cloud-anonymous-id', 'anon'),
127
+ sessionId: getStoredId(window.sessionStorage, 'eventcatalog-cloud-session-id', 'sess'),
128
+ timestamp: new Date().toISOString()
129
+ }, props || {});
130
+
131
+ var body = JSON.stringify(payload);
132
+ if (${cloudDebug}) console.log('[EventCatalog Cloud Analytics] track: ' + event, payload);
133
+
134
+ try {
135
+ fetch(${JSON.stringify(cloudAnalyticsEndpoint)}, {
136
+ method: 'POST',
137
+ headers: { 'Content-Type': 'application/json' },
138
+ body: body,
139
+ keepalive: true,
140
+ credentials: 'omit'
141
+ }).catch(function() {});
142
+ } catch(e) {}
143
+ },
144
+ pageView: function(url, props) {
145
+ props = props || {};
146
+ var path = props.url || url || window.location.pathname;
147
+ var payload = {
148
+ path: path,
149
+ section: props.section || undefined,
150
+ referrer: eventCatalogCloudLastPath || document.referrer || undefined
151
+ };
152
+ if (props.resource_type && props.resource_id) {
153
+ payload.resource = {
154
+ type: props.resource_type,
155
+ id: props.resource_id,
156
+ version: props.resource_version || undefined
157
+ };
158
+ }
159
+ eventCatalogCloudLastPath = path;
160
+ this.track('catalog.page_viewed', payload);
161
+ }
162
+ });`
163
+ : ''
164
+ }
88
165
  window.__ec_analytics = manager;
89
166
  })();`;
90
167
  ---
@@ -3,10 +3,12 @@ import config from '@config';
3
3
  import { isIntegrationsEnabled } from '@utils/feature';
4
4
 
5
5
  const integrations = config.integrations;
6
+ const cloudAnalytics = config.cloud?.analytics;
6
7
  const enabled = isIntegrationsEnabled() && integrations;
7
8
  const hasProviders = enabled && (integrations?.ga4 || integrations?.gtm || integrations?.posthog);
8
9
  const debug = integrations?.debug ?? false;
9
- const shouldRender = enabled && (hasProviders || debug);
10
+ const isCloudAnalyticsEnabled = cloudAnalytics?.enabled === true && !!cloudAnalytics?.trackingId;
11
+ const shouldRender = isCloudAnalyticsEnabled || (enabled && (hasProviders || debug));
10
12
 
11
13
  const base = (config.base || '/').replace(/\/$/, '');
12
14
  const baseJson = JSON.stringify(base);
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  },
8
8
  "license": "SEE LICENSE IN LICENSE",
9
9
  "type": "module",
10
- "version": "3.40.0",
10
+ "version": "3.40.1",
11
11
  "publishConfig": {
12
12
  "access": "public"
13
13
  },
@@ -106,9 +106,9 @@
106
106
  "update-notifier": "^7.3.1",
107
107
  "uuid": "^10.0.0",
108
108
  "zod": "^4.3.6",
109
- "@eventcatalog/linter": "1.0.24",
110
109
  "@eventcatalog/sdk": "2.21.2",
111
- "@eventcatalog/visualiser": "^3.21.0"
110
+ "@eventcatalog/visualiser": "^3.21.0",
111
+ "@eventcatalog/linter": "1.0.24"
112
112
  },
113
113
  "devDependencies": {
114
114
  "@astrojs/check": "^0.9.9",