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