@eventcatalog/core 4.12.3 → 5.0.0-beta.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.
- package/LICENSE +226 -95
- package/NOTICE +30 -0
- package/README.md +3 -2
- package/dist/analytics/analytics.cjs +2 -1
- package/dist/analytics/analytics.js +2 -2
- package/dist/analytics/log-build.cjs +44 -16
- package/dist/analytics/log-build.d.cts +6 -5
- package/dist/analytics/log-build.d.ts +6 -5
- package/dist/analytics/log-build.js +4 -3
- package/dist/{chunk-U4YJSTGV.js → chunk-AYNZXUB5.js} +2 -10
- package/dist/{chunk-5BPN6QEC.js → chunk-K2ACDO7Y.js} +1 -1
- package/dist/{chunk-ZYTCBNB3.js → chunk-KYJZJLBD.js} +2 -1
- package/dist/{chunk-TV3YAWKQ.js → chunk-Q6SD5SNQ.js} +1 -1
- package/dist/{chunk-HPC6KUDQ.js → chunk-S2QGT7ZF.js} +1 -1
- package/dist/chunk-TQLRG35T.js +203 -0
- package/dist/{chunk-M577VUOX.js → chunk-UDS3SYLZ.js} +13 -16
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog.cjs +408 -291
- package/dist/eventcatalog.config.d.cts +2 -3
- package/dist/eventcatalog.config.d.ts +2 -3
- package/dist/eventcatalog.js +35 -98
- package/dist/federation/content-cache.d.cts +0 -5
- package/dist/federation/content-cache.d.ts +0 -5
- package/dist/federation/diagnostics.d.cts +0 -5
- package/dist/federation/diagnostics.d.ts +0 -5
- package/dist/federation/federate.cjs +0 -9
- package/dist/federation/federate.d.cts +0 -5
- package/dist/federation/federate.d.ts +0 -5
- package/dist/federation/federate.js +4 -5
- package/dist/federation/filesystem-source-provider.d.cts +0 -5
- package/dist/federation/filesystem-source-provider.d.ts +0 -5
- package/dist/federation/github-source-provider.d.cts +0 -5
- package/dist/federation/github-source-provider.d.ts +0 -5
- package/dist/federation/output-transaction.d.cts +0 -4
- package/dist/federation/output-transaction.d.ts +0 -4
- package/dist/federation/public-assets.d.cts +0 -5
- package/dist/federation/public-assets.d.ts +0 -5
- package/dist/federation/source-provider.d.cts +0 -5
- package/dist/federation/source-provider.d.ts +0 -5
- package/dist/federation/types.d.cts +0 -5
- package/dist/federation/types.d.ts +0 -5
- package/dist/generate.cjs +1 -1
- package/dist/generate.js +3 -3
- package/dist/license-C1y-56bb.d.cts +23 -0
- package/dist/license-C1y-56bb.d.ts +23 -0
- package/dist/runtime-dependencies/@eventcatalog__visualiser__layout.mjs +3 -0
- package/dist/runtime-dependencies/@modelcontextprotocol__ext-apps.mjs +3 -0
- package/dist/runtime-dependencies/@modelcontextprotocol__ext-apps__react.mjs +3 -0
- package/dist/runtime-dependencies/@modelcontextprotocol__ext-apps__server.mjs +3 -0
- package/dist/runtime-dependencies/@modelcontextprotocol__sdk__types.js.mjs +3 -0
- package/dist/runtime-dependencies/manifest.json +12 -1
- package/dist/runtime-dependencies/react-syntax-highlighter__dist__esm__languages__prism__graphql.mjs +3 -0
- package/dist/runtime-dependencies/react-syntax-highlighter__dist__esm__languages__prism__json.mjs +3 -0
- package/dist/runtime-dependencies/react-syntax-highlighter__dist__esm__languages__prism__markup.mjs +3 -0
- package/dist/runtime-dependencies/react-syntax-highlighter__dist__esm__languages__prism__protobuf.mjs +3 -0
- package/dist/runtime-dependencies/react-syntax-highlighter__dist__esm__languages__prism__yaml.mjs +3 -0
- package/dist/runtime-dependencies/react-syntax-highlighter__dist__esm__styles__prism__one-dark.mjs +3 -0
- package/dist/runtime-dependencies/react-syntax-highlighter__dist__esm__styles__prism__one-light.mjs +3 -0
- package/dist/utils/cli-logger.cjs +1 -1
- package/dist/utils/cli-logger.js +2 -2
- package/dist/utils/license-status.cjs +240 -0
- package/dist/utils/license-status.d.cts +28 -0
- package/dist/utils/license-status.d.ts +28 -0
- package/dist/utils/license-status.js +12 -0
- package/eventcatalog/astro.config.mjs +1 -1
- package/eventcatalog/integrations/eventcatalog-runtime.mjs +1 -1
- package/eventcatalog/src/components/ChatPanel/ChatPanel.tsx +29 -19
- package/eventcatalog/src/components/ChatPanel/OfflineReply.tsx +74 -0
- package/eventcatalog/src/components/FieldsExplorer/FieldFilters.tsx +24 -28
- package/eventcatalog/src/components/FieldsExplorer/FieldNodeGraph.tsx +16 -11
- package/eventcatalog/src/components/FieldsExplorer/FieldsExplorer.tsx +4 -218
- package/eventcatalog/src/components/FieldsExplorer/FieldsTable.tsx +27 -36
- package/eventcatalog/src/components/Header.astro +43 -58
- package/eventcatalog/src/components/Lists/PillListFlat.styles.css +17 -17
- package/eventcatalog/src/components/MDX/EntityMap/EntityMap.astro +1 -1
- package/eventcatalog/src/components/MDX/Flow/Flow.astro +4 -0
- package/eventcatalog/src/components/MDX/NodeGraph/AstroNodeGraph.tsx +14 -0
- package/eventcatalog/src/components/MDX/NodeGraph/NodeGraph.astro +49 -18
- package/eventcatalog/src/components/MDX/RemoteFile.astro +2 -24
- package/eventcatalog/src/components/SchemaExplorer/ApiAccessSection.tsx +59 -93
- package/eventcatalog/src/components/SchemaExplorer/ApiContentViewer.tsx +1 -32
- package/eventcatalog/src/components/SchemaExplorer/DiffViewer.tsx +20 -67
- package/eventcatalog/src/components/SchemaExplorer/SchemaContentViewer.tsx +2 -11
- package/eventcatalog/src/components/SchemaExplorer/SchemaDetailsPanel.tsx +11 -60
- package/eventcatalog/src/components/SchemaExplorer/SchemaExplorer.tsx +1 -3
- package/eventcatalog/src/components/SchemaExplorer/SchemaPageViewer.tsx +0 -3
- package/eventcatalog/src/components/SchemaExplorer/VersionHistoryModal.tsx +2 -9
- package/eventcatalog/src/components/SchemaExplorer/parse-schema.ts +46 -0
- package/eventcatalog/src/components/SchemaExplorer/utils.ts +11 -0
- package/eventcatalog/src/components/Settings/AssistantSettingsForm.tsx +2 -9
- package/eventcatalog/src/components/Settings/LicenseSettings.tsx +288 -0
- package/eventcatalog/src/components/Settings/LlmAccessSettingsForm.tsx +3 -19
- package/eventcatalog/src/components/Settings/McpSettingsForm.tsx +85 -30
- package/eventcatalog/src/components/Settings/SettingsShared.tsx +7 -75
- package/eventcatalog/src/components/SideNav/CustomDocsNav.astro +2 -2
- package/eventcatalog/src/components/TrialBadge.astro +82 -0
- package/eventcatalog/src/content.config.ts +9 -96
- package/eventcatalog/src/{enterprise → features}/ai/chat-api.ts +22 -34
- package/eventcatalog/src/{enterprise → features}/analytics/adapters/ga4.ts +0 -5
- package/eventcatalog/src/{enterprise → features}/analytics/adapters/gtm.ts +0 -5
- package/eventcatalog/src/{enterprise → features}/analytics/adapters/posthog.ts +0 -5
- package/eventcatalog/src/{enterprise → features}/analytics/components/AnalyticsHead.astro +2 -4
- package/eventcatalog/src/{enterprise → features}/analytics/components/AnalyticsTracker.astro +2 -4
- package/eventcatalog/src/{enterprise → features}/analytics/tracker.ts +0 -5
- package/eventcatalog/src/{enterprise → features}/api/catalog.ts +0 -5
- package/eventcatalog/src/{enterprise → features}/auth/[...auth].ts +0 -5
- package/eventcatalog/src/{enterprise → features}/auth/middleware/middleware-auth.ts +0 -5
- package/eventcatalog/src/{enterprise → features}/auth/middleware/middleware.ts +0 -5
- package/eventcatalog/src/{enterprise → features}/collections/custom-pages.ts +0 -5
- package/eventcatalog/src/{enterprise → features}/collections/index.ts +0 -5
- package/eventcatalog/src/{enterprise → features}/collections/resource-docs.ts +0 -5
- package/eventcatalog/src/{enterprise → features}/custom-documentation/collection.ts +0 -5
- package/eventcatalog/src/features/custom-documentation/components/CustomDocsNav/CustomDocsNav.astro +9 -0
- package/eventcatalog/src/{enterprise → features}/custom-documentation/components/CustomDocsNav/CustomDocsNavWrapper.tsx +0 -5
- package/eventcatalog/src/{enterprise → features}/custom-documentation/components/CustomDocsNav/components/NestedItem.tsx +1 -6
- package/eventcatalog/src/{enterprise → features}/custom-documentation/components/CustomDocsNav/components/NoResultsFound.tsx +0 -5
- package/eventcatalog/src/{enterprise → features}/custom-documentation/components/CustomDocsNav/index.tsx +1 -6
- package/eventcatalog/src/{enterprise → features}/custom-documentation/components/CustomDocsNav/types.ts +0 -5
- package/eventcatalog/src/{enterprise/custom-documentation/pages/docs/custom/index.astro → features/custom-documentation/components/CustomDocumentationPage.astro} +5 -5
- package/eventcatalog/src/{enterprise → features}/custom-documentation/utils/badge-styles.ts +0 -5
- package/eventcatalog/src/{enterprise → features}/custom-documentation/utils/custom-docs.ts +1 -6
- package/eventcatalog/src/{enterprise → features}/custom-documentation/utils/docs-search.ts +0 -5
- package/eventcatalog/src/{enterprise → features}/custom-pages/routes.ts +0 -5
- package/eventcatalog/src/{enterprise → features}/directory/user-team-directory.ts +0 -5
- package/eventcatalog/src/{enterprise → features}/fields/field-extractor.ts +0 -5
- package/eventcatalog/src/{enterprise → features}/fields/field-indexer.ts +0 -5
- package/eventcatalog/src/{enterprise → features}/fields/fields-db.ts +0 -5
- package/eventcatalog/src/{enterprise → features}/fields/pages/api/fields.ts +1 -6
- package/eventcatalog/src/{enterprise → features}/fields/pages/fields.astro +1 -2
- package/eventcatalog/src/{enterprise → features}/integrations/eventcatalog-features.ts +17 -75
- package/eventcatalog/src/features/mcp/apps/architecture-diagram/links.ts +59 -0
- package/eventcatalog/src/features/mcp/apps/architecture-diagram/node-chat.tsx +299 -0
- package/eventcatalog/src/features/mcp/apps/architecture-diagram/shared.ts +14 -0
- package/eventcatalog/src/features/mcp/apps/architecture-diagram/view.tsx +454 -0
- package/eventcatalog/src/features/mcp/apps/generated/viewer.html +432 -0
- package/eventcatalog/src/features/mcp/apps/mermaid-stub.ts +10 -0
- package/eventcatalog/src/features/mcp/apps/schema-viewer/schema-code.tsx +65 -0
- package/eventcatalog/src/features/mcp/apps/schema-viewer/shared.ts +23 -0
- package/eventcatalog/src/features/mcp/apps/schema-viewer/view.tsx +170 -0
- package/eventcatalog/src/features/mcp/apps/shared/app-view.tsx +98 -0
- package/eventcatalog/src/features/mcp/apps/shared/resource-types.ts +15 -0
- package/eventcatalog/src/features/mcp/apps/viewer/shared.ts +24 -0
- package/eventcatalog/src/features/mcp/apps/viewer/styles.css +25 -0
- package/eventcatalog/src/features/mcp/apps/viewer/view.tsx +59 -0
- package/eventcatalog/src/features/mcp/mcp-app-icons.ts +63 -0
- package/eventcatalog/src/features/mcp/mcp-apps.ts +160 -0
- package/eventcatalog/src/{enterprise → features}/mcp/mcp-auth.ts +0 -5
- package/eventcatalog/src/{enterprise → features}/mcp/mcp-scope.ts +7 -7
- package/eventcatalog/src/{enterprise → features}/mcp/mcp-scoped-tools.ts +47 -40
- package/eventcatalog/src/{enterprise → features}/mcp/mcp-server.ts +347 -34
- package/eventcatalog/src/{enterprise → features}/mcp/oauth-protected-resource.ts +0 -5
- package/eventcatalog/src/features/mcp/schema-viewer.ts +24 -0
- package/eventcatalog/src/{enterprise → features}/tools/catalog-tools.ts +133 -102
- package/eventcatalog/src/features/tools/index.ts +5 -0
- package/eventcatalog/src/{enterprise → features}/visualizer-layout/reset.ts +0 -5
- package/eventcatalog/src/{enterprise → features}/visualizer-layout/save.ts +0 -5
- package/eventcatalog/src/layouts/BaseLayout.astro +2 -2
- package/eventcatalog/src/layouts/Footer.astro +31 -39
- package/eventcatalog/src/layouts/SettingsLayout.astro +6 -6
- package/eventcatalog/src/layouts/VerticalSideBarLayout.astro +7 -37
- package/eventcatalog/src/{enterprise → pages}/api/schemas/[collection]/[id]/[version]/index.ts +0 -22
- package/eventcatalog/src/{enterprise → pages}/api/schemas/services/[id]/[version]/[specification]/index.ts +0 -19
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/[docVersion]/_index.data.ts +2 -6
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/[docVersion]/index.astro +1 -5
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/_index.data.ts +2 -6
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/index.astro +1 -5
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId].md.ts +2 -6
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId].mdx.ts +2 -6
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +9 -5
- package/eventcatalog/src/pages/docs/custom/[...path]/index.astro +12 -0
- package/eventcatalog/src/{enterprise/custom-documentation/pages/docs/custom/root-index.astro → pages/docs/custom/index.astro} +1 -23
- package/eventcatalog/src/pages/docs/llm/llms-full.txt.ts +4 -9
- package/eventcatalog/src/pages/docs/llm/llms.txt.ts +4 -4
- package/eventcatalog/src/pages/docs/llm/schemas.txt.ts +0 -11
- package/eventcatalog/src/pages/docs/services/[id]/[docType]/[docId]/index.astro +2 -2
- package/eventcatalog/src/pages/index.astro +2 -2
- package/eventcatalog/src/pages/schemas/[type]/[id]/[version]/index.astro +0 -3
- package/eventcatalog/src/pages/schemas/explorer/index.astro +1 -4
- package/eventcatalog/src/pages/settings/assistant.astro +2 -4
- package/eventcatalog/src/pages/settings/license.astro +18 -0
- package/eventcatalog/src/pages/settings/llm-access.astro +1 -4
- package/eventcatalog/src/pages/settings/mcp.astro +33 -4
- package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/_index.data.ts +1 -2
- package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/data/index.astro +2 -45
- package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/entity-map/index.astro +1 -1
- package/eventcatalog/src/pages/visualiser/[type]/[id]/[version].mermaid.ts +7 -109
- package/eventcatalog/src/pages/visualiser/_mermaid-route.ts +78 -0
- package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/_index.data.ts +44 -0
- package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/entity-map/index.astro +1 -1
- package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/index.astro +56 -0
- package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/systems-context/index.astro +3 -40
- package/eventcatalog/src/pages/visualiser/domains/[id]/[version].mermaid.ts +20 -0
- package/eventcatalog/src/pages/visualiser/systems/[id]/[version]/_index.data.ts +29 -0
- package/eventcatalog/src/pages/visualiser/systems/[id]/[version]/context/index.astro +3 -38
- package/eventcatalog/src/pages/visualiser/systems/[id]/[version]/index.astro +56 -0
- package/eventcatalog/src/pages/visualiser/systems/[id]/[version].mermaid.ts +20 -0
- package/eventcatalog/src/stores/sidebar-store/builders/agent.ts +1 -1
- package/eventcatalog/src/stores/sidebar-store/builders/container.ts +1 -1
- package/eventcatalog/src/stores/sidebar-store/builders/data-product.ts +1 -1
- package/eventcatalog/src/stores/sidebar-store/builders/domain.ts +7 -32
- package/eventcatalog/src/stores/sidebar-store/builders/entity.ts +1 -1
- package/eventcatalog/src/stores/sidebar-store/builders/message.ts +1 -1
- package/eventcatalog/src/stores/sidebar-store/builders/service.ts +2 -8
- package/eventcatalog/src/stores/sidebar-store/builders/system.ts +2 -12
- package/eventcatalog/src/stores/sidebar-store/custom-sidebar.ts +0 -10
- package/eventcatalog/src/stores/sidebar-store/state.ts +4 -6
- package/eventcatalog/src/styles/theme.css +22 -18
- package/eventcatalog/src/styles/themes/forest.css +8 -8
- package/eventcatalog/src/styles/themes/ocean.css +8 -8
- package/eventcatalog/src/styles/themes/sapphire.css +8 -8
- package/eventcatalog/src/styles/themes/sunset.css +8 -8
- package/eventcatalog/src/utils/clipboard.ts +4 -4
- package/eventcatalog/src/utils/collections/flow-step-schema.ts +117 -0
- package/eventcatalog/src/utils/collections/pointer-schema.ts +7 -0
- package/eventcatalog/src/utils/collections/resource-docs.ts +677 -14
- package/eventcatalog/src/utils/collections/schema-loader.ts +0 -5
- package/eventcatalog/src/utils/feature.ts +14 -23
- package/eventcatalog/src/utils/license.ts +114 -0
- package/eventcatalog/src/utils/node-graphs/architecture-diagram-types.ts +32 -0
- package/eventcatalog/src/utils/node-graphs/architecture-diagram.ts +84 -0
- package/eventcatalog/src/utils/node-graphs/channel-node-graph.ts +4 -25
- package/eventcatalog/src/utils/node-graphs/container-node-graph.ts +12 -39
- package/eventcatalog/src/utils/node-graphs/data-products-node-graph.ts +11 -27
- package/eventcatalog/src/utils/node-graphs/domain-levels-node-graph.ts +679 -0
- package/eventcatalog/src/utils/node-graphs/domains-node-graph.ts +3 -20
- package/eventcatalog/src/utils/node-graphs/export-mermaid.ts +51 -4
- package/eventcatalog/src/utils/node-graphs/field-node-graph.ts +8 -23
- package/eventcatalog/src/utils/node-graphs/flow-lanes.ts +119 -0
- package/eventcatalog/src/utils/node-graphs/flows-node-graph.ts +133 -47
- package/eventcatalog/src/utils/node-graphs/layout-node-graph.ts +28 -0
- package/eventcatalog/src/utils/node-graphs/layout-persistence.ts +3 -3
- package/eventcatalog/src/utils/node-graphs/message-node-graph.ts +16 -34
- package/eventcatalog/src/utils/node-graphs/services-node-graph.ts +11 -25
- package/eventcatalog/src/utils/node-graphs/system-context-node-graph.ts +18 -54
- package/eventcatalog/src/utils/node-graphs/system-levels-node-graph.ts +59 -0
- package/eventcatalog/src/utils/node-graphs/systems-node-graph.ts +20 -80
- package/eventcatalog/src/utils/node-graphs/utils/utils.ts +1 -78
- package/eventcatalog/src/utils/trial.ts +36 -0
- package/eventcatalog/tsconfig.json +1 -1
- package/package.json +11 -11
- package/dist/chunk-FV56YFM4.js +0 -7
- package/dist/federation/entitlement.cjs +0 -31
- package/dist/federation/entitlement.d.cts +0 -12
- package/dist/federation/entitlement.d.ts +0 -12
- package/dist/federation/entitlement.js +0 -6
- package/dist/runtime-dependencies/dagre.mjs +0 -3
- package/eventcatalog/src/components/Settings/BillingSettingsForm.tsx +0 -265
- package/eventcatalog/src/enterprise/LICENSE +0 -57
- package/eventcatalog/src/enterprise/README.md +0 -5
- package/eventcatalog/src/enterprise/collections/resource-docs-utils.ts +0 -691
- package/eventcatalog/src/enterprise/custom-documentation/components/CustomDocsNav/CustomDocsNav.astro +0 -9
- package/eventcatalog/src/enterprise/custom-documentation/pages/docs/custom/[...path]/index.astro +0 -18
- package/eventcatalog/src/enterprise/custom-documentation/pages/docs/custom/feature.astro +0 -171
- package/eventcatalog/src/enterprise/feature.ts +0 -75
- package/eventcatalog/src/enterprise/tools/index.ts +0 -10
- package/eventcatalog/src/hooks/eventcatalog-visualizer.ts +0 -126
- package/eventcatalog/src/pages/settings/billing.astro +0 -17
- package/eventcatalog/src/pages/visualiser/domain-integrations/index.astro +0 -26
- package/eventcatalog/src/types/mcp-modules.d.ts +0 -67
- package/eventcatalog/src/utils/node-graphs/domains-canvas.ts +0 -261
- package/eventcatalog/src/utils/node-graphs/export-node-graph.ts +0 -91
- /package/eventcatalog/src/{enterprise → features}/auth/error.astro +0 -0
- /package/eventcatalog/src/{enterprise → features}/auth/login.astro +0 -0
- /package/eventcatalog/src/{enterprise → features}/auth/unauthorized.astro +0 -0
- /package/eventcatalog/src/{enterprise/custom-documentation/pages → pages}/docs/custom/[...path]/_index.data.ts +0 -0
- /package/eventcatalog/src/{enterprise/custom-documentation/pages → pages}/docs/custom/[...path].mdx.ts +0 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
// src/utils/license-status.ts
|
|
2
|
+
import boxen from "boxen";
|
|
3
|
+
import { isEventCatalogScaleEnabled, isEventCatalogStarterEnabled } from "@eventcatalog/license";
|
|
4
|
+
|
|
5
|
+
// eventcatalog/src/utils/trial.ts
|
|
6
|
+
var TRIAL_LENGTH_DAYS = 90;
|
|
7
|
+
var LICENSE_FAQ_URL = "https://www.eventcatalog.dev/license-faq";
|
|
8
|
+
var LICENSE_RENEW_URL = "https://eventcatalog.cloud";
|
|
9
|
+
var DAY_IN_MS = 24 * 60 * 60 * 1e3;
|
|
10
|
+
var getTrialStatus = (tsd, now = Date.now()) => {
|
|
11
|
+
if (typeof tsd !== "number" || !Number.isFinite(tsd) || tsd <= 0) return;
|
|
12
|
+
const endsAt = tsd + TRIAL_LENGTH_DAYS * DAY_IN_MS;
|
|
13
|
+
const daysLeft = Math.max(0, Math.ceil((endsAt - now) / DAY_IN_MS));
|
|
14
|
+
return { daysLeft, ended: daysLeft === 0, endsAt: new Date(endsAt) };
|
|
15
|
+
};
|
|
16
|
+
var LICENSE_REMINDER_DAYS = 30;
|
|
17
|
+
|
|
18
|
+
// eventcatalog/src/utils/license.ts
|
|
19
|
+
import fs from "fs";
|
|
20
|
+
import path from "path";
|
|
21
|
+
import { clearCache, hasCommercialLicense, verifyOfflineLicense } from "@eventcatalog/license";
|
|
22
|
+
var toDate = (seconds) => typeof seconds === "number" ? new Date(seconds * 1e3) : void 0;
|
|
23
|
+
var getDetails = (claims) => ({
|
|
24
|
+
org: typeof claims.org === "string" ? claims.org : void 0,
|
|
25
|
+
licenseId: typeof claims.licenseId === "string" ? claims.licenseId : void 0,
|
|
26
|
+
issuedAt: toDate(claims.iat)
|
|
27
|
+
});
|
|
28
|
+
var INVALID_REASONS = {
|
|
29
|
+
LICENSE_FILE_EMPTY: "the file is empty",
|
|
30
|
+
LICENSE_NOT_YET_VALID: "it is not valid yet",
|
|
31
|
+
LICENSE_SIGNATURE_INVALID: "its signature is invalid",
|
|
32
|
+
LICENSE_VALIDATION_FAILED: "it was not issued by EventCatalog"
|
|
33
|
+
};
|
|
34
|
+
var getLicenseFilePath = (projectDirectory) => process.env.EC_LICENSE || path.join(projectDirectory, "license.jwt");
|
|
35
|
+
var readClaims = (licenseFilePath) => {
|
|
36
|
+
try {
|
|
37
|
+
const payload = fs.readFileSync(licenseFilePath, "utf8").trim().split(".")[1];
|
|
38
|
+
return JSON.parse(Buffer.from(payload, "base64url").toString("utf8"));
|
|
39
|
+
} catch {
|
|
40
|
+
return {};
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
var statusCache = /* @__PURE__ */ new Map();
|
|
44
|
+
var getLicensePlan = () => {
|
|
45
|
+
if (process.env.EVENTCATALOG_SCALE === "true") return "scale";
|
|
46
|
+
if (process.env.EVENTCATALOG_STARTER === "true") return "starter";
|
|
47
|
+
};
|
|
48
|
+
var getCommercialLicenseStatus = (projectDirectory = process.env.PROJECT_DIR || process.cwd()) => {
|
|
49
|
+
const licensePath = getLicenseFilePath(projectDirectory);
|
|
50
|
+
const modifiedAt = fs.statSync(licensePath, { throwIfNoEntry: false })?.mtimeMs;
|
|
51
|
+
if (modifiedAt === void 0) return Promise.resolve({ state: "none" });
|
|
52
|
+
const key = `${licensePath}:${modifiedAt}`;
|
|
53
|
+
if (!statusCache.has(key)) statusCache.set(key, verifyLicense(licensePath));
|
|
54
|
+
return statusCache.get(key);
|
|
55
|
+
};
|
|
56
|
+
var getLicenseStatus = async (projectDirectory) => {
|
|
57
|
+
const license = await getCommercialLicenseStatus(projectDirectory);
|
|
58
|
+
if (license.state === "licensed") return license;
|
|
59
|
+
const plan = getLicensePlan();
|
|
60
|
+
return plan ? { state: "plan", plan } : license;
|
|
61
|
+
};
|
|
62
|
+
var verifyLicense = async (licensePath) => {
|
|
63
|
+
const consoleError = console.error;
|
|
64
|
+
console.error = () => {
|
|
65
|
+
};
|
|
66
|
+
try {
|
|
67
|
+
clearCache();
|
|
68
|
+
if (await hasCommercialLicense()) {
|
|
69
|
+
const entitlements2 = await verifyOfflineLicense({ licensePath });
|
|
70
|
+
return { state: "licensed", ...getDetails(entitlements2), expiresAt: new Date(entitlements2.exp * 1e3) };
|
|
71
|
+
}
|
|
72
|
+
clearCache();
|
|
73
|
+
const entitlements = await verifyOfflineLicense({ licensePath });
|
|
74
|
+
if (typeof entitlements.exp !== "number") return { state: "invalid", reason: "it has no expiry date" };
|
|
75
|
+
return { state: "expired", ...getDetails(entitlements), expiresAt: new Date(entitlements.exp * 1e3) };
|
|
76
|
+
} catch (error) {
|
|
77
|
+
if (error?.code === "LICENSE_EXPIRED") {
|
|
78
|
+
const claims = readClaims(licensePath);
|
|
79
|
+
return { state: "expired", ...getDetails(claims), expiresAt: toDate(claims.exp) };
|
|
80
|
+
}
|
|
81
|
+
return { state: "invalid", reason: INVALID_REASONS[error?.code] || error?.message || String(error) };
|
|
82
|
+
} finally {
|
|
83
|
+
console.error = consoleError;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
// src/utils/license-status.ts
|
|
88
|
+
var isPlanEnabled = async (check) => {
|
|
89
|
+
const consoleError = console.error;
|
|
90
|
+
console.error = () => {
|
|
91
|
+
};
|
|
92
|
+
try {
|
|
93
|
+
return await check();
|
|
94
|
+
} catch {
|
|
95
|
+
return false;
|
|
96
|
+
} finally {
|
|
97
|
+
console.error = consoleError;
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
var checkPlanLicense = async () => {
|
|
101
|
+
if (await isPlanEnabled(isEventCatalogScaleEnabled)) return "scale";
|
|
102
|
+
if (await isPlanEnabled(isEventCatalogStarterEnabled)) return "starter";
|
|
103
|
+
};
|
|
104
|
+
var getLicenseStatus2 = async (projectDirectory) => {
|
|
105
|
+
const license = await getCommercialLicenseStatus(projectDirectory);
|
|
106
|
+
const plan = license.state === "licensed" ? void 0 : await checkPlanLicense();
|
|
107
|
+
process.env.EVENTCATALOG_SCALE = String(plan === "scale");
|
|
108
|
+
process.env.EVENTCATALOG_STARTER = String(plan === "starter");
|
|
109
|
+
return getLicenseStatus(projectDirectory);
|
|
110
|
+
};
|
|
111
|
+
var DAY_IN_MS2 = 24 * 60 * 60 * 1e3;
|
|
112
|
+
var getLicenseType = (license) => {
|
|
113
|
+
if (license.state === "licensed") return "commercial";
|
|
114
|
+
if (license.state === "plan") return license.plan;
|
|
115
|
+
return "trial";
|
|
116
|
+
};
|
|
117
|
+
var getLicenseAnalytics = (license = { state: "none" }, tsd) => ({
|
|
118
|
+
license: getLicenseType(license),
|
|
119
|
+
licenseState: license.state === "licensed" || license.state === "plan" ? "valid" : license.state,
|
|
120
|
+
licenseExpiry: "expiresAt" in license ? license.expiresAt?.getTime() : void 0,
|
|
121
|
+
trialExpiry: getTrialStatus(tsd)?.endsAt.getTime()
|
|
122
|
+
});
|
|
123
|
+
var formatDate = (date) => date.toLocaleDateString(void 0, { dateStyle: "medium" });
|
|
124
|
+
var formatDays = (days) => `${days} ${days === 1 ? "day" : "days"}`;
|
|
125
|
+
var getTrialLine = (tsd, now) => {
|
|
126
|
+
const trial = getTrialStatus(tsd, now);
|
|
127
|
+
if (!trial) return;
|
|
128
|
+
return trial.ended ? `Your ${TRIAL_LENGTH_DAYS}-day EventCatalog trial ended on ${formatDate(trial.endsAt)}.` : `${formatDays(trial.daysLeft)} left of your ${TRIAL_LENGTH_DAYS}-day EventCatalog trial (ends ${formatDate(trial.endsAt)}).`;
|
|
129
|
+
};
|
|
130
|
+
var getLicenseStatusMessage = (license, tsd, now = Date.now()) => {
|
|
131
|
+
if (license.state === "licensed") {
|
|
132
|
+
const daysLeft = Math.max(0, Math.ceil((license.expiresAt.getTime() - now) / DAY_IN_MS2));
|
|
133
|
+
const licensedTo = license.org ? `Licensed to ${license.org}` : "Licensed";
|
|
134
|
+
if (daysLeft < LICENSE_REMINDER_DAYS) {
|
|
135
|
+
return {
|
|
136
|
+
title: "EventCatalog Commercial License",
|
|
137
|
+
color: "yellow",
|
|
138
|
+
text: [
|
|
139
|
+
licensedTo,
|
|
140
|
+
`Your license expires in ${formatDays(daysLeft)}, on ${formatDate(license.expiresAt)}.`,
|
|
141
|
+
`Renew it to keep using EventCatalog commercially: ${LICENSE_RENEW_URL}`
|
|
142
|
+
].join("\n")
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
return {
|
|
146
|
+
title: "EventCatalog Commercial License",
|
|
147
|
+
color: "green",
|
|
148
|
+
text: `${licensedTo}
|
|
149
|
+
Valid until ${formatDate(license.expiresAt)} (${formatDays(daysLeft)} left)`
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
if (license.state === "plan") return;
|
|
153
|
+
const trialLine = getTrialLine(tsd, now);
|
|
154
|
+
if (license.state === "none") {
|
|
155
|
+
if (!trialLine) return;
|
|
156
|
+
const ended = getTrialStatus(tsd, now)?.ended;
|
|
157
|
+
return {
|
|
158
|
+
title: "EventCatalog trial",
|
|
159
|
+
color: ended ? "yellow" : "green",
|
|
160
|
+
text: `${trialLine}
|
|
161
|
+
Learn about licensing: ${LICENSE_FAQ_URL}`
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
if (license.state === "expired") {
|
|
165
|
+
const expiredOn = license.expiresAt ? `expired on ${formatDate(license.expiresAt)} (${formatDays(Math.floor((now - license.expiresAt.getTime()) / DAY_IN_MS2))} ago)` : "has expired";
|
|
166
|
+
return {
|
|
167
|
+
title: "EventCatalog License Expired",
|
|
168
|
+
color: "yellow",
|
|
169
|
+
text: [
|
|
170
|
+
`Your EventCatalog commercial license${license.org ? ` for ${license.org}` : ""} ${expiredOn}.`,
|
|
171
|
+
`Renew it to keep using EventCatalog commercially: ${LICENSE_RENEW_URL}`,
|
|
172
|
+
trialLine,
|
|
173
|
+
`Learn about licensing: ${LICENSE_FAQ_URL}`
|
|
174
|
+
].filter(Boolean).join("\n")
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
return {
|
|
178
|
+
title: "EventCatalog license",
|
|
179
|
+
color: "yellow",
|
|
180
|
+
text: [`Your license.jwt could not be verified: ${license.reason}.`, trialLine, `Learn about licensing: ${LICENSE_FAQ_URL}`].filter(Boolean).join("\n")
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
var printLicenseStatus = (license, tsd) => {
|
|
184
|
+
const message = getLicenseStatusMessage(license, tsd);
|
|
185
|
+
if (!message) return;
|
|
186
|
+
console.log(
|
|
187
|
+
boxen(message.text, {
|
|
188
|
+
padding: 1,
|
|
189
|
+
margin: 1,
|
|
190
|
+
borderStyle: "round",
|
|
191
|
+
borderColor: message.color,
|
|
192
|
+
title: message.title,
|
|
193
|
+
titleAlignment: "center"
|
|
194
|
+
})
|
|
195
|
+
);
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
export {
|
|
199
|
+
getLicenseStatus2 as getLicenseStatus,
|
|
200
|
+
getLicenseAnalytics,
|
|
201
|
+
getLicenseStatusMessage,
|
|
202
|
+
printLicenseStatus
|
|
203
|
+
};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getLicenseAnalytics
|
|
3
|
+
} from "./chunk-TQLRG35T.js";
|
|
1
4
|
import {
|
|
2
5
|
countResources,
|
|
3
6
|
hashCatalogContent,
|
|
@@ -5,14 +8,16 @@ import {
|
|
|
5
8
|
} from "./chunk-ZAZHAVKB.js";
|
|
6
9
|
import {
|
|
7
10
|
raiseEvent
|
|
8
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-KYJZJLBD.js";
|
|
9
12
|
import {
|
|
10
13
|
getEventCatalogConfigFile,
|
|
11
14
|
verifyRequiredFieldsAreInCatalogConfigFile
|
|
12
15
|
} from "./chunk-RFIXKATC.js";
|
|
13
16
|
|
|
14
17
|
// src/analytics/log-build.js
|
|
18
|
+
var isMCPEnabled = (configFile) => configFile.output === "server" && (configFile.mcp?.enabled ?? true);
|
|
15
19
|
var getFeatures = async (configFile) => {
|
|
20
|
+
const mcp = isMCPEnabled(configFile);
|
|
16
21
|
return {
|
|
17
22
|
llmsTxt: configFile.llmsTxt?.enabled || false,
|
|
18
23
|
rss: configFile.rss?.enabled || false,
|
|
@@ -20,7 +25,9 @@ var getFeatures = async (configFile) => {
|
|
|
20
25
|
changelog: configFile.changelog?.enabled || false,
|
|
21
26
|
auth: configFile.auth?.enabled || false,
|
|
22
27
|
environments: Array.isArray(configFile.environments) && configFile.environments.length > 0,
|
|
23
|
-
output: configFile.output || "static"
|
|
28
|
+
output: configFile.output || "static",
|
|
29
|
+
mcp,
|
|
30
|
+
mcpAuth: mcp && (configFile.mcp?.auth?.enabled ?? false)
|
|
24
31
|
};
|
|
25
32
|
};
|
|
26
33
|
var getDirectoryProvider = (source) => {
|
|
@@ -80,21 +87,12 @@ var reportCloudResourceInventory = async (configFile, resourceCounts) => {
|
|
|
80
87
|
})
|
|
81
88
|
});
|
|
82
89
|
};
|
|
83
|
-
var main = async (projectDir, {
|
|
90
|
+
var main = async (projectDir, { command = "build", license } = {}) => {
|
|
84
91
|
try {
|
|
85
92
|
await verifyRequiredFieldsAreInCatalogConfigFile(projectDir);
|
|
86
93
|
const configFile = await getEventCatalogConfigFile(projectDir);
|
|
87
94
|
const { cId, tsd, organizationName, generators = [] } = configFile;
|
|
88
|
-
|
|
89
|
-
if (isEventCatalogStarterEnabled) {
|
|
90
|
-
generatorNames.push("@eventcatalog/eventcatalog-starter");
|
|
91
|
-
}
|
|
92
|
-
if (isEventCatalogScaleEnabled) {
|
|
93
|
-
generatorNames.push("@eventcatalog/eventcatalog-scale");
|
|
94
|
-
}
|
|
95
|
-
if (isBackstagePluginEnabled) {
|
|
96
|
-
generatorNames.push("@eventcatalog/backstage-plugin-eventcatalog");
|
|
97
|
-
}
|
|
95
|
+
const generatorNames = generators.length > 0 ? generators.map((generator) => generator[0]) : ["none"];
|
|
98
96
|
const features = await getFeatures(configFile);
|
|
99
97
|
const resourceCounts = await countResources(projectDir);
|
|
100
98
|
const contentHash = await hashCatalogContent(projectDir);
|
|
@@ -105,11 +103,10 @@ var main = async (projectDir, { isEventCatalogStarterEnabled, isEventCatalogScal
|
|
|
105
103
|
cId,
|
|
106
104
|
// Trial start date (unix ms) from eventcatalog.config.js
|
|
107
105
|
tsd,
|
|
106
|
+
// Commercial license or trial, and when each expires (unix ms)
|
|
107
|
+
...getLicenseAnalytics(license, tsd),
|
|
108
108
|
// CI redeploys and human-run builds are different signals; tag rather than suppress
|
|
109
109
|
ci: process.env.CI ? "true" : "false",
|
|
110
|
-
// The commercial plan, separate from the generators list, so telemetry joins cleanly to licensing
|
|
111
|
-
plan: isEventCatalogScaleEnabled ? "scale" : isEventCatalogStarterEnabled ? "starter" : "none",
|
|
112
|
-
backstage: isBackstagePluginEnabled ? "true" : "false",
|
|
113
110
|
contentHash,
|
|
114
111
|
generators: generatorNames.toString(),
|
|
115
112
|
features: Object.keys(features).map((feature) => `${feature}:${features[feature]}`).join(","),
|
package/dist/constants.cjs
CHANGED