@eventcatalog/sdk 2.6.3 → 2.6.5
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 +4 -4
- package/dist/channels.js.map +1 -1
- package/dist/channels.mjs +4 -4
- package/dist/channels.mjs.map +1 -1
- package/dist/commands.js +3 -3
- package/dist/commands.js.map +1 -1
- package/dist/commands.mjs +3 -3
- package/dist/commands.mjs.map +1 -1
- package/dist/custom-docs.js.map +1 -1
- package/dist/custom-docs.mjs.map +1 -1
- package/dist/domains.js +3 -3
- package/dist/domains.js.map +1 -1
- package/dist/domains.mjs +3 -3
- package/dist/domains.mjs.map +1 -1
- package/dist/eventcatalog.js +210 -149
- package/dist/eventcatalog.js.map +1 -1
- package/dist/eventcatalog.mjs +209 -148
- package/dist/eventcatalog.mjs.map +1 -1
- package/dist/events.js +3 -3
- package/dist/events.js.map +1 -1
- package/dist/events.mjs +3 -3
- package/dist/events.mjs.map +1 -1
- package/dist/index.d.mts +33 -28
- package/dist/index.d.ts +33 -28
- package/dist/index.js +210 -149
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +209 -148
- package/dist/index.mjs.map +1 -1
- package/dist/messages.js +3 -3
- package/dist/messages.js.map +1 -1
- package/dist/messages.mjs +4 -4
- package/dist/messages.mjs.map +1 -1
- package/dist/queries.js +3 -3
- package/dist/queries.js.map +1 -1
- package/dist/queries.mjs +3 -3
- package/dist/queries.mjs.map +1 -1
- package/dist/services.d.mts +29 -1
- package/dist/services.d.ts +29 -1
- package/dist/services.js +18 -4
- package/dist/services.js.map +1 -1
- package/dist/services.mjs +17 -5
- package/dist/services.mjs.map +1 -1
- package/dist/teams.d.mts +8 -1
- package/dist/teams.d.ts +8 -1
- package/dist/teams.js +122 -11
- package/dist/teams.js.map +1 -1
- package/dist/teams.mjs +121 -11
- package/dist/teams.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -33,7 +33,7 @@ __export(index_exports, {
|
|
|
33
33
|
default: () => index_default
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(index_exports);
|
|
36
|
-
var
|
|
36
|
+
var import_node_path14 = require("path");
|
|
37
37
|
|
|
38
38
|
// src/events.ts
|
|
39
39
|
var import_promises2 = __toESM(require("fs/promises"));
|
|
@@ -54,13 +54,13 @@ var versionExists = async (catalogDir, id, version) => {
|
|
|
54
54
|
var findFileById = async (catalogDir, id, version) => {
|
|
55
55
|
const files = await getFiles(`${catalogDir}/**/index.{md,mdx}`);
|
|
56
56
|
const matchedFiles = await searchFilesForId(files, id) || [];
|
|
57
|
-
const latestVersion = matchedFiles.find((
|
|
57
|
+
const latestVersion = matchedFiles.find((path5) => !path5.includes("versioned"));
|
|
58
58
|
if (!version) {
|
|
59
59
|
return latestVersion;
|
|
60
60
|
}
|
|
61
|
-
const parsedFiles = matchedFiles.map((
|
|
62
|
-
const { data } = import_gray_matter.default.read(
|
|
63
|
-
return { ...data, path:
|
|
61
|
+
const parsedFiles = matchedFiles.map((path5) => {
|
|
62
|
+
const { data } = import_gray_matter.default.read(path5);
|
|
63
|
+
return { ...data, path: path5 };
|
|
64
64
|
});
|
|
65
65
|
const semverRange = (0, import_semver.validRange)(version);
|
|
66
66
|
if (semverRange && (0, import_semver.valid)(version)) {
|
|
@@ -101,8 +101,8 @@ var getFiles = async (pattern, ignore = "") => {
|
|
|
101
101
|
);
|
|
102
102
|
}
|
|
103
103
|
};
|
|
104
|
-
var readMdxFile = async (
|
|
105
|
-
const { data } = import_gray_matter.default.read(
|
|
104
|
+
var readMdxFile = async (path5) => {
|
|
105
|
+
const { data } = import_gray_matter.default.read(path5);
|
|
106
106
|
const { markdown, ...frontmatter } = data;
|
|
107
107
|
return { ...frontmatter, markdown };
|
|
108
108
|
};
|
|
@@ -185,8 +185,8 @@ var writeResource = async (catalogDir, resource, options = {
|
|
|
185
185
|
versionExistingContent: false,
|
|
186
186
|
format: "mdx"
|
|
187
187
|
}) => {
|
|
188
|
-
const
|
|
189
|
-
const fullPath = (0, import_path.join)(catalogDir,
|
|
188
|
+
const path5 = options.path || `/${resource.id}`;
|
|
189
|
+
const fullPath = (0, import_path.join)(catalogDir, path5);
|
|
190
190
|
const format = options.format || "mdx";
|
|
191
191
|
import_node_fs2.default.mkdirSync(fullPath, { recursive: true });
|
|
192
192
|
const lockPath = (0, import_path.join)(fullPath, `index.${format}`);
|
|
@@ -221,10 +221,10 @@ var writeResource = async (catalogDir, resource, options = {
|
|
|
221
221
|
});
|
|
222
222
|
}
|
|
223
223
|
};
|
|
224
|
-
var getResource = async (catalogDir, id, version, options) => {
|
|
224
|
+
var getResource = async (catalogDir, id, version, options, filePath) => {
|
|
225
225
|
const attachSchema = options?.attachSchema || false;
|
|
226
|
-
const file = await findFileById(catalogDir, id, version);
|
|
227
|
-
if (!file) return;
|
|
226
|
+
const file = filePath || (id ? await findFileById(catalogDir, id, version) : void 0);
|
|
227
|
+
if (!file || !import_node_fs2.default.existsSync(file)) return;
|
|
228
228
|
const { data, content } = import_gray_matter2.default.read(file);
|
|
229
229
|
if (attachSchema && data?.schemaPath) {
|
|
230
230
|
const resourceDirectory = (0, import_path.dirname)(file);
|
|
@@ -349,8 +349,8 @@ var writeEventToService = (directory) => async (event, service, options = { path
|
|
|
349
349
|
pathForEvent = (0, import_node_path2.join)(pathForEvent, event.id);
|
|
350
350
|
await writeResource(directory, { ...event }, { ...options, path: pathForEvent, type: "event" });
|
|
351
351
|
};
|
|
352
|
-
var rmEvent = (directory) => async (
|
|
353
|
-
await import_promises2.default.rm((0, import_node_path2.join)(directory,
|
|
352
|
+
var rmEvent = (directory) => async (path5) => {
|
|
353
|
+
await import_promises2.default.rm((0, import_node_path2.join)(directory, path5), { recursive: true });
|
|
354
354
|
};
|
|
355
355
|
var rmEventById = (directory) => async (id, version, persistFiles) => {
|
|
356
356
|
await rmResourceById(directory, id, version, { type: "event", persistFiles });
|
|
@@ -385,8 +385,8 @@ var writeCommandToService = (directory) => async (command, service, options = {
|
|
|
385
385
|
pathForCommand = (0, import_node_path3.join)(pathForCommand, command.id);
|
|
386
386
|
await writeResource(directory, { ...command }, { ...options, path: pathForCommand, type: "command" });
|
|
387
387
|
};
|
|
388
|
-
var rmCommand = (directory) => async (
|
|
389
|
-
await import_promises3.default.rm((0, import_node_path3.join)(directory,
|
|
388
|
+
var rmCommand = (directory) => async (path5) => {
|
|
389
|
+
await import_promises3.default.rm((0, import_node_path3.join)(directory, path5), { recursive: true });
|
|
390
390
|
};
|
|
391
391
|
var rmCommandById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "command", persistFiles });
|
|
392
392
|
var versionCommand = (directory) => async (id) => versionResource(directory, id);
|
|
@@ -419,8 +419,8 @@ var writeQueryToService = (directory) => async (query, service, options = { path
|
|
|
419
419
|
pathForQuery = (0, import_node_path4.join)(pathForQuery, query.id);
|
|
420
420
|
await writeResource(directory, { ...query }, { ...options, path: pathForQuery, type: "query" });
|
|
421
421
|
};
|
|
422
|
-
var rmQuery = (directory) => async (
|
|
423
|
-
await import_promises4.default.rm((0, import_node_path4.join)(directory,
|
|
422
|
+
var rmQuery = (directory) => async (path5) => {
|
|
423
|
+
await import_promises4.default.rm((0, import_node_path4.join)(directory, path5), { recursive: true });
|
|
424
424
|
};
|
|
425
425
|
var rmQueryById = (directory) => async (id, version, persistFiles) => {
|
|
426
426
|
await rmResourceById(directory, id, version, { type: "query", persistFiles });
|
|
@@ -439,6 +439,10 @@ var queryHasVersion = (directory) => async (id, version) => {
|
|
|
439
439
|
var import_promises5 = __toESM(require("fs/promises"));
|
|
440
440
|
var import_node_path5 = require("path");
|
|
441
441
|
var getService = (directory) => async (id, version) => getResource(directory, id, version, { type: "service" });
|
|
442
|
+
var getServiceByPath = (directory) => async (path5) => {
|
|
443
|
+
const service = await getResource(directory, void 0, void 0, { type: "service" }, path5);
|
|
444
|
+
return service;
|
|
445
|
+
};
|
|
442
446
|
var getServices = (directory) => async (options) => getResources(directory, {
|
|
443
447
|
type: "services",
|
|
444
448
|
ignore: ["**/events/**", "**/commands/**", "**/queries/**", "**/entities/**", "**/subdomains/**/entities/**"],
|
|
@@ -460,8 +464,8 @@ var writeService = (directory) => async (service, options = {
|
|
|
460
464
|
};
|
|
461
465
|
var writeVersionedService = (directory) => async (service) => {
|
|
462
466
|
const resource = { ...service };
|
|
463
|
-
const
|
|
464
|
-
return await writeService(directory)(resource, { path:
|
|
467
|
+
const path5 = getVersionedDirectory(service.id, service.version);
|
|
468
|
+
return await writeService(directory)(resource, { path: path5 });
|
|
465
469
|
};
|
|
466
470
|
var writeServiceToDomain = (directory) => async (service, domain, options = { path: "", format: "mdx", override: false }) => {
|
|
467
471
|
let pathForService = domain.version && domain.version !== "latest" ? `/${domain.id}/versioned/${domain.version}/services` : `/${domain.id}/services`;
|
|
@@ -469,8 +473,8 @@ var writeServiceToDomain = (directory) => async (service, domain, options = { pa
|
|
|
469
473
|
await writeResource(directory, { ...service }, { ...options, path: pathForService, type: "service" });
|
|
470
474
|
};
|
|
471
475
|
var versionService = (directory) => async (id) => versionResource(directory, id);
|
|
472
|
-
var rmService = (directory) => async (
|
|
473
|
-
await import_promises5.default.rm((0, import_node_path5.join)(directory,
|
|
476
|
+
var rmService = (directory) => async (path5) => {
|
|
477
|
+
await import_promises5.default.rm((0, import_node_path5.join)(directory, path5), { recursive: true });
|
|
474
478
|
};
|
|
475
479
|
var rmServiceById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "service", persistFiles });
|
|
476
480
|
var addFileToService = (directory) => async (id, file, version) => addFileToResource(directory, id, file, version);
|
|
@@ -525,8 +529,8 @@ var addMessageToService = (directory) => async (id, direction, event, version) =
|
|
|
525
529
|
if (!existingResource) {
|
|
526
530
|
throw new Error(`Cannot find service ${id} in the catalog`);
|
|
527
531
|
}
|
|
528
|
-
const
|
|
529
|
-
const pathToResource = (0, import_node_path5.join)(
|
|
532
|
+
const path5 = existingResource.split(/[\\/]+services/)[0];
|
|
533
|
+
const pathToResource = (0, import_node_path5.join)(path5, "services");
|
|
530
534
|
await rmServiceById(directory)(id, version);
|
|
531
535
|
await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
|
|
532
536
|
};
|
|
@@ -534,6 +538,12 @@ var serviceHasVersion = (directory) => async (id, version) => {
|
|
|
534
538
|
const file = await findFileById(directory, id, version);
|
|
535
539
|
return !!file;
|
|
536
540
|
};
|
|
541
|
+
var isService = (directory) => async (path5) => {
|
|
542
|
+
const service = await getServiceByPath(directory)(path5);
|
|
543
|
+
const relativePath = (0, import_node_path5.relative)(directory, path5);
|
|
544
|
+
const segments = relativePath.split(/[/\\]+/);
|
|
545
|
+
return !!service && segments.includes("services");
|
|
546
|
+
};
|
|
537
547
|
|
|
538
548
|
// src/domains.ts
|
|
539
549
|
var import_promises6 = __toESM(require("fs/promises"));
|
|
@@ -562,8 +572,8 @@ var writeDomain = (directory) => async (domain, options = {
|
|
|
562
572
|
return await writeResource(directory, resource, { ...options, type: "domain" });
|
|
563
573
|
};
|
|
564
574
|
var versionDomain = (directory) => async (id) => versionResource(directory, id);
|
|
565
|
-
var rmDomain = (directory) => async (
|
|
566
|
-
await import_promises6.default.rm((0, import_node_path6.join)(directory,
|
|
575
|
+
var rmDomain = (directory) => async (path5) => {
|
|
576
|
+
await import_promises6.default.rm((0, import_node_path6.join)(directory, path5), { recursive: true });
|
|
567
577
|
};
|
|
568
578
|
var rmDomainById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "domain", persistFiles });
|
|
569
579
|
var addFileToDomain = (directory) => async (id, file, version) => addFileToResource(directory, id, file, version);
|
|
@@ -624,8 +634,8 @@ var import_node_path7 = require("path");
|
|
|
624
634
|
var getChannel = (directory) => async (id, version) => getResource(directory, id, version, { type: "channel" });
|
|
625
635
|
var getChannels = (directory) => async (options) => getResources(directory, { type: "channels", ...options });
|
|
626
636
|
var writeChannel = (directory) => async (channel, options = { path: "" }) => writeResource(directory, { ...channel }, { ...options, type: "channel" });
|
|
627
|
-
var rmChannel = (directory) => async (
|
|
628
|
-
await import_promises7.default.rm((0, import_node_path7.join)(directory,
|
|
637
|
+
var rmChannel = (directory) => async (path5) => {
|
|
638
|
+
await import_promises7.default.rm((0, import_node_path7.join)(directory, path5), { recursive: true });
|
|
629
639
|
};
|
|
630
640
|
var rmChannelById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "channel", persistFiles });
|
|
631
641
|
var versionChannel = (directory) => async (id) => versionResource(directory, id);
|
|
@@ -666,8 +676,8 @@ var addMessageToChannel = (directory, collection) => async (id, _message, versio
|
|
|
666
676
|
if (!existingResource) {
|
|
667
677
|
throw new Error(`Cannot find message ${id} in the catalog`);
|
|
668
678
|
}
|
|
669
|
-
const
|
|
670
|
-
const pathToResource = (0, import_node_path7.join)(
|
|
679
|
+
const path5 = existingResource.split(`/[\\/]+${collection}`)[0];
|
|
680
|
+
const pathToResource = (0, import_node_path7.join)(path5, collection);
|
|
671
681
|
await rmMessageById(directory)(_message.id, _message.version, true);
|
|
672
682
|
await writeMessage(pathToResource)(message, { format: extension === ".md" ? "md" : "mdx" });
|
|
673
683
|
};
|
|
@@ -676,8 +686,8 @@ var addMessageToChannel = (directory, collection) => async (id, _message, versio
|
|
|
676
686
|
var import_node_path8 = require("path");
|
|
677
687
|
var import_gray_matter4 = __toESM(require("gray-matter"));
|
|
678
688
|
var import_semver3 = require("semver");
|
|
679
|
-
var getMessageBySchemaPath = (directory) => async (
|
|
680
|
-
const pathToMessage = (0, import_node_path8.dirname)(
|
|
689
|
+
var getMessageBySchemaPath = (directory) => async (path5, options) => {
|
|
690
|
+
const pathToMessage = (0, import_node_path8.dirname)(path5);
|
|
681
691
|
try {
|
|
682
692
|
const files = await getFiles(`${directory}/${pathToMessage}/index.{md,mdx}`);
|
|
683
693
|
if (!files || files.length === 0) {
|
|
@@ -695,7 +705,7 @@ var getMessageBySchemaPath = (directory) => async (path4, options) => {
|
|
|
695
705
|
}
|
|
696
706
|
return message;
|
|
697
707
|
} catch (error) {
|
|
698
|
-
console.error(`Failed to get message for schema path ${
|
|
708
|
+
console.error(`Failed to get message for schema path ${path5}. Error processing directory ${pathToMessage}:`, error);
|
|
699
709
|
if (error instanceof Error) {
|
|
700
710
|
error.message = `Failed to retrieve message from ${pathToMessage}: ${error.message}`;
|
|
701
711
|
throw error;
|
|
@@ -789,10 +799,16 @@ var rmCustomDoc = (directory) => async (filePath) => {
|
|
|
789
799
|
|
|
790
800
|
// src/teams.ts
|
|
791
801
|
var import_promises9 = __toESM(require("fs/promises"));
|
|
802
|
+
var import_node_fs6 = __toESM(require("fs"));
|
|
803
|
+
var import_node_path11 = require("path");
|
|
804
|
+
var import_gray_matter7 = __toESM(require("gray-matter"));
|
|
805
|
+
var import_node_path12 = __toESM(require("path"));
|
|
806
|
+
|
|
807
|
+
// src/users.ts
|
|
792
808
|
var import_node_fs5 = __toESM(require("fs"));
|
|
793
809
|
var import_node_path10 = require("path");
|
|
794
810
|
var import_gray_matter6 = __toESM(require("gray-matter"));
|
|
795
|
-
var
|
|
811
|
+
var getUser = (catalogDir) => async (id) => {
|
|
796
812
|
const files = await getFiles(`${catalogDir}/${id}.{md,mdx}`);
|
|
797
813
|
if (files.length == 0) return void 0;
|
|
798
814
|
const file = files[0];
|
|
@@ -801,11 +817,12 @@ var getTeam = (catalogDir) => async (id) => {
|
|
|
801
817
|
...data,
|
|
802
818
|
id: data.id,
|
|
803
819
|
name: data.name,
|
|
820
|
+
avatarUrl: data.avatarUrl,
|
|
804
821
|
markdown: content.trim()
|
|
805
822
|
};
|
|
806
823
|
};
|
|
807
|
-
var
|
|
808
|
-
const files = await getFiles(`${catalogDir}/
|
|
824
|
+
var getUsers = (catalogDir) => async (options) => {
|
|
825
|
+
const files = await getFiles(`${catalogDir}/users/*.{md,mdx}`);
|
|
809
826
|
if (files.length === 0) return [];
|
|
810
827
|
return files.map((file) => {
|
|
811
828
|
const { data, content } = import_gray_matter6.default.read(file);
|
|
@@ -813,31 +830,29 @@ var getTeams = (catalogDir) => async (options) => {
|
|
|
813
830
|
...data,
|
|
814
831
|
id: data.id,
|
|
815
832
|
name: data.name,
|
|
833
|
+
avatarUrl: data.avatarUrl,
|
|
816
834
|
markdown: content.trim()
|
|
817
835
|
};
|
|
818
836
|
});
|
|
819
837
|
};
|
|
820
|
-
var
|
|
821
|
-
const resource = { ...
|
|
822
|
-
const
|
|
823
|
-
const exists =
|
|
838
|
+
var writeUser = (catalogDir) => async (user, options = {}) => {
|
|
839
|
+
const resource = { ...user };
|
|
840
|
+
const currentUser = await getUser(catalogDir)(resource.id);
|
|
841
|
+
const exists = currentUser !== void 0;
|
|
824
842
|
if (exists && !options.override) {
|
|
825
|
-
throw new Error(`Failed to write ${resource.id} (
|
|
843
|
+
throw new Error(`Failed to write ${resource.id} (user) as it already exists`);
|
|
826
844
|
}
|
|
827
845
|
const { markdown, ...frontmatter } = resource;
|
|
828
846
|
const document = import_gray_matter6.default.stringify(markdown, frontmatter);
|
|
829
847
|
import_node_fs5.default.mkdirSync((0, import_node_path10.join)(catalogDir, ""), { recursive: true });
|
|
830
848
|
import_node_fs5.default.writeFileSync((0, import_node_path10.join)(catalogDir, "", `${resource.id}.mdx`), document);
|
|
831
849
|
};
|
|
832
|
-
var
|
|
833
|
-
|
|
850
|
+
var rmUserById = (catalogDir) => async (id) => {
|
|
851
|
+
import_node_fs5.default.rmSync((0, import_node_path10.join)(catalogDir, `${id}.mdx`), { recursive: true });
|
|
834
852
|
};
|
|
835
853
|
|
|
836
|
-
// src/
|
|
837
|
-
var
|
|
838
|
-
var import_node_path11 = require("path");
|
|
839
|
-
var import_gray_matter7 = __toESM(require("gray-matter"));
|
|
840
|
-
var getUser = (catalogDir) => async (id) => {
|
|
854
|
+
// src/teams.ts
|
|
855
|
+
var getTeam = (catalogDir) => async (id) => {
|
|
841
856
|
const files = await getFiles(`${catalogDir}/${id}.{md,mdx}`);
|
|
842
857
|
if (files.length == 0) return void 0;
|
|
843
858
|
const file = files[0];
|
|
@@ -846,12 +861,11 @@ var getUser = (catalogDir) => async (id) => {
|
|
|
846
861
|
...data,
|
|
847
862
|
id: data.id,
|
|
848
863
|
name: data.name,
|
|
849
|
-
avatarUrl: data.avatarUrl,
|
|
850
864
|
markdown: content.trim()
|
|
851
865
|
};
|
|
852
866
|
};
|
|
853
|
-
var
|
|
854
|
-
const files = await getFiles(`${catalogDir}
|
|
867
|
+
var getTeams = (catalogDir) => async (options) => {
|
|
868
|
+
const files = await getFiles(`${catalogDir}/*.{md,mdx}`);
|
|
855
869
|
if (files.length === 0) return [];
|
|
856
870
|
return files.map((file) => {
|
|
857
871
|
const { data, content } = import_gray_matter7.default.read(file);
|
|
@@ -859,34 +873,51 @@ var getUsers = (catalogDir) => async (options) => {
|
|
|
859
873
|
...data,
|
|
860
874
|
id: data.id,
|
|
861
875
|
name: data.name,
|
|
862
|
-
avatarUrl: data.avatarUrl,
|
|
863
876
|
markdown: content.trim()
|
|
864
877
|
};
|
|
865
878
|
});
|
|
866
879
|
};
|
|
867
|
-
var
|
|
868
|
-
const resource = { ...
|
|
869
|
-
const
|
|
870
|
-
const exists =
|
|
880
|
+
var writeTeam = (catalogDir) => async (team, options = {}) => {
|
|
881
|
+
const resource = { ...team };
|
|
882
|
+
const currentTeam = await getTeam(catalogDir)(resource.id);
|
|
883
|
+
const exists = currentTeam !== void 0;
|
|
871
884
|
if (exists && !options.override) {
|
|
872
|
-
throw new Error(`Failed to write ${resource.id} (
|
|
885
|
+
throw new Error(`Failed to write ${resource.id} (team) as it already exists`);
|
|
873
886
|
}
|
|
874
887
|
const { markdown, ...frontmatter } = resource;
|
|
875
888
|
const document = import_gray_matter7.default.stringify(markdown, frontmatter);
|
|
876
889
|
import_node_fs6.default.mkdirSync((0, import_node_path11.join)(catalogDir, ""), { recursive: true });
|
|
877
890
|
import_node_fs6.default.writeFileSync((0, import_node_path11.join)(catalogDir, "", `${resource.id}.mdx`), document);
|
|
878
891
|
};
|
|
879
|
-
var
|
|
880
|
-
|
|
892
|
+
var rmTeamById = (catalogDir) => async (id) => {
|
|
893
|
+
await import_promises9.default.rm((0, import_node_path11.join)(catalogDir, `${id}.mdx`), { recursive: true });
|
|
894
|
+
};
|
|
895
|
+
var getOwnersForResource = (catalogDir) => async (id, version) => {
|
|
896
|
+
const resource = await getResource(catalogDir, id, version);
|
|
897
|
+
let owners = [];
|
|
898
|
+
if (!resource) return [];
|
|
899
|
+
if (!resource.owners) return [];
|
|
900
|
+
for (const owner of resource.owners) {
|
|
901
|
+
const team = await getTeam(import_node_path12.default.join(catalogDir, "teams"))(owner);
|
|
902
|
+
if (team) {
|
|
903
|
+
owners.push(team);
|
|
904
|
+
} else {
|
|
905
|
+
const user = await getUser(import_node_path12.default.join(catalogDir, "users"))(owner);
|
|
906
|
+
if (user) {
|
|
907
|
+
owners.push(user);
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
return owners;
|
|
881
912
|
};
|
|
882
913
|
|
|
883
914
|
// src/eventcatalog.ts
|
|
884
915
|
var import_fs = __toESM(require("fs"));
|
|
885
|
-
var
|
|
916
|
+
var import_node_path13 = __toESM(require("path"));
|
|
886
917
|
var DUMP_VERSION = "0.0.1";
|
|
887
918
|
var getEventCatalogVersion = async (catalogDir) => {
|
|
888
919
|
try {
|
|
889
|
-
const packageJson = import_fs.default.readFileSync((0,
|
|
920
|
+
const packageJson = import_fs.default.readFileSync((0, import_node_path13.join)(catalogDir, "package.json"), "utf8");
|
|
890
921
|
const packageJsonObject = JSON.parse(packageJson);
|
|
891
922
|
return packageJsonObject["dependencies"]["@eventcatalog/core"];
|
|
892
923
|
} catch (error) {
|
|
@@ -899,7 +930,7 @@ var hydrateResource = async (catalogDir, resources = [], { attachSchema = false
|
|
|
899
930
|
const resourcePath = await getResourcePath(catalogDir, resource.id, resource.version);
|
|
900
931
|
let schema = "";
|
|
901
932
|
if (resource.schemaPath && resourcePath?.fullPath) {
|
|
902
|
-
const pathToSchema =
|
|
933
|
+
const pathToSchema = import_node_path13.default.join(import_node_path13.default.dirname(resourcePath?.fullPath), resource.schemaPath);
|
|
903
934
|
if (import_fs.default.existsSync(pathToSchema)) {
|
|
904
935
|
schema = import_fs.default.readFileSync(pathToSchema, "utf8");
|
|
905
936
|
}
|
|
@@ -920,8 +951,8 @@ var filterCollection = (collection, options) => {
|
|
|
920
951
|
};
|
|
921
952
|
var getEventCatalogConfigurationFile = (directory) => async () => {
|
|
922
953
|
try {
|
|
923
|
-
const
|
|
924
|
-
const configModule = await import(
|
|
954
|
+
const path5 = (0, import_node_path13.join)(directory, "eventcatalog.config.js");
|
|
955
|
+
const configModule = await import(path5);
|
|
925
956
|
return configModule.default;
|
|
926
957
|
} catch (error) {
|
|
927
958
|
console.error("Error getting event catalog configuration file", error);
|
|
@@ -929,7 +960,7 @@ var getEventCatalogConfigurationFile = (directory) => async () => {
|
|
|
929
960
|
}
|
|
930
961
|
};
|
|
931
962
|
var dumpCatalog = (directory) => async (options) => {
|
|
932
|
-
const { getDomains: getDomains2, getServices: getServices2, getEvents: getEvents2, getQueries: getQueries2, getCommands: getCommands2, getChannels: getChannels2, getTeams: getTeams2, getUsers:
|
|
963
|
+
const { getDomains: getDomains2, getServices: getServices2, getEvents: getEvents2, getQueries: getQueries2, getCommands: getCommands2, getChannels: getChannels2, getTeams: getTeams2, getUsers: getUsers3 } = index_default(directory);
|
|
933
964
|
const { includeMarkdown = true } = options || {};
|
|
934
965
|
const domains = await getDomains2();
|
|
935
966
|
const services = await getServices2();
|
|
@@ -937,7 +968,7 @@ var dumpCatalog = (directory) => async (options) => {
|
|
|
937
968
|
const commands = await getCommands2();
|
|
938
969
|
const queries = await getQueries2();
|
|
939
970
|
const teams = await getTeams2();
|
|
940
|
-
const users = await
|
|
971
|
+
const users = await getUsers3();
|
|
941
972
|
const channels = await getChannels2();
|
|
942
973
|
const [
|
|
943
974
|
hydratedDomains,
|
|
@@ -978,7 +1009,7 @@ var dumpCatalog = (directory) => async (options) => {
|
|
|
978
1009
|
};
|
|
979
1010
|
|
|
980
1011
|
// src/index.ts
|
|
981
|
-
var index_default = (
|
|
1012
|
+
var index_default = (path5) => {
|
|
982
1013
|
return {
|
|
983
1014
|
/**
|
|
984
1015
|
* Returns an events from EventCatalog
|
|
@@ -986,13 +1017,13 @@ var index_default = (path4) => {
|
|
|
986
1017
|
* @param version - Optional id of the version to get (supports semver)
|
|
987
1018
|
* @returns Event|Undefined
|
|
988
1019
|
*/
|
|
989
|
-
getEvent: getEvent((0,
|
|
1020
|
+
getEvent: getEvent((0, import_node_path14.join)(path5)),
|
|
990
1021
|
/**
|
|
991
1022
|
* Returns all events from EventCatalog
|
|
992
1023
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
993
1024
|
* @returns Event[]|Undefined
|
|
994
1025
|
*/
|
|
995
|
-
getEvents: getEvents((0,
|
|
1026
|
+
getEvents: getEvents((0, import_node_path14.join)(path5)),
|
|
996
1027
|
/**
|
|
997
1028
|
* Adds an event to EventCatalog
|
|
998
1029
|
*
|
|
@@ -1000,7 +1031,7 @@ var index_default = (path4) => {
|
|
|
1000
1031
|
* @param options - Optional options to write the event
|
|
1001
1032
|
*
|
|
1002
1033
|
*/
|
|
1003
|
-
writeEvent: writeEvent((0,
|
|
1034
|
+
writeEvent: writeEvent((0, import_node_path14.join)(path5, "events")),
|
|
1004
1035
|
/**
|
|
1005
1036
|
* Adds an event to a service in EventCatalog
|
|
1006
1037
|
*
|
|
@@ -1009,26 +1040,26 @@ var index_default = (path4) => {
|
|
|
1009
1040
|
* @param options - Optional options to write the event
|
|
1010
1041
|
*
|
|
1011
1042
|
*/
|
|
1012
|
-
writeEventToService: writeEventToService((0,
|
|
1043
|
+
writeEventToService: writeEventToService((0, import_node_path14.join)(path5)),
|
|
1013
1044
|
/**
|
|
1014
1045
|
* Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
|
|
1015
1046
|
*
|
|
1016
1047
|
* @param path - The path to your event, e.g. `/Inventory/InventoryAdjusted`
|
|
1017
1048
|
*
|
|
1018
1049
|
*/
|
|
1019
|
-
rmEvent: rmEvent((0,
|
|
1050
|
+
rmEvent: rmEvent((0, import_node_path14.join)(path5, "events")),
|
|
1020
1051
|
/**
|
|
1021
1052
|
* Remove an event by an Event id
|
|
1022
1053
|
*
|
|
1023
1054
|
* @param id - The id of the event you want to remove
|
|
1024
1055
|
*
|
|
1025
1056
|
*/
|
|
1026
|
-
rmEventById: rmEventById((0,
|
|
1057
|
+
rmEventById: rmEventById((0, import_node_path14.join)(path5)),
|
|
1027
1058
|
/**
|
|
1028
1059
|
* Moves a given event id to the version directory
|
|
1029
1060
|
* @param directory
|
|
1030
1061
|
*/
|
|
1031
|
-
versionEvent: versionEvent((0,
|
|
1062
|
+
versionEvent: versionEvent((0, import_node_path14.join)(path5)),
|
|
1032
1063
|
/**
|
|
1033
1064
|
* Adds a file to the given event
|
|
1034
1065
|
* @param id - The id of the event to add the file to
|
|
@@ -1036,7 +1067,7 @@ var index_default = (path4) => {
|
|
|
1036
1067
|
* @param version - Optional version of the event to add the file to
|
|
1037
1068
|
* @returns
|
|
1038
1069
|
*/
|
|
1039
|
-
addFileToEvent: addFileToEvent((0,
|
|
1070
|
+
addFileToEvent: addFileToEvent((0, import_node_path14.join)(path5)),
|
|
1040
1071
|
/**
|
|
1041
1072
|
* Adds a schema to the given event
|
|
1042
1073
|
* @param id - The id of the event to add the schema to
|
|
@@ -1044,14 +1075,14 @@ var index_default = (path4) => {
|
|
|
1044
1075
|
* @param version - Optional version of the event to add the schema to
|
|
1045
1076
|
* @returns
|
|
1046
1077
|
*/
|
|
1047
|
-
addSchemaToEvent: addSchemaToEvent((0,
|
|
1078
|
+
addSchemaToEvent: addSchemaToEvent((0, import_node_path14.join)(path5)),
|
|
1048
1079
|
/**
|
|
1049
1080
|
* Check to see if an event version exists
|
|
1050
1081
|
* @param id - The id of the event
|
|
1051
1082
|
* @param version - The version of the event (supports semver)
|
|
1052
1083
|
* @returns
|
|
1053
1084
|
*/
|
|
1054
|
-
eventHasVersion: eventHasVersion((0,
|
|
1085
|
+
eventHasVersion: eventHasVersion((0, import_node_path14.join)(path5)),
|
|
1055
1086
|
/**
|
|
1056
1087
|
* ================================
|
|
1057
1088
|
* Commands
|
|
@@ -1063,13 +1094,13 @@ var index_default = (path4) => {
|
|
|
1063
1094
|
* @param version - Optional id of the version to get (supports semver)
|
|
1064
1095
|
* @returns Command|Undefined
|
|
1065
1096
|
*/
|
|
1066
|
-
getCommand: getCommand((0,
|
|
1097
|
+
getCommand: getCommand((0, import_node_path14.join)(path5)),
|
|
1067
1098
|
/**
|
|
1068
1099
|
* Returns all commands from EventCatalog
|
|
1069
1100
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1070
1101
|
* @returns Command[]|Undefined
|
|
1071
1102
|
*/
|
|
1072
|
-
getCommands: getCommands((0,
|
|
1103
|
+
getCommands: getCommands((0, import_node_path14.join)(path5)),
|
|
1073
1104
|
/**
|
|
1074
1105
|
* Adds an command to EventCatalog
|
|
1075
1106
|
*
|
|
@@ -1077,7 +1108,7 @@ var index_default = (path4) => {
|
|
|
1077
1108
|
* @param options - Optional options to write the command
|
|
1078
1109
|
*
|
|
1079
1110
|
*/
|
|
1080
|
-
writeCommand: writeCommand((0,
|
|
1111
|
+
writeCommand: writeCommand((0, import_node_path14.join)(path5, "commands")),
|
|
1081
1112
|
/**
|
|
1082
1113
|
* Adds a command to a service in EventCatalog
|
|
1083
1114
|
*
|
|
@@ -1086,26 +1117,26 @@ var index_default = (path4) => {
|
|
|
1086
1117
|
* @param options - Optional options to write the command
|
|
1087
1118
|
*
|
|
1088
1119
|
*/
|
|
1089
|
-
writeCommandToService: writeCommandToService((0,
|
|
1120
|
+
writeCommandToService: writeCommandToService((0, import_node_path14.join)(path5)),
|
|
1090
1121
|
/**
|
|
1091
1122
|
* Remove an command to EventCatalog (modeled on the standard POSIX rm utility)
|
|
1092
1123
|
*
|
|
1093
1124
|
* @param path - The path to your command, e.g. `/Inventory/InventoryAdjusted`
|
|
1094
1125
|
*
|
|
1095
1126
|
*/
|
|
1096
|
-
rmCommand: rmCommand((0,
|
|
1127
|
+
rmCommand: rmCommand((0, import_node_path14.join)(path5, "commands")),
|
|
1097
1128
|
/**
|
|
1098
1129
|
* Remove an command by an Event id
|
|
1099
1130
|
*
|
|
1100
1131
|
* @param id - The id of the command you want to remove
|
|
1101
1132
|
*
|
|
1102
1133
|
*/
|
|
1103
|
-
rmCommandById: rmCommandById((0,
|
|
1134
|
+
rmCommandById: rmCommandById((0, import_node_path14.join)(path5)),
|
|
1104
1135
|
/**
|
|
1105
1136
|
* Moves a given command id to the version directory
|
|
1106
1137
|
* @param directory
|
|
1107
1138
|
*/
|
|
1108
|
-
versionCommand: versionCommand((0,
|
|
1139
|
+
versionCommand: versionCommand((0, import_node_path14.join)(path5)),
|
|
1109
1140
|
/**
|
|
1110
1141
|
* Adds a file to the given command
|
|
1111
1142
|
* @param id - The id of the command to add the file to
|
|
@@ -1113,7 +1144,7 @@ var index_default = (path4) => {
|
|
|
1113
1144
|
* @param version - Optional version of the command to add the file to
|
|
1114
1145
|
* @returns
|
|
1115
1146
|
*/
|
|
1116
|
-
addFileToCommand: addFileToCommand((0,
|
|
1147
|
+
addFileToCommand: addFileToCommand((0, import_node_path14.join)(path5)),
|
|
1117
1148
|
/**
|
|
1118
1149
|
* Adds a schema to the given command
|
|
1119
1150
|
* @param id - The id of the command to add the schema to
|
|
@@ -1121,14 +1152,14 @@ var index_default = (path4) => {
|
|
|
1121
1152
|
* @param version - Optional version of the command to add the schema to
|
|
1122
1153
|
* @returns
|
|
1123
1154
|
*/
|
|
1124
|
-
addSchemaToCommand: addSchemaToCommand((0,
|
|
1155
|
+
addSchemaToCommand: addSchemaToCommand((0, import_node_path14.join)(path5)),
|
|
1125
1156
|
/**
|
|
1126
1157
|
* Check to see if a command version exists
|
|
1127
1158
|
* @param id - The id of the command
|
|
1128
1159
|
* @param version - The version of the command (supports semver)
|
|
1129
1160
|
* @returns
|
|
1130
1161
|
*/
|
|
1131
|
-
commandHasVersion: commandHasVersion((0,
|
|
1162
|
+
commandHasVersion: commandHasVersion((0, import_node_path14.join)(path5)),
|
|
1132
1163
|
/**
|
|
1133
1164
|
* ================================
|
|
1134
1165
|
* Queries
|
|
@@ -1140,13 +1171,13 @@ var index_default = (path4) => {
|
|
|
1140
1171
|
* @param version - Optional id of the version to get (supports semver)
|
|
1141
1172
|
* @returns Query|Undefined
|
|
1142
1173
|
*/
|
|
1143
|
-
getQuery: getQuery((0,
|
|
1174
|
+
getQuery: getQuery((0, import_node_path14.join)(path5)),
|
|
1144
1175
|
/**
|
|
1145
1176
|
* Returns all queries from EventCatalog
|
|
1146
1177
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1147
1178
|
* @returns Query[]|Undefined
|
|
1148
1179
|
*/
|
|
1149
|
-
getQueries: getQueries((0,
|
|
1180
|
+
getQueries: getQueries((0, import_node_path14.join)(path5)),
|
|
1150
1181
|
/**
|
|
1151
1182
|
* Adds a query to EventCatalog
|
|
1152
1183
|
*
|
|
@@ -1154,7 +1185,7 @@ var index_default = (path4) => {
|
|
|
1154
1185
|
* @param options - Optional options to write the event
|
|
1155
1186
|
*
|
|
1156
1187
|
*/
|
|
1157
|
-
writeQuery: writeQuery((0,
|
|
1188
|
+
writeQuery: writeQuery((0, import_node_path14.join)(path5, "queries")),
|
|
1158
1189
|
/**
|
|
1159
1190
|
* Adds a query to a service in EventCatalog
|
|
1160
1191
|
*
|
|
@@ -1163,26 +1194,26 @@ var index_default = (path4) => {
|
|
|
1163
1194
|
* @param options - Optional options to write the query
|
|
1164
1195
|
*
|
|
1165
1196
|
*/
|
|
1166
|
-
writeQueryToService: writeQueryToService((0,
|
|
1197
|
+
writeQueryToService: writeQueryToService((0, import_node_path14.join)(path5)),
|
|
1167
1198
|
/**
|
|
1168
1199
|
* Remove an query to EventCatalog (modeled on the standard POSIX rm utility)
|
|
1169
1200
|
*
|
|
1170
1201
|
* @param path - The path to your query, e.g. `/Orders/GetOrder`
|
|
1171
1202
|
*
|
|
1172
1203
|
*/
|
|
1173
|
-
rmQuery: rmQuery((0,
|
|
1204
|
+
rmQuery: rmQuery((0, import_node_path14.join)(path5, "queries")),
|
|
1174
1205
|
/**
|
|
1175
1206
|
* Remove a query by a Query id
|
|
1176
1207
|
*
|
|
1177
1208
|
* @param id - The id of the query you want to remove
|
|
1178
1209
|
*
|
|
1179
1210
|
*/
|
|
1180
|
-
rmQueryById: rmQueryById((0,
|
|
1211
|
+
rmQueryById: rmQueryById((0, import_node_path14.join)(path5)),
|
|
1181
1212
|
/**
|
|
1182
1213
|
* Moves a given query id to the version directory
|
|
1183
1214
|
* @param directory
|
|
1184
1215
|
*/
|
|
1185
|
-
versionQuery: versionQuery((0,
|
|
1216
|
+
versionQuery: versionQuery((0, import_node_path14.join)(path5)),
|
|
1186
1217
|
/**
|
|
1187
1218
|
* Adds a file to the given query
|
|
1188
1219
|
* @param id - The id of the query to add the file to
|
|
@@ -1190,7 +1221,7 @@ var index_default = (path4) => {
|
|
|
1190
1221
|
* @param version - Optional version of the query to add the file to
|
|
1191
1222
|
* @returns
|
|
1192
1223
|
*/
|
|
1193
|
-
addFileToQuery: addFileToQuery((0,
|
|
1224
|
+
addFileToQuery: addFileToQuery((0, import_node_path14.join)(path5)),
|
|
1194
1225
|
/**
|
|
1195
1226
|
* Adds a schema to the given query
|
|
1196
1227
|
* @param id - The id of the query to add the schema to
|
|
@@ -1198,14 +1229,14 @@ var index_default = (path4) => {
|
|
|
1198
1229
|
* @param version - Optional version of the query to add the schema to
|
|
1199
1230
|
* @returns
|
|
1200
1231
|
*/
|
|
1201
|
-
addSchemaToQuery: addSchemaToQuery((0,
|
|
1232
|
+
addSchemaToQuery: addSchemaToQuery((0, import_node_path14.join)(path5)),
|
|
1202
1233
|
/**
|
|
1203
1234
|
* Check to see if an query version exists
|
|
1204
1235
|
* @param id - The id of the query
|
|
1205
1236
|
* @param version - The version of the query (supports semver)
|
|
1206
1237
|
* @returns
|
|
1207
1238
|
*/
|
|
1208
|
-
queryHasVersion: queryHasVersion((0,
|
|
1239
|
+
queryHasVersion: queryHasVersion((0, import_node_path14.join)(path5)),
|
|
1209
1240
|
/**
|
|
1210
1241
|
* ================================
|
|
1211
1242
|
* Channels
|
|
@@ -1217,13 +1248,13 @@ var index_default = (path4) => {
|
|
|
1217
1248
|
* @param version - Optional id of the version to get (supports semver)
|
|
1218
1249
|
* @returns Channel|Undefined
|
|
1219
1250
|
*/
|
|
1220
|
-
getChannel: getChannel((0,
|
|
1251
|
+
getChannel: getChannel((0, import_node_path14.join)(path5)),
|
|
1221
1252
|
/**
|
|
1222
1253
|
* Returns all channels from EventCatalog
|
|
1223
1254
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1224
1255
|
* @returns Channel[]|Undefined
|
|
1225
1256
|
*/
|
|
1226
|
-
getChannels: getChannels((0,
|
|
1257
|
+
getChannels: getChannels((0, import_node_path14.join)(path5)),
|
|
1227
1258
|
/**
|
|
1228
1259
|
* Adds an channel to EventCatalog
|
|
1229
1260
|
*
|
|
@@ -1231,33 +1262,33 @@ var index_default = (path4) => {
|
|
|
1231
1262
|
* @param options - Optional options to write the channel
|
|
1232
1263
|
*
|
|
1233
1264
|
*/
|
|
1234
|
-
writeChannel: writeChannel((0,
|
|
1265
|
+
writeChannel: writeChannel((0, import_node_path14.join)(path5, "channels")),
|
|
1235
1266
|
/**
|
|
1236
1267
|
* Remove an channel to EventCatalog (modeled on the standard POSIX rm utility)
|
|
1237
1268
|
*
|
|
1238
1269
|
* @param path - The path to your channel, e.g. `/Inventory/InventoryAdjusted`
|
|
1239
1270
|
*
|
|
1240
1271
|
*/
|
|
1241
|
-
rmChannel: rmChannel((0,
|
|
1272
|
+
rmChannel: rmChannel((0, import_node_path14.join)(path5, "channels")),
|
|
1242
1273
|
/**
|
|
1243
1274
|
* Remove an channel by an Event id
|
|
1244
1275
|
*
|
|
1245
1276
|
* @param id - The id of the channel you want to remove
|
|
1246
1277
|
*
|
|
1247
1278
|
*/
|
|
1248
|
-
rmChannelById: rmChannelById((0,
|
|
1279
|
+
rmChannelById: rmChannelById((0, import_node_path14.join)(path5)),
|
|
1249
1280
|
/**
|
|
1250
1281
|
* Moves a given channel id to the version directory
|
|
1251
1282
|
* @param directory
|
|
1252
1283
|
*/
|
|
1253
|
-
versionChannel: versionChannel((0,
|
|
1284
|
+
versionChannel: versionChannel((0, import_node_path14.join)(path5)),
|
|
1254
1285
|
/**
|
|
1255
1286
|
* Check to see if a channel version exists
|
|
1256
1287
|
* @param id - The id of the channel
|
|
1257
1288
|
* @param version - The version of the channel (supports semver)
|
|
1258
1289
|
* @returns
|
|
1259
1290
|
*/
|
|
1260
|
-
channelHasVersion: channelHasVersion((0,
|
|
1291
|
+
channelHasVersion: channelHasVersion((0, import_node_path14.join)(path5)),
|
|
1261
1292
|
/**
|
|
1262
1293
|
* Add a channel to an event
|
|
1263
1294
|
*
|
|
@@ -1274,7 +1305,7 @@ var index_default = (path4) => {
|
|
|
1274
1305
|
*
|
|
1275
1306
|
* ```
|
|
1276
1307
|
*/
|
|
1277
|
-
addEventToChannel: addMessageToChannel((0,
|
|
1308
|
+
addEventToChannel: addMessageToChannel((0, import_node_path14.join)(path5), "events"),
|
|
1278
1309
|
/**
|
|
1279
1310
|
* Add a channel to an command
|
|
1280
1311
|
*
|
|
@@ -1291,7 +1322,7 @@ var index_default = (path4) => {
|
|
|
1291
1322
|
*
|
|
1292
1323
|
* ```
|
|
1293
1324
|
*/
|
|
1294
|
-
addCommandToChannel: addMessageToChannel((0,
|
|
1325
|
+
addCommandToChannel: addMessageToChannel((0, import_node_path14.join)(path5), "commands"),
|
|
1295
1326
|
/**
|
|
1296
1327
|
* Add a channel to an query
|
|
1297
1328
|
*
|
|
@@ -1308,7 +1339,7 @@ var index_default = (path4) => {
|
|
|
1308
1339
|
*
|
|
1309
1340
|
* ```
|
|
1310
1341
|
*/
|
|
1311
|
-
addQueryToChannel: addMessageToChannel((0,
|
|
1342
|
+
addQueryToChannel: addMessageToChannel((0, import_node_path14.join)(path5), "queries"),
|
|
1312
1343
|
/**
|
|
1313
1344
|
* ================================
|
|
1314
1345
|
* SERVICES
|
|
@@ -1321,14 +1352,14 @@ var index_default = (path4) => {
|
|
|
1321
1352
|
* @param options - Optional options to write the event
|
|
1322
1353
|
*
|
|
1323
1354
|
*/
|
|
1324
|
-
writeService: writeService((0,
|
|
1355
|
+
writeService: writeService((0, import_node_path14.join)(path5, "services")),
|
|
1325
1356
|
/**
|
|
1326
1357
|
* Adds a versioned service to EventCatalog
|
|
1327
1358
|
*
|
|
1328
1359
|
* @param service - The service to write
|
|
1329
1360
|
*
|
|
1330
1361
|
*/
|
|
1331
|
-
writeVersionedService: writeVersionedService((0,
|
|
1362
|
+
writeVersionedService: writeVersionedService((0, import_node_path14.join)(path5, "services")),
|
|
1332
1363
|
/**
|
|
1333
1364
|
* Adds a service to a domain in EventCatalog
|
|
1334
1365
|
*
|
|
@@ -1337,39 +1368,45 @@ var index_default = (path4) => {
|
|
|
1337
1368
|
* @param options - Optional options to write the event
|
|
1338
1369
|
*
|
|
1339
1370
|
*/
|
|
1340
|
-
writeServiceToDomain: writeServiceToDomain((0,
|
|
1371
|
+
writeServiceToDomain: writeServiceToDomain((0, import_node_path14.join)(path5, "domains")),
|
|
1341
1372
|
/**
|
|
1342
1373
|
* Returns a service from EventCatalog
|
|
1343
1374
|
* @param id - The id of the service to retrieve
|
|
1344
1375
|
* @param version - Optional id of the version to get (supports semver)
|
|
1345
1376
|
* @returns Service|Undefined
|
|
1346
1377
|
*/
|
|
1347
|
-
getService: getService((0,
|
|
1378
|
+
getService: getService((0, import_node_path14.join)(path5)),
|
|
1379
|
+
/**
|
|
1380
|
+
* Returns a service from EventCatalog by it's path.
|
|
1381
|
+
* @param path - The path to the service to retrieve
|
|
1382
|
+
* @returns Service|Undefined
|
|
1383
|
+
*/
|
|
1384
|
+
getServiceByPath: getServiceByPath((0, import_node_path14.join)(path5)),
|
|
1348
1385
|
/**
|
|
1349
1386
|
* Returns all services from EventCatalog
|
|
1350
1387
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1351
1388
|
* @returns Service[]|Undefined
|
|
1352
1389
|
*/
|
|
1353
|
-
getServices: getServices((0,
|
|
1390
|
+
getServices: getServices((0, import_node_path14.join)(path5)),
|
|
1354
1391
|
/**
|
|
1355
1392
|
* Moves a given service id to the version directory
|
|
1356
1393
|
* @param directory
|
|
1357
1394
|
*/
|
|
1358
|
-
versionService: versionService((0,
|
|
1395
|
+
versionService: versionService((0, import_node_path14.join)(path5)),
|
|
1359
1396
|
/**
|
|
1360
1397
|
* Remove a service from EventCatalog (modeled on the standard POSIX rm utility)
|
|
1361
1398
|
*
|
|
1362
1399
|
* @param path - The path to your service, e.g. `/InventoryService`
|
|
1363
1400
|
*
|
|
1364
1401
|
*/
|
|
1365
|
-
rmService: rmService((0,
|
|
1402
|
+
rmService: rmService((0, import_node_path14.join)(path5, "services")),
|
|
1366
1403
|
/**
|
|
1367
1404
|
* Remove an service by an service id
|
|
1368
1405
|
*
|
|
1369
1406
|
* @param id - The id of the service you want to remove
|
|
1370
1407
|
*
|
|
1371
1408
|
*/
|
|
1372
|
-
rmServiceById: rmServiceById((0,
|
|
1409
|
+
rmServiceById: rmServiceById((0, import_node_path14.join)(path5)),
|
|
1373
1410
|
/**
|
|
1374
1411
|
* Adds a file to the given service
|
|
1375
1412
|
* @param id - The id of the service to add the file to
|
|
@@ -1377,21 +1414,21 @@ var index_default = (path4) => {
|
|
|
1377
1414
|
* @param version - Optional version of the service to add the file to
|
|
1378
1415
|
* @returns
|
|
1379
1416
|
*/
|
|
1380
|
-
addFileToService: addFileToService((0,
|
|
1417
|
+
addFileToService: addFileToService((0, import_node_path14.join)(path5)),
|
|
1381
1418
|
/**
|
|
1382
1419
|
* Returns the specifications for a given service
|
|
1383
1420
|
* @param id - The id of the service to retrieve the specifications for
|
|
1384
1421
|
* @param version - Optional version of the service
|
|
1385
1422
|
* @returns
|
|
1386
1423
|
*/
|
|
1387
|
-
getSpecificationFilesForService: getSpecificationFilesForService((0,
|
|
1424
|
+
getSpecificationFilesForService: getSpecificationFilesForService((0, import_node_path14.join)(path5)),
|
|
1388
1425
|
/**
|
|
1389
1426
|
* Check to see if a service version exists
|
|
1390
1427
|
* @param id - The id of the service
|
|
1391
1428
|
* @param version - The version of the service (supports semver)
|
|
1392
1429
|
* @returns
|
|
1393
1430
|
*/
|
|
1394
|
-
serviceHasVersion: serviceHasVersion((0,
|
|
1431
|
+
serviceHasVersion: serviceHasVersion((0, import_node_path14.join)(path5)),
|
|
1395
1432
|
/**
|
|
1396
1433
|
* Add an event to a service by it's id.
|
|
1397
1434
|
*
|
|
@@ -1411,7 +1448,7 @@ var index_default = (path4) => {
|
|
|
1411
1448
|
*
|
|
1412
1449
|
* ```
|
|
1413
1450
|
*/
|
|
1414
|
-
addEventToService: addMessageToService((0,
|
|
1451
|
+
addEventToService: addMessageToService((0, import_node_path14.join)(path5)),
|
|
1415
1452
|
/**
|
|
1416
1453
|
* Add a command to a service by it's id.
|
|
1417
1454
|
*
|
|
@@ -1431,7 +1468,7 @@ var index_default = (path4) => {
|
|
|
1431
1468
|
*
|
|
1432
1469
|
* ```
|
|
1433
1470
|
*/
|
|
1434
|
-
addCommandToService: addMessageToService((0,
|
|
1471
|
+
addCommandToService: addMessageToService((0, import_node_path14.join)(path5)),
|
|
1435
1472
|
/**
|
|
1436
1473
|
* Add a query to a service by it's id.
|
|
1437
1474
|
*
|
|
@@ -1451,7 +1488,24 @@ var index_default = (path4) => {
|
|
|
1451
1488
|
*
|
|
1452
1489
|
* ```
|
|
1453
1490
|
*/
|
|
1454
|
-
addQueryToService: addMessageToService((0,
|
|
1491
|
+
addQueryToService: addMessageToService((0, import_node_path14.join)(path5)),
|
|
1492
|
+
/**
|
|
1493
|
+
* Check to see if a service exists by it's path.
|
|
1494
|
+
*
|
|
1495
|
+
* @example
|
|
1496
|
+
* ```ts
|
|
1497
|
+
* import utils from '@eventcatalog/utils';
|
|
1498
|
+
*
|
|
1499
|
+
* const { isService } = utils('/path/to/eventcatalog');
|
|
1500
|
+
*
|
|
1501
|
+
* // returns true if the path is a service
|
|
1502
|
+
* await isService('/services/InventoryService/index.mdx');
|
|
1503
|
+
* ```
|
|
1504
|
+
*
|
|
1505
|
+
* @param path - The path to the service to check
|
|
1506
|
+
* @returns boolean
|
|
1507
|
+
*/
|
|
1508
|
+
isService: isService((0, import_node_path14.join)(path5)),
|
|
1455
1509
|
/**
|
|
1456
1510
|
* ================================
|
|
1457
1511
|
* Domains
|
|
@@ -1464,39 +1518,39 @@ var index_default = (path4) => {
|
|
|
1464
1518
|
* @param options - Optional options to write the event
|
|
1465
1519
|
*
|
|
1466
1520
|
*/
|
|
1467
|
-
writeDomain: writeDomain((0,
|
|
1521
|
+
writeDomain: writeDomain((0, import_node_path14.join)(path5, "domains")),
|
|
1468
1522
|
/**
|
|
1469
1523
|
* Returns a domain from EventCatalog
|
|
1470
1524
|
* @param id - The id of the domain to retrieve
|
|
1471
1525
|
* @param version - Optional id of the version to get (supports semver)
|
|
1472
1526
|
* @returns Domain|Undefined
|
|
1473
1527
|
*/
|
|
1474
|
-
getDomain: getDomain((0,
|
|
1528
|
+
getDomain: getDomain((0, import_node_path14.join)(path5, "domains")),
|
|
1475
1529
|
/**
|
|
1476
1530
|
* Returns all domains from EventCatalog
|
|
1477
1531
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1478
1532
|
* @returns Domain[]|Undefined
|
|
1479
1533
|
*/
|
|
1480
|
-
getDomains: getDomains((0,
|
|
1534
|
+
getDomains: getDomains((0, import_node_path14.join)(path5)),
|
|
1481
1535
|
/**
|
|
1482
1536
|
* Moves a given domain id to the version directory
|
|
1483
1537
|
* @param directory
|
|
1484
1538
|
*/
|
|
1485
|
-
versionDomain: versionDomain((0,
|
|
1539
|
+
versionDomain: versionDomain((0, import_node_path14.join)(path5, "domains")),
|
|
1486
1540
|
/**
|
|
1487
1541
|
* Remove a domain from EventCatalog (modeled on the standard POSIX rm utility)
|
|
1488
1542
|
*
|
|
1489
1543
|
* @param path - The path to your domain, e.g. `/Payment`
|
|
1490
1544
|
*
|
|
1491
1545
|
*/
|
|
1492
|
-
rmDomain: rmDomain((0,
|
|
1546
|
+
rmDomain: rmDomain((0, import_node_path14.join)(path5, "domains")),
|
|
1493
1547
|
/**
|
|
1494
1548
|
* Remove an service by an domain id
|
|
1495
1549
|
*
|
|
1496
1550
|
* @param id - The id of the domain you want to remove
|
|
1497
1551
|
*
|
|
1498
1552
|
*/
|
|
1499
|
-
rmDomainById: rmDomainById((0,
|
|
1553
|
+
rmDomainById: rmDomainById((0, import_node_path14.join)(path5, "domains")),
|
|
1500
1554
|
/**
|
|
1501
1555
|
* Adds a file to the given domain
|
|
1502
1556
|
* @param id - The id of the domain to add the file to
|
|
@@ -1504,28 +1558,28 @@ var index_default = (path4) => {
|
|
|
1504
1558
|
* @param version - Optional version of the domain to add the file to
|
|
1505
1559
|
* @returns
|
|
1506
1560
|
*/
|
|
1507
|
-
addFileToDomain: addFileToDomain((0,
|
|
1561
|
+
addFileToDomain: addFileToDomain((0, import_node_path14.join)(path5, "domains")),
|
|
1508
1562
|
/**
|
|
1509
1563
|
* Adds an ubiquitous language dictionary to a domain
|
|
1510
1564
|
* @param id - The id of the domain to add the ubiquitous language to
|
|
1511
1565
|
* @param ubiquitousLanguageDictionary - The ubiquitous language dictionary to add
|
|
1512
1566
|
* @param version - Optional version of the domain to add the ubiquitous language to
|
|
1513
1567
|
*/
|
|
1514
|
-
addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain((0,
|
|
1568
|
+
addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain((0, import_node_path14.join)(path5, "domains")),
|
|
1515
1569
|
/**
|
|
1516
1570
|
* Get the ubiquitous language dictionary from a domain
|
|
1517
1571
|
* @param id - The id of the domain to get the ubiquitous language from
|
|
1518
1572
|
* @param version - Optional version of the domain to get the ubiquitous language from
|
|
1519
1573
|
* @returns
|
|
1520
1574
|
*/
|
|
1521
|
-
getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain((0,
|
|
1575
|
+
getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain((0, import_node_path14.join)(path5, "domains")),
|
|
1522
1576
|
/**
|
|
1523
1577
|
* Check to see if a domain version exists
|
|
1524
1578
|
* @param id - The id of the domain
|
|
1525
1579
|
* @param version - The version of the domain (supports semver)
|
|
1526
1580
|
* @returns
|
|
1527
1581
|
*/
|
|
1528
|
-
domainHasVersion: domainHasVersion((0,
|
|
1582
|
+
domainHasVersion: domainHasVersion((0, import_node_path14.join)(path5)),
|
|
1529
1583
|
/**
|
|
1530
1584
|
* Adds a given service to a domain
|
|
1531
1585
|
* @param id - The id of the domain
|
|
@@ -1533,7 +1587,7 @@ var index_default = (path4) => {
|
|
|
1533
1587
|
* @param version - (Optional) The version of the domain to add the service to
|
|
1534
1588
|
* @returns
|
|
1535
1589
|
*/
|
|
1536
|
-
addServiceToDomain: addServiceToDomain((0,
|
|
1590
|
+
addServiceToDomain: addServiceToDomain((0, import_node_path14.join)(path5, "domains")),
|
|
1537
1591
|
/**
|
|
1538
1592
|
* Adds a given subdomain to a domain
|
|
1539
1593
|
* @param id - The id of the domain
|
|
@@ -1541,7 +1595,7 @@ var index_default = (path4) => {
|
|
|
1541
1595
|
* @param version - (Optional) The version of the domain to add the subdomain to
|
|
1542
1596
|
* @returns
|
|
1543
1597
|
*/
|
|
1544
|
-
addSubDomainToDomain: addSubDomainToDomain((0,
|
|
1598
|
+
addSubDomainToDomain: addSubDomainToDomain((0, import_node_path14.join)(path5, "domains")),
|
|
1545
1599
|
/**
|
|
1546
1600
|
* ================================
|
|
1547
1601
|
* Teams
|
|
@@ -1554,25 +1608,25 @@ var index_default = (path4) => {
|
|
|
1554
1608
|
* @param options - Optional options to write the team
|
|
1555
1609
|
*
|
|
1556
1610
|
*/
|
|
1557
|
-
writeTeam: writeTeam((0,
|
|
1611
|
+
writeTeam: writeTeam((0, import_node_path14.join)(path5, "teams")),
|
|
1558
1612
|
/**
|
|
1559
1613
|
* Returns a team from EventCatalog
|
|
1560
1614
|
* @param id - The id of the team to retrieve
|
|
1561
1615
|
* @returns Team|Undefined
|
|
1562
1616
|
*/
|
|
1563
|
-
getTeam: getTeam((0,
|
|
1617
|
+
getTeam: getTeam((0, import_node_path14.join)(path5, "teams")),
|
|
1564
1618
|
/**
|
|
1565
1619
|
* Returns all teams from EventCatalog
|
|
1566
1620
|
* @returns Team[]|Undefined
|
|
1567
1621
|
*/
|
|
1568
|
-
getTeams: getTeams((0,
|
|
1622
|
+
getTeams: getTeams((0, import_node_path14.join)(path5, "teams")),
|
|
1569
1623
|
/**
|
|
1570
1624
|
* Remove a team by the team id
|
|
1571
1625
|
*
|
|
1572
1626
|
* @param id - The id of the team you want to remove
|
|
1573
1627
|
*
|
|
1574
1628
|
*/
|
|
1575
|
-
rmTeamById: rmTeamById((0,
|
|
1629
|
+
rmTeamById: rmTeamById((0, import_node_path14.join)(path5, "teams")),
|
|
1576
1630
|
/**
|
|
1577
1631
|
* ================================
|
|
1578
1632
|
* Users
|
|
@@ -1585,25 +1639,25 @@ var index_default = (path4) => {
|
|
|
1585
1639
|
* @param options - Optional options to write the user
|
|
1586
1640
|
*
|
|
1587
1641
|
*/
|
|
1588
|
-
writeUser: writeUser((0,
|
|
1642
|
+
writeUser: writeUser((0, import_node_path14.join)(path5, "users")),
|
|
1589
1643
|
/**
|
|
1590
1644
|
* Returns a user from EventCatalog
|
|
1591
1645
|
* @param id - The id of the user to retrieve
|
|
1592
1646
|
* @returns User|Undefined
|
|
1593
1647
|
*/
|
|
1594
|
-
getUser: getUser((0,
|
|
1648
|
+
getUser: getUser((0, import_node_path14.join)(path5, "users")),
|
|
1595
1649
|
/**
|
|
1596
1650
|
* Returns all user from EventCatalog
|
|
1597
1651
|
* @returns User[]|Undefined
|
|
1598
1652
|
*/
|
|
1599
|
-
getUsers: getUsers((0,
|
|
1653
|
+
getUsers: getUsers((0, import_node_path14.join)(path5)),
|
|
1600
1654
|
/**
|
|
1601
1655
|
* Remove a user by the user id
|
|
1602
1656
|
*
|
|
1603
1657
|
* @param id - The id of the user you want to remove
|
|
1604
1658
|
*
|
|
1605
1659
|
*/
|
|
1606
|
-
rmUserById: rmUserById((0,
|
|
1660
|
+
rmUserById: rmUserById((0, import_node_path14.join)(path5, "users")),
|
|
1607
1661
|
/**
|
|
1608
1662
|
* ================================
|
|
1609
1663
|
* Custom Docs
|
|
@@ -1614,32 +1668,32 @@ var index_default = (path4) => {
|
|
|
1614
1668
|
* @param path - The path to the custom doc to retrieve
|
|
1615
1669
|
* @returns CustomDoc|Undefined
|
|
1616
1670
|
*/
|
|
1617
|
-
getCustomDoc: getCustomDoc((0,
|
|
1671
|
+
getCustomDoc: getCustomDoc((0, import_node_path14.join)(path5, "docs")),
|
|
1618
1672
|
/**
|
|
1619
1673
|
* Returns all custom docs from EventCatalog
|
|
1620
1674
|
* @param options - Optional options to get custom docs from a specific path
|
|
1621
1675
|
* @returns CustomDoc[]|Undefined
|
|
1622
1676
|
*/
|
|
1623
|
-
getCustomDocs: getCustomDocs((0,
|
|
1677
|
+
getCustomDocs: getCustomDocs((0, import_node_path14.join)(path5, "docs")),
|
|
1624
1678
|
/**
|
|
1625
1679
|
* Writes a custom doc to EventCatalog
|
|
1626
1680
|
* @param customDoc - The custom doc to write
|
|
1627
1681
|
* @param options - Optional options to write the custom doc
|
|
1628
1682
|
*
|
|
1629
1683
|
*/
|
|
1630
|
-
writeCustomDoc: writeCustomDoc((0,
|
|
1684
|
+
writeCustomDoc: writeCustomDoc((0, import_node_path14.join)(path5, "docs")),
|
|
1631
1685
|
/**
|
|
1632
1686
|
* Removes a custom doc from EventCatalog
|
|
1633
1687
|
* @param path - The path to the custom doc to remove
|
|
1634
1688
|
*
|
|
1635
1689
|
*/
|
|
1636
|
-
rmCustomDoc: rmCustomDoc((0,
|
|
1690
|
+
rmCustomDoc: rmCustomDoc((0, import_node_path14.join)(path5, "docs")),
|
|
1637
1691
|
/**
|
|
1638
1692
|
* Dumps the catalog to a JSON file.
|
|
1639
1693
|
* @param directory - The directory to dump the catalog to
|
|
1640
1694
|
* @returns A JSON file with the catalog
|
|
1641
1695
|
*/
|
|
1642
|
-
dumpCatalog: dumpCatalog((0,
|
|
1696
|
+
dumpCatalog: dumpCatalog((0, import_node_path14.join)(path5)),
|
|
1643
1697
|
/**
|
|
1644
1698
|
* Returns the event catalog configuration file.
|
|
1645
1699
|
* The event catalog configuration file is the file that contains the configuration for the event catalog.
|
|
@@ -1647,7 +1701,7 @@ var index_default = (path4) => {
|
|
|
1647
1701
|
* @param directory - The directory of the catalog.
|
|
1648
1702
|
* @returns A JSON object with the configuration for the event catalog.
|
|
1649
1703
|
*/
|
|
1650
|
-
getEventCatalogConfigurationFile: getEventCatalogConfigurationFile((0,
|
|
1704
|
+
getEventCatalogConfigurationFile: getEventCatalogConfigurationFile((0, import_node_path14.join)(path5)),
|
|
1651
1705
|
/**
|
|
1652
1706
|
* ================================
|
|
1653
1707
|
* Resources Utils
|
|
@@ -1668,14 +1722,21 @@ var index_default = (path4) => {
|
|
|
1668
1722
|
* @param path - The path to the message to retrieve
|
|
1669
1723
|
* @returns Message|Undefined
|
|
1670
1724
|
*/
|
|
1671
|
-
getMessageBySchemaPath: getMessageBySchemaPath((0,
|
|
1725
|
+
getMessageBySchemaPath: getMessageBySchemaPath((0, import_node_path14.join)(path5)),
|
|
1672
1726
|
/**
|
|
1673
1727
|
* Returns the producers and consumers (services) for a given message
|
|
1674
1728
|
* @param id - The id of the message to get the producers and consumers for
|
|
1675
1729
|
* @param version - Optional version of the message
|
|
1676
1730
|
* @returns { producers: Service[], consumers: Service[] }
|
|
1677
1731
|
*/
|
|
1678
|
-
getProducersAndConsumersForMessage: getProducersAndConsumersForMessage((0,
|
|
1732
|
+
getProducersAndConsumersForMessage: getProducersAndConsumersForMessage((0, import_node_path14.join)(path5)),
|
|
1733
|
+
/**
|
|
1734
|
+
* Returns the owners for a given resource (e.g domain, service, event, command, query, etc.)
|
|
1735
|
+
* @param id - The id of the resource to get the owners for
|
|
1736
|
+
* @param version - Optional version of the resource
|
|
1737
|
+
* @returns { owners: User[] }
|
|
1738
|
+
*/
|
|
1739
|
+
getOwnersForResource: getOwnersForResource((0, import_node_path14.join)(path5))
|
|
1679
1740
|
};
|
|
1680
1741
|
};
|
|
1681
1742
|
//# sourceMappingURL=index.js.map
|