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