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