@eventcatalog/sdk 2.17.3 → 2.18.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/index.d.mts +69 -3
- package/dist/index.d.ts +69 -3
- package/dist/index.js +76 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +76 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -54,12 +54,14 @@ type ResourcePointer = {
|
|
|
54
54
|
type SendsPointer = {
|
|
55
55
|
id: string;
|
|
56
56
|
version?: string;
|
|
57
|
+
fields?: string[];
|
|
57
58
|
to?: ChannelPointer[];
|
|
58
59
|
};
|
|
59
60
|
|
|
60
61
|
type ReceivesPointer = {
|
|
61
62
|
id: string;
|
|
62
63
|
version?: string;
|
|
64
|
+
fields?: string[];
|
|
63
65
|
from?: ChannelPointer[];
|
|
64
66
|
};
|
|
65
67
|
|
|
@@ -103,6 +105,9 @@ interface MessageDetailsPanelProperty {
|
|
|
103
105
|
channels?: DetailPanelProperty;
|
|
104
106
|
versions?: DetailPanelProperty;
|
|
105
107
|
repository?: DetailPanelProperty;
|
|
108
|
+
owners?: DetailPanelProperty;
|
|
109
|
+
changelog?: DetailPanelProperty;
|
|
110
|
+
attachments?: DetailPanelProperty;
|
|
106
111
|
}
|
|
107
112
|
|
|
108
113
|
interface Event extends BaseSchema {
|
|
@@ -473,7 +478,11 @@ declare const _default: (path: string) => {
|
|
|
473
478
|
*
|
|
474
479
|
*/
|
|
475
480
|
writeEvent: (event: Event, options?: {
|
|
476
|
-
path
|
|
481
|
+
path? /**
|
|
482
|
+
* Returns all events from EventCatalog
|
|
483
|
+
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
484
|
+
* @returns Event[]|Undefined
|
|
485
|
+
*/: string;
|
|
477
486
|
override?: boolean;
|
|
478
487
|
versionExistingContent?: boolean;
|
|
479
488
|
format?: "md" | "mdx";
|
|
@@ -490,7 +499,12 @@ declare const _default: (path: string) => {
|
|
|
490
499
|
id: string;
|
|
491
500
|
version?: string;
|
|
492
501
|
}, options?: {
|
|
493
|
-
path
|
|
502
|
+
path? /**
|
|
503
|
+
* Remove an event by an Event id
|
|
504
|
+
*
|
|
505
|
+
* @param id - The id of the event you want to remove
|
|
506
|
+
*
|
|
507
|
+
*/: string;
|
|
494
508
|
format?: "md" | "mdx";
|
|
495
509
|
override?: boolean;
|
|
496
510
|
}) => Promise<void>;
|
|
@@ -546,6 +560,15 @@ declare const _default: (path: string) => {
|
|
|
546
560
|
* @returns
|
|
547
561
|
*/
|
|
548
562
|
eventHasVersion: (id: string, version?: string) => Promise<boolean>;
|
|
563
|
+
addExampleToEvent: (id: string, example: {
|
|
564
|
+
content: string;
|
|
565
|
+
fileName: string;
|
|
566
|
+
}, version?: string) => Promise<void>;
|
|
567
|
+
getExamplesFromEvent: (id: string, version?: string) => Promise<{
|
|
568
|
+
fileName: string;
|
|
569
|
+
content: string;
|
|
570
|
+
}[]>;
|
|
571
|
+
removeExampleFromEvent: (id: string, fileName: string, version?: string) => Promise<void>;
|
|
549
572
|
/**
|
|
550
573
|
* ================================
|
|
551
574
|
* Commands
|
|
@@ -650,6 +673,15 @@ declare const _default: (path: string) => {
|
|
|
650
673
|
* @returns
|
|
651
674
|
*/
|
|
652
675
|
commandHasVersion: (id: string, version?: string) => Promise<boolean>;
|
|
676
|
+
addExampleToCommand: (id: string, example: {
|
|
677
|
+
content: string;
|
|
678
|
+
fileName: string;
|
|
679
|
+
}, version?: string) => Promise<void>;
|
|
680
|
+
getExamplesFromCommand: (id: string, version?: string) => Promise<{
|
|
681
|
+
fileName: string;
|
|
682
|
+
content: string;
|
|
683
|
+
}[]>;
|
|
684
|
+
removeExampleFromCommand: (id: string, fileName: string, version?: string) => Promise<void>;
|
|
653
685
|
/**
|
|
654
686
|
* ================================
|
|
655
687
|
* Queries
|
|
@@ -754,6 +786,15 @@ declare const _default: (path: string) => {
|
|
|
754
786
|
* @returns
|
|
755
787
|
*/
|
|
756
788
|
queryHasVersion: (id: string, version?: string) => Promise<boolean>;
|
|
789
|
+
addExampleToQuery: (id: string, example: {
|
|
790
|
+
content: string;
|
|
791
|
+
fileName: string;
|
|
792
|
+
}, version?: string) => Promise<void>;
|
|
793
|
+
getExamplesFromQuery: (id: string, version?: string) => Promise<{
|
|
794
|
+
fileName: string;
|
|
795
|
+
content: string;
|
|
796
|
+
}[]>;
|
|
797
|
+
removeExampleFromQuery: (id: string, fileName: string, version?: string) => Promise<void>;
|
|
757
798
|
/**
|
|
758
799
|
* ================================
|
|
759
800
|
* Channels
|
|
@@ -1011,6 +1052,12 @@ declare const _default: (path: string) => {
|
|
|
1011
1052
|
addEventToService: (id: string, direction: string, event: {
|
|
1012
1053
|
id: string;
|
|
1013
1054
|
version: string;
|
|
1055
|
+
fields? /**
|
|
1056
|
+
* Remove an channel to EventCatalog (modeled on the standard POSIX rm utility)
|
|
1057
|
+
*
|
|
1058
|
+
* @param path - The path to your channel, e.g. `/Inventory/InventoryAdjusted`
|
|
1059
|
+
*
|
|
1060
|
+
*/: string[];
|
|
1014
1061
|
}, version?: string) => Promise<void>;
|
|
1015
1062
|
/**
|
|
1016
1063
|
* Add a data store to a service by it's id.
|
|
@@ -1054,6 +1101,12 @@ declare const _default: (path: string) => {
|
|
|
1054
1101
|
addCommandToService: (id: string, direction: string, event: {
|
|
1055
1102
|
id: string;
|
|
1056
1103
|
version: string;
|
|
1104
|
+
fields? /**
|
|
1105
|
+
* Remove an channel to EventCatalog (modeled on the standard POSIX rm utility)
|
|
1106
|
+
*
|
|
1107
|
+
* @param path - The path to your channel, e.g. `/Inventory/InventoryAdjusted`
|
|
1108
|
+
*
|
|
1109
|
+
*/: string[];
|
|
1057
1110
|
}, version?: string) => Promise<void>;
|
|
1058
1111
|
/**
|
|
1059
1112
|
* Add a query to a service by it's id.
|
|
@@ -1077,6 +1130,12 @@ declare const _default: (path: string) => {
|
|
|
1077
1130
|
addQueryToService: (id: string, direction: string, event: {
|
|
1078
1131
|
id: string;
|
|
1079
1132
|
version: string;
|
|
1133
|
+
fields? /**
|
|
1134
|
+
* Remove an channel to EventCatalog (modeled on the standard POSIX rm utility)
|
|
1135
|
+
*
|
|
1136
|
+
* @param path - The path to your channel, e.g. `/Inventory/InventoryAdjusted`
|
|
1137
|
+
*
|
|
1138
|
+
*/: string[];
|
|
1080
1139
|
}, version?: string) => Promise<void>;
|
|
1081
1140
|
/**
|
|
1082
1141
|
* Add an entity to a service by its id.
|
|
@@ -1261,6 +1320,7 @@ declare const _default: (path: string) => {
|
|
|
1261
1320
|
addEventToDomain: (id: string, direction: string, message: {
|
|
1262
1321
|
id: string;
|
|
1263
1322
|
version: string;
|
|
1323
|
+
fields?: string[];
|
|
1264
1324
|
}, version?: string) => Promise<void>;
|
|
1265
1325
|
/**
|
|
1266
1326
|
* Add a command to a domain by its id.
|
|
@@ -1282,6 +1342,7 @@ declare const _default: (path: string) => {
|
|
|
1282
1342
|
addCommandToDomain: (id: string, direction: string, message: {
|
|
1283
1343
|
id: string;
|
|
1284
1344
|
version: string;
|
|
1345
|
+
fields?: string[];
|
|
1285
1346
|
}, version?: string) => Promise<void>;
|
|
1286
1347
|
/**
|
|
1287
1348
|
* Add a query to a domain by its id.
|
|
@@ -1303,6 +1364,7 @@ declare const _default: (path: string) => {
|
|
|
1303
1364
|
addQueryToDomain: (id: string, direction: string, message: {
|
|
1304
1365
|
id: string;
|
|
1305
1366
|
version: string;
|
|
1367
|
+
fields?: string[];
|
|
1306
1368
|
}, version?: string) => Promise<void>;
|
|
1307
1369
|
/**
|
|
1308
1370
|
* ================================
|
|
@@ -1678,7 +1740,11 @@ declare const _default: (path: string) => {
|
|
|
1678
1740
|
version?: string;
|
|
1679
1741
|
}, options?: {
|
|
1680
1742
|
path?: string;
|
|
1681
|
-
format
|
|
1743
|
+
format? /**
|
|
1744
|
+
* Returns all commands from EventCatalog
|
|
1745
|
+
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1746
|
+
* @returns Command[]|Undefined
|
|
1747
|
+
*/: "md" | "mdx";
|
|
1682
1748
|
override?: boolean;
|
|
1683
1749
|
}) => Promise<void>;
|
|
1684
1750
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -54,12 +54,14 @@ type ResourcePointer = {
|
|
|
54
54
|
type SendsPointer = {
|
|
55
55
|
id: string;
|
|
56
56
|
version?: string;
|
|
57
|
+
fields?: string[];
|
|
57
58
|
to?: ChannelPointer[];
|
|
58
59
|
};
|
|
59
60
|
|
|
60
61
|
type ReceivesPointer = {
|
|
61
62
|
id: string;
|
|
62
63
|
version?: string;
|
|
64
|
+
fields?: string[];
|
|
63
65
|
from?: ChannelPointer[];
|
|
64
66
|
};
|
|
65
67
|
|
|
@@ -103,6 +105,9 @@ interface MessageDetailsPanelProperty {
|
|
|
103
105
|
channels?: DetailPanelProperty;
|
|
104
106
|
versions?: DetailPanelProperty;
|
|
105
107
|
repository?: DetailPanelProperty;
|
|
108
|
+
owners?: DetailPanelProperty;
|
|
109
|
+
changelog?: DetailPanelProperty;
|
|
110
|
+
attachments?: DetailPanelProperty;
|
|
106
111
|
}
|
|
107
112
|
|
|
108
113
|
interface Event extends BaseSchema {
|
|
@@ -473,7 +478,11 @@ declare const _default: (path: string) => {
|
|
|
473
478
|
*
|
|
474
479
|
*/
|
|
475
480
|
writeEvent: (event: Event, options?: {
|
|
476
|
-
path
|
|
481
|
+
path? /**
|
|
482
|
+
* Returns all events from EventCatalog
|
|
483
|
+
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
484
|
+
* @returns Event[]|Undefined
|
|
485
|
+
*/: string;
|
|
477
486
|
override?: boolean;
|
|
478
487
|
versionExistingContent?: boolean;
|
|
479
488
|
format?: "md" | "mdx";
|
|
@@ -490,7 +499,12 @@ declare const _default: (path: string) => {
|
|
|
490
499
|
id: string;
|
|
491
500
|
version?: string;
|
|
492
501
|
}, options?: {
|
|
493
|
-
path
|
|
502
|
+
path? /**
|
|
503
|
+
* Remove an event by an Event id
|
|
504
|
+
*
|
|
505
|
+
* @param id - The id of the event you want to remove
|
|
506
|
+
*
|
|
507
|
+
*/: string;
|
|
494
508
|
format?: "md" | "mdx";
|
|
495
509
|
override?: boolean;
|
|
496
510
|
}) => Promise<void>;
|
|
@@ -546,6 +560,15 @@ declare const _default: (path: string) => {
|
|
|
546
560
|
* @returns
|
|
547
561
|
*/
|
|
548
562
|
eventHasVersion: (id: string, version?: string) => Promise<boolean>;
|
|
563
|
+
addExampleToEvent: (id: string, example: {
|
|
564
|
+
content: string;
|
|
565
|
+
fileName: string;
|
|
566
|
+
}, version?: string) => Promise<void>;
|
|
567
|
+
getExamplesFromEvent: (id: string, version?: string) => Promise<{
|
|
568
|
+
fileName: string;
|
|
569
|
+
content: string;
|
|
570
|
+
}[]>;
|
|
571
|
+
removeExampleFromEvent: (id: string, fileName: string, version?: string) => Promise<void>;
|
|
549
572
|
/**
|
|
550
573
|
* ================================
|
|
551
574
|
* Commands
|
|
@@ -650,6 +673,15 @@ declare const _default: (path: string) => {
|
|
|
650
673
|
* @returns
|
|
651
674
|
*/
|
|
652
675
|
commandHasVersion: (id: string, version?: string) => Promise<boolean>;
|
|
676
|
+
addExampleToCommand: (id: string, example: {
|
|
677
|
+
content: string;
|
|
678
|
+
fileName: string;
|
|
679
|
+
}, version?: string) => Promise<void>;
|
|
680
|
+
getExamplesFromCommand: (id: string, version?: string) => Promise<{
|
|
681
|
+
fileName: string;
|
|
682
|
+
content: string;
|
|
683
|
+
}[]>;
|
|
684
|
+
removeExampleFromCommand: (id: string, fileName: string, version?: string) => Promise<void>;
|
|
653
685
|
/**
|
|
654
686
|
* ================================
|
|
655
687
|
* Queries
|
|
@@ -754,6 +786,15 @@ declare const _default: (path: string) => {
|
|
|
754
786
|
* @returns
|
|
755
787
|
*/
|
|
756
788
|
queryHasVersion: (id: string, version?: string) => Promise<boolean>;
|
|
789
|
+
addExampleToQuery: (id: string, example: {
|
|
790
|
+
content: string;
|
|
791
|
+
fileName: string;
|
|
792
|
+
}, version?: string) => Promise<void>;
|
|
793
|
+
getExamplesFromQuery: (id: string, version?: string) => Promise<{
|
|
794
|
+
fileName: string;
|
|
795
|
+
content: string;
|
|
796
|
+
}[]>;
|
|
797
|
+
removeExampleFromQuery: (id: string, fileName: string, version?: string) => Promise<void>;
|
|
757
798
|
/**
|
|
758
799
|
* ================================
|
|
759
800
|
* Channels
|
|
@@ -1011,6 +1052,12 @@ declare const _default: (path: string) => {
|
|
|
1011
1052
|
addEventToService: (id: string, direction: string, event: {
|
|
1012
1053
|
id: string;
|
|
1013
1054
|
version: string;
|
|
1055
|
+
fields? /**
|
|
1056
|
+
* Remove an channel to EventCatalog (modeled on the standard POSIX rm utility)
|
|
1057
|
+
*
|
|
1058
|
+
* @param path - The path to your channel, e.g. `/Inventory/InventoryAdjusted`
|
|
1059
|
+
*
|
|
1060
|
+
*/: string[];
|
|
1014
1061
|
}, version?: string) => Promise<void>;
|
|
1015
1062
|
/**
|
|
1016
1063
|
* Add a data store to a service by it's id.
|
|
@@ -1054,6 +1101,12 @@ declare const _default: (path: string) => {
|
|
|
1054
1101
|
addCommandToService: (id: string, direction: string, event: {
|
|
1055
1102
|
id: string;
|
|
1056
1103
|
version: string;
|
|
1104
|
+
fields? /**
|
|
1105
|
+
* Remove an channel to EventCatalog (modeled on the standard POSIX rm utility)
|
|
1106
|
+
*
|
|
1107
|
+
* @param path - The path to your channel, e.g. `/Inventory/InventoryAdjusted`
|
|
1108
|
+
*
|
|
1109
|
+
*/: string[];
|
|
1057
1110
|
}, version?: string) => Promise<void>;
|
|
1058
1111
|
/**
|
|
1059
1112
|
* Add a query to a service by it's id.
|
|
@@ -1077,6 +1130,12 @@ declare const _default: (path: string) => {
|
|
|
1077
1130
|
addQueryToService: (id: string, direction: string, event: {
|
|
1078
1131
|
id: string;
|
|
1079
1132
|
version: string;
|
|
1133
|
+
fields? /**
|
|
1134
|
+
* Remove an channel to EventCatalog (modeled on the standard POSIX rm utility)
|
|
1135
|
+
*
|
|
1136
|
+
* @param path - The path to your channel, e.g. `/Inventory/InventoryAdjusted`
|
|
1137
|
+
*
|
|
1138
|
+
*/: string[];
|
|
1080
1139
|
}, version?: string) => Promise<void>;
|
|
1081
1140
|
/**
|
|
1082
1141
|
* Add an entity to a service by its id.
|
|
@@ -1261,6 +1320,7 @@ declare const _default: (path: string) => {
|
|
|
1261
1320
|
addEventToDomain: (id: string, direction: string, message: {
|
|
1262
1321
|
id: string;
|
|
1263
1322
|
version: string;
|
|
1323
|
+
fields?: string[];
|
|
1264
1324
|
}, version?: string) => Promise<void>;
|
|
1265
1325
|
/**
|
|
1266
1326
|
* Add a command to a domain by its id.
|
|
@@ -1282,6 +1342,7 @@ declare const _default: (path: string) => {
|
|
|
1282
1342
|
addCommandToDomain: (id: string, direction: string, message: {
|
|
1283
1343
|
id: string;
|
|
1284
1344
|
version: string;
|
|
1345
|
+
fields?: string[];
|
|
1285
1346
|
}, version?: string) => Promise<void>;
|
|
1286
1347
|
/**
|
|
1287
1348
|
* Add a query to a domain by its id.
|
|
@@ -1303,6 +1364,7 @@ declare const _default: (path: string) => {
|
|
|
1303
1364
|
addQueryToDomain: (id: string, direction: string, message: {
|
|
1304
1365
|
id: string;
|
|
1305
1366
|
version: string;
|
|
1367
|
+
fields?: string[];
|
|
1306
1368
|
}, version?: string) => Promise<void>;
|
|
1307
1369
|
/**
|
|
1308
1370
|
* ================================
|
|
@@ -1678,7 +1740,11 @@ declare const _default: (path: string) => {
|
|
|
1678
1740
|
version?: string;
|
|
1679
1741
|
}, options?: {
|
|
1680
1742
|
path?: string;
|
|
1681
|
-
format
|
|
1743
|
+
format? /**
|
|
1744
|
+
* Returns all commands from EventCatalog
|
|
1745
|
+
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1746
|
+
* @returns Command[]|Undefined
|
|
1747
|
+
*/: "md" | "mdx";
|
|
1682
1748
|
override?: boolean;
|
|
1683
1749
|
}) => Promise<void>;
|
|
1684
1750
|
/**
|
package/dist/index.js
CHANGED
|
@@ -862,6 +862,11 @@ var copyDir = async (catalogDir, source, target, filter) => {
|
|
|
862
862
|
});
|
|
863
863
|
import_node_fs.default.rmSync(tmpDirectory, { recursive: true });
|
|
864
864
|
};
|
|
865
|
+
var buildMessagePointer = (message) => {
|
|
866
|
+
const pointer = { id: message.id, version: message.version };
|
|
867
|
+
if (message.fields) pointer.fields = message.fields;
|
|
868
|
+
return pointer;
|
|
869
|
+
};
|
|
865
870
|
var uniqueVersions = (messages) => {
|
|
866
871
|
const uniqueSet = /* @__PURE__ */ new Set();
|
|
867
872
|
return messages.filter((message) => {
|
|
@@ -1096,6 +1101,55 @@ var getFileFromResource = async (catalogDir, id, file, version) => {
|
|
|
1096
1101
|
var getVersionedDirectory = (sourceDirectory, version) => {
|
|
1097
1102
|
return (0, import_path.join)(sourceDirectory, "versioned", version);
|
|
1098
1103
|
};
|
|
1104
|
+
var CONFIG_FILES = ["examples.config.yaml", "examples.config.yml", "examples.config.json"];
|
|
1105
|
+
function resolveExamplePath(examplesDir, fileName) {
|
|
1106
|
+
const resolved = import_node_path3.default.resolve(examplesDir, fileName);
|
|
1107
|
+
if (!resolved.startsWith(import_node_path3.default.resolve(examplesDir) + import_node_path3.default.sep) && resolved !== import_node_path3.default.resolve(examplesDir)) {
|
|
1108
|
+
throw new Error(`Invalid example fileName: path traversal detected in "${fileName}"`);
|
|
1109
|
+
}
|
|
1110
|
+
return resolved;
|
|
1111
|
+
}
|
|
1112
|
+
var addExampleToResource = async (catalogDir, id, example, version) => {
|
|
1113
|
+
const pathToResource = await findFileById(catalogDir, id, version);
|
|
1114
|
+
if (!pathToResource) throw new Error("Cannot find directory to write example to");
|
|
1115
|
+
const examplesDir = (0, import_path.join)((0, import_path.dirname)(pathToResource), "examples");
|
|
1116
|
+
const targetPath = resolveExamplePath(examplesDir, example.fileName);
|
|
1117
|
+
import_node_fs2.default.mkdirSync(import_node_path3.default.dirname(targetPath), { recursive: true });
|
|
1118
|
+
import_node_fs2.default.writeFileSync(targetPath, example.content);
|
|
1119
|
+
};
|
|
1120
|
+
var getExamplesFromResource = async (catalogDir, id, version) => {
|
|
1121
|
+
const pathToResource = await findFileById(catalogDir, id, version);
|
|
1122
|
+
if (!pathToResource) throw new Error("Cannot find resource");
|
|
1123
|
+
const examplesDir = (0, import_path.join)((0, import_path.dirname)(pathToResource), "examples");
|
|
1124
|
+
if (!import_node_fs2.default.existsSync(examplesDir)) return [];
|
|
1125
|
+
const collectFiles = (dir, baseDir) => {
|
|
1126
|
+
const results = [];
|
|
1127
|
+
const entries = import_node_fs2.default.readdirSync(dir, { withFileTypes: true });
|
|
1128
|
+
for (const entry of entries) {
|
|
1129
|
+
const fullPath = (0, import_path.join)(dir, entry.name);
|
|
1130
|
+
if (entry.isDirectory()) {
|
|
1131
|
+
results.push(...collectFiles(fullPath, baseDir));
|
|
1132
|
+
} else if (entry.isFile() && !CONFIG_FILES.includes(entry.name)) {
|
|
1133
|
+
results.push({
|
|
1134
|
+
fileName: import_node_path3.default.relative(baseDir, fullPath),
|
|
1135
|
+
content: import_node_fs2.default.readFileSync(fullPath, "utf-8")
|
|
1136
|
+
});
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
return results;
|
|
1140
|
+
};
|
|
1141
|
+
return collectFiles(examplesDir, examplesDir).sort((a, b) => a.fileName.localeCompare(b.fileName));
|
|
1142
|
+
};
|
|
1143
|
+
var removeExampleFromResource = async (catalogDir, id, fileName, version) => {
|
|
1144
|
+
const pathToResource = await findFileById(catalogDir, id, version);
|
|
1145
|
+
if (!pathToResource) throw new Error("Cannot find resource");
|
|
1146
|
+
const examplesDir = (0, import_path.join)((0, import_path.dirname)(pathToResource), "examples");
|
|
1147
|
+
const examplePath = resolveExamplePath(examplesDir, fileName);
|
|
1148
|
+
if (!import_node_fs2.default.existsSync(examplePath)) {
|
|
1149
|
+
throw new Error(`Example file ${fileName} does not exist in resource ${id}${version ? ` v(${version})` : ""}`);
|
|
1150
|
+
}
|
|
1151
|
+
import_node_fs2.default.unlinkSync(examplePath);
|
|
1152
|
+
};
|
|
1099
1153
|
var isLatestVersion = async (catalogDir, id, version) => {
|
|
1100
1154
|
const resource = await getResource(catalogDir, id, version);
|
|
1101
1155
|
if (!resource) return false;
|
|
@@ -1136,6 +1190,9 @@ var eventHasVersion = (directory) => async (id, version) => {
|
|
|
1136
1190
|
const file = await findFileById(directory, id, version);
|
|
1137
1191
|
return !!file;
|
|
1138
1192
|
};
|
|
1193
|
+
var addExampleToEvent = (directory) => async (id, example, version) => addExampleToResource(directory, id, example, version);
|
|
1194
|
+
var getExamplesFromEvent = (directory) => async (id, version) => getExamplesFromResource(directory, id, version);
|
|
1195
|
+
var removeExampleFromEvent = (directory) => async (id, fileName, version) => removeExampleFromResource(directory, id, fileName, version);
|
|
1139
1196
|
|
|
1140
1197
|
// src/commands.ts
|
|
1141
1198
|
var import_promises3 = __toESM(require("fs/promises"));
|
|
@@ -1171,6 +1228,9 @@ var commandHasVersion = (directory) => async (id, version) => {
|
|
|
1171
1228
|
const file = await findFileById(directory, id, version);
|
|
1172
1229
|
return !!file;
|
|
1173
1230
|
};
|
|
1231
|
+
var addExampleToCommand = (directory) => async (id, example, version) => addExampleToResource(directory, id, example, version);
|
|
1232
|
+
var getExamplesFromCommand = (directory) => async (id, version) => getExamplesFromResource(directory, id, version);
|
|
1233
|
+
var removeExampleFromCommand = (directory) => async (id, fileName, version) => removeExampleFromResource(directory, id, fileName, version);
|
|
1174
1234
|
|
|
1175
1235
|
// src/queries.ts
|
|
1176
1236
|
var import_promises4 = __toESM(require("fs/promises"));
|
|
@@ -1208,6 +1268,9 @@ var queryHasVersion = (directory) => async (id, version) => {
|
|
|
1208
1268
|
const file = await findFileById(directory, id, version);
|
|
1209
1269
|
return !!file;
|
|
1210
1270
|
};
|
|
1271
|
+
var addExampleToQuery = (directory) => async (id, example, version) => addExampleToResource(directory, id, example, version);
|
|
1272
|
+
var getExamplesFromQuery = (directory) => async (id, version) => getExamplesFromResource(directory, id, version);
|
|
1273
|
+
var removeExampleFromQuery = (directory) => async (id, fileName, version) => removeExampleFromResource(directory, id, fileName, version);
|
|
1211
1274
|
|
|
1212
1275
|
// src/services.ts
|
|
1213
1276
|
var import_promises5 = __toESM(require("fs/promises"));
|
|
@@ -1306,7 +1369,7 @@ var addMessageToService = (directory) => async (id, direction, event, version) =
|
|
|
1306
1369
|
return;
|
|
1307
1370
|
}
|
|
1308
1371
|
}
|
|
1309
|
-
service.sends.push(
|
|
1372
|
+
service.sends.push(buildMessagePointer(event));
|
|
1310
1373
|
} else if (direction === "receives") {
|
|
1311
1374
|
if (service.receives === void 0) {
|
|
1312
1375
|
service.receives = [];
|
|
@@ -1316,7 +1379,7 @@ var addMessageToService = (directory) => async (id, direction, event, version) =
|
|
|
1316
1379
|
return;
|
|
1317
1380
|
}
|
|
1318
1381
|
}
|
|
1319
|
-
service.receives.push(
|
|
1382
|
+
service.receives.push(buildMessagePointer(event));
|
|
1320
1383
|
} else {
|
|
1321
1384
|
throw new Error(`Direction ${direction} is invalid, only 'receives' and 'sends' are supported`);
|
|
1322
1385
|
}
|
|
@@ -1536,7 +1599,7 @@ var addMessageToDomain = (directory) => async (id, direction, message, version)
|
|
|
1536
1599
|
return;
|
|
1537
1600
|
}
|
|
1538
1601
|
}
|
|
1539
|
-
domain.sends.push(
|
|
1602
|
+
domain.sends.push(buildMessagePointer(message));
|
|
1540
1603
|
} else if (direction === "receives") {
|
|
1541
1604
|
if (domain.receives === void 0) {
|
|
1542
1605
|
domain.receives = [];
|
|
@@ -1546,7 +1609,7 @@ var addMessageToDomain = (directory) => async (id, direction, message, version)
|
|
|
1546
1609
|
return;
|
|
1547
1610
|
}
|
|
1548
1611
|
}
|
|
1549
|
-
domain.receives.push(
|
|
1612
|
+
domain.receives.push(buildMessagePointer(message));
|
|
1550
1613
|
} else {
|
|
1551
1614
|
throw new Error(`Direction ${direction} is invalid, only 'receives' and 'sends' are supported`);
|
|
1552
1615
|
}
|
|
@@ -2592,6 +2655,9 @@ var src_default = (path8) => {
|
|
|
2592
2655
|
* @returns
|
|
2593
2656
|
*/
|
|
2594
2657
|
eventHasVersion: eventHasVersion((0, import_node_path22.join)(path8)),
|
|
2658
|
+
addExampleToEvent: addExampleToEvent((0, import_node_path22.join)(path8)),
|
|
2659
|
+
getExamplesFromEvent: getExamplesFromEvent((0, import_node_path22.join)(path8)),
|
|
2660
|
+
removeExampleFromEvent: removeExampleFromEvent((0, import_node_path22.join)(path8)),
|
|
2595
2661
|
/**
|
|
2596
2662
|
* ================================
|
|
2597
2663
|
* Commands
|
|
@@ -2669,6 +2735,9 @@ var src_default = (path8) => {
|
|
|
2669
2735
|
* @returns
|
|
2670
2736
|
*/
|
|
2671
2737
|
commandHasVersion: commandHasVersion((0, import_node_path22.join)(path8)),
|
|
2738
|
+
addExampleToCommand: addExampleToCommand((0, import_node_path22.join)(path8)),
|
|
2739
|
+
getExamplesFromCommand: getExamplesFromCommand((0, import_node_path22.join)(path8)),
|
|
2740
|
+
removeExampleFromCommand: removeExampleFromCommand((0, import_node_path22.join)(path8)),
|
|
2672
2741
|
/**
|
|
2673
2742
|
* ================================
|
|
2674
2743
|
* Queries
|
|
@@ -2746,6 +2815,9 @@ var src_default = (path8) => {
|
|
|
2746
2815
|
* @returns
|
|
2747
2816
|
*/
|
|
2748
2817
|
queryHasVersion: queryHasVersion((0, import_node_path22.join)(path8)),
|
|
2818
|
+
addExampleToQuery: addExampleToQuery((0, import_node_path22.join)(path8)),
|
|
2819
|
+
getExamplesFromQuery: getExamplesFromQuery((0, import_node_path22.join)(path8)),
|
|
2820
|
+
removeExampleFromQuery: removeExampleFromQuery((0, import_node_path22.join)(path8)),
|
|
2749
2821
|
/**
|
|
2750
2822
|
* ================================
|
|
2751
2823
|
* Channels
|