@eventcatalog/sdk 1.1.4 → 1.2.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 +8 -0
- package/dist/channels.d.mts +167 -0
- package/dist/channels.d.ts +167 -0
- package/dist/channels.js +259 -0
- package/dist/channels.js.map +1 -0
- package/dist/channels.mjs +212 -0
- package/dist/channels.mjs.map +1 -0
- package/dist/index.d.mts +187 -47
- package/dist/index.d.ts +187 -47
- package/dist/index.js +248 -86
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +248 -86
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.d.mts +27 -4
- package/dist/types.d.d.ts +27 -4
- 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, Service, Domain } from './types.d.mjs';
|
|
1
|
+
import { Event, Command, Query, Channel, Service, Domain } from './types.d.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Init the SDK for EventCatalog
|
|
@@ -254,6 +254,123 @@ declare const _default: (path: string) => {
|
|
|
254
254
|
* @returns
|
|
255
255
|
*/
|
|
256
256
|
queryHasVersion: (id: string, version: string) => Promise<boolean>;
|
|
257
|
+
/**
|
|
258
|
+
* ================================
|
|
259
|
+
* Channels
|
|
260
|
+
* ================================
|
|
261
|
+
*/
|
|
262
|
+
/**
|
|
263
|
+
* Returns a channel from EventCatalog
|
|
264
|
+
* @param id - The id of the channel to retrieve
|
|
265
|
+
* @param version - Optional id of the version to get (supports semver)
|
|
266
|
+
* @returns Channel|Undefined
|
|
267
|
+
*/
|
|
268
|
+
getChannel: (id: string, version?: string) => Promise<Channel>;
|
|
269
|
+
/**
|
|
270
|
+
* Adds an channel to EventCatalog
|
|
271
|
+
*
|
|
272
|
+
* @param command - The channel to write
|
|
273
|
+
* @param options - Optional options to write the channel
|
|
274
|
+
*
|
|
275
|
+
*/
|
|
276
|
+
writeChannel: (channel: Channel, options?: {
|
|
277
|
+
path: string;
|
|
278
|
+
}) => Promise<void>;
|
|
279
|
+
/**
|
|
280
|
+
* Remove an channel to EventCatalog (modeled on the standard POSIX rm utility)
|
|
281
|
+
*
|
|
282
|
+
* @param path - The path to your channel, e.g. `/Inventory/InventoryAdjusted`
|
|
283
|
+
*
|
|
284
|
+
*/
|
|
285
|
+
rmChannel: (path: string) => Promise<void>;
|
|
286
|
+
/**
|
|
287
|
+
* Remove an channel by an Event id
|
|
288
|
+
*
|
|
289
|
+
* @param id - The id of the channel you want to remove
|
|
290
|
+
*
|
|
291
|
+
*/
|
|
292
|
+
rmChannelById: (id: string, version?: string) => Promise<void>;
|
|
293
|
+
/**
|
|
294
|
+
* Moves a given channel id to the version directory
|
|
295
|
+
* @param directory
|
|
296
|
+
*/
|
|
297
|
+
versionChannel: (id: string) => Promise<void>;
|
|
298
|
+
/**
|
|
299
|
+
* Check to see if a channel version exists
|
|
300
|
+
* @param id - The id of the channel
|
|
301
|
+
* @param version - The version of the channel (supports semver)
|
|
302
|
+
* @returns
|
|
303
|
+
*/
|
|
304
|
+
channelHasVersion: (id: string, version: string) => Promise<boolean>;
|
|
305
|
+
/**
|
|
306
|
+
* Add a channel to an event
|
|
307
|
+
*
|
|
308
|
+
* Optionally specify a version to add the channel to a specific version of the event.
|
|
309
|
+
*
|
|
310
|
+
* @example
|
|
311
|
+
* ```ts
|
|
312
|
+
* import utils from '@eventcatalog/utils';
|
|
313
|
+
*
|
|
314
|
+
* const { addEventToChannel } = utils('/path/to/eventcatalog');
|
|
315
|
+
*
|
|
316
|
+
* // adds a new event (InventoryUpdatedEvent) to the inventory.{env}.events channel
|
|
317
|
+
* await addEventToChannel('inventory.{env}.events channel', { id: 'InventoryUpdatedEvent', version: '2.0.0', parameters: { env: 'dev' } });
|
|
318
|
+
*
|
|
319
|
+
* ```
|
|
320
|
+
*/
|
|
321
|
+
addEventToChannel: (id: string, _message: {
|
|
322
|
+
id: string;
|
|
323
|
+
version: string;
|
|
324
|
+
parameters?: {
|
|
325
|
+
[key: string]: string;
|
|
326
|
+
};
|
|
327
|
+
}, version?: string) => Promise<void>;
|
|
328
|
+
/**
|
|
329
|
+
* Add a channel to an command
|
|
330
|
+
*
|
|
331
|
+
* Optionally specify a version to add the channel to a specific version of the command.
|
|
332
|
+
*
|
|
333
|
+
* @example
|
|
334
|
+
* ```ts
|
|
335
|
+
* import utils from '@eventcatalog/utils';
|
|
336
|
+
*
|
|
337
|
+
* const { addCommandToChannel } = utils('/path/to/eventcatalog');
|
|
338
|
+
*
|
|
339
|
+
* // adds a new command (UpdateInventory) to the inventory.{env}.events channel
|
|
340
|
+
* await addCommandToChannel('inventory.{env}.events channel', { id: 'UpdateInventory', version: '2.0.0', parameters: { env: 'dev' } });
|
|
341
|
+
*
|
|
342
|
+
* ```
|
|
343
|
+
*/
|
|
344
|
+
addCommandToChannel: (id: string, _message: {
|
|
345
|
+
id: string;
|
|
346
|
+
version: string;
|
|
347
|
+
parameters?: {
|
|
348
|
+
[key: string]: string;
|
|
349
|
+
};
|
|
350
|
+
}, version?: string) => Promise<void>;
|
|
351
|
+
/**
|
|
352
|
+
* Add a channel to an query
|
|
353
|
+
*
|
|
354
|
+
* Optionally specify a version to add the channel to a specific version of the query.
|
|
355
|
+
*
|
|
356
|
+
* @example
|
|
357
|
+
* ```ts
|
|
358
|
+
* import utils from '@eventcatalog/utils';
|
|
359
|
+
*
|
|
360
|
+
* const { addQueryToChannel } = utils('/path/to/eventcatalog');
|
|
361
|
+
*
|
|
362
|
+
* // adds a new query (GetInventory) to the inventory.{env}.events channel
|
|
363
|
+
* await addQueryToChannel('inventory.{env}.events channel', { id: 'GetInventory', version: '2.0.0', parameters: { env: 'dev' } });
|
|
364
|
+
*
|
|
365
|
+
* ```
|
|
366
|
+
*/
|
|
367
|
+
addQueryToChannel: (id: string, _message: {
|
|
368
|
+
id: string;
|
|
369
|
+
version: string;
|
|
370
|
+
parameters?: {
|
|
371
|
+
[key: string]: string;
|
|
372
|
+
};
|
|
373
|
+
}, version?: string) => Promise<void>;
|
|
257
374
|
/**
|
|
258
375
|
* ================================
|
|
259
376
|
* SERVICES
|
|
@@ -342,6 +459,75 @@ declare const _default: (path: string) => {
|
|
|
342
459
|
* @returns
|
|
343
460
|
*/
|
|
344
461
|
serviceHasVersion: (id: string, version: string) => Promise<boolean>;
|
|
462
|
+
/**
|
|
463
|
+
* Add an event to a service by it's id.
|
|
464
|
+
*
|
|
465
|
+
* Optionally specify a version to add the event to a specific version of the service.
|
|
466
|
+
*
|
|
467
|
+
* @example
|
|
468
|
+
* ```ts
|
|
469
|
+
* import utils from '@eventcatalog/utils';
|
|
470
|
+
*
|
|
471
|
+
* const { addEventToService } = utils('/path/to/eventcatalog');
|
|
472
|
+
*
|
|
473
|
+
* // adds a new event (InventoryUpdatedEvent) that the InventoryService will send
|
|
474
|
+
* await addEventToService('InventoryService', 'sends', { event: 'InventoryUpdatedEvent', version: '2.0.0' });
|
|
475
|
+
*
|
|
476
|
+
* // adds a new event (OrderComplete) that the InventoryService will receive
|
|
477
|
+
* await addEventToService('InventoryService', 'receives', { event: 'OrderComplete', version: '2.0.0' });
|
|
478
|
+
*
|
|
479
|
+
* ```
|
|
480
|
+
*/
|
|
481
|
+
addEventToService: (id: string, direction: string, event: {
|
|
482
|
+
id: string;
|
|
483
|
+
version: string;
|
|
484
|
+
}, version?: string) => Promise<void>;
|
|
485
|
+
/**
|
|
486
|
+
* Add a command to a service by it's id.
|
|
487
|
+
*
|
|
488
|
+
* Optionally specify a version to add the event to a specific version of the service.
|
|
489
|
+
*
|
|
490
|
+
* @example
|
|
491
|
+
* ```ts
|
|
492
|
+
* import utils from '@eventcatalog/utils';
|
|
493
|
+
*
|
|
494
|
+
* const { addCommandToService } = utils('/path/to/eventcatalog');
|
|
495
|
+
*
|
|
496
|
+
* // adds a new command (UpdateInventoryCommand) that the InventoryService will send
|
|
497
|
+
* await addCommandToService('InventoryService', 'sends', { command: 'UpdateInventoryCommand', version: '2.0.0' });
|
|
498
|
+
*
|
|
499
|
+
* // adds a new command (VerifyInventory) that the InventoryService will receive
|
|
500
|
+
* await addCommandToService('InventoryService', 'receives', { command: 'VerifyInventory', version: '2.0.0' });
|
|
501
|
+
*
|
|
502
|
+
* ```
|
|
503
|
+
*/
|
|
504
|
+
addCommandToService: (id: string, direction: string, event: {
|
|
505
|
+
id: string;
|
|
506
|
+
version: string;
|
|
507
|
+
}, version?: string) => Promise<void>;
|
|
508
|
+
/**
|
|
509
|
+
* Add a query to a service by it's id.
|
|
510
|
+
*
|
|
511
|
+
* Optionally specify a version to add the event to a specific version of the service.
|
|
512
|
+
*
|
|
513
|
+
* @example
|
|
514
|
+
* ```ts
|
|
515
|
+
* import utils from '@eventcatalog/utils';
|
|
516
|
+
*
|
|
517
|
+
* const { addQueryToService } = utils('/path/to/eventcatalog');
|
|
518
|
+
*
|
|
519
|
+
* // adds a new query (UpdateInventory) that the InventoryService will send
|
|
520
|
+
* await addQueryToService('InventoryService', 'sends', { command: 'UpdateInventory', version: '2.0.0' });
|
|
521
|
+
*
|
|
522
|
+
* // adds a new command (VerifyInventory) that the InventoryService will receive
|
|
523
|
+
* await addQueryToService('InventoryService', 'receives', { command: 'VerifyInventory', version: '2.0.0' });
|
|
524
|
+
*
|
|
525
|
+
* ```
|
|
526
|
+
*/
|
|
527
|
+
addQueryToService: (id: string, direction: string, event: {
|
|
528
|
+
id: string;
|
|
529
|
+
version: string;
|
|
530
|
+
}, version?: string) => Promise<void>;
|
|
345
531
|
/**
|
|
346
532
|
* ================================
|
|
347
533
|
* Domains
|
|
@@ -394,52 +580,6 @@ declare const _default: (path: string) => {
|
|
|
394
580
|
content: string;
|
|
395
581
|
fileName: string;
|
|
396
582
|
}, version?: string) => Promise<void>;
|
|
397
|
-
/**
|
|
398
|
-
* Add an event to a service by it's id.
|
|
399
|
-
*
|
|
400
|
-
* Optionally specify a version to add the event to a specific version of the service.
|
|
401
|
-
*
|
|
402
|
-
* @example
|
|
403
|
-
* ```ts
|
|
404
|
-
* import utils from '@eventcatalog/utils';
|
|
405
|
-
*
|
|
406
|
-
* const { addEventToService } = utils('/path/to/eventcatalog');
|
|
407
|
-
*
|
|
408
|
-
* // adds a new event (InventoryUpdatedEvent) that the InventoryService will send
|
|
409
|
-
* await addEventToService('InventoryService', 'sends', { event: 'InventoryUpdatedEvent', version: '2.0.0' });
|
|
410
|
-
*
|
|
411
|
-
* // adds a new event (OrderComplete) that the InventoryService will receive
|
|
412
|
-
* await addEventToService('InventoryService', 'receives', { event: 'OrderComplete', version: '2.0.0' });
|
|
413
|
-
*
|
|
414
|
-
* ```
|
|
415
|
-
*/
|
|
416
|
-
addEventToService: (id: string, direction: string, event: {
|
|
417
|
-
id: string;
|
|
418
|
-
version: string;
|
|
419
|
-
}, version?: string) => Promise<void>;
|
|
420
|
-
/**
|
|
421
|
-
* Add a command to a service by it's id.
|
|
422
|
-
*
|
|
423
|
-
* Optionally specify a version to add the event to a specific version of the service.
|
|
424
|
-
*
|
|
425
|
-
* @example
|
|
426
|
-
* ```ts
|
|
427
|
-
* import utils from '@eventcatalog/utils';
|
|
428
|
-
*
|
|
429
|
-
* const { addCommandToService } = utils('/path/to/eventcatalog');
|
|
430
|
-
*
|
|
431
|
-
* // adds a new command (UpdateInventoryCommand) that the InventoryService will send
|
|
432
|
-
* await addCommandToService('InventoryService', 'sends', { command: 'UpdateInventoryCommand', version: '2.0.0' });
|
|
433
|
-
*
|
|
434
|
-
* // adds a new command (VerifyInventory) that the InventoryService will receive
|
|
435
|
-
* await addCommandToService('InventoryService', 'receives', { command: 'VerifyInventory', version: '2.0.0' });
|
|
436
|
-
*
|
|
437
|
-
* ```
|
|
438
|
-
*/
|
|
439
|
-
addCommandToService: (id: string, direction: string, event: {
|
|
440
|
-
id: string;
|
|
441
|
-
version: string;
|
|
442
|
-
}, version?: string) => Promise<void>;
|
|
443
583
|
/**
|
|
444
584
|
* Check to see if a domain version exists
|
|
445
585
|
* @param id - The id of the domain
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Event, Command, Query, Service, Domain } from './types.d.js';
|
|
1
|
+
import { Event, Command, Query, Channel, Service, Domain } from './types.d.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Init the SDK for EventCatalog
|
|
@@ -254,6 +254,123 @@ declare const _default: (path: string) => {
|
|
|
254
254
|
* @returns
|
|
255
255
|
*/
|
|
256
256
|
queryHasVersion: (id: string, version: string) => Promise<boolean>;
|
|
257
|
+
/**
|
|
258
|
+
* ================================
|
|
259
|
+
* Channels
|
|
260
|
+
* ================================
|
|
261
|
+
*/
|
|
262
|
+
/**
|
|
263
|
+
* Returns a channel from EventCatalog
|
|
264
|
+
* @param id - The id of the channel to retrieve
|
|
265
|
+
* @param version - Optional id of the version to get (supports semver)
|
|
266
|
+
* @returns Channel|Undefined
|
|
267
|
+
*/
|
|
268
|
+
getChannel: (id: string, version?: string) => Promise<Channel>;
|
|
269
|
+
/**
|
|
270
|
+
* Adds an channel to EventCatalog
|
|
271
|
+
*
|
|
272
|
+
* @param command - The channel to write
|
|
273
|
+
* @param options - Optional options to write the channel
|
|
274
|
+
*
|
|
275
|
+
*/
|
|
276
|
+
writeChannel: (channel: Channel, options?: {
|
|
277
|
+
path: string;
|
|
278
|
+
}) => Promise<void>;
|
|
279
|
+
/**
|
|
280
|
+
* Remove an channel to EventCatalog (modeled on the standard POSIX rm utility)
|
|
281
|
+
*
|
|
282
|
+
* @param path - The path to your channel, e.g. `/Inventory/InventoryAdjusted`
|
|
283
|
+
*
|
|
284
|
+
*/
|
|
285
|
+
rmChannel: (path: string) => Promise<void>;
|
|
286
|
+
/**
|
|
287
|
+
* Remove an channel by an Event id
|
|
288
|
+
*
|
|
289
|
+
* @param id - The id of the channel you want to remove
|
|
290
|
+
*
|
|
291
|
+
*/
|
|
292
|
+
rmChannelById: (id: string, version?: string) => Promise<void>;
|
|
293
|
+
/**
|
|
294
|
+
* Moves a given channel id to the version directory
|
|
295
|
+
* @param directory
|
|
296
|
+
*/
|
|
297
|
+
versionChannel: (id: string) => Promise<void>;
|
|
298
|
+
/**
|
|
299
|
+
* Check to see if a channel version exists
|
|
300
|
+
* @param id - The id of the channel
|
|
301
|
+
* @param version - The version of the channel (supports semver)
|
|
302
|
+
* @returns
|
|
303
|
+
*/
|
|
304
|
+
channelHasVersion: (id: string, version: string) => Promise<boolean>;
|
|
305
|
+
/**
|
|
306
|
+
* Add a channel to an event
|
|
307
|
+
*
|
|
308
|
+
* Optionally specify a version to add the channel to a specific version of the event.
|
|
309
|
+
*
|
|
310
|
+
* @example
|
|
311
|
+
* ```ts
|
|
312
|
+
* import utils from '@eventcatalog/utils';
|
|
313
|
+
*
|
|
314
|
+
* const { addEventToChannel } = utils('/path/to/eventcatalog');
|
|
315
|
+
*
|
|
316
|
+
* // adds a new event (InventoryUpdatedEvent) to the inventory.{env}.events channel
|
|
317
|
+
* await addEventToChannel('inventory.{env}.events channel', { id: 'InventoryUpdatedEvent', version: '2.0.0', parameters: { env: 'dev' } });
|
|
318
|
+
*
|
|
319
|
+
* ```
|
|
320
|
+
*/
|
|
321
|
+
addEventToChannel: (id: string, _message: {
|
|
322
|
+
id: string;
|
|
323
|
+
version: string;
|
|
324
|
+
parameters?: {
|
|
325
|
+
[key: string]: string;
|
|
326
|
+
};
|
|
327
|
+
}, version?: string) => Promise<void>;
|
|
328
|
+
/**
|
|
329
|
+
* Add a channel to an command
|
|
330
|
+
*
|
|
331
|
+
* Optionally specify a version to add the channel to a specific version of the command.
|
|
332
|
+
*
|
|
333
|
+
* @example
|
|
334
|
+
* ```ts
|
|
335
|
+
* import utils from '@eventcatalog/utils';
|
|
336
|
+
*
|
|
337
|
+
* const { addCommandToChannel } = utils('/path/to/eventcatalog');
|
|
338
|
+
*
|
|
339
|
+
* // adds a new command (UpdateInventory) to the inventory.{env}.events channel
|
|
340
|
+
* await addCommandToChannel('inventory.{env}.events channel', { id: 'UpdateInventory', version: '2.0.0', parameters: { env: 'dev' } });
|
|
341
|
+
*
|
|
342
|
+
* ```
|
|
343
|
+
*/
|
|
344
|
+
addCommandToChannel: (id: string, _message: {
|
|
345
|
+
id: string;
|
|
346
|
+
version: string;
|
|
347
|
+
parameters?: {
|
|
348
|
+
[key: string]: string;
|
|
349
|
+
};
|
|
350
|
+
}, version?: string) => Promise<void>;
|
|
351
|
+
/**
|
|
352
|
+
* Add a channel to an query
|
|
353
|
+
*
|
|
354
|
+
* Optionally specify a version to add the channel to a specific version of the query.
|
|
355
|
+
*
|
|
356
|
+
* @example
|
|
357
|
+
* ```ts
|
|
358
|
+
* import utils from '@eventcatalog/utils';
|
|
359
|
+
*
|
|
360
|
+
* const { addQueryToChannel } = utils('/path/to/eventcatalog');
|
|
361
|
+
*
|
|
362
|
+
* // adds a new query (GetInventory) to the inventory.{env}.events channel
|
|
363
|
+
* await addQueryToChannel('inventory.{env}.events channel', { id: 'GetInventory', version: '2.0.0', parameters: { env: 'dev' } });
|
|
364
|
+
*
|
|
365
|
+
* ```
|
|
366
|
+
*/
|
|
367
|
+
addQueryToChannel: (id: string, _message: {
|
|
368
|
+
id: string;
|
|
369
|
+
version: string;
|
|
370
|
+
parameters?: {
|
|
371
|
+
[key: string]: string;
|
|
372
|
+
};
|
|
373
|
+
}, version?: string) => Promise<void>;
|
|
257
374
|
/**
|
|
258
375
|
* ================================
|
|
259
376
|
* SERVICES
|
|
@@ -342,6 +459,75 @@ declare const _default: (path: string) => {
|
|
|
342
459
|
* @returns
|
|
343
460
|
*/
|
|
344
461
|
serviceHasVersion: (id: string, version: string) => Promise<boolean>;
|
|
462
|
+
/**
|
|
463
|
+
* Add an event to a service by it's id.
|
|
464
|
+
*
|
|
465
|
+
* Optionally specify a version to add the event to a specific version of the service.
|
|
466
|
+
*
|
|
467
|
+
* @example
|
|
468
|
+
* ```ts
|
|
469
|
+
* import utils from '@eventcatalog/utils';
|
|
470
|
+
*
|
|
471
|
+
* const { addEventToService } = utils('/path/to/eventcatalog');
|
|
472
|
+
*
|
|
473
|
+
* // adds a new event (InventoryUpdatedEvent) that the InventoryService will send
|
|
474
|
+
* await addEventToService('InventoryService', 'sends', { event: 'InventoryUpdatedEvent', version: '2.0.0' });
|
|
475
|
+
*
|
|
476
|
+
* // adds a new event (OrderComplete) that the InventoryService will receive
|
|
477
|
+
* await addEventToService('InventoryService', 'receives', { event: 'OrderComplete', version: '2.0.0' });
|
|
478
|
+
*
|
|
479
|
+
* ```
|
|
480
|
+
*/
|
|
481
|
+
addEventToService: (id: string, direction: string, event: {
|
|
482
|
+
id: string;
|
|
483
|
+
version: string;
|
|
484
|
+
}, version?: string) => Promise<void>;
|
|
485
|
+
/**
|
|
486
|
+
* Add a command to a service by it's id.
|
|
487
|
+
*
|
|
488
|
+
* Optionally specify a version to add the event to a specific version of the service.
|
|
489
|
+
*
|
|
490
|
+
* @example
|
|
491
|
+
* ```ts
|
|
492
|
+
* import utils from '@eventcatalog/utils';
|
|
493
|
+
*
|
|
494
|
+
* const { addCommandToService } = utils('/path/to/eventcatalog');
|
|
495
|
+
*
|
|
496
|
+
* // adds a new command (UpdateInventoryCommand) that the InventoryService will send
|
|
497
|
+
* await addCommandToService('InventoryService', 'sends', { command: 'UpdateInventoryCommand', version: '2.0.0' });
|
|
498
|
+
*
|
|
499
|
+
* // adds a new command (VerifyInventory) that the InventoryService will receive
|
|
500
|
+
* await addCommandToService('InventoryService', 'receives', { command: 'VerifyInventory', version: '2.0.0' });
|
|
501
|
+
*
|
|
502
|
+
* ```
|
|
503
|
+
*/
|
|
504
|
+
addCommandToService: (id: string, direction: string, event: {
|
|
505
|
+
id: string;
|
|
506
|
+
version: string;
|
|
507
|
+
}, version?: string) => Promise<void>;
|
|
508
|
+
/**
|
|
509
|
+
* Add a query to a service by it's id.
|
|
510
|
+
*
|
|
511
|
+
* Optionally specify a version to add the event to a specific version of the service.
|
|
512
|
+
*
|
|
513
|
+
* @example
|
|
514
|
+
* ```ts
|
|
515
|
+
* import utils from '@eventcatalog/utils';
|
|
516
|
+
*
|
|
517
|
+
* const { addQueryToService } = utils('/path/to/eventcatalog');
|
|
518
|
+
*
|
|
519
|
+
* // adds a new query (UpdateInventory) that the InventoryService will send
|
|
520
|
+
* await addQueryToService('InventoryService', 'sends', { command: 'UpdateInventory', version: '2.0.0' });
|
|
521
|
+
*
|
|
522
|
+
* // adds a new command (VerifyInventory) that the InventoryService will receive
|
|
523
|
+
* await addQueryToService('InventoryService', 'receives', { command: 'VerifyInventory', version: '2.0.0' });
|
|
524
|
+
*
|
|
525
|
+
* ```
|
|
526
|
+
*/
|
|
527
|
+
addQueryToService: (id: string, direction: string, event: {
|
|
528
|
+
id: string;
|
|
529
|
+
version: string;
|
|
530
|
+
}, version?: string) => Promise<void>;
|
|
345
531
|
/**
|
|
346
532
|
* ================================
|
|
347
533
|
* Domains
|
|
@@ -394,52 +580,6 @@ declare const _default: (path: string) => {
|
|
|
394
580
|
content: string;
|
|
395
581
|
fileName: string;
|
|
396
582
|
}, version?: string) => Promise<void>;
|
|
397
|
-
/**
|
|
398
|
-
* Add an event to a service by it's id.
|
|
399
|
-
*
|
|
400
|
-
* Optionally specify a version to add the event to a specific version of the service.
|
|
401
|
-
*
|
|
402
|
-
* @example
|
|
403
|
-
* ```ts
|
|
404
|
-
* import utils from '@eventcatalog/utils';
|
|
405
|
-
*
|
|
406
|
-
* const { addEventToService } = utils('/path/to/eventcatalog');
|
|
407
|
-
*
|
|
408
|
-
* // adds a new event (InventoryUpdatedEvent) that the InventoryService will send
|
|
409
|
-
* await addEventToService('InventoryService', 'sends', { event: 'InventoryUpdatedEvent', version: '2.0.0' });
|
|
410
|
-
*
|
|
411
|
-
* // adds a new event (OrderComplete) that the InventoryService will receive
|
|
412
|
-
* await addEventToService('InventoryService', 'receives', { event: 'OrderComplete', version: '2.0.0' });
|
|
413
|
-
*
|
|
414
|
-
* ```
|
|
415
|
-
*/
|
|
416
|
-
addEventToService: (id: string, direction: string, event: {
|
|
417
|
-
id: string;
|
|
418
|
-
version: string;
|
|
419
|
-
}, version?: string) => Promise<void>;
|
|
420
|
-
/**
|
|
421
|
-
* Add a command to a service by it's id.
|
|
422
|
-
*
|
|
423
|
-
* Optionally specify a version to add the event to a specific version of the service.
|
|
424
|
-
*
|
|
425
|
-
* @example
|
|
426
|
-
* ```ts
|
|
427
|
-
* import utils from '@eventcatalog/utils';
|
|
428
|
-
*
|
|
429
|
-
* const { addCommandToService } = utils('/path/to/eventcatalog');
|
|
430
|
-
*
|
|
431
|
-
* // adds a new command (UpdateInventoryCommand) that the InventoryService will send
|
|
432
|
-
* await addCommandToService('InventoryService', 'sends', { command: 'UpdateInventoryCommand', version: '2.0.0' });
|
|
433
|
-
*
|
|
434
|
-
* // adds a new command (VerifyInventory) that the InventoryService will receive
|
|
435
|
-
* await addCommandToService('InventoryService', 'receives', { command: 'VerifyInventory', version: '2.0.0' });
|
|
436
|
-
*
|
|
437
|
-
* ```
|
|
438
|
-
*/
|
|
439
|
-
addCommandToService: (id: string, direction: string, event: {
|
|
440
|
-
id: string;
|
|
441
|
-
version: string;
|
|
442
|
-
}, version?: string) => Promise<void>;
|
|
443
583
|
/**
|
|
444
584
|
* Check to see if a domain version exists
|
|
445
585
|
* @param id - The id of the domain
|