@eventcatalog/sdk 2.6.9 → 2.7.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/README.md +0 -16
- package/dist/domains.d.mts +22 -1
- package/dist/domains.d.ts +22 -1
- package/dist/domains.js +17 -0
- package/dist/domains.js.map +1 -1
- package/dist/domains.mjs +16 -0
- package/dist/domains.mjs.map +1 -1
- package/dist/entities.d.mts +174 -0
- package/dist/entities.d.ts +174 -0
- package/dist/entities.js +318 -0
- package/dist/entities.js.map +1 -0
- package/dist/entities.mjs +277 -0
- package/dist/entities.mjs.map +1 -0
- package/dist/eventcatalog.js +230 -93
- package/dist/eventcatalog.js.map +1 -1
- package/dist/eventcatalog.mjs +232 -95
- package/dist/eventcatalog.mjs.map +1 -1
- package/dist/index.d.mts +120 -5
- package/dist/index.d.ts +120 -5
- package/dist/index.js +226 -89
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +226 -89
- package/dist/index.mjs.map +1 -1
- package/dist/messages.js.map +1 -1
- package/dist/messages.mjs.map +1 -1
- package/dist/services.d.mts +22 -1
- package/dist/services.d.ts +22 -1
- package/dist/services.js +24 -0
- package/dist/services.js.map +1 -1
- package/dist/services.mjs +23 -0
- package/dist/services.mjs.map +1 -1
- package/dist/types.d.d.mts +29 -1
- package/dist/types.d.d.ts +29 -1
- package/dist/types.d.js.map +1 -1
- package/package.json +1 -1
package/dist/eventcatalog.js
CHANGED
|
@@ -35,10 +35,10 @@ __export(eventcatalog_exports, {
|
|
|
35
35
|
});
|
|
36
36
|
module.exports = __toCommonJS(eventcatalog_exports);
|
|
37
37
|
var import_fs = __toESM(require("fs"));
|
|
38
|
-
var
|
|
38
|
+
var import_node_path15 = __toESM(require("path"));
|
|
39
39
|
|
|
40
40
|
// src/index.ts
|
|
41
|
-
var
|
|
41
|
+
var import_node_path14 = require("path");
|
|
42
42
|
|
|
43
43
|
// src/events.ts
|
|
44
44
|
var import_promises2 = __toESM(require("fs/promises"));
|
|
@@ -557,6 +557,28 @@ var isService = (directory) => async (path5) => {
|
|
|
557
557
|
return !!service && segments.includes("services");
|
|
558
558
|
};
|
|
559
559
|
var toService = (directory) => async (file) => toResource(directory, file);
|
|
560
|
+
var addEntityToService = (directory) => async (id, entity, version) => {
|
|
561
|
+
let service = await getService(directory)(id, version);
|
|
562
|
+
const servicePath = await getResourcePath(directory, id, version);
|
|
563
|
+
const extension = (0, import_node_path5.extname)(servicePath?.fullPath || "");
|
|
564
|
+
if (service.entities === void 0) {
|
|
565
|
+
service.entities = [];
|
|
566
|
+
}
|
|
567
|
+
for (let i = 0; i < service.entities.length; i++) {
|
|
568
|
+
if (service.entities[i].id === entity.id && service.entities[i].version === entity.version) {
|
|
569
|
+
return;
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
service.entities.push({ id: entity.id, version: entity.version });
|
|
573
|
+
const existingResource = await findFileById(directory, id, version);
|
|
574
|
+
if (!existingResource) {
|
|
575
|
+
throw new Error(`Cannot find service ${id} in the catalog`);
|
|
576
|
+
}
|
|
577
|
+
const path5 = existingResource.split(/[\\/]+services/)[0];
|
|
578
|
+
const pathToResource = (0, import_node_path5.join)(path5, "services");
|
|
579
|
+
await rmServiceById(directory)(id, version);
|
|
580
|
+
await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
|
|
581
|
+
};
|
|
560
582
|
|
|
561
583
|
// src/domains.ts
|
|
562
584
|
var import_promises6 = __toESM(require("fs/promises"));
|
|
@@ -640,6 +662,21 @@ var addSubDomainToDomain = (directory) => async (id, subDomain, version) => {
|
|
|
640
662
|
await rmDomainById(directory)(id, version, true);
|
|
641
663
|
await writeDomain(directory)(domain, { format: extension === ".md" ? "md" : "mdx" });
|
|
642
664
|
};
|
|
665
|
+
var addEntityToDomain = (directory) => async (id, entity, version) => {
|
|
666
|
+
let domain = await getDomain(directory)(id, version);
|
|
667
|
+
const domainPath = await getResourcePath(directory, id, version);
|
|
668
|
+
const extension = import_node_path6.default.extname(domainPath?.fullPath || "");
|
|
669
|
+
if (domain.entities === void 0) {
|
|
670
|
+
domain.entities = [];
|
|
671
|
+
}
|
|
672
|
+
const entityExistsInList = domain.entities.some((e) => e.id === entity.id && e.version === entity.version);
|
|
673
|
+
if (entityExistsInList) {
|
|
674
|
+
return;
|
|
675
|
+
}
|
|
676
|
+
domain.entities.push(entity);
|
|
677
|
+
await rmDomainById(directory)(id, version, true);
|
|
678
|
+
await writeDomain(directory)(domain, { format: extension === ".md" ? "md" : "mdx" });
|
|
679
|
+
};
|
|
643
680
|
|
|
644
681
|
// src/channels.ts
|
|
645
682
|
var import_promises7 = __toESM(require("fs/promises"));
|
|
@@ -941,6 +978,28 @@ var getOwnersForResource = (catalogDir) => async (id, version) => {
|
|
|
941
978
|
return owners;
|
|
942
979
|
};
|
|
943
980
|
|
|
981
|
+
// src/entities.ts
|
|
982
|
+
var import_promises10 = __toESM(require("fs/promises"));
|
|
983
|
+
var import_node_path13 = require("path");
|
|
984
|
+
var getEntity = (directory) => async (id, version) => getResource(directory, id, version, { type: "entity" });
|
|
985
|
+
var getEntities = (directory) => async (options) => getResources(directory, { type: "entities", latestOnly: options?.latestOnly });
|
|
986
|
+
var writeEntity = (directory) => async (entity, options = {
|
|
987
|
+
path: "",
|
|
988
|
+
override: false,
|
|
989
|
+
format: "mdx"
|
|
990
|
+
}) => writeResource(directory, { ...entity }, { ...options, type: "entity" });
|
|
991
|
+
var rmEntity = (directory) => async (path5) => {
|
|
992
|
+
await import_promises10.default.rm((0, import_node_path13.join)(directory, path5), { recursive: true });
|
|
993
|
+
};
|
|
994
|
+
var rmEntityById = (directory) => async (id, version, persistFiles) => {
|
|
995
|
+
await rmResourceById(directory, id, version, { type: "entity", persistFiles });
|
|
996
|
+
};
|
|
997
|
+
var versionEntity = (directory) => async (id) => versionResource(directory, id);
|
|
998
|
+
var entityHasVersion = (directory) => async (id, version) => {
|
|
999
|
+
const file = await findFileById(directory, id, version);
|
|
1000
|
+
return !!file;
|
|
1001
|
+
};
|
|
1002
|
+
|
|
944
1003
|
// src/index.ts
|
|
945
1004
|
var index_default = (path5) => {
|
|
946
1005
|
return {
|
|
@@ -950,13 +1009,13 @@ var index_default = (path5) => {
|
|
|
950
1009
|
* @param version - Optional id of the version to get (supports semver)
|
|
951
1010
|
* @returns Event|Undefined
|
|
952
1011
|
*/
|
|
953
|
-
getEvent: getEvent((0,
|
|
1012
|
+
getEvent: getEvent((0, import_node_path14.join)(path5)),
|
|
954
1013
|
/**
|
|
955
1014
|
* Returns all events from EventCatalog
|
|
956
1015
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
957
1016
|
* @returns Event[]|Undefined
|
|
958
1017
|
*/
|
|
959
|
-
getEvents: getEvents((0,
|
|
1018
|
+
getEvents: getEvents((0, import_node_path14.join)(path5)),
|
|
960
1019
|
/**
|
|
961
1020
|
* Adds an event to EventCatalog
|
|
962
1021
|
*
|
|
@@ -964,7 +1023,7 @@ var index_default = (path5) => {
|
|
|
964
1023
|
* @param options - Optional options to write the event
|
|
965
1024
|
*
|
|
966
1025
|
*/
|
|
967
|
-
writeEvent: writeEvent((0,
|
|
1026
|
+
writeEvent: writeEvent((0, import_node_path14.join)(path5, "events")),
|
|
968
1027
|
/**
|
|
969
1028
|
* Adds an event to a service in EventCatalog
|
|
970
1029
|
*
|
|
@@ -973,26 +1032,26 @@ var index_default = (path5) => {
|
|
|
973
1032
|
* @param options - Optional options to write the event
|
|
974
1033
|
*
|
|
975
1034
|
*/
|
|
976
|
-
writeEventToService: writeEventToService((0,
|
|
1035
|
+
writeEventToService: writeEventToService((0, import_node_path14.join)(path5)),
|
|
977
1036
|
/**
|
|
978
1037
|
* Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
|
|
979
1038
|
*
|
|
980
1039
|
* @param path - The path to your event, e.g. `/Inventory/InventoryAdjusted`
|
|
981
1040
|
*
|
|
982
1041
|
*/
|
|
983
|
-
rmEvent: rmEvent((0,
|
|
1042
|
+
rmEvent: rmEvent((0, import_node_path14.join)(path5, "events")),
|
|
984
1043
|
/**
|
|
985
1044
|
* Remove an event by an Event id
|
|
986
1045
|
*
|
|
987
1046
|
* @param id - The id of the event you want to remove
|
|
988
1047
|
*
|
|
989
1048
|
*/
|
|
990
|
-
rmEventById: rmEventById((0,
|
|
1049
|
+
rmEventById: rmEventById((0, import_node_path14.join)(path5)),
|
|
991
1050
|
/**
|
|
992
1051
|
* Moves a given event id to the version directory
|
|
993
1052
|
* @param directory
|
|
994
1053
|
*/
|
|
995
|
-
versionEvent: versionEvent((0,
|
|
1054
|
+
versionEvent: versionEvent((0, import_node_path14.join)(path5)),
|
|
996
1055
|
/**
|
|
997
1056
|
* Adds a file to the given event
|
|
998
1057
|
* @param id - The id of the event to add the file to
|
|
@@ -1000,7 +1059,7 @@ var index_default = (path5) => {
|
|
|
1000
1059
|
* @param version - Optional version of the event to add the file to
|
|
1001
1060
|
* @returns
|
|
1002
1061
|
*/
|
|
1003
|
-
addFileToEvent: addFileToEvent((0,
|
|
1062
|
+
addFileToEvent: addFileToEvent((0, import_node_path14.join)(path5)),
|
|
1004
1063
|
/**
|
|
1005
1064
|
* Adds a schema to the given event
|
|
1006
1065
|
* @param id - The id of the event to add the schema to
|
|
@@ -1008,14 +1067,14 @@ var index_default = (path5) => {
|
|
|
1008
1067
|
* @param version - Optional version of the event to add the schema to
|
|
1009
1068
|
* @returns
|
|
1010
1069
|
*/
|
|
1011
|
-
addSchemaToEvent: addSchemaToEvent((0,
|
|
1070
|
+
addSchemaToEvent: addSchemaToEvent((0, import_node_path14.join)(path5)),
|
|
1012
1071
|
/**
|
|
1013
1072
|
* Check to see if an event version exists
|
|
1014
1073
|
* @param id - The id of the event
|
|
1015
1074
|
* @param version - The version of the event (supports semver)
|
|
1016
1075
|
* @returns
|
|
1017
1076
|
*/
|
|
1018
|
-
eventHasVersion: eventHasVersion((0,
|
|
1077
|
+
eventHasVersion: eventHasVersion((0, import_node_path14.join)(path5)),
|
|
1019
1078
|
/**
|
|
1020
1079
|
* ================================
|
|
1021
1080
|
* Commands
|
|
@@ -1027,13 +1086,13 @@ var index_default = (path5) => {
|
|
|
1027
1086
|
* @param version - Optional id of the version to get (supports semver)
|
|
1028
1087
|
* @returns Command|Undefined
|
|
1029
1088
|
*/
|
|
1030
|
-
getCommand: getCommand((0,
|
|
1089
|
+
getCommand: getCommand((0, import_node_path14.join)(path5)),
|
|
1031
1090
|
/**
|
|
1032
1091
|
* Returns all commands from EventCatalog
|
|
1033
1092
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1034
1093
|
* @returns Command[]|Undefined
|
|
1035
1094
|
*/
|
|
1036
|
-
getCommands: getCommands((0,
|
|
1095
|
+
getCommands: getCommands((0, import_node_path14.join)(path5)),
|
|
1037
1096
|
/**
|
|
1038
1097
|
* Adds an command to EventCatalog
|
|
1039
1098
|
*
|
|
@@ -1041,7 +1100,7 @@ var index_default = (path5) => {
|
|
|
1041
1100
|
* @param options - Optional options to write the command
|
|
1042
1101
|
*
|
|
1043
1102
|
*/
|
|
1044
|
-
writeCommand: writeCommand((0,
|
|
1103
|
+
writeCommand: writeCommand((0, import_node_path14.join)(path5, "commands")),
|
|
1045
1104
|
/**
|
|
1046
1105
|
* Adds a command to a service in EventCatalog
|
|
1047
1106
|
*
|
|
@@ -1050,26 +1109,26 @@ var index_default = (path5) => {
|
|
|
1050
1109
|
* @param options - Optional options to write the command
|
|
1051
1110
|
*
|
|
1052
1111
|
*/
|
|
1053
|
-
writeCommandToService: writeCommandToService((0,
|
|
1112
|
+
writeCommandToService: writeCommandToService((0, import_node_path14.join)(path5)),
|
|
1054
1113
|
/**
|
|
1055
1114
|
* Remove an command to EventCatalog (modeled on the standard POSIX rm utility)
|
|
1056
1115
|
*
|
|
1057
1116
|
* @param path - The path to your command, e.g. `/Inventory/InventoryAdjusted`
|
|
1058
1117
|
*
|
|
1059
1118
|
*/
|
|
1060
|
-
rmCommand: rmCommand((0,
|
|
1119
|
+
rmCommand: rmCommand((0, import_node_path14.join)(path5, "commands")),
|
|
1061
1120
|
/**
|
|
1062
1121
|
* Remove an command by an Event id
|
|
1063
1122
|
*
|
|
1064
1123
|
* @param id - The id of the command you want to remove
|
|
1065
1124
|
*
|
|
1066
1125
|
*/
|
|
1067
|
-
rmCommandById: rmCommandById((0,
|
|
1126
|
+
rmCommandById: rmCommandById((0, import_node_path14.join)(path5)),
|
|
1068
1127
|
/**
|
|
1069
1128
|
* Moves a given command id to the version directory
|
|
1070
1129
|
* @param directory
|
|
1071
1130
|
*/
|
|
1072
|
-
versionCommand: versionCommand((0,
|
|
1131
|
+
versionCommand: versionCommand((0, import_node_path14.join)(path5)),
|
|
1073
1132
|
/**
|
|
1074
1133
|
* Adds a file to the given command
|
|
1075
1134
|
* @param id - The id of the command to add the file to
|
|
@@ -1077,7 +1136,7 @@ var index_default = (path5) => {
|
|
|
1077
1136
|
* @param version - Optional version of the command to add the file to
|
|
1078
1137
|
* @returns
|
|
1079
1138
|
*/
|
|
1080
|
-
addFileToCommand: addFileToCommand((0,
|
|
1139
|
+
addFileToCommand: addFileToCommand((0, import_node_path14.join)(path5)),
|
|
1081
1140
|
/**
|
|
1082
1141
|
* Adds a schema to the given command
|
|
1083
1142
|
* @param id - The id of the command to add the schema to
|
|
@@ -1085,14 +1144,14 @@ var index_default = (path5) => {
|
|
|
1085
1144
|
* @param version - Optional version of the command to add the schema to
|
|
1086
1145
|
* @returns
|
|
1087
1146
|
*/
|
|
1088
|
-
addSchemaToCommand: addSchemaToCommand((0,
|
|
1147
|
+
addSchemaToCommand: addSchemaToCommand((0, import_node_path14.join)(path5)),
|
|
1089
1148
|
/**
|
|
1090
1149
|
* Check to see if a command version exists
|
|
1091
1150
|
* @param id - The id of the command
|
|
1092
1151
|
* @param version - The version of the command (supports semver)
|
|
1093
1152
|
* @returns
|
|
1094
1153
|
*/
|
|
1095
|
-
commandHasVersion: commandHasVersion((0,
|
|
1154
|
+
commandHasVersion: commandHasVersion((0, import_node_path14.join)(path5)),
|
|
1096
1155
|
/**
|
|
1097
1156
|
* ================================
|
|
1098
1157
|
* Queries
|
|
@@ -1104,13 +1163,13 @@ var index_default = (path5) => {
|
|
|
1104
1163
|
* @param version - Optional id of the version to get (supports semver)
|
|
1105
1164
|
* @returns Query|Undefined
|
|
1106
1165
|
*/
|
|
1107
|
-
getQuery: getQuery((0,
|
|
1166
|
+
getQuery: getQuery((0, import_node_path14.join)(path5)),
|
|
1108
1167
|
/**
|
|
1109
1168
|
* Returns all queries from EventCatalog
|
|
1110
1169
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1111
1170
|
* @returns Query[]|Undefined
|
|
1112
1171
|
*/
|
|
1113
|
-
getQueries: getQueries((0,
|
|
1172
|
+
getQueries: getQueries((0, import_node_path14.join)(path5)),
|
|
1114
1173
|
/**
|
|
1115
1174
|
* Adds a query to EventCatalog
|
|
1116
1175
|
*
|
|
@@ -1118,7 +1177,7 @@ var index_default = (path5) => {
|
|
|
1118
1177
|
* @param options - Optional options to write the event
|
|
1119
1178
|
*
|
|
1120
1179
|
*/
|
|
1121
|
-
writeQuery: writeQuery((0,
|
|
1180
|
+
writeQuery: writeQuery((0, import_node_path14.join)(path5, "queries")),
|
|
1122
1181
|
/**
|
|
1123
1182
|
* Adds a query to a service in EventCatalog
|
|
1124
1183
|
*
|
|
@@ -1127,26 +1186,26 @@ var index_default = (path5) => {
|
|
|
1127
1186
|
* @param options - Optional options to write the query
|
|
1128
1187
|
*
|
|
1129
1188
|
*/
|
|
1130
|
-
writeQueryToService: writeQueryToService((0,
|
|
1189
|
+
writeQueryToService: writeQueryToService((0, import_node_path14.join)(path5)),
|
|
1131
1190
|
/**
|
|
1132
1191
|
* Remove an query to EventCatalog (modeled on the standard POSIX rm utility)
|
|
1133
1192
|
*
|
|
1134
1193
|
* @param path - The path to your query, e.g. `/Orders/GetOrder`
|
|
1135
1194
|
*
|
|
1136
1195
|
*/
|
|
1137
|
-
rmQuery: rmQuery((0,
|
|
1196
|
+
rmQuery: rmQuery((0, import_node_path14.join)(path5, "queries")),
|
|
1138
1197
|
/**
|
|
1139
1198
|
* Remove a query by a Query id
|
|
1140
1199
|
*
|
|
1141
1200
|
* @param id - The id of the query you want to remove
|
|
1142
1201
|
*
|
|
1143
1202
|
*/
|
|
1144
|
-
rmQueryById: rmQueryById((0,
|
|
1203
|
+
rmQueryById: rmQueryById((0, import_node_path14.join)(path5)),
|
|
1145
1204
|
/**
|
|
1146
1205
|
* Moves a given query id to the version directory
|
|
1147
1206
|
* @param directory
|
|
1148
1207
|
*/
|
|
1149
|
-
versionQuery: versionQuery((0,
|
|
1208
|
+
versionQuery: versionQuery((0, import_node_path14.join)(path5)),
|
|
1150
1209
|
/**
|
|
1151
1210
|
* Adds a file to the given query
|
|
1152
1211
|
* @param id - The id of the query to add the file to
|
|
@@ -1154,7 +1213,7 @@ var index_default = (path5) => {
|
|
|
1154
1213
|
* @param version - Optional version of the query to add the file to
|
|
1155
1214
|
* @returns
|
|
1156
1215
|
*/
|
|
1157
|
-
addFileToQuery: addFileToQuery((0,
|
|
1216
|
+
addFileToQuery: addFileToQuery((0, import_node_path14.join)(path5)),
|
|
1158
1217
|
/**
|
|
1159
1218
|
* Adds a schema to the given query
|
|
1160
1219
|
* @param id - The id of the query to add the schema to
|
|
@@ -1162,14 +1221,14 @@ var index_default = (path5) => {
|
|
|
1162
1221
|
* @param version - Optional version of the query to add the schema to
|
|
1163
1222
|
* @returns
|
|
1164
1223
|
*/
|
|
1165
|
-
addSchemaToQuery: addSchemaToQuery((0,
|
|
1224
|
+
addSchemaToQuery: addSchemaToQuery((0, import_node_path14.join)(path5)),
|
|
1166
1225
|
/**
|
|
1167
1226
|
* Check to see if an query version exists
|
|
1168
1227
|
* @param id - The id of the query
|
|
1169
1228
|
* @param version - The version of the query (supports semver)
|
|
1170
1229
|
* @returns
|
|
1171
1230
|
*/
|
|
1172
|
-
queryHasVersion: queryHasVersion((0,
|
|
1231
|
+
queryHasVersion: queryHasVersion((0, import_node_path14.join)(path5)),
|
|
1173
1232
|
/**
|
|
1174
1233
|
* ================================
|
|
1175
1234
|
* Channels
|
|
@@ -1181,13 +1240,13 @@ var index_default = (path5) => {
|
|
|
1181
1240
|
* @param version - Optional id of the version to get (supports semver)
|
|
1182
1241
|
* @returns Channel|Undefined
|
|
1183
1242
|
*/
|
|
1184
|
-
getChannel: getChannel((0,
|
|
1243
|
+
getChannel: getChannel((0, import_node_path14.join)(path5)),
|
|
1185
1244
|
/**
|
|
1186
1245
|
* Returns all channels from EventCatalog
|
|
1187
1246
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1188
1247
|
* @returns Channel[]|Undefined
|
|
1189
1248
|
*/
|
|
1190
|
-
getChannels: getChannels((0,
|
|
1249
|
+
getChannels: getChannels((0, import_node_path14.join)(path5)),
|
|
1191
1250
|
/**
|
|
1192
1251
|
* Adds an channel to EventCatalog
|
|
1193
1252
|
*
|
|
@@ -1195,33 +1254,33 @@ var index_default = (path5) => {
|
|
|
1195
1254
|
* @param options - Optional options to write the channel
|
|
1196
1255
|
*
|
|
1197
1256
|
*/
|
|
1198
|
-
writeChannel: writeChannel((0,
|
|
1257
|
+
writeChannel: writeChannel((0, import_node_path14.join)(path5, "channels")),
|
|
1199
1258
|
/**
|
|
1200
1259
|
* Remove an channel to EventCatalog (modeled on the standard POSIX rm utility)
|
|
1201
1260
|
*
|
|
1202
1261
|
* @param path - The path to your channel, e.g. `/Inventory/InventoryAdjusted`
|
|
1203
1262
|
*
|
|
1204
1263
|
*/
|
|
1205
|
-
rmChannel: rmChannel((0,
|
|
1264
|
+
rmChannel: rmChannel((0, import_node_path14.join)(path5, "channels")),
|
|
1206
1265
|
/**
|
|
1207
1266
|
* Remove an channel by an Event id
|
|
1208
1267
|
*
|
|
1209
1268
|
* @param id - The id of the channel you want to remove
|
|
1210
1269
|
*
|
|
1211
1270
|
*/
|
|
1212
|
-
rmChannelById: rmChannelById((0,
|
|
1271
|
+
rmChannelById: rmChannelById((0, import_node_path14.join)(path5)),
|
|
1213
1272
|
/**
|
|
1214
1273
|
* Moves a given channel id to the version directory
|
|
1215
1274
|
* @param directory
|
|
1216
1275
|
*/
|
|
1217
|
-
versionChannel: versionChannel((0,
|
|
1276
|
+
versionChannel: versionChannel((0, import_node_path14.join)(path5)),
|
|
1218
1277
|
/**
|
|
1219
1278
|
* Check to see if a channel version exists
|
|
1220
1279
|
* @param id - The id of the channel
|
|
1221
1280
|
* @param version - The version of the channel (supports semver)
|
|
1222
1281
|
* @returns
|
|
1223
1282
|
*/
|
|
1224
|
-
channelHasVersion: channelHasVersion((0,
|
|
1283
|
+
channelHasVersion: channelHasVersion((0, import_node_path14.join)(path5)),
|
|
1225
1284
|
/**
|
|
1226
1285
|
* Add a channel to an event
|
|
1227
1286
|
*
|
|
@@ -1238,7 +1297,7 @@ var index_default = (path5) => {
|
|
|
1238
1297
|
*
|
|
1239
1298
|
* ```
|
|
1240
1299
|
*/
|
|
1241
|
-
addEventToChannel: addMessageToChannel((0,
|
|
1300
|
+
addEventToChannel: addMessageToChannel((0, import_node_path14.join)(path5), "events"),
|
|
1242
1301
|
/**
|
|
1243
1302
|
* Add a channel to an command
|
|
1244
1303
|
*
|
|
@@ -1255,7 +1314,7 @@ var index_default = (path5) => {
|
|
|
1255
1314
|
*
|
|
1256
1315
|
* ```
|
|
1257
1316
|
*/
|
|
1258
|
-
addCommandToChannel: addMessageToChannel((0,
|
|
1317
|
+
addCommandToChannel: addMessageToChannel((0, import_node_path14.join)(path5), "commands"),
|
|
1259
1318
|
/**
|
|
1260
1319
|
* Add a channel to an query
|
|
1261
1320
|
*
|
|
@@ -1272,7 +1331,7 @@ var index_default = (path5) => {
|
|
|
1272
1331
|
*
|
|
1273
1332
|
* ```
|
|
1274
1333
|
*/
|
|
1275
|
-
addQueryToChannel: addMessageToChannel((0,
|
|
1334
|
+
addQueryToChannel: addMessageToChannel((0, import_node_path14.join)(path5), "queries"),
|
|
1276
1335
|
/**
|
|
1277
1336
|
* ================================
|
|
1278
1337
|
* SERVICES
|
|
@@ -1285,14 +1344,14 @@ var index_default = (path5) => {
|
|
|
1285
1344
|
* @param options - Optional options to write the event
|
|
1286
1345
|
*
|
|
1287
1346
|
*/
|
|
1288
|
-
writeService: writeService((0,
|
|
1347
|
+
writeService: writeService((0, import_node_path14.join)(path5, "services")),
|
|
1289
1348
|
/**
|
|
1290
1349
|
* Adds a versioned service to EventCatalog
|
|
1291
1350
|
*
|
|
1292
1351
|
* @param service - The service to write
|
|
1293
1352
|
*
|
|
1294
1353
|
*/
|
|
1295
|
-
writeVersionedService: writeVersionedService((0,
|
|
1354
|
+
writeVersionedService: writeVersionedService((0, import_node_path14.join)(path5, "services")),
|
|
1296
1355
|
/**
|
|
1297
1356
|
* Adds a service to a domain in EventCatalog
|
|
1298
1357
|
*
|
|
@@ -1301,45 +1360,45 @@ var index_default = (path5) => {
|
|
|
1301
1360
|
* @param options - Optional options to write the event
|
|
1302
1361
|
*
|
|
1303
1362
|
*/
|
|
1304
|
-
writeServiceToDomain: writeServiceToDomain((0,
|
|
1363
|
+
writeServiceToDomain: writeServiceToDomain((0, import_node_path14.join)(path5, "domains")),
|
|
1305
1364
|
/**
|
|
1306
1365
|
* Returns a service from EventCatalog
|
|
1307
1366
|
* @param id - The id of the service to retrieve
|
|
1308
1367
|
* @param version - Optional id of the version to get (supports semver)
|
|
1309
1368
|
* @returns Service|Undefined
|
|
1310
1369
|
*/
|
|
1311
|
-
getService: getService((0,
|
|
1370
|
+
getService: getService((0, import_node_path14.join)(path5)),
|
|
1312
1371
|
/**
|
|
1313
1372
|
* Returns a service from EventCatalog by it's path.
|
|
1314
1373
|
* @param path - The path to the service to retrieve
|
|
1315
1374
|
* @returns Service|Undefined
|
|
1316
1375
|
*/
|
|
1317
|
-
getServiceByPath: getServiceByPath((0,
|
|
1376
|
+
getServiceByPath: getServiceByPath((0, import_node_path14.join)(path5)),
|
|
1318
1377
|
/**
|
|
1319
1378
|
* Returns all services from EventCatalog
|
|
1320
1379
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1321
1380
|
* @returns Service[]|Undefined
|
|
1322
1381
|
*/
|
|
1323
|
-
getServices: getServices((0,
|
|
1382
|
+
getServices: getServices((0, import_node_path14.join)(path5)),
|
|
1324
1383
|
/**
|
|
1325
1384
|
* Moves a given service id to the version directory
|
|
1326
1385
|
* @param directory
|
|
1327
1386
|
*/
|
|
1328
|
-
versionService: versionService((0,
|
|
1387
|
+
versionService: versionService((0, import_node_path14.join)(path5)),
|
|
1329
1388
|
/**
|
|
1330
1389
|
* Remove a service from EventCatalog (modeled on the standard POSIX rm utility)
|
|
1331
1390
|
*
|
|
1332
1391
|
* @param path - The path to your service, e.g. `/InventoryService`
|
|
1333
1392
|
*
|
|
1334
1393
|
*/
|
|
1335
|
-
rmService: rmService((0,
|
|
1394
|
+
rmService: rmService((0, import_node_path14.join)(path5, "services")),
|
|
1336
1395
|
/**
|
|
1337
1396
|
* Remove an service by an service id
|
|
1338
1397
|
*
|
|
1339
1398
|
* @param id - The id of the service you want to remove
|
|
1340
1399
|
*
|
|
1341
1400
|
*/
|
|
1342
|
-
rmServiceById: rmServiceById((0,
|
|
1401
|
+
rmServiceById: rmServiceById((0, import_node_path14.join)(path5)),
|
|
1343
1402
|
/**
|
|
1344
1403
|
* Adds a file to the given service
|
|
1345
1404
|
* @param id - The id of the service to add the file to
|
|
@@ -1347,21 +1406,21 @@ var index_default = (path5) => {
|
|
|
1347
1406
|
* @param version - Optional version of the service to add the file to
|
|
1348
1407
|
* @returns
|
|
1349
1408
|
*/
|
|
1350
|
-
addFileToService: addFileToService((0,
|
|
1409
|
+
addFileToService: addFileToService((0, import_node_path14.join)(path5)),
|
|
1351
1410
|
/**
|
|
1352
1411
|
* Returns the specifications for a given service
|
|
1353
1412
|
* @param id - The id of the service to retrieve the specifications for
|
|
1354
1413
|
* @param version - Optional version of the service
|
|
1355
1414
|
* @returns
|
|
1356
1415
|
*/
|
|
1357
|
-
getSpecificationFilesForService: getSpecificationFilesForService((0,
|
|
1416
|
+
getSpecificationFilesForService: getSpecificationFilesForService((0, import_node_path14.join)(path5)),
|
|
1358
1417
|
/**
|
|
1359
1418
|
* Check to see if a service version exists
|
|
1360
1419
|
* @param id - The id of the service
|
|
1361
1420
|
* @param version - The version of the service (supports semver)
|
|
1362
1421
|
* @returns
|
|
1363
1422
|
*/
|
|
1364
|
-
serviceHasVersion: serviceHasVersion((0,
|
|
1423
|
+
serviceHasVersion: serviceHasVersion((0, import_node_path14.join)(path5)),
|
|
1365
1424
|
/**
|
|
1366
1425
|
* Add an event to a service by it's id.
|
|
1367
1426
|
*
|
|
@@ -1381,7 +1440,7 @@ var index_default = (path5) => {
|
|
|
1381
1440
|
*
|
|
1382
1441
|
* ```
|
|
1383
1442
|
*/
|
|
1384
|
-
addEventToService: addMessageToService((0,
|
|
1443
|
+
addEventToService: addMessageToService((0, import_node_path14.join)(path5)),
|
|
1385
1444
|
/**
|
|
1386
1445
|
* Add a command to a service by it's id.
|
|
1387
1446
|
*
|
|
@@ -1401,7 +1460,7 @@ var index_default = (path5) => {
|
|
|
1401
1460
|
*
|
|
1402
1461
|
* ```
|
|
1403
1462
|
*/
|
|
1404
|
-
addCommandToService: addMessageToService((0,
|
|
1463
|
+
addCommandToService: addMessageToService((0, import_node_path14.join)(path5)),
|
|
1405
1464
|
/**
|
|
1406
1465
|
* Add a query to a service by it's id.
|
|
1407
1466
|
*
|
|
@@ -1421,7 +1480,25 @@ var index_default = (path5) => {
|
|
|
1421
1480
|
*
|
|
1422
1481
|
* ```
|
|
1423
1482
|
*/
|
|
1424
|
-
addQueryToService: addMessageToService((0,
|
|
1483
|
+
addQueryToService: addMessageToService((0, import_node_path14.join)(path5)),
|
|
1484
|
+
/**
|
|
1485
|
+
* Add an entity to a service by its id.
|
|
1486
|
+
*
|
|
1487
|
+
* @example
|
|
1488
|
+
* ```ts
|
|
1489
|
+
* import utils from '@eventcatalog/utils';
|
|
1490
|
+
*
|
|
1491
|
+
* const { addEntityToService } = utils('/path/to/eventcatalog');
|
|
1492
|
+
*
|
|
1493
|
+
* // adds a new entity (User) to the InventoryService
|
|
1494
|
+
* await addEntityToService('InventoryService', { id: 'User', version: '1.0.0' });
|
|
1495
|
+
*
|
|
1496
|
+
* // adds a new entity (Product) to a specific version of the InventoryService
|
|
1497
|
+
* await addEntityToService('InventoryService', { id: 'Product', version: '1.0.0' }, '2.0.0');
|
|
1498
|
+
*
|
|
1499
|
+
* ```
|
|
1500
|
+
*/
|
|
1501
|
+
addEntityToService: addEntityToService((0, import_node_path14.join)(path5)),
|
|
1425
1502
|
/**
|
|
1426
1503
|
* Check to see if a service exists by it's path.
|
|
1427
1504
|
*
|
|
@@ -1438,13 +1515,13 @@ var index_default = (path5) => {
|
|
|
1438
1515
|
* @param path - The path to the service to check
|
|
1439
1516
|
* @returns boolean
|
|
1440
1517
|
*/
|
|
1441
|
-
isService: isService((0,
|
|
1518
|
+
isService: isService((0, import_node_path14.join)(path5)),
|
|
1442
1519
|
/**
|
|
1443
1520
|
* Converts a file to a service.
|
|
1444
1521
|
* @param file - The file to convert to a service.
|
|
1445
1522
|
* @returns The service.
|
|
1446
1523
|
*/
|
|
1447
|
-
toService: toService((0,
|
|
1524
|
+
toService: toService((0, import_node_path14.join)(path5)),
|
|
1448
1525
|
/**
|
|
1449
1526
|
* ================================
|
|
1450
1527
|
* Domains
|
|
@@ -1457,39 +1534,39 @@ var index_default = (path5) => {
|
|
|
1457
1534
|
* @param options - Optional options to write the event
|
|
1458
1535
|
*
|
|
1459
1536
|
*/
|
|
1460
|
-
writeDomain: writeDomain((0,
|
|
1537
|
+
writeDomain: writeDomain((0, import_node_path14.join)(path5, "domains")),
|
|
1461
1538
|
/**
|
|
1462
1539
|
* Returns a domain from EventCatalog
|
|
1463
1540
|
* @param id - The id of the domain to retrieve
|
|
1464
1541
|
* @param version - Optional id of the version to get (supports semver)
|
|
1465
1542
|
* @returns Domain|Undefined
|
|
1466
1543
|
*/
|
|
1467
|
-
getDomain: getDomain((0,
|
|
1544
|
+
getDomain: getDomain((0, import_node_path14.join)(path5, "domains")),
|
|
1468
1545
|
/**
|
|
1469
1546
|
* Returns all domains from EventCatalog
|
|
1470
1547
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1471
1548
|
* @returns Domain[]|Undefined
|
|
1472
1549
|
*/
|
|
1473
|
-
getDomains: getDomains((0,
|
|
1550
|
+
getDomains: getDomains((0, import_node_path14.join)(path5)),
|
|
1474
1551
|
/**
|
|
1475
1552
|
* Moves a given domain id to the version directory
|
|
1476
1553
|
* @param directory
|
|
1477
1554
|
*/
|
|
1478
|
-
versionDomain: versionDomain((0,
|
|
1555
|
+
versionDomain: versionDomain((0, import_node_path14.join)(path5, "domains")),
|
|
1479
1556
|
/**
|
|
1480
1557
|
* Remove a domain from EventCatalog (modeled on the standard POSIX rm utility)
|
|
1481
1558
|
*
|
|
1482
1559
|
* @param path - The path to your domain, e.g. `/Payment`
|
|
1483
1560
|
*
|
|
1484
1561
|
*/
|
|
1485
|
-
rmDomain: rmDomain((0,
|
|
1562
|
+
rmDomain: rmDomain((0, import_node_path14.join)(path5, "domains")),
|
|
1486
1563
|
/**
|
|
1487
1564
|
* Remove an service by an domain id
|
|
1488
1565
|
*
|
|
1489
1566
|
* @param id - The id of the domain you want to remove
|
|
1490
1567
|
*
|
|
1491
1568
|
*/
|
|
1492
|
-
rmDomainById: rmDomainById((0,
|
|
1569
|
+
rmDomainById: rmDomainById((0, import_node_path14.join)(path5, "domains")),
|
|
1493
1570
|
/**
|
|
1494
1571
|
* Adds a file to the given domain
|
|
1495
1572
|
* @param id - The id of the domain to add the file to
|
|
@@ -1497,28 +1574,28 @@ var index_default = (path5) => {
|
|
|
1497
1574
|
* @param version - Optional version of the domain to add the file to
|
|
1498
1575
|
* @returns
|
|
1499
1576
|
*/
|
|
1500
|
-
addFileToDomain: addFileToDomain((0,
|
|
1577
|
+
addFileToDomain: addFileToDomain((0, import_node_path14.join)(path5, "domains")),
|
|
1501
1578
|
/**
|
|
1502
1579
|
* Adds an ubiquitous language dictionary to a domain
|
|
1503
1580
|
* @param id - The id of the domain to add the ubiquitous language to
|
|
1504
1581
|
* @param ubiquitousLanguageDictionary - The ubiquitous language dictionary to add
|
|
1505
1582
|
* @param version - Optional version of the domain to add the ubiquitous language to
|
|
1506
1583
|
*/
|
|
1507
|
-
addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain((0,
|
|
1584
|
+
addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain((0, import_node_path14.join)(path5, "domains")),
|
|
1508
1585
|
/**
|
|
1509
1586
|
* Get the ubiquitous language dictionary from a domain
|
|
1510
1587
|
* @param id - The id of the domain to get the ubiquitous language from
|
|
1511
1588
|
* @param version - Optional version of the domain to get the ubiquitous language from
|
|
1512
1589
|
* @returns
|
|
1513
1590
|
*/
|
|
1514
|
-
getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain((0,
|
|
1591
|
+
getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain((0, import_node_path14.join)(path5, "domains")),
|
|
1515
1592
|
/**
|
|
1516
1593
|
* Check to see if a domain version exists
|
|
1517
1594
|
* @param id - The id of the domain
|
|
1518
1595
|
* @param version - The version of the domain (supports semver)
|
|
1519
1596
|
* @returns
|
|
1520
1597
|
*/
|
|
1521
|
-
domainHasVersion: domainHasVersion((0,
|
|
1598
|
+
domainHasVersion: domainHasVersion((0, import_node_path14.join)(path5)),
|
|
1522
1599
|
/**
|
|
1523
1600
|
* Adds a given service to a domain
|
|
1524
1601
|
* @param id - The id of the domain
|
|
@@ -1526,7 +1603,7 @@ var index_default = (path5) => {
|
|
|
1526
1603
|
* @param version - (Optional) The version of the domain to add the service to
|
|
1527
1604
|
* @returns
|
|
1528
1605
|
*/
|
|
1529
|
-
addServiceToDomain: addServiceToDomain((0,
|
|
1606
|
+
addServiceToDomain: addServiceToDomain((0, import_node_path14.join)(path5, "domains")),
|
|
1530
1607
|
/**
|
|
1531
1608
|
* Adds a given subdomain to a domain
|
|
1532
1609
|
* @param id - The id of the domain
|
|
@@ -1534,7 +1611,15 @@ var index_default = (path5) => {
|
|
|
1534
1611
|
* @param version - (Optional) The version of the domain to add the subdomain to
|
|
1535
1612
|
* @returns
|
|
1536
1613
|
*/
|
|
1537
|
-
addSubDomainToDomain: addSubDomainToDomain((0,
|
|
1614
|
+
addSubDomainToDomain: addSubDomainToDomain((0, import_node_path14.join)(path5, "domains")),
|
|
1615
|
+
/**
|
|
1616
|
+
* Adds an entity to a domain
|
|
1617
|
+
* @param id - The id of the domain
|
|
1618
|
+
* @param entity - The id and version of the entity to add
|
|
1619
|
+
* @param version - (Optional) The version of the domain to add the entity to
|
|
1620
|
+
* @returns
|
|
1621
|
+
*/
|
|
1622
|
+
addEntityToDomain: addEntityToDomain((0, import_node_path14.join)(path5, "domains")),
|
|
1538
1623
|
/**
|
|
1539
1624
|
* ================================
|
|
1540
1625
|
* Teams
|
|
@@ -1547,25 +1632,25 @@ var index_default = (path5) => {
|
|
|
1547
1632
|
* @param options - Optional options to write the team
|
|
1548
1633
|
*
|
|
1549
1634
|
*/
|
|
1550
|
-
writeTeam: writeTeam((0,
|
|
1635
|
+
writeTeam: writeTeam((0, import_node_path14.join)(path5, "teams")),
|
|
1551
1636
|
/**
|
|
1552
1637
|
* Returns a team from EventCatalog
|
|
1553
1638
|
* @param id - The id of the team to retrieve
|
|
1554
1639
|
* @returns Team|Undefined
|
|
1555
1640
|
*/
|
|
1556
|
-
getTeam: getTeam((0,
|
|
1641
|
+
getTeam: getTeam((0, import_node_path14.join)(path5, "teams")),
|
|
1557
1642
|
/**
|
|
1558
1643
|
* Returns all teams from EventCatalog
|
|
1559
1644
|
* @returns Team[]|Undefined
|
|
1560
1645
|
*/
|
|
1561
|
-
getTeams: getTeams((0,
|
|
1646
|
+
getTeams: getTeams((0, import_node_path14.join)(path5, "teams")),
|
|
1562
1647
|
/**
|
|
1563
1648
|
* Remove a team by the team id
|
|
1564
1649
|
*
|
|
1565
1650
|
* @param id - The id of the team you want to remove
|
|
1566
1651
|
*
|
|
1567
1652
|
*/
|
|
1568
|
-
rmTeamById: rmTeamById((0,
|
|
1653
|
+
rmTeamById: rmTeamById((0, import_node_path14.join)(path5, "teams")),
|
|
1569
1654
|
/**
|
|
1570
1655
|
* ================================
|
|
1571
1656
|
* Users
|
|
@@ -1578,25 +1663,25 @@ var index_default = (path5) => {
|
|
|
1578
1663
|
* @param options - Optional options to write the user
|
|
1579
1664
|
*
|
|
1580
1665
|
*/
|
|
1581
|
-
writeUser: writeUser((0,
|
|
1666
|
+
writeUser: writeUser((0, import_node_path14.join)(path5, "users")),
|
|
1582
1667
|
/**
|
|
1583
1668
|
* Returns a user from EventCatalog
|
|
1584
1669
|
* @param id - The id of the user to retrieve
|
|
1585
1670
|
* @returns User|Undefined
|
|
1586
1671
|
*/
|
|
1587
|
-
getUser: getUser((0,
|
|
1672
|
+
getUser: getUser((0, import_node_path14.join)(path5, "users")),
|
|
1588
1673
|
/**
|
|
1589
1674
|
* Returns all user from EventCatalog
|
|
1590
1675
|
* @returns User[]|Undefined
|
|
1591
1676
|
*/
|
|
1592
|
-
getUsers: getUsers((0,
|
|
1677
|
+
getUsers: getUsers((0, import_node_path14.join)(path5)),
|
|
1593
1678
|
/**
|
|
1594
1679
|
* Remove a user by the user id
|
|
1595
1680
|
*
|
|
1596
1681
|
* @param id - The id of the user you want to remove
|
|
1597
1682
|
*
|
|
1598
1683
|
*/
|
|
1599
|
-
rmUserById: rmUserById((0,
|
|
1684
|
+
rmUserById: rmUserById((0, import_node_path14.join)(path5, "users")),
|
|
1600
1685
|
/**
|
|
1601
1686
|
* ================================
|
|
1602
1687
|
* Custom Docs
|
|
@@ -1607,32 +1692,32 @@ var index_default = (path5) => {
|
|
|
1607
1692
|
* @param path - The path to the custom doc to retrieve
|
|
1608
1693
|
* @returns CustomDoc|Undefined
|
|
1609
1694
|
*/
|
|
1610
|
-
getCustomDoc: getCustomDoc((0,
|
|
1695
|
+
getCustomDoc: getCustomDoc((0, import_node_path14.join)(path5, "docs")),
|
|
1611
1696
|
/**
|
|
1612
1697
|
* Returns all custom docs from EventCatalog
|
|
1613
1698
|
* @param options - Optional options to get custom docs from a specific path
|
|
1614
1699
|
* @returns CustomDoc[]|Undefined
|
|
1615
1700
|
*/
|
|
1616
|
-
getCustomDocs: getCustomDocs((0,
|
|
1701
|
+
getCustomDocs: getCustomDocs((0, import_node_path14.join)(path5, "docs")),
|
|
1617
1702
|
/**
|
|
1618
1703
|
* Writes a custom doc to EventCatalog
|
|
1619
1704
|
* @param customDoc - The custom doc to write
|
|
1620
1705
|
* @param options - Optional options to write the custom doc
|
|
1621
1706
|
*
|
|
1622
1707
|
*/
|
|
1623
|
-
writeCustomDoc: writeCustomDoc((0,
|
|
1708
|
+
writeCustomDoc: writeCustomDoc((0, import_node_path14.join)(path5, "docs")),
|
|
1624
1709
|
/**
|
|
1625
1710
|
* Removes a custom doc from EventCatalog
|
|
1626
1711
|
* @param path - The path to the custom doc to remove
|
|
1627
1712
|
*
|
|
1628
1713
|
*/
|
|
1629
|
-
rmCustomDoc: rmCustomDoc((0,
|
|
1714
|
+
rmCustomDoc: rmCustomDoc((0, import_node_path14.join)(path5, "docs")),
|
|
1630
1715
|
/**
|
|
1631
1716
|
* Dumps the catalog to a JSON file.
|
|
1632
1717
|
* @param directory - The directory to dump the catalog to
|
|
1633
1718
|
* @returns A JSON file with the catalog
|
|
1634
1719
|
*/
|
|
1635
|
-
dumpCatalog: dumpCatalog((0,
|
|
1720
|
+
dumpCatalog: dumpCatalog((0, import_node_path14.join)(path5)),
|
|
1636
1721
|
/**
|
|
1637
1722
|
* Returns the event catalog configuration file.
|
|
1638
1723
|
* The event catalog configuration file is the file that contains the configuration for the event catalog.
|
|
@@ -1640,7 +1725,7 @@ var index_default = (path5) => {
|
|
|
1640
1725
|
* @param directory - The directory of the catalog.
|
|
1641
1726
|
* @returns A JSON object with the configuration for the event catalog.
|
|
1642
1727
|
*/
|
|
1643
|
-
getEventCatalogConfigurationFile: getEventCatalogConfigurationFile((0,
|
|
1728
|
+
getEventCatalogConfigurationFile: getEventCatalogConfigurationFile((0, import_node_path14.join)(path5)),
|
|
1644
1729
|
/**
|
|
1645
1730
|
* ================================
|
|
1646
1731
|
* Resources Utils
|
|
@@ -1661,33 +1746,85 @@ var index_default = (path5) => {
|
|
|
1661
1746
|
* @param path - The path to the message to retrieve
|
|
1662
1747
|
* @returns Message|Undefined
|
|
1663
1748
|
*/
|
|
1664
|
-
getMessageBySchemaPath: getMessageBySchemaPath((0,
|
|
1749
|
+
getMessageBySchemaPath: getMessageBySchemaPath((0, import_node_path14.join)(path5)),
|
|
1665
1750
|
/**
|
|
1666
1751
|
* Returns the producers and consumers (services) for a given message
|
|
1667
1752
|
* @param id - The id of the message to get the producers and consumers for
|
|
1668
1753
|
* @param version - Optional version of the message
|
|
1669
1754
|
* @returns { producers: Service[], consumers: Service[] }
|
|
1670
1755
|
*/
|
|
1671
|
-
getProducersAndConsumersForMessage: getProducersAndConsumersForMessage((0,
|
|
1756
|
+
getProducersAndConsumersForMessage: getProducersAndConsumersForMessage((0, import_node_path14.join)(path5)),
|
|
1672
1757
|
/**
|
|
1673
1758
|
* Returns the consumers of a given schema path
|
|
1674
1759
|
* @param path - The path to the schema to get the consumers for
|
|
1675
1760
|
* @returns Service[]
|
|
1676
1761
|
*/
|
|
1677
|
-
getConsumersOfSchema: getConsumersOfSchema((0,
|
|
1762
|
+
getConsumersOfSchema: getConsumersOfSchema((0, import_node_path14.join)(path5)),
|
|
1678
1763
|
/**
|
|
1679
1764
|
* Returns the producers of a given schema path
|
|
1680
1765
|
* @param path - The path to the schema to get the producers for
|
|
1681
1766
|
* @returns Service[]
|
|
1682
1767
|
*/
|
|
1683
|
-
getProducersOfSchema: getProducersOfSchema((0,
|
|
1768
|
+
getProducersOfSchema: getProducersOfSchema((0, import_node_path14.join)(path5)),
|
|
1684
1769
|
/**
|
|
1685
1770
|
* Returns the owners for a given resource (e.g domain, service, event, command, query, etc.)
|
|
1686
1771
|
* @param id - The id of the resource to get the owners for
|
|
1687
1772
|
* @param version - Optional version of the resource
|
|
1688
1773
|
* @returns { owners: User[] }
|
|
1689
1774
|
*/
|
|
1690
|
-
getOwnersForResource: getOwnersForResource((0,
|
|
1775
|
+
getOwnersForResource: getOwnersForResource((0, import_node_path14.join)(path5)),
|
|
1776
|
+
/**
|
|
1777
|
+
* ================================
|
|
1778
|
+
* Entities
|
|
1779
|
+
* ================================
|
|
1780
|
+
*/
|
|
1781
|
+
/**
|
|
1782
|
+
* Returns an entity from EventCatalog
|
|
1783
|
+
* @param id - The id of the entity to retrieve
|
|
1784
|
+
* @param version - Optional id of the version to get (supports semver)
|
|
1785
|
+
* @returns Entity|Undefined
|
|
1786
|
+
*/
|
|
1787
|
+
getEntity: getEntity((0, import_node_path14.join)(path5)),
|
|
1788
|
+
/**
|
|
1789
|
+
* Returns all entities from EventCatalog
|
|
1790
|
+
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1791
|
+
* @returns Entity[]|Undefined
|
|
1792
|
+
*/
|
|
1793
|
+
getEntities: getEntities((0, import_node_path14.join)(path5)),
|
|
1794
|
+
/**
|
|
1795
|
+
* Adds an entity to EventCatalog
|
|
1796
|
+
*
|
|
1797
|
+
* @param entity - The entity to write
|
|
1798
|
+
* @param options - Optional options to write the entity
|
|
1799
|
+
*
|
|
1800
|
+
*/
|
|
1801
|
+
writeEntity: writeEntity((0, import_node_path14.join)(path5, "entities")),
|
|
1802
|
+
/**
|
|
1803
|
+
* Remove an entity from EventCatalog (modeled on the standard POSIX rm utility)
|
|
1804
|
+
*
|
|
1805
|
+
* @param path - The path to your entity, e.g. `/User`
|
|
1806
|
+
*
|
|
1807
|
+
*/
|
|
1808
|
+
rmEntity: rmEntity((0, import_node_path14.join)(path5, "entities")),
|
|
1809
|
+
/**
|
|
1810
|
+
* Remove an entity by an entity id
|
|
1811
|
+
*
|
|
1812
|
+
* @param id - The id of the entity you want to remove
|
|
1813
|
+
*
|
|
1814
|
+
*/
|
|
1815
|
+
rmEntityById: rmEntityById((0, import_node_path14.join)(path5)),
|
|
1816
|
+
/**
|
|
1817
|
+
* Moves a given entity id to the version directory
|
|
1818
|
+
* @param id - The id of the entity to version
|
|
1819
|
+
*/
|
|
1820
|
+
versionEntity: versionEntity((0, import_node_path14.join)(path5)),
|
|
1821
|
+
/**
|
|
1822
|
+
* Check to see if an entity version exists
|
|
1823
|
+
* @param id - The id of the entity
|
|
1824
|
+
* @param version - The version of the entity (supports semver)
|
|
1825
|
+
* @returns
|
|
1826
|
+
*/
|
|
1827
|
+
entityHasVersion: entityHasVersion((0, import_node_path14.join)(path5))
|
|
1691
1828
|
};
|
|
1692
1829
|
};
|
|
1693
1830
|
|
|
@@ -1695,7 +1832,7 @@ var index_default = (path5) => {
|
|
|
1695
1832
|
var DUMP_VERSION = "0.0.1";
|
|
1696
1833
|
var getEventCatalogVersion = async (catalogDir) => {
|
|
1697
1834
|
try {
|
|
1698
|
-
const packageJson = import_fs.default.readFileSync((0,
|
|
1835
|
+
const packageJson = import_fs.default.readFileSync((0, import_node_path15.join)(catalogDir, "package.json"), "utf8");
|
|
1699
1836
|
const packageJsonObject = JSON.parse(packageJson);
|
|
1700
1837
|
return packageJsonObject["dependencies"]["@eventcatalog/core"];
|
|
1701
1838
|
} catch (error) {
|
|
@@ -1708,7 +1845,7 @@ var hydrateResource = async (catalogDir, resources = [], { attachSchema = false
|
|
|
1708
1845
|
const resourcePath = await getResourcePath(catalogDir, resource.id, resource.version);
|
|
1709
1846
|
let schema = "";
|
|
1710
1847
|
if (resource.schemaPath && resourcePath?.fullPath) {
|
|
1711
|
-
const pathToSchema =
|
|
1848
|
+
const pathToSchema = import_node_path15.default.join(import_node_path15.default.dirname(resourcePath?.fullPath), resource.schemaPath);
|
|
1712
1849
|
if (import_fs.default.existsSync(pathToSchema)) {
|
|
1713
1850
|
schema = import_fs.default.readFileSync(pathToSchema, "utf8");
|
|
1714
1851
|
}
|
|
@@ -1729,7 +1866,7 @@ var filterCollection = (collection, options) => {
|
|
|
1729
1866
|
};
|
|
1730
1867
|
var getEventCatalogConfigurationFile = (directory) => async () => {
|
|
1731
1868
|
try {
|
|
1732
|
-
const path5 = (0,
|
|
1869
|
+
const path5 = (0, import_node_path15.join)(directory, "eventcatalog.config.js");
|
|
1733
1870
|
const configModule = await import(path5);
|
|
1734
1871
|
return configModule.default;
|
|
1735
1872
|
} catch (error) {
|