@eventcatalog/sdk 2.12.0 → 2.13.0-beta.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 DELETED
@@ -1,1623 +0,0 @@
1
- // Base type for all resources (domains, services and messages)
2
- interface BaseSchema {
3
- id: string;
4
- name: string;
5
- summary?: string;
6
- version: string;
7
- badges?: Badge[];
8
- sidebar?: {
9
- badge?: string;
10
- };
11
- owners?: string[];
12
- schemaPath?: string;
13
- markdown: string;
14
- repository?: {
15
- language?: string;
16
- url?: string;
17
- };
18
- deprecated?:
19
- | boolean
20
- | {
21
- date?: string;
22
- message?: string;
23
- };
24
- styles?: {
25
- icon?: string;
26
- node?: {
27
- color?: string;
28
- label?: string;
29
- };
30
- };
31
- attachments?:
32
- | string[]
33
- | {
34
- url: string;
35
- title?: string;
36
- type?: string;
37
- description?: string;
38
- icon?: string;
39
- }[];
40
- resourceGroups?: ResourceGroup[];
41
- diagrams?: ResourcePointer[];
42
- editUrl?: string;
43
- draft?: boolean | { title?: string; message?: string };
44
- // SDK types
45
- schema?: any;
46
- }
47
-
48
- type ResourcePointer = {
49
- id: string;
50
- version?: string;
51
- type?: string;
52
- };
53
-
54
- type SendsPointer = {
55
- id: string;
56
- version?: string;
57
- to?: ChannelPointer[];
58
- };
59
-
60
- type ReceivesPointer = {
61
- id: string;
62
- version?: string;
63
- from?: ChannelPointer[];
64
- };
65
-
66
- interface ResourceGroup {
67
- id?: string;
68
- title?: string;
69
- items: ResourcePointer[];
70
- limit?: number;
71
- sidebar?: boolean;
72
- }
73
-
74
- interface ChannelPointer extends ResourcePointer {
75
- parameters?: Record<string, string>;
76
- }
77
-
78
- type Message = Event | Command | Query;
79
-
80
- interface CustomDoc {
81
- title: string;
82
- summary: string;
83
- slug?: string;
84
- sidebar?: {
85
- label: string;
86
- order: number;
87
- };
88
- owners?: string[];
89
- badges?: Badge[];
90
- fileName?: string;
91
- markdown: string;
92
- }
93
-
94
- interface MessageDetailsPanelProperty {
95
- producers?: DetailPanelProperty;
96
- consumers?: DetailPanelProperty;
97
- channels?: DetailPanelProperty;
98
- versions?: DetailPanelProperty;
99
- repository?: DetailPanelProperty;
100
- }
101
-
102
- interface Event extends BaseSchema {
103
- channels?: ChannelPointer[];
104
- detailsPanel?: MessageDetailsPanelProperty;
105
- }
106
- interface Command extends BaseSchema {
107
- channels?: ChannelPointer[];
108
- detailsPanel?: MessageDetailsPanelProperty;
109
- }
110
- interface Query extends BaseSchema {
111
- channels?: ChannelPointer[];
112
- detailsPanel?: MessageDetailsPanelProperty;
113
- }
114
- interface Channel extends BaseSchema {
115
- address?: string;
116
- protocols?: string[];
117
- routes?: ChannelPointer[];
118
- detailsPanel?: {
119
- producers?: DetailPanelProperty;
120
- consumers?: DetailPanelProperty;
121
- messages?: DetailPanelProperty;
122
- protocols?: DetailPanelProperty;
123
- versions?: DetailPanelProperty;
124
- repository?: DetailPanelProperty;
125
- owners?: DetailPanelProperty;
126
- changelog?: DetailPanelProperty;
127
- };
128
- // parameters?: Record<string, Parameter>;
129
- parameters?: {
130
- [key: string]: {
131
- enum?: string[];
132
- default?: string;
133
- examples?: string[];
134
- description?: string;
135
- };
136
- };
137
- }
138
-
139
- interface Specifications {
140
- asyncapiPath?: string;
141
- openapiPath?: string;
142
- graphqlPath?: string;
143
- }
144
-
145
- interface Specification {
146
- type: 'openapi' | 'asyncapi' | 'graphql';
147
- path: string;
148
- name?: string;
149
- }
150
-
151
- interface Service extends BaseSchema {
152
- sends?: SendsPointer[];
153
- receives?: ReceivesPointer[];
154
- entities?: ResourcePointer[];
155
- writesTo?: ResourcePointer[];
156
- readsFrom?: ResourcePointer[];
157
- specifications?: Specifications | Specification[];
158
- detailsPanel?: {
159
- domains?: DetailPanelProperty;
160
- messages?: DetailPanelProperty;
161
- versions?: DetailPanelProperty;
162
- specifications?: DetailPanelProperty;
163
- entities?: DetailPanelProperty;
164
- repository?: DetailPanelProperty;
165
- owners?: DetailPanelProperty;
166
- changelog?: DetailPanelProperty;
167
- };
168
- }
169
-
170
- interface Domain extends BaseSchema {
171
- services?: ResourcePointer[];
172
- domains?: ResourcePointer[];
173
- entities?: ResourcePointer[];
174
- dataProducts?: ResourcePointer[];
175
- sends?: SendsPointer[];
176
- receives?: ReceivesPointer[];
177
- detailsPanel?: {
178
- parentDomains?: DetailPanelProperty;
179
- subdomains?: DetailPanelProperty;
180
- services?: DetailPanelProperty;
181
- entities?: DetailPanelProperty;
182
- messages?: DetailPanelProperty;
183
- ubiquitousLanguage?: DetailPanelProperty;
184
- repository?: DetailPanelProperty;
185
- versions?: DetailPanelProperty;
186
- owners?: DetailPanelProperty;
187
- changelog?: DetailPanelProperty;
188
- };
189
- }
190
-
191
- interface Team {
192
- id: string;
193
- name: string;
194
- summary?: string;
195
- email?: string;
196
- hidden?: boolean;
197
- slackDirectMessageUrl?: string;
198
- members?: User[];
199
- ownedCommands?: Command[];
200
- ownedServices?: Service[];
201
- ownedEvents?: Event[];
202
- markdown: string;
203
- }
204
-
205
- interface User {
206
- id: string;
207
- name: string;
208
- avatarUrl: string;
209
- role?: string;
210
- hidden?: boolean;
211
- email?: string;
212
- slackDirectMessageUrl?: string;
213
- ownedServices?: Service[];
214
- ownedEvents?: Event[];
215
- ownedCommands?: Command[];
216
- associatedTeams?: Team[];
217
- markdown: string;
218
- }
219
-
220
- interface Badge {
221
- content: string;
222
- backgroundColor: string;
223
- textColor: string;
224
- icon?: string;
225
- }
226
-
227
- interface UbiquitousLanguage {
228
- id: string;
229
- name: string;
230
- summary?: string;
231
- description?: string;
232
- icon?: string;
233
- }
234
-
235
- interface UbiquitousLanguageDictionary {
236
- dictionary: UbiquitousLanguage[];
237
- }
238
-
239
- interface DetailPanelProperty {
240
- visible: boolean;
241
- }
242
-
243
- interface Entity extends BaseSchema {
244
- aggregateRoot?: boolean;
245
- identifier?: string;
246
- properties?: {
247
- name: string;
248
- type: string;
249
- required?: boolean;
250
- description?: string;
251
- references?: string;
252
- referencesIdentifier?: string;
253
- relationType?: string;
254
- }[];
255
- detailsPanel?: {
256
- domains?: DetailPanelProperty;
257
- services?: DetailPanelProperty;
258
- messages?: DetailPanelProperty;
259
- versions?: DetailPanelProperty;
260
- owners?: DetailPanelProperty;
261
- changelog?: DetailPanelProperty;
262
- };
263
- }
264
-
265
- type DataProductOutputPointer = {
266
- id: string;
267
- version?: string;
268
- contract?: {
269
- path: string;
270
- name: string;
271
- type?: string;
272
- };
273
- };
274
-
275
- interface DataProduct extends BaseSchema {
276
- inputs?: ResourcePointer[];
277
- outputs?: DataProductOutputPointer[];
278
- detailsPanel?: {
279
- domains?: DetailPanelProperty;
280
- inputs?: DetailPanelProperty;
281
- outputs?: DetailPanelProperty;
282
- versions?: DetailPanelProperty;
283
- repository?: DetailPanelProperty;
284
- owners?: DetailPanelProperty;
285
- changelog?: DetailPanelProperty;
286
- };
287
- }
288
-
289
- declare enum DataClassification {
290
- Public = 'public',
291
- Internal = 'internal',
292
- Confidential = 'confidential',
293
- Regulated = 'regulated',
294
- }
295
-
296
- interface Container extends BaseSchema {
297
- container_type: 'database' | 'cache' | 'objectStore' | 'searchIndex' | 'dataWarehouse' | 'dataLake' | 'externalSaaS' | 'other';
298
- technology?: string;
299
- authoritative?: boolean;
300
- access_mode?: string;
301
- classification?: DataClassification;
302
- residency?: string;
303
- retention?: string;
304
- detailsPanel?: {
305
- versions?: DetailPanelProperty;
306
- repository?: DetailPanelProperty;
307
- owners?: DetailPanelProperty;
308
- changelog?: DetailPanelProperty;
309
- };
310
- }
311
-
312
- type EventCatalog = {
313
- version: string;
314
- catalogVersion: string;
315
- createdAt: string;
316
- resources: {
317
- domains?: ExportedResource<Domain>[];
318
- services?: ExportedResource<Service>[];
319
- messages?: {
320
- events?: ExportedResource<Event>[];
321
- queries?: ExportedResource<Query>[];
322
- commands?: ExportedResource<Command>[];
323
- };
324
- teams?: ExportedResource<Team>[];
325
- users?: ExportedResource<User>[];
326
- channels?: ExportedResource<Channel>[];
327
- customDocs?: ExportedResource<CustomDoc>[];
328
- };
329
- };
330
-
331
- /**
332
- * Init the SDK for EventCatalog
333
- *
334
- * @param path - The path to the EventCatalog directory
335
- *
336
- */
337
- declare const _default: (path: string) => {
338
- /**
339
- * Returns an events from EventCatalog
340
- * @param id - The id of the event to retrieve
341
- * @param version - Optional id of the version to get (supports semver)
342
- * @returns Event|Undefined
343
- */
344
- getEvent: (id: string, version?: string, options?: {
345
- attachSchema?: boolean;
346
- }) => Promise<Event>;
347
- /**
348
- * Returns all events from EventCatalog
349
- * @param latestOnly - optional boolean, set to true to get only latest versions
350
- * @returns Event[]|Undefined
351
- */
352
- getEvents: (options?: {
353
- latestOnly?: boolean;
354
- attachSchema?: boolean;
355
- }) => Promise<Event[]>;
356
- /**
357
- * Adds an event to EventCatalog
358
- *
359
- * @param event - The event to write
360
- * @param options - Optional options to write the event
361
- *
362
- */
363
- writeEvent: (event: Event, options?: {
364
- path?: string;
365
- override?: boolean;
366
- versionExistingContent?: boolean;
367
- format?: "md" | "mdx";
368
- }) => Promise<void>;
369
- /**
370
- * Adds an event to a service in EventCatalog
371
- *
372
- * @param event - The event to write to the service
373
- * @param service - The service and it's id to write to the event to
374
- * @param options - Optional options to write the event
375
- *
376
- */
377
- writeEventToService: (event: Event, service: {
378
- id: string;
379
- version?: string;
380
- }, options?: {
381
- path?: string;
382
- format?: "md" | "mdx";
383
- override?: boolean;
384
- }) => Promise<void>;
385
- /**
386
- * Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
387
- *
388
- * @param path - The path to your event, e.g. `/Inventory/InventoryAdjusted`
389
- *
390
- */
391
- rmEvent: (path: string) => Promise<void>;
392
- /**
393
- * Remove an event by an Event id
394
- *
395
- * @param id - The id of the event you want to remove
396
- *
397
- */
398
- rmEventById: (id: string, version?: string, persistFiles?: boolean) => Promise<void>;
399
- /**
400
- * Moves a given event id to the version directory
401
- * @param directory
402
- */
403
- versionEvent: (id: string) => Promise<void>;
404
- /**
405
- * Adds a file to the given event
406
- * @param id - The id of the event to add the file to
407
- * @param file - File contents to add including the content and the file name
408
- * @param version - Optional version of the event to add the file to
409
- * @returns
410
- */
411
- addFileToEvent: (id: string, file: {
412
- content: string;
413
- fileName: string;
414
- }, version?: string, options?: {
415
- path?: string;
416
- }) => Promise<void>;
417
- /**
418
- * Adds a schema to the given event
419
- * @param id - The id of the event to add the schema to
420
- * @param schema - Schema contents to add including the content and the file name
421
- * @param version - Optional version of the event to add the schema to
422
- * @returns
423
- */
424
- addSchemaToEvent: (id: string, schema: {
425
- schema: string;
426
- fileName: string;
427
- }, version?: string, options?: {
428
- path?: string;
429
- }) => Promise<void>;
430
- /**
431
- * Check to see if an event version exists
432
- * @param id - The id of the event
433
- * @param version - The version of the event (supports semver)
434
- * @returns
435
- */
436
- eventHasVersion: (id: string, version?: string) => Promise<boolean>;
437
- /**
438
- * ================================
439
- * Commands
440
- * ================================
441
- */
442
- /**
443
- * Returns a command from EventCatalog
444
- * @param id - The id of the command to retrieve
445
- * @param version - Optional id of the version to get (supports semver)
446
- * @returns Command|Undefined
447
- */
448
- getCommand: (id: string, version?: string, options?: {
449
- attachSchema?: boolean;
450
- }) => Promise<Command>;
451
- /**
452
- * Returns all commands from EventCatalog
453
- * @param latestOnly - optional boolean, set to true to get only latest versions
454
- * @returns Command[]|Undefined
455
- */
456
- getCommands: (options?: {
457
- latestOnly?: boolean;
458
- attachSchema?: boolean;
459
- }) => Promise<Command[]>;
460
- /**
461
- * Adds an command to EventCatalog
462
- *
463
- * @param command - The command to write
464
- * @param options - Optional options to write the command
465
- *
466
- */
467
- writeCommand: (command: Command, options?: {
468
- path?: string;
469
- override?: boolean;
470
- versionExistingContent?: boolean;
471
- format?: "md" | "mdx";
472
- }) => Promise<void>;
473
- /**
474
- * Adds a command to a service in EventCatalog
475
- *
476
- * @param command - The command to write to the service
477
- * @param service - The service and it's id to write to the command to
478
- * @param options - Optional options to write the command
479
- *
480
- */
481
- writeCommandToService: (command: Command, service: {
482
- id: string;
483
- version?: string;
484
- }, options?: {
485
- path?: string;
486
- format?: "md" | "mdx";
487
- override?: boolean;
488
- }) => Promise<void>;
489
- /**
490
- * Remove an command to EventCatalog (modeled on the standard POSIX rm utility)
491
- *
492
- * @param path - The path to your command, e.g. `/Inventory/InventoryAdjusted`
493
- *
494
- */
495
- rmCommand: (path: string) => Promise<void>;
496
- /**
497
- * Remove an command by an Event id
498
- *
499
- * @param id - The id of the command you want to remove
500
- *
501
- */
502
- rmCommandById: (id: string, version?: string, persistFiles?: boolean) => Promise<void>;
503
- /**
504
- * Moves a given command id to the version directory
505
- * @param directory
506
- */
507
- versionCommand: (id: string) => Promise<void>;
508
- /**
509
- * Adds a file to the given command
510
- * @param id - The id of the command to add the file to
511
- * @param file - File contents to add including the content and the file name
512
- * @param version - Optional version of the command to add the file to
513
- * @returns
514
- */
515
- addFileToCommand: (id: string, file: {
516
- content: string;
517
- fileName: string;
518
- }, version?: string, options?: {
519
- path?: string;
520
- }) => Promise<void>;
521
- /**
522
- * Adds a schema to the given command
523
- * @param id - The id of the command to add the schema to
524
- * @param schema - Schema contents to add including the content and the file name
525
- * @param version - Optional version of the command to add the schema to
526
- * @returns
527
- */
528
- addSchemaToCommand: (id: string, schema: {
529
- schema: string;
530
- fileName: string;
531
- }, version?: string, options?: {
532
- path?: string;
533
- }) => Promise<void>;
534
- /**
535
- * Check to see if a command version exists
536
- * @param id - The id of the command
537
- * @param version - The version of the command (supports semver)
538
- * @returns
539
- */
540
- commandHasVersion: (id: string, version?: string) => Promise<boolean>;
541
- /**
542
- * ================================
543
- * Queries
544
- * ================================
545
- */
546
- /**
547
- * Returns a query from EventCatalog
548
- * @param id - The id of the query to retrieve
549
- * @param version - Optional id of the version to get (supports semver)
550
- * @returns Query|Undefined
551
- */
552
- getQuery: (id: string, version?: string, options?: {
553
- attachSchema?: boolean;
554
- }) => Promise<Query>;
555
- /**
556
- * Returns all queries from EventCatalog
557
- * @param latestOnly - optional boolean, set to true to get only latest versions
558
- * @returns Query[]|Undefined
559
- */
560
- getQueries: (options?: {
561
- latestOnly?: boolean;
562
- attachSchema?: boolean;
563
- }) => Promise<Query[]>;
564
- /**
565
- * Adds a query to EventCatalog
566
- *
567
- * @param query - The query to write
568
- * @param options - Optional options to write the event
569
- *
570
- */
571
- writeQuery: (query: Query, options?: {
572
- path?: string;
573
- override?: boolean;
574
- versionExistingContent?: boolean;
575
- format?: "md" | "mdx";
576
- }) => Promise<void>;
577
- /**
578
- * Adds a query to a service in EventCatalog
579
- *
580
- * @param query - The query to write to the service
581
- * @param service - The service and it's id to write to the query to
582
- * @param options - Optional options to write the query
583
- *
584
- */
585
- writeQueryToService: (query: Query, service: {
586
- id: string;
587
- version?: string;
588
- }, options?: {
589
- path?: string;
590
- format?: "md" | "mdx";
591
- override?: boolean;
592
- }) => Promise<void>;
593
- /**
594
- * Remove an query to EventCatalog (modeled on the standard POSIX rm utility)
595
- *
596
- * @param path - The path to your query, e.g. `/Orders/GetOrder`
597
- *
598
- */
599
- rmQuery: (path: string) => Promise<void>;
600
- /**
601
- * Remove a query by a Query id
602
- *
603
- * @param id - The id of the query you want to remove
604
- *
605
- */
606
- rmQueryById: (id: string, version?: string, persistFiles?: boolean) => Promise<void>;
607
- /**
608
- * Moves a given query id to the version directory
609
- * @param directory
610
- */
611
- versionQuery: (id: string) => Promise<void>;
612
- /**
613
- * Adds a file to the given query
614
- * @param id - The id of the query to add the file to
615
- * @param file - File contents to add including the content and the file name
616
- * @param version - Optional version of the query to add the file to
617
- * @returns
618
- */
619
- addFileToQuery: (id: string, file: {
620
- content: string;
621
- fileName: string;
622
- }, version?: string, options?: {
623
- path?: string;
624
- }) => Promise<void>;
625
- /**
626
- * Adds a schema to the given query
627
- * @param id - The id of the query to add the schema to
628
- * @param schema - Schema contents to add including the content and the file name
629
- * @param version - Optional version of the query to add the schema to
630
- * @returns
631
- */
632
- addSchemaToQuery: (id: string, schema: {
633
- schema: string;
634
- fileName: string;
635
- }, version?: string, options?: {
636
- path?: string;
637
- }) => Promise<void>;
638
- /**
639
- * Check to see if an query version exists
640
- * @param id - The id of the query
641
- * @param version - The version of the query (supports semver)
642
- * @returns
643
- */
644
- queryHasVersion: (id: string, version?: string) => Promise<boolean>;
645
- /**
646
- * ================================
647
- * Channels
648
- * ================================
649
- */
650
- /**
651
- * Returns a channel from EventCatalog
652
- * @param id - The id of the channel to retrieve
653
- * @param version - Optional id of the version to get (supports semver)
654
- * @returns Channel|Undefined
655
- */
656
- getChannel: (id: string, version?: string) => Promise<Channel>;
657
- /**
658
- * Returns all channels from EventCatalog
659
- * @param latestOnly - optional boolean, set to true to get only latest versions
660
- * @returns Channel[]|Undefined
661
- */
662
- getChannels: (options?: {
663
- latestOnly?: boolean;
664
- }) => Promise<Channel[]>;
665
- /**
666
- * Adds an channel to EventCatalog
667
- *
668
- * @param command - The channel to write
669
- * @param options - Optional options to write the channel
670
- *
671
- */
672
- writeChannel: (channel: Channel, options?: {
673
- path?: string;
674
- override?: boolean;
675
- versionExistingContent?: boolean;
676
- format?: "md" | "mdx";
677
- }) => Promise<void>;
678
- /**
679
- * Remove an channel to EventCatalog (modeled on the standard POSIX rm utility)
680
- *
681
- * @param path - The path to your channel, e.g. `/Inventory/InventoryAdjusted`
682
- *
683
- */
684
- rmChannel: (path: string) => Promise<void>;
685
- /**
686
- * Remove an channel by an Event id
687
- *
688
- * @param id - The id of the channel you want to remove
689
- *
690
- */
691
- rmChannelById: (id: string, version?: string, persistFiles?: boolean) => Promise<void>;
692
- /**
693
- * Moves a given channel id to the version directory
694
- * @param directory
695
- */
696
- versionChannel: (id: string) => Promise<void>;
697
- /**
698
- * Check to see if a channel version exists
699
- * @param id - The id of the channel
700
- * @param version - The version of the channel (supports semver)
701
- * @returns
702
- */
703
- channelHasVersion: (id: string, version?: string) => Promise<boolean>;
704
- /**
705
- * Add a channel to an event
706
- *
707
- * Optionally specify a version to add the channel to a specific version of the event.
708
- *
709
- * @example
710
- * ```ts
711
- * import utils from '@eventcatalog/utils';
712
- *
713
- * const { addEventToChannel } = utils('/path/to/eventcatalog');
714
- *
715
- * // adds a new event (InventoryUpdatedEvent) to the inventory.{env}.events channel
716
- * await addEventToChannel('inventory.{env}.events channel', { id: 'InventoryUpdatedEvent', version: '2.0.0', parameters: { env: 'dev' } });
717
- *
718
- * ```
719
- */
720
- addEventToChannel: (id: string, _message: {
721
- id: string;
722
- version: string;
723
- parameters?: {
724
- [key: string]: string;
725
- };
726
- }, version?: string) => Promise<void>;
727
- /**
728
- * Add a channel to an command
729
- *
730
- * Optionally specify a version to add the channel to a specific version of the command.
731
- *
732
- * @example
733
- * ```ts
734
- * import utils from '@eventcatalog/utils';
735
- *
736
- * const { addCommandToChannel } = utils('/path/to/eventcatalog');
737
- *
738
- * // adds a new command (UpdateInventory) to the inventory.{env}.events channel
739
- * await addCommandToChannel('inventory.{env}.events channel', { id: 'UpdateInventory', version: '2.0.0', parameters: { env: 'dev' } });
740
- *
741
- * ```
742
- */
743
- addCommandToChannel: (id: string, _message: {
744
- id: string;
745
- version: string;
746
- parameters?: {
747
- [key: string]: string;
748
- };
749
- }, version?: string) => Promise<void>;
750
- /**
751
- * Add a channel to an query
752
- *
753
- * Optionally specify a version to add the channel to a specific version of the query.
754
- *
755
- * @example
756
- * ```ts
757
- * import utils from '@eventcatalog/utils';
758
- *
759
- * const { addQueryToChannel } = utils('/path/to/eventcatalog');
760
- *
761
- * // adds a new query (GetInventory) to the inventory.{env}.events channel
762
- * await addQueryToChannel('inventory.{env}.events channel', { id: 'GetInventory', version: '2.0.0', parameters: { env: 'dev' } });
763
- *
764
- * ```
765
- */
766
- addQueryToChannel: (id: string, _message: {
767
- id: string;
768
- version: string;
769
- parameters?: {
770
- [key: string]: string;
771
- };
772
- }, version?: string) => Promise<void>;
773
- /**
774
- * ================================
775
- * SERVICES
776
- * ================================
777
- */
778
- /**
779
- * Adds a service to EventCatalog
780
- *
781
- * @param service - The service to write
782
- * @param options - Optional options to write the event
783
- *
784
- */
785
- writeService: (service: Service, options?: {
786
- path?: string;
787
- override?: boolean;
788
- versionExistingContent?: boolean;
789
- format?: "md" | "mdx";
790
- }) => Promise<void>;
791
- /**
792
- * Adds a versioned service to EventCatalog
793
- *
794
- * @param service - The service to write
795
- *
796
- */
797
- writeVersionedService: (service: Service) => Promise<void>;
798
- /**
799
- * Adds a service to a domain in EventCatalog
800
- *
801
- * @param service - The service to write
802
- * @param domain - The domain to add the service to
803
- * @param options - Optional options to write the event
804
- *
805
- */
806
- writeServiceToDomain: (service: Service, domain: {
807
- id: string;
808
- version?: string;
809
- direction?: string;
810
- }, options?: {
811
- path?: string;
812
- format?: "md" | "mdx";
813
- override?: boolean;
814
- }) => Promise<void>;
815
- /**
816
- * Returns a service from EventCatalog
817
- * @param id - The id of the service to retrieve
818
- * @param version - Optional id of the version to get (supports semver)
819
- * @returns Service|Undefined
820
- */
821
- getService: (id: string, version?: string) => Promise<Service>;
822
- /**
823
- * Returns a service from EventCatalog by it's path.
824
- * @param path - The path to the service to retrieve
825
- * @returns Service|Undefined
826
- */
827
- getServiceByPath: (path: string) => Promise<Service>;
828
- /**
829
- * Returns all services from EventCatalog
830
- * @param latestOnly - optional boolean, set to true to get only latest versions
831
- * @returns Service[]|Undefined
832
- */
833
- getServices: (options?: {
834
- latestOnly?: boolean;
835
- }) => Promise<Service[]>;
836
- /**
837
- * Moves a given service id to the version directory
838
- * @param directory
839
- */
840
- versionService: (id: string) => Promise<void>;
841
- /**
842
- * Remove a service from EventCatalog (modeled on the standard POSIX rm utility)
843
- *
844
- * @param path - The path to your service, e.g. `/InventoryService`
845
- *
846
- */
847
- rmService: (path: string) => Promise<void>;
848
- /**
849
- * Remove an service by an service id
850
- *
851
- * @param id - The id of the service you want to remove
852
- *
853
- */
854
- rmServiceById: (id: string, version?: string, persistFiles?: boolean) => Promise<void>;
855
- /**
856
- * Adds a file to the given service
857
- * @param id - The id of the service to add the file to
858
- * @param file - File contents to add including the content and the file name
859
- * @param version - Optional version of the service to add the file to
860
- * @returns
861
- */
862
- addFileToService: (id: string, file: {
863
- content: string;
864
- fileName: string;
865
- }, version?: string) => Promise<void>;
866
- /**
867
- * Returns the specifications for a given service
868
- * @param id - The id of the service to retrieve the specifications for
869
- * @param version - Optional version of the service
870
- * @returns
871
- */
872
- getSpecificationFilesForService: (id: string, version?: string) => Promise<any>;
873
- /**
874
- * Check to see if a service version exists
875
- * @param id - The id of the service
876
- * @param version - The version of the service (supports semver)
877
- * @returns
878
- */
879
- serviceHasVersion: (id: string, version?: string) => Promise<boolean>;
880
- /**
881
- * Add an event to a service by it's id.
882
- *
883
- * Optionally specify a version to add the event to a specific version of the service.
884
- *
885
- * @example
886
- * ```ts
887
- * import utils from '@eventcatalog/utils';
888
- *
889
- * const { addEventToService } = utils('/path/to/eventcatalog');
890
- *
891
- * // adds a new event (InventoryUpdatedEvent) that the InventoryService will send
892
- * await addEventToService('InventoryService', 'sends', { event: 'InventoryUpdatedEvent', version: '2.0.0' });
893
- *
894
- * // adds a new event (OrderComplete) that the InventoryService will receive
895
- * await addEventToService('InventoryService', 'receives', { event: 'OrderComplete', version: '2.0.0' });
896
- *
897
- * ```
898
- */
899
- addEventToService: (id: string, direction: string, event: {
900
- id: string;
901
- version: string;
902
- }, version?: string) => Promise<void>;
903
- /**
904
- * Add a data store to a service by it's id.
905
- *
906
- * Optionally specify a version to add the data store to a specific version of the service.
907
- *
908
- * @example
909
- * ```ts
910
- * import utils from '@eventcatalog/utils';
911
- *
912
- * const { addDataStoreToService } = utils('/path/to/eventcatalog');
913
- *
914
- * // adds a new data store (orders-db) that the InventoryService will write to
915
- * await addDataStoreToService('InventoryService', 'writesTo', { id: 'orders-db', version: '2.0.0' });
916
- *
917
- * ```
918
- */
919
- addDataStoreToService: (id: string, operation: "writesTo" | "readsFrom", dataStore: {
920
- id: string;
921
- version: string;
922
- }, version?: string) => Promise<void>;
923
- /**
924
- * Add a command to a service by it's id.
925
- *
926
- * Optionally specify a version to add the event to a specific version of the service.
927
- *
928
- * @example
929
- * ```ts
930
- * import utils from '@eventcatalog/utils';
931
- *
932
- * const { addCommandToService } = utils('/path/to/eventcatalog');
933
- *
934
- * // adds a new command (UpdateInventoryCommand) that the InventoryService will send
935
- * await addCommandToService('InventoryService', 'sends', { command: 'UpdateInventoryCommand', version: '2.0.0' });
936
- *
937
- * // adds a new command (VerifyInventory) that the InventoryService will receive
938
- * await addCommandToService('InventoryService', 'receives', { command: 'VerifyInventory', version: '2.0.0' });
939
- *
940
- * ```
941
- */
942
- addCommandToService: (id: string, direction: string, event: {
943
- id: string;
944
- version: string;
945
- }, version?: string) => Promise<void>;
946
- /**
947
- * Add a query to a service by it's id.
948
- *
949
- * Optionally specify a version to add the event to a specific version of the service.
950
- *
951
- * @example
952
- * ```ts
953
- * import utils from '@eventcatalog/utils';
954
- *
955
- * const { addQueryToService } = utils('/path/to/eventcatalog');
956
- *
957
- * // adds a new query (UpdateInventory) that the InventoryService will send
958
- * await addQueryToService('InventoryService', 'sends', { command: 'UpdateInventory', version: '2.0.0' });
959
- *
960
- * // adds a new command (VerifyInventory) that the InventoryService will receive
961
- * await addQueryToService('InventoryService', 'receives', { command: 'VerifyInventory', version: '2.0.0' });
962
- *
963
- * ```
964
- */
965
- addQueryToService: (id: string, direction: string, event: {
966
- id: string;
967
- version: string;
968
- }, version?: string) => Promise<void>;
969
- /**
970
- * Add an entity to a service by its id.
971
- *
972
- * @example
973
- * ```ts
974
- * import utils from '@eventcatalog/utils';
975
- *
976
- * const { addEntityToService } = utils('/path/to/eventcatalog');
977
- *
978
- * // adds a new entity (User) to the InventoryService
979
- * await addEntityToService('InventoryService', { id: 'User', version: '1.0.0' });
980
- *
981
- * // adds a new entity (Product) to a specific version of the InventoryService
982
- * await addEntityToService('InventoryService', { id: 'Product', version: '1.0.0' }, '2.0.0');
983
- *
984
- * ```
985
- */
986
- addEntityToService: (id: string, entity: {
987
- id: string;
988
- version: string;
989
- }, version?: string) => Promise<void>;
990
- /**
991
- * Check to see if a service exists by it's path.
992
- *
993
- * @example
994
- * ```ts
995
- * import utils from '@eventcatalog/utils';
996
- *
997
- * const { isService } = utils('/path/to/eventcatalog');
998
- *
999
- * // returns true if the path is a service
1000
- * await isService('/services/InventoryService/index.mdx');
1001
- * ```
1002
- *
1003
- * @param path - The path to the service to check
1004
- * @returns boolean
1005
- */
1006
- isService: (path: string) => Promise<boolean>;
1007
- /**
1008
- * Converts a file to a service.
1009
- * @param file - The file to convert to a service.
1010
- * @returns The service.
1011
- */
1012
- toService: (file: string) => Promise<Service>;
1013
- /**
1014
- * ================================
1015
- * Domains
1016
- * ================================
1017
- */
1018
- /**
1019
- * Adds a domain to EventCatalog
1020
- *
1021
- * @param domain - The domain to write
1022
- * @param options - Optional options to write the event
1023
- *
1024
- */
1025
- writeDomain: (domain: Domain, options?: {
1026
- path? /**
1027
- * Adds an event to a service in EventCatalog
1028
- *
1029
- * @param event - The event to write to the service
1030
- * @param service - The service and it's id to write to the event to
1031
- * @param options - Optional options to write the event
1032
- *
1033
- */: string;
1034
- override?: boolean;
1035
- versionExistingContent?: boolean;
1036
- format?: "md" | "mdx";
1037
- }) => Promise<void>;
1038
- /**
1039
- * Returns a domain from EventCatalog
1040
- * @param id - The id of the domain to retrieve
1041
- * @param version - Optional id of the version to get (supports semver)
1042
- * @returns Domain|Undefined
1043
- */
1044
- getDomain: (id: string, version?: string) => Promise<Domain>;
1045
- /**
1046
- * Returns all domains from EventCatalog
1047
- * @param latestOnly - optional boolean, set to true to get only latest versions
1048
- * @returns Domain[]|Undefined
1049
- */
1050
- getDomains: (options?: {
1051
- latestOnly?: boolean;
1052
- }) => Promise<Domain[]>;
1053
- /**
1054
- * Moves a given domain id to the version directory
1055
- * @param directory
1056
- */
1057
- versionDomain: (id: string) => Promise<void>;
1058
- /**
1059
- * Remove a domain from EventCatalog (modeled on the standard POSIX rm utility)
1060
- *
1061
- * @param path - The path to your domain, e.g. `/Payment`
1062
- *
1063
- */
1064
- rmDomain: (path: string) => Promise<void>;
1065
- /**
1066
- * Remove an service by an domain id
1067
- *
1068
- * @param id - The id of the domain you want to remove
1069
- *
1070
- */
1071
- rmDomainById: (id: string, version?: string, persistFiles?: boolean) => Promise<void>;
1072
- /**
1073
- * Adds a file to the given domain
1074
- * @param id - The id of the domain to add the file to
1075
- * @param file - File contents to add including the content and the file name
1076
- * @param version - Optional version of the domain to add the file to
1077
- * @returns
1078
- */
1079
- addFileToDomain: (id: string, file: {
1080
- content: string;
1081
- fileName: string;
1082
- }, version?: string) => Promise<void>;
1083
- /**
1084
- * Adds an ubiquitous language dictionary to a domain
1085
- * @param id - The id of the domain to add the ubiquitous language to
1086
- * @param ubiquitousLanguageDictionary - The ubiquitous language dictionary to add
1087
- * @param version - Optional version of the domain to add the ubiquitous language to
1088
- */
1089
- addUbiquitousLanguageToDomain: (id: string, ubiquitousLanguageDictionary: UbiquitousLanguageDictionary, version?: string) => Promise<void>;
1090
- /**
1091
- * Get the ubiquitous language dictionary from a domain
1092
- * @param id - The id of the domain to get the ubiquitous language from
1093
- * @param version - Optional version of the domain to get the ubiquitous language from
1094
- * @returns
1095
- */
1096
- getUbiquitousLanguageFromDomain: (id: string, version?: string) => Promise<{
1097
- markdown: any;
1098
- } | undefined>;
1099
- /**
1100
- * Check to see if a domain version exists
1101
- * @param id - The id of the domain
1102
- * @param version - The version of the domain (supports semver)
1103
- * @returns
1104
- */
1105
- domainHasVersion: (id: string, version?: string) => Promise<boolean>;
1106
- /**
1107
- * Adds a given service to a domain
1108
- * @param id - The id of the domain
1109
- * @param service - The id and version of the service to add
1110
- * @param version - (Optional) The version of the domain to add the service to
1111
- * @returns
1112
- */
1113
- addServiceToDomain: (id: string, service: {
1114
- id: string;
1115
- version: string;
1116
- }, version?: string) => Promise<void>;
1117
- /**
1118
- * Adds a given subdomain to a domain
1119
- * @param id - The id of the domain
1120
- * @param subDomain - The id and version of the subdomain to add
1121
- * @param version - (Optional) The version of the domain to add the subdomain to
1122
- * @returns
1123
- */
1124
- addSubDomainToDomain: (id: string, subDomain: {
1125
- id: string;
1126
- version: string;
1127
- }, version?: string) => Promise<void>;
1128
- /**
1129
- * Adds an entity to a domain
1130
- * @param id - The id of the domain
1131
- * @param entity - The id and version of the entity to add
1132
- * @param version - (Optional) The version of the domain to add the entity to
1133
- * @returns
1134
- */
1135
- addEntityToDomain: (id: string, entity: {
1136
- id: string;
1137
- version: string;
1138
- }, version?: string) => Promise<void>;
1139
- /**
1140
- * Add an event to a domain by its id.
1141
- *
1142
- * @example
1143
- * ```ts
1144
- * import utils from '@eventcatalog/utils';
1145
- *
1146
- * const { addEventToDomain } = utils('/path/to/eventcatalog');
1147
- *
1148
- * // adds a new event (OrderCreated) that the Orders domain will send
1149
- * await addEventToDomain('Orders', 'sends', { id: 'OrderCreated', version: '2.0.0' });
1150
- *
1151
- * // adds a new event (PaymentProcessed) that the Orders domain will receive
1152
- * await addEventToDomain('Orders', 'receives', { id: 'PaymentProcessed', version: '2.0.0' });
1153
- *
1154
- * ```
1155
- */
1156
- addEventToDomain: (id: string, direction: string, message: {
1157
- id: string;
1158
- version: string;
1159
- }, version?: string) => Promise<void>;
1160
- /**
1161
- * Add a command to a domain by its id.
1162
- *
1163
- * @example
1164
- * ```ts
1165
- * import utils from '@eventcatalog/utils';
1166
- *
1167
- * const { addCommandToDomain } = utils('/path/to/eventcatalog');
1168
- *
1169
- * // adds a new command (ProcessOrder) that the Orders domain will send
1170
- * await addCommandToDomain('Orders', 'sends', { id: 'ProcessOrder', version: '2.0.0' });
1171
- *
1172
- * // adds a new command (CancelOrder) that the Orders domain will receive
1173
- * await addCommandToDomain('Orders', 'receives', { id: 'CancelOrder', version: '2.0.0' });
1174
- *
1175
- * ```
1176
- */
1177
- addCommandToDomain: (id: string, direction: string, message: {
1178
- id: string;
1179
- version: string;
1180
- }, version?: string) => Promise<void>;
1181
- /**
1182
- * Add a query to a domain by its id.
1183
- *
1184
- * @example
1185
- * ```ts
1186
- * import utils from '@eventcatalog/utils';
1187
- *
1188
- * const { addQueryToDomain } = utils('/path/to/eventcatalog');
1189
- *
1190
- * // adds a new query (GetOrderStatus) that the Orders domain will send
1191
- * await addQueryToDomain('Orders', 'sends', { id: 'GetOrderStatus', version: '2.0.0' });
1192
- *
1193
- * // adds a new query (GetInventory) that the Orders domain will receive
1194
- * await addQueryToDomain('Orders', 'receives', { id: 'GetInventory', version: '2.0.0' });
1195
- *
1196
- * ```
1197
- */
1198
- addQueryToDomain: (id: string, direction: string, message: {
1199
- id: string;
1200
- version: string;
1201
- }, version?: string) => Promise<void>;
1202
- /**
1203
- * ================================
1204
- * Teams
1205
- * ================================
1206
- */
1207
- /**
1208
- * Adds a team to EventCatalog
1209
- *
1210
- * @param team - The team to write
1211
- * @param options - Optional options to write the team
1212
- *
1213
- */
1214
- writeTeam: (team: Team, options?: {
1215
- override?: boolean;
1216
- }) => Promise<void>;
1217
- /**
1218
- * Returns a team from EventCatalog
1219
- * @param id - The id of the team to retrieve
1220
- * @returns Team|Undefined
1221
- */
1222
- getTeam: (id: string) => Promise<Team | undefined>;
1223
- /**
1224
- * Returns all teams from EventCatalog
1225
- * @returns Team[]|Undefined
1226
- */
1227
- getTeams: (options?: {}) => Promise<Team[]>;
1228
- /**
1229
- * Remove a team by the team id
1230
- *
1231
- * @param id - The id of the team you want to remove
1232
- *
1233
- */
1234
- rmTeamById: (id: string) => Promise<void>;
1235
- /**
1236
- * ================================
1237
- * Users
1238
- * ================================
1239
- */
1240
- /**
1241
- * Adds a user to EventCatalog
1242
- *
1243
- * @param user - The user to write
1244
- * @param options - Optional options to write the user
1245
- *
1246
- */
1247
- writeUser: (user: User, options?: {
1248
- override?: boolean;
1249
- }) => Promise<void>;
1250
- /**
1251
- * Returns a user from EventCatalog
1252
- * @param id - The id of the user to retrieve
1253
- * @returns User|Undefined
1254
- */
1255
- getUser: (id: string) => Promise<User | undefined>;
1256
- /**
1257
- * Returns all user from EventCatalog
1258
- * @returns User[]|Undefined
1259
- */
1260
- getUsers: (options?: {}) => Promise<User[]>;
1261
- /**
1262
- * Remove a user by the user id
1263
- *
1264
- * @param id - The id of the user you want to remove
1265
- *
1266
- */
1267
- rmUserById: (id: string) => Promise<void>;
1268
- /**
1269
- * ================================
1270
- * Custom Docs
1271
- * ================================
1272
- */
1273
- /**
1274
- * Returns a custom doc from EventCatalog
1275
- * @param path - The path to the custom doc to retrieve
1276
- * @returns CustomDoc|Undefined
1277
- */
1278
- getCustomDoc: (filePath: string) => Promise<CustomDoc | undefined>;
1279
- /**
1280
- * Returns all custom docs from EventCatalog
1281
- * @param options - Optional options to get custom docs from a specific path
1282
- * @returns CustomDoc[]|Undefined
1283
- */
1284
- getCustomDocs: (options?: {
1285
- path?: string;
1286
- }) => Promise<CustomDoc[]>;
1287
- /**
1288
- * Writes a custom doc to EventCatalog
1289
- * @param customDoc - The custom doc to write
1290
- * @param options - Optional options to write the custom doc
1291
- *
1292
- */
1293
- writeCustomDoc: (customDoc: CustomDoc, options?: {
1294
- path?: string;
1295
- }) => Promise<void>;
1296
- /**
1297
- * Removes a custom doc from EventCatalog
1298
- * @param path - The path to the custom doc to remove
1299
- *
1300
- */
1301
- rmCustomDoc: (filePath: string) => Promise<void>;
1302
- /**
1303
- * Dumps the catalog to a JSON file.
1304
- * @param directory - The directory to dump the catalog to
1305
- * @returns A JSON file with the catalog
1306
- */
1307
- dumpCatalog: (options?: {
1308
- includeMarkdown?: boolean;
1309
- }) => Promise<EventCatalog>;
1310
- /**
1311
- * Returns the event catalog configuration file.
1312
- * The event catalog configuration file is the file that contains the configuration for the event catalog.
1313
- *
1314
- * @param directory - The directory of the catalog.
1315
- * @returns A JSON object with the configuration for the event catalog.
1316
- */
1317
- getEventCatalogConfigurationFile: () => Promise<any>;
1318
- /**
1319
- * ================================
1320
- * Resources Utils
1321
- * ================================
1322
- */
1323
- /**
1324
- * Returns the path to a given resource by id and version
1325
- */
1326
- getResourcePath: (catalogDir: string, id: string, version?: string) => Promise<{
1327
- fullPath: string;
1328
- relativePath: string;
1329
- directory: string;
1330
- } | undefined>;
1331
- /**
1332
- * Returns the folder name of a given resource
1333
- */
1334
- getResourceFolderName: (catalogDir: string, id: string, version?: string) => Promise<string | undefined>;
1335
- /**
1336
- * ================================
1337
- * General Message Utils
1338
- * ================================
1339
- */
1340
- /**
1341
- * Returns a message from EventCatalog by a given schema path.
1342
- *
1343
- * @param path - The path to the message to retrieve
1344
- * @returns Message|Undefined
1345
- */
1346
- getMessageBySchemaPath: (path: string, options?: {
1347
- attachSchema?: boolean;
1348
- }) => Promise<Message>;
1349
- /**
1350
- * Returns the producers and consumers (services) for a given message
1351
- * @param id - The id of the message to get the producers and consumers for
1352
- * @param version - Optional version of the message
1353
- * @returns { producers: Service[], consumers: Service[] }
1354
- */
1355
- getProducersAndConsumersForMessage: (id: string, version?: string, options?: {
1356
- latestOnly?: boolean;
1357
- }) => Promise<{
1358
- producers: Service[];
1359
- consumers: Service[];
1360
- }>;
1361
- /**
1362
- * Returns the consumers of a given schema path
1363
- * @param path - The path to the schema to get the consumers for
1364
- * @returns Service[]
1365
- */
1366
- getConsumersOfSchema: (path: string) => Promise<Service[]>;
1367
- /**
1368
- * Returns the producers of a given schema path
1369
- * @param path - The path to the schema to get the producers for
1370
- * @returns Service[]
1371
- */
1372
- getProducersOfSchema: (path: string) => Promise<Service[]>;
1373
- /**
1374
- * Returns the owners for a given resource (e.g domain, service, event, command, query, etc.)
1375
- * @param id - The id of the resource to get the owners for
1376
- * @param version - Optional version of the resource
1377
- * @returns { owners: User[] }
1378
- */
1379
- getOwnersForResource: (id: string, version?: string) => Promise<Team[]>;
1380
- /**
1381
- * ================================
1382
- * Entities
1383
- * ================================
1384
- */
1385
- /**
1386
- * Returns an entity from EventCatalog
1387
- * @param id - The id of the entity to retrieve
1388
- * @param version - Optional id of the version to get (supports semver)
1389
- * @returns Entity|Undefined
1390
- */
1391
- getEntity: (id: string, version?: string) => Promise<Entity>;
1392
- /**
1393
- * Returns all entities from EventCatalog
1394
- * @param latestOnly - optional boolean, set to true to get only latest versions
1395
- * @returns Entity[]|Undefined
1396
- */
1397
- getEntities: (options?: {
1398
- latestOnly?: boolean;
1399
- }) => Promise<Entity[]>;
1400
- /**
1401
- * Adds an entity to EventCatalog
1402
- *
1403
- * @param entity - The entity to write
1404
- * @param options - Optional options to write the entity
1405
- *
1406
- */
1407
- writeEntity: (entity: Entity, options?: {
1408
- path?: string;
1409
- override?: boolean;
1410
- versionExistingContent?: boolean;
1411
- format?: "md" | "mdx";
1412
- }) => Promise<void>;
1413
- /**
1414
- * Remove an entity from EventCatalog (modeled on the standard POSIX rm utility)
1415
- *
1416
- * @param path - The path to your entity, e.g. `/User`
1417
- *
1418
- */
1419
- rmEntity: (path: string) => Promise<void>;
1420
- /**
1421
- * Remove an entity by an entity id
1422
- *
1423
- * @param id - The id of the entity you want to remove
1424
- *
1425
- */
1426
- rmEntityById: (id: string, version?: string, persistFiles?: boolean) => Promise<void>;
1427
- /**
1428
- * Moves a given entity id to the version directory
1429
- * @param id - The id of the entity to version
1430
- */
1431
- versionEntity: (id: string) => Promise<void>;
1432
- /**
1433
- * Check to see if an entity version exists
1434
- * @param id - The id of the entity
1435
- * @param version - The version of the entity (supports semver)
1436
- * @returns
1437
- */
1438
- entityHasVersion: (id: string, version?: string) => Promise<boolean>;
1439
- /**
1440
- * ================================
1441
- * Data Stores
1442
- * ================================
1443
- */
1444
- /**
1445
- * Adds a data store to EventCatalog
1446
- * @param dataStore - The data store to write
1447
- * @param options - Optional options to write the data store
1448
- *
1449
- */
1450
- writeDataStore: (data: Container, options?: {
1451
- path?: string;
1452
- override?: boolean;
1453
- versionExistingContent?: boolean;
1454
- format?: "md" | "mdx";
1455
- }) => Promise<void>;
1456
- /**
1457
- * Returns a data store from EventCatalog
1458
- * @param id - The id of the data store to retrieve
1459
- * @param version - Optional id of the version to get (supports semver)
1460
- * @returns Container|Undefined
1461
- */
1462
- getDataStore: (id: string, version?: string) => Promise<Container>;
1463
- /**
1464
- * Returns all data stores from EventCatalog
1465
- * @param latestOnly - optional boolean, set to true to get only latest versions
1466
- * @returns Container[]|Undefined
1467
- */
1468
- getDataStores: (options?: {
1469
- latestOnly?: boolean;
1470
- }) => Promise<Container[]>;
1471
- /**
1472
- * Version a data store by its id
1473
- * @param id - The id of the data store to version
1474
- */
1475
- versionDataStore: (id: string) => Promise<void>;
1476
- /**
1477
- * Remove a data store by its path
1478
- * @param path - The path to the data store to remove
1479
- */
1480
- rmDataStore: (path: string) => Promise<void>;
1481
- /**
1482
- * Remove a data store by its id
1483
- * @param id - The id of the data store to remove
1484
- */
1485
- rmDataStoreById: (id: string, version?: string, persistFiles?: boolean) => Promise<void>;
1486
- /**
1487
- * Check to see if a data store version exists
1488
- * @param id - The id of the data store
1489
- * @param version - The version of the data store (supports semver)
1490
- * @returns
1491
- */
1492
- dataStoreHasVersion: (id: string, version?: string) => Promise<boolean>;
1493
- /**
1494
- * Adds a file to a data store by its id
1495
- * @param id - The id of the data store to add the file to
1496
- * @param file - File contents to add including the content and the file name
1497
- * @param version - Optional version of the data store to add the file to
1498
- * @returns
1499
- */
1500
- addFileToDataStore: (id: string, file: {
1501
- content: string;
1502
- fileName: string;
1503
- }, version?: string) => Promise<void>;
1504
- /**
1505
- * Writes a data store to a service by its id
1506
- * @param dataStore - The data store to write
1507
- * @param service - The service to write the data store to
1508
- * @returns
1509
- */
1510
- writeDataStoreToService: (container: Container, service: {
1511
- id: string;
1512
- version?: string;
1513
- }, options?: {
1514
- path?: string;
1515
- format?: "md" | "mdx";
1516
- override? /**
1517
- * Remove an command to EventCatalog (modeled on the standard POSIX rm utility)
1518
- *
1519
- * @param path - The path to your command, e.g. `/Inventory/InventoryAdjusted`
1520
- *
1521
- */: boolean;
1522
- }) => Promise<void>;
1523
- /**
1524
- * ================================
1525
- * Data Products
1526
- * ================================
1527
- */
1528
- /**
1529
- * Adds a data product to EventCatalog
1530
- * @param dataProduct - The data product to write
1531
- * @param options - Optional options to write the data product
1532
- *
1533
- */
1534
- writeDataProduct: (dataProduct: DataProduct, options?: {
1535
- path?: string;
1536
- override?: boolean;
1537
- versionExistingContent?: boolean;
1538
- format?: "md" | "mdx";
1539
- }) => Promise<void>;
1540
- /**
1541
- * Writes a data product to a domain in EventCatalog
1542
- * @param dataProduct - The data product to write
1543
- * @param domain - The domain to write the data product to
1544
- * @param options - Optional options to write the data product
1545
- *
1546
- */
1547
- writeDataProductToDomain: (dataProduct: DataProduct, domain: {
1548
- id: string;
1549
- version?: string;
1550
- }, options?: {
1551
- path?: string;
1552
- format?: "md" | "mdx";
1553
- override? /**
1554
- * Adds a schema to the given event
1555
- * @param id - The id of the event to add the schema to
1556
- * @param schema - Schema contents to add including the content and the file name
1557
- * @param version - Optional version of the event to add the schema to
1558
- * @returns
1559
- */: boolean;
1560
- }) => Promise<void>;
1561
- /**
1562
- * Returns a data product from EventCatalog
1563
- * @param id - The id of the data product to retrieve
1564
- * @param version - Optional id of the version to get (supports semver)
1565
- * @returns DataProduct|Undefined
1566
- */
1567
- getDataProduct: (id: string, version?: string) => Promise<DataProduct>;
1568
- /**
1569
- * Returns all data products from EventCatalog
1570
- * @param latestOnly - optional boolean, set to true to get only latest versions
1571
- * @returns DataProduct[]|Undefined
1572
- */
1573
- getDataProducts: (options?: {
1574
- latestOnly?: boolean;
1575
- }) => Promise<DataProduct[]>;
1576
- /**
1577
- * Version a data product by its id
1578
- * @param id - The id of the data product to version
1579
- */
1580
- versionDataProduct: (id: string) => Promise<void>;
1581
- /**
1582
- * Remove a data product by its path
1583
- * @param path - The path to the data product to remove
1584
- */
1585
- rmDataProduct: (path: string) => Promise<void>;
1586
- /**
1587
- * Remove a data product by its id
1588
- * @param id - The id of the data product to remove
1589
- * @param version - Optional version of the data product to remove
1590
- */
1591
- rmDataProductById: (id: string, version?: string, persistFiles?: boolean) => Promise<void>;
1592
- /**
1593
- * Check to see if a data product version exists
1594
- * @param id - The id of the data product
1595
- * @param version - The version of the data product (supports semver)
1596
- * @returns
1597
- */
1598
- dataProductHasVersion: (id: string, version?: string) => Promise<boolean>;
1599
- /**
1600
- * Adds a file to a data product by its id
1601
- * @param id - The id of the data product to add the file to
1602
- * @param file - File contents to add including the content and the file name
1603
- * @param version - Optional version of the data product to add the file to
1604
- * @returns
1605
- */
1606
- addFileToDataProduct: (id: string, file: {
1607
- content: string;
1608
- fileName: string;
1609
- }, version?: string) => Promise<void>;
1610
- /**
1611
- * Adds a data product to a domain
1612
- * @param id - The id of the domain
1613
- * @param dataProduct - The id and version of the data product to add
1614
- * @param version - (Optional) The version of the domain to add the data product to
1615
- * @returns
1616
- */
1617
- addDataProductToDomain: (id: string, dataProduct: {
1618
- id: string;
1619
- version: string;
1620
- }, version?: string) => Promise<void>;
1621
- };
1622
-
1623
- export { type Badge, type BaseSchema, type Channel, type ChannelPointer, type Command, type Container, type CustomDoc, type DataProduct, type DataProductOutputPointer, type Domain, type Entity, type Event, type EventCatalog, type Message, type Query, type ReceivesPointer, type ResourceGroup, type ResourcePointer, type SendsPointer, type Service, type Specification, type Specifications, type Team, type UbiquitousLanguage, type UbiquitousLanguageDictionary, type User, _default as default };