@eventcatalog/sdk 2.8.0 → 2.8.1

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_path16 = __toESM(require("path"));
38
+ var import_node_path17 = __toESM(require("path"));
39
39
 
40
40
  // src/index.ts
41
- var import_node_path15 = require("path");
41
+ var import_node_path16 = require("path");
42
42
 
43
43
  // src/events.ts
44
44
  var import_promises2 = __toESM(require("fs/promises"));
@@ -1031,6 +1031,38 @@ var entityHasVersion = (directory) => async (id, version) => {
1031
1031
  return !!file;
1032
1032
  };
1033
1033
 
1034
+ // src/containers.ts
1035
+ var import_promises11 = __toESM(require("fs/promises"));
1036
+ var import_node_path15 = require("path");
1037
+ var getContainer = (directory) => async (id, version) => getResource(directory, id, version, { type: "container" });
1038
+ var getContainers = (directory) => async (options) => getResources(directory, { type: "containers", latestOnly: options?.latestOnly });
1039
+ var writeContainer = (directory) => async (data, options = {
1040
+ path: "",
1041
+ override: false,
1042
+ format: "mdx"
1043
+ }) => writeResource(directory, { ...data }, { ...options, type: "container" });
1044
+ var versionContainer = (directory) => async (id) => versionResource(directory, id);
1045
+ var rmContainer = (directory) => async (path5) => {
1046
+ await import_promises11.default.rm((0, import_node_path15.join)(directory, path5), { recursive: true });
1047
+ };
1048
+ var rmContainerById = (directory) => async (id, version, persistFiles) => {
1049
+ await rmResourceById(directory, id, version, { type: "container", persistFiles });
1050
+ };
1051
+ var containerHasVersion = (directory) => async (id, version) => {
1052
+ const file = await findFileById(directory, id, version);
1053
+ return !!file;
1054
+ };
1055
+ var addFileToContainer = (directory) => async (id, file, version) => addFileToResource(directory, id, file, version);
1056
+ var writeContainerToService = (directory) => async (container, service, options = { path: "", format: "mdx", override: false }) => {
1057
+ const resourcePath = await getResourcePath(directory, service.id, service.version);
1058
+ if (!resourcePath) {
1059
+ throw new Error("Service not found");
1060
+ }
1061
+ let pathForContainer = service.version && service.version !== "latest" ? `${resourcePath.directory}/versioned/${service.version}/containers` : `${resourcePath.directory}/containers`;
1062
+ pathForContainer = (0, import_node_path15.join)(pathForContainer, container.id);
1063
+ await writeResource(directory, { ...container }, { ...options, path: pathForContainer, type: "container" });
1064
+ };
1065
+
1034
1066
  // src/index.ts
1035
1067
  var index_default = (path5) => {
1036
1068
  return {
@@ -1040,13 +1072,13 @@ var index_default = (path5) => {
1040
1072
  * @param version - Optional id of the version to get (supports semver)
1041
1073
  * @returns Event|Undefined
1042
1074
  */
1043
- getEvent: getEvent((0, import_node_path15.join)(path5)),
1075
+ getEvent: getEvent((0, import_node_path16.join)(path5)),
1044
1076
  /**
1045
1077
  * Returns all events from EventCatalog
1046
1078
  * @param latestOnly - optional boolean, set to true to get only latest versions
1047
1079
  * @returns Event[]|Undefined
1048
1080
  */
1049
- getEvents: getEvents((0, import_node_path15.join)(path5)),
1081
+ getEvents: getEvents((0, import_node_path16.join)(path5)),
1050
1082
  /**
1051
1083
  * Adds an event to EventCatalog
1052
1084
  *
@@ -1054,7 +1086,7 @@ var index_default = (path5) => {
1054
1086
  * @param options - Optional options to write the event
1055
1087
  *
1056
1088
  */
1057
- writeEvent: writeEvent((0, import_node_path15.join)(path5, "events")),
1089
+ writeEvent: writeEvent((0, import_node_path16.join)(path5, "events")),
1058
1090
  /**
1059
1091
  * Adds an event to a service in EventCatalog
1060
1092
  *
@@ -1063,26 +1095,26 @@ var index_default = (path5) => {
1063
1095
  * @param options - Optional options to write the event
1064
1096
  *
1065
1097
  */
1066
- writeEventToService: writeEventToService((0, import_node_path15.join)(path5)),
1098
+ writeEventToService: writeEventToService((0, import_node_path16.join)(path5)),
1067
1099
  /**
1068
1100
  * Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
1069
1101
  *
1070
1102
  * @param path - The path to your event, e.g. `/Inventory/InventoryAdjusted`
1071
1103
  *
1072
1104
  */
1073
- rmEvent: rmEvent((0, import_node_path15.join)(path5, "events")),
1105
+ rmEvent: rmEvent((0, import_node_path16.join)(path5, "events")),
1074
1106
  /**
1075
1107
  * Remove an event by an Event id
1076
1108
  *
1077
1109
  * @param id - The id of the event you want to remove
1078
1110
  *
1079
1111
  */
1080
- rmEventById: rmEventById((0, import_node_path15.join)(path5)),
1112
+ rmEventById: rmEventById((0, import_node_path16.join)(path5)),
1081
1113
  /**
1082
1114
  * Moves a given event id to the version directory
1083
1115
  * @param directory
1084
1116
  */
1085
- versionEvent: versionEvent((0, import_node_path15.join)(path5)),
1117
+ versionEvent: versionEvent((0, import_node_path16.join)(path5)),
1086
1118
  /**
1087
1119
  * Adds a file to the given event
1088
1120
  * @param id - The id of the event to add the file to
@@ -1090,7 +1122,7 @@ var index_default = (path5) => {
1090
1122
  * @param version - Optional version of the event to add the file to
1091
1123
  * @returns
1092
1124
  */
1093
- addFileToEvent: addFileToEvent((0, import_node_path15.join)(path5)),
1125
+ addFileToEvent: addFileToEvent((0, import_node_path16.join)(path5)),
1094
1126
  /**
1095
1127
  * Adds a schema to the given event
1096
1128
  * @param id - The id of the event to add the schema to
@@ -1098,14 +1130,14 @@ var index_default = (path5) => {
1098
1130
  * @param version - Optional version of the event to add the schema to
1099
1131
  * @returns
1100
1132
  */
1101
- addSchemaToEvent: addSchemaToEvent((0, import_node_path15.join)(path5)),
1133
+ addSchemaToEvent: addSchemaToEvent((0, import_node_path16.join)(path5)),
1102
1134
  /**
1103
1135
  * Check to see if an event version exists
1104
1136
  * @param id - The id of the event
1105
1137
  * @param version - The version of the event (supports semver)
1106
1138
  * @returns
1107
1139
  */
1108
- eventHasVersion: eventHasVersion((0, import_node_path15.join)(path5)),
1140
+ eventHasVersion: eventHasVersion((0, import_node_path16.join)(path5)),
1109
1141
  /**
1110
1142
  * ================================
1111
1143
  * Commands
@@ -1117,13 +1149,13 @@ var index_default = (path5) => {
1117
1149
  * @param version - Optional id of the version to get (supports semver)
1118
1150
  * @returns Command|Undefined
1119
1151
  */
1120
- getCommand: getCommand((0, import_node_path15.join)(path5)),
1152
+ getCommand: getCommand((0, import_node_path16.join)(path5)),
1121
1153
  /**
1122
1154
  * Returns all commands from EventCatalog
1123
1155
  * @param latestOnly - optional boolean, set to true to get only latest versions
1124
1156
  * @returns Command[]|Undefined
1125
1157
  */
1126
- getCommands: getCommands((0, import_node_path15.join)(path5)),
1158
+ getCommands: getCommands((0, import_node_path16.join)(path5)),
1127
1159
  /**
1128
1160
  * Adds an command to EventCatalog
1129
1161
  *
@@ -1131,7 +1163,7 @@ var index_default = (path5) => {
1131
1163
  * @param options - Optional options to write the command
1132
1164
  *
1133
1165
  */
1134
- writeCommand: writeCommand((0, import_node_path15.join)(path5, "commands")),
1166
+ writeCommand: writeCommand((0, import_node_path16.join)(path5, "commands")),
1135
1167
  /**
1136
1168
  * Adds a command to a service in EventCatalog
1137
1169
  *
@@ -1140,26 +1172,26 @@ var index_default = (path5) => {
1140
1172
  * @param options - Optional options to write the command
1141
1173
  *
1142
1174
  */
1143
- writeCommandToService: writeCommandToService((0, import_node_path15.join)(path5)),
1175
+ writeCommandToService: writeCommandToService((0, import_node_path16.join)(path5)),
1144
1176
  /**
1145
1177
  * Remove an command to EventCatalog (modeled on the standard POSIX rm utility)
1146
1178
  *
1147
1179
  * @param path - The path to your command, e.g. `/Inventory/InventoryAdjusted`
1148
1180
  *
1149
1181
  */
1150
- rmCommand: rmCommand((0, import_node_path15.join)(path5, "commands")),
1182
+ rmCommand: rmCommand((0, import_node_path16.join)(path5, "commands")),
1151
1183
  /**
1152
1184
  * Remove an command by an Event id
1153
1185
  *
1154
1186
  * @param id - The id of the command you want to remove
1155
1187
  *
1156
1188
  */
1157
- rmCommandById: rmCommandById((0, import_node_path15.join)(path5)),
1189
+ rmCommandById: rmCommandById((0, import_node_path16.join)(path5)),
1158
1190
  /**
1159
1191
  * Moves a given command id to the version directory
1160
1192
  * @param directory
1161
1193
  */
1162
- versionCommand: versionCommand((0, import_node_path15.join)(path5)),
1194
+ versionCommand: versionCommand((0, import_node_path16.join)(path5)),
1163
1195
  /**
1164
1196
  * Adds a file to the given command
1165
1197
  * @param id - The id of the command to add the file to
@@ -1167,7 +1199,7 @@ var index_default = (path5) => {
1167
1199
  * @param version - Optional version of the command to add the file to
1168
1200
  * @returns
1169
1201
  */
1170
- addFileToCommand: addFileToCommand((0, import_node_path15.join)(path5)),
1202
+ addFileToCommand: addFileToCommand((0, import_node_path16.join)(path5)),
1171
1203
  /**
1172
1204
  * Adds a schema to the given command
1173
1205
  * @param id - The id of the command to add the schema to
@@ -1175,14 +1207,14 @@ var index_default = (path5) => {
1175
1207
  * @param version - Optional version of the command to add the schema to
1176
1208
  * @returns
1177
1209
  */
1178
- addSchemaToCommand: addSchemaToCommand((0, import_node_path15.join)(path5)),
1210
+ addSchemaToCommand: addSchemaToCommand((0, import_node_path16.join)(path5)),
1179
1211
  /**
1180
1212
  * Check to see if a command version exists
1181
1213
  * @param id - The id of the command
1182
1214
  * @param version - The version of the command (supports semver)
1183
1215
  * @returns
1184
1216
  */
1185
- commandHasVersion: commandHasVersion((0, import_node_path15.join)(path5)),
1217
+ commandHasVersion: commandHasVersion((0, import_node_path16.join)(path5)),
1186
1218
  /**
1187
1219
  * ================================
1188
1220
  * Queries
@@ -1194,13 +1226,13 @@ var index_default = (path5) => {
1194
1226
  * @param version - Optional id of the version to get (supports semver)
1195
1227
  * @returns Query|Undefined
1196
1228
  */
1197
- getQuery: getQuery((0, import_node_path15.join)(path5)),
1229
+ getQuery: getQuery((0, import_node_path16.join)(path5)),
1198
1230
  /**
1199
1231
  * Returns all queries from EventCatalog
1200
1232
  * @param latestOnly - optional boolean, set to true to get only latest versions
1201
1233
  * @returns Query[]|Undefined
1202
1234
  */
1203
- getQueries: getQueries((0, import_node_path15.join)(path5)),
1235
+ getQueries: getQueries((0, import_node_path16.join)(path5)),
1204
1236
  /**
1205
1237
  * Adds a query to EventCatalog
1206
1238
  *
@@ -1208,7 +1240,7 @@ var index_default = (path5) => {
1208
1240
  * @param options - Optional options to write the event
1209
1241
  *
1210
1242
  */
1211
- writeQuery: writeQuery((0, import_node_path15.join)(path5, "queries")),
1243
+ writeQuery: writeQuery((0, import_node_path16.join)(path5, "queries")),
1212
1244
  /**
1213
1245
  * Adds a query to a service in EventCatalog
1214
1246
  *
@@ -1217,26 +1249,26 @@ var index_default = (path5) => {
1217
1249
  * @param options - Optional options to write the query
1218
1250
  *
1219
1251
  */
1220
- writeQueryToService: writeQueryToService((0, import_node_path15.join)(path5)),
1252
+ writeQueryToService: writeQueryToService((0, import_node_path16.join)(path5)),
1221
1253
  /**
1222
1254
  * Remove an query to EventCatalog (modeled on the standard POSIX rm utility)
1223
1255
  *
1224
1256
  * @param path - The path to your query, e.g. `/Orders/GetOrder`
1225
1257
  *
1226
1258
  */
1227
- rmQuery: rmQuery((0, import_node_path15.join)(path5, "queries")),
1259
+ rmQuery: rmQuery((0, import_node_path16.join)(path5, "queries")),
1228
1260
  /**
1229
1261
  * Remove a query by a Query id
1230
1262
  *
1231
1263
  * @param id - The id of the query you want to remove
1232
1264
  *
1233
1265
  */
1234
- rmQueryById: rmQueryById((0, import_node_path15.join)(path5)),
1266
+ rmQueryById: rmQueryById((0, import_node_path16.join)(path5)),
1235
1267
  /**
1236
1268
  * Moves a given query id to the version directory
1237
1269
  * @param directory
1238
1270
  */
1239
- versionQuery: versionQuery((0, import_node_path15.join)(path5)),
1271
+ versionQuery: versionQuery((0, import_node_path16.join)(path5)),
1240
1272
  /**
1241
1273
  * Adds a file to the given query
1242
1274
  * @param id - The id of the query to add the file to
@@ -1244,7 +1276,7 @@ var index_default = (path5) => {
1244
1276
  * @param version - Optional version of the query to add the file to
1245
1277
  * @returns
1246
1278
  */
1247
- addFileToQuery: addFileToQuery((0, import_node_path15.join)(path5)),
1279
+ addFileToQuery: addFileToQuery((0, import_node_path16.join)(path5)),
1248
1280
  /**
1249
1281
  * Adds a schema to the given query
1250
1282
  * @param id - The id of the query to add the schema to
@@ -1252,14 +1284,14 @@ var index_default = (path5) => {
1252
1284
  * @param version - Optional version of the query to add the schema to
1253
1285
  * @returns
1254
1286
  */
1255
- addSchemaToQuery: addSchemaToQuery((0, import_node_path15.join)(path5)),
1287
+ addSchemaToQuery: addSchemaToQuery((0, import_node_path16.join)(path5)),
1256
1288
  /**
1257
1289
  * Check to see if an query version exists
1258
1290
  * @param id - The id of the query
1259
1291
  * @param version - The version of the query (supports semver)
1260
1292
  * @returns
1261
1293
  */
1262
- queryHasVersion: queryHasVersion((0, import_node_path15.join)(path5)),
1294
+ queryHasVersion: queryHasVersion((0, import_node_path16.join)(path5)),
1263
1295
  /**
1264
1296
  * ================================
1265
1297
  * Channels
@@ -1271,13 +1303,13 @@ var index_default = (path5) => {
1271
1303
  * @param version - Optional id of the version to get (supports semver)
1272
1304
  * @returns Channel|Undefined
1273
1305
  */
1274
- getChannel: getChannel((0, import_node_path15.join)(path5)),
1306
+ getChannel: getChannel((0, import_node_path16.join)(path5)),
1275
1307
  /**
1276
1308
  * Returns all channels from EventCatalog
1277
1309
  * @param latestOnly - optional boolean, set to true to get only latest versions
1278
1310
  * @returns Channel[]|Undefined
1279
1311
  */
1280
- getChannels: getChannels((0, import_node_path15.join)(path5)),
1312
+ getChannels: getChannels((0, import_node_path16.join)(path5)),
1281
1313
  /**
1282
1314
  * Adds an channel to EventCatalog
1283
1315
  *
@@ -1285,33 +1317,33 @@ var index_default = (path5) => {
1285
1317
  * @param options - Optional options to write the channel
1286
1318
  *
1287
1319
  */
1288
- writeChannel: writeChannel((0, import_node_path15.join)(path5, "channels")),
1320
+ writeChannel: writeChannel((0, import_node_path16.join)(path5, "channels")),
1289
1321
  /**
1290
1322
  * Remove an channel to EventCatalog (modeled on the standard POSIX rm utility)
1291
1323
  *
1292
1324
  * @param path - The path to your channel, e.g. `/Inventory/InventoryAdjusted`
1293
1325
  *
1294
1326
  */
1295
- rmChannel: rmChannel((0, import_node_path15.join)(path5, "channels")),
1327
+ rmChannel: rmChannel((0, import_node_path16.join)(path5, "channels")),
1296
1328
  /**
1297
1329
  * Remove an channel by an Event id
1298
1330
  *
1299
1331
  * @param id - The id of the channel you want to remove
1300
1332
  *
1301
1333
  */
1302
- rmChannelById: rmChannelById((0, import_node_path15.join)(path5)),
1334
+ rmChannelById: rmChannelById((0, import_node_path16.join)(path5)),
1303
1335
  /**
1304
1336
  * Moves a given channel id to the version directory
1305
1337
  * @param directory
1306
1338
  */
1307
- versionChannel: versionChannel((0, import_node_path15.join)(path5)),
1339
+ versionChannel: versionChannel((0, import_node_path16.join)(path5)),
1308
1340
  /**
1309
1341
  * Check to see if a channel version exists
1310
1342
  * @param id - The id of the channel
1311
1343
  * @param version - The version of the channel (supports semver)
1312
1344
  * @returns
1313
1345
  */
1314
- channelHasVersion: channelHasVersion((0, import_node_path15.join)(path5)),
1346
+ channelHasVersion: channelHasVersion((0, import_node_path16.join)(path5)),
1315
1347
  /**
1316
1348
  * Add a channel to an event
1317
1349
  *
@@ -1328,7 +1360,7 @@ var index_default = (path5) => {
1328
1360
  *
1329
1361
  * ```
1330
1362
  */
1331
- addEventToChannel: addMessageToChannel((0, import_node_path15.join)(path5), "events"),
1363
+ addEventToChannel: addMessageToChannel((0, import_node_path16.join)(path5), "events"),
1332
1364
  /**
1333
1365
  * Add a channel to an command
1334
1366
  *
@@ -1345,7 +1377,7 @@ var index_default = (path5) => {
1345
1377
  *
1346
1378
  * ```
1347
1379
  */
1348
- addCommandToChannel: addMessageToChannel((0, import_node_path15.join)(path5), "commands"),
1380
+ addCommandToChannel: addMessageToChannel((0, import_node_path16.join)(path5), "commands"),
1349
1381
  /**
1350
1382
  * Add a channel to an query
1351
1383
  *
@@ -1362,7 +1394,7 @@ var index_default = (path5) => {
1362
1394
  *
1363
1395
  * ```
1364
1396
  */
1365
- addQueryToChannel: addMessageToChannel((0, import_node_path15.join)(path5), "queries"),
1397
+ addQueryToChannel: addMessageToChannel((0, import_node_path16.join)(path5), "queries"),
1366
1398
  /**
1367
1399
  * ================================
1368
1400
  * SERVICES
@@ -1375,14 +1407,14 @@ var index_default = (path5) => {
1375
1407
  * @param options - Optional options to write the event
1376
1408
  *
1377
1409
  */
1378
- writeService: writeService((0, import_node_path15.join)(path5, "services")),
1410
+ writeService: writeService((0, import_node_path16.join)(path5, "services")),
1379
1411
  /**
1380
1412
  * Adds a versioned service to EventCatalog
1381
1413
  *
1382
1414
  * @param service - The service to write
1383
1415
  *
1384
1416
  */
1385
- writeVersionedService: writeVersionedService((0, import_node_path15.join)(path5, "services")),
1417
+ writeVersionedService: writeVersionedService((0, import_node_path16.join)(path5, "services")),
1386
1418
  /**
1387
1419
  * Adds a service to a domain in EventCatalog
1388
1420
  *
@@ -1391,45 +1423,45 @@ var index_default = (path5) => {
1391
1423
  * @param options - Optional options to write the event
1392
1424
  *
1393
1425
  */
1394
- writeServiceToDomain: writeServiceToDomain((0, import_node_path15.join)(path5, "domains")),
1426
+ writeServiceToDomain: writeServiceToDomain((0, import_node_path16.join)(path5, "domains")),
1395
1427
  /**
1396
1428
  * Returns a service from EventCatalog
1397
1429
  * @param id - The id of the service to retrieve
1398
1430
  * @param version - Optional id of the version to get (supports semver)
1399
1431
  * @returns Service|Undefined
1400
1432
  */
1401
- getService: getService((0, import_node_path15.join)(path5)),
1433
+ getService: getService((0, import_node_path16.join)(path5)),
1402
1434
  /**
1403
1435
  * Returns a service from EventCatalog by it's path.
1404
1436
  * @param path - The path to the service to retrieve
1405
1437
  * @returns Service|Undefined
1406
1438
  */
1407
- getServiceByPath: getServiceByPath((0, import_node_path15.join)(path5)),
1439
+ getServiceByPath: getServiceByPath((0, import_node_path16.join)(path5)),
1408
1440
  /**
1409
1441
  * Returns all services from EventCatalog
1410
1442
  * @param latestOnly - optional boolean, set to true to get only latest versions
1411
1443
  * @returns Service[]|Undefined
1412
1444
  */
1413
- getServices: getServices((0, import_node_path15.join)(path5)),
1445
+ getServices: getServices((0, import_node_path16.join)(path5)),
1414
1446
  /**
1415
1447
  * Moves a given service id to the version directory
1416
1448
  * @param directory
1417
1449
  */
1418
- versionService: versionService((0, import_node_path15.join)(path5)),
1450
+ versionService: versionService((0, import_node_path16.join)(path5)),
1419
1451
  /**
1420
1452
  * Remove a service from EventCatalog (modeled on the standard POSIX rm utility)
1421
1453
  *
1422
1454
  * @param path - The path to your service, e.g. `/InventoryService`
1423
1455
  *
1424
1456
  */
1425
- rmService: rmService((0, import_node_path15.join)(path5, "services")),
1457
+ rmService: rmService((0, import_node_path16.join)(path5, "services")),
1426
1458
  /**
1427
1459
  * Remove an service by an service id
1428
1460
  *
1429
1461
  * @param id - The id of the service you want to remove
1430
1462
  *
1431
1463
  */
1432
- rmServiceById: rmServiceById((0, import_node_path15.join)(path5)),
1464
+ rmServiceById: rmServiceById((0, import_node_path16.join)(path5)),
1433
1465
  /**
1434
1466
  * Adds a file to the given service
1435
1467
  * @param id - The id of the service to add the file to
@@ -1437,21 +1469,21 @@ var index_default = (path5) => {
1437
1469
  * @param version - Optional version of the service to add the file to
1438
1470
  * @returns
1439
1471
  */
1440
- addFileToService: addFileToService((0, import_node_path15.join)(path5)),
1472
+ addFileToService: addFileToService((0, import_node_path16.join)(path5)),
1441
1473
  /**
1442
1474
  * Returns the specifications for a given service
1443
1475
  * @param id - The id of the service to retrieve the specifications for
1444
1476
  * @param version - Optional version of the service
1445
1477
  * @returns
1446
1478
  */
1447
- getSpecificationFilesForService: getSpecificationFilesForService((0, import_node_path15.join)(path5)),
1479
+ getSpecificationFilesForService: getSpecificationFilesForService((0, import_node_path16.join)(path5)),
1448
1480
  /**
1449
1481
  * Check to see if a service version exists
1450
1482
  * @param id - The id of the service
1451
1483
  * @param version - The version of the service (supports semver)
1452
1484
  * @returns
1453
1485
  */
1454
- serviceHasVersion: serviceHasVersion((0, import_node_path15.join)(path5)),
1486
+ serviceHasVersion: serviceHasVersion((0, import_node_path16.join)(path5)),
1455
1487
  /**
1456
1488
  * Add an event to a service by it's id.
1457
1489
  *
@@ -1471,7 +1503,7 @@ var index_default = (path5) => {
1471
1503
  *
1472
1504
  * ```
1473
1505
  */
1474
- addEventToService: addMessageToService((0, import_node_path15.join)(path5)),
1506
+ addEventToService: addMessageToService((0, import_node_path16.join)(path5)),
1475
1507
  /**
1476
1508
  * Add a command to a service by it's id.
1477
1509
  *
@@ -1491,7 +1523,7 @@ var index_default = (path5) => {
1491
1523
  *
1492
1524
  * ```
1493
1525
  */
1494
- addCommandToService: addMessageToService((0, import_node_path15.join)(path5)),
1526
+ addCommandToService: addMessageToService((0, import_node_path16.join)(path5)),
1495
1527
  /**
1496
1528
  * Add a query to a service by it's id.
1497
1529
  *
@@ -1511,7 +1543,7 @@ var index_default = (path5) => {
1511
1543
  *
1512
1544
  * ```
1513
1545
  */
1514
- addQueryToService: addMessageToService((0, import_node_path15.join)(path5)),
1546
+ addQueryToService: addMessageToService((0, import_node_path16.join)(path5)),
1515
1547
  /**
1516
1548
  * Add an entity to a service by its id.
1517
1549
  *
@@ -1529,7 +1561,7 @@ var index_default = (path5) => {
1529
1561
  *
1530
1562
  * ```
1531
1563
  */
1532
- addEntityToService: addEntityToService((0, import_node_path15.join)(path5)),
1564
+ addEntityToService: addEntityToService((0, import_node_path16.join)(path5)),
1533
1565
  /**
1534
1566
  * Check to see if a service exists by it's path.
1535
1567
  *
@@ -1546,13 +1578,13 @@ var index_default = (path5) => {
1546
1578
  * @param path - The path to the service to check
1547
1579
  * @returns boolean
1548
1580
  */
1549
- isService: isService((0, import_node_path15.join)(path5)),
1581
+ isService: isService((0, import_node_path16.join)(path5)),
1550
1582
  /**
1551
1583
  * Converts a file to a service.
1552
1584
  * @param file - The file to convert to a service.
1553
1585
  * @returns The service.
1554
1586
  */
1555
- toService: toService((0, import_node_path15.join)(path5)),
1587
+ toService: toService((0, import_node_path16.join)(path5)),
1556
1588
  /**
1557
1589
  * ================================
1558
1590
  * Domains
@@ -1565,39 +1597,39 @@ var index_default = (path5) => {
1565
1597
  * @param options - Optional options to write the event
1566
1598
  *
1567
1599
  */
1568
- writeDomain: writeDomain((0, import_node_path15.join)(path5, "domains")),
1600
+ writeDomain: writeDomain((0, import_node_path16.join)(path5, "domains")),
1569
1601
  /**
1570
1602
  * Returns a domain from EventCatalog
1571
1603
  * @param id - The id of the domain to retrieve
1572
1604
  * @param version - Optional id of the version to get (supports semver)
1573
1605
  * @returns Domain|Undefined
1574
1606
  */
1575
- getDomain: getDomain((0, import_node_path15.join)(path5, "domains")),
1607
+ getDomain: getDomain((0, import_node_path16.join)(path5, "domains")),
1576
1608
  /**
1577
1609
  * Returns all domains from EventCatalog
1578
1610
  * @param latestOnly - optional boolean, set to true to get only latest versions
1579
1611
  * @returns Domain[]|Undefined
1580
1612
  */
1581
- getDomains: getDomains((0, import_node_path15.join)(path5)),
1613
+ getDomains: getDomains((0, import_node_path16.join)(path5)),
1582
1614
  /**
1583
1615
  * Moves a given domain id to the version directory
1584
1616
  * @param directory
1585
1617
  */
1586
- versionDomain: versionDomain((0, import_node_path15.join)(path5, "domains")),
1618
+ versionDomain: versionDomain((0, import_node_path16.join)(path5, "domains")),
1587
1619
  /**
1588
1620
  * Remove a domain from EventCatalog (modeled on the standard POSIX rm utility)
1589
1621
  *
1590
1622
  * @param path - The path to your domain, e.g. `/Payment`
1591
1623
  *
1592
1624
  */
1593
- rmDomain: rmDomain((0, import_node_path15.join)(path5, "domains")),
1625
+ rmDomain: rmDomain((0, import_node_path16.join)(path5, "domains")),
1594
1626
  /**
1595
1627
  * Remove an service by an domain id
1596
1628
  *
1597
1629
  * @param id - The id of the domain you want to remove
1598
1630
  *
1599
1631
  */
1600
- rmDomainById: rmDomainById((0, import_node_path15.join)(path5, "domains")),
1632
+ rmDomainById: rmDomainById((0, import_node_path16.join)(path5, "domains")),
1601
1633
  /**
1602
1634
  * Adds a file to the given domain
1603
1635
  * @param id - The id of the domain to add the file to
@@ -1605,28 +1637,28 @@ var index_default = (path5) => {
1605
1637
  * @param version - Optional version of the domain to add the file to
1606
1638
  * @returns
1607
1639
  */
1608
- addFileToDomain: addFileToDomain((0, import_node_path15.join)(path5, "domains")),
1640
+ addFileToDomain: addFileToDomain((0, import_node_path16.join)(path5, "domains")),
1609
1641
  /**
1610
1642
  * Adds an ubiquitous language dictionary to a domain
1611
1643
  * @param id - The id of the domain to add the ubiquitous language to
1612
1644
  * @param ubiquitousLanguageDictionary - The ubiquitous language dictionary to add
1613
1645
  * @param version - Optional version of the domain to add the ubiquitous language to
1614
1646
  */
1615
- addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain((0, import_node_path15.join)(path5, "domains")),
1647
+ addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain((0, import_node_path16.join)(path5, "domains")),
1616
1648
  /**
1617
1649
  * Get the ubiquitous language dictionary from a domain
1618
1650
  * @param id - The id of the domain to get the ubiquitous language from
1619
1651
  * @param version - Optional version of the domain to get the ubiquitous language from
1620
1652
  * @returns
1621
1653
  */
1622
- getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain((0, import_node_path15.join)(path5, "domains")),
1654
+ getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain((0, import_node_path16.join)(path5, "domains")),
1623
1655
  /**
1624
1656
  * Check to see if a domain version exists
1625
1657
  * @param id - The id of the domain
1626
1658
  * @param version - The version of the domain (supports semver)
1627
1659
  * @returns
1628
1660
  */
1629
- domainHasVersion: domainHasVersion((0, import_node_path15.join)(path5)),
1661
+ domainHasVersion: domainHasVersion((0, import_node_path16.join)(path5)),
1630
1662
  /**
1631
1663
  * Adds a given service to a domain
1632
1664
  * @param id - The id of the domain
@@ -1634,7 +1666,7 @@ var index_default = (path5) => {
1634
1666
  * @param version - (Optional) The version of the domain to add the service to
1635
1667
  * @returns
1636
1668
  */
1637
- addServiceToDomain: addServiceToDomain((0, import_node_path15.join)(path5, "domains")),
1669
+ addServiceToDomain: addServiceToDomain((0, import_node_path16.join)(path5, "domains")),
1638
1670
  /**
1639
1671
  * Adds a given subdomain to a domain
1640
1672
  * @param id - The id of the domain
@@ -1642,7 +1674,7 @@ var index_default = (path5) => {
1642
1674
  * @param version - (Optional) The version of the domain to add the subdomain to
1643
1675
  * @returns
1644
1676
  */
1645
- addSubDomainToDomain: addSubDomainToDomain((0, import_node_path15.join)(path5, "domains")),
1677
+ addSubDomainToDomain: addSubDomainToDomain((0, import_node_path16.join)(path5, "domains")),
1646
1678
  /**
1647
1679
  * Adds an entity to a domain
1648
1680
  * @param id - The id of the domain
@@ -1650,7 +1682,7 @@ var index_default = (path5) => {
1650
1682
  * @param version - (Optional) The version of the domain to add the entity to
1651
1683
  * @returns
1652
1684
  */
1653
- addEntityToDomain: addEntityToDomain((0, import_node_path15.join)(path5, "domains")),
1685
+ addEntityToDomain: addEntityToDomain((0, import_node_path16.join)(path5, "domains")),
1654
1686
  /**
1655
1687
  * ================================
1656
1688
  * Teams
@@ -1663,25 +1695,25 @@ var index_default = (path5) => {
1663
1695
  * @param options - Optional options to write the team
1664
1696
  *
1665
1697
  */
1666
- writeTeam: writeTeam((0, import_node_path15.join)(path5, "teams")),
1698
+ writeTeam: writeTeam((0, import_node_path16.join)(path5, "teams")),
1667
1699
  /**
1668
1700
  * Returns a team from EventCatalog
1669
1701
  * @param id - The id of the team to retrieve
1670
1702
  * @returns Team|Undefined
1671
1703
  */
1672
- getTeam: getTeam((0, import_node_path15.join)(path5, "teams")),
1704
+ getTeam: getTeam((0, import_node_path16.join)(path5, "teams")),
1673
1705
  /**
1674
1706
  * Returns all teams from EventCatalog
1675
1707
  * @returns Team[]|Undefined
1676
1708
  */
1677
- getTeams: getTeams((0, import_node_path15.join)(path5, "teams")),
1709
+ getTeams: getTeams((0, import_node_path16.join)(path5, "teams")),
1678
1710
  /**
1679
1711
  * Remove a team by the team id
1680
1712
  *
1681
1713
  * @param id - The id of the team you want to remove
1682
1714
  *
1683
1715
  */
1684
- rmTeamById: rmTeamById((0, import_node_path15.join)(path5, "teams")),
1716
+ rmTeamById: rmTeamById((0, import_node_path16.join)(path5, "teams")),
1685
1717
  /**
1686
1718
  * ================================
1687
1719
  * Users
@@ -1694,25 +1726,25 @@ var index_default = (path5) => {
1694
1726
  * @param options - Optional options to write the user
1695
1727
  *
1696
1728
  */
1697
- writeUser: writeUser((0, import_node_path15.join)(path5, "users")),
1729
+ writeUser: writeUser((0, import_node_path16.join)(path5, "users")),
1698
1730
  /**
1699
1731
  * Returns a user from EventCatalog
1700
1732
  * @param id - The id of the user to retrieve
1701
1733
  * @returns User|Undefined
1702
1734
  */
1703
- getUser: getUser((0, import_node_path15.join)(path5, "users")),
1735
+ getUser: getUser((0, import_node_path16.join)(path5, "users")),
1704
1736
  /**
1705
1737
  * Returns all user from EventCatalog
1706
1738
  * @returns User[]|Undefined
1707
1739
  */
1708
- getUsers: getUsers((0, import_node_path15.join)(path5)),
1740
+ getUsers: getUsers((0, import_node_path16.join)(path5)),
1709
1741
  /**
1710
1742
  * Remove a user by the user id
1711
1743
  *
1712
1744
  * @param id - The id of the user you want to remove
1713
1745
  *
1714
1746
  */
1715
- rmUserById: rmUserById((0, import_node_path15.join)(path5, "users")),
1747
+ rmUserById: rmUserById((0, import_node_path16.join)(path5, "users")),
1716
1748
  /**
1717
1749
  * ================================
1718
1750
  * Custom Docs
@@ -1723,32 +1755,32 @@ var index_default = (path5) => {
1723
1755
  * @param path - The path to the custom doc to retrieve
1724
1756
  * @returns CustomDoc|Undefined
1725
1757
  */
1726
- getCustomDoc: getCustomDoc((0, import_node_path15.join)(path5, "docs")),
1758
+ getCustomDoc: getCustomDoc((0, import_node_path16.join)(path5, "docs")),
1727
1759
  /**
1728
1760
  * Returns all custom docs from EventCatalog
1729
1761
  * @param options - Optional options to get custom docs from a specific path
1730
1762
  * @returns CustomDoc[]|Undefined
1731
1763
  */
1732
- getCustomDocs: getCustomDocs((0, import_node_path15.join)(path5, "docs")),
1764
+ getCustomDocs: getCustomDocs((0, import_node_path16.join)(path5, "docs")),
1733
1765
  /**
1734
1766
  * Writes a custom doc to EventCatalog
1735
1767
  * @param customDoc - The custom doc to write
1736
1768
  * @param options - Optional options to write the custom doc
1737
1769
  *
1738
1770
  */
1739
- writeCustomDoc: writeCustomDoc((0, import_node_path15.join)(path5, "docs")),
1771
+ writeCustomDoc: writeCustomDoc((0, import_node_path16.join)(path5, "docs")),
1740
1772
  /**
1741
1773
  * Removes a custom doc from EventCatalog
1742
1774
  * @param path - The path to the custom doc to remove
1743
1775
  *
1744
1776
  */
1745
- rmCustomDoc: rmCustomDoc((0, import_node_path15.join)(path5, "docs")),
1777
+ rmCustomDoc: rmCustomDoc((0, import_node_path16.join)(path5, "docs")),
1746
1778
  /**
1747
1779
  * Dumps the catalog to a JSON file.
1748
1780
  * @param directory - The directory to dump the catalog to
1749
1781
  * @returns A JSON file with the catalog
1750
1782
  */
1751
- dumpCatalog: dumpCatalog((0, import_node_path15.join)(path5)),
1783
+ dumpCatalog: dumpCatalog((0, import_node_path16.join)(path5)),
1752
1784
  /**
1753
1785
  * Returns the event catalog configuration file.
1754
1786
  * The event catalog configuration file is the file that contains the configuration for the event catalog.
@@ -1756,7 +1788,7 @@ var index_default = (path5) => {
1756
1788
  * @param directory - The directory of the catalog.
1757
1789
  * @returns A JSON object with the configuration for the event catalog.
1758
1790
  */
1759
- getEventCatalogConfigurationFile: getEventCatalogConfigurationFile((0, import_node_path15.join)(path5)),
1791
+ getEventCatalogConfigurationFile: getEventCatalogConfigurationFile((0, import_node_path16.join)(path5)),
1760
1792
  /**
1761
1793
  * ================================
1762
1794
  * Resources Utils
@@ -1777,33 +1809,33 @@ var index_default = (path5) => {
1777
1809
  * @param path - The path to the message to retrieve
1778
1810
  * @returns Message|Undefined
1779
1811
  */
1780
- getMessageBySchemaPath: getMessageBySchemaPath((0, import_node_path15.join)(path5)),
1812
+ getMessageBySchemaPath: getMessageBySchemaPath((0, import_node_path16.join)(path5)),
1781
1813
  /**
1782
1814
  * Returns the producers and consumers (services) for a given message
1783
1815
  * @param id - The id of the message to get the producers and consumers for
1784
1816
  * @param version - Optional version of the message
1785
1817
  * @returns { producers: Service[], consumers: Service[] }
1786
1818
  */
1787
- getProducersAndConsumersForMessage: getProducersAndConsumersForMessage((0, import_node_path15.join)(path5)),
1819
+ getProducersAndConsumersForMessage: getProducersAndConsumersForMessage((0, import_node_path16.join)(path5)),
1788
1820
  /**
1789
1821
  * Returns the consumers of a given schema path
1790
1822
  * @param path - The path to the schema to get the consumers for
1791
1823
  * @returns Service[]
1792
1824
  */
1793
- getConsumersOfSchema: getConsumersOfSchema((0, import_node_path15.join)(path5)),
1825
+ getConsumersOfSchema: getConsumersOfSchema((0, import_node_path16.join)(path5)),
1794
1826
  /**
1795
1827
  * Returns the producers of a given schema path
1796
1828
  * @param path - The path to the schema to get the producers for
1797
1829
  * @returns Service[]
1798
1830
  */
1799
- getProducersOfSchema: getProducersOfSchema((0, import_node_path15.join)(path5)),
1831
+ getProducersOfSchema: getProducersOfSchema((0, import_node_path16.join)(path5)),
1800
1832
  /**
1801
1833
  * Returns the owners for a given resource (e.g domain, service, event, command, query, etc.)
1802
1834
  * @param id - The id of the resource to get the owners for
1803
1835
  * @param version - Optional version of the resource
1804
1836
  * @returns { owners: User[] }
1805
1837
  */
1806
- getOwnersForResource: getOwnersForResource((0, import_node_path15.join)(path5)),
1838
+ getOwnersForResource: getOwnersForResource((0, import_node_path16.join)(path5)),
1807
1839
  /**
1808
1840
  * ================================
1809
1841
  * Entities
@@ -1815,13 +1847,13 @@ var index_default = (path5) => {
1815
1847
  * @param version - Optional id of the version to get (supports semver)
1816
1848
  * @returns Entity|Undefined
1817
1849
  */
1818
- getEntity: getEntity((0, import_node_path15.join)(path5)),
1850
+ getEntity: getEntity((0, import_node_path16.join)(path5)),
1819
1851
  /**
1820
1852
  * Returns all entities from EventCatalog
1821
1853
  * @param latestOnly - optional boolean, set to true to get only latest versions
1822
1854
  * @returns Entity[]|Undefined
1823
1855
  */
1824
- getEntities: getEntities((0, import_node_path15.join)(path5)),
1856
+ getEntities: getEntities((0, import_node_path16.join)(path5)),
1825
1857
  /**
1826
1858
  * Adds an entity to EventCatalog
1827
1859
  *
@@ -1829,33 +1861,95 @@ var index_default = (path5) => {
1829
1861
  * @param options - Optional options to write the entity
1830
1862
  *
1831
1863
  */
1832
- writeEntity: writeEntity((0, import_node_path15.join)(path5, "entities")),
1864
+ writeEntity: writeEntity((0, import_node_path16.join)(path5, "entities")),
1833
1865
  /**
1834
1866
  * Remove an entity from EventCatalog (modeled on the standard POSIX rm utility)
1835
1867
  *
1836
1868
  * @param path - The path to your entity, e.g. `/User`
1837
1869
  *
1838
1870
  */
1839
- rmEntity: rmEntity((0, import_node_path15.join)(path5, "entities")),
1871
+ rmEntity: rmEntity((0, import_node_path16.join)(path5, "entities")),
1840
1872
  /**
1841
1873
  * Remove an entity by an entity id
1842
1874
  *
1843
1875
  * @param id - The id of the entity you want to remove
1844
1876
  *
1845
1877
  */
1846
- rmEntityById: rmEntityById((0, import_node_path15.join)(path5)),
1878
+ rmEntityById: rmEntityById((0, import_node_path16.join)(path5)),
1847
1879
  /**
1848
1880
  * Moves a given entity id to the version directory
1849
1881
  * @param id - The id of the entity to version
1850
1882
  */
1851
- versionEntity: versionEntity((0, import_node_path15.join)(path5)),
1883
+ versionEntity: versionEntity((0, import_node_path16.join)(path5)),
1852
1884
  /**
1853
1885
  * Check to see if an entity version exists
1854
1886
  * @param id - The id of the entity
1855
1887
  * @param version - The version of the entity (supports semver)
1856
1888
  * @returns
1857
1889
  */
1858
- entityHasVersion: entityHasVersion((0, import_node_path15.join)(path5))
1890
+ entityHasVersion: entityHasVersion((0, import_node_path16.join)(path5)),
1891
+ /**
1892
+ * ================================
1893
+ * Data Stores
1894
+ * ================================
1895
+ */
1896
+ /**
1897
+ * Adds a data store to EventCatalog
1898
+ * @param dataStore - The data store to write
1899
+ * @param options - Optional options to write the data store
1900
+ *
1901
+ */
1902
+ writeDataStore: writeContainer((0, import_node_path16.join)(path5, "containers")),
1903
+ /**
1904
+ * Returns a container from EventCatalog
1905
+ * @param id - The id of the container to retrieve
1906
+ * @param version - Optional id of the version to get (supports semver)
1907
+ * @returns Container|Undefined
1908
+ */
1909
+ getDataStore: getContainer((0, import_node_path16.join)(path5)),
1910
+ /**
1911
+ * Returns all data stores from EventCatalog
1912
+ * @param latestOnly - optional boolean, set to true to get only latest versions
1913
+ * @returns Container[]|Undefined
1914
+ */
1915
+ getDataStores: getContainers((0, import_node_path16.join)(path5)),
1916
+ /**
1917
+ * Version a data store by its id
1918
+ * @param id - The id of the data store to version
1919
+ */
1920
+ versionDataStore: versionContainer((0, import_node_path16.join)(path5, "containers")),
1921
+ /**
1922
+ * Remove a data store by its path
1923
+ * @param path - The path to the data store to remove
1924
+ */
1925
+ rmDataStore: rmContainer((0, import_node_path16.join)(path5, "containers")),
1926
+ /**
1927
+ * Remove a data store by its id
1928
+ * @param id - The id of the data store to remove
1929
+ */
1930
+ rmDataStoreById: rmContainerById((0, import_node_path16.join)(path5)),
1931
+ /**
1932
+ * Check to see if a data store version exists
1933
+ * @param id - The id of the data store
1934
+ * @param version - The version of the data store (supports semver)
1935
+ * @returns
1936
+ */
1937
+ dataStoreHasVersion: containerHasVersion((0, import_node_path16.join)(path5)),
1938
+ /**
1939
+ * Adds a file to a data store by its id
1940
+ * @param id - The id of the data store to add the file to
1941
+ * @param file - File contents to add including the content and the file name
1942
+ * @param version - Optional version of the data store to add the file to
1943
+ * @returns
1944
+ */
1945
+ addFileToDataStore: addFileToContainer((0, import_node_path16.join)(path5)),
1946
+ /**
1947
+ * Writes a data store to a service by its id
1948
+ * @param dataStore - The data store to write
1949
+ * @param service - The service to write the data store to
1950
+ * @returns
1951
+ */
1952
+ writeDataStoreToService: writeContainerToService((0, import_node_path16.join)(path5))
1859
1953
  };
1860
1954
  };
1861
1955
 
@@ -1863,7 +1957,7 @@ var index_default = (path5) => {
1863
1957
  var DUMP_VERSION = "0.0.1";
1864
1958
  var getEventCatalogVersion = async (catalogDir) => {
1865
1959
  try {
1866
- const packageJson = import_fs.default.readFileSync((0, import_node_path16.join)(catalogDir, "package.json"), "utf8");
1960
+ const packageJson = import_fs.default.readFileSync((0, import_node_path17.join)(catalogDir, "package.json"), "utf8");
1867
1961
  const packageJsonObject = JSON.parse(packageJson);
1868
1962
  return packageJsonObject["dependencies"]["@eventcatalog/core"];
1869
1963
  } catch (error) {
@@ -1876,7 +1970,7 @@ var hydrateResource = async (catalogDir, resources = [], { attachSchema = false
1876
1970
  const resourcePath = await getResourcePath(catalogDir, resource.id, resource.version);
1877
1971
  let schema = "";
1878
1972
  if (resource.schemaPath && resourcePath?.fullPath) {
1879
- const pathToSchema = import_node_path16.default.join(import_node_path16.default.dirname(resourcePath?.fullPath), resource.schemaPath);
1973
+ const pathToSchema = import_node_path17.default.join(import_node_path17.default.dirname(resourcePath?.fullPath), resource.schemaPath);
1880
1974
  if (import_fs.default.existsSync(pathToSchema)) {
1881
1975
  schema = import_fs.default.readFileSync(pathToSchema, "utf8");
1882
1976
  }
@@ -1897,7 +1991,7 @@ var filterCollection = (collection, options) => {
1897
1991
  };
1898
1992
  var getEventCatalogConfigurationFile = (directory) => async () => {
1899
1993
  try {
1900
- const path5 = (0, import_node_path16.join)(directory, "eventcatalog.config.js");
1994
+ const path5 = (0, import_node_path17.join)(directory, "eventcatalog.config.js");
1901
1995
  const configModule = await import(path5);
1902
1996
  return configModule.default;
1903
1997
  } catch (error) {