@eventcatalog/sdk 2.1.1 → 2.2.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/dist/channels.d.mts +1 -1
- package/dist/channels.d.ts +1 -1
- package/dist/channels.js +1 -1
- package/dist/channels.js.map +1 -1
- package/dist/channels.mjs +1 -1
- package/dist/channels.mjs.map +1 -1
- package/dist/commands.d.mts +1 -1
- package/dist/commands.d.ts +1 -1
- package/dist/commands.js +17 -4
- package/dist/commands.js.map +1 -1
- package/dist/commands.mjs +17 -4
- package/dist/commands.mjs.map +1 -1
- package/dist/custom-docs.js.map +1 -1
- package/dist/custom-docs.mjs.map +1 -1
- package/dist/domains.d.mts +42 -3
- package/dist/domains.d.ts +42 -3
- package/dist/domains.js +37 -10
- package/dist/domains.js.map +1 -1
- package/dist/domains.mjs +35 -10
- package/dist/domains.mjs.map +1 -1
- package/dist/events.d.mts +1 -1
- package/dist/events.d.ts +1 -1
- package/dist/events.js +15 -2
- package/dist/events.js.map +1 -1
- package/dist/events.mjs +15 -2
- package/dist/events.mjs.map +1 -1
- package/dist/index.d.mts +25 -21
- package/dist/index.d.ts +25 -21
- package/dist/index.js +183 -130
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +188 -135
- package/dist/index.mjs.map +1 -1
- package/dist/queries.d.mts +1 -1
- package/dist/queries.d.ts +1 -1
- package/dist/queries.js +15 -2
- package/dist/queries.js.map +1 -1
- package/dist/queries.mjs +15 -2
- package/dist/queries.mjs.map +1 -1
- package/dist/services.d.mts +1 -1
- package/dist/services.d.ts +1 -1
- package/dist/services.js +1 -1
- package/dist/services.js.map +1 -1
- package/dist/services.mjs +1 -1
- package/dist/services.mjs.map +1 -1
- package/dist/types.d.d.mts +13 -1
- package/dist/types.d.d.ts +13 -1
- package/dist/types.d.js.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -20,13 +20,13 @@ var versionExists = async (catalogDir, id, version) => {
|
|
|
20
20
|
var findFileById = async (catalogDir, id, version) => {
|
|
21
21
|
const files = await getFiles(`${catalogDir}/**/index.{md,mdx}`);
|
|
22
22
|
const matchedFiles = await searchFilesForId(files, id) || [];
|
|
23
|
-
const latestVersion = matchedFiles.find((
|
|
23
|
+
const latestVersion = matchedFiles.find((path3) => !path3.includes("versioned"));
|
|
24
24
|
if (!version) {
|
|
25
25
|
return latestVersion;
|
|
26
26
|
}
|
|
27
|
-
const parsedFiles = matchedFiles.map((
|
|
28
|
-
const { data } = matter.read(
|
|
29
|
-
return { ...data, path:
|
|
27
|
+
const parsedFiles = matchedFiles.map((path3) => {
|
|
28
|
+
const { data } = matter.read(path3);
|
|
29
|
+
return { ...data, path: path3 };
|
|
30
30
|
});
|
|
31
31
|
const semverRange = validRange(version);
|
|
32
32
|
if (semverRange && valid(version)) {
|
|
@@ -50,8 +50,8 @@ var getFiles = async (pattern, ignore = "") => {
|
|
|
50
50
|
throw new Error(`Error finding files: ${error}`);
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
|
-
var readMdxFile = async (
|
|
54
|
-
const { data } = matter.read(
|
|
53
|
+
var readMdxFile = async (path3) => {
|
|
54
|
+
const { data } = matter.read(path3);
|
|
55
55
|
const { markdown, ...frontmatter } = data;
|
|
56
56
|
return { ...frontmatter, markdown };
|
|
57
57
|
};
|
|
@@ -106,7 +106,7 @@ var versionResource = async (catalogDir, id) => {
|
|
|
106
106
|
const files = await getFiles(`${catalogDir}/**/index.{md,mdx}`);
|
|
107
107
|
const matchedFiles = await searchFilesForId(files, id);
|
|
108
108
|
if (matchedFiles.length === 0) {
|
|
109
|
-
throw new Error(`No
|
|
109
|
+
throw new Error(`No resource found with id: ${id}`);
|
|
110
110
|
}
|
|
111
111
|
const file = matchedFiles[0];
|
|
112
112
|
const sourceDirectory = dirname(file);
|
|
@@ -132,8 +132,8 @@ var writeResource = async (catalogDir, resource, options = {
|
|
|
132
132
|
override: false,
|
|
133
133
|
versionExistingContent: false
|
|
134
134
|
}) => {
|
|
135
|
-
const
|
|
136
|
-
const fullPath = join2(catalogDir,
|
|
135
|
+
const path3 = options.path || `/${resource.id}`;
|
|
136
|
+
const fullPath = join2(catalogDir, path3);
|
|
137
137
|
fsSync2.mkdirSync(fullPath, { recursive: true });
|
|
138
138
|
const lockPath = join2(fullPath, "index.mdx");
|
|
139
139
|
if (!fsSync2.existsSync(lockPath)) {
|
|
@@ -176,6 +176,15 @@ var getResource = async (catalogDir, id, version, options) => {
|
|
|
176
176
|
markdown: content.trim()
|
|
177
177
|
};
|
|
178
178
|
};
|
|
179
|
+
var getResourcePath = async (catalogDir, id, version) => {
|
|
180
|
+
const file = await findFileById(catalogDir, id, version);
|
|
181
|
+
if (!file) return;
|
|
182
|
+
return {
|
|
183
|
+
fullPath: file,
|
|
184
|
+
relativePath: file.replace(catalogDir, ""),
|
|
185
|
+
directory: dirname(file.replace(catalogDir, ""))
|
|
186
|
+
};
|
|
187
|
+
};
|
|
179
188
|
var getResources = async (catalogDir, {
|
|
180
189
|
type,
|
|
181
190
|
latestOnly = false,
|
|
@@ -236,12 +245,16 @@ var getEvent = (directory) => async (id, version) => getResource(directory, id,
|
|
|
236
245
|
var getEvents = (directory) => async (options) => getResources(directory, { type: "events", ...options });
|
|
237
246
|
var writeEvent = (directory) => async (event, options = { path: "", override: false }) => writeResource(directory, { ...event }, { ...options, type: "event" });
|
|
238
247
|
var writeEventToService = (directory) => async (event, service, options = { path: "" }) => {
|
|
239
|
-
|
|
248
|
+
const resourcePath = await getResourcePath(directory, service.id, service.version);
|
|
249
|
+
if (!resourcePath) {
|
|
250
|
+
throw new Error("Service not found");
|
|
251
|
+
}
|
|
252
|
+
let pathForEvent = service.version && service.version !== "latest" ? `${resourcePath.directory}/versioned/${service.version}/events` : `${resourcePath.directory}/events`;
|
|
240
253
|
pathForEvent = join3(pathForEvent, event.id);
|
|
241
254
|
await writeResource(directory, { ...event }, { ...options, path: pathForEvent, type: "event" });
|
|
242
255
|
};
|
|
243
|
-
var rmEvent = (directory) => async (
|
|
244
|
-
await fs2.rm(join3(directory,
|
|
256
|
+
var rmEvent = (directory) => async (path3) => {
|
|
257
|
+
await fs2.rm(join3(directory, path3), { recursive: true });
|
|
245
258
|
};
|
|
246
259
|
var rmEventById = (directory) => async (id, version, persistFiles) => {
|
|
247
260
|
await rmResourceById(directory, id, version, { type: "event", persistFiles });
|
|
@@ -263,12 +276,16 @@ var getCommand = (directory) => async (id, version) => getResource(directory, id
|
|
|
263
276
|
var getCommands = (directory) => async (options) => getResources(directory, { type: "commands", ...options });
|
|
264
277
|
var writeCommand = (directory) => async (command, options = { path: "" }) => writeResource(directory, { ...command }, { ...options, type: "command" });
|
|
265
278
|
var writeCommandToService = (directory) => async (command, service, options = { path: "" }) => {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
279
|
+
const resourcePath = await getResourcePath(directory, service.id, service.version);
|
|
280
|
+
if (!resourcePath) {
|
|
281
|
+
throw new Error("Service not found");
|
|
282
|
+
}
|
|
283
|
+
let pathForCommand = service.version && service.version !== "latest" ? `${resourcePath.directory}/versioned/${service.version}/commands` : `${resourcePath.directory}/commands`;
|
|
284
|
+
pathForCommand = join4(pathForCommand, command.id);
|
|
285
|
+
await writeResource(directory, { ...command }, { ...options, path: pathForCommand, type: "command" });
|
|
269
286
|
};
|
|
270
|
-
var rmCommand = (directory) => async (
|
|
271
|
-
await fs3.rm(join4(directory,
|
|
287
|
+
var rmCommand = (directory) => async (path3) => {
|
|
288
|
+
await fs3.rm(join4(directory, path3), { recursive: true });
|
|
272
289
|
};
|
|
273
290
|
var rmCommandById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "command", persistFiles });
|
|
274
291
|
var versionCommand = (directory) => async (id) => versionResource(directory, id);
|
|
@@ -288,12 +305,16 @@ var getQuery = (directory) => async (id, version) => getResource(directory, id,
|
|
|
288
305
|
var writeQuery = (directory) => async (query, options = { path: "" }) => writeResource(directory, { ...query }, { ...options, type: "query" });
|
|
289
306
|
var getQueries = (directory) => async (options) => getResources(directory, { type: "queries", ...options });
|
|
290
307
|
var writeQueryToService = (directory) => async (query, service, options = { path: "" }) => {
|
|
291
|
-
|
|
308
|
+
const resourcePath = await getResourcePath(directory, service.id, service.version);
|
|
309
|
+
if (!resourcePath) {
|
|
310
|
+
throw new Error("Service not found");
|
|
311
|
+
}
|
|
312
|
+
let pathForQuery = service.version && service.version !== "latest" ? `${resourcePath.directory}/versioned/${service.version}/queries` : `${resourcePath.directory}/queries`;
|
|
292
313
|
pathForQuery = join5(pathForQuery, query.id);
|
|
293
314
|
await writeResource(directory, { ...query }, { ...options, path: pathForQuery, type: "query" });
|
|
294
315
|
};
|
|
295
|
-
var rmQuery = (directory) => async (
|
|
296
|
-
await fs4.rm(join5(directory,
|
|
316
|
+
var rmQuery = (directory) => async (path3) => {
|
|
317
|
+
await fs4.rm(join5(directory, path3), { recursive: true });
|
|
297
318
|
};
|
|
298
319
|
var rmQueryById = (directory) => async (id, version, persistFiles) => {
|
|
299
320
|
await rmResourceById(directory, id, version, { type: "query", persistFiles });
|
|
@@ -310,7 +331,7 @@ var queryHasVersion = (directory) => async (id, version) => {
|
|
|
310
331
|
|
|
311
332
|
// src/services.ts
|
|
312
333
|
import fs5 from "node:fs/promises";
|
|
313
|
-
import { join as join6, dirname as
|
|
334
|
+
import { join as join6, dirname as dirname3 } from "node:path";
|
|
314
335
|
var getService = (directory) => async (id, version) => getResource(directory, id, version, { type: "service" });
|
|
315
336
|
var getServices = (directory) => async (options) => getResources(directory, {
|
|
316
337
|
type: "services",
|
|
@@ -329,8 +350,8 @@ var writeService = (directory) => async (service, options = { path: "" }) => {
|
|
|
329
350
|
};
|
|
330
351
|
var writeVersionedService = (directory) => async (service) => {
|
|
331
352
|
const resource = { ...service };
|
|
332
|
-
const
|
|
333
|
-
return await writeService(directory)(resource, { path:
|
|
353
|
+
const path3 = getVersionedDirectory(service.id, service.version);
|
|
354
|
+
return await writeService(directory)(resource, { path: path3 });
|
|
334
355
|
};
|
|
335
356
|
var writeServiceToDomain = (directory) => async (service, domain, options = { path: "" }) => {
|
|
336
357
|
let pathForService = domain.version && domain.version !== "latest" ? `/${domain.id}/versioned/${domain.version}/services` : `/${domain.id}/services`;
|
|
@@ -338,8 +359,8 @@ var writeServiceToDomain = (directory) => async (service, domain, options = { pa
|
|
|
338
359
|
await writeResource(directory, { ...service }, { ...options, path: pathForService, type: "service" });
|
|
339
360
|
};
|
|
340
361
|
var versionService = (directory) => async (id) => versionResource(directory, id);
|
|
341
|
-
var rmService = (directory) => async (
|
|
342
|
-
await fs5.rm(join6(directory,
|
|
362
|
+
var rmService = (directory) => async (path3) => {
|
|
363
|
+
await fs5.rm(join6(directory, path3), { recursive: true });
|
|
343
364
|
};
|
|
344
365
|
var rmServiceById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "service", persistFiles });
|
|
345
366
|
var addFileToService = (directory) => async (id, file, version) => addFileToResource(directory, id, file, version);
|
|
@@ -357,7 +378,7 @@ var getSpecificationFilesForService = (directory) => async (id, version) => {
|
|
|
357
378
|
throw new Error(`Specification file name for ${specFile} is undefined`);
|
|
358
379
|
}
|
|
359
380
|
const rawFile = await getFileFromResource(directory, id, { fileName }, version);
|
|
360
|
-
return { key: specFile, content: rawFile, fileName, path: join6(
|
|
381
|
+
return { key: specFile, content: rawFile, fileName, path: join6(dirname3(filePathToService), fileName) };
|
|
361
382
|
});
|
|
362
383
|
specs = await Promise.all(getSpecs);
|
|
363
384
|
}
|
|
@@ -392,8 +413,8 @@ var addMessageToService = (directory) => async (id, direction, event, version) =
|
|
|
392
413
|
if (!existingResource) {
|
|
393
414
|
throw new Error(`Cannot find service ${id} in the catalog`);
|
|
394
415
|
}
|
|
395
|
-
const
|
|
396
|
-
const pathToResource = join6(
|
|
416
|
+
const path3 = existingResource.split("/services")[0];
|
|
417
|
+
const pathToResource = join6(path3, "services");
|
|
397
418
|
await rmServiceById(directory)(id, version);
|
|
398
419
|
await writeService(pathToResource)(service);
|
|
399
420
|
};
|
|
@@ -404,7 +425,9 @@ var serviceHasVersion = (directory) => async (id, version) => {
|
|
|
404
425
|
|
|
405
426
|
// src/domains.ts
|
|
406
427
|
import fs6 from "node:fs/promises";
|
|
407
|
-
import { join as join7 } from "node:path";
|
|
428
|
+
import path, { join as join7 } from "node:path";
|
|
429
|
+
import fsSync3 from "node:fs";
|
|
430
|
+
import matter3 from "gray-matter";
|
|
408
431
|
var getDomain = (directory) => async (id, version) => getResource(directory, id, version, { type: "domain" });
|
|
409
432
|
var getDomains = (directory) => async (options) => getResources(directory, {
|
|
410
433
|
type: "domains",
|
|
@@ -419,11 +442,27 @@ var writeDomain = (directory) => async (domain, options = { path: "" }) => {
|
|
|
419
442
|
return await writeResource(directory, resource, { ...options, type: "domain" });
|
|
420
443
|
};
|
|
421
444
|
var versionDomain = (directory) => async (id) => versionResource(directory, id);
|
|
422
|
-
var rmDomain = (directory) => async (
|
|
423
|
-
await fs6.rm(join7(directory,
|
|
445
|
+
var rmDomain = (directory) => async (path3) => {
|
|
446
|
+
await fs6.rm(join7(directory, path3), { recursive: true });
|
|
424
447
|
};
|
|
425
448
|
var rmDomainById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "domain", persistFiles });
|
|
426
449
|
var addFileToDomain = (directory) => async (id, file, version) => addFileToResource(directory, id, file, version);
|
|
450
|
+
var addUbiquitousLanguageToDomain = (directory) => async (id, ubiquitousLanguageDictionary, version) => {
|
|
451
|
+
const content = matter3.stringify("", {
|
|
452
|
+
...ubiquitousLanguageDictionary
|
|
453
|
+
});
|
|
454
|
+
await addFileToResource(directory, id, { content, fileName: "ubiquitous-language.mdx" }, version);
|
|
455
|
+
};
|
|
456
|
+
var getUbiquitousLanguageFromDomain = (directory) => async (id, version) => {
|
|
457
|
+
const pathToDomain = await findFileById(directory, id, version) || "";
|
|
458
|
+
const pathToUbiquitousLanguage = path.join(path.dirname(pathToDomain), "ubiquitous-language.mdx");
|
|
459
|
+
const fileExists = fsSync3.existsSync(pathToUbiquitousLanguage);
|
|
460
|
+
if (!fileExists) {
|
|
461
|
+
return void 0;
|
|
462
|
+
}
|
|
463
|
+
const content = await readMdxFile(pathToUbiquitousLanguage);
|
|
464
|
+
return content;
|
|
465
|
+
};
|
|
427
466
|
var domainHasVersion = (directory) => async (id, version) => {
|
|
428
467
|
const file = await findFileById(directory, id, version);
|
|
429
468
|
return !!file;
|
|
@@ -448,8 +487,8 @@ import { join as join8 } from "node:path";
|
|
|
448
487
|
var getChannel = (directory) => async (id, version) => getResource(directory, id, version, { type: "channel" });
|
|
449
488
|
var getChannels = (directory) => async (options) => getResources(directory, { type: "channels", ...options });
|
|
450
489
|
var writeChannel = (directory) => async (channel, options = { path: "" }) => writeResource(directory, { ...channel }, { ...options, type: "channel" });
|
|
451
|
-
var rmChannel = (directory) => async (
|
|
452
|
-
await fs7.rm(join8(directory,
|
|
490
|
+
var rmChannel = (directory) => async (path3) => {
|
|
491
|
+
await fs7.rm(join8(directory, path3), { recursive: true });
|
|
453
492
|
};
|
|
454
493
|
var rmChannelById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "channel", persistFiles });
|
|
455
494
|
var versionChannel = (directory) => async (id) => versionResource(directory, id);
|
|
@@ -488,22 +527,22 @@ var addMessageToChannel = (directory, collection) => async (id, _message, versio
|
|
|
488
527
|
if (!existingResource) {
|
|
489
528
|
throw new Error(`Cannot find message ${id} in the catalog`);
|
|
490
529
|
}
|
|
491
|
-
const
|
|
492
|
-
const pathToResource = join8(
|
|
530
|
+
const path3 = existingResource.split(`/${collection}`)[0];
|
|
531
|
+
const pathToResource = join8(path3, collection);
|
|
493
532
|
await rmMessageById(directory)(_message.id, _message.version, true);
|
|
494
533
|
await writeMessage(pathToResource)(message);
|
|
495
534
|
};
|
|
496
535
|
|
|
497
536
|
// src/custom-docs.ts
|
|
498
|
-
import
|
|
499
|
-
import
|
|
537
|
+
import path2, { join as join9 } from "node:path";
|
|
538
|
+
import fsSync4 from "node:fs";
|
|
500
539
|
import fs8 from "node:fs/promises";
|
|
501
|
-
import
|
|
540
|
+
import matter4 from "gray-matter";
|
|
502
541
|
import slugify from "slugify";
|
|
503
542
|
var getCustomDoc = (directory) => async (filePath) => {
|
|
504
|
-
const fullPath =
|
|
543
|
+
const fullPath = path2.join(directory, filePath);
|
|
505
544
|
const fullPathWithExtension = fullPath.endsWith(".mdx") ? fullPath : `${fullPath}.mdx`;
|
|
506
|
-
const fileExists =
|
|
545
|
+
const fileExists = fsSync4.existsSync(fullPathWithExtension);
|
|
507
546
|
if (!fileExists) {
|
|
508
547
|
return void 0;
|
|
509
548
|
}
|
|
@@ -520,10 +559,10 @@ var writeCustomDoc = (directory) => async (customDoc, options = { path: "" }) =>
|
|
|
520
559
|
const { fileName, ...rest } = customDoc;
|
|
521
560
|
const name = fileName || slugify(customDoc.title, { lower: true });
|
|
522
561
|
const withExtension = name.endsWith(".mdx") ? name : `${name}.mdx`;
|
|
523
|
-
const fullPath =
|
|
524
|
-
|
|
525
|
-
const document =
|
|
526
|
-
|
|
562
|
+
const fullPath = path2.join(directory, options.path || "", withExtension);
|
|
563
|
+
fsSync4.mkdirSync(path2.dirname(fullPath), { recursive: true });
|
|
564
|
+
const document = matter4.stringify(customDoc.markdown.trim(), rest);
|
|
565
|
+
fsSync4.writeFileSync(fullPath, document);
|
|
527
566
|
};
|
|
528
567
|
var rmCustomDoc = (directory) => async (filePath) => {
|
|
529
568
|
const withExtension = filePath.endsWith(".mdx") ? filePath : `${filePath}.mdx`;
|
|
@@ -532,14 +571,14 @@ var rmCustomDoc = (directory) => async (filePath) => {
|
|
|
532
571
|
|
|
533
572
|
// src/teams.ts
|
|
534
573
|
import fs9 from "node:fs/promises";
|
|
535
|
-
import
|
|
574
|
+
import fsSync5 from "node:fs";
|
|
536
575
|
import { join as join10 } from "node:path";
|
|
537
|
-
import
|
|
576
|
+
import matter5 from "gray-matter";
|
|
538
577
|
var getTeam = (catalogDir) => async (id) => {
|
|
539
578
|
const files = await getFiles(`${catalogDir}/${id}.md`);
|
|
540
579
|
if (files.length == 0) return void 0;
|
|
541
580
|
const file = files[0];
|
|
542
|
-
const { data, content } =
|
|
581
|
+
const { data, content } = matter5.read(file);
|
|
543
582
|
return {
|
|
544
583
|
...data,
|
|
545
584
|
id: data.id,
|
|
@@ -551,7 +590,7 @@ var getTeams = (catalogDir) => async (options) => {
|
|
|
551
590
|
const files = await getFiles(`${catalogDir}/teams/*.md`);
|
|
552
591
|
if (files.length === 0) return [];
|
|
553
592
|
return files.map((file) => {
|
|
554
|
-
const { data, content } =
|
|
593
|
+
const { data, content } = matter5.read(file);
|
|
555
594
|
return {
|
|
556
595
|
...data,
|
|
557
596
|
id: data.id,
|
|
@@ -568,23 +607,23 @@ var writeTeam = (catalogDir) => async (team, options = {}) => {
|
|
|
568
607
|
throw new Error(`Failed to write ${resource.id} (team) as it already exists`);
|
|
569
608
|
}
|
|
570
609
|
const { markdown, ...frontmatter } = resource;
|
|
571
|
-
const document =
|
|
572
|
-
|
|
573
|
-
|
|
610
|
+
const document = matter5.stringify(markdown, frontmatter);
|
|
611
|
+
fsSync5.mkdirSync(join10(catalogDir, ""), { recursive: true });
|
|
612
|
+
fsSync5.writeFileSync(join10(catalogDir, "", `${resource.id}.md`), document);
|
|
574
613
|
};
|
|
575
614
|
var rmTeamById = (catalogDir) => async (id) => {
|
|
576
615
|
await fs9.rm(join10(catalogDir, `${id}.md`), { recursive: true });
|
|
577
616
|
};
|
|
578
617
|
|
|
579
618
|
// src/users.ts
|
|
580
|
-
import
|
|
619
|
+
import fsSync6 from "node:fs";
|
|
581
620
|
import { join as join11 } from "node:path";
|
|
582
|
-
import
|
|
621
|
+
import matter6 from "gray-matter";
|
|
583
622
|
var getUser = (catalogDir) => async (id) => {
|
|
584
623
|
const files = await getFiles(`${catalogDir}/${id}.md`);
|
|
585
624
|
if (files.length == 0) return void 0;
|
|
586
625
|
const file = files[0];
|
|
587
|
-
const { data, content } =
|
|
626
|
+
const { data, content } = matter6.read(file);
|
|
588
627
|
return {
|
|
589
628
|
...data,
|
|
590
629
|
id: data.id,
|
|
@@ -597,7 +636,7 @@ var getUsers = (catalogDir) => async (options) => {
|
|
|
597
636
|
const files = await getFiles(`${catalogDir}/users/*.md`);
|
|
598
637
|
if (files.length === 0) return [];
|
|
599
638
|
return files.map((file) => {
|
|
600
|
-
const { data, content } =
|
|
639
|
+
const { data, content } = matter6.read(file);
|
|
601
640
|
return {
|
|
602
641
|
...data,
|
|
603
642
|
id: data.id,
|
|
@@ -615,16 +654,16 @@ var writeUser = (catalogDir) => async (user, options = {}) => {
|
|
|
615
654
|
throw new Error(`Failed to write ${resource.id} (user) as it already exists`);
|
|
616
655
|
}
|
|
617
656
|
const { markdown, ...frontmatter } = resource;
|
|
618
|
-
const document =
|
|
619
|
-
|
|
620
|
-
|
|
657
|
+
const document = matter6.stringify(markdown, frontmatter);
|
|
658
|
+
fsSync6.mkdirSync(join11(catalogDir, ""), { recursive: true });
|
|
659
|
+
fsSync6.writeFileSync(join11(catalogDir, "", `${resource.id}.md`), document);
|
|
621
660
|
};
|
|
622
661
|
var rmUserById = (catalogDir) => async (id) => {
|
|
623
|
-
|
|
662
|
+
fsSync6.rmSync(join11(catalogDir, `${id}.md`), { recursive: true });
|
|
624
663
|
};
|
|
625
664
|
|
|
626
665
|
// src/index.ts
|
|
627
|
-
var index_default = (
|
|
666
|
+
var index_default = (path3) => {
|
|
628
667
|
return {
|
|
629
668
|
/**
|
|
630
669
|
* Returns an events from EventCatalog
|
|
@@ -632,13 +671,13 @@ var index_default = (path2) => {
|
|
|
632
671
|
* @param version - Optional id of the version to get (supports semver)
|
|
633
672
|
* @returns Event|Undefined
|
|
634
673
|
*/
|
|
635
|
-
getEvent: getEvent(join12(
|
|
674
|
+
getEvent: getEvent(join12(path3)),
|
|
636
675
|
/**
|
|
637
676
|
* Returns all events from EventCatalog
|
|
638
677
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
639
678
|
* @returns Event[]|Undefined
|
|
640
679
|
*/
|
|
641
|
-
getEvents: getEvents(join12(
|
|
680
|
+
getEvents: getEvents(join12(path3)),
|
|
642
681
|
/**
|
|
643
682
|
* Adds an event to EventCatalog
|
|
644
683
|
*
|
|
@@ -646,7 +685,7 @@ var index_default = (path2) => {
|
|
|
646
685
|
* @param options - Optional options to write the event
|
|
647
686
|
*
|
|
648
687
|
*/
|
|
649
|
-
writeEvent: writeEvent(join12(
|
|
688
|
+
writeEvent: writeEvent(join12(path3, "events")),
|
|
650
689
|
/**
|
|
651
690
|
* Adds an event to a service in EventCatalog
|
|
652
691
|
*
|
|
@@ -655,26 +694,26 @@ var index_default = (path2) => {
|
|
|
655
694
|
* @param options - Optional options to write the event
|
|
656
695
|
*
|
|
657
696
|
*/
|
|
658
|
-
writeEventToService: writeEventToService(join12(
|
|
697
|
+
writeEventToService: writeEventToService(join12(path3)),
|
|
659
698
|
/**
|
|
660
699
|
* Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
|
|
661
700
|
*
|
|
662
701
|
* @param path - The path to your event, e.g. `/Inventory/InventoryAdjusted`
|
|
663
702
|
*
|
|
664
703
|
*/
|
|
665
|
-
rmEvent: rmEvent(join12(
|
|
704
|
+
rmEvent: rmEvent(join12(path3, "events")),
|
|
666
705
|
/**
|
|
667
706
|
* Remove an event by an Event id
|
|
668
707
|
*
|
|
669
708
|
* @param id - The id of the event you want to remove
|
|
670
709
|
*
|
|
671
710
|
*/
|
|
672
|
-
rmEventById: rmEventById(join12(
|
|
711
|
+
rmEventById: rmEventById(join12(path3)),
|
|
673
712
|
/**
|
|
674
713
|
* Moves a given event id to the version directory
|
|
675
714
|
* @param directory
|
|
676
715
|
*/
|
|
677
|
-
versionEvent: versionEvent(join12(
|
|
716
|
+
versionEvent: versionEvent(join12(path3)),
|
|
678
717
|
/**
|
|
679
718
|
* Adds a file to the given event
|
|
680
719
|
* @param id - The id of the event to add the file to
|
|
@@ -682,7 +721,7 @@ var index_default = (path2) => {
|
|
|
682
721
|
* @param version - Optional version of the event to add the file to
|
|
683
722
|
* @returns
|
|
684
723
|
*/
|
|
685
|
-
addFileToEvent: addFileToEvent(join12(
|
|
724
|
+
addFileToEvent: addFileToEvent(join12(path3)),
|
|
686
725
|
/**
|
|
687
726
|
* Adds a schema to the given event
|
|
688
727
|
* @param id - The id of the event to add the schema to
|
|
@@ -690,14 +729,14 @@ var index_default = (path2) => {
|
|
|
690
729
|
* @param version - Optional version of the event to add the schema to
|
|
691
730
|
* @returns
|
|
692
731
|
*/
|
|
693
|
-
addSchemaToEvent: addSchemaToEvent(join12(
|
|
732
|
+
addSchemaToEvent: addSchemaToEvent(join12(path3)),
|
|
694
733
|
/**
|
|
695
734
|
* Check to see if an event version exists
|
|
696
735
|
* @param id - The id of the event
|
|
697
736
|
* @param version - The version of the event (supports semver)
|
|
698
737
|
* @returns
|
|
699
738
|
*/
|
|
700
|
-
eventHasVersion: eventHasVersion(join12(
|
|
739
|
+
eventHasVersion: eventHasVersion(join12(path3)),
|
|
701
740
|
/**
|
|
702
741
|
* ================================
|
|
703
742
|
* Commands
|
|
@@ -709,13 +748,13 @@ var index_default = (path2) => {
|
|
|
709
748
|
* @param version - Optional id of the version to get (supports semver)
|
|
710
749
|
* @returns Command|Undefined
|
|
711
750
|
*/
|
|
712
|
-
getCommand: getCommand(join12(
|
|
751
|
+
getCommand: getCommand(join12(path3)),
|
|
713
752
|
/**
|
|
714
753
|
* Returns all commands from EventCatalog
|
|
715
754
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
716
755
|
* @returns Command[]|Undefined
|
|
717
756
|
*/
|
|
718
|
-
getCommands: getCommands(join12(
|
|
757
|
+
getCommands: getCommands(join12(path3)),
|
|
719
758
|
/**
|
|
720
759
|
* Adds an command to EventCatalog
|
|
721
760
|
*
|
|
@@ -723,7 +762,7 @@ var index_default = (path2) => {
|
|
|
723
762
|
* @param options - Optional options to write the command
|
|
724
763
|
*
|
|
725
764
|
*/
|
|
726
|
-
writeCommand: writeCommand(join12(
|
|
765
|
+
writeCommand: writeCommand(join12(path3, "commands")),
|
|
727
766
|
/**
|
|
728
767
|
* Adds a command to a service in EventCatalog
|
|
729
768
|
*
|
|
@@ -732,26 +771,26 @@ var index_default = (path2) => {
|
|
|
732
771
|
* @param options - Optional options to write the command
|
|
733
772
|
*
|
|
734
773
|
*/
|
|
735
|
-
writeCommandToService: writeCommandToService(join12(
|
|
774
|
+
writeCommandToService: writeCommandToService(join12(path3)),
|
|
736
775
|
/**
|
|
737
776
|
* Remove an command to EventCatalog (modeled on the standard POSIX rm utility)
|
|
738
777
|
*
|
|
739
778
|
* @param path - The path to your command, e.g. `/Inventory/InventoryAdjusted`
|
|
740
779
|
*
|
|
741
780
|
*/
|
|
742
|
-
rmCommand: rmCommand(join12(
|
|
781
|
+
rmCommand: rmCommand(join12(path3, "commands")),
|
|
743
782
|
/**
|
|
744
783
|
* Remove an command by an Event id
|
|
745
784
|
*
|
|
746
785
|
* @param id - The id of the command you want to remove
|
|
747
786
|
*
|
|
748
787
|
*/
|
|
749
|
-
rmCommandById: rmCommandById(join12(
|
|
788
|
+
rmCommandById: rmCommandById(join12(path3)),
|
|
750
789
|
/**
|
|
751
790
|
* Moves a given command id to the version directory
|
|
752
791
|
* @param directory
|
|
753
792
|
*/
|
|
754
|
-
versionCommand: versionCommand(join12(
|
|
793
|
+
versionCommand: versionCommand(join12(path3)),
|
|
755
794
|
/**
|
|
756
795
|
* Adds a file to the given command
|
|
757
796
|
* @param id - The id of the command to add the file to
|
|
@@ -759,7 +798,7 @@ var index_default = (path2) => {
|
|
|
759
798
|
* @param version - Optional version of the command to add the file to
|
|
760
799
|
* @returns
|
|
761
800
|
*/
|
|
762
|
-
addFileToCommand: addFileToCommand(join12(
|
|
801
|
+
addFileToCommand: addFileToCommand(join12(path3)),
|
|
763
802
|
/**
|
|
764
803
|
* Adds a schema to the given command
|
|
765
804
|
* @param id - The id of the command to add the schema to
|
|
@@ -767,14 +806,14 @@ var index_default = (path2) => {
|
|
|
767
806
|
* @param version - Optional version of the command to add the schema to
|
|
768
807
|
* @returns
|
|
769
808
|
*/
|
|
770
|
-
addSchemaToCommand: addSchemaToCommand(join12(
|
|
809
|
+
addSchemaToCommand: addSchemaToCommand(join12(path3)),
|
|
771
810
|
/**
|
|
772
811
|
* Check to see if a command version exists
|
|
773
812
|
* @param id - The id of the command
|
|
774
813
|
* @param version - The version of the command (supports semver)
|
|
775
814
|
* @returns
|
|
776
815
|
*/
|
|
777
|
-
commandHasVersion: commandHasVersion(join12(
|
|
816
|
+
commandHasVersion: commandHasVersion(join12(path3)),
|
|
778
817
|
/**
|
|
779
818
|
* ================================
|
|
780
819
|
* Queries
|
|
@@ -786,13 +825,13 @@ var index_default = (path2) => {
|
|
|
786
825
|
* @param version - Optional id of the version to get (supports semver)
|
|
787
826
|
* @returns Query|Undefined
|
|
788
827
|
*/
|
|
789
|
-
getQuery: getQuery(join12(
|
|
828
|
+
getQuery: getQuery(join12(path3)),
|
|
790
829
|
/**
|
|
791
830
|
* Returns all queries from EventCatalog
|
|
792
831
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
793
832
|
* @returns Query[]|Undefined
|
|
794
833
|
*/
|
|
795
|
-
getQueries: getQueries(join12(
|
|
834
|
+
getQueries: getQueries(join12(path3)),
|
|
796
835
|
/**
|
|
797
836
|
* Adds a query to EventCatalog
|
|
798
837
|
*
|
|
@@ -800,7 +839,7 @@ var index_default = (path2) => {
|
|
|
800
839
|
* @param options - Optional options to write the event
|
|
801
840
|
*
|
|
802
841
|
*/
|
|
803
|
-
writeQuery: writeQuery(join12(
|
|
842
|
+
writeQuery: writeQuery(join12(path3, "queries")),
|
|
804
843
|
/**
|
|
805
844
|
* Adds a query to a service in EventCatalog
|
|
806
845
|
*
|
|
@@ -809,26 +848,26 @@ var index_default = (path2) => {
|
|
|
809
848
|
* @param options - Optional options to write the query
|
|
810
849
|
*
|
|
811
850
|
*/
|
|
812
|
-
writeQueryToService: writeQueryToService(join12(
|
|
851
|
+
writeQueryToService: writeQueryToService(join12(path3)),
|
|
813
852
|
/**
|
|
814
853
|
* Remove an query to EventCatalog (modeled on the standard POSIX rm utility)
|
|
815
854
|
*
|
|
816
855
|
* @param path - The path to your query, e.g. `/Orders/GetOrder`
|
|
817
856
|
*
|
|
818
857
|
*/
|
|
819
|
-
rmQuery: rmQuery(join12(
|
|
858
|
+
rmQuery: rmQuery(join12(path3, "queries")),
|
|
820
859
|
/**
|
|
821
860
|
* Remove a query by a Query id
|
|
822
861
|
*
|
|
823
862
|
* @param id - The id of the query you want to remove
|
|
824
863
|
*
|
|
825
864
|
*/
|
|
826
|
-
rmQueryById: rmQueryById(join12(
|
|
865
|
+
rmQueryById: rmQueryById(join12(path3)),
|
|
827
866
|
/**
|
|
828
867
|
* Moves a given query id to the version directory
|
|
829
868
|
* @param directory
|
|
830
869
|
*/
|
|
831
|
-
versionQuery: versionQuery(join12(
|
|
870
|
+
versionQuery: versionQuery(join12(path3)),
|
|
832
871
|
/**
|
|
833
872
|
* Adds a file to the given query
|
|
834
873
|
* @param id - The id of the query to add the file to
|
|
@@ -836,7 +875,7 @@ var index_default = (path2) => {
|
|
|
836
875
|
* @param version - Optional version of the query to add the file to
|
|
837
876
|
* @returns
|
|
838
877
|
*/
|
|
839
|
-
addFileToQuery: addFileToQuery(join12(
|
|
878
|
+
addFileToQuery: addFileToQuery(join12(path3)),
|
|
840
879
|
/**
|
|
841
880
|
* Adds a schema to the given query
|
|
842
881
|
* @param id - The id of the query to add the schema to
|
|
@@ -844,14 +883,14 @@ var index_default = (path2) => {
|
|
|
844
883
|
* @param version - Optional version of the query to add the schema to
|
|
845
884
|
* @returns
|
|
846
885
|
*/
|
|
847
|
-
addSchemaToQuery: addSchemaToQuery(join12(
|
|
886
|
+
addSchemaToQuery: addSchemaToQuery(join12(path3)),
|
|
848
887
|
/**
|
|
849
888
|
* Check to see if an query version exists
|
|
850
889
|
* @param id - The id of the query
|
|
851
890
|
* @param version - The version of the query (supports semver)
|
|
852
891
|
* @returns
|
|
853
892
|
*/
|
|
854
|
-
queryHasVersion: queryHasVersion(join12(
|
|
893
|
+
queryHasVersion: queryHasVersion(join12(path3)),
|
|
855
894
|
/**
|
|
856
895
|
* ================================
|
|
857
896
|
* Channels
|
|
@@ -863,13 +902,13 @@ var index_default = (path2) => {
|
|
|
863
902
|
* @param version - Optional id of the version to get (supports semver)
|
|
864
903
|
* @returns Channel|Undefined
|
|
865
904
|
*/
|
|
866
|
-
getChannel: getChannel(join12(
|
|
905
|
+
getChannel: getChannel(join12(path3)),
|
|
867
906
|
/**
|
|
868
907
|
* Returns all channels from EventCatalog
|
|
869
908
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
870
909
|
* @returns Channel[]|Undefined
|
|
871
910
|
*/
|
|
872
|
-
getChannels: getChannels(join12(
|
|
911
|
+
getChannels: getChannels(join12(path3)),
|
|
873
912
|
/**
|
|
874
913
|
* Adds an channel to EventCatalog
|
|
875
914
|
*
|
|
@@ -877,33 +916,33 @@ var index_default = (path2) => {
|
|
|
877
916
|
* @param options - Optional options to write the channel
|
|
878
917
|
*
|
|
879
918
|
*/
|
|
880
|
-
writeChannel: writeChannel(join12(
|
|
919
|
+
writeChannel: writeChannel(join12(path3, "channels")),
|
|
881
920
|
/**
|
|
882
921
|
* Remove an channel to EventCatalog (modeled on the standard POSIX rm utility)
|
|
883
922
|
*
|
|
884
923
|
* @param path - The path to your channel, e.g. `/Inventory/InventoryAdjusted`
|
|
885
924
|
*
|
|
886
925
|
*/
|
|
887
|
-
rmChannel: rmChannel(join12(
|
|
926
|
+
rmChannel: rmChannel(join12(path3, "channels")),
|
|
888
927
|
/**
|
|
889
928
|
* Remove an channel by an Event id
|
|
890
929
|
*
|
|
891
930
|
* @param id - The id of the channel you want to remove
|
|
892
931
|
*
|
|
893
932
|
*/
|
|
894
|
-
rmChannelById: rmChannelById(join12(
|
|
933
|
+
rmChannelById: rmChannelById(join12(path3)),
|
|
895
934
|
/**
|
|
896
935
|
* Moves a given channel id to the version directory
|
|
897
936
|
* @param directory
|
|
898
937
|
*/
|
|
899
|
-
versionChannel: versionChannel(join12(
|
|
938
|
+
versionChannel: versionChannel(join12(path3)),
|
|
900
939
|
/**
|
|
901
940
|
* Check to see if a channel version exists
|
|
902
941
|
* @param id - The id of the channel
|
|
903
942
|
* @param version - The version of the channel (supports semver)
|
|
904
943
|
* @returns
|
|
905
944
|
*/
|
|
906
|
-
channelHasVersion: channelHasVersion(join12(
|
|
945
|
+
channelHasVersion: channelHasVersion(join12(path3)),
|
|
907
946
|
/**
|
|
908
947
|
* Add a channel to an event
|
|
909
948
|
*
|
|
@@ -920,7 +959,7 @@ var index_default = (path2) => {
|
|
|
920
959
|
*
|
|
921
960
|
* ```
|
|
922
961
|
*/
|
|
923
|
-
addEventToChannel: addMessageToChannel(join12(
|
|
962
|
+
addEventToChannel: addMessageToChannel(join12(path3), "events"),
|
|
924
963
|
/**
|
|
925
964
|
* Add a channel to an command
|
|
926
965
|
*
|
|
@@ -937,7 +976,7 @@ var index_default = (path2) => {
|
|
|
937
976
|
*
|
|
938
977
|
* ```
|
|
939
978
|
*/
|
|
940
|
-
addCommandToChannel: addMessageToChannel(join12(
|
|
979
|
+
addCommandToChannel: addMessageToChannel(join12(path3), "commands"),
|
|
941
980
|
/**
|
|
942
981
|
* Add a channel to an query
|
|
943
982
|
*
|
|
@@ -954,7 +993,7 @@ var index_default = (path2) => {
|
|
|
954
993
|
*
|
|
955
994
|
* ```
|
|
956
995
|
*/
|
|
957
|
-
addQueryToChannel: addMessageToChannel(join12(
|
|
996
|
+
addQueryToChannel: addMessageToChannel(join12(path3), "queries"),
|
|
958
997
|
/**
|
|
959
998
|
* ================================
|
|
960
999
|
* SERVICES
|
|
@@ -967,14 +1006,14 @@ var index_default = (path2) => {
|
|
|
967
1006
|
* @param options - Optional options to write the event
|
|
968
1007
|
*
|
|
969
1008
|
*/
|
|
970
|
-
writeService: writeService(join12(
|
|
1009
|
+
writeService: writeService(join12(path3, "services")),
|
|
971
1010
|
/**
|
|
972
1011
|
* Adds a versioned service to EventCatalog
|
|
973
1012
|
*
|
|
974
1013
|
* @param service - The service to write
|
|
975
1014
|
*
|
|
976
1015
|
*/
|
|
977
|
-
writeVersionedService: writeVersionedService(join12(
|
|
1016
|
+
writeVersionedService: writeVersionedService(join12(path3, "services")),
|
|
978
1017
|
/**
|
|
979
1018
|
* Adds a service to a domain in EventCatalog
|
|
980
1019
|
*
|
|
@@ -983,39 +1022,39 @@ var index_default = (path2) => {
|
|
|
983
1022
|
* @param options - Optional options to write the event
|
|
984
1023
|
*
|
|
985
1024
|
*/
|
|
986
|
-
writeServiceToDomain: writeServiceToDomain(join12(
|
|
1025
|
+
writeServiceToDomain: writeServiceToDomain(join12(path3, "domains")),
|
|
987
1026
|
/**
|
|
988
1027
|
* Returns a service from EventCatalog
|
|
989
1028
|
* @param id - The id of the service to retrieve
|
|
990
1029
|
* @param version - Optional id of the version to get (supports semver)
|
|
991
1030
|
* @returns Service|Undefined
|
|
992
1031
|
*/
|
|
993
|
-
getService: getService(join12(
|
|
1032
|
+
getService: getService(join12(path3)),
|
|
994
1033
|
/**
|
|
995
1034
|
* Returns all services from EventCatalog
|
|
996
1035
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
997
1036
|
* @returns Service[]|Undefined
|
|
998
1037
|
*/
|
|
999
|
-
getServices: getServices(join12(
|
|
1038
|
+
getServices: getServices(join12(path3)),
|
|
1000
1039
|
/**
|
|
1001
1040
|
* Moves a given service id to the version directory
|
|
1002
1041
|
* @param directory
|
|
1003
1042
|
*/
|
|
1004
|
-
versionService: versionService(join12(
|
|
1043
|
+
versionService: versionService(join12(path3)),
|
|
1005
1044
|
/**
|
|
1006
1045
|
* Remove a service from EventCatalog (modeled on the standard POSIX rm utility)
|
|
1007
1046
|
*
|
|
1008
1047
|
* @param path - The path to your service, e.g. `/InventoryService`
|
|
1009
1048
|
*
|
|
1010
1049
|
*/
|
|
1011
|
-
rmService: rmService(join12(
|
|
1050
|
+
rmService: rmService(join12(path3, "services")),
|
|
1012
1051
|
/**
|
|
1013
1052
|
* Remove an service by an service id
|
|
1014
1053
|
*
|
|
1015
1054
|
* @param id - The id of the service you want to remove
|
|
1016
1055
|
*
|
|
1017
1056
|
*/
|
|
1018
|
-
rmServiceById: rmServiceById(join12(
|
|
1057
|
+
rmServiceById: rmServiceById(join12(path3)),
|
|
1019
1058
|
/**
|
|
1020
1059
|
* Adds a file to the given service
|
|
1021
1060
|
* @param id - The id of the service to add the file to
|
|
@@ -1023,21 +1062,21 @@ var index_default = (path2) => {
|
|
|
1023
1062
|
* @param version - Optional version of the service to add the file to
|
|
1024
1063
|
* @returns
|
|
1025
1064
|
*/
|
|
1026
|
-
addFileToService: addFileToService(join12(
|
|
1065
|
+
addFileToService: addFileToService(join12(path3)),
|
|
1027
1066
|
/**
|
|
1028
1067
|
* Returns the specifications for a given service
|
|
1029
1068
|
* @param id - The id of the service to retrieve the specifications for
|
|
1030
1069
|
* @param version - Optional version of the service
|
|
1031
1070
|
* @returns
|
|
1032
1071
|
*/
|
|
1033
|
-
getSpecificationFilesForService: getSpecificationFilesForService(join12(
|
|
1072
|
+
getSpecificationFilesForService: getSpecificationFilesForService(join12(path3)),
|
|
1034
1073
|
/**
|
|
1035
1074
|
* Check to see if a service version exists
|
|
1036
1075
|
* @param id - The id of the service
|
|
1037
1076
|
* @param version - The version of the service (supports semver)
|
|
1038
1077
|
* @returns
|
|
1039
1078
|
*/
|
|
1040
|
-
serviceHasVersion: serviceHasVersion(join12(
|
|
1079
|
+
serviceHasVersion: serviceHasVersion(join12(path3)),
|
|
1041
1080
|
/**
|
|
1042
1081
|
* Add an event to a service by it's id.
|
|
1043
1082
|
*
|
|
@@ -1057,7 +1096,7 @@ var index_default = (path2) => {
|
|
|
1057
1096
|
*
|
|
1058
1097
|
* ```
|
|
1059
1098
|
*/
|
|
1060
|
-
addEventToService: addMessageToService(join12(
|
|
1099
|
+
addEventToService: addMessageToService(join12(path3)),
|
|
1061
1100
|
/**
|
|
1062
1101
|
* Add a command to a service by it's id.
|
|
1063
1102
|
*
|
|
@@ -1077,7 +1116,7 @@ var index_default = (path2) => {
|
|
|
1077
1116
|
*
|
|
1078
1117
|
* ```
|
|
1079
1118
|
*/
|
|
1080
|
-
addCommandToService: addMessageToService(join12(
|
|
1119
|
+
addCommandToService: addMessageToService(join12(path3)),
|
|
1081
1120
|
/**
|
|
1082
1121
|
* Add a query to a service by it's id.
|
|
1083
1122
|
*
|
|
@@ -1097,7 +1136,7 @@ var index_default = (path2) => {
|
|
|
1097
1136
|
*
|
|
1098
1137
|
* ```
|
|
1099
1138
|
*/
|
|
1100
|
-
addQueryToService: addMessageToService(join12(
|
|
1139
|
+
addQueryToService: addMessageToService(join12(path3)),
|
|
1101
1140
|
/**
|
|
1102
1141
|
* ================================
|
|
1103
1142
|
* Domains
|
|
@@ -1110,39 +1149,39 @@ var index_default = (path2) => {
|
|
|
1110
1149
|
* @param options - Optional options to write the event
|
|
1111
1150
|
*
|
|
1112
1151
|
*/
|
|
1113
|
-
writeDomain: writeDomain(join12(
|
|
1152
|
+
writeDomain: writeDomain(join12(path3, "domains")),
|
|
1114
1153
|
/**
|
|
1115
1154
|
* Returns a domain from EventCatalog
|
|
1116
1155
|
* @param id - The id of the domain to retrieve
|
|
1117
1156
|
* @param version - Optional id of the version to get (supports semver)
|
|
1118
1157
|
* @returns Domain|Undefined
|
|
1119
1158
|
*/
|
|
1120
|
-
getDomain: getDomain(join12(
|
|
1159
|
+
getDomain: getDomain(join12(path3, "domains")),
|
|
1121
1160
|
/**
|
|
1122
1161
|
* Returns all domains from EventCatalog
|
|
1123
1162
|
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
1124
1163
|
* @returns Domain[]|Undefined
|
|
1125
1164
|
*/
|
|
1126
|
-
getDomains: getDomains(join12(
|
|
1165
|
+
getDomains: getDomains(join12(path3)),
|
|
1127
1166
|
/**
|
|
1128
1167
|
* Moves a given domain id to the version directory
|
|
1129
1168
|
* @param directory
|
|
1130
1169
|
*/
|
|
1131
|
-
versionDomain: versionDomain(join12(
|
|
1170
|
+
versionDomain: versionDomain(join12(path3, "domains")),
|
|
1132
1171
|
/**
|
|
1133
1172
|
* Remove a domain from EventCatalog (modeled on the standard POSIX rm utility)
|
|
1134
1173
|
*
|
|
1135
1174
|
* @param path - The path to your domain, e.g. `/Payment`
|
|
1136
1175
|
*
|
|
1137
1176
|
*/
|
|
1138
|
-
rmDomain: rmDomain(join12(
|
|
1177
|
+
rmDomain: rmDomain(join12(path3, "domains")),
|
|
1139
1178
|
/**
|
|
1140
1179
|
* Remove an service by an domain id
|
|
1141
1180
|
*
|
|
1142
1181
|
* @param id - The id of the domain you want to remove
|
|
1143
1182
|
*
|
|
1144
1183
|
*/
|
|
1145
|
-
rmDomainById: rmDomainById(join12(
|
|
1184
|
+
rmDomainById: rmDomainById(join12(path3, "domains")),
|
|
1146
1185
|
/**
|
|
1147
1186
|
* Adds a file to the given domain
|
|
1148
1187
|
* @param id - The id of the domain to add the file to
|
|
@@ -1150,14 +1189,28 @@ var index_default = (path2) => {
|
|
|
1150
1189
|
* @param version - Optional version of the domain to add the file to
|
|
1151
1190
|
* @returns
|
|
1152
1191
|
*/
|
|
1153
|
-
addFileToDomain: addFileToDomain(join12(
|
|
1192
|
+
addFileToDomain: addFileToDomain(join12(path3, "domains")),
|
|
1193
|
+
/**
|
|
1194
|
+
* Adds an ubiquitous language dictionary to a domain
|
|
1195
|
+
* @param id - The id of the domain to add the ubiquitous language to
|
|
1196
|
+
* @param ubiquitousLanguageDictionary - The ubiquitous language dictionary to add
|
|
1197
|
+
* @param version - Optional version of the domain to add the ubiquitous language to
|
|
1198
|
+
*/
|
|
1199
|
+
addUbiquitousLanguageToDomain: addUbiquitousLanguageToDomain(join12(path3, "domains")),
|
|
1200
|
+
/**
|
|
1201
|
+
* Get the ubiquitous language dictionary from a domain
|
|
1202
|
+
* @param id - The id of the domain to get the ubiquitous language from
|
|
1203
|
+
* @param version - Optional version of the domain to get the ubiquitous language from
|
|
1204
|
+
* @returns
|
|
1205
|
+
*/
|
|
1206
|
+
getUbiquitousLanguageFromDomain: getUbiquitousLanguageFromDomain(join12(path3, "domains")),
|
|
1154
1207
|
/**
|
|
1155
1208
|
* Check to see if a domain version exists
|
|
1156
1209
|
* @param id - The id of the domain
|
|
1157
1210
|
* @param version - The version of the domain (supports semver)
|
|
1158
1211
|
* @returns
|
|
1159
1212
|
*/
|
|
1160
|
-
domainHasVersion: domainHasVersion(join12(
|
|
1213
|
+
domainHasVersion: domainHasVersion(join12(path3)),
|
|
1161
1214
|
/**
|
|
1162
1215
|
* Adds a given service to a domain
|
|
1163
1216
|
* @param id - The id of the domain
|
|
@@ -1165,7 +1218,7 @@ var index_default = (path2) => {
|
|
|
1165
1218
|
* @param version - (Optional) The version of the domain to add the service to
|
|
1166
1219
|
* @returns
|
|
1167
1220
|
*/
|
|
1168
|
-
addServiceToDomain: addServiceToDomain(join12(
|
|
1221
|
+
addServiceToDomain: addServiceToDomain(join12(path3, "domains")),
|
|
1169
1222
|
/**
|
|
1170
1223
|
* ================================
|
|
1171
1224
|
* Teams
|
|
@@ -1178,25 +1231,25 @@ var index_default = (path2) => {
|
|
|
1178
1231
|
* @param options - Optional options to write the team
|
|
1179
1232
|
*
|
|
1180
1233
|
*/
|
|
1181
|
-
writeTeam: writeTeam(join12(
|
|
1234
|
+
writeTeam: writeTeam(join12(path3, "teams")),
|
|
1182
1235
|
/**
|
|
1183
1236
|
* Returns a team from EventCatalog
|
|
1184
1237
|
* @param id - The id of the team to retrieve
|
|
1185
1238
|
* @returns Team|Undefined
|
|
1186
1239
|
*/
|
|
1187
|
-
getTeam: getTeam(join12(
|
|
1240
|
+
getTeam: getTeam(join12(path3, "teams")),
|
|
1188
1241
|
/**
|
|
1189
1242
|
* Returns all teams from EventCatalog
|
|
1190
1243
|
* @returns Team[]|Undefined
|
|
1191
1244
|
*/
|
|
1192
|
-
getTeams: getTeams(join12(
|
|
1245
|
+
getTeams: getTeams(join12(path3)),
|
|
1193
1246
|
/**
|
|
1194
1247
|
* Remove a team by the team id
|
|
1195
1248
|
*
|
|
1196
1249
|
* @param id - The id of the team you want to remove
|
|
1197
1250
|
*
|
|
1198
1251
|
*/
|
|
1199
|
-
rmTeamById: rmTeamById(join12(
|
|
1252
|
+
rmTeamById: rmTeamById(join12(path3, "teams")),
|
|
1200
1253
|
/**
|
|
1201
1254
|
* ================================
|
|
1202
1255
|
* Users
|
|
@@ -1209,25 +1262,25 @@ var index_default = (path2) => {
|
|
|
1209
1262
|
* @param options - Optional options to write the user
|
|
1210
1263
|
*
|
|
1211
1264
|
*/
|
|
1212
|
-
writeUser: writeUser(join12(
|
|
1265
|
+
writeUser: writeUser(join12(path3, "users")),
|
|
1213
1266
|
/**
|
|
1214
1267
|
* Returns a user from EventCatalog
|
|
1215
1268
|
* @param id - The id of the user to retrieve
|
|
1216
1269
|
* @returns User|Undefined
|
|
1217
1270
|
*/
|
|
1218
|
-
getUser: getUser(join12(
|
|
1271
|
+
getUser: getUser(join12(path3, "users")),
|
|
1219
1272
|
/**
|
|
1220
1273
|
* Returns all user from EventCatalog
|
|
1221
1274
|
* @returns User[]|Undefined
|
|
1222
1275
|
*/
|
|
1223
|
-
getUsers: getUsers(join12(
|
|
1276
|
+
getUsers: getUsers(join12(path3)),
|
|
1224
1277
|
/**
|
|
1225
1278
|
* Remove a user by the user id
|
|
1226
1279
|
*
|
|
1227
1280
|
* @param id - The id of the user you want to remove
|
|
1228
1281
|
*
|
|
1229
1282
|
*/
|
|
1230
|
-
rmUserById: rmUserById(join12(
|
|
1283
|
+
rmUserById: rmUserById(join12(path3, "users")),
|
|
1231
1284
|
/**
|
|
1232
1285
|
* ================================
|
|
1233
1286
|
* Custom Docs
|
|
@@ -1238,26 +1291,26 @@ var index_default = (path2) => {
|
|
|
1238
1291
|
* @param path - The path to the custom doc to retrieve
|
|
1239
1292
|
* @returns CustomDoc|Undefined
|
|
1240
1293
|
*/
|
|
1241
|
-
getCustomDoc: getCustomDoc(join12(
|
|
1294
|
+
getCustomDoc: getCustomDoc(join12(path3, "docs")),
|
|
1242
1295
|
/**
|
|
1243
1296
|
* Returns all custom docs from EventCatalog
|
|
1244
1297
|
* @param options - Optional options to get custom docs from a specific path
|
|
1245
1298
|
* @returns CustomDoc[]|Undefined
|
|
1246
1299
|
*/
|
|
1247
|
-
getCustomDocs: getCustomDocs(join12(
|
|
1300
|
+
getCustomDocs: getCustomDocs(join12(path3, "docs")),
|
|
1248
1301
|
/**
|
|
1249
1302
|
* Writes a custom doc to EventCatalog
|
|
1250
1303
|
* @param customDoc - The custom doc to write
|
|
1251
1304
|
* @param options - Optional options to write the custom doc
|
|
1252
1305
|
*
|
|
1253
1306
|
*/
|
|
1254
|
-
writeCustomDoc: writeCustomDoc(join12(
|
|
1307
|
+
writeCustomDoc: writeCustomDoc(join12(path3, "docs")),
|
|
1255
1308
|
/**
|
|
1256
1309
|
* Removes a custom doc from EventCatalog
|
|
1257
1310
|
* @param path - The path to the custom doc to remove
|
|
1258
1311
|
*
|
|
1259
1312
|
*/
|
|
1260
|
-
rmCustomDoc: rmCustomDoc(join12(
|
|
1313
|
+
rmCustomDoc: rmCustomDoc(join12(path3, "docs"))
|
|
1261
1314
|
};
|
|
1262
1315
|
};
|
|
1263
1316
|
export {
|