@eventcatalog/sdk 2.8.0 → 2.8.2

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