@eventcatalog/sdk 2.7.6 → 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.
Files changed (60) hide show
  1. package/dist/channels.js +18 -9
  2. package/dist/channels.js.map +1 -1
  3. package/dist/channels.mjs +11 -2
  4. package/dist/channels.mjs.map +1 -1
  5. package/dist/commands.js +14 -5
  6. package/dist/commands.js.map +1 -1
  7. package/dist/commands.mjs +11 -2
  8. package/dist/commands.mjs.map +1 -1
  9. package/dist/containers.d.mts +179 -0
  10. package/dist/containers.d.ts +179 -0
  11. package/dist/containers.js +374 -0
  12. package/dist/containers.js.map +1 -0
  13. package/dist/containers.mjs +331 -0
  14. package/dist/containers.mjs.map +1 -0
  15. package/dist/custom-docs.js +6 -5
  16. package/dist/custom-docs.js.map +1 -1
  17. package/dist/custom-docs.mjs +1 -0
  18. package/dist/custom-docs.mjs.map +1 -1
  19. package/dist/domains.js +17 -8
  20. package/dist/domains.js.map +1 -1
  21. package/dist/domains.mjs +11 -2
  22. package/dist/domains.mjs.map +1 -1
  23. package/dist/entities.js +13 -4
  24. package/dist/entities.js.map +1 -1
  25. package/dist/entities.mjs +11 -2
  26. package/dist/entities.mjs.map +1 -1
  27. package/dist/eventcatalog.js +255 -152
  28. package/dist/eventcatalog.js.map +1 -1
  29. package/dist/eventcatalog.mjs +209 -106
  30. package/dist/eventcatalog.mjs.map +1 -1
  31. package/dist/events.js +14 -5
  32. package/dist/events.js.map +1 -1
  33. package/dist/events.mjs +11 -2
  34. package/dist/events.mjs.map +1 -1
  35. package/dist/index.d.mts +97 -30
  36. package/dist/index.d.ts +97 -30
  37. package/dist/index.js +255 -152
  38. package/dist/index.js.map +1 -1
  39. package/dist/index.mjs +203 -100
  40. package/dist/index.mjs.map +1 -1
  41. package/dist/messages.js +4 -3
  42. package/dist/messages.js.map +1 -1
  43. package/dist/messages.mjs +1 -0
  44. package/dist/messages.mjs.map +1 -1
  45. package/dist/queries.js +14 -5
  46. package/dist/queries.js.map +1 -1
  47. package/dist/queries.mjs +11 -2
  48. package/dist/queries.mjs.map +1 -1
  49. package/dist/services.js +20 -11
  50. package/dist/services.js.map +1 -1
  51. package/dist/services.mjs +11 -2
  52. package/dist/services.mjs.map +1 -1
  53. package/dist/teams.js +9 -8
  54. package/dist/teams.js.map +1 -1
  55. package/dist/teams.mjs +1 -0
  56. package/dist/teams.mjs.map +1 -1
  57. package/dist/types.d.d.mts +24 -1
  58. package/dist/types.d.d.ts +24 -1
  59. package/dist/types.d.js.map +1 -1
  60. package/package.json +1 -1
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";
@@ -120,6 +120,7 @@ import fs from "fs/promises";
120
120
  import fsSync2 from "fs";
121
121
  import { satisfies as satisfies2 } from "semver";
122
122
  import { lock, unlock } from "proper-lockfile";
123
+ import { basename as basename2 } from "path";
123
124
  var versionResource = async (catalogDir, id) => {
124
125
  const files = await getFiles(`${catalogDir}/**/index.{md,mdx}`);
125
126
  const matchedFiles = await searchFilesForId(files, id);
@@ -127,16 +128,24 @@ var versionResource = async (catalogDir, id) => {
127
128
  throw new Error(`No resource found with id: ${id}`);
128
129
  }
129
130
  const file = matchedFiles[0];
130
- const sourceDirectory = dirname2(file);
131
+ const sourceDirectory = dirname2(file).replace(/\/versioned?\/[^/]+\//, "/");
131
132
  const { data: { version = "0.0.1" } = {} } = matter2.read(file);
132
133
  const targetDirectory = getVersionedDirectory(sourceDirectory, version);
133
134
  fsSync2.mkdirSync(targetDirectory, { recursive: true });
135
+ const ignoreListToCopy = ["events", "commands", "queries", "versioned"];
134
136
  await copyDir(catalogDir, sourceDirectory, targetDirectory, (src) => {
135
- return !src.includes("versioned");
137
+ const folderName = basename2(src);
138
+ if (ignoreListToCopy.includes(folderName)) {
139
+ return false;
140
+ }
141
+ return true;
136
142
  });
137
143
  await fs.readdir(sourceDirectory).then(async (resourceFiles) => {
138
144
  await Promise.all(
139
145
  resourceFiles.map(async (file2) => {
146
+ if (ignoreListToCopy.includes(file2)) {
147
+ return;
148
+ }
140
149
  if (file2 !== "versioned") {
141
150
  fsSync2.rmSync(join2(sourceDirectory, file2), { recursive: true });
142
151
  }
@@ -1080,6 +1089,38 @@ var entityHasVersion = (directory) => async (id, version) => {
1080
1089
  return !!file;
1081
1090
  };
1082
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
+
1083
1124
  // src/index.ts
1084
1125
  var index_default = (path5) => {
1085
1126
  return {
@@ -1089,13 +1130,13 @@ var index_default = (path5) => {
1089
1130
  * @param version - Optional id of the version to get (supports semver)
1090
1131
  * @returns Event|Undefined
1091
1132
  */
1092
- getEvent: getEvent(join15(path5)),
1133
+ getEvent: getEvent(join16(path5)),
1093
1134
  /**
1094
1135
  * Returns all events from EventCatalog
1095
1136
  * @param latestOnly - optional boolean, set to true to get only latest versions
1096
1137
  * @returns Event[]|Undefined
1097
1138
  */
1098
- getEvents: getEvents(join15(path5)),
1139
+ getEvents: getEvents(join16(path5)),
1099
1140
  /**
1100
1141
  * Adds an event to EventCatalog
1101
1142
  *
@@ -1103,7 +1144,7 @@ var index_default = (path5) => {
1103
1144
  * @param options - Optional options to write the event
1104
1145
  *
1105
1146
  */
1106
- writeEvent: writeEvent(join15(path5, "events")),
1147
+ writeEvent: writeEvent(join16(path5, "events")),
1107
1148
  /**
1108
1149
  * Adds an event to a service in EventCatalog
1109
1150
  *
@@ -1112,26 +1153,26 @@ var index_default = (path5) => {
1112
1153
  * @param options - Optional options to write the event
1113
1154
  *
1114
1155
  */
1115
- writeEventToService: writeEventToService(join15(path5)),
1156
+ writeEventToService: writeEventToService(join16(path5)),
1116
1157
  /**
1117
1158
  * Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
1118
1159
  *
1119
1160
  * @param path - The path to your event, e.g. `/Inventory/InventoryAdjusted`
1120
1161
  *
1121
1162
  */
1122
- rmEvent: rmEvent(join15(path5, "events")),
1163
+ rmEvent: rmEvent(join16(path5, "events")),
1123
1164
  /**
1124
1165
  * Remove an event by an Event id
1125
1166
  *
1126
1167
  * @param id - The id of the event you want to remove
1127
1168
  *
1128
1169
  */
1129
- rmEventById: rmEventById(join15(path5)),
1170
+ rmEventById: rmEventById(join16(path5)),
1130
1171
  /**
1131
1172
  * Moves a given event id to the version directory
1132
1173
  * @param directory
1133
1174
  */
1134
- versionEvent: versionEvent(join15(path5)),
1175
+ versionEvent: versionEvent(join16(path5)),
1135
1176
  /**
1136
1177
  * Adds a file to the given event
1137
1178
  * @param id - The id of the event to add the file to
@@ -1139,7 +1180,7 @@ var index_default = (path5) => {
1139
1180
  * @param version - Optional version of the event to add the file to
1140
1181
  * @returns
1141
1182
  */
1142
- addFileToEvent: addFileToEvent(join15(path5)),
1183
+ addFileToEvent: addFileToEvent(join16(path5)),
1143
1184
  /**
1144
1185
  * Adds a schema to the given event
1145
1186
  * @param id - The id of the event to add the schema to
@@ -1147,14 +1188,14 @@ var index_default = (path5) => {
1147
1188
  * @param version - Optional version of the event to add the schema to
1148
1189
  * @returns
1149
1190
  */
1150
- addSchemaToEvent: addSchemaToEvent(join15(path5)),
1191
+ addSchemaToEvent: addSchemaToEvent(join16(path5)),
1151
1192
  /**
1152
1193
  * Check to see if an event version exists
1153
1194
  * @param id - The id of the event
1154
1195
  * @param version - The version of the event (supports semver)
1155
1196
  * @returns
1156
1197
  */
1157
- eventHasVersion: eventHasVersion(join15(path5)),
1198
+ eventHasVersion: eventHasVersion(join16(path5)),
1158
1199
  /**
1159
1200
  * ================================
1160
1201
  * Commands
@@ -1166,13 +1207,13 @@ var index_default = (path5) => {
1166
1207
  * @param version - Optional id of the version to get (supports semver)
1167
1208
  * @returns Command|Undefined
1168
1209
  */
1169
- getCommand: getCommand(join15(path5)),
1210
+ getCommand: getCommand(join16(path5)),
1170
1211
  /**
1171
1212
  * Returns all commands from EventCatalog
1172
1213
  * @param latestOnly - optional boolean, set to true to get only latest versions
1173
1214
  * @returns Command[]|Undefined
1174
1215
  */
1175
- getCommands: getCommands(join15(path5)),
1216
+ getCommands: getCommands(join16(path5)),
1176
1217
  /**
1177
1218
  * Adds an command to EventCatalog
1178
1219
  *
@@ -1180,7 +1221,7 @@ var index_default = (path5) => {
1180
1221
  * @param options - Optional options to write the command
1181
1222
  *
1182
1223
  */
1183
- writeCommand: writeCommand(join15(path5, "commands")),
1224
+ writeCommand: writeCommand(join16(path5, "commands")),
1184
1225
  /**
1185
1226
  * Adds a command to a service in EventCatalog
1186
1227
  *
@@ -1189,26 +1230,26 @@ var index_default = (path5) => {
1189
1230
  * @param options - Optional options to write the command
1190
1231
  *
1191
1232
  */
1192
- writeCommandToService: writeCommandToService(join15(path5)),
1233
+ writeCommandToService: writeCommandToService(join16(path5)),
1193
1234
  /**
1194
1235
  * Remove an command to EventCatalog (modeled on the standard POSIX rm utility)
1195
1236
  *
1196
1237
  * @param path - The path to your command, e.g. `/Inventory/InventoryAdjusted`
1197
1238
  *
1198
1239
  */
1199
- rmCommand: rmCommand(join15(path5, "commands")),
1240
+ rmCommand: rmCommand(join16(path5, "commands")),
1200
1241
  /**
1201
1242
  * Remove an command by an Event id
1202
1243
  *
1203
1244
  * @param id - The id of the command you want to remove
1204
1245
  *
1205
1246
  */
1206
- rmCommandById: rmCommandById(join15(path5)),
1247
+ rmCommandById: rmCommandById(join16(path5)),
1207
1248
  /**
1208
1249
  * Moves a given command id to the version directory
1209
1250
  * @param directory
1210
1251
  */
1211
- versionCommand: versionCommand(join15(path5)),
1252
+ versionCommand: versionCommand(join16(path5)),
1212
1253
  /**
1213
1254
  * Adds a file to the given command
1214
1255
  * @param id - The id of the command to add the file to
@@ -1216,7 +1257,7 @@ var index_default = (path5) => {
1216
1257
  * @param version - Optional version of the command to add the file to
1217
1258
  * @returns
1218
1259
  */
1219
- addFileToCommand: addFileToCommand(join15(path5)),
1260
+ addFileToCommand: addFileToCommand(join16(path5)),
1220
1261
  /**
1221
1262
  * Adds a schema to the given command
1222
1263
  * @param id - The id of the command to add the schema to
@@ -1224,14 +1265,14 @@ var index_default = (path5) => {
1224
1265
  * @param version - Optional version of the command to add the schema to
1225
1266
  * @returns
1226
1267
  */
1227
- addSchemaToCommand: addSchemaToCommand(join15(path5)),
1268
+ addSchemaToCommand: addSchemaToCommand(join16(path5)),
1228
1269
  /**
1229
1270
  * Check to see if a command version exists
1230
1271
  * @param id - The id of the command
1231
1272
  * @param version - The version of the command (supports semver)
1232
1273
  * @returns
1233
1274
  */
1234
- commandHasVersion: commandHasVersion(join15(path5)),
1275
+ commandHasVersion: commandHasVersion(join16(path5)),
1235
1276
  /**
1236
1277
  * ================================
1237
1278
  * Queries
@@ -1243,13 +1284,13 @@ var index_default = (path5) => {
1243
1284
  * @param version - Optional id of the version to get (supports semver)
1244
1285
  * @returns Query|Undefined
1245
1286
  */
1246
- getQuery: getQuery(join15(path5)),
1287
+ getQuery: getQuery(join16(path5)),
1247
1288
  /**
1248
1289
  * Returns all queries from EventCatalog
1249
1290
  * @param latestOnly - optional boolean, set to true to get only latest versions
1250
1291
  * @returns Query[]|Undefined
1251
1292
  */
1252
- getQueries: getQueries(join15(path5)),
1293
+ getQueries: getQueries(join16(path5)),
1253
1294
  /**
1254
1295
  * Adds a query to EventCatalog
1255
1296
  *
@@ -1257,7 +1298,7 @@ var index_default = (path5) => {
1257
1298
  * @param options - Optional options to write the event
1258
1299
  *
1259
1300
  */
1260
- writeQuery: writeQuery(join15(path5, "queries")),
1301
+ writeQuery: writeQuery(join16(path5, "queries")),
1261
1302
  /**
1262
1303
  * Adds a query to a service in EventCatalog
1263
1304
  *
@@ -1266,26 +1307,26 @@ var index_default = (path5) => {
1266
1307
  * @param options - Optional options to write the query
1267
1308
  *
1268
1309
  */
1269
- writeQueryToService: writeQueryToService(join15(path5)),
1310
+ writeQueryToService: writeQueryToService(join16(path5)),
1270
1311
  /**
1271
1312
  * Remove an query to EventCatalog (modeled on the standard POSIX rm utility)
1272
1313
  *
1273
1314
  * @param path - The path to your query, e.g. `/Orders/GetOrder`
1274
1315
  *
1275
1316
  */
1276
- rmQuery: rmQuery(join15(path5, "queries")),
1317
+ rmQuery: rmQuery(join16(path5, "queries")),
1277
1318
  /**
1278
1319
  * Remove a query by a Query id
1279
1320
  *
1280
1321
  * @param id - The id of the query you want to remove
1281
1322
  *
1282
1323
  */
1283
- rmQueryById: rmQueryById(join15(path5)),
1324
+ rmQueryById: rmQueryById(join16(path5)),
1284
1325
  /**
1285
1326
  * Moves a given query id to the version directory
1286
1327
  * @param directory
1287
1328
  */
1288
- versionQuery: versionQuery(join15(path5)),
1329
+ versionQuery: versionQuery(join16(path5)),
1289
1330
  /**
1290
1331
  * Adds a file to the given query
1291
1332
  * @param id - The id of the query to add the file to
@@ -1293,7 +1334,7 @@ var index_default = (path5) => {
1293
1334
  * @param version - Optional version of the query to add the file to
1294
1335
  * @returns
1295
1336
  */
1296
- addFileToQuery: addFileToQuery(join15(path5)),
1337
+ addFileToQuery: addFileToQuery(join16(path5)),
1297
1338
  /**
1298
1339
  * Adds a schema to the given query
1299
1340
  * @param id - The id of the query to add the schema to
@@ -1301,14 +1342,14 @@ var index_default = (path5) => {
1301
1342
  * @param version - Optional version of the query to add the schema to
1302
1343
  * @returns
1303
1344
  */
1304
- addSchemaToQuery: addSchemaToQuery(join15(path5)),
1345
+ addSchemaToQuery: addSchemaToQuery(join16(path5)),
1305
1346
  /**
1306
1347
  * Check to see if an query version exists
1307
1348
  * @param id - The id of the query
1308
1349
  * @param version - The version of the query (supports semver)
1309
1350
  * @returns
1310
1351
  */
1311
- queryHasVersion: queryHasVersion(join15(path5)),
1352
+ queryHasVersion: queryHasVersion(join16(path5)),
1312
1353
  /**
1313
1354
  * ================================
1314
1355
  * Channels
@@ -1320,13 +1361,13 @@ var index_default = (path5) => {
1320
1361
  * @param version - Optional id of the version to get (supports semver)
1321
1362
  * @returns Channel|Undefined
1322
1363
  */
1323
- getChannel: getChannel(join15(path5)),
1364
+ getChannel: getChannel(join16(path5)),
1324
1365
  /**
1325
1366
  * Returns all channels from EventCatalog
1326
1367
  * @param latestOnly - optional boolean, set to true to get only latest versions
1327
1368
  * @returns Channel[]|Undefined
1328
1369
  */
1329
- getChannels: getChannels(join15(path5)),
1370
+ getChannels: getChannels(join16(path5)),
1330
1371
  /**
1331
1372
  * Adds an channel to EventCatalog
1332
1373
  *
@@ -1334,33 +1375,33 @@ var index_default = (path5) => {
1334
1375
  * @param options - Optional options to write the channel
1335
1376
  *
1336
1377
  */
1337
- writeChannel: writeChannel(join15(path5, "channels")),
1378
+ writeChannel: writeChannel(join16(path5, "channels")),
1338
1379
  /**
1339
1380
  * Remove an channel to EventCatalog (modeled on the standard POSIX rm utility)
1340
1381
  *
1341
1382
  * @param path - The path to your channel, e.g. `/Inventory/InventoryAdjusted`
1342
1383
  *
1343
1384
  */
1344
- rmChannel: rmChannel(join15(path5, "channels")),
1385
+ rmChannel: rmChannel(join16(path5, "channels")),
1345
1386
  /**
1346
1387
  * Remove an channel by an Event id
1347
1388
  *
1348
1389
  * @param id - The id of the channel you want to remove
1349
1390
  *
1350
1391
  */
1351
- rmChannelById: rmChannelById(join15(path5)),
1392
+ rmChannelById: rmChannelById(join16(path5)),
1352
1393
  /**
1353
1394
  * Moves a given channel id to the version directory
1354
1395
  * @param directory
1355
1396
  */
1356
- versionChannel: versionChannel(join15(path5)),
1397
+ versionChannel: versionChannel(join16(path5)),
1357
1398
  /**
1358
1399
  * Check to see if a channel version exists
1359
1400
  * @param id - The id of the channel
1360
1401
  * @param version - The version of the channel (supports semver)
1361
1402
  * @returns
1362
1403
  */
1363
- channelHasVersion: channelHasVersion(join15(path5)),
1404
+ channelHasVersion: channelHasVersion(join16(path5)),
1364
1405
  /**
1365
1406
  * Add a channel to an event
1366
1407
  *
@@ -1377,7 +1418,7 @@ var index_default = (path5) => {
1377
1418
  *
1378
1419
  * ```
1379
1420
  */
1380
- addEventToChannel: addMessageToChannel(join15(path5), "events"),
1421
+ addEventToChannel: addMessageToChannel(join16(path5), "events"),
1381
1422
  /**
1382
1423
  * Add a channel to an command
1383
1424
  *
@@ -1394,7 +1435,7 @@ var index_default = (path5) => {
1394
1435
  *
1395
1436
  * ```
1396
1437
  */
1397
- addCommandToChannel: addMessageToChannel(join15(path5), "commands"),
1438
+ addCommandToChannel: addMessageToChannel(join16(path5), "commands"),
1398
1439
  /**
1399
1440
  * Add a channel to an query
1400
1441
  *
@@ -1411,7 +1452,7 @@ var index_default = (path5) => {
1411
1452
  *
1412
1453
  * ```
1413
1454
  */
1414
- addQueryToChannel: addMessageToChannel(join15(path5), "queries"),
1455
+ addQueryToChannel: addMessageToChannel(join16(path5), "queries"),
1415
1456
  /**
1416
1457
  * ================================
1417
1458
  * SERVICES
@@ -1424,14 +1465,14 @@ var index_default = (path5) => {
1424
1465
  * @param options - Optional options to write the event
1425
1466
  *
1426
1467
  */
1427
- writeService: writeService(join15(path5, "services")),
1468
+ writeService: writeService(join16(path5, "services")),
1428
1469
  /**
1429
1470
  * Adds a versioned service to EventCatalog
1430
1471
  *
1431
1472
  * @param service - The service to write
1432
1473
  *
1433
1474
  */
1434
- writeVersionedService: writeVersionedService(join15(path5, "services")),
1475
+ writeVersionedService: writeVersionedService(join16(path5, "services")),
1435
1476
  /**
1436
1477
  * Adds a service to a domain in EventCatalog
1437
1478
  *
@@ -1440,45 +1481,45 @@ var index_default = (path5) => {
1440
1481
  * @param options - Optional options to write the event
1441
1482
  *
1442
1483
  */
1443
- writeServiceToDomain: writeServiceToDomain(join15(path5, "domains")),
1484
+ writeServiceToDomain: writeServiceToDomain(join16(path5, "domains")),
1444
1485
  /**
1445
1486
  * Returns a service from EventCatalog
1446
1487
  * @param id - The id of the service to retrieve
1447
1488
  * @param version - Optional id of the version to get (supports semver)
1448
1489
  * @returns Service|Undefined
1449
1490
  */
1450
- getService: getService(join15(path5)),
1491
+ getService: getService(join16(path5)),
1451
1492
  /**
1452
1493
  * Returns a service from EventCatalog by it's path.
1453
1494
  * @param path - The path to the service to retrieve
1454
1495
  * @returns Service|Undefined
1455
1496
  */
1456
- getServiceByPath: getServiceByPath(join15(path5)),
1497
+ getServiceByPath: getServiceByPath(join16(path5)),
1457
1498
  /**
1458
1499
  * Returns all services from EventCatalog
1459
1500
  * @param latestOnly - optional boolean, set to true to get only latest versions
1460
1501
  * @returns Service[]|Undefined
1461
1502
  */
1462
- getServices: getServices(join15(path5)),
1503
+ getServices: getServices(join16(path5)),
1463
1504
  /**
1464
1505
  * Moves a given service id to the version directory
1465
1506
  * @param directory
1466
1507
  */
1467
- versionService: versionService(join15(path5)),
1508
+ versionService: versionService(join16(path5)),
1468
1509
  /**
1469
1510
  * Remove a service from EventCatalog (modeled on the standard POSIX rm utility)
1470
1511
  *
1471
1512
  * @param path - The path to your service, e.g. `/InventoryService`
1472
1513
  *
1473
1514
  */
1474
- rmService: rmService(join15(path5, "services")),
1515
+ rmService: rmService(join16(path5, "services")),
1475
1516
  /**
1476
1517
  * Remove an service by an service id
1477
1518
  *
1478
1519
  * @param id - The id of the service you want to remove
1479
1520
  *
1480
1521
  */
1481
- rmServiceById: rmServiceById(join15(path5)),
1522
+ rmServiceById: rmServiceById(join16(path5)),
1482
1523
  /**
1483
1524
  * Adds a file to the given service
1484
1525
  * @param id - The id of the service to add the file to
@@ -1486,21 +1527,21 @@ var index_default = (path5) => {
1486
1527
  * @param version - Optional version of the service to add the file to
1487
1528
  * @returns
1488
1529
  */
1489
- addFileToService: addFileToService(join15(path5)),
1530
+ addFileToService: addFileToService(join16(path5)),
1490
1531
  /**
1491
1532
  * Returns the specifications for a given service
1492
1533
  * @param id - The id of the service to retrieve the specifications for
1493
1534
  * @param version - Optional version of the service
1494
1535
  * @returns
1495
1536
  */
1496
- getSpecificationFilesForService: getSpecificationFilesForService(join15(path5)),
1537
+ getSpecificationFilesForService: getSpecificationFilesForService(join16(path5)),
1497
1538
  /**
1498
1539
  * Check to see if a service version exists
1499
1540
  * @param id - The id of the service
1500
1541
  * @param version - The version of the service (supports semver)
1501
1542
  * @returns
1502
1543
  */
1503
- serviceHasVersion: serviceHasVersion(join15(path5)),
1544
+ serviceHasVersion: serviceHasVersion(join16(path5)),
1504
1545
  /**
1505
1546
  * Add an event to a service by it's id.
1506
1547
  *
@@ -1520,7 +1561,7 @@ var index_default = (path5) => {
1520
1561
  *
1521
1562
  * ```
1522
1563
  */
1523
- addEventToService: addMessageToService(join15(path5)),
1564
+ addEventToService: addMessageToService(join16(path5)),
1524
1565
  /**
1525
1566
  * Add a command to a service by it's id.
1526
1567
  *
@@ -1540,7 +1581,7 @@ var index_default = (path5) => {
1540
1581
  *
1541
1582
  * ```
1542
1583
  */
1543
- addCommandToService: addMessageToService(join15(path5)),
1584
+ addCommandToService: addMessageToService(join16(path5)),
1544
1585
  /**
1545
1586
  * Add a query to a service by it's id.
1546
1587
  *
@@ -1560,7 +1601,7 @@ var index_default = (path5) => {
1560
1601
  *
1561
1602
  * ```
1562
1603
  */
1563
- addQueryToService: addMessageToService(join15(path5)),
1604
+ addQueryToService: addMessageToService(join16(path5)),
1564
1605
  /**
1565
1606
  * Add an entity to a service by its id.
1566
1607
  *
@@ -1578,7 +1619,7 @@ var index_default = (path5) => {
1578
1619
  *
1579
1620
  * ```
1580
1621
  */
1581
- addEntityToService: addEntityToService(join15(path5)),
1622
+ addEntityToService: addEntityToService(join16(path5)),
1582
1623
  /**
1583
1624
  * Check to see if a service exists by it's path.
1584
1625
  *
@@ -1595,13 +1636,13 @@ var index_default = (path5) => {
1595
1636
  * @param path - The path to the service to check
1596
1637
  * @returns boolean
1597
1638
  */
1598
- isService: isService(join15(path5)),
1639
+ isService: isService(join16(path5)),
1599
1640
  /**
1600
1641
  * Converts a file to a service.
1601
1642
  * @param file - The file to convert to a service.
1602
1643
  * @returns The service.
1603
1644
  */
1604
- toService: toService(join15(path5)),
1645
+ toService: toService(join16(path5)),
1605
1646
  /**
1606
1647
  * ================================
1607
1648
  * Domains
@@ -1614,39 +1655,39 @@ var index_default = (path5) => {
1614
1655
  * @param options - Optional options to write the event
1615
1656
  *
1616
1657
  */
1617
- writeDomain: writeDomain(join15(path5, "domains")),
1658
+ writeDomain: writeDomain(join16(path5, "domains")),
1618
1659
  /**
1619
1660
  * Returns a domain from EventCatalog
1620
1661
  * @param id - The id of the domain to retrieve
1621
1662
  * @param version - Optional id of the version to get (supports semver)
1622
1663
  * @returns Domain|Undefined
1623
1664
  */
1624
- getDomain: getDomain(join15(path5, "domains")),
1665
+ getDomain: getDomain(join16(path5, "domains")),
1625
1666
  /**
1626
1667
  * Returns all domains from EventCatalog
1627
1668
  * @param latestOnly - optional boolean, set to true to get only latest versions
1628
1669
  * @returns Domain[]|Undefined
1629
1670
  */
1630
- getDomains: getDomains(join15(path5)),
1671
+ getDomains: getDomains(join16(path5)),
1631
1672
  /**
1632
1673
  * Moves a given domain id to the version directory
1633
1674
  * @param directory
1634
1675
  */
1635
- versionDomain: versionDomain(join15(path5, "domains")),
1676
+ versionDomain: versionDomain(join16(path5, "domains")),
1636
1677
  /**
1637
1678
  * Remove a domain from EventCatalog (modeled on the standard POSIX rm utility)
1638
1679
  *
1639
1680
  * @param path - The path to your domain, e.g. `/Payment`
1640
1681
  *
1641
1682
  */
1642
- rmDomain: rmDomain(join15(path5, "domains")),
1683
+ rmDomain: rmDomain(join16(path5, "domains")),
1643
1684
  /**
1644
1685
  * Remove an service by an domain id
1645
1686
  *
1646
1687
  * @param id - The id of the domain you want to remove
1647
1688
  *
1648
1689
  */
1649
- rmDomainById: rmDomainById(join15(path5, "domains")),
1690
+ rmDomainById: rmDomainById(join16(path5, "domains")),
1650
1691
  /**
1651
1692
  * Adds a file to the given domain
1652
1693
  * @param id - The id of the domain to add the file to
@@ -1654,28 +1695,28 @@ var index_default = (path5) => {
1654
1695
  * @param version - Optional version of the domain to add the file to
1655
1696
  * @returns
1656
1697
  */
1657
- addFileToDomain: addFileToDomain(join15(path5, "domains")),
1698
+ addFileToDomain: addFileToDomain(join16(path5, "domains")),
1658
1699
  /**
1659
1700
  * Adds an ubiquitous language dictionary to a domain
1660
1701
  * @param id - The id of the domain to add the ubiquitous language to
1661
1702
  * @param ubiquitousLanguageDictionary - The ubiquitous language dictionary to add
1662
1703
  * @param version - Optional version of the domain to add the ubiquitous language to
1663
1704
  */
1664
- addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain(join15(path5, "domains")),
1705
+ addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain(join16(path5, "domains")),
1665
1706
  /**
1666
1707
  * Get the ubiquitous language dictionary from a domain
1667
1708
  * @param id - The id of the domain to get the ubiquitous language from
1668
1709
  * @param version - Optional version of the domain to get the ubiquitous language from
1669
1710
  * @returns
1670
1711
  */
1671
- getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain(join15(path5, "domains")),
1712
+ getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain(join16(path5, "domains")),
1672
1713
  /**
1673
1714
  * Check to see if a domain version exists
1674
1715
  * @param id - The id of the domain
1675
1716
  * @param version - The version of the domain (supports semver)
1676
1717
  * @returns
1677
1718
  */
1678
- domainHasVersion: domainHasVersion(join15(path5)),
1719
+ domainHasVersion: domainHasVersion(join16(path5)),
1679
1720
  /**
1680
1721
  * Adds a given service to a domain
1681
1722
  * @param id - The id of the domain
@@ -1683,7 +1724,7 @@ var index_default = (path5) => {
1683
1724
  * @param version - (Optional) The version of the domain to add the service to
1684
1725
  * @returns
1685
1726
  */
1686
- addServiceToDomain: addServiceToDomain(join15(path5, "domains")),
1727
+ addServiceToDomain: addServiceToDomain(join16(path5, "domains")),
1687
1728
  /**
1688
1729
  * Adds a given subdomain to a domain
1689
1730
  * @param id - The id of the domain
@@ -1691,7 +1732,7 @@ var index_default = (path5) => {
1691
1732
  * @param version - (Optional) The version of the domain to add the subdomain to
1692
1733
  * @returns
1693
1734
  */
1694
- addSubDomainToDomain: addSubDomainToDomain(join15(path5, "domains")),
1735
+ addSubDomainToDomain: addSubDomainToDomain(join16(path5, "domains")),
1695
1736
  /**
1696
1737
  * Adds an entity to a domain
1697
1738
  * @param id - The id of the domain
@@ -1699,7 +1740,7 @@ var index_default = (path5) => {
1699
1740
  * @param version - (Optional) The version of the domain to add the entity to
1700
1741
  * @returns
1701
1742
  */
1702
- addEntityToDomain: addEntityToDomain(join15(path5, "domains")),
1743
+ addEntityToDomain: addEntityToDomain(join16(path5, "domains")),
1703
1744
  /**
1704
1745
  * ================================
1705
1746
  * Teams
@@ -1712,25 +1753,25 @@ var index_default = (path5) => {
1712
1753
  * @param options - Optional options to write the team
1713
1754
  *
1714
1755
  */
1715
- writeTeam: writeTeam(join15(path5, "teams")),
1756
+ writeTeam: writeTeam(join16(path5, "teams")),
1716
1757
  /**
1717
1758
  * Returns a team from EventCatalog
1718
1759
  * @param id - The id of the team to retrieve
1719
1760
  * @returns Team|Undefined
1720
1761
  */
1721
- getTeam: getTeam(join15(path5, "teams")),
1762
+ getTeam: getTeam(join16(path5, "teams")),
1722
1763
  /**
1723
1764
  * Returns all teams from EventCatalog
1724
1765
  * @returns Team[]|Undefined
1725
1766
  */
1726
- getTeams: getTeams(join15(path5, "teams")),
1767
+ getTeams: getTeams(join16(path5, "teams")),
1727
1768
  /**
1728
1769
  * Remove a team by the team id
1729
1770
  *
1730
1771
  * @param id - The id of the team you want to remove
1731
1772
  *
1732
1773
  */
1733
- rmTeamById: rmTeamById(join15(path5, "teams")),
1774
+ rmTeamById: rmTeamById(join16(path5, "teams")),
1734
1775
  /**
1735
1776
  * ================================
1736
1777
  * Users
@@ -1743,25 +1784,25 @@ var index_default = (path5) => {
1743
1784
  * @param options - Optional options to write the user
1744
1785
  *
1745
1786
  */
1746
- writeUser: writeUser(join15(path5, "users")),
1787
+ writeUser: writeUser(join16(path5, "users")),
1747
1788
  /**
1748
1789
  * Returns a user from EventCatalog
1749
1790
  * @param id - The id of the user to retrieve
1750
1791
  * @returns User|Undefined
1751
1792
  */
1752
- getUser: getUser(join15(path5, "users")),
1793
+ getUser: getUser(join16(path5, "users")),
1753
1794
  /**
1754
1795
  * Returns all user from EventCatalog
1755
1796
  * @returns User[]|Undefined
1756
1797
  */
1757
- getUsers: getUsers(join15(path5)),
1798
+ getUsers: getUsers(join16(path5)),
1758
1799
  /**
1759
1800
  * Remove a user by the user id
1760
1801
  *
1761
1802
  * @param id - The id of the user you want to remove
1762
1803
  *
1763
1804
  */
1764
- rmUserById: rmUserById(join15(path5, "users")),
1805
+ rmUserById: rmUserById(join16(path5, "users")),
1765
1806
  /**
1766
1807
  * ================================
1767
1808
  * Custom Docs
@@ -1772,32 +1813,32 @@ var index_default = (path5) => {
1772
1813
  * @param path - The path to the custom doc to retrieve
1773
1814
  * @returns CustomDoc|Undefined
1774
1815
  */
1775
- getCustomDoc: getCustomDoc(join15(path5, "docs")),
1816
+ getCustomDoc: getCustomDoc(join16(path5, "docs")),
1776
1817
  /**
1777
1818
  * Returns all custom docs from EventCatalog
1778
1819
  * @param options - Optional options to get custom docs from a specific path
1779
1820
  * @returns CustomDoc[]|Undefined
1780
1821
  */
1781
- getCustomDocs: getCustomDocs(join15(path5, "docs")),
1822
+ getCustomDocs: getCustomDocs(join16(path5, "docs")),
1782
1823
  /**
1783
1824
  * Writes a custom doc to EventCatalog
1784
1825
  * @param customDoc - The custom doc to write
1785
1826
  * @param options - Optional options to write the custom doc
1786
1827
  *
1787
1828
  */
1788
- writeCustomDoc: writeCustomDoc(join15(path5, "docs")),
1829
+ writeCustomDoc: writeCustomDoc(join16(path5, "docs")),
1789
1830
  /**
1790
1831
  * Removes a custom doc from EventCatalog
1791
1832
  * @param path - The path to the custom doc to remove
1792
1833
  *
1793
1834
  */
1794
- rmCustomDoc: rmCustomDoc(join15(path5, "docs")),
1835
+ rmCustomDoc: rmCustomDoc(join16(path5, "docs")),
1795
1836
  /**
1796
1837
  * Dumps the catalog to a JSON file.
1797
1838
  * @param directory - The directory to dump the catalog to
1798
1839
  * @returns A JSON file with the catalog
1799
1840
  */
1800
- dumpCatalog: dumpCatalog(join15(path5)),
1841
+ dumpCatalog: dumpCatalog(join16(path5)),
1801
1842
  /**
1802
1843
  * Returns the event catalog configuration file.
1803
1844
  * The event catalog configuration file is the file that contains the configuration for the event catalog.
@@ -1805,7 +1846,7 @@ var index_default = (path5) => {
1805
1846
  * @param directory - The directory of the catalog.
1806
1847
  * @returns A JSON object with the configuration for the event catalog.
1807
1848
  */
1808
- getEventCatalogConfigurationFile: getEventCatalogConfigurationFile(join15(path5)),
1849
+ getEventCatalogConfigurationFile: getEventCatalogConfigurationFile(join16(path5)),
1809
1850
  /**
1810
1851
  * ================================
1811
1852
  * Resources Utils
@@ -1826,33 +1867,33 @@ var index_default = (path5) => {
1826
1867
  * @param path - The path to the message to retrieve
1827
1868
  * @returns Message|Undefined
1828
1869
  */
1829
- getMessageBySchemaPath: getMessageBySchemaPath(join15(path5)),
1870
+ getMessageBySchemaPath: getMessageBySchemaPath(join16(path5)),
1830
1871
  /**
1831
1872
  * Returns the producers and consumers (services) for a given message
1832
1873
  * @param id - The id of the message to get the producers and consumers for
1833
1874
  * @param version - Optional version of the message
1834
1875
  * @returns { producers: Service[], consumers: Service[] }
1835
1876
  */
1836
- getProducersAndConsumersForMessage: getProducersAndConsumersForMessage(join15(path5)),
1877
+ getProducersAndConsumersForMessage: getProducersAndConsumersForMessage(join16(path5)),
1837
1878
  /**
1838
1879
  * Returns the consumers of a given schema path
1839
1880
  * @param path - The path to the schema to get the consumers for
1840
1881
  * @returns Service[]
1841
1882
  */
1842
- getConsumersOfSchema: getConsumersOfSchema(join15(path5)),
1883
+ getConsumersOfSchema: getConsumersOfSchema(join16(path5)),
1843
1884
  /**
1844
1885
  * Returns the producers of a given schema path
1845
1886
  * @param path - The path to the schema to get the producers for
1846
1887
  * @returns Service[]
1847
1888
  */
1848
- getProducersOfSchema: getProducersOfSchema(join15(path5)),
1889
+ getProducersOfSchema: getProducersOfSchema(join16(path5)),
1849
1890
  /**
1850
1891
  * Returns the owners for a given resource (e.g domain, service, event, command, query, etc.)
1851
1892
  * @param id - The id of the resource to get the owners for
1852
1893
  * @param version - Optional version of the resource
1853
1894
  * @returns { owners: User[] }
1854
1895
  */
1855
- getOwnersForResource: getOwnersForResource(join15(path5)),
1896
+ getOwnersForResource: getOwnersForResource(join16(path5)),
1856
1897
  /**
1857
1898
  * ================================
1858
1899
  * Entities
@@ -1864,13 +1905,13 @@ var index_default = (path5) => {
1864
1905
  * @param version - Optional id of the version to get (supports semver)
1865
1906
  * @returns Entity|Undefined
1866
1907
  */
1867
- getEntity: getEntity(join15(path5)),
1908
+ getEntity: getEntity(join16(path5)),
1868
1909
  /**
1869
1910
  * Returns all entities from EventCatalog
1870
1911
  * @param latestOnly - optional boolean, set to true to get only latest versions
1871
1912
  * @returns Entity[]|Undefined
1872
1913
  */
1873
- getEntities: getEntities(join15(path5)),
1914
+ getEntities: getEntities(join16(path5)),
1874
1915
  /**
1875
1916
  * Adds an entity to EventCatalog
1876
1917
  *
@@ -1878,33 +1919,95 @@ var index_default = (path5) => {
1878
1919
  * @param options - Optional options to write the entity
1879
1920
  *
1880
1921
  */
1881
- writeEntity: writeEntity(join15(path5, "entities")),
1922
+ writeEntity: writeEntity(join16(path5, "entities")),
1882
1923
  /**
1883
1924
  * Remove an entity from EventCatalog (modeled on the standard POSIX rm utility)
1884
1925
  *
1885
1926
  * @param path - The path to your entity, e.g. `/User`
1886
1927
  *
1887
1928
  */
1888
- rmEntity: rmEntity(join15(path5, "entities")),
1929
+ rmEntity: rmEntity(join16(path5, "entities")),
1889
1930
  /**
1890
1931
  * Remove an entity by an entity id
1891
1932
  *
1892
1933
  * @param id - The id of the entity you want to remove
1893
1934
  *
1894
1935
  */
1895
- rmEntityById: rmEntityById(join15(path5)),
1936
+ rmEntityById: rmEntityById(join16(path5)),
1896
1937
  /**
1897
1938
  * Moves a given entity id to the version directory
1898
1939
  * @param id - The id of the entity to version
1899
1940
  */
1900
- versionEntity: versionEntity(join15(path5)),
1941
+ versionEntity: versionEntity(join16(path5)),
1901
1942
  /**
1902
1943
  * Check to see if an entity version exists
1903
1944
  * @param id - The id of the entity
1904
1945
  * @param version - The version of the entity (supports semver)
1905
1946
  * @returns
1906
1947
  */
1907
- 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))
1908
2011
  };
1909
2012
  };
1910
2013
  export {