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