@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/eventcatalog.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/eventcatalog.ts
|
|
2
2
|
import fs10 from "fs";
|
|
3
|
-
import
|
|
3
|
+
import path4, { join as join14 } from "path";
|
|
4
4
|
|
|
5
5
|
// src/index.ts
|
|
6
6
|
import { join as join13 } from "path";
|
|
@@ -24,13 +24,13 @@ var versionExists = async (catalogDir, id, version) => {
|
|
|
24
24
|
var findFileById = async (catalogDir, id, version) => {
|
|
25
25
|
const files = await getFiles(`${catalogDir}/**/index.{md,mdx}`);
|
|
26
26
|
const matchedFiles = await searchFilesForId(files, id) || [];
|
|
27
|
-
const latestVersion = matchedFiles.find((
|
|
27
|
+
const latestVersion = matchedFiles.find((path5) => !path5.includes("versioned"));
|
|
28
28
|
if (!version) {
|
|
29
29
|
return latestVersion;
|
|
30
30
|
}
|
|
31
|
-
const parsedFiles = matchedFiles.map((
|
|
32
|
-
const { data } = matter.read(
|
|
33
|
-
return { ...data, path:
|
|
31
|
+
const parsedFiles = matchedFiles.map((path5) => {
|
|
32
|
+
const { data } = matter.read(path5);
|
|
33
|
+
return { ...data, path: path5 };
|
|
34
34
|
});
|
|
35
35
|
const semverRange = validRange(version);
|
|
36
36
|
if (semverRange && valid(version)) {
|
|
@@ -71,8 +71,8 @@ var getFiles = async (pattern, ignore = "") => {
|
|
|
71
71
|
);
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
|
-
var readMdxFile = async (
|
|
75
|
-
const { data } = matter.read(
|
|
74
|
+
var readMdxFile = async (path5) => {
|
|
75
|
+
const { data } = matter.read(path5);
|
|
76
76
|
const { markdown, ...frontmatter } = data;
|
|
77
77
|
return { ...frontmatter, markdown };
|
|
78
78
|
};
|
|
@@ -155,8 +155,8 @@ var writeResource = async (catalogDir, resource, options = {
|
|
|
155
155
|
versionExistingContent: false,
|
|
156
156
|
format: "mdx"
|
|
157
157
|
}) => {
|
|
158
|
-
const
|
|
159
|
-
const fullPath = join2(catalogDir,
|
|
158
|
+
const path5 = options.path || `/${resource.id}`;
|
|
159
|
+
const fullPath = join2(catalogDir, path5);
|
|
160
160
|
const format = options.format || "mdx";
|
|
161
161
|
fsSync2.mkdirSync(fullPath, { recursive: true });
|
|
162
162
|
const lockPath = join2(fullPath, `index.${format}`);
|
|
@@ -191,10 +191,10 @@ var writeResource = async (catalogDir, resource, options = {
|
|
|
191
191
|
});
|
|
192
192
|
}
|
|
193
193
|
};
|
|
194
|
-
var getResource = async (catalogDir, id, version, options) => {
|
|
194
|
+
var getResource = async (catalogDir, id, version, options, filePath) => {
|
|
195
195
|
const attachSchema = options?.attachSchema || false;
|
|
196
|
-
const file = await findFileById(catalogDir, id, version);
|
|
197
|
-
if (!file) return;
|
|
196
|
+
const file = filePath || (id ? await findFileById(catalogDir, id, version) : void 0);
|
|
197
|
+
if (!file || !fsSync2.existsSync(file)) return;
|
|
198
198
|
const { data, content } = matter2.read(file);
|
|
199
199
|
if (attachSchema && data?.schemaPath) {
|
|
200
200
|
const resourceDirectory = dirname2(file);
|
|
@@ -319,8 +319,8 @@ var writeEventToService = (directory) => async (event, service, options = { path
|
|
|
319
319
|
pathForEvent = join3(pathForEvent, event.id);
|
|
320
320
|
await writeResource(directory, { ...event }, { ...options, path: pathForEvent, type: "event" });
|
|
321
321
|
};
|
|
322
|
-
var rmEvent = (directory) => async (
|
|
323
|
-
await fs2.rm(join3(directory,
|
|
322
|
+
var rmEvent = (directory) => async (path5) => {
|
|
323
|
+
await fs2.rm(join3(directory, path5), { recursive: true });
|
|
324
324
|
};
|
|
325
325
|
var rmEventById = (directory) => async (id, version, persistFiles) => {
|
|
326
326
|
await rmResourceById(directory, id, version, { type: "event", persistFiles });
|
|
@@ -355,8 +355,8 @@ var writeCommandToService = (directory) => async (command, service, options = {
|
|
|
355
355
|
pathForCommand = join4(pathForCommand, command.id);
|
|
356
356
|
await writeResource(directory, { ...command }, { ...options, path: pathForCommand, type: "command" });
|
|
357
357
|
};
|
|
358
|
-
var rmCommand = (directory) => async (
|
|
359
|
-
await fs3.rm(join4(directory,
|
|
358
|
+
var rmCommand = (directory) => async (path5) => {
|
|
359
|
+
await fs3.rm(join4(directory, path5), { recursive: true });
|
|
360
360
|
};
|
|
361
361
|
var rmCommandById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "command", persistFiles });
|
|
362
362
|
var versionCommand = (directory) => async (id) => versionResource(directory, id);
|
|
@@ -389,8 +389,8 @@ var writeQueryToService = (directory) => async (query, service, options = { path
|
|
|
389
389
|
pathForQuery = join5(pathForQuery, query.id);
|
|
390
390
|
await writeResource(directory, { ...query }, { ...options, path: pathForQuery, type: "query" });
|
|
391
391
|
};
|
|
392
|
-
var rmQuery = (directory) => async (
|
|
393
|
-
await fs4.rm(join5(directory,
|
|
392
|
+
var rmQuery = (directory) => async (path5) => {
|
|
393
|
+
await fs4.rm(join5(directory, path5), { recursive: true });
|
|
394
394
|
};
|
|
395
395
|
var rmQueryById = (directory) => async (id, version, persistFiles) => {
|
|
396
396
|
await rmResourceById(directory, id, version, { type: "query", persistFiles });
|
|
@@ -407,8 +407,12 @@ var queryHasVersion = (directory) => async (id, version) => {
|
|
|
407
407
|
|
|
408
408
|
// src/services.ts
|
|
409
409
|
import fs5 from "fs/promises";
|
|
410
|
-
import { join as join6, dirname as dirname4, extname } from "path";
|
|
410
|
+
import { join as join6, dirname as dirname4, extname, relative as relative2 } from "path";
|
|
411
411
|
var getService = (directory) => async (id, version) => getResource(directory, id, version, { type: "service" });
|
|
412
|
+
var getServiceByPath = (directory) => async (path5) => {
|
|
413
|
+
const service = await getResource(directory, void 0, void 0, { type: "service" }, path5);
|
|
414
|
+
return service;
|
|
415
|
+
};
|
|
412
416
|
var getServices = (directory) => async (options) => getResources(directory, {
|
|
413
417
|
type: "services",
|
|
414
418
|
ignore: ["**/events/**", "**/commands/**", "**/queries/**", "**/entities/**", "**/subdomains/**/entities/**"],
|
|
@@ -430,8 +434,8 @@ var writeService = (directory) => async (service, options = {
|
|
|
430
434
|
};
|
|
431
435
|
var writeVersionedService = (directory) => async (service) => {
|
|
432
436
|
const resource = { ...service };
|
|
433
|
-
const
|
|
434
|
-
return await writeService(directory)(resource, { path:
|
|
437
|
+
const path5 = getVersionedDirectory(service.id, service.version);
|
|
438
|
+
return await writeService(directory)(resource, { path: path5 });
|
|
435
439
|
};
|
|
436
440
|
var writeServiceToDomain = (directory) => async (service, domain, options = { path: "", format: "mdx", override: false }) => {
|
|
437
441
|
let pathForService = domain.version && domain.version !== "latest" ? `/${domain.id}/versioned/${domain.version}/services` : `/${domain.id}/services`;
|
|
@@ -439,8 +443,8 @@ var writeServiceToDomain = (directory) => async (service, domain, options = { pa
|
|
|
439
443
|
await writeResource(directory, { ...service }, { ...options, path: pathForService, type: "service" });
|
|
440
444
|
};
|
|
441
445
|
var versionService = (directory) => async (id) => versionResource(directory, id);
|
|
442
|
-
var rmService = (directory) => async (
|
|
443
|
-
await fs5.rm(join6(directory,
|
|
446
|
+
var rmService = (directory) => async (path5) => {
|
|
447
|
+
await fs5.rm(join6(directory, path5), { recursive: true });
|
|
444
448
|
};
|
|
445
449
|
var rmServiceById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "service", persistFiles });
|
|
446
450
|
var addFileToService = (directory) => async (id, file, version) => addFileToResource(directory, id, file, version);
|
|
@@ -495,8 +499,8 @@ var addMessageToService = (directory) => async (id, direction, event, version) =
|
|
|
495
499
|
if (!existingResource) {
|
|
496
500
|
throw new Error(`Cannot find service ${id} in the catalog`);
|
|
497
501
|
}
|
|
498
|
-
const
|
|
499
|
-
const pathToResource = join6(
|
|
502
|
+
const path5 = existingResource.split(/[\\/]+services/)[0];
|
|
503
|
+
const pathToResource = join6(path5, "services");
|
|
500
504
|
await rmServiceById(directory)(id, version);
|
|
501
505
|
await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
|
|
502
506
|
};
|
|
@@ -504,6 +508,12 @@ var serviceHasVersion = (directory) => async (id, version) => {
|
|
|
504
508
|
const file = await findFileById(directory, id, version);
|
|
505
509
|
return !!file;
|
|
506
510
|
};
|
|
511
|
+
var isService = (directory) => async (path5) => {
|
|
512
|
+
const service = await getServiceByPath(directory)(path5);
|
|
513
|
+
const relativePath = relative2(directory, path5);
|
|
514
|
+
const segments = relativePath.split(/[/\\]+/);
|
|
515
|
+
return !!service && segments.includes("services");
|
|
516
|
+
};
|
|
507
517
|
|
|
508
518
|
// src/domains.ts
|
|
509
519
|
import fs6 from "fs/promises";
|
|
@@ -532,8 +542,8 @@ var writeDomain = (directory) => async (domain, options = {
|
|
|
532
542
|
return await writeResource(directory, resource, { ...options, type: "domain" });
|
|
533
543
|
};
|
|
534
544
|
var versionDomain = (directory) => async (id) => versionResource(directory, id);
|
|
535
|
-
var rmDomain = (directory) => async (
|
|
536
|
-
await fs6.rm(join7(directory,
|
|
545
|
+
var rmDomain = (directory) => async (path5) => {
|
|
546
|
+
await fs6.rm(join7(directory, path5), { recursive: true });
|
|
537
547
|
};
|
|
538
548
|
var rmDomainById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "domain", persistFiles });
|
|
539
549
|
var addFileToDomain = (directory) => async (id, file, version) => addFileToResource(directory, id, file, version);
|
|
@@ -594,8 +604,8 @@ import { join as join8, extname as extname2 } from "path";
|
|
|
594
604
|
var getChannel = (directory) => async (id, version) => getResource(directory, id, version, { type: "channel" });
|
|
595
605
|
var getChannels = (directory) => async (options) => getResources(directory, { type: "channels", ...options });
|
|
596
606
|
var writeChannel = (directory) => async (channel, options = { path: "" }) => writeResource(directory, { ...channel }, { ...options, type: "channel" });
|
|
597
|
-
var rmChannel = (directory) => async (
|
|
598
|
-
await fs7.rm(join8(directory,
|
|
607
|
+
var rmChannel = (directory) => async (path5) => {
|
|
608
|
+
await fs7.rm(join8(directory, path5), { recursive: true });
|
|
599
609
|
};
|
|
600
610
|
var rmChannelById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "channel", persistFiles });
|
|
601
611
|
var versionChannel = (directory) => async (id) => versionResource(directory, id);
|
|
@@ -636,8 +646,8 @@ var addMessageToChannel = (directory, collection) => async (id, _message, versio
|
|
|
636
646
|
if (!existingResource) {
|
|
637
647
|
throw new Error(`Cannot find message ${id} in the catalog`);
|
|
638
648
|
}
|
|
639
|
-
const
|
|
640
|
-
const pathToResource = join8(
|
|
649
|
+
const path5 = existingResource.split(`/[\\/]+${collection}`)[0];
|
|
650
|
+
const pathToResource = join8(path5, collection);
|
|
641
651
|
await rmMessageById(directory)(_message.id, _message.version, true);
|
|
642
652
|
await writeMessage(pathToResource)(message, { format: extension === ".md" ? "md" : "mdx" });
|
|
643
653
|
};
|
|
@@ -646,8 +656,8 @@ var addMessageToChannel = (directory, collection) => async (id, _message, versio
|
|
|
646
656
|
import { dirname as dirname5 } from "path";
|
|
647
657
|
import matter4 from "gray-matter";
|
|
648
658
|
import { satisfies as satisfies3, validRange as validRange2 } from "semver";
|
|
649
|
-
var getMessageBySchemaPath = (directory) => async (
|
|
650
|
-
const pathToMessage = dirname5(
|
|
659
|
+
var getMessageBySchemaPath = (directory) => async (path5, options) => {
|
|
660
|
+
const pathToMessage = dirname5(path5);
|
|
651
661
|
try {
|
|
652
662
|
const files = await getFiles(`${directory}/${pathToMessage}/index.{md,mdx}`);
|
|
653
663
|
if (!files || files.length === 0) {
|
|
@@ -665,7 +675,7 @@ var getMessageBySchemaPath = (directory) => async (path4, options) => {
|
|
|
665
675
|
}
|
|
666
676
|
return message;
|
|
667
677
|
} catch (error) {
|
|
668
|
-
console.error(`Failed to get message for schema path ${
|
|
678
|
+
console.error(`Failed to get message for schema path ${path5}. Error processing directory ${pathToMessage}:`, error);
|
|
669
679
|
if (error instanceof Error) {
|
|
670
680
|
error.message = `Failed to retrieve message from ${pathToMessage}: ${error.message}`;
|
|
671
681
|
throw error;
|
|
@@ -759,10 +769,16 @@ var rmCustomDoc = (directory) => async (filePath) => {
|
|
|
759
769
|
|
|
760
770
|
// src/teams.ts
|
|
761
771
|
import fs9 from "fs/promises";
|
|
772
|
+
import fsSync6 from "fs";
|
|
773
|
+
import { join as join12 } from "path";
|
|
774
|
+
import matter7 from "gray-matter";
|
|
775
|
+
import path3 from "path";
|
|
776
|
+
|
|
777
|
+
// src/users.ts
|
|
762
778
|
import fsSync5 from "fs";
|
|
763
779
|
import { join as join11 } from "path";
|
|
764
780
|
import matter6 from "gray-matter";
|
|
765
|
-
var
|
|
781
|
+
var getUser = (catalogDir) => async (id) => {
|
|
766
782
|
const files = await getFiles(`${catalogDir}/${id}.{md,mdx}`);
|
|
767
783
|
if (files.length == 0) return void 0;
|
|
768
784
|
const file = files[0];
|
|
@@ -771,11 +787,12 @@ var getTeam = (catalogDir) => async (id) => {
|
|
|
771
787
|
...data,
|
|
772
788
|
id: data.id,
|
|
773
789
|
name: data.name,
|
|
790
|
+
avatarUrl: data.avatarUrl,
|
|
774
791
|
markdown: content.trim()
|
|
775
792
|
};
|
|
776
793
|
};
|
|
777
|
-
var
|
|
778
|
-
const files = await getFiles(`${catalogDir}/
|
|
794
|
+
var getUsers = (catalogDir) => async (options) => {
|
|
795
|
+
const files = await getFiles(`${catalogDir}/users/*.{md,mdx}`);
|
|
779
796
|
if (files.length === 0) return [];
|
|
780
797
|
return files.map((file) => {
|
|
781
798
|
const { data, content } = matter6.read(file);
|
|
@@ -783,31 +800,29 @@ var getTeams = (catalogDir) => async (options) => {
|
|
|
783
800
|
...data,
|
|
784
801
|
id: data.id,
|
|
785
802
|
name: data.name,
|
|
803
|
+
avatarUrl: data.avatarUrl,
|
|
786
804
|
markdown: content.trim()
|
|
787
805
|
};
|
|
788
806
|
});
|
|
789
807
|
};
|
|
790
|
-
var
|
|
791
|
-
const resource = { ...
|
|
792
|
-
const
|
|
793
|
-
const exists =
|
|
808
|
+
var writeUser = (catalogDir) => async (user, options = {}) => {
|
|
809
|
+
const resource = { ...user };
|
|
810
|
+
const currentUser = await getUser(catalogDir)(resource.id);
|
|
811
|
+
const exists = currentUser !== void 0;
|
|
794
812
|
if (exists && !options.override) {
|
|
795
|
-
throw new Error(`Failed to write ${resource.id} (
|
|
813
|
+
throw new Error(`Failed to write ${resource.id} (user) as it already exists`);
|
|
796
814
|
}
|
|
797
815
|
const { markdown, ...frontmatter } = resource;
|
|
798
816
|
const document = matter6.stringify(markdown, frontmatter);
|
|
799
817
|
fsSync5.mkdirSync(join11(catalogDir, ""), { recursive: true });
|
|
800
818
|
fsSync5.writeFileSync(join11(catalogDir, "", `${resource.id}.mdx`), document);
|
|
801
819
|
};
|
|
802
|
-
var
|
|
803
|
-
|
|
820
|
+
var rmUserById = (catalogDir) => async (id) => {
|
|
821
|
+
fsSync5.rmSync(join11(catalogDir, `${id}.mdx`), { recursive: true });
|
|
804
822
|
};
|
|
805
823
|
|
|
806
|
-
// src/
|
|
807
|
-
|
|
808
|
-
import { join as join12 } from "path";
|
|
809
|
-
import matter7 from "gray-matter";
|
|
810
|
-
var getUser = (catalogDir) => async (id) => {
|
|
824
|
+
// src/teams.ts
|
|
825
|
+
var getTeam = (catalogDir) => async (id) => {
|
|
811
826
|
const files = await getFiles(`${catalogDir}/${id}.{md,mdx}`);
|
|
812
827
|
if (files.length == 0) return void 0;
|
|
813
828
|
const file = files[0];
|
|
@@ -816,12 +831,11 @@ var getUser = (catalogDir) => async (id) => {
|
|
|
816
831
|
...data,
|
|
817
832
|
id: data.id,
|
|
818
833
|
name: data.name,
|
|
819
|
-
avatarUrl: data.avatarUrl,
|
|
820
834
|
markdown: content.trim()
|
|
821
835
|
};
|
|
822
836
|
};
|
|
823
|
-
var
|
|
824
|
-
const files = await getFiles(`${catalogDir}
|
|
837
|
+
var getTeams = (catalogDir) => async (options) => {
|
|
838
|
+
const files = await getFiles(`${catalogDir}/*.{md,mdx}`);
|
|
825
839
|
if (files.length === 0) return [];
|
|
826
840
|
return files.map((file) => {
|
|
827
841
|
const { data, content } = matter7.read(file);
|
|
@@ -829,29 +843,46 @@ var getUsers = (catalogDir) => async (options) => {
|
|
|
829
843
|
...data,
|
|
830
844
|
id: data.id,
|
|
831
845
|
name: data.name,
|
|
832
|
-
avatarUrl: data.avatarUrl,
|
|
833
846
|
markdown: content.trim()
|
|
834
847
|
};
|
|
835
848
|
});
|
|
836
849
|
};
|
|
837
|
-
var
|
|
838
|
-
const resource = { ...
|
|
839
|
-
const
|
|
840
|
-
const exists =
|
|
850
|
+
var writeTeam = (catalogDir) => async (team, options = {}) => {
|
|
851
|
+
const resource = { ...team };
|
|
852
|
+
const currentTeam = await getTeam(catalogDir)(resource.id);
|
|
853
|
+
const exists = currentTeam !== void 0;
|
|
841
854
|
if (exists && !options.override) {
|
|
842
|
-
throw new Error(`Failed to write ${resource.id} (
|
|
855
|
+
throw new Error(`Failed to write ${resource.id} (team) as it already exists`);
|
|
843
856
|
}
|
|
844
857
|
const { markdown, ...frontmatter } = resource;
|
|
845
858
|
const document = matter7.stringify(markdown, frontmatter);
|
|
846
859
|
fsSync6.mkdirSync(join12(catalogDir, ""), { recursive: true });
|
|
847
860
|
fsSync6.writeFileSync(join12(catalogDir, "", `${resource.id}.mdx`), document);
|
|
848
861
|
};
|
|
849
|
-
var
|
|
850
|
-
|
|
862
|
+
var rmTeamById = (catalogDir) => async (id) => {
|
|
863
|
+
await fs9.rm(join12(catalogDir, `${id}.mdx`), { recursive: true });
|
|
864
|
+
};
|
|
865
|
+
var getOwnersForResource = (catalogDir) => async (id, version) => {
|
|
866
|
+
const resource = await getResource(catalogDir, id, version);
|
|
867
|
+
let owners = [];
|
|
868
|
+
if (!resource) return [];
|
|
869
|
+
if (!resource.owners) return [];
|
|
870
|
+
for (const owner of resource.owners) {
|
|
871
|
+
const team = await getTeam(path3.join(catalogDir, "teams"))(owner);
|
|
872
|
+
if (team) {
|
|
873
|
+
owners.push(team);
|
|
874
|
+
} else {
|
|
875
|
+
const user = await getUser(path3.join(catalogDir, "users"))(owner);
|
|
876
|
+
if (user) {
|
|
877
|
+
owners.push(user);
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
return owners;
|
|
851
882
|
};
|
|
852
883
|
|
|
853
884
|
// src/index.ts
|
|
854
|
-
var index_default = (
|
|
885
|
+
var index_default = (path5) => {
|
|
855
886
|
return {
|
|
856
887
|
/**
|
|
857
888
|
* Returns an events from EventCatalog
|
|
@@ -859,13 +890,13 @@ var index_default = (path4) => {
|
|
|
859
890
|
* @param version - Optional id of the version to get (supports semver)
|
|
860
891
|
* @returns Event|Undefined
|
|
861
892
|
*/
|
|
862
|
-
getEvent: getEvent(join13(
|
|
893
|
+
getEvent: getEvent(join13(path5)),
|
|
863
894
|
/**
|
|
864
895
|
* Returns all events from EventCatalog
|
|
865
896
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
866
897
|
* @returns Event[]|Undefined
|
|
867
898
|
*/
|
|
868
|
-
getEvents: getEvents(join13(
|
|
899
|
+
getEvents: getEvents(join13(path5)),
|
|
869
900
|
/**
|
|
870
901
|
* Adds an event to EventCatalog
|
|
871
902
|
*
|
|
@@ -873,7 +904,7 @@ var index_default = (path4) => {
|
|
|
873
904
|
* @param options - Optional options to write the event
|
|
874
905
|
*
|
|
875
906
|
*/
|
|
876
|
-
writeEvent: writeEvent(join13(
|
|
907
|
+
writeEvent: writeEvent(join13(path5, "events")),
|
|
877
908
|
/**
|
|
878
909
|
* Adds an event to a service in EventCatalog
|
|
879
910
|
*
|
|
@@ -882,26 +913,26 @@ var index_default = (path4) => {
|
|
|
882
913
|
* @param options - Optional options to write the event
|
|
883
914
|
*
|
|
884
915
|
*/
|
|
885
|
-
writeEventToService: writeEventToService(join13(
|
|
916
|
+
writeEventToService: writeEventToService(join13(path5)),
|
|
886
917
|
/**
|
|
887
918
|
* Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
|
|
888
919
|
*
|
|
889
920
|
* @param path - The path to your event, e.g. `/Inventory/InventoryAdjusted`
|
|
890
921
|
*
|
|
891
922
|
*/
|
|
892
|
-
rmEvent: rmEvent(join13(
|
|
923
|
+
rmEvent: rmEvent(join13(path5, "events")),
|
|
893
924
|
/**
|
|
894
925
|
* Remove an event by an Event id
|
|
895
926
|
*
|
|
896
927
|
* @param id - The id of the event you want to remove
|
|
897
928
|
*
|
|
898
929
|
*/
|
|
899
|
-
rmEventById: rmEventById(join13(
|
|
930
|
+
rmEventById: rmEventById(join13(path5)),
|
|
900
931
|
/**
|
|
901
932
|
* Moves a given event id to the version directory
|
|
902
933
|
* @param directory
|
|
903
934
|
*/
|
|
904
|
-
versionEvent: versionEvent(join13(
|
|
935
|
+
versionEvent: versionEvent(join13(path5)),
|
|
905
936
|
/**
|
|
906
937
|
* Adds a file to the given event
|
|
907
938
|
* @param id - The id of the event to add the file to
|
|
@@ -909,7 +940,7 @@ var index_default = (path4) => {
|
|
|
909
940
|
* @param version - Optional version of the event to add the file to
|
|
910
941
|
* @returns
|
|
911
942
|
*/
|
|
912
|
-
addFileToEvent: addFileToEvent(join13(
|
|
943
|
+
addFileToEvent: addFileToEvent(join13(path5)),
|
|
913
944
|
/**
|
|
914
945
|
* Adds a schema to the given event
|
|
915
946
|
* @param id - The id of the event to add the schema to
|
|
@@ -917,14 +948,14 @@ var index_default = (path4) => {
|
|
|
917
948
|
* @param version - Optional version of the event to add the schema to
|
|
918
949
|
* @returns
|
|
919
950
|
*/
|
|
920
|
-
addSchemaToEvent: addSchemaToEvent(join13(
|
|
951
|
+
addSchemaToEvent: addSchemaToEvent(join13(path5)),
|
|
921
952
|
/**
|
|
922
953
|
* Check to see if an event version exists
|
|
923
954
|
* @param id - The id of the event
|
|
924
955
|
* @param version - The version of the event (supports semver)
|
|
925
956
|
* @returns
|
|
926
957
|
*/
|
|
927
|
-
eventHasVersion: eventHasVersion(join13(
|
|
958
|
+
eventHasVersion: eventHasVersion(join13(path5)),
|
|
928
959
|
/**
|
|
929
960
|
* ================================
|
|
930
961
|
* Commands
|
|
@@ -936,13 +967,13 @@ var index_default = (path4) => {
|
|
|
936
967
|
* @param version - Optional id of the version to get (supports semver)
|
|
937
968
|
* @returns Command|Undefined
|
|
938
969
|
*/
|
|
939
|
-
getCommand: getCommand(join13(
|
|
970
|
+
getCommand: getCommand(join13(path5)),
|
|
940
971
|
/**
|
|
941
972
|
* Returns all commands from EventCatalog
|
|
942
973
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
943
974
|
* @returns Command[]|Undefined
|
|
944
975
|
*/
|
|
945
|
-
getCommands: getCommands(join13(
|
|
976
|
+
getCommands: getCommands(join13(path5)),
|
|
946
977
|
/**
|
|
947
978
|
* Adds an command to EventCatalog
|
|
948
979
|
*
|
|
@@ -950,7 +981,7 @@ var index_default = (path4) => {
|
|
|
950
981
|
* @param options - Optional options to write the command
|
|
951
982
|
*
|
|
952
983
|
*/
|
|
953
|
-
writeCommand: writeCommand(join13(
|
|
984
|
+
writeCommand: writeCommand(join13(path5, "commands")),
|
|
954
985
|
/**
|
|
955
986
|
* Adds a command to a service in EventCatalog
|
|
956
987
|
*
|
|
@@ -959,26 +990,26 @@ var index_default = (path4) => {
|
|
|
959
990
|
* @param options - Optional options to write the command
|
|
960
991
|
*
|
|
961
992
|
*/
|
|
962
|
-
writeCommandToService: writeCommandToService(join13(
|
|
993
|
+
writeCommandToService: writeCommandToService(join13(path5)),
|
|
963
994
|
/**
|
|
964
995
|
* Remove an command to EventCatalog (modeled on the standard POSIX rm utility)
|
|
965
996
|
*
|
|
966
997
|
* @param path - The path to your command, e.g. `/Inventory/InventoryAdjusted`
|
|
967
998
|
*
|
|
968
999
|
*/
|
|
969
|
-
rmCommand: rmCommand(join13(
|
|
1000
|
+
rmCommand: rmCommand(join13(path5, "commands")),
|
|
970
1001
|
/**
|
|
971
1002
|
* Remove an command by an Event id
|
|
972
1003
|
*
|
|
973
1004
|
* @param id - The id of the command you want to remove
|
|
974
1005
|
*
|
|
975
1006
|
*/
|
|
976
|
-
rmCommandById: rmCommandById(join13(
|
|
1007
|
+
rmCommandById: rmCommandById(join13(path5)),
|
|
977
1008
|
/**
|
|
978
1009
|
* Moves a given command id to the version directory
|
|
979
1010
|
* @param directory
|
|
980
1011
|
*/
|
|
981
|
-
versionCommand: versionCommand(join13(
|
|
1012
|
+
versionCommand: versionCommand(join13(path5)),
|
|
982
1013
|
/**
|
|
983
1014
|
* Adds a file to the given command
|
|
984
1015
|
* @param id - The id of the command to add the file to
|
|
@@ -986,7 +1017,7 @@ var index_default = (path4) => {
|
|
|
986
1017
|
* @param version - Optional version of the command to add the file to
|
|
987
1018
|
* @returns
|
|
988
1019
|
*/
|
|
989
|
-
addFileToCommand: addFileToCommand(join13(
|
|
1020
|
+
addFileToCommand: addFileToCommand(join13(path5)),
|
|
990
1021
|
/**
|
|
991
1022
|
* Adds a schema to the given command
|
|
992
1023
|
* @param id - The id of the command to add the schema to
|
|
@@ -994,14 +1025,14 @@ var index_default = (path4) => {
|
|
|
994
1025
|
* @param version - Optional version of the command to add the schema to
|
|
995
1026
|
* @returns
|
|
996
1027
|
*/
|
|
997
|
-
addSchemaToCommand: addSchemaToCommand(join13(
|
|
1028
|
+
addSchemaToCommand: addSchemaToCommand(join13(path5)),
|
|
998
1029
|
/**
|
|
999
1030
|
* Check to see if a command version exists
|
|
1000
1031
|
* @param id - The id of the command
|
|
1001
1032
|
* @param version - The version of the command (supports semver)
|
|
1002
1033
|
* @returns
|
|
1003
1034
|
*/
|
|
1004
|
-
commandHasVersion: commandHasVersion(join13(
|
|
1035
|
+
commandHasVersion: commandHasVersion(join13(path5)),
|
|
1005
1036
|
/**
|
|
1006
1037
|
* ================================
|
|
1007
1038
|
* Queries
|
|
@@ -1013,13 +1044,13 @@ var index_default = (path4) => {
|
|
|
1013
1044
|
* @param version - Optional id of the version to get (supports semver)
|
|
1014
1045
|
* @returns Query|Undefined
|
|
1015
1046
|
*/
|
|
1016
|
-
getQuery: getQuery(join13(
|
|
1047
|
+
getQuery: getQuery(join13(path5)),
|
|
1017
1048
|
/**
|
|
1018
1049
|
* Returns all queries from EventCatalog
|
|
1019
1050
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1020
1051
|
* @returns Query[]|Undefined
|
|
1021
1052
|
*/
|
|
1022
|
-
getQueries: getQueries(join13(
|
|
1053
|
+
getQueries: getQueries(join13(path5)),
|
|
1023
1054
|
/**
|
|
1024
1055
|
* Adds a query to EventCatalog
|
|
1025
1056
|
*
|
|
@@ -1027,7 +1058,7 @@ var index_default = (path4) => {
|
|
|
1027
1058
|
* @param options - Optional options to write the event
|
|
1028
1059
|
*
|
|
1029
1060
|
*/
|
|
1030
|
-
writeQuery: writeQuery(join13(
|
|
1061
|
+
writeQuery: writeQuery(join13(path5, "queries")),
|
|
1031
1062
|
/**
|
|
1032
1063
|
* Adds a query to a service in EventCatalog
|
|
1033
1064
|
*
|
|
@@ -1036,26 +1067,26 @@ var index_default = (path4) => {
|
|
|
1036
1067
|
* @param options - Optional options to write the query
|
|
1037
1068
|
*
|
|
1038
1069
|
*/
|
|
1039
|
-
writeQueryToService: writeQueryToService(join13(
|
|
1070
|
+
writeQueryToService: writeQueryToService(join13(path5)),
|
|
1040
1071
|
/**
|
|
1041
1072
|
* Remove an query to EventCatalog (modeled on the standard POSIX rm utility)
|
|
1042
1073
|
*
|
|
1043
1074
|
* @param path - The path to your query, e.g. `/Orders/GetOrder`
|
|
1044
1075
|
*
|
|
1045
1076
|
*/
|
|
1046
|
-
rmQuery: rmQuery(join13(
|
|
1077
|
+
rmQuery: rmQuery(join13(path5, "queries")),
|
|
1047
1078
|
/**
|
|
1048
1079
|
* Remove a query by a Query id
|
|
1049
1080
|
*
|
|
1050
1081
|
* @param id - The id of the query you want to remove
|
|
1051
1082
|
*
|
|
1052
1083
|
*/
|
|
1053
|
-
rmQueryById: rmQueryById(join13(
|
|
1084
|
+
rmQueryById: rmQueryById(join13(path5)),
|
|
1054
1085
|
/**
|
|
1055
1086
|
* Moves a given query id to the version directory
|
|
1056
1087
|
* @param directory
|
|
1057
1088
|
*/
|
|
1058
|
-
versionQuery: versionQuery(join13(
|
|
1089
|
+
versionQuery: versionQuery(join13(path5)),
|
|
1059
1090
|
/**
|
|
1060
1091
|
* Adds a file to the given query
|
|
1061
1092
|
* @param id - The id of the query to add the file to
|
|
@@ -1063,7 +1094,7 @@ var index_default = (path4) => {
|
|
|
1063
1094
|
* @param version - Optional version of the query to add the file to
|
|
1064
1095
|
* @returns
|
|
1065
1096
|
*/
|
|
1066
|
-
addFileToQuery: addFileToQuery(join13(
|
|
1097
|
+
addFileToQuery: addFileToQuery(join13(path5)),
|
|
1067
1098
|
/**
|
|
1068
1099
|
* Adds a schema to the given query
|
|
1069
1100
|
* @param id - The id of the query to add the schema to
|
|
@@ -1071,14 +1102,14 @@ var index_default = (path4) => {
|
|
|
1071
1102
|
* @param version - Optional version of the query to add the schema to
|
|
1072
1103
|
* @returns
|
|
1073
1104
|
*/
|
|
1074
|
-
addSchemaToQuery: addSchemaToQuery(join13(
|
|
1105
|
+
addSchemaToQuery: addSchemaToQuery(join13(path5)),
|
|
1075
1106
|
/**
|
|
1076
1107
|
* Check to see if an query version exists
|
|
1077
1108
|
* @param id - The id of the query
|
|
1078
1109
|
* @param version - The version of the query (supports semver)
|
|
1079
1110
|
* @returns
|
|
1080
1111
|
*/
|
|
1081
|
-
queryHasVersion: queryHasVersion(join13(
|
|
1112
|
+
queryHasVersion: queryHasVersion(join13(path5)),
|
|
1082
1113
|
/**
|
|
1083
1114
|
* ================================
|
|
1084
1115
|
* Channels
|
|
@@ -1090,13 +1121,13 @@ var index_default = (path4) => {
|
|
|
1090
1121
|
* @param version - Optional id of the version to get (supports semver)
|
|
1091
1122
|
* @returns Channel|Undefined
|
|
1092
1123
|
*/
|
|
1093
|
-
getChannel: getChannel(join13(
|
|
1124
|
+
getChannel: getChannel(join13(path5)),
|
|
1094
1125
|
/**
|
|
1095
1126
|
* Returns all channels from EventCatalog
|
|
1096
1127
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1097
1128
|
* @returns Channel[]|Undefined
|
|
1098
1129
|
*/
|
|
1099
|
-
getChannels: getChannels(join13(
|
|
1130
|
+
getChannels: getChannels(join13(path5)),
|
|
1100
1131
|
/**
|
|
1101
1132
|
* Adds an channel to EventCatalog
|
|
1102
1133
|
*
|
|
@@ -1104,33 +1135,33 @@ var index_default = (path4) => {
|
|
|
1104
1135
|
* @param options - Optional options to write the channel
|
|
1105
1136
|
*
|
|
1106
1137
|
*/
|
|
1107
|
-
writeChannel: writeChannel(join13(
|
|
1138
|
+
writeChannel: writeChannel(join13(path5, "channels")),
|
|
1108
1139
|
/**
|
|
1109
1140
|
* Remove an channel to EventCatalog (modeled on the standard POSIX rm utility)
|
|
1110
1141
|
*
|
|
1111
1142
|
* @param path - The path to your channel, e.g. `/Inventory/InventoryAdjusted`
|
|
1112
1143
|
*
|
|
1113
1144
|
*/
|
|
1114
|
-
rmChannel: rmChannel(join13(
|
|
1145
|
+
rmChannel: rmChannel(join13(path5, "channels")),
|
|
1115
1146
|
/**
|
|
1116
1147
|
* Remove an channel by an Event id
|
|
1117
1148
|
*
|
|
1118
1149
|
* @param id - The id of the channel you want to remove
|
|
1119
1150
|
*
|
|
1120
1151
|
*/
|
|
1121
|
-
rmChannelById: rmChannelById(join13(
|
|
1152
|
+
rmChannelById: rmChannelById(join13(path5)),
|
|
1122
1153
|
/**
|
|
1123
1154
|
* Moves a given channel id to the version directory
|
|
1124
1155
|
* @param directory
|
|
1125
1156
|
*/
|
|
1126
|
-
versionChannel: versionChannel(join13(
|
|
1157
|
+
versionChannel: versionChannel(join13(path5)),
|
|
1127
1158
|
/**
|
|
1128
1159
|
* Check to see if a channel version exists
|
|
1129
1160
|
* @param id - The id of the channel
|
|
1130
1161
|
* @param version - The version of the channel (supports semver)
|
|
1131
1162
|
* @returns
|
|
1132
1163
|
*/
|
|
1133
|
-
channelHasVersion: channelHasVersion(join13(
|
|
1164
|
+
channelHasVersion: channelHasVersion(join13(path5)),
|
|
1134
1165
|
/**
|
|
1135
1166
|
* Add a channel to an event
|
|
1136
1167
|
*
|
|
@@ -1147,7 +1178,7 @@ var index_default = (path4) => {
|
|
|
1147
1178
|
*
|
|
1148
1179
|
* ```
|
|
1149
1180
|
*/
|
|
1150
|
-
addEventToChannel: addMessageToChannel(join13(
|
|
1181
|
+
addEventToChannel: addMessageToChannel(join13(path5), "events"),
|
|
1151
1182
|
/**
|
|
1152
1183
|
* Add a channel to an command
|
|
1153
1184
|
*
|
|
@@ -1164,7 +1195,7 @@ var index_default = (path4) => {
|
|
|
1164
1195
|
*
|
|
1165
1196
|
* ```
|
|
1166
1197
|
*/
|
|
1167
|
-
addCommandToChannel: addMessageToChannel(join13(
|
|
1198
|
+
addCommandToChannel: addMessageToChannel(join13(path5), "commands"),
|
|
1168
1199
|
/**
|
|
1169
1200
|
* Add a channel to an query
|
|
1170
1201
|
*
|
|
@@ -1181,7 +1212,7 @@ var index_default = (path4) => {
|
|
|
1181
1212
|
*
|
|
1182
1213
|
* ```
|
|
1183
1214
|
*/
|
|
1184
|
-
addQueryToChannel: addMessageToChannel(join13(
|
|
1215
|
+
addQueryToChannel: addMessageToChannel(join13(path5), "queries"),
|
|
1185
1216
|
/**
|
|
1186
1217
|
* ================================
|
|
1187
1218
|
* SERVICES
|
|
@@ -1194,14 +1225,14 @@ var index_default = (path4) => {
|
|
|
1194
1225
|
* @param options - Optional options to write the event
|
|
1195
1226
|
*
|
|
1196
1227
|
*/
|
|
1197
|
-
writeService: writeService(join13(
|
|
1228
|
+
writeService: writeService(join13(path5, "services")),
|
|
1198
1229
|
/**
|
|
1199
1230
|
* Adds a versioned service to EventCatalog
|
|
1200
1231
|
*
|
|
1201
1232
|
* @param service - The service to write
|
|
1202
1233
|
*
|
|
1203
1234
|
*/
|
|
1204
|
-
writeVersionedService: writeVersionedService(join13(
|
|
1235
|
+
writeVersionedService: writeVersionedService(join13(path5, "services")),
|
|
1205
1236
|
/**
|
|
1206
1237
|
* Adds a service to a domain in EventCatalog
|
|
1207
1238
|
*
|
|
@@ -1210,39 +1241,45 @@ var index_default = (path4) => {
|
|
|
1210
1241
|
* @param options - Optional options to write the event
|
|
1211
1242
|
*
|
|
1212
1243
|
*/
|
|
1213
|
-
writeServiceToDomain: writeServiceToDomain(join13(
|
|
1244
|
+
writeServiceToDomain: writeServiceToDomain(join13(path5, "domains")),
|
|
1214
1245
|
/**
|
|
1215
1246
|
* Returns a service from EventCatalog
|
|
1216
1247
|
* @param id - The id of the service to retrieve
|
|
1217
1248
|
* @param version - Optional id of the version to get (supports semver)
|
|
1218
1249
|
* @returns Service|Undefined
|
|
1219
1250
|
*/
|
|
1220
|
-
getService: getService(join13(
|
|
1251
|
+
getService: getService(join13(path5)),
|
|
1252
|
+
/**
|
|
1253
|
+
* Returns a service from EventCatalog by it's path.
|
|
1254
|
+
* @param path - The path to the service to retrieve
|
|
1255
|
+
* @returns Service|Undefined
|
|
1256
|
+
*/
|
|
1257
|
+
getServiceByPath: getServiceByPath(join13(path5)),
|
|
1221
1258
|
/**
|
|
1222
1259
|
* Returns all services from EventCatalog
|
|
1223
1260
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1224
1261
|
* @returns Service[]|Undefined
|
|
1225
1262
|
*/
|
|
1226
|
-
getServices: getServices(join13(
|
|
1263
|
+
getServices: getServices(join13(path5)),
|
|
1227
1264
|
/**
|
|
1228
1265
|
* Moves a given service id to the version directory
|
|
1229
1266
|
* @param directory
|
|
1230
1267
|
*/
|
|
1231
|
-
versionService: versionService(join13(
|
|
1268
|
+
versionService: versionService(join13(path5)),
|
|
1232
1269
|
/**
|
|
1233
1270
|
* Remove a service from EventCatalog (modeled on the standard POSIX rm utility)
|
|
1234
1271
|
*
|
|
1235
1272
|
* @param path - The path to your service, e.g. `/InventoryService`
|
|
1236
1273
|
*
|
|
1237
1274
|
*/
|
|
1238
|
-
rmService: rmService(join13(
|
|
1275
|
+
rmService: rmService(join13(path5, "services")),
|
|
1239
1276
|
/**
|
|
1240
1277
|
* Remove an service by an service id
|
|
1241
1278
|
*
|
|
1242
1279
|
* @param id - The id of the service you want to remove
|
|
1243
1280
|
*
|
|
1244
1281
|
*/
|
|
1245
|
-
rmServiceById: rmServiceById(join13(
|
|
1282
|
+
rmServiceById: rmServiceById(join13(path5)),
|
|
1246
1283
|
/**
|
|
1247
1284
|
* Adds a file to the given service
|
|
1248
1285
|
* @param id - The id of the service to add the file to
|
|
@@ -1250,21 +1287,21 @@ var index_default = (path4) => {
|
|
|
1250
1287
|
* @param version - Optional version of the service to add the file to
|
|
1251
1288
|
* @returns
|
|
1252
1289
|
*/
|
|
1253
|
-
addFileToService: addFileToService(join13(
|
|
1290
|
+
addFileToService: addFileToService(join13(path5)),
|
|
1254
1291
|
/**
|
|
1255
1292
|
* Returns the specifications for a given service
|
|
1256
1293
|
* @param id - The id of the service to retrieve the specifications for
|
|
1257
1294
|
* @param version - Optional version of the service
|
|
1258
1295
|
* @returns
|
|
1259
1296
|
*/
|
|
1260
|
-
getSpecificationFilesForService: getSpecificationFilesForService(join13(
|
|
1297
|
+
getSpecificationFilesForService: getSpecificationFilesForService(join13(path5)),
|
|
1261
1298
|
/**
|
|
1262
1299
|
* Check to see if a service version exists
|
|
1263
1300
|
* @param id - The id of the service
|
|
1264
1301
|
* @param version - The version of the service (supports semver)
|
|
1265
1302
|
* @returns
|
|
1266
1303
|
*/
|
|
1267
|
-
serviceHasVersion: serviceHasVersion(join13(
|
|
1304
|
+
serviceHasVersion: serviceHasVersion(join13(path5)),
|
|
1268
1305
|
/**
|
|
1269
1306
|
* Add an event to a service by it's id.
|
|
1270
1307
|
*
|
|
@@ -1284,7 +1321,7 @@ var index_default = (path4) => {
|
|
|
1284
1321
|
*
|
|
1285
1322
|
* ```
|
|
1286
1323
|
*/
|
|
1287
|
-
addEventToService: addMessageToService(join13(
|
|
1324
|
+
addEventToService: addMessageToService(join13(path5)),
|
|
1288
1325
|
/**
|
|
1289
1326
|
* Add a command to a service by it's id.
|
|
1290
1327
|
*
|
|
@@ -1304,7 +1341,7 @@ var index_default = (path4) => {
|
|
|
1304
1341
|
*
|
|
1305
1342
|
* ```
|
|
1306
1343
|
*/
|
|
1307
|
-
addCommandToService: addMessageToService(join13(
|
|
1344
|
+
addCommandToService: addMessageToService(join13(path5)),
|
|
1308
1345
|
/**
|
|
1309
1346
|
* Add a query to a service by it's id.
|
|
1310
1347
|
*
|
|
@@ -1324,7 +1361,24 @@ var index_default = (path4) => {
|
|
|
1324
1361
|
*
|
|
1325
1362
|
* ```
|
|
1326
1363
|
*/
|
|
1327
|
-
addQueryToService: addMessageToService(join13(
|
|
1364
|
+
addQueryToService: addMessageToService(join13(path5)),
|
|
1365
|
+
/**
|
|
1366
|
+
* Check to see if a service exists by it's path.
|
|
1367
|
+
*
|
|
1368
|
+
* @example
|
|
1369
|
+
* ```ts
|
|
1370
|
+
* import utils from '@eventcatalog/utils';
|
|
1371
|
+
*
|
|
1372
|
+
* const { isService } = utils('/path/to/eventcatalog');
|
|
1373
|
+
*
|
|
1374
|
+
* // returns true if the path is a service
|
|
1375
|
+
* await isService('/services/InventoryService/index.mdx');
|
|
1376
|
+
* ```
|
|
1377
|
+
*
|
|
1378
|
+
* @param path - The path to the service to check
|
|
1379
|
+
* @returns boolean
|
|
1380
|
+
*/
|
|
1381
|
+
isService: isService(join13(path5)),
|
|
1328
1382
|
/**
|
|
1329
1383
|
* ================================
|
|
1330
1384
|
* Domains
|
|
@@ -1337,39 +1391,39 @@ var index_default = (path4) => {
|
|
|
1337
1391
|
* @param options - Optional options to write the event
|
|
1338
1392
|
*
|
|
1339
1393
|
*/
|
|
1340
|
-
writeDomain: writeDomain(join13(
|
|
1394
|
+
writeDomain: writeDomain(join13(path5, "domains")),
|
|
1341
1395
|
/**
|
|
1342
1396
|
* Returns a domain from EventCatalog
|
|
1343
1397
|
* @param id - The id of the domain to retrieve
|
|
1344
1398
|
* @param version - Optional id of the version to get (supports semver)
|
|
1345
1399
|
* @returns Domain|Undefined
|
|
1346
1400
|
*/
|
|
1347
|
-
getDomain: getDomain(join13(
|
|
1401
|
+
getDomain: getDomain(join13(path5, "domains")),
|
|
1348
1402
|
/**
|
|
1349
1403
|
* Returns all domains from EventCatalog
|
|
1350
1404
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1351
1405
|
* @returns Domain[]|Undefined
|
|
1352
1406
|
*/
|
|
1353
|
-
getDomains: getDomains(join13(
|
|
1407
|
+
getDomains: getDomains(join13(path5)),
|
|
1354
1408
|
/**
|
|
1355
1409
|
* Moves a given domain id to the version directory
|
|
1356
1410
|
* @param directory
|
|
1357
1411
|
*/
|
|
1358
|
-
versionDomain: versionDomain(join13(
|
|
1412
|
+
versionDomain: versionDomain(join13(path5, "domains")),
|
|
1359
1413
|
/**
|
|
1360
1414
|
* Remove a domain from EventCatalog (modeled on the standard POSIX rm utility)
|
|
1361
1415
|
*
|
|
1362
1416
|
* @param path - The path to your domain, e.g. `/Payment`
|
|
1363
1417
|
*
|
|
1364
1418
|
*/
|
|
1365
|
-
rmDomain: rmDomain(join13(
|
|
1419
|
+
rmDomain: rmDomain(join13(path5, "domains")),
|
|
1366
1420
|
/**
|
|
1367
1421
|
* Remove an service by an domain id
|
|
1368
1422
|
*
|
|
1369
1423
|
* @param id - The id of the domain you want to remove
|
|
1370
1424
|
*
|
|
1371
1425
|
*/
|
|
1372
|
-
rmDomainById: rmDomainById(join13(
|
|
1426
|
+
rmDomainById: rmDomainById(join13(path5, "domains")),
|
|
1373
1427
|
/**
|
|
1374
1428
|
* Adds a file to the given domain
|
|
1375
1429
|
* @param id - The id of the domain to add the file to
|
|
@@ -1377,28 +1431,28 @@ var index_default = (path4) => {
|
|
|
1377
1431
|
* @param version - Optional version of the domain to add the file to
|
|
1378
1432
|
* @returns
|
|
1379
1433
|
*/
|
|
1380
|
-
addFileToDomain: addFileToDomain(join13(
|
|
1434
|
+
addFileToDomain: addFileToDomain(join13(path5, "domains")),
|
|
1381
1435
|
/**
|
|
1382
1436
|
* Adds an ubiquitous language dictionary to a domain
|
|
1383
1437
|
* @param id - The id of the domain to add the ubiquitous language to
|
|
1384
1438
|
* @param ubiquitousLanguageDictionary - The ubiquitous language dictionary to add
|
|
1385
1439
|
* @param version - Optional version of the domain to add the ubiquitous language to
|
|
1386
1440
|
*/
|
|
1387
|
-
addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain(join13(
|
|
1441
|
+
addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain(join13(path5, "domains")),
|
|
1388
1442
|
/**
|
|
1389
1443
|
* Get the ubiquitous language dictionary from a domain
|
|
1390
1444
|
* @param id - The id of the domain to get the ubiquitous language from
|
|
1391
1445
|
* @param version - Optional version of the domain to get the ubiquitous language from
|
|
1392
1446
|
* @returns
|
|
1393
1447
|
*/
|
|
1394
|
-
getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain(join13(
|
|
1448
|
+
getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain(join13(path5, "domains")),
|
|
1395
1449
|
/**
|
|
1396
1450
|
* Check to see if a domain version exists
|
|
1397
1451
|
* @param id - The id of the domain
|
|
1398
1452
|
* @param version - The version of the domain (supports semver)
|
|
1399
1453
|
* @returns
|
|
1400
1454
|
*/
|
|
1401
|
-
domainHasVersion: domainHasVersion(join13(
|
|
1455
|
+
domainHasVersion: domainHasVersion(join13(path5)),
|
|
1402
1456
|
/**
|
|
1403
1457
|
* Adds a given service to a domain
|
|
1404
1458
|
* @param id - The id of the domain
|
|
@@ -1406,7 +1460,7 @@ var index_default = (path4) => {
|
|
|
1406
1460
|
* @param version - (Optional) The version of the domain to add the service to
|
|
1407
1461
|
* @returns
|
|
1408
1462
|
*/
|
|
1409
|
-
addServiceToDomain: addServiceToDomain(join13(
|
|
1463
|
+
addServiceToDomain: addServiceToDomain(join13(path5, "domains")),
|
|
1410
1464
|
/**
|
|
1411
1465
|
* Adds a given subdomain to a domain
|
|
1412
1466
|
* @param id - The id of the domain
|
|
@@ -1414,7 +1468,7 @@ var index_default = (path4) => {
|
|
|
1414
1468
|
* @param version - (Optional) The version of the domain to add the subdomain to
|
|
1415
1469
|
* @returns
|
|
1416
1470
|
*/
|
|
1417
|
-
addSubDomainToDomain: addSubDomainToDomain(join13(
|
|
1471
|
+
addSubDomainToDomain: addSubDomainToDomain(join13(path5, "domains")),
|
|
1418
1472
|
/**
|
|
1419
1473
|
* ================================
|
|
1420
1474
|
* Teams
|
|
@@ -1427,25 +1481,25 @@ var index_default = (path4) => {
|
|
|
1427
1481
|
* @param options - Optional options to write the team
|
|
1428
1482
|
*
|
|
1429
1483
|
*/
|
|
1430
|
-
writeTeam: writeTeam(join13(
|
|
1484
|
+
writeTeam: writeTeam(join13(path5, "teams")),
|
|
1431
1485
|
/**
|
|
1432
1486
|
* Returns a team from EventCatalog
|
|
1433
1487
|
* @param id - The id of the team to retrieve
|
|
1434
1488
|
* @returns Team|Undefined
|
|
1435
1489
|
*/
|
|
1436
|
-
getTeam: getTeam(join13(
|
|
1490
|
+
getTeam: getTeam(join13(path5, "teams")),
|
|
1437
1491
|
/**
|
|
1438
1492
|
* Returns all teams from EventCatalog
|
|
1439
1493
|
* @returns Team[]|Undefined
|
|
1440
1494
|
*/
|
|
1441
|
-
getTeams: getTeams(join13(
|
|
1495
|
+
getTeams: getTeams(join13(path5, "teams")),
|
|
1442
1496
|
/**
|
|
1443
1497
|
* Remove a team by the team id
|
|
1444
1498
|
*
|
|
1445
1499
|
* @param id - The id of the team you want to remove
|
|
1446
1500
|
*
|
|
1447
1501
|
*/
|
|
1448
|
-
rmTeamById: rmTeamById(join13(
|
|
1502
|
+
rmTeamById: rmTeamById(join13(path5, "teams")),
|
|
1449
1503
|
/**
|
|
1450
1504
|
* ================================
|
|
1451
1505
|
* Users
|
|
@@ -1458,25 +1512,25 @@ var index_default = (path4) => {
|
|
|
1458
1512
|
* @param options - Optional options to write the user
|
|
1459
1513
|
*
|
|
1460
1514
|
*/
|
|
1461
|
-
writeUser: writeUser(join13(
|
|
1515
|
+
writeUser: writeUser(join13(path5, "users")),
|
|
1462
1516
|
/**
|
|
1463
1517
|
* Returns a user from EventCatalog
|
|
1464
1518
|
* @param id - The id of the user to retrieve
|
|
1465
1519
|
* @returns User|Undefined
|
|
1466
1520
|
*/
|
|
1467
|
-
getUser: getUser(join13(
|
|
1521
|
+
getUser: getUser(join13(path5, "users")),
|
|
1468
1522
|
/**
|
|
1469
1523
|
* Returns all user from EventCatalog
|
|
1470
1524
|
* @returns User[]|Undefined
|
|
1471
1525
|
*/
|
|
1472
|
-
getUsers: getUsers(join13(
|
|
1526
|
+
getUsers: getUsers(join13(path5)),
|
|
1473
1527
|
/**
|
|
1474
1528
|
* Remove a user by the user id
|
|
1475
1529
|
*
|
|
1476
1530
|
* @param id - The id of the user you want to remove
|
|
1477
1531
|
*
|
|
1478
1532
|
*/
|
|
1479
|
-
rmUserById: rmUserById(join13(
|
|
1533
|
+
rmUserById: rmUserById(join13(path5, "users")),
|
|
1480
1534
|
/**
|
|
1481
1535
|
* ================================
|
|
1482
1536
|
* Custom Docs
|
|
@@ -1487,32 +1541,32 @@ var index_default = (path4) => {
|
|
|
1487
1541
|
* @param path - The path to the custom doc to retrieve
|
|
1488
1542
|
* @returns CustomDoc|Undefined
|
|
1489
1543
|
*/
|
|
1490
|
-
getCustomDoc: getCustomDoc(join13(
|
|
1544
|
+
getCustomDoc: getCustomDoc(join13(path5, "docs")),
|
|
1491
1545
|
/**
|
|
1492
1546
|
* Returns all custom docs from EventCatalog
|
|
1493
1547
|
* @param options - Optional options to get custom docs from a specific path
|
|
1494
1548
|
* @returns CustomDoc[]|Undefined
|
|
1495
1549
|
*/
|
|
1496
|
-
getCustomDocs: getCustomDocs(join13(
|
|
1550
|
+
getCustomDocs: getCustomDocs(join13(path5, "docs")),
|
|
1497
1551
|
/**
|
|
1498
1552
|
* Writes a custom doc to EventCatalog
|
|
1499
1553
|
* @param customDoc - The custom doc to write
|
|
1500
1554
|
* @param options - Optional options to write the custom doc
|
|
1501
1555
|
*
|
|
1502
1556
|
*/
|
|
1503
|
-
writeCustomDoc: writeCustomDoc(join13(
|
|
1557
|
+
writeCustomDoc: writeCustomDoc(join13(path5, "docs")),
|
|
1504
1558
|
/**
|
|
1505
1559
|
* Removes a custom doc from EventCatalog
|
|
1506
1560
|
* @param path - The path to the custom doc to remove
|
|
1507
1561
|
*
|
|
1508
1562
|
*/
|
|
1509
|
-
rmCustomDoc: rmCustomDoc(join13(
|
|
1563
|
+
rmCustomDoc: rmCustomDoc(join13(path5, "docs")),
|
|
1510
1564
|
/**
|
|
1511
1565
|
* Dumps the catalog to a JSON file.
|
|
1512
1566
|
* @param directory - The directory to dump the catalog to
|
|
1513
1567
|
* @returns A JSON file with the catalog
|
|
1514
1568
|
*/
|
|
1515
|
-
dumpCatalog: dumpCatalog(join13(
|
|
1569
|
+
dumpCatalog: dumpCatalog(join13(path5)),
|
|
1516
1570
|
/**
|
|
1517
1571
|
* Returns the event catalog configuration file.
|
|
1518
1572
|
* The event catalog configuration file is the file that contains the configuration for the event catalog.
|
|
@@ -1520,7 +1574,7 @@ var index_default = (path4) => {
|
|
|
1520
1574
|
* @param directory - The directory of the catalog.
|
|
1521
1575
|
* @returns A JSON object with the configuration for the event catalog.
|
|
1522
1576
|
*/
|
|
1523
|
-
getEventCatalogConfigurationFile: getEventCatalogConfigurationFile(join13(
|
|
1577
|
+
getEventCatalogConfigurationFile: getEventCatalogConfigurationFile(join13(path5)),
|
|
1524
1578
|
/**
|
|
1525
1579
|
* ================================
|
|
1526
1580
|
* Resources Utils
|
|
@@ -1541,14 +1595,21 @@ var index_default = (path4) => {
|
|
|
1541
1595
|
* @param path - The path to the message to retrieve
|
|
1542
1596
|
* @returns Message|Undefined
|
|
1543
1597
|
*/
|
|
1544
|
-
getMessageBySchemaPath: getMessageBySchemaPath(join13(
|
|
1598
|
+
getMessageBySchemaPath: getMessageBySchemaPath(join13(path5)),
|
|
1545
1599
|
/**
|
|
1546
1600
|
* Returns the producers and consumers (services) for a given message
|
|
1547
1601
|
* @param id - The id of the message to get the producers and consumers for
|
|
1548
1602
|
* @param version - Optional version of the message
|
|
1549
1603
|
* @returns { producers: Service[], consumers: Service[] }
|
|
1550
1604
|
*/
|
|
1551
|
-
getProducersAndConsumersForMessage: getProducersAndConsumersForMessage(join13(
|
|
1605
|
+
getProducersAndConsumersForMessage: getProducersAndConsumersForMessage(join13(path5)),
|
|
1606
|
+
/**
|
|
1607
|
+
* Returns the owners for a given resource (e.g domain, service, event, command, query, etc.)
|
|
1608
|
+
* @param id - The id of the resource to get the owners for
|
|
1609
|
+
* @param version - Optional version of the resource
|
|
1610
|
+
* @returns { owners: User[] }
|
|
1611
|
+
*/
|
|
1612
|
+
getOwnersForResource: getOwnersForResource(join13(path5))
|
|
1552
1613
|
};
|
|
1553
1614
|
};
|
|
1554
1615
|
|
|
@@ -1569,7 +1630,7 @@ var hydrateResource = async (catalogDir, resources = [], { attachSchema = false
|
|
|
1569
1630
|
const resourcePath = await getResourcePath(catalogDir, resource.id, resource.version);
|
|
1570
1631
|
let schema = "";
|
|
1571
1632
|
if (resource.schemaPath && resourcePath?.fullPath) {
|
|
1572
|
-
const pathToSchema =
|
|
1633
|
+
const pathToSchema = path4.join(path4.dirname(resourcePath?.fullPath), resource.schemaPath);
|
|
1573
1634
|
if (fs10.existsSync(pathToSchema)) {
|
|
1574
1635
|
schema = fs10.readFileSync(pathToSchema, "utf8");
|
|
1575
1636
|
}
|
|
@@ -1590,8 +1651,8 @@ var filterCollection = (collection, options) => {
|
|
|
1590
1651
|
};
|
|
1591
1652
|
var getEventCatalogConfigurationFile = (directory) => async () => {
|
|
1592
1653
|
try {
|
|
1593
|
-
const
|
|
1594
|
-
const configModule = await import(
|
|
1654
|
+
const path5 = join14(directory, "eventcatalog.config.js");
|
|
1655
|
+
const configModule = await import(path5);
|
|
1595
1656
|
return configModule.default;
|
|
1596
1657
|
} catch (error) {
|
|
1597
1658
|
console.error("Error getting event catalog configuration file", error);
|
|
@@ -1599,7 +1660,7 @@ var getEventCatalogConfigurationFile = (directory) => async () => {
|
|
|
1599
1660
|
}
|
|
1600
1661
|
};
|
|
1601
1662
|
var dumpCatalog = (directory) => async (options) => {
|
|
1602
|
-
const { getDomains: getDomains2, getServices: getServices2, getEvents: getEvents2, getQueries: getQueries2, getCommands: getCommands2, getChannels: getChannels2, getTeams: getTeams2, getUsers:
|
|
1663
|
+
const { getDomains: getDomains2, getServices: getServices2, getEvents: getEvents2, getQueries: getQueries2, getCommands: getCommands2, getChannels: getChannels2, getTeams: getTeams2, getUsers: getUsers3 } = index_default(directory);
|
|
1603
1664
|
const { includeMarkdown = true } = options || {};
|
|
1604
1665
|
const domains = await getDomains2();
|
|
1605
1666
|
const services = await getServices2();
|
|
@@ -1607,7 +1668,7 @@ var dumpCatalog = (directory) => async (options) => {
|
|
|
1607
1668
|
const commands = await getCommands2();
|
|
1608
1669
|
const queries = await getQueries2();
|
|
1609
1670
|
const teams = await getTeams2();
|
|
1610
|
-
const users = await
|
|
1671
|
+
const users = await getUsers3();
|
|
1611
1672
|
const channels = await getChannels2();
|
|
1612
1673
|
const [
|
|
1613
1674
|
hydratedDomains,
|