@eventcatalog/sdk 2.18.1 → 2.18.3
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/LICENSE +28 -0
- package/dist/index.d.mts +83 -93
- package/dist/index.d.ts +83 -93
- package/dist/index.js +58 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +58 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1438,8 +1438,11 @@ var resolveDomainWriteDirectory = async (directory, id, version) => {
|
|
|
1438
1438
|
if (!existingResource) return directory;
|
|
1439
1439
|
const normalizedPath = existingResource.replace(/\\/g, "/");
|
|
1440
1440
|
const lastDomainsIndex = normalizedPath.lastIndexOf("/domains/");
|
|
1441
|
-
|
|
1442
|
-
|
|
1441
|
+
const lastSubdomainsIndex = normalizedPath.lastIndexOf("/subdomains/");
|
|
1442
|
+
const lastIndex = Math.max(lastDomainsIndex, lastSubdomainsIndex);
|
|
1443
|
+
if (lastIndex === -1) return directory;
|
|
1444
|
+
const segment = lastSubdomainsIndex > lastDomainsIndex ? "/subdomains" : "/domains";
|
|
1445
|
+
return existingResource.substring(0, lastIndex + segment.length);
|
|
1443
1446
|
};
|
|
1444
1447
|
var getDomain = (directory) => async (id, version) => getResource(directory, id, version, { type: "domain" });
|
|
1445
1448
|
var getDomains = (directory) => async (options) => getResources(directory, {
|
|
@@ -1967,7 +1970,19 @@ var getEventCatalogConfigurationFile = (directory) => async () => {
|
|
|
1967
1970
|
}
|
|
1968
1971
|
};
|
|
1969
1972
|
var dumpCatalog = (directory) => async (options) => {
|
|
1970
|
-
const {
|
|
1973
|
+
const {
|
|
1974
|
+
getDomains: getDomains2,
|
|
1975
|
+
getServices: getServices2,
|
|
1976
|
+
getEvents: getEvents2,
|
|
1977
|
+
getQueries: getQueries2,
|
|
1978
|
+
getCommands: getCommands2,
|
|
1979
|
+
getChannels: getChannels2,
|
|
1980
|
+
getTeams: getTeams2,
|
|
1981
|
+
getUsers: getUsers3,
|
|
1982
|
+
getEntities: getEntities2,
|
|
1983
|
+
getDataStores: getDataStores2,
|
|
1984
|
+
getFlows: getFlows2
|
|
1985
|
+
} = src_default(directory);
|
|
1971
1986
|
const { includeMarkdown = true } = options || {};
|
|
1972
1987
|
const domains = await getDomains2();
|
|
1973
1988
|
const services = await getServices2();
|
|
@@ -1977,6 +1992,9 @@ var dumpCatalog = (directory) => async (options) => {
|
|
|
1977
1992
|
const teams = await getTeams2();
|
|
1978
1993
|
const users = await getUsers3();
|
|
1979
1994
|
const channels = await getChannels2();
|
|
1995
|
+
const entities = await getEntities2();
|
|
1996
|
+
const containers = await getDataStores2();
|
|
1997
|
+
const flows = await getFlows2();
|
|
1980
1998
|
const [
|
|
1981
1999
|
hydratedDomains,
|
|
1982
2000
|
hydratedServices,
|
|
@@ -1985,7 +2003,10 @@ var dumpCatalog = (directory) => async (options) => {
|
|
|
1985
2003
|
hydratedCommands,
|
|
1986
2004
|
hydratedTeams,
|
|
1987
2005
|
hydratedUsers,
|
|
1988
|
-
hydratedChannels
|
|
2006
|
+
hydratedChannels,
|
|
2007
|
+
hydratedEntities,
|
|
2008
|
+
hydratedContainers,
|
|
2009
|
+
hydratedFlows
|
|
1989
2010
|
] = await Promise.all([
|
|
1990
2011
|
hydrateResource(directory, domains),
|
|
1991
2012
|
hydrateResource(directory, services),
|
|
@@ -1994,7 +2015,10 @@ var dumpCatalog = (directory) => async (options) => {
|
|
|
1994
2015
|
hydrateResource(directory, commands),
|
|
1995
2016
|
hydrateResource(directory, teams),
|
|
1996
2017
|
hydrateResource(directory, users),
|
|
1997
|
-
hydrateResource(directory, channels)
|
|
2018
|
+
hydrateResource(directory, channels),
|
|
2019
|
+
hydrateResource(directory, entities),
|
|
2020
|
+
hydrateResource(directory, containers),
|
|
2021
|
+
hydrateResource(directory, flows)
|
|
1998
2022
|
]);
|
|
1999
2023
|
return {
|
|
2000
2024
|
version: DUMP_VERSION,
|
|
@@ -2010,7 +2034,10 @@ var dumpCatalog = (directory) => async (options) => {
|
|
|
2010
2034
|
},
|
|
2011
2035
|
teams: filterCollection(hydratedTeams, { includeMarkdown }),
|
|
2012
2036
|
users: filterCollection(hydratedUsers, { includeMarkdown }),
|
|
2013
|
-
channels: filterCollection(hydratedChannels, { includeMarkdown })
|
|
2037
|
+
channels: filterCollection(hydratedChannels, { includeMarkdown }),
|
|
2038
|
+
entities: filterCollection(hydratedEntities, { includeMarkdown }),
|
|
2039
|
+
containers: filterCollection(hydratedContainers, { includeMarkdown }),
|
|
2040
|
+
flows: filterCollection(hydratedFlows, { includeMarkdown })
|
|
2014
2041
|
}
|
|
2015
2042
|
};
|
|
2016
2043
|
};
|
|
@@ -2455,6 +2482,10 @@ var entityHasVersion = (directory) => async (id, version) => {
|
|
|
2455
2482
|
return !!file;
|
|
2456
2483
|
};
|
|
2457
2484
|
|
|
2485
|
+
// src/flows.ts
|
|
2486
|
+
var getFlow = (directory) => async (id, version) => getResource(directory, id, version, { type: "flow" });
|
|
2487
|
+
var getFlows = (directory) => async (options) => getResources(directory, { type: "flows", latestOnly: options?.latestOnly });
|
|
2488
|
+
|
|
2458
2489
|
// src/containers.ts
|
|
2459
2490
|
import fs14 from "fs/promises";
|
|
2460
2491
|
import { join as join15 } from "path";
|
|
@@ -3509,6 +3540,27 @@ var src_default = (path8) => {
|
|
|
3509
3540
|
* @returns
|
|
3510
3541
|
*/
|
|
3511
3542
|
entityHasVersion: entityHasVersion(join18(path8)),
|
|
3543
|
+
/**
|
|
3544
|
+
* ================================
|
|
3545
|
+
* Flows
|
|
3546
|
+
* ================================
|
|
3547
|
+
*/
|
|
3548
|
+
/**
|
|
3549
|
+
* Returns a flow from EventCatalog
|
|
3550
|
+
*
|
|
3551
|
+
* @param id - The id of the flow to retrieve
|
|
3552
|
+
* @param version - Optional version of the flow
|
|
3553
|
+
* @returns Flow
|
|
3554
|
+
*/
|
|
3555
|
+
getFlow: getFlow(join18(path8)),
|
|
3556
|
+
/**
|
|
3557
|
+
* Returns all flows from EventCatalog
|
|
3558
|
+
*
|
|
3559
|
+
* @param options - optional options to get flows
|
|
3560
|
+
* @param latestOnly - optional boolean, set to true to get only latest versions
|
|
3561
|
+
* @returns Flow[]|Undefined
|
|
3562
|
+
*/
|
|
3563
|
+
getFlows: getFlows(join18(path8)),
|
|
3512
3564
|
/**
|
|
3513
3565
|
* ================================
|
|
3514
3566
|
* Data Stores
|