@eventcatalog/sdk 2.6.4 → 2.6.6

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 (49) hide show
  1. package/dist/channels.js +3 -3
  2. package/dist/channels.js.map +1 -1
  3. package/dist/channels.mjs +3 -3
  4. package/dist/channels.mjs.map +1 -1
  5. package/dist/commands.js +3 -3
  6. package/dist/commands.js.map +1 -1
  7. package/dist/commands.mjs +3 -3
  8. package/dist/commands.mjs.map +1 -1
  9. package/dist/custom-docs.js.map +1 -1
  10. package/dist/custom-docs.mjs.map +1 -1
  11. package/dist/domains.js +3 -3
  12. package/dist/domains.js.map +1 -1
  13. package/dist/domains.mjs +3 -3
  14. package/dist/domains.mjs.map +1 -1
  15. package/dist/eventcatalog.js +224 -149
  16. package/dist/eventcatalog.js.map +1 -1
  17. package/dist/eventcatalog.mjs +223 -148
  18. package/dist/eventcatalog.mjs.map +1 -1
  19. package/dist/events.js +3 -3
  20. package/dist/events.js.map +1 -1
  21. package/dist/events.mjs +3 -3
  22. package/dist/events.mjs.map +1 -1
  23. package/dist/index.d.mts +60 -30
  24. package/dist/index.d.ts +60 -30
  25. package/dist/index.js +224 -149
  26. package/dist/index.js.map +1 -1
  27. package/dist/index.mjs +223 -148
  28. package/dist/index.mjs.map +1 -1
  29. package/dist/messages.js +3 -3
  30. package/dist/messages.js.map +1 -1
  31. package/dist/messages.mjs +4 -4
  32. package/dist/messages.mjs.map +1 -1
  33. package/dist/queries.js +3 -3
  34. package/dist/queries.js.map +1 -1
  35. package/dist/queries.mjs +3 -3
  36. package/dist/queries.mjs.map +1 -1
  37. package/dist/services.d.mts +45 -1
  38. package/dist/services.d.ts +45 -1
  39. package/dist/services.js +27 -3
  40. package/dist/services.js.map +1 -1
  41. package/dist/services.mjs +25 -4
  42. package/dist/services.mjs.map +1 -1
  43. package/dist/teams.d.mts +8 -1
  44. package/dist/teams.d.ts +8 -1
  45. package/dist/teams.js +122 -11
  46. package/dist/teams.js.map +1 -1
  47. package/dist/teams.mjs +121 -11
  48. package/dist/teams.mjs.map +1 -1
  49. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -23,14 +23,7 @@ declare const _default: (path: string) => {
23
23
  * @returns Event[]|Undefined
24
24
  */
25
25
  getEvents: (options?: {
26
- latestOnly
27
- /**
28
- * Init the SDK for EventCatalog
29
- *
30
- * @param path - The path to the EventCatalog directory
31
- *
32
- */
33
- ?: boolean;
26
+ latestOnly?: boolean;
34
27
  attachSchema?: boolean;
35
28
  }) => Promise<Event[]>;
36
29
  /**
@@ -60,7 +53,19 @@ declare const _default: (path: string) => {
60
53
  }, options?: {
61
54
  path?: string;
62
55
  format?: "md" | "mdx";
63
- override?: boolean;
56
+ override
57
+ /**
58
+ * Returns a command from EventCatalog
59
+ * @param id - The id of the command to retrieve
60
+ * @param version - Optional id of the version to get (supports semver)
61
+ * @returns Command|Undefined
62
+ */
63
+ ? /**
64
+ * Returns a command from EventCatalog
65
+ * @param id - The id of the command to retrieve
66
+ * @param version - Optional id of the version to get (supports semver)
67
+ * @returns Command|Undefined
68
+ */: boolean;
64
69
  }) => Promise<void>;
65
70
  /**
66
71
  * Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
@@ -242,14 +247,7 @@ declare const _default: (path: string) => {
242
247
  */
243
248
  writeQuery: (query: Query, options?: {
244
249
  path?: string;
245
- override? /**
246
- * Adds an event to a service in EventCatalog
247
- *
248
- * @param event - The event to write to the service
249
- * @param service - The service and it's id to write to the event to
250
- * @param options - Optional options to write the event
251
- *
252
- */: boolean;
250
+ override?: boolean;
253
251
  versionExistingContent?: boolean;
254
252
  format?: "md" | "mdx";
255
253
  }) => Promise<void>;
@@ -263,18 +261,7 @@ declare const _default: (path: string) => {
263
261
  */
264
262
  writeQueryToService: (query: Query, service: {
265
263
  id: string;
266
- version
267
- /**
268
- * Returns a command from EventCatalog
269
- * @param id - The id of the command to retrieve
270
- * @param version - Optional id of the version to get (supports semver)
271
- * @returns Command|Undefined
272
- */
273
- ? /**
274
- * ================================
275
- * Commands
276
- * ================================
277
- */: string;
264
+ version?: string;
278
265
  }, options?: {
279
266
  path?: string;
280
267
  format?: "md" | "mdx";
@@ -505,6 +492,12 @@ declare const _default: (path: string) => {
505
492
  * @returns Service|Undefined
506
493
  */
507
494
  getService: (id: string, version?: string) => Promise<Service>;
495
+ /**
496
+ * Returns a service from EventCatalog by it's path.
497
+ * @param path - The path to the service to retrieve
498
+ * @returns Service|Undefined
499
+ */
500
+ getServiceByPath: (path: string) => Promise<Service>;
508
501
  /**
509
502
  * Returns all services from EventCatalog
510
503
  * @param latestOnly - optional boolean, set to true to get only latest versions
@@ -626,6 +619,29 @@ declare const _default: (path: string) => {
626
619
  id: string;
627
620
  version: string;
628
621
  }, version?: string) => Promise<void>;
622
+ /**
623
+ * Check to see if a service exists by it's path.
624
+ *
625
+ * @example
626
+ * ```ts
627
+ * import utils from '@eventcatalog/utils';
628
+ *
629
+ * const { isService } = utils('/path/to/eventcatalog');
630
+ *
631
+ * // returns true if the path is a service
632
+ * await isService('/services/InventoryService/index.mdx');
633
+ * ```
634
+ *
635
+ * @param path - The path to the service to check
636
+ * @returns boolean
637
+ */
638
+ isService: (path: string) => Promise<boolean>;
639
+ /**
640
+ * Converts a file to a service.
641
+ * @param file - The file to convert to a service.
642
+ * @returns The service.
643
+ */
644
+ toService: (file: string) => Promise<Service>;
629
645
  /**
630
646
  * ================================
631
647
  * Domains
@@ -780,7 +796,14 @@ declare const _default: (path: string) => {
780
796
  *
781
797
  */
782
798
  writeUser: (user: User, options?: {
783
- override?: boolean;
799
+ override? /**
800
+ * Adds an event to a service in EventCatalog
801
+ *
802
+ * @param event - The event to write to the service
803
+ * @param service - The service and it's id to write to the event to
804
+ * @param options - Optional options to write the event
805
+ *
806
+ */: boolean;
784
807
  }) => Promise<void>;
785
808
  /**
786
809
  * Returns a user from EventCatalog
@@ -889,6 +912,13 @@ declare const _default: (path: string) => {
889
912
  producers: Service[];
890
913
  consumers: Service[];
891
914
  }>;
915
+ /**
916
+ * Returns the owners for a given resource (e.g domain, service, event, command, query, etc.)
917
+ * @param id - The id of the resource to get the owners for
918
+ * @param version - Optional version of the resource
919
+ * @returns { owners: User[] }
920
+ */
921
+ getOwnersForResource: (id: string, version?: string) => Promise<Team[]>;
892
922
  };
893
923
 
894
924
  export { Channel, Command, CustomDoc, Domain, Event, EventCatalog, Message, Query, Service, Team, UbiquitousLanguageDictionary, User, _default as default };