@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.js CHANGED
@@ -33,7 +33,7 @@ __export(src_exports, {
33
33
  default: () => src_default
34
34
  });
35
35
  module.exports = __toCommonJS(src_exports);
36
- var import_node_path18 = require("path");
36
+ var import_node_path19 = require("path");
37
37
 
38
38
  // src/events.ts
39
39
  var import_promises2 = __toESM(require("fs/promises"));
@@ -685,6 +685,15 @@ var writeDomain = (directory) => async (domain, options = {
685
685
  if (Array.isArray(domain.domains)) {
686
686
  resource.domains = uniqueVersions(domain.domains);
687
687
  }
688
+ if (Array.isArray(domain.sends)) {
689
+ resource.sends = uniqueVersions(domain.sends);
690
+ }
691
+ if (Array.isArray(domain.receives)) {
692
+ resource.receives = uniqueVersions(domain.receives);
693
+ }
694
+ if (Array.isArray(domain.dataProducts)) {
695
+ resource.dataProducts = uniqueVersions(domain.dataProducts);
696
+ }
688
697
  return await writeResource(directory, resource, { ...options, type: "domain" });
689
698
  };
690
699
  var versionDomain = (directory) => async (id) => versionResource(directory, id);
@@ -758,6 +767,60 @@ var addEntityToDomain = (directory) => async (id, entity, version) => {
758
767
  await rmDomainById(directory)(id, version, true);
759
768
  await writeDomain(directory)(domain, { format: extension === ".md" ? "md" : "mdx" });
760
769
  };
770
+ var addDataProductToDomain = (directory) => async (id, dataProduct, version) => {
771
+ let domain = await getDomain(directory)(id, version);
772
+ const domainPath = await getResourcePath(directory, id, version);
773
+ const extension = import_node_path8.default.extname(domainPath?.fullPath || "");
774
+ if (domain.dataProducts === void 0) {
775
+ domain.dataProducts = [];
776
+ }
777
+ const dataProductExistsInList = domain.dataProducts.some(
778
+ (dp) => dp.id === dataProduct.id && dp.version === dataProduct.version
779
+ );
780
+ if (dataProductExistsInList) {
781
+ return;
782
+ }
783
+ domain.dataProducts.push(dataProduct);
784
+ await rmDomainById(directory)(id, version, true);
785
+ await writeDomain(directory)(domain, { format: extension === ".md" ? "md" : "mdx" });
786
+ };
787
+ var addMessageToDomain = (directory) => async (id, direction, message, version) => {
788
+ let domain = await getDomain(directory)(id, version);
789
+ const domainPath = await getResourcePath(directory, id, version);
790
+ const extension = import_node_path8.default.extname(domainPath?.fullPath || "");
791
+ if (direction === "sends") {
792
+ if (domain.sends === void 0) {
793
+ domain.sends = [];
794
+ }
795
+ for (let i = 0; i < domain.sends.length; i++) {
796
+ if (domain.sends[i].id === message.id && domain.sends[i].version === message.version) {
797
+ return;
798
+ }
799
+ }
800
+ domain.sends.push({ id: message.id, version: message.version });
801
+ } else if (direction === "receives") {
802
+ if (domain.receives === void 0) {
803
+ domain.receives = [];
804
+ }
805
+ for (let i = 0; i < domain.receives.length; i++) {
806
+ if (domain.receives[i].id === message.id && domain.receives[i].version === message.version) {
807
+ return;
808
+ }
809
+ }
810
+ domain.receives.push({ id: message.id, version: message.version });
811
+ } else {
812
+ throw new Error(`Direction ${direction} is invalid, only 'receives' and 'sends' are supported`);
813
+ }
814
+ const existingResource = await findFileById(directory, id, version);
815
+ if (!existingResource) {
816
+ throw new Error(`Cannot find domain ${id} in the catalog`);
817
+ }
818
+ const normalizedPath = existingResource.replace(/\\/g, "/");
819
+ const lastDomainsIndex = normalizedPath.lastIndexOf("/domains/");
820
+ const pathToResource = existingResource.substring(0, lastDomainsIndex + "/domains".length);
821
+ await rmDomainById(directory)(id, version, true);
822
+ await writeDomain(pathToResource)(domain, { format: extension === ".md" ? "md" : "mdx" });
823
+ };
761
824
 
762
825
  // src/channels.ts
763
826
  var import_promises7 = __toESM(require("fs/promises"));
@@ -1221,6 +1284,34 @@ var dataStoreHasVersion = containerHasVersion;
1221
1284
  var addFileToDataStore = addFileToContainer;
1222
1285
  var writeDataStoreToService = writeContainerToService;
1223
1286
 
1287
+ // src/data-products.ts
1288
+ var import_promises12 = __toESM(require("fs/promises"));
1289
+ var import_node_path18 = require("path");
1290
+ var getDataProduct = (directory) => async (id, version) => getResource(directory, id, version, { type: "data-product" });
1291
+ var getDataProducts = (directory) => async (options) => getResources(directory, { type: "data-products", latestOnly: options?.latestOnly });
1292
+ var writeDataProduct = (directory) => async (dataProduct, options = {
1293
+ path: "",
1294
+ override: false,
1295
+ format: "mdx"
1296
+ }) => writeResource(directory, { ...dataProduct }, { ...options, type: "data-product" });
1297
+ var writeDataProductToDomain = (directory) => async (dataProduct, domain, options = { path: "", format: "mdx", override: false }) => {
1298
+ let pathForDataProduct = domain.version && domain.version !== "latest" ? `/${domain.id}/versioned/${domain.version}/data-products` : `/${domain.id}/data-products`;
1299
+ pathForDataProduct = (0, import_node_path18.join)(pathForDataProduct, dataProduct.id);
1300
+ await writeResource(directory, { ...dataProduct }, { ...options, path: pathForDataProduct, type: "data-product" });
1301
+ };
1302
+ var rmDataProduct = (directory) => async (path6) => {
1303
+ await import_promises12.default.rm((0, import_node_path18.join)(directory, path6), { recursive: true });
1304
+ };
1305
+ var rmDataProductById = (directory) => async (id, version, persistFiles) => {
1306
+ await rmResourceById(directory, id, version, { type: "data-product", persistFiles });
1307
+ };
1308
+ var versionDataProduct = (directory) => async (id) => versionResource(directory, id);
1309
+ var dataProductHasVersion = (directory) => async (id, version) => {
1310
+ const file = await findFileById(directory, id, version);
1311
+ return !!file;
1312
+ };
1313
+ var addFileToDataProduct = (directory) => async (id, file, version) => addFileToResource(directory, id, file, version);
1314
+
1224
1315
  // src/index.ts
1225
1316
  var src_default = (path6) => {
1226
1317
  return {
@@ -1230,13 +1321,13 @@ var src_default = (path6) => {
1230
1321
  * @param version - Optional id of the version to get (supports semver)
1231
1322
  * @returns Event|Undefined
1232
1323
  */
1233
- getEvent: getEvent((0, import_node_path18.join)(path6)),
1324
+ getEvent: getEvent((0, import_node_path19.join)(path6)),
1234
1325
  /**
1235
1326
  * Returns all events from EventCatalog
1236
1327
  * @param latestOnly - optional boolean, set to true to get only latest versions
1237
1328
  * @returns Event[]|Undefined
1238
1329
  */
1239
- getEvents: getEvents((0, import_node_path18.join)(path6)),
1330
+ getEvents: getEvents((0, import_node_path19.join)(path6)),
1240
1331
  /**
1241
1332
  * Adds an event to EventCatalog
1242
1333
  *
@@ -1244,7 +1335,7 @@ var src_default = (path6) => {
1244
1335
  * @param options - Optional options to write the event
1245
1336
  *
1246
1337
  */
1247
- writeEvent: writeEvent((0, import_node_path18.join)(path6, "events")),
1338
+ writeEvent: writeEvent((0, import_node_path19.join)(path6, "events")),
1248
1339
  /**
1249
1340
  * Adds an event to a service in EventCatalog
1250
1341
  *
@@ -1253,26 +1344,26 @@ var src_default = (path6) => {
1253
1344
  * @param options - Optional options to write the event
1254
1345
  *
1255
1346
  */
1256
- writeEventToService: writeEventToService((0, import_node_path18.join)(path6)),
1347
+ writeEventToService: writeEventToService((0, import_node_path19.join)(path6)),
1257
1348
  /**
1258
1349
  * Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
1259
1350
  *
1260
1351
  * @param path - The path to your event, e.g. `/Inventory/InventoryAdjusted`
1261
1352
  *
1262
1353
  */
1263
- rmEvent: rmEvent((0, import_node_path18.join)(path6, "events")),
1354
+ rmEvent: rmEvent((0, import_node_path19.join)(path6, "events")),
1264
1355
  /**
1265
1356
  * Remove an event by an Event id
1266
1357
  *
1267
1358
  * @param id - The id of the event you want to remove
1268
1359
  *
1269
1360
  */
1270
- rmEventById: rmEventById((0, import_node_path18.join)(path6)),
1361
+ rmEventById: rmEventById((0, import_node_path19.join)(path6)),
1271
1362
  /**
1272
1363
  * Moves a given event id to the version directory
1273
1364
  * @param directory
1274
1365
  */
1275
- versionEvent: versionEvent((0, import_node_path18.join)(path6)),
1366
+ versionEvent: versionEvent((0, import_node_path19.join)(path6)),
1276
1367
  /**
1277
1368
  * Adds a file to the given event
1278
1369
  * @param id - The id of the event to add the file to
@@ -1280,7 +1371,7 @@ var src_default = (path6) => {
1280
1371
  * @param version - Optional version of the event to add the file to
1281
1372
  * @returns
1282
1373
  */
1283
- addFileToEvent: addFileToEvent((0, import_node_path18.join)(path6)),
1374
+ addFileToEvent: addFileToEvent((0, import_node_path19.join)(path6)),
1284
1375
  /**
1285
1376
  * Adds a schema to the given event
1286
1377
  * @param id - The id of the event to add the schema to
@@ -1288,14 +1379,14 @@ var src_default = (path6) => {
1288
1379
  * @param version - Optional version of the event to add the schema to
1289
1380
  * @returns
1290
1381
  */
1291
- addSchemaToEvent: addSchemaToEvent((0, import_node_path18.join)(path6)),
1382
+ addSchemaToEvent: addSchemaToEvent((0, import_node_path19.join)(path6)),
1292
1383
  /**
1293
1384
  * Check to see if an event version exists
1294
1385
  * @param id - The id of the event
1295
1386
  * @param version - The version of the event (supports semver)
1296
1387
  * @returns
1297
1388
  */
1298
- eventHasVersion: eventHasVersion((0, import_node_path18.join)(path6)),
1389
+ eventHasVersion: eventHasVersion((0, import_node_path19.join)(path6)),
1299
1390
  /**
1300
1391
  * ================================
1301
1392
  * Commands
@@ -1307,13 +1398,13 @@ var src_default = (path6) => {
1307
1398
  * @param version - Optional id of the version to get (supports semver)
1308
1399
  * @returns Command|Undefined
1309
1400
  */
1310
- getCommand: getCommand((0, import_node_path18.join)(path6)),
1401
+ getCommand: getCommand((0, import_node_path19.join)(path6)),
1311
1402
  /**
1312
1403
  * Returns all commands from EventCatalog
1313
1404
  * @param latestOnly - optional boolean, set to true to get only latest versions
1314
1405
  * @returns Command[]|Undefined
1315
1406
  */
1316
- getCommands: getCommands((0, import_node_path18.join)(path6)),
1407
+ getCommands: getCommands((0, import_node_path19.join)(path6)),
1317
1408
  /**
1318
1409
  * Adds an command to EventCatalog
1319
1410
  *
@@ -1321,7 +1412,7 @@ var src_default = (path6) => {
1321
1412
  * @param options - Optional options to write the command
1322
1413
  *
1323
1414
  */
1324
- writeCommand: writeCommand((0, import_node_path18.join)(path6, "commands")),
1415
+ writeCommand: writeCommand((0, import_node_path19.join)(path6, "commands")),
1325
1416
  /**
1326
1417
  * Adds a command to a service in EventCatalog
1327
1418
  *
@@ -1330,26 +1421,26 @@ var src_default = (path6) => {
1330
1421
  * @param options - Optional options to write the command
1331
1422
  *
1332
1423
  */
1333
- writeCommandToService: writeCommandToService((0, import_node_path18.join)(path6)),
1424
+ writeCommandToService: writeCommandToService((0, import_node_path19.join)(path6)),
1334
1425
  /**
1335
1426
  * Remove an command to EventCatalog (modeled on the standard POSIX rm utility)
1336
1427
  *
1337
1428
  * @param path - The path to your command, e.g. `/Inventory/InventoryAdjusted`
1338
1429
  *
1339
1430
  */
1340
- rmCommand: rmCommand((0, import_node_path18.join)(path6, "commands")),
1431
+ rmCommand: rmCommand((0, import_node_path19.join)(path6, "commands")),
1341
1432
  /**
1342
1433
  * Remove an command by an Event id
1343
1434
  *
1344
1435
  * @param id - The id of the command you want to remove
1345
1436
  *
1346
1437
  */
1347
- rmCommandById: rmCommandById((0, import_node_path18.join)(path6)),
1438
+ rmCommandById: rmCommandById((0, import_node_path19.join)(path6)),
1348
1439
  /**
1349
1440
  * Moves a given command id to the version directory
1350
1441
  * @param directory
1351
1442
  */
1352
- versionCommand: versionCommand((0, import_node_path18.join)(path6)),
1443
+ versionCommand: versionCommand((0, import_node_path19.join)(path6)),
1353
1444
  /**
1354
1445
  * Adds a file to the given command
1355
1446
  * @param id - The id of the command to add the file to
@@ -1357,7 +1448,7 @@ var src_default = (path6) => {
1357
1448
  * @param version - Optional version of the command to add the file to
1358
1449
  * @returns
1359
1450
  */
1360
- addFileToCommand: addFileToCommand((0, import_node_path18.join)(path6)),
1451
+ addFileToCommand: addFileToCommand((0, import_node_path19.join)(path6)),
1361
1452
  /**
1362
1453
  * Adds a schema to the given command
1363
1454
  * @param id - The id of the command to add the schema to
@@ -1365,14 +1456,14 @@ var src_default = (path6) => {
1365
1456
  * @param version - Optional version of the command to add the schema to
1366
1457
  * @returns
1367
1458
  */
1368
- addSchemaToCommand: addSchemaToCommand((0, import_node_path18.join)(path6)),
1459
+ addSchemaToCommand: addSchemaToCommand((0, import_node_path19.join)(path6)),
1369
1460
  /**
1370
1461
  * Check to see if a command version exists
1371
1462
  * @param id - The id of the command
1372
1463
  * @param version - The version of the command (supports semver)
1373
1464
  * @returns
1374
1465
  */
1375
- commandHasVersion: commandHasVersion((0, import_node_path18.join)(path6)),
1466
+ commandHasVersion: commandHasVersion((0, import_node_path19.join)(path6)),
1376
1467
  /**
1377
1468
  * ================================
1378
1469
  * Queries
@@ -1384,13 +1475,13 @@ var src_default = (path6) => {
1384
1475
  * @param version - Optional id of the version to get (supports semver)
1385
1476
  * @returns Query|Undefined
1386
1477
  */
1387
- getQuery: getQuery((0, import_node_path18.join)(path6)),
1478
+ getQuery: getQuery((0, import_node_path19.join)(path6)),
1388
1479
  /**
1389
1480
  * Returns all queries from EventCatalog
1390
1481
  * @param latestOnly - optional boolean, set to true to get only latest versions
1391
1482
  * @returns Query[]|Undefined
1392
1483
  */
1393
- getQueries: getQueries((0, import_node_path18.join)(path6)),
1484
+ getQueries: getQueries((0, import_node_path19.join)(path6)),
1394
1485
  /**
1395
1486
  * Adds a query to EventCatalog
1396
1487
  *
@@ -1398,7 +1489,7 @@ var src_default = (path6) => {
1398
1489
  * @param options - Optional options to write the event
1399
1490
  *
1400
1491
  */
1401
- writeQuery: writeQuery((0, import_node_path18.join)(path6, "queries")),
1492
+ writeQuery: writeQuery((0, import_node_path19.join)(path6, "queries")),
1402
1493
  /**
1403
1494
  * Adds a query to a service in EventCatalog
1404
1495
  *
@@ -1407,26 +1498,26 @@ var src_default = (path6) => {
1407
1498
  * @param options - Optional options to write the query
1408
1499
  *
1409
1500
  */
1410
- writeQueryToService: writeQueryToService((0, import_node_path18.join)(path6)),
1501
+ writeQueryToService: writeQueryToService((0, import_node_path19.join)(path6)),
1411
1502
  /**
1412
1503
  * Remove an query to EventCatalog (modeled on the standard POSIX rm utility)
1413
1504
  *
1414
1505
  * @param path - The path to your query, e.g. `/Orders/GetOrder`
1415
1506
  *
1416
1507
  */
1417
- rmQuery: rmQuery((0, import_node_path18.join)(path6, "queries")),
1508
+ rmQuery: rmQuery((0, import_node_path19.join)(path6, "queries")),
1418
1509
  /**
1419
1510
  * Remove a query by a Query id
1420
1511
  *
1421
1512
  * @param id - The id of the query you want to remove
1422
1513
  *
1423
1514
  */
1424
- rmQueryById: rmQueryById((0, import_node_path18.join)(path6)),
1515
+ rmQueryById: rmQueryById((0, import_node_path19.join)(path6)),
1425
1516
  /**
1426
1517
  * Moves a given query id to the version directory
1427
1518
  * @param directory
1428
1519
  */
1429
- versionQuery: versionQuery((0, import_node_path18.join)(path6)),
1520
+ versionQuery: versionQuery((0, import_node_path19.join)(path6)),
1430
1521
  /**
1431
1522
  * Adds a file to the given query
1432
1523
  * @param id - The id of the query to add the file to
@@ -1434,7 +1525,7 @@ var src_default = (path6) => {
1434
1525
  * @param version - Optional version of the query to add the file to
1435
1526
  * @returns
1436
1527
  */
1437
- addFileToQuery: addFileToQuery((0, import_node_path18.join)(path6)),
1528
+ addFileToQuery: addFileToQuery((0, import_node_path19.join)(path6)),
1438
1529
  /**
1439
1530
  * Adds a schema to the given query
1440
1531
  * @param id - The id of the query to add the schema to
@@ -1442,14 +1533,14 @@ var src_default = (path6) => {
1442
1533
  * @param version - Optional version of the query to add the schema to
1443
1534
  * @returns
1444
1535
  */
1445
- addSchemaToQuery: addSchemaToQuery((0, import_node_path18.join)(path6)),
1536
+ addSchemaToQuery: addSchemaToQuery((0, import_node_path19.join)(path6)),
1446
1537
  /**
1447
1538
  * Check to see if an query version exists
1448
1539
  * @param id - The id of the query
1449
1540
  * @param version - The version of the query (supports semver)
1450
1541
  * @returns
1451
1542
  */
1452
- queryHasVersion: queryHasVersion((0, import_node_path18.join)(path6)),
1543
+ queryHasVersion: queryHasVersion((0, import_node_path19.join)(path6)),
1453
1544
  /**
1454
1545
  * ================================
1455
1546
  * Channels
@@ -1461,13 +1552,13 @@ var src_default = (path6) => {
1461
1552
  * @param version - Optional id of the version to get (supports semver)
1462
1553
  * @returns Channel|Undefined
1463
1554
  */
1464
- getChannel: getChannel((0, import_node_path18.join)(path6)),
1555
+ getChannel: getChannel((0, import_node_path19.join)(path6)),
1465
1556
  /**
1466
1557
  * Returns all channels from EventCatalog
1467
1558
  * @param latestOnly - optional boolean, set to true to get only latest versions
1468
1559
  * @returns Channel[]|Undefined
1469
1560
  */
1470
- getChannels: getChannels((0, import_node_path18.join)(path6)),
1561
+ getChannels: getChannels((0, import_node_path19.join)(path6)),
1471
1562
  /**
1472
1563
  * Adds an channel to EventCatalog
1473
1564
  *
@@ -1475,33 +1566,33 @@ var src_default = (path6) => {
1475
1566
  * @param options - Optional options to write the channel
1476
1567
  *
1477
1568
  */
1478
- writeChannel: writeChannel((0, import_node_path18.join)(path6, "channels")),
1569
+ writeChannel: writeChannel((0, import_node_path19.join)(path6, "channels")),
1479
1570
  /**
1480
1571
  * Remove an channel to EventCatalog (modeled on the standard POSIX rm utility)
1481
1572
  *
1482
1573
  * @param path - The path to your channel, e.g. `/Inventory/InventoryAdjusted`
1483
1574
  *
1484
1575
  */
1485
- rmChannel: rmChannel((0, import_node_path18.join)(path6, "channels")),
1576
+ rmChannel: rmChannel((0, import_node_path19.join)(path6, "channels")),
1486
1577
  /**
1487
1578
  * Remove an channel by an Event id
1488
1579
  *
1489
1580
  * @param id - The id of the channel you want to remove
1490
1581
  *
1491
1582
  */
1492
- rmChannelById: rmChannelById((0, import_node_path18.join)(path6)),
1583
+ rmChannelById: rmChannelById((0, import_node_path19.join)(path6)),
1493
1584
  /**
1494
1585
  * Moves a given channel id to the version directory
1495
1586
  * @param directory
1496
1587
  */
1497
- versionChannel: versionChannel((0, import_node_path18.join)(path6)),
1588
+ versionChannel: versionChannel((0, import_node_path19.join)(path6)),
1498
1589
  /**
1499
1590
  * Check to see if a channel version exists
1500
1591
  * @param id - The id of the channel
1501
1592
  * @param version - The version of the channel (supports semver)
1502
1593
  * @returns
1503
1594
  */
1504
- channelHasVersion: channelHasVersion((0, import_node_path18.join)(path6)),
1595
+ channelHasVersion: channelHasVersion((0, import_node_path19.join)(path6)),
1505
1596
  /**
1506
1597
  * Add a channel to an event
1507
1598
  *
@@ -1518,7 +1609,7 @@ var src_default = (path6) => {
1518
1609
  *
1519
1610
  * ```
1520
1611
  */
1521
- addEventToChannel: addMessageToChannel((0, import_node_path18.join)(path6), "events"),
1612
+ addEventToChannel: addMessageToChannel((0, import_node_path19.join)(path6), "events"),
1522
1613
  /**
1523
1614
  * Add a channel to an command
1524
1615
  *
@@ -1535,7 +1626,7 @@ var src_default = (path6) => {
1535
1626
  *
1536
1627
  * ```
1537
1628
  */
1538
- addCommandToChannel: addMessageToChannel((0, import_node_path18.join)(path6), "commands"),
1629
+ addCommandToChannel: addMessageToChannel((0, import_node_path19.join)(path6), "commands"),
1539
1630
  /**
1540
1631
  * Add a channel to an query
1541
1632
  *
@@ -1552,7 +1643,7 @@ var src_default = (path6) => {
1552
1643
  *
1553
1644
  * ```
1554
1645
  */
1555
- addQueryToChannel: addMessageToChannel((0, import_node_path18.join)(path6), "queries"),
1646
+ addQueryToChannel: addMessageToChannel((0, import_node_path19.join)(path6), "queries"),
1556
1647
  /**
1557
1648
  * ================================
1558
1649
  * SERVICES
@@ -1565,14 +1656,14 @@ var src_default = (path6) => {
1565
1656
  * @param options - Optional options to write the event
1566
1657
  *
1567
1658
  */
1568
- writeService: writeService((0, import_node_path18.join)(path6, "services")),
1659
+ writeService: writeService((0, import_node_path19.join)(path6, "services")),
1569
1660
  /**
1570
1661
  * Adds a versioned service to EventCatalog
1571
1662
  *
1572
1663
  * @param service - The service to write
1573
1664
  *
1574
1665
  */
1575
- writeVersionedService: writeVersionedService((0, import_node_path18.join)(path6, "services")),
1666
+ writeVersionedService: writeVersionedService((0, import_node_path19.join)(path6, "services")),
1576
1667
  /**
1577
1668
  * Adds a service to a domain in EventCatalog
1578
1669
  *
@@ -1581,45 +1672,45 @@ var src_default = (path6) => {
1581
1672
  * @param options - Optional options to write the event
1582
1673
  *
1583
1674
  */
1584
- writeServiceToDomain: writeServiceToDomain((0, import_node_path18.join)(path6, "domains")),
1675
+ writeServiceToDomain: writeServiceToDomain((0, import_node_path19.join)(path6, "domains")),
1585
1676
  /**
1586
1677
  * Returns a service from EventCatalog
1587
1678
  * @param id - The id of the service to retrieve
1588
1679
  * @param version - Optional id of the version to get (supports semver)
1589
1680
  * @returns Service|Undefined
1590
1681
  */
1591
- getService: getService((0, import_node_path18.join)(path6)),
1682
+ getService: getService((0, import_node_path19.join)(path6)),
1592
1683
  /**
1593
1684
  * Returns a service from EventCatalog by it's path.
1594
1685
  * @param path - The path to the service to retrieve
1595
1686
  * @returns Service|Undefined
1596
1687
  */
1597
- getServiceByPath: getServiceByPath((0, import_node_path18.join)(path6)),
1688
+ getServiceByPath: getServiceByPath((0, import_node_path19.join)(path6)),
1598
1689
  /**
1599
1690
  * Returns all services from EventCatalog
1600
1691
  * @param latestOnly - optional boolean, set to true to get only latest versions
1601
1692
  * @returns Service[]|Undefined
1602
1693
  */
1603
- getServices: getServices((0, import_node_path18.join)(path6)),
1694
+ getServices: getServices((0, import_node_path19.join)(path6)),
1604
1695
  /**
1605
1696
  * Moves a given service id to the version directory
1606
1697
  * @param directory
1607
1698
  */
1608
- versionService: versionService((0, import_node_path18.join)(path6)),
1699
+ versionService: versionService((0, import_node_path19.join)(path6)),
1609
1700
  /**
1610
1701
  * Remove a service from EventCatalog (modeled on the standard POSIX rm utility)
1611
1702
  *
1612
1703
  * @param path - The path to your service, e.g. `/InventoryService`
1613
1704
  *
1614
1705
  */
1615
- rmService: rmService((0, import_node_path18.join)(path6, "services")),
1706
+ rmService: rmService((0, import_node_path19.join)(path6, "services")),
1616
1707
  /**
1617
1708
  * Remove an service by an service id
1618
1709
  *
1619
1710
  * @param id - The id of the service you want to remove
1620
1711
  *
1621
1712
  */
1622
- rmServiceById: rmServiceById((0, import_node_path18.join)(path6)),
1713
+ rmServiceById: rmServiceById((0, import_node_path19.join)(path6)),
1623
1714
  /**
1624
1715
  * Adds a file to the given service
1625
1716
  * @param id - The id of the service to add the file to
@@ -1627,21 +1718,21 @@ var src_default = (path6) => {
1627
1718
  * @param version - Optional version of the service to add the file to
1628
1719
  * @returns
1629
1720
  */
1630
- addFileToService: addFileToService((0, import_node_path18.join)(path6)),
1721
+ addFileToService: addFileToService((0, import_node_path19.join)(path6)),
1631
1722
  /**
1632
1723
  * Returns the specifications for a given service
1633
1724
  * @param id - The id of the service to retrieve the specifications for
1634
1725
  * @param version - Optional version of the service
1635
1726
  * @returns
1636
1727
  */
1637
- getSpecificationFilesForService: getSpecificationFilesForService((0, import_node_path18.join)(path6)),
1728
+ getSpecificationFilesForService: getSpecificationFilesForService((0, import_node_path19.join)(path6)),
1638
1729
  /**
1639
1730
  * Check to see if a service version exists
1640
1731
  * @param id - The id of the service
1641
1732
  * @param version - The version of the service (supports semver)
1642
1733
  * @returns
1643
1734
  */
1644
- serviceHasVersion: serviceHasVersion((0, import_node_path18.join)(path6)),
1735
+ serviceHasVersion: serviceHasVersion((0, import_node_path19.join)(path6)),
1645
1736
  /**
1646
1737
  * Add an event to a service by it's id.
1647
1738
  *
@@ -1661,7 +1752,7 @@ var src_default = (path6) => {
1661
1752
  *
1662
1753
  * ```
1663
1754
  */
1664
- addEventToService: addMessageToService((0, import_node_path18.join)(path6)),
1755
+ addEventToService: addMessageToService((0, import_node_path19.join)(path6)),
1665
1756
  /**
1666
1757
  * Add a data store to a service by it's id.
1667
1758
  *
@@ -1678,7 +1769,7 @@ var src_default = (path6) => {
1678
1769
  *
1679
1770
  * ```
1680
1771
  */
1681
- addDataStoreToService: addDataStoreToService((0, import_node_path18.join)(path6)),
1772
+ addDataStoreToService: addDataStoreToService((0, import_node_path19.join)(path6)),
1682
1773
  /**
1683
1774
  * Add a command to a service by it's id.
1684
1775
  *
@@ -1698,7 +1789,7 @@ var src_default = (path6) => {
1698
1789
  *
1699
1790
  * ```
1700
1791
  */
1701
- addCommandToService: addMessageToService((0, import_node_path18.join)(path6)),
1792
+ addCommandToService: addMessageToService((0, import_node_path19.join)(path6)),
1702
1793
  /**
1703
1794
  * Add a query to a service by it's id.
1704
1795
  *
@@ -1718,7 +1809,7 @@ var src_default = (path6) => {
1718
1809
  *
1719
1810
  * ```
1720
1811
  */
1721
- addQueryToService: addMessageToService((0, import_node_path18.join)(path6)),
1812
+ addQueryToService: addMessageToService((0, import_node_path19.join)(path6)),
1722
1813
  /**
1723
1814
  * Add an entity to a service by its id.
1724
1815
  *
@@ -1736,7 +1827,7 @@ var src_default = (path6) => {
1736
1827
  *
1737
1828
  * ```
1738
1829
  */
1739
- addEntityToService: addEntityToService((0, import_node_path18.join)(path6)),
1830
+ addEntityToService: addEntityToService((0, import_node_path19.join)(path6)),
1740
1831
  /**
1741
1832
  * Check to see if a service exists by it's path.
1742
1833
  *
@@ -1753,13 +1844,13 @@ var src_default = (path6) => {
1753
1844
  * @param path - The path to the service to check
1754
1845
  * @returns boolean
1755
1846
  */
1756
- isService: isService((0, import_node_path18.join)(path6)),
1847
+ isService: isService((0, import_node_path19.join)(path6)),
1757
1848
  /**
1758
1849
  * Converts a file to a service.
1759
1850
  * @param file - The file to convert to a service.
1760
1851
  * @returns The service.
1761
1852
  */
1762
- toService: toService((0, import_node_path18.join)(path6)),
1853
+ toService: toService((0, import_node_path19.join)(path6)),
1763
1854
  /**
1764
1855
  * ================================
1765
1856
  * Domains
@@ -1772,39 +1863,39 @@ var src_default = (path6) => {
1772
1863
  * @param options - Optional options to write the event
1773
1864
  *
1774
1865
  */
1775
- writeDomain: writeDomain((0, import_node_path18.join)(path6, "domains")),
1866
+ writeDomain: writeDomain((0, import_node_path19.join)(path6, "domains")),
1776
1867
  /**
1777
1868
  * Returns a domain from EventCatalog
1778
1869
  * @param id - The id of the domain to retrieve
1779
1870
  * @param version - Optional id of the version to get (supports semver)
1780
1871
  * @returns Domain|Undefined
1781
1872
  */
1782
- getDomain: getDomain((0, import_node_path18.join)(path6, "domains")),
1873
+ getDomain: getDomain((0, import_node_path19.join)(path6, "domains")),
1783
1874
  /**
1784
1875
  * Returns all domains from EventCatalog
1785
1876
  * @param latestOnly - optional boolean, set to true to get only latest versions
1786
1877
  * @returns Domain[]|Undefined
1787
1878
  */
1788
- getDomains: getDomains((0, import_node_path18.join)(path6)),
1879
+ getDomains: getDomains((0, import_node_path19.join)(path6)),
1789
1880
  /**
1790
1881
  * Moves a given domain id to the version directory
1791
1882
  * @param directory
1792
1883
  */
1793
- versionDomain: versionDomain((0, import_node_path18.join)(path6, "domains")),
1884
+ versionDomain: versionDomain((0, import_node_path19.join)(path6, "domains")),
1794
1885
  /**
1795
1886
  * Remove a domain from EventCatalog (modeled on the standard POSIX rm utility)
1796
1887
  *
1797
1888
  * @param path - The path to your domain, e.g. `/Payment`
1798
1889
  *
1799
1890
  */
1800
- rmDomain: rmDomain((0, import_node_path18.join)(path6, "domains")),
1891
+ rmDomain: rmDomain((0, import_node_path19.join)(path6, "domains")),
1801
1892
  /**
1802
1893
  * Remove an service by an domain id
1803
1894
  *
1804
1895
  * @param id - The id of the domain you want to remove
1805
1896
  *
1806
1897
  */
1807
- rmDomainById: rmDomainById((0, import_node_path18.join)(path6, "domains")),
1898
+ rmDomainById: rmDomainById((0, import_node_path19.join)(path6, "domains")),
1808
1899
  /**
1809
1900
  * Adds a file to the given domain
1810
1901
  * @param id - The id of the domain to add the file to
@@ -1812,28 +1903,28 @@ var src_default = (path6) => {
1812
1903
  * @param version - Optional version of the domain to add the file to
1813
1904
  * @returns
1814
1905
  */
1815
- addFileToDomain: addFileToDomain((0, import_node_path18.join)(path6, "domains")),
1906
+ addFileToDomain: addFileToDomain((0, import_node_path19.join)(path6, "domains")),
1816
1907
  /**
1817
1908
  * Adds an ubiquitous language dictionary to a domain
1818
1909
  * @param id - The id of the domain to add the ubiquitous language to
1819
1910
  * @param ubiquitousLanguageDictionary - The ubiquitous language dictionary to add
1820
1911
  * @param version - Optional version of the domain to add the ubiquitous language to
1821
1912
  */
1822
- addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain((0, import_node_path18.join)(path6, "domains")),
1913
+ addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain((0, import_node_path19.join)(path6, "domains")),
1823
1914
  /**
1824
1915
  * Get the ubiquitous language dictionary from a domain
1825
1916
  * @param id - The id of the domain to get the ubiquitous language from
1826
1917
  * @param version - Optional version of the domain to get the ubiquitous language from
1827
1918
  * @returns
1828
1919
  */
1829
- getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain((0, import_node_path18.join)(path6, "domains")),
1920
+ getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain((0, import_node_path19.join)(path6, "domains")),
1830
1921
  /**
1831
1922
  * Check to see if a domain version exists
1832
1923
  * @param id - The id of the domain
1833
1924
  * @param version - The version of the domain (supports semver)
1834
1925
  * @returns
1835
1926
  */
1836
- domainHasVersion: domainHasVersion((0, import_node_path18.join)(path6)),
1927
+ domainHasVersion: domainHasVersion((0, import_node_path19.join)(path6)),
1837
1928
  /**
1838
1929
  * Adds a given service to a domain
1839
1930
  * @param id - The id of the domain
@@ -1841,7 +1932,7 @@ var src_default = (path6) => {
1841
1932
  * @param version - (Optional) The version of the domain to add the service to
1842
1933
  * @returns
1843
1934
  */
1844
- addServiceToDomain: addServiceToDomain((0, import_node_path18.join)(path6, "domains")),
1935
+ addServiceToDomain: addServiceToDomain((0, import_node_path19.join)(path6, "domains")),
1845
1936
  /**
1846
1937
  * Adds a given subdomain to a domain
1847
1938
  * @param id - The id of the domain
@@ -1849,7 +1940,7 @@ var src_default = (path6) => {
1849
1940
  * @param version - (Optional) The version of the domain to add the subdomain to
1850
1941
  * @returns
1851
1942
  */
1852
- addSubDomainToDomain: addSubDomainToDomain((0, import_node_path18.join)(path6, "domains")),
1943
+ addSubDomainToDomain: addSubDomainToDomain((0, import_node_path19.join)(path6, "domains")),
1853
1944
  /**
1854
1945
  * Adds an entity to a domain
1855
1946
  * @param id - The id of the domain
@@ -1857,7 +1948,61 @@ var src_default = (path6) => {
1857
1948
  * @param version - (Optional) The version of the domain to add the entity to
1858
1949
  * @returns
1859
1950
  */
1860
- addEntityToDomain: addEntityToDomain((0, import_node_path18.join)(path6, "domains")),
1951
+ addEntityToDomain: addEntityToDomain((0, import_node_path19.join)(path6, "domains")),
1952
+ /**
1953
+ * Add an event to a domain by its id.
1954
+ *
1955
+ * @example
1956
+ * ```ts
1957
+ * import utils from '@eventcatalog/utils';
1958
+ *
1959
+ * const { addEventToDomain } = utils('/path/to/eventcatalog');
1960
+ *
1961
+ * // adds a new event (OrderCreated) that the Orders domain will send
1962
+ * await addEventToDomain('Orders', 'sends', { id: 'OrderCreated', version: '2.0.0' });
1963
+ *
1964
+ * // adds a new event (PaymentProcessed) that the Orders domain will receive
1965
+ * await addEventToDomain('Orders', 'receives', { id: 'PaymentProcessed', version: '2.0.0' });
1966
+ *
1967
+ * ```
1968
+ */
1969
+ addEventToDomain: addMessageToDomain((0, import_node_path19.join)(path6, "domains")),
1970
+ /**
1971
+ * Add a command to a domain by its id.
1972
+ *
1973
+ * @example
1974
+ * ```ts
1975
+ * import utils from '@eventcatalog/utils';
1976
+ *
1977
+ * const { addCommandToDomain } = utils('/path/to/eventcatalog');
1978
+ *
1979
+ * // adds a new command (ProcessOrder) that the Orders domain will send
1980
+ * await addCommandToDomain('Orders', 'sends', { id: 'ProcessOrder', version: '2.0.0' });
1981
+ *
1982
+ * // adds a new command (CancelOrder) that the Orders domain will receive
1983
+ * await addCommandToDomain('Orders', 'receives', { id: 'CancelOrder', version: '2.0.0' });
1984
+ *
1985
+ * ```
1986
+ */
1987
+ addCommandToDomain: addMessageToDomain((0, import_node_path19.join)(path6, "domains")),
1988
+ /**
1989
+ * Add a query to a domain by its id.
1990
+ *
1991
+ * @example
1992
+ * ```ts
1993
+ * import utils from '@eventcatalog/utils';
1994
+ *
1995
+ * const { addQueryToDomain } = utils('/path/to/eventcatalog');
1996
+ *
1997
+ * // adds a new query (GetOrderStatus) that the Orders domain will send
1998
+ * await addQueryToDomain('Orders', 'sends', { id: 'GetOrderStatus', version: '2.0.0' });
1999
+ *
2000
+ * // adds a new query (GetInventory) that the Orders domain will receive
2001
+ * await addQueryToDomain('Orders', 'receives', { id: 'GetInventory', version: '2.0.0' });
2002
+ *
2003
+ * ```
2004
+ */
2005
+ addQueryToDomain: addMessageToDomain((0, import_node_path19.join)(path6, "domains")),
1861
2006
  /**
1862
2007
  * ================================
1863
2008
  * Teams
@@ -1870,25 +2015,25 @@ var src_default = (path6) => {
1870
2015
  * @param options - Optional options to write the team
1871
2016
  *
1872
2017
  */
1873
- writeTeam: writeTeam((0, import_node_path18.join)(path6, "teams")),
2018
+ writeTeam: writeTeam((0, import_node_path19.join)(path6, "teams")),
1874
2019
  /**
1875
2020
  * Returns a team from EventCatalog
1876
2021
  * @param id - The id of the team to retrieve
1877
2022
  * @returns Team|Undefined
1878
2023
  */
1879
- getTeam: getTeam((0, import_node_path18.join)(path6, "teams")),
2024
+ getTeam: getTeam((0, import_node_path19.join)(path6, "teams")),
1880
2025
  /**
1881
2026
  * Returns all teams from EventCatalog
1882
2027
  * @returns Team[]|Undefined
1883
2028
  */
1884
- getTeams: getTeams((0, import_node_path18.join)(path6, "teams")),
2029
+ getTeams: getTeams((0, import_node_path19.join)(path6, "teams")),
1885
2030
  /**
1886
2031
  * Remove a team by the team id
1887
2032
  *
1888
2033
  * @param id - The id of the team you want to remove
1889
2034
  *
1890
2035
  */
1891
- rmTeamById: rmTeamById((0, import_node_path18.join)(path6, "teams")),
2036
+ rmTeamById: rmTeamById((0, import_node_path19.join)(path6, "teams")),
1892
2037
  /**
1893
2038
  * ================================
1894
2039
  * Users
@@ -1901,25 +2046,25 @@ var src_default = (path6) => {
1901
2046
  * @param options - Optional options to write the user
1902
2047
  *
1903
2048
  */
1904
- writeUser: writeUser((0, import_node_path18.join)(path6, "users")),
2049
+ writeUser: writeUser((0, import_node_path19.join)(path6, "users")),
1905
2050
  /**
1906
2051
  * Returns a user from EventCatalog
1907
2052
  * @param id - The id of the user to retrieve
1908
2053
  * @returns User|Undefined
1909
2054
  */
1910
- getUser: getUser((0, import_node_path18.join)(path6, "users")),
2055
+ getUser: getUser((0, import_node_path19.join)(path6, "users")),
1911
2056
  /**
1912
2057
  * Returns all user from EventCatalog
1913
2058
  * @returns User[]|Undefined
1914
2059
  */
1915
- getUsers: getUsers((0, import_node_path18.join)(path6)),
2060
+ getUsers: getUsers((0, import_node_path19.join)(path6)),
1916
2061
  /**
1917
2062
  * Remove a user by the user id
1918
2063
  *
1919
2064
  * @param id - The id of the user you want to remove
1920
2065
  *
1921
2066
  */
1922
- rmUserById: rmUserById((0, import_node_path18.join)(path6, "users")),
2067
+ rmUserById: rmUserById((0, import_node_path19.join)(path6, "users")),
1923
2068
  /**
1924
2069
  * ================================
1925
2070
  * Custom Docs
@@ -1930,32 +2075,32 @@ var src_default = (path6) => {
1930
2075
  * @param path - The path to the custom doc to retrieve
1931
2076
  * @returns CustomDoc|Undefined
1932
2077
  */
1933
- getCustomDoc: getCustomDoc((0, import_node_path18.join)(path6, "docs")),
2078
+ getCustomDoc: getCustomDoc((0, import_node_path19.join)(path6, "docs")),
1934
2079
  /**
1935
2080
  * Returns all custom docs from EventCatalog
1936
2081
  * @param options - Optional options to get custom docs from a specific path
1937
2082
  * @returns CustomDoc[]|Undefined
1938
2083
  */
1939
- getCustomDocs: getCustomDocs((0, import_node_path18.join)(path6, "docs")),
2084
+ getCustomDocs: getCustomDocs((0, import_node_path19.join)(path6, "docs")),
1940
2085
  /**
1941
2086
  * Writes a custom doc to EventCatalog
1942
2087
  * @param customDoc - The custom doc to write
1943
2088
  * @param options - Optional options to write the custom doc
1944
2089
  *
1945
2090
  */
1946
- writeCustomDoc: writeCustomDoc((0, import_node_path18.join)(path6, "docs")),
2091
+ writeCustomDoc: writeCustomDoc((0, import_node_path19.join)(path6, "docs")),
1947
2092
  /**
1948
2093
  * Removes a custom doc from EventCatalog
1949
2094
  * @param path - The path to the custom doc to remove
1950
2095
  *
1951
2096
  */
1952
- rmCustomDoc: rmCustomDoc((0, import_node_path18.join)(path6, "docs")),
2097
+ rmCustomDoc: rmCustomDoc((0, import_node_path19.join)(path6, "docs")),
1953
2098
  /**
1954
2099
  * Dumps the catalog to a JSON file.
1955
2100
  * @param directory - The directory to dump the catalog to
1956
2101
  * @returns A JSON file with the catalog
1957
2102
  */
1958
- dumpCatalog: dumpCatalog((0, import_node_path18.join)(path6)),
2103
+ dumpCatalog: dumpCatalog((0, import_node_path19.join)(path6)),
1959
2104
  /**
1960
2105
  * Returns the event catalog configuration file.
1961
2106
  * The event catalog configuration file is the file that contains the configuration for the event catalog.
@@ -1963,7 +2108,7 @@ var src_default = (path6) => {
1963
2108
  * @param directory - The directory of the catalog.
1964
2109
  * @returns A JSON object with the configuration for the event catalog.
1965
2110
  */
1966
- getEventCatalogConfigurationFile: getEventCatalogConfigurationFile((0, import_node_path18.join)(path6)),
2111
+ getEventCatalogConfigurationFile: getEventCatalogConfigurationFile((0, import_node_path19.join)(path6)),
1967
2112
  /**
1968
2113
  * ================================
1969
2114
  * Resources Utils
@@ -1988,33 +2133,33 @@ var src_default = (path6) => {
1988
2133
  * @param path - The path to the message to retrieve
1989
2134
  * @returns Message|Undefined
1990
2135
  */
1991
- getMessageBySchemaPath: getMessageBySchemaPath((0, import_node_path18.join)(path6)),
2136
+ getMessageBySchemaPath: getMessageBySchemaPath((0, import_node_path19.join)(path6)),
1992
2137
  /**
1993
2138
  * Returns the producers and consumers (services) for a given message
1994
2139
  * @param id - The id of the message to get the producers and consumers for
1995
2140
  * @param version - Optional version of the message
1996
2141
  * @returns { producers: Service[], consumers: Service[] }
1997
2142
  */
1998
- getProducersAndConsumersForMessage: getProducersAndConsumersForMessage((0, import_node_path18.join)(path6)),
2143
+ getProducersAndConsumersForMessage: getProducersAndConsumersForMessage((0, import_node_path19.join)(path6)),
1999
2144
  /**
2000
2145
  * Returns the consumers of a given schema path
2001
2146
  * @param path - The path to the schema to get the consumers for
2002
2147
  * @returns Service[]
2003
2148
  */
2004
- getConsumersOfSchema: getConsumersOfSchema((0, import_node_path18.join)(path6)),
2149
+ getConsumersOfSchema: getConsumersOfSchema((0, import_node_path19.join)(path6)),
2005
2150
  /**
2006
2151
  * Returns the producers of a given schema path
2007
2152
  * @param path - The path to the schema to get the producers for
2008
2153
  * @returns Service[]
2009
2154
  */
2010
- getProducersOfSchema: getProducersOfSchema((0, import_node_path18.join)(path6)),
2155
+ getProducersOfSchema: getProducersOfSchema((0, import_node_path19.join)(path6)),
2011
2156
  /**
2012
2157
  * Returns the owners for a given resource (e.g domain, service, event, command, query, etc.)
2013
2158
  * @param id - The id of the resource to get the owners for
2014
2159
  * @param version - Optional version of the resource
2015
2160
  * @returns { owners: User[] }
2016
2161
  */
2017
- getOwnersForResource: getOwnersForResource((0, import_node_path18.join)(path6)),
2162
+ getOwnersForResource: getOwnersForResource((0, import_node_path19.join)(path6)),
2018
2163
  /**
2019
2164
  * ================================
2020
2165
  * Entities
@@ -2026,13 +2171,13 @@ var src_default = (path6) => {
2026
2171
  * @param version - Optional id of the version to get (supports semver)
2027
2172
  * @returns Entity|Undefined
2028
2173
  */
2029
- getEntity: getEntity((0, import_node_path18.join)(path6)),
2174
+ getEntity: getEntity((0, import_node_path19.join)(path6)),
2030
2175
  /**
2031
2176
  * Returns all entities from EventCatalog
2032
2177
  * @param latestOnly - optional boolean, set to true to get only latest versions
2033
2178
  * @returns Entity[]|Undefined
2034
2179
  */
2035
- getEntities: getEntities((0, import_node_path18.join)(path6)),
2180
+ getEntities: getEntities((0, import_node_path19.join)(path6)),
2036
2181
  /**
2037
2182
  * Adds an entity to EventCatalog
2038
2183
  *
@@ -2040,33 +2185,33 @@ var src_default = (path6) => {
2040
2185
  * @param options - Optional options to write the entity
2041
2186
  *
2042
2187
  */
2043
- writeEntity: writeEntity((0, import_node_path18.join)(path6, "entities")),
2188
+ writeEntity: writeEntity((0, import_node_path19.join)(path6, "entities")),
2044
2189
  /**
2045
2190
  * Remove an entity from EventCatalog (modeled on the standard POSIX rm utility)
2046
2191
  *
2047
2192
  * @param path - The path to your entity, e.g. `/User`
2048
2193
  *
2049
2194
  */
2050
- rmEntity: rmEntity((0, import_node_path18.join)(path6, "entities")),
2195
+ rmEntity: rmEntity((0, import_node_path19.join)(path6, "entities")),
2051
2196
  /**
2052
2197
  * Remove an entity by an entity id
2053
2198
  *
2054
2199
  * @param id - The id of the entity you want to remove
2055
2200
  *
2056
2201
  */
2057
- rmEntityById: rmEntityById((0, import_node_path18.join)(path6)),
2202
+ rmEntityById: rmEntityById((0, import_node_path19.join)(path6)),
2058
2203
  /**
2059
2204
  * Moves a given entity id to the version directory
2060
2205
  * @param id - The id of the entity to version
2061
2206
  */
2062
- versionEntity: versionEntity((0, import_node_path18.join)(path6)),
2207
+ versionEntity: versionEntity((0, import_node_path19.join)(path6)),
2063
2208
  /**
2064
2209
  * Check to see if an entity version exists
2065
2210
  * @param id - The id of the entity
2066
2211
  * @param version - The version of the entity (supports semver)
2067
2212
  * @returns
2068
2213
  */
2069
- entityHasVersion: entityHasVersion((0, import_node_path18.join)(path6)),
2214
+ entityHasVersion: entityHasVersion((0, import_node_path19.join)(path6)),
2070
2215
  /**
2071
2216
  * ================================
2072
2217
  * Data Stores
@@ -2078,42 +2223,42 @@ var src_default = (path6) => {
2078
2223
  * @param options - Optional options to write the data store
2079
2224
  *
2080
2225
  */
2081
- writeDataStore: writeDataStore((0, import_node_path18.join)(path6, "containers")),
2226
+ writeDataStore: writeDataStore((0, import_node_path19.join)(path6, "containers")),
2082
2227
  /**
2083
2228
  * Returns a data store from EventCatalog
2084
2229
  * @param id - The id of the data store to retrieve
2085
2230
  * @param version - Optional id of the version to get (supports semver)
2086
2231
  * @returns Container|Undefined
2087
2232
  */
2088
- getDataStore: getDataStore((0, import_node_path18.join)(path6)),
2233
+ getDataStore: getDataStore((0, import_node_path19.join)(path6)),
2089
2234
  /**
2090
2235
  * Returns all data stores from EventCatalog
2091
2236
  * @param latestOnly - optional boolean, set to true to get only latest versions
2092
2237
  * @returns Container[]|Undefined
2093
2238
  */
2094
- getDataStores: getDataStores((0, import_node_path18.join)(path6)),
2239
+ getDataStores: getDataStores((0, import_node_path19.join)(path6)),
2095
2240
  /**
2096
2241
  * Version a data store by its id
2097
2242
  * @param id - The id of the data store to version
2098
2243
  */
2099
- versionDataStore: versionDataStore((0, import_node_path18.join)(path6, "containers")),
2244
+ versionDataStore: versionDataStore((0, import_node_path19.join)(path6, "containers")),
2100
2245
  /**
2101
2246
  * Remove a data store by its path
2102
2247
  * @param path - The path to the data store to remove
2103
2248
  */
2104
- rmDataStore: rmDataStore((0, import_node_path18.join)(path6, "containers")),
2249
+ rmDataStore: rmDataStore((0, import_node_path19.join)(path6, "containers")),
2105
2250
  /**
2106
2251
  * Remove a data store by its id
2107
2252
  * @param id - The id of the data store to remove
2108
2253
  */
2109
- rmDataStoreById: rmDataStoreById((0, import_node_path18.join)(path6)),
2254
+ rmDataStoreById: rmDataStoreById((0, import_node_path19.join)(path6)),
2110
2255
  /**
2111
2256
  * Check to see if a data store version exists
2112
2257
  * @param id - The id of the data store
2113
2258
  * @param version - The version of the data store (supports semver)
2114
2259
  * @returns
2115
2260
  */
2116
- dataStoreHasVersion: dataStoreHasVersion((0, import_node_path18.join)(path6)),
2261
+ dataStoreHasVersion: dataStoreHasVersion((0, import_node_path19.join)(path6)),
2117
2262
  /**
2118
2263
  * Adds a file to a data store by its id
2119
2264
  * @param id - The id of the data store to add the file to
@@ -2121,14 +2266,86 @@ var src_default = (path6) => {
2121
2266
  * @param version - Optional version of the data store to add the file to
2122
2267
  * @returns
2123
2268
  */
2124
- addFileToDataStore: addFileToDataStore((0, import_node_path18.join)(path6)),
2269
+ addFileToDataStore: addFileToDataStore((0, import_node_path19.join)(path6)),
2125
2270
  /**
2126
2271
  * Writes a data store to a service by its id
2127
2272
  * @param dataStore - The data store to write
2128
2273
  * @param service - The service to write the data store to
2129
2274
  * @returns
2130
2275
  */
2131
- writeDataStoreToService: writeDataStoreToService((0, import_node_path18.join)(path6))
2276
+ writeDataStoreToService: writeDataStoreToService((0, import_node_path19.join)(path6)),
2277
+ /**
2278
+ * ================================
2279
+ * Data Products
2280
+ * ================================
2281
+ */
2282
+ /**
2283
+ * Adds a data product to EventCatalog
2284
+ * @param dataProduct - The data product to write
2285
+ * @param options - Optional options to write the data product
2286
+ *
2287
+ */
2288
+ writeDataProduct: writeDataProduct((0, import_node_path19.join)(path6, "data-products")),
2289
+ /**
2290
+ * Writes a data product to a domain in EventCatalog
2291
+ * @param dataProduct - The data product to write
2292
+ * @param domain - The domain to write the data product to
2293
+ * @param options - Optional options to write the data product
2294
+ *
2295
+ */
2296
+ writeDataProductToDomain: writeDataProductToDomain((0, import_node_path19.join)(path6, "domains")),
2297
+ /**
2298
+ * Returns a data product from EventCatalog
2299
+ * @param id - The id of the data product to retrieve
2300
+ * @param version - Optional id of the version to get (supports semver)
2301
+ * @returns DataProduct|Undefined
2302
+ */
2303
+ getDataProduct: getDataProduct((0, import_node_path19.join)(path6)),
2304
+ /**
2305
+ * Returns all data products from EventCatalog
2306
+ * @param latestOnly - optional boolean, set to true to get only latest versions
2307
+ * @returns DataProduct[]|Undefined
2308
+ */
2309
+ getDataProducts: getDataProducts((0, import_node_path19.join)(path6)),
2310
+ /**
2311
+ * Version a data product by its id
2312
+ * @param id - The id of the data product to version
2313
+ */
2314
+ versionDataProduct: versionDataProduct((0, import_node_path19.join)(path6)),
2315
+ /**
2316
+ * Remove a data product by its path
2317
+ * @param path - The path to the data product to remove
2318
+ */
2319
+ rmDataProduct: rmDataProduct((0, import_node_path19.join)(path6, "data-products")),
2320
+ /**
2321
+ * Remove a data product by its id
2322
+ * @param id - The id of the data product to remove
2323
+ * @param version - Optional version of the data product to remove
2324
+ */
2325
+ rmDataProductById: rmDataProductById((0, import_node_path19.join)(path6)),
2326
+ /**
2327
+ * Check to see if a data product version exists
2328
+ * @param id - The id of the data product
2329
+ * @param version - The version of the data product (supports semver)
2330
+ * @returns
2331
+ */
2332
+ dataProductHasVersion: dataProductHasVersion((0, import_node_path19.join)(path6)),
2333
+ /**
2334
+ * Adds a file to a data product by its id
2335
+ * @param id - The id of the data product to add the file to
2336
+ * @param file - File contents to add including the content and the file name
2337
+ * @param version - Optional version of the data product to add the file to
2338
+ * @returns
2339
+ */
2340
+ addFileToDataProduct: addFileToDataProduct((0, import_node_path19.join)(path6)),
2341
+ /**
2342
+ * Adds a data product to a domain
2343
+ * @param id - The id of the domain
2344
+ * @param dataProduct - The id and version of the data product to add
2345
+ * @param version - (Optional) The version of the domain to add the data product to
2346
+ * @returns
2347
+ */
2348
+ addDataProductToDomain: addDataProductToDomain((0, import_node_path19.join)(path6, "domains"))
2132
2349
  };
2133
2350
  };
2134
2351
  //# sourceMappingURL=index.js.map