@eventcatalog/sdk 2.6.9 → 2.7.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/README.md +0 -16
- package/dist/domains.d.mts +22 -1
- package/dist/domains.d.ts +22 -1
- package/dist/domains.js +17 -0
- package/dist/domains.js.map +1 -1
- package/dist/domains.mjs +16 -0
- package/dist/domains.mjs.map +1 -1
- package/dist/entities.d.mts +174 -0
- package/dist/entities.d.ts +174 -0
- package/dist/entities.js +318 -0
- package/dist/entities.js.map +1 -0
- package/dist/entities.mjs +277 -0
- package/dist/entities.mjs.map +1 -0
- package/dist/eventcatalog.js +230 -93
- package/dist/eventcatalog.js.map +1 -1
- package/dist/eventcatalog.mjs +232 -95
- package/dist/eventcatalog.mjs.map +1 -1
- package/dist/index.d.mts +120 -5
- package/dist/index.d.ts +120 -5
- package/dist/index.js +226 -89
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +226 -89
- package/dist/index.mjs.map +1 -1
- package/dist/messages.js.map +1 -1
- package/dist/messages.mjs.map +1 -1
- package/dist/services.d.mts +22 -1
- package/dist/services.d.ts +22 -1
- package/dist/services.js +24 -0
- package/dist/services.js.map +1 -1
- package/dist/services.mjs +23 -0
- package/dist/services.mjs.map +1 -1
- package/dist/types.d.d.mts +29 -1
- package/dist/types.d.d.ts +29 -1
- package/dist/types.d.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Event, Command, Query, Channel, Service, Domain, UbiquitousLanguageDictionary, Team, User, CustomDoc, EventCatalog, Message } from './types.d.mjs';
|
|
1
|
+
import { Event, Command, Query, Channel, Service, Domain, UbiquitousLanguageDictionary, Team, User, CustomDoc, EventCatalog, Message, Entity } from './types.d.mjs';
|
|
2
2
|
export { Badge, BaseSchema, ChannelPointer, ResourceGroup, ResourcePointer, Specifications, UbiquitousLanguage } from './types.d.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -252,7 +252,19 @@ declare const _default: (path: string) => {
|
|
|
252
252
|
version?: string;
|
|
253
253
|
}, options?: {
|
|
254
254
|
path?: string;
|
|
255
|
-
format
|
|
255
|
+
format
|
|
256
|
+
/**
|
|
257
|
+
* Check to see if an event version exists
|
|
258
|
+
* @param id - The id of the event
|
|
259
|
+
* @param version - The version of the event (supports semver)
|
|
260
|
+
* @returns
|
|
261
|
+
*/
|
|
262
|
+
? /**
|
|
263
|
+
* Check to see if an event version exists
|
|
264
|
+
* @param id - The id of the event
|
|
265
|
+
* @param version - The version of the event (supports semver)
|
|
266
|
+
* @returns
|
|
267
|
+
*/: "md" | "mdx";
|
|
256
268
|
override?: boolean;
|
|
257
269
|
}) => Promise<void>;
|
|
258
270
|
/**
|
|
@@ -444,7 +456,13 @@ declare const _default: (path: string) => {
|
|
|
444
456
|
*
|
|
445
457
|
*/
|
|
446
458
|
writeService: (service: Service, options?: {
|
|
447
|
-
path
|
|
459
|
+
path? /**
|
|
460
|
+
* Adds a schema to the given event
|
|
461
|
+
* @param id - The id of the event to add the schema to
|
|
462
|
+
* @param schema - Schema contents to add including the content and the file name
|
|
463
|
+
* @param version - Optional version of the event to add the schema to
|
|
464
|
+
* @returns
|
|
465
|
+
*/: string;
|
|
448
466
|
override?: boolean;
|
|
449
467
|
versionExistingContent?: boolean;
|
|
450
468
|
format?: "md" | "mdx";
|
|
@@ -607,6 +625,27 @@ declare const _default: (path: string) => {
|
|
|
607
625
|
id: string;
|
|
608
626
|
version: string;
|
|
609
627
|
}, version?: string) => Promise<void>;
|
|
628
|
+
/**
|
|
629
|
+
* Add an entity to a service by its id.
|
|
630
|
+
*
|
|
631
|
+
* @example
|
|
632
|
+
* ```ts
|
|
633
|
+
* import utils from '@eventcatalog/utils';
|
|
634
|
+
*
|
|
635
|
+
* const { addEntityToService } = utils('/path/to/eventcatalog');
|
|
636
|
+
*
|
|
637
|
+
* // adds a new entity (User) to the InventoryService
|
|
638
|
+
* await addEntityToService('InventoryService', { id: 'User', version: '1.0.0' });
|
|
639
|
+
*
|
|
640
|
+
* // adds a new entity (Product) to a specific version of the InventoryService
|
|
641
|
+
* await addEntityToService('InventoryService', { id: 'Product', version: '1.0.0' }, '2.0.0');
|
|
642
|
+
*
|
|
643
|
+
* ```
|
|
644
|
+
*/
|
|
645
|
+
addEntityToService: (id: string, entity: {
|
|
646
|
+
id: string;
|
|
647
|
+
version: string;
|
|
648
|
+
}, version?: string) => Promise<void>;
|
|
610
649
|
/**
|
|
611
650
|
* Check to see if a service exists by it's path.
|
|
612
651
|
*
|
|
@@ -738,6 +777,17 @@ declare const _default: (path: string) => {
|
|
|
738
777
|
id: string;
|
|
739
778
|
version: string;
|
|
740
779
|
}, version?: string) => Promise<void>;
|
|
780
|
+
/**
|
|
781
|
+
* Adds an entity to a domain
|
|
782
|
+
* @param id - The id of the domain
|
|
783
|
+
* @param entity - The id and version of the entity to add
|
|
784
|
+
* @param version - (Optional) The version of the domain to add the entity to
|
|
785
|
+
* @returns
|
|
786
|
+
*/
|
|
787
|
+
addEntityToDomain: (id: string, entity: {
|
|
788
|
+
id: string;
|
|
789
|
+
version: string;
|
|
790
|
+
}, version?: string) => Promise<void>;
|
|
741
791
|
/**
|
|
742
792
|
* ================================
|
|
743
793
|
* Teams
|
|
@@ -784,7 +834,13 @@ declare const _default: (path: string) => {
|
|
|
784
834
|
*
|
|
785
835
|
*/
|
|
786
836
|
writeUser: (user: User, options?: {
|
|
787
|
-
override
|
|
837
|
+
override? /**
|
|
838
|
+
* Adds an event to EventCatalog
|
|
839
|
+
*
|
|
840
|
+
* @param event - The event to write
|
|
841
|
+
* @param options - Optional options to write the event
|
|
842
|
+
*
|
|
843
|
+
*/: boolean;
|
|
788
844
|
}) => Promise<void>;
|
|
789
845
|
/**
|
|
790
846
|
* Returns a user from EventCatalog
|
|
@@ -912,6 +968,65 @@ declare const _default: (path: string) => {
|
|
|
912
968
|
* @returns { owners: User[] }
|
|
913
969
|
*/
|
|
914
970
|
getOwnersForResource: (id: string, version?: string) => Promise<Team[]>;
|
|
971
|
+
/**
|
|
972
|
+
* ================================
|
|
973
|
+
* Entities
|
|
974
|
+
* ================================
|
|
975
|
+
*/
|
|
976
|
+
/**
|
|
977
|
+
* Returns an entity from EventCatalog
|
|
978
|
+
* @param id - The id of the entity to retrieve
|
|
979
|
+
* @param version - Optional id of the version to get (supports semver)
|
|
980
|
+
* @returns Entity|Undefined
|
|
981
|
+
*/
|
|
982
|
+
getEntity: (id: string, version?: string) => Promise<Entity>;
|
|
983
|
+
/**
|
|
984
|
+
* Returns all entities from EventCatalog
|
|
985
|
+
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
986
|
+
* @returns Entity[]|Undefined
|
|
987
|
+
*/
|
|
988
|
+
getEntities: (options?: {
|
|
989
|
+
latestOnly?: boolean;
|
|
990
|
+
}) => Promise<Entity[]>;
|
|
991
|
+
/**
|
|
992
|
+
* Adds an entity to EventCatalog
|
|
993
|
+
*
|
|
994
|
+
* @param entity - The entity to write
|
|
995
|
+
* @param options - Optional options to write the entity
|
|
996
|
+
*
|
|
997
|
+
*/
|
|
998
|
+
writeEntity: (entity: Entity, options?: {
|
|
999
|
+
path?: string;
|
|
1000
|
+
override?: boolean;
|
|
1001
|
+
versionExistingContent?: boolean;
|
|
1002
|
+
format?: "md" | "mdx";
|
|
1003
|
+
}) => Promise<void>;
|
|
1004
|
+
/**
|
|
1005
|
+
* Remove an entity from EventCatalog (modeled on the standard POSIX rm utility)
|
|
1006
|
+
*
|
|
1007
|
+
* @param path - The path to your entity, e.g. `/User`
|
|
1008
|
+
*
|
|
1009
|
+
*/
|
|
1010
|
+
rmEntity: (path: string) => Promise<void>;
|
|
1011
|
+
/**
|
|
1012
|
+
* Remove an entity by an entity id
|
|
1013
|
+
*
|
|
1014
|
+
* @param id - The id of the entity you want to remove
|
|
1015
|
+
*
|
|
1016
|
+
*/
|
|
1017
|
+
rmEntityById: (id: string, version?: string, persistFiles?: boolean) => Promise<void>;
|
|
1018
|
+
/**
|
|
1019
|
+
* Moves a given entity id to the version directory
|
|
1020
|
+
* @param id - The id of the entity to version
|
|
1021
|
+
*/
|
|
1022
|
+
versionEntity: (id: string) => Promise<void>;
|
|
1023
|
+
/**
|
|
1024
|
+
* Check to see if an entity version exists
|
|
1025
|
+
* @param id - The id of the entity
|
|
1026
|
+
* @param version - The version of the entity (supports semver)
|
|
1027
|
+
* @returns
|
|
1028
|
+
*/
|
|
1029
|
+
entityHasVersion: (id: string, version?: string) => Promise<boolean>;
|
|
915
1030
|
};
|
|
916
1031
|
|
|
917
|
-
export { Channel, Command, CustomDoc, Domain, Event, EventCatalog, Message, Query, Service, Team, UbiquitousLanguageDictionary, User, _default as default };
|
|
1032
|
+
export { Channel, Command, CustomDoc, Domain, Entity, Event, EventCatalog, Message, Query, Service, Team, UbiquitousLanguageDictionary, User, _default as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Event, Command, Query, Channel, Service, Domain, UbiquitousLanguageDictionary, Team, User, CustomDoc, EventCatalog, Message } from './types.d.js';
|
|
1
|
+
import { Event, Command, Query, Channel, Service, Domain, UbiquitousLanguageDictionary, Team, User, CustomDoc, EventCatalog, Message, Entity } from './types.d.js';
|
|
2
2
|
export { Badge, BaseSchema, ChannelPointer, ResourceGroup, ResourcePointer, Specifications, UbiquitousLanguage } from './types.d.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -252,7 +252,19 @@ declare const _default: (path: string) => {
|
|
|
252
252
|
version?: string;
|
|
253
253
|
}, options?: {
|
|
254
254
|
path?: string;
|
|
255
|
-
format
|
|
255
|
+
format
|
|
256
|
+
/**
|
|
257
|
+
* Check to see if an event version exists
|
|
258
|
+
* @param id - The id of the event
|
|
259
|
+
* @param version - The version of the event (supports semver)
|
|
260
|
+
* @returns
|
|
261
|
+
*/
|
|
262
|
+
? /**
|
|
263
|
+
* Check to see if an event version exists
|
|
264
|
+
* @param id - The id of the event
|
|
265
|
+
* @param version - The version of the event (supports semver)
|
|
266
|
+
* @returns
|
|
267
|
+
*/: "md" | "mdx";
|
|
256
268
|
override?: boolean;
|
|
257
269
|
}) => Promise<void>;
|
|
258
270
|
/**
|
|
@@ -444,7 +456,13 @@ declare const _default: (path: string) => {
|
|
|
444
456
|
*
|
|
445
457
|
*/
|
|
446
458
|
writeService: (service: Service, options?: {
|
|
447
|
-
path
|
|
459
|
+
path? /**
|
|
460
|
+
* Adds a schema to the given event
|
|
461
|
+
* @param id - The id of the event to add the schema to
|
|
462
|
+
* @param schema - Schema contents to add including the content and the file name
|
|
463
|
+
* @param version - Optional version of the event to add the schema to
|
|
464
|
+
* @returns
|
|
465
|
+
*/: string;
|
|
448
466
|
override?: boolean;
|
|
449
467
|
versionExistingContent?: boolean;
|
|
450
468
|
format?: "md" | "mdx";
|
|
@@ -607,6 +625,27 @@ declare const _default: (path: string) => {
|
|
|
607
625
|
id: string;
|
|
608
626
|
version: string;
|
|
609
627
|
}, version?: string) => Promise<void>;
|
|
628
|
+
/**
|
|
629
|
+
* Add an entity to a service by its id.
|
|
630
|
+
*
|
|
631
|
+
* @example
|
|
632
|
+
* ```ts
|
|
633
|
+
* import utils from '@eventcatalog/utils';
|
|
634
|
+
*
|
|
635
|
+
* const { addEntityToService } = utils('/path/to/eventcatalog');
|
|
636
|
+
*
|
|
637
|
+
* // adds a new entity (User) to the InventoryService
|
|
638
|
+
* await addEntityToService('InventoryService', { id: 'User', version: '1.0.0' });
|
|
639
|
+
*
|
|
640
|
+
* // adds a new entity (Product) to a specific version of the InventoryService
|
|
641
|
+
* await addEntityToService('InventoryService', { id: 'Product', version: '1.0.0' }, '2.0.0');
|
|
642
|
+
*
|
|
643
|
+
* ```
|
|
644
|
+
*/
|
|
645
|
+
addEntityToService: (id: string, entity: {
|
|
646
|
+
id: string;
|
|
647
|
+
version: string;
|
|
648
|
+
}, version?: string) => Promise<void>;
|
|
610
649
|
/**
|
|
611
650
|
* Check to see if a service exists by it's path.
|
|
612
651
|
*
|
|
@@ -738,6 +777,17 @@ declare const _default: (path: string) => {
|
|
|
738
777
|
id: string;
|
|
739
778
|
version: string;
|
|
740
779
|
}, version?: string) => Promise<void>;
|
|
780
|
+
/**
|
|
781
|
+
* Adds an entity to a domain
|
|
782
|
+
* @param id - The id of the domain
|
|
783
|
+
* @param entity - The id and version of the entity to add
|
|
784
|
+
* @param version - (Optional) The version of the domain to add the entity to
|
|
785
|
+
* @returns
|
|
786
|
+
*/
|
|
787
|
+
addEntityToDomain: (id: string, entity: {
|
|
788
|
+
id: string;
|
|
789
|
+
version: string;
|
|
790
|
+
}, version?: string) => Promise<void>;
|
|
741
791
|
/**
|
|
742
792
|
* ================================
|
|
743
793
|
* Teams
|
|
@@ -784,7 +834,13 @@ declare const _default: (path: string) => {
|
|
|
784
834
|
*
|
|
785
835
|
*/
|
|
786
836
|
writeUser: (user: User, options?: {
|
|
787
|
-
override
|
|
837
|
+
override? /**
|
|
838
|
+
* Adds an event to EventCatalog
|
|
839
|
+
*
|
|
840
|
+
* @param event - The event to write
|
|
841
|
+
* @param options - Optional options to write the event
|
|
842
|
+
*
|
|
843
|
+
*/: boolean;
|
|
788
844
|
}) => Promise<void>;
|
|
789
845
|
/**
|
|
790
846
|
* Returns a user from EventCatalog
|
|
@@ -912,6 +968,65 @@ declare const _default: (path: string) => {
|
|
|
912
968
|
* @returns { owners: User[] }
|
|
913
969
|
*/
|
|
914
970
|
getOwnersForResource: (id: string, version?: string) => Promise<Team[]>;
|
|
971
|
+
/**
|
|
972
|
+
* ================================
|
|
973
|
+
* Entities
|
|
974
|
+
* ================================
|
|
975
|
+
*/
|
|
976
|
+
/**
|
|
977
|
+
* Returns an entity from EventCatalog
|
|
978
|
+
* @param id - The id of the entity to retrieve
|
|
979
|
+
* @param version - Optional id of the version to get (supports semver)
|
|
980
|
+
* @returns Entity|Undefined
|
|
981
|
+
*/
|
|
982
|
+
getEntity: (id: string, version?: string) => Promise<Entity>;
|
|
983
|
+
/**
|
|
984
|
+
* Returns all entities from EventCatalog
|
|
985
|
+
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
986
|
+
* @returns Entity[]|Undefined
|
|
987
|
+
*/
|
|
988
|
+
getEntities: (options?: {
|
|
989
|
+
latestOnly?: boolean;
|
|
990
|
+
}) => Promise<Entity[]>;
|
|
991
|
+
/**
|
|
992
|
+
* Adds an entity to EventCatalog
|
|
993
|
+
*
|
|
994
|
+
* @param entity - The entity to write
|
|
995
|
+
* @param options - Optional options to write the entity
|
|
996
|
+
*
|
|
997
|
+
*/
|
|
998
|
+
writeEntity: (entity: Entity, options?: {
|
|
999
|
+
path?: string;
|
|
1000
|
+
override?: boolean;
|
|
1001
|
+
versionExistingContent?: boolean;
|
|
1002
|
+
format?: "md" | "mdx";
|
|
1003
|
+
}) => Promise<void>;
|
|
1004
|
+
/**
|
|
1005
|
+
* Remove an entity from EventCatalog (modeled on the standard POSIX rm utility)
|
|
1006
|
+
*
|
|
1007
|
+
* @param path - The path to your entity, e.g. `/User`
|
|
1008
|
+
*
|
|
1009
|
+
*/
|
|
1010
|
+
rmEntity: (path: string) => Promise<void>;
|
|
1011
|
+
/**
|
|
1012
|
+
* Remove an entity by an entity id
|
|
1013
|
+
*
|
|
1014
|
+
* @param id - The id of the entity you want to remove
|
|
1015
|
+
*
|
|
1016
|
+
*/
|
|
1017
|
+
rmEntityById: (id: string, version?: string, persistFiles?: boolean) => Promise<void>;
|
|
1018
|
+
/**
|
|
1019
|
+
* Moves a given entity id to the version directory
|
|
1020
|
+
* @param id - The id of the entity to version
|
|
1021
|
+
*/
|
|
1022
|
+
versionEntity: (id: string) => Promise<void>;
|
|
1023
|
+
/**
|
|
1024
|
+
* Check to see if an entity version exists
|
|
1025
|
+
* @param id - The id of the entity
|
|
1026
|
+
* @param version - The version of the entity (supports semver)
|
|
1027
|
+
* @returns
|
|
1028
|
+
*/
|
|
1029
|
+
entityHasVersion: (id: string, version?: string) => Promise<boolean>;
|
|
915
1030
|
};
|
|
916
1031
|
|
|
917
|
-
export { Channel, Command, CustomDoc, Domain, Event, EventCatalog, Message, Query, Service, Team, UbiquitousLanguageDictionary, User, _default as default };
|
|
1032
|
+
export { Channel, Command, CustomDoc, Domain, Entity, Event, EventCatalog, Message, Query, Service, Team, UbiquitousLanguageDictionary, User, _default as default };
|