@eventcatalog/sdk 1.4.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -43,7 +43,8 @@ var findFileById = async (catalogDir, id, version) => {
43
43
  };
44
44
  var getFiles = async (pattern, ignore = "") => {
45
45
  try {
46
- const files = await glob(pattern, { ignore: ["node_modules/**", ignore] });
46
+ const ignoreList = Array.isArray(ignore) ? ignore : [ignore];
47
+ const files = await glob(pattern, { ignore: ["node_modules/**", ...ignoreList] });
47
48
  return files;
48
49
  } catch (error) {
49
50
  throw new Error(`Error finding files: ${error}`);
@@ -155,9 +156,9 @@ var getResource = async (catalogDir, id, version, options) => {
155
156
  markdown: content.trim()
156
157
  };
157
158
  };
158
- var getResources = async (catalogDir, { type, latestOnly = false }) => {
159
- const ignore = latestOnly ? `**/versioned/**` : "";
160
- const files = await getFiles(`${catalogDir}/**/${type}/**/index.md`, ignore);
159
+ var getResources = async (catalogDir, { type, latestOnly = false, ignore = [] }) => {
160
+ const ignoreList = latestOnly ? `**/versioned/**` : "";
161
+ const files = await getFiles(`${catalogDir}/**/${type}/**/index.md`, [ignoreList, ...ignore]);
161
162
  if (files.length === 0) return;
162
163
  return files.map((file) => {
163
164
  const { data, content } = matter2.read(file);
@@ -272,7 +273,11 @@ var queryHasVersion = (directory) => async (id, version) => {
272
273
  import fs6 from "node:fs/promises";
273
274
  import { join as join6, dirname as dirname2 } from "node:path";
274
275
  var getService = (directory) => async (id, version) => getResource(directory, id, version, { type: "service" });
275
- var getServices = (directory) => async (options) => getResources(directory, { type: "services", ...options });
276
+ var getServices = (directory) => async (options) => getResources(directory, {
277
+ type: "services",
278
+ ignore: ["**/events/**", "**/commands/**", "**/queries/**"],
279
+ ...options
280
+ });
276
281
  var writeService = (directory) => async (service, options = { path: "" }) => {
277
282
  const resource = { ...service };
278
283
  if (Array.isArray(service.sends)) {
@@ -362,7 +367,11 @@ var serviceHasVersion = (directory) => async (id, version) => {
362
367
  import fs7 from "node:fs/promises";
363
368
  import { join as join7 } from "node:path";
364
369
  var getDomain = (directory) => async (id, version) => getResource(directory, id, version, { type: "domain" });
365
- var getDomains = (directory) => async (options) => getResources(directory, { type: "domains", ...options });
370
+ var getDomains = (directory) => async (options) => getResources(directory, {
371
+ type: "domains",
372
+ ignore: ["**/services/**", "**/events/**", "**/commands/**", "**/queries/**"],
373
+ ...options
374
+ });
366
375
  var writeDomain = (directory) => async (domain, options = { path: "" }) => {
367
376
  const resource = { ...domain };
368
377
  if (Array.isArray(domain.services)) {