@eventcatalog/sdk 1.1.3 → 1.2.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.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/index.ts
2
- import { join as join8 } from "node:path";
2
+ import { join as join9 } from "node:path";
3
3
 
4
4
  // src/events.ts
5
5
  import fs3 from "node:fs/promises";
@@ -123,7 +123,7 @@ var writeResource = async (catalogDir, resource, options = { path: "", type: ""
123
123
  const path = options.path || `/${resource.id}`;
124
124
  const exists = await versionExists(catalogDir, resource.id, resource.version);
125
125
  if (exists) {
126
- throw new Error(`Failed to write ${options.type} as the version ${resource.version} already exists`);
126
+ throw new Error(`Failed to write ${resource.id} (${options.type}) as the version ${resource.version} already exists`);
127
127
  }
128
128
  const { markdown, ...frontmatter } = resource;
129
129
  const document = matter2.stringify(markdown.trim(), frontmatter);
@@ -355,6 +355,51 @@ var addServiceToDomain = (directory) => async (id, service, version) => {
355
355
  await writeDomain(directory)(domain);
356
356
  };
357
357
 
358
+ // src/channels.ts
359
+ import fs8 from "node:fs/promises";
360
+ import { join as join8 } from "node:path";
361
+ var getChannel = (directory) => async (id, version) => getResource(directory, id, version, { type: "channel" });
362
+ var writeChannel = (directory) => async (channel, options = { path: "" }) => writeResource(directory, { ...channel }, { ...options, type: "channel" });
363
+ var rmChannel = (directory) => async (path) => {
364
+ await fs8.rm(join8(directory, path), { recursive: true });
365
+ };
366
+ var rmChannelById = (directory) => async (id, version) => rmResourceById(directory, id, version, { type: "channel" });
367
+ var versionChannel = (directory) => async (id) => versionResource(directory, id);
368
+ var channelHasVersion = (directory) => async (id, version) => {
369
+ const file = await findFileById(directory, id, version);
370
+ return !!file;
371
+ };
372
+ var addMessageToChannel = (directory, collection) => async (id, _message, version) => {
373
+ let channel = await getChannel(directory)(id, version);
374
+ const functions = {
375
+ events: {
376
+ getMessage: getEvent,
377
+ rmMessageById: rmEventById,
378
+ writeMessage: writeEvent
379
+ },
380
+ commands: {
381
+ getMessage: getCommand,
382
+ rmMessageById: rmCommandById,
383
+ writeMessage: writeCommand
384
+ },
385
+ queries: {
386
+ getMessage: getQuery,
387
+ rmMessageById: rmQueryById,
388
+ writeMessage: writeQuery
389
+ }
390
+ };
391
+ const { getMessage, rmMessageById, writeMessage } = functions[collection];
392
+ const message = await getMessage(directory)(_message.id, _message.version);
393
+ if (!message) throw new Error(`Message ${_message.id} with version ${_message.version} not found`);
394
+ if (message.channels === void 0) {
395
+ message.channels = [];
396
+ }
397
+ const channelInfo = { id, version: channel.version, ..._message.parameters && { parameters: _message.parameters } };
398
+ message.channels.push(channelInfo);
399
+ await rmMessageById(directory)(_message.id, _message.version);
400
+ await writeMessage(directory)(message);
401
+ };
402
+
358
403
  // src/index.ts
359
404
  var src_default = (path) => {
360
405
  return {
@@ -364,7 +409,7 @@ var src_default = (path) => {
364
409
  * @param version - Optional id of the version to get (supports semver)
365
410
  * @returns Event|Undefined
366
411
  */
367
- getEvent: getEvent(join8(path)),
412
+ getEvent: getEvent(join9(path)),
368
413
  /**
369
414
  * Adds an event to EventCatalog
370
415
  *
@@ -372,7 +417,7 @@ var src_default = (path) => {
372
417
  * @param options - Optional options to write the event
373
418
  *
374
419
  */
375
- writeEvent: writeEvent(join8(path, "events")),
420
+ writeEvent: writeEvent(join9(path, "events")),
376
421
  /**
377
422
  * Adds an event to a service in EventCatalog
378
423
  *
@@ -381,26 +426,26 @@ var src_default = (path) => {
381
426
  * @param options - Optional options to write the event
382
427
  *
383
428
  */
384
- writeEventToService: writeEventToService(join8(path, "services")),
429
+ writeEventToService: writeEventToService(join9(path, "services")),
385
430
  /**
386
431
  * Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
387
432
  *
388
433
  * @param path - The path to your event, e.g. `/Inventory/InventoryAdjusted`
389
434
  *
390
435
  */
391
- rmEvent: rmEvent(join8(path, "events")),
436
+ rmEvent: rmEvent(join9(path, "events")),
392
437
  /**
393
438
  * Remove an event by an Event id
394
439
  *
395
440
  * @param id - The id of the event you want to remove
396
441
  *
397
442
  */
398
- rmEventById: rmEventById(join8(path)),
443
+ rmEventById: rmEventById(join9(path)),
399
444
  /**
400
445
  * Moves a given event id to the version directory
401
446
  * @param directory
402
447
  */
403
- versionEvent: versionEvent(join8(path)),
448
+ versionEvent: versionEvent(join9(path)),
404
449
  /**
405
450
  * Adds a file to the given event
406
451
  * @param id - The id of the event to add the file to
@@ -408,7 +453,7 @@ var src_default = (path) => {
408
453
  * @param version - Optional version of the event to add the file to
409
454
  * @returns
410
455
  */
411
- addFileToEvent: addFileToEvent(join8(path)),
456
+ addFileToEvent: addFileToEvent(join9(path)),
412
457
  /**
413
458
  * Adds a schema to the given event
414
459
  * @param id - The id of the event to add the schema to
@@ -416,14 +461,14 @@ var src_default = (path) => {
416
461
  * @param version - Optional version of the event to add the schema to
417
462
  * @returns
418
463
  */
419
- addSchemaToEvent: addSchemaToEvent(join8(path)),
464
+ addSchemaToEvent: addSchemaToEvent(join9(path)),
420
465
  /**
421
466
  * Check to see if an event version exists
422
467
  * @param id - The id of the event
423
468
  * @param version - The version of the event (supports semver)
424
469
  * @returns
425
470
  */
426
- eventHasVersion: eventHasVersion(join8(path)),
471
+ eventHasVersion: eventHasVersion(join9(path)),
427
472
  /**
428
473
  * ================================
429
474
  * Commands
@@ -435,7 +480,7 @@ var src_default = (path) => {
435
480
  * @param version - Optional id of the version to get (supports semver)
436
481
  * @returns Command|Undefined
437
482
  */
438
- getCommand: getCommand(join8(path)),
483
+ getCommand: getCommand(join9(path)),
439
484
  /**
440
485
  * Adds an command to EventCatalog
441
486
  *
@@ -443,7 +488,7 @@ var src_default = (path) => {
443
488
  * @param options - Optional options to write the command
444
489
  *
445
490
  */
446
- writeCommand: writeCommand(join8(path, "commands")),
491
+ writeCommand: writeCommand(join9(path, "commands")),
447
492
  /**
448
493
  * Adds a command to a service in EventCatalog
449
494
  *
@@ -452,26 +497,26 @@ var src_default = (path) => {
452
497
  * @param options - Optional options to write the command
453
498
  *
454
499
  */
455
- writeCommandToService: writeCommandToService(join8(path, "services")),
500
+ writeCommandToService: writeCommandToService(join9(path, "services")),
456
501
  /**
457
502
  * Remove an command to EventCatalog (modeled on the standard POSIX rm utility)
458
503
  *
459
504
  * @param path - The path to your command, e.g. `/Inventory/InventoryAdjusted`
460
505
  *
461
506
  */
462
- rmCommand: rmCommand(join8(path, "commands")),
507
+ rmCommand: rmCommand(join9(path, "commands")),
463
508
  /**
464
509
  * Remove an command by an Event id
465
510
  *
466
511
  * @param id - The id of the command you want to remove
467
512
  *
468
513
  */
469
- rmCommandById: rmCommandById(join8(path)),
514
+ rmCommandById: rmCommandById(join9(path)),
470
515
  /**
471
516
  * Moves a given command id to the version directory
472
517
  * @param directory
473
518
  */
474
- versionCommand: versionCommand(join8(path)),
519
+ versionCommand: versionCommand(join9(path)),
475
520
  /**
476
521
  * Adds a file to the given command
477
522
  * @param id - The id of the command to add the file to
@@ -479,7 +524,7 @@ var src_default = (path) => {
479
524
  * @param version - Optional version of the command to add the file to
480
525
  * @returns
481
526
  */
482
- addFileToCommand: addFileToCommand(join8(path)),
527
+ addFileToCommand: addFileToCommand(join9(path)),
483
528
  /**
484
529
  * Adds a schema to the given command
485
530
  * @param id - The id of the command to add the schema to
@@ -487,14 +532,14 @@ var src_default = (path) => {
487
532
  * @param version - Optional version of the command to add the schema to
488
533
  * @returns
489
534
  */
490
- addSchemaToCommand: addSchemaToCommand(join8(path)),
535
+ addSchemaToCommand: addSchemaToCommand(join9(path)),
491
536
  /**
492
537
  * Check to see if a command version exists
493
538
  * @param id - The id of the command
494
539
  * @param version - The version of the command (supports semver)
495
540
  * @returns
496
541
  */
497
- commandHasVersion: commandHasVersion(join8(path)),
542
+ commandHasVersion: commandHasVersion(join9(path)),
498
543
  /**
499
544
  * ================================
500
545
  * Queries
@@ -506,7 +551,7 @@ var src_default = (path) => {
506
551
  * @param version - Optional id of the version to get (supports semver)
507
552
  * @returns Query|Undefined
508
553
  */
509
- getQuery: getQuery(join8(path)),
554
+ getQuery: getQuery(join9(path)),
510
555
  /**
511
556
  * Adds a query to EventCatalog
512
557
  *
@@ -514,7 +559,7 @@ var src_default = (path) => {
514
559
  * @param options - Optional options to write the event
515
560
  *
516
561
  */
517
- writeQuery: writeQuery(join8(path, "queries")),
562
+ writeQuery: writeQuery(join9(path, "queries")),
518
563
  /**
519
564
  * Adds a query to a service in EventCatalog
520
565
  *
@@ -523,26 +568,26 @@ var src_default = (path) => {
523
568
  * @param options - Optional options to write the query
524
569
  *
525
570
  */
526
- writeQueryToService: writeQueryToService(join8(path, "services")),
571
+ writeQueryToService: writeQueryToService(join9(path, "services")),
527
572
  /**
528
573
  * Remove an query to EventCatalog (modeled on the standard POSIX rm utility)
529
574
  *
530
575
  * @param path - The path to your query, e.g. `/Orders/GetOrder`
531
576
  *
532
577
  */
533
- rmQuery: rmQuery(join8(path, "queries")),
578
+ rmQuery: rmQuery(join9(path, "queries")),
534
579
  /**
535
580
  * Remove a query by a Query id
536
581
  *
537
582
  * @param id - The id of the query you want to remove
538
583
  *
539
584
  */
540
- rmQueryById: rmQueryById(join8(path)),
585
+ rmQueryById: rmQueryById(join9(path)),
541
586
  /**
542
587
  * Moves a given query id to the version directory
543
588
  * @param directory
544
589
  */
545
- versionQuery: versionQuery(join8(path)),
590
+ versionQuery: versionQuery(join9(path)),
546
591
  /**
547
592
  * Adds a file to the given query
548
593
  * @param id - The id of the query to add the file to
@@ -550,7 +595,7 @@ var src_default = (path) => {
550
595
  * @param version - Optional version of the query to add the file to
551
596
  * @returns
552
597
  */
553
- addFileToQuery: addFileToQuery(join8(path)),
598
+ addFileToQuery: addFileToQuery(join9(path)),
554
599
  /**
555
600
  * Adds a schema to the given query
556
601
  * @param id - The id of the query to add the schema to
@@ -558,14 +603,111 @@ var src_default = (path) => {
558
603
  * @param version - Optional version of the query to add the schema to
559
604
  * @returns
560
605
  */
561
- addSchemaToQuery: addSchemaToQuery(join8(path)),
606
+ addSchemaToQuery: addSchemaToQuery(join9(path)),
562
607
  /**
563
608
  * Check to see if an query version exists
564
609
  * @param id - The id of the query
565
610
  * @param version - The version of the query (supports semver)
566
611
  * @returns
567
612
  */
568
- queryHasVersion: queryHasVersion(join8(path)),
613
+ queryHasVersion: queryHasVersion(join9(path)),
614
+ /**
615
+ * ================================
616
+ * Channels
617
+ * ================================
618
+ */
619
+ /**
620
+ * Returns a channel from EventCatalog
621
+ * @param id - The id of the channel to retrieve
622
+ * @param version - Optional id of the version to get (supports semver)
623
+ * @returns Channel|Undefined
624
+ */
625
+ getChannel: getChannel(join9(path)),
626
+ /**
627
+ * Adds an channel to EventCatalog
628
+ *
629
+ * @param command - The channel to write
630
+ * @param options - Optional options to write the channel
631
+ *
632
+ */
633
+ writeChannel: writeChannel(join9(path, "channels")),
634
+ /**
635
+ * Remove an channel to EventCatalog (modeled on the standard POSIX rm utility)
636
+ *
637
+ * @param path - The path to your channel, e.g. `/Inventory/InventoryAdjusted`
638
+ *
639
+ */
640
+ rmChannel: rmChannel(join9(path, "channels")),
641
+ /**
642
+ * Remove an channel by an Event id
643
+ *
644
+ * @param id - The id of the channel you want to remove
645
+ *
646
+ */
647
+ rmChannelById: rmChannelById(join9(path)),
648
+ /**
649
+ * Moves a given channel id to the version directory
650
+ * @param directory
651
+ */
652
+ versionChannel: versionChannel(join9(path)),
653
+ /**
654
+ * Check to see if a channel version exists
655
+ * @param id - The id of the channel
656
+ * @param version - The version of the channel (supports semver)
657
+ * @returns
658
+ */
659
+ channelHasVersion: channelHasVersion(join9(path)),
660
+ /**
661
+ * Add a channel to an event
662
+ *
663
+ * Optionally specify a version to add the channel to a specific version of the event.
664
+ *
665
+ * @example
666
+ * ```ts
667
+ * import utils from '@eventcatalog/utils';
668
+ *
669
+ * const { addEventToChannel } = utils('/path/to/eventcatalog');
670
+ *
671
+ * // adds a new event (InventoryUpdatedEvent) to the inventory.{env}.events channel
672
+ * await addEventToChannel('inventory.{env}.events channel', { id: 'InventoryUpdatedEvent', version: '2.0.0', parameters: { env: 'dev' } });
673
+ *
674
+ * ```
675
+ */
676
+ addEventToChannel: addMessageToChannel(join9(path), "events"),
677
+ /**
678
+ * Add a channel to an command
679
+ *
680
+ * Optionally specify a version to add the channel to a specific version of the command.
681
+ *
682
+ * @example
683
+ * ```ts
684
+ * import utils from '@eventcatalog/utils';
685
+ *
686
+ * const { addCommandToChannel } = utils('/path/to/eventcatalog');
687
+ *
688
+ * // adds a new command (UpdateInventory) to the inventory.{env}.events channel
689
+ * await addCommandToChannel('inventory.{env}.events channel', { id: 'UpdateInventory', version: '2.0.0', parameters: { env: 'dev' } });
690
+ *
691
+ * ```
692
+ */
693
+ addCommandToChannel: addMessageToChannel(join9(path), "commands"),
694
+ /**
695
+ * Add a channel to an query
696
+ *
697
+ * Optionally specify a version to add the channel to a specific version of the query.
698
+ *
699
+ * @example
700
+ * ```ts
701
+ * import utils from '@eventcatalog/utils';
702
+ *
703
+ * const { addQueryToChannel } = utils('/path/to/eventcatalog');
704
+ *
705
+ * // adds a new query (GetInventory) to the inventory.{env}.events channel
706
+ * await addQueryToChannel('inventory.{env}.events channel', { id: 'GetInventory', version: '2.0.0', parameters: { env: 'dev' } });
707
+ *
708
+ * ```
709
+ */
710
+ addQueryToChannel: addMessageToChannel(join9(path), "queries"),
569
711
  /**
570
712
  * ================================
571
713
  * SERVICES
@@ -578,14 +720,14 @@ var src_default = (path) => {
578
720
  * @param options - Optional options to write the event
579
721
  *
580
722
  */
581
- writeService: writeService(join8(path, "services")),
723
+ writeService: writeService(join9(path, "services")),
582
724
  /**
583
725
  * Adds a versioned service to EventCatalog
584
726
  *
585
727
  * @param service - The service to write
586
728
  *
587
729
  */
588
- writeVersionedService: writeVersionedService(join8(path, "services")),
730
+ writeVersionedService: writeVersionedService(join9(path, "services")),
589
731
  /**
590
732
  * Adds a service to a domain in EventCatalog
591
733
  *
@@ -594,33 +736,33 @@ var src_default = (path) => {
594
736
  * @param options - Optional options to write the event
595
737
  *
596
738
  */
597
- writeServiceToDomain: writeServiceToDomain(join8(path, "domains")),
739
+ writeServiceToDomain: writeServiceToDomain(join9(path, "domains")),
598
740
  /**
599
741
  * Returns a service from EventCatalog
600
742
  * @param id - The id of the service to retrieve
601
743
  * @param version - Optional id of the version to get (supports semver)
602
744
  * @returns Service|Undefined
603
745
  */
604
- getService: getService(join8(path)),
746
+ getService: getService(join9(path)),
605
747
  /**
606
748
  * Moves a given service id to the version directory
607
749
  * @param directory
608
750
  */
609
- versionService: versionService(join8(path)),
751
+ versionService: versionService(join9(path)),
610
752
  /**
611
753
  * Remove a service from EventCatalog (modeled on the standard POSIX rm utility)
612
754
  *
613
755
  * @param path - The path to your service, e.g. `/InventoryService`
614
756
  *
615
757
  */
616
- rmService: rmService(join8(path, "services")),
758
+ rmService: rmService(join9(path, "services")),
617
759
  /**
618
760
  * Remove an service by an service id
619
761
  *
620
762
  * @param id - The id of the service you want to remove
621
763
  *
622
764
  */
623
- rmServiceById: rmServiceById(join8(path)),
765
+ rmServiceById: rmServiceById(join9(path)),
624
766
  /**
625
767
  * Adds a file to the given service
626
768
  * @param id - The id of the service to add the file to
@@ -628,21 +770,81 @@ var src_default = (path) => {
628
770
  * @param version - Optional version of the service to add the file to
629
771
  * @returns
630
772
  */
631
- addFileToService: addFileToService(join8(path)),
773
+ addFileToService: addFileToService(join9(path)),
632
774
  /**
633
775
  * Returns the specifications for a given service
634
776
  * @param id - The id of the service to retrieve the specifications for
635
777
  * @param version - Optional version of the service
636
778
  * @returns
637
779
  */
638
- getSpecificationFilesForService: getSpecificationFilesForService(join8(path)),
780
+ getSpecificationFilesForService: getSpecificationFilesForService(join9(path)),
639
781
  /**
640
782
  * Check to see if a service version exists
641
783
  * @param id - The id of the service
642
784
  * @param version - The version of the service (supports semver)
643
785
  * @returns
644
786
  */
645
- serviceHasVersion: serviceHasVersion(join8(path)),
787
+ serviceHasVersion: serviceHasVersion(join9(path)),
788
+ /**
789
+ * Add an event to a service by it's id.
790
+ *
791
+ * Optionally specify a version to add the event to a specific version of the service.
792
+ *
793
+ * @example
794
+ * ```ts
795
+ * import utils from '@eventcatalog/utils';
796
+ *
797
+ * const { addEventToService } = utils('/path/to/eventcatalog');
798
+ *
799
+ * // adds a new event (InventoryUpdatedEvent) that the InventoryService will send
800
+ * await addEventToService('InventoryService', 'sends', { event: 'InventoryUpdatedEvent', version: '2.0.0' });
801
+ *
802
+ * // adds a new event (OrderComplete) that the InventoryService will receive
803
+ * await addEventToService('InventoryService', 'receives', { event: 'OrderComplete', version: '2.0.0' });
804
+ *
805
+ * ```
806
+ */
807
+ addEventToService: addMessageToService(join9(path)),
808
+ /**
809
+ * Add a command to a service by it's id.
810
+ *
811
+ * Optionally specify a version to add the event to a specific version of the service.
812
+ *
813
+ * @example
814
+ * ```ts
815
+ * import utils from '@eventcatalog/utils';
816
+ *
817
+ * const { addCommandToService } = utils('/path/to/eventcatalog');
818
+ *
819
+ * // adds a new command (UpdateInventoryCommand) that the InventoryService will send
820
+ * await addCommandToService('InventoryService', 'sends', { command: 'UpdateInventoryCommand', version: '2.0.0' });
821
+ *
822
+ * // adds a new command (VerifyInventory) that the InventoryService will receive
823
+ * await addCommandToService('InventoryService', 'receives', { command: 'VerifyInventory', version: '2.0.0' });
824
+ *
825
+ * ```
826
+ */
827
+ addCommandToService: addMessageToService(join9(path)),
828
+ /**
829
+ * Add a query to a service by it's id.
830
+ *
831
+ * Optionally specify a version to add the event to a specific version of the service.
832
+ *
833
+ * @example
834
+ * ```ts
835
+ * import utils from '@eventcatalog/utils';
836
+ *
837
+ * const { addQueryToService } = utils('/path/to/eventcatalog');
838
+ *
839
+ * // adds a new query (UpdateInventory) that the InventoryService will send
840
+ * await addQueryToService('InventoryService', 'sends', { command: 'UpdateInventory', version: '2.0.0' });
841
+ *
842
+ * // adds a new command (VerifyInventory) that the InventoryService will receive
843
+ * await addQueryToService('InventoryService', 'receives', { command: 'VerifyInventory', version: '2.0.0' });
844
+ *
845
+ * ```
846
+ */
847
+ addQueryToService: addMessageToService(join9(path)),
646
848
  /**
647
849
  * ================================
648
850
  * Domains
@@ -655,33 +857,33 @@ var src_default = (path) => {
655
857
  * @param options - Optional options to write the event
656
858
  *
657
859
  */
658
- writeDomain: writeDomain(join8(path, "domains")),
860
+ writeDomain: writeDomain(join9(path, "domains")),
659
861
  /**
660
862
  * Returns a domain from EventCatalog
661
863
  * @param id - The id of the domain to retrieve
662
864
  * @param version - Optional id of the version to get (supports semver)
663
865
  * @returns Domain|Undefined
664
866
  */
665
- getDomain: getDomain(join8(path, "domains")),
867
+ getDomain: getDomain(join9(path, "domains")),
666
868
  /**
667
869
  * Moves a given domain id to the version directory
668
870
  * @param directory
669
871
  */
670
- versionDomain: versionDomain(join8(path, "domains")),
872
+ versionDomain: versionDomain(join9(path, "domains")),
671
873
  /**
672
874
  * Remove a domain from EventCatalog (modeled on the standard POSIX rm utility)
673
875
  *
674
876
  * @param path - The path to your domain, e.g. `/Payment`
675
877
  *
676
878
  */
677
- rmDomain: rmDomain(join8(path, "domains")),
879
+ rmDomain: rmDomain(join9(path, "domains")),
678
880
  /**
679
881
  * Remove an service by an domain id
680
882
  *
681
883
  * @param id - The id of the domain you want to remove
682
884
  *
683
885
  */
684
- rmDomainById: rmDomainById(join8(path, "domains")),
886
+ rmDomainById: rmDomainById(join9(path, "domains")),
685
887
  /**
686
888
  * Adds a file to the given domain
687
889
  * @param id - The id of the domain to add the file to
@@ -689,54 +891,14 @@ var src_default = (path) => {
689
891
  * @param version - Optional version of the domain to add the file to
690
892
  * @returns
691
893
  */
692
- addFileToDomain: addFileToDomain(join8(path, "domains")),
693
- /**
694
- * Add an event to a service by it's id.
695
- *
696
- * Optionally specify a version to add the event to a specific version of the service.
697
- *
698
- * @example
699
- * ```ts
700
- * import utils from '@eventcatalog/utils';
701
- *
702
- * const { addEventToService } = utils('/path/to/eventcatalog');
703
- *
704
- * // adds a new event (InventoryUpdatedEvent) that the InventoryService will send
705
- * await addEventToService('InventoryService', 'sends', { event: 'InventoryUpdatedEvent', version: '2.0.0' });
706
- *
707
- * // adds a new event (OrderComplete) that the InventoryService will receive
708
- * await addEventToService('InventoryService', 'receives', { event: 'OrderComplete', version: '2.0.0' });
709
- *
710
- * ```
711
- */
712
- addEventToService: addMessageToService(join8(path)),
713
- /**
714
- * Add a command to a service by it's id.
715
- *
716
- * Optionally specify a version to add the event to a specific version of the service.
717
- *
718
- * @example
719
- * ```ts
720
- * import utils from '@eventcatalog/utils';
721
- *
722
- * const { addCommandToService } = utils('/path/to/eventcatalog');
723
- *
724
- * // adds a new command (UpdateInventoryCommand) that the InventoryService will send
725
- * await addCommandToService('InventoryService', 'sends', { command: 'UpdateInventoryCommand', version: '2.0.0' });
726
- *
727
- * // adds a new command (VerifyInventory) that the InventoryService will receive
728
- * await addCommandToService('InventoryService', 'receives', { command: 'VerifyInventory', version: '2.0.0' });
729
- *
730
- * ```
731
- */
732
- addCommandToService: addMessageToService(join8(path)),
894
+ addFileToDomain: addFileToDomain(join9(path, "domains")),
733
895
  /**
734
896
  * Check to see if a domain version exists
735
897
  * @param id - The id of the domain
736
898
  * @param version - The version of the domain (supports semver)
737
899
  * @returns
738
900
  */
739
- domainHasVersion: domainHasVersion(join8(path)),
901
+ domainHasVersion: domainHasVersion(join9(path)),
740
902
  /**
741
903
  * Adds a given service to a domain
742
904
  * @param id - The id of the domain
@@ -744,7 +906,7 @@ var src_default = (path) => {
744
906
  * @param version - (Optional) The version of the domain to add the service to
745
907
  * @returns
746
908
  */
747
- addServiceToDomain: addServiceToDomain(join8(path, "domains"))
909
+ addServiceToDomain: addServiceToDomain(join9(path, "domains"))
748
910
  };
749
911
  };
750
912
  export {