@eventcatalog/sdk 2.14.0 → 2.14.1
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/index.d.mts +46 -11
- package/dist/index.d.ts +46 -11
- package/dist/index.js +152 -47
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +152 -47
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -27,10 +27,30 @@ function serializeBaseFields(resource, indent = " ") {
|
|
|
27
27
|
}
|
|
28
28
|
return lines.join("\n");
|
|
29
29
|
}
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
function buildMessageTypeIndex(catalogDir) {
|
|
31
|
+
const index = /* @__PURE__ */ new Map();
|
|
32
|
+
const types = ["events", "commands", "queries"];
|
|
33
|
+
const typeMap = { events: "event", commands: "command", queries: "query" };
|
|
34
|
+
for (const type of types) {
|
|
35
|
+
const matches = globSync(`**/${type}/*/index.{md,mdx}`, { cwd: catalogDir });
|
|
36
|
+
for (const match of matches) {
|
|
37
|
+
const parts = match.replace(/\\/g, "/").split("/");
|
|
38
|
+
const typeIdx = parts.lastIndexOf(type);
|
|
39
|
+
if (typeIdx !== -1 && typeIdx + 1 < parts.length) {
|
|
40
|
+
const id = parts[typeIdx + 1];
|
|
41
|
+
if (!index.has(id)) index.set(id, typeMap[type]);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return index;
|
|
46
|
+
}
|
|
47
|
+
function resolveMessageType(catalogDirOrIndex, id) {
|
|
48
|
+
if (typeof catalogDirOrIndex !== "string") {
|
|
49
|
+
return catalogDirOrIndex.get(id);
|
|
50
|
+
}
|
|
51
|
+
if (globSync(`**/events/${id}/index.{md,mdx}`, { cwd: catalogDirOrIndex }).length > 0) return "event";
|
|
52
|
+
if (globSync(`**/commands/${id}/index.{md,mdx}`, { cwd: catalogDirOrIndex }).length > 0) return "command";
|
|
53
|
+
if (globSync(`**/queries/${id}/index.{md,mdx}`, { cwd: catalogDirOrIndex }).length > 0) return "query";
|
|
34
54
|
return void 0;
|
|
35
55
|
}
|
|
36
56
|
function serializeChannelRef(channel) {
|
|
@@ -38,10 +58,10 @@ function serializeChannelRef(channel) {
|
|
|
38
58
|
if (channel.version) ref += `@${channel.version}`;
|
|
39
59
|
return ref;
|
|
40
60
|
}
|
|
41
|
-
function serializeMessagePointers(items, direction,
|
|
61
|
+
function serializeMessagePointers(items, direction, catalogDirOrIndex, indent = " ") {
|
|
42
62
|
const lines = [];
|
|
43
63
|
for (const item of items) {
|
|
44
|
-
const msgType = resolveMessageType(
|
|
64
|
+
const msgType = resolveMessageType(catalogDirOrIndex, item.id);
|
|
45
65
|
if (!msgType) continue;
|
|
46
66
|
let ref = `${item.id}`;
|
|
47
67
|
if (item.version) ref += `@${item.version}`;
|
|
@@ -73,6 +93,7 @@ ${body}
|
|
|
73
93
|
// src/dsl/service.ts
|
|
74
94
|
async function serviceToDSL(resource, options, getMessageFn) {
|
|
75
95
|
const { catalogDir, hydrate = false, _seen = /* @__PURE__ */ new Set() } = options;
|
|
96
|
+
const msgIndex = options._msgIndex || buildMessageTypeIndex(catalogDir);
|
|
76
97
|
const parts = [];
|
|
77
98
|
if (hydrate && getMessageFn) {
|
|
78
99
|
const allMessages = [...resource.sends || [], ...resource.receives || []];
|
|
@@ -80,7 +101,7 @@ async function serviceToDSL(resource, options, getMessageFn) {
|
|
|
80
101
|
const key = `${msg.id}@${msg.version || "latest"}`;
|
|
81
102
|
if (_seen.has(key)) continue;
|
|
82
103
|
_seen.add(key);
|
|
83
|
-
const msgType = resolveMessageType(
|
|
104
|
+
const msgType = resolveMessageType(msgIndex, msg.id);
|
|
84
105
|
if (!msgType) continue;
|
|
85
106
|
const msgResource = await getMessageFn(msg.id, msg.version);
|
|
86
107
|
if (msgResource) {
|
|
@@ -92,11 +113,11 @@ async function serviceToDSL(resource, options, getMessageFn) {
|
|
|
92
113
|
const baseFields = serializeBaseFields(resource);
|
|
93
114
|
if (baseFields) lines.push(baseFields);
|
|
94
115
|
if (resource.sends && resource.sends.length > 0) {
|
|
95
|
-
const sendsStr = serializeMessagePointers(resource.sends, "sends",
|
|
116
|
+
const sendsStr = serializeMessagePointers(resource.sends, "sends", msgIndex);
|
|
96
117
|
if (sendsStr) lines.push(sendsStr);
|
|
97
118
|
}
|
|
98
119
|
if (resource.receives && resource.receives.length > 0) {
|
|
99
|
-
const recvStr = serializeMessagePointers(resource.receives, "receives",
|
|
120
|
+
const recvStr = serializeMessagePointers(resource.receives, "receives", msgIndex);
|
|
100
121
|
if (recvStr) lines.push(recvStr);
|
|
101
122
|
}
|
|
102
123
|
if (resource.writesTo && resource.writesTo.length > 0) {
|
|
@@ -209,6 +230,7 @@ async function hydrateChannelsFromMessages(messages, resolvers, seen, parts) {
|
|
|
209
230
|
}
|
|
210
231
|
async function buildDomainBody(resource, options, resolvers, keyword) {
|
|
211
232
|
const { catalogDir, hydrate = false, _seen = /* @__PURE__ */ new Set() } = options;
|
|
233
|
+
const msgIndex = options._msgIndex || buildMessageTypeIndex(catalogDir);
|
|
212
234
|
const topLevelParts = [];
|
|
213
235
|
if (hydrate && resolvers) {
|
|
214
236
|
if (resource.services && resource.services.length > 0 && resolvers.getService) {
|
|
@@ -221,7 +243,7 @@ async function buildDomainBody(resource, options, resolvers, keyword) {
|
|
|
221
243
|
await hydrateOwners(svc.owners, resolvers, _seen, topLevelParts);
|
|
222
244
|
const svcMessages = [...svc.sends || [], ...svc.receives || []];
|
|
223
245
|
await hydrateChannelsFromMessages(svcMessages, resolvers, _seen, topLevelParts);
|
|
224
|
-
const svcDsl = await serviceToDSL(svc, { catalogDir, hydrate: true, _seen }, resolvers.getMessage);
|
|
246
|
+
const svcDsl = await serviceToDSL(svc, { catalogDir, hydrate: true, _seen, _msgIndex: msgIndex }, resolvers.getMessage);
|
|
225
247
|
topLevelParts.push(svcDsl);
|
|
226
248
|
}
|
|
227
249
|
}
|
|
@@ -233,7 +255,7 @@ async function buildDomainBody(resource, options, resolvers, keyword) {
|
|
|
233
255
|
const key = `${msg.id}@${msg.version || "latest"}`;
|
|
234
256
|
if (_seen.has(key)) continue;
|
|
235
257
|
_seen.add(key);
|
|
236
|
-
const msgType = resolveMessageType(
|
|
258
|
+
const msgType = resolveMessageType(msgIndex, msg.id);
|
|
237
259
|
if (!msgType) continue;
|
|
238
260
|
const msgResource = await resolvers.getMessage(msg.id, msg.version);
|
|
239
261
|
if (msgResource) {
|
|
@@ -253,11 +275,11 @@ async function buildDomainBody(resource, options, resolvers, keyword) {
|
|
|
253
275
|
}
|
|
254
276
|
}
|
|
255
277
|
if (resource.sends && resource.sends.length > 0) {
|
|
256
|
-
const sendsStr = serializeMessagePointers(resource.sends, "sends",
|
|
278
|
+
const sendsStr = serializeMessagePointers(resource.sends, "sends", msgIndex);
|
|
257
279
|
if (sendsStr) lines.push(sendsStr);
|
|
258
280
|
}
|
|
259
281
|
if (resource.receives && resource.receives.length > 0) {
|
|
260
|
-
const recvStr = serializeMessagePointers(resource.receives, "receives",
|
|
282
|
+
const recvStr = serializeMessagePointers(resource.receives, "receives", msgIndex);
|
|
261
283
|
if (recvStr) lines.push(recvStr);
|
|
262
284
|
}
|
|
263
285
|
if (resource.domains && resource.domains.length > 0) {
|
|
@@ -269,7 +291,12 @@ async function buildDomainBody(resource, options, resolvers, keyword) {
|
|
|
269
291
|
const subDomain = await resolvers.getDomain(subRef.id, subRef.version);
|
|
270
292
|
if (subDomain) {
|
|
271
293
|
await hydrateOwners(subDomain.owners, resolvers, _seen, topLevelParts);
|
|
272
|
-
const sub = await buildDomainBody(
|
|
294
|
+
const sub = await buildDomainBody(
|
|
295
|
+
subDomain,
|
|
296
|
+
{ catalogDir, hydrate, _seen, _msgIndex: msgIndex },
|
|
297
|
+
resolvers,
|
|
298
|
+
"subdomain"
|
|
299
|
+
);
|
|
273
300
|
topLevelParts.push(...sub.topLevelParts);
|
|
274
301
|
const indented = sub.block.split("\n").map((line) => ` ${line}`).join("\n");
|
|
275
302
|
lines.push(indented);
|
|
@@ -291,15 +318,16 @@ ${body}
|
|
|
291
318
|
}
|
|
292
319
|
async function domainToDSL(resource, options, resolvers) {
|
|
293
320
|
const { catalogDir, hydrate = false, _seen = /* @__PURE__ */ new Set() } = options;
|
|
294
|
-
const
|
|
321
|
+
const msgIndex = options._msgIndex || buildMessageTypeIndex(catalogDir);
|
|
322
|
+
const result = await buildDomainBody(resource, { catalogDir, hydrate, _seen, _msgIndex: msgIndex }, resolvers, "domain");
|
|
295
323
|
const parts = [...result.topLevelParts, result.block];
|
|
296
324
|
return parts.join("\n\n");
|
|
297
325
|
}
|
|
298
326
|
|
|
299
327
|
// src/dsl/index.ts
|
|
300
|
-
function getMessage(resolvers,
|
|
328
|
+
function getMessage(resolvers, msgIndex) {
|
|
301
329
|
return async (id, version) => {
|
|
302
|
-
const msgType = resolveMessageType(
|
|
330
|
+
const msgType = resolveMessageType(msgIndex, id);
|
|
303
331
|
if (!msgType) return void 0;
|
|
304
332
|
switch (msgType) {
|
|
305
333
|
case "event":
|
|
@@ -348,6 +376,7 @@ var toDSL = (catalogDir, resolvers) => async (resource, options) => {
|
|
|
348
376
|
const resources = Array.isArray(resource) ? resource : [resource];
|
|
349
377
|
const seen = /* @__PURE__ */ new Set();
|
|
350
378
|
const parts = [];
|
|
379
|
+
const msgIndex = buildMessageTypeIndex(catalogDir);
|
|
351
380
|
for (const res of resources) {
|
|
352
381
|
const key = `${options.type}:${res.id}@${res.version || "latest"}`;
|
|
353
382
|
if (seen.has(key)) continue;
|
|
@@ -369,8 +398,8 @@ var toDSL = (catalogDir, resolvers) => async (resource, options) => {
|
|
|
369
398
|
parts.push(
|
|
370
399
|
await serviceToDSL(
|
|
371
400
|
res,
|
|
372
|
-
{ catalogDir, hydrate: options.hydrate, _seen: seen },
|
|
373
|
-
getMessage(resolvers,
|
|
401
|
+
{ catalogDir, hydrate: options.hydrate, _seen: seen, _msgIndex: msgIndex },
|
|
402
|
+
getMessage(resolvers, msgIndex)
|
|
374
403
|
)
|
|
375
404
|
);
|
|
376
405
|
break;
|
|
@@ -381,11 +410,11 @@ var toDSL = (catalogDir, resolvers) => async (resource, options) => {
|
|
|
381
410
|
parts.push(
|
|
382
411
|
await domainToDSL(
|
|
383
412
|
res,
|
|
384
|
-
{ catalogDir, hydrate: options.hydrate, _seen: seen },
|
|
413
|
+
{ catalogDir, hydrate: options.hydrate, _seen: seen, _msgIndex: msgIndex },
|
|
385
414
|
{
|
|
386
415
|
getService: resolvers.getService,
|
|
387
416
|
getDomain: resolvers.getDomain,
|
|
388
|
-
getMessage: getMessage(resolvers,
|
|
417
|
+
getMessage: getMessage(resolvers, msgIndex),
|
|
389
418
|
getChannel: resolvers.getChannel,
|
|
390
419
|
getTeam: resolvers.getTeam,
|
|
391
420
|
getUser: resolvers.getUser
|
|
@@ -409,39 +438,96 @@ import { copy } from "fs-extra";
|
|
|
409
438
|
import { join, dirname, normalize, resolve, relative } from "path";
|
|
410
439
|
import matter from "gray-matter";
|
|
411
440
|
import { satisfies, validRange } from "semver";
|
|
441
|
+
var _fileIndexCache = null;
|
|
442
|
+
var _fileIndexCatalogDir = null;
|
|
443
|
+
var _matterCache = null;
|
|
444
|
+
var _fileIndexMtimeMs = 0;
|
|
445
|
+
function buildFileCache(catalogDir) {
|
|
446
|
+
const files = globSync2("**/index.{md,mdx}", {
|
|
447
|
+
cwd: catalogDir,
|
|
448
|
+
ignore: ["node_modules/**"],
|
|
449
|
+
absolute: true,
|
|
450
|
+
nodir: true
|
|
451
|
+
}).map(normalize);
|
|
452
|
+
const index = /* @__PURE__ */ new Map();
|
|
453
|
+
const matterResults = /* @__PURE__ */ new Map();
|
|
454
|
+
for (const file of files) {
|
|
455
|
+
const content = fsSync.readFileSync(file, "utf-8");
|
|
456
|
+
const parsed = matter(content);
|
|
457
|
+
matterResults.set(file, parsed);
|
|
458
|
+
const id = parsed.data.id;
|
|
459
|
+
if (!id) continue;
|
|
460
|
+
const version = parsed.data.version || "";
|
|
461
|
+
const isVersioned = file.includes("versioned");
|
|
462
|
+
const entry = { path: file, id, version: String(version), isVersioned };
|
|
463
|
+
const existing = index.get(id);
|
|
464
|
+
if (existing) {
|
|
465
|
+
existing.push(entry);
|
|
466
|
+
} else {
|
|
467
|
+
index.set(id, [entry]);
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
_fileIndexCache = index;
|
|
471
|
+
_fileIndexCatalogDir = catalogDir;
|
|
472
|
+
_matterCache = matterResults;
|
|
473
|
+
try {
|
|
474
|
+
_fileIndexMtimeMs = fsSync.statSync(catalogDir).mtimeMs;
|
|
475
|
+
} catch {
|
|
476
|
+
_fileIndexMtimeMs = 0;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
function ensureFileCache(catalogDir) {
|
|
480
|
+
if (!_fileIndexCache || _fileIndexCatalogDir !== catalogDir) {
|
|
481
|
+
buildFileCache(catalogDir);
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
try {
|
|
485
|
+
const currentMtime = fsSync.statSync(catalogDir).mtimeMs;
|
|
486
|
+
if (currentMtime !== _fileIndexMtimeMs) {
|
|
487
|
+
buildFileCache(catalogDir);
|
|
488
|
+
}
|
|
489
|
+
} catch {
|
|
490
|
+
buildFileCache(catalogDir);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
function invalidateFileCache() {
|
|
494
|
+
_fileIndexCache = null;
|
|
495
|
+
_fileIndexCatalogDir = null;
|
|
496
|
+
_matterCache = null;
|
|
497
|
+
}
|
|
498
|
+
function cachedMatterRead(filePath) {
|
|
499
|
+
if (_matterCache) {
|
|
500
|
+
const cached = _matterCache.get(filePath);
|
|
501
|
+
if (cached) return cached;
|
|
502
|
+
}
|
|
503
|
+
return matter.read(filePath);
|
|
504
|
+
}
|
|
412
505
|
var versionExists = async (catalogDir, id, version) => {
|
|
413
|
-
|
|
414
|
-
const
|
|
415
|
-
|
|
506
|
+
ensureFileCache(catalogDir);
|
|
507
|
+
const entries = _fileIndexCache.get(id);
|
|
508
|
+
if (!entries) return false;
|
|
509
|
+
return entries.some((e) => e.version === version);
|
|
416
510
|
};
|
|
417
511
|
var findFileById = async (catalogDir, id, version) => {
|
|
418
|
-
|
|
419
|
-
const
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
});
|
|
428
|
-
if (version === "latest") {
|
|
429
|
-
return latestVersion;
|
|
430
|
-
}
|
|
431
|
-
const exactMatch = parsedFiles.find((c) => c.version === version);
|
|
432
|
-
if (exactMatch) {
|
|
433
|
-
return exactMatch.path;
|
|
434
|
-
}
|
|
512
|
+
ensureFileCache(catalogDir);
|
|
513
|
+
const entries = _fileIndexCache.get(id);
|
|
514
|
+
if (!entries || entries.length === 0) return void 0;
|
|
515
|
+
const latestEntry = entries.find((e) => !e.isVersioned);
|
|
516
|
+
if (!version || version === "latest") {
|
|
517
|
+
return latestEntry?.path;
|
|
518
|
+
}
|
|
519
|
+
const exactMatch = entries.find((e) => e.version === version);
|
|
520
|
+
if (exactMatch) return exactMatch.path;
|
|
435
521
|
const semverRange = validRange(version);
|
|
436
522
|
if (semverRange) {
|
|
437
|
-
const match =
|
|
523
|
+
const match = entries.find((e) => {
|
|
438
524
|
try {
|
|
439
|
-
return satisfies(
|
|
440
|
-
} catch
|
|
525
|
+
return satisfies(e.version, semverRange);
|
|
526
|
+
} catch {
|
|
441
527
|
return false;
|
|
442
528
|
}
|
|
443
529
|
});
|
|
444
|
-
return match
|
|
530
|
+
return match?.path;
|
|
445
531
|
}
|
|
446
532
|
return void 0;
|
|
447
533
|
};
|
|
@@ -557,6 +643,7 @@ var versionResource = async (catalogDir, id) => {
|
|
|
557
643
|
})
|
|
558
644
|
);
|
|
559
645
|
});
|
|
646
|
+
invalidateFileCache();
|
|
560
647
|
};
|
|
561
648
|
var writeResource = async (catalogDir, resource, options = {
|
|
562
649
|
path: "",
|
|
@@ -596,6 +683,7 @@ var writeResource = async (catalogDir, resource, options = {
|
|
|
596
683
|
}
|
|
597
684
|
const document = matter2.stringify(markdown.trim(), frontmatter);
|
|
598
685
|
fsSync2.writeFileSync(lockPath, document);
|
|
686
|
+
invalidateFileCache();
|
|
599
687
|
} finally {
|
|
600
688
|
await unlock(lockPath).catch(() => {
|
|
601
689
|
});
|
|
@@ -605,7 +693,7 @@ var getResource = async (catalogDir, id, version, options, filePath) => {
|
|
|
605
693
|
const attachSchema = options?.attachSchema || false;
|
|
606
694
|
const file = filePath || (id ? await findFileById(catalogDir, id, version) : void 0);
|
|
607
695
|
if (!file || !fsSync2.existsSync(file)) return;
|
|
608
|
-
const { data, content } =
|
|
696
|
+
const { data, content } = cachedMatterRead(file);
|
|
609
697
|
if (attachSchema && data?.schemaPath) {
|
|
610
698
|
const resourceDirectory = dirname2(file);
|
|
611
699
|
const pathToSchema = join2(resourceDirectory, data.schemaPath);
|
|
@@ -656,7 +744,7 @@ var getResources = async (catalogDir, {
|
|
|
656
744
|
const files = await getFiles(filePattern, [ignoreList, ...ignore]);
|
|
657
745
|
if (files.length === 0) return;
|
|
658
746
|
return files.map((file) => {
|
|
659
|
-
const { data, content } =
|
|
747
|
+
const { data, content } = cachedMatterRead(file);
|
|
660
748
|
if (attachSchema && data?.schemaPath) {
|
|
661
749
|
const resourceDirectory = dirname2(file);
|
|
662
750
|
const pathToSchema = join2(resourceDirectory, data.schemaPath);
|
|
@@ -697,6 +785,7 @@ var rmResourceById = async (catalogDir, id, version, options) => {
|
|
|
697
785
|
})
|
|
698
786
|
);
|
|
699
787
|
}
|
|
788
|
+
invalidateFileCache();
|
|
700
789
|
};
|
|
701
790
|
var waitForFileRemoval = async (path6, maxRetries = 50, delay = 10) => {
|
|
702
791
|
for (let i = 0; i < maxRetries; i++) {
|
|
@@ -762,6 +851,7 @@ var writeEventToService = (directory) => async (event, service, options = { path
|
|
|
762
851
|
};
|
|
763
852
|
var rmEvent = (directory) => async (path6) => {
|
|
764
853
|
await fs2.rm(join3(directory, path6), { recursive: true });
|
|
854
|
+
invalidateFileCache();
|
|
765
855
|
};
|
|
766
856
|
var rmEventById = (directory) => async (id, version, persistFiles) => {
|
|
767
857
|
await rmResourceById(directory, id, version, { type: "event", persistFiles });
|
|
@@ -798,6 +888,7 @@ var writeCommandToService = (directory) => async (command, service, options = {
|
|
|
798
888
|
};
|
|
799
889
|
var rmCommand = (directory) => async (path6) => {
|
|
800
890
|
await fs3.rm(join4(directory, path6), { recursive: true });
|
|
891
|
+
invalidateFileCache();
|
|
801
892
|
};
|
|
802
893
|
var rmCommandById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "command", persistFiles });
|
|
803
894
|
var versionCommand = (directory) => async (id) => versionResource(directory, id);
|
|
@@ -832,6 +923,7 @@ var writeQueryToService = (directory) => async (query, service, options = { path
|
|
|
832
923
|
};
|
|
833
924
|
var rmQuery = (directory) => async (path6) => {
|
|
834
925
|
await fs4.rm(join5(directory, path6), { recursive: true });
|
|
926
|
+
invalidateFileCache();
|
|
835
927
|
};
|
|
836
928
|
var rmQueryById = (directory) => async (id, version, persistFiles) => {
|
|
837
929
|
await rmResourceById(directory, id, version, { type: "query", persistFiles });
|
|
@@ -897,6 +989,7 @@ var writeServiceToDomain = (directory) => async (service, domain, options = { pa
|
|
|
897
989
|
var versionService = (directory) => async (id) => versionResource(directory, id);
|
|
898
990
|
var rmService = (directory) => async (path6) => {
|
|
899
991
|
await fs5.rm(join6(directory, path6), { recursive: true });
|
|
992
|
+
invalidateFileCache();
|
|
900
993
|
};
|
|
901
994
|
var rmServiceById = (directory) => async (id, version, persistFiles) => {
|
|
902
995
|
await rmResourceById(directory, id, version, { type: "service", persistFiles });
|
|
@@ -1073,6 +1166,7 @@ var writeDomain = (directory) => async (domain, options = {
|
|
|
1073
1166
|
var versionDomain = (directory) => async (id) => versionResource(directory, id);
|
|
1074
1167
|
var rmDomain = (directory) => async (path6) => {
|
|
1075
1168
|
await fs6.rm(join7(directory, path6), { recursive: true });
|
|
1169
|
+
invalidateFileCache();
|
|
1076
1170
|
};
|
|
1077
1171
|
var rmDomainById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "domain", persistFiles });
|
|
1078
1172
|
var addFileToDomain = (directory) => async (id, file, version) => addFileToResource(directory, id, file, version);
|
|
@@ -1204,6 +1298,7 @@ var getChannels = (directory) => async (options) => getResources(directory, { ty
|
|
|
1204
1298
|
var writeChannel = (directory) => async (channel, options = { path: "" }) => writeResource(directory, { ...channel }, { ...options, type: "channel" });
|
|
1205
1299
|
var rmChannel = (directory) => async (path6) => {
|
|
1206
1300
|
await fs7.rm(join8(directory, path6), { recursive: true });
|
|
1301
|
+
invalidateFileCache();
|
|
1207
1302
|
};
|
|
1208
1303
|
var rmChannelById = (directory) => async (id, version, persistFiles) => rmResourceById(directory, id, version, { type: "channel", persistFiles });
|
|
1209
1304
|
var versionChannel = (directory) => async (id) => versionResource(directory, id);
|
|
@@ -1376,10 +1471,12 @@ var writeCustomDoc = (directory) => async (customDoc, options = { path: "" }) =>
|
|
|
1376
1471
|
fsSync4.mkdirSync(path3.dirname(fullPath), { recursive: true });
|
|
1377
1472
|
const document = matter5.stringify(customDoc.markdown.trim(), rest);
|
|
1378
1473
|
fsSync4.writeFileSync(fullPath, document);
|
|
1474
|
+
invalidateFileCache();
|
|
1379
1475
|
};
|
|
1380
1476
|
var rmCustomDoc = (directory) => async (filePath) => {
|
|
1381
1477
|
const withExtension = filePath.endsWith(".mdx") ? filePath : `${filePath}.mdx`;
|
|
1382
1478
|
await fs8.rm(join10(directory, withExtension), { recursive: true });
|
|
1479
|
+
invalidateFileCache();
|
|
1383
1480
|
};
|
|
1384
1481
|
|
|
1385
1482
|
// src/teams.ts
|
|
@@ -1431,9 +1528,11 @@ var writeUser = (catalogDir) => async (user, options = {}) => {
|
|
|
1431
1528
|
const document = matter6.stringify(markdown, frontmatter);
|
|
1432
1529
|
fsSync5.mkdirSync(join11(catalogDir, ""), { recursive: true });
|
|
1433
1530
|
fsSync5.writeFileSync(join11(catalogDir, "", `${resource.id}.mdx`), document);
|
|
1531
|
+
invalidateFileCache();
|
|
1434
1532
|
};
|
|
1435
1533
|
var rmUserById = (catalogDir) => async (id) => {
|
|
1436
1534
|
fsSync5.rmSync(join11(catalogDir, `${id}.mdx`), { recursive: true });
|
|
1535
|
+
invalidateFileCache();
|
|
1437
1536
|
};
|
|
1438
1537
|
|
|
1439
1538
|
// src/teams.ts
|
|
@@ -1473,9 +1572,11 @@ var writeTeam = (catalogDir) => async (team, options = {}) => {
|
|
|
1473
1572
|
const document = matter7.stringify(markdown, frontmatter);
|
|
1474
1573
|
fsSync6.mkdirSync(join12(catalogDir, ""), { recursive: true });
|
|
1475
1574
|
fsSync6.writeFileSync(join12(catalogDir, "", `${resource.id}.mdx`), document);
|
|
1575
|
+
invalidateFileCache();
|
|
1476
1576
|
};
|
|
1477
1577
|
var rmTeamById = (catalogDir) => async (id) => {
|
|
1478
1578
|
await fs9.rm(join12(catalogDir, `${id}.mdx`), { recursive: true });
|
|
1579
|
+
invalidateFileCache();
|
|
1479
1580
|
};
|
|
1480
1581
|
var getOwnersForResource = (catalogDir) => async (id, version) => {
|
|
1481
1582
|
const resource = await getResource(catalogDir, id, version);
|
|
@@ -1605,6 +1706,7 @@ var writeEntity = (directory) => async (entity, options = {
|
|
|
1605
1706
|
}) => writeResource(directory, { ...entity }, { ...options, type: "entity" });
|
|
1606
1707
|
var rmEntity = (directory) => async (path6) => {
|
|
1607
1708
|
await fs11.rm(join14(directory, path6), { recursive: true });
|
|
1709
|
+
invalidateFileCache();
|
|
1608
1710
|
};
|
|
1609
1711
|
var rmEntityById = (directory) => async (id, version, persistFiles) => {
|
|
1610
1712
|
await rmResourceById(directory, id, version, { type: "entity", persistFiles });
|
|
@@ -1628,6 +1730,7 @@ var writeContainer = (directory) => async (data, options = {
|
|
|
1628
1730
|
var versionContainer = (directory) => async (id) => versionResource(directory, id);
|
|
1629
1731
|
var rmContainer = (directory) => async (path6) => {
|
|
1630
1732
|
await fs12.rm(join15(directory, path6), { recursive: true });
|
|
1733
|
+
invalidateFileCache();
|
|
1631
1734
|
};
|
|
1632
1735
|
var rmContainerById = (directory) => async (id, version, persistFiles) => {
|
|
1633
1736
|
await rmResourceById(directory, id, version, { type: "container", persistFiles });
|
|
@@ -1675,6 +1778,7 @@ var writeDataProductToDomain = (directory) => async (dataProduct, domain, option
|
|
|
1675
1778
|
};
|
|
1676
1779
|
var rmDataProduct = (directory) => async (path6) => {
|
|
1677
1780
|
await fs13.rm(join16(directory, path6), { recursive: true });
|
|
1781
|
+
invalidateFileCache();
|
|
1678
1782
|
};
|
|
1679
1783
|
var rmDataProductById = (directory) => async (id, version, persistFiles) => {
|
|
1680
1784
|
await rmResourceById(directory, id, version, { type: "data-product", persistFiles });
|
|
@@ -1698,6 +1802,7 @@ var writeDiagram = (directory) => async (diagram, options = {
|
|
|
1698
1802
|
}) => writeResource(directory, { ...diagram }, { ...options, type: "diagram" });
|
|
1699
1803
|
var rmDiagram = (directory) => async (path6) => {
|
|
1700
1804
|
await fs14.rm(join17(directory, path6), { recursive: true });
|
|
1805
|
+
invalidateFileCache();
|
|
1701
1806
|
};
|
|
1702
1807
|
var rmDiagramById = (directory) => async (id, version, persistFiles) => {
|
|
1703
1808
|
await rmResourceById(directory, id, version, { type: "diagram", persistFiles });
|