@eventcatalog/core 5.0.0-beta.8 → 5.0.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 +234 -134
- package/README.md +5 -5
- package/dist/analytics/analytics.cjs +18 -3
- package/dist/analytics/analytics.d.cts +1 -1
- package/dist/analytics/analytics.d.ts +1 -1
- package/dist/analytics/analytics.js +3 -2
- package/dist/analytics/log-build.cjs +157 -76
- package/dist/analytics/log-build.d.cts +2 -2
- package/dist/analytics/log-build.d.ts +2 -2
- package/dist/analytics/log-build.js +7 -5
- package/dist/analytics/studio-usage.cjs +90 -0
- package/dist/analytics/studio-usage.d.cts +5 -0
- package/dist/analytics/studio-usage.d.ts +5 -0
- package/dist/analytics/studio-usage.js +10 -0
- package/dist/analytics/telemetry.cjs +42 -0
- package/dist/analytics/telemetry.d.cts +20 -0
- package/dist/analytics/telemetry.d.ts +20 -0
- package/dist/analytics/telemetry.js +8 -0
- package/dist/catalog-runtime.cjs +1 -1
- package/dist/{chunk-RFIXKATC.js → chunk-4G7FSRPN.js} +35 -42
- package/dist/{chunk-AWOO63ME.js → chunk-AD7CL772.js} +11 -4
- package/dist/chunk-CA6WCQ2T.js +54 -0
- package/dist/chunk-CPW6G62V.js +17 -0
- package/dist/{chunk-PU25TOOJ.js → chunk-JZN4RSMF.js} +1 -1
- package/dist/{chunk-4W55ZOOS.js → chunk-NEAVAFSJ.js} +66 -35
- package/dist/{chunk-C6T2AAFR.js → chunk-NIVST4WY.js} +9 -3
- package/dist/{chunk-ENAG6UH7.js → chunk-NKNOXQ62.js} +1 -6
- package/dist/{chunk-AYNZXUB5.js → chunk-OX6TSVHY.js} +5 -5
- package/dist/{chunk-36RYTYT5.js → chunk-PD7KTSYN.js} +1 -1
- package/dist/{chunk-RDIZJ7UT.js → chunk-RE7UTPWH.js} +1 -1
- package/dist/chunk-S5GWAUG5.js +29 -0
- package/dist/{chunk-T4G3VVZ4.js → chunk-YQGRMDRB.js} +4 -2
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/docs/api/02-config.md +57 -7
- package/dist/docs/development/00-why-eventcatalog.md +11 -11
- package/dist/docs/development/01-fundamentals.md +20 -13
- package/dist/docs/development/01-getting-started/configuration-overview.md +2 -2
- package/dist/docs/development/01-getting-started/installation.md +9 -1
- package/dist/docs/development/_getting-started.mdx +1 -1
- package/dist/docs/development/ask-your-architecture/01-intro.md +5 -5
- package/dist/docs/development/ask-your-architecture/02-eventcatalog-assistant/01-what-is-eventcatalog-assistant.md +0 -4
- package/dist/docs/development/ask-your-architecture/02-eventcatalog-assistant/02-configuration.md +15 -3
- package/dist/docs/development/ask-your-architecture/02-eventcatalog-assistant/03-bring-your-own-tools.md +0 -3
- package/dist/docs/development/ask-your-architecture/02-eventcatalog-assistant/_category_.json +1 -1
- package/dist/docs/development/ask-your-architecture/02-llms.txt.md +1 -1
- package/dist/docs/development/ask-your-architecture/{05-skills/01-introduction.md → 03-install-skills.md} +57 -7
- package/dist/docs/development/ask-your-architecture/03-mcp-server/_category_.json +1 -1
- package/dist/docs/development/ask-your-architecture/03-mcp-server/getting-started.md +86 -33
- package/dist/docs/development/ask-your-architecture/03-mcp-server/introduction.md +14 -4
- package/dist/docs/development/ask-your-architecture/03-schemas.txt.md +1 -1
- package/dist/docs/development/ask-your-architecture/04-agents/_category_.json +1 -1
- package/dist/docs/development/authentication/01-introduction.md +2 -23
- package/dist/docs/development/authentication/02-enabling-authentication.md +0 -20
- package/dist/docs/development/authentication/07-rbac-middleware.md +0 -2
- package/dist/docs/development/authentication/providers/03-setting-up-github.md +0 -2
- package/dist/docs/development/authentication/providers/03a-setting-up-google.md +0 -2
- package/dist/docs/development/authentication/providers/04-setting-up-azure-ad.md +0 -2
- package/dist/docs/development/authentication/providers/05-setting-up-okta.md +0 -3
- package/dist/docs/development/authentication/providers/06-setting-up-auth0.md +0 -2
- package/dist/docs/development/bring-your-own-documentation/01-introduction.md +0 -4
- package/dist/docs/development/bring-your-own-documentation/custom-pages/01-introduction.md +0 -3
- package/dist/docs/development/bring-your-own-documentation/custom-pages/02-adding-custom-docs.md +0 -17
- package/dist/docs/development/bring-your-own-documentation/custom-pages/03-components.md +0 -4
- package/dist/docs/development/bring-your-own-documentation/custom-pages/04-owners.md +0 -2
- package/dist/docs/development/bring-your-own-documentation/resource-docs/01-introduction.md +1 -3
- package/dist/docs/development/bring-your-own-documentation/resource-docs/02-adding-resource-docs.md +1 -4
- package/dist/docs/development/bring-your-own-documentation/resource-docs/03-categories.md +0 -2
- package/dist/docs/development/bring-your-own-documentation/resource-docs/04-versioning.md +1 -3
- package/dist/docs/development/components/components/11-flow.md +17 -0
- package/dist/docs/development/components/components/15-nodegraph.md +43 -10
- package/dist/docs/development/components/components/18-remote-schema.md +1 -4
- package/dist/docs/development/components/custom-components/07-reference.md +14 -0
- package/dist/docs/development/customization/02-themes.md +0 -5
- package/dist/docs/development/customization/03-search.md +1 -1
- package/dist/docs/development/customization/05-custom-pages-and-api-routes/01-introduction.md +0 -2
- package/dist/docs/development/customization/05-custom-pages-and-api-routes/04-reference.md +7 -1
- package/dist/docs/development/customization/05-resource-sidebar.md +1 -1
- package/dist/docs/development/customization/09-embed-eventcatalog.md +20 -25
- package/dist/docs/development/deployment/hosting-options.md +7 -2
- package/dist/docs/development/developer-tools/eventcatalog-linter/how-to/05-fix-common-problems.md +16 -0
- package/dist/docs/development/developer-tools/eventcatalog-linter/reference/03-rules.md +31 -1
- package/dist/docs/development/developer-tools/eventcatalog-linter/reference/05-supported-resources.md +1 -1
- package/dist/docs/development/governance/architecture-change-detection/01-introduction.md +0 -10
- package/dist/docs/development/governance/architecture-change-detection/06-pipeline-gates.md +0 -4
- package/dist/docs/development/guides/97-architecture-graph.md +1 -1
- package/dist/docs/development/guides/99-adding-analytics.md +0 -7
- package/dist/docs/development/guides/domains/03-model-subdomains.md +2 -2
- package/dist/docs/development/guides/domains/04-add-resources-to-domains/01-add-systems-to-domains.md +3 -1
- package/dist/docs/development/guides/domains/04-add-resources-to-domains/02-add-services-to-domains.md +5 -1
- package/dist/docs/development/guides/domains/04-add-resources-to-domains/03-add-messages-to-domains.md +2 -2
- package/dist/docs/development/guides/domains/04-add-resources-to-domains/05-add-entities-to-domains.md +1 -1
- package/dist/docs/development/guides/domains/04-add-resources-to-domains/06-domain-resources-page.md +40 -0
- package/dist/docs/development/guides/domains/06-visualize-domains/01-domain-diagram.md +89 -0
- package/dist/docs/development/guides/domains/06-visualize-domains/_category_.json +1 -2
- package/dist/docs/development/guides/domains/09-reference.md +4 -4
- package/dist/docs/development/guides/owners/automated-teams-and-users/create-your-own-connector.md +0 -2
- package/dist/docs/development/guides/owners/automated-teams-and-users/sync-from-github.md +0 -3
- package/dist/docs/development/guides/owners/automated-teams-and-users/sync-from-microsoft-entra.md +0 -2
- package/dist/docs/development/guides/resources/adrs/03-linking-resources.md +8 -0
- package/dist/docs/development/guides/resources/adrs/06-reference.md +4 -4
- package/dist/docs/development/guides/resources/agents/11-reference.md +1 -1
- package/dist/docs/development/guides/resources/data/04-reference.md +1 -1
- package/dist/docs/development/guides/resources/data-products/07-reference.md +1 -1
- package/dist/docs/development/guides/resources/entities/05-entity-maps.md +1 -1
- package/dist/docs/development/guides/resources/entities/06-reference.md +2 -2
- package/dist/docs/development/guides/resources/flows/01-introduction.md +11 -1
- package/dist/docs/development/guides/resources/flows/03-model-flow-steps.md +65 -6
- package/dist/docs/development/guides/resources/flows/05-explore-flows.md +112 -0
- package/dist/docs/development/guides/resources/flows/06-reference.md +25 -4
- package/dist/docs/development/guides/resources/messages/01-what-are-messages.md +19 -0
- package/dist/docs/development/guides/resources/messages/04-message-channels/01-introduction.md +16 -0
- package/dist/docs/development/guides/resources/messages/04-message-channels/05-reference.md +2 -1
- package/dist/docs/development/guides/resources/messages/10-reference.md +6 -3
- package/dist/docs/development/guides/resources/schemas/04-explore-schemas/01-schema-explorer.md +2 -2
- package/dist/docs/development/guides/resources/schemas/04-explore-schemas/02-fields-explorer.md +0 -9
- package/dist/docs/development/guides/resources/schemas/05-schema-api.md +0 -3
- package/dist/docs/development/guides/resources/schemas/06-schema-mcp.md +11 -3
- package/dist/docs/development/guides/resources/services/04-add-resources-to-services/03-add-entities-to-services.md +1 -1
- package/dist/docs/development/guides/resources/services/05-resources-page.md +50 -0
- package/dist/docs/development/guides/resources/services/08-reference.md +2 -1
- package/dist/docs/development/guides/systems/01-introduction.md +1 -1
- package/dist/docs/development/guides/systems/02-create-system.md +2 -2
- package/dist/docs/development/guides/systems/03-add-resources-to-systems.md +35 -9
- package/dist/docs/development/guides/systems/04-model-relationships-and-actors.md +5 -3
- package/dist/docs/development/guides/systems/05-system-context-maps.md +39 -22
- package/dist/docs/development/guides/systems/06-reference.md +4 -4
- package/dist/docs/development/license/01-license-file.md +151 -0
- package/dist/docs/development/license/_category_.json +12 -0
- package/dist/docs/development/license-keys/_category_.json +3 -3
- package/dist/docs/development/license-keys/integrations.md +7 -37
- package/dist/docs/development/license-keys/license-validation.md +4 -0
- package/dist/docs/development/license-keys/overview.md +5 -1
- package/dist/docs/development/license-keys/plans.md +4 -2
- package/dist/docs/development/studio/01-introduction.md +60 -0
- package/dist/docs/development/studio/02-create-a-canvas.md +103 -0
- package/dist/docs/development/studio/03-set-up-persistent-storage.md +59 -0
- package/dist/docs/development/studio/04-collaborate-on-a-canvas.md +78 -0
- package/dist/docs/development/studio/05-connect-your-agent.md +102 -0
- package/dist/docs/development/studio/06-run-studio-in-production.md +54 -0
- package/dist/docs/development/studio/07-reference.md +294 -0
- package/dist/docs/development/studio/_category_.json +12 -0
- package/dist/docs/development/upgrading/v5.md +345 -0
- package/dist/docs/federation/00-overview.md +2 -8
- package/dist/docs/federation/01-first-federation.md +6 -18
- package/dist/docs/federation/explanation/how-it-works.md +0 -4
- package/dist/docs/federation/explanation/lockfile-and-cache.md +0 -4
- package/dist/docs/federation/explanation/mvp-status-and-feedback.md +0 -4
- package/dist/docs/federation/explanation/ownership-and-references.md +0 -4
- package/dist/docs/federation/how-to/configure-github-sources.md +6 -5
- package/dist/docs/federation/how-to/configure-validation-rules.md +0 -4
- package/dist/docs/federation/how-to/run-in-ci.md +2 -9
- package/dist/docs/federation/how-to/share-assets-and-components.md +0 -4
- package/dist/docs/federation/how-to/use-local-sources.md +0 -4
- package/dist/docs/federation/legacy-federation/00-introduction.md +4 -22
- package/dist/docs/federation/legacy-federation/01-installation.md +7 -58
- package/dist/docs/federation/legacy-federation/02-plugin-configuration.md +3 -21
- package/dist/docs/federation/legacy-federation/03-examples.md +3 -5
- package/dist/docs/federation/legacy-federation/04-configuration.md +3 -8
- package/dist/docs/federation/legacy-federation/05-setup-team-catalog.md +3 -6
- package/dist/docs/federation/reference/cli.md +2 -8
- package/dist/docs/federation/reference/configuration.md +0 -4
- package/dist/docs/federation/reference/diagnostic-rules.md +0 -5
- package/dist/docs/federation/reference/generated-output.md +0 -4
- package/dist/docs/federation/reference/supported-content.md +0 -4
- package/dist/docs/federation/reference/troubleshooting.md +0 -14
- package/dist/docs/plugins/02-generators.md +1 -1
- package/dist/docs/plugins/amazon-apigateway/00-intro.md +3 -28
- package/dist/docs/plugins/amazon-apigateway/01-installation.md +4 -56
- package/dist/docs/plugins/amazon-apigateway/02-plugin-configuration.md +1 -6
- package/dist/docs/plugins/apicurio/00-intro.md +2 -31
- package/dist/docs/plugins/apicurio/01-installation.md +2 -26
- package/dist/docs/plugins/apicurio/02-plugin-configuration.md +5 -13
- package/dist/docs/plugins/apicurio/03-features.md +1 -3
- package/dist/docs/plugins/asyncapi/00-intro.md +2 -28
- package/dist/docs/plugins/asyncapi/01-installation.md +3 -54
- package/dist/docs/plugins/asyncapi/02-plugin-configuration.md +2 -1
- package/dist/docs/plugins/aws-glue-registry/00-intro.md +4 -32
- package/dist/docs/plugins/aws-glue-registry/00a-installation.md +3 -53
- package/dist/docs/plugins/azure-schema-registry/00-intro.md +4 -32
- package/dist/docs/plugins/azure-schema-registry/01-installation.md +6 -33
- package/dist/docs/plugins/azure-schema-registry/02-plugin-configuration.md +1 -14
- package/dist/docs/plugins/azure-schema-registry/04-examples.md +0 -2
- package/dist/docs/plugins/backstage/00-overview.md +1 -7
- package/dist/docs/plugins/backstage/01-get-started.md +6 -15
- package/dist/docs/plugins/backstage/06-configuration.md +2 -8
- package/dist/docs/plugins/confluent-schema-registry/00-intro.md +2 -29
- package/dist/docs/plugins/confluent-schema-registry/01-installation.md +2 -26
- package/dist/docs/plugins/eventbridge/00-intro.md +0 -4
- package/dist/docs/plugins/eventbridge/00a-installation.md +1 -87
- package/dist/docs/plugins/eventbridge/03-api.md +2 -20
- package/dist/docs/plugins/github/00-intro.md +0 -31
- package/dist/docs/plugins/github/01-installation.md +2 -34
- package/dist/docs/plugins/graphql/00-intro.md +0 -30
- package/dist/docs/plugins/graphql/01-installation.md +1 -53
- package/dist/docs/plugins/graphql/02-plugin-configuration.md +0 -1
- package/dist/docs/plugins/hookdeck/01-intro.md +1 -1
- package/dist/docs/plugins/openapi/00-intro.md +0 -30
- package/dist/docs/plugins/openapi/01-installation.md +1 -57
- package/dist/docs/plugins/openapi/02-plugin-configuration.md +0 -5
- package/dist/docs/plugins/openapi/03-features.md +0 -4
- package/dist/eventcatalog-config-file-utils.cjs +34 -41
- package/dist/eventcatalog-config-file-utils.d.cts +56 -58
- package/dist/eventcatalog-config-file-utils.d.ts +56 -58
- package/dist/eventcatalog-config-file-utils.js +1 -1
- package/dist/eventcatalog.cjs +408 -281
- package/dist/eventcatalog.config.d.cts +26 -15
- package/dist/eventcatalog.config.d.ts +26 -15
- package/dist/eventcatalog.js +46 -27
- package/dist/features.cjs +36 -49
- package/dist/features.d.cts +1 -3
- package/dist/features.d.ts +1 -3
- package/dist/features.js +4 -6
- package/dist/federation/federate.cjs +37 -44
- package/dist/federation/federate.js +5 -5
- package/dist/federation/source-provider.js +2 -2
- package/dist/generate.cjs +37 -42
- package/dist/generate.js +4 -4
- package/dist/resolve-catalog-dependencies.cjs +34 -41
- package/dist/resolve-catalog-dependencies.js +2 -2
- package/dist/runtime-dependencies/@eventcatalog__visualiser__studio-fonts.css.mjs +3 -0
- package/dist/runtime-dependencies/@eventcatalog__visualiser__studio.css.mjs +3 -0
- package/dist/runtime-dependencies/@eventcatalog__visualiser__studio.mjs +3 -0
- package/dist/runtime-dependencies/htmlparser2.mjs +3 -0
- package/dist/runtime-dependencies/manifest.json +5 -1
- package/dist/runtime-dependencies/react-syntax-highlighter__dist__cjs__create-element.js.mjs +3 -0
- package/dist/utils/child-process-signals.cjs +53 -0
- package/dist/utils/child-process-signals.d.cts +19 -0
- package/dist/utils/child-process-signals.d.ts +19 -0
- package/dist/utils/child-process-signals.js +6 -0
- package/dist/utils/cli-logger.cjs +1 -1
- package/dist/utils/cli-logger.js +2 -2
- package/dist/utils/license-status.cjs +11 -4
- package/dist/utils/license-status.d.cts +3 -2
- package/dist/utils/license-status.d.ts +3 -2
- package/dist/utils/license-status.js +1 -1
- package/eventcatalog/astro.config.mjs +21 -1
- package/eventcatalog/integrations/config-loader.mjs +56 -58
- package/eventcatalog/integrations/skip-startup-reload.mjs +31 -0
- package/eventcatalog/integrations/stable-dependency-order.mjs +29 -0
- package/eventcatalog/integrations/storage.mjs +20 -0
- package/eventcatalog/integrations/studio-server.mjs +4 -1
- package/eventcatalog/src/components/CatalogGraph/CatalogForceGraph.tsx +39 -0
- package/eventcatalog/src/components/ChatPanel/ChatPanel.tsx +2 -0
- package/eventcatalog/src/components/Homepage/CatalogDashboard.astro +342 -0
- package/eventcatalog/src/components/MDX/NodeGraph/AstroNodeGraph.tsx +60 -4
- package/eventcatalog/src/components/MDX/NodeGraph/NodeGraph.astro +5 -1
- package/eventcatalog/src/components/NavigationProgress.astro +7 -0
- package/eventcatalog/src/components/SchemaExplorer/ApiContentViewer.tsx +2 -0
- package/eventcatalog/src/components/SchemaExplorer/ExamplesViewer.tsx +2 -0
- package/eventcatalog/src/components/SchemaExplorer/SchemaCodeModal.tsx +2 -0
- package/eventcatalog/src/components/SchemaExplorer/SchemaContentViewer.tsx +2 -0
- package/eventcatalog/src/components/Search/SearchDataLoader.astro +16 -28
- package/eventcatalog/src/components/Search/SearchModal.tsx +2 -10
- package/eventcatalog/src/components/Search/search-utils.ts +26 -0
- package/eventcatalog/src/components/Seo.astro +5 -1
- package/eventcatalog/src/components/Settings/AssistantSettingsForm.tsx +53 -48
- package/eventcatalog/src/components/Settings/GeneralSettingsForm.tsx +183 -178
- package/eventcatalog/src/components/Settings/LicenseSettings.tsx +140 -31
- package/eventcatalog/src/components/Settings/LlmAccessSettingsForm.tsx +40 -35
- package/eventcatalog/src/components/Settings/LogoUpload.tsx +1 -1
- package/eventcatalog/src/components/Settings/McpSettingsForm.tsx +9 -8
- package/eventcatalog/src/components/Settings/Row.tsx +7 -4
- package/eventcatalog/src/components/Settings/SettingsShared.tsx +3 -3
- package/eventcatalog/src/components/SideNav/NestedSideBar/index.tsx +37 -76
- package/eventcatalog/src/components/SideNav/NestedSideBar/storage.ts +2 -0
- package/eventcatalog/src/components/SideNav/NestedSideBar/utils.ts +122 -1
- package/eventcatalog/src/components/SideNav/SideNav.astro +9 -1
- package/eventcatalog/src/components/TrialBadge.astro +20 -9
- package/eventcatalog/src/content.config.ts +19 -2
- package/eventcatalog/src/features/auth/error.astro +4 -2
- package/eventcatalog/src/features/auth/login.astro +2 -1
- package/eventcatalog/src/features/auth/middleware/middleware-auth.ts +21 -1
- package/eventcatalog/src/features/auth/unauthorized.astro +1 -1
- package/eventcatalog/src/features/fields/pages/fields.astro +1 -1
- package/eventcatalog/src/features/integrations/eventcatalog-features.ts +13 -7
- package/eventcatalog/src/features/mcp/apps/architecture-diagram/node-chat.tsx +6 -45
- package/eventcatalog/src/features/mcp/apps/canvas/shared.ts +3 -3
- package/eventcatalog/src/features/mcp/apps/canvas/styles.css +3 -1
- package/eventcatalog/src/features/mcp/apps/canvas/view.tsx +7 -5
- package/eventcatalog/src/features/mcp/apps/generated/canvas.html +123 -98
- package/eventcatalog/src/features/mcp/apps/generated/viewer.html +118 -101
- package/eventcatalog/src/features/mcp/mcp-server.ts +20 -4
- package/eventcatalog/src/features/server/start.ts +25 -0
- package/eventcatalog/src/features/storage/database.ts +88 -0
- package/eventcatalog/src/features/storage/migrations.ts +85 -0
- package/eventcatalog/src/features/storage/sql/database.sql +5 -0
- package/eventcatalog/src/features/storage/sql/migrations/0001-studio-canvases.sql +12 -0
- package/eventcatalog/src/features/storage/sql/migrations.sql +15 -0
- package/eventcatalog/src/features/storage/sql.ts +28 -0
- package/eventcatalog/src/features/studio/agent-choreography.ts +13 -10
- package/eventcatalog/src/features/studio/agents.ts +28 -0
- package/eventcatalog/src/features/studio/api/canvases-api.ts +219 -0
- package/eventcatalog/src/features/studio/api/canvases.ts +25 -0
- package/eventcatalog/src/features/studio/api/client.ts +40 -0
- package/eventcatalog/src/features/studio/canvas-actions.ts +160 -34
- package/eventcatalog/src/features/studio/canvas-preview.ts +1 -2
- package/eventcatalog/src/features/studio/catalog.ts +16 -14
- package/eventcatalog/src/features/studio/components/CanvasHeader.tsx +274 -105
- package/eventcatalog/src/features/studio/components/CanvasStatusMenu.tsx +15 -14
- package/eventcatalog/src/features/studio/components/ConnectAgentDialog.tsx +272 -119
- package/eventcatalog/src/features/studio/components/ConnectionsChooser.tsx +1 -2
- package/eventcatalog/src/features/studio/components/DeleteCanvasDialog.tsx +65 -0
- package/eventcatalog/src/features/studio/components/Dialog.tsx +60 -0
- package/eventcatalog/src/features/studio/components/JoinForm.tsx +101 -26
- package/eventcatalog/src/features/studio/components/LeftPanel.tsx +122 -230
- package/eventcatalog/src/features/studio/components/NodeDetails.tsx +183 -0
- package/eventcatalog/src/features/studio/components/OpenInStudioDialog.tsx +79 -0
- package/eventcatalog/src/features/studio/components/Presence.tsx +52 -45
- package/eventcatalog/src/features/studio/components/ShareDialog.tsx +277 -141
- package/eventcatalog/src/features/studio/components/ShortcutsDialog.tsx +41 -0
- package/eventcatalog/src/features/studio/components/StudioDesigner.tsx +1314 -385
- package/eventcatalog/src/features/studio/components/StudioNotice.astro +24 -0
- package/eventcatalog/src/features/studio/document-name.ts +7 -0
- package/eventcatalog/src/features/studio/from-visualiser.ts +138 -0
- package/eventcatalog/src/features/studio/hooks/presence-sender.ts +19 -2
- package/eventcatalog/src/features/studio/hooks/use-canvas-webmcp.ts +9 -3
- package/eventcatalog/src/features/studio/hooks/use-comments.ts +2 -2
- package/eventcatalog/src/features/studio/hooks/use-follow-camera.ts +8 -3
- package/eventcatalog/src/features/studio/hooks/use-studio-flow.ts +244 -32
- package/eventcatalog/src/features/studio/identity.ts +25 -1
- package/eventcatalog/src/features/studio/limits.ts +2 -0
- package/eventcatalog/src/features/studio/pages/[id].astro +42 -16
- package/eventcatalog/src/features/studio/pages/index.astro +596 -373
- package/eventcatalog/src/features/studio/pages/webmcp-relay.ts +12 -15
- package/eventcatalog/src/features/studio/server/canvas-mcp.ts +8 -23
- package/eventcatalog/src/features/studio/server/runtime.ts +150 -46
- package/eventcatalog/src/features/studio/server/sql/storage.sql +18 -0
- package/eventcatalog/src/features/studio/server/storage.ts +53 -73
- package/eventcatalog/src/features/studio/webmcp-relay/LICENSE +21 -0
- package/eventcatalog/src/features/studio/webmcp-relay/README.md +5 -0
- package/eventcatalog/src/features/studio/webmcp-relay/embed.js +2 -0
- package/eventcatalog/src/features/studio/webmcp-relay/widget.html +10 -0
- package/eventcatalog/src/features/studio/webmcp-relay/widget.js +1 -0
- package/eventcatalog/src/features/tools/catalog-tools.ts +3 -1
- package/eventcatalog/src/layouts/BaseLayout.astro +4 -4
- package/eventcatalog/src/layouts/SettingsLayout.astro +2 -2
- package/eventcatalog/src/layouts/VerticalSideBarLayout.astro +3 -2
- package/eventcatalog/src/pages/_index.astro +5 -342
- package/eventcatalog/src/pages/architecture/[type]/[id]/[version]/_index.data.spec.ts +2 -3
- package/eventcatalog/src/pages/architecture/[type]/[id]/[version]/_index.data.ts +0 -7
- package/eventcatalog/src/pages/architecture/[type]/[id]/[version]/index.astro +3 -1
- package/eventcatalog/src/pages/diagrams/[id]/[version]/_index.data.ts +0 -7
- package/eventcatalog/src/pages/diagrams/[id]/[version]/embed.astro +1 -0
- package/eventcatalog/src/pages/diagrams/[id]/[version]/index.astro +1 -0
- package/eventcatalog/src/pages/directory/[type]/_index.data.ts +5 -7
- package/eventcatalog/src/pages/directory/[type]/index.astro +3 -1
- package/eventcatalog/src/pages/discover/[type]/_index.data.ts +5 -7
- package/eventcatalog/src/pages/discover/[type]/index.astro +3 -1
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/[docVersion]/_index.data.ts +0 -7
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/[docVersion]/index.astro +1 -0
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/_index.data.ts +0 -7
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/index.astro +1 -0
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/_index.data.ts +0 -7
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/asyncapi/[filename].astro +3 -1
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/asyncapi/_[filename].data.ts +0 -7
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/changelog/_index.data.ts +0 -7
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/changelog/index.astro +1 -0
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/examples/[...filename].astro +1 -0
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/examples/_[...filename].data.ts +0 -4
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/field-lineage/_index.data.ts +0 -7
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/field-lineage/index.astro +1 -0
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/graphql/[filename].astro +3 -1
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/graphql/_[filename].data.ts +0 -7
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +1 -0
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/resources/_index.data.spec.ts +2 -3
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/resources/_index.data.ts +0 -7
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/resources/index.astro +1 -0
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/spec/[filename].astro +1 -0
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/spec/_[filename].data.ts +0 -7
- package/eventcatalog/src/pages/docs/[type]/[id]/_index.data.ts +0 -7
- package/eventcatalog/src/pages/docs/[type]/[id]/index.astro +2 -1
- package/eventcatalog/src/pages/docs/[type]/[id]/language/[dictionaryId]/_index.data.ts +0 -7
- package/eventcatalog/src/pages/docs/[type]/[id]/language/[dictionaryId]/index.astro +1 -0
- package/eventcatalog/src/pages/docs/[type]/[id]/language/_index.data.ts +0 -7
- package/eventcatalog/src/pages/docs/[type]/[id]/language/index.astro +1 -0
- package/eventcatalog/src/pages/docs/custom/[...path]/_index.data.ts +0 -7
- package/eventcatalog/src/pages/docs/custom/[...path]/index.astro +1 -0
- package/eventcatalog/src/pages/docs/services/[id]/[docType]/[docId]/index.astro +1 -1
- package/eventcatalog/src/pages/docs/services/[id]/[version]/resources/index.astro +1 -0
- package/eventcatalog/src/pages/docs/services/[id]/asyncapi/[filename].astro +1 -1
- package/eventcatalog/src/pages/docs/services/[id]/changelog/index.astro +1 -1
- package/eventcatalog/src/pages/docs/services/[id]/graphql/[filename].astro +1 -1
- package/eventcatalog/src/pages/docs/services/[id]/spec/[filename].astro +1 -1
- package/eventcatalog/src/pages/docs/teams/[id]/_index.data.ts +0 -7
- package/eventcatalog/src/pages/docs/teams/[id]/index.astro +1 -0
- package/eventcatalog/src/pages/docs/users/[id]/_index.data.ts +0 -7
- package/eventcatalog/src/pages/docs/users/[id]/index.astro +1 -0
- package/eventcatalog/src/pages/index.astro +4 -2
- package/eventcatalog/src/pages/schemas/[type]/[id]/[version]/_index.data.ts +0 -7
- package/eventcatalog/src/pages/schemas/[type]/[id]/[version]/index.astro +9 -1
- package/eventcatalog/src/pages/schemas/explorer/_index.data.ts +0 -7
- package/eventcatalog/src/pages/schemas/explorer/index.astro +4 -2
- package/eventcatalog/src/pages/settings/license.astro +9 -1
- package/eventcatalog/src/pages/triggers/[type]/[id]/[version]/_index.data.ts +0 -7
- package/eventcatalog/src/pages/triggers/[type]/[id]/[version]/index.astro +1 -0
- package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/_index.data.ts +0 -7
- package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/data/_index.data.ts +0 -7
- package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/data/index.astro +1 -0
- package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/entity-map/_index.data.ts +0 -7
- package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/entity-map/index.astro +1 -0
- package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/index.astro +1 -0
- package/eventcatalog/src/pages/visualiser/[type]/[id]/_index.data.ts +38 -0
- package/eventcatalog/src/pages/visualiser/[type]/[id]/index.astro +18 -41
- package/eventcatalog/src/pages/visualiser/designs/[id]/_index.data.ts +0 -7
- package/eventcatalog/src/pages/visualiser/designs/[id]/index.astro +2 -1
- package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/entity-map/_index.data.ts +0 -7
- package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/entity-map/index.astro +1 -0
- package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/index.astro +1 -0
- package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/systems-context/_index.data.ts +0 -7
- package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/systems-context/index.astro +1 -0
- package/eventcatalog/src/pages/visualiser/systems/[id]/[version]/context/_index.data.ts +0 -7
- package/eventcatalog/src/pages/visualiser/systems/[id]/[version]/context/index.astro +1 -0
- package/eventcatalog/src/pages/visualiser/systems/[id]/[version]/index.astro +1 -0
- package/eventcatalog/src/types/react-syntax-highlighter.d.ts +10 -0
- package/eventcatalog/src/utils/collections/flows.ts +20 -7
- package/eventcatalog/src/utils/collections/resource-owners.ts +8 -2
- package/eventcatalog/src/utils/collections/resources.ts +2 -0
- package/eventcatalog/src/utils/collections/util.ts +8 -4
- package/eventcatalog/src/utils/git.ts +11 -0
- package/eventcatalog/src/utils/homepage-dashboard.ts +143 -0
- package/eventcatalog/src/utils/license.ts +1 -1
- package/eventcatalog/src/utils/link-validation.ts +25 -19
- package/eventcatalog/src/utils/node-graphs/domain-entity-map.ts +3 -1
- package/eventcatalog/src/utils/node-graphs/domain-levels-node-graph.ts +3 -3
- package/eventcatalog/src/utils/node-graphs/field-node-graph.ts +4 -2
- package/eventcatalog/src/utils/node-graphs/layout-node-graph.ts +20 -1
- package/eventcatalog/src/utils/node-graphs/node-resource.ts +67 -0
- package/eventcatalog/src/utils/node-graphs/systems-node-graph.ts +1 -1
- package/eventcatalog/src/utils/page-loaders/hybrid-page.ts +4 -15
- package/eventcatalog/src/utils/page-title.ts +15 -0
- package/eventcatalog/src/utils/syntax-highlighter-renderer.ts +64 -0
- package/eventcatalog/src/utils/trial.ts +13 -0
- package/package.json +11 -11
- package/dist/docs/development/ask-your-architecture/05-skills/02-installation.md +0 -60
- package/dist/docs/development/ask-your-architecture/05-skills/_category_.json +0 -11
- package/dist/docs/development/ask-your-architecture/06-slack-integration/01-introduction.md +0 -63
- package/dist/docs/development/ask-your-architecture/06-slack-integration/02-slack-app-setup.md +0 -154
- package/dist/docs/development/ask-your-architecture/06-slack-integration/03-installation.md +0 -169
- package/dist/docs/development/ask-your-architecture/06-slack-integration/04-deployment.md +0 -236
- package/dist/docs/development/ask-your-architecture/06-slack-integration/05-usage.md +0 -140
- package/dist/docs/development/ask-your-architecture/06-slack-integration/06-troubleshooting.md +0 -268
- package/dist/docs/development/ask-your-architecture/06-slack-integration/_category_.json +0 -13
- package/dist/docs/development/guides/domains/06-visualize-domains/01-domain-integration-map.md +0 -40
- package/dist/runtime-dependencies/@mcp-b__webmcp-local-relay.mjs +0 -3
- package/eventcatalog/src/features/studio/canvas-doc.ts +0 -409
- package/eventcatalog/src/features/studio/clipboard.ts +0 -97
- package/eventcatalog/src/features/studio/components/CanvasControls.tsx +0 -154
- package/eventcatalog/src/features/studio/components/Comments.tsx +0 -770
- package/eventcatalog/src/features/studio/components/ContainerChooser.tsx +0 -145
- package/eventcatalog/src/features/studio/components/DragGhost.tsx +0 -115
- package/eventcatalog/src/features/studio/components/Picture.tsx +0 -21
- package/eventcatalog/src/features/studio/components/PropertiesPanel.tsx +0 -212
- package/eventcatalog/src/features/studio/components/canvas-nodes.tsx +0 -255
- package/eventcatalog/src/features/studio/components/icons.ts +0 -53
- package/eventcatalog/src/features/studio/components/status.ts +0 -51
- package/eventcatalog/src/features/studio/edges.ts +0 -56
- package/eventcatalog/src/features/studio/flow-state.ts +0 -92
- package/eventcatalog/src/features/studio/grouping.ts +0 -226
- package/eventcatalog/src/features/studio/layout.ts +0 -42
- package/eventcatalog/src/features/studio/levels.ts +0 -282
- package/eventcatalog/src/features/studio/node-types.ts +0 -205
- package/eventcatalog/src/features/studio/pages/new.astro +0 -24
- package/eventcatalog/src/features/studio/pages/wake.ts +0 -15
- package/eventcatalog/src/features/studio/placement.ts +0 -197
- package/eventcatalog/src/features/studio/studio.css +0 -273
- package/dist/{chunk-A2RZR3U4.js → chunk-6K7XZAYI.js} +3 -3
package/dist/eventcatalog.cjs
CHANGED
|
@@ -22,19 +22,19 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
22
|
mod
|
|
23
23
|
));
|
|
24
24
|
|
|
25
|
-
// ../../node_modules/.pnpm/tsup@8.5.0_jiti@2.7.0_postcss@8.5.
|
|
25
|
+
// ../../node_modules/.pnpm/tsup@8.5.0_jiti@2.7.0_postcss@8.5.29_tsx@4.23.15_typescript@5.9.3_yaml@2.9.1/node_modules/tsup/assets/cjs_shims.js
|
|
26
26
|
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
27
27
|
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
28
28
|
|
|
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_path21 = 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_path22 = __toESM(require("path"), 1);
|
|
36
36
|
var import_node_url2 = require("url");
|
|
37
|
-
var
|
|
37
|
+
var import_node_module3 = require("module");
|
|
38
38
|
|
|
39
39
|
// src/generate.js
|
|
40
40
|
var import_node_path3 = __toESM(require("path"), 1);
|
|
@@ -50,65 +50,58 @@ var import_promises = require("fs/promises");
|
|
|
50
50
|
var import_node_fs = require("fs");
|
|
51
51
|
var import_node_path = __toESM(require("path"), 1);
|
|
52
52
|
var import_node_url = require("url");
|
|
53
|
-
var
|
|
53
|
+
var import_node_module = require("module");
|
|
54
54
|
async function cleanup(projectDirectory) {
|
|
55
55
|
const filePath = import_node_path.default.join(projectDirectory, "eventcatalog.config.mjs");
|
|
56
56
|
if ((0, import_node_fs.existsSync)(filePath)) {
|
|
57
57
|
await (0, import_promises.rm)(filePath);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
var
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
var linkNodeModulesIntoTempDirectory = async ({ projectDirectory, tempDir }) => {
|
|
75
|
-
const nodeModulesDirectory = findNodeModulesDirectory(projectDirectory);
|
|
76
|
-
if (!nodeModulesDirectory) {
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
await (0, import_promises.symlink)(nodeModulesDirectory, import_node_path.default.join(tempDir, "node_modules"), "dir");
|
|
60
|
+
var hidesConfigModuleTypeWarning = false;
|
|
61
|
+
var loads = 0;
|
|
62
|
+
var hideConfigModuleTypeWarning = () => {
|
|
63
|
+
if (hidesConfigModuleTypeWarning) return;
|
|
64
|
+
hidesConfigModuleTypeWarning = true;
|
|
65
|
+
const emitWarning = process.emitWarning;
|
|
66
|
+
process.emitWarning = function(warning, ...args) {
|
|
67
|
+
const code = typeof args[0] === "object" ? args[0]?.code : args[1];
|
|
68
|
+
const message2 = typeof warning === "string" ? warning : warning?.message;
|
|
69
|
+
if (code === "MODULE_TYPELESS_PACKAGE_JSON" && message2?.includes("eventcatalog.config.js")) return;
|
|
70
|
+
return emitWarning.call(this, warning, ...args);
|
|
71
|
+
};
|
|
80
72
|
};
|
|
81
|
-
var
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
73
|
+
var AS_MODULE_QUERY = "eventcatalog-config-as-module";
|
|
74
|
+
var loadsMarkedConfigsAsModules = false;
|
|
75
|
+
var loadMarkedConfigsAsModules = () => {
|
|
76
|
+
if (loadsMarkedConfigsAsModules) return;
|
|
77
|
+
loadsMarkedConfigsAsModules = true;
|
|
78
|
+
const hook = `export async function load(url, context, nextLoad) {
|
|
79
|
+
return nextLoad(url, url.includes('${AS_MODULE_QUERY}=') ? { ...context, format: 'module' } : context);
|
|
80
|
+
}`;
|
|
81
|
+
(0, import_node_module.register)(`data:text/javascript,${encodeURIComponent(hook)}`);
|
|
82
|
+
};
|
|
83
|
+
var isCommonJSPackage = async (projectDirectory) => {
|
|
84
|
+
try {
|
|
85
|
+
const packageJson = JSON.parse(await (0, import_promises.readFile)(import_node_path.default.join(projectDirectory, "package.json"), "utf-8"));
|
|
86
|
+
return packageJson?.type === "commonjs";
|
|
87
|
+
} catch {
|
|
88
|
+
return false;
|
|
85
89
|
}
|
|
86
|
-
const tempDir = await (0, import_promises.mkdtemp)(import_node_path.default.join((0, import_node_os.tmpdir)(), "eventcatalog-config-"));
|
|
87
|
-
await linkNodeModulesIntoTempDirectory({ projectDirectory, tempDir });
|
|
88
|
-
return tempDir;
|
|
89
90
|
};
|
|
90
91
|
var getEventCatalogConfigFile = async (projectDirectory) => {
|
|
91
|
-
let tempDir;
|
|
92
92
|
try {
|
|
93
|
-
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
configFilePath = import_node_path.default.join(tempDir, "eventcatalog.config.mjs");
|
|
99
|
-
await (0, import_promises.copyFile)(import_node_path.default.join(projectDirectory, "eventcatalog.config.js"), configFilePath);
|
|
100
|
-
}
|
|
101
|
-
const configFileURL = `${(0, import_node_url.pathToFileURL)(configFilePath).href}?t=${Date.now()}`;
|
|
93
|
+
hideConfigModuleTypeWarning();
|
|
94
|
+
const asModule = await isCommonJSPackage(projectDirectory);
|
|
95
|
+
if (asModule) loadMarkedConfigsAsModules();
|
|
96
|
+
const configFileURL = (0, import_node_url.pathToFileURL)(import_node_path.default.join(projectDirectory, "eventcatalog.config.js")).href;
|
|
97
|
+
const query = `${asModule ? AS_MODULE_QUERY : "loaded"}=${Date.now()}-${loads++}`;
|
|
102
98
|
const config = await import(
|
|
103
99
|
/* @vite-ignore */
|
|
104
|
-
configFileURL
|
|
100
|
+
`${configFileURL}?${query}`
|
|
105
101
|
);
|
|
106
102
|
return config.default;
|
|
107
103
|
} finally {
|
|
108
104
|
await cleanup(projectDirectory);
|
|
109
|
-
if (tempDir) {
|
|
110
|
-
await (0, import_promises.rm)(tempDir, { recursive: true, force: true });
|
|
111
|
-
}
|
|
112
105
|
}
|
|
113
106
|
};
|
|
114
107
|
|
|
@@ -181,7 +174,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
|
|
|
181
174
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
182
175
|
|
|
183
176
|
// package.json
|
|
184
|
-
var version = "5.0.0
|
|
177
|
+
var version = "5.0.0";
|
|
185
178
|
|
|
186
179
|
// src/constants.ts
|
|
187
180
|
var VERSION = version;
|
|
@@ -295,16 +288,34 @@ var generate = async (PROJECT_DIRECTORY) => {
|
|
|
295
288
|
for (const { plugin } of errors) {
|
|
296
289
|
logger.error(` - ${plugin}`, "generator");
|
|
297
290
|
}
|
|
291
|
+
process.exitCode = 1;
|
|
298
292
|
}
|
|
299
293
|
} catch (error) {
|
|
300
294
|
console.error(error);
|
|
301
295
|
await cleanup(PROJECT_DIRECTORY);
|
|
296
|
+
process.exitCode = 1;
|
|
302
297
|
}
|
|
303
298
|
};
|
|
304
299
|
|
|
305
300
|
// src/analytics/analytics.js
|
|
306
301
|
var import_os = __toESM(require("os"), 1);
|
|
307
|
-
|
|
302
|
+
|
|
303
|
+
// src/analytics/telemetry.ts
|
|
304
|
+
var TELEMETRY_REQUEST_TIMEOUT_MS = 2e3;
|
|
305
|
+
var isOptOutEnvValue = (value) => {
|
|
306
|
+
if (typeof value !== "string") return false;
|
|
307
|
+
const normalized = value.trim().toLowerCase();
|
|
308
|
+
return normalized === "1" || normalized === "true";
|
|
309
|
+
};
|
|
310
|
+
var isTelemetryDisabled = (config, env) => {
|
|
311
|
+
if (isOptOutEnvValue(env.EVENTCATALOG_TELEMETRY_DISABLED)) return true;
|
|
312
|
+
if (isOptOutEnvValue(env.DO_NOT_TRACK)) return true;
|
|
313
|
+
return config?.telemetry === false;
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
// src/analytics/analytics.js
|
|
317
|
+
async function raiseEvent(eventData, config) {
|
|
318
|
+
if (isTelemetryDisabled(config, process.env)) return;
|
|
308
319
|
if (typeof eventData?.command !== "string" || typeof eventData?.cId !== "string") return;
|
|
309
320
|
const url = "https://queue.simpleanalyticscdn.com/events";
|
|
310
321
|
const userAgent = `@eventcatalog/eventcatalog@${VERSION} (${import_os.default.platform()}; ${import_os.default.arch()}; Node/${process.version})`;
|
|
@@ -326,7 +337,8 @@ async function raiseEvent(eventData) {
|
|
|
326
337
|
const response = await fetch(url, {
|
|
327
338
|
method: "POST",
|
|
328
339
|
headers,
|
|
329
|
-
body: JSON.stringify(payload)
|
|
340
|
+
body: JSON.stringify(payload),
|
|
341
|
+
signal: AbortSignal.timeout(TELEMETRY_REQUEST_TIMEOUT_MS)
|
|
330
342
|
});
|
|
331
343
|
if (!response.ok) {
|
|
332
344
|
throw new Error(`Failed to raise analytics event: ${response.status}`);
|
|
@@ -410,6 +422,9 @@ var import_license2 = require("@eventcatalog/license");
|
|
|
410
422
|
var TRIAL_LENGTH_DAYS = 60;
|
|
411
423
|
var LICENSE_FAQ_URL = "https://www.eventcatalog.dev/license-faq";
|
|
412
424
|
var LICENSE_RENEW_URL = "https://eventcatalog.cloud";
|
|
425
|
+
var BUY_BUSINESS_URL = "https://www.eventcatalog.dev/buy?source=cli";
|
|
426
|
+
var PRICING_URL = "https://www.eventcatalog.dev/pricing";
|
|
427
|
+
var FREE_USE_NOTE = "Under $10M revenue and $10M raised, an individual or an open-source project? You qualify for Free Use; get a free key at eventcatalog.cloud.";
|
|
413
428
|
var DAY_IN_MS = 24 * 60 * 60 * 1e3;
|
|
414
429
|
var getTrialStatus = (tsd, now = Date.now()) => {
|
|
415
430
|
if (typeof tsd !== "number" || !Number.isFinite(tsd) || tsd <= 0) return;
|
|
@@ -528,15 +543,17 @@ var formatDate = (date) => date.toLocaleDateString(void 0, { dateStyle: "medium"
|
|
|
528
543
|
var formatDays = (days) => `${days} ${days === 1 ? "day" : "days"}`;
|
|
529
544
|
var PLAIN = { bold: (text) => text, dim: (text) => text, link: (text) => text };
|
|
530
545
|
var COLOURS = { bold: import_picocolors2.default.bold, dim: import_picocolors2.default.dim, link: (text) => import_picocolors2.default.cyan(text) };
|
|
531
|
-
var render = ({ headline, rows, links }, colours) => {
|
|
546
|
+
var render = ({ headline, rows, links, note }, colours) => {
|
|
532
547
|
const width = Math.max(0, ...[...rows, ...links].map(([label]) => label.length));
|
|
533
548
|
const row = ([label, value]) => `${colours.dim(label.padEnd(width))} ${value}`;
|
|
534
549
|
return [
|
|
535
550
|
colours.bold(headline),
|
|
536
551
|
...rows.length ? ["", ...rows.map(row)] : [],
|
|
537
|
-
...links.length ? ["", ...links.map(([label, url]) => row([label, colours.link(url)]))] : []
|
|
552
|
+
...links.length ? ["", ...links.map(([label, url]) => row([label, colours.link(url)]))] : [],
|
|
553
|
+
...note?.length ? ["", ...note.map(colours.dim)] : []
|
|
538
554
|
].join("\n");
|
|
539
555
|
};
|
|
556
|
+
var FREE_USE_LINES = FREE_USE_NOTE.split(/(?<=\?) /);
|
|
540
557
|
var message = (content) => ({
|
|
541
558
|
...content,
|
|
542
559
|
text: render(content, PLAIN)
|
|
@@ -583,7 +600,8 @@ var getLicenseStatusMessage = (license, tsd, now = Date.now()) => {
|
|
|
583
600
|
color: trial.ended ? "yellow" : "green",
|
|
584
601
|
headline: trial.ended ? "Your EventCatalog trial has ended" : `You're on the ${TRIAL_LENGTH_DAYS}-day EventCatalog trial`,
|
|
585
602
|
rows: trialRows,
|
|
586
|
-
links: trial.ended ? [["Get a license", LICENSE_RENEW_URL], licensing] : [licensing]
|
|
603
|
+
links: trial.ended ? [["Get a license", LICENSE_RENEW_URL], ["Buy Business", BUY_BUSINESS_URL], licensing] : [["Buy a license", PRICING_URL], licensing],
|
|
604
|
+
note: trial.ended ? FREE_USE_LINES : void 0
|
|
587
605
|
});
|
|
588
606
|
}
|
|
589
607
|
if (license.state === "expired") {
|
|
@@ -597,7 +615,8 @@ var getLicenseStatusMessage = (license, tsd, now = Date.now()) => {
|
|
|
597
615
|
title: "EventCatalog license",
|
|
598
616
|
color: "yellow",
|
|
599
617
|
headline: "Your commercial license has expired",
|
|
600
|
-
|
|
618
|
+
// A catalog has a license or is on the trial: an expired license is renewed, not replaced by the trial
|
|
619
|
+
rows: [...licensedTo, ...expiredOn],
|
|
601
620
|
links: [renew, licensing]
|
|
602
621
|
});
|
|
603
622
|
}
|
|
@@ -624,6 +643,55 @@ var printLicenseStatus = (license, tsd) => {
|
|
|
624
643
|
);
|
|
625
644
|
};
|
|
626
645
|
|
|
646
|
+
// src/analytics/studio-usage.js
|
|
647
|
+
var import_node_fs3 = __toESM(require("fs"), 1);
|
|
648
|
+
var import_node_path6 = __toESM(require("path"), 1);
|
|
649
|
+
var DAY_IN_MS3 = 24 * 60 * 60 * 1e3;
|
|
650
|
+
var DEFAULT_DATABASE_PATH = ".eventcatalog/eventcatalog.db";
|
|
651
|
+
var getStudioMode = (configFile) => {
|
|
652
|
+
const enabled = configFile.studio?.enabled;
|
|
653
|
+
if (enabled === false) return "off";
|
|
654
|
+
return configFile.output === "server" && enabled === true ? "server" : "dev";
|
|
655
|
+
};
|
|
656
|
+
var getStorageType = (configFile) => configFile.storage?.type || "memory";
|
|
657
|
+
var loadSqlite = () => {
|
|
658
|
+
const emitWarning = process.emitWarning;
|
|
659
|
+
process.emitWarning = function(warning, ...args) {
|
|
660
|
+
const type = typeof args[0] === "object" ? args[0]?.type : args[0];
|
|
661
|
+
const message2 = typeof warning === "string" ? warning : warning?.message;
|
|
662
|
+
if (type === "ExperimentalWarning" && message2?.startsWith("SQLite")) return;
|
|
663
|
+
return emitWarning.call(this, warning, ...args);
|
|
664
|
+
};
|
|
665
|
+
try {
|
|
666
|
+
return process.getBuiltinModule?.("node:sqlite");
|
|
667
|
+
} catch {
|
|
668
|
+
return void 0;
|
|
669
|
+
} finally {
|
|
670
|
+
process.emitWarning = emitWarning;
|
|
671
|
+
}
|
|
672
|
+
};
|
|
673
|
+
var UNKNOWN = "canvases:unknown";
|
|
674
|
+
var serializeStudioUsage = (projectDirectory, configFile, now = Date.now()) => {
|
|
675
|
+
if (getStudioMode(configFile) === "off" || getStorageType(configFile) !== "sqlite") return UNKNOWN;
|
|
676
|
+
const file = import_node_path6.default.resolve(projectDirectory, configFile.storage.path ?? DEFAULT_DATABASE_PATH);
|
|
677
|
+
if (!import_node_fs3.default.existsSync(file)) return "canvases:0,changed7d:0,changed30d:0,deleted:0";
|
|
678
|
+
let database;
|
|
679
|
+
try {
|
|
680
|
+
const sqlite = loadSqlite();
|
|
681
|
+
if (!sqlite?.DatabaseSync) return UNKNOWN;
|
|
682
|
+
database = new sqlite.DatabaseSync(file, { readOnly: true });
|
|
683
|
+
const canvases = database.prepare(
|
|
684
|
+
"SELECT COUNT(*) AS total, SUM(updated_at >= ?) AS changed7d, SUM(updated_at >= ?) AS changed30d FROM studio_canvases"
|
|
685
|
+
).get(now - 7 * DAY_IN_MS3, now - 30 * DAY_IN_MS3);
|
|
686
|
+
const { deleted } = database.prepare("SELECT COUNT(*) AS deleted FROM studio_deleted_canvases").get();
|
|
687
|
+
return `canvases:${canvases.total},changed7d:${canvases.changed7d ?? 0},changed30d:${canvases.changed30d ?? 0},deleted:${deleted}`;
|
|
688
|
+
} catch {
|
|
689
|
+
return UNKNOWN;
|
|
690
|
+
} finally {
|
|
691
|
+
database?.close();
|
|
692
|
+
}
|
|
693
|
+
};
|
|
694
|
+
|
|
627
695
|
// src/analytics/log-build.js
|
|
628
696
|
var isMCPEnabled = (configFile) => configFile.output === "server" && (configFile.mcp?.enabled ?? true);
|
|
629
697
|
var getFeatures = async (configFile) => {
|
|
@@ -637,7 +705,9 @@ var getFeatures = async (configFile) => {
|
|
|
637
705
|
environments: Array.isArray(configFile.environments) && configFile.environments.length > 0,
|
|
638
706
|
output: configFile.output || "static",
|
|
639
707
|
mcp,
|
|
640
|
-
mcpAuth: mcp && (configFile.mcp?.auth?.enabled ?? false)
|
|
708
|
+
mcpAuth: mcp && (configFile.mcp?.auth?.enabled ?? false),
|
|
709
|
+
studio: getStudioMode(configFile),
|
|
710
|
+
storage: getStorageType(configFile)
|
|
641
711
|
};
|
|
642
712
|
};
|
|
643
713
|
var getDirectoryProvider = (source) => {
|
|
@@ -679,50 +749,70 @@ var toCloudResourceCounts = (counts) => ({
|
|
|
679
749
|
customPages: counts.customPages || 0,
|
|
680
750
|
customApis: counts.customApis || 0
|
|
681
751
|
});
|
|
682
|
-
var
|
|
752
|
+
var getEnabledCloudAnalytics = (configFile) => {
|
|
683
753
|
const analytics = configFile.cloud?.analytics;
|
|
684
|
-
if (!analytics?.enabled || !analytics.trackingId || !analytics.writeKey) return;
|
|
754
|
+
if (!analytics?.enabled || !analytics.trackingId || !analytics.writeKey) return null;
|
|
755
|
+
return analytics;
|
|
756
|
+
};
|
|
757
|
+
var reportCloudResourceInventory = async (configFile, resourceCounts) => {
|
|
758
|
+
const analytics = getEnabledCloudAnalytics(configFile);
|
|
759
|
+
if (!analytics) return;
|
|
685
760
|
const endpoint = analytics.endpoint || CLOUD_ANALYTICS_ENDPOINT;
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
761
|
+
try {
|
|
762
|
+
await fetch(endpoint, {
|
|
763
|
+
method: "POST",
|
|
764
|
+
headers: {
|
|
765
|
+
"Content-Type": "application/json",
|
|
766
|
+
"X-EventCatalog-Analytics-Key": analytics.writeKey
|
|
767
|
+
},
|
|
768
|
+
body: JSON.stringify({
|
|
769
|
+
trackingId: analytics.trackingId,
|
|
770
|
+
event: "catalog.resource_inventory_reported",
|
|
771
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
772
|
+
counts: toCloudResourceCounts(resourceCounts)
|
|
773
|
+
}),
|
|
774
|
+
signal: AbortSignal.timeout(TELEMETRY_REQUEST_TIMEOUT_MS)
|
|
775
|
+
});
|
|
776
|
+
} catch {
|
|
777
|
+
}
|
|
699
778
|
};
|
|
700
779
|
var main = async (projectDir, { command = "build", license } = {}) => {
|
|
701
780
|
try {
|
|
702
781
|
await verifyRequiredFieldsAreInCatalogConfigFile(projectDir);
|
|
703
782
|
const configFile = await getEventCatalogConfigFile(projectDir);
|
|
783
|
+
if (isTelemetryDisabled(configFile, process.env)) {
|
|
784
|
+
if (getEnabledCloudAnalytics(configFile)) {
|
|
785
|
+
const resourceCounts2 = await countResources(projectDir);
|
|
786
|
+
await reportCloudResourceInventory(configFile, resourceCounts2);
|
|
787
|
+
}
|
|
788
|
+
return;
|
|
789
|
+
}
|
|
704
790
|
const { cId, tsd, organizationName, generators = [] } = configFile;
|
|
705
791
|
const generatorNames = generators.length > 0 ? generators.map((generator) => generator[0]) : ["none"];
|
|
706
792
|
const features = await getFeatures(configFile);
|
|
707
793
|
const resourceCounts = await countResources(projectDir);
|
|
708
794
|
const contentHash = await hashCatalogContent(projectDir);
|
|
709
795
|
await reportCloudResourceInventory(configFile, resourceCounts);
|
|
710
|
-
await raiseEvent(
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
796
|
+
await raiseEvent(
|
|
797
|
+
{
|
|
798
|
+
command,
|
|
799
|
+
org: organizationName,
|
|
800
|
+
cId,
|
|
801
|
+
// Trial start date (unix ms) from eventcatalog.config.js
|
|
802
|
+
tsd,
|
|
803
|
+
// Commercial license or trial, and when each expires (unix ms)
|
|
804
|
+
...getLicenseAnalytics(license, tsd),
|
|
805
|
+
// CI redeploys and human-run builds are different signals; tag rather than suppress
|
|
806
|
+
ci: process.env.CI ? "true" : "false",
|
|
807
|
+
contentHash,
|
|
808
|
+
generators: generatorNames.toString(),
|
|
809
|
+
features: Object.keys(features).map((feature) => `${feature}:${features[feature]}`).join(","),
|
|
810
|
+
directorySources: serializeDirectorySources(configFile),
|
|
811
|
+
resources: serializeCounts(resourceCounts),
|
|
812
|
+
studio: serializeStudioUsage(projectDir, configFile)
|
|
813
|
+
},
|
|
814
|
+
configFile
|
|
815
|
+
);
|
|
726
816
|
} catch (error) {
|
|
727
817
|
}
|
|
728
818
|
};
|
|
@@ -740,8 +830,8 @@ async function watch(projectDirectory, catalogDirectory, callback = () => {
|
|
|
740
830
|
}
|
|
741
831
|
|
|
742
832
|
// src/resolve-catalog-dependencies.js
|
|
743
|
-
var
|
|
744
|
-
var
|
|
833
|
+
var import_node_path7 = __toESM(require("path"), 1);
|
|
834
|
+
var import_node_fs4 = __toESM(require("fs"), 1);
|
|
745
835
|
var import_gray_matter2 = __toESM(require("gray-matter"), 1);
|
|
746
836
|
var resolve_catalog_dependencies_default = async (catalogDir, core2) => {
|
|
747
837
|
const catalogConfig = await getEventCatalogConfigFile(catalogDir);
|
|
@@ -749,11 +839,11 @@ var resolve_catalog_dependencies_default = async (catalogDir, core2) => {
|
|
|
749
839
|
if (!dependencies) {
|
|
750
840
|
return;
|
|
751
841
|
}
|
|
752
|
-
const dependenciesDir =
|
|
753
|
-
if (
|
|
754
|
-
|
|
842
|
+
const dependenciesDir = import_node_path7.default.join(catalogDir, "dependencies");
|
|
843
|
+
if (import_node_fs4.default.existsSync(dependenciesDir)) {
|
|
844
|
+
import_node_fs4.default.rmSync(dependenciesDir, { recursive: true, force: true });
|
|
755
845
|
}
|
|
756
|
-
|
|
846
|
+
import_node_fs4.default.mkdirSync(dependenciesDir, { recursive: true });
|
|
757
847
|
const resourceTypes = Object.keys(dependencies);
|
|
758
848
|
for (const resourceType of resourceTypes) {
|
|
759
849
|
for (const dependency of dependencies[resourceType]) {
|
|
@@ -773,9 +863,9 @@ var resolve_catalog_dependencies_default = async (catalogDir, core2) => {
|
|
|
773
863
|
},
|
|
774
864
|
frontmatter
|
|
775
865
|
);
|
|
776
|
-
const resourceFile =
|
|
777
|
-
|
|
778
|
-
|
|
866
|
+
const resourceFile = import_node_path7.default.join(dependenciesDir, resourceType, dependency.id, `index.md`);
|
|
867
|
+
import_node_fs4.default.mkdirSync(import_node_path7.default.dirname(resourceFile), { recursive: true });
|
|
868
|
+
import_node_fs4.default.writeFileSync(resourceFile, markdown);
|
|
779
869
|
}
|
|
780
870
|
}
|
|
781
871
|
return;
|
|
@@ -785,8 +875,8 @@ var resolve_catalog_dependencies_default = async (catalogDir, core2) => {
|
|
|
785
875
|
var import_boxen2 = __toESM(require("boxen"), 1);
|
|
786
876
|
|
|
787
877
|
// src/features.ts
|
|
788
|
-
var
|
|
789
|
-
var
|
|
878
|
+
var import_node_path8 = require("path");
|
|
879
|
+
var import_node_fs5 = __toESM(require("fs"), 1);
|
|
790
880
|
var getProjectOutDir = async () => {
|
|
791
881
|
const config = await getEventCatalogConfigFile(process.env.PROJECT_DIR || "");
|
|
792
882
|
return config?.outDir || "dist";
|
|
@@ -795,17 +885,13 @@ var isOutputServer = async () => {
|
|
|
795
885
|
const config = await getEventCatalogConfigFile(process.env.PROJECT_DIR || "");
|
|
796
886
|
return config?.output === "server";
|
|
797
887
|
};
|
|
798
|
-
var isStudioEnabled = async () => {
|
|
799
|
-
const config = await getEventCatalogConfigFile(process.env.PROJECT_DIR || "");
|
|
800
|
-
return config?.output === "server" && config?.studio?.enabled === true;
|
|
801
|
-
};
|
|
802
888
|
var isIndexedSearchEnabled = async () => {
|
|
803
889
|
const config = await getEventCatalogConfigFile(process.env.PROJECT_DIR || "");
|
|
804
890
|
return config?.search?.type === "indexed";
|
|
805
891
|
};
|
|
806
892
|
var isAuthEnabled = async () => {
|
|
807
893
|
const directory = process.env.PROJECT_DIR || process.cwd();
|
|
808
|
-
const hasAuthConfig =
|
|
894
|
+
const hasAuthConfig = import_node_fs5.default.existsSync((0, import_node_path8.join)(directory, "eventcatalog.auth.js"));
|
|
809
895
|
return hasAuthConfig;
|
|
810
896
|
};
|
|
811
897
|
|
|
@@ -814,11 +900,11 @@ var import_update_notifier = __toESM(require("update-notifier"), 1);
|
|
|
814
900
|
var import_dotenv = __toESM(require("dotenv"), 1);
|
|
815
901
|
|
|
816
902
|
// src/migrations/message-channels-to-service-channels.ts
|
|
817
|
-
var
|
|
903
|
+
var import_node_fs6 = __toESM(require("fs"), 1);
|
|
818
904
|
var import_glob2 = require("glob");
|
|
819
|
-
var
|
|
905
|
+
var import_node_os = __toESM(require("os"), 1);
|
|
820
906
|
var import_gray_matter3 = __toESM(require("gray-matter"), 1);
|
|
821
|
-
var
|
|
907
|
+
var import_node_path9 = __toESM(require("path"), 1);
|
|
822
908
|
var DISABLE_CHANNEL_MIGRATION_ENV = "EVENTCATALOG_DISABLE_CHANNEL_MIGRATION";
|
|
823
909
|
var isChannelMigrationDisabled = () => {
|
|
824
910
|
return ["true", "1", "yes"].includes((process.env[DISABLE_CHANNEL_MIGRATION_ENV] ?? "").toLowerCase());
|
|
@@ -827,7 +913,7 @@ var message_channels_to_service_channels_default = async (dir2) => {
|
|
|
827
913
|
if (isChannelMigrationDisabled()) {
|
|
828
914
|
return { status: "skipped", message: `Channel migration disabled by ${DISABLE_CHANNEL_MIGRATION_ENV}` };
|
|
829
915
|
}
|
|
830
|
-
const PROJECT_DIR =
|
|
916
|
+
const PROJECT_DIR = import_node_path9.default.join(dir2 || process.env.PROJECT_DIR);
|
|
831
917
|
const messages = await (0, import_glob2.glob)(
|
|
832
918
|
[
|
|
833
919
|
"**/events/*/index.mdx",
|
|
@@ -850,7 +936,7 @@ var message_channels_to_service_channels_default = async (dir2) => {
|
|
|
850
936
|
cwd: PROJECT_DIR,
|
|
851
937
|
absolute: true,
|
|
852
938
|
nodir: true,
|
|
853
|
-
windowsPathsNoEscape:
|
|
939
|
+
windowsPathsNoEscape: import_node_os.default.platform() == "win32",
|
|
854
940
|
ignore: ["node_modules/**", "**/dist/**", "**/teams", "**/users", "**/package.json", "**/Dockerfile"]
|
|
855
941
|
}
|
|
856
942
|
);
|
|
@@ -867,7 +953,7 @@ var message_channels_to_service_channels_default = async (dir2) => {
|
|
|
867
953
|
}
|
|
868
954
|
);
|
|
869
955
|
const messagesWithChannels = messages.reduce((acc, message2) => {
|
|
870
|
-
const file =
|
|
956
|
+
const file = import_node_fs6.default.readFileSync(message2, "utf8");
|
|
871
957
|
const { data } = (0, import_gray_matter3.default)(file);
|
|
872
958
|
if (data.channels?.length > 0) {
|
|
873
959
|
acc.push({
|
|
@@ -881,7 +967,7 @@ var message_channels_to_service_channels_default = async (dir2) => {
|
|
|
881
967
|
return { status: "success", message: "No messages with channels found in the catalog" };
|
|
882
968
|
}
|
|
883
969
|
const servicesWithChannels = services.reduce((acc, service) => {
|
|
884
|
-
const file =
|
|
970
|
+
const file = import_node_fs6.default.readFileSync(service, "utf8");
|
|
885
971
|
const { data } = (0, import_gray_matter3.default)(file);
|
|
886
972
|
const isSending = data.sends?.some((send) => messagesWithChannels.some((message2) => message2.id === send.id));
|
|
887
973
|
const isReceiving = data.receives?.some(
|
|
@@ -896,7 +982,7 @@ var message_channels_to_service_channels_default = async (dir2) => {
|
|
|
896
982
|
return acc;
|
|
897
983
|
}, []);
|
|
898
984
|
for (const service of servicesWithChannels) {
|
|
899
|
-
const file =
|
|
985
|
+
const file = import_node_fs6.default.readFileSync(service.path, "utf8");
|
|
900
986
|
const { data } = (0, import_gray_matter3.default)(file);
|
|
901
987
|
const messagesTheServiceSendsThatNeedUpdating = data.sends?.filter((send) => messagesWithChannels.some((message2) => message2.id === send.id)) ?? [];
|
|
902
988
|
const messagesTheServiceReceivesThatNeedUpdating = data.receives?.filter((receive) => messagesWithChannels.some((message2) => message2.id === receive.id)) ?? [];
|
|
@@ -916,14 +1002,14 @@ var message_channels_to_service_channels_default = async (dir2) => {
|
|
|
916
1002
|
...newSends.length > 0 ? { sends: newSends } : {},
|
|
917
1003
|
...newReceives.length > 0 ? { receives: newReceives } : {}
|
|
918
1004
|
};
|
|
919
|
-
|
|
1005
|
+
import_node_fs6.default.writeFileSync(service.path, import_gray_matter3.default.stringify(file, newData));
|
|
920
1006
|
}
|
|
921
1007
|
}
|
|
922
1008
|
for (const message2 of messagesWithChannels) {
|
|
923
|
-
const file =
|
|
1009
|
+
const file = import_node_fs6.default.readFileSync(message2.path, "utf8");
|
|
924
1010
|
const parsed = (0, import_gray_matter3.default)(file);
|
|
925
1011
|
const { channels, ...newData } = parsed.data;
|
|
926
|
-
|
|
1012
|
+
import_node_fs6.default.writeFileSync(message2.path, import_gray_matter3.default.stringify(parsed.content, newData));
|
|
927
1013
|
}
|
|
928
1014
|
console.log("\u2714 Channels migrated to new services API");
|
|
929
1015
|
};
|
|
@@ -933,13 +1019,39 @@ var runMigrations = async (dir2) => {
|
|
|
933
1019
|
await message_channels_to_service_channels_default(dir2);
|
|
934
1020
|
};
|
|
935
1021
|
|
|
1022
|
+
// src/utils/child-process-signals.ts
|
|
1023
|
+
var import_node_os2 = require("os");
|
|
1024
|
+
var FORWARDED_SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
|
|
1025
|
+
var isRunning = (child) => child.exitCode === null && child.signalCode === null;
|
|
1026
|
+
var stopChildWithParent = (child, parent = process) => {
|
|
1027
|
+
let received;
|
|
1028
|
+
const onSignal = (signal) => {
|
|
1029
|
+
received = signal;
|
|
1030
|
+
if (isRunning(child)) child.kill(signal);
|
|
1031
|
+
};
|
|
1032
|
+
const onExit = () => {
|
|
1033
|
+
if (isRunning(child)) child.kill("SIGTERM");
|
|
1034
|
+
};
|
|
1035
|
+
for (const signal of FORWARDED_SIGNALS) parent.on(signal, onSignal);
|
|
1036
|
+
parent.on("exit", onExit);
|
|
1037
|
+
return {
|
|
1038
|
+
childClosed: () => {
|
|
1039
|
+
for (const signal of FORWARDED_SIGNALS) parent.off(signal, onSignal);
|
|
1040
|
+
parent.off("exit", onExit);
|
|
1041
|
+
if (!received) return false;
|
|
1042
|
+
parent.exit(128 + import_node_os2.constants.signals[received]);
|
|
1043
|
+
return true;
|
|
1044
|
+
}
|
|
1045
|
+
};
|
|
1046
|
+
};
|
|
1047
|
+
|
|
936
1048
|
// eventcatalog/src/features/fields/field-indexer.ts
|
|
937
|
-
var
|
|
938
|
-
var
|
|
1049
|
+
var import_node_path11 = __toESM(require("path"), 1);
|
|
1050
|
+
var import_node_fs8 = __toESM(require("fs"), 1);
|
|
939
1051
|
|
|
940
1052
|
// eventcatalog/src/features/fields/fields-db.ts
|
|
941
1053
|
var import_sql = __toESM(require("sql.js"), 1);
|
|
942
|
-
var
|
|
1054
|
+
var import_node_fs7 = __toESM(require("fs"), 1);
|
|
943
1055
|
var SCHEMA_SQL = `
|
|
944
1056
|
CREATE TABLE IF NOT EXISTS fields (
|
|
945
1057
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
@@ -1008,13 +1120,13 @@ var FieldsDatabase = class _FieldsDatabase {
|
|
|
1008
1120
|
this.dbPath = dbPath;
|
|
1009
1121
|
}
|
|
1010
1122
|
static async create(dbPath, options) {
|
|
1011
|
-
if (options?.recreate &&
|
|
1012
|
-
|
|
1123
|
+
if (options?.recreate && import_node_fs7.default.existsSync(dbPath)) {
|
|
1124
|
+
import_node_fs7.default.unlinkSync(dbPath);
|
|
1013
1125
|
}
|
|
1014
1126
|
const SQL = await (0, import_sql.default)();
|
|
1015
1127
|
let db;
|
|
1016
|
-
if (!options?.recreate &&
|
|
1017
|
-
const buffer =
|
|
1128
|
+
if (!options?.recreate && import_node_fs7.default.existsSync(dbPath)) {
|
|
1129
|
+
const buffer = import_node_fs7.default.readFileSync(dbPath);
|
|
1018
1130
|
db = new SQL.Database(buffer);
|
|
1019
1131
|
} else {
|
|
1020
1132
|
db = new SQL.Database();
|
|
@@ -1075,7 +1187,7 @@ var FieldsDatabase = class _FieldsDatabase {
|
|
|
1075
1187
|
save() {
|
|
1076
1188
|
const data = this.db.export();
|
|
1077
1189
|
const buffer = Buffer.from(data);
|
|
1078
|
-
|
|
1190
|
+
import_node_fs7.default.writeFileSync(this.dbPath, buffer);
|
|
1079
1191
|
}
|
|
1080
1192
|
queryFields(params) {
|
|
1081
1193
|
const {
|
|
@@ -1300,22 +1412,22 @@ function getAvroTypeName(type) {
|
|
|
1300
1412
|
function walkAvroRecord(schema, prefix, fields) {
|
|
1301
1413
|
if (!schema.fields || !Array.isArray(schema.fields)) return;
|
|
1302
1414
|
for (const field of schema.fields) {
|
|
1303
|
-
const
|
|
1415
|
+
const path21 = prefix ? `${prefix}.${field.name}` : field.name;
|
|
1304
1416
|
const isOptional = Array.isArray(field.type) && field.type.includes("null");
|
|
1305
1417
|
const typeName = getAvroTypeName(field.type);
|
|
1306
1418
|
fields.push({
|
|
1307
|
-
path:
|
|
1419
|
+
path: path21,
|
|
1308
1420
|
type: typeName,
|
|
1309
1421
|
description: field.doc || "",
|
|
1310
1422
|
required: !isOptional
|
|
1311
1423
|
});
|
|
1312
1424
|
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;
|
|
1313
1425
|
if (innerType) {
|
|
1314
|
-
walkAvroRecord(innerType,
|
|
1426
|
+
walkAvroRecord(innerType, path21, fields);
|
|
1315
1427
|
}
|
|
1316
1428
|
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;
|
|
1317
1429
|
if (arrayType && typeof arrayType.items === "object" && arrayType.items.type === "record") {
|
|
1318
|
-
walkAvroRecord(arrayType.items, `${
|
|
1430
|
+
walkAvroRecord(arrayType.items, `${path21}[]`, fields);
|
|
1319
1431
|
}
|
|
1320
1432
|
}
|
|
1321
1433
|
}
|
|
@@ -1346,32 +1458,32 @@ function walkJsonSchema(node, prefix, requiredList, rootSchema, fields) {
|
|
|
1346
1458
|
}
|
|
1347
1459
|
if (!node.properties) return;
|
|
1348
1460
|
for (const [name, prop] of Object.entries(node.properties)) {
|
|
1349
|
-
const
|
|
1461
|
+
const path21 = prefix ? `${prefix}.${name}` : name;
|
|
1350
1462
|
const isRequired = requiredList.includes(name);
|
|
1351
1463
|
if (prop.$ref) {
|
|
1352
1464
|
const resolved = resolveLocalRef(prop.$ref, rootSchema);
|
|
1353
1465
|
if (resolved) {
|
|
1354
1466
|
const rawRefType = resolved.type || "object";
|
|
1355
1467
|
const type2 = Array.isArray(rawRefType) ? [...rawRefType].sort().join(" | ") : rawRefType;
|
|
1356
|
-
fields.push({ path:
|
|
1468
|
+
fields.push({ path: path21, type: type2, description: resolved.description || "", required: isRequired });
|
|
1357
1469
|
if (resolved.properties) {
|
|
1358
|
-
walkJsonSchema(resolved,
|
|
1470
|
+
walkJsonSchema(resolved, path21, resolved.required || [], rootSchema, fields);
|
|
1359
1471
|
}
|
|
1360
1472
|
} else {
|
|
1361
|
-
fields.push({ path:
|
|
1473
|
+
fields.push({ path: path21, type: "$ref", description: "", required: isRequired });
|
|
1362
1474
|
}
|
|
1363
1475
|
continue;
|
|
1364
1476
|
}
|
|
1365
1477
|
const rawType = prop.type || (prop.enum ? "enum" : prop.$ref ? "$ref" : "object");
|
|
1366
1478
|
const typeList = Array.isArray(rawType) ? rawType : [rawType];
|
|
1367
1479
|
const type = Array.isArray(rawType) ? [...rawType].sort().join(" | ") : rawType;
|
|
1368
|
-
fields.push({ path:
|
|
1480
|
+
fields.push({ path: path21, type, description: prop.description || "", required: isRequired });
|
|
1369
1481
|
if (typeList.includes("object") && prop.properties) {
|
|
1370
|
-
walkJsonSchema(prop,
|
|
1482
|
+
walkJsonSchema(prop, path21, prop.required || [], rootSchema, fields);
|
|
1371
1483
|
}
|
|
1372
1484
|
if (typeList.includes("array") && prop.items) {
|
|
1373
1485
|
if (prop.items.type === "object" && prop.items.properties) {
|
|
1374
|
-
walkJsonSchema(prop.items, `${
|
|
1486
|
+
walkJsonSchema(prop.items, `${path21}[]`, prop.items.required || [], rootSchema, fields);
|
|
1375
1487
|
}
|
|
1376
1488
|
}
|
|
1377
1489
|
}
|
|
@@ -1388,22 +1500,22 @@ function resolveLocalRef(ref, rootSchema) {
|
|
|
1388
1500
|
}
|
|
1389
1501
|
|
|
1390
1502
|
// eventcatalog/integrations/runtime-paths.mjs
|
|
1391
|
-
var
|
|
1503
|
+
var import_node_path10 = __toESM(require("path"), 1);
|
|
1392
1504
|
function getRuntimePaths(projectDirectory, runtimeDirectory) {
|
|
1393
|
-
const project =
|
|
1394
|
-
const cacheDirectory =
|
|
1395
|
-
const runtime = runtimeDirectory ?
|
|
1505
|
+
const project = import_node_path10.default.resolve(projectDirectory);
|
|
1506
|
+
const cacheDirectory = import_node_path10.default.join(project, ".astro");
|
|
1507
|
+
const runtime = runtimeDirectory ? import_node_path10.default.resolve(runtimeDirectory) : import_node_path10.default.join(cacheDirectory, "eventcatalog");
|
|
1396
1508
|
return {
|
|
1397
1509
|
projectDirectory: project,
|
|
1398
1510
|
cacheDirectory,
|
|
1399
1511
|
runtimeDirectory: runtime,
|
|
1400
|
-
fieldsDatabasePath:
|
|
1512
|
+
fieldsDatabasePath: import_node_path10.default.join(runtime, ".eventcatalog", "fields.db")
|
|
1401
1513
|
};
|
|
1402
1514
|
}
|
|
1403
1515
|
|
|
1404
1516
|
// eventcatalog/src/features/fields/field-indexer.ts
|
|
1405
1517
|
function detectFormat(fileName) {
|
|
1406
|
-
const ext =
|
|
1518
|
+
const ext = import_node_path11.default.extname(fileName).toLowerCase();
|
|
1407
1519
|
if (ext === ".proto") return "proto";
|
|
1408
1520
|
if (ext === ".avro" || ext === ".avsc") return "avro";
|
|
1409
1521
|
return "json-schema";
|
|
@@ -1412,9 +1524,9 @@ async function buildFieldsIndex(catalogDir, outputDir) {
|
|
|
1412
1524
|
const sdkModule = await import("@eventcatalog/sdk");
|
|
1413
1525
|
const sdk = sdkModule.default(catalogDir);
|
|
1414
1526
|
const { fieldsDatabasePath: dbPath } = getRuntimePaths(catalogDir, outputDir || catalogDir);
|
|
1415
|
-
const dbDir =
|
|
1416
|
-
if (!
|
|
1417
|
-
|
|
1527
|
+
const dbDir = import_node_path11.default.dirname(dbPath);
|
|
1528
|
+
if (!import_node_fs8.default.existsSync(dbDir)) {
|
|
1529
|
+
import_node_fs8.default.mkdirSync(dbDir, { recursive: true });
|
|
1418
1530
|
}
|
|
1419
1531
|
const db = await FieldsDatabase.create(dbPath, { recreate: true });
|
|
1420
1532
|
const warnings = [];
|
|
@@ -1498,7 +1610,7 @@ async function buildFieldsIndex(catalogDir, outputDir) {
|
|
|
1498
1610
|
|
|
1499
1611
|
// src/search-indexer.ts
|
|
1500
1612
|
var import_promises4 = __toESM(require("fs/promises"), 1);
|
|
1501
|
-
var
|
|
1613
|
+
var import_node_path12 = __toESM(require("path"), 1);
|
|
1502
1614
|
var import_glob3 = require("glob");
|
|
1503
1615
|
var import_gray_matter4 = __toESM(require("gray-matter"), 1);
|
|
1504
1616
|
var RESOURCE_COLLECTIONS = {
|
|
@@ -1562,9 +1674,9 @@ var markdownToSearchText = (content) => {
|
|
|
1562
1674
|
};
|
|
1563
1675
|
var inferDocIdFromFile = (relativePath, frontmatterId) => {
|
|
1564
1676
|
if (frontmatterId) return frontmatterId;
|
|
1565
|
-
const fileName =
|
|
1677
|
+
const fileName = import_node_path12.default.posix.basename(removeExtension(relativePath));
|
|
1566
1678
|
if (fileName.toLowerCase() === "index") {
|
|
1567
|
-
return
|
|
1679
|
+
return import_node_path12.default.posix.basename(import_node_path12.default.posix.dirname(relativePath));
|
|
1568
1680
|
}
|
|
1569
1681
|
return stripNumericPrefix(fileName);
|
|
1570
1682
|
};
|
|
@@ -1582,7 +1694,7 @@ var findResourceSegment = (segments) => {
|
|
|
1582
1694
|
return match;
|
|
1583
1695
|
};
|
|
1584
1696
|
var readResourceFrontmatter = async (projectDir, resourcePath) => {
|
|
1585
|
-
const candidates = [
|
|
1697
|
+
const candidates = [import_node_path12.default.join(projectDir, resourcePath, "index.mdx"), import_node_path12.default.join(projectDir, resourcePath, "index.md")];
|
|
1586
1698
|
for (const candidate of candidates) {
|
|
1587
1699
|
try {
|
|
1588
1700
|
const file = await import_promises4.default.readFile(candidate, "utf8");
|
|
@@ -1607,7 +1719,7 @@ var deriveRecordFromPath = async ({
|
|
|
1607
1719
|
}
|
|
1608
1720
|
if (segments[0] === "docs") {
|
|
1609
1721
|
const customPath = normalizeUrlPath(removeExtension(segments.slice(1).join("/")));
|
|
1610
|
-
const title = data.title || data.label ||
|
|
1722
|
+
const title = data.title || data.label || import_node_path12.default.posix.basename(customPath) || "Custom docs";
|
|
1611
1723
|
return {
|
|
1612
1724
|
url: buildUrl(`/docs/custom/${customPath}`, config),
|
|
1613
1725
|
title,
|
|
@@ -1725,7 +1837,7 @@ var collectSearchRecords = async ({
|
|
|
1725
1837
|
files.map(async (file) => {
|
|
1726
1838
|
const raw = await import_promises4.default.readFile(file, "utf8");
|
|
1727
1839
|
const parsed = (0, import_gray_matter4.default)(raw);
|
|
1728
|
-
const relativePath = normalizePath(
|
|
1840
|
+
const relativePath = normalizePath(import_node_path12.default.relative(projectDir, file));
|
|
1729
1841
|
const baseRecord = await deriveRecordFromPath({
|
|
1730
1842
|
projectDir,
|
|
1731
1843
|
relativePath,
|
|
@@ -1773,7 +1885,7 @@ var getSearchOutputPath = ({
|
|
|
1773
1885
|
if (searchOutputPath) {
|
|
1774
1886
|
return searchOutputPath;
|
|
1775
1887
|
}
|
|
1776
|
-
return
|
|
1888
|
+
return import_node_path12.default.join(outDir, isServer ? "client" : "", "pagefind");
|
|
1777
1889
|
};
|
|
1778
1890
|
var buildSearchIndex = async ({ projectDir, outDir, config, isServer, searchOutputPath }) => {
|
|
1779
1891
|
const records = await collectSearchRecords({ projectDir, config });
|
|
@@ -1827,74 +1939,74 @@ ${errors.join("\n")}`);
|
|
|
1827
1939
|
};
|
|
1828
1940
|
|
|
1829
1941
|
// src/catalog-runtime.ts
|
|
1830
|
-
var
|
|
1831
|
-
var
|
|
1832
|
-
var
|
|
1833
|
-
var require2 = (0,
|
|
1942
|
+
var import_node_fs9 = __toESM(require("fs"), 1);
|
|
1943
|
+
var import_node_path13 = __toESM(require("path"), 1);
|
|
1944
|
+
var import_node_module2 = require("module");
|
|
1945
|
+
var require2 = (0, import_node_module2.createRequire)(importMetaUrl);
|
|
1834
1946
|
var writeIfChanged = (file, content) => {
|
|
1835
|
-
if (
|
|
1836
|
-
|
|
1837
|
-
|
|
1947
|
+
if (import_node_fs9.default.existsSync(file) && import_node_fs9.default.readFileSync(file, "utf8") === content) return;
|
|
1948
|
+
import_node_fs9.default.mkdirSync(import_node_path13.default.dirname(file), { recursive: true });
|
|
1949
|
+
import_node_fs9.default.writeFileSync(file, content);
|
|
1838
1950
|
};
|
|
1839
1951
|
var importPath = (file) => file.replace(/\\/g, "/");
|
|
1840
|
-
var hasLegacyCatalogRuntime = (projectDirectory) =>
|
|
1952
|
+
var hasLegacyCatalogRuntime = (projectDirectory) => import_node_fs9.default.existsSync(import_node_path13.default.join(projectDirectory, ".eventcatalog-core"));
|
|
1841
1953
|
var clearCatalogCache = (projectDirectory) => {
|
|
1842
1954
|
const { cacheDirectory } = getRuntimePaths(projectDirectory);
|
|
1843
|
-
|
|
1955
|
+
import_node_fs9.default.rmSync(cacheDirectory, { recursive: true, force: true });
|
|
1844
1956
|
};
|
|
1845
1957
|
var prepareCatalogRuntime = ({ projectDirectory, catalogDirectory, packageDirectory }) => {
|
|
1846
|
-
const runtime =
|
|
1847
|
-
const source =
|
|
1848
|
-
const project =
|
|
1958
|
+
const runtime = import_node_path13.default.resolve(catalogDirectory);
|
|
1959
|
+
const source = import_node_path13.default.resolve(packageDirectory);
|
|
1960
|
+
const project = import_node_path13.default.resolve(projectDirectory);
|
|
1849
1961
|
if (runtime === source || runtime === project) {
|
|
1850
1962
|
throw new Error("The catalog runtime must be separate from the project and installed application directories.");
|
|
1851
1963
|
}
|
|
1852
|
-
|
|
1964
|
+
import_node_fs9.default.mkdirSync(runtime, { recursive: true });
|
|
1853
1965
|
writeIfChanged(
|
|
1854
|
-
|
|
1855
|
-
`export { collections } from ${JSON.stringify(importPath(
|
|
1966
|
+
import_node_path13.default.join(runtime, "content.config.ts"),
|
|
1967
|
+
`export { collections } from ${JSON.stringify(importPath(import_node_path13.default.join(source, "src/content.config.ts")))};
|
|
1856
1968
|
`
|
|
1857
1969
|
);
|
|
1858
|
-
const packageTsconfig = JSON.parse(
|
|
1970
|
+
const packageTsconfig = JSON.parse(import_node_fs9.default.readFileSync(import_node_path13.default.join(source, "tsconfig.json"), "utf8"));
|
|
1859
1971
|
const paths = Object.fromEntries(
|
|
1860
1972
|
Object.entries(packageTsconfig.compilerOptions.paths).map(([alias, targets]) => [
|
|
1861
1973
|
alias,
|
|
1862
|
-
targets.map((target) => importPath(
|
|
1974
|
+
targets.map((target) => importPath(import_node_path13.default.resolve(source, target)))
|
|
1863
1975
|
])
|
|
1864
1976
|
);
|
|
1865
|
-
paths["@config"] = [importPath(
|
|
1866
|
-
paths["@catalog/styles"] = [importPath(
|
|
1977
|
+
paths["@config"] = [importPath(import_node_path13.default.join(project, "eventcatalog.config.js"))];
|
|
1978
|
+
paths["@catalog/styles"] = [importPath(import_node_path13.default.join(project, "eventcatalog.styles.css"))];
|
|
1867
1979
|
paths["@catalog/components/*"] = [
|
|
1868
|
-
importPath(
|
|
1869
|
-
importPath(
|
|
1980
|
+
importPath(import_node_path13.default.join(project, "components/*")),
|
|
1981
|
+
importPath(import_node_path13.default.join(project, "federated/components/*"))
|
|
1870
1982
|
];
|
|
1871
|
-
paths["@catalog/snippets/*"] = [importPath(
|
|
1983
|
+
paths["@catalog/snippets/*"] = [importPath(import_node_path13.default.join(project, "snippets/*"))];
|
|
1872
1984
|
for (const specifier of ["astro", "astro/zod", "astro/loaders", "astro/runtime/server/index.js"]) {
|
|
1873
1985
|
paths[specifier] = [importPath(require2.resolve(specifier).replace(/\.js$/, ".d.ts"))];
|
|
1874
1986
|
}
|
|
1875
1987
|
writeIfChanged(
|
|
1876
|
-
|
|
1988
|
+
import_node_path13.default.join(runtime, "tsconfig.json"),
|
|
1877
1989
|
JSON.stringify(
|
|
1878
1990
|
{
|
|
1879
|
-
extends: importPath(
|
|
1991
|
+
extends: importPath(import_node_path13.default.join(source, "tsconfig.json")),
|
|
1880
1992
|
compilerOptions: {
|
|
1881
1993
|
baseUrl: ".",
|
|
1882
1994
|
paths,
|
|
1883
1995
|
typeRoots: [
|
|
1884
|
-
importPath(
|
|
1885
|
-
importPath(
|
|
1886
|
-
importPath(
|
|
1887
|
-
importPath(
|
|
1996
|
+
importPath(import_node_path13.default.join(project, "node_modules/@types")),
|
|
1997
|
+
importPath(import_node_path13.default.join(source, "../node_modules/@types")),
|
|
1998
|
+
importPath(import_node_path13.default.join(source, "../node_modules")),
|
|
1999
|
+
importPath(import_node_path13.default.join(project, "node_modules"))
|
|
1888
2000
|
]
|
|
1889
2001
|
},
|
|
1890
2002
|
include: [
|
|
1891
|
-
importPath(
|
|
2003
|
+
importPath(import_node_path13.default.join(project, ".astro/types.d.ts")),
|
|
1892
2004
|
"content.config.ts",
|
|
1893
|
-
importPath(
|
|
1894
|
-
importPath(
|
|
2005
|
+
importPath(import_node_path13.default.join(project, "components/**/*")),
|
|
2006
|
+
importPath(import_node_path13.default.join(source, "src/**/*"))
|
|
1895
2007
|
],
|
|
1896
2008
|
// Keep legacy generated files out of checks on an existing checkout.
|
|
1897
|
-
exclude: (packageTsconfig.exclude ?? []).map((entry) => importPath(
|
|
2009
|
+
exclude: (packageTsconfig.exclude ?? []).map((entry) => importPath(import_node_path13.default.resolve(source, entry)))
|
|
1898
2010
|
},
|
|
1899
2011
|
null,
|
|
1900
2012
|
2
|
|
@@ -1974,8 +2086,8 @@ var createAstroDevLineFilter = () => {
|
|
|
1974
2086
|
};
|
|
1975
2087
|
|
|
1976
2088
|
// src/astro-config-path.ts
|
|
1977
|
-
var
|
|
1978
|
-
var getAstroConfigPath = (projectDirectory, configFile, paths =
|
|
2089
|
+
var import_node_path14 = __toESM(require("path"), 1);
|
|
2090
|
+
var getAstroConfigPath = (projectDirectory, configFile, paths = import_node_path14.default) => {
|
|
1979
2091
|
const relative = paths.relative(projectDirectory, configFile);
|
|
1980
2092
|
const projectRoot = paths.parse(paths.resolve(projectDirectory)).root.toLowerCase();
|
|
1981
2093
|
const configRoot = paths.parse(paths.resolve(configFile)).root.toLowerCase();
|
|
@@ -1990,18 +2102,18 @@ var getAstroConfigPath = (projectDirectory, configFile, paths = import_node_path
|
|
|
1990
2102
|
// src/federation/federate.ts
|
|
1991
2103
|
var import_node_crypto5 = require("crypto");
|
|
1992
2104
|
var import_promises10 = __toESM(require("fs/promises"), 1);
|
|
1993
|
-
var
|
|
2105
|
+
var import_node_path20 = __toESM(require("path"), 1);
|
|
1994
2106
|
var import_sdk3 = __toESM(require("@eventcatalog/sdk"), 1);
|
|
1995
2107
|
|
|
1996
2108
|
// src/federation/content-cache.ts
|
|
1997
2109
|
var import_node_crypto2 = require("crypto");
|
|
1998
2110
|
var import_promises5 = __toESM(require("fs/promises"), 1);
|
|
1999
|
-
var
|
|
2111
|
+
var import_node_path15 = __toESM(require("path"), 1);
|
|
2000
2112
|
var getContentHash = (content) => `sha256:${(0, import_node_crypto2.createHash)("sha256").update(content).digest("hex")}`;
|
|
2001
2113
|
var isContentHash = (key) => /^sha256:[a-f0-9]{64}$/i.test(key);
|
|
2002
2114
|
var createFederationContentCache = (projectDirectory, options = {}) => {
|
|
2003
|
-
const cacheDirectory =
|
|
2004
|
-
const getCachePath = (key) =>
|
|
2115
|
+
const cacheDirectory = import_node_path15.default.join(projectDirectory, ".eventcatalog-cache", "federation", "content");
|
|
2116
|
+
const getCachePath = (key) => import_node_path15.default.join(cacheDirectory, encodeURIComponent(key));
|
|
2005
2117
|
return {
|
|
2006
2118
|
async get(key) {
|
|
2007
2119
|
if (options.read === false || !isContentHash(key)) return void 0;
|
|
@@ -2188,20 +2300,20 @@ var getVisibleFederationDiagnostics = (diagnostics, verbose) => diagnostics.filt
|
|
|
2188
2300
|
|
|
2189
2301
|
// src/federation/output-transaction.ts
|
|
2190
2302
|
var import_promises6 = __toESM(require("fs/promises"), 1);
|
|
2191
|
-
var
|
|
2303
|
+
var import_node_path16 = __toESM(require("path"), 1);
|
|
2192
2304
|
var getSafePublicPath = (publicDirectory, relativePath) => {
|
|
2193
|
-
const normalizedPath =
|
|
2194
|
-
const unsafe = relativePath.length === 0 || relativePath.includes("\0") || relativePath.includes("\\") ||
|
|
2305
|
+
const normalizedPath = import_node_path16.default.posix.normalize(relativePath);
|
|
2306
|
+
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("../");
|
|
2195
2307
|
if (unsafe) return void 0;
|
|
2196
|
-
const destinationPath =
|
|
2197
|
-
const relativeDestinationPath =
|
|
2198
|
-
return relativeDestinationPath !== "" && relativeDestinationPath !== ".." && !relativeDestinationPath.startsWith(`..${
|
|
2308
|
+
const destinationPath = import_node_path16.default.resolve(publicDirectory, relativePath);
|
|
2309
|
+
const relativeDestinationPath = import_node_path16.default.relative(publicDirectory, destinationPath);
|
|
2310
|
+
return relativeDestinationPath !== "" && relativeDestinationPath !== ".." && !relativeDestinationPath.startsWith(`..${import_node_path16.default.sep}`) && !import_node_path16.default.isAbsolute(relativeDestinationPath) ? destinationPath : void 0;
|
|
2199
2311
|
};
|
|
2200
2312
|
var beginFederationOutputTransaction = async (projectDirectory, outDir, relativePublicPaths) => {
|
|
2201
|
-
const transactionDirectory = await import_promises6.default.mkdtemp(
|
|
2202
|
-
const previousOutDir =
|
|
2203
|
-
const publicBackupDirectory =
|
|
2204
|
-
const publicDirectory =
|
|
2313
|
+
const transactionDirectory = await import_promises6.default.mkdtemp(import_node_path16.default.join(projectDirectory, ".eventcatalog-federation-transaction-"));
|
|
2314
|
+
const previousOutDir = import_node_path16.default.join(transactionDirectory, "federated");
|
|
2315
|
+
const publicBackupDirectory = import_node_path16.default.join(transactionDirectory, "public");
|
|
2316
|
+
const publicDirectory = import_node_path16.default.resolve(projectDirectory, "public");
|
|
2205
2317
|
const publicSnapshots = [];
|
|
2206
2318
|
const missingPublicDirectories = /* @__PURE__ */ new Set();
|
|
2207
2319
|
let hadPreviousOutDir = false;
|
|
@@ -2212,8 +2324,8 @@ var beginFederationOutputTransaction = async (projectDirectory, outDir, relative
|
|
|
2212
2324
|
try {
|
|
2213
2325
|
const stat = await import_promises6.default.lstat(destinationPath);
|
|
2214
2326
|
if (!stat.isFile()) continue;
|
|
2215
|
-
const backupPath =
|
|
2216
|
-
await import_promises6.default.mkdir(
|
|
2327
|
+
const backupPath = import_node_path16.default.join(publicBackupDirectory, `${publicSnapshots.length}`);
|
|
2328
|
+
await import_promises6.default.mkdir(import_node_path16.default.dirname(backupPath), { recursive: true });
|
|
2217
2329
|
await import_promises6.default.copyFile(destinationPath, backupPath);
|
|
2218
2330
|
publicSnapshots.push({ backupPath, destinationPath, state: "file" });
|
|
2219
2331
|
} catch (error) {
|
|
@@ -2221,7 +2333,7 @@ var beginFederationOutputTransaction = async (projectDirectory, outDir, relative
|
|
|
2221
2333
|
if (code === "ENOTDIR") continue;
|
|
2222
2334
|
if (code !== "ENOENT") throw error;
|
|
2223
2335
|
publicSnapshots.push({ destinationPath, state: "missing" });
|
|
2224
|
-
let directory =
|
|
2336
|
+
let directory = import_node_path16.default.dirname(destinationPath);
|
|
2225
2337
|
while (directory !== publicDirectory) {
|
|
2226
2338
|
try {
|
|
2227
2339
|
await import_promises6.default.lstat(directory);
|
|
@@ -2231,7 +2343,7 @@ var beginFederationOutputTransaction = async (projectDirectory, outDir, relative
|
|
|
2231
2343
|
if (directoryCode === "ENOTDIR") break;
|
|
2232
2344
|
if (directoryCode !== "ENOENT") throw directoryError;
|
|
2233
2345
|
missingPublicDirectories.add(directory);
|
|
2234
|
-
directory =
|
|
2346
|
+
directory = import_node_path16.default.dirname(directory);
|
|
2235
2347
|
}
|
|
2236
2348
|
}
|
|
2237
2349
|
}
|
|
@@ -2267,7 +2379,7 @@ var beginFederationOutputTransaction = async (projectDirectory, outDir, relative
|
|
|
2267
2379
|
continue;
|
|
2268
2380
|
}
|
|
2269
2381
|
await attempt(async () => {
|
|
2270
|
-
await import_promises6.default.mkdir(
|
|
2382
|
+
await import_promises6.default.mkdir(import_node_path16.default.dirname(snapshot.destinationPath), { recursive: true });
|
|
2271
2383
|
await import_promises6.default.copyFile(snapshot.backupPath, snapshot.destinationPath);
|
|
2272
2384
|
});
|
|
2273
2385
|
}
|
|
@@ -2304,7 +2416,7 @@ var withFederationOutputTransaction = async (projectDirectory, outDir, relativeP
|
|
|
2304
2416
|
// src/federation/public-assets.ts
|
|
2305
2417
|
var import_node_crypto3 = require("crypto");
|
|
2306
2418
|
var import_promises7 = __toESM(require("fs/promises"), 1);
|
|
2307
|
-
var
|
|
2419
|
+
var import_node_path17 = __toESM(require("path"), 1);
|
|
2308
2420
|
var getContentHash2 = (content) => `sha256:${(0, import_node_crypto3.createHash)("sha256").update(content).digest("hex")}`;
|
|
2309
2421
|
var getFileHash = async (filePath) => {
|
|
2310
2422
|
try {
|
|
@@ -2316,13 +2428,13 @@ var getFileHash = async (filePath) => {
|
|
|
2316
2428
|
}
|
|
2317
2429
|
};
|
|
2318
2430
|
var getSafePath = (directory, relativePath) => {
|
|
2319
|
-
const normalizedPath =
|
|
2320
|
-
const unsafe = relativePath.length === 0 || relativePath.includes("\0") || relativePath.includes("\\") ||
|
|
2431
|
+
const normalizedPath = import_node_path17.default.posix.normalize(relativePath);
|
|
2432
|
+
const unsafe = relativePath.length === 0 || relativePath.includes("\0") || relativePath.includes("\\") || import_node_path17.default.posix.isAbsolute(relativePath) || /^[a-zA-Z]:\//.test(relativePath) || normalizedPath !== relativePath || normalizedPath === ".." || normalizedPath.startsWith("../");
|
|
2321
2433
|
if (unsafe) return void 0;
|
|
2322
|
-
const resolvedDirectory =
|
|
2323
|
-
const resolvedPath =
|
|
2324
|
-
const relativeResolvedPath =
|
|
2325
|
-
if (relativeResolvedPath === "" || relativeResolvedPath === ".." || relativeResolvedPath.startsWith(`..${
|
|
2434
|
+
const resolvedDirectory = import_node_path17.default.resolve(directory);
|
|
2435
|
+
const resolvedPath = import_node_path17.default.resolve(resolvedDirectory, relativePath);
|
|
2436
|
+
const relativeResolvedPath = import_node_path17.default.relative(resolvedDirectory, resolvedPath);
|
|
2437
|
+
if (relativeResolvedPath === "" || relativeResolvedPath === ".." || relativeResolvedPath.startsWith(`..${import_node_path17.default.sep}`) || import_node_path17.default.isAbsolute(relativeResolvedPath)) {
|
|
2326
2438
|
return void 0;
|
|
2327
2439
|
}
|
|
2328
2440
|
return resolvedPath;
|
|
@@ -2330,16 +2442,16 @@ var getSafePath = (directory, relativePath) => {
|
|
|
2330
2442
|
var listFiles = async (directory, relativeDirectory = "") => {
|
|
2331
2443
|
let entries;
|
|
2332
2444
|
try {
|
|
2333
|
-
entries = await import_promises7.default.readdir(
|
|
2445
|
+
entries = await import_promises7.default.readdir(import_node_path17.default.join(directory, relativeDirectory), { withFileTypes: true });
|
|
2334
2446
|
} catch (error) {
|
|
2335
2447
|
if (error.code === "ENOENT") return [];
|
|
2336
2448
|
throw error;
|
|
2337
2449
|
}
|
|
2338
2450
|
const files = await Promise.all(
|
|
2339
2451
|
entries.map(async (entry) => {
|
|
2340
|
-
const relativePath =
|
|
2452
|
+
const relativePath = import_node_path17.default.join(relativeDirectory, entry.name);
|
|
2341
2453
|
if (entry.isDirectory()) return listFiles(directory, relativePath);
|
|
2342
|
-
return entry.isFile() ? [relativePath.split(
|
|
2454
|
+
return entry.isFile() ? [relativePath.split(import_node_path17.default.sep).join("/")] : [];
|
|
2343
2455
|
})
|
|
2344
2456
|
);
|
|
2345
2457
|
return files.flat().sort();
|
|
@@ -2354,19 +2466,19 @@ var pathExists = async (filePath) => {
|
|
|
2354
2466
|
}
|
|
2355
2467
|
};
|
|
2356
2468
|
var hasBlockingParent = async (publicDirectory, destinationPath) => {
|
|
2357
|
-
let currentPath =
|
|
2469
|
+
let currentPath = import_node_path17.default.dirname(destinationPath);
|
|
2358
2470
|
while (currentPath !== publicDirectory) {
|
|
2359
2471
|
try {
|
|
2360
2472
|
if (!(await import_promises7.default.lstat(currentPath)).isDirectory()) return true;
|
|
2361
2473
|
} catch (error) {
|
|
2362
2474
|
if (error.code !== "ENOENT") throw error;
|
|
2363
2475
|
}
|
|
2364
|
-
currentPath =
|
|
2476
|
+
currentPath = import_node_path17.default.dirname(currentPath);
|
|
2365
2477
|
}
|
|
2366
2478
|
return false;
|
|
2367
2479
|
};
|
|
2368
2480
|
var pruneEmptyDirectories = async (publicDirectory, filePath) => {
|
|
2369
|
-
let currentPath =
|
|
2481
|
+
let currentPath = import_node_path17.default.dirname(filePath);
|
|
2370
2482
|
while (currentPath !== publicDirectory) {
|
|
2371
2483
|
try {
|
|
2372
2484
|
await import_promises7.default.rmdir(currentPath);
|
|
@@ -2374,7 +2486,7 @@ var pruneEmptyDirectories = async (publicDirectory, filePath) => {
|
|
|
2374
2486
|
if (!["ENOENT", "ENOTEMPTY"].includes(error.code ?? "")) throw error;
|
|
2375
2487
|
if (error.code === "ENOTEMPTY") return;
|
|
2376
2488
|
}
|
|
2377
|
-
currentPath =
|
|
2489
|
+
currentPath = import_node_path17.default.dirname(currentPath);
|
|
2378
2490
|
}
|
|
2379
2491
|
};
|
|
2380
2492
|
var composePublicAssets = async ({
|
|
@@ -2384,8 +2496,8 @@ var composePublicAssets = async ({
|
|
|
2384
2496
|
previousFiles = {},
|
|
2385
2497
|
collisionPaths = /* @__PURE__ */ new Set()
|
|
2386
2498
|
}) => {
|
|
2387
|
-
const publicDirectory =
|
|
2388
|
-
const federatedPublicDirectory =
|
|
2499
|
+
const publicDirectory = import_node_path17.default.resolve(projectDirectory, "public");
|
|
2500
|
+
const federatedPublicDirectory = import_node_path17.default.resolve(federatedDirectory, "public");
|
|
2389
2501
|
const sourceFiles = await listFiles(federatedPublicDirectory);
|
|
2390
2502
|
const sourceFileSet = new Set(sourceFiles);
|
|
2391
2503
|
const managedFiles = /* @__PURE__ */ new Set();
|
|
@@ -2421,7 +2533,7 @@ var composePublicAssets = async ({
|
|
|
2421
2533
|
const asset = publicAssetsByPath.get(relativePath);
|
|
2422
2534
|
if (!asset) throw new Error(`Cannot identify the source of federated public asset "${relativePath}"`);
|
|
2423
2535
|
const content = await import_promises7.default.readFile(sourcePath);
|
|
2424
|
-
await import_promises7.default.mkdir(
|
|
2536
|
+
await import_promises7.default.mkdir(import_node_path17.default.dirname(destinationPath), { recursive: true });
|
|
2425
2537
|
await import_promises7.default.writeFile(destinationPath, content);
|
|
2426
2538
|
files[relativePath] = { source: asset.resolvedFrom.source, hash: getContentHash2(content) };
|
|
2427
2539
|
copied += 1;
|
|
@@ -2434,17 +2546,17 @@ var composePublicAssets = async ({
|
|
|
2434
2546
|
// src/federation/filesystem-source-provider.ts
|
|
2435
2547
|
var import_node_crypto4 = require("crypto");
|
|
2436
2548
|
var import_promises8 = __toESM(require("fs/promises"), 1);
|
|
2437
|
-
var
|
|
2549
|
+
var import_node_path18 = __toESM(require("path"), 1);
|
|
2438
2550
|
var import_sdk = __toESM(require("@eventcatalog/sdk"), 1);
|
|
2439
2551
|
var FILESYSTEM_SOURCE_PREFIX = "file:";
|
|
2440
2552
|
var isWithinDirectory = (directory, target) => {
|
|
2441
|
-
const relativePath =
|
|
2442
|
-
return relativePath === "" || !relativePath.startsWith(`..${
|
|
2553
|
+
const relativePath = import_node_path18.default.relative(directory, target);
|
|
2554
|
+
return relativePath === "" || !relativePath.startsWith(`..${import_node_path18.default.sep}`) && relativePath !== ".." && !import_node_path18.default.isAbsolute(relativePath);
|
|
2443
2555
|
};
|
|
2444
2556
|
var assertPortableRelativePath = (filePath, label, allowRoot = true) => {
|
|
2445
2557
|
const portablePath = filePath.replaceAll("\\", "/");
|
|
2446
|
-
const normalizedPath =
|
|
2447
|
-
const isUnsafe = filePath.includes("\\") || filePath.includes("\0") ||
|
|
2558
|
+
const normalizedPath = import_node_path18.default.posix.normalize(portablePath);
|
|
2559
|
+
const isUnsafe = filePath.includes("\\") || filePath.includes("\0") || import_node_path18.default.posix.isAbsolute(normalizedPath) || /^[a-zA-Z]:\//.test(normalizedPath) || normalizedPath === ".." || normalizedPath.startsWith("../") || !allowRoot && (normalizedPath === "." || normalizedPath === "");
|
|
2448
2560
|
if (isUnsafe) throw new Error(`${label} "${filePath}" escapes its filesystem source`);
|
|
2449
2561
|
return normalizedPath;
|
|
2450
2562
|
};
|
|
@@ -2454,13 +2566,13 @@ var getSourceRoot = (projectDirectory, source) => {
|
|
|
2454
2566
|
}
|
|
2455
2567
|
const locator = source.source.slice(FILESYSTEM_SOURCE_PREFIX.length);
|
|
2456
2568
|
if (!locator.trim()) throw new Error(`Filesystem federation source "${source.id}" requires a path after "file:".`);
|
|
2457
|
-
return
|
|
2569
|
+
return import_node_path18.default.resolve(projectDirectory, locator);
|
|
2458
2570
|
};
|
|
2459
2571
|
var getCatalogDirectory = async (projectDirectory, source) => {
|
|
2460
2572
|
if (source.ref) throw new Error(`Filesystem federation source "${source.id}" does not support "ref".`);
|
|
2461
2573
|
const sourceRoot = getSourceRoot(projectDirectory, source);
|
|
2462
2574
|
const catalogPath = assertPortableRelativePath(source.path ?? ".", "Catalog path");
|
|
2463
|
-
const catalogDirectory =
|
|
2575
|
+
const catalogDirectory = import_node_path18.default.resolve(sourceRoot, ...catalogPath.split("/"));
|
|
2464
2576
|
if (!isWithinDirectory(sourceRoot, catalogDirectory)) {
|
|
2465
2577
|
throw new Error(`Catalog path "${source.path}" escapes source "${source.id}"`);
|
|
2466
2578
|
}
|
|
@@ -2482,7 +2594,7 @@ var getCatalogDirectory = async (projectDirectory, source) => {
|
|
|
2482
2594
|
};
|
|
2483
2595
|
var getArtifactPath = async (catalogDirectory, source, artifactPath) => {
|
|
2484
2596
|
const normalizedPath = assertPortableRelativePath(artifactPath, "Federated artifact path", false);
|
|
2485
|
-
const filePath =
|
|
2597
|
+
const filePath = import_node_path18.default.resolve(catalogDirectory, ...normalizedPath.split("/"));
|
|
2486
2598
|
if (!isWithinDirectory(catalogDirectory, filePath)) {
|
|
2487
2599
|
throw new Error(`Federated artifact path "${artifactPath}" escapes source "${source.id}"`);
|
|
2488
2600
|
}
|
|
@@ -2522,7 +2634,7 @@ var createFileSystemSourceProvider = (projectDirectory) => ({
|
|
|
2522
2634
|
var import_node_child_process = require("child_process");
|
|
2523
2635
|
var import_promises9 = __toESM(require("fs/promises"), 1);
|
|
2524
2636
|
var import_node_os3 = __toESM(require("os"), 1);
|
|
2525
|
-
var
|
|
2637
|
+
var import_node_path19 = __toESM(require("path"), 1);
|
|
2526
2638
|
var import_node_util = require("util");
|
|
2527
2639
|
var import_sdk2 = __toESM(require("@eventcatalog/sdk"), 1);
|
|
2528
2640
|
var execFileAsync = (0, import_node_util.promisify)(import_node_child_process.execFile);
|
|
@@ -2533,8 +2645,8 @@ var parseGitHubSource = (source) => {
|
|
|
2533
2645
|
};
|
|
2534
2646
|
var assertSafeCatalogPath = (source) => {
|
|
2535
2647
|
const catalogPath = source.path ?? ".";
|
|
2536
|
-
const normalized =
|
|
2537
|
-
if (catalogPath.includes("\\") ||
|
|
2648
|
+
const normalized = import_node_path19.default.posix.normalize(catalogPath.replaceAll("\\", "/"));
|
|
2649
|
+
if (catalogPath.includes("\\") || import_node_path19.default.posix.isAbsolute(normalized) || normalized === ".." || normalized.startsWith("../")) {
|
|
2538
2650
|
throw new Error(`Catalog path "${catalogPath}" escapes source "${source.id}"`);
|
|
2539
2651
|
}
|
|
2540
2652
|
};
|
|
@@ -2577,8 +2689,8 @@ var getGitEnvironment = (token) => {
|
|
|
2577
2689
|
};
|
|
2578
2690
|
var createCheckout = (executeFile, token) => async (source, ref, callback) => {
|
|
2579
2691
|
const { owner, repository } = parseGitHubSource(source);
|
|
2580
|
-
const catalogPath =
|
|
2581
|
-
const directory = await import_promises9.default.mkdtemp(
|
|
2692
|
+
const catalogPath = import_node_path19.default.posix.normalize(source.path ?? ".");
|
|
2693
|
+
const directory = await import_promises9.default.mkdtemp(import_node_path19.default.join(import_node_os3.default.tmpdir(), "eventcatalog-federation-"));
|
|
2582
2694
|
const env = getGitEnvironment(token);
|
|
2583
2695
|
try {
|
|
2584
2696
|
const git = (args) => executeFile("git", args, { cwd: directory, env, encoding: "utf8" });
|
|
@@ -2598,16 +2710,16 @@ var createCheckout = (executeFile, token) => async (source, ref, callback) => {
|
|
|
2598
2710
|
var generateIndex = async (source, ref, checkout, executeFile) => checkout(source, ref, async (directory) => {
|
|
2599
2711
|
const { stdout } = await executeFile("git", ["rev-parse", "HEAD"], { cwd: directory, encoding: "utf8" });
|
|
2600
2712
|
const commit = stdout.trim();
|
|
2601
|
-
const catalogDirectory =
|
|
2602
|
-
const relativeCatalogDirectory =
|
|
2603
|
-
if (relativeCatalogDirectory.startsWith("..") ||
|
|
2713
|
+
const catalogDirectory = import_node_path19.default.resolve(directory, source.path ?? ".");
|
|
2714
|
+
const relativeCatalogDirectory = import_node_path19.default.relative(directory, catalogDirectory);
|
|
2715
|
+
if (relativeCatalogDirectory.startsWith("..") || import_node_path19.default.isAbsolute(relativeCatalogDirectory)) {
|
|
2604
2716
|
throw new Error(`Catalog path "${source.path}" escapes source "${source.id}"`);
|
|
2605
2717
|
}
|
|
2606
2718
|
const index = await (0, import_sdk2.default)(catalogDirectory).buildIndex({ source: source.id, commit });
|
|
2607
2719
|
return { bytes: Buffer.from(JSON.stringify(index)), index, commit, generated: true };
|
|
2608
2720
|
});
|
|
2609
2721
|
var fetchPublishedIndex = async (source, ref, fetcher, token) => {
|
|
2610
|
-
const indexPath =
|
|
2722
|
+
const indexPath = import_node_path19.default.posix.join(source.path ?? ".", "catalog.index.json");
|
|
2611
2723
|
const bytes = await fetchBytes(source, ref, indexPath, fetcher, token);
|
|
2612
2724
|
if (!bytes) return void 0;
|
|
2613
2725
|
const index = (0, import_sdk2.parseIndex)(JSON.parse(bytes.toString("utf8")));
|
|
@@ -2630,7 +2742,7 @@ var createGitHubSourceProvider = (options = {}) => {
|
|
|
2630
2742
|
},
|
|
2631
2743
|
async fetchContent({ source, commit, path: artifactPath }) {
|
|
2632
2744
|
assertSafeCatalogPath(source);
|
|
2633
|
-
const catalogPath =
|
|
2745
|
+
const catalogPath = import_node_path19.default.posix.join(source.path ?? ".", artifactPath);
|
|
2634
2746
|
const content = await fetchBytes(source, commit, catalogPath, fetcher, token);
|
|
2635
2747
|
if (!content) throw new Error(`Federated artifact not found for "${source.id}": ${artifactPath}`);
|
|
2636
2748
|
return content;
|
|
@@ -2741,8 +2853,8 @@ var pathExists2 = async (filePath) => {
|
|
|
2741
2853
|
}
|
|
2742
2854
|
};
|
|
2743
2855
|
var cleanupPreviousFederation = async (projectDirectory, onProgress) => {
|
|
2744
|
-
const outDir =
|
|
2745
|
-
const lockPath =
|
|
2856
|
+
const outDir = import_node_path20.default.join(projectDirectory, "federated");
|
|
2857
|
+
const lockPath = import_node_path20.default.join(projectDirectory, "eventcatalog.lock");
|
|
2746
2858
|
const previousLock = await readLock(lockPath);
|
|
2747
2859
|
const hadFederatedOutput = await pathExists2(outDir);
|
|
2748
2860
|
const hadLock = previousLock !== void 0;
|
|
@@ -2802,8 +2914,8 @@ var federateCatalog = async (projectDirectory, options = {}) => {
|
|
|
2802
2914
|
throw new Error(`Failed to federate source "${source.id}": ${message2}`, { cause: error });
|
|
2803
2915
|
}
|
|
2804
2916
|
}
|
|
2805
|
-
const outDir =
|
|
2806
|
-
const lockPath =
|
|
2917
|
+
const outDir = import_node_path20.default.join(projectDirectory, "federated");
|
|
2918
|
+
const lockPath = import_node_path20.default.join(projectDirectory, "eventcatalog.lock");
|
|
2807
2919
|
const previousLock = await readLock(lockPath);
|
|
2808
2920
|
const resources = resolvedSources.reduce((total, source) => total + source.resolved.index.resources.length, 0);
|
|
2809
2921
|
const remoteIndexes = resolvedSources.map(({ resolved }) => resolved.index);
|
|
@@ -2915,16 +3027,17 @@ Run npm i @eventcatalog/core to update`;
|
|
|
2915
3027
|
};
|
|
2916
3028
|
|
|
2917
3029
|
// src/eventcatalog.ts
|
|
2918
|
-
var currentDir =
|
|
2919
|
-
var astroCli =
|
|
3030
|
+
var currentDir = import_node_path22.default.dirname((0, import_node_url2.fileURLToPath)(importMetaUrl));
|
|
3031
|
+
var astroCli = import_node_path22.default.join(import_node_path22.default.dirname((0, import_node_module3.createRequire)(importMetaUrl).resolve("astro/package.json")), "bin/astro.mjs");
|
|
3032
|
+
var ASTRO_IN_FOREGROUND = { ASTRO_DEV_BACKGROUND: "1", ASTRO_PREVIEW_BACKGROUND: "1" };
|
|
2920
3033
|
var program = new import_commander.Command().version(VERSION);
|
|
2921
|
-
var dir =
|
|
2922
|
-
var eventCatalogDir =
|
|
2923
|
-
var astroConfigPath = () => getAstroConfigPath(dir, (0,
|
|
3034
|
+
var dir = import_node_path22.default.resolve(process.env.PROJECT_DIR || process.cwd());
|
|
3035
|
+
var eventCatalogDir = import_node_path22.default.resolve((0, import_node_path21.join)(currentDir, "../eventcatalog/"));
|
|
3036
|
+
var astroConfigPath = () => getAstroConfigPath(dir, (0, import_node_path21.join)(eventCatalogDir, "astro.config.mjs"));
|
|
2924
3037
|
var { runtimeDirectory: core } = getRuntimePaths(dir);
|
|
2925
3038
|
var getInstalledEventCatalogVersion = () => {
|
|
2926
3039
|
try {
|
|
2927
|
-
const pkg = import_fs.default.readFileSync((0,
|
|
3040
|
+
const pkg = import_fs.default.readFileSync((0, import_node_path21.join)(dir, "package.json"), "utf8");
|
|
2928
3041
|
const json = JSON.parse(pkg);
|
|
2929
3042
|
return json.dependencies["@eventcatalog/core"];
|
|
2930
3043
|
} catch (error) {
|
|
@@ -2948,7 +3061,7 @@ var resolveDevPort = async ({ projectDir }) => {
|
|
|
2948
3061
|
};
|
|
2949
3062
|
var startDevPrewarm = ({
|
|
2950
3063
|
port = 3e3,
|
|
2951
|
-
paths = ["/
|
|
3064
|
+
paths = ["/"],
|
|
2952
3065
|
retries = 80,
|
|
2953
3066
|
intervalMs = 250,
|
|
2954
3067
|
initialDelayMs = 500
|
|
@@ -2957,10 +3070,13 @@ var startDevPrewarm = ({
|
|
|
2957
3070
|
const hit = (requestPath) => new Promise((resolve2) => {
|
|
2958
3071
|
const req = import_node_http.default.get(
|
|
2959
3072
|
{
|
|
2960
|
-
|
|
3073
|
+
// Not 127.0.0.1: the dev server can listen on IPv6 only ([::1]), which refused
|
|
3074
|
+
// every prewarm request
|
|
3075
|
+
hostname: "localhost",
|
|
2961
3076
|
port,
|
|
2962
3077
|
path: requestPath,
|
|
2963
|
-
|
|
3078
|
+
// A refused connection fails at once; once connected, let the first render finish
|
|
3079
|
+
timeout: 3e4
|
|
2964
3080
|
},
|
|
2965
3081
|
(res) => {
|
|
2966
3082
|
res.resume();
|
|
@@ -2990,12 +3106,12 @@ var startDevPrewarm = ({
|
|
|
2990
3106
|
var buildDevSearchIndex = async ({ config }) => {
|
|
2991
3107
|
const result = await buildSearchIndex({
|
|
2992
3108
|
projectDir: dir,
|
|
2993
|
-
outDir:
|
|
2994
|
-
searchOutputPath:
|
|
3109
|
+
outDir: import_node_path22.default.join(core, "public"),
|
|
3110
|
+
searchOutputPath: import_node_path22.default.join(core, "public", "pagefind"),
|
|
2995
3111
|
config,
|
|
2996
3112
|
isServer: false
|
|
2997
3113
|
});
|
|
2998
|
-
logger.info(`Indexed ${result.records} page(s) into ${
|
|
3114
|
+
logger.info(`Indexed ${result.records} page(s) into ${import_node_path22.default.relative(core, result.outputPath)}`, "search");
|
|
2999
3115
|
};
|
|
3000
3116
|
var warnIfIndexedSearchUsesAuth = async () => {
|
|
3001
3117
|
if (!await isAuthEnabled()) {
|
|
@@ -3058,10 +3174,14 @@ var runCommandWithFilteredOutput = async ({
|
|
|
3058
3174
|
cwd,
|
|
3059
3175
|
env: {
|
|
3060
3176
|
...process.env,
|
|
3177
|
+
// Astro sends usage data (commands, config, machine details) to Astro by default: turn it off
|
|
3178
|
+
// for everyone using EventCatalog
|
|
3179
|
+
ASTRO_TELEMETRY_DISABLED: "1",
|
|
3061
3180
|
...env
|
|
3062
3181
|
},
|
|
3063
3182
|
stdio: ["inherit", "pipe", "pipe"]
|
|
3064
3183
|
});
|
|
3184
|
+
const signals = stopChildWithParent(child);
|
|
3065
3185
|
let stdoutBuffer = "";
|
|
3066
3186
|
let stderrBuffer = "";
|
|
3067
3187
|
const flush = (buffer, writer, isFinal = false) => {
|
|
@@ -3089,11 +3209,13 @@ var runCommandWithFilteredOutput = async ({
|
|
|
3089
3209
|
stderrBuffer = flush(stderrBuffer, process.stderr);
|
|
3090
3210
|
});
|
|
3091
3211
|
child.on("error", (error) => {
|
|
3212
|
+
signals.childClosed();
|
|
3092
3213
|
reject(error);
|
|
3093
3214
|
});
|
|
3094
3215
|
child.on("close", (code) => {
|
|
3095
3216
|
stdoutBuffer = flush(stdoutBuffer, process.stdout, true);
|
|
3096
3217
|
stderrBuffer = flush(stderrBuffer, process.stderr, true);
|
|
3218
|
+
if (signals.childClosed()) return;
|
|
3097
3219
|
if (code === 0) {
|
|
3098
3220
|
resolve2();
|
|
3099
3221
|
return;
|
|
@@ -3171,8 +3293,8 @@ program.command("dev").description("Run development server of EventCatalog").opt
|
|
|
3171
3293
|
logger.info("Setting up EventCatalog...", "eventcatalog");
|
|
3172
3294
|
const isServer = await isOutputServer();
|
|
3173
3295
|
logger.info(isServer ? "EventCatalog is running in Server Mode" : "EventCatalog is running in Static Mode", "config");
|
|
3174
|
-
if (import_fs.default.existsSync(
|
|
3175
|
-
import_dotenv.default.config({ path:
|
|
3296
|
+
if (import_fs.default.existsSync(import_node_path22.default.join(dir, ".env"))) {
|
|
3297
|
+
import_dotenv.default.config({ path: import_node_path22.default.join(dir, ".env") });
|
|
3176
3298
|
}
|
|
3177
3299
|
if (options.debug) {
|
|
3178
3300
|
logger.info("Debug mode enabled", "debug");
|
|
@@ -3219,7 +3341,9 @@ program.command("dev").description("Run development server of EventCatalog").opt
|
|
|
3219
3341
|
});
|
|
3220
3342
|
startDevPrewarm({
|
|
3221
3343
|
port: prewarmPort,
|
|
3222
|
-
|
|
3344
|
+
// Renders the homepage before anyone opens it. Requests stop at the first response,
|
|
3345
|
+
// so a probe path like /ping first would leave the homepage cold.
|
|
3346
|
+
paths: ["/"]
|
|
3223
3347
|
});
|
|
3224
3348
|
}
|
|
3225
3349
|
await runCommandWithFilteredOutput({
|
|
@@ -3231,7 +3355,8 @@ program.command("dev").description("Run development server of EventCatalog").opt
|
|
|
3231
3355
|
CATALOG_DIR: core,
|
|
3232
3356
|
EVENTCATALOG_DEV_MODE: "true",
|
|
3233
3357
|
IGNORE_BUILD_ARTIFACTS: "true",
|
|
3234
|
-
NODE_NO_WARNINGS: "1"
|
|
3358
|
+
NODE_NO_WARNINGS: "1",
|
|
3359
|
+
...ASTRO_IN_FOREGROUND
|
|
3235
3360
|
},
|
|
3236
3361
|
shouldFilterLine: createAstroDevLineFilter(),
|
|
3237
3362
|
transformLine: replaceAstroReadyVersionLine
|
|
@@ -3247,8 +3372,8 @@ program.command("build").description("Run build of EventCatalog").action(async (
|
|
|
3247
3372
|
logger.info("Building EventCatalog...", "build");
|
|
3248
3373
|
const isServer = await isOutputServer();
|
|
3249
3374
|
logger.info(isServer ? "EventCatalog is running in Server Mode" : "EventCatalog is running in Static Mode", "config");
|
|
3250
|
-
if (import_fs.default.existsSync(
|
|
3251
|
-
import_dotenv.default.config({ path:
|
|
3375
|
+
if (import_fs.default.existsSync(import_node_path22.default.join(dir, ".env"))) {
|
|
3376
|
+
import_dotenv.default.config({ path: import_node_path22.default.join(dir, ".env") });
|
|
3252
3377
|
}
|
|
3253
3378
|
await verifyRequiredFieldsAreInCatalogConfigFile(dir);
|
|
3254
3379
|
const config = await getEventCatalogConfigFile(dir);
|
|
@@ -3285,7 +3410,7 @@ program.command("build").description("Run build of EventCatalog").action(async (
|
|
|
3285
3410
|
});
|
|
3286
3411
|
if (await isIndexedSearchEnabled()) {
|
|
3287
3412
|
await warnIfIndexedSearchUsesAuth();
|
|
3288
|
-
const outDir =
|
|
3413
|
+
const outDir = import_node_path22.default.resolve(dir, await getProjectOutDir());
|
|
3289
3414
|
logger.info("Building indexed search...", "search");
|
|
3290
3415
|
const result = await buildSearchIndex({
|
|
3291
3416
|
projectDir: dir,
|
|
@@ -3293,7 +3418,7 @@ program.command("build").description("Run build of EventCatalog").action(async (
|
|
|
3293
3418
|
config,
|
|
3294
3419
|
isServer
|
|
3295
3420
|
});
|
|
3296
|
-
logger.info(`Indexed ${result.records} page(s) into ${
|
|
3421
|
+
logger.info(`Indexed ${result.records} page(s) into ${import_node_path22.default.relative(dir, result.outputPath)}`, "search");
|
|
3297
3422
|
}
|
|
3298
3423
|
});
|
|
3299
3424
|
var previewCatalog = async ({ command }) => {
|
|
@@ -3303,7 +3428,8 @@ var previewCatalog = async ({ command }) => {
|
|
|
3303
3428
|
cwd: dir,
|
|
3304
3429
|
env: {
|
|
3305
3430
|
PROJECT_DIR: dir,
|
|
3306
|
-
CATALOG_DIR: core
|
|
3431
|
+
CATALOG_DIR: core,
|
|
3432
|
+
...ASTRO_IN_FOREGROUND
|
|
3307
3433
|
},
|
|
3308
3434
|
shouldFilterLine: createAstroLineFilter()
|
|
3309
3435
|
});
|
|
@@ -3312,18 +3438,18 @@ var SERVER_BOOTSTRAP = `
|
|
|
3312
3438
|
const entry = await import(process.argv[1]);
|
|
3313
3439
|
const { server } = entry.startServer();
|
|
3314
3440
|
globalThis[Symbol.for('eventcatalog.http-server')] = server.server;
|
|
3315
|
-
const
|
|
3316
|
-
if (
|
|
3441
|
+
const start = process.env.EVENTCATALOG_START_PATH;
|
|
3442
|
+
if (start) {
|
|
3317
3443
|
server.server.once('listening', () => {
|
|
3318
3444
|
// Where the server listens (HOST can be one address only); loopback when it listens on every address
|
|
3319
3445
|
const { address, port } = server.server.address();
|
|
3320
3446
|
const host = ['0.0.0.0', '::'].includes(address) ? '127.0.0.1' : address.includes(':') ? '[' + address + ']' : address;
|
|
3321
|
-
fetch('http://' + host + ':' + port +
|
|
3447
|
+
fetch('http://' + host + ':' + port + start).catch((error) => console.error('[eventcatalog] Could not start the server:', error.message));
|
|
3322
3448
|
});
|
|
3323
3449
|
}
|
|
3324
3450
|
`;
|
|
3325
3451
|
var startServerCatalog = async () => {
|
|
3326
|
-
const serverEntryPath =
|
|
3452
|
+
const serverEntryPath = import_node_path22.default.join(dir, "dist", "server", "entry.mjs");
|
|
3327
3453
|
const config = await getEventCatalogConfigFile(dir);
|
|
3328
3454
|
const base = (config?.base || "/").replace(/\/$/, "");
|
|
3329
3455
|
await runCommandWithFilteredOutput({
|
|
@@ -3334,7 +3460,7 @@ var startServerCatalog = async () => {
|
|
|
3334
3460
|
PROJECT_DIR: dir,
|
|
3335
3461
|
CATALOG_DIR: core,
|
|
3336
3462
|
ASTRO_NODE_AUTOSTART: "disabled",
|
|
3337
|
-
|
|
3463
|
+
EVENTCATALOG_START_PATH: `${base}/_eventcatalog/start`
|
|
3338
3464
|
},
|
|
3339
3465
|
shouldFilterLine: createAstroLineFilter()
|
|
3340
3466
|
});
|
|
@@ -3342,20 +3468,21 @@ var startServerCatalog = async () => {
|
|
|
3342
3468
|
program.command("preview").description("Serves the contents of your eventcatalog build directory").action(async (options, command) => {
|
|
3343
3469
|
logger.welcome();
|
|
3344
3470
|
logger.info("Starting preview of your build...", "preview");
|
|
3345
|
-
if (import_fs.default.existsSync(
|
|
3346
|
-
import_dotenv.default.config({ path:
|
|
3471
|
+
if (import_fs.default.existsSync(import_node_path22.default.join(dir, ".env"))) {
|
|
3472
|
+
import_dotenv.default.config({ path: import_node_path22.default.join(dir, ".env") });
|
|
3347
3473
|
}
|
|
3348
3474
|
await previewCatalog({ command });
|
|
3349
3475
|
});
|
|
3350
3476
|
program.command("start").description("Serves the contents of your eventcatalog build directory").action(async (options, command) => {
|
|
3351
3477
|
logger.welcome();
|
|
3352
3478
|
logger.info("Starting preview of your build...", "preview");
|
|
3353
|
-
if (import_fs.default.existsSync(
|
|
3354
|
-
import_dotenv.default.config({ path:
|
|
3479
|
+
if (import_fs.default.existsSync(import_node_path22.default.join(dir, ".env"))) {
|
|
3480
|
+
import_dotenv.default.config({ path: import_node_path22.default.join(dir, ".env") });
|
|
3355
3481
|
}
|
|
3356
3482
|
const isServerOutput = await isOutputServer();
|
|
3357
3483
|
if (isServerOutput) {
|
|
3358
|
-
await getLicenseStatus2(dir);
|
|
3484
|
+
const license = await getLicenseStatus2(dir);
|
|
3485
|
+
void log_build_default(dir, { command: "start", license });
|
|
3359
3486
|
await startServerCatalog();
|
|
3360
3487
|
} else {
|
|
3361
3488
|
await previewCatalog({ command });
|
|
@@ -3364,22 +3491,22 @@ program.command("start").description("Serves the contents of your eventcatalog b
|
|
|
3364
3491
|
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) => {
|
|
3365
3492
|
logger.welcome();
|
|
3366
3493
|
logger.info("Exporting EventCatalog...", "export");
|
|
3367
|
-
if (import_fs.default.existsSync(
|
|
3368
|
-
import_dotenv.default.config({ path:
|
|
3494
|
+
if (import_fs.default.existsSync(import_node_path22.default.join(dir, ".env"))) {
|
|
3495
|
+
import_dotenv.default.config({ path: import_node_path22.default.join(dir, ".env") });
|
|
3369
3496
|
}
|
|
3370
3497
|
const { default: initSDK } = await import("@eventcatalog/sdk");
|
|
3371
3498
|
const sdk = initSDK(dir);
|
|
3372
3499
|
const catalog = await sdk.dumpCatalog({ includeMarkdown: options.includeMarkdown });
|
|
3373
|
-
const exportsDir =
|
|
3500
|
+
const exportsDir = import_node_path22.default.join(dir, "exports");
|
|
3374
3501
|
ensureDir(exportsDir);
|
|
3375
3502
|
const date = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
3376
|
-
const exportFile =
|
|
3503
|
+
const exportFile = import_node_path22.default.join(exportsDir, `catalog-${date}.json`);
|
|
3377
3504
|
import_fs.default.writeFileSync(exportFile, JSON.stringify(catalog, null, 2), "utf-8");
|
|
3378
3505
|
logger.info(`Catalog exported to ${exportFile}`, "export");
|
|
3379
3506
|
});
|
|
3380
3507
|
program.command("generate [siteDir]").description("Start the generator scripts.").action(async () => {
|
|
3381
|
-
if (import_fs.default.existsSync(
|
|
3382
|
-
import_dotenv.default.config({ path:
|
|
3508
|
+
if (import_fs.default.existsSync(import_node_path22.default.join(dir, ".env"))) {
|
|
3509
|
+
import_dotenv.default.config({ path: import_node_path22.default.join(dir, ".env") });
|
|
3383
3510
|
}
|
|
3384
3511
|
await generate(dir);
|
|
3385
3512
|
});
|
|
@@ -3452,7 +3579,7 @@ var reportFederationProgress = (event, verbose = false) => {
|
|
|
3452
3579
|
}
|
|
3453
3580
|
return;
|
|
3454
3581
|
case "hydrating":
|
|
3455
|
-
logger.info(`Hydrating federated content into ${
|
|
3582
|
+
logger.info(`Hydrating federated content into ${import_node_path22.default.relative(dir, event.outDir)}/...`, "federation");
|
|
3456
3583
|
return;
|
|
3457
3584
|
case "hydrate:cache":
|
|
3458
3585
|
if (event.files === 1 || event.files % 25 === 0) {
|
|
@@ -3475,13 +3602,13 @@ var reportFederationProgress = (event, verbose = false) => {
|
|
|
3475
3602
|
`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)`,
|
|
3476
3603
|
"federation"
|
|
3477
3604
|
);
|
|
3478
|
-
logger.info(`Recorded resolved source state in ${
|
|
3605
|
+
logger.info(`Recorded resolved source state in ${import_node_path22.default.relative(dir, event.result.lockPath)}`, "federation");
|
|
3479
3606
|
}
|
|
3480
3607
|
};
|
|
3481
3608
|
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) => {
|
|
3482
3609
|
logger.welcome();
|
|
3483
|
-
if (import_fs.default.existsSync(
|
|
3484
|
-
import_dotenv.default.config({ path:
|
|
3610
|
+
if (import_fs.default.existsSync(import_node_path22.default.join(dir, ".env"))) {
|
|
3611
|
+
import_dotenv.default.config({ path: import_node_path22.default.join(dir, ".env") });
|
|
3485
3612
|
}
|
|
3486
3613
|
logger.info("Starting federation...", "federation");
|
|
3487
3614
|
let cleanedPreviousOutput = false;
|
|
@@ -3502,7 +3629,7 @@ program.addHelpText(
|
|
|
3502
3629
|
Example: npx eventcatalog dev --debug -- --env=production --port=3000
|
|
3503
3630
|
`
|
|
3504
3631
|
);
|
|
3505
|
-
program.parseAsync().then(() => process.exit(
|
|
3632
|
+
program.parseAsync().then(() => process.exit()).catch((err) => {
|
|
3506
3633
|
if (!(err instanceof FederationConflictError) && !(err instanceof FederationDiagnosticError)) console.error(err);
|
|
3507
3634
|
process.exit(1);
|
|
3508
3635
|
});
|