@eventcatalog/sdk 2.0.1 → 2.1.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.js CHANGED
@@ -33,7 +33,7 @@ __export(index_exports, {
33
33
  default: () => index_default
34
34
  });
35
35
  module.exports = __toCommonJS(index_exports);
36
- var import_node_path10 = require("path");
36
+ var import_node_path11 = require("path");
37
37
 
38
38
  // src/events.ts
39
39
  var import_promises2 = __toESM(require("fs/promises"));
@@ -54,13 +54,13 @@ var versionExists = async (catalogDir, id, version) => {
54
54
  var findFileById = async (catalogDir, id, version) => {
55
55
  const files = await getFiles(`${catalogDir}/**/index.{md,mdx}`);
56
56
  const matchedFiles = await searchFilesForId(files, id) || [];
57
- const latestVersion = matchedFiles.find((path) => !path.includes("versioned"));
57
+ const latestVersion = matchedFiles.find((path2) => !path2.includes("versioned"));
58
58
  if (!version) {
59
59
  return latestVersion;
60
60
  }
61
- const parsedFiles = matchedFiles.map((path) => {
62
- const { data } = import_gray_matter.default.read(path);
63
- return { ...data, path };
61
+ const parsedFiles = matchedFiles.map((path2) => {
62
+ const { data } = import_gray_matter.default.read(path2);
63
+ return { ...data, path: path2 };
64
64
  });
65
65
  const semverRange = (0, import_semver.validRange)(version);
66
66
  if (semverRange && (0, import_semver.valid)(version)) {
@@ -84,6 +84,11 @@ var getFiles = async (pattern, ignore = "") => {
84
84
  throw new Error(`Error finding files: ${error}`);
85
85
  }
86
86
  };
87
+ var readMdxFile = async (path2) => {
88
+ const { data } = import_gray_matter.default.read(path2);
89
+ const { markdown, ...frontmatter } = data;
90
+ return { ...frontmatter, markdown };
91
+ };
87
92
  var searchFilesForId = async (files, id, version) => {
88
93
  const idRegex = new RegExp(`^id:\\s*(['"]|>-)?\\s*${id}['"]?\\s*$`, "m");
89
94
  const versionRegex = new RegExp(`^version:\\s*['"]?${version}['"]?\\s*$`, "m");
@@ -161,8 +166,8 @@ var writeResource = async (catalogDir, resource, options = {
161
166
  override: false,
162
167
  versionExistingContent: false
163
168
  }) => {
164
- const path = options.path || `/${resource.id}`;
165
- const fullPath = (0, import_path.join)(catalogDir, path);
169
+ const path2 = options.path || `/${resource.id}`;
170
+ const fullPath = (0, import_path.join)(catalogDir, path2);
166
171
  import_node_fs2.default.mkdirSync(fullPath, { recursive: true });
167
172
  const lockPath = (0, import_path.join)(fullPath, "index.mdx");
168
173
  if (!import_node_fs2.default.existsSync(lockPath)) {
@@ -205,9 +210,15 @@ var getResource = async (catalogDir, id, version, options) => {
205
210
  markdown: content.trim()
206
211
  };
207
212
  };
208
- var getResources = async (catalogDir, { type, latestOnly = false, ignore = [] }) => {
213
+ var getResources = async (catalogDir, {
214
+ type,
215
+ latestOnly = false,
216
+ ignore = [],
217
+ pattern = ""
218
+ }) => {
209
219
  const ignoreList = latestOnly ? `**/versioned/**` : "";
210
- const files = await getFiles(`${catalogDir}/**/${type}/**/index.{md,mdx}`, [ignoreList, ...ignore]);
220
+ const filePattern = pattern || `${catalogDir}/**/${type}/**/index.{md,mdx}`;
221
+ const files = await getFiles(filePattern, [ignoreList, ...ignore]);
211
222
  if (files.length === 0) return;
212
223
  return files.map((file) => {
213
224
  const { data, content } = import_gray_matter2.default.read(file);
@@ -263,8 +274,8 @@ var writeEventToService = (directory) => async (event, service, options = { path
263
274
  pathForEvent = (0, import_node_path2.join)(pathForEvent, event.id);
264
275
  await writeResource(directory, { ...event }, { ...options, path: pathForEvent, type: "event" });
265
276
  };
266
- var rmEvent = (directory) => async (path) => {
267
- await import_promises2.default.rm((0, import_node_path2.join)(directory, path), { recursive: true });
277
+ var rmEvent = (directory) => async (path2) => {
278
+ await import_promises2.default.rm((0, import_node_path2.join)(directory, path2), { recursive: true });
268
279
  };
269
280
  var rmEventById = (directory) => async (id, version, persistFiles) => {
270
281
  await rmResourceById(directory, id, version, { type: "event", persistFiles });
@@ -290,8 +301,8 @@ var writeCommandToService = (directory) => async (command, service, options = {
290
301
  pathForEvent = (0, import_node_path3.join)(pathForEvent, command.id);
291
302
  await writeResource(directory, { ...command }, { ...options, path: pathForEvent, type: "command" });
292
303
  };
293
- var rmCommand = (directory) => async (path) => {
294
- await import_promises3.default.rm((0, import_node_path3.join)(directory, path), { recursive: true });
304
+ var rmCommand = (directory) => async (path2) => {
305
+ await import_promises3.default.rm((0, import_node_path3.join)(directory, path2), { recursive: true });
295
306
  };
296
307
  var rmCommandById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "command", persistFiles });
297
308
  var versionCommand = (directory) => async (id) => versionResource(directory, id);
@@ -315,8 +326,8 @@ var writeQueryToService = (directory) => async (query, service, options = { path
315
326
  pathForQuery = (0, import_node_path4.join)(pathForQuery, query.id);
316
327
  await writeResource(directory, { ...query }, { ...options, path: pathForQuery, type: "query" });
317
328
  };
318
- var rmQuery = (directory) => async (path) => {
319
- await import_promises4.default.rm((0, import_node_path4.join)(directory, path), { recursive: true });
329
+ var rmQuery = (directory) => async (path2) => {
330
+ await import_promises4.default.rm((0, import_node_path4.join)(directory, path2), { recursive: true });
320
331
  };
321
332
  var rmQueryById = (directory) => async (id, version, persistFiles) => {
322
333
  await rmResourceById(directory, id, version, { type: "query", persistFiles });
@@ -352,8 +363,8 @@ var writeService = (directory) => async (service, options = { path: "" }) => {
352
363
  };
353
364
  var writeVersionedService = (directory) => async (service) => {
354
365
  const resource = { ...service };
355
- const path = getVersionedDirectory(service.id, service.version);
356
- return await writeService(directory)(resource, { path });
366
+ const path2 = getVersionedDirectory(service.id, service.version);
367
+ return await writeService(directory)(resource, { path: path2 });
357
368
  };
358
369
  var writeServiceToDomain = (directory) => async (service, domain, options = { path: "" }) => {
359
370
  let pathForService = domain.version && domain.version !== "latest" ? `/${domain.id}/versioned/${domain.version}/services` : `/${domain.id}/services`;
@@ -361,8 +372,8 @@ var writeServiceToDomain = (directory) => async (service, domain, options = { pa
361
372
  await writeResource(directory, { ...service }, { ...options, path: pathForService, type: "service" });
362
373
  };
363
374
  var versionService = (directory) => async (id) => versionResource(directory, id);
364
- var rmService = (directory) => async (path) => {
365
- await import_promises5.default.rm((0, import_node_path5.join)(directory, path), { recursive: true });
375
+ var rmService = (directory) => async (path2) => {
376
+ await import_promises5.default.rm((0, import_node_path5.join)(directory, path2), { recursive: true });
366
377
  };
367
378
  var rmServiceById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "service", persistFiles });
368
379
  var addFileToService = (directory) => async (id, file, version) => addFileToResource(directory, id, file, version);
@@ -415,8 +426,8 @@ var addMessageToService = (directory) => async (id, direction, event, version) =
415
426
  if (!existingResource) {
416
427
  throw new Error(`Cannot find service ${id} in the catalog`);
417
428
  }
418
- const path = existingResource.split("/services")[0];
419
- const pathToResource = (0, import_node_path5.join)(path, "services");
429
+ const path2 = existingResource.split("/services")[0];
430
+ const pathToResource = (0, import_node_path5.join)(path2, "services");
420
431
  await rmServiceById(directory)(id, version);
421
432
  await writeService(pathToResource)(service);
422
433
  };
@@ -442,8 +453,8 @@ var writeDomain = (directory) => async (domain, options = { path: "" }) => {
442
453
  return await writeResource(directory, resource, { ...options, type: "domain" });
443
454
  };
444
455
  var versionDomain = (directory) => async (id) => versionResource(directory, id);
445
- var rmDomain = (directory) => async (path) => {
446
- await import_promises6.default.rm((0, import_node_path6.join)(directory, path), { recursive: true });
456
+ var rmDomain = (directory) => async (path2) => {
457
+ await import_promises6.default.rm((0, import_node_path6.join)(directory, path2), { recursive: true });
447
458
  };
448
459
  var rmDomainById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "domain", persistFiles });
449
460
  var addFileToDomain = (directory) => async (id, file, version) => addFileToResource(directory, id, file, version);
@@ -471,8 +482,8 @@ var import_node_path7 = require("path");
471
482
  var getChannel = (directory) => async (id, version) => getResource(directory, id, version, { type: "channel" });
472
483
  var getChannels = (directory) => async (options) => getResources(directory, { type: "channels", ...options });
473
484
  var writeChannel = (directory) => async (channel, options = { path: "" }) => writeResource(directory, { ...channel }, { ...options, type: "channel" });
474
- var rmChannel = (directory) => async (path) => {
475
- await import_promises7.default.rm((0, import_node_path7.join)(directory, path), { recursive: true });
485
+ var rmChannel = (directory) => async (path2) => {
486
+ await import_promises7.default.rm((0, import_node_path7.join)(directory, path2), { recursive: true });
476
487
  };
477
488
  var rmChannelById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "channel", persistFiles });
478
489
  var versionChannel = (directory) => async (id) => versionResource(directory, id);
@@ -511,22 +522,58 @@ var addMessageToChannel = (directory, collection) => async (id, _message, versio
511
522
  if (!existingResource) {
512
523
  throw new Error(`Cannot find message ${id} in the catalog`);
513
524
  }
514
- const path = existingResource.split(`/${collection}`)[0];
515
- const pathToResource = (0, import_node_path7.join)(path, collection);
525
+ const path2 = existingResource.split(`/${collection}`)[0];
526
+ const pathToResource = (0, import_node_path7.join)(path2, collection);
516
527
  await rmMessageById(directory)(_message.id, _message.version, true);
517
528
  await writeMessage(pathToResource)(message);
518
529
  };
519
530
 
520
- // src/teams.ts
521
- var import_promises8 = __toESM(require("fs/promises"));
531
+ // src/custom-docs.ts
532
+ var import_node_path8 = __toESM(require("path"));
522
533
  var import_node_fs3 = __toESM(require("fs"));
523
- var import_node_path8 = require("path");
534
+ var import_promises8 = __toESM(require("fs/promises"));
524
535
  var import_gray_matter3 = __toESM(require("gray-matter"));
536
+ var import_slugify = __toESM(require("slugify"));
537
+ var getCustomDoc = (directory) => async (filePath) => {
538
+ const fullPath = import_node_path8.default.join(directory, filePath);
539
+ const fullPathWithExtension = fullPath.endsWith(".mdx") ? fullPath : `${fullPath}.mdx`;
540
+ const fileExists = import_node_fs3.default.existsSync(fullPathWithExtension);
541
+ if (!fileExists) {
542
+ return void 0;
543
+ }
544
+ return readMdxFile(fullPathWithExtension);
545
+ };
546
+ var getCustomDocs = (directory) => async (options) => {
547
+ if (options?.path) {
548
+ const pattern = `${directory}/${options.path}/**/*.{md,mdx}`;
549
+ return getResources(directory, { type: "docs", pattern });
550
+ }
551
+ return getResources(directory, { type: "docs", pattern: `${directory}/**/*.{md,mdx}` });
552
+ };
553
+ var writeCustomDoc = (directory) => async (customDoc, options = { path: "" }) => {
554
+ const { fileName, ...rest } = customDoc;
555
+ const name = fileName || (0, import_slugify.default)(customDoc.title, { lower: true });
556
+ const withExtension = name.endsWith(".mdx") ? name : `${name}.mdx`;
557
+ const fullPath = import_node_path8.default.join(directory, options.path || "", withExtension);
558
+ import_node_fs3.default.mkdirSync(import_node_path8.default.dirname(fullPath), { recursive: true });
559
+ const document = import_gray_matter3.default.stringify(customDoc.markdown.trim(), rest);
560
+ import_node_fs3.default.writeFileSync(fullPath, document);
561
+ };
562
+ var rmCustomDoc = (directory) => async (filePath) => {
563
+ const withExtension = filePath.endsWith(".mdx") ? filePath : `${filePath}.mdx`;
564
+ await import_promises8.default.rm((0, import_node_path8.join)(directory, withExtension), { recursive: true });
565
+ };
566
+
567
+ // src/teams.ts
568
+ var import_promises9 = __toESM(require("fs/promises"));
569
+ var import_node_fs4 = __toESM(require("fs"));
570
+ var import_node_path9 = require("path");
571
+ var import_gray_matter4 = __toESM(require("gray-matter"));
525
572
  var getTeam = (catalogDir) => async (id) => {
526
573
  const files = await getFiles(`${catalogDir}/${id}.md`);
527
574
  if (files.length == 0) return void 0;
528
575
  const file = files[0];
529
- const { data, content } = import_gray_matter3.default.read(file);
576
+ const { data, content } = import_gray_matter4.default.read(file);
530
577
  return {
531
578
  ...data,
532
579
  id: data.id,
@@ -538,7 +585,7 @@ var getTeams = (catalogDir) => async (options) => {
538
585
  const files = await getFiles(`${catalogDir}/teams/*.md`);
539
586
  if (files.length === 0) return [];
540
587
  return files.map((file) => {
541
- const { data, content } = import_gray_matter3.default.read(file);
588
+ const { data, content } = import_gray_matter4.default.read(file);
542
589
  return {
543
590
  ...data,
544
591
  id: data.id,
@@ -555,23 +602,23 @@ var writeTeam = (catalogDir) => async (team, options = {}) => {
555
602
  throw new Error(`Failed to write ${resource.id} (team) as it already exists`);
556
603
  }
557
604
  const { markdown, ...frontmatter } = resource;
558
- const document = import_gray_matter3.default.stringify(markdown, frontmatter);
559
- import_node_fs3.default.mkdirSync((0, import_node_path8.join)(catalogDir, ""), { recursive: true });
560
- import_node_fs3.default.writeFileSync((0, import_node_path8.join)(catalogDir, "", `${resource.id}.md`), document);
605
+ const document = import_gray_matter4.default.stringify(markdown, frontmatter);
606
+ import_node_fs4.default.mkdirSync((0, import_node_path9.join)(catalogDir, ""), { recursive: true });
607
+ import_node_fs4.default.writeFileSync((0, import_node_path9.join)(catalogDir, "", `${resource.id}.md`), document);
561
608
  };
562
609
  var rmTeamById = (catalogDir) => async (id) => {
563
- await import_promises8.default.rm((0, import_node_path8.join)(catalogDir, `${id}.md`), { recursive: true });
610
+ await import_promises9.default.rm((0, import_node_path9.join)(catalogDir, `${id}.md`), { recursive: true });
564
611
  };
565
612
 
566
613
  // src/users.ts
567
- var import_node_fs4 = __toESM(require("fs"));
568
- var import_node_path9 = require("path");
569
- var import_gray_matter4 = __toESM(require("gray-matter"));
614
+ var import_node_fs5 = __toESM(require("fs"));
615
+ var import_node_path10 = require("path");
616
+ var import_gray_matter5 = __toESM(require("gray-matter"));
570
617
  var getUser = (catalogDir) => async (id) => {
571
618
  const files = await getFiles(`${catalogDir}/${id}.md`);
572
619
  if (files.length == 0) return void 0;
573
620
  const file = files[0];
574
- const { data, content } = import_gray_matter4.default.read(file);
621
+ const { data, content } = import_gray_matter5.default.read(file);
575
622
  return {
576
623
  ...data,
577
624
  id: data.id,
@@ -584,7 +631,7 @@ var getUsers = (catalogDir) => async (options) => {
584
631
  const files = await getFiles(`${catalogDir}/users/*.md`);
585
632
  if (files.length === 0) return [];
586
633
  return files.map((file) => {
587
- const { data, content } = import_gray_matter4.default.read(file);
634
+ const { data, content } = import_gray_matter5.default.read(file);
588
635
  return {
589
636
  ...data,
590
637
  id: data.id,
@@ -602,16 +649,16 @@ var writeUser = (catalogDir) => async (user, options = {}) => {
602
649
  throw new Error(`Failed to write ${resource.id} (user) as it already exists`);
603
650
  }
604
651
  const { markdown, ...frontmatter } = resource;
605
- const document = import_gray_matter4.default.stringify(markdown, frontmatter);
606
- import_node_fs4.default.mkdirSync((0, import_node_path9.join)(catalogDir, ""), { recursive: true });
607
- import_node_fs4.default.writeFileSync((0, import_node_path9.join)(catalogDir, "", `${resource.id}.md`), document);
652
+ const document = import_gray_matter5.default.stringify(markdown, frontmatter);
653
+ import_node_fs5.default.mkdirSync((0, import_node_path10.join)(catalogDir, ""), { recursive: true });
654
+ import_node_fs5.default.writeFileSync((0, import_node_path10.join)(catalogDir, "", `${resource.id}.md`), document);
608
655
  };
609
656
  var rmUserById = (catalogDir) => async (id) => {
610
- import_node_fs4.default.rmSync((0, import_node_path9.join)(catalogDir, `${id}.md`), { recursive: true });
657
+ import_node_fs5.default.rmSync((0, import_node_path10.join)(catalogDir, `${id}.md`), { recursive: true });
611
658
  };
612
659
 
613
660
  // src/index.ts
614
- var index_default = (path) => {
661
+ var index_default = (path2) => {
615
662
  return {
616
663
  /**
617
664
  * Returns an events from EventCatalog
@@ -619,13 +666,13 @@ var index_default = (path) => {
619
666
  * @param version - Optional id of the version to get (supports semver)
620
667
  * @returns Event|Undefined
621
668
  */
622
- getEvent: getEvent((0, import_node_path10.join)(path)),
669
+ getEvent: getEvent((0, import_node_path11.join)(path2)),
623
670
  /**
624
671
  * Returns all events from EventCatalog
625
672
  * @param latestOnly - optional boolean, set to true to get only latest versions
626
673
  * @returns Event[]|Undefined
627
674
  */
628
- getEvents: getEvents((0, import_node_path10.join)(path)),
675
+ getEvents: getEvents((0, import_node_path11.join)(path2)),
629
676
  /**
630
677
  * Adds an event to EventCatalog
631
678
  *
@@ -633,7 +680,7 @@ var index_default = (path) => {
633
680
  * @param options - Optional options to write the event
634
681
  *
635
682
  */
636
- writeEvent: writeEvent((0, import_node_path10.join)(path, "events")),
683
+ writeEvent: writeEvent((0, import_node_path11.join)(path2, "events")),
637
684
  /**
638
685
  * Adds an event to a service in EventCatalog
639
686
  *
@@ -642,26 +689,26 @@ var index_default = (path) => {
642
689
  * @param options - Optional options to write the event
643
690
  *
644
691
  */
645
- writeEventToService: writeEventToService((0, import_node_path10.join)(path, "services")),
692
+ writeEventToService: writeEventToService((0, import_node_path11.join)(path2, "services")),
646
693
  /**
647
694
  * Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
648
695
  *
649
696
  * @param path - The path to your event, e.g. `/Inventory/InventoryAdjusted`
650
697
  *
651
698
  */
652
- rmEvent: rmEvent((0, import_node_path10.join)(path, "events")),
699
+ rmEvent: rmEvent((0, import_node_path11.join)(path2, "events")),
653
700
  /**
654
701
  * Remove an event by an Event id
655
702
  *
656
703
  * @param id - The id of the event you want to remove
657
704
  *
658
705
  */
659
- rmEventById: rmEventById((0, import_node_path10.join)(path)),
706
+ rmEventById: rmEventById((0, import_node_path11.join)(path2)),
660
707
  /**
661
708
  * Moves a given event id to the version directory
662
709
  * @param directory
663
710
  */
664
- versionEvent: versionEvent((0, import_node_path10.join)(path)),
711
+ versionEvent: versionEvent((0, import_node_path11.join)(path2)),
665
712
  /**
666
713
  * Adds a file to the given event
667
714
  * @param id - The id of the event to add the file to
@@ -669,7 +716,7 @@ var index_default = (path) => {
669
716
  * @param version - Optional version of the event to add the file to
670
717
  * @returns
671
718
  */
672
- addFileToEvent: addFileToEvent((0, import_node_path10.join)(path)),
719
+ addFileToEvent: addFileToEvent((0, import_node_path11.join)(path2)),
673
720
  /**
674
721
  * Adds a schema to the given event
675
722
  * @param id - The id of the event to add the schema to
@@ -677,14 +724,14 @@ var index_default = (path) => {
677
724
  * @param version - Optional version of the event to add the schema to
678
725
  * @returns
679
726
  */
680
- addSchemaToEvent: addSchemaToEvent((0, import_node_path10.join)(path)),
727
+ addSchemaToEvent: addSchemaToEvent((0, import_node_path11.join)(path2)),
681
728
  /**
682
729
  * Check to see if an event version exists
683
730
  * @param id - The id of the event
684
731
  * @param version - The version of the event (supports semver)
685
732
  * @returns
686
733
  */
687
- eventHasVersion: eventHasVersion((0, import_node_path10.join)(path)),
734
+ eventHasVersion: eventHasVersion((0, import_node_path11.join)(path2)),
688
735
  /**
689
736
  * ================================
690
737
  * Commands
@@ -696,13 +743,13 @@ var index_default = (path) => {
696
743
  * @param version - Optional id of the version to get (supports semver)
697
744
  * @returns Command|Undefined
698
745
  */
699
- getCommand: getCommand((0, import_node_path10.join)(path)),
746
+ getCommand: getCommand((0, import_node_path11.join)(path2)),
700
747
  /**
701
748
  * Returns all commands from EventCatalog
702
749
  * @param latestOnly - optional boolean, set to true to get only latest versions
703
750
  * @returns Command[]|Undefined
704
751
  */
705
- getCommands: getCommands((0, import_node_path10.join)(path)),
752
+ getCommands: getCommands((0, import_node_path11.join)(path2)),
706
753
  /**
707
754
  * Adds an command to EventCatalog
708
755
  *
@@ -710,7 +757,7 @@ var index_default = (path) => {
710
757
  * @param options - Optional options to write the command
711
758
  *
712
759
  */
713
- writeCommand: writeCommand((0, import_node_path10.join)(path, "commands")),
760
+ writeCommand: writeCommand((0, import_node_path11.join)(path2, "commands")),
714
761
  /**
715
762
  * Adds a command to a service in EventCatalog
716
763
  *
@@ -719,26 +766,26 @@ var index_default = (path) => {
719
766
  * @param options - Optional options to write the command
720
767
  *
721
768
  */
722
- writeCommandToService: writeCommandToService((0, import_node_path10.join)(path, "services")),
769
+ writeCommandToService: writeCommandToService((0, import_node_path11.join)(path2, "services")),
723
770
  /**
724
771
  * Remove an command to EventCatalog (modeled on the standard POSIX rm utility)
725
772
  *
726
773
  * @param path - The path to your command, e.g. `/Inventory/InventoryAdjusted`
727
774
  *
728
775
  */
729
- rmCommand: rmCommand((0, import_node_path10.join)(path, "commands")),
776
+ rmCommand: rmCommand((0, import_node_path11.join)(path2, "commands")),
730
777
  /**
731
778
  * Remove an command by an Event id
732
779
  *
733
780
  * @param id - The id of the command you want to remove
734
781
  *
735
782
  */
736
- rmCommandById: rmCommandById((0, import_node_path10.join)(path)),
783
+ rmCommandById: rmCommandById((0, import_node_path11.join)(path2)),
737
784
  /**
738
785
  * Moves a given command id to the version directory
739
786
  * @param directory
740
787
  */
741
- versionCommand: versionCommand((0, import_node_path10.join)(path)),
788
+ versionCommand: versionCommand((0, import_node_path11.join)(path2)),
742
789
  /**
743
790
  * Adds a file to the given command
744
791
  * @param id - The id of the command to add the file to
@@ -746,7 +793,7 @@ var index_default = (path) => {
746
793
  * @param version - Optional version of the command to add the file to
747
794
  * @returns
748
795
  */
749
- addFileToCommand: addFileToCommand((0, import_node_path10.join)(path)),
796
+ addFileToCommand: addFileToCommand((0, import_node_path11.join)(path2)),
750
797
  /**
751
798
  * Adds a schema to the given command
752
799
  * @param id - The id of the command to add the schema to
@@ -754,14 +801,14 @@ var index_default = (path) => {
754
801
  * @param version - Optional version of the command to add the schema to
755
802
  * @returns
756
803
  */
757
- addSchemaToCommand: addSchemaToCommand((0, import_node_path10.join)(path)),
804
+ addSchemaToCommand: addSchemaToCommand((0, import_node_path11.join)(path2)),
758
805
  /**
759
806
  * Check to see if a command version exists
760
807
  * @param id - The id of the command
761
808
  * @param version - The version of the command (supports semver)
762
809
  * @returns
763
810
  */
764
- commandHasVersion: commandHasVersion((0, import_node_path10.join)(path)),
811
+ commandHasVersion: commandHasVersion((0, import_node_path11.join)(path2)),
765
812
  /**
766
813
  * ================================
767
814
  * Queries
@@ -773,13 +820,13 @@ var index_default = (path) => {
773
820
  * @param version - Optional id of the version to get (supports semver)
774
821
  * @returns Query|Undefined
775
822
  */
776
- getQuery: getQuery((0, import_node_path10.join)(path)),
823
+ getQuery: getQuery((0, import_node_path11.join)(path2)),
777
824
  /**
778
825
  * Returns all queries from EventCatalog
779
826
  * @param latestOnly - optional boolean, set to true to get only latest versions
780
827
  * @returns Query[]|Undefined
781
828
  */
782
- getQueries: getQueries((0, import_node_path10.join)(path)),
829
+ getQueries: getQueries((0, import_node_path11.join)(path2)),
783
830
  /**
784
831
  * Adds a query to EventCatalog
785
832
  *
@@ -787,7 +834,7 @@ var index_default = (path) => {
787
834
  * @param options - Optional options to write the event
788
835
  *
789
836
  */
790
- writeQuery: writeQuery((0, import_node_path10.join)(path, "queries")),
837
+ writeQuery: writeQuery((0, import_node_path11.join)(path2, "queries")),
791
838
  /**
792
839
  * Adds a query to a service in EventCatalog
793
840
  *
@@ -796,26 +843,26 @@ var index_default = (path) => {
796
843
  * @param options - Optional options to write the query
797
844
  *
798
845
  */
799
- writeQueryToService: writeQueryToService((0, import_node_path10.join)(path, "services")),
846
+ writeQueryToService: writeQueryToService((0, import_node_path11.join)(path2, "services")),
800
847
  /**
801
848
  * Remove an query to EventCatalog (modeled on the standard POSIX rm utility)
802
849
  *
803
850
  * @param path - The path to your query, e.g. `/Orders/GetOrder`
804
851
  *
805
852
  */
806
- rmQuery: rmQuery((0, import_node_path10.join)(path, "queries")),
853
+ rmQuery: rmQuery((0, import_node_path11.join)(path2, "queries")),
807
854
  /**
808
855
  * Remove a query by a Query id
809
856
  *
810
857
  * @param id - The id of the query you want to remove
811
858
  *
812
859
  */
813
- rmQueryById: rmQueryById((0, import_node_path10.join)(path)),
860
+ rmQueryById: rmQueryById((0, import_node_path11.join)(path2)),
814
861
  /**
815
862
  * Moves a given query id to the version directory
816
863
  * @param directory
817
864
  */
818
- versionQuery: versionQuery((0, import_node_path10.join)(path)),
865
+ versionQuery: versionQuery((0, import_node_path11.join)(path2)),
819
866
  /**
820
867
  * Adds a file to the given query
821
868
  * @param id - The id of the query to add the file to
@@ -823,7 +870,7 @@ var index_default = (path) => {
823
870
  * @param version - Optional version of the query to add the file to
824
871
  * @returns
825
872
  */
826
- addFileToQuery: addFileToQuery((0, import_node_path10.join)(path)),
873
+ addFileToQuery: addFileToQuery((0, import_node_path11.join)(path2)),
827
874
  /**
828
875
  * Adds a schema to the given query
829
876
  * @param id - The id of the query to add the schema to
@@ -831,14 +878,14 @@ var index_default = (path) => {
831
878
  * @param version - Optional version of the query to add the schema to
832
879
  * @returns
833
880
  */
834
- addSchemaToQuery: addSchemaToQuery((0, import_node_path10.join)(path)),
881
+ addSchemaToQuery: addSchemaToQuery((0, import_node_path11.join)(path2)),
835
882
  /**
836
883
  * Check to see if an query version exists
837
884
  * @param id - The id of the query
838
885
  * @param version - The version of the query (supports semver)
839
886
  * @returns
840
887
  */
841
- queryHasVersion: queryHasVersion((0, import_node_path10.join)(path)),
888
+ queryHasVersion: queryHasVersion((0, import_node_path11.join)(path2)),
842
889
  /**
843
890
  * ================================
844
891
  * Channels
@@ -850,13 +897,13 @@ var index_default = (path) => {
850
897
  * @param version - Optional id of the version to get (supports semver)
851
898
  * @returns Channel|Undefined
852
899
  */
853
- getChannel: getChannel((0, import_node_path10.join)(path)),
900
+ getChannel: getChannel((0, import_node_path11.join)(path2)),
854
901
  /**
855
902
  * Returns all channels from EventCatalog
856
903
  * @param latestOnly - optional boolean, set to true to get only latest versions
857
904
  * @returns Channel[]|Undefined
858
905
  */
859
- getChannels: getChannels((0, import_node_path10.join)(path)),
906
+ getChannels: getChannels((0, import_node_path11.join)(path2)),
860
907
  /**
861
908
  * Adds an channel to EventCatalog
862
909
  *
@@ -864,33 +911,33 @@ var index_default = (path) => {
864
911
  * @param options - Optional options to write the channel
865
912
  *
866
913
  */
867
- writeChannel: writeChannel((0, import_node_path10.join)(path, "channels")),
914
+ writeChannel: writeChannel((0, import_node_path11.join)(path2, "channels")),
868
915
  /**
869
916
  * Remove an channel to EventCatalog (modeled on the standard POSIX rm utility)
870
917
  *
871
918
  * @param path - The path to your channel, e.g. `/Inventory/InventoryAdjusted`
872
919
  *
873
920
  */
874
- rmChannel: rmChannel((0, import_node_path10.join)(path, "channels")),
921
+ rmChannel: rmChannel((0, import_node_path11.join)(path2, "channels")),
875
922
  /**
876
923
  * Remove an channel by an Event id
877
924
  *
878
925
  * @param id - The id of the channel you want to remove
879
926
  *
880
927
  */
881
- rmChannelById: rmChannelById((0, import_node_path10.join)(path)),
928
+ rmChannelById: rmChannelById((0, import_node_path11.join)(path2)),
882
929
  /**
883
930
  * Moves a given channel id to the version directory
884
931
  * @param directory
885
932
  */
886
- versionChannel: versionChannel((0, import_node_path10.join)(path)),
933
+ versionChannel: versionChannel((0, import_node_path11.join)(path2)),
887
934
  /**
888
935
  * Check to see if a channel version exists
889
936
  * @param id - The id of the channel
890
937
  * @param version - The version of the channel (supports semver)
891
938
  * @returns
892
939
  */
893
- channelHasVersion: channelHasVersion((0, import_node_path10.join)(path)),
940
+ channelHasVersion: channelHasVersion((0, import_node_path11.join)(path2)),
894
941
  /**
895
942
  * Add a channel to an event
896
943
  *
@@ -907,7 +954,7 @@ var index_default = (path) => {
907
954
  *
908
955
  * ```
909
956
  */
910
- addEventToChannel: addMessageToChannel((0, import_node_path10.join)(path), "events"),
957
+ addEventToChannel: addMessageToChannel((0, import_node_path11.join)(path2), "events"),
911
958
  /**
912
959
  * Add a channel to an command
913
960
  *
@@ -924,7 +971,7 @@ var index_default = (path) => {
924
971
  *
925
972
  * ```
926
973
  */
927
- addCommandToChannel: addMessageToChannel((0, import_node_path10.join)(path), "commands"),
974
+ addCommandToChannel: addMessageToChannel((0, import_node_path11.join)(path2), "commands"),
928
975
  /**
929
976
  * Add a channel to an query
930
977
  *
@@ -941,7 +988,7 @@ var index_default = (path) => {
941
988
  *
942
989
  * ```
943
990
  */
944
- addQueryToChannel: addMessageToChannel((0, import_node_path10.join)(path), "queries"),
991
+ addQueryToChannel: addMessageToChannel((0, import_node_path11.join)(path2), "queries"),
945
992
  /**
946
993
  * ================================
947
994
  * SERVICES
@@ -954,14 +1001,14 @@ var index_default = (path) => {
954
1001
  * @param options - Optional options to write the event
955
1002
  *
956
1003
  */
957
- writeService: writeService((0, import_node_path10.join)(path, "services")),
1004
+ writeService: writeService((0, import_node_path11.join)(path2, "services")),
958
1005
  /**
959
1006
  * Adds a versioned service to EventCatalog
960
1007
  *
961
1008
  * @param service - The service to write
962
1009
  *
963
1010
  */
964
- writeVersionedService: writeVersionedService((0, import_node_path10.join)(path, "services")),
1011
+ writeVersionedService: writeVersionedService((0, import_node_path11.join)(path2, "services")),
965
1012
  /**
966
1013
  * Adds a service to a domain in EventCatalog
967
1014
  *
@@ -970,39 +1017,39 @@ var index_default = (path) => {
970
1017
  * @param options - Optional options to write the event
971
1018
  *
972
1019
  */
973
- writeServiceToDomain: writeServiceToDomain((0, import_node_path10.join)(path, "domains")),
1020
+ writeServiceToDomain: writeServiceToDomain((0, import_node_path11.join)(path2, "domains")),
974
1021
  /**
975
1022
  * Returns a service from EventCatalog
976
1023
  * @param id - The id of the service to retrieve
977
1024
  * @param version - Optional id of the version to get (supports semver)
978
1025
  * @returns Service|Undefined
979
1026
  */
980
- getService: getService((0, import_node_path10.join)(path)),
1027
+ getService: getService((0, import_node_path11.join)(path2)),
981
1028
  /**
982
1029
  * Returns all services from EventCatalog
983
1030
  * @param latestOnly - optional boolean, set to true to get only latest versions
984
1031
  * @returns Service[]|Undefined
985
1032
  */
986
- getServices: getServices((0, import_node_path10.join)(path)),
1033
+ getServices: getServices((0, import_node_path11.join)(path2)),
987
1034
  /**
988
1035
  * Moves a given service id to the version directory
989
1036
  * @param directory
990
1037
  */
991
- versionService: versionService((0, import_node_path10.join)(path)),
1038
+ versionService: versionService((0, import_node_path11.join)(path2)),
992
1039
  /**
993
1040
  * Remove a service from EventCatalog (modeled on the standard POSIX rm utility)
994
1041
  *
995
1042
  * @param path - The path to your service, e.g. `/InventoryService`
996
1043
  *
997
1044
  */
998
- rmService: rmService((0, import_node_path10.join)(path, "services")),
1045
+ rmService: rmService((0, import_node_path11.join)(path2, "services")),
999
1046
  /**
1000
1047
  * Remove an service by an service id
1001
1048
  *
1002
1049
  * @param id - The id of the service you want to remove
1003
1050
  *
1004
1051
  */
1005
- rmServiceById: rmServiceById((0, import_node_path10.join)(path)),
1052
+ rmServiceById: rmServiceById((0, import_node_path11.join)(path2)),
1006
1053
  /**
1007
1054
  * Adds a file to the given service
1008
1055
  * @param id - The id of the service to add the file to
@@ -1010,21 +1057,21 @@ var index_default = (path) => {
1010
1057
  * @param version - Optional version of the service to add the file to
1011
1058
  * @returns
1012
1059
  */
1013
- addFileToService: addFileToService((0, import_node_path10.join)(path)),
1060
+ addFileToService: addFileToService((0, import_node_path11.join)(path2)),
1014
1061
  /**
1015
1062
  * Returns the specifications for a given service
1016
1063
  * @param id - The id of the service to retrieve the specifications for
1017
1064
  * @param version - Optional version of the service
1018
1065
  * @returns
1019
1066
  */
1020
- getSpecificationFilesForService: getSpecificationFilesForService((0, import_node_path10.join)(path)),
1067
+ getSpecificationFilesForService: getSpecificationFilesForService((0, import_node_path11.join)(path2)),
1021
1068
  /**
1022
1069
  * Check to see if a service version exists
1023
1070
  * @param id - The id of the service
1024
1071
  * @param version - The version of the service (supports semver)
1025
1072
  * @returns
1026
1073
  */
1027
- serviceHasVersion: serviceHasVersion((0, import_node_path10.join)(path)),
1074
+ serviceHasVersion: serviceHasVersion((0, import_node_path11.join)(path2)),
1028
1075
  /**
1029
1076
  * Add an event to a service by it's id.
1030
1077
  *
@@ -1044,7 +1091,7 @@ var index_default = (path) => {
1044
1091
  *
1045
1092
  * ```
1046
1093
  */
1047
- addEventToService: addMessageToService((0, import_node_path10.join)(path)),
1094
+ addEventToService: addMessageToService((0, import_node_path11.join)(path2)),
1048
1095
  /**
1049
1096
  * Add a command to a service by it's id.
1050
1097
  *
@@ -1064,7 +1111,7 @@ var index_default = (path) => {
1064
1111
  *
1065
1112
  * ```
1066
1113
  */
1067
- addCommandToService: addMessageToService((0, import_node_path10.join)(path)),
1114
+ addCommandToService: addMessageToService((0, import_node_path11.join)(path2)),
1068
1115
  /**
1069
1116
  * Add a query to a service by it's id.
1070
1117
  *
@@ -1084,7 +1131,7 @@ var index_default = (path) => {
1084
1131
  *
1085
1132
  * ```
1086
1133
  */
1087
- addQueryToService: addMessageToService((0, import_node_path10.join)(path)),
1134
+ addQueryToService: addMessageToService((0, import_node_path11.join)(path2)),
1088
1135
  /**
1089
1136
  * ================================
1090
1137
  * Domains
@@ -1097,39 +1144,39 @@ var index_default = (path) => {
1097
1144
  * @param options - Optional options to write the event
1098
1145
  *
1099
1146
  */
1100
- writeDomain: writeDomain((0, import_node_path10.join)(path, "domains")),
1147
+ writeDomain: writeDomain((0, import_node_path11.join)(path2, "domains")),
1101
1148
  /**
1102
1149
  * Returns a domain from EventCatalog
1103
1150
  * @param id - The id of the domain to retrieve
1104
1151
  * @param version - Optional id of the version to get (supports semver)
1105
1152
  * @returns Domain|Undefined
1106
1153
  */
1107
- getDomain: getDomain((0, import_node_path10.join)(path, "domains")),
1154
+ getDomain: getDomain((0, import_node_path11.join)(path2, "domains")),
1108
1155
  /**
1109
1156
  * Returns all domains from EventCatalog
1110
1157
  * @param latestOnly - optional boolean, set to true to get only latest versions
1111
1158
  * @returns Domain[]|Undefined
1112
1159
  */
1113
- getDomains: getDomains((0, import_node_path10.join)(path)),
1160
+ getDomains: getDomains((0, import_node_path11.join)(path2)),
1114
1161
  /**
1115
1162
  * Moves a given domain id to the version directory
1116
1163
  * @param directory
1117
1164
  */
1118
- versionDomain: versionDomain((0, import_node_path10.join)(path, "domains")),
1165
+ versionDomain: versionDomain((0, import_node_path11.join)(path2, "domains")),
1119
1166
  /**
1120
1167
  * Remove a domain from EventCatalog (modeled on the standard POSIX rm utility)
1121
1168
  *
1122
1169
  * @param path - The path to your domain, e.g. `/Payment`
1123
1170
  *
1124
1171
  */
1125
- rmDomain: rmDomain((0, import_node_path10.join)(path, "domains")),
1172
+ rmDomain: rmDomain((0, import_node_path11.join)(path2, "domains")),
1126
1173
  /**
1127
1174
  * Remove an service by an domain id
1128
1175
  *
1129
1176
  * @param id - The id of the domain you want to remove
1130
1177
  *
1131
1178
  */
1132
- rmDomainById: rmDomainById((0, import_node_path10.join)(path, "domains")),
1179
+ rmDomainById: rmDomainById((0, import_node_path11.join)(path2, "domains")),
1133
1180
  /**
1134
1181
  * Adds a file to the given domain
1135
1182
  * @param id - The id of the domain to add the file to
@@ -1137,14 +1184,14 @@ var index_default = (path) => {
1137
1184
  * @param version - Optional version of the domain to add the file to
1138
1185
  * @returns
1139
1186
  */
1140
- addFileToDomain: addFileToDomain((0, import_node_path10.join)(path, "domains")),
1187
+ addFileToDomain: addFileToDomain((0, import_node_path11.join)(path2, "domains")),
1141
1188
  /**
1142
1189
  * Check to see if a domain version exists
1143
1190
  * @param id - The id of the domain
1144
1191
  * @param version - The version of the domain (supports semver)
1145
1192
  * @returns
1146
1193
  */
1147
- domainHasVersion: domainHasVersion((0, import_node_path10.join)(path)),
1194
+ domainHasVersion: domainHasVersion((0, import_node_path11.join)(path2)),
1148
1195
  /**
1149
1196
  * Adds a given service to a domain
1150
1197
  * @param id - The id of the domain
@@ -1152,7 +1199,7 @@ var index_default = (path) => {
1152
1199
  * @param version - (Optional) The version of the domain to add the service to
1153
1200
  * @returns
1154
1201
  */
1155
- addServiceToDomain: addServiceToDomain((0, import_node_path10.join)(path, "domains")),
1202
+ addServiceToDomain: addServiceToDomain((0, import_node_path11.join)(path2, "domains")),
1156
1203
  /**
1157
1204
  * ================================
1158
1205
  * Teams
@@ -1165,25 +1212,25 @@ var index_default = (path) => {
1165
1212
  * @param options - Optional options to write the team
1166
1213
  *
1167
1214
  */
1168
- writeTeam: writeTeam((0, import_node_path10.join)(path, "teams")),
1215
+ writeTeam: writeTeam((0, import_node_path11.join)(path2, "teams")),
1169
1216
  /**
1170
1217
  * Returns a team from EventCatalog
1171
1218
  * @param id - The id of the team to retrieve
1172
1219
  * @returns Team|Undefined
1173
1220
  */
1174
- getTeam: getTeam((0, import_node_path10.join)(path, "teams")),
1221
+ getTeam: getTeam((0, import_node_path11.join)(path2, "teams")),
1175
1222
  /**
1176
1223
  * Returns all teams from EventCatalog
1177
1224
  * @returns Team[]|Undefined
1178
1225
  */
1179
- getTeams: getTeams((0, import_node_path10.join)(path)),
1226
+ getTeams: getTeams((0, import_node_path11.join)(path2)),
1180
1227
  /**
1181
1228
  * Remove a team by the team id
1182
1229
  *
1183
1230
  * @param id - The id of the team you want to remove
1184
1231
  *
1185
1232
  */
1186
- rmTeamById: rmTeamById((0, import_node_path10.join)(path, "teams")),
1233
+ rmTeamById: rmTeamById((0, import_node_path11.join)(path2, "teams")),
1187
1234
  /**
1188
1235
  * ================================
1189
1236
  * Users
@@ -1196,25 +1243,55 @@ var index_default = (path) => {
1196
1243
  * @param options - Optional options to write the user
1197
1244
  *
1198
1245
  */
1199
- writeUser: writeUser((0, import_node_path10.join)(path, "users")),
1246
+ writeUser: writeUser((0, import_node_path11.join)(path2, "users")),
1200
1247
  /**
1201
1248
  * Returns a user from EventCatalog
1202
1249
  * @param id - The id of the user to retrieve
1203
1250
  * @returns User|Undefined
1204
1251
  */
1205
- getUser: getUser((0, import_node_path10.join)(path, "users")),
1252
+ getUser: getUser((0, import_node_path11.join)(path2, "users")),
1206
1253
  /**
1207
1254
  * Returns all user from EventCatalog
1208
1255
  * @returns User[]|Undefined
1209
1256
  */
1210
- getUsers: getUsers((0, import_node_path10.join)(path)),
1257
+ getUsers: getUsers((0, import_node_path11.join)(path2)),
1211
1258
  /**
1212
1259
  * Remove a user by the user id
1213
1260
  *
1214
1261
  * @param id - The id of the user you want to remove
1215
1262
  *
1216
1263
  */
1217
- rmUserById: rmUserById((0, import_node_path10.join)(path, "users"))
1264
+ rmUserById: rmUserById((0, import_node_path11.join)(path2, "users")),
1265
+ /**
1266
+ * ================================
1267
+ * Custom Docs
1268
+ * ================================
1269
+ */
1270
+ /**
1271
+ * Returns a custom doc from EventCatalog
1272
+ * @param path - The path to the custom doc to retrieve
1273
+ * @returns CustomDoc|Undefined
1274
+ */
1275
+ getCustomDoc: getCustomDoc((0, import_node_path11.join)(path2, "docs")),
1276
+ /**
1277
+ * Returns all custom docs from EventCatalog
1278
+ * @param options - Optional options to get custom docs from a specific path
1279
+ * @returns CustomDoc[]|Undefined
1280
+ */
1281
+ getCustomDocs: getCustomDocs((0, import_node_path11.join)(path2, "docs")),
1282
+ /**
1283
+ * Writes a custom doc to EventCatalog
1284
+ * @param customDoc - The custom doc to write
1285
+ * @param options - Optional options to write the custom doc
1286
+ *
1287
+ */
1288
+ writeCustomDoc: writeCustomDoc((0, import_node_path11.join)(path2, "docs")),
1289
+ /**
1290
+ * Removes a custom doc from EventCatalog
1291
+ * @param path - The path to the custom doc to remove
1292
+ *
1293
+ */
1294
+ rmCustomDoc: rmCustomDoc((0, import_node_path11.join)(path2, "docs"))
1218
1295
  };
1219
1296
  };
1220
1297
  //# sourceMappingURL=index.js.map