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