@eventcatalog/sdk 2.6.5 → 2.6.6

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
@@ -218,6 +218,13 @@ var getResourcePath = async (catalogDir, id, version) => {
218
218
  directory: dirname2(file.replace(catalogDir, ""))
219
219
  };
220
220
  };
221
+ var toResource = async (catalogDir, file) => {
222
+ const { data, content } = matter2.read(file);
223
+ return {
224
+ ...data,
225
+ markdown: content.trim()
226
+ };
227
+ };
221
228
  var getResources = async (catalogDir, {
222
229
  type,
223
230
  latestOnly = false,
@@ -510,6 +517,7 @@ var isService = (directory) => async (path5) => {
510
517
  const segments = relativePath.split(/[/\\]+/);
511
518
  return !!service && segments.includes("services");
512
519
  };
520
+ var toService = (directory) => async (file) => toResource(directory, file);
513
521
 
514
522
  // src/domains.ts
515
523
  import fs6 from "fs/promises";
@@ -1472,6 +1480,12 @@ var index_default = (path5) => {
1472
1480
  * @returns boolean
1473
1481
  */
1474
1482
  isService: isService(join14(path5)),
1483
+ /**
1484
+ * Converts a file to a service.
1485
+ * @param file - The file to convert to a service.
1486
+ * @returns The service.
1487
+ */
1488
+ toService: toService(join14(path5)),
1475
1489
  /**
1476
1490
  * ================================
1477
1491
  * Domains