@eventcatalog/core 4.12.2 → 5.0.0-beta.0
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 +1 -1
- package/dist/analytics/analytics.js +2 -2
- package/dist/analytics/log-build.cjs +43 -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-IVVM67LN.js → chunk-CR6AK5LR.js} +1 -1
- package/dist/{chunk-GTIC4R74.js → chunk-LR7AGRHN.js} +13 -16
- package/dist/chunk-TQLRG35T.js +203 -0
- package/dist/{chunk-WK4J6FP3.js → chunk-TWN43V4T.js} +1 -1
- package/dist/{chunk-ZW3MYAWF.js → chunk-WAIADKQE.js} +1 -1
- package/dist/{chunk-RPVA2SZY.js → chunk-ZHKEARLJ.js} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog.cjs +407 -291
- package/dist/eventcatalog.config.d.cts +2 -3
- package/dist/eventcatalog.config.d.ts +2 -3
- package/dist/eventcatalog.js +30 -93
- 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 +2 -3
- 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 -90
- 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/catalog-force-graph.ts +1 -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 +62 -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 +153 -45
- 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
package/dist/eventcatalog.cjs
CHANGED
|
@@ -29,10 +29,10 @@ var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
|
29
29
|
// src/eventcatalog.ts
|
|
30
30
|
var import_commander = require("commander");
|
|
31
31
|
var import_node_child_process2 = require("child_process");
|
|
32
|
-
var
|
|
32
|
+
var import_node_path20 = require("path");
|
|
33
33
|
var import_node_http = __toESM(require("http"), 1);
|
|
34
34
|
var import_fs = __toESM(require("fs"), 1);
|
|
35
|
-
var
|
|
35
|
+
var import_node_path21 = __toESM(require("path"), 1);
|
|
36
36
|
var import_node_url2 = require("url");
|
|
37
37
|
var import_node_module2 = require("module");
|
|
38
38
|
|
|
@@ -181,7 +181,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
|
|
|
181
181
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
182
182
|
|
|
183
183
|
// package.json
|
|
184
|
-
var version = "
|
|
184
|
+
var version = "5.0.0-beta.0";
|
|
185
185
|
|
|
186
186
|
// src/constants.ts
|
|
187
187
|
var VERSION = version;
|
|
@@ -400,8 +400,207 @@ function serializeCounts(counts) {
|
|
|
400
400
|
return Object.entries(counts).map(([k, v]) => `${k}:${v}`).join(",");
|
|
401
401
|
}
|
|
402
402
|
|
|
403
|
+
// src/utils/license-status.ts
|
|
404
|
+
var import_boxen = __toESM(require("boxen"), 1);
|
|
405
|
+
var import_license2 = require("@eventcatalog/license");
|
|
406
|
+
|
|
407
|
+
// eventcatalog/src/utils/trial.ts
|
|
408
|
+
var TRIAL_LENGTH_DAYS = 90;
|
|
409
|
+
var LICENSE_FAQ_URL = "https://www.eventcatalog.dev/license-faq";
|
|
410
|
+
var LICENSE_RENEW_URL = "https://eventcatalog.cloud";
|
|
411
|
+
var DAY_IN_MS = 24 * 60 * 60 * 1e3;
|
|
412
|
+
var getTrialStatus = (tsd, now = Date.now()) => {
|
|
413
|
+
if (typeof tsd !== "number" || !Number.isFinite(tsd) || tsd <= 0) return;
|
|
414
|
+
const endsAt = tsd + TRIAL_LENGTH_DAYS * DAY_IN_MS;
|
|
415
|
+
const daysLeft = Math.max(0, Math.ceil((endsAt - now) / DAY_IN_MS));
|
|
416
|
+
return { daysLeft, ended: daysLeft === 0, endsAt: new Date(endsAt) };
|
|
417
|
+
};
|
|
418
|
+
var LICENSE_REMINDER_DAYS = 30;
|
|
419
|
+
|
|
420
|
+
// eventcatalog/src/utils/license.ts
|
|
421
|
+
var import_node_fs2 = __toESM(require("fs"), 1);
|
|
422
|
+
var import_node_path5 = __toESM(require("path"), 1);
|
|
423
|
+
var import_license = require("@eventcatalog/license");
|
|
424
|
+
var toDate = (seconds) => typeof seconds === "number" ? new Date(seconds * 1e3) : void 0;
|
|
425
|
+
var getDetails = (claims) => ({
|
|
426
|
+
org: typeof claims.org === "string" ? claims.org : void 0,
|
|
427
|
+
licenseId: typeof claims.licenseId === "string" ? claims.licenseId : void 0,
|
|
428
|
+
issuedAt: toDate(claims.iat)
|
|
429
|
+
});
|
|
430
|
+
var INVALID_REASONS = {
|
|
431
|
+
LICENSE_FILE_EMPTY: "the file is empty",
|
|
432
|
+
LICENSE_NOT_YET_VALID: "it is not valid yet",
|
|
433
|
+
LICENSE_SIGNATURE_INVALID: "its signature is invalid",
|
|
434
|
+
LICENSE_VALIDATION_FAILED: "it was not issued by EventCatalog"
|
|
435
|
+
};
|
|
436
|
+
var getLicenseFilePath = (projectDirectory) => process.env.EC_LICENSE || import_node_path5.default.join(projectDirectory, "license.jwt");
|
|
437
|
+
var readClaims = (licenseFilePath) => {
|
|
438
|
+
try {
|
|
439
|
+
const payload = import_node_fs2.default.readFileSync(licenseFilePath, "utf8").trim().split(".")[1];
|
|
440
|
+
return JSON.parse(Buffer.from(payload, "base64url").toString("utf8"));
|
|
441
|
+
} catch {
|
|
442
|
+
return {};
|
|
443
|
+
}
|
|
444
|
+
};
|
|
445
|
+
var statusCache = /* @__PURE__ */ new Map();
|
|
446
|
+
var getLicensePlan = () => {
|
|
447
|
+
if (process.env.EVENTCATALOG_SCALE === "true") return "scale";
|
|
448
|
+
if (process.env.EVENTCATALOG_STARTER === "true") return "starter";
|
|
449
|
+
};
|
|
450
|
+
var getCommercialLicenseStatus = (projectDirectory = process.env.PROJECT_DIR || process.cwd()) => {
|
|
451
|
+
const licensePath = getLicenseFilePath(projectDirectory);
|
|
452
|
+
const modifiedAt = import_node_fs2.default.statSync(licensePath, { throwIfNoEntry: false })?.mtimeMs;
|
|
453
|
+
if (modifiedAt === void 0) return Promise.resolve({ state: "none" });
|
|
454
|
+
const key = `${licensePath}:${modifiedAt}`;
|
|
455
|
+
if (!statusCache.has(key)) statusCache.set(key, verifyLicense(licensePath));
|
|
456
|
+
return statusCache.get(key);
|
|
457
|
+
};
|
|
458
|
+
var getLicenseStatus = async (projectDirectory) => {
|
|
459
|
+
const license = await getCommercialLicenseStatus(projectDirectory);
|
|
460
|
+
if (license.state === "licensed") return license;
|
|
461
|
+
const plan = getLicensePlan();
|
|
462
|
+
return plan ? { state: "plan", plan } : license;
|
|
463
|
+
};
|
|
464
|
+
var verifyLicense = async (licensePath) => {
|
|
465
|
+
const consoleError = console.error;
|
|
466
|
+
console.error = () => {
|
|
467
|
+
};
|
|
468
|
+
try {
|
|
469
|
+
(0, import_license.clearCache)();
|
|
470
|
+
if (await (0, import_license.hasCommercialLicense)()) {
|
|
471
|
+
const entitlements2 = await (0, import_license.verifyOfflineLicense)({ licensePath });
|
|
472
|
+
return { state: "licensed", ...getDetails(entitlements2), expiresAt: new Date(entitlements2.exp * 1e3) };
|
|
473
|
+
}
|
|
474
|
+
(0, import_license.clearCache)();
|
|
475
|
+
const entitlements = await (0, import_license.verifyOfflineLicense)({ licensePath });
|
|
476
|
+
if (typeof entitlements.exp !== "number") return { state: "invalid", reason: "it has no expiry date" };
|
|
477
|
+
return { state: "expired", ...getDetails(entitlements), expiresAt: new Date(entitlements.exp * 1e3) };
|
|
478
|
+
} catch (error) {
|
|
479
|
+
if (error?.code === "LICENSE_EXPIRED") {
|
|
480
|
+
const claims = readClaims(licensePath);
|
|
481
|
+
return { state: "expired", ...getDetails(claims), expiresAt: toDate(claims.exp) };
|
|
482
|
+
}
|
|
483
|
+
return { state: "invalid", reason: INVALID_REASONS[error?.code] || error?.message || String(error) };
|
|
484
|
+
} finally {
|
|
485
|
+
console.error = consoleError;
|
|
486
|
+
}
|
|
487
|
+
};
|
|
488
|
+
|
|
489
|
+
// src/utils/license-status.ts
|
|
490
|
+
var isPlanEnabled = async (check) => {
|
|
491
|
+
const consoleError = console.error;
|
|
492
|
+
console.error = () => {
|
|
493
|
+
};
|
|
494
|
+
try {
|
|
495
|
+
return await check();
|
|
496
|
+
} catch {
|
|
497
|
+
return false;
|
|
498
|
+
} finally {
|
|
499
|
+
console.error = consoleError;
|
|
500
|
+
}
|
|
501
|
+
};
|
|
502
|
+
var checkPlanLicense = async () => {
|
|
503
|
+
if (await isPlanEnabled(import_license2.isEventCatalogScaleEnabled)) return "scale";
|
|
504
|
+
if (await isPlanEnabled(import_license2.isEventCatalogStarterEnabled)) return "starter";
|
|
505
|
+
};
|
|
506
|
+
var getLicenseStatus2 = async (projectDirectory) => {
|
|
507
|
+
const license = await getCommercialLicenseStatus(projectDirectory);
|
|
508
|
+
const plan = license.state === "licensed" ? void 0 : await checkPlanLicense();
|
|
509
|
+
process.env.EVENTCATALOG_SCALE = String(plan === "scale");
|
|
510
|
+
process.env.EVENTCATALOG_STARTER = String(plan === "starter");
|
|
511
|
+
return getLicenseStatus(projectDirectory);
|
|
512
|
+
};
|
|
513
|
+
var DAY_IN_MS2 = 24 * 60 * 60 * 1e3;
|
|
514
|
+
var getLicenseType = (license) => {
|
|
515
|
+
if (license.state === "licensed") return "commercial";
|
|
516
|
+
if (license.state === "plan") return license.plan;
|
|
517
|
+
return "trial";
|
|
518
|
+
};
|
|
519
|
+
var getLicenseAnalytics = (license = { state: "none" }, tsd) => ({
|
|
520
|
+
license: getLicenseType(license),
|
|
521
|
+
licenseState: license.state === "licensed" || license.state === "plan" ? "valid" : license.state,
|
|
522
|
+
licenseExpiry: "expiresAt" in license ? license.expiresAt?.getTime() : void 0,
|
|
523
|
+
trialExpiry: getTrialStatus(tsd)?.endsAt.getTime()
|
|
524
|
+
});
|
|
525
|
+
var formatDate = (date) => date.toLocaleDateString(void 0, { dateStyle: "medium" });
|
|
526
|
+
var formatDays = (days) => `${days} ${days === 1 ? "day" : "days"}`;
|
|
527
|
+
var getTrialLine = (tsd, now) => {
|
|
528
|
+
const trial = getTrialStatus(tsd, now);
|
|
529
|
+
if (!trial) return;
|
|
530
|
+
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)}).`;
|
|
531
|
+
};
|
|
532
|
+
var getLicenseStatusMessage = (license, tsd, now = Date.now()) => {
|
|
533
|
+
if (license.state === "licensed") {
|
|
534
|
+
const daysLeft = Math.max(0, Math.ceil((license.expiresAt.getTime() - now) / DAY_IN_MS2));
|
|
535
|
+
const licensedTo = license.org ? `Licensed to ${license.org}` : "Licensed";
|
|
536
|
+
if (daysLeft < LICENSE_REMINDER_DAYS) {
|
|
537
|
+
return {
|
|
538
|
+
title: "EventCatalog Commercial License",
|
|
539
|
+
color: "yellow",
|
|
540
|
+
text: [
|
|
541
|
+
licensedTo,
|
|
542
|
+
`Your license expires in ${formatDays(daysLeft)}, on ${formatDate(license.expiresAt)}.`,
|
|
543
|
+
`Renew it to keep using EventCatalog commercially: ${LICENSE_RENEW_URL}`
|
|
544
|
+
].join("\n")
|
|
545
|
+
};
|
|
546
|
+
}
|
|
547
|
+
return {
|
|
548
|
+
title: "EventCatalog Commercial License",
|
|
549
|
+
color: "green",
|
|
550
|
+
text: `${licensedTo}
|
|
551
|
+
Valid until ${formatDate(license.expiresAt)} (${formatDays(daysLeft)} left)`
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
if (license.state === "plan") return;
|
|
555
|
+
const trialLine = getTrialLine(tsd, now);
|
|
556
|
+
if (license.state === "none") {
|
|
557
|
+
if (!trialLine) return;
|
|
558
|
+
const ended = getTrialStatus(tsd, now)?.ended;
|
|
559
|
+
return {
|
|
560
|
+
title: "EventCatalog trial",
|
|
561
|
+
color: ended ? "yellow" : "green",
|
|
562
|
+
text: `${trialLine}
|
|
563
|
+
Learn about licensing: ${LICENSE_FAQ_URL}`
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
if (license.state === "expired") {
|
|
567
|
+
const expiredOn = license.expiresAt ? `expired on ${formatDate(license.expiresAt)} (${formatDays(Math.floor((now - license.expiresAt.getTime()) / DAY_IN_MS2))} ago)` : "has expired";
|
|
568
|
+
return {
|
|
569
|
+
title: "EventCatalog License Expired",
|
|
570
|
+
color: "yellow",
|
|
571
|
+
text: [
|
|
572
|
+
`Your EventCatalog commercial license${license.org ? ` for ${license.org}` : ""} ${expiredOn}.`,
|
|
573
|
+
`Renew it to keep using EventCatalog commercially: ${LICENSE_RENEW_URL}`,
|
|
574
|
+
trialLine,
|
|
575
|
+
`Learn about licensing: ${LICENSE_FAQ_URL}`
|
|
576
|
+
].filter(Boolean).join("\n")
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
return {
|
|
580
|
+
title: "EventCatalog license",
|
|
581
|
+
color: "yellow",
|
|
582
|
+
text: [`Your license.jwt could not be verified: ${license.reason}.`, trialLine, `Learn about licensing: ${LICENSE_FAQ_URL}`].filter(Boolean).join("\n")
|
|
583
|
+
};
|
|
584
|
+
};
|
|
585
|
+
var printLicenseStatus = (license, tsd) => {
|
|
586
|
+
const message = getLicenseStatusMessage(license, tsd);
|
|
587
|
+
if (!message) return;
|
|
588
|
+
console.log(
|
|
589
|
+
(0, import_boxen.default)(message.text, {
|
|
590
|
+
padding: 1,
|
|
591
|
+
margin: 1,
|
|
592
|
+
borderStyle: "round",
|
|
593
|
+
borderColor: message.color,
|
|
594
|
+
title: message.title,
|
|
595
|
+
titleAlignment: "center"
|
|
596
|
+
})
|
|
597
|
+
);
|
|
598
|
+
};
|
|
599
|
+
|
|
403
600
|
// src/analytics/log-build.js
|
|
601
|
+
var isMCPEnabled = (configFile) => configFile.output === "server" && (configFile.mcp?.enabled ?? true);
|
|
404
602
|
var getFeatures = async (configFile) => {
|
|
603
|
+
const mcp = isMCPEnabled(configFile);
|
|
405
604
|
return {
|
|
406
605
|
llmsTxt: configFile.llmsTxt?.enabled || false,
|
|
407
606
|
rss: configFile.rss?.enabled || false,
|
|
@@ -409,7 +608,9 @@ var getFeatures = async (configFile) => {
|
|
|
409
608
|
changelog: configFile.changelog?.enabled || false,
|
|
410
609
|
auth: configFile.auth?.enabled || false,
|
|
411
610
|
environments: Array.isArray(configFile.environments) && configFile.environments.length > 0,
|
|
412
|
-
output: configFile.output || "static"
|
|
611
|
+
output: configFile.output || "static",
|
|
612
|
+
mcp,
|
|
613
|
+
mcpAuth: mcp && (configFile.mcp?.auth?.enabled ?? false)
|
|
413
614
|
};
|
|
414
615
|
};
|
|
415
616
|
var getDirectoryProvider = (source) => {
|
|
@@ -469,21 +670,12 @@ var reportCloudResourceInventory = async (configFile, resourceCounts) => {
|
|
|
469
670
|
})
|
|
470
671
|
});
|
|
471
672
|
};
|
|
472
|
-
var main = async (projectDir, {
|
|
673
|
+
var main = async (projectDir, { command = "build", license } = {}) => {
|
|
473
674
|
try {
|
|
474
675
|
await verifyRequiredFieldsAreInCatalogConfigFile(projectDir);
|
|
475
676
|
const configFile = await getEventCatalogConfigFile(projectDir);
|
|
476
677
|
const { cId, tsd, organizationName, generators = [] } = configFile;
|
|
477
|
-
|
|
478
|
-
if (isEventCatalogStarterEnabled2) {
|
|
479
|
-
generatorNames.push("@eventcatalog/eventcatalog-starter");
|
|
480
|
-
}
|
|
481
|
-
if (isEventCatalogScaleEnabled2) {
|
|
482
|
-
generatorNames.push("@eventcatalog/eventcatalog-scale");
|
|
483
|
-
}
|
|
484
|
-
if (isBackstagePluginEnabled) {
|
|
485
|
-
generatorNames.push("@eventcatalog/backstage-plugin-eventcatalog");
|
|
486
|
-
}
|
|
678
|
+
const generatorNames = generators.length > 0 ? generators.map((generator) => generator[0]) : ["none"];
|
|
487
679
|
const features = await getFeatures(configFile);
|
|
488
680
|
const resourceCounts = await countResources(projectDir);
|
|
489
681
|
const contentHash = await hashCatalogContent(projectDir);
|
|
@@ -494,11 +686,10 @@ var main = async (projectDir, { isEventCatalogStarterEnabled: isEventCatalogStar
|
|
|
494
686
|
cId,
|
|
495
687
|
// Trial start date (unix ms) from eventcatalog.config.js
|
|
496
688
|
tsd,
|
|
689
|
+
// Commercial license or trial, and when each expires (unix ms)
|
|
690
|
+
...getLicenseAnalytics(license, tsd),
|
|
497
691
|
// CI redeploys and human-run builds are different signals; tag rather than suppress
|
|
498
692
|
ci: process.env.CI ? "true" : "false",
|
|
499
|
-
// The commercial plan, separate from the generators list, so telemetry joins cleanly to licensing
|
|
500
|
-
plan: isEventCatalogScaleEnabled2 ? "scale" : isEventCatalogStarterEnabled2 ? "starter" : "none",
|
|
501
|
-
backstage: isBackstagePluginEnabled ? "true" : "false",
|
|
502
693
|
contentHash,
|
|
503
694
|
generators: generatorNames.toString(),
|
|
504
695
|
features: Object.keys(features).map((feature) => `${feature}:${features[feature]}`).join(","),
|
|
@@ -522,8 +713,8 @@ async function watch(projectDirectory, catalogDirectory, callback = () => {
|
|
|
522
713
|
}
|
|
523
714
|
|
|
524
715
|
// src/resolve-catalog-dependencies.js
|
|
525
|
-
var
|
|
526
|
-
var
|
|
716
|
+
var import_node_path6 = __toESM(require("path"), 1);
|
|
717
|
+
var import_node_fs3 = __toESM(require("fs"), 1);
|
|
527
718
|
var import_gray_matter2 = __toESM(require("gray-matter"), 1);
|
|
528
719
|
var resolve_catalog_dependencies_default = async (catalogDir, core2) => {
|
|
529
720
|
const catalogConfig = await getEventCatalogConfigFile(catalogDir);
|
|
@@ -531,11 +722,11 @@ var resolve_catalog_dependencies_default = async (catalogDir, core2) => {
|
|
|
531
722
|
if (!dependencies) {
|
|
532
723
|
return;
|
|
533
724
|
}
|
|
534
|
-
const dependenciesDir =
|
|
535
|
-
if (
|
|
536
|
-
|
|
725
|
+
const dependenciesDir = import_node_path6.default.join(catalogDir, "dependencies");
|
|
726
|
+
if (import_node_fs3.default.existsSync(dependenciesDir)) {
|
|
727
|
+
import_node_fs3.default.rmSync(dependenciesDir, { recursive: true, force: true });
|
|
537
728
|
}
|
|
538
|
-
|
|
729
|
+
import_node_fs3.default.mkdirSync(dependenciesDir, { recursive: true });
|
|
539
730
|
const resourceTypes = Object.keys(dependencies);
|
|
540
731
|
for (const resourceType of resourceTypes) {
|
|
541
732
|
for (const dependency of dependencies[resourceType]) {
|
|
@@ -555,20 +746,20 @@ var resolve_catalog_dependencies_default = async (catalogDir, core2) => {
|
|
|
555
746
|
},
|
|
556
747
|
frontmatter
|
|
557
748
|
);
|
|
558
|
-
const resourceFile =
|
|
559
|
-
|
|
560
|
-
|
|
749
|
+
const resourceFile = import_node_path6.default.join(dependenciesDir, resourceType, dependency.id, `index.md`);
|
|
750
|
+
import_node_fs3.default.mkdirSync(import_node_path6.default.dirname(resourceFile), { recursive: true });
|
|
751
|
+
import_node_fs3.default.writeFileSync(resourceFile, markdown);
|
|
561
752
|
}
|
|
562
753
|
}
|
|
563
754
|
return;
|
|
564
755
|
};
|
|
565
756
|
|
|
566
757
|
// src/eventcatalog.ts
|
|
567
|
-
var
|
|
758
|
+
var import_boxen2 = __toESM(require("boxen"), 1);
|
|
568
759
|
|
|
569
760
|
// src/features.ts
|
|
570
|
-
var
|
|
571
|
-
var
|
|
761
|
+
var import_node_path7 = require("path");
|
|
762
|
+
var import_node_fs4 = __toESM(require("fs"), 1);
|
|
572
763
|
var getProjectOutDir = async () => {
|
|
573
764
|
const config = await getEventCatalogConfigFile(process.env.PROJECT_DIR || "");
|
|
574
765
|
return config?.outDir || "dist";
|
|
@@ -583,7 +774,7 @@ var isIndexedSearchEnabled = async () => {
|
|
|
583
774
|
};
|
|
584
775
|
var isAuthEnabled = async () => {
|
|
585
776
|
const directory = process.env.PROJECT_DIR || process.cwd();
|
|
586
|
-
const hasAuthConfig =
|
|
777
|
+
const hasAuthConfig = import_node_fs4.default.existsSync((0, import_node_path7.join)(directory, "eventcatalog.auth.js"));
|
|
587
778
|
return hasAuthConfig;
|
|
588
779
|
};
|
|
589
780
|
|
|
@@ -592,11 +783,11 @@ var import_update_notifier = __toESM(require("update-notifier"), 1);
|
|
|
592
783
|
var import_dotenv = __toESM(require("dotenv"), 1);
|
|
593
784
|
|
|
594
785
|
// src/migrations/message-channels-to-service-channels.ts
|
|
595
|
-
var
|
|
786
|
+
var import_node_fs5 = __toESM(require("fs"), 1);
|
|
596
787
|
var import_glob2 = require("glob");
|
|
597
788
|
var import_node_os2 = __toESM(require("os"), 1);
|
|
598
789
|
var import_gray_matter3 = __toESM(require("gray-matter"), 1);
|
|
599
|
-
var
|
|
790
|
+
var import_node_path8 = __toESM(require("path"), 1);
|
|
600
791
|
var DISABLE_CHANNEL_MIGRATION_ENV = "EVENTCATALOG_DISABLE_CHANNEL_MIGRATION";
|
|
601
792
|
var isChannelMigrationDisabled = () => {
|
|
602
793
|
return ["true", "1", "yes"].includes((process.env[DISABLE_CHANNEL_MIGRATION_ENV] ?? "").toLowerCase());
|
|
@@ -605,7 +796,7 @@ var message_channels_to_service_channels_default = async (dir2) => {
|
|
|
605
796
|
if (isChannelMigrationDisabled()) {
|
|
606
797
|
return { status: "skipped", message: `Channel migration disabled by ${DISABLE_CHANNEL_MIGRATION_ENV}` };
|
|
607
798
|
}
|
|
608
|
-
const PROJECT_DIR =
|
|
799
|
+
const PROJECT_DIR = import_node_path8.default.join(dir2 || process.env.PROJECT_DIR);
|
|
609
800
|
const messages = await (0, import_glob2.glob)(
|
|
610
801
|
[
|
|
611
802
|
"**/events/*/index.mdx",
|
|
@@ -645,7 +836,7 @@ var message_channels_to_service_channels_default = async (dir2) => {
|
|
|
645
836
|
}
|
|
646
837
|
);
|
|
647
838
|
const messagesWithChannels = messages.reduce((acc, message) => {
|
|
648
|
-
const file =
|
|
839
|
+
const file = import_node_fs5.default.readFileSync(message, "utf8");
|
|
649
840
|
const { data } = (0, import_gray_matter3.default)(file);
|
|
650
841
|
if (data.channels?.length > 0) {
|
|
651
842
|
acc.push({
|
|
@@ -659,7 +850,7 @@ var message_channels_to_service_channels_default = async (dir2) => {
|
|
|
659
850
|
return { status: "success", message: "No messages with channels found in the catalog" };
|
|
660
851
|
}
|
|
661
852
|
const servicesWithChannels = services.reduce((acc, service) => {
|
|
662
|
-
const file =
|
|
853
|
+
const file = import_node_fs5.default.readFileSync(service, "utf8");
|
|
663
854
|
const { data } = (0, import_gray_matter3.default)(file);
|
|
664
855
|
const isSending = data.sends?.some((send) => messagesWithChannels.some((message) => message.id === send.id));
|
|
665
856
|
const isReceiving = data.receives?.some(
|
|
@@ -674,7 +865,7 @@ var message_channels_to_service_channels_default = async (dir2) => {
|
|
|
674
865
|
return acc;
|
|
675
866
|
}, []);
|
|
676
867
|
for (const service of servicesWithChannels) {
|
|
677
|
-
const file =
|
|
868
|
+
const file = import_node_fs5.default.readFileSync(service.path, "utf8");
|
|
678
869
|
const { data } = (0, import_gray_matter3.default)(file);
|
|
679
870
|
const messagesTheServiceSendsThatNeedUpdating = data.sends?.filter((send) => messagesWithChannels.some((message) => message.id === send.id)) ?? [];
|
|
680
871
|
const messagesTheServiceReceivesThatNeedUpdating = data.receives?.filter((receive) => messagesWithChannels.some((message) => message.id === receive.id)) ?? [];
|
|
@@ -694,14 +885,14 @@ var message_channels_to_service_channels_default = async (dir2) => {
|
|
|
694
885
|
...newSends.length > 0 ? { sends: newSends } : {},
|
|
695
886
|
...newReceives.length > 0 ? { receives: newReceives } : {}
|
|
696
887
|
};
|
|
697
|
-
|
|
888
|
+
import_node_fs5.default.writeFileSync(service.path, import_gray_matter3.default.stringify(file, newData));
|
|
698
889
|
}
|
|
699
890
|
}
|
|
700
891
|
for (const message of messagesWithChannels) {
|
|
701
|
-
const file =
|
|
892
|
+
const file = import_node_fs5.default.readFileSync(message.path, "utf8");
|
|
702
893
|
const parsed = (0, import_gray_matter3.default)(file);
|
|
703
894
|
const { channels, ...newData } = parsed.data;
|
|
704
|
-
|
|
895
|
+
import_node_fs5.default.writeFileSync(message.path, import_gray_matter3.default.stringify(parsed.content, newData));
|
|
705
896
|
}
|
|
706
897
|
console.log("\u2714 Channels migrated to new services API");
|
|
707
898
|
};
|
|
@@ -711,13 +902,13 @@ var runMigrations = async (dir2) => {
|
|
|
711
902
|
await message_channels_to_service_channels_default(dir2);
|
|
712
903
|
};
|
|
713
904
|
|
|
714
|
-
// eventcatalog/src/
|
|
715
|
-
var
|
|
716
|
-
var
|
|
905
|
+
// eventcatalog/src/features/fields/field-indexer.ts
|
|
906
|
+
var import_node_path10 = __toESM(require("path"), 1);
|
|
907
|
+
var import_node_fs7 = __toESM(require("fs"), 1);
|
|
717
908
|
|
|
718
|
-
// eventcatalog/src/
|
|
909
|
+
// eventcatalog/src/features/fields/fields-db.ts
|
|
719
910
|
var import_sql = __toESM(require("sql.js"), 1);
|
|
720
|
-
var
|
|
911
|
+
var import_node_fs6 = __toESM(require("fs"), 1);
|
|
721
912
|
var SCHEMA_SQL = `
|
|
722
913
|
CREATE TABLE IF NOT EXISTS fields (
|
|
723
914
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
@@ -786,13 +977,13 @@ var FieldsDatabase = class _FieldsDatabase {
|
|
|
786
977
|
this.dbPath = dbPath;
|
|
787
978
|
}
|
|
788
979
|
static async create(dbPath, options) {
|
|
789
|
-
if (options?.recreate &&
|
|
790
|
-
|
|
980
|
+
if (options?.recreate && import_node_fs6.default.existsSync(dbPath)) {
|
|
981
|
+
import_node_fs6.default.unlinkSync(dbPath);
|
|
791
982
|
}
|
|
792
983
|
const SQL = await (0, import_sql.default)();
|
|
793
984
|
let db;
|
|
794
|
-
if (!options?.recreate &&
|
|
795
|
-
const buffer =
|
|
985
|
+
if (!options?.recreate && import_node_fs6.default.existsSync(dbPath)) {
|
|
986
|
+
const buffer = import_node_fs6.default.readFileSync(dbPath);
|
|
796
987
|
db = new SQL.Database(buffer);
|
|
797
988
|
} else {
|
|
798
989
|
db = new SQL.Database();
|
|
@@ -853,7 +1044,7 @@ var FieldsDatabase = class _FieldsDatabase {
|
|
|
853
1044
|
save() {
|
|
854
1045
|
const data = this.db.export();
|
|
855
1046
|
const buffer = Buffer.from(data);
|
|
856
|
-
|
|
1047
|
+
import_node_fs6.default.writeFileSync(this.dbPath, buffer);
|
|
857
1048
|
}
|
|
858
1049
|
queryFields(params) {
|
|
859
1050
|
const {
|
|
@@ -1022,7 +1213,7 @@ function decodeCursor(cursor) {
|
|
|
1022
1213
|
return parseInt(Buffer.from(cursor, "base64url").toString(), 10);
|
|
1023
1214
|
}
|
|
1024
1215
|
|
|
1025
|
-
// eventcatalog/src/
|
|
1216
|
+
// eventcatalog/src/features/fields/field-extractor.ts
|
|
1026
1217
|
function extractSchemaFieldsDeep(content, format) {
|
|
1027
1218
|
if (!content) return [];
|
|
1028
1219
|
if (format === "json-schema") {
|
|
@@ -1078,22 +1269,22 @@ function getAvroTypeName(type) {
|
|
|
1078
1269
|
function walkAvroRecord(schema, prefix, fields) {
|
|
1079
1270
|
if (!schema.fields || !Array.isArray(schema.fields)) return;
|
|
1080
1271
|
for (const field of schema.fields) {
|
|
1081
|
-
const
|
|
1272
|
+
const path20 = prefix ? `${prefix}.${field.name}` : field.name;
|
|
1082
1273
|
const isOptional = Array.isArray(field.type) && field.type.includes("null");
|
|
1083
1274
|
const typeName = getAvroTypeName(field.type);
|
|
1084
1275
|
fields.push({
|
|
1085
|
-
path:
|
|
1276
|
+
path: path20,
|
|
1086
1277
|
type: typeName,
|
|
1087
1278
|
description: field.doc || "",
|
|
1088
1279
|
required: !isOptional
|
|
1089
1280
|
});
|
|
1090
1281
|
const innerType = Array.isArray(field.type) ? field.type.find((t) => typeof t === "object" && t.type === "record") : typeof field.type === "object" && field.type.type === "record" ? field.type : null;
|
|
1091
1282
|
if (innerType) {
|
|
1092
|
-
walkAvroRecord(innerType,
|
|
1283
|
+
walkAvroRecord(innerType, path20, fields);
|
|
1093
1284
|
}
|
|
1094
1285
|
const arrayType = Array.isArray(field.type) ? field.type.find((t) => typeof t === "object" && t.type === "array") : typeof field.type === "object" && field.type.type === "array" ? field.type : null;
|
|
1095
1286
|
if (arrayType && typeof arrayType.items === "object" && arrayType.items.type === "record") {
|
|
1096
|
-
walkAvroRecord(arrayType.items, `${
|
|
1287
|
+
walkAvroRecord(arrayType.items, `${path20}[]`, fields);
|
|
1097
1288
|
}
|
|
1098
1289
|
}
|
|
1099
1290
|
}
|
|
@@ -1124,32 +1315,32 @@ function walkJsonSchema(node, prefix, requiredList, rootSchema, fields) {
|
|
|
1124
1315
|
}
|
|
1125
1316
|
if (!node.properties) return;
|
|
1126
1317
|
for (const [name, prop] of Object.entries(node.properties)) {
|
|
1127
|
-
const
|
|
1318
|
+
const path20 = prefix ? `${prefix}.${name}` : name;
|
|
1128
1319
|
const isRequired = requiredList.includes(name);
|
|
1129
1320
|
if (prop.$ref) {
|
|
1130
1321
|
const resolved = resolveLocalRef(prop.$ref, rootSchema);
|
|
1131
1322
|
if (resolved) {
|
|
1132
1323
|
const rawRefType = resolved.type || "object";
|
|
1133
1324
|
const type2 = Array.isArray(rawRefType) ? [...rawRefType].sort().join(" | ") : rawRefType;
|
|
1134
|
-
fields.push({ path:
|
|
1325
|
+
fields.push({ path: path20, type: type2, description: resolved.description || "", required: isRequired });
|
|
1135
1326
|
if (resolved.properties) {
|
|
1136
|
-
walkJsonSchema(resolved,
|
|
1327
|
+
walkJsonSchema(resolved, path20, resolved.required || [], rootSchema, fields);
|
|
1137
1328
|
}
|
|
1138
1329
|
} else {
|
|
1139
|
-
fields.push({ path:
|
|
1330
|
+
fields.push({ path: path20, type: "$ref", description: "", required: isRequired });
|
|
1140
1331
|
}
|
|
1141
1332
|
continue;
|
|
1142
1333
|
}
|
|
1143
1334
|
const rawType = prop.type || (prop.enum ? "enum" : prop.$ref ? "$ref" : "object");
|
|
1144
1335
|
const typeList = Array.isArray(rawType) ? rawType : [rawType];
|
|
1145
1336
|
const type = Array.isArray(rawType) ? [...rawType].sort().join(" | ") : rawType;
|
|
1146
|
-
fields.push({ path:
|
|
1337
|
+
fields.push({ path: path20, type, description: prop.description || "", required: isRequired });
|
|
1147
1338
|
if (typeList.includes("object") && prop.properties) {
|
|
1148
|
-
walkJsonSchema(prop,
|
|
1339
|
+
walkJsonSchema(prop, path20, prop.required || [], rootSchema, fields);
|
|
1149
1340
|
}
|
|
1150
1341
|
if (typeList.includes("array") && prop.items) {
|
|
1151
1342
|
if (prop.items.type === "object" && prop.items.properties) {
|
|
1152
|
-
walkJsonSchema(prop.items, `${
|
|
1343
|
+
walkJsonSchema(prop.items, `${path20}[]`, prop.items.required || [], rootSchema, fields);
|
|
1153
1344
|
}
|
|
1154
1345
|
}
|
|
1155
1346
|
}
|
|
@@ -1166,22 +1357,22 @@ function resolveLocalRef(ref, rootSchema) {
|
|
|
1166
1357
|
}
|
|
1167
1358
|
|
|
1168
1359
|
// eventcatalog/integrations/runtime-paths.mjs
|
|
1169
|
-
var
|
|
1360
|
+
var import_node_path9 = __toESM(require("path"), 1);
|
|
1170
1361
|
function getRuntimePaths(projectDirectory, runtimeDirectory) {
|
|
1171
|
-
const project =
|
|
1172
|
-
const cacheDirectory =
|
|
1173
|
-
const runtime = runtimeDirectory ?
|
|
1362
|
+
const project = import_node_path9.default.resolve(projectDirectory);
|
|
1363
|
+
const cacheDirectory = import_node_path9.default.join(project, ".astro");
|
|
1364
|
+
const runtime = runtimeDirectory ? import_node_path9.default.resolve(runtimeDirectory) : import_node_path9.default.join(cacheDirectory, "eventcatalog");
|
|
1174
1365
|
return {
|
|
1175
1366
|
projectDirectory: project,
|
|
1176
1367
|
cacheDirectory,
|
|
1177
1368
|
runtimeDirectory: runtime,
|
|
1178
|
-
fieldsDatabasePath:
|
|
1369
|
+
fieldsDatabasePath: import_node_path9.default.join(runtime, ".eventcatalog", "fields.db")
|
|
1179
1370
|
};
|
|
1180
1371
|
}
|
|
1181
1372
|
|
|
1182
|
-
// eventcatalog/src/
|
|
1373
|
+
// eventcatalog/src/features/fields/field-indexer.ts
|
|
1183
1374
|
function detectFormat(fileName) {
|
|
1184
|
-
const ext =
|
|
1375
|
+
const ext = import_node_path10.default.extname(fileName).toLowerCase();
|
|
1185
1376
|
if (ext === ".proto") return "proto";
|
|
1186
1377
|
if (ext === ".avro" || ext === ".avsc") return "avro";
|
|
1187
1378
|
return "json-schema";
|
|
@@ -1190,9 +1381,9 @@ async function buildFieldsIndex(catalogDir, outputDir) {
|
|
|
1190
1381
|
const sdkModule = await import("@eventcatalog/sdk");
|
|
1191
1382
|
const sdk = sdkModule.default(catalogDir);
|
|
1192
1383
|
const { fieldsDatabasePath: dbPath } = getRuntimePaths(catalogDir, outputDir || catalogDir);
|
|
1193
|
-
const dbDir =
|
|
1194
|
-
if (!
|
|
1195
|
-
|
|
1384
|
+
const dbDir = import_node_path10.default.dirname(dbPath);
|
|
1385
|
+
if (!import_node_fs7.default.existsSync(dbDir)) {
|
|
1386
|
+
import_node_fs7.default.mkdirSync(dbDir, { recursive: true });
|
|
1196
1387
|
}
|
|
1197
1388
|
const db = await FieldsDatabase.create(dbPath, { recreate: true });
|
|
1198
1389
|
const warnings = [];
|
|
@@ -1276,7 +1467,7 @@ async function buildFieldsIndex(catalogDir, outputDir) {
|
|
|
1276
1467
|
|
|
1277
1468
|
// src/search-indexer.ts
|
|
1278
1469
|
var import_promises4 = __toESM(require("fs/promises"), 1);
|
|
1279
|
-
var
|
|
1470
|
+
var import_node_path11 = __toESM(require("path"), 1);
|
|
1280
1471
|
var import_glob3 = require("glob");
|
|
1281
1472
|
var import_gray_matter4 = __toESM(require("gray-matter"), 1);
|
|
1282
1473
|
var RESOURCE_COLLECTIONS = {
|
|
@@ -1340,9 +1531,9 @@ var markdownToSearchText = (content) => {
|
|
|
1340
1531
|
};
|
|
1341
1532
|
var inferDocIdFromFile = (relativePath, frontmatterId) => {
|
|
1342
1533
|
if (frontmatterId) return frontmatterId;
|
|
1343
|
-
const fileName =
|
|
1534
|
+
const fileName = import_node_path11.default.posix.basename(removeExtension(relativePath));
|
|
1344
1535
|
if (fileName.toLowerCase() === "index") {
|
|
1345
|
-
return
|
|
1536
|
+
return import_node_path11.default.posix.basename(import_node_path11.default.posix.dirname(relativePath));
|
|
1346
1537
|
}
|
|
1347
1538
|
return stripNumericPrefix(fileName);
|
|
1348
1539
|
};
|
|
@@ -1360,7 +1551,7 @@ var findResourceSegment = (segments) => {
|
|
|
1360
1551
|
return match;
|
|
1361
1552
|
};
|
|
1362
1553
|
var readResourceFrontmatter = async (projectDir, resourcePath) => {
|
|
1363
|
-
const candidates = [
|
|
1554
|
+
const candidates = [import_node_path11.default.join(projectDir, resourcePath, "index.mdx"), import_node_path11.default.join(projectDir, resourcePath, "index.md")];
|
|
1364
1555
|
for (const candidate of candidates) {
|
|
1365
1556
|
try {
|
|
1366
1557
|
const file = await import_promises4.default.readFile(candidate, "utf8");
|
|
@@ -1385,7 +1576,7 @@ var deriveRecordFromPath = async ({
|
|
|
1385
1576
|
}
|
|
1386
1577
|
if (segments[0] === "docs") {
|
|
1387
1578
|
const customPath = normalizeUrlPath(removeExtension(segments.slice(1).join("/")));
|
|
1388
|
-
const title = data.title || data.label ||
|
|
1579
|
+
const title = data.title || data.label || import_node_path11.default.posix.basename(customPath) || "Custom docs";
|
|
1389
1580
|
return {
|
|
1390
1581
|
url: buildUrl(`/docs/custom/${customPath}`, config),
|
|
1391
1582
|
title,
|
|
@@ -1503,7 +1694,7 @@ var collectSearchRecords = async ({
|
|
|
1503
1694
|
files.map(async (file) => {
|
|
1504
1695
|
const raw = await import_promises4.default.readFile(file, "utf8");
|
|
1505
1696
|
const parsed = (0, import_gray_matter4.default)(raw);
|
|
1506
|
-
const relativePath = normalizePath(
|
|
1697
|
+
const relativePath = normalizePath(import_node_path11.default.relative(projectDir, file));
|
|
1507
1698
|
const baseRecord = await deriveRecordFromPath({
|
|
1508
1699
|
projectDir,
|
|
1509
1700
|
relativePath,
|
|
@@ -1551,7 +1742,7 @@ var getSearchOutputPath = ({
|
|
|
1551
1742
|
if (searchOutputPath) {
|
|
1552
1743
|
return searchOutputPath;
|
|
1553
1744
|
}
|
|
1554
|
-
return
|
|
1745
|
+
return import_node_path11.default.join(outDir, isServer ? "client" : "", "pagefind");
|
|
1555
1746
|
};
|
|
1556
1747
|
var buildSearchIndex = async ({ projectDir, outDir, config, isServer, searchOutputPath }) => {
|
|
1557
1748
|
const records = await collectSearchRecords({ projectDir, config });
|
|
@@ -1605,74 +1796,74 @@ ${errors.join("\n")}`);
|
|
|
1605
1796
|
};
|
|
1606
1797
|
|
|
1607
1798
|
// src/catalog-runtime.ts
|
|
1608
|
-
var
|
|
1609
|
-
var
|
|
1799
|
+
var import_node_fs8 = __toESM(require("fs"), 1);
|
|
1800
|
+
var import_node_path12 = __toESM(require("path"), 1);
|
|
1610
1801
|
var import_node_module = require("module");
|
|
1611
1802
|
var require2 = (0, import_node_module.createRequire)(importMetaUrl);
|
|
1612
1803
|
var writeIfChanged = (file, content) => {
|
|
1613
|
-
if (
|
|
1614
|
-
|
|
1615
|
-
|
|
1804
|
+
if (import_node_fs8.default.existsSync(file) && import_node_fs8.default.readFileSync(file, "utf8") === content) return;
|
|
1805
|
+
import_node_fs8.default.mkdirSync(import_node_path12.default.dirname(file), { recursive: true });
|
|
1806
|
+
import_node_fs8.default.writeFileSync(file, content);
|
|
1616
1807
|
};
|
|
1617
1808
|
var importPath = (file) => file.replace(/\\/g, "/");
|
|
1618
|
-
var hasLegacyCatalogRuntime = (projectDirectory) =>
|
|
1809
|
+
var hasLegacyCatalogRuntime = (projectDirectory) => import_node_fs8.default.existsSync(import_node_path12.default.join(projectDirectory, ".eventcatalog-core"));
|
|
1619
1810
|
var clearCatalogCache = (projectDirectory) => {
|
|
1620
1811
|
const { cacheDirectory } = getRuntimePaths(projectDirectory);
|
|
1621
|
-
|
|
1812
|
+
import_node_fs8.default.rmSync(cacheDirectory, { recursive: true, force: true });
|
|
1622
1813
|
};
|
|
1623
1814
|
var prepareCatalogRuntime = ({ projectDirectory, catalogDirectory, packageDirectory }) => {
|
|
1624
|
-
const runtime =
|
|
1625
|
-
const source =
|
|
1626
|
-
const project =
|
|
1815
|
+
const runtime = import_node_path12.default.resolve(catalogDirectory);
|
|
1816
|
+
const source = import_node_path12.default.resolve(packageDirectory);
|
|
1817
|
+
const project = import_node_path12.default.resolve(projectDirectory);
|
|
1627
1818
|
if (runtime === source || runtime === project) {
|
|
1628
1819
|
throw new Error("The catalog runtime must be separate from the project and installed application directories.");
|
|
1629
1820
|
}
|
|
1630
|
-
|
|
1821
|
+
import_node_fs8.default.mkdirSync(runtime, { recursive: true });
|
|
1631
1822
|
writeIfChanged(
|
|
1632
|
-
|
|
1633
|
-
`export { collections } from ${JSON.stringify(importPath(
|
|
1823
|
+
import_node_path12.default.join(runtime, "content.config.ts"),
|
|
1824
|
+
`export { collections } from ${JSON.stringify(importPath(import_node_path12.default.join(source, "src/content.config.ts")))};
|
|
1634
1825
|
`
|
|
1635
1826
|
);
|
|
1636
|
-
const packageTsconfig = JSON.parse(
|
|
1827
|
+
const packageTsconfig = JSON.parse(import_node_fs8.default.readFileSync(import_node_path12.default.join(source, "tsconfig.json"), "utf8"));
|
|
1637
1828
|
const paths = Object.fromEntries(
|
|
1638
1829
|
Object.entries(packageTsconfig.compilerOptions.paths).map(([alias, targets]) => [
|
|
1639
1830
|
alias,
|
|
1640
|
-
targets.map((target) => importPath(
|
|
1831
|
+
targets.map((target) => importPath(import_node_path12.default.resolve(source, target)))
|
|
1641
1832
|
])
|
|
1642
1833
|
);
|
|
1643
|
-
paths["@config"] = [importPath(
|
|
1644
|
-
paths["@catalog/styles"] = [importPath(
|
|
1834
|
+
paths["@config"] = [importPath(import_node_path12.default.join(project, "eventcatalog.config.js"))];
|
|
1835
|
+
paths["@catalog/styles"] = [importPath(import_node_path12.default.join(project, "eventcatalog.styles.css"))];
|
|
1645
1836
|
paths["@catalog/components/*"] = [
|
|
1646
|
-
importPath(
|
|
1647
|
-
importPath(
|
|
1837
|
+
importPath(import_node_path12.default.join(project, "components/*")),
|
|
1838
|
+
importPath(import_node_path12.default.join(project, "federated/components/*"))
|
|
1648
1839
|
];
|
|
1649
|
-
paths["@catalog/snippets/*"] = [importPath(
|
|
1840
|
+
paths["@catalog/snippets/*"] = [importPath(import_node_path12.default.join(project, "snippets/*"))];
|
|
1650
1841
|
for (const specifier of ["astro", "astro/zod", "astro/loaders", "astro/runtime/server/index.js"]) {
|
|
1651
1842
|
paths[specifier] = [importPath(require2.resolve(specifier).replace(/\.js$/, ".d.ts"))];
|
|
1652
1843
|
}
|
|
1653
1844
|
writeIfChanged(
|
|
1654
|
-
|
|
1845
|
+
import_node_path12.default.join(runtime, "tsconfig.json"),
|
|
1655
1846
|
JSON.stringify(
|
|
1656
1847
|
{
|
|
1657
|
-
extends: importPath(
|
|
1848
|
+
extends: importPath(import_node_path12.default.join(source, "tsconfig.json")),
|
|
1658
1849
|
compilerOptions: {
|
|
1659
1850
|
baseUrl: ".",
|
|
1660
1851
|
paths,
|
|
1661
1852
|
typeRoots: [
|
|
1662
|
-
importPath(
|
|
1663
|
-
importPath(
|
|
1664
|
-
importPath(
|
|
1665
|
-
importPath(
|
|
1853
|
+
importPath(import_node_path12.default.join(project, "node_modules/@types")),
|
|
1854
|
+
importPath(import_node_path12.default.join(source, "../node_modules/@types")),
|
|
1855
|
+
importPath(import_node_path12.default.join(source, "../node_modules")),
|
|
1856
|
+
importPath(import_node_path12.default.join(project, "node_modules"))
|
|
1666
1857
|
]
|
|
1667
1858
|
},
|
|
1668
1859
|
include: [
|
|
1669
|
-
importPath(
|
|
1860
|
+
importPath(import_node_path12.default.join(project, ".astro/types.d.ts")),
|
|
1670
1861
|
"content.config.ts",
|
|
1671
|
-
importPath(
|
|
1672
|
-
importPath(
|
|
1862
|
+
importPath(import_node_path12.default.join(project, "components/**/*")),
|
|
1863
|
+
importPath(import_node_path12.default.join(source, "src/**/*"))
|
|
1673
1864
|
],
|
|
1674
1865
|
// Keep legacy generated files out of checks on an existing checkout.
|
|
1675
|
-
exclude: (packageTsconfig.exclude ?? []).map((entry) => importPath(
|
|
1866
|
+
exclude: (packageTsconfig.exclude ?? []).map((entry) => importPath(import_node_path12.default.resolve(source, entry)))
|
|
1676
1867
|
},
|
|
1677
1868
|
null,
|
|
1678
1869
|
2
|
|
@@ -1752,8 +1943,8 @@ var createAstroDevLineFilter = () => {
|
|
|
1752
1943
|
};
|
|
1753
1944
|
|
|
1754
1945
|
// src/astro-config-path.ts
|
|
1755
|
-
var
|
|
1756
|
-
var getAstroConfigPath = (projectDirectory, configFile, paths =
|
|
1946
|
+
var import_node_path13 = __toESM(require("path"), 1);
|
|
1947
|
+
var getAstroConfigPath = (projectDirectory, configFile, paths = import_node_path13.default) => {
|
|
1757
1948
|
const relative = paths.relative(projectDirectory, configFile);
|
|
1758
1949
|
const projectRoot = paths.parse(paths.resolve(projectDirectory)).root.toLowerCase();
|
|
1759
1950
|
const configRoot = paths.parse(paths.resolve(configFile)).root.toLowerCase();
|
|
@@ -1768,18 +1959,18 @@ var getAstroConfigPath = (projectDirectory, configFile, paths = import_node_path
|
|
|
1768
1959
|
// src/federation/federate.ts
|
|
1769
1960
|
var import_node_crypto5 = require("crypto");
|
|
1770
1961
|
var import_promises10 = __toESM(require("fs/promises"), 1);
|
|
1771
|
-
var
|
|
1962
|
+
var import_node_path19 = __toESM(require("path"), 1);
|
|
1772
1963
|
var import_sdk3 = __toESM(require("@eventcatalog/sdk"), 1);
|
|
1773
1964
|
|
|
1774
1965
|
// src/federation/content-cache.ts
|
|
1775
1966
|
var import_node_crypto2 = require("crypto");
|
|
1776
1967
|
var import_promises5 = __toESM(require("fs/promises"), 1);
|
|
1777
|
-
var
|
|
1968
|
+
var import_node_path14 = __toESM(require("path"), 1);
|
|
1778
1969
|
var getContentHash = (content) => `sha256:${(0, import_node_crypto2.createHash)("sha256").update(content).digest("hex")}`;
|
|
1779
1970
|
var isContentHash = (key) => /^sha256:[a-f0-9]{64}$/i.test(key);
|
|
1780
1971
|
var createFederationContentCache = (projectDirectory, options = {}) => {
|
|
1781
|
-
const cacheDirectory =
|
|
1782
|
-
const getCachePath = (key) =>
|
|
1972
|
+
const cacheDirectory = import_node_path14.default.join(projectDirectory, ".eventcatalog-cache", "federation", "content");
|
|
1973
|
+
const getCachePath = (key) => import_node_path14.default.join(cacheDirectory, encodeURIComponent(key));
|
|
1783
1974
|
return {
|
|
1784
1975
|
async get(key) {
|
|
1785
1976
|
if (options.read === false || !isContentHash(key)) return void 0;
|
|
@@ -1964,26 +2155,22 @@ var getFederationDiagnosticCounts = (diagnostics) => diagnostics.reduce(
|
|
|
1964
2155
|
);
|
|
1965
2156
|
var getVisibleFederationDiagnostics = (diagnostics, verbose) => diagnostics.filter((diagnostic) => verbose || diagnostic.severity === "error");
|
|
1966
2157
|
|
|
1967
|
-
// src/federation/entitlement.ts
|
|
1968
|
-
var import_license = require("@eventcatalog/license");
|
|
1969
|
-
var isFederationEnabled = () => (0, import_license.isEventCatalogEnterpriseEnabled)();
|
|
1970
|
-
|
|
1971
2158
|
// src/federation/output-transaction.ts
|
|
1972
2159
|
var import_promises6 = __toESM(require("fs/promises"), 1);
|
|
1973
|
-
var
|
|
2160
|
+
var import_node_path15 = __toESM(require("path"), 1);
|
|
1974
2161
|
var getSafePublicPath = (publicDirectory, relativePath) => {
|
|
1975
|
-
const normalizedPath =
|
|
1976
|
-
const unsafe = relativePath.length === 0 || relativePath.includes("\0") || relativePath.includes("\\") ||
|
|
2162
|
+
const normalizedPath = import_node_path15.default.posix.normalize(relativePath);
|
|
2163
|
+
const unsafe = relativePath.length === 0 || relativePath.includes("\0") || relativePath.includes("\\") || import_node_path15.default.posix.isAbsolute(relativePath) || /^[a-zA-Z]:\//.test(relativePath) || normalizedPath !== relativePath || normalizedPath === ".." || normalizedPath.startsWith("../");
|
|
1977
2164
|
if (unsafe) return void 0;
|
|
1978
|
-
const destinationPath =
|
|
1979
|
-
const relativeDestinationPath =
|
|
1980
|
-
return relativeDestinationPath !== "" && relativeDestinationPath !== ".." && !relativeDestinationPath.startsWith(`..${
|
|
2165
|
+
const destinationPath = import_node_path15.default.resolve(publicDirectory, relativePath);
|
|
2166
|
+
const relativeDestinationPath = import_node_path15.default.relative(publicDirectory, destinationPath);
|
|
2167
|
+
return relativeDestinationPath !== "" && relativeDestinationPath !== ".." && !relativeDestinationPath.startsWith(`..${import_node_path15.default.sep}`) && !import_node_path15.default.isAbsolute(relativeDestinationPath) ? destinationPath : void 0;
|
|
1981
2168
|
};
|
|
1982
2169
|
var beginFederationOutputTransaction = async (projectDirectory, outDir, relativePublicPaths) => {
|
|
1983
|
-
const transactionDirectory = await import_promises6.default.mkdtemp(
|
|
1984
|
-
const previousOutDir =
|
|
1985
|
-
const publicBackupDirectory =
|
|
1986
|
-
const publicDirectory =
|
|
2170
|
+
const transactionDirectory = await import_promises6.default.mkdtemp(import_node_path15.default.join(projectDirectory, ".eventcatalog-federation-transaction-"));
|
|
2171
|
+
const previousOutDir = import_node_path15.default.join(transactionDirectory, "federated");
|
|
2172
|
+
const publicBackupDirectory = import_node_path15.default.join(transactionDirectory, "public");
|
|
2173
|
+
const publicDirectory = import_node_path15.default.resolve(projectDirectory, "public");
|
|
1987
2174
|
const publicSnapshots = [];
|
|
1988
2175
|
const missingPublicDirectories = /* @__PURE__ */ new Set();
|
|
1989
2176
|
let hadPreviousOutDir = false;
|
|
@@ -1994,8 +2181,8 @@ var beginFederationOutputTransaction = async (projectDirectory, outDir, relative
|
|
|
1994
2181
|
try {
|
|
1995
2182
|
const stat = await import_promises6.default.lstat(destinationPath);
|
|
1996
2183
|
if (!stat.isFile()) continue;
|
|
1997
|
-
const backupPath =
|
|
1998
|
-
await import_promises6.default.mkdir(
|
|
2184
|
+
const backupPath = import_node_path15.default.join(publicBackupDirectory, `${publicSnapshots.length}`);
|
|
2185
|
+
await import_promises6.default.mkdir(import_node_path15.default.dirname(backupPath), { recursive: true });
|
|
1999
2186
|
await import_promises6.default.copyFile(destinationPath, backupPath);
|
|
2000
2187
|
publicSnapshots.push({ backupPath, destinationPath, state: "file" });
|
|
2001
2188
|
} catch (error) {
|
|
@@ -2003,7 +2190,7 @@ var beginFederationOutputTransaction = async (projectDirectory, outDir, relative
|
|
|
2003
2190
|
if (code === "ENOTDIR") continue;
|
|
2004
2191
|
if (code !== "ENOENT") throw error;
|
|
2005
2192
|
publicSnapshots.push({ destinationPath, state: "missing" });
|
|
2006
|
-
let directory =
|
|
2193
|
+
let directory = import_node_path15.default.dirname(destinationPath);
|
|
2007
2194
|
while (directory !== publicDirectory) {
|
|
2008
2195
|
try {
|
|
2009
2196
|
await import_promises6.default.lstat(directory);
|
|
@@ -2013,7 +2200,7 @@ var beginFederationOutputTransaction = async (projectDirectory, outDir, relative
|
|
|
2013
2200
|
if (directoryCode === "ENOTDIR") break;
|
|
2014
2201
|
if (directoryCode !== "ENOENT") throw directoryError;
|
|
2015
2202
|
missingPublicDirectories.add(directory);
|
|
2016
|
-
directory =
|
|
2203
|
+
directory = import_node_path15.default.dirname(directory);
|
|
2017
2204
|
}
|
|
2018
2205
|
}
|
|
2019
2206
|
}
|
|
@@ -2049,7 +2236,7 @@ var beginFederationOutputTransaction = async (projectDirectory, outDir, relative
|
|
|
2049
2236
|
continue;
|
|
2050
2237
|
}
|
|
2051
2238
|
await attempt(async () => {
|
|
2052
|
-
await import_promises6.default.mkdir(
|
|
2239
|
+
await import_promises6.default.mkdir(import_node_path15.default.dirname(snapshot.destinationPath), { recursive: true });
|
|
2053
2240
|
await import_promises6.default.copyFile(snapshot.backupPath, snapshot.destinationPath);
|
|
2054
2241
|
});
|
|
2055
2242
|
}
|
|
@@ -2086,7 +2273,7 @@ var withFederationOutputTransaction = async (projectDirectory, outDir, relativeP
|
|
|
2086
2273
|
// src/federation/public-assets.ts
|
|
2087
2274
|
var import_node_crypto3 = require("crypto");
|
|
2088
2275
|
var import_promises7 = __toESM(require("fs/promises"), 1);
|
|
2089
|
-
var
|
|
2276
|
+
var import_node_path16 = __toESM(require("path"), 1);
|
|
2090
2277
|
var getContentHash2 = (content) => `sha256:${(0, import_node_crypto3.createHash)("sha256").update(content).digest("hex")}`;
|
|
2091
2278
|
var getFileHash = async (filePath) => {
|
|
2092
2279
|
try {
|
|
@@ -2098,13 +2285,13 @@ var getFileHash = async (filePath) => {
|
|
|
2098
2285
|
}
|
|
2099
2286
|
};
|
|
2100
2287
|
var getSafePath = (directory, relativePath) => {
|
|
2101
|
-
const normalizedPath =
|
|
2102
|
-
const unsafe = relativePath.length === 0 || relativePath.includes("\0") || relativePath.includes("\\") ||
|
|
2288
|
+
const normalizedPath = import_node_path16.default.posix.normalize(relativePath);
|
|
2289
|
+
const unsafe = relativePath.length === 0 || relativePath.includes("\0") || relativePath.includes("\\") || import_node_path16.default.posix.isAbsolute(relativePath) || /^[a-zA-Z]:\//.test(relativePath) || normalizedPath !== relativePath || normalizedPath === ".." || normalizedPath.startsWith("../");
|
|
2103
2290
|
if (unsafe) return void 0;
|
|
2104
|
-
const resolvedDirectory =
|
|
2105
|
-
const resolvedPath =
|
|
2106
|
-
const relativeResolvedPath =
|
|
2107
|
-
if (relativeResolvedPath === "" || relativeResolvedPath === ".." || relativeResolvedPath.startsWith(`..${
|
|
2291
|
+
const resolvedDirectory = import_node_path16.default.resolve(directory);
|
|
2292
|
+
const resolvedPath = import_node_path16.default.resolve(resolvedDirectory, relativePath);
|
|
2293
|
+
const relativeResolvedPath = import_node_path16.default.relative(resolvedDirectory, resolvedPath);
|
|
2294
|
+
if (relativeResolvedPath === "" || relativeResolvedPath === ".." || relativeResolvedPath.startsWith(`..${import_node_path16.default.sep}`) || import_node_path16.default.isAbsolute(relativeResolvedPath)) {
|
|
2108
2295
|
return void 0;
|
|
2109
2296
|
}
|
|
2110
2297
|
return resolvedPath;
|
|
@@ -2112,16 +2299,16 @@ var getSafePath = (directory, relativePath) => {
|
|
|
2112
2299
|
var listFiles = async (directory, relativeDirectory = "") => {
|
|
2113
2300
|
let entries;
|
|
2114
2301
|
try {
|
|
2115
|
-
entries = await import_promises7.default.readdir(
|
|
2302
|
+
entries = await import_promises7.default.readdir(import_node_path16.default.join(directory, relativeDirectory), { withFileTypes: true });
|
|
2116
2303
|
} catch (error) {
|
|
2117
2304
|
if (error.code === "ENOENT") return [];
|
|
2118
2305
|
throw error;
|
|
2119
2306
|
}
|
|
2120
2307
|
const files = await Promise.all(
|
|
2121
2308
|
entries.map(async (entry) => {
|
|
2122
|
-
const relativePath =
|
|
2309
|
+
const relativePath = import_node_path16.default.join(relativeDirectory, entry.name);
|
|
2123
2310
|
if (entry.isDirectory()) return listFiles(directory, relativePath);
|
|
2124
|
-
return entry.isFile() ? [relativePath.split(
|
|
2311
|
+
return entry.isFile() ? [relativePath.split(import_node_path16.default.sep).join("/")] : [];
|
|
2125
2312
|
})
|
|
2126
2313
|
);
|
|
2127
2314
|
return files.flat().sort();
|
|
@@ -2136,19 +2323,19 @@ var pathExists = async (filePath) => {
|
|
|
2136
2323
|
}
|
|
2137
2324
|
};
|
|
2138
2325
|
var hasBlockingParent = async (publicDirectory, destinationPath) => {
|
|
2139
|
-
let currentPath =
|
|
2326
|
+
let currentPath = import_node_path16.default.dirname(destinationPath);
|
|
2140
2327
|
while (currentPath !== publicDirectory) {
|
|
2141
2328
|
try {
|
|
2142
2329
|
if (!(await import_promises7.default.lstat(currentPath)).isDirectory()) return true;
|
|
2143
2330
|
} catch (error) {
|
|
2144
2331
|
if (error.code !== "ENOENT") throw error;
|
|
2145
2332
|
}
|
|
2146
|
-
currentPath =
|
|
2333
|
+
currentPath = import_node_path16.default.dirname(currentPath);
|
|
2147
2334
|
}
|
|
2148
2335
|
return false;
|
|
2149
2336
|
};
|
|
2150
2337
|
var pruneEmptyDirectories = async (publicDirectory, filePath) => {
|
|
2151
|
-
let currentPath =
|
|
2338
|
+
let currentPath = import_node_path16.default.dirname(filePath);
|
|
2152
2339
|
while (currentPath !== publicDirectory) {
|
|
2153
2340
|
try {
|
|
2154
2341
|
await import_promises7.default.rmdir(currentPath);
|
|
@@ -2156,7 +2343,7 @@ var pruneEmptyDirectories = async (publicDirectory, filePath) => {
|
|
|
2156
2343
|
if (!["ENOENT", "ENOTEMPTY"].includes(error.code ?? "")) throw error;
|
|
2157
2344
|
if (error.code === "ENOTEMPTY") return;
|
|
2158
2345
|
}
|
|
2159
|
-
currentPath =
|
|
2346
|
+
currentPath = import_node_path16.default.dirname(currentPath);
|
|
2160
2347
|
}
|
|
2161
2348
|
};
|
|
2162
2349
|
var composePublicAssets = async ({
|
|
@@ -2166,8 +2353,8 @@ var composePublicAssets = async ({
|
|
|
2166
2353
|
previousFiles = {},
|
|
2167
2354
|
collisionPaths = /* @__PURE__ */ new Set()
|
|
2168
2355
|
}) => {
|
|
2169
|
-
const publicDirectory =
|
|
2170
|
-
const federatedPublicDirectory =
|
|
2356
|
+
const publicDirectory = import_node_path16.default.resolve(projectDirectory, "public");
|
|
2357
|
+
const federatedPublicDirectory = import_node_path16.default.resolve(federatedDirectory, "public");
|
|
2171
2358
|
const sourceFiles = await listFiles(federatedPublicDirectory);
|
|
2172
2359
|
const sourceFileSet = new Set(sourceFiles);
|
|
2173
2360
|
const managedFiles = /* @__PURE__ */ new Set();
|
|
@@ -2203,7 +2390,7 @@ var composePublicAssets = async ({
|
|
|
2203
2390
|
const asset = publicAssetsByPath.get(relativePath);
|
|
2204
2391
|
if (!asset) throw new Error(`Cannot identify the source of federated public asset "${relativePath}"`);
|
|
2205
2392
|
const content = await import_promises7.default.readFile(sourcePath);
|
|
2206
|
-
await import_promises7.default.mkdir(
|
|
2393
|
+
await import_promises7.default.mkdir(import_node_path16.default.dirname(destinationPath), { recursive: true });
|
|
2207
2394
|
await import_promises7.default.writeFile(destinationPath, content);
|
|
2208
2395
|
files[relativePath] = { source: asset.resolvedFrom.source, hash: getContentHash2(content) };
|
|
2209
2396
|
copied += 1;
|
|
@@ -2216,17 +2403,17 @@ var composePublicAssets = async ({
|
|
|
2216
2403
|
// src/federation/filesystem-source-provider.ts
|
|
2217
2404
|
var import_node_crypto4 = require("crypto");
|
|
2218
2405
|
var import_promises8 = __toESM(require("fs/promises"), 1);
|
|
2219
|
-
var
|
|
2406
|
+
var import_node_path17 = __toESM(require("path"), 1);
|
|
2220
2407
|
var import_sdk = __toESM(require("@eventcatalog/sdk"), 1);
|
|
2221
2408
|
var FILESYSTEM_SOURCE_PREFIX = "file:";
|
|
2222
2409
|
var isWithinDirectory = (directory, target) => {
|
|
2223
|
-
const relativePath =
|
|
2224
|
-
return relativePath === "" || !relativePath.startsWith(`..${
|
|
2410
|
+
const relativePath = import_node_path17.default.relative(directory, target);
|
|
2411
|
+
return relativePath === "" || !relativePath.startsWith(`..${import_node_path17.default.sep}`) && relativePath !== ".." && !import_node_path17.default.isAbsolute(relativePath);
|
|
2225
2412
|
};
|
|
2226
2413
|
var assertPortableRelativePath = (filePath, label, allowRoot = true) => {
|
|
2227
2414
|
const portablePath = filePath.replaceAll("\\", "/");
|
|
2228
|
-
const normalizedPath =
|
|
2229
|
-
const isUnsafe = filePath.includes("\\") || filePath.includes("\0") ||
|
|
2415
|
+
const normalizedPath = import_node_path17.default.posix.normalize(portablePath);
|
|
2416
|
+
const isUnsafe = filePath.includes("\\") || filePath.includes("\0") || import_node_path17.default.posix.isAbsolute(normalizedPath) || /^[a-zA-Z]:\//.test(normalizedPath) || normalizedPath === ".." || normalizedPath.startsWith("../") || !allowRoot && (normalizedPath === "." || normalizedPath === "");
|
|
2230
2417
|
if (isUnsafe) throw new Error(`${label} "${filePath}" escapes its filesystem source`);
|
|
2231
2418
|
return normalizedPath;
|
|
2232
2419
|
};
|
|
@@ -2236,13 +2423,13 @@ var getSourceRoot = (projectDirectory, source) => {
|
|
|
2236
2423
|
}
|
|
2237
2424
|
const locator = source.source.slice(FILESYSTEM_SOURCE_PREFIX.length);
|
|
2238
2425
|
if (!locator.trim()) throw new Error(`Filesystem federation source "${source.id}" requires a path after "file:".`);
|
|
2239
|
-
return
|
|
2426
|
+
return import_node_path17.default.resolve(projectDirectory, locator);
|
|
2240
2427
|
};
|
|
2241
2428
|
var getCatalogDirectory = async (projectDirectory, source) => {
|
|
2242
2429
|
if (source.ref) throw new Error(`Filesystem federation source "${source.id}" does not support "ref".`);
|
|
2243
2430
|
const sourceRoot = getSourceRoot(projectDirectory, source);
|
|
2244
2431
|
const catalogPath = assertPortableRelativePath(source.path ?? ".", "Catalog path");
|
|
2245
|
-
const catalogDirectory =
|
|
2432
|
+
const catalogDirectory = import_node_path17.default.resolve(sourceRoot, ...catalogPath.split("/"));
|
|
2246
2433
|
if (!isWithinDirectory(sourceRoot, catalogDirectory)) {
|
|
2247
2434
|
throw new Error(`Catalog path "${source.path}" escapes source "${source.id}"`);
|
|
2248
2435
|
}
|
|
@@ -2264,7 +2451,7 @@ var getCatalogDirectory = async (projectDirectory, source) => {
|
|
|
2264
2451
|
};
|
|
2265
2452
|
var getArtifactPath = async (catalogDirectory, source, artifactPath) => {
|
|
2266
2453
|
const normalizedPath = assertPortableRelativePath(artifactPath, "Federated artifact path", false);
|
|
2267
|
-
const filePath =
|
|
2454
|
+
const filePath = import_node_path17.default.resolve(catalogDirectory, ...normalizedPath.split("/"));
|
|
2268
2455
|
if (!isWithinDirectory(catalogDirectory, filePath)) {
|
|
2269
2456
|
throw new Error(`Federated artifact path "${artifactPath}" escapes source "${source.id}"`);
|
|
2270
2457
|
}
|
|
@@ -2304,7 +2491,7 @@ var createFileSystemSourceProvider = (projectDirectory) => ({
|
|
|
2304
2491
|
var import_node_child_process = require("child_process");
|
|
2305
2492
|
var import_promises9 = __toESM(require("fs/promises"), 1);
|
|
2306
2493
|
var import_node_os3 = __toESM(require("os"), 1);
|
|
2307
|
-
var
|
|
2494
|
+
var import_node_path18 = __toESM(require("path"), 1);
|
|
2308
2495
|
var import_node_util = require("util");
|
|
2309
2496
|
var import_sdk2 = __toESM(require("@eventcatalog/sdk"), 1);
|
|
2310
2497
|
var execFileAsync = (0, import_node_util.promisify)(import_node_child_process.execFile);
|
|
@@ -2315,8 +2502,8 @@ var parseGitHubSource = (source) => {
|
|
|
2315
2502
|
};
|
|
2316
2503
|
var assertSafeCatalogPath = (source) => {
|
|
2317
2504
|
const catalogPath = source.path ?? ".";
|
|
2318
|
-
const normalized =
|
|
2319
|
-
if (catalogPath.includes("\\") ||
|
|
2505
|
+
const normalized = import_node_path18.default.posix.normalize(catalogPath.replaceAll("\\", "/"));
|
|
2506
|
+
if (catalogPath.includes("\\") || import_node_path18.default.posix.isAbsolute(normalized) || normalized === ".." || normalized.startsWith("../")) {
|
|
2320
2507
|
throw new Error(`Catalog path "${catalogPath}" escapes source "${source.id}"`);
|
|
2321
2508
|
}
|
|
2322
2509
|
};
|
|
@@ -2359,8 +2546,8 @@ var getGitEnvironment = (token) => {
|
|
|
2359
2546
|
};
|
|
2360
2547
|
var createCheckout = (executeFile, token) => async (source, ref, callback) => {
|
|
2361
2548
|
const { owner, repository } = parseGitHubSource(source);
|
|
2362
|
-
const catalogPath =
|
|
2363
|
-
const directory = await import_promises9.default.mkdtemp(
|
|
2549
|
+
const catalogPath = import_node_path18.default.posix.normalize(source.path ?? ".");
|
|
2550
|
+
const directory = await import_promises9.default.mkdtemp(import_node_path18.default.join(import_node_os3.default.tmpdir(), "eventcatalog-federation-"));
|
|
2364
2551
|
const env = getGitEnvironment(token);
|
|
2365
2552
|
try {
|
|
2366
2553
|
const git = (args) => executeFile("git", args, { cwd: directory, env, encoding: "utf8" });
|
|
@@ -2380,16 +2567,16 @@ var createCheckout = (executeFile, token) => async (source, ref, callback) => {
|
|
|
2380
2567
|
var generateIndex = async (source, ref, checkout, executeFile) => checkout(source, ref, async (directory) => {
|
|
2381
2568
|
const { stdout } = await executeFile("git", ["rev-parse", "HEAD"], { cwd: directory, encoding: "utf8" });
|
|
2382
2569
|
const commit = stdout.trim();
|
|
2383
|
-
const catalogDirectory =
|
|
2384
|
-
const relativeCatalogDirectory =
|
|
2385
|
-
if (relativeCatalogDirectory.startsWith("..") ||
|
|
2570
|
+
const catalogDirectory = import_node_path18.default.resolve(directory, source.path ?? ".");
|
|
2571
|
+
const relativeCatalogDirectory = import_node_path18.default.relative(directory, catalogDirectory);
|
|
2572
|
+
if (relativeCatalogDirectory.startsWith("..") || import_node_path18.default.isAbsolute(relativeCatalogDirectory)) {
|
|
2386
2573
|
throw new Error(`Catalog path "${source.path}" escapes source "${source.id}"`);
|
|
2387
2574
|
}
|
|
2388
2575
|
const index = await (0, import_sdk2.default)(catalogDirectory).buildIndex({ source: source.id, commit });
|
|
2389
2576
|
return { bytes: Buffer.from(JSON.stringify(index)), index, commit, generated: true };
|
|
2390
2577
|
});
|
|
2391
2578
|
var fetchPublishedIndex = async (source, ref, fetcher, token) => {
|
|
2392
|
-
const indexPath =
|
|
2579
|
+
const indexPath = import_node_path18.default.posix.join(source.path ?? ".", "catalog.index.json");
|
|
2393
2580
|
const bytes = await fetchBytes(source, ref, indexPath, fetcher, token);
|
|
2394
2581
|
if (!bytes) return void 0;
|
|
2395
2582
|
const index = (0, import_sdk2.parseIndex)(JSON.parse(bytes.toString("utf8")));
|
|
@@ -2412,7 +2599,7 @@ var createGitHubSourceProvider = (options = {}) => {
|
|
|
2412
2599
|
},
|
|
2413
2600
|
async fetchContent({ source, commit, path: artifactPath }) {
|
|
2414
2601
|
assertSafeCatalogPath(source);
|
|
2415
|
-
const catalogPath =
|
|
2602
|
+
const catalogPath = import_node_path18.default.posix.join(source.path ?? ".", artifactPath);
|
|
2416
2603
|
const content = await fetchBytes(source, commit, catalogPath, fetcher, token);
|
|
2417
2604
|
if (!content) throw new Error(`Federated artifact not found for "${source.id}": ${artifactPath}`);
|
|
2418
2605
|
return content;
|
|
@@ -2523,8 +2710,8 @@ var pathExists2 = async (filePath) => {
|
|
|
2523
2710
|
}
|
|
2524
2711
|
};
|
|
2525
2712
|
var cleanupPreviousFederation = async (projectDirectory, onProgress) => {
|
|
2526
|
-
const outDir =
|
|
2527
|
-
const lockPath =
|
|
2713
|
+
const outDir = import_node_path19.default.join(projectDirectory, "federated");
|
|
2714
|
+
const lockPath = import_node_path19.default.join(projectDirectory, "eventcatalog.lock");
|
|
2528
2715
|
const previousLock = await readLock(lockPath);
|
|
2529
2716
|
const hadFederatedOutput = await pathExists2(outDir);
|
|
2530
2717
|
const hadLock = previousLock !== void 0;
|
|
@@ -2559,11 +2746,6 @@ var federateCatalog = async (projectDirectory, options = {}) => {
|
|
|
2559
2746
|
await cleanupPreviousFederation(projectDirectory, options.onProgress);
|
|
2560
2747
|
return null;
|
|
2561
2748
|
}
|
|
2562
|
-
if (!await isFederationEnabled()) {
|
|
2563
|
-
throw new Error(
|
|
2564
|
-
"Cannot federate catalogs: EventCatalog federation is an Enterprise feature. Visit https://www.eventcatalog.dev/pricing to enable federation."
|
|
2565
|
-
);
|
|
2566
|
-
}
|
|
2567
2749
|
validateSources(sources);
|
|
2568
2750
|
const rules = resolveFederationRules(config.federation?.rules);
|
|
2569
2751
|
if (options.useCache === false) options.onProgress?.({ type: "cache:disabled" });
|
|
@@ -2589,8 +2771,8 @@ var federateCatalog = async (projectDirectory, options = {}) => {
|
|
|
2589
2771
|
throw new Error(`Failed to federate source "${source.id}": ${message}`, { cause: error });
|
|
2590
2772
|
}
|
|
2591
2773
|
}
|
|
2592
|
-
const outDir =
|
|
2593
|
-
const lockPath =
|
|
2774
|
+
const outDir = import_node_path19.default.join(projectDirectory, "federated");
|
|
2775
|
+
const lockPath = import_node_path19.default.join(projectDirectory, "eventcatalog.lock");
|
|
2594
2776
|
const previousLock = await readLock(lockPath);
|
|
2595
2777
|
const resources = resolvedSources.reduce((total, source) => total + source.resolved.index.resources.length, 0);
|
|
2596
2778
|
const remoteIndexes = resolvedSources.map(({ resolved }) => resolved.index);
|
|
@@ -2702,17 +2884,16 @@ Run npm i @eventcatalog/core to update`;
|
|
|
2702
2884
|
};
|
|
2703
2885
|
|
|
2704
2886
|
// src/eventcatalog.ts
|
|
2705
|
-
var
|
|
2706
|
-
var
|
|
2707
|
-
var astroCli = import_node_path20.default.join(import_node_path20.default.dirname((0, import_node_module2.createRequire)(importMetaUrl).resolve("astro/package.json")), "bin/astro.mjs");
|
|
2887
|
+
var currentDir = import_node_path21.default.dirname((0, import_node_url2.fileURLToPath)(importMetaUrl));
|
|
2888
|
+
var astroCli = import_node_path21.default.join(import_node_path21.default.dirname((0, import_node_module2.createRequire)(importMetaUrl).resolve("astro/package.json")), "bin/astro.mjs");
|
|
2708
2889
|
var program = new import_commander.Command().version(VERSION);
|
|
2709
|
-
var dir =
|
|
2710
|
-
var eventCatalogDir =
|
|
2711
|
-
var astroConfigPath = () => getAstroConfigPath(dir, (0,
|
|
2890
|
+
var dir = import_node_path21.default.resolve(process.env.PROJECT_DIR || process.cwd());
|
|
2891
|
+
var eventCatalogDir = import_node_path21.default.resolve((0, import_node_path20.join)(currentDir, "../eventcatalog/"));
|
|
2892
|
+
var astroConfigPath = () => getAstroConfigPath(dir, (0, import_node_path20.join)(eventCatalogDir, "astro.config.mjs"));
|
|
2712
2893
|
var { runtimeDirectory: core } = getRuntimePaths(dir);
|
|
2713
2894
|
var getInstalledEventCatalogVersion = () => {
|
|
2714
2895
|
try {
|
|
2715
|
-
const pkg = import_fs.default.readFileSync((0,
|
|
2896
|
+
const pkg = import_fs.default.readFileSync((0, import_node_path20.join)(dir, "package.json"), "utf8");
|
|
2716
2897
|
const json = JSON.parse(pkg);
|
|
2717
2898
|
return json.dependencies["@eventcatalog/core"];
|
|
2718
2899
|
} catch (error) {
|
|
@@ -2778,12 +2959,12 @@ var startDevPrewarm = ({
|
|
|
2778
2959
|
var buildDevSearchIndex = async ({ config }) => {
|
|
2779
2960
|
const result = await buildSearchIndex({
|
|
2780
2961
|
projectDir: dir,
|
|
2781
|
-
outDir:
|
|
2782
|
-
searchOutputPath:
|
|
2962
|
+
outDir: import_node_path21.default.join(core, "public"),
|
|
2963
|
+
searchOutputPath: import_node_path21.default.join(core, "public", "pagefind"),
|
|
2783
2964
|
config,
|
|
2784
2965
|
isServer: false
|
|
2785
2966
|
});
|
|
2786
|
-
logger.info(`Indexed ${result.records} page(s) into ${
|
|
2967
|
+
logger.info(`Indexed ${result.records} page(s) into ${import_node_path21.default.relative(core, result.outputPath)}`, "search");
|
|
2787
2968
|
};
|
|
2788
2969
|
var warnIfIndexedSearchUsesAuth = async () => {
|
|
2789
2970
|
if (!await isAuthEnabled()) {
|
|
@@ -2918,7 +3099,7 @@ V3 brings exciting new features and improvements.
|
|
|
2918
3099
|
|
|
2919
3100
|
Upgrade now: npm i @eventcatalog/core@beta`;
|
|
2920
3101
|
console.log(
|
|
2921
|
-
(0,
|
|
3102
|
+
(0, import_boxen2.default)(v3Message, {
|
|
2922
3103
|
padding: 1,
|
|
2923
3104
|
margin: 1,
|
|
2924
3105
|
align: "center",
|
|
@@ -2935,7 +3116,7 @@ Upgrade now: npm i @eventcatalog/core@beta`;
|
|
|
2935
3116
|
const message = getEventCatalogUpdateMessage(installedVersion, notifier.update?.latest);
|
|
2936
3117
|
if (message) {
|
|
2937
3118
|
console.log(
|
|
2938
|
-
(0,
|
|
3119
|
+
(0, import_boxen2.default)(message, {
|
|
2939
3120
|
padding: 1,
|
|
2940
3121
|
margin: 1,
|
|
2941
3122
|
align: "center",
|
|
@@ -2959,8 +3140,8 @@ program.command("dev").description("Run development server of EventCatalog").opt
|
|
|
2959
3140
|
logger.info("Setting up EventCatalog...", "eventcatalog");
|
|
2960
3141
|
const isServer = await isOutputServer();
|
|
2961
3142
|
logger.info(isServer ? "EventCatalog is running in Server Mode" : "EventCatalog is running in Static Mode", "config");
|
|
2962
|
-
if (import_fs.default.existsSync(
|
|
2963
|
-
import_dotenv.default.config({ path:
|
|
3143
|
+
if (import_fs.default.existsSync(import_node_path21.default.join(dir, ".env"))) {
|
|
3144
|
+
import_dotenv.default.config({ path: import_node_path21.default.join(dir, ".env") });
|
|
2964
3145
|
}
|
|
2965
3146
|
if (options.debug) {
|
|
2966
3147
|
logger.info("Debug mode enabled", "debug");
|
|
@@ -2973,18 +3154,9 @@ program.command("dev").description("Run development server of EventCatalog").opt
|
|
|
2973
3154
|
await resolve_catalog_dependencies_default(dir, core);
|
|
2974
3155
|
await runMigrations(dir);
|
|
2975
3156
|
const config = await getEventCatalogConfigFile(dir);
|
|
2976
|
-
const
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
);
|
|
2980
|
-
const isEventCatalogStarter = await (0, import_license2.isEventCatalogStarterEnabled)();
|
|
2981
|
-
const isEventCatalogScale = await (0, import_license2.isEventCatalogScaleEnabled)();
|
|
2982
|
-
void log_build_default(dir, {
|
|
2983
|
-
isEventCatalogStarterEnabled: isEventCatalogStarter,
|
|
2984
|
-
isEventCatalogScaleEnabled: isEventCatalogScale,
|
|
2985
|
-
isBackstagePluginEnabled: canEmbedPages || isEventCatalogScale,
|
|
2986
|
-
command: "dev"
|
|
2987
|
-
});
|
|
3157
|
+
const license = await getLicenseStatus2(dir);
|
|
3158
|
+
printLicenseStatus(license, config?.tsd);
|
|
3159
|
+
void log_build_default(dir, { command: "dev", license });
|
|
2988
3160
|
if (isServer) {
|
|
2989
3161
|
try {
|
|
2990
3162
|
logger.info("Building fields index...", "fields");
|
|
@@ -3026,9 +3198,6 @@ program.command("dev").description("Run development server of EventCatalog").opt
|
|
|
3026
3198
|
env: {
|
|
3027
3199
|
PROJECT_DIR: dir,
|
|
3028
3200
|
CATALOG_DIR: core,
|
|
3029
|
-
ENABLE_EMBED: String(canEmbedPages || isEventCatalogScale),
|
|
3030
|
-
EVENTCATALOG_STARTER: String(isEventCatalogStarter),
|
|
3031
|
-
EVENTCATALOG_SCALE: String(isEventCatalogScale),
|
|
3032
3201
|
EVENTCATALOG_DEV_MODE: "true",
|
|
3033
3202
|
IGNORE_BUILD_ARTIFACTS: "true",
|
|
3034
3203
|
NODE_NO_WARNINGS: "1"
|
|
@@ -3047,24 +3216,15 @@ program.command("build").description("Run build of EventCatalog").action(async (
|
|
|
3047
3216
|
logger.info("Building EventCatalog...", "build");
|
|
3048
3217
|
const isServer = await isOutputServer();
|
|
3049
3218
|
logger.info(isServer ? "EventCatalog is running in Server Mode" : "EventCatalog is running in Static Mode", "config");
|
|
3050
|
-
if (import_fs.default.existsSync(
|
|
3051
|
-
import_dotenv.default.config({ path:
|
|
3219
|
+
if (import_fs.default.existsSync(import_node_path21.default.join(dir, ".env"))) {
|
|
3220
|
+
import_dotenv.default.config({ path: import_node_path21.default.join(dir, ".env") });
|
|
3052
3221
|
}
|
|
3053
3222
|
await verifyRequiredFieldsAreInCatalogConfigFile(dir);
|
|
3223
|
+
const config = await getEventCatalogConfigFile(dir);
|
|
3224
|
+
const license = await getLicenseStatus2(dir);
|
|
3225
|
+
printLicenseStatus(license, config?.tsd);
|
|
3054
3226
|
prepareCore();
|
|
3055
|
-
|
|
3056
|
-
"@eventcatalog/backstage-plugin-eventcatalog",
|
|
3057
|
-
process.env.EVENTCATALOG_LICENSE_KEY_BACKSTAGE
|
|
3058
|
-
);
|
|
3059
|
-
const isEventCatalogStarter = await (0, import_license2.isEventCatalogStarterEnabled)();
|
|
3060
|
-
const isEventCatalogScale = await (0, import_license2.isEventCatalogScaleEnabled)();
|
|
3061
|
-
const canEmbedPages = isBackstagePluginEnabled || isEventCatalogScale;
|
|
3062
|
-
await log_build_default(dir, {
|
|
3063
|
-
isEventCatalogStarterEnabled: isEventCatalogStarter,
|
|
3064
|
-
isEventCatalogScaleEnabled: isEventCatalogScale,
|
|
3065
|
-
isBackstagePluginEnabled: canEmbedPages || isEventCatalogScale,
|
|
3066
|
-
command: "build"
|
|
3067
|
-
});
|
|
3227
|
+
await log_build_default(dir, { command: "build", license });
|
|
3068
3228
|
await resolve_catalog_dependencies_default(dir, core);
|
|
3069
3229
|
await runMigrations(dir);
|
|
3070
3230
|
if (isServer) {
|
|
@@ -3088,17 +3248,13 @@ program.command("build").description("Run build of EventCatalog").action(async (
|
|
|
3088
3248
|
env: {
|
|
3089
3249
|
PROJECT_DIR: dir,
|
|
3090
3250
|
CATALOG_DIR: core,
|
|
3091
|
-
ENABLE_EMBED: String(canEmbedPages),
|
|
3092
|
-
EVENTCATALOG_STARTER: String(isEventCatalogStarter),
|
|
3093
|
-
EVENTCATALOG_SCALE: String(isEventCatalogScale),
|
|
3094
3251
|
IGNORE_BUILD_ARTIFACTS: "true"
|
|
3095
3252
|
},
|
|
3096
3253
|
shouldFilterLine: createAstroLineFilter()
|
|
3097
3254
|
});
|
|
3098
3255
|
if (await isIndexedSearchEnabled()) {
|
|
3099
3256
|
await warnIfIndexedSearchUsesAuth();
|
|
3100
|
-
const
|
|
3101
|
-
const outDir = import_node_path20.default.resolve(dir, await getProjectOutDir());
|
|
3257
|
+
const outDir = import_node_path21.default.resolve(dir, await getProjectOutDir());
|
|
3102
3258
|
logger.info("Building indexed search...", "search");
|
|
3103
3259
|
const result = await buildSearchIndex({
|
|
3104
3260
|
projectDir: dir,
|
|
@@ -3106,45 +3262,30 @@ program.command("build").description("Run build of EventCatalog").action(async (
|
|
|
3106
3262
|
config,
|
|
3107
3263
|
isServer
|
|
3108
3264
|
});
|
|
3109
|
-
logger.info(`Indexed ${result.records} page(s) into ${
|
|
3265
|
+
logger.info(`Indexed ${result.records} page(s) into ${import_node_path21.default.relative(dir, result.outputPath)}`, "search");
|
|
3110
3266
|
}
|
|
3111
3267
|
});
|
|
3112
|
-
var previewCatalog = async ({
|
|
3113
|
-
command,
|
|
3114
|
-
canEmbedPages = false,
|
|
3115
|
-
isEventCatalogStarter = false,
|
|
3116
|
-
isEventCatalogScale = false
|
|
3117
|
-
}) => {
|
|
3268
|
+
var previewCatalog = async ({ command }) => {
|
|
3118
3269
|
await runCommandWithFilteredOutput({
|
|
3119
3270
|
command: process.execPath,
|
|
3120
3271
|
args: [astroCli, "preview", "--config", astroConfigPath(), ...command.args],
|
|
3121
3272
|
cwd: dir,
|
|
3122
3273
|
env: {
|
|
3123
3274
|
PROJECT_DIR: dir,
|
|
3124
|
-
CATALOG_DIR: core
|
|
3125
|
-
ENABLE_EMBED: String(canEmbedPages),
|
|
3126
|
-
EVENTCATALOG_STARTER: String(isEventCatalogStarter),
|
|
3127
|
-
EVENTCATALOG_SCALE: String(isEventCatalogScale)
|
|
3275
|
+
CATALOG_DIR: core
|
|
3128
3276
|
},
|
|
3129
3277
|
shouldFilterLine: createAstroLineFilter()
|
|
3130
3278
|
});
|
|
3131
3279
|
};
|
|
3132
|
-
var startServerCatalog = async ({
|
|
3133
|
-
|
|
3134
|
-
isEventCatalogStarter = false,
|
|
3135
|
-
isEventCatalogScale = false
|
|
3136
|
-
}) => {
|
|
3137
|
-
const serverEntryPath = import_node_path20.default.join(dir, "dist", "server", "entry.mjs");
|
|
3280
|
+
var startServerCatalog = async () => {
|
|
3281
|
+
const serverEntryPath = import_node_path21.default.join(dir, "dist", "server", "entry.mjs");
|
|
3138
3282
|
await runCommandWithFilteredOutput({
|
|
3139
3283
|
command: process.execPath,
|
|
3140
3284
|
args: [serverEntryPath],
|
|
3141
3285
|
cwd: dir,
|
|
3142
3286
|
env: {
|
|
3143
3287
|
PROJECT_DIR: dir,
|
|
3144
|
-
CATALOG_DIR: core
|
|
3145
|
-
ENABLE_EMBED: String(canEmbedPages),
|
|
3146
|
-
EVENTCATALOG_STARTER: String(isEventCatalogStarter),
|
|
3147
|
-
EVENTCATALOG_SCALE: String(isEventCatalogScale)
|
|
3288
|
+
CATALOG_DIR: core
|
|
3148
3289
|
},
|
|
3149
3290
|
shouldFilterLine: createAstroLineFilter()
|
|
3150
3291
|
});
|
|
@@ -3152,69 +3293,44 @@ var startServerCatalog = async ({
|
|
|
3152
3293
|
program.command("preview").description("Serves the contents of your eventcatalog build directory").action(async (options, command) => {
|
|
3153
3294
|
logger.welcome();
|
|
3154
3295
|
logger.info("Starting preview of your build...", "preview");
|
|
3155
|
-
if (import_fs.default.existsSync(
|
|
3156
|
-
import_dotenv.default.config({ path:
|
|
3296
|
+
if (import_fs.default.existsSync(import_node_path21.default.join(dir, ".env"))) {
|
|
3297
|
+
import_dotenv.default.config({ path: import_node_path21.default.join(dir, ".env") });
|
|
3157
3298
|
}
|
|
3158
|
-
|
|
3159
|
-
"@eventcatalog/backstage-plugin-eventcatalog",
|
|
3160
|
-
process.env.EVENTCATALOG_LICENSE_KEY_BACKSTAGE
|
|
3161
|
-
);
|
|
3162
|
-
const isEventCatalogStarter = await (0, import_license2.isEventCatalogStarterEnabled)();
|
|
3163
|
-
const isEventCatalogScale = await (0, import_license2.isEventCatalogScaleEnabled)();
|
|
3164
|
-
await previewCatalog({
|
|
3165
|
-
command,
|
|
3166
|
-
canEmbedPages: canEmbedPages || isEventCatalogScale,
|
|
3167
|
-
isEventCatalogStarter,
|
|
3168
|
-
isEventCatalogScale
|
|
3169
|
-
});
|
|
3299
|
+
await previewCatalog({ command });
|
|
3170
3300
|
});
|
|
3171
3301
|
program.command("start").description("Serves the contents of your eventcatalog build directory").action(async (options, command) => {
|
|
3172
3302
|
logger.welcome();
|
|
3173
3303
|
logger.info("Starting preview of your build...", "preview");
|
|
3174
|
-
if (import_fs.default.existsSync(
|
|
3175
|
-
import_dotenv.default.config({ path:
|
|
3304
|
+
if (import_fs.default.existsSync(import_node_path21.default.join(dir, ".env"))) {
|
|
3305
|
+
import_dotenv.default.config({ path: import_node_path21.default.join(dir, ".env") });
|
|
3176
3306
|
}
|
|
3177
|
-
const canEmbedPages = await (0, import_license2.isFeatureEnabled)(
|
|
3178
|
-
"@eventcatalog/backstage-plugin-eventcatalog",
|
|
3179
|
-
process.env.EVENTCATALOG_LICENSE_KEY_BACKSTAGE
|
|
3180
|
-
);
|
|
3181
|
-
const isEventCatalogStarter = await (0, import_license2.isEventCatalogStarterEnabled)();
|
|
3182
|
-
const isEventCatalogScale = await (0, import_license2.isEventCatalogScaleEnabled)();
|
|
3183
3307
|
const isServerOutput = await isOutputServer();
|
|
3184
3308
|
if (isServerOutput) {
|
|
3185
|
-
await
|
|
3186
|
-
|
|
3187
|
-
isEventCatalogStarter,
|
|
3188
|
-
isEventCatalogScale
|
|
3189
|
-
});
|
|
3309
|
+
await getLicenseStatus2(dir);
|
|
3310
|
+
await startServerCatalog();
|
|
3190
3311
|
} else {
|
|
3191
|
-
await previewCatalog({
|
|
3192
|
-
command,
|
|
3193
|
-
canEmbedPages: canEmbedPages || isEventCatalogScale,
|
|
3194
|
-
isEventCatalogStarter,
|
|
3195
|
-
isEventCatalogScale
|
|
3196
|
-
});
|
|
3312
|
+
await previewCatalog({ command });
|
|
3197
3313
|
}
|
|
3198
3314
|
});
|
|
3199
3315
|
program.command("export").description("Export your EventCatalog using the SDK dumpCatalog function").option("--include-markdown", "Include markdown content in the export", false).action(async (options) => {
|
|
3200
3316
|
logger.welcome();
|
|
3201
3317
|
logger.info("Exporting EventCatalog...", "export");
|
|
3202
|
-
if (import_fs.default.existsSync(
|
|
3203
|
-
import_dotenv.default.config({ path:
|
|
3318
|
+
if (import_fs.default.existsSync(import_node_path21.default.join(dir, ".env"))) {
|
|
3319
|
+
import_dotenv.default.config({ path: import_node_path21.default.join(dir, ".env") });
|
|
3204
3320
|
}
|
|
3205
3321
|
const { default: initSDK } = await import("@eventcatalog/sdk");
|
|
3206
3322
|
const sdk = initSDK(dir);
|
|
3207
3323
|
const catalog = await sdk.dumpCatalog({ includeMarkdown: options.includeMarkdown });
|
|
3208
|
-
const exportsDir =
|
|
3324
|
+
const exportsDir = import_node_path21.default.join(dir, "exports");
|
|
3209
3325
|
ensureDir(exportsDir);
|
|
3210
3326
|
const date = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
3211
|
-
const exportFile =
|
|
3327
|
+
const exportFile = import_node_path21.default.join(exportsDir, `catalog-${date}.json`);
|
|
3212
3328
|
import_fs.default.writeFileSync(exportFile, JSON.stringify(catalog, null, 2), "utf-8");
|
|
3213
3329
|
logger.info(`Catalog exported to ${exportFile}`, "export");
|
|
3214
3330
|
});
|
|
3215
3331
|
program.command("generate [siteDir]").description("Start the generator scripts.").action(async () => {
|
|
3216
|
-
if (import_fs.default.existsSync(
|
|
3217
|
-
import_dotenv.default.config({ path:
|
|
3332
|
+
if (import_fs.default.existsSync(import_node_path21.default.join(dir, ".env"))) {
|
|
3333
|
+
import_dotenv.default.config({ path: import_node_path21.default.join(dir, ".env") });
|
|
3218
3334
|
}
|
|
3219
3335
|
await generate(dir);
|
|
3220
3336
|
});
|
|
@@ -3287,7 +3403,7 @@ var reportFederationProgress = (event, verbose = false) => {
|
|
|
3287
3403
|
}
|
|
3288
3404
|
return;
|
|
3289
3405
|
case "hydrating":
|
|
3290
|
-
logger.info(`Hydrating federated content into ${
|
|
3406
|
+
logger.info(`Hydrating federated content into ${import_node_path21.default.relative(dir, event.outDir)}/...`, "federation");
|
|
3291
3407
|
return;
|
|
3292
3408
|
case "hydrate:cache":
|
|
3293
3409
|
if (event.files === 1 || event.files % 25 === 0) {
|
|
@@ -3310,13 +3426,13 @@ var reportFederationProgress = (event, verbose = false) => {
|
|
|
3310
3426
|
`Federation complete: ${event.result.sources} sources, ${event.result.resources} remote resources, ${event.result.hydrate.written} files written (${event.result.hydrate.fetched} downloaded, ${event.result.hydrate.written - event.result.hydrate.fetched} cached)`,
|
|
3311
3427
|
"federation"
|
|
3312
3428
|
);
|
|
3313
|
-
logger.info(`Recorded resolved source state in ${
|
|
3429
|
+
logger.info(`Recorded resolved source state in ${import_node_path21.default.relative(dir, event.result.lockPath)}`, "federation");
|
|
3314
3430
|
}
|
|
3315
3431
|
};
|
|
3316
3432
|
program.command("federate").description("Fetch, resolve, and hydrate the catalogs configured in federation.sources.").option("--no-cache", "Download all federation content and refresh the cache.").option("-v, --verbose", "Show detailed federation diagnostics.").action(async (commandOptions) => {
|
|
3317
3433
|
logger.welcome();
|
|
3318
|
-
if (import_fs.default.existsSync(
|
|
3319
|
-
import_dotenv.default.config({ path:
|
|
3434
|
+
if (import_fs.default.existsSync(import_node_path21.default.join(dir, ".env"))) {
|
|
3435
|
+
import_dotenv.default.config({ path: import_node_path21.default.join(dir, ".env") });
|
|
3320
3436
|
}
|
|
3321
3437
|
logger.info("Starting federation...", "federation");
|
|
3322
3438
|
let cleanedPreviousOutput = false;
|