@eventcatalog/sdk 1.3.2 → 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.
Files changed (46) hide show
  1. package/dist/channels.js +5 -4
  2. package/dist/channels.js.map +1 -1
  3. package/dist/channels.mjs +5 -4
  4. package/dist/channels.mjs.map +1 -1
  5. package/dist/commands.js +5 -4
  6. package/dist/commands.js.map +1 -1
  7. package/dist/commands.mjs +5 -4
  8. package/dist/commands.mjs.map +1 -1
  9. package/dist/domains.js +10 -5
  10. package/dist/domains.js.map +1 -1
  11. package/dist/domains.mjs +10 -5
  12. package/dist/domains.mjs.map +1 -1
  13. package/dist/events.js +5 -4
  14. package/dist/events.js.map +1 -1
  15. package/dist/events.mjs +5 -4
  16. package/dist/events.mjs.map +1 -1
  17. package/dist/index.d.mts +68 -6
  18. package/dist/index.d.ts +68 -6
  19. package/dist/index.js +233 -70
  20. package/dist/index.js.map +1 -1
  21. package/dist/index.mjs +233 -70
  22. package/dist/index.mjs.map +1 -1
  23. package/dist/queries.js +5 -4
  24. package/dist/queries.js.map +1 -1
  25. package/dist/queries.mjs +5 -4
  26. package/dist/queries.mjs.map +1 -1
  27. package/dist/services.js +10 -5
  28. package/dist/services.js.map +1 -1
  29. package/dist/services.mjs +10 -5
  30. package/dist/services.mjs.map +1 -1
  31. package/dist/teams.d.mts +83 -0
  32. package/dist/teams.d.ts +83 -0
  33. package/dist/teams.js +108 -0
  34. package/dist/teams.js.map +1 -0
  35. package/dist/teams.mjs +68 -0
  36. package/dist/teams.mjs.map +1 -0
  37. package/dist/types.d.d.mts +2 -0
  38. package/dist/types.d.d.ts +2 -0
  39. package/dist/types.d.js.map +1 -1
  40. package/dist/users.d.mts +83 -0
  41. package/dist/users.d.ts +83 -0
  42. package/dist/users.js +110 -0
  43. package/dist/users.js.map +1 -0
  44. package/dist/users.mjs +70 -0
  45. package/dist/users.mjs.map +1 -0
  46. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/index.ts
2
- import { join as join9 } from "node:path";
2
+ import { join as join11 } from "node:path";
3
3
 
4
4
  // src/events.ts
5
5
  import fs3 from "node:fs/promises";
@@ -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)) {
@@ -446,6 +455,98 @@ var addMessageToChannel = (directory, collection) => async (id, _message, versio
446
455
  await writeMessage(pathToResource)(message);
447
456
  };
448
457
 
458
+ // src/teams.ts
459
+ import fs9 from "node:fs/promises";
460
+ import { join as join9 } from "node:path";
461
+ import matter3 from "gray-matter";
462
+ var getTeam = (catalogDir) => async (id) => {
463
+ const files = await getFiles(`${catalogDir}/${id}.md`);
464
+ if (files.length == 0) return void 0;
465
+ const file = files[0];
466
+ const { data, content } = matter3.read(file);
467
+ return {
468
+ ...data,
469
+ id: data.id,
470
+ name: data.name,
471
+ markdown: content.trim()
472
+ };
473
+ };
474
+ var getTeams = (catalogDir) => async (options) => {
475
+ const files = await getFiles(`${catalogDir}/teams/*.md`);
476
+ if (files.length === 0) return [];
477
+ return files.map((file) => {
478
+ const { data, content } = matter3.read(file);
479
+ return {
480
+ ...data,
481
+ id: data.id,
482
+ name: data.name,
483
+ markdown: content.trim()
484
+ };
485
+ });
486
+ };
487
+ var writeTeam = (catalogDir) => async (team, options = {}) => {
488
+ const resource = { ...team };
489
+ const currentTeam = await getTeam(catalogDir)(resource.id);
490
+ const exists = currentTeam !== void 0;
491
+ if (exists && !options.override) {
492
+ throw new Error(`Failed to write ${resource.id} (team) as it already exists`);
493
+ }
494
+ const { markdown, ...frontmatter } = resource;
495
+ const document = matter3.stringify(markdown, frontmatter);
496
+ await fs9.mkdir(join9(catalogDir, ""), { recursive: true });
497
+ await fs9.writeFile(join9(catalogDir, "", `${resource.id}.md`), document);
498
+ };
499
+ var rmTeamById = (catalogDir) => async (id) => {
500
+ await fs9.rm(join9(catalogDir, `${id}.md`), { recursive: true });
501
+ };
502
+
503
+ // src/users.ts
504
+ import fs10 from "node:fs/promises";
505
+ import { join as join10 } from "node:path";
506
+ import matter4 from "gray-matter";
507
+ var getUser = (catalogDir) => async (id) => {
508
+ const files = await getFiles(`${catalogDir}/${id}.md`);
509
+ if (files.length == 0) return void 0;
510
+ const file = files[0];
511
+ const { data, content } = matter4.read(file);
512
+ return {
513
+ ...data,
514
+ id: data.id,
515
+ name: data.name,
516
+ avatarUrl: data.avatarUrl,
517
+ markdown: content.trim()
518
+ };
519
+ };
520
+ var getUsers = (catalogDir) => async (options) => {
521
+ const files = await getFiles(`${catalogDir}/users/*.md`);
522
+ if (files.length === 0) return [];
523
+ return files.map((file) => {
524
+ const { data, content } = matter4.read(file);
525
+ return {
526
+ ...data,
527
+ id: data.id,
528
+ name: data.name,
529
+ avatarUrl: data.avatarUrl,
530
+ markdown: content.trim()
531
+ };
532
+ });
533
+ };
534
+ var writeUser = (catalogDir) => async (user, options = {}) => {
535
+ const resource = { ...user };
536
+ const currentUser = await getUser(catalogDir)(resource.id);
537
+ const exists = currentUser !== void 0;
538
+ if (exists && !options.override) {
539
+ throw new Error(`Failed to write ${resource.id} (user) as it already exists`);
540
+ }
541
+ const { markdown, ...frontmatter } = resource;
542
+ const document = matter4.stringify(markdown, frontmatter);
543
+ await fs10.mkdir(join10(catalogDir, ""), { recursive: true });
544
+ await fs10.writeFile(join10(catalogDir, "", `${resource.id}.md`), document);
545
+ };
546
+ var rmUserById = (catalogDir) => async (id) => {
547
+ await fs10.rm(join10(catalogDir, `${id}.md`), { recursive: true });
548
+ };
549
+
449
550
  // src/index.ts
450
551
  var src_default = (path) => {
451
552
  return {
@@ -455,13 +556,13 @@ var src_default = (path) => {
455
556
  * @param version - Optional id of the version to get (supports semver)
456
557
  * @returns Event|Undefined
457
558
  */
458
- getEvent: getEvent(join9(path)),
559
+ getEvent: getEvent(join11(path)),
459
560
  /**
460
561
  * Returns all events from EventCatalog
461
562
  * @param latestOnly - optional boolean, set to true to get only latest versions
462
563
  * @returns Event[]|Undefined
463
564
  */
464
- getEvents: getEvents(join9(path)),
565
+ getEvents: getEvents(join11(path)),
465
566
  /**
466
567
  * Adds an event to EventCatalog
467
568
  *
@@ -469,7 +570,7 @@ var src_default = (path) => {
469
570
  * @param options - Optional options to write the event
470
571
  *
471
572
  */
472
- writeEvent: writeEvent(join9(path, "events")),
573
+ writeEvent: writeEvent(join11(path, "events")),
473
574
  /**
474
575
  * Adds an event to a service in EventCatalog
475
576
  *
@@ -478,26 +579,26 @@ var src_default = (path) => {
478
579
  * @param options - Optional options to write the event
479
580
  *
480
581
  */
481
- writeEventToService: writeEventToService(join9(path, "services")),
582
+ writeEventToService: writeEventToService(join11(path, "services")),
482
583
  /**
483
584
  * Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
484
585
  *
485
586
  * @param path - The path to your event, e.g. `/Inventory/InventoryAdjusted`
486
587
  *
487
588
  */
488
- rmEvent: rmEvent(join9(path, "events")),
589
+ rmEvent: rmEvent(join11(path, "events")),
489
590
  /**
490
591
  * Remove an event by an Event id
491
592
  *
492
593
  * @param id - The id of the event you want to remove
493
594
  *
494
595
  */
495
- rmEventById: rmEventById(join9(path)),
596
+ rmEventById: rmEventById(join11(path)),
496
597
  /**
497
598
  * Moves a given event id to the version directory
498
599
  * @param directory
499
600
  */
500
- versionEvent: versionEvent(join9(path)),
601
+ versionEvent: versionEvent(join11(path)),
501
602
  /**
502
603
  * Adds a file to the given event
503
604
  * @param id - The id of the event to add the file to
@@ -505,7 +606,7 @@ var src_default = (path) => {
505
606
  * @param version - Optional version of the event to add the file to
506
607
  * @returns
507
608
  */
508
- addFileToEvent: addFileToEvent(join9(path)),
609
+ addFileToEvent: addFileToEvent(join11(path)),
509
610
  /**
510
611
  * Adds a schema to the given event
511
612
  * @param id - The id of the event to add the schema to
@@ -513,14 +614,14 @@ var src_default = (path) => {
513
614
  * @param version - Optional version of the event to add the schema to
514
615
  * @returns
515
616
  */
516
- addSchemaToEvent: addSchemaToEvent(join9(path)),
617
+ addSchemaToEvent: addSchemaToEvent(join11(path)),
517
618
  /**
518
619
  * Check to see if an event version exists
519
620
  * @param id - The id of the event
520
621
  * @param version - The version of the event (supports semver)
521
622
  * @returns
522
623
  */
523
- eventHasVersion: eventHasVersion(join9(path)),
624
+ eventHasVersion: eventHasVersion(join11(path)),
524
625
  /**
525
626
  * ================================
526
627
  * Commands
@@ -532,13 +633,13 @@ var src_default = (path) => {
532
633
  * @param version - Optional id of the version to get (supports semver)
533
634
  * @returns Command|Undefined
534
635
  */
535
- getCommand: getCommand(join9(path)),
636
+ getCommand: getCommand(join11(path)),
536
637
  /**
537
638
  * Returns all commands from EventCatalog
538
639
  * @param latestOnly - optional boolean, set to true to get only latest versions
539
640
  * @returns Command[]|Undefined
540
641
  */
541
- getCommands: getCommands(join9(path)),
642
+ getCommands: getCommands(join11(path)),
542
643
  /**
543
644
  * Adds an command to EventCatalog
544
645
  *
@@ -546,7 +647,7 @@ var src_default = (path) => {
546
647
  * @param options - Optional options to write the command
547
648
  *
548
649
  */
549
- writeCommand: writeCommand(join9(path, "commands")),
650
+ writeCommand: writeCommand(join11(path, "commands")),
550
651
  /**
551
652
  * Adds a command to a service in EventCatalog
552
653
  *
@@ -555,26 +656,26 @@ var src_default = (path) => {
555
656
  * @param options - Optional options to write the command
556
657
  *
557
658
  */
558
- writeCommandToService: writeCommandToService(join9(path, "services")),
659
+ writeCommandToService: writeCommandToService(join11(path, "services")),
559
660
  /**
560
661
  * Remove an command to EventCatalog (modeled on the standard POSIX rm utility)
561
662
  *
562
663
  * @param path - The path to your command, e.g. `/Inventory/InventoryAdjusted`
563
664
  *
564
665
  */
565
- rmCommand: rmCommand(join9(path, "commands")),
666
+ rmCommand: rmCommand(join11(path, "commands")),
566
667
  /**
567
668
  * Remove an command by an Event id
568
669
  *
569
670
  * @param id - The id of the command you want to remove
570
671
  *
571
672
  */
572
- rmCommandById: rmCommandById(join9(path)),
673
+ rmCommandById: rmCommandById(join11(path)),
573
674
  /**
574
675
  * Moves a given command id to the version directory
575
676
  * @param directory
576
677
  */
577
- versionCommand: versionCommand(join9(path)),
678
+ versionCommand: versionCommand(join11(path)),
578
679
  /**
579
680
  * Adds a file to the given command
580
681
  * @param id - The id of the command to add the file to
@@ -582,7 +683,7 @@ var src_default = (path) => {
582
683
  * @param version - Optional version of the command to add the file to
583
684
  * @returns
584
685
  */
585
- addFileToCommand: addFileToCommand(join9(path)),
686
+ addFileToCommand: addFileToCommand(join11(path)),
586
687
  /**
587
688
  * Adds a schema to the given command
588
689
  * @param id - The id of the command to add the schema to
@@ -590,14 +691,14 @@ var src_default = (path) => {
590
691
  * @param version - Optional version of the command to add the schema to
591
692
  * @returns
592
693
  */
593
- addSchemaToCommand: addSchemaToCommand(join9(path)),
694
+ addSchemaToCommand: addSchemaToCommand(join11(path)),
594
695
  /**
595
696
  * Check to see if a command version exists
596
697
  * @param id - The id of the command
597
698
  * @param version - The version of the command (supports semver)
598
699
  * @returns
599
700
  */
600
- commandHasVersion: commandHasVersion(join9(path)),
701
+ commandHasVersion: commandHasVersion(join11(path)),
601
702
  /**
602
703
  * ================================
603
704
  * Queries
@@ -609,13 +710,13 @@ var src_default = (path) => {
609
710
  * @param version - Optional id of the version to get (supports semver)
610
711
  * @returns Query|Undefined
611
712
  */
612
- getQuery: getQuery(join9(path)),
713
+ getQuery: getQuery(join11(path)),
613
714
  /**
614
715
  * Returns all queries from EventCatalog
615
716
  * @param latestOnly - optional boolean, set to true to get only latest versions
616
717
  * @returns Query[]|Undefined
617
718
  */
618
- getQueries: getQueries(join9(path)),
719
+ getQueries: getQueries(join11(path)),
619
720
  /**
620
721
  * Adds a query to EventCatalog
621
722
  *
@@ -623,7 +724,7 @@ var src_default = (path) => {
623
724
  * @param options - Optional options to write the event
624
725
  *
625
726
  */
626
- writeQuery: writeQuery(join9(path, "queries")),
727
+ writeQuery: writeQuery(join11(path, "queries")),
627
728
  /**
628
729
  * Adds a query to a service in EventCatalog
629
730
  *
@@ -632,26 +733,26 @@ var src_default = (path) => {
632
733
  * @param options - Optional options to write the query
633
734
  *
634
735
  */
635
- writeQueryToService: writeQueryToService(join9(path, "services")),
736
+ writeQueryToService: writeQueryToService(join11(path, "services")),
636
737
  /**
637
738
  * Remove an query to EventCatalog (modeled on the standard POSIX rm utility)
638
739
  *
639
740
  * @param path - The path to your query, e.g. `/Orders/GetOrder`
640
741
  *
641
742
  */
642
- rmQuery: rmQuery(join9(path, "queries")),
743
+ rmQuery: rmQuery(join11(path, "queries")),
643
744
  /**
644
745
  * Remove a query by a Query id
645
746
  *
646
747
  * @param id - The id of the query you want to remove
647
748
  *
648
749
  */
649
- rmQueryById: rmQueryById(join9(path)),
750
+ rmQueryById: rmQueryById(join11(path)),
650
751
  /**
651
752
  * Moves a given query id to the version directory
652
753
  * @param directory
653
754
  */
654
- versionQuery: versionQuery(join9(path)),
755
+ versionQuery: versionQuery(join11(path)),
655
756
  /**
656
757
  * Adds a file to the given query
657
758
  * @param id - The id of the query to add the file to
@@ -659,7 +760,7 @@ var src_default = (path) => {
659
760
  * @param version - Optional version of the query to add the file to
660
761
  * @returns
661
762
  */
662
- addFileToQuery: addFileToQuery(join9(path)),
763
+ addFileToQuery: addFileToQuery(join11(path)),
663
764
  /**
664
765
  * Adds a schema to the given query
665
766
  * @param id - The id of the query to add the schema to
@@ -667,14 +768,14 @@ var src_default = (path) => {
667
768
  * @param version - Optional version of the query to add the schema to
668
769
  * @returns
669
770
  */
670
- addSchemaToQuery: addSchemaToQuery(join9(path)),
771
+ addSchemaToQuery: addSchemaToQuery(join11(path)),
671
772
  /**
672
773
  * Check to see if an query version exists
673
774
  * @param id - The id of the query
674
775
  * @param version - The version of the query (supports semver)
675
776
  * @returns
676
777
  */
677
- queryHasVersion: queryHasVersion(join9(path)),
778
+ queryHasVersion: queryHasVersion(join11(path)),
678
779
  /**
679
780
  * ================================
680
781
  * Channels
@@ -686,13 +787,13 @@ var src_default = (path) => {
686
787
  * @param version - Optional id of the version to get (supports semver)
687
788
  * @returns Channel|Undefined
688
789
  */
689
- getChannel: getChannel(join9(path)),
790
+ getChannel: getChannel(join11(path)),
690
791
  /**
691
792
  * Returns all channels from EventCatalog
692
793
  * @param latestOnly - optional boolean, set to true to get only latest versions
693
794
  * @returns Channel[]|Undefined
694
795
  */
695
- getChannels: getChannels(join9(path)),
796
+ getChannels: getChannels(join11(path)),
696
797
  /**
697
798
  * Adds an channel to EventCatalog
698
799
  *
@@ -700,33 +801,33 @@ var src_default = (path) => {
700
801
  * @param options - Optional options to write the channel
701
802
  *
702
803
  */
703
- writeChannel: writeChannel(join9(path, "channels")),
804
+ writeChannel: writeChannel(join11(path, "channels")),
704
805
  /**
705
806
  * Remove an channel to EventCatalog (modeled on the standard POSIX rm utility)
706
807
  *
707
808
  * @param path - The path to your channel, e.g. `/Inventory/InventoryAdjusted`
708
809
  *
709
810
  */
710
- rmChannel: rmChannel(join9(path, "channels")),
811
+ rmChannel: rmChannel(join11(path, "channels")),
711
812
  /**
712
813
  * Remove an channel by an Event id
713
814
  *
714
815
  * @param id - The id of the channel you want to remove
715
816
  *
716
817
  */
717
- rmChannelById: rmChannelById(join9(path)),
818
+ rmChannelById: rmChannelById(join11(path)),
718
819
  /**
719
820
  * Moves a given channel id to the version directory
720
821
  * @param directory
721
822
  */
722
- versionChannel: versionChannel(join9(path)),
823
+ versionChannel: versionChannel(join11(path)),
723
824
  /**
724
825
  * Check to see if a channel version exists
725
826
  * @param id - The id of the channel
726
827
  * @param version - The version of the channel (supports semver)
727
828
  * @returns
728
829
  */
729
- channelHasVersion: channelHasVersion(join9(path)),
830
+ channelHasVersion: channelHasVersion(join11(path)),
730
831
  /**
731
832
  * Add a channel to an event
732
833
  *
@@ -743,7 +844,7 @@ var src_default = (path) => {
743
844
  *
744
845
  * ```
745
846
  */
746
- addEventToChannel: addMessageToChannel(join9(path), "events"),
847
+ addEventToChannel: addMessageToChannel(join11(path), "events"),
747
848
  /**
748
849
  * Add a channel to an command
749
850
  *
@@ -760,7 +861,7 @@ var src_default = (path) => {
760
861
  *
761
862
  * ```
762
863
  */
763
- addCommandToChannel: addMessageToChannel(join9(path), "commands"),
864
+ addCommandToChannel: addMessageToChannel(join11(path), "commands"),
764
865
  /**
765
866
  * Add a channel to an query
766
867
  *
@@ -777,7 +878,7 @@ var src_default = (path) => {
777
878
  *
778
879
  * ```
779
880
  */
780
- addQueryToChannel: addMessageToChannel(join9(path), "queries"),
881
+ addQueryToChannel: addMessageToChannel(join11(path), "queries"),
781
882
  /**
782
883
  * ================================
783
884
  * SERVICES
@@ -790,14 +891,14 @@ var src_default = (path) => {
790
891
  * @param options - Optional options to write the event
791
892
  *
792
893
  */
793
- writeService: writeService(join9(path, "services")),
894
+ writeService: writeService(join11(path, "services")),
794
895
  /**
795
896
  * Adds a versioned service to EventCatalog
796
897
  *
797
898
  * @param service - The service to write
798
899
  *
799
900
  */
800
- writeVersionedService: writeVersionedService(join9(path, "services")),
901
+ writeVersionedService: writeVersionedService(join11(path, "services")),
801
902
  /**
802
903
  * Adds a service to a domain in EventCatalog
803
904
  *
@@ -806,39 +907,39 @@ var src_default = (path) => {
806
907
  * @param options - Optional options to write the event
807
908
  *
808
909
  */
809
- writeServiceToDomain: writeServiceToDomain(join9(path, "domains")),
910
+ writeServiceToDomain: writeServiceToDomain(join11(path, "domains")),
810
911
  /**
811
912
  * Returns a service from EventCatalog
812
913
  * @param id - The id of the service to retrieve
813
914
  * @param version - Optional id of the version to get (supports semver)
814
915
  * @returns Service|Undefined
815
916
  */
816
- getService: getService(join9(path)),
917
+ getService: getService(join11(path)),
817
918
  /**
818
919
  * Returns all services from EventCatalog
819
920
  * @param latestOnly - optional boolean, set to true to get only latest versions
820
921
  * @returns Service[]|Undefined
821
922
  */
822
- getServices: getServices(join9(path)),
923
+ getServices: getServices(join11(path)),
823
924
  /**
824
925
  * Moves a given service id to the version directory
825
926
  * @param directory
826
927
  */
827
- versionService: versionService(join9(path)),
928
+ versionService: versionService(join11(path)),
828
929
  /**
829
930
  * Remove a service from EventCatalog (modeled on the standard POSIX rm utility)
830
931
  *
831
932
  * @param path - The path to your service, e.g. `/InventoryService`
832
933
  *
833
934
  */
834
- rmService: rmService(join9(path, "services")),
935
+ rmService: rmService(join11(path, "services")),
835
936
  /**
836
937
  * Remove an service by an service id
837
938
  *
838
939
  * @param id - The id of the service you want to remove
839
940
  *
840
941
  */
841
- rmServiceById: rmServiceById(join9(path)),
942
+ rmServiceById: rmServiceById(join11(path)),
842
943
  /**
843
944
  * Adds a file to the given service
844
945
  * @param id - The id of the service to add the file to
@@ -846,21 +947,21 @@ var src_default = (path) => {
846
947
  * @param version - Optional version of the service to add the file to
847
948
  * @returns
848
949
  */
849
- addFileToService: addFileToService(join9(path)),
950
+ addFileToService: addFileToService(join11(path)),
850
951
  /**
851
952
  * Returns the specifications for a given service
852
953
  * @param id - The id of the service to retrieve the specifications for
853
954
  * @param version - Optional version of the service
854
955
  * @returns
855
956
  */
856
- getSpecificationFilesForService: getSpecificationFilesForService(join9(path)),
957
+ getSpecificationFilesForService: getSpecificationFilesForService(join11(path)),
857
958
  /**
858
959
  * Check to see if a service version exists
859
960
  * @param id - The id of the service
860
961
  * @param version - The version of the service (supports semver)
861
962
  * @returns
862
963
  */
863
- serviceHasVersion: serviceHasVersion(join9(path)),
964
+ serviceHasVersion: serviceHasVersion(join11(path)),
864
965
  /**
865
966
  * Add an event to a service by it's id.
866
967
  *
@@ -880,7 +981,7 @@ var src_default = (path) => {
880
981
  *
881
982
  * ```
882
983
  */
883
- addEventToService: addMessageToService(join9(path)),
984
+ addEventToService: addMessageToService(join11(path)),
884
985
  /**
885
986
  * Add a command to a service by it's id.
886
987
  *
@@ -900,7 +1001,7 @@ var src_default = (path) => {
900
1001
  *
901
1002
  * ```
902
1003
  */
903
- addCommandToService: addMessageToService(join9(path)),
1004
+ addCommandToService: addMessageToService(join11(path)),
904
1005
  /**
905
1006
  * Add a query to a service by it's id.
906
1007
  *
@@ -920,7 +1021,7 @@ var src_default = (path) => {
920
1021
  *
921
1022
  * ```
922
1023
  */
923
- addQueryToService: addMessageToService(join9(path)),
1024
+ addQueryToService: addMessageToService(join11(path)),
924
1025
  /**
925
1026
  * ================================
926
1027
  * Domains
@@ -933,39 +1034,39 @@ var src_default = (path) => {
933
1034
  * @param options - Optional options to write the event
934
1035
  *
935
1036
  */
936
- writeDomain: writeDomain(join9(path, "domains")),
1037
+ writeDomain: writeDomain(join11(path, "domains")),
937
1038
  /**
938
1039
  * Returns a domain from EventCatalog
939
1040
  * @param id - The id of the domain to retrieve
940
1041
  * @param version - Optional id of the version to get (supports semver)
941
1042
  * @returns Domain|Undefined
942
1043
  */
943
- getDomain: getDomain(join9(path, "domains")),
1044
+ getDomain: getDomain(join11(path, "domains")),
944
1045
  /**
945
1046
  * Returns all domains from EventCatalog
946
1047
  * @param latestOnly - optional boolean, set to true to get only latest versions
947
1048
  * @returns Domain[]|Undefined
948
1049
  */
949
- getDomains: getDomains(join9(path)),
1050
+ getDomains: getDomains(join11(path)),
950
1051
  /**
951
1052
  * Moves a given domain id to the version directory
952
1053
  * @param directory
953
1054
  */
954
- versionDomain: versionDomain(join9(path, "domains")),
1055
+ versionDomain: versionDomain(join11(path, "domains")),
955
1056
  /**
956
1057
  * Remove a domain from EventCatalog (modeled on the standard POSIX rm utility)
957
1058
  *
958
1059
  * @param path - The path to your domain, e.g. `/Payment`
959
1060
  *
960
1061
  */
961
- rmDomain: rmDomain(join9(path, "domains")),
1062
+ rmDomain: rmDomain(join11(path, "domains")),
962
1063
  /**
963
1064
  * Remove an service by an domain id
964
1065
  *
965
1066
  * @param id - The id of the domain you want to remove
966
1067
  *
967
1068
  */
968
- rmDomainById: rmDomainById(join9(path, "domains")),
1069
+ rmDomainById: rmDomainById(join11(path, "domains")),
969
1070
  /**
970
1071
  * Adds a file to the given domain
971
1072
  * @param id - The id of the domain to add the file to
@@ -973,14 +1074,14 @@ var src_default = (path) => {
973
1074
  * @param version - Optional version of the domain to add the file to
974
1075
  * @returns
975
1076
  */
976
- addFileToDomain: addFileToDomain(join9(path, "domains")),
1077
+ addFileToDomain: addFileToDomain(join11(path, "domains")),
977
1078
  /**
978
1079
  * Check to see if a domain version exists
979
1080
  * @param id - The id of the domain
980
1081
  * @param version - The version of the domain (supports semver)
981
1082
  * @returns
982
1083
  */
983
- domainHasVersion: domainHasVersion(join9(path)),
1084
+ domainHasVersion: domainHasVersion(join11(path)),
984
1085
  /**
985
1086
  * Adds a given service to a domain
986
1087
  * @param id - The id of the domain
@@ -988,7 +1089,69 @@ var src_default = (path) => {
988
1089
  * @param version - (Optional) The version of the domain to add the service to
989
1090
  * @returns
990
1091
  */
991
- addServiceToDomain: addServiceToDomain(join9(path, "domains"))
1092
+ addServiceToDomain: addServiceToDomain(join11(path, "domains")),
1093
+ /**
1094
+ * ================================
1095
+ * Teams
1096
+ * ================================
1097
+ */
1098
+ /**
1099
+ * Adds a team to EventCatalog
1100
+ *
1101
+ * @param team - The team to write
1102
+ * @param options - Optional options to write the team
1103
+ *
1104
+ */
1105
+ writeTeam: writeTeam(join11(path, "teams")),
1106
+ /**
1107
+ * Returns a team from EventCatalog
1108
+ * @param id - The id of the team to retrieve
1109
+ * @returns Team|Undefined
1110
+ */
1111
+ getTeam: getTeam(join11(path, "teams")),
1112
+ /**
1113
+ * Returns all teams from EventCatalog
1114
+ * @returns Team[]|Undefined
1115
+ */
1116
+ getTeams: getTeams(join11(path)),
1117
+ /**
1118
+ * Remove a team by the team id
1119
+ *
1120
+ * @param id - The id of the team you want to remove
1121
+ *
1122
+ */
1123
+ rmTeamById: rmTeamById(join11(path, "teams")),
1124
+ /**
1125
+ * ================================
1126
+ * Users
1127
+ * ================================
1128
+ */
1129
+ /**
1130
+ * Adds a user to EventCatalog
1131
+ *
1132
+ * @param user - The user to write
1133
+ * @param options - Optional options to write the user
1134
+ *
1135
+ */
1136
+ writeUser: writeUser(join11(path, "users")),
1137
+ /**
1138
+ * Returns a user from EventCatalog
1139
+ * @param id - The id of the user to retrieve
1140
+ * @returns User|Undefined
1141
+ */
1142
+ getUser: getUser(join11(path, "users")),
1143
+ /**
1144
+ * Returns all user from EventCatalog
1145
+ * @returns User[]|Undefined
1146
+ */
1147
+ getUsers: getUsers(join11(path)),
1148
+ /**
1149
+ * Remove a user by the user id
1150
+ *
1151
+ * @param id - The id of the user you want to remove
1152
+ *
1153
+ */
1154
+ rmUserById: rmUserById(join11(path, "users"))
992
1155
  };
993
1156
  };
994
1157
  export {