@eventcatalog/core 5.0.0-beta.27 → 5.0.0-beta.28
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.
- package/dist/analytics/analytics.cjs +1 -1
- package/dist/analytics/analytics.js +2 -2
- package/dist/analytics/log-build.cjs +55 -3
- package/dist/analytics/log-build.d.cts +2 -2
- package/dist/analytics/log-build.d.ts +2 -2
- package/dist/analytics/log-build.js +4 -3
- package/dist/analytics/studio-usage.cjs +90 -0
- package/dist/analytics/studio-usage.d.cts +5 -0
- package/dist/analytics/studio-usage.d.ts +5 -0
- package/dist/analytics/studio-usage.js +10 -0
- package/dist/chunk-CA6WCQ2T.js +54 -0
- package/dist/{chunk-YGUOLT7F.js → chunk-EUMQAONX.js} +1 -1
- package/dist/{chunk-I6CBMGUM.js → chunk-G46KUC6G.js} +1 -1
- package/dist/{chunk-QJ7KKN2D.js → chunk-OX6TSVHY.js} +1 -1
- package/dist/{chunk-EFBDR7JJ.js → chunk-QWFP2PDM.js} +1 -1
- package/dist/{chunk-ILPH363P.js → chunk-TDUUHSGF.js} +1 -1
- package/dist/{chunk-P5IFIKG6.js → chunk-VAL22T5Y.js} +11 -3
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog.cjs +235 -182
- package/dist/eventcatalog.js +11 -9
- package/dist/federation/federate.js +3 -3
- package/dist/federation/source-provider.js +2 -2
- package/dist/generate.cjs +1 -1
- package/dist/generate.js +3 -3
- package/dist/utils/cli-logger.cjs +1 -1
- package/dist/utils/cli-logger.js +2 -2
- package/package.json +1 -1
- package/dist/{chunk-A2RZR3U4.js → chunk-6K7XZAYI.js} +3 -3
|
@@ -169,7 +169,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
|
|
|
169
169
|
var import_os = __toESM(require("os"), 1);
|
|
170
170
|
|
|
171
171
|
// package.json
|
|
172
|
-
var version = "5.0.0-beta.
|
|
172
|
+
var version = "5.0.0-beta.28";
|
|
173
173
|
|
|
174
174
|
// src/constants.ts
|
|
175
175
|
var VERSION = version;
|
|
@@ -322,6 +322,55 @@ var getLicenseAnalytics = (license = { state: "none" }, tsd) => ({
|
|
|
322
322
|
});
|
|
323
323
|
var COLOURS = { bold: import_picocolors.default.bold, dim: import_picocolors.default.dim, link: (text) => import_picocolors.default.cyan(text) };
|
|
324
324
|
|
|
325
|
+
// src/analytics/studio-usage.js
|
|
326
|
+
var import_node_fs3 = __toESM(require("fs"), 1);
|
|
327
|
+
var import_node_path5 = __toESM(require("path"), 1);
|
|
328
|
+
var DAY_IN_MS3 = 24 * 60 * 60 * 1e3;
|
|
329
|
+
var DEFAULT_DATABASE_PATH = ".eventcatalog/eventcatalog.db";
|
|
330
|
+
var getStudioMode = (configFile) => {
|
|
331
|
+
const enabled = configFile.studio?.enabled;
|
|
332
|
+
if (enabled === false) return "off";
|
|
333
|
+
return configFile.output === "server" && enabled === true ? "server" : "dev";
|
|
334
|
+
};
|
|
335
|
+
var getStorageType = (configFile) => configFile.storage?.type || "memory";
|
|
336
|
+
var loadSqlite = () => {
|
|
337
|
+
const emitWarning = process.emitWarning;
|
|
338
|
+
process.emitWarning = function(warning, ...args) {
|
|
339
|
+
const type = typeof args[0] === "object" ? args[0]?.type : args[0];
|
|
340
|
+
const message = typeof warning === "string" ? warning : warning?.message;
|
|
341
|
+
if (type === "ExperimentalWarning" && message?.startsWith("SQLite")) return;
|
|
342
|
+
return emitWarning.call(this, warning, ...args);
|
|
343
|
+
};
|
|
344
|
+
try {
|
|
345
|
+
return process.getBuiltinModule?.("node:sqlite");
|
|
346
|
+
} catch {
|
|
347
|
+
return void 0;
|
|
348
|
+
} finally {
|
|
349
|
+
process.emitWarning = emitWarning;
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
var UNKNOWN = "canvases:unknown";
|
|
353
|
+
var serializeStudioUsage = (projectDirectory, configFile, now = Date.now()) => {
|
|
354
|
+
if (getStudioMode(configFile) === "off" || getStorageType(configFile) !== "sqlite") return UNKNOWN;
|
|
355
|
+
const file = import_node_path5.default.resolve(projectDirectory, configFile.storage.path ?? DEFAULT_DATABASE_PATH);
|
|
356
|
+
if (!import_node_fs3.default.existsSync(file)) return "canvases:0,changed7d:0,changed30d:0,deleted:0";
|
|
357
|
+
let database;
|
|
358
|
+
try {
|
|
359
|
+
const sqlite = loadSqlite();
|
|
360
|
+
if (!sqlite?.DatabaseSync) return UNKNOWN;
|
|
361
|
+
database = new sqlite.DatabaseSync(file, { readOnly: true });
|
|
362
|
+
const canvases = database.prepare(
|
|
363
|
+
"SELECT COUNT(*) AS total, SUM(updated_at >= ?) AS changed7d, SUM(updated_at >= ?) AS changed30d FROM studio_canvases"
|
|
364
|
+
).get(now - 7 * DAY_IN_MS3, now - 30 * DAY_IN_MS3);
|
|
365
|
+
const { deleted } = database.prepare("SELECT COUNT(*) AS deleted FROM studio_deleted_canvases").get();
|
|
366
|
+
return `canvases:${canvases.total},changed7d:${canvases.changed7d ?? 0},changed30d:${canvases.changed30d ?? 0},deleted:${deleted}`;
|
|
367
|
+
} catch {
|
|
368
|
+
return UNKNOWN;
|
|
369
|
+
} finally {
|
|
370
|
+
database?.close();
|
|
371
|
+
}
|
|
372
|
+
};
|
|
373
|
+
|
|
325
374
|
// src/analytics/log-build.js
|
|
326
375
|
var isMCPEnabled = (configFile) => configFile.output === "server" && (configFile.mcp?.enabled ?? true);
|
|
327
376
|
var getFeatures = async (configFile) => {
|
|
@@ -335,7 +384,9 @@ var getFeatures = async (configFile) => {
|
|
|
335
384
|
environments: Array.isArray(configFile.environments) && configFile.environments.length > 0,
|
|
336
385
|
output: configFile.output || "static",
|
|
337
386
|
mcp,
|
|
338
|
-
mcpAuth: mcp && (configFile.mcp?.auth?.enabled ?? false)
|
|
387
|
+
mcpAuth: mcp && (configFile.mcp?.auth?.enabled ?? false),
|
|
388
|
+
studio: getStudioMode(configFile),
|
|
389
|
+
storage: getStorageType(configFile)
|
|
339
390
|
};
|
|
340
391
|
};
|
|
341
392
|
var getDirectoryProvider = (source) => {
|
|
@@ -436,7 +487,8 @@ var main = async (projectDir, { command = "build", license } = {}) => {
|
|
|
436
487
|
generators: generatorNames.toString(),
|
|
437
488
|
features: Object.keys(features).map((feature) => `${feature}:${features[feature]}`).join(","),
|
|
438
489
|
directorySources: serializeDirectorySources(configFile),
|
|
439
|
-
resources: serializeCounts(resourceCounts)
|
|
490
|
+
resources: serializeCounts(resourceCounts),
|
|
491
|
+
studio: serializeStudioUsage(projectDir, configFile)
|
|
440
492
|
},
|
|
441
493
|
configFile
|
|
442
494
|
);
|
|
@@ -3,10 +3,10 @@ import { L as LicenseStatus } from '../license-C1y-56bb.cjs';
|
|
|
3
3
|
/**
|
|
4
4
|
*
|
|
5
5
|
* @param {string} projectDir
|
|
6
|
-
* @param {{ command?: 'build' | 'dev', license?: import('../utils/license-status').LicenseStatus }} [options]
|
|
6
|
+
* @param {{ command?: 'build' | 'dev' | 'start', license?: import('../utils/license-status').LicenseStatus }} [options]
|
|
7
7
|
*/
|
|
8
8
|
declare function main(projectDir: string, { command, license }?: {
|
|
9
|
-
command?: "build" | "dev";
|
|
9
|
+
command?: "build" | "dev" | "start";
|
|
10
10
|
license?: LicenseStatus;
|
|
11
11
|
}): Promise<void>;
|
|
12
12
|
|
|
@@ -3,10 +3,10 @@ import { L as LicenseStatus } from '../license-C1y-56bb.js';
|
|
|
3
3
|
/**
|
|
4
4
|
*
|
|
5
5
|
* @param {string} projectDir
|
|
6
|
-
* @param {{ command?: 'build' | 'dev', license?: import('../utils/license-status').LicenseStatus }} [options]
|
|
6
|
+
* @param {{ command?: 'build' | 'dev' | 'start', license?: import('../utils/license-status').LicenseStatus }} [options]
|
|
7
7
|
*/
|
|
8
8
|
declare function main(projectDir: string, { command, license }?: {
|
|
9
|
-
command?: "build" | "dev";
|
|
9
|
+
command?: "build" | "dev" | "start";
|
|
10
10
|
license?: LicenseStatus;
|
|
11
11
|
}): Promise<void>;
|
|
12
12
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
log_build_default
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-VAL22T5Y.js";
|
|
4
4
|
import "../chunk-AWOO63ME.js";
|
|
5
5
|
import "../chunk-ZAZHAVKB.js";
|
|
6
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-CA6WCQ2T.js";
|
|
7
|
+
import "../chunk-QWFP2PDM.js";
|
|
7
8
|
import "../chunk-CPW6G62V.js";
|
|
8
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-EUMQAONX.js";
|
|
9
10
|
import "../chunk-4G7FSRPN.js";
|
|
10
11
|
export {
|
|
11
12
|
log_build_default as default
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
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
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/analytics/studio-usage.js
|
|
31
|
+
var studio_usage_exports = {};
|
|
32
|
+
__export(studio_usage_exports, {
|
|
33
|
+
getStorageType: () => getStorageType,
|
|
34
|
+
getStudioMode: () => getStudioMode,
|
|
35
|
+
serializeStudioUsage: () => serializeStudioUsage
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(studio_usage_exports);
|
|
38
|
+
var import_node_fs = __toESM(require("fs"), 1);
|
|
39
|
+
var import_node_path = __toESM(require("path"), 1);
|
|
40
|
+
var DAY_IN_MS = 24 * 60 * 60 * 1e3;
|
|
41
|
+
var DEFAULT_DATABASE_PATH = ".eventcatalog/eventcatalog.db";
|
|
42
|
+
var getStudioMode = (configFile) => {
|
|
43
|
+
const enabled = configFile.studio?.enabled;
|
|
44
|
+
if (enabled === false) return "off";
|
|
45
|
+
return configFile.output === "server" && enabled === true ? "server" : "dev";
|
|
46
|
+
};
|
|
47
|
+
var getStorageType = (configFile) => configFile.storage?.type || "memory";
|
|
48
|
+
var loadSqlite = () => {
|
|
49
|
+
const emitWarning = process.emitWarning;
|
|
50
|
+
process.emitWarning = function(warning, ...args) {
|
|
51
|
+
const type = typeof args[0] === "object" ? args[0]?.type : args[0];
|
|
52
|
+
const message = typeof warning === "string" ? warning : warning?.message;
|
|
53
|
+
if (type === "ExperimentalWarning" && message?.startsWith("SQLite")) return;
|
|
54
|
+
return emitWarning.call(this, warning, ...args);
|
|
55
|
+
};
|
|
56
|
+
try {
|
|
57
|
+
return process.getBuiltinModule?.("node:sqlite");
|
|
58
|
+
} catch {
|
|
59
|
+
return void 0;
|
|
60
|
+
} finally {
|
|
61
|
+
process.emitWarning = emitWarning;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
var UNKNOWN = "canvases:unknown";
|
|
65
|
+
var serializeStudioUsage = (projectDirectory, configFile, now = Date.now()) => {
|
|
66
|
+
if (getStudioMode(configFile) === "off" || getStorageType(configFile) !== "sqlite") return UNKNOWN;
|
|
67
|
+
const file = import_node_path.default.resolve(projectDirectory, configFile.storage.path ?? DEFAULT_DATABASE_PATH);
|
|
68
|
+
if (!import_node_fs.default.existsSync(file)) return "canvases:0,changed7d:0,changed30d:0,deleted:0";
|
|
69
|
+
let database;
|
|
70
|
+
try {
|
|
71
|
+
const sqlite = loadSqlite();
|
|
72
|
+
if (!sqlite?.DatabaseSync) return UNKNOWN;
|
|
73
|
+
database = new sqlite.DatabaseSync(file, { readOnly: true });
|
|
74
|
+
const canvases = database.prepare(
|
|
75
|
+
"SELECT COUNT(*) AS total, SUM(updated_at >= ?) AS changed7d, SUM(updated_at >= ?) AS changed30d FROM studio_canvases"
|
|
76
|
+
).get(now - 7 * DAY_IN_MS, now - 30 * DAY_IN_MS);
|
|
77
|
+
const { deleted } = database.prepare("SELECT COUNT(*) AS deleted FROM studio_deleted_canvases").get();
|
|
78
|
+
return `canvases:${canvases.total},changed7d:${canvases.changed7d ?? 0},changed30d:${canvases.changed30d ?? 0},deleted:${deleted}`;
|
|
79
|
+
} catch {
|
|
80
|
+
return UNKNOWN;
|
|
81
|
+
} finally {
|
|
82
|
+
database?.close();
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
86
|
+
0 && (module.exports = {
|
|
87
|
+
getStorageType,
|
|
88
|
+
getStudioMode,
|
|
89
|
+
serializeStudioUsage
|
|
90
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
declare function getStudioMode(configFile: any): "off" | "server" | "dev";
|
|
2
|
+
declare function getStorageType(configFile: any): any;
|
|
3
|
+
declare function serializeStudioUsage(projectDirectory: any, configFile: any, now?: number): string;
|
|
4
|
+
|
|
5
|
+
export { getStorageType, getStudioMode, serializeStudioUsage };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
declare function getStudioMode(configFile: any): "off" | "server" | "dev";
|
|
2
|
+
declare function getStorageType(configFile: any): any;
|
|
3
|
+
declare function serializeStudioUsage(projectDirectory: any, configFile: any, now?: number): string;
|
|
4
|
+
|
|
5
|
+
export { getStorageType, getStudioMode, serializeStudioUsage };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// src/analytics/studio-usage.js
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import path from "path";
|
|
4
|
+
var DAY_IN_MS = 24 * 60 * 60 * 1e3;
|
|
5
|
+
var DEFAULT_DATABASE_PATH = ".eventcatalog/eventcatalog.db";
|
|
6
|
+
var getStudioMode = (configFile) => {
|
|
7
|
+
const enabled = configFile.studio?.enabled;
|
|
8
|
+
if (enabled === false) return "off";
|
|
9
|
+
return configFile.output === "server" && enabled === true ? "server" : "dev";
|
|
10
|
+
};
|
|
11
|
+
var getStorageType = (configFile) => configFile.storage?.type || "memory";
|
|
12
|
+
var loadSqlite = () => {
|
|
13
|
+
const emitWarning = process.emitWarning;
|
|
14
|
+
process.emitWarning = function(warning, ...args) {
|
|
15
|
+
const type = typeof args[0] === "object" ? args[0]?.type : args[0];
|
|
16
|
+
const message = typeof warning === "string" ? warning : warning?.message;
|
|
17
|
+
if (type === "ExperimentalWarning" && message?.startsWith("SQLite")) return;
|
|
18
|
+
return emitWarning.call(this, warning, ...args);
|
|
19
|
+
};
|
|
20
|
+
try {
|
|
21
|
+
return process.getBuiltinModule?.("node:sqlite");
|
|
22
|
+
} catch {
|
|
23
|
+
return void 0;
|
|
24
|
+
} finally {
|
|
25
|
+
process.emitWarning = emitWarning;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
var UNKNOWN = "canvases:unknown";
|
|
29
|
+
var serializeStudioUsage = (projectDirectory, configFile, now = Date.now()) => {
|
|
30
|
+
if (getStudioMode(configFile) === "off" || getStorageType(configFile) !== "sqlite") return UNKNOWN;
|
|
31
|
+
const file = path.resolve(projectDirectory, configFile.storage.path ?? DEFAULT_DATABASE_PATH);
|
|
32
|
+
if (!fs.existsSync(file)) return "canvases:0,changed7d:0,changed30d:0,deleted:0";
|
|
33
|
+
let database;
|
|
34
|
+
try {
|
|
35
|
+
const sqlite = loadSqlite();
|
|
36
|
+
if (!sqlite?.DatabaseSync) return UNKNOWN;
|
|
37
|
+
database = new sqlite.DatabaseSync(file, { readOnly: true });
|
|
38
|
+
const canvases = database.prepare(
|
|
39
|
+
"SELECT COUNT(*) AS total, SUM(updated_at >= ?) AS changed7d, SUM(updated_at >= ?) AS changed30d FROM studio_canvases"
|
|
40
|
+
).get(now - 7 * DAY_IN_MS, now - 30 * DAY_IN_MS);
|
|
41
|
+
const { deleted } = database.prepare("SELECT COUNT(*) AS deleted FROM studio_deleted_canvases").get();
|
|
42
|
+
return `canvases:${canvases.total},changed7d:${canvases.changed7d ?? 0},changed30d:${canvases.changed30d ?? 0},deleted:${deleted}`;
|
|
43
|
+
} catch {
|
|
44
|
+
return UNKNOWN;
|
|
45
|
+
} finally {
|
|
46
|
+
database?.close();
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export {
|
|
51
|
+
getStudioMode,
|
|
52
|
+
getStorageType,
|
|
53
|
+
serializeStudioUsage
|
|
54
|
+
};
|
|
@@ -6,9 +6,14 @@ import {
|
|
|
6
6
|
hashCatalogContent,
|
|
7
7
|
serializeCounts
|
|
8
8
|
} from "./chunk-ZAZHAVKB.js";
|
|
9
|
+
import {
|
|
10
|
+
getStorageType,
|
|
11
|
+
getStudioMode,
|
|
12
|
+
serializeStudioUsage
|
|
13
|
+
} from "./chunk-CA6WCQ2T.js";
|
|
9
14
|
import {
|
|
10
15
|
raiseEvent
|
|
11
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-QWFP2PDM.js";
|
|
12
17
|
import {
|
|
13
18
|
TELEMETRY_REQUEST_TIMEOUT_MS,
|
|
14
19
|
isTelemetryDisabled
|
|
@@ -31,7 +36,9 @@ var getFeatures = async (configFile) => {
|
|
|
31
36
|
environments: Array.isArray(configFile.environments) && configFile.environments.length > 0,
|
|
32
37
|
output: configFile.output || "static",
|
|
33
38
|
mcp,
|
|
34
|
-
mcpAuth: mcp && (configFile.mcp?.auth?.enabled ?? false)
|
|
39
|
+
mcpAuth: mcp && (configFile.mcp?.auth?.enabled ?? false),
|
|
40
|
+
studio: getStudioMode(configFile),
|
|
41
|
+
storage: getStorageType(configFile)
|
|
35
42
|
};
|
|
36
43
|
};
|
|
37
44
|
var getDirectoryProvider = (source) => {
|
|
@@ -132,7 +139,8 @@ var main = async (projectDir, { command = "build", license } = {}) => {
|
|
|
132
139
|
generators: generatorNames.toString(),
|
|
133
140
|
features: Object.keys(features).map((feature) => `${feature}:${features[feature]}`).join(","),
|
|
134
141
|
directorySources: serializeDirectorySources(configFile),
|
|
135
|
-
resources: serializeCounts(resourceCounts)
|
|
142
|
+
resources: serializeCounts(resourceCounts),
|
|
143
|
+
studio: serializeStudioUsage(projectDir, configFile)
|
|
136
144
|
},
|
|
137
145
|
configFile
|
|
138
146
|
);
|
package/dist/constants.cjs
CHANGED