@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.
@@ -222,6 +222,13 @@ var getResourcePath = async (catalogDir, id, version) => {
222
222
  directory: dirname2(file.replace(catalogDir, ""))
223
223
  };
224
224
  };
225
+ var toResource = async (catalogDir, file) => {
226
+ const { data, content } = matter2.read(file);
227
+ return {
228
+ ...data,
229
+ markdown: content.trim()
230
+ };
231
+ };
225
232
  var getResources = async (catalogDir, {
226
233
  type,
227
234
  latestOnly = false,
@@ -514,6 +521,7 @@ var isService = (directory) => async (path5) => {
514
521
  const segments = relativePath.split(/[/\\]+/);
515
522
  return !!service && segments.includes("services");
516
523
  };
524
+ var toService = (directory) => async (file) => toResource(directory, file);
517
525
 
518
526
  // src/domains.ts
519
527
  import fs6 from "fs/promises";
@@ -1379,6 +1387,12 @@ var index_default = (path5) => {
1379
1387
  * @returns boolean
1380
1388
  */
1381
1389
  isService: isService(join13(path5)),
1390
+ /**
1391
+ * Converts a file to a service.
1392
+ * @param file - The file to convert to a service.
1393
+ * @returns The service.
1394
+ */
1395
+ toService: toService(join13(path5)),
1382
1396
  /**
1383
1397
  * ================================
1384
1398
  * Domains