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