@eventcatalog/sdk 2.1.1 → 2.1.2

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
@@ -20,13 +20,13 @@ var versionExists = async (catalogDir, id, version) => {
20
20
  var findFileById = async (catalogDir, id, version) => {
21
21
  const files = await getFiles(`${catalogDir}/**/index.{md,mdx}`);
22
22
  const matchedFiles = await searchFilesForId(files, id) || [];
23
- const latestVersion = matchedFiles.find((path2) => !path2.includes("versioned"));
23
+ const latestVersion = matchedFiles.find((path3) => !path3.includes("versioned"));
24
24
  if (!version) {
25
25
  return latestVersion;
26
26
  }
27
- const parsedFiles = matchedFiles.map((path2) => {
28
- const { data } = matter.read(path2);
29
- return { ...data, path: path2 };
27
+ const parsedFiles = matchedFiles.map((path3) => {
28
+ const { data } = matter.read(path3);
29
+ return { ...data, path: path3 };
30
30
  });
31
31
  const semverRange = validRange(version);
32
32
  if (semverRange && valid(version)) {
@@ -50,8 +50,8 @@ var getFiles = async (pattern, ignore = "") => {
50
50
  throw new Error(`Error finding files: ${error}`);
51
51
  }
52
52
  };
53
- var readMdxFile = async (path2) => {
54
- const { data } = matter.read(path2);
53
+ var readMdxFile = async (path3) => {
54
+ const { data } = matter.read(path3);
55
55
  const { markdown, ...frontmatter } = data;
56
56
  return { ...frontmatter, markdown };
57
57
  };
@@ -132,8 +132,8 @@ var writeResource = async (catalogDir, resource, options = {
132
132
  override: false,
133
133
  versionExistingContent: false
134
134
  }) => {
135
- const path2 = options.path || `/${resource.id}`;
136
- const fullPath = join2(catalogDir, path2);
135
+ const path3 = options.path || `/${resource.id}`;
136
+ const fullPath = join2(catalogDir, path3);
137
137
  fsSync2.mkdirSync(fullPath, { recursive: true });
138
138
  const lockPath = join2(fullPath, "index.mdx");
139
139
  if (!fsSync2.existsSync(lockPath)) {
@@ -240,8 +240,8 @@ var writeEventToService = (directory) => async (event, service, options = { path
240
240
  pathForEvent = join3(pathForEvent, event.id);
241
241
  await writeResource(directory, { ...event }, { ...options, path: pathForEvent, type: "event" });
242
242
  };
243
- var rmEvent = (directory) => async (path2) => {
244
- await fs2.rm(join3(directory, path2), { recursive: true });
243
+ var rmEvent = (directory) => async (path3) => {
244
+ await fs2.rm(join3(directory, path3), { recursive: true });
245
245
  };
246
246
  var rmEventById = (directory) => async (id, version, persistFiles) => {
247
247
  await rmResourceById(directory, id, version, { type: "event", persistFiles });
@@ -267,8 +267,8 @@ var writeCommandToService = (directory) => async (command, service, options = {
267
267
  pathForEvent = join4(pathForEvent, command.id);
268
268
  await writeResource(directory, { ...command }, { ...options, path: pathForEvent, type: "command" });
269
269
  };
270
- var rmCommand = (directory) => async (path2) => {
271
- await fs3.rm(join4(directory, path2), { recursive: true });
270
+ var rmCommand = (directory) => async (path3) => {
271
+ await fs3.rm(join4(directory, path3), { recursive: true });
272
272
  };
273
273
  var rmCommandById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "command", persistFiles });
274
274
  var versionCommand = (directory) => async (id) => versionResource(directory, id);
@@ -292,8 +292,8 @@ var writeQueryToService = (directory) => async (query, service, options = { path
292
292
  pathForQuery = join5(pathForQuery, query.id);
293
293
  await writeResource(directory, { ...query }, { ...options, path: pathForQuery, type: "query" });
294
294
  };
295
- var rmQuery = (directory) => async (path2) => {
296
- await fs4.rm(join5(directory, path2), { recursive: true });
295
+ var rmQuery = (directory) => async (path3) => {
296
+ await fs4.rm(join5(directory, path3), { recursive: true });
297
297
  };
298
298
  var rmQueryById = (directory) => async (id, version, persistFiles) => {
299
299
  await rmResourceById(directory, id, version, { type: "query", persistFiles });
@@ -329,8 +329,8 @@ var writeService = (directory) => async (service, options = { path: "" }) => {
329
329
  };
330
330
  var writeVersionedService = (directory) => async (service) => {
331
331
  const resource = { ...service };
332
- const path2 = getVersionedDirectory(service.id, service.version);
333
- return await writeService(directory)(resource, { path: path2 });
332
+ const path3 = getVersionedDirectory(service.id, service.version);
333
+ return await writeService(directory)(resource, { path: path3 });
334
334
  };
335
335
  var writeServiceToDomain = (directory) => async (service, domain, options = { path: "" }) => {
336
336
  let pathForService = domain.version && domain.version !== "latest" ? `/${domain.id}/versioned/${domain.version}/services` : `/${domain.id}/services`;
@@ -338,8 +338,8 @@ var writeServiceToDomain = (directory) => async (service, domain, options = { pa
338
338
  await writeResource(directory, { ...service }, { ...options, path: pathForService, type: "service" });
339
339
  };
340
340
  var versionService = (directory) => async (id) => versionResource(directory, id);
341
- var rmService = (directory) => async (path2) => {
342
- await fs5.rm(join6(directory, path2), { recursive: true });
341
+ var rmService = (directory) => async (path3) => {
342
+ await fs5.rm(join6(directory, path3), { recursive: true });
343
343
  };
344
344
  var rmServiceById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "service", persistFiles });
345
345
  var addFileToService = (directory) => async (id, file, version) => addFileToResource(directory, id, file, version);
@@ -392,8 +392,8 @@ var addMessageToService = (directory) => async (id, direction, event, version) =
392
392
  if (!existingResource) {
393
393
  throw new Error(`Cannot find service ${id} in the catalog`);
394
394
  }
395
- const path2 = existingResource.split("/services")[0];
396
- const pathToResource = join6(path2, "services");
395
+ const path3 = existingResource.split("/services")[0];
396
+ const pathToResource = join6(path3, "services");
397
397
  await rmServiceById(directory)(id, version);
398
398
  await writeService(pathToResource)(service);
399
399
  };
@@ -404,7 +404,9 @@ var serviceHasVersion = (directory) => async (id, version) => {
404
404
 
405
405
  // src/domains.ts
406
406
  import fs6 from "node:fs/promises";
407
- import { join as join7 } from "node:path";
407
+ import path, { join as join7 } from "node:path";
408
+ import fsSync3 from "node:fs";
409
+ import matter3 from "gray-matter";
408
410
  var getDomain = (directory) => async (id, version) => getResource(directory, id, version, { type: "domain" });
409
411
  var getDomains = (directory) => async (options) => getResources(directory, {
410
412
  type: "domains",
@@ -419,11 +421,27 @@ var writeDomain = (directory) => async (domain, options = { path: "" }) => {
419
421
  return await writeResource(directory, resource, { ...options, type: "domain" });
420
422
  };
421
423
  var versionDomain = (directory) => async (id) => versionResource(directory, id);
422
- var rmDomain = (directory) => async (path2) => {
423
- await fs6.rm(join7(directory, path2), { recursive: true });
424
+ var rmDomain = (directory) => async (path3) => {
425
+ await fs6.rm(join7(directory, path3), { recursive: true });
424
426
  };
425
427
  var rmDomainById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "domain", persistFiles });
426
428
  var addFileToDomain = (directory) => async (id, file, version) => addFileToResource(directory, id, file, version);
429
+ var addUbiquitousLanguageToDomain = (directory) => async (id, ubiquitousLanguageDictionary, version) => {
430
+ const content = matter3.stringify("", {
431
+ ...ubiquitousLanguageDictionary
432
+ });
433
+ await addFileToResource(directory, id, { content, fileName: "ubiquitous-language.mdx" }, version);
434
+ };
435
+ var getUbiquitousLanguageFromDomain = (directory) => async (id, version) => {
436
+ const pathToDomain = await findFileById(directory, id, version) || "";
437
+ const pathToUbiquitousLanguage = path.join(path.dirname(pathToDomain), "ubiquitous-language.mdx");
438
+ const fileExists = fsSync3.existsSync(pathToUbiquitousLanguage);
439
+ if (!fileExists) {
440
+ return void 0;
441
+ }
442
+ const content = await readMdxFile(pathToUbiquitousLanguage);
443
+ return content;
444
+ };
427
445
  var domainHasVersion = (directory) => async (id, version) => {
428
446
  const file = await findFileById(directory, id, version);
429
447
  return !!file;
@@ -448,8 +466,8 @@ import { join as join8 } from "node:path";
448
466
  var getChannel = (directory) => async (id, version) => getResource(directory, id, version, { type: "channel" });
449
467
  var getChannels = (directory) => async (options) => getResources(directory, { type: "channels", ...options });
450
468
  var writeChannel = (directory) => async (channel, options = { path: "" }) => writeResource(directory, { ...channel }, { ...options, type: "channel" });
451
- var rmChannel = (directory) => async (path2) => {
452
- await fs7.rm(join8(directory, path2), { recursive: true });
469
+ var rmChannel = (directory) => async (path3) => {
470
+ await fs7.rm(join8(directory, path3), { recursive: true });
453
471
  };
454
472
  var rmChannelById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "channel", persistFiles });
455
473
  var versionChannel = (directory) => async (id) => versionResource(directory, id);
@@ -488,22 +506,22 @@ var addMessageToChannel = (directory, collection) => async (id, _message, versio
488
506
  if (!existingResource) {
489
507
  throw new Error(`Cannot find message ${id} in the catalog`);
490
508
  }
491
- const path2 = existingResource.split(`/${collection}`)[0];
492
- const pathToResource = join8(path2, collection);
509
+ const path3 = existingResource.split(`/${collection}`)[0];
510
+ const pathToResource = join8(path3, collection);
493
511
  await rmMessageById(directory)(_message.id, _message.version, true);
494
512
  await writeMessage(pathToResource)(message);
495
513
  };
496
514
 
497
515
  // src/custom-docs.ts
498
- import path, { join as join9 } from "node:path";
499
- import fsSync3 from "node:fs";
516
+ import path2, { join as join9 } from "node:path";
517
+ import fsSync4 from "node:fs";
500
518
  import fs8 from "node:fs/promises";
501
- import matter3 from "gray-matter";
519
+ import matter4 from "gray-matter";
502
520
  import slugify from "slugify";
503
521
  var getCustomDoc = (directory) => async (filePath) => {
504
- const fullPath = path.join(directory, filePath);
522
+ const fullPath = path2.join(directory, filePath);
505
523
  const fullPathWithExtension = fullPath.endsWith(".mdx") ? fullPath : `${fullPath}.mdx`;
506
- const fileExists = fsSync3.existsSync(fullPathWithExtension);
524
+ const fileExists = fsSync4.existsSync(fullPathWithExtension);
507
525
  if (!fileExists) {
508
526
  return void 0;
509
527
  }
@@ -520,10 +538,10 @@ var writeCustomDoc = (directory) => async (customDoc, options = { path: "" }) =>
520
538
  const { fileName, ...rest } = customDoc;
521
539
  const name = fileName || slugify(customDoc.title, { lower: true });
522
540
  const withExtension = name.endsWith(".mdx") ? name : `${name}.mdx`;
523
- const fullPath = path.join(directory, options.path || "", withExtension);
524
- fsSync3.mkdirSync(path.dirname(fullPath), { recursive: true });
525
- const document = matter3.stringify(customDoc.markdown.trim(), rest);
526
- fsSync3.writeFileSync(fullPath, document);
541
+ const fullPath = path2.join(directory, options.path || "", withExtension);
542
+ fsSync4.mkdirSync(path2.dirname(fullPath), { recursive: true });
543
+ const document = matter4.stringify(customDoc.markdown.trim(), rest);
544
+ fsSync4.writeFileSync(fullPath, document);
527
545
  };
528
546
  var rmCustomDoc = (directory) => async (filePath) => {
529
547
  const withExtension = filePath.endsWith(".mdx") ? filePath : `${filePath}.mdx`;
@@ -532,14 +550,14 @@ var rmCustomDoc = (directory) => async (filePath) => {
532
550
 
533
551
  // src/teams.ts
534
552
  import fs9 from "node:fs/promises";
535
- import fsSync4 from "node:fs";
553
+ import fsSync5 from "node:fs";
536
554
  import { join as join10 } from "node:path";
537
- import matter4 from "gray-matter";
555
+ import matter5 from "gray-matter";
538
556
  var getTeam = (catalogDir) => async (id) => {
539
557
  const files = await getFiles(`${catalogDir}/${id}.md`);
540
558
  if (files.length == 0) return void 0;
541
559
  const file = files[0];
542
- const { data, content } = matter4.read(file);
560
+ const { data, content } = matter5.read(file);
543
561
  return {
544
562
  ...data,
545
563
  id: data.id,
@@ -551,7 +569,7 @@ var getTeams = (catalogDir) => async (options) => {
551
569
  const files = await getFiles(`${catalogDir}/teams/*.md`);
552
570
  if (files.length === 0) return [];
553
571
  return files.map((file) => {
554
- const { data, content } = matter4.read(file);
572
+ const { data, content } = matter5.read(file);
555
573
  return {
556
574
  ...data,
557
575
  id: data.id,
@@ -568,23 +586,23 @@ var writeTeam = (catalogDir) => async (team, options = {}) => {
568
586
  throw new Error(`Failed to write ${resource.id} (team) as it already exists`);
569
587
  }
570
588
  const { markdown, ...frontmatter } = resource;
571
- const document = matter4.stringify(markdown, frontmatter);
572
- fsSync4.mkdirSync(join10(catalogDir, ""), { recursive: true });
573
- fsSync4.writeFileSync(join10(catalogDir, "", `${resource.id}.md`), document);
589
+ const document = matter5.stringify(markdown, frontmatter);
590
+ fsSync5.mkdirSync(join10(catalogDir, ""), { recursive: true });
591
+ fsSync5.writeFileSync(join10(catalogDir, "", `${resource.id}.md`), document);
574
592
  };
575
593
  var rmTeamById = (catalogDir) => async (id) => {
576
594
  await fs9.rm(join10(catalogDir, `${id}.md`), { recursive: true });
577
595
  };
578
596
 
579
597
  // src/users.ts
580
- import fsSync5 from "node:fs";
598
+ import fsSync6 from "node:fs";
581
599
  import { join as join11 } from "node:path";
582
- import matter5 from "gray-matter";
600
+ import matter6 from "gray-matter";
583
601
  var getUser = (catalogDir) => async (id) => {
584
602
  const files = await getFiles(`${catalogDir}/${id}.md`);
585
603
  if (files.length == 0) return void 0;
586
604
  const file = files[0];
587
- const { data, content } = matter5.read(file);
605
+ const { data, content } = matter6.read(file);
588
606
  return {
589
607
  ...data,
590
608
  id: data.id,
@@ -597,7 +615,7 @@ var getUsers = (catalogDir) => async (options) => {
597
615
  const files = await getFiles(`${catalogDir}/users/*.md`);
598
616
  if (files.length === 0) return [];
599
617
  return files.map((file) => {
600
- const { data, content } = matter5.read(file);
618
+ const { data, content } = matter6.read(file);
601
619
  return {
602
620
  ...data,
603
621
  id: data.id,
@@ -615,16 +633,16 @@ var writeUser = (catalogDir) => async (user, options = {}) => {
615
633
  throw new Error(`Failed to write ${resource.id} (user) as it already exists`);
616
634
  }
617
635
  const { markdown, ...frontmatter } = resource;
618
- const document = matter5.stringify(markdown, frontmatter);
619
- fsSync5.mkdirSync(join11(catalogDir, ""), { recursive: true });
620
- fsSync5.writeFileSync(join11(catalogDir, "", `${resource.id}.md`), document);
636
+ const document = matter6.stringify(markdown, frontmatter);
637
+ fsSync6.mkdirSync(join11(catalogDir, ""), { recursive: true });
638
+ fsSync6.writeFileSync(join11(catalogDir, "", `${resource.id}.md`), document);
621
639
  };
622
640
  var rmUserById = (catalogDir) => async (id) => {
623
- fsSync5.rmSync(join11(catalogDir, `${id}.md`), { recursive: true });
641
+ fsSync6.rmSync(join11(catalogDir, `${id}.md`), { recursive: true });
624
642
  };
625
643
 
626
644
  // src/index.ts
627
- var index_default = (path2) => {
645
+ var index_default = (path3) => {
628
646
  return {
629
647
  /**
630
648
  * Returns an events from EventCatalog
@@ -632,13 +650,13 @@ var index_default = (path2) => {
632
650
  * @param version - Optional id of the version to get (supports semver)
633
651
  * @returns Event|Undefined
634
652
  */
635
- getEvent: getEvent(join12(path2)),
653
+ getEvent: getEvent(join12(path3)),
636
654
  /**
637
655
  * Returns all events from EventCatalog
638
656
  * @param latestOnly - optional boolean, set to true to get only latest versions
639
657
  * @returns Event[]|Undefined
640
658
  */
641
- getEvents: getEvents(join12(path2)),
659
+ getEvents: getEvents(join12(path3)),
642
660
  /**
643
661
  * Adds an event to EventCatalog
644
662
  *
@@ -646,7 +664,7 @@ var index_default = (path2) => {
646
664
  * @param options - Optional options to write the event
647
665
  *
648
666
  */
649
- writeEvent: writeEvent(join12(path2, "events")),
667
+ writeEvent: writeEvent(join12(path3, "events")),
650
668
  /**
651
669
  * Adds an event to a service in EventCatalog
652
670
  *
@@ -655,26 +673,26 @@ var index_default = (path2) => {
655
673
  * @param options - Optional options to write the event
656
674
  *
657
675
  */
658
- writeEventToService: writeEventToService(join12(path2, "services")),
676
+ writeEventToService: writeEventToService(join12(path3, "services")),
659
677
  /**
660
678
  * Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
661
679
  *
662
680
  * @param path - The path to your event, e.g. `/Inventory/InventoryAdjusted`
663
681
  *
664
682
  */
665
- rmEvent: rmEvent(join12(path2, "events")),
683
+ rmEvent: rmEvent(join12(path3, "events")),
666
684
  /**
667
685
  * Remove an event by an Event id
668
686
  *
669
687
  * @param id - The id of the event you want to remove
670
688
  *
671
689
  */
672
- rmEventById: rmEventById(join12(path2)),
690
+ rmEventById: rmEventById(join12(path3)),
673
691
  /**
674
692
  * Moves a given event id to the version directory
675
693
  * @param directory
676
694
  */
677
- versionEvent: versionEvent(join12(path2)),
695
+ versionEvent: versionEvent(join12(path3)),
678
696
  /**
679
697
  * Adds a file to the given event
680
698
  * @param id - The id of the event to add the file to
@@ -682,7 +700,7 @@ var index_default = (path2) => {
682
700
  * @param version - Optional version of the event to add the file to
683
701
  * @returns
684
702
  */
685
- addFileToEvent: addFileToEvent(join12(path2)),
703
+ addFileToEvent: addFileToEvent(join12(path3)),
686
704
  /**
687
705
  * Adds a schema to the given event
688
706
  * @param id - The id of the event to add the schema to
@@ -690,14 +708,14 @@ var index_default = (path2) => {
690
708
  * @param version - Optional version of the event to add the schema to
691
709
  * @returns
692
710
  */
693
- addSchemaToEvent: addSchemaToEvent(join12(path2)),
711
+ addSchemaToEvent: addSchemaToEvent(join12(path3)),
694
712
  /**
695
713
  * Check to see if an event version exists
696
714
  * @param id - The id of the event
697
715
  * @param version - The version of the event (supports semver)
698
716
  * @returns
699
717
  */
700
- eventHasVersion: eventHasVersion(join12(path2)),
718
+ eventHasVersion: eventHasVersion(join12(path3)),
701
719
  /**
702
720
  * ================================
703
721
  * Commands
@@ -709,13 +727,13 @@ var index_default = (path2) => {
709
727
  * @param version - Optional id of the version to get (supports semver)
710
728
  * @returns Command|Undefined
711
729
  */
712
- getCommand: getCommand(join12(path2)),
730
+ getCommand: getCommand(join12(path3)),
713
731
  /**
714
732
  * Returns all commands from EventCatalog
715
733
  * @param latestOnly - optional boolean, set to true to get only latest versions
716
734
  * @returns Command[]|Undefined
717
735
  */
718
- getCommands: getCommands(join12(path2)),
736
+ getCommands: getCommands(join12(path3)),
719
737
  /**
720
738
  * Adds an command to EventCatalog
721
739
  *
@@ -723,7 +741,7 @@ var index_default = (path2) => {
723
741
  * @param options - Optional options to write the command
724
742
  *
725
743
  */
726
- writeCommand: writeCommand(join12(path2, "commands")),
744
+ writeCommand: writeCommand(join12(path3, "commands")),
727
745
  /**
728
746
  * Adds a command to a service in EventCatalog
729
747
  *
@@ -732,26 +750,26 @@ var index_default = (path2) => {
732
750
  * @param options - Optional options to write the command
733
751
  *
734
752
  */
735
- writeCommandToService: writeCommandToService(join12(path2, "services")),
753
+ writeCommandToService: writeCommandToService(join12(path3, "services")),
736
754
  /**
737
755
  * Remove an command to EventCatalog (modeled on the standard POSIX rm utility)
738
756
  *
739
757
  * @param path - The path to your command, e.g. `/Inventory/InventoryAdjusted`
740
758
  *
741
759
  */
742
- rmCommand: rmCommand(join12(path2, "commands")),
760
+ rmCommand: rmCommand(join12(path3, "commands")),
743
761
  /**
744
762
  * Remove an command by an Event id
745
763
  *
746
764
  * @param id - The id of the command you want to remove
747
765
  *
748
766
  */
749
- rmCommandById: rmCommandById(join12(path2)),
767
+ rmCommandById: rmCommandById(join12(path3)),
750
768
  /**
751
769
  * Moves a given command id to the version directory
752
770
  * @param directory
753
771
  */
754
- versionCommand: versionCommand(join12(path2)),
772
+ versionCommand: versionCommand(join12(path3)),
755
773
  /**
756
774
  * Adds a file to the given command
757
775
  * @param id - The id of the command to add the file to
@@ -759,7 +777,7 @@ var index_default = (path2) => {
759
777
  * @param version - Optional version of the command to add the file to
760
778
  * @returns
761
779
  */
762
- addFileToCommand: addFileToCommand(join12(path2)),
780
+ addFileToCommand: addFileToCommand(join12(path3)),
763
781
  /**
764
782
  * Adds a schema to the given command
765
783
  * @param id - The id of the command to add the schema to
@@ -767,14 +785,14 @@ var index_default = (path2) => {
767
785
  * @param version - Optional version of the command to add the schema to
768
786
  * @returns
769
787
  */
770
- addSchemaToCommand: addSchemaToCommand(join12(path2)),
788
+ addSchemaToCommand: addSchemaToCommand(join12(path3)),
771
789
  /**
772
790
  * Check to see if a command version exists
773
791
  * @param id - The id of the command
774
792
  * @param version - The version of the command (supports semver)
775
793
  * @returns
776
794
  */
777
- commandHasVersion: commandHasVersion(join12(path2)),
795
+ commandHasVersion: commandHasVersion(join12(path3)),
778
796
  /**
779
797
  * ================================
780
798
  * Queries
@@ -786,13 +804,13 @@ var index_default = (path2) => {
786
804
  * @param version - Optional id of the version to get (supports semver)
787
805
  * @returns Query|Undefined
788
806
  */
789
- getQuery: getQuery(join12(path2)),
807
+ getQuery: getQuery(join12(path3)),
790
808
  /**
791
809
  * Returns all queries from EventCatalog
792
810
  * @param latestOnly - optional boolean, set to true to get only latest versions
793
811
  * @returns Query[]|Undefined
794
812
  */
795
- getQueries: getQueries(join12(path2)),
813
+ getQueries: getQueries(join12(path3)),
796
814
  /**
797
815
  * Adds a query to EventCatalog
798
816
  *
@@ -800,7 +818,7 @@ var index_default = (path2) => {
800
818
  * @param options - Optional options to write the event
801
819
  *
802
820
  */
803
- writeQuery: writeQuery(join12(path2, "queries")),
821
+ writeQuery: writeQuery(join12(path3, "queries")),
804
822
  /**
805
823
  * Adds a query to a service in EventCatalog
806
824
  *
@@ -809,26 +827,26 @@ var index_default = (path2) => {
809
827
  * @param options - Optional options to write the query
810
828
  *
811
829
  */
812
- writeQueryToService: writeQueryToService(join12(path2, "services")),
830
+ writeQueryToService: writeQueryToService(join12(path3, "services")),
813
831
  /**
814
832
  * Remove an query to EventCatalog (modeled on the standard POSIX rm utility)
815
833
  *
816
834
  * @param path - The path to your query, e.g. `/Orders/GetOrder`
817
835
  *
818
836
  */
819
- rmQuery: rmQuery(join12(path2, "queries")),
837
+ rmQuery: rmQuery(join12(path3, "queries")),
820
838
  /**
821
839
  * Remove a query by a Query id
822
840
  *
823
841
  * @param id - The id of the query you want to remove
824
842
  *
825
843
  */
826
- rmQueryById: rmQueryById(join12(path2)),
844
+ rmQueryById: rmQueryById(join12(path3)),
827
845
  /**
828
846
  * Moves a given query id to the version directory
829
847
  * @param directory
830
848
  */
831
- versionQuery: versionQuery(join12(path2)),
849
+ versionQuery: versionQuery(join12(path3)),
832
850
  /**
833
851
  * Adds a file to the given query
834
852
  * @param id - The id of the query to add the file to
@@ -836,7 +854,7 @@ var index_default = (path2) => {
836
854
  * @param version - Optional version of the query to add the file to
837
855
  * @returns
838
856
  */
839
- addFileToQuery: addFileToQuery(join12(path2)),
857
+ addFileToQuery: addFileToQuery(join12(path3)),
840
858
  /**
841
859
  * Adds a schema to the given query
842
860
  * @param id - The id of the query to add the schema to
@@ -844,14 +862,14 @@ var index_default = (path2) => {
844
862
  * @param version - Optional version of the query to add the schema to
845
863
  * @returns
846
864
  */
847
- addSchemaToQuery: addSchemaToQuery(join12(path2)),
865
+ addSchemaToQuery: addSchemaToQuery(join12(path3)),
848
866
  /**
849
867
  * Check to see if an query version exists
850
868
  * @param id - The id of the query
851
869
  * @param version - The version of the query (supports semver)
852
870
  * @returns
853
871
  */
854
- queryHasVersion: queryHasVersion(join12(path2)),
872
+ queryHasVersion: queryHasVersion(join12(path3)),
855
873
  /**
856
874
  * ================================
857
875
  * Channels
@@ -863,13 +881,13 @@ var index_default = (path2) => {
863
881
  * @param version - Optional id of the version to get (supports semver)
864
882
  * @returns Channel|Undefined
865
883
  */
866
- getChannel: getChannel(join12(path2)),
884
+ getChannel: getChannel(join12(path3)),
867
885
  /**
868
886
  * Returns all channels from EventCatalog
869
887
  * @param latestOnly - optional boolean, set to true to get only latest versions
870
888
  * @returns Channel[]|Undefined
871
889
  */
872
- getChannels: getChannels(join12(path2)),
890
+ getChannels: getChannels(join12(path3)),
873
891
  /**
874
892
  * Adds an channel to EventCatalog
875
893
  *
@@ -877,33 +895,33 @@ var index_default = (path2) => {
877
895
  * @param options - Optional options to write the channel
878
896
  *
879
897
  */
880
- writeChannel: writeChannel(join12(path2, "channels")),
898
+ writeChannel: writeChannel(join12(path3, "channels")),
881
899
  /**
882
900
  * Remove an channel to EventCatalog (modeled on the standard POSIX rm utility)
883
901
  *
884
902
  * @param path - The path to your channel, e.g. `/Inventory/InventoryAdjusted`
885
903
  *
886
904
  */
887
- rmChannel: rmChannel(join12(path2, "channels")),
905
+ rmChannel: rmChannel(join12(path3, "channels")),
888
906
  /**
889
907
  * Remove an channel by an Event id
890
908
  *
891
909
  * @param id - The id of the channel you want to remove
892
910
  *
893
911
  */
894
- rmChannelById: rmChannelById(join12(path2)),
912
+ rmChannelById: rmChannelById(join12(path3)),
895
913
  /**
896
914
  * Moves a given channel id to the version directory
897
915
  * @param directory
898
916
  */
899
- versionChannel: versionChannel(join12(path2)),
917
+ versionChannel: versionChannel(join12(path3)),
900
918
  /**
901
919
  * Check to see if a channel version exists
902
920
  * @param id - The id of the channel
903
921
  * @param version - The version of the channel (supports semver)
904
922
  * @returns
905
923
  */
906
- channelHasVersion: channelHasVersion(join12(path2)),
924
+ channelHasVersion: channelHasVersion(join12(path3)),
907
925
  /**
908
926
  * Add a channel to an event
909
927
  *
@@ -920,7 +938,7 @@ var index_default = (path2) => {
920
938
  *
921
939
  * ```
922
940
  */
923
- addEventToChannel: addMessageToChannel(join12(path2), "events"),
941
+ addEventToChannel: addMessageToChannel(join12(path3), "events"),
924
942
  /**
925
943
  * Add a channel to an command
926
944
  *
@@ -937,7 +955,7 @@ var index_default = (path2) => {
937
955
  *
938
956
  * ```
939
957
  */
940
- addCommandToChannel: addMessageToChannel(join12(path2), "commands"),
958
+ addCommandToChannel: addMessageToChannel(join12(path3), "commands"),
941
959
  /**
942
960
  * Add a channel to an query
943
961
  *
@@ -954,7 +972,7 @@ var index_default = (path2) => {
954
972
  *
955
973
  * ```
956
974
  */
957
- addQueryToChannel: addMessageToChannel(join12(path2), "queries"),
975
+ addQueryToChannel: addMessageToChannel(join12(path3), "queries"),
958
976
  /**
959
977
  * ================================
960
978
  * SERVICES
@@ -967,14 +985,14 @@ var index_default = (path2) => {
967
985
  * @param options - Optional options to write the event
968
986
  *
969
987
  */
970
- writeService: writeService(join12(path2, "services")),
988
+ writeService: writeService(join12(path3, "services")),
971
989
  /**
972
990
  * Adds a versioned service to EventCatalog
973
991
  *
974
992
  * @param service - The service to write
975
993
  *
976
994
  */
977
- writeVersionedService: writeVersionedService(join12(path2, "services")),
995
+ writeVersionedService: writeVersionedService(join12(path3, "services")),
978
996
  /**
979
997
  * Adds a service to a domain in EventCatalog
980
998
  *
@@ -983,39 +1001,39 @@ var index_default = (path2) => {
983
1001
  * @param options - Optional options to write the event
984
1002
  *
985
1003
  */
986
- writeServiceToDomain: writeServiceToDomain(join12(path2, "domains")),
1004
+ writeServiceToDomain: writeServiceToDomain(join12(path3, "domains")),
987
1005
  /**
988
1006
  * Returns a service from EventCatalog
989
1007
  * @param id - The id of the service to retrieve
990
1008
  * @param version - Optional id of the version to get (supports semver)
991
1009
  * @returns Service|Undefined
992
1010
  */
993
- getService: getService(join12(path2)),
1011
+ getService: getService(join12(path3)),
994
1012
  /**
995
1013
  * Returns all services from EventCatalog
996
1014
  * @param latestOnly - optional boolean, set to true to get only latest versions
997
1015
  * @returns Service[]|Undefined
998
1016
  */
999
- getServices: getServices(join12(path2)),
1017
+ getServices: getServices(join12(path3)),
1000
1018
  /**
1001
1019
  * Moves a given service id to the version directory
1002
1020
  * @param directory
1003
1021
  */
1004
- versionService: versionService(join12(path2)),
1022
+ versionService: versionService(join12(path3)),
1005
1023
  /**
1006
1024
  * Remove a service from EventCatalog (modeled on the standard POSIX rm utility)
1007
1025
  *
1008
1026
  * @param path - The path to your service, e.g. `/InventoryService`
1009
1027
  *
1010
1028
  */
1011
- rmService: rmService(join12(path2, "services")),
1029
+ rmService: rmService(join12(path3, "services")),
1012
1030
  /**
1013
1031
  * Remove an service by an service id
1014
1032
  *
1015
1033
  * @param id - The id of the service you want to remove
1016
1034
  *
1017
1035
  */
1018
- rmServiceById: rmServiceById(join12(path2)),
1036
+ rmServiceById: rmServiceById(join12(path3)),
1019
1037
  /**
1020
1038
  * Adds a file to the given service
1021
1039
  * @param id - The id of the service to add the file to
@@ -1023,21 +1041,21 @@ var index_default = (path2) => {
1023
1041
  * @param version - Optional version of the service to add the file to
1024
1042
  * @returns
1025
1043
  */
1026
- addFileToService: addFileToService(join12(path2)),
1044
+ addFileToService: addFileToService(join12(path3)),
1027
1045
  /**
1028
1046
  * Returns the specifications for a given service
1029
1047
  * @param id - The id of the service to retrieve the specifications for
1030
1048
  * @param version - Optional version of the service
1031
1049
  * @returns
1032
1050
  */
1033
- getSpecificationFilesForService: getSpecificationFilesForService(join12(path2)),
1051
+ getSpecificationFilesForService: getSpecificationFilesForService(join12(path3)),
1034
1052
  /**
1035
1053
  * Check to see if a service version exists
1036
1054
  * @param id - The id of the service
1037
1055
  * @param version - The version of the service (supports semver)
1038
1056
  * @returns
1039
1057
  */
1040
- serviceHasVersion: serviceHasVersion(join12(path2)),
1058
+ serviceHasVersion: serviceHasVersion(join12(path3)),
1041
1059
  /**
1042
1060
  * Add an event to a service by it's id.
1043
1061
  *
@@ -1057,7 +1075,7 @@ var index_default = (path2) => {
1057
1075
  *
1058
1076
  * ```
1059
1077
  */
1060
- addEventToService: addMessageToService(join12(path2)),
1078
+ addEventToService: addMessageToService(join12(path3)),
1061
1079
  /**
1062
1080
  * Add a command to a service by it's id.
1063
1081
  *
@@ -1077,7 +1095,7 @@ var index_default = (path2) => {
1077
1095
  *
1078
1096
  * ```
1079
1097
  */
1080
- addCommandToService: addMessageToService(join12(path2)),
1098
+ addCommandToService: addMessageToService(join12(path3)),
1081
1099
  /**
1082
1100
  * Add a query to a service by it's id.
1083
1101
  *
@@ -1097,7 +1115,7 @@ var index_default = (path2) => {
1097
1115
  *
1098
1116
  * ```
1099
1117
  */
1100
- addQueryToService: addMessageToService(join12(path2)),
1118
+ addQueryToService: addMessageToService(join12(path3)),
1101
1119
  /**
1102
1120
  * ================================
1103
1121
  * Domains
@@ -1110,39 +1128,39 @@ var index_default = (path2) => {
1110
1128
  * @param options - Optional options to write the event
1111
1129
  *
1112
1130
  */
1113
- writeDomain: writeDomain(join12(path2, "domains")),
1131
+ writeDomain: writeDomain(join12(path3, "domains")),
1114
1132
  /**
1115
1133
  * Returns a domain from EventCatalog
1116
1134
  * @param id - The id of the domain to retrieve
1117
1135
  * @param version - Optional id of the version to get (supports semver)
1118
1136
  * @returns Domain|Undefined
1119
1137
  */
1120
- getDomain: getDomain(join12(path2, "domains")),
1138
+ getDomain: getDomain(join12(path3, "domains")),
1121
1139
  /**
1122
1140
  * Returns all domains from EventCatalog
1123
1141
  * @param latestOnly - optional boolean, set to true to get only latest versions
1124
1142
  * @returns Domain[]|Undefined
1125
1143
  */
1126
- getDomains: getDomains(join12(path2)),
1144
+ getDomains: getDomains(join12(path3)),
1127
1145
  /**
1128
1146
  * Moves a given domain id to the version directory
1129
1147
  * @param directory
1130
1148
  */
1131
- versionDomain: versionDomain(join12(path2, "domains")),
1149
+ versionDomain: versionDomain(join12(path3, "domains")),
1132
1150
  /**
1133
1151
  * Remove a domain from EventCatalog (modeled on the standard POSIX rm utility)
1134
1152
  *
1135
1153
  * @param path - The path to your domain, e.g. `/Payment`
1136
1154
  *
1137
1155
  */
1138
- rmDomain: rmDomain(join12(path2, "domains")),
1156
+ rmDomain: rmDomain(join12(path3, "domains")),
1139
1157
  /**
1140
1158
  * Remove an service by an domain id
1141
1159
  *
1142
1160
  * @param id - The id of the domain you want to remove
1143
1161
  *
1144
1162
  */
1145
- rmDomainById: rmDomainById(join12(path2, "domains")),
1163
+ rmDomainById: rmDomainById(join12(path3, "domains")),
1146
1164
  /**
1147
1165
  * Adds a file to the given domain
1148
1166
  * @param id - The id of the domain to add the file to
@@ -1150,14 +1168,28 @@ var index_default = (path2) => {
1150
1168
  * @param version - Optional version of the domain to add the file to
1151
1169
  * @returns
1152
1170
  */
1153
- addFileToDomain: addFileToDomain(join12(path2, "domains")),
1171
+ addFileToDomain: addFileToDomain(join12(path3, "domains")),
1172
+ /**
1173
+ * Adds an ubiquitous language dictionary to a domain
1174
+ * @param id - The id of the domain to add the ubiquitous language to
1175
+ * @param ubiquitousLanguageDictionary - The ubiquitous language dictionary to add
1176
+ * @param version - Optional version of the domain to add the ubiquitous language to
1177
+ */
1178
+ addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain(join12(path3, "domains")),
1179
+ /**
1180
+ * Get the ubiquitous language dictionary from a domain
1181
+ * @param id - The id of the domain to get the ubiquitous language from
1182
+ * @param version - Optional version of the domain to get the ubiquitous language from
1183
+ * @returns
1184
+ */
1185
+ getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain(join12(path3, "domains")),
1154
1186
  /**
1155
1187
  * Check to see if a domain version exists
1156
1188
  * @param id - The id of the domain
1157
1189
  * @param version - The version of the domain (supports semver)
1158
1190
  * @returns
1159
1191
  */
1160
- domainHasVersion: domainHasVersion(join12(path2)),
1192
+ domainHasVersion: domainHasVersion(join12(path3)),
1161
1193
  /**
1162
1194
  * Adds a given service to a domain
1163
1195
  * @param id - The id of the domain
@@ -1165,7 +1197,7 @@ var index_default = (path2) => {
1165
1197
  * @param version - (Optional) The version of the domain to add the service to
1166
1198
  * @returns
1167
1199
  */
1168
- addServiceToDomain: addServiceToDomain(join12(path2, "domains")),
1200
+ addServiceToDomain: addServiceToDomain(join12(path3, "domains")),
1169
1201
  /**
1170
1202
  * ================================
1171
1203
  * Teams
@@ -1178,25 +1210,25 @@ var index_default = (path2) => {
1178
1210
  * @param options - Optional options to write the team
1179
1211
  *
1180
1212
  */
1181
- writeTeam: writeTeam(join12(path2, "teams")),
1213
+ writeTeam: writeTeam(join12(path3, "teams")),
1182
1214
  /**
1183
1215
  * Returns a team from EventCatalog
1184
1216
  * @param id - The id of the team to retrieve
1185
1217
  * @returns Team|Undefined
1186
1218
  */
1187
- getTeam: getTeam(join12(path2, "teams")),
1219
+ getTeam: getTeam(join12(path3, "teams")),
1188
1220
  /**
1189
1221
  * Returns all teams from EventCatalog
1190
1222
  * @returns Team[]|Undefined
1191
1223
  */
1192
- getTeams: getTeams(join12(path2)),
1224
+ getTeams: getTeams(join12(path3)),
1193
1225
  /**
1194
1226
  * Remove a team by the team id
1195
1227
  *
1196
1228
  * @param id - The id of the team you want to remove
1197
1229
  *
1198
1230
  */
1199
- rmTeamById: rmTeamById(join12(path2, "teams")),
1231
+ rmTeamById: rmTeamById(join12(path3, "teams")),
1200
1232
  /**
1201
1233
  * ================================
1202
1234
  * Users
@@ -1209,25 +1241,25 @@ var index_default = (path2) => {
1209
1241
  * @param options - Optional options to write the user
1210
1242
  *
1211
1243
  */
1212
- writeUser: writeUser(join12(path2, "users")),
1244
+ writeUser: writeUser(join12(path3, "users")),
1213
1245
  /**
1214
1246
  * Returns a user from EventCatalog
1215
1247
  * @param id - The id of the user to retrieve
1216
1248
  * @returns User|Undefined
1217
1249
  */
1218
- getUser: getUser(join12(path2, "users")),
1250
+ getUser: getUser(join12(path3, "users")),
1219
1251
  /**
1220
1252
  * Returns all user from EventCatalog
1221
1253
  * @returns User[]|Undefined
1222
1254
  */
1223
- getUsers: getUsers(join12(path2)),
1255
+ getUsers: getUsers(join12(path3)),
1224
1256
  /**
1225
1257
  * Remove a user by the user id
1226
1258
  *
1227
1259
  * @param id - The id of the user you want to remove
1228
1260
  *
1229
1261
  */
1230
- rmUserById: rmUserById(join12(path2, "users")),
1262
+ rmUserById: rmUserById(join12(path3, "users")),
1231
1263
  /**
1232
1264
  * ================================
1233
1265
  * Custom Docs
@@ -1238,26 +1270,26 @@ var index_default = (path2) => {
1238
1270
  * @param path - The path to the custom doc to retrieve
1239
1271
  * @returns CustomDoc|Undefined
1240
1272
  */
1241
- getCustomDoc: getCustomDoc(join12(path2, "docs")),
1273
+ getCustomDoc: getCustomDoc(join12(path3, "docs")),
1242
1274
  /**
1243
1275
  * Returns all custom docs from EventCatalog
1244
1276
  * @param options - Optional options to get custom docs from a specific path
1245
1277
  * @returns CustomDoc[]|Undefined
1246
1278
  */
1247
- getCustomDocs: getCustomDocs(join12(path2, "docs")),
1279
+ getCustomDocs: getCustomDocs(join12(path3, "docs")),
1248
1280
  /**
1249
1281
  * Writes a custom doc to EventCatalog
1250
1282
  * @param customDoc - The custom doc to write
1251
1283
  * @param options - Optional options to write the custom doc
1252
1284
  *
1253
1285
  */
1254
- writeCustomDoc: writeCustomDoc(join12(path2, "docs")),
1286
+ writeCustomDoc: writeCustomDoc(join12(path3, "docs")),
1255
1287
  /**
1256
1288
  * Removes a custom doc from EventCatalog
1257
1289
  * @param path - The path to the custom doc to remove
1258
1290
  *
1259
1291
  */
1260
- rmCustomDoc: rmCustomDoc(join12(path2, "docs"))
1292
+ rmCustomDoc: rmCustomDoc(join12(path3, "docs"))
1261
1293
  };
1262
1294
  };
1263
1295
  export {