@eventcatalog/sdk 2.3.0 → 2.3.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.d.mts CHANGED
@@ -31,13 +31,7 @@ declare const _default: (path: string) => {
31
31
  *
32
32
  */
33
33
  writeEvent: (event: Event, options?: {
34
- path? /**
35
- * Adds a file to the given event
36
- * @param id - The id of the event to add the file to
37
- * @param file - File contents to add including the content and the file name
38
- * @param version - Optional version of the event to add the file to
39
- * @returns
40
- */: string;
34
+ path?: string;
41
35
  override?: boolean;
42
36
  versionExistingContent?: boolean;
43
37
  format?: "md" | "mdx";
@@ -464,12 +458,7 @@ declare const _default: (path: string) => {
464
458
  direction?: string;
465
459
  }, options?: {
466
460
  path?: string;
467
- format? /**
468
- * Remove an command by an Event id
469
- *
470
- * @param id - The id of the command you want to remove
471
- *
472
- */: "md" | "mdx";
461
+ format?: "md" | "mdx";
473
462
  }) => Promise<void>;
474
463
  /**
475
464
  * Returns a service from EventCatalog
@@ -696,6 +685,17 @@ declare const _default: (path: string) => {
696
685
  id: string;
697
686
  version: string;
698
687
  }, version?: string) => Promise<void>;
688
+ /**
689
+ * Adds a given subdomain to a domain
690
+ * @param id - The id of the domain
691
+ * @param subDomain - The id and version of the subdomain to add
692
+ * @param version - (Optional) The version of the domain to add the subdomain to
693
+ * @returns
694
+ */
695
+ addSubDomainToDomain: (id: string, subDomain: {
696
+ id: string;
697
+ version: string;
698
+ }, version?: string) => Promise<void>;
699
699
  /**
700
700
  * ================================
701
701
  * Teams
@@ -742,19 +742,7 @@ declare const _default: (path: string) => {
742
742
  *
743
743
  */
744
744
  writeUser: (user: User, options?: {
745
- override
746
- /**
747
- * Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
748
- *
749
- * @param path - The path to your event, e.g. `/Inventory/InventoryAdjusted`
750
- *
751
- */
752
- ? /**
753
- * Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
754
- *
755
- * @param path - The path to your event, e.g. `/Inventory/InventoryAdjusted`
756
- *
757
- */: boolean;
745
+ override?: boolean;
758
746
  }) => Promise<void>;
759
747
  /**
760
748
  * Returns a user from EventCatalog
package/dist/index.d.ts CHANGED
@@ -31,13 +31,7 @@ declare const _default: (path: string) => {
31
31
  *
32
32
  */
33
33
  writeEvent: (event: Event, options?: {
34
- path? /**
35
- * Adds a file to the given event
36
- * @param id - The id of the event to add the file to
37
- * @param file - File contents to add including the content and the file name
38
- * @param version - Optional version of the event to add the file to
39
- * @returns
40
- */: string;
34
+ path?: string;
41
35
  override?: boolean;
42
36
  versionExistingContent?: boolean;
43
37
  format?: "md" | "mdx";
@@ -464,12 +458,7 @@ declare const _default: (path: string) => {
464
458
  direction?: string;
465
459
  }, options?: {
466
460
  path?: string;
467
- format? /**
468
- * Remove an command by an Event id
469
- *
470
- * @param id - The id of the command you want to remove
471
- *
472
- */: "md" | "mdx";
461
+ format?: "md" | "mdx";
473
462
  }) => Promise<void>;
474
463
  /**
475
464
  * Returns a service from EventCatalog
@@ -696,6 +685,17 @@ declare const _default: (path: string) => {
696
685
  id: string;
697
686
  version: string;
698
687
  }, version?: string) => Promise<void>;
688
+ /**
689
+ * Adds a given subdomain to a domain
690
+ * @param id - The id of the domain
691
+ * @param subDomain - The id and version of the subdomain to add
692
+ * @param version - (Optional) The version of the domain to add the subdomain to
693
+ * @returns
694
+ */
695
+ addSubDomainToDomain: (id: string, subDomain: {
696
+ id: string;
697
+ version: string;
698
+ }, version?: string) => Promise<void>;
699
699
  /**
700
700
  * ================================
701
701
  * Teams
@@ -742,19 +742,7 @@ declare const _default: (path: string) => {
742
742
  *
743
743
  */
744
744
  writeUser: (user: User, options?: {
745
- override
746
- /**
747
- * Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
748
- *
749
- * @param path - The path to your event, e.g. `/Inventory/InventoryAdjusted`
750
- *
751
- */
752
- ? /**
753
- * Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
754
- *
755
- * @param path - The path to your event, e.g. `/Inventory/InventoryAdjusted`
756
- *
757
- */: boolean;
745
+ override?: boolean;
758
746
  }) => Promise<void>;
759
747
  /**
760
748
  * Returns a user from EventCatalog
package/dist/index.js CHANGED
@@ -517,6 +517,9 @@ var writeDomain = (directory) => async (domain, options = {
517
517
  if (Array.isArray(domain.services)) {
518
518
  resource.services = uniqueVersions(domain.services);
519
519
  }
520
+ if (Array.isArray(domain.domains)) {
521
+ resource.domains = uniqueVersions(domain.domains);
522
+ }
520
523
  return await writeResource(directory, resource, { ...options, type: "domain" });
521
524
  };
522
525
  var versionDomain = (directory) => async (id) => versionResource(directory, id);
@@ -560,6 +563,21 @@ var addServiceToDomain = (directory) => async (id, service, version) => {
560
563
  await rmDomainById(directory)(id, version, true);
561
564
  await writeDomain(directory)(domain, { format: extension === ".md" ? "md" : "mdx" });
562
565
  };
566
+ var addSubDomainToDomain = (directory) => async (id, subDomain, version) => {
567
+ let domain = await getDomain(directory)(id, version);
568
+ const domainPath = await getResourcePath(directory, id, version);
569
+ const extension = import_node_path6.default.extname(domainPath?.fullPath || "");
570
+ if (domain.domains === void 0) {
571
+ domain.domains = [];
572
+ }
573
+ const subDomainExistsInList = domain.domains.some((s) => s.id === subDomain.id && s.version === subDomain.version);
574
+ if (subDomainExistsInList) {
575
+ return;
576
+ }
577
+ domain.domains.push(subDomain);
578
+ await rmDomainById(directory)(id, version, true);
579
+ await writeDomain(directory)(domain, { format: extension === ".md" ? "md" : "mdx" });
580
+ };
563
581
 
564
582
  // src/channels.ts
565
583
  var import_promises7 = __toESM(require("fs/promises"));
@@ -1388,6 +1406,14 @@ var index_default = (path4) => {
1388
1406
  * @returns
1389
1407
  */
1390
1408
  addServiceToDomain: addServiceToDomain((0, import_node_path12.join)(path4, "domains")),
1409
+ /**
1410
+ * Adds a given subdomain to a domain
1411
+ * @param id - The id of the domain
1412
+ * @param subDomain - The id and version of the subdomain to add
1413
+ * @param version - (Optional) The version of the domain to add the subdomain to
1414
+ * @returns
1415
+ */
1416
+ addSubDomainToDomain: addSubDomainToDomain((0, import_node_path12.join)(path4, "domains")),
1391
1417
  /**
1392
1418
  * ================================
1393
1419
  * Teams