@eventcatalog/sdk 2.8.2 → 2.8.4
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 +19 -18
- package/dist/channels.js.map +1 -1
- package/dist/channels.mjs +14 -13
- package/dist/channels.mjs.map +1 -1
- package/dist/commands.js +14 -13
- package/dist/commands.js.map +1 -1
- package/dist/commands.mjs +12 -11
- package/dist/commands.mjs.map +1 -1
- package/dist/containers.js +14 -13
- package/dist/containers.js.map +1 -1
- package/dist/containers.mjs +12 -11
- package/dist/containers.mjs.map +1 -1
- package/dist/custom-docs.js +8 -7
- package/dist/custom-docs.js.map +1 -1
- package/dist/custom-docs.mjs +7 -6
- package/dist/custom-docs.mjs.map +1 -1
- package/dist/data-stores.js +14 -13
- package/dist/data-stores.js.map +1 -1
- package/dist/data-stores.mjs +12 -11
- package/dist/data-stores.mjs.map +1 -1
- package/dist/domains.js +19 -18
- package/dist/domains.js.map +1 -1
- package/dist/domains.mjs +19 -18
- package/dist/domains.mjs.map +1 -1
- package/dist/entities.js +13 -12
- package/dist/entities.js.map +1 -1
- package/dist/entities.mjs +12 -11
- package/dist/entities.mjs.map +1 -1
- package/dist/eventcatalog.js +260 -197
- package/dist/eventcatalog.js.map +1 -1
- package/dist/eventcatalog.mjs +232 -169
- package/dist/eventcatalog.mjs.map +1 -1
- package/dist/events.js +14 -13
- package/dist/events.js.map +1 -1
- package/dist/events.mjs +12 -11
- package/dist/events.mjs.map +1 -1
- package/dist/index.d.mts +26 -12
- package/dist/index.d.ts +26 -12
- package/dist/index.js +260 -197
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +232 -169
- package/dist/index.mjs.map +1 -1
- package/dist/messages.js +13 -12
- package/dist/messages.js.map +1 -1
- package/dist/messages.mjs +11 -10
- package/dist/messages.mjs.map +1 -1
- package/dist/queries.js +14 -13
- package/dist/queries.js.map +1 -1
- package/dist/queries.mjs +12 -11
- package/dist/queries.mjs.map +1 -1
- package/dist/services.d.mts +25 -1
- package/dist/services.d.ts +25 -1
- package/dist/services.js +66 -27
- package/dist/services.js.map +1 -1
- package/dist/services.mjs +60 -22
- package/dist/services.mjs.map +1 -1
- package/dist/teams.js +13 -12
- package/dist/teams.js.map +1 -1
- package/dist/teams.mjs +8 -7
- package/dist/teams.mjs.map +1 -1
- package/dist/types.d.d.mts +2 -0
- package/dist/types.d.d.ts +2 -0
- package/dist/types.d.js.map +1 -1
- package/package.json +2 -2
package/dist/eventcatalog.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/eventcatalog.ts
|
|
2
2
|
import fs12 from "fs";
|
|
3
|
-
import
|
|
3
|
+
import path5, { join as join16 } from "path";
|
|
4
4
|
|
|
5
5
|
// src/index.ts
|
|
6
6
|
import { join as join15 } from "path";
|
|
@@ -24,13 +24,13 @@ var versionExists = async (catalogDir, id, version) => {
|
|
|
24
24
|
var findFileById = async (catalogDir, id, version) => {
|
|
25
25
|
const files = await getFiles(`${catalogDir}/**/index.{md,mdx}`);
|
|
26
26
|
const matchedFiles = await searchFilesForId(files, id) || [];
|
|
27
|
-
const latestVersion = matchedFiles.find((
|
|
27
|
+
const latestVersion = matchedFiles.find((path6) => !path6.includes("versioned"));
|
|
28
28
|
if (!version) {
|
|
29
29
|
return latestVersion;
|
|
30
30
|
}
|
|
31
|
-
const parsedFiles = matchedFiles.map((
|
|
32
|
-
const { data } = matter.read(
|
|
33
|
-
return { ...data, path:
|
|
31
|
+
const parsedFiles = matchedFiles.map((path6) => {
|
|
32
|
+
const { data } = matter.read(path6);
|
|
33
|
+
return { ...data, path: path6 };
|
|
34
34
|
});
|
|
35
35
|
const semverRange = validRange(version);
|
|
36
36
|
if (semverRange && valid(version)) {
|
|
@@ -71,8 +71,8 @@ var getFiles = async (pattern, ignore = "") => {
|
|
|
71
71
|
);
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
|
-
var readMdxFile = async (
|
|
75
|
-
const { data } = matter.read(
|
|
74
|
+
var readMdxFile = async (path6) => {
|
|
75
|
+
const { data } = matter.read(path6);
|
|
76
76
|
const { markdown, ...frontmatter } = data;
|
|
77
77
|
return { ...frontmatter, markdown };
|
|
78
78
|
};
|
|
@@ -125,6 +125,7 @@ import fsSync2 from "fs";
|
|
|
125
125
|
import { satisfies as satisfies2 } from "semver";
|
|
126
126
|
import { lock, unlock } from "proper-lockfile";
|
|
127
127
|
import { basename as basename2 } from "path";
|
|
128
|
+
import path from "path";
|
|
128
129
|
var versionResource = async (catalogDir, id) => {
|
|
129
130
|
const files = await getFiles(`${catalogDir}/**/index.{md,mdx}`);
|
|
130
131
|
const matchedFiles = await searchFilesForId(files, id);
|
|
@@ -164,8 +165,8 @@ var writeResource = async (catalogDir, resource, options = {
|
|
|
164
165
|
versionExistingContent: false,
|
|
165
166
|
format: "mdx"
|
|
166
167
|
}) => {
|
|
167
|
-
const
|
|
168
|
-
const fullPath = join2(catalogDir,
|
|
168
|
+
const path6 = options.path || `/${resource.id}`;
|
|
169
|
+
const fullPath = join2(catalogDir, path6);
|
|
169
170
|
const format = options.format || "mdx";
|
|
170
171
|
fsSync2.mkdirSync(fullPath, { recursive: true });
|
|
171
172
|
const lockPath = join2(fullPath, `index.${format}`);
|
|
@@ -231,6 +232,11 @@ var getResourcePath = async (catalogDir, id, version) => {
|
|
|
231
232
|
directory: dirname2(file.replace(catalogDir, ""))
|
|
232
233
|
};
|
|
233
234
|
};
|
|
235
|
+
var getResourceFolderName = async (catalogDir, id, version) => {
|
|
236
|
+
const paths = await getResourcePath(catalogDir, id, version);
|
|
237
|
+
if (!paths) return;
|
|
238
|
+
return paths?.directory.split(path.sep).filter(Boolean).pop();
|
|
239
|
+
};
|
|
234
240
|
var toResource = async (catalogDir, rawContents) => {
|
|
235
241
|
const { data, content } = matter2(rawContents);
|
|
236
242
|
return {
|
|
@@ -292,16 +298,16 @@ var rmResourceById = async (catalogDir, id, version, options) => {
|
|
|
292
298
|
);
|
|
293
299
|
}
|
|
294
300
|
};
|
|
295
|
-
var waitForFileRemoval = async (
|
|
301
|
+
var waitForFileRemoval = async (path6, maxRetries = 50, delay = 10) => {
|
|
296
302
|
for (let i = 0; i < maxRetries; i++) {
|
|
297
303
|
try {
|
|
298
|
-
await fs.access(
|
|
304
|
+
await fs.access(path6);
|
|
299
305
|
await new Promise((resolve2) => setTimeout(resolve2, delay));
|
|
300
306
|
} catch (error) {
|
|
301
307
|
return;
|
|
302
308
|
}
|
|
303
309
|
}
|
|
304
|
-
throw new Error(`File/directory ${
|
|
310
|
+
throw new Error(`File/directory ${path6} was not removed after ${maxRetries} attempts`);
|
|
305
311
|
};
|
|
306
312
|
var addFileToResource = async (catalogDir, id, file, version) => {
|
|
307
313
|
const pathToResource = await findFileById(catalogDir, id, version);
|
|
@@ -348,8 +354,8 @@ var writeEventToService = (directory) => async (event, service, options = { path
|
|
|
348
354
|
pathForEvent = join3(pathForEvent, event.id);
|
|
349
355
|
await writeResource(directory, { ...event }, { ...options, path: pathForEvent, type: "event" });
|
|
350
356
|
};
|
|
351
|
-
var rmEvent = (directory) => async (
|
|
352
|
-
await fs2.rm(join3(directory,
|
|
357
|
+
var rmEvent = (directory) => async (path6) => {
|
|
358
|
+
await fs2.rm(join3(directory, path6), { recursive: true });
|
|
353
359
|
};
|
|
354
360
|
var rmEventById = (directory) => async (id, version, persistFiles) => {
|
|
355
361
|
await rmResourceById(directory, id, version, { type: "event", persistFiles });
|
|
@@ -384,8 +390,8 @@ var writeCommandToService = (directory) => async (command, service, options = {
|
|
|
384
390
|
pathForCommand = join4(pathForCommand, command.id);
|
|
385
391
|
await writeResource(directory, { ...command }, { ...options, path: pathForCommand, type: "command" });
|
|
386
392
|
};
|
|
387
|
-
var rmCommand = (directory) => async (
|
|
388
|
-
await fs3.rm(join4(directory,
|
|
393
|
+
var rmCommand = (directory) => async (path6) => {
|
|
394
|
+
await fs3.rm(join4(directory, path6), { recursive: true });
|
|
389
395
|
};
|
|
390
396
|
var rmCommandById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "command", persistFiles });
|
|
391
397
|
var versionCommand = (directory) => async (id) => versionResource(directory, id);
|
|
@@ -418,8 +424,8 @@ var writeQueryToService = (directory) => async (query, service, options = { path
|
|
|
418
424
|
pathForQuery = join5(pathForQuery, query.id);
|
|
419
425
|
await writeResource(directory, { ...query }, { ...options, path: pathForQuery, type: "query" });
|
|
420
426
|
};
|
|
421
|
-
var rmQuery = (directory) => async (
|
|
422
|
-
await fs4.rm(join5(directory,
|
|
427
|
+
var rmQuery = (directory) => async (path6) => {
|
|
428
|
+
await fs4.rm(join5(directory, path6), { recursive: true });
|
|
423
429
|
};
|
|
424
430
|
var rmQueryById = (directory) => async (id, version, persistFiles) => {
|
|
425
431
|
await rmResourceById(directory, id, version, { type: "query", persistFiles });
|
|
@@ -438,8 +444,8 @@ var queryHasVersion = (directory) => async (id, version) => {
|
|
|
438
444
|
import fs5 from "fs/promises";
|
|
439
445
|
import { join as join6, dirname as dirname4, extname, relative as relative2 } from "path";
|
|
440
446
|
var getService = (directory) => async (id, version) => getResource(directory, id, version, { type: "service" });
|
|
441
|
-
var getServiceByPath = (directory) => async (
|
|
442
|
-
const service = await getResource(directory, void 0, void 0, { type: "service" },
|
|
447
|
+
var getServiceByPath = (directory) => async (path6) => {
|
|
448
|
+
const service = await getResource(directory, void 0, void 0, { type: "service" }, path6);
|
|
443
449
|
return service;
|
|
444
450
|
};
|
|
445
451
|
var getServices = (directory) => async (options) => getResources(directory, {
|
|
@@ -463,8 +469,8 @@ var writeService = (directory) => async (service, options = {
|
|
|
463
469
|
};
|
|
464
470
|
var writeVersionedService = (directory) => async (service) => {
|
|
465
471
|
const resource = { ...service };
|
|
466
|
-
const
|
|
467
|
-
return await writeService(directory)(resource, { path:
|
|
472
|
+
const path6 = getVersionedDirectory(service.id, service.version);
|
|
473
|
+
return await writeService(directory)(resource, { path: path6 });
|
|
468
474
|
};
|
|
469
475
|
var writeServiceToDomain = (directory) => async (service, domain, options = { path: "", format: "mdx", override: false }) => {
|
|
470
476
|
let pathForService = domain.version && domain.version !== "latest" ? `/${domain.id}/versioned/${domain.version}/services` : `/${domain.id}/services`;
|
|
@@ -472,8 +478,8 @@ var writeServiceToDomain = (directory) => async (service, domain, options = { pa
|
|
|
472
478
|
await writeResource(directory, { ...service }, { ...options, path: pathForService, type: "service" });
|
|
473
479
|
};
|
|
474
480
|
var versionService = (directory) => async (id) => versionResource(directory, id);
|
|
475
|
-
var rmService = (directory) => async (
|
|
476
|
-
await fs5.rm(join6(directory,
|
|
481
|
+
var rmService = (directory) => async (path6) => {
|
|
482
|
+
await fs5.rm(join6(directory, path6), { recursive: true });
|
|
477
483
|
};
|
|
478
484
|
var rmServiceById = (directory) => async (id, version, persistFiles) => {
|
|
479
485
|
await rmResourceById(directory, id, version, { type: "service", persistFiles });
|
|
@@ -537,8 +543,8 @@ var addMessageToService = (directory) => async (id, direction, event, version) =
|
|
|
537
543
|
if (!existingResource) {
|
|
538
544
|
throw new Error(`Cannot find service ${id} in the catalog`);
|
|
539
545
|
}
|
|
540
|
-
const
|
|
541
|
-
const pathToResource = join6(
|
|
546
|
+
const path6 = existingResource.split(/[\\/]+services/)[0];
|
|
547
|
+
const pathToResource = join6(path6, "services");
|
|
542
548
|
await rmServiceById(directory)(id, version);
|
|
543
549
|
await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
|
|
544
550
|
};
|
|
@@ -546,9 +552,9 @@ var serviceHasVersion = (directory) => async (id, version) => {
|
|
|
546
552
|
const file = await findFileById(directory, id, version);
|
|
547
553
|
return !!file;
|
|
548
554
|
};
|
|
549
|
-
var isService = (directory) => async (
|
|
550
|
-
const service = await getServiceByPath(directory)(
|
|
551
|
-
const relativePath = relative2(directory,
|
|
555
|
+
var isService = (directory) => async (path6) => {
|
|
556
|
+
const service = await getServiceByPath(directory)(path6);
|
|
557
|
+
const relativePath = relative2(directory, path6);
|
|
552
558
|
const segments = relativePath.split(/[/\\]+/);
|
|
553
559
|
return !!service && segments.includes("services");
|
|
554
560
|
};
|
|
@@ -570,15 +576,51 @@ var addEntityToService = (directory) => async (id, entity, version) => {
|
|
|
570
576
|
if (!existingResource) {
|
|
571
577
|
throw new Error(`Cannot find service ${id} in the catalog`);
|
|
572
578
|
}
|
|
573
|
-
const
|
|
574
|
-
const pathToResource = join6(
|
|
579
|
+
const path6 = existingResource.split(/[\\/]+services/)[0];
|
|
580
|
+
const pathToResource = join6(path6, "services");
|
|
581
|
+
await rmServiceById(directory)(id, version);
|
|
582
|
+
await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
|
|
583
|
+
};
|
|
584
|
+
var addDataStoreToService = (directory) => async (id, operation, dataStore, version) => {
|
|
585
|
+
let service = await getService(directory)(id, version);
|
|
586
|
+
const servicePath = await getResourcePath(directory, id, version);
|
|
587
|
+
const extension = extname(servicePath?.fullPath || "");
|
|
588
|
+
if (operation === "writesTo") {
|
|
589
|
+
if (service.writesTo === void 0) {
|
|
590
|
+
service.writesTo = [];
|
|
591
|
+
}
|
|
592
|
+
for (let i = 0; i < service.writesTo.length; i++) {
|
|
593
|
+
if (service.writesTo[i].id === dataStore.id && service.writesTo[i].version === dataStore.version) {
|
|
594
|
+
return;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
service.writesTo.push({ id: dataStore.id, version: dataStore.version });
|
|
598
|
+
} else if (operation === "readsFrom") {
|
|
599
|
+
if (service.readsFrom === void 0) {
|
|
600
|
+
service.readsFrom = [];
|
|
601
|
+
}
|
|
602
|
+
for (let i = 0; i < service.readsFrom.length; i++) {
|
|
603
|
+
if (service.readsFrom[i].id === dataStore.id && service.readsFrom[i].version === dataStore.version) {
|
|
604
|
+
return;
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
service.readsFrom.push({ id: dataStore.id, version: dataStore.version });
|
|
608
|
+
} else {
|
|
609
|
+
throw new Error(`Operation ${operation} is invalid, only 'writesTo' and 'readsFrom' are supported`);
|
|
610
|
+
}
|
|
611
|
+
const existingResource = await findFileById(directory, id, version);
|
|
612
|
+
if (!existingResource) {
|
|
613
|
+
throw new Error(`Cannot find service ${id} in the catalog`);
|
|
614
|
+
}
|
|
615
|
+
const path6 = existingResource.split(/[\\/]+services/)[0];
|
|
616
|
+
const pathToResource = join6(path6, "services");
|
|
575
617
|
await rmServiceById(directory)(id, version);
|
|
576
618
|
await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
|
|
577
619
|
};
|
|
578
620
|
|
|
579
621
|
// src/domains.ts
|
|
580
622
|
import fs6 from "fs/promises";
|
|
581
|
-
import
|
|
623
|
+
import path2, { join as join7 } from "path";
|
|
582
624
|
import fsSync3 from "fs";
|
|
583
625
|
import matter3 from "gray-matter";
|
|
584
626
|
var getDomain = (directory) => async (id, version) => getResource(directory, id, version, { type: "domain" });
|
|
@@ -603,8 +645,8 @@ var writeDomain = (directory) => async (domain, options = {
|
|
|
603
645
|
return await writeResource(directory, resource, { ...options, type: "domain" });
|
|
604
646
|
};
|
|
605
647
|
var versionDomain = (directory) => async (id) => versionResource(directory, id);
|
|
606
|
-
var rmDomain = (directory) => async (
|
|
607
|
-
await fs6.rm(join7(directory,
|
|
648
|
+
var rmDomain = (directory) => async (path6) => {
|
|
649
|
+
await fs6.rm(join7(directory, path6), { recursive: true });
|
|
608
650
|
};
|
|
609
651
|
var rmDomainById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "domain", persistFiles });
|
|
610
652
|
var addFileToDomain = (directory) => async (id, file, version) => addFileToResource(directory, id, file, version);
|
|
@@ -616,7 +658,7 @@ var addUbiquitousLanguageToDomain = (directory) => async (id, ubiquitousLanguage
|
|
|
616
658
|
};
|
|
617
659
|
var getUbiquitousLanguageFromDomain = (directory) => async (id, version) => {
|
|
618
660
|
const pathToDomain = await findFileById(directory, id, version) || "";
|
|
619
|
-
const pathToUbiquitousLanguage =
|
|
661
|
+
const pathToUbiquitousLanguage = path2.join(path2.dirname(pathToDomain), "ubiquitous-language.mdx");
|
|
620
662
|
const fileExists = fsSync3.existsSync(pathToUbiquitousLanguage);
|
|
621
663
|
if (!fileExists) {
|
|
622
664
|
return void 0;
|
|
@@ -631,7 +673,7 @@ var domainHasVersion = (directory) => async (id, version) => {
|
|
|
631
673
|
var addServiceToDomain = (directory) => async (id, service, version) => {
|
|
632
674
|
let domain = await getDomain(directory)(id, version);
|
|
633
675
|
const domainPath = await getResourcePath(directory, id, version);
|
|
634
|
-
const extension =
|
|
676
|
+
const extension = path2.extname(domainPath?.fullPath || "");
|
|
635
677
|
if (domain.services === void 0) {
|
|
636
678
|
domain.services = [];
|
|
637
679
|
}
|
|
@@ -646,7 +688,7 @@ var addServiceToDomain = (directory) => async (id, service, version) => {
|
|
|
646
688
|
var addSubDomainToDomain = (directory) => async (id, subDomain, version) => {
|
|
647
689
|
let domain = await getDomain(directory)(id, version);
|
|
648
690
|
const domainPath = await getResourcePath(directory, id, version);
|
|
649
|
-
const extension =
|
|
691
|
+
const extension = path2.extname(domainPath?.fullPath || "");
|
|
650
692
|
if (domain.domains === void 0) {
|
|
651
693
|
domain.domains = [];
|
|
652
694
|
}
|
|
@@ -661,7 +703,7 @@ var addSubDomainToDomain = (directory) => async (id, subDomain, version) => {
|
|
|
661
703
|
var addEntityToDomain = (directory) => async (id, entity, version) => {
|
|
662
704
|
let domain = await getDomain(directory)(id, version);
|
|
663
705
|
const domainPath = await getResourcePath(directory, id, version);
|
|
664
|
-
const extension =
|
|
706
|
+
const extension = path2.extname(domainPath?.fullPath || "");
|
|
665
707
|
if (domain.entities === void 0) {
|
|
666
708
|
domain.entities = [];
|
|
667
709
|
}
|
|
@@ -680,8 +722,8 @@ import { join as join8, extname as extname2 } from "path";
|
|
|
680
722
|
var getChannel = (directory) => async (id, version) => getResource(directory, id, version, { type: "channel" });
|
|
681
723
|
var getChannels = (directory) => async (options) => getResources(directory, { type: "channels", ...options });
|
|
682
724
|
var writeChannel = (directory) => async (channel, options = { path: "" }) => writeResource(directory, { ...channel }, { ...options, type: "channel" });
|
|
683
|
-
var rmChannel = (directory) => async (
|
|
684
|
-
await fs7.rm(join8(directory,
|
|
725
|
+
var rmChannel = (directory) => async (path6) => {
|
|
726
|
+
await fs7.rm(join8(directory, path6), { recursive: true });
|
|
685
727
|
};
|
|
686
728
|
var rmChannelById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "channel", persistFiles });
|
|
687
729
|
var versionChannel = (directory) => async (id) => versionResource(directory, id);
|
|
@@ -722,8 +764,8 @@ var addMessageToChannel = (directory, collection) => async (id, _message, versio
|
|
|
722
764
|
if (!existingResource) {
|
|
723
765
|
throw new Error(`Cannot find message ${id} in the catalog`);
|
|
724
766
|
}
|
|
725
|
-
const
|
|
726
|
-
const pathToResource = join8(
|
|
767
|
+
const path6 = existingResource.split(`/[\\/]+${collection}`)[0];
|
|
768
|
+
const pathToResource = join8(path6, collection);
|
|
727
769
|
await rmMessageById(directory)(_message.id, _message.version, true);
|
|
728
770
|
await writeMessage(pathToResource)(message, { format: extension === ".md" ? "md" : "mdx" });
|
|
729
771
|
};
|
|
@@ -732,8 +774,8 @@ var addMessageToChannel = (directory, collection) => async (id, _message, versio
|
|
|
732
774
|
import { dirname as dirname5 } from "path";
|
|
733
775
|
import matter4 from "gray-matter";
|
|
734
776
|
import { satisfies as satisfies3, validRange as validRange2 } from "semver";
|
|
735
|
-
var getMessageBySchemaPath = (directory) => async (
|
|
736
|
-
const pathToMessage = dirname5(
|
|
777
|
+
var getMessageBySchemaPath = (directory) => async (path6, options) => {
|
|
778
|
+
const pathToMessage = dirname5(path6);
|
|
737
779
|
try {
|
|
738
780
|
const files = await getFiles(`${directory}/${pathToMessage}/index.{md,mdx}`);
|
|
739
781
|
if (!files || files.length === 0) {
|
|
@@ -805,18 +847,18 @@ var getProducersAndConsumersForMessage = (directory) => async (id, version, opti
|
|
|
805
847
|
}
|
|
806
848
|
return { producers, consumers };
|
|
807
849
|
};
|
|
808
|
-
var getConsumersOfSchema = (directory) => async (
|
|
850
|
+
var getConsumersOfSchema = (directory) => async (path6) => {
|
|
809
851
|
try {
|
|
810
|
-
const message = await getMessageBySchemaPath(directory)(
|
|
852
|
+
const message = await getMessageBySchemaPath(directory)(path6);
|
|
811
853
|
const { consumers } = await getProducersAndConsumersForMessage(directory)(message.id, message.version);
|
|
812
854
|
return consumers;
|
|
813
855
|
} catch (error) {
|
|
814
856
|
return [];
|
|
815
857
|
}
|
|
816
858
|
};
|
|
817
|
-
var getProducersOfSchema = (directory) => async (
|
|
859
|
+
var getProducersOfSchema = (directory) => async (path6) => {
|
|
818
860
|
try {
|
|
819
|
-
const message = await getMessageBySchemaPath(directory)(
|
|
861
|
+
const message = await getMessageBySchemaPath(directory)(path6);
|
|
820
862
|
const { producers } = await getProducersAndConsumersForMessage(directory)(message.id, message.version);
|
|
821
863
|
return producers;
|
|
822
864
|
} catch (error) {
|
|
@@ -825,13 +867,13 @@ var getProducersOfSchema = (directory) => async (path5) => {
|
|
|
825
867
|
};
|
|
826
868
|
|
|
827
869
|
// src/custom-docs.ts
|
|
828
|
-
import
|
|
870
|
+
import path3, { join as join10 } from "path";
|
|
829
871
|
import fsSync4 from "fs";
|
|
830
872
|
import fs8 from "fs/promises";
|
|
831
873
|
import matter5 from "gray-matter";
|
|
832
874
|
import slugify from "slugify";
|
|
833
875
|
var getCustomDoc = (directory) => async (filePath) => {
|
|
834
|
-
const fullPath =
|
|
876
|
+
const fullPath = path3.join(directory, filePath);
|
|
835
877
|
const fullPathWithExtension = fullPath.endsWith(".mdx") ? fullPath : `${fullPath}.mdx`;
|
|
836
878
|
const fileExists = fsSync4.existsSync(fullPathWithExtension);
|
|
837
879
|
if (!fileExists) {
|
|
@@ -850,8 +892,8 @@ var writeCustomDoc = (directory) => async (customDoc, options = { path: "" }) =>
|
|
|
850
892
|
const { fileName, ...rest } = customDoc;
|
|
851
893
|
const name = fileName || slugify(customDoc.title, { lower: true });
|
|
852
894
|
const withExtension = name.endsWith(".mdx") ? name : `${name}.mdx`;
|
|
853
|
-
const fullPath =
|
|
854
|
-
fsSync4.mkdirSync(
|
|
895
|
+
const fullPath = path3.join(directory, options.path || "", withExtension);
|
|
896
|
+
fsSync4.mkdirSync(path3.dirname(fullPath), { recursive: true });
|
|
855
897
|
const document = matter5.stringify(customDoc.markdown.trim(), rest);
|
|
856
898
|
fsSync4.writeFileSync(fullPath, document);
|
|
857
899
|
};
|
|
@@ -865,7 +907,7 @@ import fs9 from "fs/promises";
|
|
|
865
907
|
import fsSync6 from "fs";
|
|
866
908
|
import { join as join12 } from "path";
|
|
867
909
|
import matter7 from "gray-matter";
|
|
868
|
-
import
|
|
910
|
+
import path4 from "path";
|
|
869
911
|
|
|
870
912
|
// src/users.ts
|
|
871
913
|
import fsSync5 from "fs";
|
|
@@ -961,11 +1003,11 @@ var getOwnersForResource = (catalogDir) => async (id, version) => {
|
|
|
961
1003
|
if (!resource) return [];
|
|
962
1004
|
if (!resource.owners) return [];
|
|
963
1005
|
for (const owner of resource.owners) {
|
|
964
|
-
const team = await getTeam(
|
|
1006
|
+
const team = await getTeam(path4.join(catalogDir, "teams"))(owner);
|
|
965
1007
|
if (team) {
|
|
966
1008
|
owners.push(team);
|
|
967
1009
|
} else {
|
|
968
|
-
const user = await getUser(
|
|
1010
|
+
const user = await getUser(path4.join(catalogDir, "users"))(owner);
|
|
969
1011
|
if (user) {
|
|
970
1012
|
owners.push(user);
|
|
971
1013
|
}
|
|
@@ -984,8 +1026,8 @@ var writeEntity = (directory) => async (entity, options = {
|
|
|
984
1026
|
override: false,
|
|
985
1027
|
format: "mdx"
|
|
986
1028
|
}) => writeResource(directory, { ...entity }, { ...options, type: "entity" });
|
|
987
|
-
var rmEntity = (directory) => async (
|
|
988
|
-
await fs10.rm(join13(directory,
|
|
1029
|
+
var rmEntity = (directory) => async (path6) => {
|
|
1030
|
+
await fs10.rm(join13(directory, path6), { recursive: true });
|
|
989
1031
|
};
|
|
990
1032
|
var rmEntityById = (directory) => async (id, version, persistFiles) => {
|
|
991
1033
|
await rmResourceById(directory, id, version, { type: "entity", persistFiles });
|
|
@@ -1007,8 +1049,8 @@ var writeContainer = (directory) => async (data, options = {
|
|
|
1007
1049
|
format: "mdx"
|
|
1008
1050
|
}) => writeResource(directory, { ...data }, { ...options, type: "container" });
|
|
1009
1051
|
var versionContainer = (directory) => async (id) => versionResource(directory, id);
|
|
1010
|
-
var rmContainer = (directory) => async (
|
|
1011
|
-
await fs11.rm(join14(directory,
|
|
1052
|
+
var rmContainer = (directory) => async (path6) => {
|
|
1053
|
+
await fs11.rm(join14(directory, path6), { recursive: true });
|
|
1012
1054
|
};
|
|
1013
1055
|
var rmContainerById = (directory) => async (id, version, persistFiles) => {
|
|
1014
1056
|
await rmResourceById(directory, id, version, { type: "container", persistFiles });
|
|
@@ -1040,7 +1082,7 @@ var addFileToDataStore = addFileToContainer;
|
|
|
1040
1082
|
var writeDataStoreToService = writeContainerToService;
|
|
1041
1083
|
|
|
1042
1084
|
// src/index.ts
|
|
1043
|
-
var index_default = (
|
|
1085
|
+
var index_default = (path6) => {
|
|
1044
1086
|
return {
|
|
1045
1087
|
/**
|
|
1046
1088
|
* Returns an events from EventCatalog
|
|
@@ -1048,13 +1090,13 @@ var index_default = (path5) => {
|
|
|
1048
1090
|
* @param version - Optional id of the version to get (supports semver)
|
|
1049
1091
|
* @returns Event|Undefined
|
|
1050
1092
|
*/
|
|
1051
|
-
getEvent: getEvent(join15(
|
|
1093
|
+
getEvent: getEvent(join15(path6)),
|
|
1052
1094
|
/**
|
|
1053
1095
|
* Returns all events from EventCatalog
|
|
1054
1096
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1055
1097
|
* @returns Event[]|Undefined
|
|
1056
1098
|
*/
|
|
1057
|
-
getEvents: getEvents(join15(
|
|
1099
|
+
getEvents: getEvents(join15(path6)),
|
|
1058
1100
|
/**
|
|
1059
1101
|
* Adds an event to EventCatalog
|
|
1060
1102
|
*
|
|
@@ -1062,7 +1104,7 @@ var index_default = (path5) => {
|
|
|
1062
1104
|
* @param options - Optional options to write the event
|
|
1063
1105
|
*
|
|
1064
1106
|
*/
|
|
1065
|
-
writeEvent: writeEvent(join15(
|
|
1107
|
+
writeEvent: writeEvent(join15(path6, "events")),
|
|
1066
1108
|
/**
|
|
1067
1109
|
* Adds an event to a service in EventCatalog
|
|
1068
1110
|
*
|
|
@@ -1071,26 +1113,26 @@ var index_default = (path5) => {
|
|
|
1071
1113
|
* @param options - Optional options to write the event
|
|
1072
1114
|
*
|
|
1073
1115
|
*/
|
|
1074
|
-
writeEventToService: writeEventToService(join15(
|
|
1116
|
+
writeEventToService: writeEventToService(join15(path6)),
|
|
1075
1117
|
/**
|
|
1076
1118
|
* Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
|
|
1077
1119
|
*
|
|
1078
1120
|
* @param path - The path to your event, e.g. `/Inventory/InventoryAdjusted`
|
|
1079
1121
|
*
|
|
1080
1122
|
*/
|
|
1081
|
-
rmEvent: rmEvent(join15(
|
|
1123
|
+
rmEvent: rmEvent(join15(path6, "events")),
|
|
1082
1124
|
/**
|
|
1083
1125
|
* Remove an event by an Event id
|
|
1084
1126
|
*
|
|
1085
1127
|
* @param id - The id of the event you want to remove
|
|
1086
1128
|
*
|
|
1087
1129
|
*/
|
|
1088
|
-
rmEventById: rmEventById(join15(
|
|
1130
|
+
rmEventById: rmEventById(join15(path6)),
|
|
1089
1131
|
/**
|
|
1090
1132
|
* Moves a given event id to the version directory
|
|
1091
1133
|
* @param directory
|
|
1092
1134
|
*/
|
|
1093
|
-
versionEvent: versionEvent(join15(
|
|
1135
|
+
versionEvent: versionEvent(join15(path6)),
|
|
1094
1136
|
/**
|
|
1095
1137
|
* Adds a file to the given event
|
|
1096
1138
|
* @param id - The id of the event to add the file to
|
|
@@ -1098,7 +1140,7 @@ var index_default = (path5) => {
|
|
|
1098
1140
|
* @param version - Optional version of the event to add the file to
|
|
1099
1141
|
* @returns
|
|
1100
1142
|
*/
|
|
1101
|
-
addFileToEvent: addFileToEvent(join15(
|
|
1143
|
+
addFileToEvent: addFileToEvent(join15(path6)),
|
|
1102
1144
|
/**
|
|
1103
1145
|
* Adds a schema to the given event
|
|
1104
1146
|
* @param id - The id of the event to add the schema to
|
|
@@ -1106,14 +1148,14 @@ var index_default = (path5) => {
|
|
|
1106
1148
|
* @param version - Optional version of the event to add the schema to
|
|
1107
1149
|
* @returns
|
|
1108
1150
|
*/
|
|
1109
|
-
addSchemaToEvent: addSchemaToEvent(join15(
|
|
1151
|
+
addSchemaToEvent: addSchemaToEvent(join15(path6)),
|
|
1110
1152
|
/**
|
|
1111
1153
|
* Check to see if an event version exists
|
|
1112
1154
|
* @param id - The id of the event
|
|
1113
1155
|
* @param version - The version of the event (supports semver)
|
|
1114
1156
|
* @returns
|
|
1115
1157
|
*/
|
|
1116
|
-
eventHasVersion: eventHasVersion(join15(
|
|
1158
|
+
eventHasVersion: eventHasVersion(join15(path6)),
|
|
1117
1159
|
/**
|
|
1118
1160
|
* ================================
|
|
1119
1161
|
* Commands
|
|
@@ -1125,13 +1167,13 @@ var index_default = (path5) => {
|
|
|
1125
1167
|
* @param version - Optional id of the version to get (supports semver)
|
|
1126
1168
|
* @returns Command|Undefined
|
|
1127
1169
|
*/
|
|
1128
|
-
getCommand: getCommand(join15(
|
|
1170
|
+
getCommand: getCommand(join15(path6)),
|
|
1129
1171
|
/**
|
|
1130
1172
|
* Returns all commands from EventCatalog
|
|
1131
1173
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1132
1174
|
* @returns Command[]|Undefined
|
|
1133
1175
|
*/
|
|
1134
|
-
getCommands: getCommands(join15(
|
|
1176
|
+
getCommands: getCommands(join15(path6)),
|
|
1135
1177
|
/**
|
|
1136
1178
|
* Adds an command to EventCatalog
|
|
1137
1179
|
*
|
|
@@ -1139,7 +1181,7 @@ var index_default = (path5) => {
|
|
|
1139
1181
|
* @param options - Optional options to write the command
|
|
1140
1182
|
*
|
|
1141
1183
|
*/
|
|
1142
|
-
writeCommand: writeCommand(join15(
|
|
1184
|
+
writeCommand: writeCommand(join15(path6, "commands")),
|
|
1143
1185
|
/**
|
|
1144
1186
|
* Adds a command to a service in EventCatalog
|
|
1145
1187
|
*
|
|
@@ -1148,26 +1190,26 @@ var index_default = (path5) => {
|
|
|
1148
1190
|
* @param options - Optional options to write the command
|
|
1149
1191
|
*
|
|
1150
1192
|
*/
|
|
1151
|
-
writeCommandToService: writeCommandToService(join15(
|
|
1193
|
+
writeCommandToService: writeCommandToService(join15(path6)),
|
|
1152
1194
|
/**
|
|
1153
1195
|
* Remove an command to EventCatalog (modeled on the standard POSIX rm utility)
|
|
1154
1196
|
*
|
|
1155
1197
|
* @param path - The path to your command, e.g. `/Inventory/InventoryAdjusted`
|
|
1156
1198
|
*
|
|
1157
1199
|
*/
|
|
1158
|
-
rmCommand: rmCommand(join15(
|
|
1200
|
+
rmCommand: rmCommand(join15(path6, "commands")),
|
|
1159
1201
|
/**
|
|
1160
1202
|
* Remove an command by an Event id
|
|
1161
1203
|
*
|
|
1162
1204
|
* @param id - The id of the command you want to remove
|
|
1163
1205
|
*
|
|
1164
1206
|
*/
|
|
1165
|
-
rmCommandById: rmCommandById(join15(
|
|
1207
|
+
rmCommandById: rmCommandById(join15(path6)),
|
|
1166
1208
|
/**
|
|
1167
1209
|
* Moves a given command id to the version directory
|
|
1168
1210
|
* @param directory
|
|
1169
1211
|
*/
|
|
1170
|
-
versionCommand: versionCommand(join15(
|
|
1212
|
+
versionCommand: versionCommand(join15(path6)),
|
|
1171
1213
|
/**
|
|
1172
1214
|
* Adds a file to the given command
|
|
1173
1215
|
* @param id - The id of the command to add the file to
|
|
@@ -1175,7 +1217,7 @@ var index_default = (path5) => {
|
|
|
1175
1217
|
* @param version - Optional version of the command to add the file to
|
|
1176
1218
|
* @returns
|
|
1177
1219
|
*/
|
|
1178
|
-
addFileToCommand: addFileToCommand(join15(
|
|
1220
|
+
addFileToCommand: addFileToCommand(join15(path6)),
|
|
1179
1221
|
/**
|
|
1180
1222
|
* Adds a schema to the given command
|
|
1181
1223
|
* @param id - The id of the command to add the schema to
|
|
@@ -1183,14 +1225,14 @@ var index_default = (path5) => {
|
|
|
1183
1225
|
* @param version - Optional version of the command to add the schema to
|
|
1184
1226
|
* @returns
|
|
1185
1227
|
*/
|
|
1186
|
-
addSchemaToCommand: addSchemaToCommand(join15(
|
|
1228
|
+
addSchemaToCommand: addSchemaToCommand(join15(path6)),
|
|
1187
1229
|
/**
|
|
1188
1230
|
* Check to see if a command version exists
|
|
1189
1231
|
* @param id - The id of the command
|
|
1190
1232
|
* @param version - The version of the command (supports semver)
|
|
1191
1233
|
* @returns
|
|
1192
1234
|
*/
|
|
1193
|
-
commandHasVersion: commandHasVersion(join15(
|
|
1235
|
+
commandHasVersion: commandHasVersion(join15(path6)),
|
|
1194
1236
|
/**
|
|
1195
1237
|
* ================================
|
|
1196
1238
|
* Queries
|
|
@@ -1202,13 +1244,13 @@ var index_default = (path5) => {
|
|
|
1202
1244
|
* @param version - Optional id of the version to get (supports semver)
|
|
1203
1245
|
* @returns Query|Undefined
|
|
1204
1246
|
*/
|
|
1205
|
-
getQuery: getQuery(join15(
|
|
1247
|
+
getQuery: getQuery(join15(path6)),
|
|
1206
1248
|
/**
|
|
1207
1249
|
* Returns all queries from EventCatalog
|
|
1208
1250
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1209
1251
|
* @returns Query[]|Undefined
|
|
1210
1252
|
*/
|
|
1211
|
-
getQueries: getQueries(join15(
|
|
1253
|
+
getQueries: getQueries(join15(path6)),
|
|
1212
1254
|
/**
|
|
1213
1255
|
* Adds a query to EventCatalog
|
|
1214
1256
|
*
|
|
@@ -1216,7 +1258,7 @@ var index_default = (path5) => {
|
|
|
1216
1258
|
* @param options - Optional options to write the event
|
|
1217
1259
|
*
|
|
1218
1260
|
*/
|
|
1219
|
-
writeQuery: writeQuery(join15(
|
|
1261
|
+
writeQuery: writeQuery(join15(path6, "queries")),
|
|
1220
1262
|
/**
|
|
1221
1263
|
* Adds a query to a service in EventCatalog
|
|
1222
1264
|
*
|
|
@@ -1225,26 +1267,26 @@ var index_default = (path5) => {
|
|
|
1225
1267
|
* @param options - Optional options to write the query
|
|
1226
1268
|
*
|
|
1227
1269
|
*/
|
|
1228
|
-
writeQueryToService: writeQueryToService(join15(
|
|
1270
|
+
writeQueryToService: writeQueryToService(join15(path6)),
|
|
1229
1271
|
/**
|
|
1230
1272
|
* Remove an query to EventCatalog (modeled on the standard POSIX rm utility)
|
|
1231
1273
|
*
|
|
1232
1274
|
* @param path - The path to your query, e.g. `/Orders/GetOrder`
|
|
1233
1275
|
*
|
|
1234
1276
|
*/
|
|
1235
|
-
rmQuery: rmQuery(join15(
|
|
1277
|
+
rmQuery: rmQuery(join15(path6, "queries")),
|
|
1236
1278
|
/**
|
|
1237
1279
|
* Remove a query by a Query id
|
|
1238
1280
|
*
|
|
1239
1281
|
* @param id - The id of the query you want to remove
|
|
1240
1282
|
*
|
|
1241
1283
|
*/
|
|
1242
|
-
rmQueryById: rmQueryById(join15(
|
|
1284
|
+
rmQueryById: rmQueryById(join15(path6)),
|
|
1243
1285
|
/**
|
|
1244
1286
|
* Moves a given query id to the version directory
|
|
1245
1287
|
* @param directory
|
|
1246
1288
|
*/
|
|
1247
|
-
versionQuery: versionQuery(join15(
|
|
1289
|
+
versionQuery: versionQuery(join15(path6)),
|
|
1248
1290
|
/**
|
|
1249
1291
|
* Adds a file to the given query
|
|
1250
1292
|
* @param id - The id of the query to add the file to
|
|
@@ -1252,7 +1294,7 @@ var index_default = (path5) => {
|
|
|
1252
1294
|
* @param version - Optional version of the query to add the file to
|
|
1253
1295
|
* @returns
|
|
1254
1296
|
*/
|
|
1255
|
-
addFileToQuery: addFileToQuery(join15(
|
|
1297
|
+
addFileToQuery: addFileToQuery(join15(path6)),
|
|
1256
1298
|
/**
|
|
1257
1299
|
* Adds a schema to the given query
|
|
1258
1300
|
* @param id - The id of the query to add the schema to
|
|
@@ -1260,14 +1302,14 @@ var index_default = (path5) => {
|
|
|
1260
1302
|
* @param version - Optional version of the query to add the schema to
|
|
1261
1303
|
* @returns
|
|
1262
1304
|
*/
|
|
1263
|
-
addSchemaToQuery: addSchemaToQuery(join15(
|
|
1305
|
+
addSchemaToQuery: addSchemaToQuery(join15(path6)),
|
|
1264
1306
|
/**
|
|
1265
1307
|
* Check to see if an query version exists
|
|
1266
1308
|
* @param id - The id of the query
|
|
1267
1309
|
* @param version - The version of the query (supports semver)
|
|
1268
1310
|
* @returns
|
|
1269
1311
|
*/
|
|
1270
|
-
queryHasVersion: queryHasVersion(join15(
|
|
1312
|
+
queryHasVersion: queryHasVersion(join15(path6)),
|
|
1271
1313
|
/**
|
|
1272
1314
|
* ================================
|
|
1273
1315
|
* Channels
|
|
@@ -1279,13 +1321,13 @@ var index_default = (path5) => {
|
|
|
1279
1321
|
* @param version - Optional id of the version to get (supports semver)
|
|
1280
1322
|
* @returns Channel|Undefined
|
|
1281
1323
|
*/
|
|
1282
|
-
getChannel: getChannel(join15(
|
|
1324
|
+
getChannel: getChannel(join15(path6)),
|
|
1283
1325
|
/**
|
|
1284
1326
|
* Returns all channels from EventCatalog
|
|
1285
1327
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1286
1328
|
* @returns Channel[]|Undefined
|
|
1287
1329
|
*/
|
|
1288
|
-
getChannels: getChannels(join15(
|
|
1330
|
+
getChannels: getChannels(join15(path6)),
|
|
1289
1331
|
/**
|
|
1290
1332
|
* Adds an channel to EventCatalog
|
|
1291
1333
|
*
|
|
@@ -1293,33 +1335,33 @@ var index_default = (path5) => {
|
|
|
1293
1335
|
* @param options - Optional options to write the channel
|
|
1294
1336
|
*
|
|
1295
1337
|
*/
|
|
1296
|
-
writeChannel: writeChannel(join15(
|
|
1338
|
+
writeChannel: writeChannel(join15(path6, "channels")),
|
|
1297
1339
|
/**
|
|
1298
1340
|
* Remove an channel to EventCatalog (modeled on the standard POSIX rm utility)
|
|
1299
1341
|
*
|
|
1300
1342
|
* @param path - The path to your channel, e.g. `/Inventory/InventoryAdjusted`
|
|
1301
1343
|
*
|
|
1302
1344
|
*/
|
|
1303
|
-
rmChannel: rmChannel(join15(
|
|
1345
|
+
rmChannel: rmChannel(join15(path6, "channels")),
|
|
1304
1346
|
/**
|
|
1305
1347
|
* Remove an channel by an Event id
|
|
1306
1348
|
*
|
|
1307
1349
|
* @param id - The id of the channel you want to remove
|
|
1308
1350
|
*
|
|
1309
1351
|
*/
|
|
1310
|
-
rmChannelById: rmChannelById(join15(
|
|
1352
|
+
rmChannelById: rmChannelById(join15(path6)),
|
|
1311
1353
|
/**
|
|
1312
1354
|
* Moves a given channel id to the version directory
|
|
1313
1355
|
* @param directory
|
|
1314
1356
|
*/
|
|
1315
|
-
versionChannel: versionChannel(join15(
|
|
1357
|
+
versionChannel: versionChannel(join15(path6)),
|
|
1316
1358
|
/**
|
|
1317
1359
|
* Check to see if a channel version exists
|
|
1318
1360
|
* @param id - The id of the channel
|
|
1319
1361
|
* @param version - The version of the channel (supports semver)
|
|
1320
1362
|
* @returns
|
|
1321
1363
|
*/
|
|
1322
|
-
channelHasVersion: channelHasVersion(join15(
|
|
1364
|
+
channelHasVersion: channelHasVersion(join15(path6)),
|
|
1323
1365
|
/**
|
|
1324
1366
|
* Add a channel to an event
|
|
1325
1367
|
*
|
|
@@ -1336,7 +1378,7 @@ var index_default = (path5) => {
|
|
|
1336
1378
|
*
|
|
1337
1379
|
* ```
|
|
1338
1380
|
*/
|
|
1339
|
-
addEventToChannel: addMessageToChannel(join15(
|
|
1381
|
+
addEventToChannel: addMessageToChannel(join15(path6), "events"),
|
|
1340
1382
|
/**
|
|
1341
1383
|
* Add a channel to an command
|
|
1342
1384
|
*
|
|
@@ -1353,7 +1395,7 @@ var index_default = (path5) => {
|
|
|
1353
1395
|
*
|
|
1354
1396
|
* ```
|
|
1355
1397
|
*/
|
|
1356
|
-
addCommandToChannel: addMessageToChannel(join15(
|
|
1398
|
+
addCommandToChannel: addMessageToChannel(join15(path6), "commands"),
|
|
1357
1399
|
/**
|
|
1358
1400
|
* Add a channel to an query
|
|
1359
1401
|
*
|
|
@@ -1370,7 +1412,7 @@ var index_default = (path5) => {
|
|
|
1370
1412
|
*
|
|
1371
1413
|
* ```
|
|
1372
1414
|
*/
|
|
1373
|
-
addQueryToChannel: addMessageToChannel(join15(
|
|
1415
|
+
addQueryToChannel: addMessageToChannel(join15(path6), "queries"),
|
|
1374
1416
|
/**
|
|
1375
1417
|
* ================================
|
|
1376
1418
|
* SERVICES
|
|
@@ -1383,14 +1425,14 @@ var index_default = (path5) => {
|
|
|
1383
1425
|
* @param options - Optional options to write the event
|
|
1384
1426
|
*
|
|
1385
1427
|
*/
|
|
1386
|
-
writeService: writeService(join15(
|
|
1428
|
+
writeService: writeService(join15(path6, "services")),
|
|
1387
1429
|
/**
|
|
1388
1430
|
* Adds a versioned service to EventCatalog
|
|
1389
1431
|
*
|
|
1390
1432
|
* @param service - The service to write
|
|
1391
1433
|
*
|
|
1392
1434
|
*/
|
|
1393
|
-
writeVersionedService: writeVersionedService(join15(
|
|
1435
|
+
writeVersionedService: writeVersionedService(join15(path6, "services")),
|
|
1394
1436
|
/**
|
|
1395
1437
|
* Adds a service to a domain in EventCatalog
|
|
1396
1438
|
*
|
|
@@ -1399,45 +1441,45 @@ var index_default = (path5) => {
|
|
|
1399
1441
|
* @param options - Optional options to write the event
|
|
1400
1442
|
*
|
|
1401
1443
|
*/
|
|
1402
|
-
writeServiceToDomain: writeServiceToDomain(join15(
|
|
1444
|
+
writeServiceToDomain: writeServiceToDomain(join15(path6, "domains")),
|
|
1403
1445
|
/**
|
|
1404
1446
|
* Returns a service from EventCatalog
|
|
1405
1447
|
* @param id - The id of the service to retrieve
|
|
1406
1448
|
* @param version - Optional id of the version to get (supports semver)
|
|
1407
1449
|
* @returns Service|Undefined
|
|
1408
1450
|
*/
|
|
1409
|
-
getService: getService(join15(
|
|
1451
|
+
getService: getService(join15(path6)),
|
|
1410
1452
|
/**
|
|
1411
1453
|
* Returns a service from EventCatalog by it's path.
|
|
1412
1454
|
* @param path - The path to the service to retrieve
|
|
1413
1455
|
* @returns Service|Undefined
|
|
1414
1456
|
*/
|
|
1415
|
-
getServiceByPath: getServiceByPath(join15(
|
|
1457
|
+
getServiceByPath: getServiceByPath(join15(path6)),
|
|
1416
1458
|
/**
|
|
1417
1459
|
* Returns all services from EventCatalog
|
|
1418
1460
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1419
1461
|
* @returns Service[]|Undefined
|
|
1420
1462
|
*/
|
|
1421
|
-
getServices: getServices(join15(
|
|
1463
|
+
getServices: getServices(join15(path6)),
|
|
1422
1464
|
/**
|
|
1423
1465
|
* Moves a given service id to the version directory
|
|
1424
1466
|
* @param directory
|
|
1425
1467
|
*/
|
|
1426
|
-
versionService: versionService(join15(
|
|
1468
|
+
versionService: versionService(join15(path6)),
|
|
1427
1469
|
/**
|
|
1428
1470
|
* Remove a service from EventCatalog (modeled on the standard POSIX rm utility)
|
|
1429
1471
|
*
|
|
1430
1472
|
* @param path - The path to your service, e.g. `/InventoryService`
|
|
1431
1473
|
*
|
|
1432
1474
|
*/
|
|
1433
|
-
rmService: rmService(join15(
|
|
1475
|
+
rmService: rmService(join15(path6, "services")),
|
|
1434
1476
|
/**
|
|
1435
1477
|
* Remove an service by an service id
|
|
1436
1478
|
*
|
|
1437
1479
|
* @param id - The id of the service you want to remove
|
|
1438
1480
|
*
|
|
1439
1481
|
*/
|
|
1440
|
-
rmServiceById: rmServiceById(join15(
|
|
1482
|
+
rmServiceById: rmServiceById(join15(path6)),
|
|
1441
1483
|
/**
|
|
1442
1484
|
* Adds a file to the given service
|
|
1443
1485
|
* @param id - The id of the service to add the file to
|
|
@@ -1445,21 +1487,21 @@ var index_default = (path5) => {
|
|
|
1445
1487
|
* @param version - Optional version of the service to add the file to
|
|
1446
1488
|
* @returns
|
|
1447
1489
|
*/
|
|
1448
|
-
addFileToService: addFileToService(join15(
|
|
1490
|
+
addFileToService: addFileToService(join15(path6)),
|
|
1449
1491
|
/**
|
|
1450
1492
|
* Returns the specifications for a given service
|
|
1451
1493
|
* @param id - The id of the service to retrieve the specifications for
|
|
1452
1494
|
* @param version - Optional version of the service
|
|
1453
1495
|
* @returns
|
|
1454
1496
|
*/
|
|
1455
|
-
getSpecificationFilesForService: getSpecificationFilesForService(join15(
|
|
1497
|
+
getSpecificationFilesForService: getSpecificationFilesForService(join15(path6)),
|
|
1456
1498
|
/**
|
|
1457
1499
|
* Check to see if a service version exists
|
|
1458
1500
|
* @param id - The id of the service
|
|
1459
1501
|
* @param version - The version of the service (supports semver)
|
|
1460
1502
|
* @returns
|
|
1461
1503
|
*/
|
|
1462
|
-
serviceHasVersion: serviceHasVersion(join15(
|
|
1504
|
+
serviceHasVersion: serviceHasVersion(join15(path6)),
|
|
1463
1505
|
/**
|
|
1464
1506
|
* Add an event to a service by it's id.
|
|
1465
1507
|
*
|
|
@@ -1479,7 +1521,24 @@ var index_default = (path5) => {
|
|
|
1479
1521
|
*
|
|
1480
1522
|
* ```
|
|
1481
1523
|
*/
|
|
1482
|
-
addEventToService: addMessageToService(join15(
|
|
1524
|
+
addEventToService: addMessageToService(join15(path6)),
|
|
1525
|
+
/**
|
|
1526
|
+
* Add a data store to a service by it's id.
|
|
1527
|
+
*
|
|
1528
|
+
* Optionally specify a version to add the data store to a specific version of the service.
|
|
1529
|
+
*
|
|
1530
|
+
* @example
|
|
1531
|
+
* ```ts
|
|
1532
|
+
* import utils from '@eventcatalog/utils';
|
|
1533
|
+
*
|
|
1534
|
+
* const { addDataStoreToService } = utils('/path/to/eventcatalog');
|
|
1535
|
+
*
|
|
1536
|
+
* // adds a new data store (orders-db) that the InventoryService will write to
|
|
1537
|
+
* await addDataStoreToService('InventoryService', 'writesTo', { id: 'orders-db', version: '2.0.0' });
|
|
1538
|
+
*
|
|
1539
|
+
* ```
|
|
1540
|
+
*/
|
|
1541
|
+
addDataStoreToService: addDataStoreToService(join15(path6)),
|
|
1483
1542
|
/**
|
|
1484
1543
|
* Add a command to a service by it's id.
|
|
1485
1544
|
*
|
|
@@ -1499,7 +1558,7 @@ var index_default = (path5) => {
|
|
|
1499
1558
|
*
|
|
1500
1559
|
* ```
|
|
1501
1560
|
*/
|
|
1502
|
-
addCommandToService: addMessageToService(join15(
|
|
1561
|
+
addCommandToService: addMessageToService(join15(path6)),
|
|
1503
1562
|
/**
|
|
1504
1563
|
* Add a query to a service by it's id.
|
|
1505
1564
|
*
|
|
@@ -1519,7 +1578,7 @@ var index_default = (path5) => {
|
|
|
1519
1578
|
*
|
|
1520
1579
|
* ```
|
|
1521
1580
|
*/
|
|
1522
|
-
addQueryToService: addMessageToService(join15(
|
|
1581
|
+
addQueryToService: addMessageToService(join15(path6)),
|
|
1523
1582
|
/**
|
|
1524
1583
|
* Add an entity to a service by its id.
|
|
1525
1584
|
*
|
|
@@ -1537,7 +1596,7 @@ var index_default = (path5) => {
|
|
|
1537
1596
|
*
|
|
1538
1597
|
* ```
|
|
1539
1598
|
*/
|
|
1540
|
-
addEntityToService: addEntityToService(join15(
|
|
1599
|
+
addEntityToService: addEntityToService(join15(path6)),
|
|
1541
1600
|
/**
|
|
1542
1601
|
* Check to see if a service exists by it's path.
|
|
1543
1602
|
*
|
|
@@ -1554,13 +1613,13 @@ var index_default = (path5) => {
|
|
|
1554
1613
|
* @param path - The path to the service to check
|
|
1555
1614
|
* @returns boolean
|
|
1556
1615
|
*/
|
|
1557
|
-
isService: isService(join15(
|
|
1616
|
+
isService: isService(join15(path6)),
|
|
1558
1617
|
/**
|
|
1559
1618
|
* Converts a file to a service.
|
|
1560
1619
|
* @param file - The file to convert to a service.
|
|
1561
1620
|
* @returns The service.
|
|
1562
1621
|
*/
|
|
1563
|
-
toService: toService(join15(
|
|
1622
|
+
toService: toService(join15(path6)),
|
|
1564
1623
|
/**
|
|
1565
1624
|
* ================================
|
|
1566
1625
|
* Domains
|
|
@@ -1573,39 +1632,39 @@ var index_default = (path5) => {
|
|
|
1573
1632
|
* @param options - Optional options to write the event
|
|
1574
1633
|
*
|
|
1575
1634
|
*/
|
|
1576
|
-
writeDomain: writeDomain(join15(
|
|
1635
|
+
writeDomain: writeDomain(join15(path6, "domains")),
|
|
1577
1636
|
/**
|
|
1578
1637
|
* Returns a domain from EventCatalog
|
|
1579
1638
|
* @param id - The id of the domain to retrieve
|
|
1580
1639
|
* @param version - Optional id of the version to get (supports semver)
|
|
1581
1640
|
* @returns Domain|Undefined
|
|
1582
1641
|
*/
|
|
1583
|
-
getDomain: getDomain(join15(
|
|
1642
|
+
getDomain: getDomain(join15(path6, "domains")),
|
|
1584
1643
|
/**
|
|
1585
1644
|
* Returns all domains from EventCatalog
|
|
1586
1645
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1587
1646
|
* @returns Domain[]|Undefined
|
|
1588
1647
|
*/
|
|
1589
|
-
getDomains: getDomains(join15(
|
|
1648
|
+
getDomains: getDomains(join15(path6)),
|
|
1590
1649
|
/**
|
|
1591
1650
|
* Moves a given domain id to the version directory
|
|
1592
1651
|
* @param directory
|
|
1593
1652
|
*/
|
|
1594
|
-
versionDomain: versionDomain(join15(
|
|
1653
|
+
versionDomain: versionDomain(join15(path6, "domains")),
|
|
1595
1654
|
/**
|
|
1596
1655
|
* Remove a domain from EventCatalog (modeled on the standard POSIX rm utility)
|
|
1597
1656
|
*
|
|
1598
1657
|
* @param path - The path to your domain, e.g. `/Payment`
|
|
1599
1658
|
*
|
|
1600
1659
|
*/
|
|
1601
|
-
rmDomain: rmDomain(join15(
|
|
1660
|
+
rmDomain: rmDomain(join15(path6, "domains")),
|
|
1602
1661
|
/**
|
|
1603
1662
|
* Remove an service by an domain id
|
|
1604
1663
|
*
|
|
1605
1664
|
* @param id - The id of the domain you want to remove
|
|
1606
1665
|
*
|
|
1607
1666
|
*/
|
|
1608
|
-
rmDomainById: rmDomainById(join15(
|
|
1667
|
+
rmDomainById: rmDomainById(join15(path6, "domains")),
|
|
1609
1668
|
/**
|
|
1610
1669
|
* Adds a file to the given domain
|
|
1611
1670
|
* @param id - The id of the domain to add the file to
|
|
@@ -1613,28 +1672,28 @@ var index_default = (path5) => {
|
|
|
1613
1672
|
* @param version - Optional version of the domain to add the file to
|
|
1614
1673
|
* @returns
|
|
1615
1674
|
*/
|
|
1616
|
-
addFileToDomain: addFileToDomain(join15(
|
|
1675
|
+
addFileToDomain: addFileToDomain(join15(path6, "domains")),
|
|
1617
1676
|
/**
|
|
1618
1677
|
* Adds an ubiquitous language dictionary to a domain
|
|
1619
1678
|
* @param id - The id of the domain to add the ubiquitous language to
|
|
1620
1679
|
* @param ubiquitousLanguageDictionary - The ubiquitous language dictionary to add
|
|
1621
1680
|
* @param version - Optional version of the domain to add the ubiquitous language to
|
|
1622
1681
|
*/
|
|
1623
|
-
addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain(join15(
|
|
1682
|
+
addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain(join15(path6, "domains")),
|
|
1624
1683
|
/**
|
|
1625
1684
|
* Get the ubiquitous language dictionary from a domain
|
|
1626
1685
|
* @param id - The id of the domain to get the ubiquitous language from
|
|
1627
1686
|
* @param version - Optional version of the domain to get the ubiquitous language from
|
|
1628
1687
|
* @returns
|
|
1629
1688
|
*/
|
|
1630
|
-
getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain(join15(
|
|
1689
|
+
getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain(join15(path6, "domains")),
|
|
1631
1690
|
/**
|
|
1632
1691
|
* Check to see if a domain version exists
|
|
1633
1692
|
* @param id - The id of the domain
|
|
1634
1693
|
* @param version - The version of the domain (supports semver)
|
|
1635
1694
|
* @returns
|
|
1636
1695
|
*/
|
|
1637
|
-
domainHasVersion: domainHasVersion(join15(
|
|
1696
|
+
domainHasVersion: domainHasVersion(join15(path6)),
|
|
1638
1697
|
/**
|
|
1639
1698
|
* Adds a given service to a domain
|
|
1640
1699
|
* @param id - The id of the domain
|
|
@@ -1642,7 +1701,7 @@ var index_default = (path5) => {
|
|
|
1642
1701
|
* @param version - (Optional) The version of the domain to add the service to
|
|
1643
1702
|
* @returns
|
|
1644
1703
|
*/
|
|
1645
|
-
addServiceToDomain: addServiceToDomain(join15(
|
|
1704
|
+
addServiceToDomain: addServiceToDomain(join15(path6, "domains")),
|
|
1646
1705
|
/**
|
|
1647
1706
|
* Adds a given subdomain to a domain
|
|
1648
1707
|
* @param id - The id of the domain
|
|
@@ -1650,7 +1709,7 @@ var index_default = (path5) => {
|
|
|
1650
1709
|
* @param version - (Optional) The version of the domain to add the subdomain to
|
|
1651
1710
|
* @returns
|
|
1652
1711
|
*/
|
|
1653
|
-
addSubDomainToDomain: addSubDomainToDomain(join15(
|
|
1712
|
+
addSubDomainToDomain: addSubDomainToDomain(join15(path6, "domains")),
|
|
1654
1713
|
/**
|
|
1655
1714
|
* Adds an entity to a domain
|
|
1656
1715
|
* @param id - The id of the domain
|
|
@@ -1658,7 +1717,7 @@ var index_default = (path5) => {
|
|
|
1658
1717
|
* @param version - (Optional) The version of the domain to add the entity to
|
|
1659
1718
|
* @returns
|
|
1660
1719
|
*/
|
|
1661
|
-
addEntityToDomain: addEntityToDomain(join15(
|
|
1720
|
+
addEntityToDomain: addEntityToDomain(join15(path6, "domains")),
|
|
1662
1721
|
/**
|
|
1663
1722
|
* ================================
|
|
1664
1723
|
* Teams
|
|
@@ -1671,25 +1730,25 @@ var index_default = (path5) => {
|
|
|
1671
1730
|
* @param options - Optional options to write the team
|
|
1672
1731
|
*
|
|
1673
1732
|
*/
|
|
1674
|
-
writeTeam: writeTeam(join15(
|
|
1733
|
+
writeTeam: writeTeam(join15(path6, "teams")),
|
|
1675
1734
|
/**
|
|
1676
1735
|
* Returns a team from EventCatalog
|
|
1677
1736
|
* @param id - The id of the team to retrieve
|
|
1678
1737
|
* @returns Team|Undefined
|
|
1679
1738
|
*/
|
|
1680
|
-
getTeam: getTeam(join15(
|
|
1739
|
+
getTeam: getTeam(join15(path6, "teams")),
|
|
1681
1740
|
/**
|
|
1682
1741
|
* Returns all teams from EventCatalog
|
|
1683
1742
|
* @returns Team[]|Undefined
|
|
1684
1743
|
*/
|
|
1685
|
-
getTeams: getTeams(join15(
|
|
1744
|
+
getTeams: getTeams(join15(path6, "teams")),
|
|
1686
1745
|
/**
|
|
1687
1746
|
* Remove a team by the team id
|
|
1688
1747
|
*
|
|
1689
1748
|
* @param id - The id of the team you want to remove
|
|
1690
1749
|
*
|
|
1691
1750
|
*/
|
|
1692
|
-
rmTeamById: rmTeamById(join15(
|
|
1751
|
+
rmTeamById: rmTeamById(join15(path6, "teams")),
|
|
1693
1752
|
/**
|
|
1694
1753
|
* ================================
|
|
1695
1754
|
* Users
|
|
@@ -1702,25 +1761,25 @@ var index_default = (path5) => {
|
|
|
1702
1761
|
* @param options - Optional options to write the user
|
|
1703
1762
|
*
|
|
1704
1763
|
*/
|
|
1705
|
-
writeUser: writeUser(join15(
|
|
1764
|
+
writeUser: writeUser(join15(path6, "users")),
|
|
1706
1765
|
/**
|
|
1707
1766
|
* Returns a user from EventCatalog
|
|
1708
1767
|
* @param id - The id of the user to retrieve
|
|
1709
1768
|
* @returns User|Undefined
|
|
1710
1769
|
*/
|
|
1711
|
-
getUser: getUser(join15(
|
|
1770
|
+
getUser: getUser(join15(path6, "users")),
|
|
1712
1771
|
/**
|
|
1713
1772
|
* Returns all user from EventCatalog
|
|
1714
1773
|
* @returns User[]|Undefined
|
|
1715
1774
|
*/
|
|
1716
|
-
getUsers: getUsers(join15(
|
|
1775
|
+
getUsers: getUsers(join15(path6)),
|
|
1717
1776
|
/**
|
|
1718
1777
|
* Remove a user by the user id
|
|
1719
1778
|
*
|
|
1720
1779
|
* @param id - The id of the user you want to remove
|
|
1721
1780
|
*
|
|
1722
1781
|
*/
|
|
1723
|
-
rmUserById: rmUserById(join15(
|
|
1782
|
+
rmUserById: rmUserById(join15(path6, "users")),
|
|
1724
1783
|
/**
|
|
1725
1784
|
* ================================
|
|
1726
1785
|
* Custom Docs
|
|
@@ -1731,32 +1790,32 @@ var index_default = (path5) => {
|
|
|
1731
1790
|
* @param path - The path to the custom doc to retrieve
|
|
1732
1791
|
* @returns CustomDoc|Undefined
|
|
1733
1792
|
*/
|
|
1734
|
-
getCustomDoc: getCustomDoc(join15(
|
|
1793
|
+
getCustomDoc: getCustomDoc(join15(path6, "docs")),
|
|
1735
1794
|
/**
|
|
1736
1795
|
* Returns all custom docs from EventCatalog
|
|
1737
1796
|
* @param options - Optional options to get custom docs from a specific path
|
|
1738
1797
|
* @returns CustomDoc[]|Undefined
|
|
1739
1798
|
*/
|
|
1740
|
-
getCustomDocs: getCustomDocs(join15(
|
|
1799
|
+
getCustomDocs: getCustomDocs(join15(path6, "docs")),
|
|
1741
1800
|
/**
|
|
1742
1801
|
* Writes a custom doc to EventCatalog
|
|
1743
1802
|
* @param customDoc - The custom doc to write
|
|
1744
1803
|
* @param options - Optional options to write the custom doc
|
|
1745
1804
|
*
|
|
1746
1805
|
*/
|
|
1747
|
-
writeCustomDoc: writeCustomDoc(join15(
|
|
1806
|
+
writeCustomDoc: writeCustomDoc(join15(path6, "docs")),
|
|
1748
1807
|
/**
|
|
1749
1808
|
* Removes a custom doc from EventCatalog
|
|
1750
1809
|
* @param path - The path to the custom doc to remove
|
|
1751
1810
|
*
|
|
1752
1811
|
*/
|
|
1753
|
-
rmCustomDoc: rmCustomDoc(join15(
|
|
1812
|
+
rmCustomDoc: rmCustomDoc(join15(path6, "docs")),
|
|
1754
1813
|
/**
|
|
1755
1814
|
* Dumps the catalog to a JSON file.
|
|
1756
1815
|
* @param directory - The directory to dump the catalog to
|
|
1757
1816
|
* @returns A JSON file with the catalog
|
|
1758
1817
|
*/
|
|
1759
|
-
dumpCatalog: dumpCatalog(join15(
|
|
1818
|
+
dumpCatalog: dumpCatalog(join15(path6)),
|
|
1760
1819
|
/**
|
|
1761
1820
|
* Returns the event catalog configuration file.
|
|
1762
1821
|
* The event catalog configuration file is the file that contains the configuration for the event catalog.
|
|
@@ -1764,7 +1823,7 @@ var index_default = (path5) => {
|
|
|
1764
1823
|
* @param directory - The directory of the catalog.
|
|
1765
1824
|
* @returns A JSON object with the configuration for the event catalog.
|
|
1766
1825
|
*/
|
|
1767
|
-
getEventCatalogConfigurationFile: getEventCatalogConfigurationFile(join15(
|
|
1826
|
+
getEventCatalogConfigurationFile: getEventCatalogConfigurationFile(join15(path6)),
|
|
1768
1827
|
/**
|
|
1769
1828
|
* ================================
|
|
1770
1829
|
* Resources Utils
|
|
@@ -1774,6 +1833,10 @@ var index_default = (path5) => {
|
|
|
1774
1833
|
* Returns the path to a given resource by id and version
|
|
1775
1834
|
*/
|
|
1776
1835
|
getResourcePath,
|
|
1836
|
+
/**
|
|
1837
|
+
* Returns the folder name of a given resource
|
|
1838
|
+
*/
|
|
1839
|
+
getResourceFolderName,
|
|
1777
1840
|
/**
|
|
1778
1841
|
* ================================
|
|
1779
1842
|
* General Message Utils
|
|
@@ -1785,33 +1848,33 @@ var index_default = (path5) => {
|
|
|
1785
1848
|
* @param path - The path to the message to retrieve
|
|
1786
1849
|
* @returns Message|Undefined
|
|
1787
1850
|
*/
|
|
1788
|
-
getMessageBySchemaPath: getMessageBySchemaPath(join15(
|
|
1851
|
+
getMessageBySchemaPath: getMessageBySchemaPath(join15(path6)),
|
|
1789
1852
|
/**
|
|
1790
1853
|
* Returns the producers and consumers (services) for a given message
|
|
1791
1854
|
* @param id - The id of the message to get the producers and consumers for
|
|
1792
1855
|
* @param version - Optional version of the message
|
|
1793
1856
|
* @returns { producers: Service[], consumers: Service[] }
|
|
1794
1857
|
*/
|
|
1795
|
-
getProducersAndConsumersForMessage: getProducersAndConsumersForMessage(join15(
|
|
1858
|
+
getProducersAndConsumersForMessage: getProducersAndConsumersForMessage(join15(path6)),
|
|
1796
1859
|
/**
|
|
1797
1860
|
* Returns the consumers of a given schema path
|
|
1798
1861
|
* @param path - The path to the schema to get the consumers for
|
|
1799
1862
|
* @returns Service[]
|
|
1800
1863
|
*/
|
|
1801
|
-
getConsumersOfSchema: getConsumersOfSchema(join15(
|
|
1864
|
+
getConsumersOfSchema: getConsumersOfSchema(join15(path6)),
|
|
1802
1865
|
/**
|
|
1803
1866
|
* Returns the producers of a given schema path
|
|
1804
1867
|
* @param path - The path to the schema to get the producers for
|
|
1805
1868
|
* @returns Service[]
|
|
1806
1869
|
*/
|
|
1807
|
-
getProducersOfSchema: getProducersOfSchema(join15(
|
|
1870
|
+
getProducersOfSchema: getProducersOfSchema(join15(path6)),
|
|
1808
1871
|
/**
|
|
1809
1872
|
* Returns the owners for a given resource (e.g domain, service, event, command, query, etc.)
|
|
1810
1873
|
* @param id - The id of the resource to get the owners for
|
|
1811
1874
|
* @param version - Optional version of the resource
|
|
1812
1875
|
* @returns { owners: User[] }
|
|
1813
1876
|
*/
|
|
1814
|
-
getOwnersForResource: getOwnersForResource(join15(
|
|
1877
|
+
getOwnersForResource: getOwnersForResource(join15(path6)),
|
|
1815
1878
|
/**
|
|
1816
1879
|
* ================================
|
|
1817
1880
|
* Entities
|
|
@@ -1823,13 +1886,13 @@ var index_default = (path5) => {
|
|
|
1823
1886
|
* @param version - Optional id of the version to get (supports semver)
|
|
1824
1887
|
* @returns Entity|Undefined
|
|
1825
1888
|
*/
|
|
1826
|
-
getEntity: getEntity(join15(
|
|
1889
|
+
getEntity: getEntity(join15(path6)),
|
|
1827
1890
|
/**
|
|
1828
1891
|
* Returns all entities from EventCatalog
|
|
1829
1892
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1830
1893
|
* @returns Entity[]|Undefined
|
|
1831
1894
|
*/
|
|
1832
|
-
getEntities: getEntities(join15(
|
|
1895
|
+
getEntities: getEntities(join15(path6)),
|
|
1833
1896
|
/**
|
|
1834
1897
|
* Adds an entity to EventCatalog
|
|
1835
1898
|
*
|
|
@@ -1837,33 +1900,33 @@ var index_default = (path5) => {
|
|
|
1837
1900
|
* @param options - Optional options to write the entity
|
|
1838
1901
|
*
|
|
1839
1902
|
*/
|
|
1840
|
-
writeEntity: writeEntity(join15(
|
|
1903
|
+
writeEntity: writeEntity(join15(path6, "entities")),
|
|
1841
1904
|
/**
|
|
1842
1905
|
* Remove an entity from EventCatalog (modeled on the standard POSIX rm utility)
|
|
1843
1906
|
*
|
|
1844
1907
|
* @param path - The path to your entity, e.g. `/User`
|
|
1845
1908
|
*
|
|
1846
1909
|
*/
|
|
1847
|
-
rmEntity: rmEntity(join15(
|
|
1910
|
+
rmEntity: rmEntity(join15(path6, "entities")),
|
|
1848
1911
|
/**
|
|
1849
1912
|
* Remove an entity by an entity id
|
|
1850
1913
|
*
|
|
1851
1914
|
* @param id - The id of the entity you want to remove
|
|
1852
1915
|
*
|
|
1853
1916
|
*/
|
|
1854
|
-
rmEntityById: rmEntityById(join15(
|
|
1917
|
+
rmEntityById: rmEntityById(join15(path6)),
|
|
1855
1918
|
/**
|
|
1856
1919
|
* Moves a given entity id to the version directory
|
|
1857
1920
|
* @param id - The id of the entity to version
|
|
1858
1921
|
*/
|
|
1859
|
-
versionEntity: versionEntity(join15(
|
|
1922
|
+
versionEntity: versionEntity(join15(path6)),
|
|
1860
1923
|
/**
|
|
1861
1924
|
* Check to see if an entity version exists
|
|
1862
1925
|
* @param id - The id of the entity
|
|
1863
1926
|
* @param version - The version of the entity (supports semver)
|
|
1864
1927
|
* @returns
|
|
1865
1928
|
*/
|
|
1866
|
-
entityHasVersion: entityHasVersion(join15(
|
|
1929
|
+
entityHasVersion: entityHasVersion(join15(path6)),
|
|
1867
1930
|
/**
|
|
1868
1931
|
* ================================
|
|
1869
1932
|
* Data Stores
|
|
@@ -1875,42 +1938,42 @@ var index_default = (path5) => {
|
|
|
1875
1938
|
* @param options - Optional options to write the data store
|
|
1876
1939
|
*
|
|
1877
1940
|
*/
|
|
1878
|
-
writeDataStore: writeDataStore(join15(
|
|
1941
|
+
writeDataStore: writeDataStore(join15(path6, "containers")),
|
|
1879
1942
|
/**
|
|
1880
1943
|
* Returns a data store from EventCatalog
|
|
1881
1944
|
* @param id - The id of the data store to retrieve
|
|
1882
1945
|
* @param version - Optional id of the version to get (supports semver)
|
|
1883
1946
|
* @returns Container|Undefined
|
|
1884
1947
|
*/
|
|
1885
|
-
getDataStore: getDataStore(join15(
|
|
1948
|
+
getDataStore: getDataStore(join15(path6)),
|
|
1886
1949
|
/**
|
|
1887
1950
|
* Returns all data stores from EventCatalog
|
|
1888
1951
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1889
1952
|
* @returns Container[]|Undefined
|
|
1890
1953
|
*/
|
|
1891
|
-
getDataStores: getDataStores(join15(
|
|
1954
|
+
getDataStores: getDataStores(join15(path6)),
|
|
1892
1955
|
/**
|
|
1893
1956
|
* Version a data store by its id
|
|
1894
1957
|
* @param id - The id of the data store to version
|
|
1895
1958
|
*/
|
|
1896
|
-
versionDataStore: versionDataStore(join15(
|
|
1959
|
+
versionDataStore: versionDataStore(join15(path6, "containers")),
|
|
1897
1960
|
/**
|
|
1898
1961
|
* Remove a data store by its path
|
|
1899
1962
|
* @param path - The path to the data store to remove
|
|
1900
1963
|
*/
|
|
1901
|
-
rmDataStore: rmDataStore(join15(
|
|
1964
|
+
rmDataStore: rmDataStore(join15(path6, "containers")),
|
|
1902
1965
|
/**
|
|
1903
1966
|
* Remove a data store by its id
|
|
1904
1967
|
* @param id - The id of the data store to remove
|
|
1905
1968
|
*/
|
|
1906
|
-
rmDataStoreById: rmDataStoreById(join15(
|
|
1969
|
+
rmDataStoreById: rmDataStoreById(join15(path6)),
|
|
1907
1970
|
/**
|
|
1908
1971
|
* Check to see if a data store version exists
|
|
1909
1972
|
* @param id - The id of the data store
|
|
1910
1973
|
* @param version - The version of the data store (supports semver)
|
|
1911
1974
|
* @returns
|
|
1912
1975
|
*/
|
|
1913
|
-
dataStoreHasVersion: dataStoreHasVersion(join15(
|
|
1976
|
+
dataStoreHasVersion: dataStoreHasVersion(join15(path6)),
|
|
1914
1977
|
/**
|
|
1915
1978
|
* Adds a file to a data store by its id
|
|
1916
1979
|
* @param id - The id of the data store to add the file to
|
|
@@ -1918,14 +1981,14 @@ var index_default = (path5) => {
|
|
|
1918
1981
|
* @param version - Optional version of the data store to add the file to
|
|
1919
1982
|
* @returns
|
|
1920
1983
|
*/
|
|
1921
|
-
addFileToDataStore: addFileToDataStore(join15(
|
|
1984
|
+
addFileToDataStore: addFileToDataStore(join15(path6)),
|
|
1922
1985
|
/**
|
|
1923
1986
|
* Writes a data store to a service by its id
|
|
1924
1987
|
* @param dataStore - The data store to write
|
|
1925
1988
|
* @param service - The service to write the data store to
|
|
1926
1989
|
* @returns
|
|
1927
1990
|
*/
|
|
1928
|
-
writeDataStoreToService: writeDataStoreToService(join15(
|
|
1991
|
+
writeDataStoreToService: writeDataStoreToService(join15(path6))
|
|
1929
1992
|
};
|
|
1930
1993
|
};
|
|
1931
1994
|
|
|
@@ -1946,7 +2009,7 @@ var hydrateResource = async (catalogDir, resources = [], { attachSchema = false
|
|
|
1946
2009
|
const resourcePath = await getResourcePath(catalogDir, resource.id, resource.version);
|
|
1947
2010
|
let schema = "";
|
|
1948
2011
|
if (resource.schemaPath && resourcePath?.fullPath) {
|
|
1949
|
-
const pathToSchema =
|
|
2012
|
+
const pathToSchema = path5.join(path5.dirname(resourcePath?.fullPath), resource.schemaPath);
|
|
1950
2013
|
if (fs12.existsSync(pathToSchema)) {
|
|
1951
2014
|
schema = fs12.readFileSync(pathToSchema, "utf8");
|
|
1952
2015
|
}
|
|
@@ -1967,8 +2030,8 @@ var filterCollection = (collection, options) => {
|
|
|
1967
2030
|
};
|
|
1968
2031
|
var getEventCatalogConfigurationFile = (directory) => async () => {
|
|
1969
2032
|
try {
|
|
1970
|
-
const
|
|
1971
|
-
const configModule = await import(
|
|
2033
|
+
const path6 = join16(directory, "eventcatalog.config.js");
|
|
2034
|
+
const configModule = await import(path6);
|
|
1972
2035
|
return configModule.default;
|
|
1973
2036
|
} catch (error) {
|
|
1974
2037
|
console.error("Error getting event catalog configuration file", error);
|