@eventcatalog/sdk 2.10.0 → 2.11.0
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/data-products.d.mts +225 -0
- package/dist/data-products.d.ts +225 -0
- package/dist/data-products.js +375 -0
- package/dist/data-products.js.map +1 -0
- package/dist/data-products.mjs +332 -0
- package/dist/data-products.mjs.map +1 -0
- package/dist/domains.d.mts +51 -1
- package/dist/domains.d.ts +51 -1
- package/dist/domains.js +67 -0
- package/dist/domains.js.map +1 -1
- package/dist/domains.mjs +65 -0
- package/dist/domains.mjs.map +1 -1
- package/dist/eventcatalog.js +329 -112
- package/dist/eventcatalog.js.map +1 -1
- package/dist/eventcatalog.mjs +331 -114
- package/dist/eventcatalog.mjs.map +1 -1
- package/dist/index.d.mts +177 -4
- package/dist/index.d.ts +177 -4
- package/dist/index.js +325 -108
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +325 -108
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.d.mts +28 -1
- package/dist/types.d.d.ts +28 -1
- package/dist/types.d.js.map +1 -1
- package/package.json +1 -1
package/dist/eventcatalog.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// src/eventcatalog.ts
|
|
2
|
-
import
|
|
3
|
-
import path5, { join as
|
|
2
|
+
import fs13 from "fs";
|
|
3
|
+
import path5, { join as join17 } from "node:path";
|
|
4
4
|
|
|
5
5
|
// src/index.ts
|
|
6
|
-
import { join as
|
|
6
|
+
import { join as join16 } from "node:path";
|
|
7
7
|
|
|
8
8
|
// src/events.ts
|
|
9
9
|
import fs2 from "node:fs/promises";
|
|
@@ -655,6 +655,15 @@ var writeDomain = (directory) => async (domain, options = {
|
|
|
655
655
|
if (Array.isArray(domain.domains)) {
|
|
656
656
|
resource.domains = uniqueVersions(domain.domains);
|
|
657
657
|
}
|
|
658
|
+
if (Array.isArray(domain.sends)) {
|
|
659
|
+
resource.sends = uniqueVersions(domain.sends);
|
|
660
|
+
}
|
|
661
|
+
if (Array.isArray(domain.receives)) {
|
|
662
|
+
resource.receives = uniqueVersions(domain.receives);
|
|
663
|
+
}
|
|
664
|
+
if (Array.isArray(domain.dataProducts)) {
|
|
665
|
+
resource.dataProducts = uniqueVersions(domain.dataProducts);
|
|
666
|
+
}
|
|
658
667
|
return await writeResource(directory, resource, { ...options, type: "domain" });
|
|
659
668
|
};
|
|
660
669
|
var versionDomain = (directory) => async (id) => versionResource(directory, id);
|
|
@@ -728,6 +737,60 @@ var addEntityToDomain = (directory) => async (id, entity, version) => {
|
|
|
728
737
|
await rmDomainById(directory)(id, version, true);
|
|
729
738
|
await writeDomain(directory)(domain, { format: extension === ".md" ? "md" : "mdx" });
|
|
730
739
|
};
|
|
740
|
+
var addDataProductToDomain = (directory) => async (id, dataProduct, version) => {
|
|
741
|
+
let domain = await getDomain(directory)(id, version);
|
|
742
|
+
const domainPath = await getResourcePath(directory, id, version);
|
|
743
|
+
const extension = path2.extname(domainPath?.fullPath || "");
|
|
744
|
+
if (domain.dataProducts === void 0) {
|
|
745
|
+
domain.dataProducts = [];
|
|
746
|
+
}
|
|
747
|
+
const dataProductExistsInList = domain.dataProducts.some(
|
|
748
|
+
(dp) => dp.id === dataProduct.id && dp.version === dataProduct.version
|
|
749
|
+
);
|
|
750
|
+
if (dataProductExistsInList) {
|
|
751
|
+
return;
|
|
752
|
+
}
|
|
753
|
+
domain.dataProducts.push(dataProduct);
|
|
754
|
+
await rmDomainById(directory)(id, version, true);
|
|
755
|
+
await writeDomain(directory)(domain, { format: extension === ".md" ? "md" : "mdx" });
|
|
756
|
+
};
|
|
757
|
+
var addMessageToDomain = (directory) => async (id, direction, message, version) => {
|
|
758
|
+
let domain = await getDomain(directory)(id, version);
|
|
759
|
+
const domainPath = await getResourcePath(directory, id, version);
|
|
760
|
+
const extension = path2.extname(domainPath?.fullPath || "");
|
|
761
|
+
if (direction === "sends") {
|
|
762
|
+
if (domain.sends === void 0) {
|
|
763
|
+
domain.sends = [];
|
|
764
|
+
}
|
|
765
|
+
for (let i = 0; i < domain.sends.length; i++) {
|
|
766
|
+
if (domain.sends[i].id === message.id && domain.sends[i].version === message.version) {
|
|
767
|
+
return;
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
domain.sends.push({ id: message.id, version: message.version });
|
|
771
|
+
} else if (direction === "receives") {
|
|
772
|
+
if (domain.receives === void 0) {
|
|
773
|
+
domain.receives = [];
|
|
774
|
+
}
|
|
775
|
+
for (let i = 0; i < domain.receives.length; i++) {
|
|
776
|
+
if (domain.receives[i].id === message.id && domain.receives[i].version === message.version) {
|
|
777
|
+
return;
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
domain.receives.push({ id: message.id, version: message.version });
|
|
781
|
+
} else {
|
|
782
|
+
throw new Error(`Direction ${direction} is invalid, only 'receives' and 'sends' are supported`);
|
|
783
|
+
}
|
|
784
|
+
const existingResource = await findFileById(directory, id, version);
|
|
785
|
+
if (!existingResource) {
|
|
786
|
+
throw new Error(`Cannot find domain ${id} in the catalog`);
|
|
787
|
+
}
|
|
788
|
+
const normalizedPath = existingResource.replace(/\\/g, "/");
|
|
789
|
+
const lastDomainsIndex = normalizedPath.lastIndexOf("/domains/");
|
|
790
|
+
const pathToResource = existingResource.substring(0, lastDomainsIndex + "/domains".length);
|
|
791
|
+
await rmDomainById(directory)(id, version, true);
|
|
792
|
+
await writeDomain(pathToResource)(domain, { format: extension === ".md" ? "md" : "mdx" });
|
|
793
|
+
};
|
|
731
794
|
|
|
732
795
|
// src/channels.ts
|
|
733
796
|
import fs7 from "node:fs/promises";
|
|
@@ -1094,6 +1157,34 @@ var dataStoreHasVersion = containerHasVersion;
|
|
|
1094
1157
|
var addFileToDataStore = addFileToContainer;
|
|
1095
1158
|
var writeDataStoreToService = writeContainerToService;
|
|
1096
1159
|
|
|
1160
|
+
// src/data-products.ts
|
|
1161
|
+
import fs12 from "node:fs/promises";
|
|
1162
|
+
import { join as join15 } from "node:path";
|
|
1163
|
+
var getDataProduct = (directory) => async (id, version) => getResource(directory, id, version, { type: "data-product" });
|
|
1164
|
+
var getDataProducts = (directory) => async (options) => getResources(directory, { type: "data-products", latestOnly: options?.latestOnly });
|
|
1165
|
+
var writeDataProduct = (directory) => async (dataProduct, options = {
|
|
1166
|
+
path: "",
|
|
1167
|
+
override: false,
|
|
1168
|
+
format: "mdx"
|
|
1169
|
+
}) => writeResource(directory, { ...dataProduct }, { ...options, type: "data-product" });
|
|
1170
|
+
var writeDataProductToDomain = (directory) => async (dataProduct, domain, options = { path: "", format: "mdx", override: false }) => {
|
|
1171
|
+
let pathForDataProduct = domain.version && domain.version !== "latest" ? `/${domain.id}/versioned/${domain.version}/data-products` : `/${domain.id}/data-products`;
|
|
1172
|
+
pathForDataProduct = join15(pathForDataProduct, dataProduct.id);
|
|
1173
|
+
await writeResource(directory, { ...dataProduct }, { ...options, path: pathForDataProduct, type: "data-product" });
|
|
1174
|
+
};
|
|
1175
|
+
var rmDataProduct = (directory) => async (path6) => {
|
|
1176
|
+
await fs12.rm(join15(directory, path6), { recursive: true });
|
|
1177
|
+
};
|
|
1178
|
+
var rmDataProductById = (directory) => async (id, version, persistFiles) => {
|
|
1179
|
+
await rmResourceById(directory, id, version, { type: "data-product", persistFiles });
|
|
1180
|
+
};
|
|
1181
|
+
var versionDataProduct = (directory) => async (id) => versionResource(directory, id);
|
|
1182
|
+
var dataProductHasVersion = (directory) => async (id, version) => {
|
|
1183
|
+
const file = await findFileById(directory, id, version);
|
|
1184
|
+
return !!file;
|
|
1185
|
+
};
|
|
1186
|
+
var addFileToDataProduct = (directory) => async (id, file, version) => addFileToResource(directory, id, file, version);
|
|
1187
|
+
|
|
1097
1188
|
// src/index.ts
|
|
1098
1189
|
var src_default = (path6) => {
|
|
1099
1190
|
return {
|
|
@@ -1103,13 +1194,13 @@ var src_default = (path6) => {
|
|
|
1103
1194
|
* @param version - Optional id of the version to get (supports semver)
|
|
1104
1195
|
* @returns Event|Undefined
|
|
1105
1196
|
*/
|
|
1106
|
-
getEvent: getEvent(
|
|
1197
|
+
getEvent: getEvent(join16(path6)),
|
|
1107
1198
|
/**
|
|
1108
1199
|
* Returns all events from EventCatalog
|
|
1109
1200
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1110
1201
|
* @returns Event[]|Undefined
|
|
1111
1202
|
*/
|
|
1112
|
-
getEvents: getEvents(
|
|
1203
|
+
getEvents: getEvents(join16(path6)),
|
|
1113
1204
|
/**
|
|
1114
1205
|
* Adds an event to EventCatalog
|
|
1115
1206
|
*
|
|
@@ -1117,7 +1208,7 @@ var src_default = (path6) => {
|
|
|
1117
1208
|
* @param options - Optional options to write the event
|
|
1118
1209
|
*
|
|
1119
1210
|
*/
|
|
1120
|
-
writeEvent: writeEvent(
|
|
1211
|
+
writeEvent: writeEvent(join16(path6, "events")),
|
|
1121
1212
|
/**
|
|
1122
1213
|
* Adds an event to a service in EventCatalog
|
|
1123
1214
|
*
|
|
@@ -1126,26 +1217,26 @@ var src_default = (path6) => {
|
|
|
1126
1217
|
* @param options - Optional options to write the event
|
|
1127
1218
|
*
|
|
1128
1219
|
*/
|
|
1129
|
-
writeEventToService: writeEventToService(
|
|
1220
|
+
writeEventToService: writeEventToService(join16(path6)),
|
|
1130
1221
|
/**
|
|
1131
1222
|
* Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
|
|
1132
1223
|
*
|
|
1133
1224
|
* @param path - The path to your event, e.g. `/Inventory/InventoryAdjusted`
|
|
1134
1225
|
*
|
|
1135
1226
|
*/
|
|
1136
|
-
rmEvent: rmEvent(
|
|
1227
|
+
rmEvent: rmEvent(join16(path6, "events")),
|
|
1137
1228
|
/**
|
|
1138
1229
|
* Remove an event by an Event id
|
|
1139
1230
|
*
|
|
1140
1231
|
* @param id - The id of the event you want to remove
|
|
1141
1232
|
*
|
|
1142
1233
|
*/
|
|
1143
|
-
rmEventById: rmEventById(
|
|
1234
|
+
rmEventById: rmEventById(join16(path6)),
|
|
1144
1235
|
/**
|
|
1145
1236
|
* Moves a given event id to the version directory
|
|
1146
1237
|
* @param directory
|
|
1147
1238
|
*/
|
|
1148
|
-
versionEvent: versionEvent(
|
|
1239
|
+
versionEvent: versionEvent(join16(path6)),
|
|
1149
1240
|
/**
|
|
1150
1241
|
* Adds a file to the given event
|
|
1151
1242
|
* @param id - The id of the event to add the file to
|
|
@@ -1153,7 +1244,7 @@ var src_default = (path6) => {
|
|
|
1153
1244
|
* @param version - Optional version of the event to add the file to
|
|
1154
1245
|
* @returns
|
|
1155
1246
|
*/
|
|
1156
|
-
addFileToEvent: addFileToEvent(
|
|
1247
|
+
addFileToEvent: addFileToEvent(join16(path6)),
|
|
1157
1248
|
/**
|
|
1158
1249
|
* Adds a schema to the given event
|
|
1159
1250
|
* @param id - The id of the event to add the schema to
|
|
@@ -1161,14 +1252,14 @@ var src_default = (path6) => {
|
|
|
1161
1252
|
* @param version - Optional version of the event to add the schema to
|
|
1162
1253
|
* @returns
|
|
1163
1254
|
*/
|
|
1164
|
-
addSchemaToEvent: addSchemaToEvent(
|
|
1255
|
+
addSchemaToEvent: addSchemaToEvent(join16(path6)),
|
|
1165
1256
|
/**
|
|
1166
1257
|
* Check to see if an event version exists
|
|
1167
1258
|
* @param id - The id of the event
|
|
1168
1259
|
* @param version - The version of the event (supports semver)
|
|
1169
1260
|
* @returns
|
|
1170
1261
|
*/
|
|
1171
|
-
eventHasVersion: eventHasVersion(
|
|
1262
|
+
eventHasVersion: eventHasVersion(join16(path6)),
|
|
1172
1263
|
/**
|
|
1173
1264
|
* ================================
|
|
1174
1265
|
* Commands
|
|
@@ -1180,13 +1271,13 @@ var src_default = (path6) => {
|
|
|
1180
1271
|
* @param version - Optional id of the version to get (supports semver)
|
|
1181
1272
|
* @returns Command|Undefined
|
|
1182
1273
|
*/
|
|
1183
|
-
getCommand: getCommand(
|
|
1274
|
+
getCommand: getCommand(join16(path6)),
|
|
1184
1275
|
/**
|
|
1185
1276
|
* Returns all commands from EventCatalog
|
|
1186
1277
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1187
1278
|
* @returns Command[]|Undefined
|
|
1188
1279
|
*/
|
|
1189
|
-
getCommands: getCommands(
|
|
1280
|
+
getCommands: getCommands(join16(path6)),
|
|
1190
1281
|
/**
|
|
1191
1282
|
* Adds an command to EventCatalog
|
|
1192
1283
|
*
|
|
@@ -1194,7 +1285,7 @@ var src_default = (path6) => {
|
|
|
1194
1285
|
* @param options - Optional options to write the command
|
|
1195
1286
|
*
|
|
1196
1287
|
*/
|
|
1197
|
-
writeCommand: writeCommand(
|
|
1288
|
+
writeCommand: writeCommand(join16(path6, "commands")),
|
|
1198
1289
|
/**
|
|
1199
1290
|
* Adds a command to a service in EventCatalog
|
|
1200
1291
|
*
|
|
@@ -1203,26 +1294,26 @@ var src_default = (path6) => {
|
|
|
1203
1294
|
* @param options - Optional options to write the command
|
|
1204
1295
|
*
|
|
1205
1296
|
*/
|
|
1206
|
-
writeCommandToService: writeCommandToService(
|
|
1297
|
+
writeCommandToService: writeCommandToService(join16(path6)),
|
|
1207
1298
|
/**
|
|
1208
1299
|
* Remove an command to EventCatalog (modeled on the standard POSIX rm utility)
|
|
1209
1300
|
*
|
|
1210
1301
|
* @param path - The path to your command, e.g. `/Inventory/InventoryAdjusted`
|
|
1211
1302
|
*
|
|
1212
1303
|
*/
|
|
1213
|
-
rmCommand: rmCommand(
|
|
1304
|
+
rmCommand: rmCommand(join16(path6, "commands")),
|
|
1214
1305
|
/**
|
|
1215
1306
|
* Remove an command by an Event id
|
|
1216
1307
|
*
|
|
1217
1308
|
* @param id - The id of the command you want to remove
|
|
1218
1309
|
*
|
|
1219
1310
|
*/
|
|
1220
|
-
rmCommandById: rmCommandById(
|
|
1311
|
+
rmCommandById: rmCommandById(join16(path6)),
|
|
1221
1312
|
/**
|
|
1222
1313
|
* Moves a given command id to the version directory
|
|
1223
1314
|
* @param directory
|
|
1224
1315
|
*/
|
|
1225
|
-
versionCommand: versionCommand(
|
|
1316
|
+
versionCommand: versionCommand(join16(path6)),
|
|
1226
1317
|
/**
|
|
1227
1318
|
* Adds a file to the given command
|
|
1228
1319
|
* @param id - The id of the command to add the file to
|
|
@@ -1230,7 +1321,7 @@ var src_default = (path6) => {
|
|
|
1230
1321
|
* @param version - Optional version of the command to add the file to
|
|
1231
1322
|
* @returns
|
|
1232
1323
|
*/
|
|
1233
|
-
addFileToCommand: addFileToCommand(
|
|
1324
|
+
addFileToCommand: addFileToCommand(join16(path6)),
|
|
1234
1325
|
/**
|
|
1235
1326
|
* Adds a schema to the given command
|
|
1236
1327
|
* @param id - The id of the command to add the schema to
|
|
@@ -1238,14 +1329,14 @@ var src_default = (path6) => {
|
|
|
1238
1329
|
* @param version - Optional version of the command to add the schema to
|
|
1239
1330
|
* @returns
|
|
1240
1331
|
*/
|
|
1241
|
-
addSchemaToCommand: addSchemaToCommand(
|
|
1332
|
+
addSchemaToCommand: addSchemaToCommand(join16(path6)),
|
|
1242
1333
|
/**
|
|
1243
1334
|
* Check to see if a command version exists
|
|
1244
1335
|
* @param id - The id of the command
|
|
1245
1336
|
* @param version - The version of the command (supports semver)
|
|
1246
1337
|
* @returns
|
|
1247
1338
|
*/
|
|
1248
|
-
commandHasVersion: commandHasVersion(
|
|
1339
|
+
commandHasVersion: commandHasVersion(join16(path6)),
|
|
1249
1340
|
/**
|
|
1250
1341
|
* ================================
|
|
1251
1342
|
* Queries
|
|
@@ -1257,13 +1348,13 @@ var src_default = (path6) => {
|
|
|
1257
1348
|
* @param version - Optional id of the version to get (supports semver)
|
|
1258
1349
|
* @returns Query|Undefined
|
|
1259
1350
|
*/
|
|
1260
|
-
getQuery: getQuery(
|
|
1351
|
+
getQuery: getQuery(join16(path6)),
|
|
1261
1352
|
/**
|
|
1262
1353
|
* Returns all queries from EventCatalog
|
|
1263
1354
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1264
1355
|
* @returns Query[]|Undefined
|
|
1265
1356
|
*/
|
|
1266
|
-
getQueries: getQueries(
|
|
1357
|
+
getQueries: getQueries(join16(path6)),
|
|
1267
1358
|
/**
|
|
1268
1359
|
* Adds a query to EventCatalog
|
|
1269
1360
|
*
|
|
@@ -1271,7 +1362,7 @@ var src_default = (path6) => {
|
|
|
1271
1362
|
* @param options - Optional options to write the event
|
|
1272
1363
|
*
|
|
1273
1364
|
*/
|
|
1274
|
-
writeQuery: writeQuery(
|
|
1365
|
+
writeQuery: writeQuery(join16(path6, "queries")),
|
|
1275
1366
|
/**
|
|
1276
1367
|
* Adds a query to a service in EventCatalog
|
|
1277
1368
|
*
|
|
@@ -1280,26 +1371,26 @@ var src_default = (path6) => {
|
|
|
1280
1371
|
* @param options - Optional options to write the query
|
|
1281
1372
|
*
|
|
1282
1373
|
*/
|
|
1283
|
-
writeQueryToService: writeQueryToService(
|
|
1374
|
+
writeQueryToService: writeQueryToService(join16(path6)),
|
|
1284
1375
|
/**
|
|
1285
1376
|
* Remove an query to EventCatalog (modeled on the standard POSIX rm utility)
|
|
1286
1377
|
*
|
|
1287
1378
|
* @param path - The path to your query, e.g. `/Orders/GetOrder`
|
|
1288
1379
|
*
|
|
1289
1380
|
*/
|
|
1290
|
-
rmQuery: rmQuery(
|
|
1381
|
+
rmQuery: rmQuery(join16(path6, "queries")),
|
|
1291
1382
|
/**
|
|
1292
1383
|
* Remove a query by a Query id
|
|
1293
1384
|
*
|
|
1294
1385
|
* @param id - The id of the query you want to remove
|
|
1295
1386
|
*
|
|
1296
1387
|
*/
|
|
1297
|
-
rmQueryById: rmQueryById(
|
|
1388
|
+
rmQueryById: rmQueryById(join16(path6)),
|
|
1298
1389
|
/**
|
|
1299
1390
|
* Moves a given query id to the version directory
|
|
1300
1391
|
* @param directory
|
|
1301
1392
|
*/
|
|
1302
|
-
versionQuery: versionQuery(
|
|
1393
|
+
versionQuery: versionQuery(join16(path6)),
|
|
1303
1394
|
/**
|
|
1304
1395
|
* Adds a file to the given query
|
|
1305
1396
|
* @param id - The id of the query to add the file to
|
|
@@ -1307,7 +1398,7 @@ var src_default = (path6) => {
|
|
|
1307
1398
|
* @param version - Optional version of the query to add the file to
|
|
1308
1399
|
* @returns
|
|
1309
1400
|
*/
|
|
1310
|
-
addFileToQuery: addFileToQuery(
|
|
1401
|
+
addFileToQuery: addFileToQuery(join16(path6)),
|
|
1311
1402
|
/**
|
|
1312
1403
|
* Adds a schema to the given query
|
|
1313
1404
|
* @param id - The id of the query to add the schema to
|
|
@@ -1315,14 +1406,14 @@ var src_default = (path6) => {
|
|
|
1315
1406
|
* @param version - Optional version of the query to add the schema to
|
|
1316
1407
|
* @returns
|
|
1317
1408
|
*/
|
|
1318
|
-
addSchemaToQuery: addSchemaToQuery(
|
|
1409
|
+
addSchemaToQuery: addSchemaToQuery(join16(path6)),
|
|
1319
1410
|
/**
|
|
1320
1411
|
* Check to see if an query version exists
|
|
1321
1412
|
* @param id - The id of the query
|
|
1322
1413
|
* @param version - The version of the query (supports semver)
|
|
1323
1414
|
* @returns
|
|
1324
1415
|
*/
|
|
1325
|
-
queryHasVersion: queryHasVersion(
|
|
1416
|
+
queryHasVersion: queryHasVersion(join16(path6)),
|
|
1326
1417
|
/**
|
|
1327
1418
|
* ================================
|
|
1328
1419
|
* Channels
|
|
@@ -1334,13 +1425,13 @@ var src_default = (path6) => {
|
|
|
1334
1425
|
* @param version - Optional id of the version to get (supports semver)
|
|
1335
1426
|
* @returns Channel|Undefined
|
|
1336
1427
|
*/
|
|
1337
|
-
getChannel: getChannel(
|
|
1428
|
+
getChannel: getChannel(join16(path6)),
|
|
1338
1429
|
/**
|
|
1339
1430
|
* Returns all channels from EventCatalog
|
|
1340
1431
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1341
1432
|
* @returns Channel[]|Undefined
|
|
1342
1433
|
*/
|
|
1343
|
-
getChannels: getChannels(
|
|
1434
|
+
getChannels: getChannels(join16(path6)),
|
|
1344
1435
|
/**
|
|
1345
1436
|
* Adds an channel to EventCatalog
|
|
1346
1437
|
*
|
|
@@ -1348,33 +1439,33 @@ var src_default = (path6) => {
|
|
|
1348
1439
|
* @param options - Optional options to write the channel
|
|
1349
1440
|
*
|
|
1350
1441
|
*/
|
|
1351
|
-
writeChannel: writeChannel(
|
|
1442
|
+
writeChannel: writeChannel(join16(path6, "channels")),
|
|
1352
1443
|
/**
|
|
1353
1444
|
* Remove an channel to EventCatalog (modeled on the standard POSIX rm utility)
|
|
1354
1445
|
*
|
|
1355
1446
|
* @param path - The path to your channel, e.g. `/Inventory/InventoryAdjusted`
|
|
1356
1447
|
*
|
|
1357
1448
|
*/
|
|
1358
|
-
rmChannel: rmChannel(
|
|
1449
|
+
rmChannel: rmChannel(join16(path6, "channels")),
|
|
1359
1450
|
/**
|
|
1360
1451
|
* Remove an channel by an Event id
|
|
1361
1452
|
*
|
|
1362
1453
|
* @param id - The id of the channel you want to remove
|
|
1363
1454
|
*
|
|
1364
1455
|
*/
|
|
1365
|
-
rmChannelById: rmChannelById(
|
|
1456
|
+
rmChannelById: rmChannelById(join16(path6)),
|
|
1366
1457
|
/**
|
|
1367
1458
|
* Moves a given channel id to the version directory
|
|
1368
1459
|
* @param directory
|
|
1369
1460
|
*/
|
|
1370
|
-
versionChannel: versionChannel(
|
|
1461
|
+
versionChannel: versionChannel(join16(path6)),
|
|
1371
1462
|
/**
|
|
1372
1463
|
* Check to see if a channel version exists
|
|
1373
1464
|
* @param id - The id of the channel
|
|
1374
1465
|
* @param version - The version of the channel (supports semver)
|
|
1375
1466
|
* @returns
|
|
1376
1467
|
*/
|
|
1377
|
-
channelHasVersion: channelHasVersion(
|
|
1468
|
+
channelHasVersion: channelHasVersion(join16(path6)),
|
|
1378
1469
|
/**
|
|
1379
1470
|
* Add a channel to an event
|
|
1380
1471
|
*
|
|
@@ -1391,7 +1482,7 @@ var src_default = (path6) => {
|
|
|
1391
1482
|
*
|
|
1392
1483
|
* ```
|
|
1393
1484
|
*/
|
|
1394
|
-
addEventToChannel: addMessageToChannel(
|
|
1485
|
+
addEventToChannel: addMessageToChannel(join16(path6), "events"),
|
|
1395
1486
|
/**
|
|
1396
1487
|
* Add a channel to an command
|
|
1397
1488
|
*
|
|
@@ -1408,7 +1499,7 @@ var src_default = (path6) => {
|
|
|
1408
1499
|
*
|
|
1409
1500
|
* ```
|
|
1410
1501
|
*/
|
|
1411
|
-
addCommandToChannel: addMessageToChannel(
|
|
1502
|
+
addCommandToChannel: addMessageToChannel(join16(path6), "commands"),
|
|
1412
1503
|
/**
|
|
1413
1504
|
* Add a channel to an query
|
|
1414
1505
|
*
|
|
@@ -1425,7 +1516,7 @@ var src_default = (path6) => {
|
|
|
1425
1516
|
*
|
|
1426
1517
|
* ```
|
|
1427
1518
|
*/
|
|
1428
|
-
addQueryToChannel: addMessageToChannel(
|
|
1519
|
+
addQueryToChannel: addMessageToChannel(join16(path6), "queries"),
|
|
1429
1520
|
/**
|
|
1430
1521
|
* ================================
|
|
1431
1522
|
* SERVICES
|
|
@@ -1438,14 +1529,14 @@ var src_default = (path6) => {
|
|
|
1438
1529
|
* @param options - Optional options to write the event
|
|
1439
1530
|
*
|
|
1440
1531
|
*/
|
|
1441
|
-
writeService: writeService(
|
|
1532
|
+
writeService: writeService(join16(path6, "services")),
|
|
1442
1533
|
/**
|
|
1443
1534
|
* Adds a versioned service to EventCatalog
|
|
1444
1535
|
*
|
|
1445
1536
|
* @param service - The service to write
|
|
1446
1537
|
*
|
|
1447
1538
|
*/
|
|
1448
|
-
writeVersionedService: writeVersionedService(
|
|
1539
|
+
writeVersionedService: writeVersionedService(join16(path6, "services")),
|
|
1449
1540
|
/**
|
|
1450
1541
|
* Adds a service to a domain in EventCatalog
|
|
1451
1542
|
*
|
|
@@ -1454,45 +1545,45 @@ var src_default = (path6) => {
|
|
|
1454
1545
|
* @param options - Optional options to write the event
|
|
1455
1546
|
*
|
|
1456
1547
|
*/
|
|
1457
|
-
writeServiceToDomain: writeServiceToDomain(
|
|
1548
|
+
writeServiceToDomain: writeServiceToDomain(join16(path6, "domains")),
|
|
1458
1549
|
/**
|
|
1459
1550
|
* Returns a service from EventCatalog
|
|
1460
1551
|
* @param id - The id of the service to retrieve
|
|
1461
1552
|
* @param version - Optional id of the version to get (supports semver)
|
|
1462
1553
|
* @returns Service|Undefined
|
|
1463
1554
|
*/
|
|
1464
|
-
getService: getService(
|
|
1555
|
+
getService: getService(join16(path6)),
|
|
1465
1556
|
/**
|
|
1466
1557
|
* Returns a service from EventCatalog by it's path.
|
|
1467
1558
|
* @param path - The path to the service to retrieve
|
|
1468
1559
|
* @returns Service|Undefined
|
|
1469
1560
|
*/
|
|
1470
|
-
getServiceByPath: getServiceByPath(
|
|
1561
|
+
getServiceByPath: getServiceByPath(join16(path6)),
|
|
1471
1562
|
/**
|
|
1472
1563
|
* Returns all services from EventCatalog
|
|
1473
1564
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1474
1565
|
* @returns Service[]|Undefined
|
|
1475
1566
|
*/
|
|
1476
|
-
getServices: getServices(
|
|
1567
|
+
getServices: getServices(join16(path6)),
|
|
1477
1568
|
/**
|
|
1478
1569
|
* Moves a given service id to the version directory
|
|
1479
1570
|
* @param directory
|
|
1480
1571
|
*/
|
|
1481
|
-
versionService: versionService(
|
|
1572
|
+
versionService: versionService(join16(path6)),
|
|
1482
1573
|
/**
|
|
1483
1574
|
* Remove a service from EventCatalog (modeled on the standard POSIX rm utility)
|
|
1484
1575
|
*
|
|
1485
1576
|
* @param path - The path to your service, e.g. `/InventoryService`
|
|
1486
1577
|
*
|
|
1487
1578
|
*/
|
|
1488
|
-
rmService: rmService(
|
|
1579
|
+
rmService: rmService(join16(path6, "services")),
|
|
1489
1580
|
/**
|
|
1490
1581
|
* Remove an service by an service id
|
|
1491
1582
|
*
|
|
1492
1583
|
* @param id - The id of the service you want to remove
|
|
1493
1584
|
*
|
|
1494
1585
|
*/
|
|
1495
|
-
rmServiceById: rmServiceById(
|
|
1586
|
+
rmServiceById: rmServiceById(join16(path6)),
|
|
1496
1587
|
/**
|
|
1497
1588
|
* Adds a file to the given service
|
|
1498
1589
|
* @param id - The id of the service to add the file to
|
|
@@ -1500,21 +1591,21 @@ var src_default = (path6) => {
|
|
|
1500
1591
|
* @param version - Optional version of the service to add the file to
|
|
1501
1592
|
* @returns
|
|
1502
1593
|
*/
|
|
1503
|
-
addFileToService: addFileToService(
|
|
1594
|
+
addFileToService: addFileToService(join16(path6)),
|
|
1504
1595
|
/**
|
|
1505
1596
|
* Returns the specifications for a given service
|
|
1506
1597
|
* @param id - The id of the service to retrieve the specifications for
|
|
1507
1598
|
* @param version - Optional version of the service
|
|
1508
1599
|
* @returns
|
|
1509
1600
|
*/
|
|
1510
|
-
getSpecificationFilesForService: getSpecificationFilesForService(
|
|
1601
|
+
getSpecificationFilesForService: getSpecificationFilesForService(join16(path6)),
|
|
1511
1602
|
/**
|
|
1512
1603
|
* Check to see if a service version exists
|
|
1513
1604
|
* @param id - The id of the service
|
|
1514
1605
|
* @param version - The version of the service (supports semver)
|
|
1515
1606
|
* @returns
|
|
1516
1607
|
*/
|
|
1517
|
-
serviceHasVersion: serviceHasVersion(
|
|
1608
|
+
serviceHasVersion: serviceHasVersion(join16(path6)),
|
|
1518
1609
|
/**
|
|
1519
1610
|
* Add an event to a service by it's id.
|
|
1520
1611
|
*
|
|
@@ -1534,7 +1625,7 @@ var src_default = (path6) => {
|
|
|
1534
1625
|
*
|
|
1535
1626
|
* ```
|
|
1536
1627
|
*/
|
|
1537
|
-
addEventToService: addMessageToService(
|
|
1628
|
+
addEventToService: addMessageToService(join16(path6)),
|
|
1538
1629
|
/**
|
|
1539
1630
|
* Add a data store to a service by it's id.
|
|
1540
1631
|
*
|
|
@@ -1551,7 +1642,7 @@ var src_default = (path6) => {
|
|
|
1551
1642
|
*
|
|
1552
1643
|
* ```
|
|
1553
1644
|
*/
|
|
1554
|
-
addDataStoreToService: addDataStoreToService(
|
|
1645
|
+
addDataStoreToService: addDataStoreToService(join16(path6)),
|
|
1555
1646
|
/**
|
|
1556
1647
|
* Add a command to a service by it's id.
|
|
1557
1648
|
*
|
|
@@ -1571,7 +1662,7 @@ var src_default = (path6) => {
|
|
|
1571
1662
|
*
|
|
1572
1663
|
* ```
|
|
1573
1664
|
*/
|
|
1574
|
-
addCommandToService: addMessageToService(
|
|
1665
|
+
addCommandToService: addMessageToService(join16(path6)),
|
|
1575
1666
|
/**
|
|
1576
1667
|
* Add a query to a service by it's id.
|
|
1577
1668
|
*
|
|
@@ -1591,7 +1682,7 @@ var src_default = (path6) => {
|
|
|
1591
1682
|
*
|
|
1592
1683
|
* ```
|
|
1593
1684
|
*/
|
|
1594
|
-
addQueryToService: addMessageToService(
|
|
1685
|
+
addQueryToService: addMessageToService(join16(path6)),
|
|
1595
1686
|
/**
|
|
1596
1687
|
* Add an entity to a service by its id.
|
|
1597
1688
|
*
|
|
@@ -1609,7 +1700,7 @@ var src_default = (path6) => {
|
|
|
1609
1700
|
*
|
|
1610
1701
|
* ```
|
|
1611
1702
|
*/
|
|
1612
|
-
addEntityToService: addEntityToService(
|
|
1703
|
+
addEntityToService: addEntityToService(join16(path6)),
|
|
1613
1704
|
/**
|
|
1614
1705
|
* Check to see if a service exists by it's path.
|
|
1615
1706
|
*
|
|
@@ -1626,13 +1717,13 @@ var src_default = (path6) => {
|
|
|
1626
1717
|
* @param path - The path to the service to check
|
|
1627
1718
|
* @returns boolean
|
|
1628
1719
|
*/
|
|
1629
|
-
isService: isService(
|
|
1720
|
+
isService: isService(join16(path6)),
|
|
1630
1721
|
/**
|
|
1631
1722
|
* Converts a file to a service.
|
|
1632
1723
|
* @param file - The file to convert to a service.
|
|
1633
1724
|
* @returns The service.
|
|
1634
1725
|
*/
|
|
1635
|
-
toService: toService(
|
|
1726
|
+
toService: toService(join16(path6)),
|
|
1636
1727
|
/**
|
|
1637
1728
|
* ================================
|
|
1638
1729
|
* Domains
|
|
@@ -1645,39 +1736,39 @@ var src_default = (path6) => {
|
|
|
1645
1736
|
* @param options - Optional options to write the event
|
|
1646
1737
|
*
|
|
1647
1738
|
*/
|
|
1648
|
-
writeDomain: writeDomain(
|
|
1739
|
+
writeDomain: writeDomain(join16(path6, "domains")),
|
|
1649
1740
|
/**
|
|
1650
1741
|
* Returns a domain from EventCatalog
|
|
1651
1742
|
* @param id - The id of the domain to retrieve
|
|
1652
1743
|
* @param version - Optional id of the version to get (supports semver)
|
|
1653
1744
|
* @returns Domain|Undefined
|
|
1654
1745
|
*/
|
|
1655
|
-
getDomain: getDomain(
|
|
1746
|
+
getDomain: getDomain(join16(path6, "domains")),
|
|
1656
1747
|
/**
|
|
1657
1748
|
* Returns all domains from EventCatalog
|
|
1658
1749
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1659
1750
|
* @returns Domain[]|Undefined
|
|
1660
1751
|
*/
|
|
1661
|
-
getDomains: getDomains(
|
|
1752
|
+
getDomains: getDomains(join16(path6)),
|
|
1662
1753
|
/**
|
|
1663
1754
|
* Moves a given domain id to the version directory
|
|
1664
1755
|
* @param directory
|
|
1665
1756
|
*/
|
|
1666
|
-
versionDomain: versionDomain(
|
|
1757
|
+
versionDomain: versionDomain(join16(path6, "domains")),
|
|
1667
1758
|
/**
|
|
1668
1759
|
* Remove a domain from EventCatalog (modeled on the standard POSIX rm utility)
|
|
1669
1760
|
*
|
|
1670
1761
|
* @param path - The path to your domain, e.g. `/Payment`
|
|
1671
1762
|
*
|
|
1672
1763
|
*/
|
|
1673
|
-
rmDomain: rmDomain(
|
|
1764
|
+
rmDomain: rmDomain(join16(path6, "domains")),
|
|
1674
1765
|
/**
|
|
1675
1766
|
* Remove an service by an domain id
|
|
1676
1767
|
*
|
|
1677
1768
|
* @param id - The id of the domain you want to remove
|
|
1678
1769
|
*
|
|
1679
1770
|
*/
|
|
1680
|
-
rmDomainById: rmDomainById(
|
|
1771
|
+
rmDomainById: rmDomainById(join16(path6, "domains")),
|
|
1681
1772
|
/**
|
|
1682
1773
|
* Adds a file to the given domain
|
|
1683
1774
|
* @param id - The id of the domain to add the file to
|
|
@@ -1685,28 +1776,28 @@ var src_default = (path6) => {
|
|
|
1685
1776
|
* @param version - Optional version of the domain to add the file to
|
|
1686
1777
|
* @returns
|
|
1687
1778
|
*/
|
|
1688
|
-
addFileToDomain: addFileToDomain(
|
|
1779
|
+
addFileToDomain: addFileToDomain(join16(path6, "domains")),
|
|
1689
1780
|
/**
|
|
1690
1781
|
* Adds an ubiquitous language dictionary to a domain
|
|
1691
1782
|
* @param id - The id of the domain to add the ubiquitous language to
|
|
1692
1783
|
* @param ubiquitousLanguageDictionary - The ubiquitous language dictionary to add
|
|
1693
1784
|
* @param version - Optional version of the domain to add the ubiquitous language to
|
|
1694
1785
|
*/
|
|
1695
|
-
addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain(
|
|
1786
|
+
addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain(join16(path6, "domains")),
|
|
1696
1787
|
/**
|
|
1697
1788
|
* Get the ubiquitous language dictionary from a domain
|
|
1698
1789
|
* @param id - The id of the domain to get the ubiquitous language from
|
|
1699
1790
|
* @param version - Optional version of the domain to get the ubiquitous language from
|
|
1700
1791
|
* @returns
|
|
1701
1792
|
*/
|
|
1702
|
-
getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain(
|
|
1793
|
+
getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain(join16(path6, "domains")),
|
|
1703
1794
|
/**
|
|
1704
1795
|
* Check to see if a domain version exists
|
|
1705
1796
|
* @param id - The id of the domain
|
|
1706
1797
|
* @param version - The version of the domain (supports semver)
|
|
1707
1798
|
* @returns
|
|
1708
1799
|
*/
|
|
1709
|
-
domainHasVersion: domainHasVersion(
|
|
1800
|
+
domainHasVersion: domainHasVersion(join16(path6)),
|
|
1710
1801
|
/**
|
|
1711
1802
|
* Adds a given service to a domain
|
|
1712
1803
|
* @param id - The id of the domain
|
|
@@ -1714,7 +1805,7 @@ var src_default = (path6) => {
|
|
|
1714
1805
|
* @param version - (Optional) The version of the domain to add the service to
|
|
1715
1806
|
* @returns
|
|
1716
1807
|
*/
|
|
1717
|
-
addServiceToDomain: addServiceToDomain(
|
|
1808
|
+
addServiceToDomain: addServiceToDomain(join16(path6, "domains")),
|
|
1718
1809
|
/**
|
|
1719
1810
|
* Adds a given subdomain to a domain
|
|
1720
1811
|
* @param id - The id of the domain
|
|
@@ -1722,7 +1813,7 @@ var src_default = (path6) => {
|
|
|
1722
1813
|
* @param version - (Optional) The version of the domain to add the subdomain to
|
|
1723
1814
|
* @returns
|
|
1724
1815
|
*/
|
|
1725
|
-
addSubDomainToDomain: addSubDomainToDomain(
|
|
1816
|
+
addSubDomainToDomain: addSubDomainToDomain(join16(path6, "domains")),
|
|
1726
1817
|
/**
|
|
1727
1818
|
* Adds an entity to a domain
|
|
1728
1819
|
* @param id - The id of the domain
|
|
@@ -1730,7 +1821,61 @@ var src_default = (path6) => {
|
|
|
1730
1821
|
* @param version - (Optional) The version of the domain to add the entity to
|
|
1731
1822
|
* @returns
|
|
1732
1823
|
*/
|
|
1733
|
-
addEntityToDomain: addEntityToDomain(
|
|
1824
|
+
addEntityToDomain: addEntityToDomain(join16(path6, "domains")),
|
|
1825
|
+
/**
|
|
1826
|
+
* Add an event to a domain by its id.
|
|
1827
|
+
*
|
|
1828
|
+
* @example
|
|
1829
|
+
* ```ts
|
|
1830
|
+
* import utils from '@eventcatalog/utils';
|
|
1831
|
+
*
|
|
1832
|
+
* const { addEventToDomain } = utils('/path/to/eventcatalog');
|
|
1833
|
+
*
|
|
1834
|
+
* // adds a new event (OrderCreated) that the Orders domain will send
|
|
1835
|
+
* await addEventToDomain('Orders', 'sends', { id: 'OrderCreated', version: '2.0.0' });
|
|
1836
|
+
*
|
|
1837
|
+
* // adds a new event (PaymentProcessed) that the Orders domain will receive
|
|
1838
|
+
* await addEventToDomain('Orders', 'receives', { id: 'PaymentProcessed', version: '2.0.0' });
|
|
1839
|
+
*
|
|
1840
|
+
* ```
|
|
1841
|
+
*/
|
|
1842
|
+
addEventToDomain: addMessageToDomain(join16(path6, "domains")),
|
|
1843
|
+
/**
|
|
1844
|
+
* Add a command to a domain by its id.
|
|
1845
|
+
*
|
|
1846
|
+
* @example
|
|
1847
|
+
* ```ts
|
|
1848
|
+
* import utils from '@eventcatalog/utils';
|
|
1849
|
+
*
|
|
1850
|
+
* const { addCommandToDomain } = utils('/path/to/eventcatalog');
|
|
1851
|
+
*
|
|
1852
|
+
* // adds a new command (ProcessOrder) that the Orders domain will send
|
|
1853
|
+
* await addCommandToDomain('Orders', 'sends', { id: 'ProcessOrder', version: '2.0.0' });
|
|
1854
|
+
*
|
|
1855
|
+
* // adds a new command (CancelOrder) that the Orders domain will receive
|
|
1856
|
+
* await addCommandToDomain('Orders', 'receives', { id: 'CancelOrder', version: '2.0.0' });
|
|
1857
|
+
*
|
|
1858
|
+
* ```
|
|
1859
|
+
*/
|
|
1860
|
+
addCommandToDomain: addMessageToDomain(join16(path6, "domains")),
|
|
1861
|
+
/**
|
|
1862
|
+
* Add a query to a domain by its id.
|
|
1863
|
+
*
|
|
1864
|
+
* @example
|
|
1865
|
+
* ```ts
|
|
1866
|
+
* import utils from '@eventcatalog/utils';
|
|
1867
|
+
*
|
|
1868
|
+
* const { addQueryToDomain } = utils('/path/to/eventcatalog');
|
|
1869
|
+
*
|
|
1870
|
+
* // adds a new query (GetOrderStatus) that the Orders domain will send
|
|
1871
|
+
* await addQueryToDomain('Orders', 'sends', { id: 'GetOrderStatus', version: '2.0.0' });
|
|
1872
|
+
*
|
|
1873
|
+
* // adds a new query (GetInventory) that the Orders domain will receive
|
|
1874
|
+
* await addQueryToDomain('Orders', 'receives', { id: 'GetInventory', version: '2.0.0' });
|
|
1875
|
+
*
|
|
1876
|
+
* ```
|
|
1877
|
+
*/
|
|
1878
|
+
addQueryToDomain: addMessageToDomain(join16(path6, "domains")),
|
|
1734
1879
|
/**
|
|
1735
1880
|
* ================================
|
|
1736
1881
|
* Teams
|
|
@@ -1743,25 +1888,25 @@ var src_default = (path6) => {
|
|
|
1743
1888
|
* @param options - Optional options to write the team
|
|
1744
1889
|
*
|
|
1745
1890
|
*/
|
|
1746
|
-
writeTeam: writeTeam(
|
|
1891
|
+
writeTeam: writeTeam(join16(path6, "teams")),
|
|
1747
1892
|
/**
|
|
1748
1893
|
* Returns a team from EventCatalog
|
|
1749
1894
|
* @param id - The id of the team to retrieve
|
|
1750
1895
|
* @returns Team|Undefined
|
|
1751
1896
|
*/
|
|
1752
|
-
getTeam: getTeam(
|
|
1897
|
+
getTeam: getTeam(join16(path6, "teams")),
|
|
1753
1898
|
/**
|
|
1754
1899
|
* Returns all teams from EventCatalog
|
|
1755
1900
|
* @returns Team[]|Undefined
|
|
1756
1901
|
*/
|
|
1757
|
-
getTeams: getTeams(
|
|
1902
|
+
getTeams: getTeams(join16(path6, "teams")),
|
|
1758
1903
|
/**
|
|
1759
1904
|
* Remove a team by the team id
|
|
1760
1905
|
*
|
|
1761
1906
|
* @param id - The id of the team you want to remove
|
|
1762
1907
|
*
|
|
1763
1908
|
*/
|
|
1764
|
-
rmTeamById: rmTeamById(
|
|
1909
|
+
rmTeamById: rmTeamById(join16(path6, "teams")),
|
|
1765
1910
|
/**
|
|
1766
1911
|
* ================================
|
|
1767
1912
|
* Users
|
|
@@ -1774,25 +1919,25 @@ var src_default = (path6) => {
|
|
|
1774
1919
|
* @param options - Optional options to write the user
|
|
1775
1920
|
*
|
|
1776
1921
|
*/
|
|
1777
|
-
writeUser: writeUser(
|
|
1922
|
+
writeUser: writeUser(join16(path6, "users")),
|
|
1778
1923
|
/**
|
|
1779
1924
|
* Returns a user from EventCatalog
|
|
1780
1925
|
* @param id - The id of the user to retrieve
|
|
1781
1926
|
* @returns User|Undefined
|
|
1782
1927
|
*/
|
|
1783
|
-
getUser: getUser(
|
|
1928
|
+
getUser: getUser(join16(path6, "users")),
|
|
1784
1929
|
/**
|
|
1785
1930
|
* Returns all user from EventCatalog
|
|
1786
1931
|
* @returns User[]|Undefined
|
|
1787
1932
|
*/
|
|
1788
|
-
getUsers: getUsers(
|
|
1933
|
+
getUsers: getUsers(join16(path6)),
|
|
1789
1934
|
/**
|
|
1790
1935
|
* Remove a user by the user id
|
|
1791
1936
|
*
|
|
1792
1937
|
* @param id - The id of the user you want to remove
|
|
1793
1938
|
*
|
|
1794
1939
|
*/
|
|
1795
|
-
rmUserById: rmUserById(
|
|
1940
|
+
rmUserById: rmUserById(join16(path6, "users")),
|
|
1796
1941
|
/**
|
|
1797
1942
|
* ================================
|
|
1798
1943
|
* Custom Docs
|
|
@@ -1803,32 +1948,32 @@ var src_default = (path6) => {
|
|
|
1803
1948
|
* @param path - The path to the custom doc to retrieve
|
|
1804
1949
|
* @returns CustomDoc|Undefined
|
|
1805
1950
|
*/
|
|
1806
|
-
getCustomDoc: getCustomDoc(
|
|
1951
|
+
getCustomDoc: getCustomDoc(join16(path6, "docs")),
|
|
1807
1952
|
/**
|
|
1808
1953
|
* Returns all custom docs from EventCatalog
|
|
1809
1954
|
* @param options - Optional options to get custom docs from a specific path
|
|
1810
1955
|
* @returns CustomDoc[]|Undefined
|
|
1811
1956
|
*/
|
|
1812
|
-
getCustomDocs: getCustomDocs(
|
|
1957
|
+
getCustomDocs: getCustomDocs(join16(path6, "docs")),
|
|
1813
1958
|
/**
|
|
1814
1959
|
* Writes a custom doc to EventCatalog
|
|
1815
1960
|
* @param customDoc - The custom doc to write
|
|
1816
1961
|
* @param options - Optional options to write the custom doc
|
|
1817
1962
|
*
|
|
1818
1963
|
*/
|
|
1819
|
-
writeCustomDoc: writeCustomDoc(
|
|
1964
|
+
writeCustomDoc: writeCustomDoc(join16(path6, "docs")),
|
|
1820
1965
|
/**
|
|
1821
1966
|
* Removes a custom doc from EventCatalog
|
|
1822
1967
|
* @param path - The path to the custom doc to remove
|
|
1823
1968
|
*
|
|
1824
1969
|
*/
|
|
1825
|
-
rmCustomDoc: rmCustomDoc(
|
|
1970
|
+
rmCustomDoc: rmCustomDoc(join16(path6, "docs")),
|
|
1826
1971
|
/**
|
|
1827
1972
|
* Dumps the catalog to a JSON file.
|
|
1828
1973
|
* @param directory - The directory to dump the catalog to
|
|
1829
1974
|
* @returns A JSON file with the catalog
|
|
1830
1975
|
*/
|
|
1831
|
-
dumpCatalog: dumpCatalog(
|
|
1976
|
+
dumpCatalog: dumpCatalog(join16(path6)),
|
|
1832
1977
|
/**
|
|
1833
1978
|
* Returns the event catalog configuration file.
|
|
1834
1979
|
* The event catalog configuration file is the file that contains the configuration for the event catalog.
|
|
@@ -1836,7 +1981,7 @@ var src_default = (path6) => {
|
|
|
1836
1981
|
* @param directory - The directory of the catalog.
|
|
1837
1982
|
* @returns A JSON object with the configuration for the event catalog.
|
|
1838
1983
|
*/
|
|
1839
|
-
getEventCatalogConfigurationFile: getEventCatalogConfigurationFile(
|
|
1984
|
+
getEventCatalogConfigurationFile: getEventCatalogConfigurationFile(join16(path6)),
|
|
1840
1985
|
/**
|
|
1841
1986
|
* ================================
|
|
1842
1987
|
* Resources Utils
|
|
@@ -1861,33 +2006,33 @@ var src_default = (path6) => {
|
|
|
1861
2006
|
* @param path - The path to the message to retrieve
|
|
1862
2007
|
* @returns Message|Undefined
|
|
1863
2008
|
*/
|
|
1864
|
-
getMessageBySchemaPath: getMessageBySchemaPath(
|
|
2009
|
+
getMessageBySchemaPath: getMessageBySchemaPath(join16(path6)),
|
|
1865
2010
|
/**
|
|
1866
2011
|
* Returns the producers and consumers (services) for a given message
|
|
1867
2012
|
* @param id - The id of the message to get the producers and consumers for
|
|
1868
2013
|
* @param version - Optional version of the message
|
|
1869
2014
|
* @returns { producers: Service[], consumers: Service[] }
|
|
1870
2015
|
*/
|
|
1871
|
-
getProducersAndConsumersForMessage: getProducersAndConsumersForMessage(
|
|
2016
|
+
getProducersAndConsumersForMessage: getProducersAndConsumersForMessage(join16(path6)),
|
|
1872
2017
|
/**
|
|
1873
2018
|
* Returns the consumers of a given schema path
|
|
1874
2019
|
* @param path - The path to the schema to get the consumers for
|
|
1875
2020
|
* @returns Service[]
|
|
1876
2021
|
*/
|
|
1877
|
-
getConsumersOfSchema: getConsumersOfSchema(
|
|
2022
|
+
getConsumersOfSchema: getConsumersOfSchema(join16(path6)),
|
|
1878
2023
|
/**
|
|
1879
2024
|
* Returns the producers of a given schema path
|
|
1880
2025
|
* @param path - The path to the schema to get the producers for
|
|
1881
2026
|
* @returns Service[]
|
|
1882
2027
|
*/
|
|
1883
|
-
getProducersOfSchema: getProducersOfSchema(
|
|
2028
|
+
getProducersOfSchema: getProducersOfSchema(join16(path6)),
|
|
1884
2029
|
/**
|
|
1885
2030
|
* Returns the owners for a given resource (e.g domain, service, event, command, query, etc.)
|
|
1886
2031
|
* @param id - The id of the resource to get the owners for
|
|
1887
2032
|
* @param version - Optional version of the resource
|
|
1888
2033
|
* @returns { owners: User[] }
|
|
1889
2034
|
*/
|
|
1890
|
-
getOwnersForResource: getOwnersForResource(
|
|
2035
|
+
getOwnersForResource: getOwnersForResource(join16(path6)),
|
|
1891
2036
|
/**
|
|
1892
2037
|
* ================================
|
|
1893
2038
|
* Entities
|
|
@@ -1899,13 +2044,13 @@ var src_default = (path6) => {
|
|
|
1899
2044
|
* @param version - Optional id of the version to get (supports semver)
|
|
1900
2045
|
* @returns Entity|Undefined
|
|
1901
2046
|
*/
|
|
1902
|
-
getEntity: getEntity(
|
|
2047
|
+
getEntity: getEntity(join16(path6)),
|
|
1903
2048
|
/**
|
|
1904
2049
|
* Returns all entities from EventCatalog
|
|
1905
2050
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1906
2051
|
* @returns Entity[]|Undefined
|
|
1907
2052
|
*/
|
|
1908
|
-
getEntities: getEntities(
|
|
2053
|
+
getEntities: getEntities(join16(path6)),
|
|
1909
2054
|
/**
|
|
1910
2055
|
* Adds an entity to EventCatalog
|
|
1911
2056
|
*
|
|
@@ -1913,33 +2058,33 @@ var src_default = (path6) => {
|
|
|
1913
2058
|
* @param options - Optional options to write the entity
|
|
1914
2059
|
*
|
|
1915
2060
|
*/
|
|
1916
|
-
writeEntity: writeEntity(
|
|
2061
|
+
writeEntity: writeEntity(join16(path6, "entities")),
|
|
1917
2062
|
/**
|
|
1918
2063
|
* Remove an entity from EventCatalog (modeled on the standard POSIX rm utility)
|
|
1919
2064
|
*
|
|
1920
2065
|
* @param path - The path to your entity, e.g. `/User`
|
|
1921
2066
|
*
|
|
1922
2067
|
*/
|
|
1923
|
-
rmEntity: rmEntity(
|
|
2068
|
+
rmEntity: rmEntity(join16(path6, "entities")),
|
|
1924
2069
|
/**
|
|
1925
2070
|
* Remove an entity by an entity id
|
|
1926
2071
|
*
|
|
1927
2072
|
* @param id - The id of the entity you want to remove
|
|
1928
2073
|
*
|
|
1929
2074
|
*/
|
|
1930
|
-
rmEntityById: rmEntityById(
|
|
2075
|
+
rmEntityById: rmEntityById(join16(path6)),
|
|
1931
2076
|
/**
|
|
1932
2077
|
* Moves a given entity id to the version directory
|
|
1933
2078
|
* @param id - The id of the entity to version
|
|
1934
2079
|
*/
|
|
1935
|
-
versionEntity: versionEntity(
|
|
2080
|
+
versionEntity: versionEntity(join16(path6)),
|
|
1936
2081
|
/**
|
|
1937
2082
|
* Check to see if an entity version exists
|
|
1938
2083
|
* @param id - The id of the entity
|
|
1939
2084
|
* @param version - The version of the entity (supports semver)
|
|
1940
2085
|
* @returns
|
|
1941
2086
|
*/
|
|
1942
|
-
entityHasVersion: entityHasVersion(
|
|
2087
|
+
entityHasVersion: entityHasVersion(join16(path6)),
|
|
1943
2088
|
/**
|
|
1944
2089
|
* ================================
|
|
1945
2090
|
* Data Stores
|
|
@@ -1951,42 +2096,42 @@ var src_default = (path6) => {
|
|
|
1951
2096
|
* @param options - Optional options to write the data store
|
|
1952
2097
|
*
|
|
1953
2098
|
*/
|
|
1954
|
-
writeDataStore: writeDataStore(
|
|
2099
|
+
writeDataStore: writeDataStore(join16(path6, "containers")),
|
|
1955
2100
|
/**
|
|
1956
2101
|
* Returns a data store from EventCatalog
|
|
1957
2102
|
* @param id - The id of the data store to retrieve
|
|
1958
2103
|
* @param version - Optional id of the version to get (supports semver)
|
|
1959
2104
|
* @returns Container|Undefined
|
|
1960
2105
|
*/
|
|
1961
|
-
getDataStore: getDataStore(
|
|
2106
|
+
getDataStore: getDataStore(join16(path6)),
|
|
1962
2107
|
/**
|
|
1963
2108
|
* Returns all data stores from EventCatalog
|
|
1964
2109
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1965
2110
|
* @returns Container[]|Undefined
|
|
1966
2111
|
*/
|
|
1967
|
-
getDataStores: getDataStores(
|
|
2112
|
+
getDataStores: getDataStores(join16(path6)),
|
|
1968
2113
|
/**
|
|
1969
2114
|
* Version a data store by its id
|
|
1970
2115
|
* @param id - The id of the data store to version
|
|
1971
2116
|
*/
|
|
1972
|
-
versionDataStore: versionDataStore(
|
|
2117
|
+
versionDataStore: versionDataStore(join16(path6, "containers")),
|
|
1973
2118
|
/**
|
|
1974
2119
|
* Remove a data store by its path
|
|
1975
2120
|
* @param path - The path to the data store to remove
|
|
1976
2121
|
*/
|
|
1977
|
-
rmDataStore: rmDataStore(
|
|
2122
|
+
rmDataStore: rmDataStore(join16(path6, "containers")),
|
|
1978
2123
|
/**
|
|
1979
2124
|
* Remove a data store by its id
|
|
1980
2125
|
* @param id - The id of the data store to remove
|
|
1981
2126
|
*/
|
|
1982
|
-
rmDataStoreById: rmDataStoreById(
|
|
2127
|
+
rmDataStoreById: rmDataStoreById(join16(path6)),
|
|
1983
2128
|
/**
|
|
1984
2129
|
* Check to see if a data store version exists
|
|
1985
2130
|
* @param id - The id of the data store
|
|
1986
2131
|
* @param version - The version of the data store (supports semver)
|
|
1987
2132
|
* @returns
|
|
1988
2133
|
*/
|
|
1989
|
-
dataStoreHasVersion: dataStoreHasVersion(
|
|
2134
|
+
dataStoreHasVersion: dataStoreHasVersion(join16(path6)),
|
|
1990
2135
|
/**
|
|
1991
2136
|
* Adds a file to a data store by its id
|
|
1992
2137
|
* @param id - The id of the data store to add the file to
|
|
@@ -1994,14 +2139,86 @@ var src_default = (path6) => {
|
|
|
1994
2139
|
* @param version - Optional version of the data store to add the file to
|
|
1995
2140
|
* @returns
|
|
1996
2141
|
*/
|
|
1997
|
-
addFileToDataStore: addFileToDataStore(
|
|
2142
|
+
addFileToDataStore: addFileToDataStore(join16(path6)),
|
|
1998
2143
|
/**
|
|
1999
2144
|
* Writes a data store to a service by its id
|
|
2000
2145
|
* @param dataStore - The data store to write
|
|
2001
2146
|
* @param service - The service to write the data store to
|
|
2002
2147
|
* @returns
|
|
2003
2148
|
*/
|
|
2004
|
-
writeDataStoreToService: writeDataStoreToService(
|
|
2149
|
+
writeDataStoreToService: writeDataStoreToService(join16(path6)),
|
|
2150
|
+
/**
|
|
2151
|
+
* ================================
|
|
2152
|
+
* Data Products
|
|
2153
|
+
* ================================
|
|
2154
|
+
*/
|
|
2155
|
+
/**
|
|
2156
|
+
* Adds a data product to EventCatalog
|
|
2157
|
+
* @param dataProduct - The data product to write
|
|
2158
|
+
* @param options - Optional options to write the data product
|
|
2159
|
+
*
|
|
2160
|
+
*/
|
|
2161
|
+
writeDataProduct: writeDataProduct(join16(path6, "data-products")),
|
|
2162
|
+
/**
|
|
2163
|
+
* Writes a data product to a domain in EventCatalog
|
|
2164
|
+
* @param dataProduct - The data product to write
|
|
2165
|
+
* @param domain - The domain to write the data product to
|
|
2166
|
+
* @param options - Optional options to write the data product
|
|
2167
|
+
*
|
|
2168
|
+
*/
|
|
2169
|
+
writeDataProductToDomain: writeDataProductToDomain(join16(path6, "domains")),
|
|
2170
|
+
/**
|
|
2171
|
+
* Returns a data product from EventCatalog
|
|
2172
|
+
* @param id - The id of the data product to retrieve
|
|
2173
|
+
* @param version - Optional id of the version to get (supports semver)
|
|
2174
|
+
* @returns DataProduct|Undefined
|
|
2175
|
+
*/
|
|
2176
|
+
getDataProduct: getDataProduct(join16(path6)),
|
|
2177
|
+
/**
|
|
2178
|
+
* Returns all data products from EventCatalog
|
|
2179
|
+
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
2180
|
+
* @returns DataProduct[]|Undefined
|
|
2181
|
+
*/
|
|
2182
|
+
getDataProducts: getDataProducts(join16(path6)),
|
|
2183
|
+
/**
|
|
2184
|
+
* Version a data product by its id
|
|
2185
|
+
* @param id - The id of the data product to version
|
|
2186
|
+
*/
|
|
2187
|
+
versionDataProduct: versionDataProduct(join16(path6)),
|
|
2188
|
+
/**
|
|
2189
|
+
* Remove a data product by its path
|
|
2190
|
+
* @param path - The path to the data product to remove
|
|
2191
|
+
*/
|
|
2192
|
+
rmDataProduct: rmDataProduct(join16(path6, "data-products")),
|
|
2193
|
+
/**
|
|
2194
|
+
* Remove a data product by its id
|
|
2195
|
+
* @param id - The id of the data product to remove
|
|
2196
|
+
* @param version - Optional version of the data product to remove
|
|
2197
|
+
*/
|
|
2198
|
+
rmDataProductById: rmDataProductById(join16(path6)),
|
|
2199
|
+
/**
|
|
2200
|
+
* Check to see if a data product version exists
|
|
2201
|
+
* @param id - The id of the data product
|
|
2202
|
+
* @param version - The version of the data product (supports semver)
|
|
2203
|
+
* @returns
|
|
2204
|
+
*/
|
|
2205
|
+
dataProductHasVersion: dataProductHasVersion(join16(path6)),
|
|
2206
|
+
/**
|
|
2207
|
+
* Adds a file to a data product by its id
|
|
2208
|
+
* @param id - The id of the data product to add the file to
|
|
2209
|
+
* @param file - File contents to add including the content and the file name
|
|
2210
|
+
* @param version - Optional version of the data product to add the file to
|
|
2211
|
+
* @returns
|
|
2212
|
+
*/
|
|
2213
|
+
addFileToDataProduct: addFileToDataProduct(join16(path6)),
|
|
2214
|
+
/**
|
|
2215
|
+
* Adds a data product to a domain
|
|
2216
|
+
* @param id - The id of the domain
|
|
2217
|
+
* @param dataProduct - The id and version of the data product to add
|
|
2218
|
+
* @param version - (Optional) The version of the domain to add the data product to
|
|
2219
|
+
* @returns
|
|
2220
|
+
*/
|
|
2221
|
+
addDataProductToDomain: addDataProductToDomain(join16(path6, "domains"))
|
|
2005
2222
|
};
|
|
2006
2223
|
};
|
|
2007
2224
|
|
|
@@ -2009,7 +2226,7 @@ var src_default = (path6) => {
|
|
|
2009
2226
|
var DUMP_VERSION = "0.0.1";
|
|
2010
2227
|
var getEventCatalogVersion = async (catalogDir) => {
|
|
2011
2228
|
try {
|
|
2012
|
-
const packageJson =
|
|
2229
|
+
const packageJson = fs13.readFileSync(join17(catalogDir, "package.json"), "utf8");
|
|
2013
2230
|
const packageJsonObject = JSON.parse(packageJson);
|
|
2014
2231
|
return packageJsonObject["dependencies"]["@eventcatalog/core"];
|
|
2015
2232
|
} catch (error) {
|
|
@@ -2023,8 +2240,8 @@ var hydrateResource = async (catalogDir, resources = [], { attachSchema = false
|
|
|
2023
2240
|
let schema = "";
|
|
2024
2241
|
if (resource.schemaPath && resourcePath?.fullPath) {
|
|
2025
2242
|
const pathToSchema = path5.join(path5.dirname(resourcePath?.fullPath), resource.schemaPath);
|
|
2026
|
-
if (
|
|
2027
|
-
schema =
|
|
2243
|
+
if (fs13.existsSync(pathToSchema)) {
|
|
2244
|
+
schema = fs13.readFileSync(pathToSchema, "utf8");
|
|
2028
2245
|
}
|
|
2029
2246
|
}
|
|
2030
2247
|
const eventcatalog = schema ? { directory: resourcePath?.directory, schema } : { directory: resourcePath?.directory };
|
|
@@ -2043,7 +2260,7 @@ var filterCollection = (collection, options) => {
|
|
|
2043
2260
|
};
|
|
2044
2261
|
var getEventCatalogConfigurationFile = (directory) => async () => {
|
|
2045
2262
|
try {
|
|
2046
|
-
const path6 =
|
|
2263
|
+
const path6 = join17(directory, "eventcatalog.config.js");
|
|
2047
2264
|
const configModule = await import(path6);
|
|
2048
2265
|
return configModule.default;
|
|
2049
2266
|
} catch (error) {
|