@eventcatalog/core 3.40.0 → 3.40.2

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.
@@ -0,0 +1 @@
1
+ export type { Config, SideBarConfig } from '../dist/eventcatalog.config.js';
@@ -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.2";
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-PWIB7GLR.js";
4
+ import "../chunk-HSSCHCQA.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.2";
115
115
 
116
116
  // src/constants.ts
117
117
  var VERSION = version;
@@ -187,8 +187,43 @@ 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
- if (process.env.NODE_ENV === "CI") return;
192
227
  try {
193
228
  await verifyRequiredFieldsAreInCatalogConfigFile(projectDir);
194
229
  const configFile = await getEventCatalogConfigFile(projectDir);
@@ -205,6 +240,7 @@ var main = async (projectDir, { isEventCatalogStarterEnabled, isEventCatalogScal
205
240
  }
206
241
  const features = await getFeatures(configFile);
207
242
  const resourceCounts = await countResources(projectDir);
243
+ await reportCloudResourceInventory(configFile, resourceCounts);
208
244
  await raiseEvent({
209
245
  command: "build",
210
246
  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-5FFRK3S5.js";
4
+ import "../chunk-PWIB7GLR.js";
5
5
  import "../chunk-4UVFXLPI.js";
6
- import "../chunk-UPI6QQEZ.js";
6
+ import "../chunk-HSSCHCQA.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
  raiseEvent
3
- } from "./chunk-WFNAWDCB.js";
3
+ } from "./chunk-PWIB7GLR.js";
4
4
  import {
5
5
  countResources,
6
6
  serializeCounts
@@ -19,8 +19,43 @@ 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
- if (process.env.NODE_ENV === "CI") return;
24
59
  try {
25
60
  await verifyRequiredFieldsAreInCatalogConfigFile(projectDir);
26
61
  const configFile = await getEventCatalogConfigFile(projectDir);
@@ -37,6 +72,7 @@ var main = async (projectDir, { isEventCatalogStarterEnabled, isEventCatalogScal
37
72
  }
38
73
  const features = await getFeatures(configFile);
39
74
  const resourceCounts = await countResources(projectDir);
75
+ await reportCloudResourceInventory(configFile, resourceCounts);
40
76
  await raiseEvent({
41
77
  command: "build",
42
78
  org: organizationName,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logger
3
- } from "./chunk-J5CG7FRO.js";
3
+ } from "./chunk-D6UVZABG.js";
4
4
  import {
5
5
  cleanup,
6
6
  getEventCatalogConfigFile
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-UPI6QQEZ.js";
3
+ } from "./chunk-HSSCHCQA.js";
4
4
 
5
5
  // src/utils/cli-logger.ts
6
6
  import pc from "picocolors";
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "3.40.0";
2
+ var version = "3.40.2";
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-HSSCHCQA.js";
4
4
 
5
5
  // src/analytics/analytics.js
6
6
  import axios from "axios";
@@ -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.2";
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-HSSCHCQA.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.2";
118
118
 
119
119
  // src/constants.ts
120
120
  var VERSION = version;
@@ -282,8 +282,43 @@ 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
- if (process.env.NODE_ENV === "CI") return;
287
322
  try {
288
323
  await verifyRequiredFieldsAreInCatalogConfigFile(projectDir);
289
324
  const configFile = await getEventCatalogConfigFile(projectDir);
@@ -300,6 +335,7 @@ var main = async (projectDir, { isEventCatalogStarterEnabled: isEventCatalogStar
300
335
  }
301
336
  const features = await getFeatures(configFile);
302
337
  const resourceCounts = await countResources(projectDir);
338
+ await reportCloudResourceInventory(configFile, resourceCounts);
303
339
  await raiseEvent({
304
340
  command: "build",
305
341
  org: organizationName,
@@ -35,6 +35,7 @@ type TableConfiguration = {
35
35
  columns: {
36
36
  [key: string]: {
37
37
  visible?: boolean;
38
+ label?: string;
38
39
  };
39
40
  };
40
41
  };
@@ -44,6 +45,8 @@ type PagesConfiguration = {
44
45
  icon?: string;
45
46
  pages?: string[];
46
47
  };
48
+ type NavigationPage = string | PagesConfiguration;
49
+ type GeneratorConfig = string | Record<string, unknown> | [string, Record<string, unknown>];
47
50
  type AuthConfig = {
48
51
  enabled: boolean;
49
52
  };
@@ -98,6 +101,16 @@ type PostHogConfig = {
98
101
  apiKey: string;
99
102
  apiHost?: string;
100
103
  };
104
+ type EventCatalogCloudAnalyticsConfig = {
105
+ enabled: boolean;
106
+ trackingId: string;
107
+ writeKey?: string;
108
+ endpoint?: string;
109
+ debug?: boolean;
110
+ };
111
+ type EventCatalogCloudConfig = {
112
+ analytics?: EventCatalogCloudAnalyticsConfig;
113
+ };
101
114
  type IntegrationsConfig = {
102
115
  ga4?: GA4Config;
103
116
  gtm?: GTMConfig;
@@ -108,18 +121,26 @@ type IntegrationsConfig = {
108
121
  type CatalogTheme = 'default' | 'ocean' | 'sapphire' | 'sunset' | 'forest' | (string & {});
109
122
  type ScalarConfiguration = any;
110
123
  interface Config {
124
+ cId: string;
111
125
  title: string;
112
- tagline: false;
113
126
  organizationName: string;
114
- homepageLink: string;
115
- editUrl: string;
127
+ tagline?: string | false;
128
+ homepageLink?: string;
129
+ editUrl?: string;
116
130
  repositoryUrl?: string;
117
131
  landingPage?: string;
118
132
  base?: string;
119
- port?: string;
120
- host?: string;
133
+ port?: string | number;
134
+ outDir?: string;
135
+ host?: string | boolean;
121
136
  trailingSlash?: boolean;
122
137
  output?: 'server' | 'static';
138
+ server?: {
139
+ allowedHosts?: string[] | true;
140
+ };
141
+ security?: {
142
+ checkOrigin?: boolean;
143
+ };
123
144
  /**
124
145
  * Theme for the catalog UI.
125
146
  * - 'default': Default purple/slate theme
@@ -133,8 +154,8 @@ interface Config {
133
154
  auth?: AuthConfig;
134
155
  mcp?: McpConfig;
135
156
  rss?: {
136
- enabled: boolean;
137
- limit: number;
157
+ enabled?: boolean;
158
+ limit?: number;
138
159
  };
139
160
  search?: {
140
161
  /**
@@ -160,9 +181,9 @@ interface Config {
160
181
  compress?: boolean;
161
182
  sidebar?: SideBarConfig[];
162
183
  navigation?: {
163
- pages: PagesConfiguration[];
184
+ pages: NavigationPage[];
164
185
  };
165
- docs: {
186
+ docs?: {
166
187
  sidebar: {
167
188
  type?: 'TREE_VIEW' | 'LIST_VIEW';
168
189
  showOrphanedMessages?: boolean;
@@ -179,7 +200,7 @@ interface Config {
179
200
  iconPacks?: string[];
180
201
  };
181
202
  chat?: {
182
- enabled: boolean;
203
+ enabled?: boolean;
183
204
  provider?: 'openai' | 'anthropic' | 'google';
184
205
  model?: string;
185
206
  max_tokens?: number;
@@ -197,7 +218,7 @@ interface Config {
197
218
  /**
198
219
  * Enable or disable the /api/catalog endpoint that dumps the entire catalog as JSON.
199
220
  * Disabling this can significantly reduce memory usage during builds for large catalogs (1000+ files).
200
- * @default false
221
+ * @default true
201
222
  */
202
223
  fullCatalogAPIEnabled?: boolean;
203
224
  };
@@ -243,8 +264,10 @@ interface Config {
243
264
  queries?: {
244
265
  tableConfiguration?: TableConfiguration;
245
266
  };
267
+ cloud?: EventCatalogCloudConfig;
246
268
  integrations?: IntegrationsConfig;
247
269
  scalarConfiguration?: ScalarConfiguration;
270
+ generators?: GeneratorConfig[];
248
271
  }
249
272
 
250
273
  export type { Config, SideBarConfig };
@@ -35,6 +35,7 @@ type TableConfiguration = {
35
35
  columns: {
36
36
  [key: string]: {
37
37
  visible?: boolean;
38
+ label?: string;
38
39
  };
39
40
  };
40
41
  };
@@ -44,6 +45,8 @@ type PagesConfiguration = {
44
45
  icon?: string;
45
46
  pages?: string[];
46
47
  };
48
+ type NavigationPage = string | PagesConfiguration;
49
+ type GeneratorConfig = string | Record<string, unknown> | [string, Record<string, unknown>];
47
50
  type AuthConfig = {
48
51
  enabled: boolean;
49
52
  };
@@ -98,6 +101,16 @@ type PostHogConfig = {
98
101
  apiKey: string;
99
102
  apiHost?: string;
100
103
  };
104
+ type EventCatalogCloudAnalyticsConfig = {
105
+ enabled: boolean;
106
+ trackingId: string;
107
+ writeKey?: string;
108
+ endpoint?: string;
109
+ debug?: boolean;
110
+ };
111
+ type EventCatalogCloudConfig = {
112
+ analytics?: EventCatalogCloudAnalyticsConfig;
113
+ };
101
114
  type IntegrationsConfig = {
102
115
  ga4?: GA4Config;
103
116
  gtm?: GTMConfig;
@@ -108,18 +121,26 @@ type IntegrationsConfig = {
108
121
  type CatalogTheme = 'default' | 'ocean' | 'sapphire' | 'sunset' | 'forest' | (string & {});
109
122
  type ScalarConfiguration = any;
110
123
  interface Config {
124
+ cId: string;
111
125
  title: string;
112
- tagline: false;
113
126
  organizationName: string;
114
- homepageLink: string;
115
- editUrl: string;
127
+ tagline?: string | false;
128
+ homepageLink?: string;
129
+ editUrl?: string;
116
130
  repositoryUrl?: string;
117
131
  landingPage?: string;
118
132
  base?: string;
119
- port?: string;
120
- host?: string;
133
+ port?: string | number;
134
+ outDir?: string;
135
+ host?: string | boolean;
121
136
  trailingSlash?: boolean;
122
137
  output?: 'server' | 'static';
138
+ server?: {
139
+ allowedHosts?: string[] | true;
140
+ };
141
+ security?: {
142
+ checkOrigin?: boolean;
143
+ };
123
144
  /**
124
145
  * Theme for the catalog UI.
125
146
  * - 'default': Default purple/slate theme
@@ -133,8 +154,8 @@ interface Config {
133
154
  auth?: AuthConfig;
134
155
  mcp?: McpConfig;
135
156
  rss?: {
136
- enabled: boolean;
137
- limit: number;
157
+ enabled?: boolean;
158
+ limit?: number;
138
159
  };
139
160
  search?: {
140
161
  /**
@@ -160,9 +181,9 @@ interface Config {
160
181
  compress?: boolean;
161
182
  sidebar?: SideBarConfig[];
162
183
  navigation?: {
163
- pages: PagesConfiguration[];
184
+ pages: NavigationPage[];
164
185
  };
165
- docs: {
186
+ docs?: {
166
187
  sidebar: {
167
188
  type?: 'TREE_VIEW' | 'LIST_VIEW';
168
189
  showOrphanedMessages?: boolean;
@@ -179,7 +200,7 @@ interface Config {
179
200
  iconPacks?: string[];
180
201
  };
181
202
  chat?: {
182
- enabled: boolean;
203
+ enabled?: boolean;
183
204
  provider?: 'openai' | 'anthropic' | 'google';
184
205
  model?: string;
185
206
  max_tokens?: number;
@@ -197,7 +218,7 @@ interface Config {
197
218
  /**
198
219
  * Enable or disable the /api/catalog endpoint that dumps the entire catalog as JSON.
199
220
  * Disabling this can significantly reduce memory usage during builds for large catalogs (1000+ files).
200
- * @default false
221
+ * @default true
201
222
  */
202
223
  fullCatalogAPIEnabled?: boolean;
203
224
  };
@@ -243,8 +264,10 @@ interface Config {
243
264
  queries?: {
244
265
  tableConfiguration?: TableConfiguration;
245
266
  };
267
+ cloud?: EventCatalogCloudConfig;
246
268
  integrations?: IntegrationsConfig;
247
269
  scalarConfiguration?: ScalarConfiguration;
270
+ generators?: GeneratorConfig[];
248
271
  }
249
272
 
250
273
  export type { Config, SideBarConfig };
@@ -13,8 +13,8 @@ import {
13
13
  } from "./chunk-K3ZVEX2Y.js";
14
14
  import {
15
15
  log_build_default
16
- } from "./chunk-72BKUYSR.js";
17
- import "./chunk-WFNAWDCB.js";
16
+ } from "./chunk-5FFRK3S5.js";
17
+ import "./chunk-PWIB7GLR.js";
18
18
  import "./chunk-4UVFXLPI.js";
19
19
  import {
20
20
  catalogToAstro
@@ -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-B7LKNRMT.js";
32
32
  import {
33
33
  logger
34
- } from "./chunk-J5CG7FRO.js";
34
+ } from "./chunk-D6UVZABG.js";
35
35
  import {
36
36
  VERSION
37
- } from "./chunk-UPI6QQEZ.js";
37
+ } from "./chunk-HSSCHCQA.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.2";
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-B7LKNRMT.js";
4
+ import "./chunk-D6UVZABG.js";
5
+ import "./chunk-HSSCHCQA.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.2";
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-D6UVZABG.js";
4
+ import "../chunk-HSSCHCQA.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,13 +7,20 @@
7
7
  },
8
8
  "license": "SEE LICENSE IN LICENSE",
9
9
  "type": "module",
10
- "version": "3.40.0",
10
+ "version": "3.40.2",
11
11
  "publishConfig": {
12
12
  "access": "public"
13
13
  },
14
14
  "bin": {
15
15
  "eventcatalog": "bin/eventcatalog.js"
16
16
  },
17
+ "typesVersions": {
18
+ "*": {
19
+ "bin/eventcatalog.config": [
20
+ "bin/eventcatalog.config.d.ts"
21
+ ]
22
+ }
23
+ },
17
24
  "files": [
18
25
  "eventcatalog/",
19
26
  "!eventcatalog/**/__tests__/",
@@ -107,8 +114,8 @@
107
114
  "uuid": "^10.0.0",
108
115
  "zod": "^4.3.6",
109
116
  "@eventcatalog/linter": "1.0.24",
110
- "@eventcatalog/sdk": "2.21.2",
111
- "@eventcatalog/visualiser": "^3.21.0"
117
+ "@eventcatalog/visualiser": "^3.21.0",
118
+ "@eventcatalog/sdk": "2.21.2"
112
119
  },
113
120
  "devDependencies": {
114
121
  "@astrojs/check": "^0.9.9",