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