@eventcatalog/sdk 2.2.9 → 2.2.10
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/channels.js +12 -1
- package/dist/channels.js.map +1 -1
- package/dist/channels.mjs +13 -2
- package/dist/channels.mjs.map +1 -1
- package/dist/domains.js +12 -1
- package/dist/domains.js.map +1 -1
- package/dist/domains.mjs +12 -1
- package/dist/domains.mjs.map +1 -1
- package/dist/eventcatalog.js +9 -3
- package/dist/eventcatalog.js.map +1 -1
- package/dist/eventcatalog.mjs +11 -5
- package/dist/eventcatalog.mjs.map +1 -1
- package/dist/index.d.mts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -5
- package/dist/index.mjs.map +1 -1
- package/dist/services.js +12 -1
- package/dist/services.js.map +1 -1
- package/dist/services.mjs +13 -2
- package/dist/services.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -348,7 +348,7 @@ var queryHasVersion = (directory) => async (id, version) => {
|
|
|
348
348
|
|
|
349
349
|
// src/services.ts
|
|
350
350
|
import fs5 from "node:fs/promises";
|
|
351
|
-
import { join as join6, dirname as dirname4 } from "node:path";
|
|
351
|
+
import { join as join6, dirname as dirname4, extname } from "node:path";
|
|
352
352
|
var getService = (directory) => async (id, version) => getResource(directory, id, version, { type: "service" });
|
|
353
353
|
var getServices = (directory) => async (options) => getResources(directory, {
|
|
354
354
|
type: "services",
|
|
@@ -407,6 +407,8 @@ var getSpecificationFilesForService = (directory) => async (id, version) => {
|
|
|
407
407
|
};
|
|
408
408
|
var addMessageToService = (directory) => async (id, direction, event, version) => {
|
|
409
409
|
let service = await getService(directory)(id, version);
|
|
410
|
+
const servicePath = await getResourcePath(directory, id, version);
|
|
411
|
+
const extension = extname(servicePath?.fullPath || "");
|
|
410
412
|
if (direction === "sends") {
|
|
411
413
|
if (service.sends === void 0) {
|
|
412
414
|
service.sends = [];
|
|
@@ -437,7 +439,7 @@ var addMessageToService = (directory) => async (id, direction, event, version) =
|
|
|
437
439
|
const path4 = existingResource.split("/services")[0];
|
|
438
440
|
const pathToResource = join6(path4, "services");
|
|
439
441
|
await rmServiceById(directory)(id, version);
|
|
440
|
-
await writeService(pathToResource)(service);
|
|
442
|
+
await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
|
|
441
443
|
};
|
|
442
444
|
var serviceHasVersion = (directory) => async (id, version) => {
|
|
443
445
|
const file = await findFileById(directory, id, version);
|
|
@@ -495,6 +497,8 @@ var domainHasVersion = (directory) => async (id, version) => {
|
|
|
495
497
|
};
|
|
496
498
|
var addServiceToDomain = (directory) => async (id, service, version) => {
|
|
497
499
|
let domain = await getDomain(directory)(id, version);
|
|
500
|
+
const domainPath = await getResourcePath(directory, id, version);
|
|
501
|
+
const extension = path.extname(domainPath?.fullPath || "");
|
|
498
502
|
if (domain.services === void 0) {
|
|
499
503
|
domain.services = [];
|
|
500
504
|
}
|
|
@@ -504,12 +508,12 @@ var addServiceToDomain = (directory) => async (id, service, version) => {
|
|
|
504
508
|
}
|
|
505
509
|
domain.services.push(service);
|
|
506
510
|
await rmDomainById(directory)(id, version, true);
|
|
507
|
-
await writeDomain(directory)(domain);
|
|
511
|
+
await writeDomain(directory)(domain, { format: extension === ".md" ? "md" : "mdx" });
|
|
508
512
|
};
|
|
509
513
|
|
|
510
514
|
// src/channels.ts
|
|
511
515
|
import fs7 from "node:fs/promises";
|
|
512
|
-
import { join as join8 } from "node:path";
|
|
516
|
+
import { join as join8, extname as extname2 } from "node:path";
|
|
513
517
|
var getChannel = (directory) => async (id, version) => getResource(directory, id, version, { type: "channel" });
|
|
514
518
|
var getChannels = (directory) => async (options) => getResources(directory, { type: "channels", ...options });
|
|
515
519
|
var writeChannel = (directory) => async (channel, options = { path: "" }) => writeResource(directory, { ...channel }, { ...options, type: "channel" });
|
|
@@ -543,6 +547,8 @@ var addMessageToChannel = (directory, collection) => async (id, _message, versio
|
|
|
543
547
|
};
|
|
544
548
|
const { getMessage, rmMessageById, writeMessage } = functions[collection];
|
|
545
549
|
const message = await getMessage(directory)(_message.id, _message.version);
|
|
550
|
+
const messagePath = await getResourcePath(directory, _message.id, _message.version);
|
|
551
|
+
const extension = extname2(messagePath?.fullPath || "");
|
|
546
552
|
if (!message) throw new Error(`Message ${_message.id} with version ${_message.version} not found`);
|
|
547
553
|
if (message.channels === void 0) {
|
|
548
554
|
message.channels = [];
|
|
@@ -556,7 +562,7 @@ var addMessageToChannel = (directory, collection) => async (id, _message, versio
|
|
|
556
562
|
const path4 = existingResource.split(`/${collection}`)[0];
|
|
557
563
|
const pathToResource = join8(path4, collection);
|
|
558
564
|
await rmMessageById(directory)(_message.id, _message.version, true);
|
|
559
|
-
await writeMessage(pathToResource)(message);
|
|
565
|
+
await writeMessage(pathToResource)(message, { format: extension === ".md" ? "md" : "mdx" });
|
|
560
566
|
};
|
|
561
567
|
|
|
562
568
|
// src/eventcatalog.ts
|