@eventcatalog/sdk 2.10.0 → 2.11.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.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { Event, Command, Query, Channel, Service, Domain, UbiquitousLanguageDictionary, Team, User, CustomDoc, EventCatalog, Message, Entity, Container } from './types.d.mjs';
2
- export { Badge, BaseSchema, ChannelPointer, ReceivesPointer, ResourceGroup, ResourcePointer, SendsPointer, Specification, Specifications, UbiquitousLanguage } from './types.d.mjs';
1
+ import { Event, Command, Query, Channel, Service, Domain, UbiquitousLanguageDictionary, Team, User, CustomDoc, EventCatalog, Message, Entity, Container, DataProduct } from './types.d.mjs';
2
+ export { Badge, BaseSchema, ChannelPointer, DataProductOutputPointer, ReceivesPointer, ResourceGroup, ResourcePointer, SendsPointer, Specification, Specifications, UbiquitousLanguage } from './types.d.mjs';
3
3
 
4
4
  /**
5
5
  * Init the SDK for EventCatalog
@@ -696,7 +696,14 @@ declare const _default: (path: string) => {
696
696
  *
697
697
  */
698
698
  writeDomain: (domain: Domain, options?: {
699
- path?: string;
699
+ path? /**
700
+ * Adds an event to a service in EventCatalog
701
+ *
702
+ * @param event - The event to write to the service
703
+ * @param service - The service and it's id to write to the event to
704
+ * @param options - Optional options to write the event
705
+ *
706
+ */: string;
700
707
  override?: boolean;
701
708
  versionExistingContent?: boolean;
702
709
  format?: "md" | "mdx";
@@ -802,6 +809,69 @@ declare const _default: (path: string) => {
802
809
  id: string;
803
810
  version: string;
804
811
  }, version?: string) => Promise<void>;
812
+ /**
813
+ * Add an event to a domain by its id.
814
+ *
815
+ * @example
816
+ * ```ts
817
+ * import utils from '@eventcatalog/utils';
818
+ *
819
+ * const { addEventToDomain } = utils('/path/to/eventcatalog');
820
+ *
821
+ * // adds a new event (OrderCreated) that the Orders domain will send
822
+ * await addEventToDomain('Orders', 'sends', { id: 'OrderCreated', version: '2.0.0' });
823
+ *
824
+ * // adds a new event (PaymentProcessed) that the Orders domain will receive
825
+ * await addEventToDomain('Orders', 'receives', { id: 'PaymentProcessed', version: '2.0.0' });
826
+ *
827
+ * ```
828
+ */
829
+ addEventToDomain: (id: string, direction: string, message: {
830
+ id: string;
831
+ version: string;
832
+ }, version?: string) => Promise<void>;
833
+ /**
834
+ * Add a command to a domain by its id.
835
+ *
836
+ * @example
837
+ * ```ts
838
+ * import utils from '@eventcatalog/utils';
839
+ *
840
+ * const { addCommandToDomain } = utils('/path/to/eventcatalog');
841
+ *
842
+ * // adds a new command (ProcessOrder) that the Orders domain will send
843
+ * await addCommandToDomain('Orders', 'sends', { id: 'ProcessOrder', version: '2.0.0' });
844
+ *
845
+ * // adds a new command (CancelOrder) that the Orders domain will receive
846
+ * await addCommandToDomain('Orders', 'receives', { id: 'CancelOrder', version: '2.0.0' });
847
+ *
848
+ * ```
849
+ */
850
+ addCommandToDomain: (id: string, direction: string, message: {
851
+ id: string;
852
+ version: string;
853
+ }, version?: string) => Promise<void>;
854
+ /**
855
+ * Add a query to a domain by its id.
856
+ *
857
+ * @example
858
+ * ```ts
859
+ * import utils from '@eventcatalog/utils';
860
+ *
861
+ * const { addQueryToDomain } = utils('/path/to/eventcatalog');
862
+ *
863
+ * // adds a new query (GetOrderStatus) that the Orders domain will send
864
+ * await addQueryToDomain('Orders', 'sends', { id: 'GetOrderStatus', version: '2.0.0' });
865
+ *
866
+ * // adds a new query (GetInventory) that the Orders domain will receive
867
+ * await addQueryToDomain('Orders', 'receives', { id: 'GetInventory', version: '2.0.0' });
868
+ *
869
+ * ```
870
+ */
871
+ addQueryToDomain: (id: string, direction: string, message: {
872
+ id: string;
873
+ version: string;
874
+ }, version?: string) => Promise<void>;
805
875
  /**
806
876
  * ================================
807
877
  * Teams
@@ -1116,8 +1186,111 @@ declare const _default: (path: string) => {
1116
1186
  }, options?: {
1117
1187
  path?: string;
1118
1188
  format?: "md" | "mdx";
1189
+ override? /**
1190
+ * Remove an command to EventCatalog (modeled on the standard POSIX rm utility)
1191
+ *
1192
+ * @param path - The path to your command, e.g. `/Inventory/InventoryAdjusted`
1193
+ *
1194
+ */: boolean;
1195
+ }) => Promise<void>;
1196
+ /**
1197
+ * ================================
1198
+ * Data Products
1199
+ * ================================
1200
+ */
1201
+ /**
1202
+ * Adds a data product to EventCatalog
1203
+ * @param dataProduct - The data product to write
1204
+ * @param options - Optional options to write the data product
1205
+ *
1206
+ */
1207
+ writeDataProduct: (dataProduct: DataProduct, options?: {
1208
+ path?: string;
1119
1209
  override?: boolean;
1210
+ versionExistingContent?: boolean;
1211
+ format?: "md" | "mdx";
1120
1212
  }) => Promise<void>;
1213
+ /**
1214
+ * Writes a data product to a domain in EventCatalog
1215
+ * @param dataProduct - The data product to write
1216
+ * @param domain - The domain to write the data product to
1217
+ * @param options - Optional options to write the data product
1218
+ *
1219
+ */
1220
+ writeDataProductToDomain: (dataProduct: DataProduct, domain: {
1221
+ id: string;
1222
+ version?: string;
1223
+ }, options?: {
1224
+ path?: string;
1225
+ format?: "md" | "mdx";
1226
+ override? /**
1227
+ * Adds a schema to the given event
1228
+ * @param id - The id of the event to add the schema to
1229
+ * @param schema - Schema contents to add including the content and the file name
1230
+ * @param version - Optional version of the event to add the schema to
1231
+ * @returns
1232
+ */: boolean;
1233
+ }) => Promise<void>;
1234
+ /**
1235
+ * Returns a data product from EventCatalog
1236
+ * @param id - The id of the data product to retrieve
1237
+ * @param version - Optional id of the version to get (supports semver)
1238
+ * @returns DataProduct|Undefined
1239
+ */
1240
+ getDataProduct: (id: string, version?: string) => Promise<DataProduct>;
1241
+ /**
1242
+ * Returns all data products from EventCatalog
1243
+ * @param latestOnly - optional boolean, set to true to get only latest versions
1244
+ * @returns DataProduct[]|Undefined
1245
+ */
1246
+ getDataProducts: (options?: {
1247
+ latestOnly?: boolean;
1248
+ }) => Promise<DataProduct[]>;
1249
+ /**
1250
+ * Version a data product by its id
1251
+ * @param id - The id of the data product to version
1252
+ */
1253
+ versionDataProduct: (id: string) => Promise<void>;
1254
+ /**
1255
+ * Remove a data product by its path
1256
+ * @param path - The path to the data product to remove
1257
+ */
1258
+ rmDataProduct: (path: string) => Promise<void>;
1259
+ /**
1260
+ * Remove a data product by its id
1261
+ * @param id - The id of the data product to remove
1262
+ * @param version - Optional version of the data product to remove
1263
+ */
1264
+ rmDataProductById: (id: string, version?: string, persistFiles?: boolean) => Promise<void>;
1265
+ /**
1266
+ * Check to see if a data product version exists
1267
+ * @param id - The id of the data product
1268
+ * @param version - The version of the data product (supports semver)
1269
+ * @returns
1270
+ */
1271
+ dataProductHasVersion: (id: string, version?: string) => Promise<boolean>;
1272
+ /**
1273
+ * Adds a file to a data product by its id
1274
+ * @param id - The id of the data product to add the file to
1275
+ * @param file - File contents to add including the content and the file name
1276
+ * @param version - Optional version of the data product to add the file to
1277
+ * @returns
1278
+ */
1279
+ addFileToDataProduct: (id: string, file: {
1280
+ content: string;
1281
+ fileName: string;
1282
+ }, version?: string) => Promise<void>;
1283
+ /**
1284
+ * Adds a data product to a domain
1285
+ * @param id - The id of the domain
1286
+ * @param dataProduct - The id and version of the data product to add
1287
+ * @param version - (Optional) The version of the domain to add the data product to
1288
+ * @returns
1289
+ */
1290
+ addDataProductToDomain: (id: string, dataProduct: {
1291
+ id: string;
1292
+ version: string;
1293
+ }, version?: string) => Promise<void>;
1121
1294
  };
1122
1295
 
1123
- export { Channel, Command, Container, CustomDoc, Domain, Entity, Event, EventCatalog, Message, Query, Service, Team, UbiquitousLanguageDictionary, User, _default as default };
1296
+ export { Channel, Command, Container, CustomDoc, DataProduct, Domain, Entity, Event, EventCatalog, Message, Query, Service, Team, UbiquitousLanguageDictionary, User, _default as default };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Event, Command, Query, Channel, Service, Domain, UbiquitousLanguageDictionary, Team, User, CustomDoc, EventCatalog, Message, Entity, Container } from './types.d.js';
2
- export { Badge, BaseSchema, ChannelPointer, ReceivesPointer, ResourceGroup, ResourcePointer, SendsPointer, Specification, Specifications, UbiquitousLanguage } from './types.d.js';
1
+ import { Event, Command, Query, Channel, Service, Domain, UbiquitousLanguageDictionary, Team, User, CustomDoc, EventCatalog, Message, Entity, Container, DataProduct } from './types.d.js';
2
+ export { Badge, BaseSchema, ChannelPointer, DataProductOutputPointer, ReceivesPointer, ResourceGroup, ResourcePointer, SendsPointer, Specification, Specifications, UbiquitousLanguage } from './types.d.js';
3
3
 
4
4
  /**
5
5
  * Init the SDK for EventCatalog
@@ -696,7 +696,14 @@ declare const _default: (path: string) => {
696
696
  *
697
697
  */
698
698
  writeDomain: (domain: Domain, options?: {
699
- path?: string;
699
+ path? /**
700
+ * Adds an event to a service in EventCatalog
701
+ *
702
+ * @param event - The event to write to the service
703
+ * @param service - The service and it's id to write to the event to
704
+ * @param options - Optional options to write the event
705
+ *
706
+ */: string;
700
707
  override?: boolean;
701
708
  versionExistingContent?: boolean;
702
709
  format?: "md" | "mdx";
@@ -802,6 +809,69 @@ declare const _default: (path: string) => {
802
809
  id: string;
803
810
  version: string;
804
811
  }, version?: string) => Promise<void>;
812
+ /**
813
+ * Add an event to a domain by its id.
814
+ *
815
+ * @example
816
+ * ```ts
817
+ * import utils from '@eventcatalog/utils';
818
+ *
819
+ * const { addEventToDomain } = utils('/path/to/eventcatalog');
820
+ *
821
+ * // adds a new event (OrderCreated) that the Orders domain will send
822
+ * await addEventToDomain('Orders', 'sends', { id: 'OrderCreated', version: '2.0.0' });
823
+ *
824
+ * // adds a new event (PaymentProcessed) that the Orders domain will receive
825
+ * await addEventToDomain('Orders', 'receives', { id: 'PaymentProcessed', version: '2.0.0' });
826
+ *
827
+ * ```
828
+ */
829
+ addEventToDomain: (id: string, direction: string, message: {
830
+ id: string;
831
+ version: string;
832
+ }, version?: string) => Promise<void>;
833
+ /**
834
+ * Add a command to a domain by its id.
835
+ *
836
+ * @example
837
+ * ```ts
838
+ * import utils from '@eventcatalog/utils';
839
+ *
840
+ * const { addCommandToDomain } = utils('/path/to/eventcatalog');
841
+ *
842
+ * // adds a new command (ProcessOrder) that the Orders domain will send
843
+ * await addCommandToDomain('Orders', 'sends', { id: 'ProcessOrder', version: '2.0.0' });
844
+ *
845
+ * // adds a new command (CancelOrder) that the Orders domain will receive
846
+ * await addCommandToDomain('Orders', 'receives', { id: 'CancelOrder', version: '2.0.0' });
847
+ *
848
+ * ```
849
+ */
850
+ addCommandToDomain: (id: string, direction: string, message: {
851
+ id: string;
852
+ version: string;
853
+ }, version?: string) => Promise<void>;
854
+ /**
855
+ * Add a query to a domain by its id.
856
+ *
857
+ * @example
858
+ * ```ts
859
+ * import utils from '@eventcatalog/utils';
860
+ *
861
+ * const { addQueryToDomain } = utils('/path/to/eventcatalog');
862
+ *
863
+ * // adds a new query (GetOrderStatus) that the Orders domain will send
864
+ * await addQueryToDomain('Orders', 'sends', { id: 'GetOrderStatus', version: '2.0.0' });
865
+ *
866
+ * // adds a new query (GetInventory) that the Orders domain will receive
867
+ * await addQueryToDomain('Orders', 'receives', { id: 'GetInventory', version: '2.0.0' });
868
+ *
869
+ * ```
870
+ */
871
+ addQueryToDomain: (id: string, direction: string, message: {
872
+ id: string;
873
+ version: string;
874
+ }, version?: string) => Promise<void>;
805
875
  /**
806
876
  * ================================
807
877
  * Teams
@@ -1116,8 +1186,111 @@ declare const _default: (path: string) => {
1116
1186
  }, options?: {
1117
1187
  path?: string;
1118
1188
  format?: "md" | "mdx";
1189
+ override? /**
1190
+ * Remove an command to EventCatalog (modeled on the standard POSIX rm utility)
1191
+ *
1192
+ * @param path - The path to your command, e.g. `/Inventory/InventoryAdjusted`
1193
+ *
1194
+ */: boolean;
1195
+ }) => Promise<void>;
1196
+ /**
1197
+ * ================================
1198
+ * Data Products
1199
+ * ================================
1200
+ */
1201
+ /**
1202
+ * Adds a data product to EventCatalog
1203
+ * @param dataProduct - The data product to write
1204
+ * @param options - Optional options to write the data product
1205
+ *
1206
+ */
1207
+ writeDataProduct: (dataProduct: DataProduct, options?: {
1208
+ path?: string;
1119
1209
  override?: boolean;
1210
+ versionExistingContent?: boolean;
1211
+ format?: "md" | "mdx";
1120
1212
  }) => Promise<void>;
1213
+ /**
1214
+ * Writes a data product to a domain in EventCatalog
1215
+ * @param dataProduct - The data product to write
1216
+ * @param domain - The domain to write the data product to
1217
+ * @param options - Optional options to write the data product
1218
+ *
1219
+ */
1220
+ writeDataProductToDomain: (dataProduct: DataProduct, domain: {
1221
+ id: string;
1222
+ version?: string;
1223
+ }, options?: {
1224
+ path?: string;
1225
+ format?: "md" | "mdx";
1226
+ override? /**
1227
+ * Adds a schema to the given event
1228
+ * @param id - The id of the event to add the schema to
1229
+ * @param schema - Schema contents to add including the content and the file name
1230
+ * @param version - Optional version of the event to add the schema to
1231
+ * @returns
1232
+ */: boolean;
1233
+ }) => Promise<void>;
1234
+ /**
1235
+ * Returns a data product from EventCatalog
1236
+ * @param id - The id of the data product to retrieve
1237
+ * @param version - Optional id of the version to get (supports semver)
1238
+ * @returns DataProduct|Undefined
1239
+ */
1240
+ getDataProduct: (id: string, version?: string) => Promise<DataProduct>;
1241
+ /**
1242
+ * Returns all data products from EventCatalog
1243
+ * @param latestOnly - optional boolean, set to true to get only latest versions
1244
+ * @returns DataProduct[]|Undefined
1245
+ */
1246
+ getDataProducts: (options?: {
1247
+ latestOnly?: boolean;
1248
+ }) => Promise<DataProduct[]>;
1249
+ /**
1250
+ * Version a data product by its id
1251
+ * @param id - The id of the data product to version
1252
+ */
1253
+ versionDataProduct: (id: string) => Promise<void>;
1254
+ /**
1255
+ * Remove a data product by its path
1256
+ * @param path - The path to the data product to remove
1257
+ */
1258
+ rmDataProduct: (path: string) => Promise<void>;
1259
+ /**
1260
+ * Remove a data product by its id
1261
+ * @param id - The id of the data product to remove
1262
+ * @param version - Optional version of the data product to remove
1263
+ */
1264
+ rmDataProductById: (id: string, version?: string, persistFiles?: boolean) => Promise<void>;
1265
+ /**
1266
+ * Check to see if a data product version exists
1267
+ * @param id - The id of the data product
1268
+ * @param version - The version of the data product (supports semver)
1269
+ * @returns
1270
+ */
1271
+ dataProductHasVersion: (id: string, version?: string) => Promise<boolean>;
1272
+ /**
1273
+ * Adds a file to a data product by its id
1274
+ * @param id - The id of the data product to add the file to
1275
+ * @param file - File contents to add including the content and the file name
1276
+ * @param version - Optional version of the data product to add the file to
1277
+ * @returns
1278
+ */
1279
+ addFileToDataProduct: (id: string, file: {
1280
+ content: string;
1281
+ fileName: string;
1282
+ }, version?: string) => Promise<void>;
1283
+ /**
1284
+ * Adds a data product to a domain
1285
+ * @param id - The id of the domain
1286
+ * @param dataProduct - The id and version of the data product to add
1287
+ * @param version - (Optional) The version of the domain to add the data product to
1288
+ * @returns
1289
+ */
1290
+ addDataProductToDomain: (id: string, dataProduct: {
1291
+ id: string;
1292
+ version: string;
1293
+ }, version?: string) => Promise<void>;
1121
1294
  };
1122
1295
 
1123
- export { Channel, Command, Container, CustomDoc, Domain, Entity, Event, EventCatalog, Message, Query, Service, Team, UbiquitousLanguageDictionary, User, _default as default };
1296
+ export { Channel, Command, Container, CustomDoc, DataProduct, Domain, Entity, Event, EventCatalog, Message, Query, Service, Team, UbiquitousLanguageDictionary, User, _default as default };