@eventcatalog/core 4.2.2 → 4.2.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.
Files changed (27) hide show
  1. package/dist/analytics/analytics.cjs +1 -1
  2. package/dist/analytics/analytics.js +2 -2
  3. package/dist/analytics/log-build.cjs +1 -1
  4. package/dist/analytics/log-build.js +3 -3
  5. package/dist/{chunk-A5LDEHRI.js → chunk-DGDCWOWP.js} +1 -1
  6. package/dist/{chunk-JV33GNVZ.js → chunk-I4TTHHXI.js} +1 -1
  7. package/dist/{chunk-Z2CMR4HM.js → chunk-M2YEUPPP.js} +1 -1
  8. package/dist/{chunk-HIQ22EHS.js → chunk-QQC5UX3E.js} +1 -1
  9. package/dist/{chunk-ZGQNCIRW.js → chunk-WOASLQ3F.js} +1 -1
  10. package/dist/constants.cjs +1 -1
  11. package/dist/constants.js +1 -1
  12. package/dist/eventcatalog.cjs +1 -1
  13. package/dist/eventcatalog.js +5 -5
  14. package/dist/generate.cjs +1 -1
  15. package/dist/generate.js +3 -3
  16. package/dist/utils/cli-logger.cjs +1 -1
  17. package/dist/utils/cli-logger.js +2 -2
  18. package/eventcatalog/src/components/MDX/CustomProperties/CustomProperties.astro +39 -0
  19. package/eventcatalog/src/components/MDX/CustomProperties/CustomProperty.astro +37 -0
  20. package/eventcatalog/src/components/MDX/CustomProperties/CustomPropertyRow.astro +37 -0
  21. package/eventcatalog/src/components/MDX/CustomProperties/CustomPropertyValue.astro +51 -0
  22. package/eventcatalog/src/components/MDX/CustomProperties/custom-properties.spec.ts +38 -0
  23. package/eventcatalog/src/components/MDX/CustomProperties/custom-properties.ts +39 -0
  24. package/eventcatalog/src/components/MDX/components.tsx +4 -0
  25. package/eventcatalog/src/content.config.ts +402 -373
  26. package/eventcatalog/src/utils/collections/extension-properties.ts +25 -0
  27. package/package.json +3 -3
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(analytics_exports);
36
36
  var import_os = __toESM(require("os"), 1);
37
37
 
38
38
  // package.json
39
- var version = "4.2.2";
39
+ var version = "4.2.3";
40
40
 
41
41
  // src/constants.ts
42
42
  var VERSION = version;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "../chunk-ZGQNCIRW.js";
4
- import "../chunk-A5LDEHRI.js";
3
+ } from "../chunk-WOASLQ3F.js";
4
+ import "../chunk-DGDCWOWP.js";
5
5
  export {
6
6
  raiseEvent
7
7
  };
@@ -140,7 +140,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
140
140
  var import_os = __toESM(require("os"), 1);
141
141
 
142
142
  // package.json
143
- var version = "4.2.2";
143
+ var version = "4.2.3";
144
144
 
145
145
  // src/constants.ts
146
146
  var VERSION = version;
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  log_build_default
3
- } from "../chunk-HIQ22EHS.js";
3
+ } from "../chunk-QQC5UX3E.js";
4
4
  import "../chunk-K2XIENVT.js";
5
- import "../chunk-ZGQNCIRW.js";
6
- import "../chunk-A5LDEHRI.js";
5
+ import "../chunk-WOASLQ3F.js";
6
+ import "../chunk-DGDCWOWP.js";
7
7
  import "../chunk-6QENHZZP.js";
8
8
  export {
9
9
  log_build_default as default
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "4.2.2";
2
+ var version = "4.2.3";
3
3
 
4
4
  // src/constants.ts
5
5
  var VERSION = version;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logger
3
- } from "./chunk-Z2CMR4HM.js";
3
+ } from "./chunk-M2YEUPPP.js";
4
4
  import {
5
5
  cleanup,
6
6
  getEventCatalogConfigFile
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-A5LDEHRI.js";
3
+ } from "./chunk-DGDCWOWP.js";
4
4
 
5
5
  // src/utils/cli-logger.ts
6
6
  import pc from "picocolors";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-K2XIENVT.js";
5
5
  import {
6
6
  raiseEvent
7
- } from "./chunk-ZGQNCIRW.js";
7
+ } from "./chunk-WOASLQ3F.js";
8
8
  import {
9
9
  getEventCatalogConfigFile,
10
10
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-A5LDEHRI.js";
3
+ } from "./chunk-DGDCWOWP.js";
4
4
 
5
5
  // src/analytics/analytics.js
6
6
  import os from "os";
@@ -25,7 +25,7 @@ __export(constants_exports, {
25
25
  module.exports = __toCommonJS(constants_exports);
26
26
 
27
27
  // package.json
28
- var version = "4.2.2";
28
+ var version = "4.2.3";
29
29
 
30
30
  // src/constants.ts
31
31
  var VERSION = version;
package/dist/constants.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-A5LDEHRI.js";
3
+ } from "./chunk-DGDCWOWP.js";
4
4
  export {
5
5
  VERSION
6
6
  };
@@ -144,7 +144,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
144
144
  var import_picocolors = __toESM(require("picocolors"), 1);
145
145
 
146
146
  // package.json
147
- var version = "4.2.2";
147
+ var version = "4.2.3";
148
148
 
149
149
  // src/constants.ts
150
150
  var VERSION = version;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  log_build_default
3
- } from "./chunk-HIQ22EHS.js";
3
+ } from "./chunk-QQC5UX3E.js";
4
4
  import "./chunk-K2XIENVT.js";
5
5
  import {
6
6
  runMigrations
@@ -14,10 +14,10 @@ import {
14
14
  } from "./chunk-B7HCX5HM.js";
15
15
  import {
16
16
  generate
17
- } from "./chunk-JV33GNVZ.js";
17
+ } from "./chunk-I4TTHHXI.js";
18
18
  import {
19
19
  logger
20
- } from "./chunk-Z2CMR4HM.js";
20
+ } from "./chunk-M2YEUPPP.js";
21
21
  import {
22
22
  resolve_catalog_dependencies_default
23
23
  } from "./chunk-LHR4G2UO.js";
@@ -27,7 +27,7 @@ import {
27
27
  import {
28
28
  watch
29
29
  } from "./chunk-CAJUIMDJ.js";
30
- import "./chunk-ZGQNCIRW.js";
30
+ import "./chunk-WOASLQ3F.js";
31
31
  import {
32
32
  createAstroDevLineFilter,
33
33
  createAstroLineFilter
@@ -38,7 +38,7 @@ import {
38
38
  import "./chunk-W5JQON7Z.js";
39
39
  import {
40
40
  VERSION
41
- } from "./chunk-A5LDEHRI.js";
41
+ } from "./chunk-DGDCWOWP.js";
42
42
  import {
43
43
  linkCoreNodeModules,
44
44
  resolveInstalledCoreNodeModules
package/dist/generate.cjs CHANGED
@@ -108,7 +108,7 @@ var getEventCatalogConfigFile = async (projectDirectory) => {
108
108
  var import_picocolors = __toESM(require("picocolors"), 1);
109
109
 
110
110
  // package.json
111
- var version = "4.2.2";
111
+ var version = "4.2.3";
112
112
 
113
113
  // src/constants.ts
114
114
  var VERSION = version;
package/dist/generate.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  generate
3
- } from "./chunk-JV33GNVZ.js";
4
- import "./chunk-Z2CMR4HM.js";
5
- import "./chunk-A5LDEHRI.js";
3
+ } from "./chunk-I4TTHHXI.js";
4
+ import "./chunk-M2YEUPPP.js";
5
+ import "./chunk-DGDCWOWP.js";
6
6
  import "./chunk-6QENHZZP.js";
7
7
  export {
8
8
  generate
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(cli_logger_exports);
36
36
  var import_picocolors = __toESM(require("picocolors"), 1);
37
37
 
38
38
  // package.json
39
- var version = "4.2.2";
39
+ var version = "4.2.3";
40
40
 
41
41
  // src/constants.ts
42
42
  var VERSION = version;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  logger
3
- } from "../chunk-Z2CMR4HM.js";
4
- import "../chunk-A5LDEHRI.js";
3
+ } from "../chunk-M2YEUPPP.js";
4
+ import "../chunk-DGDCWOWP.js";
5
5
  export {
6
6
  logger
7
7
  };
@@ -0,0 +1,39 @@
1
+ ---
2
+ import CustomPropertyRow from './CustomPropertyRow.astro';
3
+ import { getCustomProperties } from './custom-properties';
4
+
5
+ interface Props {
6
+ title?: string;
7
+ data?: Record<string, unknown>;
8
+ }
9
+
10
+ const { title = 'Custom properties', data } = Astro.props;
11
+ const properties = getCustomProperties(data);
12
+ ---
13
+
14
+ {
15
+ properties.length > 0 && (
16
+ <section class="not-prose my-8">
17
+ {title && <h3 class="mb-4 text-xl font-semibold text-[rgb(var(--ec-page-text))]">{title}</h3>}
18
+ <div class="overflow-x-auto">
19
+ <table class="w-full border-collapse text-left text-sm text-[rgb(var(--ec-page-text-muted))]">
20
+ <thead>
21
+ <tr class="border-b border-[rgb(var(--ec-page-border))] text-[rgb(var(--ec-page-text))]">
22
+ <th scope="col" class="py-3 pr-6 font-semibold">
23
+ Property
24
+ </th>
25
+ <th scope="col" class="py-3 font-semibold">
26
+ Value
27
+ </th>
28
+ </tr>
29
+ </thead>
30
+ <tbody class="divide-y divide-[rgb(var(--ec-page-border))]">
31
+ {properties.map((property) => (
32
+ <CustomPropertyRow property={property} />
33
+ ))}
34
+ </tbody>
35
+ </table>
36
+ </div>
37
+ </section>
38
+ )
39
+ }
@@ -0,0 +1,37 @@
1
+ ---
2
+ import CustomPropertyRow from './CustomPropertyRow.astro';
3
+ import { getCustomProperty } from './custom-properties';
4
+
5
+ interface Props {
6
+ name: string;
7
+ label?: string;
8
+ data?: Record<string, unknown>;
9
+ }
10
+
11
+ const { name, label, data } = Astro.props;
12
+ const property = getCustomProperty(data, name);
13
+
14
+ if (property && label) property.label = label;
15
+ ---
16
+
17
+ {
18
+ property && (
19
+ <div class="not-prose my-6 overflow-x-auto">
20
+ <table class="w-full border-collapse text-left text-sm text-[rgb(var(--ec-page-text-muted))]">
21
+ <thead>
22
+ <tr class="border-b border-[rgb(var(--ec-page-border))] text-[rgb(var(--ec-page-text))]">
23
+ <th scope="col" class="py-3 pr-6 font-semibold">
24
+ Property
25
+ </th>
26
+ <th scope="col" class="py-3 font-semibold">
27
+ Value
28
+ </th>
29
+ </tr>
30
+ </thead>
31
+ <tbody class="divide-y divide-[rgb(var(--ec-page-border))]">
32
+ <CustomPropertyRow property={property} />
33
+ </tbody>
34
+ </table>
35
+ </div>
36
+ )
37
+ }
@@ -0,0 +1,37 @@
1
+ ---
2
+ import CustomPropertyValue from './CustomPropertyValue.astro';
3
+ import type { CustomProperty } from './custom-properties';
4
+ import { InformationCircleIcon } from '@heroicons/react/24/outline';
5
+
6
+ interface Props {
7
+ property: CustomProperty;
8
+ }
9
+
10
+ const { property } = Astro.props;
11
+ ---
12
+
13
+ <tr class="hover:bg-[rgb(var(--ec-content-hover))]">
14
+ <td class="w-1/3 min-w-48 py-4 pr-6 align-top font-medium text-[rgb(var(--ec-page-text))]">
15
+ <span class="inline-flex items-center gap-1.5">
16
+ {property.label}
17
+ <span class="group relative inline-flex">
18
+ <button
19
+ type="button"
20
+ class="inline-flex cursor-help text-[rgb(var(--ec-page-text-muted))] hover:text-[rgb(var(--ec-page-text))] focus:outline-hidden focus:ring-2 focus:ring-[rgb(var(--ec-accent))] focus:ring-offset-2"
21
+ aria-label={`Frontmatter property: ${property.name}`}
22
+ >
23
+ <InformationCircleIcon className="h-4 w-4" aria-hidden="true" />
24
+ </button>
25
+ <span
26
+ role="tooltip"
27
+ class="pointer-events-none absolute left-full top-1/2 z-20 ml-2 -translate-y-1/2 whitespace-nowrap rounded-md bg-[rgb(var(--ec-page-text))] px-2.5 py-1.5 text-xs font-medium text-[rgb(var(--ec-page-bg))] opacity-0 shadow-lg transition-opacity group-hover:opacity-100 group-focus-within:opacity-100"
28
+ >
29
+ {property.name}
30
+ </span>
31
+ </span>
32
+ </span>
33
+ </td>
34
+ <td class="min-w-0 py-4 align-top text-sm">
35
+ <CustomPropertyValue value={property.value} />
36
+ </td>
37
+ </tr>
@@ -0,0 +1,51 @@
1
+ ---
2
+ import { formatCustomPropertyLabel } from './custom-properties';
3
+
4
+ interface Props {
5
+ value: unknown;
6
+ }
7
+
8
+ const { value } = Astro.props;
9
+ const isArray = Array.isArray(value);
10
+ const isDate = value instanceof Date;
11
+ const isObject = value !== null && typeof value === 'object' && !isArray && !isDate;
12
+ const entries = isObject ? Object.entries(value as Record<string, unknown>) : [];
13
+ const scalarValue = value === null || value === undefined ? '—' : isDate ? value.toISOString() : String(value);
14
+ ---
15
+
16
+ {
17
+ isArray ? (
18
+ value.length > 0 ? (
19
+ <ul class="m-0 list-disc space-y-1 pl-5 text-[rgb(var(--ec-page-text))]">
20
+ {value.map((item) => (
21
+ <li>
22
+ <Astro.self value={item} />
23
+ </li>
24
+ ))}
25
+ </ul>
26
+ ) : (
27
+ <span class="text-[rgb(var(--ec-page-text-muted))]">—</span>
28
+ )
29
+ ) : isObject ? (
30
+ entries.length > 0 ? (
31
+ <dl class="m-0 space-y-2">
32
+ {entries.map(([name, nestedValue]) => (
33
+ <div class="grid gap-1 sm:grid-cols-[minmax(0,10rem)_minmax(0,1fr)]">
34
+ <dt class="font-medium text-[rgb(var(--ec-page-text-muted))]">{formatCustomPropertyLabel(name)}</dt>
35
+ <dd class="m-0 min-w-0 text-[rgb(var(--ec-page-text))]">
36
+ <Astro.self value={nestedValue} />
37
+ </dd>
38
+ </div>
39
+ ))}
40
+ </dl>
41
+ ) : (
42
+ <span class="text-[rgb(var(--ec-page-text-muted))]">—</span>
43
+ )
44
+ ) : typeof value === 'boolean' ? (
45
+ <span class="inline-flex rounded-full bg-[rgb(var(--ec-content-hover))] px-2 py-0.5 text-xs font-medium text-[rgb(var(--ec-page-text))]">
46
+ {scalarValue}
47
+ </span>
48
+ ) : (
49
+ <span class="break-words text-[rgb(var(--ec-page-text))]">{scalarValue}</span>
50
+ )
51
+ }
@@ -0,0 +1,38 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { formatCustomPropertyLabel, getCustomProperties, getCustomProperty, isCustomPropertyName } from './custom-properties';
3
+
4
+ describe('custom properties MDX components', () => {
5
+ it('recognizes extension property names', () => {
6
+ expect(isCustomPropertyName('x-owner')).toBe(true);
7
+ expect(isCustomPropertyName('x-')).toBe(false);
8
+ expect(isCustomPropertyName('owner')).toBe(false);
9
+ });
10
+
11
+ it('creates a readable label without changing uppercase text', () => {
12
+ expect(formatCustomPropertyLabel('x-operational-tier')).toBe('Operational Tier');
13
+ expect(formatCustomPropertyLabel('x-PII_classification')).toBe('PII Classification');
14
+ });
15
+
16
+ it('extracts only custom properties and preserves their values', () => {
17
+ const properties = getCustomProperties({
18
+ id: 'payment-api',
19
+ 'x-operational-tier': 1,
20
+ 'x-on-call': { schedule: 'payments-primary' },
21
+ });
22
+
23
+ expect(properties).toEqual([
24
+ { name: 'x-operational-tier', label: 'Operational Tier', value: 1 },
25
+ { name: 'x-on-call', label: 'On Call', value: { schedule: 'payments-primary' } },
26
+ ]);
27
+ });
28
+
29
+ it('gets a named custom property', () => {
30
+ expect(getCustomProperty({ 'x-owner': 'payments' }, 'x-owner')).toEqual({
31
+ name: 'x-owner',
32
+ label: 'Owner',
33
+ value: 'payments',
34
+ });
35
+ expect(getCustomProperty({ owner: 'payments' }, 'owner')).toBeUndefined();
36
+ expect(getCustomProperty({ 'x-owner': 'payments' }, 'x-missing')).toBeUndefined();
37
+ });
38
+ });
@@ -0,0 +1,39 @@
1
+ export type CustomProperty = {
2
+ name: string;
3
+ label: string;
4
+ value: unknown;
5
+ };
6
+
7
+ export const isCustomPropertyName = (name: string) => name.startsWith('x-') && name.length > 2;
8
+
9
+ export const formatCustomPropertyLabel = (name: string) => {
10
+ const propertyName = isCustomPropertyName(name) ? name.slice(2) : name;
11
+
12
+ return propertyName
13
+ .split(/[-_.\s]+/)
14
+ .filter(Boolean)
15
+ .map((part) => `${part.charAt(0).toUpperCase()}${part.slice(1)}`)
16
+ .join(' ');
17
+ };
18
+
19
+ export const getCustomProperties = (data?: Record<string, unknown>): CustomProperty[] => {
20
+ if (!data) return [];
21
+
22
+ return Object.entries(data)
23
+ .filter(([name]) => isCustomPropertyName(name))
24
+ .map(([name, value]) => ({
25
+ name,
26
+ label: formatCustomPropertyLabel(name),
27
+ value,
28
+ }));
29
+ };
30
+
31
+ export const getCustomProperty = (data: Record<string, unknown> | undefined, name: string): CustomProperty | undefined => {
32
+ if (!data || !isCustomPropertyName(name) || !Object.prototype.hasOwnProperty.call(data, name)) return undefined;
33
+
34
+ return {
35
+ name,
36
+ label: formatCustomPropertyLabel(name),
37
+ value: data[name],
38
+ };
39
+ };
@@ -41,6 +41,8 @@ import SchemaViewerPortal from '@components/MDX/SchemaViewer/SchemaViewerPortal'
41
41
  import { jsx } from 'astro/jsx-runtime';
42
42
  import RemoteSchema from '@components/MDX/RemoteSchema.astro';
43
43
  import Visibility from '@components/MDX/Visibility';
44
+ import CustomProperties from '@components/MDX/CustomProperties/CustomProperties.astro';
45
+ import CustomProperty from '@components/MDX/CustomProperties/CustomProperty.astro';
44
46
 
45
47
  const getEntityMapCollection = (props: any, mdxProp: any) => {
46
48
  const collection = mdxProp.collection ?? props.collection;
@@ -50,6 +52,8 @@ const getEntityMapCollection = (props: any, mdxProp: any) => {
50
52
  const components = (props: any) => {
51
53
  return {
52
54
  Attachments: (mdxProp: any) => jsx(Attachments, { ...props, ...mdxProp }),
55
+ CustomProperties: (mdxProp: any) => jsx(CustomProperties, { ...props, ...mdxProp }),
56
+ CustomProperty: (mdxProp: any) => jsx(CustomProperty, { ...props, ...mdxProp }),
53
57
  Accordion,
54
58
  AccordionGroup,
55
59
  Admonition,