@eventcatalog/sdk 1.4.8 → 2.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/dist/index.mjs CHANGED
@@ -13,12 +13,12 @@ import { join } from "node:path";
13
13
  import matter from "gray-matter";
14
14
  import { satisfies, validRange, valid } from "semver";
15
15
  var versionExists = async (catalogDir, id, version) => {
16
- const files = await getFiles(`${catalogDir}/**/index.md`);
16
+ const files = await getFiles(`${catalogDir}/**/index.{md,mdx}`);
17
17
  const matchedFiles = await searchFilesForId(files, id, version) || [];
18
18
  return matchedFiles.length > 0;
19
19
  };
20
20
  var findFileById = async (catalogDir, id, version) => {
21
- const files = await getFiles(`${catalogDir}/**/index.md`);
21
+ const files = await getFiles(`${catalogDir}/**/index.{md,mdx}`);
22
22
  const matchedFiles = await searchFilesForId(files, id) || [];
23
23
  const latestVersion = matchedFiles.find((path) => !path.includes("versioned"));
24
24
  if (!version) {
@@ -98,7 +98,7 @@ import fsSync2 from "node:fs";
98
98
  import { satisfies as satisfies2 } from "semver";
99
99
  import { lock, unlock } from "proper-lockfile";
100
100
  var versionResource = async (catalogDir, id) => {
101
- const files = await getFiles(`${catalogDir}/**/index.md`);
101
+ const files = await getFiles(`${catalogDir}/**/index.{md,mdx}`);
102
102
  const matchedFiles = await searchFilesForId(files, id);
103
103
  if (matchedFiles.length === 0) {
104
104
  throw new Error(`No event found with id: ${id}`);
@@ -130,7 +130,7 @@ var writeResource = async (catalogDir, resource, options = {
130
130
  const path = options.path || `/${resource.id}`;
131
131
  const fullPath = join2(catalogDir, path);
132
132
  fsSync2.mkdirSync(fullPath, { recursive: true });
133
- const lockPath = join2(fullPath, "index.md");
133
+ const lockPath = join2(fullPath, "index.mdx");
134
134
  if (!fsSync2.existsSync(lockPath)) {
135
135
  fsSync2.writeFileSync(lockPath, "");
136
136
  }
@@ -173,7 +173,7 @@ var getResource = async (catalogDir, id, version, options) => {
173
173
  };
174
174
  var getResources = async (catalogDir, { type, latestOnly = false, ignore = [] }) => {
175
175
  const ignoreList = latestOnly ? `**/versioned/**` : "";
176
- const files = await getFiles(`${catalogDir}/**/${type}/**/index.md`, [ignoreList, ...ignore]);
176
+ const files = await getFiles(`${catalogDir}/**/${type}/**/index.{md,mdx}`, [ignoreList, ...ignore]);
177
177
  if (files.length === 0) return;
178
178
  return files.map((file) => {
179
179
  const { data, content } = matter2.read(file);
@@ -184,7 +184,7 @@ var getResources = async (catalogDir, { type, latestOnly = false, ignore = [] })
184
184
  });
185
185
  };
186
186
  var rmResourceById = async (catalogDir, id, version, options) => {
187
- const files = await getFiles(`${catalogDir}/**/index.md`);
187
+ const files = await getFiles(`${catalogDir}/**/index.{md,mdx}`);
188
188
  const matchedFiles = await searchFilesForId(files, id, version);
189
189
  if (matchedFiles.length === 0) {
190
190
  throw new Error(`No ${options?.type || "resource"} found with id: ${id}`);
@@ -397,7 +397,7 @@ import { join as join7 } from "node:path";
397
397
  var getDomain = (directory) => async (id, version) => getResource(directory, id, version, { type: "domain" });
398
398
  var getDomains = (directory) => async (options) => getResources(directory, {
399
399
  type: "domains",
400
- ignore: ["**/services/**", "**/events/**", "**/commands/**", "**/queries/**"],
400
+ ignore: ["**/services/**", "**/events/**", "**/commands/**", "**/queries/**", "**/flows/**"],
401
401
  ...options
402
402
  });
403
403
  var writeDomain = (directory) => async (domain, options = { path: "" }) => {