@eventcatalog/sdk 2.28.0 → 2.29.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/index.d.mts CHANGED
@@ -439,10 +439,12 @@ interface UbiquitousLanguage {
439
439
  summary?: string;
440
440
  description?: string;
441
441
  icon?: string;
442
+ editUrl?: string;
442
443
  }
443
444
 
444
445
  interface UbiquitousLanguageDictionary {
445
446
  dictionary: UbiquitousLanguage[];
447
+ editUrl?: string;
446
448
  }
447
449
 
448
450
  interface DetailPanelProperty {
@@ -663,6 +665,8 @@ interface ToDSLOptions {
663
665
  type IndexResourceType = 'adr' | 'agent' | 'channel' | 'command' | 'container' | 'data-product' | 'diagram' | 'domain' | 'entity' | 'event' | 'flow' | 'query' | 'service' | 'system' | 'team' | 'user';
664
666
  type IndexSchema = Omit<SchemaPointer, 'file'> & {
665
667
  hash?: string;
668
+ /** Raw schema file text. Only present when the index was built with `includeSchemaContent`. */
669
+ content?: string;
666
670
  };
667
671
  type IndexSpecification = Specification & {
668
672
  hash?: string;
@@ -1418,6 +1422,7 @@ declare const FederationIndexSchema: z.ZodObject<{
1418
1422
  environments: z.ZodOptional<z.ZodArray<z.ZodString>>;
1419
1423
  default: z.ZodOptional<z.ZodBoolean>;
1420
1424
  hash: z.ZodOptional<z.ZodString>;
1425
+ content: z.ZodOptional<z.ZodString>;
1421
1426
  }, z.core.$strict>>>;
1422
1427
  specifications: z.ZodOptional<z.ZodArray<z.ZodObject<{
1423
1428
  type: z.ZodEnum<{
@@ -3517,11 +3522,12 @@ declare const _default: (path: string) => {
3517
3522
  * ```
3518
3523
  */
3519
3524
  createSnapshot: (options?: SnapshotOptions) => Promise<SnapshotResult>;
3520
- buildIndex: ({ source, commit, hashContent, includeFederated }: {
3525
+ buildIndex: ({ source, commit, hashContent, includeFederated, includeSchemaContent, }: {
3521
3526
  source: string;
3522
3527
  commit: string;
3523
3528
  hashContent?: boolean;
3524
3529
  includeFederated?: boolean;
3530
+ includeSchemaContent?: boolean;
3525
3531
  }) => Promise<Index>;
3526
3532
  diffSnapshots: (snapshotAPath: string, snapshotBPath: string) => Promise<SnapshotDiff>;
3527
3533
  listSnapshots: () => Promise<SnapshotMeta[]>;
package/dist/index.d.ts CHANGED
@@ -439,10 +439,12 @@ interface UbiquitousLanguage {
439
439
  summary?: string;
440
440
  description?: string;
441
441
  icon?: string;
442
+ editUrl?: string;
442
443
  }
443
444
 
444
445
  interface UbiquitousLanguageDictionary {
445
446
  dictionary: UbiquitousLanguage[];
447
+ editUrl?: string;
446
448
  }
447
449
 
448
450
  interface DetailPanelProperty {
@@ -663,6 +665,8 @@ interface ToDSLOptions {
663
665
  type IndexResourceType = 'adr' | 'agent' | 'channel' | 'command' | 'container' | 'data-product' | 'diagram' | 'domain' | 'entity' | 'event' | 'flow' | 'query' | 'service' | 'system' | 'team' | 'user';
664
666
  type IndexSchema = Omit<SchemaPointer, 'file'> & {
665
667
  hash?: string;
668
+ /** Raw schema file text. Only present when the index was built with `includeSchemaContent`. */
669
+ content?: string;
666
670
  };
667
671
  type IndexSpecification = Specification & {
668
672
  hash?: string;
@@ -1418,6 +1422,7 @@ declare const FederationIndexSchema: z.ZodObject<{
1418
1422
  environments: z.ZodOptional<z.ZodArray<z.ZodString>>;
1419
1423
  default: z.ZodOptional<z.ZodBoolean>;
1420
1424
  hash: z.ZodOptional<z.ZodString>;
1425
+ content: z.ZodOptional<z.ZodString>;
1421
1426
  }, z.core.$strict>>>;
1422
1427
  specifications: z.ZodOptional<z.ZodArray<z.ZodObject<{
1423
1428
  type: z.ZodEnum<{
@@ -3517,11 +3522,12 @@ declare const _default: (path: string) => {
3517
3522
  * ```
3518
3523
  */
3519
3524
  createSnapshot: (options?: SnapshotOptions) => Promise<SnapshotResult>;
3520
- buildIndex: ({ source, commit, hashContent, includeFederated }: {
3525
+ buildIndex: ({ source, commit, hashContent, includeFederated, includeSchemaContent, }: {
3521
3526
  source: string;
3522
3527
  commit: string;
3523
3528
  hashContent?: boolean;
3524
3529
  includeFederated?: boolean;
3530
+ includeSchemaContent?: boolean;
3525
3531
  }) => Promise<Index>;
3526
3532
  diffSnapshots: (snapshotAPath: string, snapshotBPath: string) => Promise<SnapshotDiff>;
3527
3533
  listSnapshots: () => Promise<SnapshotMeta[]>;
package/dist/index.js CHANGED
@@ -3911,18 +3911,19 @@ var normalizeAssets = async (directory, hashContent, ignoreRules) => {
3911
3911
  );
3912
3912
  return assets.length === 0 ? void 0 : assets;
3913
3913
  };
3914
- var normalizeSchemas = async (resource, resourcePath, hashContent) => {
3914
+ var normalizeSchemas = async (resource, resourcePath, hashContent, includeSchemaContent) => {
3915
3915
  const schemas = resource.schemas ?? (resource.schemaPath ? [{ path: resource.schemaPath, default: true }] : void 0);
3916
3916
  if (schemas === void 0) return void 0;
3917
3917
  return Promise.all(
3918
3918
  schemas.map(async ({ file, ...schema }) => {
3919
3919
  const schemaPath = file ?? schema.path;
3920
+ const readSchema = schemaPath && (hashContent || includeSchemaContent);
3921
+ const bytes = readSchema ? await import_promises18.default.readFile(import_node_path26.default.join(import_node_path26.default.dirname(resourcePath), schemaPath)) : void 0;
3920
3922
  return {
3921
3923
  ...schema,
3922
3924
  ...schemaPath === void 0 ? {} : { path: schemaPath },
3923
- ...hashContent && schemaPath ? {
3924
- hash: `sha256:${(0, import_node_crypto2.createHash)("sha256").update(await import_promises18.default.readFile(import_node_path26.default.join(import_node_path26.default.dirname(resourcePath), schemaPath))).digest("hex")}`
3925
- } : {}
3925
+ ...bytes && hashContent ? { hash: `sha256:${(0, import_node_crypto2.createHash)("sha256").update(bytes).digest("hex")}` } : {},
3926
+ ...bytes && includeSchemaContent ? { content: bytes.toString("utf8") } : {}
3926
3927
  };
3927
3928
  })
3928
3929
  );
@@ -3969,9 +3970,9 @@ var normalizeSidecars = async (directory, resourcePath, resourceDirectories, rep
3969
3970
  );
3970
3971
  return sidecars.length === 0 ? void 0 : sidecars;
3971
3972
  };
3972
- var toIndexResource = async (directory, type, resource, hashContent, sourcePath, resourceDirectories, ignoreRules) => {
3973
+ var toIndexResource = async (directory, type, resource, hashContent, includeSchemaContent, sourcePath, resourceDirectories, ignoreRules) => {
3973
3974
  const { id, version, name } = resource;
3974
- const schemas = await normalizeSchemas(resource, sourcePath, hashContent);
3975
+ const schemas = await normalizeSchemas(resource, sourcePath, hashContent, includeSchemaContent);
3975
3976
  const specifications = await normalizeSpecifications(resource, sourcePath, hashContent);
3976
3977
  const representedPaths = new Set(
3977
3978
  [
@@ -4038,7 +4039,13 @@ var toIndexResource = async (directory, type, resource, hashContent, sourcePath,
4038
4039
  ...resource.members === void 0 ? {} : { members: resource.members }
4039
4040
  };
4040
4041
  };
4041
- var buildIndex = (directory) => async ({ source, commit, hashContent = true, includeFederated = true }) => {
4042
+ var buildIndex = (directory) => async ({
4043
+ source,
4044
+ commit,
4045
+ hashContent = true,
4046
+ includeFederated = true,
4047
+ includeSchemaContent = false
4048
+ }) => {
4042
4049
  const ignoreRules = await loadIgnoreRules(directory);
4043
4050
  const [
4044
4051
  domains,
@@ -4119,7 +4126,16 @@ var buildIndex = (directory) => async ({ source, commit, hashContent = true, inc
4119
4126
  );
4120
4127
  const resources = await Promise.all(
4121
4128
  locatedResources.map(
4122
- ({ type, resource, sourcePath }) => toIndexResource(directory, type, resource, hashContent, sourcePath, resourceDirectories, ignoreRules)
4129
+ ({ type, resource, sourcePath }) => toIndexResource(
4130
+ directory,
4131
+ type,
4132
+ resource,
4133
+ hashContent,
4134
+ includeSchemaContent,
4135
+ sourcePath,
4136
+ resourceDirectories,
4137
+ ignoreRules
4138
+ )
4123
4139
  )
4124
4140
  );
4125
4141
  const assets = await normalizeAssets(directory, hashContent, ignoreRules);
@@ -4638,7 +4654,8 @@ var IndexSchemaPointerSchema = import_zod.z.object({
4638
4654
  format: import_zod.z.string().optional(),
4639
4655
  environments: import_zod.z.array(import_zod.z.string()).optional(),
4640
4656
  default: import_zod.z.boolean().optional(),
4641
- hash: contentHash.optional()
4657
+ hash: contentHash.optional(),
4658
+ content: import_zod.z.string().optional()
4642
4659
  }).strict();
4643
4660
  var IndexSpecificationSchema = import_zod.z.object({
4644
4661
  type: import_zod.z.enum(["openapi", "asyncapi", "graphql"]),