@eventcatalog/sdk 2.6.8 → 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 +31 -1
- package/dist/types.d.d.ts +31 -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 path4, { join as
|
|
2
|
+
import fs11 from "fs";
|
|
3
|
+
import path4, { join as join15 } from "path";
|
|
4
4
|
|
|
5
5
|
// src/index.ts
|
|
6
|
-
import { join as
|
|
6
|
+
import { join as join14 } from "path";
|
|
7
7
|
|
|
8
8
|
// src/events.ts
|
|
9
9
|
import fs2 from "fs/promises";
|
|
@@ -522,6 +522,28 @@ var isService = (directory) => async (path5) => {
|
|
|
522
522
|
return !!service && segments.includes("services");
|
|
523
523
|
};
|
|
524
524
|
var toService = (directory) => async (file) => toResource(directory, file);
|
|
525
|
+
var addEntityToService = (directory) => async (id, entity, version) => {
|
|
526
|
+
let service = await getService(directory)(id, version);
|
|
527
|
+
const servicePath = await getResourcePath(directory, id, version);
|
|
528
|
+
const extension = extname(servicePath?.fullPath || "");
|
|
529
|
+
if (service.entities === void 0) {
|
|
530
|
+
service.entities = [];
|
|
531
|
+
}
|
|
532
|
+
for (let i = 0; i < service.entities.length; i++) {
|
|
533
|
+
if (service.entities[i].id === entity.id && service.entities[i].version === entity.version) {
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
service.entities.push({ id: entity.id, version: entity.version });
|
|
538
|
+
const existingResource = await findFileById(directory, id, version);
|
|
539
|
+
if (!existingResource) {
|
|
540
|
+
throw new Error(`Cannot find service ${id} in the catalog`);
|
|
541
|
+
}
|
|
542
|
+
const path5 = existingResource.split(/[\\/]+services/)[0];
|
|
543
|
+
const pathToResource = join6(path5, "services");
|
|
544
|
+
await rmServiceById(directory)(id, version);
|
|
545
|
+
await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
|
|
546
|
+
};
|
|
525
547
|
|
|
526
548
|
// src/domains.ts
|
|
527
549
|
import fs6 from "fs/promises";
|
|
@@ -605,6 +627,21 @@ var addSubDomainToDomain = (directory) => async (id, subDomain, version) => {
|
|
|
605
627
|
await rmDomainById(directory)(id, version, true);
|
|
606
628
|
await writeDomain(directory)(domain, { format: extension === ".md" ? "md" : "mdx" });
|
|
607
629
|
};
|
|
630
|
+
var addEntityToDomain = (directory) => async (id, entity, version) => {
|
|
631
|
+
let domain = await getDomain(directory)(id, version);
|
|
632
|
+
const domainPath = await getResourcePath(directory, id, version);
|
|
633
|
+
const extension = path.extname(domainPath?.fullPath || "");
|
|
634
|
+
if (domain.entities === void 0) {
|
|
635
|
+
domain.entities = [];
|
|
636
|
+
}
|
|
637
|
+
const entityExistsInList = domain.entities.some((e) => e.id === entity.id && e.version === entity.version);
|
|
638
|
+
if (entityExistsInList) {
|
|
639
|
+
return;
|
|
640
|
+
}
|
|
641
|
+
domain.entities.push(entity);
|
|
642
|
+
await rmDomainById(directory)(id, version, true);
|
|
643
|
+
await writeDomain(directory)(domain, { format: extension === ".md" ? "md" : "mdx" });
|
|
644
|
+
};
|
|
608
645
|
|
|
609
646
|
// src/channels.ts
|
|
610
647
|
import fs7 from "fs/promises";
|
|
@@ -906,6 +943,28 @@ var getOwnersForResource = (catalogDir) => async (id, version) => {
|
|
|
906
943
|
return owners;
|
|
907
944
|
};
|
|
908
945
|
|
|
946
|
+
// src/entities.ts
|
|
947
|
+
import fs10 from "fs/promises";
|
|
948
|
+
import { join as join13 } from "path";
|
|
949
|
+
var getEntity = (directory) => async (id, version) => getResource(directory, id, version, { type: "entity" });
|
|
950
|
+
var getEntities = (directory) => async (options) => getResources(directory, { type: "entities", latestOnly: options?.latestOnly });
|
|
951
|
+
var writeEntity = (directory) => async (entity, options = {
|
|
952
|
+
path: "",
|
|
953
|
+
override: false,
|
|
954
|
+
format: "mdx"
|
|
955
|
+
}) => writeResource(directory, { ...entity }, { ...options, type: "entity" });
|
|
956
|
+
var rmEntity = (directory) => async (path5) => {
|
|
957
|
+
await fs10.rm(join13(directory, path5), { recursive: true });
|
|
958
|
+
};
|
|
959
|
+
var rmEntityById = (directory) => async (id, version, persistFiles) => {
|
|
960
|
+
await rmResourceById(directory, id, version, { type: "entity", persistFiles });
|
|
961
|
+
};
|
|
962
|
+
var versionEntity = (directory) => async (id) => versionResource(directory, id);
|
|
963
|
+
var entityHasVersion = (directory) => async (id, version) => {
|
|
964
|
+
const file = await findFileById(directory, id, version);
|
|
965
|
+
return !!file;
|
|
966
|
+
};
|
|
967
|
+
|
|
909
968
|
// src/index.ts
|
|
910
969
|
var index_default = (path5) => {
|
|
911
970
|
return {
|
|
@@ -915,13 +974,13 @@ var index_default = (path5) => {
|
|
|
915
974
|
* @param version - Optional id of the version to get (supports semver)
|
|
916
975
|
* @returns Event|Undefined
|
|
917
976
|
*/
|
|
918
|
-
getEvent: getEvent(
|
|
977
|
+
getEvent: getEvent(join14(path5)),
|
|
919
978
|
/**
|
|
920
979
|
* Returns all events from EventCatalog
|
|
921
980
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
922
981
|
* @returns Event[]|Undefined
|
|
923
982
|
*/
|
|
924
|
-
getEvents: getEvents(
|
|
983
|
+
getEvents: getEvents(join14(path5)),
|
|
925
984
|
/**
|
|
926
985
|
* Adds an event to EventCatalog
|
|
927
986
|
*
|
|
@@ -929,7 +988,7 @@ var index_default = (path5) => {
|
|
|
929
988
|
* @param options - Optional options to write the event
|
|
930
989
|
*
|
|
931
990
|
*/
|
|
932
|
-
writeEvent: writeEvent(
|
|
991
|
+
writeEvent: writeEvent(join14(path5, "events")),
|
|
933
992
|
/**
|
|
934
993
|
* Adds an event to a service in EventCatalog
|
|
935
994
|
*
|
|
@@ -938,26 +997,26 @@ var index_default = (path5) => {
|
|
|
938
997
|
* @param options - Optional options to write the event
|
|
939
998
|
*
|
|
940
999
|
*/
|
|
941
|
-
writeEventToService: writeEventToService(
|
|
1000
|
+
writeEventToService: writeEventToService(join14(path5)),
|
|
942
1001
|
/**
|
|
943
1002
|
* Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
|
|
944
1003
|
*
|
|
945
1004
|
* @param path - The path to your event, e.g. `/Inventory/InventoryAdjusted`
|
|
946
1005
|
*
|
|
947
1006
|
*/
|
|
948
|
-
rmEvent: rmEvent(
|
|
1007
|
+
rmEvent: rmEvent(join14(path5, "events")),
|
|
949
1008
|
/**
|
|
950
1009
|
* Remove an event by an Event id
|
|
951
1010
|
*
|
|
952
1011
|
* @param id - The id of the event you want to remove
|
|
953
1012
|
*
|
|
954
1013
|
*/
|
|
955
|
-
rmEventById: rmEventById(
|
|
1014
|
+
rmEventById: rmEventById(join14(path5)),
|
|
956
1015
|
/**
|
|
957
1016
|
* Moves a given event id to the version directory
|
|
958
1017
|
* @param directory
|
|
959
1018
|
*/
|
|
960
|
-
versionEvent: versionEvent(
|
|
1019
|
+
versionEvent: versionEvent(join14(path5)),
|
|
961
1020
|
/**
|
|
962
1021
|
* Adds a file to the given event
|
|
963
1022
|
* @param id - The id of the event to add the file to
|
|
@@ -965,7 +1024,7 @@ var index_default = (path5) => {
|
|
|
965
1024
|
* @param version - Optional version of the event to add the file to
|
|
966
1025
|
* @returns
|
|
967
1026
|
*/
|
|
968
|
-
addFileToEvent: addFileToEvent(
|
|
1027
|
+
addFileToEvent: addFileToEvent(join14(path5)),
|
|
969
1028
|
/**
|
|
970
1029
|
* Adds a schema to the given event
|
|
971
1030
|
* @param id - The id of the event to add the schema to
|
|
@@ -973,14 +1032,14 @@ var index_default = (path5) => {
|
|
|
973
1032
|
* @param version - Optional version of the event to add the schema to
|
|
974
1033
|
* @returns
|
|
975
1034
|
*/
|
|
976
|
-
addSchemaToEvent: addSchemaToEvent(
|
|
1035
|
+
addSchemaToEvent: addSchemaToEvent(join14(path5)),
|
|
977
1036
|
/**
|
|
978
1037
|
* Check to see if an event version exists
|
|
979
1038
|
* @param id - The id of the event
|
|
980
1039
|
* @param version - The version of the event (supports semver)
|
|
981
1040
|
* @returns
|
|
982
1041
|
*/
|
|
983
|
-
eventHasVersion: eventHasVersion(
|
|
1042
|
+
eventHasVersion: eventHasVersion(join14(path5)),
|
|
984
1043
|
/**
|
|
985
1044
|
* ================================
|
|
986
1045
|
* Commands
|
|
@@ -992,13 +1051,13 @@ var index_default = (path5) => {
|
|
|
992
1051
|
* @param version - Optional id of the version to get (supports semver)
|
|
993
1052
|
* @returns Command|Undefined
|
|
994
1053
|
*/
|
|
995
|
-
getCommand: getCommand(
|
|
1054
|
+
getCommand: getCommand(join14(path5)),
|
|
996
1055
|
/**
|
|
997
1056
|
* Returns all commands from EventCatalog
|
|
998
1057
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
999
1058
|
* @returns Command[]|Undefined
|
|
1000
1059
|
*/
|
|
1001
|
-
getCommands: getCommands(
|
|
1060
|
+
getCommands: getCommands(join14(path5)),
|
|
1002
1061
|
/**
|
|
1003
1062
|
* Adds an command to EventCatalog
|
|
1004
1063
|
*
|
|
@@ -1006,7 +1065,7 @@ var index_default = (path5) => {
|
|
|
1006
1065
|
* @param options - Optional options to write the command
|
|
1007
1066
|
*
|
|
1008
1067
|
*/
|
|
1009
|
-
writeCommand: writeCommand(
|
|
1068
|
+
writeCommand: writeCommand(join14(path5, "commands")),
|
|
1010
1069
|
/**
|
|
1011
1070
|
* Adds a command to a service in EventCatalog
|
|
1012
1071
|
*
|
|
@@ -1015,26 +1074,26 @@ var index_default = (path5) => {
|
|
|
1015
1074
|
* @param options - Optional options to write the command
|
|
1016
1075
|
*
|
|
1017
1076
|
*/
|
|
1018
|
-
writeCommandToService: writeCommandToService(
|
|
1077
|
+
writeCommandToService: writeCommandToService(join14(path5)),
|
|
1019
1078
|
/**
|
|
1020
1079
|
* Remove an command to EventCatalog (modeled on the standard POSIX rm utility)
|
|
1021
1080
|
*
|
|
1022
1081
|
* @param path - The path to your command, e.g. `/Inventory/InventoryAdjusted`
|
|
1023
1082
|
*
|
|
1024
1083
|
*/
|
|
1025
|
-
rmCommand: rmCommand(
|
|
1084
|
+
rmCommand: rmCommand(join14(path5, "commands")),
|
|
1026
1085
|
/**
|
|
1027
1086
|
* Remove an command by an Event id
|
|
1028
1087
|
*
|
|
1029
1088
|
* @param id - The id of the command you want to remove
|
|
1030
1089
|
*
|
|
1031
1090
|
*/
|
|
1032
|
-
rmCommandById: rmCommandById(
|
|
1091
|
+
rmCommandById: rmCommandById(join14(path5)),
|
|
1033
1092
|
/**
|
|
1034
1093
|
* Moves a given command id to the version directory
|
|
1035
1094
|
* @param directory
|
|
1036
1095
|
*/
|
|
1037
|
-
versionCommand: versionCommand(
|
|
1096
|
+
versionCommand: versionCommand(join14(path5)),
|
|
1038
1097
|
/**
|
|
1039
1098
|
* Adds a file to the given command
|
|
1040
1099
|
* @param id - The id of the command to add the file to
|
|
@@ -1042,7 +1101,7 @@ var index_default = (path5) => {
|
|
|
1042
1101
|
* @param version - Optional version of the command to add the file to
|
|
1043
1102
|
* @returns
|
|
1044
1103
|
*/
|
|
1045
|
-
addFileToCommand: addFileToCommand(
|
|
1104
|
+
addFileToCommand: addFileToCommand(join14(path5)),
|
|
1046
1105
|
/**
|
|
1047
1106
|
* Adds a schema to the given command
|
|
1048
1107
|
* @param id - The id of the command to add the schema to
|
|
@@ -1050,14 +1109,14 @@ var index_default = (path5) => {
|
|
|
1050
1109
|
* @param version - Optional version of the command to add the schema to
|
|
1051
1110
|
* @returns
|
|
1052
1111
|
*/
|
|
1053
|
-
addSchemaToCommand: addSchemaToCommand(
|
|
1112
|
+
addSchemaToCommand: addSchemaToCommand(join14(path5)),
|
|
1054
1113
|
/**
|
|
1055
1114
|
* Check to see if a command version exists
|
|
1056
1115
|
* @param id - The id of the command
|
|
1057
1116
|
* @param version - The version of the command (supports semver)
|
|
1058
1117
|
* @returns
|
|
1059
1118
|
*/
|
|
1060
|
-
commandHasVersion: commandHasVersion(
|
|
1119
|
+
commandHasVersion: commandHasVersion(join14(path5)),
|
|
1061
1120
|
/**
|
|
1062
1121
|
* ================================
|
|
1063
1122
|
* Queries
|
|
@@ -1069,13 +1128,13 @@ var index_default = (path5) => {
|
|
|
1069
1128
|
* @param version - Optional id of the version to get (supports semver)
|
|
1070
1129
|
* @returns Query|Undefined
|
|
1071
1130
|
*/
|
|
1072
|
-
getQuery: getQuery(
|
|
1131
|
+
getQuery: getQuery(join14(path5)),
|
|
1073
1132
|
/**
|
|
1074
1133
|
* Returns all queries from EventCatalog
|
|
1075
1134
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1076
1135
|
* @returns Query[]|Undefined
|
|
1077
1136
|
*/
|
|
1078
|
-
getQueries: getQueries(
|
|
1137
|
+
getQueries: getQueries(join14(path5)),
|
|
1079
1138
|
/**
|
|
1080
1139
|
* Adds a query to EventCatalog
|
|
1081
1140
|
*
|
|
@@ -1083,7 +1142,7 @@ var index_default = (path5) => {
|
|
|
1083
1142
|
* @param options - Optional options to write the event
|
|
1084
1143
|
*
|
|
1085
1144
|
*/
|
|
1086
|
-
writeQuery: writeQuery(
|
|
1145
|
+
writeQuery: writeQuery(join14(path5, "queries")),
|
|
1087
1146
|
/**
|
|
1088
1147
|
* Adds a query to a service in EventCatalog
|
|
1089
1148
|
*
|
|
@@ -1092,26 +1151,26 @@ var index_default = (path5) => {
|
|
|
1092
1151
|
* @param options - Optional options to write the query
|
|
1093
1152
|
*
|
|
1094
1153
|
*/
|
|
1095
|
-
writeQueryToService: writeQueryToService(
|
|
1154
|
+
writeQueryToService: writeQueryToService(join14(path5)),
|
|
1096
1155
|
/**
|
|
1097
1156
|
* Remove an query to EventCatalog (modeled on the standard POSIX rm utility)
|
|
1098
1157
|
*
|
|
1099
1158
|
* @param path - The path to your query, e.g. `/Orders/GetOrder`
|
|
1100
1159
|
*
|
|
1101
1160
|
*/
|
|
1102
|
-
rmQuery: rmQuery(
|
|
1161
|
+
rmQuery: rmQuery(join14(path5, "queries")),
|
|
1103
1162
|
/**
|
|
1104
1163
|
* Remove a query by a Query id
|
|
1105
1164
|
*
|
|
1106
1165
|
* @param id - The id of the query you want to remove
|
|
1107
1166
|
*
|
|
1108
1167
|
*/
|
|
1109
|
-
rmQueryById: rmQueryById(
|
|
1168
|
+
rmQueryById: rmQueryById(join14(path5)),
|
|
1110
1169
|
/**
|
|
1111
1170
|
* Moves a given query id to the version directory
|
|
1112
1171
|
* @param directory
|
|
1113
1172
|
*/
|
|
1114
|
-
versionQuery: versionQuery(
|
|
1173
|
+
versionQuery: versionQuery(join14(path5)),
|
|
1115
1174
|
/**
|
|
1116
1175
|
* Adds a file to the given query
|
|
1117
1176
|
* @param id - The id of the query to add the file to
|
|
@@ -1119,7 +1178,7 @@ var index_default = (path5) => {
|
|
|
1119
1178
|
* @param version - Optional version of the query to add the file to
|
|
1120
1179
|
* @returns
|
|
1121
1180
|
*/
|
|
1122
|
-
addFileToQuery: addFileToQuery(
|
|
1181
|
+
addFileToQuery: addFileToQuery(join14(path5)),
|
|
1123
1182
|
/**
|
|
1124
1183
|
* Adds a schema to the given query
|
|
1125
1184
|
* @param id - The id of the query to add the schema to
|
|
@@ -1127,14 +1186,14 @@ var index_default = (path5) => {
|
|
|
1127
1186
|
* @param version - Optional version of the query to add the schema to
|
|
1128
1187
|
* @returns
|
|
1129
1188
|
*/
|
|
1130
|
-
addSchemaToQuery: addSchemaToQuery(
|
|
1189
|
+
addSchemaToQuery: addSchemaToQuery(join14(path5)),
|
|
1131
1190
|
/**
|
|
1132
1191
|
* Check to see if an query version exists
|
|
1133
1192
|
* @param id - The id of the query
|
|
1134
1193
|
* @param version - The version of the query (supports semver)
|
|
1135
1194
|
* @returns
|
|
1136
1195
|
*/
|
|
1137
|
-
queryHasVersion: queryHasVersion(
|
|
1196
|
+
queryHasVersion: queryHasVersion(join14(path5)),
|
|
1138
1197
|
/**
|
|
1139
1198
|
* ================================
|
|
1140
1199
|
* Channels
|
|
@@ -1146,13 +1205,13 @@ var index_default = (path5) => {
|
|
|
1146
1205
|
* @param version - Optional id of the version to get (supports semver)
|
|
1147
1206
|
* @returns Channel|Undefined
|
|
1148
1207
|
*/
|
|
1149
|
-
getChannel: getChannel(
|
|
1208
|
+
getChannel: getChannel(join14(path5)),
|
|
1150
1209
|
/**
|
|
1151
1210
|
* Returns all channels from EventCatalog
|
|
1152
1211
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1153
1212
|
* @returns Channel[]|Undefined
|
|
1154
1213
|
*/
|
|
1155
|
-
getChannels: getChannels(
|
|
1214
|
+
getChannels: getChannels(join14(path5)),
|
|
1156
1215
|
/**
|
|
1157
1216
|
* Adds an channel to EventCatalog
|
|
1158
1217
|
*
|
|
@@ -1160,33 +1219,33 @@ var index_default = (path5) => {
|
|
|
1160
1219
|
* @param options - Optional options to write the channel
|
|
1161
1220
|
*
|
|
1162
1221
|
*/
|
|
1163
|
-
writeChannel: writeChannel(
|
|
1222
|
+
writeChannel: writeChannel(join14(path5, "channels")),
|
|
1164
1223
|
/**
|
|
1165
1224
|
* Remove an channel to EventCatalog (modeled on the standard POSIX rm utility)
|
|
1166
1225
|
*
|
|
1167
1226
|
* @param path - The path to your channel, e.g. `/Inventory/InventoryAdjusted`
|
|
1168
1227
|
*
|
|
1169
1228
|
*/
|
|
1170
|
-
rmChannel: rmChannel(
|
|
1229
|
+
rmChannel: rmChannel(join14(path5, "channels")),
|
|
1171
1230
|
/**
|
|
1172
1231
|
* Remove an channel by an Event id
|
|
1173
1232
|
*
|
|
1174
1233
|
* @param id - The id of the channel you want to remove
|
|
1175
1234
|
*
|
|
1176
1235
|
*/
|
|
1177
|
-
rmChannelById: rmChannelById(
|
|
1236
|
+
rmChannelById: rmChannelById(join14(path5)),
|
|
1178
1237
|
/**
|
|
1179
1238
|
* Moves a given channel id to the version directory
|
|
1180
1239
|
* @param directory
|
|
1181
1240
|
*/
|
|
1182
|
-
versionChannel: versionChannel(
|
|
1241
|
+
versionChannel: versionChannel(join14(path5)),
|
|
1183
1242
|
/**
|
|
1184
1243
|
* Check to see if a channel version exists
|
|
1185
1244
|
* @param id - The id of the channel
|
|
1186
1245
|
* @param version - The version of the channel (supports semver)
|
|
1187
1246
|
* @returns
|
|
1188
1247
|
*/
|
|
1189
|
-
channelHasVersion: channelHasVersion(
|
|
1248
|
+
channelHasVersion: channelHasVersion(join14(path5)),
|
|
1190
1249
|
/**
|
|
1191
1250
|
* Add a channel to an event
|
|
1192
1251
|
*
|
|
@@ -1203,7 +1262,7 @@ var index_default = (path5) => {
|
|
|
1203
1262
|
*
|
|
1204
1263
|
* ```
|
|
1205
1264
|
*/
|
|
1206
|
-
addEventToChannel: addMessageToChannel(
|
|
1265
|
+
addEventToChannel: addMessageToChannel(join14(path5), "events"),
|
|
1207
1266
|
/**
|
|
1208
1267
|
* Add a channel to an command
|
|
1209
1268
|
*
|
|
@@ -1220,7 +1279,7 @@ var index_default = (path5) => {
|
|
|
1220
1279
|
*
|
|
1221
1280
|
* ```
|
|
1222
1281
|
*/
|
|
1223
|
-
addCommandToChannel: addMessageToChannel(
|
|
1282
|
+
addCommandToChannel: addMessageToChannel(join14(path5), "commands"),
|
|
1224
1283
|
/**
|
|
1225
1284
|
* Add a channel to an query
|
|
1226
1285
|
*
|
|
@@ -1237,7 +1296,7 @@ var index_default = (path5) => {
|
|
|
1237
1296
|
*
|
|
1238
1297
|
* ```
|
|
1239
1298
|
*/
|
|
1240
|
-
addQueryToChannel: addMessageToChannel(
|
|
1299
|
+
addQueryToChannel: addMessageToChannel(join14(path5), "queries"),
|
|
1241
1300
|
/**
|
|
1242
1301
|
* ================================
|
|
1243
1302
|
* SERVICES
|
|
@@ -1250,14 +1309,14 @@ var index_default = (path5) => {
|
|
|
1250
1309
|
* @param options - Optional options to write the event
|
|
1251
1310
|
*
|
|
1252
1311
|
*/
|
|
1253
|
-
writeService: writeService(
|
|
1312
|
+
writeService: writeService(join14(path5, "services")),
|
|
1254
1313
|
/**
|
|
1255
1314
|
* Adds a versioned service to EventCatalog
|
|
1256
1315
|
*
|
|
1257
1316
|
* @param service - The service to write
|
|
1258
1317
|
*
|
|
1259
1318
|
*/
|
|
1260
|
-
writeVersionedService: writeVersionedService(
|
|
1319
|
+
writeVersionedService: writeVersionedService(join14(path5, "services")),
|
|
1261
1320
|
/**
|
|
1262
1321
|
* Adds a service to a domain in EventCatalog
|
|
1263
1322
|
*
|
|
@@ -1266,45 +1325,45 @@ var index_default = (path5) => {
|
|
|
1266
1325
|
* @param options - Optional options to write the event
|
|
1267
1326
|
*
|
|
1268
1327
|
*/
|
|
1269
|
-
writeServiceToDomain: writeServiceToDomain(
|
|
1328
|
+
writeServiceToDomain: writeServiceToDomain(join14(path5, "domains")),
|
|
1270
1329
|
/**
|
|
1271
1330
|
* Returns a service from EventCatalog
|
|
1272
1331
|
* @param id - The id of the service to retrieve
|
|
1273
1332
|
* @param version - Optional id of the version to get (supports semver)
|
|
1274
1333
|
* @returns Service|Undefined
|
|
1275
1334
|
*/
|
|
1276
|
-
getService: getService(
|
|
1335
|
+
getService: getService(join14(path5)),
|
|
1277
1336
|
/**
|
|
1278
1337
|
* Returns a service from EventCatalog by it's path.
|
|
1279
1338
|
* @param path - The path to the service to retrieve
|
|
1280
1339
|
* @returns Service|Undefined
|
|
1281
1340
|
*/
|
|
1282
|
-
getServiceByPath: getServiceByPath(
|
|
1341
|
+
getServiceByPath: getServiceByPath(join14(path5)),
|
|
1283
1342
|
/**
|
|
1284
1343
|
* Returns all services from EventCatalog
|
|
1285
1344
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1286
1345
|
* @returns Service[]|Undefined
|
|
1287
1346
|
*/
|
|
1288
|
-
getServices: getServices(
|
|
1347
|
+
getServices: getServices(join14(path5)),
|
|
1289
1348
|
/**
|
|
1290
1349
|
* Moves a given service id to the version directory
|
|
1291
1350
|
* @param directory
|
|
1292
1351
|
*/
|
|
1293
|
-
versionService: versionService(
|
|
1352
|
+
versionService: versionService(join14(path5)),
|
|
1294
1353
|
/**
|
|
1295
1354
|
* Remove a service from EventCatalog (modeled on the standard POSIX rm utility)
|
|
1296
1355
|
*
|
|
1297
1356
|
* @param path - The path to your service, e.g. `/InventoryService`
|
|
1298
1357
|
*
|
|
1299
1358
|
*/
|
|
1300
|
-
rmService: rmService(
|
|
1359
|
+
rmService: rmService(join14(path5, "services")),
|
|
1301
1360
|
/**
|
|
1302
1361
|
* Remove an service by an service id
|
|
1303
1362
|
*
|
|
1304
1363
|
* @param id - The id of the service you want to remove
|
|
1305
1364
|
*
|
|
1306
1365
|
*/
|
|
1307
|
-
rmServiceById: rmServiceById(
|
|
1366
|
+
rmServiceById: rmServiceById(join14(path5)),
|
|
1308
1367
|
/**
|
|
1309
1368
|
* Adds a file to the given service
|
|
1310
1369
|
* @param id - The id of the service to add the file to
|
|
@@ -1312,21 +1371,21 @@ var index_default = (path5) => {
|
|
|
1312
1371
|
* @param version - Optional version of the service to add the file to
|
|
1313
1372
|
* @returns
|
|
1314
1373
|
*/
|
|
1315
|
-
addFileToService: addFileToService(
|
|
1374
|
+
addFileToService: addFileToService(join14(path5)),
|
|
1316
1375
|
/**
|
|
1317
1376
|
* Returns the specifications for a given service
|
|
1318
1377
|
* @param id - The id of the service to retrieve the specifications for
|
|
1319
1378
|
* @param version - Optional version of the service
|
|
1320
1379
|
* @returns
|
|
1321
1380
|
*/
|
|
1322
|
-
getSpecificationFilesForService: getSpecificationFilesForService(
|
|
1381
|
+
getSpecificationFilesForService: getSpecificationFilesForService(join14(path5)),
|
|
1323
1382
|
/**
|
|
1324
1383
|
* Check to see if a service version exists
|
|
1325
1384
|
* @param id - The id of the service
|
|
1326
1385
|
* @param version - The version of the service (supports semver)
|
|
1327
1386
|
* @returns
|
|
1328
1387
|
*/
|
|
1329
|
-
serviceHasVersion: serviceHasVersion(
|
|
1388
|
+
serviceHasVersion: serviceHasVersion(join14(path5)),
|
|
1330
1389
|
/**
|
|
1331
1390
|
* Add an event to a service by it's id.
|
|
1332
1391
|
*
|
|
@@ -1346,7 +1405,7 @@ var index_default = (path5) => {
|
|
|
1346
1405
|
*
|
|
1347
1406
|
* ```
|
|
1348
1407
|
*/
|
|
1349
|
-
addEventToService: addMessageToService(
|
|
1408
|
+
addEventToService: addMessageToService(join14(path5)),
|
|
1350
1409
|
/**
|
|
1351
1410
|
* Add a command to a service by it's id.
|
|
1352
1411
|
*
|
|
@@ -1366,7 +1425,7 @@ var index_default = (path5) => {
|
|
|
1366
1425
|
*
|
|
1367
1426
|
* ```
|
|
1368
1427
|
*/
|
|
1369
|
-
addCommandToService: addMessageToService(
|
|
1428
|
+
addCommandToService: addMessageToService(join14(path5)),
|
|
1370
1429
|
/**
|
|
1371
1430
|
* Add a query to a service by it's id.
|
|
1372
1431
|
*
|
|
@@ -1386,7 +1445,25 @@ var index_default = (path5) => {
|
|
|
1386
1445
|
*
|
|
1387
1446
|
* ```
|
|
1388
1447
|
*/
|
|
1389
|
-
addQueryToService: addMessageToService(
|
|
1448
|
+
addQueryToService: addMessageToService(join14(path5)),
|
|
1449
|
+
/**
|
|
1450
|
+
* Add an entity to a service by its id.
|
|
1451
|
+
*
|
|
1452
|
+
* @example
|
|
1453
|
+
* ```ts
|
|
1454
|
+
* import utils from '@eventcatalog/utils';
|
|
1455
|
+
*
|
|
1456
|
+
* const { addEntityToService } = utils('/path/to/eventcatalog');
|
|
1457
|
+
*
|
|
1458
|
+
* // adds a new entity (User) to the InventoryService
|
|
1459
|
+
* await addEntityToService('InventoryService', { id: 'User', version: '1.0.0' });
|
|
1460
|
+
*
|
|
1461
|
+
* // adds a new entity (Product) to a specific version of the InventoryService
|
|
1462
|
+
* await addEntityToService('InventoryService', { id: 'Product', version: '1.0.0' }, '2.0.0');
|
|
1463
|
+
*
|
|
1464
|
+
* ```
|
|
1465
|
+
*/
|
|
1466
|
+
addEntityToService: addEntityToService(join14(path5)),
|
|
1390
1467
|
/**
|
|
1391
1468
|
* Check to see if a service exists by it's path.
|
|
1392
1469
|
*
|
|
@@ -1403,13 +1480,13 @@ var index_default = (path5) => {
|
|
|
1403
1480
|
* @param path - The path to the service to check
|
|
1404
1481
|
* @returns boolean
|
|
1405
1482
|
*/
|
|
1406
|
-
isService: isService(
|
|
1483
|
+
isService: isService(join14(path5)),
|
|
1407
1484
|
/**
|
|
1408
1485
|
* Converts a file to a service.
|
|
1409
1486
|
* @param file - The file to convert to a service.
|
|
1410
1487
|
* @returns The service.
|
|
1411
1488
|
*/
|
|
1412
|
-
toService: toService(
|
|
1489
|
+
toService: toService(join14(path5)),
|
|
1413
1490
|
/**
|
|
1414
1491
|
* ================================
|
|
1415
1492
|
* Domains
|
|
@@ -1422,39 +1499,39 @@ var index_default = (path5) => {
|
|
|
1422
1499
|
* @param options - Optional options to write the event
|
|
1423
1500
|
*
|
|
1424
1501
|
*/
|
|
1425
|
-
writeDomain: writeDomain(
|
|
1502
|
+
writeDomain: writeDomain(join14(path5, "domains")),
|
|
1426
1503
|
/**
|
|
1427
1504
|
* Returns a domain from EventCatalog
|
|
1428
1505
|
* @param id - The id of the domain to retrieve
|
|
1429
1506
|
* @param version - Optional id of the version to get (supports semver)
|
|
1430
1507
|
* @returns Domain|Undefined
|
|
1431
1508
|
*/
|
|
1432
|
-
getDomain: getDomain(
|
|
1509
|
+
getDomain: getDomain(join14(path5, "domains")),
|
|
1433
1510
|
/**
|
|
1434
1511
|
* Returns all domains from EventCatalog
|
|
1435
1512
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1436
1513
|
* @returns Domain[]|Undefined
|
|
1437
1514
|
*/
|
|
1438
|
-
getDomains: getDomains(
|
|
1515
|
+
getDomains: getDomains(join14(path5)),
|
|
1439
1516
|
/**
|
|
1440
1517
|
* Moves a given domain id to the version directory
|
|
1441
1518
|
* @param directory
|
|
1442
1519
|
*/
|
|
1443
|
-
versionDomain: versionDomain(
|
|
1520
|
+
versionDomain: versionDomain(join14(path5, "domains")),
|
|
1444
1521
|
/**
|
|
1445
1522
|
* Remove a domain from EventCatalog (modeled on the standard POSIX rm utility)
|
|
1446
1523
|
*
|
|
1447
1524
|
* @param path - The path to your domain, e.g. `/Payment`
|
|
1448
1525
|
*
|
|
1449
1526
|
*/
|
|
1450
|
-
rmDomain: rmDomain(
|
|
1527
|
+
rmDomain: rmDomain(join14(path5, "domains")),
|
|
1451
1528
|
/**
|
|
1452
1529
|
* Remove an service by an domain id
|
|
1453
1530
|
*
|
|
1454
1531
|
* @param id - The id of the domain you want to remove
|
|
1455
1532
|
*
|
|
1456
1533
|
*/
|
|
1457
|
-
rmDomainById: rmDomainById(
|
|
1534
|
+
rmDomainById: rmDomainById(join14(path5, "domains")),
|
|
1458
1535
|
/**
|
|
1459
1536
|
* Adds a file to the given domain
|
|
1460
1537
|
* @param id - The id of the domain to add the file to
|
|
@@ -1462,28 +1539,28 @@ var index_default = (path5) => {
|
|
|
1462
1539
|
* @param version - Optional version of the domain to add the file to
|
|
1463
1540
|
* @returns
|
|
1464
1541
|
*/
|
|
1465
|
-
addFileToDomain: addFileToDomain(
|
|
1542
|
+
addFileToDomain: addFileToDomain(join14(path5, "domains")),
|
|
1466
1543
|
/**
|
|
1467
1544
|
* Adds an ubiquitous language dictionary to a domain
|
|
1468
1545
|
* @param id - The id of the domain to add the ubiquitous language to
|
|
1469
1546
|
* @param ubiquitousLanguageDictionary - The ubiquitous language dictionary to add
|
|
1470
1547
|
* @param version - Optional version of the domain to add the ubiquitous language to
|
|
1471
1548
|
*/
|
|
1472
|
-
addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain(
|
|
1549
|
+
addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain(join14(path5, "domains")),
|
|
1473
1550
|
/**
|
|
1474
1551
|
* Get the ubiquitous language dictionary from a domain
|
|
1475
1552
|
* @param id - The id of the domain to get the ubiquitous language from
|
|
1476
1553
|
* @param version - Optional version of the domain to get the ubiquitous language from
|
|
1477
1554
|
* @returns
|
|
1478
1555
|
*/
|
|
1479
|
-
getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain(
|
|
1556
|
+
getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain(join14(path5, "domains")),
|
|
1480
1557
|
/**
|
|
1481
1558
|
* Check to see if a domain version exists
|
|
1482
1559
|
* @param id - The id of the domain
|
|
1483
1560
|
* @param version - The version of the domain (supports semver)
|
|
1484
1561
|
* @returns
|
|
1485
1562
|
*/
|
|
1486
|
-
domainHasVersion: domainHasVersion(
|
|
1563
|
+
domainHasVersion: domainHasVersion(join14(path5)),
|
|
1487
1564
|
/**
|
|
1488
1565
|
* Adds a given service to a domain
|
|
1489
1566
|
* @param id - The id of the domain
|
|
@@ -1491,7 +1568,7 @@ var index_default = (path5) => {
|
|
|
1491
1568
|
* @param version - (Optional) The version of the domain to add the service to
|
|
1492
1569
|
* @returns
|
|
1493
1570
|
*/
|
|
1494
|
-
addServiceToDomain: addServiceToDomain(
|
|
1571
|
+
addServiceToDomain: addServiceToDomain(join14(path5, "domains")),
|
|
1495
1572
|
/**
|
|
1496
1573
|
* Adds a given subdomain to a domain
|
|
1497
1574
|
* @param id - The id of the domain
|
|
@@ -1499,7 +1576,15 @@ var index_default = (path5) => {
|
|
|
1499
1576
|
* @param version - (Optional) The version of the domain to add the subdomain to
|
|
1500
1577
|
* @returns
|
|
1501
1578
|
*/
|
|
1502
|
-
addSubDomainToDomain: addSubDomainToDomain(
|
|
1579
|
+
addSubDomainToDomain: addSubDomainToDomain(join14(path5, "domains")),
|
|
1580
|
+
/**
|
|
1581
|
+
* Adds an entity to a domain
|
|
1582
|
+
* @param id - The id of the domain
|
|
1583
|
+
* @param entity - The id and version of the entity to add
|
|
1584
|
+
* @param version - (Optional) The version of the domain to add the entity to
|
|
1585
|
+
* @returns
|
|
1586
|
+
*/
|
|
1587
|
+
addEntityToDomain: addEntityToDomain(join14(path5, "domains")),
|
|
1503
1588
|
/**
|
|
1504
1589
|
* ================================
|
|
1505
1590
|
* Teams
|
|
@@ -1512,25 +1597,25 @@ var index_default = (path5) => {
|
|
|
1512
1597
|
* @param options - Optional options to write the team
|
|
1513
1598
|
*
|
|
1514
1599
|
*/
|
|
1515
|
-
writeTeam: writeTeam(
|
|
1600
|
+
writeTeam: writeTeam(join14(path5, "teams")),
|
|
1516
1601
|
/**
|
|
1517
1602
|
* Returns a team from EventCatalog
|
|
1518
1603
|
* @param id - The id of the team to retrieve
|
|
1519
1604
|
* @returns Team|Undefined
|
|
1520
1605
|
*/
|
|
1521
|
-
getTeam: getTeam(
|
|
1606
|
+
getTeam: getTeam(join14(path5, "teams")),
|
|
1522
1607
|
/**
|
|
1523
1608
|
* Returns all teams from EventCatalog
|
|
1524
1609
|
* @returns Team[]|Undefined
|
|
1525
1610
|
*/
|
|
1526
|
-
getTeams: getTeams(
|
|
1611
|
+
getTeams: getTeams(join14(path5, "teams")),
|
|
1527
1612
|
/**
|
|
1528
1613
|
* Remove a team by the team id
|
|
1529
1614
|
*
|
|
1530
1615
|
* @param id - The id of the team you want to remove
|
|
1531
1616
|
*
|
|
1532
1617
|
*/
|
|
1533
|
-
rmTeamById: rmTeamById(
|
|
1618
|
+
rmTeamById: rmTeamById(join14(path5, "teams")),
|
|
1534
1619
|
/**
|
|
1535
1620
|
* ================================
|
|
1536
1621
|
* Users
|
|
@@ -1543,25 +1628,25 @@ var index_default = (path5) => {
|
|
|
1543
1628
|
* @param options - Optional options to write the user
|
|
1544
1629
|
*
|
|
1545
1630
|
*/
|
|
1546
|
-
writeUser: writeUser(
|
|
1631
|
+
writeUser: writeUser(join14(path5, "users")),
|
|
1547
1632
|
/**
|
|
1548
1633
|
* Returns a user from EventCatalog
|
|
1549
1634
|
* @param id - The id of the user to retrieve
|
|
1550
1635
|
* @returns User|Undefined
|
|
1551
1636
|
*/
|
|
1552
|
-
getUser: getUser(
|
|
1637
|
+
getUser: getUser(join14(path5, "users")),
|
|
1553
1638
|
/**
|
|
1554
1639
|
* Returns all user from EventCatalog
|
|
1555
1640
|
* @returns User[]|Undefined
|
|
1556
1641
|
*/
|
|
1557
|
-
getUsers: getUsers(
|
|
1642
|
+
getUsers: getUsers(join14(path5)),
|
|
1558
1643
|
/**
|
|
1559
1644
|
* Remove a user by the user id
|
|
1560
1645
|
*
|
|
1561
1646
|
* @param id - The id of the user you want to remove
|
|
1562
1647
|
*
|
|
1563
1648
|
*/
|
|
1564
|
-
rmUserById: rmUserById(
|
|
1649
|
+
rmUserById: rmUserById(join14(path5, "users")),
|
|
1565
1650
|
/**
|
|
1566
1651
|
* ================================
|
|
1567
1652
|
* Custom Docs
|
|
@@ -1572,32 +1657,32 @@ var index_default = (path5) => {
|
|
|
1572
1657
|
* @param path - The path to the custom doc to retrieve
|
|
1573
1658
|
* @returns CustomDoc|Undefined
|
|
1574
1659
|
*/
|
|
1575
|
-
getCustomDoc: getCustomDoc(
|
|
1660
|
+
getCustomDoc: getCustomDoc(join14(path5, "docs")),
|
|
1576
1661
|
/**
|
|
1577
1662
|
* Returns all custom docs from EventCatalog
|
|
1578
1663
|
* @param options - Optional options to get custom docs from a specific path
|
|
1579
1664
|
* @returns CustomDoc[]|Undefined
|
|
1580
1665
|
*/
|
|
1581
|
-
getCustomDocs: getCustomDocs(
|
|
1666
|
+
getCustomDocs: getCustomDocs(join14(path5, "docs")),
|
|
1582
1667
|
/**
|
|
1583
1668
|
* Writes a custom doc to EventCatalog
|
|
1584
1669
|
* @param customDoc - The custom doc to write
|
|
1585
1670
|
* @param options - Optional options to write the custom doc
|
|
1586
1671
|
*
|
|
1587
1672
|
*/
|
|
1588
|
-
writeCustomDoc: writeCustomDoc(
|
|
1673
|
+
writeCustomDoc: writeCustomDoc(join14(path5, "docs")),
|
|
1589
1674
|
/**
|
|
1590
1675
|
* Removes a custom doc from EventCatalog
|
|
1591
1676
|
* @param path - The path to the custom doc to remove
|
|
1592
1677
|
*
|
|
1593
1678
|
*/
|
|
1594
|
-
rmCustomDoc: rmCustomDoc(
|
|
1679
|
+
rmCustomDoc: rmCustomDoc(join14(path5, "docs")),
|
|
1595
1680
|
/**
|
|
1596
1681
|
* Dumps the catalog to a JSON file.
|
|
1597
1682
|
* @param directory - The directory to dump the catalog to
|
|
1598
1683
|
* @returns A JSON file with the catalog
|
|
1599
1684
|
*/
|
|
1600
|
-
dumpCatalog: dumpCatalog(
|
|
1685
|
+
dumpCatalog: dumpCatalog(join14(path5)),
|
|
1601
1686
|
/**
|
|
1602
1687
|
* Returns the event catalog configuration file.
|
|
1603
1688
|
* The event catalog configuration file is the file that contains the configuration for the event catalog.
|
|
@@ -1605,7 +1690,7 @@ var index_default = (path5) => {
|
|
|
1605
1690
|
* @param directory - The directory of the catalog.
|
|
1606
1691
|
* @returns A JSON object with the configuration for the event catalog.
|
|
1607
1692
|
*/
|
|
1608
|
-
getEventCatalogConfigurationFile: getEventCatalogConfigurationFile(
|
|
1693
|
+
getEventCatalogConfigurationFile: getEventCatalogConfigurationFile(join14(path5)),
|
|
1609
1694
|
/**
|
|
1610
1695
|
* ================================
|
|
1611
1696
|
* Resources Utils
|
|
@@ -1626,33 +1711,85 @@ var index_default = (path5) => {
|
|
|
1626
1711
|
* @param path - The path to the message to retrieve
|
|
1627
1712
|
* @returns Message|Undefined
|
|
1628
1713
|
*/
|
|
1629
|
-
getMessageBySchemaPath: getMessageBySchemaPath(
|
|
1714
|
+
getMessageBySchemaPath: getMessageBySchemaPath(join14(path5)),
|
|
1630
1715
|
/**
|
|
1631
1716
|
* Returns the producers and consumers (services) for a given message
|
|
1632
1717
|
* @param id - The id of the message to get the producers and consumers for
|
|
1633
1718
|
* @param version - Optional version of the message
|
|
1634
1719
|
* @returns { producers: Service[], consumers: Service[] }
|
|
1635
1720
|
*/
|
|
1636
|
-
getProducersAndConsumersForMessage: getProducersAndConsumersForMessage(
|
|
1721
|
+
getProducersAndConsumersForMessage: getProducersAndConsumersForMessage(join14(path5)),
|
|
1637
1722
|
/**
|
|
1638
1723
|
* Returns the consumers of a given schema path
|
|
1639
1724
|
* @param path - The path to the schema to get the consumers for
|
|
1640
1725
|
* @returns Service[]
|
|
1641
1726
|
*/
|
|
1642
|
-
getConsumersOfSchema: getConsumersOfSchema(
|
|
1727
|
+
getConsumersOfSchema: getConsumersOfSchema(join14(path5)),
|
|
1643
1728
|
/**
|
|
1644
1729
|
* Returns the producers of a given schema path
|
|
1645
1730
|
* @param path - The path to the schema to get the producers for
|
|
1646
1731
|
* @returns Service[]
|
|
1647
1732
|
*/
|
|
1648
|
-
getProducersOfSchema: getProducersOfSchema(
|
|
1733
|
+
getProducersOfSchema: getProducersOfSchema(join14(path5)),
|
|
1649
1734
|
/**
|
|
1650
1735
|
* Returns the owners for a given resource (e.g domain, service, event, command, query, etc.)
|
|
1651
1736
|
* @param id - The id of the resource to get the owners for
|
|
1652
1737
|
* @param version - Optional version of the resource
|
|
1653
1738
|
* @returns { owners: User[] }
|
|
1654
1739
|
*/
|
|
1655
|
-
getOwnersForResource: getOwnersForResource(
|
|
1740
|
+
getOwnersForResource: getOwnersForResource(join14(path5)),
|
|
1741
|
+
/**
|
|
1742
|
+
* ================================
|
|
1743
|
+
* Entities
|
|
1744
|
+
* ================================
|
|
1745
|
+
*/
|
|
1746
|
+
/**
|
|
1747
|
+
* Returns an entity from EventCatalog
|
|
1748
|
+
* @param id - The id of the entity to retrieve
|
|
1749
|
+
* @param version - Optional id of the version to get (supports semver)
|
|
1750
|
+
* @returns Entity|Undefined
|
|
1751
|
+
*/
|
|
1752
|
+
getEntity: getEntity(join14(path5)),
|
|
1753
|
+
/**
|
|
1754
|
+
* Returns all entities from EventCatalog
|
|
1755
|
+
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1756
|
+
* @returns Entity[]|Undefined
|
|
1757
|
+
*/
|
|
1758
|
+
getEntities: getEntities(join14(path5)),
|
|
1759
|
+
/**
|
|
1760
|
+
* Adds an entity to EventCatalog
|
|
1761
|
+
*
|
|
1762
|
+
* @param entity - The entity to write
|
|
1763
|
+
* @param options - Optional options to write the entity
|
|
1764
|
+
*
|
|
1765
|
+
*/
|
|
1766
|
+
writeEntity: writeEntity(join14(path5, "entities")),
|
|
1767
|
+
/**
|
|
1768
|
+
* Remove an entity from EventCatalog (modeled on the standard POSIX rm utility)
|
|
1769
|
+
*
|
|
1770
|
+
* @param path - The path to your entity, e.g. `/User`
|
|
1771
|
+
*
|
|
1772
|
+
*/
|
|
1773
|
+
rmEntity: rmEntity(join14(path5, "entities")),
|
|
1774
|
+
/**
|
|
1775
|
+
* Remove an entity by an entity id
|
|
1776
|
+
*
|
|
1777
|
+
* @param id - The id of the entity you want to remove
|
|
1778
|
+
*
|
|
1779
|
+
*/
|
|
1780
|
+
rmEntityById: rmEntityById(join14(path5)),
|
|
1781
|
+
/**
|
|
1782
|
+
* Moves a given entity id to the version directory
|
|
1783
|
+
* @param id - The id of the entity to version
|
|
1784
|
+
*/
|
|
1785
|
+
versionEntity: versionEntity(join14(path5)),
|
|
1786
|
+
/**
|
|
1787
|
+
* Check to see if an entity version exists
|
|
1788
|
+
* @param id - The id of the entity
|
|
1789
|
+
* @param version - The version of the entity (supports semver)
|
|
1790
|
+
* @returns
|
|
1791
|
+
*/
|
|
1792
|
+
entityHasVersion: entityHasVersion(join14(path5))
|
|
1656
1793
|
};
|
|
1657
1794
|
};
|
|
1658
1795
|
|
|
@@ -1660,7 +1797,7 @@ var index_default = (path5) => {
|
|
|
1660
1797
|
var DUMP_VERSION = "0.0.1";
|
|
1661
1798
|
var getEventCatalogVersion = async (catalogDir) => {
|
|
1662
1799
|
try {
|
|
1663
|
-
const packageJson =
|
|
1800
|
+
const packageJson = fs11.readFileSync(join15(catalogDir, "package.json"), "utf8");
|
|
1664
1801
|
const packageJsonObject = JSON.parse(packageJson);
|
|
1665
1802
|
return packageJsonObject["dependencies"]["@eventcatalog/core"];
|
|
1666
1803
|
} catch (error) {
|
|
@@ -1674,8 +1811,8 @@ var hydrateResource = async (catalogDir, resources = [], { attachSchema = false
|
|
|
1674
1811
|
let schema = "";
|
|
1675
1812
|
if (resource.schemaPath && resourcePath?.fullPath) {
|
|
1676
1813
|
const pathToSchema = path4.join(path4.dirname(resourcePath?.fullPath), resource.schemaPath);
|
|
1677
|
-
if (
|
|
1678
|
-
schema =
|
|
1814
|
+
if (fs11.existsSync(pathToSchema)) {
|
|
1815
|
+
schema = fs11.readFileSync(pathToSchema, "utf8");
|
|
1679
1816
|
}
|
|
1680
1817
|
}
|
|
1681
1818
|
const eventcatalog = schema ? { directory: resourcePath?.directory, schema } : { directory: resourcePath?.directory };
|
|
@@ -1694,7 +1831,7 @@ var filterCollection = (collection, options) => {
|
|
|
1694
1831
|
};
|
|
1695
1832
|
var getEventCatalogConfigurationFile = (directory) => async () => {
|
|
1696
1833
|
try {
|
|
1697
|
-
const path5 =
|
|
1834
|
+
const path5 = join15(directory, "eventcatalog.config.js");
|
|
1698
1835
|
const configModule = await import(path5);
|
|
1699
1836
|
return configModule.default;
|
|
1700
1837
|
} catch (error) {
|