@eventcatalog/core 4.11.2 → 4.12.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analytics/analytics.cjs +1 -1
- package/dist/analytics/analytics.js +2 -2
- package/dist/analytics/log-build.cjs +17 -11
- package/dist/analytics/log-build.js +4 -4
- package/dist/astro-config-path.cjs +51 -0
- package/dist/astro-config-path.d.cts +6 -0
- package/dist/astro-config-path.d.ts +6 -0
- package/dist/astro-config-path.js +6 -0
- package/dist/catalog-runtime.cjs +136 -0
- package/dist/catalog-runtime.d.cts +12 -0
- package/dist/catalog-runtime.d.ts +12 -0
- package/dist/catalog-runtime.js +8 -0
- package/dist/{chunk-B7HCX5HM.js → chunk-3SJDIENM.js} +1 -1
- package/dist/{chunk-Z6OKCHWL.js → chunk-C326DCDM.js} +2 -2
- package/dist/{chunk-6U72KINX.js → chunk-DJCOJ77J.js} +1 -0
- package/dist/{chunk-LHR4G2UO.js → chunk-EEZXGNF6.js} +1 -1
- package/dist/{chunk-XMRPNDXB.js → chunk-FZEJ62MJ.js} +1 -1
- package/dist/{chunk-6QENHZZP.js → chunk-JE6RX7SJ.js} +11 -5
- package/dist/{chunk-2YJRF4ZX.js → chunk-RYPZGCRN.js} +1 -1
- package/dist/chunk-SAN4U2WU.js +96 -0
- package/dist/{chunk-LAWEGSJH.js → chunk-SETCQKS3.js} +1 -1
- package/dist/{chunk-AFPH6ERZ.js → chunk-TI3Y63NZ.js} +1 -1
- package/dist/chunk-U63GDPPY.js +14 -0
- package/dist/chunk-VIJJ7JKH.js +17 -0
- package/dist/{chunk-EGH3ALRY.js → chunk-ZER6HESL.js} +4 -4
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog-config-file-utils.cjs +13 -7
- package/dist/eventcatalog-config-file-utils.d.cts +86 -2
- package/dist/eventcatalog-config-file-utils.d.ts +86 -2
- package/dist/eventcatalog-config-file-utils.js +1 -1
- package/dist/eventcatalog.cjs +227 -561
- package/dist/eventcatalog.js +62 -71
- package/dist/features.cjs +10 -6
- package/dist/features.js +2 -2
- package/dist/federation/federate.cjs +110 -106
- package/dist/federation/federate.js +4 -4
- package/dist/generate.cjs +11 -7
- package/dist/generate.js +4 -4
- package/dist/resolve-catalog-dependencies.cjs +12 -8
- package/dist/resolve-catalog-dependencies.js +2 -2
- package/dist/runtime-dependencies/@ai-sdk__react.mjs +3 -0
- package/dist/runtime-dependencies/@astrojs__markdown-remark.mjs +3 -0
- package/dist/runtime-dependencies/@astrojs__mdx.mjs +3 -0
- package/dist/runtime-dependencies/@astrojs__node.mjs +3 -0
- package/dist/runtime-dependencies/@astrojs__react.mjs +3 -0
- package/dist/runtime-dependencies/@astrojs__rss.mjs +3 -0
- package/dist/runtime-dependencies/@asyncapi__avro-schema-parser.mjs +3 -0
- package/dist/runtime-dependencies/@asyncapi__parser.mjs +3 -0
- package/dist/runtime-dependencies/@asyncapi__react-component.mjs +3 -0
- package/dist/runtime-dependencies/@asyncapi__react-component__styles__default.min.css.mjs +3 -0
- package/dist/runtime-dependencies/@auth__core.mjs +3 -0
- package/dist/runtime-dependencies/@auth__core__providers__auth0.mjs +3 -0
- package/dist/runtime-dependencies/@auth__core__providers__github.mjs +3 -0
- package/dist/runtime-dependencies/@auth__core__providers__google.mjs +3 -0
- package/dist/runtime-dependencies/@auth__core__providers__microsoft-entra-id.mjs +3 -0
- package/dist/runtime-dependencies/@auth__core__providers__okta.mjs +3 -0
- package/dist/runtime-dependencies/@auth__core__types.mjs +3 -0
- package/dist/runtime-dependencies/@eventcatalog__license.mjs +3 -0
- package/dist/runtime-dependencies/@eventcatalog__linter.mjs +3 -0
- package/dist/runtime-dependencies/@eventcatalog__sdk.mjs +3 -0
- package/dist/runtime-dependencies/@eventcatalog__visualiser.mjs +3 -0
- package/dist/runtime-dependencies/@eventcatalog__visualiser__styles-core.css.mjs +3 -0
- package/dist/runtime-dependencies/@fontsource__inter.mjs +3 -0
- package/dist/runtime-dependencies/@fontsource__inter__400.css.mjs +3 -0
- package/dist/runtime-dependencies/@fontsource__inter__700.css.mjs +3 -0
- package/dist/runtime-dependencies/@headlessui__react.mjs +3 -0
- package/dist/runtime-dependencies/@heroicons__react.mjs +3 -0
- package/dist/runtime-dependencies/@heroicons__react__16__solid__EnvelopeIcon.mjs +3 -0
- package/dist/runtime-dependencies/@heroicons__react__20__solid.mjs +3 -0
- package/dist/runtime-dependencies/@heroicons__react__24__outline.mjs +3 -0
- package/dist/runtime-dependencies/@heroicons__react__24__outline__MagnifyingGlassIcon.mjs +3 -0
- package/dist/runtime-dependencies/@heroicons__react__24__outline__RectangleGroupIcon.mjs +3 -0
- package/dist/runtime-dependencies/@heroicons__react__24__outline__ServerIcon.mjs +3 -0
- package/dist/runtime-dependencies/@heroicons__react__24__solid.mjs +3 -0
- package/dist/runtime-dependencies/@iconify-json__logos.mjs +3 -0
- package/dist/runtime-dependencies/@mermaid-js__layout-elk.mjs +3 -0
- package/dist/runtime-dependencies/@mermaid-js__layout-elk__dist__mermaid-layout-elk.core.mjs.mjs +3 -0
- package/dist/runtime-dependencies/@modelcontextprotocol__sdk.mjs +3 -0
- package/dist/runtime-dependencies/@modelcontextprotocol__sdk__server__mcp.js.mjs +3 -0
- package/dist/runtime-dependencies/@modelcontextprotocol__sdk__server__webStandardStreamableHttp.js.mjs +3 -0
- package/dist/runtime-dependencies/@nanostores__react.mjs +3 -0
- package/dist/runtime-dependencies/@parcel__watcher.mjs +3 -0
- package/dist/runtime-dependencies/@radix-ui__react-context-menu.mjs +3 -0
- package/dist/runtime-dependencies/@radix-ui__react-dialog.mjs +3 -0
- package/dist/runtime-dependencies/@radix-ui__react-dropdown-menu.mjs +3 -0
- package/dist/runtime-dependencies/@radix-ui__react-popover.mjs +3 -0
- package/dist/runtime-dependencies/@radix-ui__react-tooltip.mjs +3 -0
- package/dist/runtime-dependencies/@scalar__api-reference-react.mjs +3 -0
- package/dist/runtime-dependencies/@scalar__api-reference-react__style.css.mjs +3 -0
- package/dist/runtime-dependencies/@tailwindcss__typography.mjs +3 -0
- package/dist/runtime-dependencies/@tailwindcss__vite.mjs +3 -0
- package/dist/runtime-dependencies/@tanstack__react-table.mjs +3 -0
- package/dist/runtime-dependencies/@xyflow__react.mjs +3 -0
- package/dist/runtime-dependencies/@xyflow__react__dist__style.css.mjs +3 -0
- package/dist/runtime-dependencies/ai.mjs +3 -0
- package/dist/runtime-dependencies/astro-expressive-code.mjs +3 -0
- package/dist/runtime-dependencies/astro-expressive-code__components.mjs +3 -0
- package/dist/runtime-dependencies/astro-seo.mjs +3 -0
- package/dist/runtime-dependencies/astro.mjs +3 -0
- package/dist/runtime-dependencies/astro__assets__services__sharp.mjs +3 -0
- package/dist/runtime-dependencies/astro__config.mjs +3 -0
- package/dist/runtime-dependencies/astro__jsx-runtime.mjs +3 -0
- package/dist/runtime-dependencies/astro__loaders.mjs +3 -0
- package/dist/runtime-dependencies/astro__logger__node.mjs +3 -0
- package/dist/runtime-dependencies/astro__types.mjs +3 -0
- package/dist/runtime-dependencies/astro__zod.mjs +3 -0
- package/dist/runtime-dependencies/auth-astro.mjs +3 -0
- package/dist/runtime-dependencies/auth-astro__client.mjs +3 -0
- package/dist/runtime-dependencies/auth-astro__server.mjs +3 -0
- package/dist/runtime-dependencies/boxen.mjs +3 -0
- package/dist/runtime-dependencies/commander.mjs +3 -0
- package/dist/runtime-dependencies/cross-env.mjs +3 -0
- package/dist/runtime-dependencies/d3-drag.mjs +3 -0
- package/dist/runtime-dependencies/d3-force.mjs +3 -0
- package/dist/runtime-dependencies/d3-selection.mjs +3 -0
- package/dist/runtime-dependencies/d3-zoom.mjs +3 -0
- package/dist/runtime-dependencies/dagre.mjs +3 -0
- package/dist/runtime-dependencies/diff.mjs +3 -0
- package/dist/runtime-dependencies/diff2html.mjs +3 -0
- package/dist/runtime-dependencies/diff2html__bundles__css__diff2html.min.css.mjs +3 -0
- package/dist/runtime-dependencies/dotenv.mjs +3 -0
- package/dist/runtime-dependencies/elkjs.mjs +3 -0
- package/dist/runtime-dependencies/elkjs__lib__elk.bundled.js.mjs +3 -0
- package/dist/runtime-dependencies/glob.mjs +3 -0
- package/dist/runtime-dependencies/gray-matter.mjs +3 -0
- package/dist/runtime-dependencies/hono.mjs +3 -0
- package/dist/runtime-dependencies/html-to-image.mjs +3 -0
- package/dist/runtime-dependencies/js-yaml.mjs +3 -0
- package/dist/runtime-dependencies/jsonpath-plus.mjs +3 -0
- package/dist/runtime-dependencies/jsonwebtoken.mjs +3 -0
- package/dist/runtime-dependencies/lodash.debounce.mjs +3 -0
- package/dist/runtime-dependencies/lodash.merge.mjs +3 -0
- package/dist/runtime-dependencies/lucide-react.mjs +3 -0
- package/dist/runtime-dependencies/manifest.json +136 -0
- package/dist/runtime-dependencies/marked.mjs +3 -0
- package/dist/runtime-dependencies/mdast-util-find-and-replace.mjs +3 -0
- package/dist/runtime-dependencies/mermaid.mjs +3 -0
- package/dist/runtime-dependencies/minisearch.mjs +3 -0
- package/dist/runtime-dependencies/nanostores.mjs +3 -0
- package/dist/runtime-dependencies/pagefind.mjs +3 -0
- package/dist/runtime-dependencies/pako.mjs +3 -0
- package/dist/runtime-dependencies/parse5.mjs +3 -0
- package/dist/runtime-dependencies/picocolors.mjs +3 -0
- package/dist/runtime-dependencies/picomatch.mjs +3 -0
- package/dist/runtime-dependencies/react-dom.mjs +3 -0
- package/dist/runtime-dependencies/react-dom__client.mjs +3 -0
- package/dist/runtime-dependencies/react-dom__server.mjs +3 -0
- package/dist/runtime-dependencies/react-markdown.mjs +3 -0
- package/dist/runtime-dependencies/react-syntax-highlighter.mjs +3 -0
- package/dist/runtime-dependencies/react-syntax-highlighter__dist__cjs__styles__prism.mjs +3 -0
- package/dist/runtime-dependencies/react-syntax-highlighter__dist__cjs__styles__prism__index.js.mjs +3 -0
- package/dist/runtime-dependencies/react.mjs +3 -0
- package/dist/runtime-dependencies/react__jsx-dev-runtime.mjs +3 -0
- package/dist/runtime-dependencies/react__jsx-runtime.mjs +3 -0
- package/dist/runtime-dependencies/recast.mjs +3 -0
- package/dist/runtime-dependencies/recast__parsers__babel.js.mjs +3 -0
- package/dist/runtime-dependencies/rehype-autolink-headings.mjs +3 -0
- package/dist/runtime-dependencies/rehype-expressive-code.mjs +3 -0
- package/dist/runtime-dependencies/rehype-expressive-code__hast.mjs +3 -0
- package/dist/runtime-dependencies/rehype-slug.mjs +3 -0
- package/dist/runtime-dependencies/remark-comment.mjs +3 -0
- package/dist/runtime-dependencies/remark-directive.mjs +3 -0
- package/dist/runtime-dependencies/remark-gfm.mjs +3 -0
- package/dist/runtime-dependencies/rimraf.mjs +3 -0
- package/dist/runtime-dependencies/semver.mjs +3 -0
- package/dist/runtime-dependencies/shelljs.mjs +3 -0
- package/dist/runtime-dependencies/sonner.mjs +3 -0
- package/dist/runtime-dependencies/sql.js.mjs +3 -0
- package/dist/runtime-dependencies/tailwindcss.mjs +3 -0
- package/dist/runtime-dependencies/typescript.mjs +3 -0
- package/dist/runtime-dependencies/unist-util-visit.mjs +3 -0
- package/dist/runtime-dependencies/update-notifier.mjs +3 -0
- package/dist/runtime-dependencies/uuid.mjs +3 -0
- package/dist/runtime-dependencies/zod.mjs +3 -0
- package/dist/runtime-dependencies/zod__v4.mjs +3 -0
- package/dist/search-indexer.cjs +1 -0
- package/dist/search-indexer.js +1 -1
- package/dist/utils/cli-logger.cjs +1 -1
- package/dist/utils/cli-logger.js +2 -2
- package/dist/watcher.cjs +5 -204
- package/dist/watcher.js +1 -2
- package/eventcatalog/astro.config.mjs +66 -31
- package/eventcatalog/integrations/catalog-assets.mjs +204 -0
- package/eventcatalog/integrations/config-loader.mjs +85 -0
- package/eventcatalog/integrations/ecstudio-watcher.mjs +11 -9
- package/eventcatalog/integrations/eventcatalog-runtime.mjs +255 -0
- package/eventcatalog/integrations/expressive-code-config.mjs +6 -0
- package/eventcatalog/integrations/runtime-dependencies.mjs +49 -0
- package/eventcatalog/integrations/runtime-dependency-manifest.mjs +15 -0
- package/eventcatalog/integrations/runtime-paths.mjs +16 -0
- package/eventcatalog/src/content.config.ts +33 -46
- package/eventcatalog/src/enterprise/custom-pages/routes.ts +3 -2
- package/eventcatalog/src/enterprise/feature.ts +2 -1
- package/eventcatalog/src/enterprise/fields/field-indexer.ts +5 -2
- package/eventcatalog/src/enterprise/fields/pages/api/fields.ts +4 -3
- package/eventcatalog/src/enterprise/integrations/eventcatalog-features.ts +32 -32
- package/eventcatalog/src/enterprise/mcp/mcp-auth.ts +1 -1
- package/eventcatalog/src/env.d.ts +7 -1
- package/eventcatalog/src/layouts/VerticalSideBarLayout.astro +15 -3
- package/eventcatalog/src/pages/architecture/[type]/[id]/[version]/index.astro +1 -1
- package/eventcatalog/src/pages/diagrams/[id]/[version]/index.astro +2 -2
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/[docVersion]/index.astro +2 -2
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/index.astro +2 -2
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/graphql/[filename].astro +1 -1
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +2 -2
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/resources/index.astro +1 -1
- package/eventcatalog/src/pages/docs/[type]/[id]/language/[dictionaryId]/index.astro +1 -1
- package/eventcatalog/src/pages/docs/[type]/[id]/language/index.astro +1 -1
- package/eventcatalog/src/pages/docs/teams/[id]/index.astro +2 -2
- package/eventcatalog/src/pages/docs/users/[id]/index.astro +2 -2
- package/eventcatalog/src/pages/index.astro +2 -3
- package/eventcatalog/src/styles/tailwind.css +3 -0
- package/eventcatalog/src/utils/eventcatalog-config/source.ts +9 -0
- package/eventcatalog/src/utils/feature.ts +2 -1
- package/eventcatalog/tsconfig.json +1 -4
- package/package.json +16 -3
- package/dist/catalog-to-astro-content-directory.cjs +0 -382
- package/dist/catalog-to-astro-content-directory.d.cts +0 -3
- package/dist/catalog-to-astro-content-directory.d.ts +0 -3
- package/dist/catalog-to-astro-content-directory.js +0 -9
- package/dist/chunk-BWN544LB.js +0 -73
- package/dist/chunk-DHH5U5PF.js +0 -53
- package/dist/chunk-KLOHNCNF.js +0 -101
- package/dist/chunk-T4RVWPIQ.js +0 -85
- package/dist/chunk-T5IUG523.js +0 -54
- package/dist/chunk-W5JQON7Z.js +0 -117
- package/dist/copy-core.cjs +0 -88
- package/dist/copy-core.d.cts +0 -4
- package/dist/copy-core.d.ts +0 -4
- package/dist/copy-core.js +0 -8
- package/dist/core-node-modules.cjs +0 -108
- package/dist/core-node-modules.d.cts +0 -7
- package/dist/core-node-modules.d.ts +0 -7
- package/dist/core-node-modules.js +0 -8
- package/dist/custom-components.cjs +0 -89
- package/dist/custom-components.d.cts +0 -4
- package/dist/custom-components.d.ts +0 -4
- package/dist/custom-components.js +0 -8
- package/dist/map-catalog-to-astro.cjs +0 -151
- package/dist/map-catalog-to-astro.d.cts +0 -28
- package/dist/map-catalog-to-astro.d.ts +0 -28
- package/dist/map-catalog-to-astro.js +0 -6
|
@@ -36,18 +36,22 @@ __export(federate_exports, {
|
|
|
36
36
|
});
|
|
37
37
|
module.exports = __toCommonJS(federate_exports);
|
|
38
38
|
var import_node_crypto4 = require("crypto");
|
|
39
|
-
var
|
|
40
|
-
var
|
|
39
|
+
var import_promises8 = __toESM(require("fs/promises"), 1);
|
|
40
|
+
var import_node_path8 = __toESM(require("path"), 1);
|
|
41
41
|
var import_sdk3 = __toESM(require("@eventcatalog/sdk"), 1);
|
|
42
42
|
|
|
43
43
|
// src/eventcatalog-config-file-utils.js
|
|
44
|
+
var import_promises2 = require("fs/promises");
|
|
45
|
+
var import_node_path2 = __toESM(require("path"), 1);
|
|
46
|
+
var import_uuid = require("uuid");
|
|
47
|
+
var import_gray_matter = __toESM(require("gray-matter"), 1);
|
|
48
|
+
|
|
49
|
+
// eventcatalog/integrations/config-loader.mjs
|
|
44
50
|
var import_promises = require("fs/promises");
|
|
45
51
|
var import_node_fs = require("fs");
|
|
46
52
|
var import_node_path = __toESM(require("path"), 1);
|
|
47
|
-
var
|
|
48
|
-
var import_url = require("url");
|
|
53
|
+
var import_node_url = require("url");
|
|
49
54
|
var import_node_os = require("os");
|
|
50
|
-
var import_gray_matter = __toESM(require("gray-matter"), 1);
|
|
51
55
|
async function cleanup(projectDirectory) {
|
|
52
56
|
const filePath = import_node_path.default.join(projectDirectory, "eventcatalog.config.mjs");
|
|
53
57
|
if ((0, import_node_fs.existsSync)(filePath)) {
|
|
@@ -95,7 +99,7 @@ var getEventCatalogConfigFile = async (projectDirectory) => {
|
|
|
95
99
|
configFilePath = import_node_path.default.join(tempDir, "eventcatalog.config.mjs");
|
|
96
100
|
await (0, import_promises.copyFile)(import_node_path.default.join(projectDirectory, "eventcatalog.config.js"), configFilePath);
|
|
97
101
|
}
|
|
98
|
-
const configFileURL = `${(0,
|
|
102
|
+
const configFileURL = `${(0, import_node_url.pathToFileURL)(configFilePath).href}?t=${Date.now()}`;
|
|
99
103
|
const config = await import(
|
|
100
104
|
/* @vite-ignore */
|
|
101
105
|
configFileURL
|
|
@@ -111,21 +115,21 @@ var getEventCatalogConfigFile = async (projectDirectory) => {
|
|
|
111
115
|
|
|
112
116
|
// src/federation/content-cache.ts
|
|
113
117
|
var import_node_crypto = require("crypto");
|
|
114
|
-
var
|
|
115
|
-
var
|
|
118
|
+
var import_promises3 = __toESM(require("fs/promises"), 1);
|
|
119
|
+
var import_node_path3 = __toESM(require("path"), 1);
|
|
116
120
|
var getContentHash = (content) => `sha256:${(0, import_node_crypto.createHash)("sha256").update(content).digest("hex")}`;
|
|
117
121
|
var isContentHash = (key) => /^sha256:[a-f0-9]{64}$/i.test(key);
|
|
118
122
|
var createFederationContentCache = (projectDirectory, options = {}) => {
|
|
119
|
-
const cacheDirectory =
|
|
120
|
-
const getCachePath = (key) =>
|
|
123
|
+
const cacheDirectory = import_node_path3.default.join(projectDirectory, ".eventcatalog-cache", "federation", "content");
|
|
124
|
+
const getCachePath = (key) => import_node_path3.default.join(cacheDirectory, encodeURIComponent(key));
|
|
121
125
|
return {
|
|
122
126
|
async get(key) {
|
|
123
127
|
if (options.read === false || !isContentHash(key)) return void 0;
|
|
124
128
|
const cachePath = getCachePath(key);
|
|
125
129
|
try {
|
|
126
|
-
const content = await
|
|
130
|
+
const content = await import_promises3.default.readFile(cachePath);
|
|
127
131
|
if (getContentHash(content) !== key) {
|
|
128
|
-
await
|
|
132
|
+
await import_promises3.default.rm(cachePath, { force: true });
|
|
129
133
|
return void 0;
|
|
130
134
|
}
|
|
131
135
|
options.onHit?.(key);
|
|
@@ -137,14 +141,14 @@ var createFederationContentCache = (projectDirectory, options = {}) => {
|
|
|
137
141
|
},
|
|
138
142
|
async set(key, content) {
|
|
139
143
|
if (!isContentHash(key) || getContentHash(content) !== key) return;
|
|
140
|
-
await
|
|
144
|
+
await import_promises3.default.mkdir(cacheDirectory, { recursive: true });
|
|
141
145
|
const cachePath = getCachePath(key);
|
|
142
146
|
const temporaryPath = `${cachePath}.tmp-${process.pid}-${(0, import_node_crypto.randomUUID)()}`;
|
|
143
147
|
try {
|
|
144
|
-
await
|
|
145
|
-
await
|
|
148
|
+
await import_promises3.default.writeFile(temporaryPath, content);
|
|
149
|
+
await import_promises3.default.rename(temporaryPath, cachePath);
|
|
146
150
|
} finally {
|
|
147
|
-
await
|
|
151
|
+
await import_promises3.default.rm(temporaryPath, { force: true });
|
|
148
152
|
}
|
|
149
153
|
}
|
|
150
154
|
};
|
|
@@ -299,21 +303,21 @@ var import_license = require("@eventcatalog/license");
|
|
|
299
303
|
var isFederationEnabled = () => (0, import_license.isEventCatalogEnterpriseEnabled)();
|
|
300
304
|
|
|
301
305
|
// src/federation/output-transaction.ts
|
|
302
|
-
var
|
|
303
|
-
var
|
|
306
|
+
var import_promises4 = __toESM(require("fs/promises"), 1);
|
|
307
|
+
var import_node_path4 = __toESM(require("path"), 1);
|
|
304
308
|
var getSafePublicPath = (publicDirectory, relativePath) => {
|
|
305
|
-
const normalizedPath =
|
|
306
|
-
const unsafe = relativePath.length === 0 || relativePath.includes("\0") || relativePath.includes("\\") ||
|
|
309
|
+
const normalizedPath = import_node_path4.default.posix.normalize(relativePath);
|
|
310
|
+
const unsafe = relativePath.length === 0 || relativePath.includes("\0") || relativePath.includes("\\") || import_node_path4.default.posix.isAbsolute(relativePath) || /^[a-zA-Z]:\//.test(relativePath) || normalizedPath !== relativePath || normalizedPath === ".." || normalizedPath.startsWith("../");
|
|
307
311
|
if (unsafe) return void 0;
|
|
308
|
-
const destinationPath =
|
|
309
|
-
const relativeDestinationPath =
|
|
310
|
-
return relativeDestinationPath !== "" && relativeDestinationPath !== ".." && !relativeDestinationPath.startsWith(`..${
|
|
312
|
+
const destinationPath = import_node_path4.default.resolve(publicDirectory, relativePath);
|
|
313
|
+
const relativeDestinationPath = import_node_path4.default.relative(publicDirectory, destinationPath);
|
|
314
|
+
return relativeDestinationPath !== "" && relativeDestinationPath !== ".." && !relativeDestinationPath.startsWith(`..${import_node_path4.default.sep}`) && !import_node_path4.default.isAbsolute(relativeDestinationPath) ? destinationPath : void 0;
|
|
311
315
|
};
|
|
312
316
|
var beginFederationOutputTransaction = async (projectDirectory, outDir, relativePublicPaths) => {
|
|
313
|
-
const transactionDirectory = await
|
|
314
|
-
const previousOutDir =
|
|
315
|
-
const publicBackupDirectory =
|
|
316
|
-
const publicDirectory =
|
|
317
|
+
const transactionDirectory = await import_promises4.default.mkdtemp(import_node_path4.default.join(projectDirectory, ".eventcatalog-federation-transaction-"));
|
|
318
|
+
const previousOutDir = import_node_path4.default.join(transactionDirectory, "federated");
|
|
319
|
+
const publicBackupDirectory = import_node_path4.default.join(transactionDirectory, "public");
|
|
320
|
+
const publicDirectory = import_node_path4.default.resolve(projectDirectory, "public");
|
|
317
321
|
const publicSnapshots = [];
|
|
318
322
|
const missingPublicDirectories = /* @__PURE__ */ new Set();
|
|
319
323
|
let hadPreviousOutDir = false;
|
|
@@ -322,45 +326,45 @@ var beginFederationOutputTransaction = async (projectDirectory, outDir, relative
|
|
|
322
326
|
const destinationPath = getSafePublicPath(publicDirectory, relativePath);
|
|
323
327
|
if (!destinationPath) continue;
|
|
324
328
|
try {
|
|
325
|
-
const stat = await
|
|
329
|
+
const stat = await import_promises4.default.lstat(destinationPath);
|
|
326
330
|
if (!stat.isFile()) continue;
|
|
327
|
-
const backupPath =
|
|
328
|
-
await
|
|
329
|
-
await
|
|
331
|
+
const backupPath = import_node_path4.default.join(publicBackupDirectory, `${publicSnapshots.length}`);
|
|
332
|
+
await import_promises4.default.mkdir(import_node_path4.default.dirname(backupPath), { recursive: true });
|
|
333
|
+
await import_promises4.default.copyFile(destinationPath, backupPath);
|
|
330
334
|
publicSnapshots.push({ backupPath, destinationPath, state: "file" });
|
|
331
335
|
} catch (error) {
|
|
332
336
|
const code = error.code;
|
|
333
337
|
if (code === "ENOTDIR") continue;
|
|
334
338
|
if (code !== "ENOENT") throw error;
|
|
335
339
|
publicSnapshots.push({ destinationPath, state: "missing" });
|
|
336
|
-
let directory =
|
|
340
|
+
let directory = import_node_path4.default.dirname(destinationPath);
|
|
337
341
|
while (directory !== publicDirectory) {
|
|
338
342
|
try {
|
|
339
|
-
await
|
|
343
|
+
await import_promises4.default.lstat(directory);
|
|
340
344
|
break;
|
|
341
345
|
} catch (directoryError) {
|
|
342
346
|
const directoryCode = directoryError.code;
|
|
343
347
|
if (directoryCode === "ENOTDIR") break;
|
|
344
348
|
if (directoryCode !== "ENOENT") throw directoryError;
|
|
345
349
|
missingPublicDirectories.add(directory);
|
|
346
|
-
directory =
|
|
350
|
+
directory = import_node_path4.default.dirname(directory);
|
|
347
351
|
}
|
|
348
352
|
}
|
|
349
353
|
}
|
|
350
354
|
}
|
|
351
355
|
try {
|
|
352
|
-
await
|
|
356
|
+
await import_promises4.default.rename(outDir, previousOutDir);
|
|
353
357
|
hadPreviousOutDir = true;
|
|
354
358
|
} catch (error) {
|
|
355
359
|
if (error.code !== "ENOENT") throw error;
|
|
356
360
|
}
|
|
357
361
|
} catch (error) {
|
|
358
|
-
await
|
|
362
|
+
await import_promises4.default.rm(transactionDirectory, { recursive: true, force: true });
|
|
359
363
|
throw error;
|
|
360
364
|
}
|
|
361
365
|
return {
|
|
362
366
|
commit: async () => {
|
|
363
|
-
await
|
|
367
|
+
await import_promises4.default.rm(transactionDirectory, { recursive: true, force: true }).catch(() => void 0);
|
|
364
368
|
},
|
|
365
369
|
rollback: async () => {
|
|
366
370
|
const rollbackErrors = [];
|
|
@@ -371,28 +375,28 @@ var beginFederationOutputTransaction = async (projectDirectory, outDir, relative
|
|
|
371
375
|
rollbackErrors.push(error);
|
|
372
376
|
}
|
|
373
377
|
};
|
|
374
|
-
await attempt(() =>
|
|
375
|
-
if (hadPreviousOutDir) await attempt(() =>
|
|
378
|
+
await attempt(() => import_promises4.default.rm(outDir, { recursive: true, force: true }));
|
|
379
|
+
if (hadPreviousOutDir) await attempt(() => import_promises4.default.rename(previousOutDir, outDir));
|
|
376
380
|
for (const snapshot of publicSnapshots) {
|
|
377
381
|
if (snapshot.state === "missing") {
|
|
378
|
-
await attempt(() =>
|
|
382
|
+
await attempt(() => import_promises4.default.rm(snapshot.destinationPath, { force: true }));
|
|
379
383
|
continue;
|
|
380
384
|
}
|
|
381
385
|
await attempt(async () => {
|
|
382
|
-
await
|
|
383
|
-
await
|
|
386
|
+
await import_promises4.default.mkdir(import_node_path4.default.dirname(snapshot.destinationPath), { recursive: true });
|
|
387
|
+
await import_promises4.default.copyFile(snapshot.backupPath, snapshot.destinationPath);
|
|
384
388
|
});
|
|
385
389
|
}
|
|
386
390
|
for (const directory of [...missingPublicDirectories].sort((left, right) => right.length - left.length)) {
|
|
387
391
|
await attempt(async () => {
|
|
388
392
|
try {
|
|
389
|
-
await
|
|
393
|
+
await import_promises4.default.rmdir(directory);
|
|
390
394
|
} catch (error) {
|
|
391
395
|
if (!["ENOENT", "ENOTEMPTY"].includes(error.code ?? "")) throw error;
|
|
392
396
|
}
|
|
393
397
|
});
|
|
394
398
|
}
|
|
395
|
-
await attempt(() =>
|
|
399
|
+
await attempt(() => import_promises4.default.rm(transactionDirectory, { recursive: true, force: true }));
|
|
396
400
|
if (rollbackErrors.length > 0) throw new AggregateError(rollbackErrors, "Failed to restore the previous federation output");
|
|
397
401
|
}
|
|
398
402
|
};
|
|
@@ -415,26 +419,26 @@ var withFederationOutputTransaction = async (projectDirectory, outDir, relativeP
|
|
|
415
419
|
|
|
416
420
|
// src/federation/public-assets.ts
|
|
417
421
|
var import_node_crypto2 = require("crypto");
|
|
418
|
-
var
|
|
419
|
-
var
|
|
422
|
+
var import_promises5 = __toESM(require("fs/promises"), 1);
|
|
423
|
+
var import_node_path5 = __toESM(require("path"), 1);
|
|
420
424
|
var getContentHash2 = (content) => `sha256:${(0, import_node_crypto2.createHash)("sha256").update(content).digest("hex")}`;
|
|
421
425
|
var getFileHash = async (filePath) => {
|
|
422
426
|
try {
|
|
423
|
-
const stat = await
|
|
424
|
-
return stat.isFile() ? getContentHash2(await
|
|
427
|
+
const stat = await import_promises5.default.lstat(filePath);
|
|
428
|
+
return stat.isFile() ? getContentHash2(await import_promises5.default.readFile(filePath)) : void 0;
|
|
425
429
|
} catch (error) {
|
|
426
430
|
if (error.code === "ENOENT") return void 0;
|
|
427
431
|
throw error;
|
|
428
432
|
}
|
|
429
433
|
};
|
|
430
434
|
var getSafePath = (directory, relativePath) => {
|
|
431
|
-
const normalizedPath =
|
|
432
|
-
const unsafe = relativePath.length === 0 || relativePath.includes("\0") || relativePath.includes("\\") ||
|
|
435
|
+
const normalizedPath = import_node_path5.default.posix.normalize(relativePath);
|
|
436
|
+
const unsafe = relativePath.length === 0 || relativePath.includes("\0") || relativePath.includes("\\") || import_node_path5.default.posix.isAbsolute(relativePath) || /^[a-zA-Z]:\//.test(relativePath) || normalizedPath !== relativePath || normalizedPath === ".." || normalizedPath.startsWith("../");
|
|
433
437
|
if (unsafe) return void 0;
|
|
434
|
-
const resolvedDirectory =
|
|
435
|
-
const resolvedPath =
|
|
436
|
-
const relativeResolvedPath =
|
|
437
|
-
if (relativeResolvedPath === "" || relativeResolvedPath === ".." || relativeResolvedPath.startsWith(`..${
|
|
438
|
+
const resolvedDirectory = import_node_path5.default.resolve(directory);
|
|
439
|
+
const resolvedPath = import_node_path5.default.resolve(resolvedDirectory, relativePath);
|
|
440
|
+
const relativeResolvedPath = import_node_path5.default.relative(resolvedDirectory, resolvedPath);
|
|
441
|
+
if (relativeResolvedPath === "" || relativeResolvedPath === ".." || relativeResolvedPath.startsWith(`..${import_node_path5.default.sep}`) || import_node_path5.default.isAbsolute(relativeResolvedPath)) {
|
|
438
442
|
return void 0;
|
|
439
443
|
}
|
|
440
444
|
return resolvedPath;
|
|
@@ -442,23 +446,23 @@ var getSafePath = (directory, relativePath) => {
|
|
|
442
446
|
var listFiles = async (directory, relativeDirectory = "") => {
|
|
443
447
|
let entries;
|
|
444
448
|
try {
|
|
445
|
-
entries = await
|
|
449
|
+
entries = await import_promises5.default.readdir(import_node_path5.default.join(directory, relativeDirectory), { withFileTypes: true });
|
|
446
450
|
} catch (error) {
|
|
447
451
|
if (error.code === "ENOENT") return [];
|
|
448
452
|
throw error;
|
|
449
453
|
}
|
|
450
454
|
const files = await Promise.all(
|
|
451
455
|
entries.map(async (entry) => {
|
|
452
|
-
const relativePath =
|
|
456
|
+
const relativePath = import_node_path5.default.join(relativeDirectory, entry.name);
|
|
453
457
|
if (entry.isDirectory()) return listFiles(directory, relativePath);
|
|
454
|
-
return entry.isFile() ? [relativePath.split(
|
|
458
|
+
return entry.isFile() ? [relativePath.split(import_node_path5.default.sep).join("/")] : [];
|
|
455
459
|
})
|
|
456
460
|
);
|
|
457
461
|
return files.flat().sort();
|
|
458
462
|
};
|
|
459
463
|
var pathExists = async (filePath) => {
|
|
460
464
|
try {
|
|
461
|
-
await
|
|
465
|
+
await import_promises5.default.lstat(filePath);
|
|
462
466
|
return true;
|
|
463
467
|
} catch (error) {
|
|
464
468
|
if (error.code === "ENOENT") return false;
|
|
@@ -466,27 +470,27 @@ var pathExists = async (filePath) => {
|
|
|
466
470
|
}
|
|
467
471
|
};
|
|
468
472
|
var hasBlockingParent = async (publicDirectory, destinationPath) => {
|
|
469
|
-
let currentPath =
|
|
473
|
+
let currentPath = import_node_path5.default.dirname(destinationPath);
|
|
470
474
|
while (currentPath !== publicDirectory) {
|
|
471
475
|
try {
|
|
472
|
-
if (!(await
|
|
476
|
+
if (!(await import_promises5.default.lstat(currentPath)).isDirectory()) return true;
|
|
473
477
|
} catch (error) {
|
|
474
478
|
if (error.code !== "ENOENT") throw error;
|
|
475
479
|
}
|
|
476
|
-
currentPath =
|
|
480
|
+
currentPath = import_node_path5.default.dirname(currentPath);
|
|
477
481
|
}
|
|
478
482
|
return false;
|
|
479
483
|
};
|
|
480
484
|
var pruneEmptyDirectories = async (publicDirectory, filePath) => {
|
|
481
|
-
let currentPath =
|
|
485
|
+
let currentPath = import_node_path5.default.dirname(filePath);
|
|
482
486
|
while (currentPath !== publicDirectory) {
|
|
483
487
|
try {
|
|
484
|
-
await
|
|
488
|
+
await import_promises5.default.rmdir(currentPath);
|
|
485
489
|
} catch (error) {
|
|
486
490
|
if (!["ENOENT", "ENOTEMPTY"].includes(error.code ?? "")) throw error;
|
|
487
491
|
if (error.code === "ENOTEMPTY") return;
|
|
488
492
|
}
|
|
489
|
-
currentPath =
|
|
493
|
+
currentPath = import_node_path5.default.dirname(currentPath);
|
|
490
494
|
}
|
|
491
495
|
};
|
|
492
496
|
var composePublicAssets = async ({
|
|
@@ -496,8 +500,8 @@ var composePublicAssets = async ({
|
|
|
496
500
|
previousFiles = {},
|
|
497
501
|
collisionPaths = /* @__PURE__ */ new Set()
|
|
498
502
|
}) => {
|
|
499
|
-
const publicDirectory =
|
|
500
|
-
const federatedPublicDirectory =
|
|
503
|
+
const publicDirectory = import_node_path5.default.resolve(projectDirectory, "public");
|
|
504
|
+
const federatedPublicDirectory = import_node_path5.default.resolve(federatedDirectory, "public");
|
|
501
505
|
const sourceFiles = await listFiles(federatedPublicDirectory);
|
|
502
506
|
const sourceFileSet = new Set(sourceFiles);
|
|
503
507
|
const managedFiles = /* @__PURE__ */ new Set();
|
|
@@ -510,7 +514,7 @@ var composePublicAssets = async ({
|
|
|
510
514
|
if (sourceFileSet.has(relativePath)) continue;
|
|
511
515
|
const destinationPath = getSafePath(publicDirectory, relativePath);
|
|
512
516
|
if (!destinationPath) continue;
|
|
513
|
-
await
|
|
517
|
+
await import_promises5.default.rm(destinationPath, { force: true });
|
|
514
518
|
await pruneEmptyDirectories(publicDirectory, destinationPath);
|
|
515
519
|
removed += 1;
|
|
516
520
|
}
|
|
@@ -532,31 +536,31 @@ var composePublicAssets = async ({
|
|
|
532
536
|
}
|
|
533
537
|
const asset = publicAssetsByPath.get(relativePath);
|
|
534
538
|
if (!asset) throw new Error(`Cannot identify the source of federated public asset "${relativePath}"`);
|
|
535
|
-
const content = await
|
|
536
|
-
await
|
|
537
|
-
await
|
|
539
|
+
const content = await import_promises5.default.readFile(sourcePath);
|
|
540
|
+
await import_promises5.default.mkdir(import_node_path5.default.dirname(destinationPath), { recursive: true });
|
|
541
|
+
await import_promises5.default.writeFile(destinationPath, content);
|
|
538
542
|
files[relativePath] = { source: asset.resolvedFrom.source, hash: getContentHash2(content) };
|
|
539
543
|
copied += 1;
|
|
540
544
|
if (collisionPaths.has(`public/${relativePath}`)) overwritten += 1;
|
|
541
545
|
}
|
|
542
|
-
await
|
|
546
|
+
await import_promises5.default.rm(federatedPublicDirectory, { recursive: true, force: true });
|
|
543
547
|
return { files, copied, skipped, overwritten, removed };
|
|
544
548
|
};
|
|
545
549
|
|
|
546
550
|
// src/federation/filesystem-source-provider.ts
|
|
547
551
|
var import_node_crypto3 = require("crypto");
|
|
548
|
-
var
|
|
549
|
-
var
|
|
552
|
+
var import_promises6 = __toESM(require("fs/promises"), 1);
|
|
553
|
+
var import_node_path6 = __toESM(require("path"), 1);
|
|
550
554
|
var import_sdk = __toESM(require("@eventcatalog/sdk"), 1);
|
|
551
555
|
var FILESYSTEM_SOURCE_PREFIX = "file:";
|
|
552
556
|
var isWithinDirectory = (directory, target) => {
|
|
553
|
-
const relativePath =
|
|
554
|
-
return relativePath === "" || !relativePath.startsWith(`..${
|
|
557
|
+
const relativePath = import_node_path6.default.relative(directory, target);
|
|
558
|
+
return relativePath === "" || !relativePath.startsWith(`..${import_node_path6.default.sep}`) && relativePath !== ".." && !import_node_path6.default.isAbsolute(relativePath);
|
|
555
559
|
};
|
|
556
560
|
var assertPortableRelativePath = (filePath, label, allowRoot = true) => {
|
|
557
561
|
const portablePath = filePath.replaceAll("\\", "/");
|
|
558
|
-
const normalizedPath =
|
|
559
|
-
const isUnsafe = filePath.includes("\\") || filePath.includes("\0") ||
|
|
562
|
+
const normalizedPath = import_node_path6.default.posix.normalize(portablePath);
|
|
563
|
+
const isUnsafe = filePath.includes("\\") || filePath.includes("\0") || import_node_path6.default.posix.isAbsolute(normalizedPath) || /^[a-zA-Z]:\//.test(normalizedPath) || normalizedPath === ".." || normalizedPath.startsWith("../") || !allowRoot && (normalizedPath === "." || normalizedPath === "");
|
|
560
564
|
if (isUnsafe) throw new Error(`${label} "${filePath}" escapes its filesystem source`);
|
|
561
565
|
return normalizedPath;
|
|
562
566
|
};
|
|
@@ -566,22 +570,22 @@ var getSourceRoot = (projectDirectory, source) => {
|
|
|
566
570
|
}
|
|
567
571
|
const locator = source.source.slice(FILESYSTEM_SOURCE_PREFIX.length);
|
|
568
572
|
if (!locator.trim()) throw new Error(`Filesystem federation source "${source.id}" requires a path after "file:".`);
|
|
569
|
-
return
|
|
573
|
+
return import_node_path6.default.resolve(projectDirectory, locator);
|
|
570
574
|
};
|
|
571
575
|
var getCatalogDirectory = async (projectDirectory, source) => {
|
|
572
576
|
if (source.ref) throw new Error(`Filesystem federation source "${source.id}" does not support "ref".`);
|
|
573
577
|
const sourceRoot = getSourceRoot(projectDirectory, source);
|
|
574
578
|
const catalogPath = assertPortableRelativePath(source.path ?? ".", "Catalog path");
|
|
575
|
-
const catalogDirectory =
|
|
579
|
+
const catalogDirectory = import_node_path6.default.resolve(sourceRoot, ...catalogPath.split("/"));
|
|
576
580
|
if (!isWithinDirectory(sourceRoot, catalogDirectory)) {
|
|
577
581
|
throw new Error(`Catalog path "${source.path}" escapes source "${source.id}"`);
|
|
578
582
|
}
|
|
579
583
|
try {
|
|
580
|
-
const [realSourceRoot, realCatalogDirectory] = await Promise.all([
|
|
584
|
+
const [realSourceRoot, realCatalogDirectory] = await Promise.all([import_promises6.default.realpath(sourceRoot), import_promises6.default.realpath(catalogDirectory)]);
|
|
581
585
|
if (!isWithinDirectory(realSourceRoot, realCatalogDirectory)) {
|
|
582
586
|
throw new Error(`Catalog path "${source.path}" escapes source "${source.id}"`);
|
|
583
587
|
}
|
|
584
|
-
if (!(await
|
|
588
|
+
if (!(await import_promises6.default.stat(realCatalogDirectory)).isDirectory()) {
|
|
585
589
|
throw new Error(`Filesystem federation source "${source.id}" is not a directory: ${catalogDirectory}`);
|
|
586
590
|
}
|
|
587
591
|
return realCatalogDirectory;
|
|
@@ -594,12 +598,12 @@ var getCatalogDirectory = async (projectDirectory, source) => {
|
|
|
594
598
|
};
|
|
595
599
|
var getArtifactPath = async (catalogDirectory, source, artifactPath) => {
|
|
596
600
|
const normalizedPath = assertPortableRelativePath(artifactPath, "Federated artifact path", false);
|
|
597
|
-
const filePath =
|
|
601
|
+
const filePath = import_node_path6.default.resolve(catalogDirectory, ...normalizedPath.split("/"));
|
|
598
602
|
if (!isWithinDirectory(catalogDirectory, filePath)) {
|
|
599
603
|
throw new Error(`Federated artifact path "${artifactPath}" escapes source "${source.id}"`);
|
|
600
604
|
}
|
|
601
605
|
try {
|
|
602
|
-
const realFilePath = await
|
|
606
|
+
const realFilePath = await import_promises6.default.realpath(filePath);
|
|
603
607
|
if (!isWithinDirectory(catalogDirectory, realFilePath)) {
|
|
604
608
|
throw new Error(`Federated artifact path "${artifactPath}" escapes source "${source.id}"`);
|
|
605
609
|
}
|
|
@@ -626,15 +630,15 @@ var createFileSystemSourceProvider = (projectDirectory) => ({
|
|
|
626
630
|
},
|
|
627
631
|
async fetchContent({ source, path: artifactPath }) {
|
|
628
632
|
const catalogDirectory = await getCatalogDirectory(projectDirectory, source);
|
|
629
|
-
return
|
|
633
|
+
return import_promises6.default.readFile(await getArtifactPath(catalogDirectory, source, artifactPath));
|
|
630
634
|
}
|
|
631
635
|
});
|
|
632
636
|
|
|
633
637
|
// src/federation/github-source-provider.ts
|
|
634
638
|
var import_node_child_process = require("child_process");
|
|
635
|
-
var
|
|
639
|
+
var import_promises7 = __toESM(require("fs/promises"), 1);
|
|
636
640
|
var import_node_os2 = __toESM(require("os"), 1);
|
|
637
|
-
var
|
|
641
|
+
var import_node_path7 = __toESM(require("path"), 1);
|
|
638
642
|
var import_node_util = require("util");
|
|
639
643
|
var import_sdk2 = __toESM(require("@eventcatalog/sdk"), 1);
|
|
640
644
|
var execFileAsync = (0, import_node_util.promisify)(import_node_child_process.execFile);
|
|
@@ -645,8 +649,8 @@ var parseGitHubSource = (source) => {
|
|
|
645
649
|
};
|
|
646
650
|
var assertSafeCatalogPath = (source) => {
|
|
647
651
|
const catalogPath = source.path ?? ".";
|
|
648
|
-
const normalized =
|
|
649
|
-
if (catalogPath.includes("\\") ||
|
|
652
|
+
const normalized = import_node_path7.default.posix.normalize(catalogPath.replaceAll("\\", "/"));
|
|
653
|
+
if (catalogPath.includes("\\") || import_node_path7.default.posix.isAbsolute(normalized) || normalized === ".." || normalized.startsWith("../")) {
|
|
650
654
|
throw new Error(`Catalog path "${catalogPath}" escapes source "${source.id}"`);
|
|
651
655
|
}
|
|
652
656
|
};
|
|
@@ -689,8 +693,8 @@ var getGitEnvironment = (token) => {
|
|
|
689
693
|
};
|
|
690
694
|
var createCheckout = (executeFile, token) => async (source, ref, callback) => {
|
|
691
695
|
const { owner, repository } = parseGitHubSource(source);
|
|
692
|
-
const catalogPath =
|
|
693
|
-
const directory = await
|
|
696
|
+
const catalogPath = import_node_path7.default.posix.normalize(source.path ?? ".");
|
|
697
|
+
const directory = await import_promises7.default.mkdtemp(import_node_path7.default.join(import_node_os2.default.tmpdir(), "eventcatalog-federation-"));
|
|
694
698
|
const env = getGitEnvironment(token);
|
|
695
699
|
try {
|
|
696
700
|
const git = (args) => executeFile("git", args, { cwd: directory, env, encoding: "utf8" });
|
|
@@ -704,22 +708,22 @@ var createCheckout = (executeFile, token) => async (source, ref, callback) => {
|
|
|
704
708
|
await git(["checkout", "--quiet", "--detach", "FETCH_HEAD"]);
|
|
705
709
|
return await callback(directory);
|
|
706
710
|
} finally {
|
|
707
|
-
await
|
|
711
|
+
await import_promises7.default.rm(directory, { recursive: true, force: true });
|
|
708
712
|
}
|
|
709
713
|
};
|
|
710
714
|
var generateIndex = async (source, ref, checkout, executeFile) => checkout(source, ref, async (directory) => {
|
|
711
715
|
const { stdout } = await executeFile("git", ["rev-parse", "HEAD"], { cwd: directory, encoding: "utf8" });
|
|
712
716
|
const commit = stdout.trim();
|
|
713
|
-
const catalogDirectory =
|
|
714
|
-
const relativeCatalogDirectory =
|
|
715
|
-
if (relativeCatalogDirectory.startsWith("..") ||
|
|
717
|
+
const catalogDirectory = import_node_path7.default.resolve(directory, source.path ?? ".");
|
|
718
|
+
const relativeCatalogDirectory = import_node_path7.default.relative(directory, catalogDirectory);
|
|
719
|
+
if (relativeCatalogDirectory.startsWith("..") || import_node_path7.default.isAbsolute(relativeCatalogDirectory)) {
|
|
716
720
|
throw new Error(`Catalog path "${source.path}" escapes source "${source.id}"`);
|
|
717
721
|
}
|
|
718
722
|
const index = await (0, import_sdk2.default)(catalogDirectory).buildIndex({ source: source.id, commit });
|
|
719
723
|
return { bytes: Buffer.from(JSON.stringify(index)), index, commit, generated: true };
|
|
720
724
|
});
|
|
721
725
|
var fetchPublishedIndex = async (source, ref, fetcher, token) => {
|
|
722
|
-
const indexPath =
|
|
726
|
+
const indexPath = import_node_path7.default.posix.join(source.path ?? ".", "catalog.index.json");
|
|
723
727
|
const bytes = await fetchBytes(source, ref, indexPath, fetcher, token);
|
|
724
728
|
if (!bytes) return void 0;
|
|
725
729
|
const index = (0, import_sdk2.parseIndex)(JSON.parse(bytes.toString("utf8")));
|
|
@@ -742,7 +746,7 @@ var createGitHubSourceProvider = (options = {}) => {
|
|
|
742
746
|
},
|
|
743
747
|
async fetchContent({ source, commit, path: artifactPath }) {
|
|
744
748
|
assertSafeCatalogPath(source);
|
|
745
|
-
const catalogPath =
|
|
749
|
+
const catalogPath = import_node_path7.default.posix.join(source.path ?? ".", artifactPath);
|
|
746
750
|
const content = await fetchBytes(source, commit, catalogPath, fetcher, token);
|
|
747
751
|
if (!content) throw new Error(`Federated artifact not found for "${source.id}": ${artifactPath}`);
|
|
748
752
|
return content;
|
|
@@ -828,16 +832,16 @@ var createDiagnosticGraph = (graph, ownershipGraph, remoteSourceIds, localSource
|
|
|
828
832
|
var writeLock = async (lockPath, lock) => {
|
|
829
833
|
const temporaryPath = `${lockPath}.tmp-${process.pid}`;
|
|
830
834
|
try {
|
|
831
|
-
await
|
|
835
|
+
await import_promises8.default.writeFile(temporaryPath, `${JSON.stringify(lock, null, 2)}
|
|
832
836
|
`, "utf8");
|
|
833
|
-
await
|
|
837
|
+
await import_promises8.default.rename(temporaryPath, lockPath);
|
|
834
838
|
} finally {
|
|
835
|
-
await
|
|
839
|
+
await import_promises8.default.rm(temporaryPath, { force: true });
|
|
836
840
|
}
|
|
837
841
|
};
|
|
838
842
|
var readLock = async (lockPath) => {
|
|
839
843
|
try {
|
|
840
|
-
return JSON.parse(await
|
|
844
|
+
return JSON.parse(await import_promises8.default.readFile(lockPath, "utf8"));
|
|
841
845
|
} catch (error) {
|
|
842
846
|
if (error.code === "ENOENT") return void 0;
|
|
843
847
|
throw new Error(`Cannot read federation lock at "${lockPath}"`, { cause: error });
|
|
@@ -845,7 +849,7 @@ var readLock = async (lockPath) => {
|
|
|
845
849
|
};
|
|
846
850
|
var pathExists2 = async (filePath) => {
|
|
847
851
|
try {
|
|
848
|
-
await
|
|
852
|
+
await import_promises8.default.access(filePath);
|
|
849
853
|
return true;
|
|
850
854
|
} catch (error) {
|
|
851
855
|
if (error.code === "ENOENT") return false;
|
|
@@ -853,8 +857,8 @@ var pathExists2 = async (filePath) => {
|
|
|
853
857
|
}
|
|
854
858
|
};
|
|
855
859
|
var cleanupPreviousFederation = async (projectDirectory, onProgress) => {
|
|
856
|
-
const outDir =
|
|
857
|
-
const lockPath =
|
|
860
|
+
const outDir = import_node_path8.default.join(projectDirectory, "federated");
|
|
861
|
+
const lockPath = import_node_path8.default.join(projectDirectory, "eventcatalog.lock");
|
|
858
862
|
const previousLock = await readLock(lockPath);
|
|
859
863
|
const hadFederatedOutput = await pathExists2(outDir);
|
|
860
864
|
const hadLock = previousLock !== void 0;
|
|
@@ -870,7 +874,7 @@ var cleanupPreviousFederation = async (projectDirectory, onProgress) => {
|
|
|
870
874
|
assets: [],
|
|
871
875
|
previousFiles: previousLock?.publicFiles
|
|
872
876
|
});
|
|
873
|
-
await
|
|
877
|
+
await import_promises8.default.rm(lockPath, { force: true });
|
|
874
878
|
return result;
|
|
875
879
|
}
|
|
876
880
|
);
|
|
@@ -919,8 +923,8 @@ var federateCatalog = async (projectDirectory, options = {}) => {
|
|
|
919
923
|
throw new Error(`Failed to federate source "${source.id}": ${message}`, { cause: error });
|
|
920
924
|
}
|
|
921
925
|
}
|
|
922
|
-
const outDir =
|
|
923
|
-
const lockPath =
|
|
926
|
+
const outDir = import_node_path8.default.join(projectDirectory, "federated");
|
|
927
|
+
const lockPath = import_node_path8.default.join(projectDirectory, "eventcatalog.lock");
|
|
924
928
|
const previousLock = await readLock(lockPath);
|
|
925
929
|
const resources = resolvedSources.reduce((total, source) => total + source.resolved.index.resources.length, 0);
|
|
926
930
|
const remoteIndexes = resolvedSources.map(({ resolved }) => resolved.index);
|
|
@@ -2,16 +2,16 @@ import {
|
|
|
2
2
|
FederationConflictError,
|
|
3
3
|
FederationDiagnosticError,
|
|
4
4
|
federateCatalog
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-RYPZGCRN.js";
|
|
6
6
|
import "../chunk-WRNH5C3U.js";
|
|
7
7
|
import "../chunk-5EPNFDT5.js";
|
|
8
8
|
import "../chunk-A2RZR3U4.js";
|
|
9
|
-
import "../chunk-SDZQJTJW.js";
|
|
10
|
-
import "../chunk-352FGP6W.js";
|
|
11
9
|
import "../chunk-R7Z5ALYI.js";
|
|
12
10
|
import "../chunk-JJPB6EOZ.js";
|
|
13
11
|
import "../chunk-FV56YFM4.js";
|
|
14
|
-
import "../chunk-
|
|
12
|
+
import "../chunk-SDZQJTJW.js";
|
|
13
|
+
import "../chunk-352FGP6W.js";
|
|
14
|
+
import "../chunk-JE6RX7SJ.js";
|
|
15
15
|
export {
|
|
16
16
|
FederationConflictError,
|
|
17
17
|
FederationDiagnosticError,
|
package/dist/generate.cjs
CHANGED
|
@@ -33,16 +33,20 @@ __export(generate_exports, {
|
|
|
33
33
|
generate: () => generate
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(generate_exports);
|
|
36
|
-
var
|
|
36
|
+
var import_node_path3 = __toESM(require("path"), 1);
|
|
37
37
|
|
|
38
38
|
// src/eventcatalog-config-file-utils.js
|
|
39
|
+
var import_promises2 = require("fs/promises");
|
|
40
|
+
var import_node_path2 = __toESM(require("path"), 1);
|
|
41
|
+
var import_uuid = require("uuid");
|
|
42
|
+
var import_gray_matter = __toESM(require("gray-matter"), 1);
|
|
43
|
+
|
|
44
|
+
// eventcatalog/integrations/config-loader.mjs
|
|
39
45
|
var import_promises = require("fs/promises");
|
|
40
46
|
var import_node_fs = require("fs");
|
|
41
47
|
var import_node_path = __toESM(require("path"), 1);
|
|
42
|
-
var
|
|
43
|
-
var import_url = require("url");
|
|
48
|
+
var import_node_url = require("url");
|
|
44
49
|
var import_node_os = require("os");
|
|
45
|
-
var import_gray_matter = __toESM(require("gray-matter"), 1);
|
|
46
50
|
async function cleanup(projectDirectory) {
|
|
47
51
|
const filePath = import_node_path.default.join(projectDirectory, "eventcatalog.config.mjs");
|
|
48
52
|
if ((0, import_node_fs.existsSync)(filePath)) {
|
|
@@ -90,7 +94,7 @@ var getEventCatalogConfigFile = async (projectDirectory) => {
|
|
|
90
94
|
configFilePath = import_node_path.default.join(tempDir, "eventcatalog.config.mjs");
|
|
91
95
|
await (0, import_promises.copyFile)(import_node_path.default.join(projectDirectory, "eventcatalog.config.js"), configFilePath);
|
|
92
96
|
}
|
|
93
|
-
const configFileURL = `${(0,
|
|
97
|
+
const configFileURL = `${(0, import_node_url.pathToFileURL)(configFilePath).href}?t=${Date.now()}`;
|
|
94
98
|
const config = await import(
|
|
95
99
|
/* @vite-ignore */
|
|
96
100
|
configFileURL
|
|
@@ -108,7 +112,7 @@ var getEventCatalogConfigFile = async (projectDirectory) => {
|
|
|
108
112
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
109
113
|
|
|
110
114
|
// package.json
|
|
111
|
-
var version = "4.
|
|
115
|
+
var version = "4.12.0-beta.2";
|
|
112
116
|
|
|
113
117
|
// src/constants.ts
|
|
114
118
|
var VERSION = version;
|
|
@@ -201,7 +205,7 @@ var generate = async (PROJECT_DIRECTORY) => {
|
|
|
201
205
|
let plugin = generator[0];
|
|
202
206
|
const pluginConfig = generator[1];
|
|
203
207
|
if (plugin.startsWith("./")) {
|
|
204
|
-
plugin =
|
|
208
|
+
plugin = import_node_path3.default.join(PROJECT_DIRECTORY, plugin);
|
|
205
209
|
}
|
|
206
210
|
if (plugin.includes("<rootDir>")) {
|
|
207
211
|
plugin = plugin.replace("<rootDir>", PROJECT_DIRECTORY);
|
package/dist/generate.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
generate
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-C326DCDM.js";
|
|
4
|
+
import "./chunk-FZEJ62MJ.js";
|
|
5
|
+
import "./chunk-SETCQKS3.js";
|
|
6
|
+
import "./chunk-JE6RX7SJ.js";
|
|
7
7
|
export {
|
|
8
8
|
generate
|
|
9
9
|
};
|