@eventcatalog/sdk 2.28.1 → 2.29.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 +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +27 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1000,7 +1000,7 @@ var getResources = async (catalogDir, {
|
|
|
1000
1000
|
}) => {
|
|
1001
1001
|
const ignoreList = latestOnly ? `**/versioned/**` : "";
|
|
1002
1002
|
const filePattern = pattern || `${catalogDir}/**/${type}/**/index.{md,mdx}`;
|
|
1003
|
-
const files = await getFiles(filePattern, [ignoreList, ...ignore2]);
|
|
1003
|
+
const files = await getFiles(filePattern, ["**/examples/**", ignoreList, ...ignore2]);
|
|
1004
1004
|
if (files.length === 0) return;
|
|
1005
1005
|
return files.map((file) => {
|
|
1006
1006
|
const { data, content } = cachedMatterRead(file);
|
|
@@ -3871,18 +3871,19 @@ var normalizeAssets = async (directory, hashContent, ignoreRules) => {
|
|
|
3871
3871
|
);
|
|
3872
3872
|
return assets.length === 0 ? void 0 : assets;
|
|
3873
3873
|
};
|
|
3874
|
-
var normalizeSchemas = async (resource, resourcePath, hashContent) => {
|
|
3874
|
+
var normalizeSchemas = async (resource, resourcePath, hashContent, includeSchemaContent) => {
|
|
3875
3875
|
const schemas = resource.schemas ?? (resource.schemaPath ? [{ path: resource.schemaPath, default: true }] : void 0);
|
|
3876
3876
|
if (schemas === void 0) return void 0;
|
|
3877
3877
|
return Promise.all(
|
|
3878
3878
|
schemas.map(async ({ file, ...schema }) => {
|
|
3879
3879
|
const schemaPath = file ?? schema.path;
|
|
3880
|
+
const readSchema = schemaPath && (hashContent || includeSchemaContent);
|
|
3881
|
+
const bytes = readSchema ? await fs21.readFile(path8.join(path8.dirname(resourcePath), schemaPath)) : void 0;
|
|
3880
3882
|
return {
|
|
3881
3883
|
...schema,
|
|
3882
3884
|
...schemaPath === void 0 ? {} : { path: schemaPath },
|
|
3883
|
-
...
|
|
3884
|
-
|
|
3885
|
-
} : {}
|
|
3885
|
+
...bytes && hashContent ? { hash: `sha256:${createHash2("sha256").update(bytes).digest("hex")}` } : {},
|
|
3886
|
+
...bytes && includeSchemaContent ? { content: bytes.toString("utf8") } : {}
|
|
3886
3887
|
};
|
|
3887
3888
|
})
|
|
3888
3889
|
);
|
|
@@ -3929,9 +3930,9 @@ var normalizeSidecars = async (directory, resourcePath, resourceDirectories, rep
|
|
|
3929
3930
|
);
|
|
3930
3931
|
return sidecars.length === 0 ? void 0 : sidecars;
|
|
3931
3932
|
};
|
|
3932
|
-
var toIndexResource = async (directory, type, resource, hashContent, sourcePath, resourceDirectories, ignoreRules) => {
|
|
3933
|
+
var toIndexResource = async (directory, type, resource, hashContent, includeSchemaContent, sourcePath, resourceDirectories, ignoreRules) => {
|
|
3933
3934
|
const { id, version, name } = resource;
|
|
3934
|
-
const schemas = await normalizeSchemas(resource, sourcePath, hashContent);
|
|
3935
|
+
const schemas = await normalizeSchemas(resource, sourcePath, hashContent, includeSchemaContent);
|
|
3935
3936
|
const specifications = await normalizeSpecifications(resource, sourcePath, hashContent);
|
|
3936
3937
|
const representedPaths = new Set(
|
|
3937
3938
|
[
|
|
@@ -3998,7 +3999,13 @@ var toIndexResource = async (directory, type, resource, hashContent, sourcePath,
|
|
|
3998
3999
|
...resource.members === void 0 ? {} : { members: resource.members }
|
|
3999
4000
|
};
|
|
4000
4001
|
};
|
|
4001
|
-
var buildIndex = (directory) => async ({
|
|
4002
|
+
var buildIndex = (directory) => async ({
|
|
4003
|
+
source,
|
|
4004
|
+
commit,
|
|
4005
|
+
hashContent = true,
|
|
4006
|
+
includeFederated = true,
|
|
4007
|
+
includeSchemaContent = false
|
|
4008
|
+
}) => {
|
|
4002
4009
|
const ignoreRules = await loadIgnoreRules(directory);
|
|
4003
4010
|
const [
|
|
4004
4011
|
domains,
|
|
@@ -4079,7 +4086,16 @@ var buildIndex = (directory) => async ({ source, commit, hashContent = true, inc
|
|
|
4079
4086
|
);
|
|
4080
4087
|
const resources = await Promise.all(
|
|
4081
4088
|
locatedResources.map(
|
|
4082
|
-
({ type, resource, sourcePath }) => toIndexResource(
|
|
4089
|
+
({ type, resource, sourcePath }) => toIndexResource(
|
|
4090
|
+
directory,
|
|
4091
|
+
type,
|
|
4092
|
+
resource,
|
|
4093
|
+
hashContent,
|
|
4094
|
+
includeSchemaContent,
|
|
4095
|
+
sourcePath,
|
|
4096
|
+
resourceDirectories,
|
|
4097
|
+
ignoreRules
|
|
4098
|
+
)
|
|
4083
4099
|
)
|
|
4084
4100
|
);
|
|
4085
4101
|
const assets = await normalizeAssets(directory, hashContent, ignoreRules);
|
|
@@ -4598,7 +4614,8 @@ var IndexSchemaPointerSchema = z.object({
|
|
|
4598
4614
|
format: z.string().optional(),
|
|
4599
4615
|
environments: z.array(z.string()).optional(),
|
|
4600
4616
|
default: z.boolean().optional(),
|
|
4601
|
-
hash: contentHash.optional()
|
|
4617
|
+
hash: contentHash.optional(),
|
|
4618
|
+
content: z.string().optional()
|
|
4602
4619
|
}).strict();
|
|
4603
4620
|
var IndexSpecificationSchema = z.object({
|
|
4604
4621
|
type: z.enum(["openapi", "asyncapi", "graphql"]),
|