@eventcatalog/sdk 2.10.0 → 2.12.0
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/README.md +86 -1
- package/dist/cli/index.d.mts +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/{eventcatalog.js → cli/index.js} +691 -347
- package/dist/cli/index.js.map +1 -0
- package/dist/{eventcatalog.mjs → cli/index.mjs} +765 -401
- package/dist/cli/index.mjs.map +1 -0
- package/dist/cli-docs.d.mts +43 -0
- package/dist/cli-docs.d.ts +43 -0
- package/dist/cli-docs.js +1513 -0
- package/dist/cli-docs.js.map +1 -0
- package/dist/cli-docs.mjs +1485 -0
- package/dist/cli-docs.mjs.map +1 -0
- package/dist/index.d.mts +504 -4
- package/dist/index.d.ts +504 -4
- package/dist/index.js +325 -108
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +325 -108
- package/dist/index.mjs.map +1 -1
- package/package.json +13 -4
- package/dist/channels.d.mts +0 -214
- package/dist/channels.d.ts +0 -214
- package/dist/channels.js +0 -432
- package/dist/channels.js.map +0 -1
- package/dist/channels.mjs +0 -384
- package/dist/channels.mjs.map +0 -1
- package/dist/commands.d.mts +0 -274
- package/dist/commands.d.ts +0 -274
- package/dist/commands.js +0 -394
- package/dist/commands.js.map +0 -1
- package/dist/commands.mjs +0 -350
- package/dist/commands.mjs.map +0 -1
- package/dist/containers.d.mts +0 -179
- package/dist/containers.d.ts +0 -179
- package/dist/containers.js +0 -388
- package/dist/containers.js.map +0 -1
- package/dist/containers.mjs +0 -345
- package/dist/containers.mjs.map +0 -1
- package/dist/custom-docs.d.mts +0 -89
- package/dist/custom-docs.d.ts +0 -89
- package/dist/custom-docs.js +0 -164
- package/dist/custom-docs.js.map +0 -1
- package/dist/custom-docs.mjs +0 -122
- package/dist/custom-docs.mjs.map +0 -1
- package/dist/data-stores.d.mts +0 -179
- package/dist/data-stores.d.ts +0 -179
- package/dist/data-stores.js +0 -401
- package/dist/data-stores.js.map +0 -1
- package/dist/data-stores.mjs +0 -356
- package/dist/data-stores.mjs.map +0 -1
- package/dist/domains.d.mts +0 -297
- package/dist/domains.d.ts +0 -297
- package/dist/domains.js +0 -480
- package/dist/domains.js.map +0 -1
- package/dist/domains.mjs +0 -433
- package/dist/domains.mjs.map +0 -1
- package/dist/entities.d.mts +0 -174
- package/dist/entities.d.ts +0 -174
- package/dist/entities.js +0 -348
- package/dist/entities.js.map +0 -1
- package/dist/entities.mjs +0 -307
- package/dist/entities.mjs.map +0 -1
- package/dist/eventcatalog.d.mts +0 -21
- package/dist/eventcatalog.d.ts +0 -21
- package/dist/eventcatalog.js.map +0 -1
- package/dist/eventcatalog.mjs.map +0 -1
- package/dist/events.d.mts +0 -276
- package/dist/events.d.ts +0 -276
- package/dist/events.js +0 -393
- package/dist/events.js.map +0 -1
- package/dist/events.mjs +0 -349
- package/dist/events.mjs.map +0 -1
- package/dist/messages.d.mts +0 -65
- package/dist/messages.d.ts +0 -65
- package/dist/messages.js +0 -312
- package/dist/messages.js.map +0 -1
- package/dist/messages.mjs +0 -269
- package/dist/messages.mjs.map +0 -1
- package/dist/queries.d.mts +0 -276
- package/dist/queries.d.ts +0 -276
- package/dist/queries.js +0 -394
- package/dist/queries.js.map +0 -1
- package/dist/queries.mjs +0 -350
- package/dist/queries.mjs.map +0 -1
- package/dist/services.d.mts +0 -384
- package/dist/services.d.ts +0 -384
- package/dist/services.js +0 -577
- package/dist/services.js.map +0 -1
- package/dist/services.mjs +0 -526
- package/dist/services.mjs.map +0 -1
- package/dist/teams.d.mts +0 -90
- package/dist/teams.d.ts +0 -90
- package/dist/teams.js +0 -246
- package/dist/teams.js.map +0 -1
- package/dist/teams.mjs +0 -202
- package/dist/teams.mjs.map +0 -1
- package/dist/types.d.d.mts +0 -304
- package/dist/types.d.d.ts +0 -304
- package/dist/types.d.js +0 -19
- package/dist/types.d.js.map +0 -1
- package/dist/types.d.mjs +0 -1
- package/dist/types.d.mjs.map +0 -1
- package/dist/users.d.mts +0 -83
- package/dist/users.d.ts +0 -83
- package/dist/users.js +0 -127
- package/dist/users.js.map +0 -1
- package/dist/users.mjs +0 -88
- package/dist/users.mjs.map +0 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
1
2
|
"use strict";
|
|
2
3
|
var __create = Object.create;
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
@@ -5,10 +6,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
9
|
var __copyProps = (to, from, except, desc) => {
|
|
13
10
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
11
|
for (let key of __getOwnPropNames(from))
|
|
@@ -25,20 +22,39 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
22
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
23
|
mod
|
|
27
24
|
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
25
|
|
|
30
|
-
// src/
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
26
|
+
// src/cli/index.ts
|
|
27
|
+
var import_commander = require("commander");
|
|
28
|
+
var import_node_fs8 = require("fs");
|
|
29
|
+
var import_node_path20 = require("path");
|
|
30
|
+
|
|
31
|
+
// src/cli/executor.ts
|
|
32
|
+
var import_node_fs7 = require("fs");
|
|
33
|
+
|
|
34
|
+
// src/cli/parser.ts
|
|
35
|
+
function parseArguments(rawArgs) {
|
|
36
|
+
return rawArgs.map((arg, index) => {
|
|
37
|
+
if (arg.startsWith("{") && arg.endsWith("}") || arg.startsWith("[") && arg.endsWith("]")) {
|
|
38
|
+
try {
|
|
39
|
+
return JSON.parse(arg);
|
|
40
|
+
} catch (error) {
|
|
41
|
+
if (arg.includes(":") || arg.includes(",")) {
|
|
42
|
+
throw new Error(`Invalid JSON in argument ${index + 1}: ${error instanceof Error ? error.message : String(error)}`);
|
|
43
|
+
}
|
|
44
|
+
return arg;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (arg === "true") return true;
|
|
48
|
+
if (arg === "false") return false;
|
|
49
|
+
if (/^-?\d+(\.\d+)?$/.test(arg)) {
|
|
50
|
+
return Number(arg);
|
|
51
|
+
}
|
|
52
|
+
return arg;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
39
55
|
|
|
40
56
|
// src/index.ts
|
|
41
|
-
var
|
|
57
|
+
var import_node_path19 = require("path");
|
|
42
58
|
|
|
43
59
|
// src/events.ts
|
|
44
60
|
var import_promises2 = __toESM(require("fs/promises"));
|
|
@@ -51,30 +67,30 @@ var import_fs_extra = require("fs-extra");
|
|
|
51
67
|
var import_node_path = require("path");
|
|
52
68
|
var import_gray_matter = __toESM(require("gray-matter"));
|
|
53
69
|
var import_semver = require("semver");
|
|
54
|
-
var versionExists = async (catalogDir, id,
|
|
70
|
+
var versionExists = async (catalogDir, id, version2) => {
|
|
55
71
|
const files = await getFiles(`${catalogDir}/**/index.{md,mdx}`);
|
|
56
|
-
const matchedFiles = await searchFilesForId(files, id,
|
|
72
|
+
const matchedFiles = await searchFilesForId(files, id, version2) || [];
|
|
57
73
|
return matchedFiles.length > 0;
|
|
58
74
|
};
|
|
59
|
-
var findFileById = async (catalogDir, id,
|
|
75
|
+
var findFileById = async (catalogDir, id, version2) => {
|
|
60
76
|
const files = await getFiles(`${catalogDir}/**/index.{md,mdx}`);
|
|
61
77
|
const matchedFiles = await searchFilesForId(files, id) || [];
|
|
62
78
|
const latestVersion = matchedFiles.find((path6) => !path6.includes("versioned"));
|
|
63
|
-
if (!
|
|
79
|
+
if (!version2) {
|
|
64
80
|
return latestVersion;
|
|
65
81
|
}
|
|
66
82
|
const parsedFiles = matchedFiles.map((path6) => {
|
|
67
83
|
const { data } = import_gray_matter.default.read(path6);
|
|
68
84
|
return { ...data, path: path6 };
|
|
69
85
|
});
|
|
70
|
-
if (
|
|
86
|
+
if (version2 === "latest") {
|
|
71
87
|
return latestVersion;
|
|
72
88
|
}
|
|
73
|
-
const exactMatch = parsedFiles.find((c) => c.version ===
|
|
89
|
+
const exactMatch = parsedFiles.find((c) => c.version === version2);
|
|
74
90
|
if (exactMatch) {
|
|
75
91
|
return exactMatch.path;
|
|
76
92
|
}
|
|
77
|
-
const semverRange = (0, import_semver.validRange)(
|
|
93
|
+
const semverRange = (0, import_semver.validRange)(version2);
|
|
78
94
|
if (semverRange) {
|
|
79
95
|
const match = parsedFiles.filter((c) => {
|
|
80
96
|
try {
|
|
@@ -118,14 +134,14 @@ var readMdxFile = async (path6) => {
|
|
|
118
134
|
const { markdown, ...frontmatter } = data;
|
|
119
135
|
return { ...frontmatter, markdown };
|
|
120
136
|
};
|
|
121
|
-
var searchFilesForId = async (files, id,
|
|
137
|
+
var searchFilesForId = async (files, id, version2) => {
|
|
122
138
|
const escapedId = id.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
123
139
|
const idRegex = new RegExp(`^id:\\s*(['"]|>-)?\\s*${escapedId}['"]?\\s*$`, "m");
|
|
124
|
-
const versionRegex = new RegExp(`^version:\\s*['"]?${
|
|
140
|
+
const versionRegex = new RegExp(`^version:\\s*['"]?${version2}['"]?\\s*$`, "m");
|
|
125
141
|
const matches = files.map((file) => {
|
|
126
142
|
const content = import_node_fs.default.readFileSync(file, "utf-8");
|
|
127
143
|
const hasIdMatch = content.match(idRegex);
|
|
128
|
-
if (
|
|
144
|
+
if (version2 && !content.match(versionRegex)) {
|
|
129
145
|
return void 0;
|
|
130
146
|
}
|
|
131
147
|
if (hasIdMatch) {
|
|
@@ -176,8 +192,8 @@ var versionResource = async (catalogDir, id) => {
|
|
|
176
192
|
}
|
|
177
193
|
const file = matchedFiles[0];
|
|
178
194
|
const sourceDirectory = (0, import_path.dirname)(file).replace(/[/\\]versioned[/\\][^/\\]+[/\\]/, import_node_path3.default.sep);
|
|
179
|
-
const { data: { version = "0.0.1" } = {} } = import_gray_matter2.default.read(file);
|
|
180
|
-
const targetDirectory = getVersionedDirectory(sourceDirectory,
|
|
195
|
+
const { data: { version: version2 = "0.0.1" } = {} } = import_gray_matter2.default.read(file);
|
|
196
|
+
const targetDirectory = getVersionedDirectory(sourceDirectory, version2);
|
|
181
197
|
import_node_fs2.default.mkdirSync(targetDirectory, { recursive: true });
|
|
182
198
|
const ignoreListToCopy = ["events", "commands", "queries", "versioned"];
|
|
183
199
|
await copyDir(catalogDir, sourceDirectory, targetDirectory, (src) => {
|
|
@@ -243,9 +259,9 @@ var writeResource = async (catalogDir, resource, options = {
|
|
|
243
259
|
});
|
|
244
260
|
}
|
|
245
261
|
};
|
|
246
|
-
var getResource = async (catalogDir, id,
|
|
262
|
+
var getResource = async (catalogDir, id, version2, options, filePath) => {
|
|
247
263
|
const attachSchema = options?.attachSchema || false;
|
|
248
|
-
const file = filePath || (id ? await findFileById(catalogDir, id,
|
|
264
|
+
const file = filePath || (id ? await findFileById(catalogDir, id, version2) : void 0);
|
|
249
265
|
if (!file || !import_node_fs2.default.existsSync(file)) return;
|
|
250
266
|
const { data, content } = import_gray_matter2.default.read(file);
|
|
251
267
|
if (attachSchema && data?.schemaPath) {
|
|
@@ -265,8 +281,8 @@ var getResource = async (catalogDir, id, version, options, filePath) => {
|
|
|
265
281
|
markdown: content.trim()
|
|
266
282
|
};
|
|
267
283
|
};
|
|
268
|
-
var getResourcePath = async (catalogDir, id,
|
|
269
|
-
const file = await findFileById(catalogDir, id,
|
|
284
|
+
var getResourcePath = async (catalogDir, id, version2) => {
|
|
285
|
+
const file = await findFileById(catalogDir, id, version2);
|
|
270
286
|
if (!file) return;
|
|
271
287
|
return {
|
|
272
288
|
fullPath: file,
|
|
@@ -274,8 +290,8 @@ var getResourcePath = async (catalogDir, id, version) => {
|
|
|
274
290
|
directory: (0, import_path.dirname)(file.replace(catalogDir, ""))
|
|
275
291
|
};
|
|
276
292
|
};
|
|
277
|
-
var getResourceFolderName = async (catalogDir, id,
|
|
278
|
-
const paths = await getResourcePath(catalogDir, id,
|
|
293
|
+
var getResourceFolderName = async (catalogDir, id, version2) => {
|
|
294
|
+
const paths = await getResourcePath(catalogDir, id, version2);
|
|
279
295
|
if (!paths) return;
|
|
280
296
|
return paths?.directory.split(import_node_path3.default.sep).filter(Boolean).pop();
|
|
281
297
|
};
|
|
@@ -317,9 +333,9 @@ var getResources = async (catalogDir, {
|
|
|
317
333
|
};
|
|
318
334
|
});
|
|
319
335
|
};
|
|
320
|
-
var rmResourceById = async (catalogDir, id,
|
|
336
|
+
var rmResourceById = async (catalogDir, id, version2, options) => {
|
|
321
337
|
const files = await getFiles(`${catalogDir}/**/index.{md,mdx}`);
|
|
322
|
-
const matchedFiles = await searchFilesForId(files, id,
|
|
338
|
+
const matchedFiles = await searchFilesForId(files, id, version2);
|
|
323
339
|
if (matchedFiles.length === 0) {
|
|
324
340
|
throw new Error(`No ${options?.type || "resource"} found with id: ${id}`);
|
|
325
341
|
}
|
|
@@ -344,19 +360,19 @@ var waitForFileRemoval = async (path6, maxRetries = 50, delay = 10) => {
|
|
|
344
360
|
for (let i = 0; i < maxRetries; i++) {
|
|
345
361
|
try {
|
|
346
362
|
await import_promises.default.access(path6);
|
|
347
|
-
await new Promise((
|
|
363
|
+
await new Promise((resolve3) => setTimeout(resolve3, delay));
|
|
348
364
|
} catch (error) {
|
|
349
365
|
return;
|
|
350
366
|
}
|
|
351
367
|
}
|
|
352
368
|
throw new Error(`File/directory ${path6} was not removed after ${maxRetries} attempts`);
|
|
353
369
|
};
|
|
354
|
-
var addFileToResource = async (catalogDir, id, file,
|
|
370
|
+
var addFileToResource = async (catalogDir, id, file, version2, options) => {
|
|
355
371
|
let pathToResource;
|
|
356
372
|
if (options?.path) {
|
|
357
373
|
pathToResource = (0, import_path.join)(catalogDir, options.path, "index.mdx");
|
|
358
374
|
} else {
|
|
359
|
-
pathToResource = await findFileById(catalogDir, id,
|
|
375
|
+
pathToResource = await findFileById(catalogDir, id, version2);
|
|
360
376
|
}
|
|
361
377
|
if (!pathToResource) throw new Error("Cannot find directory to write file to");
|
|
362
378
|
import_node_fs2.default.mkdirSync(import_node_path3.default.dirname(pathToResource), { recursive: true });
|
|
@@ -368,25 +384,25 @@ var addFileToResource = async (catalogDir, id, file, version, options) => {
|
|
|
368
384
|
}
|
|
369
385
|
import_node_fs2.default.writeFileSync((0, import_path.join)((0, import_path.dirname)(pathToResource), file.fileName), fileContent);
|
|
370
386
|
};
|
|
371
|
-
var getFileFromResource = async (catalogDir, id, file,
|
|
372
|
-
const pathToResource = await findFileById(catalogDir, id,
|
|
387
|
+
var getFileFromResource = async (catalogDir, id, file, version2) => {
|
|
388
|
+
const pathToResource = await findFileById(catalogDir, id, version2);
|
|
373
389
|
if (!pathToResource) throw new Error("Cannot find directory of resource");
|
|
374
390
|
const exists = await import_promises.default.access((0, import_path.join)((0, import_path.dirname)(pathToResource), file.fileName)).then(() => true).catch(() => false);
|
|
375
|
-
if (!exists) throw new Error(`File ${file.fileName} does not exist in resource ${id} v(${
|
|
391
|
+
if (!exists) throw new Error(`File ${file.fileName} does not exist in resource ${id} v(${version2})`);
|
|
376
392
|
return import_node_fs2.default.readFileSync((0, import_path.join)((0, import_path.dirname)(pathToResource), file.fileName), "utf-8");
|
|
377
393
|
};
|
|
378
|
-
var getVersionedDirectory = (sourceDirectory,
|
|
379
|
-
return (0, import_path.join)(sourceDirectory, "versioned",
|
|
394
|
+
var getVersionedDirectory = (sourceDirectory, version2) => {
|
|
395
|
+
return (0, import_path.join)(sourceDirectory, "versioned", version2);
|
|
380
396
|
};
|
|
381
|
-
var isLatestVersion = async (catalogDir, id,
|
|
382
|
-
const resource = await getResource(catalogDir, id,
|
|
397
|
+
var isLatestVersion = async (catalogDir, id, version2) => {
|
|
398
|
+
const resource = await getResource(catalogDir, id, version2);
|
|
383
399
|
if (!resource) return false;
|
|
384
|
-
const pathToResource = await getResourcePath(catalogDir, id,
|
|
400
|
+
const pathToResource = await getResourcePath(catalogDir, id, version2);
|
|
385
401
|
return !pathToResource?.relativePath.replace(/\\/g, "/").includes("/versioned/");
|
|
386
402
|
};
|
|
387
403
|
|
|
388
404
|
// src/events.ts
|
|
389
|
-
var getEvent = (directory) => async (id,
|
|
405
|
+
var getEvent = (directory) => async (id, version2, options) => getResource(directory, id, version2, { type: "event", ...options });
|
|
390
406
|
var getEvents = (directory) => async (options) => getResources(directory, { type: "events", ...options });
|
|
391
407
|
var writeEvent = (directory) => async (event, options = {
|
|
392
408
|
path: "",
|
|
@@ -405,23 +421,23 @@ var writeEventToService = (directory) => async (event, service, options = { path
|
|
|
405
421
|
var rmEvent = (directory) => async (path6) => {
|
|
406
422
|
await import_promises2.default.rm((0, import_node_path4.join)(directory, path6), { recursive: true });
|
|
407
423
|
};
|
|
408
|
-
var rmEventById = (directory) => async (id,
|
|
409
|
-
await rmResourceById(directory, id,
|
|
424
|
+
var rmEventById = (directory) => async (id, version2, persistFiles) => {
|
|
425
|
+
await rmResourceById(directory, id, version2, { type: "event", persistFiles });
|
|
410
426
|
};
|
|
411
427
|
var versionEvent = (directory) => async (id) => versionResource(directory, id);
|
|
412
|
-
var addFileToEvent = (directory) => async (id, file,
|
|
413
|
-
var addSchemaToEvent = (directory) => async (id, schema,
|
|
414
|
-
await addFileToEvent(directory)(id, { content: schema.schema, fileName: schema.fileName },
|
|
428
|
+
var addFileToEvent = (directory) => async (id, file, version2, options) => addFileToResource(directory, id, file, version2, options);
|
|
429
|
+
var addSchemaToEvent = (directory) => async (id, schema, version2, options) => {
|
|
430
|
+
await addFileToEvent(directory)(id, { content: schema.schema, fileName: schema.fileName }, version2, options);
|
|
415
431
|
};
|
|
416
|
-
var eventHasVersion = (directory) => async (id,
|
|
417
|
-
const file = await findFileById(directory, id,
|
|
432
|
+
var eventHasVersion = (directory) => async (id, version2) => {
|
|
433
|
+
const file = await findFileById(directory, id, version2);
|
|
418
434
|
return !!file;
|
|
419
435
|
};
|
|
420
436
|
|
|
421
437
|
// src/commands.ts
|
|
422
438
|
var import_promises3 = __toESM(require("fs/promises"));
|
|
423
439
|
var import_node_path5 = require("path");
|
|
424
|
-
var getCommand = (directory) => async (id,
|
|
440
|
+
var getCommand = (directory) => async (id, version2, options) => getResource(directory, id, version2, { type: "command", ...options });
|
|
425
441
|
var getCommands = (directory) => async (options) => getResources(directory, { type: "commands", ...options });
|
|
426
442
|
var writeCommand = (directory) => async (command, options = {
|
|
427
443
|
path: "",
|
|
@@ -441,21 +457,21 @@ var writeCommandToService = (directory) => async (command, service, options = {
|
|
|
441
457
|
var rmCommand = (directory) => async (path6) => {
|
|
442
458
|
await import_promises3.default.rm((0, import_node_path5.join)(directory, path6), { recursive: true });
|
|
443
459
|
};
|
|
444
|
-
var rmCommandById = (directory) => async (id,
|
|
460
|
+
var rmCommandById = (directory) => async (id, version2, persistFiles) => rmResourceById(directory, id, version2, { type: "command", persistFiles });
|
|
445
461
|
var versionCommand = (directory) => async (id) => versionResource(directory, id);
|
|
446
|
-
var addFileToCommand = (directory) => async (id, file,
|
|
447
|
-
var addSchemaToCommand = (directory) => async (id, schema,
|
|
448
|
-
await addFileToCommand(directory)(id, { content: schema.schema, fileName: schema.fileName },
|
|
462
|
+
var addFileToCommand = (directory) => async (id, file, version2, options) => addFileToResource(directory, id, file, version2, options);
|
|
463
|
+
var addSchemaToCommand = (directory) => async (id, schema, version2, options) => {
|
|
464
|
+
await addFileToCommand(directory)(id, { content: schema.schema, fileName: schema.fileName }, version2, options);
|
|
449
465
|
};
|
|
450
|
-
var commandHasVersion = (directory) => async (id,
|
|
451
|
-
const file = await findFileById(directory, id,
|
|
466
|
+
var commandHasVersion = (directory) => async (id, version2) => {
|
|
467
|
+
const file = await findFileById(directory, id, version2);
|
|
452
468
|
return !!file;
|
|
453
469
|
};
|
|
454
470
|
|
|
455
471
|
// src/queries.ts
|
|
456
472
|
var import_promises4 = __toESM(require("fs/promises"));
|
|
457
473
|
var import_node_path6 = require("path");
|
|
458
|
-
var getQuery = (directory) => async (id,
|
|
474
|
+
var getQuery = (directory) => async (id, version2, options) => getResource(directory, id, version2, { type: "query", ...options });
|
|
459
475
|
var writeQuery = (directory) => async (query, options = {
|
|
460
476
|
path: "",
|
|
461
477
|
override: false,
|
|
@@ -475,23 +491,23 @@ var writeQueryToService = (directory) => async (query, service, options = { path
|
|
|
475
491
|
var rmQuery = (directory) => async (path6) => {
|
|
476
492
|
await import_promises4.default.rm((0, import_node_path6.join)(directory, path6), { recursive: true });
|
|
477
493
|
};
|
|
478
|
-
var rmQueryById = (directory) => async (id,
|
|
479
|
-
await rmResourceById(directory, id,
|
|
494
|
+
var rmQueryById = (directory) => async (id, version2, persistFiles) => {
|
|
495
|
+
await rmResourceById(directory, id, version2, { type: "query", persistFiles });
|
|
480
496
|
};
|
|
481
497
|
var versionQuery = (directory) => async (id) => versionResource(directory, id);
|
|
482
|
-
var addFileToQuery = (directory) => async (id, file,
|
|
483
|
-
var addSchemaToQuery = (directory) => async (id, schema,
|
|
484
|
-
await addFileToQuery(directory)(id, { content: schema.schema, fileName: schema.fileName },
|
|
498
|
+
var addFileToQuery = (directory) => async (id, file, version2, options) => addFileToResource(directory, id, file, version2, options);
|
|
499
|
+
var addSchemaToQuery = (directory) => async (id, schema, version2, options) => {
|
|
500
|
+
await addFileToQuery(directory)(id, { content: schema.schema, fileName: schema.fileName }, version2, options);
|
|
485
501
|
};
|
|
486
|
-
var queryHasVersion = (directory) => async (id,
|
|
487
|
-
const file = await findFileById(directory, id,
|
|
502
|
+
var queryHasVersion = (directory) => async (id, version2) => {
|
|
503
|
+
const file = await findFileById(directory, id, version2);
|
|
488
504
|
return !!file;
|
|
489
505
|
};
|
|
490
506
|
|
|
491
507
|
// src/services.ts
|
|
492
508
|
var import_promises5 = __toESM(require("fs/promises"));
|
|
493
509
|
var import_node_path7 = require("path");
|
|
494
|
-
var getService = (directory) => async (id,
|
|
510
|
+
var getService = (directory) => async (id, version2) => getResource(directory, id, version2, { type: "service" });
|
|
495
511
|
var getServiceByPath = (directory) => async (path6) => {
|
|
496
512
|
const service = await getResource(directory, void 0, void 0, { type: "service" }, path6);
|
|
497
513
|
return service;
|
|
@@ -529,13 +545,13 @@ var versionService = (directory) => async (id) => versionResource(directory, id)
|
|
|
529
545
|
var rmService = (directory) => async (path6) => {
|
|
530
546
|
await import_promises5.default.rm((0, import_node_path7.join)(directory, path6), { recursive: true });
|
|
531
547
|
};
|
|
532
|
-
var rmServiceById = (directory) => async (id,
|
|
533
|
-
await rmResourceById(directory, id,
|
|
548
|
+
var rmServiceById = (directory) => async (id, version2, persistFiles) => {
|
|
549
|
+
await rmResourceById(directory, id, version2, { type: "service", persistFiles });
|
|
534
550
|
};
|
|
535
|
-
var addFileToService = (directory) => async (id, file,
|
|
536
|
-
var getSpecificationFilesForService = (directory) => async (id,
|
|
537
|
-
let service = await getService(directory)(id,
|
|
538
|
-
const filePathToService = await findFileById(directory, id,
|
|
551
|
+
var addFileToService = (directory) => async (id, file, version2) => addFileToResource(directory, id, file, version2);
|
|
552
|
+
var getSpecificationFilesForService = (directory) => async (id, version2) => {
|
|
553
|
+
let service = await getService(directory)(id, version2);
|
|
554
|
+
const filePathToService = await findFileById(directory, id, version2);
|
|
539
555
|
if (!filePathToService) throw new Error("Cannot find directory of service");
|
|
540
556
|
let specs = [];
|
|
541
557
|
if (service.specifications) {
|
|
@@ -553,16 +569,16 @@ var getSpecificationFilesForService = (directory) => async (id, version) => {
|
|
|
553
569
|
if (!fileName) {
|
|
554
570
|
throw new Error(`Specification file name for ${fileName} is undefined`);
|
|
555
571
|
}
|
|
556
|
-
const rawFile = await getFileFromResource(directory, id, { fileName },
|
|
572
|
+
const rawFile = await getFileFromResource(directory, id, { fileName }, version2);
|
|
557
573
|
return { key, content: rawFile, fileName, path: (0, import_node_path7.join)((0, import_node_path7.dirname)(filePathToService), fileName) };
|
|
558
574
|
});
|
|
559
575
|
specs = await Promise.all(getSpecs);
|
|
560
576
|
}
|
|
561
577
|
return specs;
|
|
562
578
|
};
|
|
563
|
-
var addMessageToService = (directory) => async (id, direction, event,
|
|
564
|
-
let service = await getService(directory)(id,
|
|
565
|
-
const servicePath = await getResourcePath(directory, id,
|
|
579
|
+
var addMessageToService = (directory) => async (id, direction, event, version2) => {
|
|
580
|
+
let service = await getService(directory)(id, version2);
|
|
581
|
+
const servicePath = await getResourcePath(directory, id, version2);
|
|
566
582
|
const extension = (0, import_node_path7.extname)(servicePath?.fullPath || "");
|
|
567
583
|
if (direction === "sends") {
|
|
568
584
|
if (service.sends === void 0) {
|
|
@@ -587,17 +603,17 @@ var addMessageToService = (directory) => async (id, direction, event, version) =
|
|
|
587
603
|
} else {
|
|
588
604
|
throw new Error(`Direction ${direction} is invalid, only 'receives' and 'sends' are supported`);
|
|
589
605
|
}
|
|
590
|
-
const existingResource = await findFileById(directory, id,
|
|
606
|
+
const existingResource = await findFileById(directory, id, version2);
|
|
591
607
|
if (!existingResource) {
|
|
592
608
|
throw new Error(`Cannot find service ${id} in the catalog`);
|
|
593
609
|
}
|
|
594
610
|
const path6 = existingResource.split(/[\\/]+services/)[0];
|
|
595
611
|
const pathToResource = (0, import_node_path7.join)(path6, "services");
|
|
596
|
-
await rmServiceById(directory)(id,
|
|
612
|
+
await rmServiceById(directory)(id, version2);
|
|
597
613
|
await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
|
|
598
614
|
};
|
|
599
|
-
var serviceHasVersion = (directory) => async (id,
|
|
600
|
-
const file = await findFileById(directory, id,
|
|
615
|
+
var serviceHasVersion = (directory) => async (id, version2) => {
|
|
616
|
+
const file = await findFileById(directory, id, version2);
|
|
601
617
|
return !!file;
|
|
602
618
|
};
|
|
603
619
|
var isService = (directory) => async (path6) => {
|
|
@@ -607,9 +623,9 @@ var isService = (directory) => async (path6) => {
|
|
|
607
623
|
return !!service && segments.includes("services");
|
|
608
624
|
};
|
|
609
625
|
var toService = (directory) => async (file) => toResource(directory, file);
|
|
610
|
-
var addEntityToService = (directory) => async (id, entity,
|
|
611
|
-
let service = await getService(directory)(id,
|
|
612
|
-
const servicePath = await getResourcePath(directory, id,
|
|
626
|
+
var addEntityToService = (directory) => async (id, entity, version2) => {
|
|
627
|
+
let service = await getService(directory)(id, version2);
|
|
628
|
+
const servicePath = await getResourcePath(directory, id, version2);
|
|
613
629
|
const extension = (0, import_node_path7.extname)(servicePath?.fullPath || "");
|
|
614
630
|
if (service.entities === void 0) {
|
|
615
631
|
service.entities = [];
|
|
@@ -620,18 +636,18 @@ var addEntityToService = (directory) => async (id, entity, version) => {
|
|
|
620
636
|
}
|
|
621
637
|
}
|
|
622
638
|
service.entities.push({ id: entity.id, version: entity.version });
|
|
623
|
-
const existingResource = await findFileById(directory, id,
|
|
639
|
+
const existingResource = await findFileById(directory, id, version2);
|
|
624
640
|
if (!existingResource) {
|
|
625
641
|
throw new Error(`Cannot find service ${id} in the catalog`);
|
|
626
642
|
}
|
|
627
643
|
const path6 = existingResource.split(/[\\/]+services/)[0];
|
|
628
644
|
const pathToResource = (0, import_node_path7.join)(path6, "services");
|
|
629
|
-
await rmServiceById(directory)(id,
|
|
645
|
+
await rmServiceById(directory)(id, version2);
|
|
630
646
|
await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
|
|
631
647
|
};
|
|
632
|
-
var addDataStoreToService = (directory) => async (id, operation, dataStore,
|
|
633
|
-
let service = await getService(directory)(id,
|
|
634
|
-
const servicePath = await getResourcePath(directory, id,
|
|
648
|
+
var addDataStoreToService = (directory) => async (id, operation, dataStore, version2) => {
|
|
649
|
+
let service = await getService(directory)(id, version2);
|
|
650
|
+
const servicePath = await getResourcePath(directory, id, version2);
|
|
635
651
|
const extension = (0, import_node_path7.extname)(servicePath?.fullPath || "");
|
|
636
652
|
if (operation === "writesTo") {
|
|
637
653
|
if (service.writesTo === void 0) {
|
|
@@ -656,13 +672,13 @@ var addDataStoreToService = (directory) => async (id, operation, dataStore, vers
|
|
|
656
672
|
} else {
|
|
657
673
|
throw new Error(`Operation ${operation} is invalid, only 'writesTo' and 'readsFrom' are supported`);
|
|
658
674
|
}
|
|
659
|
-
const existingResource = await findFileById(directory, id,
|
|
675
|
+
const existingResource = await findFileById(directory, id, version2);
|
|
660
676
|
if (!existingResource) {
|
|
661
677
|
throw new Error(`Cannot find service ${id} in the catalog`);
|
|
662
678
|
}
|
|
663
679
|
const path6 = existingResource.split(/[\\/]+services/)[0];
|
|
664
680
|
const pathToResource = (0, import_node_path7.join)(path6, "services");
|
|
665
|
-
await rmServiceById(directory)(id,
|
|
681
|
+
await rmServiceById(directory)(id, version2);
|
|
666
682
|
await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
|
|
667
683
|
};
|
|
668
684
|
|
|
@@ -671,7 +687,7 @@ var import_promises6 = __toESM(require("fs/promises"));
|
|
|
671
687
|
var import_node_path8 = __toESM(require("path"));
|
|
672
688
|
var import_node_fs3 = __toESM(require("fs"));
|
|
673
689
|
var import_gray_matter3 = __toESM(require("gray-matter"));
|
|
674
|
-
var getDomain = (directory) => async (id,
|
|
690
|
+
var getDomain = (directory) => async (id, version2) => getResource(directory, id, version2, { type: "domain" });
|
|
675
691
|
var getDomains = (directory) => async (options) => getResources(directory, {
|
|
676
692
|
type: "domains",
|
|
677
693
|
ignore: ["**/services/**", "**/events/**", "**/commands/**", "**/queries/**", "**/flows/**", "**/entities/**"],
|
|
@@ -690,22 +706,31 @@ var writeDomain = (directory) => async (domain, options = {
|
|
|
690
706
|
if (Array.isArray(domain.domains)) {
|
|
691
707
|
resource.domains = uniqueVersions(domain.domains);
|
|
692
708
|
}
|
|
709
|
+
if (Array.isArray(domain.sends)) {
|
|
710
|
+
resource.sends = uniqueVersions(domain.sends);
|
|
711
|
+
}
|
|
712
|
+
if (Array.isArray(domain.receives)) {
|
|
713
|
+
resource.receives = uniqueVersions(domain.receives);
|
|
714
|
+
}
|
|
715
|
+
if (Array.isArray(domain.dataProducts)) {
|
|
716
|
+
resource.dataProducts = uniqueVersions(domain.dataProducts);
|
|
717
|
+
}
|
|
693
718
|
return await writeResource(directory, resource, { ...options, type: "domain" });
|
|
694
719
|
};
|
|
695
720
|
var versionDomain = (directory) => async (id) => versionResource(directory, id);
|
|
696
721
|
var rmDomain = (directory) => async (path6) => {
|
|
697
722
|
await import_promises6.default.rm((0, import_node_path8.join)(directory, path6), { recursive: true });
|
|
698
723
|
};
|
|
699
|
-
var rmDomainById = (directory) => async (id,
|
|
700
|
-
var addFileToDomain = (directory) => async (id, file,
|
|
701
|
-
var addUbiquitousLanguageToDomain = (directory) => async (id, ubiquitousLanguageDictionary,
|
|
724
|
+
var rmDomainById = (directory) => async (id, version2, persistFiles) => rmResourceById(directory, id, version2, { type: "domain", persistFiles });
|
|
725
|
+
var addFileToDomain = (directory) => async (id, file, version2) => addFileToResource(directory, id, file, version2);
|
|
726
|
+
var addUbiquitousLanguageToDomain = (directory) => async (id, ubiquitousLanguageDictionary, version2) => {
|
|
702
727
|
const content = import_gray_matter3.default.stringify("", {
|
|
703
728
|
...ubiquitousLanguageDictionary
|
|
704
729
|
});
|
|
705
|
-
await addFileToResource(directory, id, { content, fileName: "ubiquitous-language.mdx" },
|
|
730
|
+
await addFileToResource(directory, id, { content, fileName: "ubiquitous-language.mdx" }, version2);
|
|
706
731
|
};
|
|
707
|
-
var getUbiquitousLanguageFromDomain = (directory) => async (id,
|
|
708
|
-
const pathToDomain = await findFileById(directory, id,
|
|
732
|
+
var getUbiquitousLanguageFromDomain = (directory) => async (id, version2) => {
|
|
733
|
+
const pathToDomain = await findFileById(directory, id, version2) || "";
|
|
709
734
|
const pathToUbiquitousLanguage = import_node_path8.default.join(import_node_path8.default.dirname(pathToDomain), "ubiquitous-language.mdx");
|
|
710
735
|
const fileExists = import_node_fs3.default.existsSync(pathToUbiquitousLanguage);
|
|
711
736
|
if (!fileExists) {
|
|
@@ -714,13 +739,13 @@ var getUbiquitousLanguageFromDomain = (directory) => async (id, version) => {
|
|
|
714
739
|
const content = await readMdxFile(pathToUbiquitousLanguage);
|
|
715
740
|
return content;
|
|
716
741
|
};
|
|
717
|
-
var domainHasVersion = (directory) => async (id,
|
|
718
|
-
const file = await findFileById(directory, id,
|
|
742
|
+
var domainHasVersion = (directory) => async (id, version2) => {
|
|
743
|
+
const file = await findFileById(directory, id, version2);
|
|
719
744
|
return !!file;
|
|
720
745
|
};
|
|
721
|
-
var addServiceToDomain = (directory) => async (id, service,
|
|
722
|
-
let domain = await getDomain(directory)(id,
|
|
723
|
-
const domainPath = await getResourcePath(directory, id,
|
|
746
|
+
var addServiceToDomain = (directory) => async (id, service, version2) => {
|
|
747
|
+
let domain = await getDomain(directory)(id, version2);
|
|
748
|
+
const domainPath = await getResourcePath(directory, id, version2);
|
|
724
749
|
const extension = import_node_path8.default.extname(domainPath?.fullPath || "");
|
|
725
750
|
if (domain.services === void 0) {
|
|
726
751
|
domain.services = [];
|
|
@@ -730,12 +755,12 @@ var addServiceToDomain = (directory) => async (id, service, version) => {
|
|
|
730
755
|
return;
|
|
731
756
|
}
|
|
732
757
|
domain.services.push(service);
|
|
733
|
-
await rmDomainById(directory)(id,
|
|
758
|
+
await rmDomainById(directory)(id, version2, true);
|
|
734
759
|
await writeDomain(directory)(domain, { format: extension === ".md" ? "md" : "mdx" });
|
|
735
760
|
};
|
|
736
|
-
var addSubDomainToDomain = (directory) => async (id, subDomain,
|
|
737
|
-
let domain = await getDomain(directory)(id,
|
|
738
|
-
const domainPath = await getResourcePath(directory, id,
|
|
761
|
+
var addSubDomainToDomain = (directory) => async (id, subDomain, version2) => {
|
|
762
|
+
let domain = await getDomain(directory)(id, version2);
|
|
763
|
+
const domainPath = await getResourcePath(directory, id, version2);
|
|
739
764
|
const extension = import_node_path8.default.extname(domainPath?.fullPath || "");
|
|
740
765
|
if (domain.domains === void 0) {
|
|
741
766
|
domain.domains = [];
|
|
@@ -745,12 +770,12 @@ var addSubDomainToDomain = (directory) => async (id, subDomain, version) => {
|
|
|
745
770
|
return;
|
|
746
771
|
}
|
|
747
772
|
domain.domains.push(subDomain);
|
|
748
|
-
await rmDomainById(directory)(id,
|
|
773
|
+
await rmDomainById(directory)(id, version2, true);
|
|
749
774
|
await writeDomain(directory)(domain, { format: extension === ".md" ? "md" : "mdx" });
|
|
750
775
|
};
|
|
751
|
-
var addEntityToDomain = (directory) => async (id, entity,
|
|
752
|
-
let domain = await getDomain(directory)(id,
|
|
753
|
-
const domainPath = await getResourcePath(directory, id,
|
|
776
|
+
var addEntityToDomain = (directory) => async (id, entity, version2) => {
|
|
777
|
+
let domain = await getDomain(directory)(id, version2);
|
|
778
|
+
const domainPath = await getResourcePath(directory, id, version2);
|
|
754
779
|
const extension = import_node_path8.default.extname(domainPath?.fullPath || "");
|
|
755
780
|
if (domain.entities === void 0) {
|
|
756
781
|
domain.entities = [];
|
|
@@ -760,27 +785,81 @@ var addEntityToDomain = (directory) => async (id, entity, version) => {
|
|
|
760
785
|
return;
|
|
761
786
|
}
|
|
762
787
|
domain.entities.push(entity);
|
|
763
|
-
await rmDomainById(directory)(id,
|
|
788
|
+
await rmDomainById(directory)(id, version2, true);
|
|
764
789
|
await writeDomain(directory)(domain, { format: extension === ".md" ? "md" : "mdx" });
|
|
765
790
|
};
|
|
791
|
+
var addDataProductToDomain = (directory) => async (id, dataProduct, version2) => {
|
|
792
|
+
let domain = await getDomain(directory)(id, version2);
|
|
793
|
+
const domainPath = await getResourcePath(directory, id, version2);
|
|
794
|
+
const extension = import_node_path8.default.extname(domainPath?.fullPath || "");
|
|
795
|
+
if (domain.dataProducts === void 0) {
|
|
796
|
+
domain.dataProducts = [];
|
|
797
|
+
}
|
|
798
|
+
const dataProductExistsInList = domain.dataProducts.some(
|
|
799
|
+
(dp) => dp.id === dataProduct.id && dp.version === dataProduct.version
|
|
800
|
+
);
|
|
801
|
+
if (dataProductExistsInList) {
|
|
802
|
+
return;
|
|
803
|
+
}
|
|
804
|
+
domain.dataProducts.push(dataProduct);
|
|
805
|
+
await rmDomainById(directory)(id, version2, true);
|
|
806
|
+
await writeDomain(directory)(domain, { format: extension === ".md" ? "md" : "mdx" });
|
|
807
|
+
};
|
|
808
|
+
var addMessageToDomain = (directory) => async (id, direction, message, version2) => {
|
|
809
|
+
let domain = await getDomain(directory)(id, version2);
|
|
810
|
+
const domainPath = await getResourcePath(directory, id, version2);
|
|
811
|
+
const extension = import_node_path8.default.extname(domainPath?.fullPath || "");
|
|
812
|
+
if (direction === "sends") {
|
|
813
|
+
if (domain.sends === void 0) {
|
|
814
|
+
domain.sends = [];
|
|
815
|
+
}
|
|
816
|
+
for (let i = 0; i < domain.sends.length; i++) {
|
|
817
|
+
if (domain.sends[i].id === message.id && domain.sends[i].version === message.version) {
|
|
818
|
+
return;
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
domain.sends.push({ id: message.id, version: message.version });
|
|
822
|
+
} else if (direction === "receives") {
|
|
823
|
+
if (domain.receives === void 0) {
|
|
824
|
+
domain.receives = [];
|
|
825
|
+
}
|
|
826
|
+
for (let i = 0; i < domain.receives.length; i++) {
|
|
827
|
+
if (domain.receives[i].id === message.id && domain.receives[i].version === message.version) {
|
|
828
|
+
return;
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
domain.receives.push({ id: message.id, version: message.version });
|
|
832
|
+
} else {
|
|
833
|
+
throw new Error(`Direction ${direction} is invalid, only 'receives' and 'sends' are supported`);
|
|
834
|
+
}
|
|
835
|
+
const existingResource = await findFileById(directory, id, version2);
|
|
836
|
+
if (!existingResource) {
|
|
837
|
+
throw new Error(`Cannot find domain ${id} in the catalog`);
|
|
838
|
+
}
|
|
839
|
+
const normalizedPath = existingResource.replace(/\\/g, "/");
|
|
840
|
+
const lastDomainsIndex = normalizedPath.lastIndexOf("/domains/");
|
|
841
|
+
const pathToResource = existingResource.substring(0, lastDomainsIndex + "/domains".length);
|
|
842
|
+
await rmDomainById(directory)(id, version2, true);
|
|
843
|
+
await writeDomain(pathToResource)(domain, { format: extension === ".md" ? "md" : "mdx" });
|
|
844
|
+
};
|
|
766
845
|
|
|
767
846
|
// src/channels.ts
|
|
768
847
|
var import_promises7 = __toESM(require("fs/promises"));
|
|
769
848
|
var import_node_path9 = require("path");
|
|
770
|
-
var getChannel = (directory) => async (id,
|
|
849
|
+
var getChannel = (directory) => async (id, version2) => getResource(directory, id, version2, { type: "channel" });
|
|
771
850
|
var getChannels = (directory) => async (options) => getResources(directory, { type: "channels", ...options });
|
|
772
851
|
var writeChannel = (directory) => async (channel, options = { path: "" }) => writeResource(directory, { ...channel }, { ...options, type: "channel" });
|
|
773
852
|
var rmChannel = (directory) => async (path6) => {
|
|
774
853
|
await import_promises7.default.rm((0, import_node_path9.join)(directory, path6), { recursive: true });
|
|
775
854
|
};
|
|
776
|
-
var rmChannelById = (directory) => async (id,
|
|
855
|
+
var rmChannelById = (directory) => async (id, version2, persistFiles) => rmResourceById(directory, id, version2, { type: "channel", persistFiles });
|
|
777
856
|
var versionChannel = (directory) => async (id) => versionResource(directory, id);
|
|
778
|
-
var channelHasVersion = (directory) => async (id,
|
|
779
|
-
const file = await findFileById(directory, id,
|
|
857
|
+
var channelHasVersion = (directory) => async (id, version2) => {
|
|
858
|
+
const file = await findFileById(directory, id, version2);
|
|
780
859
|
return !!file;
|
|
781
860
|
};
|
|
782
|
-
var addMessageToChannel = (directory, collection) => async (id, _message,
|
|
783
|
-
let channel = await getChannel(directory)(id,
|
|
861
|
+
var addMessageToChannel = (directory, collection) => async (id, _message, version2) => {
|
|
862
|
+
let channel = await getChannel(directory)(id, version2);
|
|
784
863
|
const functions = {
|
|
785
864
|
events: {
|
|
786
865
|
getMessage: getEvent,
|
|
@@ -831,13 +910,13 @@ var getMessageBySchemaPath = (directory) => async (path6, options) => {
|
|
|
831
910
|
}
|
|
832
911
|
const messageFile = files[0];
|
|
833
912
|
const { data } = import_gray_matter4.default.read(messageFile);
|
|
834
|
-
const { id, version } = data;
|
|
835
|
-
if (!id || !
|
|
913
|
+
const { id, version: version2 } = data;
|
|
914
|
+
if (!id || !version2) {
|
|
836
915
|
throw new Error(`Message definition file at ${messageFile} is missing 'id' or 'version' in its frontmatter.`);
|
|
837
916
|
}
|
|
838
|
-
const message = await getResource(directory, id,
|
|
917
|
+
const message = await getResource(directory, id, version2, { type: "message", ...options });
|
|
839
918
|
if (!message) {
|
|
840
|
-
throw new Error(`Message resource with id '${id}' and version '${
|
|
919
|
+
throw new Error(`Message resource with id '${id}' and version '${version2}' not found, as referenced in ${messageFile}.`);
|
|
841
920
|
}
|
|
842
921
|
return message;
|
|
843
922
|
} catch (error) {
|
|
@@ -848,12 +927,12 @@ var getMessageBySchemaPath = (directory) => async (path6, options) => {
|
|
|
848
927
|
throw new Error(`Failed to retrieve message from ${pathToMessage} due to an unknown error.`);
|
|
849
928
|
}
|
|
850
929
|
};
|
|
851
|
-
var getProducersAndConsumersForMessage = (directory) => async (id,
|
|
930
|
+
var getProducersAndConsumersForMessage = (directory) => async (id, version2, options) => {
|
|
852
931
|
const services = await getServices(directory)({ latestOnly: options?.latestOnly ?? true });
|
|
853
|
-
const message = await getResource(directory, id,
|
|
854
|
-
const isMessageLatestVersion = await isLatestVersion(directory, id,
|
|
932
|
+
const message = await getResource(directory, id, version2, { type: "message" });
|
|
933
|
+
const isMessageLatestVersion = await isLatestVersion(directory, id, version2);
|
|
855
934
|
if (!message) {
|
|
856
|
-
throw new Error(`Message resource with id '${id}' and version '${
|
|
935
|
+
throw new Error(`Message resource with id '${id}' and version '${version2}' not found.`);
|
|
857
936
|
}
|
|
858
937
|
const producers = [];
|
|
859
938
|
const consumers = [];
|
|
@@ -1045,8 +1124,8 @@ var writeTeam = (catalogDir) => async (team, options = {}) => {
|
|
|
1045
1124
|
var rmTeamById = (catalogDir) => async (id) => {
|
|
1046
1125
|
await import_promises9.default.rm((0, import_node_path13.join)(catalogDir, `${id}.mdx`), { recursive: true });
|
|
1047
1126
|
};
|
|
1048
|
-
var getOwnersForResource = (catalogDir) => async (id,
|
|
1049
|
-
const resource = await getResource(catalogDir, id,
|
|
1127
|
+
var getOwnersForResource = (catalogDir) => async (id, version2) => {
|
|
1128
|
+
const resource = await getResource(catalogDir, id, version2);
|
|
1050
1129
|
let owners = [];
|
|
1051
1130
|
if (!resource) return [];
|
|
1052
1131
|
if (!resource.owners) return [];
|
|
@@ -1064,10 +1143,107 @@ var getOwnersForResource = (catalogDir) => async (id, version) => {
|
|
|
1064
1143
|
return owners;
|
|
1065
1144
|
};
|
|
1066
1145
|
|
|
1146
|
+
// src/eventcatalog.ts
|
|
1147
|
+
var import_fs = __toESM(require("fs"));
|
|
1148
|
+
var import_node_path15 = __toESM(require("path"));
|
|
1149
|
+
var DUMP_VERSION = "0.0.1";
|
|
1150
|
+
var getEventCatalogVersion = async (catalogDir) => {
|
|
1151
|
+
try {
|
|
1152
|
+
const packageJson = import_fs.default.readFileSync((0, import_node_path15.join)(catalogDir, "package.json"), "utf8");
|
|
1153
|
+
const packageJsonObject = JSON.parse(packageJson);
|
|
1154
|
+
return packageJsonObject["dependencies"]["@eventcatalog/core"];
|
|
1155
|
+
} catch (error) {
|
|
1156
|
+
return "unknown";
|
|
1157
|
+
}
|
|
1158
|
+
};
|
|
1159
|
+
var hydrateResource = async (catalogDir, resources = [], { attachSchema = false } = {}) => {
|
|
1160
|
+
return await Promise.all(
|
|
1161
|
+
resources.map(async (resource) => {
|
|
1162
|
+
const resourcePath = await getResourcePath(catalogDir, resource.id, resource.version);
|
|
1163
|
+
let schema = "";
|
|
1164
|
+
if (resource.schemaPath && resourcePath?.fullPath) {
|
|
1165
|
+
const pathToSchema = import_node_path15.default.join(import_node_path15.default.dirname(resourcePath?.fullPath), resource.schemaPath);
|
|
1166
|
+
if (import_fs.default.existsSync(pathToSchema)) {
|
|
1167
|
+
schema = import_fs.default.readFileSync(pathToSchema, "utf8");
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
const eventcatalog = schema ? { directory: resourcePath?.directory, schema } : { directory: resourcePath?.directory };
|
|
1171
|
+
return {
|
|
1172
|
+
...resource,
|
|
1173
|
+
_eventcatalog: eventcatalog
|
|
1174
|
+
};
|
|
1175
|
+
})
|
|
1176
|
+
);
|
|
1177
|
+
};
|
|
1178
|
+
var filterCollection = (collection, options) => {
|
|
1179
|
+
return collection.map((item) => ({
|
|
1180
|
+
...item,
|
|
1181
|
+
markdown: options?.includeMarkdown ? item.markdown : void 0
|
|
1182
|
+
}));
|
|
1183
|
+
};
|
|
1184
|
+
var getEventCatalogConfigurationFile = (directory) => async () => {
|
|
1185
|
+
try {
|
|
1186
|
+
const path6 = (0, import_node_path15.join)(directory, "eventcatalog.config.js");
|
|
1187
|
+
const configModule = await import(path6);
|
|
1188
|
+
return configModule.default;
|
|
1189
|
+
} catch (error) {
|
|
1190
|
+
console.error("Error getting event catalog configuration file", error);
|
|
1191
|
+
return null;
|
|
1192
|
+
}
|
|
1193
|
+
};
|
|
1194
|
+
var dumpCatalog = (directory) => async (options) => {
|
|
1195
|
+
const { getDomains: getDomains2, getServices: getServices2, getEvents: getEvents2, getQueries: getQueries2, getCommands: getCommands2, getChannels: getChannels2, getTeams: getTeams2, getUsers: getUsers3 } = src_default(directory);
|
|
1196
|
+
const { includeMarkdown = true } = options || {};
|
|
1197
|
+
const domains = await getDomains2();
|
|
1198
|
+
const services = await getServices2();
|
|
1199
|
+
const events = await getEvents2();
|
|
1200
|
+
const commands = await getCommands2();
|
|
1201
|
+
const queries = await getQueries2();
|
|
1202
|
+
const teams = await getTeams2();
|
|
1203
|
+
const users = await getUsers3();
|
|
1204
|
+
const channels = await getChannels2();
|
|
1205
|
+
const [
|
|
1206
|
+
hydratedDomains,
|
|
1207
|
+
hydratedServices,
|
|
1208
|
+
hydratedEvents,
|
|
1209
|
+
hydratedQueries,
|
|
1210
|
+
hydratedCommands,
|
|
1211
|
+
hydratedTeams,
|
|
1212
|
+
hydratedUsers,
|
|
1213
|
+
hydratedChannels
|
|
1214
|
+
] = await Promise.all([
|
|
1215
|
+
hydrateResource(directory, domains),
|
|
1216
|
+
hydrateResource(directory, services),
|
|
1217
|
+
hydrateResource(directory, events),
|
|
1218
|
+
hydrateResource(directory, queries),
|
|
1219
|
+
hydrateResource(directory, commands),
|
|
1220
|
+
hydrateResource(directory, teams),
|
|
1221
|
+
hydrateResource(directory, users),
|
|
1222
|
+
hydrateResource(directory, channels)
|
|
1223
|
+
]);
|
|
1224
|
+
return {
|
|
1225
|
+
version: DUMP_VERSION,
|
|
1226
|
+
catalogVersion: await getEventCatalogVersion(directory),
|
|
1227
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1228
|
+
resources: {
|
|
1229
|
+
domains: filterCollection(hydratedDomains, { includeMarkdown }),
|
|
1230
|
+
services: filterCollection(hydratedServices, { includeMarkdown }),
|
|
1231
|
+
messages: {
|
|
1232
|
+
events: filterCollection(hydratedEvents, { includeMarkdown }),
|
|
1233
|
+
queries: filterCollection(hydratedQueries, { includeMarkdown }),
|
|
1234
|
+
commands: filterCollection(hydratedCommands, { includeMarkdown })
|
|
1235
|
+
},
|
|
1236
|
+
teams: filterCollection(hydratedTeams, { includeMarkdown }),
|
|
1237
|
+
users: filterCollection(hydratedUsers, { includeMarkdown }),
|
|
1238
|
+
channels: filterCollection(hydratedChannels, { includeMarkdown })
|
|
1239
|
+
}
|
|
1240
|
+
};
|
|
1241
|
+
};
|
|
1242
|
+
|
|
1067
1243
|
// src/entities.ts
|
|
1068
1244
|
var import_promises10 = __toESM(require("fs/promises"));
|
|
1069
|
-
var
|
|
1070
|
-
var getEntity = (directory) => async (id,
|
|
1245
|
+
var import_node_path16 = require("path");
|
|
1246
|
+
var getEntity = (directory) => async (id, version2) => getResource(directory, id, version2, { type: "entity" });
|
|
1071
1247
|
var getEntities = (directory) => async (options) => getResources(directory, { type: "entities", latestOnly: options?.latestOnly });
|
|
1072
1248
|
var writeEntity = (directory) => async (entity, options = {
|
|
1073
1249
|
path: "",
|
|
@@ -1075,21 +1251,21 @@ var writeEntity = (directory) => async (entity, options = {
|
|
|
1075
1251
|
format: "mdx"
|
|
1076
1252
|
}) => writeResource(directory, { ...entity }, { ...options, type: "entity" });
|
|
1077
1253
|
var rmEntity = (directory) => async (path6) => {
|
|
1078
|
-
await import_promises10.default.rm((0,
|
|
1254
|
+
await import_promises10.default.rm((0, import_node_path16.join)(directory, path6), { recursive: true });
|
|
1079
1255
|
};
|
|
1080
|
-
var rmEntityById = (directory) => async (id,
|
|
1081
|
-
await rmResourceById(directory, id,
|
|
1256
|
+
var rmEntityById = (directory) => async (id, version2, persistFiles) => {
|
|
1257
|
+
await rmResourceById(directory, id, version2, { type: "entity", persistFiles });
|
|
1082
1258
|
};
|
|
1083
1259
|
var versionEntity = (directory) => async (id) => versionResource(directory, id);
|
|
1084
|
-
var entityHasVersion = (directory) => async (id,
|
|
1085
|
-
const file = await findFileById(directory, id,
|
|
1260
|
+
var entityHasVersion = (directory) => async (id, version2) => {
|
|
1261
|
+
const file = await findFileById(directory, id, version2);
|
|
1086
1262
|
return !!file;
|
|
1087
1263
|
};
|
|
1088
1264
|
|
|
1089
1265
|
// src/containers.ts
|
|
1090
1266
|
var import_promises11 = __toESM(require("fs/promises"));
|
|
1091
|
-
var
|
|
1092
|
-
var getContainer = (directory) => async (id,
|
|
1267
|
+
var import_node_path17 = require("path");
|
|
1268
|
+
var getContainer = (directory) => async (id, version2) => getResource(directory, id, version2, { type: "container" });
|
|
1093
1269
|
var getContainers = (directory) => async (options) => getResources(directory, { type: "containers", latestOnly: options?.latestOnly });
|
|
1094
1270
|
var writeContainer = (directory) => async (data, options = {
|
|
1095
1271
|
path: "",
|
|
@@ -1098,23 +1274,23 @@ var writeContainer = (directory) => async (data, options = {
|
|
|
1098
1274
|
}) => writeResource(directory, { ...data }, { ...options, type: "container" });
|
|
1099
1275
|
var versionContainer = (directory) => async (id) => versionResource(directory, id);
|
|
1100
1276
|
var rmContainer = (directory) => async (path6) => {
|
|
1101
|
-
await import_promises11.default.rm((0,
|
|
1277
|
+
await import_promises11.default.rm((0, import_node_path17.join)(directory, path6), { recursive: true });
|
|
1102
1278
|
};
|
|
1103
|
-
var rmContainerById = (directory) => async (id,
|
|
1104
|
-
await rmResourceById(directory, id,
|
|
1279
|
+
var rmContainerById = (directory) => async (id, version2, persistFiles) => {
|
|
1280
|
+
await rmResourceById(directory, id, version2, { type: "container", persistFiles });
|
|
1105
1281
|
};
|
|
1106
|
-
var containerHasVersion = (directory) => async (id,
|
|
1107
|
-
const file = await findFileById(directory, id,
|
|
1282
|
+
var containerHasVersion = (directory) => async (id, version2) => {
|
|
1283
|
+
const file = await findFileById(directory, id, version2);
|
|
1108
1284
|
return !!file;
|
|
1109
1285
|
};
|
|
1110
|
-
var addFileToContainer = (directory) => async (id, file,
|
|
1286
|
+
var addFileToContainer = (directory) => async (id, file, version2) => addFileToResource(directory, id, file, version2);
|
|
1111
1287
|
var writeContainerToService = (directory) => async (container, service, options = { path: "", format: "mdx", override: false }) => {
|
|
1112
1288
|
const resourcePath = await getResourcePath(directory, service.id, service.version);
|
|
1113
1289
|
if (!resourcePath) {
|
|
1114
1290
|
throw new Error("Service not found");
|
|
1115
1291
|
}
|
|
1116
1292
|
let pathForContainer = service.version && service.version !== "latest" ? `${resourcePath.directory}/versioned/${service.version}/containers` : `${resourcePath.directory}/containers`;
|
|
1117
|
-
pathForContainer = (0,
|
|
1293
|
+
pathForContainer = (0, import_node_path17.join)(pathForContainer, container.id);
|
|
1118
1294
|
await writeResource(directory, { ...container }, { ...options, path: pathForContainer, type: "container" });
|
|
1119
1295
|
};
|
|
1120
1296
|
|
|
@@ -1129,6 +1305,34 @@ var dataStoreHasVersion = containerHasVersion;
|
|
|
1129
1305
|
var addFileToDataStore = addFileToContainer;
|
|
1130
1306
|
var writeDataStoreToService = writeContainerToService;
|
|
1131
1307
|
|
|
1308
|
+
// src/data-products.ts
|
|
1309
|
+
var import_promises12 = __toESM(require("fs/promises"));
|
|
1310
|
+
var import_node_path18 = require("path");
|
|
1311
|
+
var getDataProduct = (directory) => async (id, version2) => getResource(directory, id, version2, { type: "data-product" });
|
|
1312
|
+
var getDataProducts = (directory) => async (options) => getResources(directory, { type: "data-products", latestOnly: options?.latestOnly });
|
|
1313
|
+
var writeDataProduct = (directory) => async (dataProduct, options = {
|
|
1314
|
+
path: "",
|
|
1315
|
+
override: false,
|
|
1316
|
+
format: "mdx"
|
|
1317
|
+
}) => writeResource(directory, { ...dataProduct }, { ...options, type: "data-product" });
|
|
1318
|
+
var writeDataProductToDomain = (directory) => async (dataProduct, domain, options = { path: "", format: "mdx", override: false }) => {
|
|
1319
|
+
let pathForDataProduct = domain.version && domain.version !== "latest" ? `/${domain.id}/versioned/${domain.version}/data-products` : `/${domain.id}/data-products`;
|
|
1320
|
+
pathForDataProduct = (0, import_node_path18.join)(pathForDataProduct, dataProduct.id);
|
|
1321
|
+
await writeResource(directory, { ...dataProduct }, { ...options, path: pathForDataProduct, type: "data-product" });
|
|
1322
|
+
};
|
|
1323
|
+
var rmDataProduct = (directory) => async (path6) => {
|
|
1324
|
+
await import_promises12.default.rm((0, import_node_path18.join)(directory, path6), { recursive: true });
|
|
1325
|
+
};
|
|
1326
|
+
var rmDataProductById = (directory) => async (id, version2, persistFiles) => {
|
|
1327
|
+
await rmResourceById(directory, id, version2, { type: "data-product", persistFiles });
|
|
1328
|
+
};
|
|
1329
|
+
var versionDataProduct = (directory) => async (id) => versionResource(directory, id);
|
|
1330
|
+
var dataProductHasVersion = (directory) => async (id, version2) => {
|
|
1331
|
+
const file = await findFileById(directory, id, version2);
|
|
1332
|
+
return !!file;
|
|
1333
|
+
};
|
|
1334
|
+
var addFileToDataProduct = (directory) => async (id, file, version2) => addFileToResource(directory, id, file, version2);
|
|
1335
|
+
|
|
1132
1336
|
// src/index.ts
|
|
1133
1337
|
var src_default = (path6) => {
|
|
1134
1338
|
return {
|
|
@@ -1138,13 +1342,13 @@ var src_default = (path6) => {
|
|
|
1138
1342
|
* @param version - Optional id of the version to get (supports semver)
|
|
1139
1343
|
* @returns Event|Undefined
|
|
1140
1344
|
*/
|
|
1141
|
-
getEvent: getEvent((0,
|
|
1345
|
+
getEvent: getEvent((0, import_node_path19.join)(path6)),
|
|
1142
1346
|
/**
|
|
1143
1347
|
* Returns all events from EventCatalog
|
|
1144
1348
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1145
1349
|
* @returns Event[]|Undefined
|
|
1146
1350
|
*/
|
|
1147
|
-
getEvents: getEvents((0,
|
|
1351
|
+
getEvents: getEvents((0, import_node_path19.join)(path6)),
|
|
1148
1352
|
/**
|
|
1149
1353
|
* Adds an event to EventCatalog
|
|
1150
1354
|
*
|
|
@@ -1152,7 +1356,7 @@ var src_default = (path6) => {
|
|
|
1152
1356
|
* @param options - Optional options to write the event
|
|
1153
1357
|
*
|
|
1154
1358
|
*/
|
|
1155
|
-
writeEvent: writeEvent((0,
|
|
1359
|
+
writeEvent: writeEvent((0, import_node_path19.join)(path6, "events")),
|
|
1156
1360
|
/**
|
|
1157
1361
|
* Adds an event to a service in EventCatalog
|
|
1158
1362
|
*
|
|
@@ -1161,26 +1365,26 @@ var src_default = (path6) => {
|
|
|
1161
1365
|
* @param options - Optional options to write the event
|
|
1162
1366
|
*
|
|
1163
1367
|
*/
|
|
1164
|
-
writeEventToService: writeEventToService((0,
|
|
1368
|
+
writeEventToService: writeEventToService((0, import_node_path19.join)(path6)),
|
|
1165
1369
|
/**
|
|
1166
1370
|
* Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
|
|
1167
1371
|
*
|
|
1168
1372
|
* @param path - The path to your event, e.g. `/Inventory/InventoryAdjusted`
|
|
1169
1373
|
*
|
|
1170
1374
|
*/
|
|
1171
|
-
rmEvent: rmEvent((0,
|
|
1375
|
+
rmEvent: rmEvent((0, import_node_path19.join)(path6, "events")),
|
|
1172
1376
|
/**
|
|
1173
1377
|
* Remove an event by an Event id
|
|
1174
1378
|
*
|
|
1175
1379
|
* @param id - The id of the event you want to remove
|
|
1176
1380
|
*
|
|
1177
1381
|
*/
|
|
1178
|
-
rmEventById: rmEventById((0,
|
|
1382
|
+
rmEventById: rmEventById((0, import_node_path19.join)(path6)),
|
|
1179
1383
|
/**
|
|
1180
1384
|
* Moves a given event id to the version directory
|
|
1181
1385
|
* @param directory
|
|
1182
1386
|
*/
|
|
1183
|
-
versionEvent: versionEvent((0,
|
|
1387
|
+
versionEvent: versionEvent((0, import_node_path19.join)(path6)),
|
|
1184
1388
|
/**
|
|
1185
1389
|
* Adds a file to the given event
|
|
1186
1390
|
* @param id - The id of the event to add the file to
|
|
@@ -1188,7 +1392,7 @@ var src_default = (path6) => {
|
|
|
1188
1392
|
* @param version - Optional version of the event to add the file to
|
|
1189
1393
|
* @returns
|
|
1190
1394
|
*/
|
|
1191
|
-
addFileToEvent: addFileToEvent((0,
|
|
1395
|
+
addFileToEvent: addFileToEvent((0, import_node_path19.join)(path6)),
|
|
1192
1396
|
/**
|
|
1193
1397
|
* Adds a schema to the given event
|
|
1194
1398
|
* @param id - The id of the event to add the schema to
|
|
@@ -1196,14 +1400,14 @@ var src_default = (path6) => {
|
|
|
1196
1400
|
* @param version - Optional version of the event to add the schema to
|
|
1197
1401
|
* @returns
|
|
1198
1402
|
*/
|
|
1199
|
-
addSchemaToEvent: addSchemaToEvent((0,
|
|
1403
|
+
addSchemaToEvent: addSchemaToEvent((0, import_node_path19.join)(path6)),
|
|
1200
1404
|
/**
|
|
1201
1405
|
* Check to see if an event version exists
|
|
1202
1406
|
* @param id - The id of the event
|
|
1203
1407
|
* @param version - The version of the event (supports semver)
|
|
1204
1408
|
* @returns
|
|
1205
1409
|
*/
|
|
1206
|
-
eventHasVersion: eventHasVersion((0,
|
|
1410
|
+
eventHasVersion: eventHasVersion((0, import_node_path19.join)(path6)),
|
|
1207
1411
|
/**
|
|
1208
1412
|
* ================================
|
|
1209
1413
|
* Commands
|
|
@@ -1215,13 +1419,13 @@ var src_default = (path6) => {
|
|
|
1215
1419
|
* @param version - Optional id of the version to get (supports semver)
|
|
1216
1420
|
* @returns Command|Undefined
|
|
1217
1421
|
*/
|
|
1218
|
-
getCommand: getCommand((0,
|
|
1422
|
+
getCommand: getCommand((0, import_node_path19.join)(path6)),
|
|
1219
1423
|
/**
|
|
1220
1424
|
* Returns all commands from EventCatalog
|
|
1221
1425
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1222
1426
|
* @returns Command[]|Undefined
|
|
1223
1427
|
*/
|
|
1224
|
-
getCommands: getCommands((0,
|
|
1428
|
+
getCommands: getCommands((0, import_node_path19.join)(path6)),
|
|
1225
1429
|
/**
|
|
1226
1430
|
* Adds an command to EventCatalog
|
|
1227
1431
|
*
|
|
@@ -1229,7 +1433,7 @@ var src_default = (path6) => {
|
|
|
1229
1433
|
* @param options - Optional options to write the command
|
|
1230
1434
|
*
|
|
1231
1435
|
*/
|
|
1232
|
-
writeCommand: writeCommand((0,
|
|
1436
|
+
writeCommand: writeCommand((0, import_node_path19.join)(path6, "commands")),
|
|
1233
1437
|
/**
|
|
1234
1438
|
* Adds a command to a service in EventCatalog
|
|
1235
1439
|
*
|
|
@@ -1238,26 +1442,26 @@ var src_default = (path6) => {
|
|
|
1238
1442
|
* @param options - Optional options to write the command
|
|
1239
1443
|
*
|
|
1240
1444
|
*/
|
|
1241
|
-
writeCommandToService: writeCommandToService((0,
|
|
1445
|
+
writeCommandToService: writeCommandToService((0, import_node_path19.join)(path6)),
|
|
1242
1446
|
/**
|
|
1243
1447
|
* Remove an command to EventCatalog (modeled on the standard POSIX rm utility)
|
|
1244
1448
|
*
|
|
1245
1449
|
* @param path - The path to your command, e.g. `/Inventory/InventoryAdjusted`
|
|
1246
1450
|
*
|
|
1247
1451
|
*/
|
|
1248
|
-
rmCommand: rmCommand((0,
|
|
1452
|
+
rmCommand: rmCommand((0, import_node_path19.join)(path6, "commands")),
|
|
1249
1453
|
/**
|
|
1250
1454
|
* Remove an command by an Event id
|
|
1251
1455
|
*
|
|
1252
1456
|
* @param id - The id of the command you want to remove
|
|
1253
1457
|
*
|
|
1254
1458
|
*/
|
|
1255
|
-
rmCommandById: rmCommandById((0,
|
|
1459
|
+
rmCommandById: rmCommandById((0, import_node_path19.join)(path6)),
|
|
1256
1460
|
/**
|
|
1257
1461
|
* Moves a given command id to the version directory
|
|
1258
1462
|
* @param directory
|
|
1259
1463
|
*/
|
|
1260
|
-
versionCommand: versionCommand((0,
|
|
1464
|
+
versionCommand: versionCommand((0, import_node_path19.join)(path6)),
|
|
1261
1465
|
/**
|
|
1262
1466
|
* Adds a file to the given command
|
|
1263
1467
|
* @param id - The id of the command to add the file to
|
|
@@ -1265,7 +1469,7 @@ var src_default = (path6) => {
|
|
|
1265
1469
|
* @param version - Optional version of the command to add the file to
|
|
1266
1470
|
* @returns
|
|
1267
1471
|
*/
|
|
1268
|
-
addFileToCommand: addFileToCommand((0,
|
|
1472
|
+
addFileToCommand: addFileToCommand((0, import_node_path19.join)(path6)),
|
|
1269
1473
|
/**
|
|
1270
1474
|
* Adds a schema to the given command
|
|
1271
1475
|
* @param id - The id of the command to add the schema to
|
|
@@ -1273,14 +1477,14 @@ var src_default = (path6) => {
|
|
|
1273
1477
|
* @param version - Optional version of the command to add the schema to
|
|
1274
1478
|
* @returns
|
|
1275
1479
|
*/
|
|
1276
|
-
addSchemaToCommand: addSchemaToCommand((0,
|
|
1480
|
+
addSchemaToCommand: addSchemaToCommand((0, import_node_path19.join)(path6)),
|
|
1277
1481
|
/**
|
|
1278
1482
|
* Check to see if a command version exists
|
|
1279
1483
|
* @param id - The id of the command
|
|
1280
1484
|
* @param version - The version of the command (supports semver)
|
|
1281
1485
|
* @returns
|
|
1282
1486
|
*/
|
|
1283
|
-
commandHasVersion: commandHasVersion((0,
|
|
1487
|
+
commandHasVersion: commandHasVersion((0, import_node_path19.join)(path6)),
|
|
1284
1488
|
/**
|
|
1285
1489
|
* ================================
|
|
1286
1490
|
* Queries
|
|
@@ -1292,13 +1496,13 @@ var src_default = (path6) => {
|
|
|
1292
1496
|
* @param version - Optional id of the version to get (supports semver)
|
|
1293
1497
|
* @returns Query|Undefined
|
|
1294
1498
|
*/
|
|
1295
|
-
getQuery: getQuery((0,
|
|
1499
|
+
getQuery: getQuery((0, import_node_path19.join)(path6)),
|
|
1296
1500
|
/**
|
|
1297
1501
|
* Returns all queries from EventCatalog
|
|
1298
1502
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1299
1503
|
* @returns Query[]|Undefined
|
|
1300
1504
|
*/
|
|
1301
|
-
getQueries: getQueries((0,
|
|
1505
|
+
getQueries: getQueries((0, import_node_path19.join)(path6)),
|
|
1302
1506
|
/**
|
|
1303
1507
|
* Adds a query to EventCatalog
|
|
1304
1508
|
*
|
|
@@ -1306,7 +1510,7 @@ var src_default = (path6) => {
|
|
|
1306
1510
|
* @param options - Optional options to write the event
|
|
1307
1511
|
*
|
|
1308
1512
|
*/
|
|
1309
|
-
writeQuery: writeQuery((0,
|
|
1513
|
+
writeQuery: writeQuery((0, import_node_path19.join)(path6, "queries")),
|
|
1310
1514
|
/**
|
|
1311
1515
|
* Adds a query to a service in EventCatalog
|
|
1312
1516
|
*
|
|
@@ -1315,26 +1519,26 @@ var src_default = (path6) => {
|
|
|
1315
1519
|
* @param options - Optional options to write the query
|
|
1316
1520
|
*
|
|
1317
1521
|
*/
|
|
1318
|
-
writeQueryToService: writeQueryToService((0,
|
|
1522
|
+
writeQueryToService: writeQueryToService((0, import_node_path19.join)(path6)),
|
|
1319
1523
|
/**
|
|
1320
1524
|
* Remove an query to EventCatalog (modeled on the standard POSIX rm utility)
|
|
1321
1525
|
*
|
|
1322
1526
|
* @param path - The path to your query, e.g. `/Orders/GetOrder`
|
|
1323
1527
|
*
|
|
1324
1528
|
*/
|
|
1325
|
-
rmQuery: rmQuery((0,
|
|
1529
|
+
rmQuery: rmQuery((0, import_node_path19.join)(path6, "queries")),
|
|
1326
1530
|
/**
|
|
1327
1531
|
* Remove a query by a Query id
|
|
1328
1532
|
*
|
|
1329
1533
|
* @param id - The id of the query you want to remove
|
|
1330
1534
|
*
|
|
1331
1535
|
*/
|
|
1332
|
-
rmQueryById: rmQueryById((0,
|
|
1536
|
+
rmQueryById: rmQueryById((0, import_node_path19.join)(path6)),
|
|
1333
1537
|
/**
|
|
1334
1538
|
* Moves a given query id to the version directory
|
|
1335
1539
|
* @param directory
|
|
1336
1540
|
*/
|
|
1337
|
-
versionQuery: versionQuery((0,
|
|
1541
|
+
versionQuery: versionQuery((0, import_node_path19.join)(path6)),
|
|
1338
1542
|
/**
|
|
1339
1543
|
* Adds a file to the given query
|
|
1340
1544
|
* @param id - The id of the query to add the file to
|
|
@@ -1342,7 +1546,7 @@ var src_default = (path6) => {
|
|
|
1342
1546
|
* @param version - Optional version of the query to add the file to
|
|
1343
1547
|
* @returns
|
|
1344
1548
|
*/
|
|
1345
|
-
addFileToQuery: addFileToQuery((0,
|
|
1549
|
+
addFileToQuery: addFileToQuery((0, import_node_path19.join)(path6)),
|
|
1346
1550
|
/**
|
|
1347
1551
|
* Adds a schema to the given query
|
|
1348
1552
|
* @param id - The id of the query to add the schema to
|
|
@@ -1350,14 +1554,14 @@ var src_default = (path6) => {
|
|
|
1350
1554
|
* @param version - Optional version of the query to add the schema to
|
|
1351
1555
|
* @returns
|
|
1352
1556
|
*/
|
|
1353
|
-
addSchemaToQuery: addSchemaToQuery((0,
|
|
1557
|
+
addSchemaToQuery: addSchemaToQuery((0, import_node_path19.join)(path6)),
|
|
1354
1558
|
/**
|
|
1355
1559
|
* Check to see if an query version exists
|
|
1356
1560
|
* @param id - The id of the query
|
|
1357
1561
|
* @param version - The version of the query (supports semver)
|
|
1358
1562
|
* @returns
|
|
1359
1563
|
*/
|
|
1360
|
-
queryHasVersion: queryHasVersion((0,
|
|
1564
|
+
queryHasVersion: queryHasVersion((0, import_node_path19.join)(path6)),
|
|
1361
1565
|
/**
|
|
1362
1566
|
* ================================
|
|
1363
1567
|
* Channels
|
|
@@ -1369,13 +1573,13 @@ var src_default = (path6) => {
|
|
|
1369
1573
|
* @param version - Optional id of the version to get (supports semver)
|
|
1370
1574
|
* @returns Channel|Undefined
|
|
1371
1575
|
*/
|
|
1372
|
-
getChannel: getChannel((0,
|
|
1576
|
+
getChannel: getChannel((0, import_node_path19.join)(path6)),
|
|
1373
1577
|
/**
|
|
1374
1578
|
* Returns all channels from EventCatalog
|
|
1375
1579
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1376
1580
|
* @returns Channel[]|Undefined
|
|
1377
1581
|
*/
|
|
1378
|
-
getChannels: getChannels((0,
|
|
1582
|
+
getChannels: getChannels((0, import_node_path19.join)(path6)),
|
|
1379
1583
|
/**
|
|
1380
1584
|
* Adds an channel to EventCatalog
|
|
1381
1585
|
*
|
|
@@ -1383,33 +1587,33 @@ var src_default = (path6) => {
|
|
|
1383
1587
|
* @param options - Optional options to write the channel
|
|
1384
1588
|
*
|
|
1385
1589
|
*/
|
|
1386
|
-
writeChannel: writeChannel((0,
|
|
1590
|
+
writeChannel: writeChannel((0, import_node_path19.join)(path6, "channels")),
|
|
1387
1591
|
/**
|
|
1388
1592
|
* Remove an channel to EventCatalog (modeled on the standard POSIX rm utility)
|
|
1389
1593
|
*
|
|
1390
1594
|
* @param path - The path to your channel, e.g. `/Inventory/InventoryAdjusted`
|
|
1391
1595
|
*
|
|
1392
1596
|
*/
|
|
1393
|
-
rmChannel: rmChannel((0,
|
|
1597
|
+
rmChannel: rmChannel((0, import_node_path19.join)(path6, "channels")),
|
|
1394
1598
|
/**
|
|
1395
1599
|
* Remove an channel by an Event id
|
|
1396
1600
|
*
|
|
1397
1601
|
* @param id - The id of the channel you want to remove
|
|
1398
1602
|
*
|
|
1399
1603
|
*/
|
|
1400
|
-
rmChannelById: rmChannelById((0,
|
|
1604
|
+
rmChannelById: rmChannelById((0, import_node_path19.join)(path6)),
|
|
1401
1605
|
/**
|
|
1402
1606
|
* Moves a given channel id to the version directory
|
|
1403
1607
|
* @param directory
|
|
1404
1608
|
*/
|
|
1405
|
-
versionChannel: versionChannel((0,
|
|
1609
|
+
versionChannel: versionChannel((0, import_node_path19.join)(path6)),
|
|
1406
1610
|
/**
|
|
1407
1611
|
* Check to see if a channel version exists
|
|
1408
1612
|
* @param id - The id of the channel
|
|
1409
1613
|
* @param version - The version of the channel (supports semver)
|
|
1410
1614
|
* @returns
|
|
1411
1615
|
*/
|
|
1412
|
-
channelHasVersion: channelHasVersion((0,
|
|
1616
|
+
channelHasVersion: channelHasVersion((0, import_node_path19.join)(path6)),
|
|
1413
1617
|
/**
|
|
1414
1618
|
* Add a channel to an event
|
|
1415
1619
|
*
|
|
@@ -1426,7 +1630,7 @@ var src_default = (path6) => {
|
|
|
1426
1630
|
*
|
|
1427
1631
|
* ```
|
|
1428
1632
|
*/
|
|
1429
|
-
addEventToChannel: addMessageToChannel((0,
|
|
1633
|
+
addEventToChannel: addMessageToChannel((0, import_node_path19.join)(path6), "events"),
|
|
1430
1634
|
/**
|
|
1431
1635
|
* Add a channel to an command
|
|
1432
1636
|
*
|
|
@@ -1443,7 +1647,7 @@ var src_default = (path6) => {
|
|
|
1443
1647
|
*
|
|
1444
1648
|
* ```
|
|
1445
1649
|
*/
|
|
1446
|
-
addCommandToChannel: addMessageToChannel((0,
|
|
1650
|
+
addCommandToChannel: addMessageToChannel((0, import_node_path19.join)(path6), "commands"),
|
|
1447
1651
|
/**
|
|
1448
1652
|
* Add a channel to an query
|
|
1449
1653
|
*
|
|
@@ -1460,7 +1664,7 @@ var src_default = (path6) => {
|
|
|
1460
1664
|
*
|
|
1461
1665
|
* ```
|
|
1462
1666
|
*/
|
|
1463
|
-
addQueryToChannel: addMessageToChannel((0,
|
|
1667
|
+
addQueryToChannel: addMessageToChannel((0, import_node_path19.join)(path6), "queries"),
|
|
1464
1668
|
/**
|
|
1465
1669
|
* ================================
|
|
1466
1670
|
* SERVICES
|
|
@@ -1473,14 +1677,14 @@ var src_default = (path6) => {
|
|
|
1473
1677
|
* @param options - Optional options to write the event
|
|
1474
1678
|
*
|
|
1475
1679
|
*/
|
|
1476
|
-
writeService: writeService((0,
|
|
1680
|
+
writeService: writeService((0, import_node_path19.join)(path6, "services")),
|
|
1477
1681
|
/**
|
|
1478
1682
|
* Adds a versioned service to EventCatalog
|
|
1479
1683
|
*
|
|
1480
1684
|
* @param service - The service to write
|
|
1481
1685
|
*
|
|
1482
1686
|
*/
|
|
1483
|
-
writeVersionedService: writeVersionedService((0,
|
|
1687
|
+
writeVersionedService: writeVersionedService((0, import_node_path19.join)(path6, "services")),
|
|
1484
1688
|
/**
|
|
1485
1689
|
* Adds a service to a domain in EventCatalog
|
|
1486
1690
|
*
|
|
@@ -1489,45 +1693,45 @@ var src_default = (path6) => {
|
|
|
1489
1693
|
* @param options - Optional options to write the event
|
|
1490
1694
|
*
|
|
1491
1695
|
*/
|
|
1492
|
-
writeServiceToDomain: writeServiceToDomain((0,
|
|
1696
|
+
writeServiceToDomain: writeServiceToDomain((0, import_node_path19.join)(path6, "domains")),
|
|
1493
1697
|
/**
|
|
1494
1698
|
* Returns a service from EventCatalog
|
|
1495
1699
|
* @param id - The id of the service to retrieve
|
|
1496
1700
|
* @param version - Optional id of the version to get (supports semver)
|
|
1497
1701
|
* @returns Service|Undefined
|
|
1498
1702
|
*/
|
|
1499
|
-
getService: getService((0,
|
|
1703
|
+
getService: getService((0, import_node_path19.join)(path6)),
|
|
1500
1704
|
/**
|
|
1501
1705
|
* Returns a service from EventCatalog by it's path.
|
|
1502
1706
|
* @param path - The path to the service to retrieve
|
|
1503
1707
|
* @returns Service|Undefined
|
|
1504
1708
|
*/
|
|
1505
|
-
getServiceByPath: getServiceByPath((0,
|
|
1709
|
+
getServiceByPath: getServiceByPath((0, import_node_path19.join)(path6)),
|
|
1506
1710
|
/**
|
|
1507
1711
|
* Returns all services from EventCatalog
|
|
1508
1712
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1509
1713
|
* @returns Service[]|Undefined
|
|
1510
1714
|
*/
|
|
1511
|
-
getServices: getServices((0,
|
|
1715
|
+
getServices: getServices((0, import_node_path19.join)(path6)),
|
|
1512
1716
|
/**
|
|
1513
1717
|
* Moves a given service id to the version directory
|
|
1514
1718
|
* @param directory
|
|
1515
1719
|
*/
|
|
1516
|
-
versionService: versionService((0,
|
|
1720
|
+
versionService: versionService((0, import_node_path19.join)(path6)),
|
|
1517
1721
|
/**
|
|
1518
1722
|
* Remove a service from EventCatalog (modeled on the standard POSIX rm utility)
|
|
1519
1723
|
*
|
|
1520
1724
|
* @param path - The path to your service, e.g. `/InventoryService`
|
|
1521
1725
|
*
|
|
1522
1726
|
*/
|
|
1523
|
-
rmService: rmService((0,
|
|
1727
|
+
rmService: rmService((0, import_node_path19.join)(path6, "services")),
|
|
1524
1728
|
/**
|
|
1525
1729
|
* Remove an service by an service id
|
|
1526
1730
|
*
|
|
1527
1731
|
* @param id - The id of the service you want to remove
|
|
1528
1732
|
*
|
|
1529
1733
|
*/
|
|
1530
|
-
rmServiceById: rmServiceById((0,
|
|
1734
|
+
rmServiceById: rmServiceById((0, import_node_path19.join)(path6)),
|
|
1531
1735
|
/**
|
|
1532
1736
|
* Adds a file to the given service
|
|
1533
1737
|
* @param id - The id of the service to add the file to
|
|
@@ -1535,21 +1739,21 @@ var src_default = (path6) => {
|
|
|
1535
1739
|
* @param version - Optional version of the service to add the file to
|
|
1536
1740
|
* @returns
|
|
1537
1741
|
*/
|
|
1538
|
-
addFileToService: addFileToService((0,
|
|
1742
|
+
addFileToService: addFileToService((0, import_node_path19.join)(path6)),
|
|
1539
1743
|
/**
|
|
1540
1744
|
* Returns the specifications for a given service
|
|
1541
1745
|
* @param id - The id of the service to retrieve the specifications for
|
|
1542
1746
|
* @param version - Optional version of the service
|
|
1543
1747
|
* @returns
|
|
1544
1748
|
*/
|
|
1545
|
-
getSpecificationFilesForService: getSpecificationFilesForService((0,
|
|
1749
|
+
getSpecificationFilesForService: getSpecificationFilesForService((0, import_node_path19.join)(path6)),
|
|
1546
1750
|
/**
|
|
1547
1751
|
* Check to see if a service version exists
|
|
1548
1752
|
* @param id - The id of the service
|
|
1549
1753
|
* @param version - The version of the service (supports semver)
|
|
1550
1754
|
* @returns
|
|
1551
1755
|
*/
|
|
1552
|
-
serviceHasVersion: serviceHasVersion((0,
|
|
1756
|
+
serviceHasVersion: serviceHasVersion((0, import_node_path19.join)(path6)),
|
|
1553
1757
|
/**
|
|
1554
1758
|
* Add an event to a service by it's id.
|
|
1555
1759
|
*
|
|
@@ -1569,7 +1773,7 @@ var src_default = (path6) => {
|
|
|
1569
1773
|
*
|
|
1570
1774
|
* ```
|
|
1571
1775
|
*/
|
|
1572
|
-
addEventToService: addMessageToService((0,
|
|
1776
|
+
addEventToService: addMessageToService((0, import_node_path19.join)(path6)),
|
|
1573
1777
|
/**
|
|
1574
1778
|
* Add a data store to a service by it's id.
|
|
1575
1779
|
*
|
|
@@ -1586,7 +1790,7 @@ var src_default = (path6) => {
|
|
|
1586
1790
|
*
|
|
1587
1791
|
* ```
|
|
1588
1792
|
*/
|
|
1589
|
-
addDataStoreToService: addDataStoreToService((0,
|
|
1793
|
+
addDataStoreToService: addDataStoreToService((0, import_node_path19.join)(path6)),
|
|
1590
1794
|
/**
|
|
1591
1795
|
* Add a command to a service by it's id.
|
|
1592
1796
|
*
|
|
@@ -1606,7 +1810,7 @@ var src_default = (path6) => {
|
|
|
1606
1810
|
*
|
|
1607
1811
|
* ```
|
|
1608
1812
|
*/
|
|
1609
|
-
addCommandToService: addMessageToService((0,
|
|
1813
|
+
addCommandToService: addMessageToService((0, import_node_path19.join)(path6)),
|
|
1610
1814
|
/**
|
|
1611
1815
|
* Add a query to a service by it's id.
|
|
1612
1816
|
*
|
|
@@ -1626,7 +1830,7 @@ var src_default = (path6) => {
|
|
|
1626
1830
|
*
|
|
1627
1831
|
* ```
|
|
1628
1832
|
*/
|
|
1629
|
-
addQueryToService: addMessageToService((0,
|
|
1833
|
+
addQueryToService: addMessageToService((0, import_node_path19.join)(path6)),
|
|
1630
1834
|
/**
|
|
1631
1835
|
* Add an entity to a service by its id.
|
|
1632
1836
|
*
|
|
@@ -1644,7 +1848,7 @@ var src_default = (path6) => {
|
|
|
1644
1848
|
*
|
|
1645
1849
|
* ```
|
|
1646
1850
|
*/
|
|
1647
|
-
addEntityToService: addEntityToService((0,
|
|
1851
|
+
addEntityToService: addEntityToService((0, import_node_path19.join)(path6)),
|
|
1648
1852
|
/**
|
|
1649
1853
|
* Check to see if a service exists by it's path.
|
|
1650
1854
|
*
|
|
@@ -1661,13 +1865,13 @@ var src_default = (path6) => {
|
|
|
1661
1865
|
* @param path - The path to the service to check
|
|
1662
1866
|
* @returns boolean
|
|
1663
1867
|
*/
|
|
1664
|
-
isService: isService((0,
|
|
1868
|
+
isService: isService((0, import_node_path19.join)(path6)),
|
|
1665
1869
|
/**
|
|
1666
1870
|
* Converts a file to a service.
|
|
1667
1871
|
* @param file - The file to convert to a service.
|
|
1668
1872
|
* @returns The service.
|
|
1669
1873
|
*/
|
|
1670
|
-
toService: toService((0,
|
|
1874
|
+
toService: toService((0, import_node_path19.join)(path6)),
|
|
1671
1875
|
/**
|
|
1672
1876
|
* ================================
|
|
1673
1877
|
* Domains
|
|
@@ -1680,39 +1884,39 @@ var src_default = (path6) => {
|
|
|
1680
1884
|
* @param options - Optional options to write the event
|
|
1681
1885
|
*
|
|
1682
1886
|
*/
|
|
1683
|
-
writeDomain: writeDomain((0,
|
|
1887
|
+
writeDomain: writeDomain((0, import_node_path19.join)(path6, "domains")),
|
|
1684
1888
|
/**
|
|
1685
1889
|
* Returns a domain from EventCatalog
|
|
1686
1890
|
* @param id - The id of the domain to retrieve
|
|
1687
1891
|
* @param version - Optional id of the version to get (supports semver)
|
|
1688
1892
|
* @returns Domain|Undefined
|
|
1689
1893
|
*/
|
|
1690
|
-
getDomain: getDomain((0,
|
|
1894
|
+
getDomain: getDomain((0, import_node_path19.join)(path6, "domains")),
|
|
1691
1895
|
/**
|
|
1692
1896
|
* Returns all domains from EventCatalog
|
|
1693
1897
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1694
1898
|
* @returns Domain[]|Undefined
|
|
1695
1899
|
*/
|
|
1696
|
-
getDomains: getDomains((0,
|
|
1900
|
+
getDomains: getDomains((0, import_node_path19.join)(path6)),
|
|
1697
1901
|
/**
|
|
1698
1902
|
* Moves a given domain id to the version directory
|
|
1699
1903
|
* @param directory
|
|
1700
1904
|
*/
|
|
1701
|
-
versionDomain: versionDomain((0,
|
|
1905
|
+
versionDomain: versionDomain((0, import_node_path19.join)(path6, "domains")),
|
|
1702
1906
|
/**
|
|
1703
1907
|
* Remove a domain from EventCatalog (modeled on the standard POSIX rm utility)
|
|
1704
1908
|
*
|
|
1705
1909
|
* @param path - The path to your domain, e.g. `/Payment`
|
|
1706
1910
|
*
|
|
1707
1911
|
*/
|
|
1708
|
-
rmDomain: rmDomain((0,
|
|
1912
|
+
rmDomain: rmDomain((0, import_node_path19.join)(path6, "domains")),
|
|
1709
1913
|
/**
|
|
1710
1914
|
* Remove an service by an domain id
|
|
1711
1915
|
*
|
|
1712
1916
|
* @param id - The id of the domain you want to remove
|
|
1713
1917
|
*
|
|
1714
1918
|
*/
|
|
1715
|
-
rmDomainById: rmDomainById((0,
|
|
1919
|
+
rmDomainById: rmDomainById((0, import_node_path19.join)(path6, "domains")),
|
|
1716
1920
|
/**
|
|
1717
1921
|
* Adds a file to the given domain
|
|
1718
1922
|
* @param id - The id of the domain to add the file to
|
|
@@ -1720,28 +1924,28 @@ var src_default = (path6) => {
|
|
|
1720
1924
|
* @param version - Optional version of the domain to add the file to
|
|
1721
1925
|
* @returns
|
|
1722
1926
|
*/
|
|
1723
|
-
addFileToDomain: addFileToDomain((0,
|
|
1927
|
+
addFileToDomain: addFileToDomain((0, import_node_path19.join)(path6, "domains")),
|
|
1724
1928
|
/**
|
|
1725
1929
|
* Adds an ubiquitous language dictionary to a domain
|
|
1726
1930
|
* @param id - The id of the domain to add the ubiquitous language to
|
|
1727
1931
|
* @param ubiquitousLanguageDictionary - The ubiquitous language dictionary to add
|
|
1728
1932
|
* @param version - Optional version of the domain to add the ubiquitous language to
|
|
1729
1933
|
*/
|
|
1730
|
-
addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain((0,
|
|
1934
|
+
addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain((0, import_node_path19.join)(path6, "domains")),
|
|
1731
1935
|
/**
|
|
1732
1936
|
* Get the ubiquitous language dictionary from a domain
|
|
1733
1937
|
* @param id - The id of the domain to get the ubiquitous language from
|
|
1734
1938
|
* @param version - Optional version of the domain to get the ubiquitous language from
|
|
1735
1939
|
* @returns
|
|
1736
1940
|
*/
|
|
1737
|
-
getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain((0,
|
|
1941
|
+
getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain((0, import_node_path19.join)(path6, "domains")),
|
|
1738
1942
|
/**
|
|
1739
1943
|
* Check to see if a domain version exists
|
|
1740
1944
|
* @param id - The id of the domain
|
|
1741
1945
|
* @param version - The version of the domain (supports semver)
|
|
1742
1946
|
* @returns
|
|
1743
1947
|
*/
|
|
1744
|
-
domainHasVersion: domainHasVersion((0,
|
|
1948
|
+
domainHasVersion: domainHasVersion((0, import_node_path19.join)(path6)),
|
|
1745
1949
|
/**
|
|
1746
1950
|
* Adds a given service to a domain
|
|
1747
1951
|
* @param id - The id of the domain
|
|
@@ -1749,7 +1953,7 @@ var src_default = (path6) => {
|
|
|
1749
1953
|
* @param version - (Optional) The version of the domain to add the service to
|
|
1750
1954
|
* @returns
|
|
1751
1955
|
*/
|
|
1752
|
-
addServiceToDomain: addServiceToDomain((0,
|
|
1956
|
+
addServiceToDomain: addServiceToDomain((0, import_node_path19.join)(path6, "domains")),
|
|
1753
1957
|
/**
|
|
1754
1958
|
* Adds a given subdomain to a domain
|
|
1755
1959
|
* @param id - The id of the domain
|
|
@@ -1757,7 +1961,7 @@ var src_default = (path6) => {
|
|
|
1757
1961
|
* @param version - (Optional) The version of the domain to add the subdomain to
|
|
1758
1962
|
* @returns
|
|
1759
1963
|
*/
|
|
1760
|
-
addSubDomainToDomain: addSubDomainToDomain((0,
|
|
1964
|
+
addSubDomainToDomain: addSubDomainToDomain((0, import_node_path19.join)(path6, "domains")),
|
|
1761
1965
|
/**
|
|
1762
1966
|
* Adds an entity to a domain
|
|
1763
1967
|
* @param id - The id of the domain
|
|
@@ -1765,7 +1969,61 @@ var src_default = (path6) => {
|
|
|
1765
1969
|
* @param version - (Optional) The version of the domain to add the entity to
|
|
1766
1970
|
* @returns
|
|
1767
1971
|
*/
|
|
1768
|
-
addEntityToDomain: addEntityToDomain((0,
|
|
1972
|
+
addEntityToDomain: addEntityToDomain((0, import_node_path19.join)(path6, "domains")),
|
|
1973
|
+
/**
|
|
1974
|
+
* Add an event to a domain by its id.
|
|
1975
|
+
*
|
|
1976
|
+
* @example
|
|
1977
|
+
* ```ts
|
|
1978
|
+
* import utils from '@eventcatalog/utils';
|
|
1979
|
+
*
|
|
1980
|
+
* const { addEventToDomain } = utils('/path/to/eventcatalog');
|
|
1981
|
+
*
|
|
1982
|
+
* // adds a new event (OrderCreated) that the Orders domain will send
|
|
1983
|
+
* await addEventToDomain('Orders', 'sends', { id: 'OrderCreated', version: '2.0.0' });
|
|
1984
|
+
*
|
|
1985
|
+
* // adds a new event (PaymentProcessed) that the Orders domain will receive
|
|
1986
|
+
* await addEventToDomain('Orders', 'receives', { id: 'PaymentProcessed', version: '2.0.0' });
|
|
1987
|
+
*
|
|
1988
|
+
* ```
|
|
1989
|
+
*/
|
|
1990
|
+
addEventToDomain: addMessageToDomain((0, import_node_path19.join)(path6, "domains")),
|
|
1991
|
+
/**
|
|
1992
|
+
* Add a command to a domain by its id.
|
|
1993
|
+
*
|
|
1994
|
+
* @example
|
|
1995
|
+
* ```ts
|
|
1996
|
+
* import utils from '@eventcatalog/utils';
|
|
1997
|
+
*
|
|
1998
|
+
* const { addCommandToDomain } = utils('/path/to/eventcatalog');
|
|
1999
|
+
*
|
|
2000
|
+
* // adds a new command (ProcessOrder) that the Orders domain will send
|
|
2001
|
+
* await addCommandToDomain('Orders', 'sends', { id: 'ProcessOrder', version: '2.0.0' });
|
|
2002
|
+
*
|
|
2003
|
+
* // adds a new command (CancelOrder) that the Orders domain will receive
|
|
2004
|
+
* await addCommandToDomain('Orders', 'receives', { id: 'CancelOrder', version: '2.0.0' });
|
|
2005
|
+
*
|
|
2006
|
+
* ```
|
|
2007
|
+
*/
|
|
2008
|
+
addCommandToDomain: addMessageToDomain((0, import_node_path19.join)(path6, "domains")),
|
|
2009
|
+
/**
|
|
2010
|
+
* Add a query to a domain by its id.
|
|
2011
|
+
*
|
|
2012
|
+
* @example
|
|
2013
|
+
* ```ts
|
|
2014
|
+
* import utils from '@eventcatalog/utils';
|
|
2015
|
+
*
|
|
2016
|
+
* const { addQueryToDomain } = utils('/path/to/eventcatalog');
|
|
2017
|
+
*
|
|
2018
|
+
* // adds a new query (GetOrderStatus) that the Orders domain will send
|
|
2019
|
+
* await addQueryToDomain('Orders', 'sends', { id: 'GetOrderStatus', version: '2.0.0' });
|
|
2020
|
+
*
|
|
2021
|
+
* // adds a new query (GetInventory) that the Orders domain will receive
|
|
2022
|
+
* await addQueryToDomain('Orders', 'receives', { id: 'GetInventory', version: '2.0.0' });
|
|
2023
|
+
*
|
|
2024
|
+
* ```
|
|
2025
|
+
*/
|
|
2026
|
+
addQueryToDomain: addMessageToDomain((0, import_node_path19.join)(path6, "domains")),
|
|
1769
2027
|
/**
|
|
1770
2028
|
* ================================
|
|
1771
2029
|
* Teams
|
|
@@ -1778,25 +2036,25 @@ var src_default = (path6) => {
|
|
|
1778
2036
|
* @param options - Optional options to write the team
|
|
1779
2037
|
*
|
|
1780
2038
|
*/
|
|
1781
|
-
writeTeam: writeTeam((0,
|
|
2039
|
+
writeTeam: writeTeam((0, import_node_path19.join)(path6, "teams")),
|
|
1782
2040
|
/**
|
|
1783
2041
|
* Returns a team from EventCatalog
|
|
1784
2042
|
* @param id - The id of the team to retrieve
|
|
1785
2043
|
* @returns Team|Undefined
|
|
1786
2044
|
*/
|
|
1787
|
-
getTeam: getTeam((0,
|
|
2045
|
+
getTeam: getTeam((0, import_node_path19.join)(path6, "teams")),
|
|
1788
2046
|
/**
|
|
1789
2047
|
* Returns all teams from EventCatalog
|
|
1790
2048
|
* @returns Team[]|Undefined
|
|
1791
2049
|
*/
|
|
1792
|
-
getTeams: getTeams((0,
|
|
2050
|
+
getTeams: getTeams((0, import_node_path19.join)(path6, "teams")),
|
|
1793
2051
|
/**
|
|
1794
2052
|
* Remove a team by the team id
|
|
1795
2053
|
*
|
|
1796
2054
|
* @param id - The id of the team you want to remove
|
|
1797
2055
|
*
|
|
1798
2056
|
*/
|
|
1799
|
-
rmTeamById: rmTeamById((0,
|
|
2057
|
+
rmTeamById: rmTeamById((0, import_node_path19.join)(path6, "teams")),
|
|
1800
2058
|
/**
|
|
1801
2059
|
* ================================
|
|
1802
2060
|
* Users
|
|
@@ -1809,25 +2067,25 @@ var src_default = (path6) => {
|
|
|
1809
2067
|
* @param options - Optional options to write the user
|
|
1810
2068
|
*
|
|
1811
2069
|
*/
|
|
1812
|
-
writeUser: writeUser((0,
|
|
2070
|
+
writeUser: writeUser((0, import_node_path19.join)(path6, "users")),
|
|
1813
2071
|
/**
|
|
1814
2072
|
* Returns a user from EventCatalog
|
|
1815
2073
|
* @param id - The id of the user to retrieve
|
|
1816
2074
|
* @returns User|Undefined
|
|
1817
2075
|
*/
|
|
1818
|
-
getUser: getUser((0,
|
|
2076
|
+
getUser: getUser((0, import_node_path19.join)(path6, "users")),
|
|
1819
2077
|
/**
|
|
1820
2078
|
* Returns all user from EventCatalog
|
|
1821
2079
|
* @returns User[]|Undefined
|
|
1822
2080
|
*/
|
|
1823
|
-
getUsers: getUsers((0,
|
|
2081
|
+
getUsers: getUsers((0, import_node_path19.join)(path6)),
|
|
1824
2082
|
/**
|
|
1825
2083
|
* Remove a user by the user id
|
|
1826
2084
|
*
|
|
1827
2085
|
* @param id - The id of the user you want to remove
|
|
1828
2086
|
*
|
|
1829
2087
|
*/
|
|
1830
|
-
rmUserById: rmUserById((0,
|
|
2088
|
+
rmUserById: rmUserById((0, import_node_path19.join)(path6, "users")),
|
|
1831
2089
|
/**
|
|
1832
2090
|
* ================================
|
|
1833
2091
|
* Custom Docs
|
|
@@ -1838,32 +2096,32 @@ var src_default = (path6) => {
|
|
|
1838
2096
|
* @param path - The path to the custom doc to retrieve
|
|
1839
2097
|
* @returns CustomDoc|Undefined
|
|
1840
2098
|
*/
|
|
1841
|
-
getCustomDoc: getCustomDoc((0,
|
|
2099
|
+
getCustomDoc: getCustomDoc((0, import_node_path19.join)(path6, "docs")),
|
|
1842
2100
|
/**
|
|
1843
2101
|
* Returns all custom docs from EventCatalog
|
|
1844
2102
|
* @param options - Optional options to get custom docs from a specific path
|
|
1845
2103
|
* @returns CustomDoc[]|Undefined
|
|
1846
2104
|
*/
|
|
1847
|
-
getCustomDocs: getCustomDocs((0,
|
|
2105
|
+
getCustomDocs: getCustomDocs((0, import_node_path19.join)(path6, "docs")),
|
|
1848
2106
|
/**
|
|
1849
2107
|
* Writes a custom doc to EventCatalog
|
|
1850
2108
|
* @param customDoc - The custom doc to write
|
|
1851
2109
|
* @param options - Optional options to write the custom doc
|
|
1852
2110
|
*
|
|
1853
2111
|
*/
|
|
1854
|
-
writeCustomDoc: writeCustomDoc((0,
|
|
2112
|
+
writeCustomDoc: writeCustomDoc((0, import_node_path19.join)(path6, "docs")),
|
|
1855
2113
|
/**
|
|
1856
2114
|
* Removes a custom doc from EventCatalog
|
|
1857
2115
|
* @param path - The path to the custom doc to remove
|
|
1858
2116
|
*
|
|
1859
2117
|
*/
|
|
1860
|
-
rmCustomDoc: rmCustomDoc((0,
|
|
2118
|
+
rmCustomDoc: rmCustomDoc((0, import_node_path19.join)(path6, "docs")),
|
|
1861
2119
|
/**
|
|
1862
2120
|
* Dumps the catalog to a JSON file.
|
|
1863
2121
|
* @param directory - The directory to dump the catalog to
|
|
1864
2122
|
* @returns A JSON file with the catalog
|
|
1865
2123
|
*/
|
|
1866
|
-
dumpCatalog: dumpCatalog((0,
|
|
2124
|
+
dumpCatalog: dumpCatalog((0, import_node_path19.join)(path6)),
|
|
1867
2125
|
/**
|
|
1868
2126
|
* Returns the event catalog configuration file.
|
|
1869
2127
|
* The event catalog configuration file is the file that contains the configuration for the event catalog.
|
|
@@ -1871,7 +2129,7 @@ var src_default = (path6) => {
|
|
|
1871
2129
|
* @param directory - The directory of the catalog.
|
|
1872
2130
|
* @returns A JSON object with the configuration for the event catalog.
|
|
1873
2131
|
*/
|
|
1874
|
-
getEventCatalogConfigurationFile: getEventCatalogConfigurationFile((0,
|
|
2132
|
+
getEventCatalogConfigurationFile: getEventCatalogConfigurationFile((0, import_node_path19.join)(path6)),
|
|
1875
2133
|
/**
|
|
1876
2134
|
* ================================
|
|
1877
2135
|
* Resources Utils
|
|
@@ -1896,33 +2154,33 @@ var src_default = (path6) => {
|
|
|
1896
2154
|
* @param path - The path to the message to retrieve
|
|
1897
2155
|
* @returns Message|Undefined
|
|
1898
2156
|
*/
|
|
1899
|
-
getMessageBySchemaPath: getMessageBySchemaPath((0,
|
|
2157
|
+
getMessageBySchemaPath: getMessageBySchemaPath((0, import_node_path19.join)(path6)),
|
|
1900
2158
|
/**
|
|
1901
2159
|
* Returns the producers and consumers (services) for a given message
|
|
1902
2160
|
* @param id - The id of the message to get the producers and consumers for
|
|
1903
2161
|
* @param version - Optional version of the message
|
|
1904
2162
|
* @returns { producers: Service[], consumers: Service[] }
|
|
1905
2163
|
*/
|
|
1906
|
-
getProducersAndConsumersForMessage: getProducersAndConsumersForMessage((0,
|
|
2164
|
+
getProducersAndConsumersForMessage: getProducersAndConsumersForMessage((0, import_node_path19.join)(path6)),
|
|
1907
2165
|
/**
|
|
1908
2166
|
* Returns the consumers of a given schema path
|
|
1909
2167
|
* @param path - The path to the schema to get the consumers for
|
|
1910
2168
|
* @returns Service[]
|
|
1911
2169
|
*/
|
|
1912
|
-
getConsumersOfSchema: getConsumersOfSchema((0,
|
|
2170
|
+
getConsumersOfSchema: getConsumersOfSchema((0, import_node_path19.join)(path6)),
|
|
1913
2171
|
/**
|
|
1914
2172
|
* Returns the producers of a given schema path
|
|
1915
2173
|
* @param path - The path to the schema to get the producers for
|
|
1916
2174
|
* @returns Service[]
|
|
1917
2175
|
*/
|
|
1918
|
-
getProducersOfSchema: getProducersOfSchema((0,
|
|
2176
|
+
getProducersOfSchema: getProducersOfSchema((0, import_node_path19.join)(path6)),
|
|
1919
2177
|
/**
|
|
1920
2178
|
* Returns the owners for a given resource (e.g domain, service, event, command, query, etc.)
|
|
1921
2179
|
* @param id - The id of the resource to get the owners for
|
|
1922
2180
|
* @param version - Optional version of the resource
|
|
1923
2181
|
* @returns { owners: User[] }
|
|
1924
2182
|
*/
|
|
1925
|
-
getOwnersForResource: getOwnersForResource((0,
|
|
2183
|
+
getOwnersForResource: getOwnersForResource((0, import_node_path19.join)(path6)),
|
|
1926
2184
|
/**
|
|
1927
2185
|
* ================================
|
|
1928
2186
|
* Entities
|
|
@@ -1934,13 +2192,13 @@ var src_default = (path6) => {
|
|
|
1934
2192
|
* @param version - Optional id of the version to get (supports semver)
|
|
1935
2193
|
* @returns Entity|Undefined
|
|
1936
2194
|
*/
|
|
1937
|
-
getEntity: getEntity((0,
|
|
2195
|
+
getEntity: getEntity((0, import_node_path19.join)(path6)),
|
|
1938
2196
|
/**
|
|
1939
2197
|
* Returns all entities from EventCatalog
|
|
1940
2198
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1941
2199
|
* @returns Entity[]|Undefined
|
|
1942
2200
|
*/
|
|
1943
|
-
getEntities: getEntities((0,
|
|
2201
|
+
getEntities: getEntities((0, import_node_path19.join)(path6)),
|
|
1944
2202
|
/**
|
|
1945
2203
|
* Adds an entity to EventCatalog
|
|
1946
2204
|
*
|
|
@@ -1948,33 +2206,33 @@ var src_default = (path6) => {
|
|
|
1948
2206
|
* @param options - Optional options to write the entity
|
|
1949
2207
|
*
|
|
1950
2208
|
*/
|
|
1951
|
-
writeEntity: writeEntity((0,
|
|
2209
|
+
writeEntity: writeEntity((0, import_node_path19.join)(path6, "entities")),
|
|
1952
2210
|
/**
|
|
1953
2211
|
* Remove an entity from EventCatalog (modeled on the standard POSIX rm utility)
|
|
1954
2212
|
*
|
|
1955
2213
|
* @param path - The path to your entity, e.g. `/User`
|
|
1956
2214
|
*
|
|
1957
2215
|
*/
|
|
1958
|
-
rmEntity: rmEntity((0,
|
|
2216
|
+
rmEntity: rmEntity((0, import_node_path19.join)(path6, "entities")),
|
|
1959
2217
|
/**
|
|
1960
2218
|
* Remove an entity by an entity id
|
|
1961
2219
|
*
|
|
1962
2220
|
* @param id - The id of the entity you want to remove
|
|
1963
2221
|
*
|
|
1964
2222
|
*/
|
|
1965
|
-
rmEntityById: rmEntityById((0,
|
|
2223
|
+
rmEntityById: rmEntityById((0, import_node_path19.join)(path6)),
|
|
1966
2224
|
/**
|
|
1967
2225
|
* Moves a given entity id to the version directory
|
|
1968
2226
|
* @param id - The id of the entity to version
|
|
1969
2227
|
*/
|
|
1970
|
-
versionEntity: versionEntity((0,
|
|
2228
|
+
versionEntity: versionEntity((0, import_node_path19.join)(path6)),
|
|
1971
2229
|
/**
|
|
1972
2230
|
* Check to see if an entity version exists
|
|
1973
2231
|
* @param id - The id of the entity
|
|
1974
2232
|
* @param version - The version of the entity (supports semver)
|
|
1975
2233
|
* @returns
|
|
1976
2234
|
*/
|
|
1977
|
-
entityHasVersion: entityHasVersion((0,
|
|
2235
|
+
entityHasVersion: entityHasVersion((0, import_node_path19.join)(path6)),
|
|
1978
2236
|
/**
|
|
1979
2237
|
* ================================
|
|
1980
2238
|
* Data Stores
|
|
@@ -1986,42 +2244,42 @@ var src_default = (path6) => {
|
|
|
1986
2244
|
* @param options - Optional options to write the data store
|
|
1987
2245
|
*
|
|
1988
2246
|
*/
|
|
1989
|
-
writeDataStore: writeDataStore((0,
|
|
2247
|
+
writeDataStore: writeDataStore((0, import_node_path19.join)(path6, "containers")),
|
|
1990
2248
|
/**
|
|
1991
2249
|
* Returns a data store from EventCatalog
|
|
1992
2250
|
* @param id - The id of the data store to retrieve
|
|
1993
2251
|
* @param version - Optional id of the version to get (supports semver)
|
|
1994
2252
|
* @returns Container|Undefined
|
|
1995
2253
|
*/
|
|
1996
|
-
getDataStore: getDataStore((0,
|
|
2254
|
+
getDataStore: getDataStore((0, import_node_path19.join)(path6)),
|
|
1997
2255
|
/**
|
|
1998
2256
|
* Returns all data stores from EventCatalog
|
|
1999
2257
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
2000
2258
|
* @returns Container[]|Undefined
|
|
2001
2259
|
*/
|
|
2002
|
-
getDataStores: getDataStores((0,
|
|
2260
|
+
getDataStores: getDataStores((0, import_node_path19.join)(path6)),
|
|
2003
2261
|
/**
|
|
2004
2262
|
* Version a data store by its id
|
|
2005
2263
|
* @param id - The id of the data store to version
|
|
2006
2264
|
*/
|
|
2007
|
-
versionDataStore: versionDataStore((0,
|
|
2265
|
+
versionDataStore: versionDataStore((0, import_node_path19.join)(path6, "containers")),
|
|
2008
2266
|
/**
|
|
2009
2267
|
* Remove a data store by its path
|
|
2010
2268
|
* @param path - The path to the data store to remove
|
|
2011
2269
|
*/
|
|
2012
|
-
rmDataStore: rmDataStore((0,
|
|
2270
|
+
rmDataStore: rmDataStore((0, import_node_path19.join)(path6, "containers")),
|
|
2013
2271
|
/**
|
|
2014
2272
|
* Remove a data store by its id
|
|
2015
2273
|
* @param id - The id of the data store to remove
|
|
2016
2274
|
*/
|
|
2017
|
-
rmDataStoreById: rmDataStoreById((0,
|
|
2275
|
+
rmDataStoreById: rmDataStoreById((0, import_node_path19.join)(path6)),
|
|
2018
2276
|
/**
|
|
2019
2277
|
* Check to see if a data store version exists
|
|
2020
2278
|
* @param id - The id of the data store
|
|
2021
2279
|
* @param version - The version of the data store (supports semver)
|
|
2022
2280
|
* @returns
|
|
2023
2281
|
*/
|
|
2024
|
-
dataStoreHasVersion: dataStoreHasVersion((0,
|
|
2282
|
+
dataStoreHasVersion: dataStoreHasVersion((0, import_node_path19.join)(path6)),
|
|
2025
2283
|
/**
|
|
2026
2284
|
* Adds a file to a data store by its id
|
|
2027
2285
|
* @param id - The id of the data store to add the file to
|
|
@@ -2029,114 +2287,200 @@ var src_default = (path6) => {
|
|
|
2029
2287
|
* @param version - Optional version of the data store to add the file to
|
|
2030
2288
|
* @returns
|
|
2031
2289
|
*/
|
|
2032
|
-
addFileToDataStore: addFileToDataStore((0,
|
|
2290
|
+
addFileToDataStore: addFileToDataStore((0, import_node_path19.join)(path6)),
|
|
2033
2291
|
/**
|
|
2034
2292
|
* Writes a data store to a service by its id
|
|
2035
2293
|
* @param dataStore - The data store to write
|
|
2036
2294
|
* @param service - The service to write the data store to
|
|
2037
2295
|
* @returns
|
|
2038
2296
|
*/
|
|
2039
|
-
writeDataStoreToService: writeDataStoreToService((0,
|
|
2297
|
+
writeDataStoreToService: writeDataStoreToService((0, import_node_path19.join)(path6)),
|
|
2298
|
+
/**
|
|
2299
|
+
* ================================
|
|
2300
|
+
* Data Products
|
|
2301
|
+
* ================================
|
|
2302
|
+
*/
|
|
2303
|
+
/**
|
|
2304
|
+
* Adds a data product to EventCatalog
|
|
2305
|
+
* @param dataProduct - The data product to write
|
|
2306
|
+
* @param options - Optional options to write the data product
|
|
2307
|
+
*
|
|
2308
|
+
*/
|
|
2309
|
+
writeDataProduct: writeDataProduct((0, import_node_path19.join)(path6, "data-products")),
|
|
2310
|
+
/**
|
|
2311
|
+
* Writes a data product to a domain in EventCatalog
|
|
2312
|
+
* @param dataProduct - The data product to write
|
|
2313
|
+
* @param domain - The domain to write the data product to
|
|
2314
|
+
* @param options - Optional options to write the data product
|
|
2315
|
+
*
|
|
2316
|
+
*/
|
|
2317
|
+
writeDataProductToDomain: writeDataProductToDomain((0, import_node_path19.join)(path6, "domains")),
|
|
2318
|
+
/**
|
|
2319
|
+
* Returns a data product from EventCatalog
|
|
2320
|
+
* @param id - The id of the data product to retrieve
|
|
2321
|
+
* @param version - Optional id of the version to get (supports semver)
|
|
2322
|
+
* @returns DataProduct|Undefined
|
|
2323
|
+
*/
|
|
2324
|
+
getDataProduct: getDataProduct((0, import_node_path19.join)(path6)),
|
|
2325
|
+
/**
|
|
2326
|
+
* Returns all data products from EventCatalog
|
|
2327
|
+
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
2328
|
+
* @returns DataProduct[]|Undefined
|
|
2329
|
+
*/
|
|
2330
|
+
getDataProducts: getDataProducts((0, import_node_path19.join)(path6)),
|
|
2331
|
+
/**
|
|
2332
|
+
* Version a data product by its id
|
|
2333
|
+
* @param id - The id of the data product to version
|
|
2334
|
+
*/
|
|
2335
|
+
versionDataProduct: versionDataProduct((0, import_node_path19.join)(path6)),
|
|
2336
|
+
/**
|
|
2337
|
+
* Remove a data product by its path
|
|
2338
|
+
* @param path - The path to the data product to remove
|
|
2339
|
+
*/
|
|
2340
|
+
rmDataProduct: rmDataProduct((0, import_node_path19.join)(path6, "data-products")),
|
|
2341
|
+
/**
|
|
2342
|
+
* Remove a data product by its id
|
|
2343
|
+
* @param id - The id of the data product to remove
|
|
2344
|
+
* @param version - Optional version of the data product to remove
|
|
2345
|
+
*/
|
|
2346
|
+
rmDataProductById: rmDataProductById((0, import_node_path19.join)(path6)),
|
|
2347
|
+
/**
|
|
2348
|
+
* Check to see if a data product version exists
|
|
2349
|
+
* @param id - The id of the data product
|
|
2350
|
+
* @param version - The version of the data product (supports semver)
|
|
2351
|
+
* @returns
|
|
2352
|
+
*/
|
|
2353
|
+
dataProductHasVersion: dataProductHasVersion((0, import_node_path19.join)(path6)),
|
|
2354
|
+
/**
|
|
2355
|
+
* Adds a file to a data product by its id
|
|
2356
|
+
* @param id - The id of the data product to add the file to
|
|
2357
|
+
* @param file - File contents to add including the content and the file name
|
|
2358
|
+
* @param version - Optional version of the data product to add the file to
|
|
2359
|
+
* @returns
|
|
2360
|
+
*/
|
|
2361
|
+
addFileToDataProduct: addFileToDataProduct((0, import_node_path19.join)(path6)),
|
|
2362
|
+
/**
|
|
2363
|
+
* Adds a data product to a domain
|
|
2364
|
+
* @param id - The id of the domain
|
|
2365
|
+
* @param dataProduct - The id and version of the data product to add
|
|
2366
|
+
* @param version - (Optional) The version of the domain to add the data product to
|
|
2367
|
+
* @returns
|
|
2368
|
+
*/
|
|
2369
|
+
addDataProductToDomain: addDataProductToDomain((0, import_node_path19.join)(path6, "domains"))
|
|
2040
2370
|
};
|
|
2041
2371
|
};
|
|
2042
2372
|
|
|
2043
|
-
// src/
|
|
2044
|
-
|
|
2045
|
-
|
|
2373
|
+
// src/cli/executor.ts
|
|
2374
|
+
async function executeFunction(catalogDir, functionName, rawArgs) {
|
|
2375
|
+
if (!(0, import_node_fs7.existsSync)(catalogDir)) {
|
|
2376
|
+
throw new Error(`Catalog directory not found: ${catalogDir}`);
|
|
2377
|
+
}
|
|
2378
|
+
const sdk = src_default(catalogDir);
|
|
2379
|
+
if (!(functionName in sdk)) {
|
|
2380
|
+
throw new Error(`Function '${functionName}' not found. Use 'eventcatalog list' to see available functions.`);
|
|
2381
|
+
}
|
|
2382
|
+
const fn = sdk[functionName];
|
|
2383
|
+
if (typeof fn !== "function") {
|
|
2384
|
+
throw new Error(`'${functionName}' is not a callable function.`);
|
|
2385
|
+
}
|
|
2386
|
+
const parsedArgs = parseArguments(rawArgs);
|
|
2046
2387
|
try {
|
|
2047
|
-
|
|
2048
|
-
const packageJsonObject = JSON.parse(packageJson);
|
|
2049
|
-
return packageJsonObject["dependencies"]["@eventcatalog/core"];
|
|
2388
|
+
return await fn(...parsedArgs);
|
|
2050
2389
|
} catch (error) {
|
|
2051
|
-
|
|
2390
|
+
throw new Error(`Error executing '${functionName}': ${error instanceof Error ? error.message : String(error)}`);
|
|
2052
2391
|
}
|
|
2053
|
-
}
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2392
|
+
}
|
|
2393
|
+
|
|
2394
|
+
// src/cli/list.ts
|
|
2395
|
+
function listFunctions(catalogDir = ".") {
|
|
2396
|
+
const sdk = src_default(catalogDir);
|
|
2397
|
+
const functionNames = Object.keys(sdk).filter((key) => typeof sdk[key] === "function");
|
|
2398
|
+
const categories = {
|
|
2399
|
+
Events: [],
|
|
2400
|
+
Commands: [],
|
|
2401
|
+
Queries: [],
|
|
2402
|
+
Channels: [],
|
|
2403
|
+
Services: [],
|
|
2404
|
+
Domains: [],
|
|
2405
|
+
Entities: [],
|
|
2406
|
+
DataStores: [],
|
|
2407
|
+
DataProducts: [],
|
|
2408
|
+
Teams: [],
|
|
2409
|
+
Users: [],
|
|
2410
|
+
"Custom Docs": [],
|
|
2411
|
+
Messages: [],
|
|
2412
|
+
Utilities: []
|
|
2413
|
+
};
|
|
2414
|
+
functionNames.forEach((name) => {
|
|
2415
|
+
if (name.includes("Event")) categories["Events"].push(name);
|
|
2416
|
+
else if (name.includes("Command")) categories["Commands"].push(name);
|
|
2417
|
+
else if (name.includes("Query")) categories["Queries"].push(name);
|
|
2418
|
+
else if (name.includes("Channel")) categories["Channels"].push(name);
|
|
2419
|
+
else if (name.includes("Service")) categories["Services"].push(name);
|
|
2420
|
+
else if (name.includes("Domain")) categories["Domains"].push(name);
|
|
2421
|
+
else if (name.includes("Entity")) categories["Entities"].push(name);
|
|
2422
|
+
else if (name.includes("DataStore")) categories["DataStores"].push(name);
|
|
2423
|
+
else if (name.includes("DataProduct")) categories["DataProducts"].push(name);
|
|
2424
|
+
else if (name.includes("Team")) categories["Teams"].push(name);
|
|
2425
|
+
else if (name.includes("User")) categories["Users"].push(name);
|
|
2426
|
+
else if (name.includes("CustomDoc")) categories["Custom Docs"].push(name);
|
|
2427
|
+
else if (name.includes("Message") || name.includes("Producers") || name.includes("Consumers"))
|
|
2428
|
+
categories["Messages"].push(name);
|
|
2429
|
+
else categories["Utilities"].push(name);
|
|
2430
|
+
});
|
|
2431
|
+
Object.keys(categories).forEach((key) => {
|
|
2432
|
+
if (categories[key].length === 0) {
|
|
2433
|
+
delete categories[key];
|
|
2434
|
+
}
|
|
2435
|
+
});
|
|
2436
|
+
return categories;
|
|
2437
|
+
}
|
|
2438
|
+
function formatListOutput(functions) {
|
|
2439
|
+
let output = "Available EventCatalog SDK Functions:\n\n";
|
|
2440
|
+
Object.entries(functions).forEach(([category, names]) => {
|
|
2441
|
+
output += `${category}:
|
|
2442
|
+
`;
|
|
2443
|
+
names.sort().forEach((name) => {
|
|
2444
|
+
output += ` - ${name}
|
|
2445
|
+
`;
|
|
2446
|
+
});
|
|
2447
|
+
output += "\n";
|
|
2448
|
+
});
|
|
2449
|
+
return output;
|
|
2450
|
+
}
|
|
2451
|
+
|
|
2452
|
+
// src/cli/index.ts
|
|
2453
|
+
var version = "1.0.0";
|
|
2454
|
+
try {
|
|
2455
|
+
const packageJsonPath = (0, import_node_path20.resolve)(__dirname, "../../package.json");
|
|
2456
|
+
const packageJson = JSON.parse((0, import_node_fs8.readFileSync)(packageJsonPath, "utf-8"));
|
|
2457
|
+
version = packageJson.version;
|
|
2458
|
+
} catch {
|
|
2459
|
+
}
|
|
2460
|
+
import_commander.program.name("eventcatalog").description("EventCatalog SDK Command-Line Interface").version(version).option("-d, --dir <path>", "Path to the EventCatalog directory (default: current directory)", ".");
|
|
2461
|
+
import_commander.program.command("list").description("List all available SDK functions").action(() => {
|
|
2080
2462
|
try {
|
|
2081
|
-
const
|
|
2082
|
-
const
|
|
2083
|
-
|
|
2463
|
+
const functions = listFunctions(".");
|
|
2464
|
+
const output = formatListOutput(functions);
|
|
2465
|
+
console.log(output);
|
|
2084
2466
|
} catch (error) {
|
|
2085
|
-
console.error("Error
|
|
2086
|
-
|
|
2467
|
+
console.error("Error listing functions:", error instanceof Error ? error.message : String(error));
|
|
2468
|
+
process.exit(1);
|
|
2469
|
+
}
|
|
2470
|
+
});
|
|
2471
|
+
import_commander.program.arguments("<function> [args...]").action(async (functionName, args) => {
|
|
2472
|
+
try {
|
|
2473
|
+
const options = import_commander.program.opts();
|
|
2474
|
+
const dir = options.dir || ".";
|
|
2475
|
+
const result = await executeFunction(dir, functionName, args);
|
|
2476
|
+
console.log(JSON.stringify(result, null, 0));
|
|
2477
|
+
} catch (error) {
|
|
2478
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
2479
|
+
process.exit(1);
|
|
2087
2480
|
}
|
|
2088
|
-
};
|
|
2089
|
-
var dumpCatalog = (directory) => async (options) => {
|
|
2090
|
-
const { getDomains: getDomains2, getServices: getServices2, getEvents: getEvents2, getQueries: getQueries2, getCommands: getCommands2, getChannels: getChannels2, getTeams: getTeams2, getUsers: getUsers3 } = src_default(directory);
|
|
2091
|
-
const { includeMarkdown = true } = options || {};
|
|
2092
|
-
const domains = await getDomains2();
|
|
2093
|
-
const services = await getServices2();
|
|
2094
|
-
const events = await getEvents2();
|
|
2095
|
-
const commands = await getCommands2();
|
|
2096
|
-
const queries = await getQueries2();
|
|
2097
|
-
const teams = await getTeams2();
|
|
2098
|
-
const users = await getUsers3();
|
|
2099
|
-
const channels = await getChannels2();
|
|
2100
|
-
const [
|
|
2101
|
-
hydratedDomains,
|
|
2102
|
-
hydratedServices,
|
|
2103
|
-
hydratedEvents,
|
|
2104
|
-
hydratedQueries,
|
|
2105
|
-
hydratedCommands,
|
|
2106
|
-
hydratedTeams,
|
|
2107
|
-
hydratedUsers,
|
|
2108
|
-
hydratedChannels
|
|
2109
|
-
] = await Promise.all([
|
|
2110
|
-
hydrateResource(directory, domains),
|
|
2111
|
-
hydrateResource(directory, services),
|
|
2112
|
-
hydrateResource(directory, events),
|
|
2113
|
-
hydrateResource(directory, queries),
|
|
2114
|
-
hydrateResource(directory, commands),
|
|
2115
|
-
hydrateResource(directory, teams),
|
|
2116
|
-
hydrateResource(directory, users),
|
|
2117
|
-
hydrateResource(directory, channels)
|
|
2118
|
-
]);
|
|
2119
|
-
return {
|
|
2120
|
-
version: DUMP_VERSION,
|
|
2121
|
-
catalogVersion: await getEventCatalogVersion(directory),
|
|
2122
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2123
|
-
resources: {
|
|
2124
|
-
domains: filterCollection(hydratedDomains, { includeMarkdown }),
|
|
2125
|
-
services: filterCollection(hydratedServices, { includeMarkdown }),
|
|
2126
|
-
messages: {
|
|
2127
|
-
events: filterCollection(hydratedEvents, { includeMarkdown }),
|
|
2128
|
-
queries: filterCollection(hydratedQueries, { includeMarkdown }),
|
|
2129
|
-
commands: filterCollection(hydratedCommands, { includeMarkdown })
|
|
2130
|
-
},
|
|
2131
|
-
teams: filterCollection(hydratedTeams, { includeMarkdown }),
|
|
2132
|
-
users: filterCollection(hydratedUsers, { includeMarkdown }),
|
|
2133
|
-
channels: filterCollection(hydratedChannels, { includeMarkdown })
|
|
2134
|
-
}
|
|
2135
|
-
};
|
|
2136
|
-
};
|
|
2137
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
2138
|
-
0 && (module.exports = {
|
|
2139
|
-
dumpCatalog,
|
|
2140
|
-
getEventCatalogConfigurationFile
|
|
2141
2481
|
});
|
|
2142
|
-
|
|
2482
|
+
import_commander.program.parse(process.argv);
|
|
2483
|
+
if (process.argv.length < 3) {
|
|
2484
|
+
import_commander.program.outputHelp();
|
|
2485
|
+
}
|
|
2486
|
+
//# sourceMappingURL=index.js.map
|