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