@open-resource-discovery/metadata-renderer 1.0.0 → 1.1.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.
Files changed (39) hide show
  1. package/README.md +1 -0
  2. package/dist/a2a/index.d.ts +1 -1
  3. package/dist/a2a.js +1 -1
  4. package/dist/asyncApi/asyncapi-browser.d.ts +10 -0
  5. package/dist/asyncApi/customAttributes/attributeLink.d.ts +1 -1
  6. package/dist/asyncApi/index.d.ts +2 -2
  7. package/dist/asyncapi.js +1 -1
  8. package/dist/chunks/{a2a-B5lkgqLU.js → a2a-BfdUdobQ.js} +1 -1
  9. package/dist/chunks/{asyncApi-K0uQpQwz.js → asyncApi-B7WZqXRI.js} +16 -153
  10. package/dist/chunks/{csn-D4GBs8tC.js → csn-CIBA2ds5.js} +58 -189
  11. package/dist/chunks/{mcp-qA5sYRAN.js → mcp-Yb3SHisP.js} +1 -1
  12. package/dist/chunks/{openApi-Ccp9Pa_k.js → openApi-sDysRKUP.js} +15 -323
  13. package/dist/chunks/overlay-CO0o6FYy.js +41 -0
  14. package/dist/chunks/{utils-BC3WF3-9.js → utils-BLQCpHkJ.js} +2 -0
  15. package/dist/core/ShadowRoot.d.ts +1 -1
  16. package/dist/core/dispatch.d.ts +3 -0
  17. package/dist/core/dispatch.test.d.ts +1 -0
  18. package/dist/core/index.d.ts +1 -1
  19. package/dist/core/utils.d.ts +1 -1
  20. package/dist/csn/customAttributes/postProcess.d.ts +1 -0
  21. package/dist/csn/customAttributes/postProcess.test.d.ts +1 -0
  22. package/dist/csn/index.d.ts +1 -2
  23. package/dist/csn.js +1 -1
  24. package/dist/entries/overlay.d.ts +2 -0
  25. package/dist/index.css +6815 -2141
  26. package/dist/index.d.ts +2 -0
  27. package/dist/index.js +650 -28
  28. package/dist/mcp/index.d.ts +1 -1
  29. package/dist/mcp.js +1 -1
  30. package/dist/openApi/customAttributes/attributeLink.d.ts +1 -1
  31. package/dist/openApi/index.d.ts +1 -2
  32. package/dist/openapi.js +1 -1
  33. package/dist/overlay/index.d.ts +7 -0
  34. package/dist/overlay.js +2 -0
  35. package/dist/styles.d.ts +1 -0
  36. package/dist/styles.js +1 -0
  37. package/dist/types.d.ts +1 -3
  38. package/dist/vendor.d.ts +1 -0
  39. package/package.json +30 -20
package/dist/index.js CHANGED
@@ -1,16 +1,40 @@
1
- import { i as loadObject, n as detectMetaType, r as extractVersion } from "./chunks/utils-BC3WF3-9.js";
2
- import { n as sapOpenApiAttributesConfig, t as OpenApiRenderer } from "./chunks/openApi-Ccp9Pa_k.js";
3
- import { n as sapCsnAttributesConfig, t as CsnRenderer } from "./chunks/csn-D4GBs8tC.js";
4
- import { n as sapAsyncApiAttributesConfig, t as AsyncApiRenderer } from "./chunks/asyncApi-K0uQpQwz.js";
5
- import { t as A2ARenderer } from "./chunks/a2a-B5lkgqLU.js";
6
- import { t as McpRenderer } from "./chunks/mcp-qA5sYRAN.js";
7
- import { useMemo } from "react";
8
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ import { i as loadObject, n as detectMetaType, r as extractVersion } from "./chunks/utils-BLQCpHkJ.js";
2
+ import { n as attributeLink, t as OpenApiRenderer } from "./chunks/openApi-sDysRKUP.js";
3
+ import { t as CsnRenderer } from "./chunks/csn-CIBA2ds5.js";
4
+ import { n as AttributeLink, t as AsyncApiRenderer } from "./chunks/asyncApi-B7WZqXRI.js";
5
+ import { t as OverlayRenderer } from "./chunks/overlay-CO0o6FYy.js";
6
+ import { t as A2ARenderer } from "./chunks/a2a-BfdUdobQ.js";
7
+ import { t as McpRenderer } from "./chunks/mcp-Yb3SHisP.js";
8
+ import { useMemo, useState } from "react";
9
+ import Markdown from "react-markdown";
10
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
11
+ //#region src/lib/core/dispatch.ts
12
+ function buildRendererExtraProps(metaType, options) {
13
+ const extraProps = {};
14
+ const customAttributes = options?.customAttributes;
15
+ const ca = customAttributes !== false ? customAttributes : void 0;
16
+ if (metaType === "openapi") {
17
+ if (ca?.openapi) extraProps.customAttributes = ca.openapi;
18
+ }
19
+ if (metaType === "asyncapi") {
20
+ if (options?.asyncapi) Object.assign(extraProps, { config: options.asyncapi });
21
+ if (ca?.asyncapi) extraProps.customAttributes = ca.asyncapi;
22
+ }
23
+ if (metaType === "csn") {
24
+ if (options?.csn) Object.assign(extraProps, { config: options.csn });
25
+ if (ca?.csn) extraProps.customAttributes = ca.csn;
26
+ }
27
+ if (metaType === "a2a" && options?.a2a) Object.assign(extraProps, options.a2a);
28
+ if (metaType === "mcp" && options?.mcp) Object.assign(extraProps, options.mcp);
29
+ return extraProps;
30
+ }
31
+ //#endregion
9
32
  //#region src/lib/core/index.tsx
10
33
  var DEFAULT_RENDERERS = {
11
34
  openapi: OpenApiRenderer,
12
35
  csn: CsnRenderer,
13
36
  asyncapi: AsyncApiRenderer,
37
+ overlay: OverlayRenderer,
14
38
  a2a: A2ARenderer,
15
39
  mcp: McpRenderer
16
40
  };
@@ -18,6 +42,7 @@ var PROTOCOL_LABELS = {
18
42
  openapi: "OpenAPI",
19
43
  csn: "CSN",
20
44
  asyncapi: "AsyncAPI",
45
+ overlay: "Overlay",
21
46
  a2a: "A2A",
22
47
  mcp: "MCP"
23
48
  };
@@ -60,23 +85,7 @@ function MetadataRenderer({ content, renderers, options, type, className, theme
60
85
  ]
61
86
  });
62
87
  } else if (RendererComponent) {
63
- const extraProps = {};
64
- if (metaType === "openapi") {
65
- if (options?.customAttributes === false || options?.showSAPCustomFields === false) extraProps.showCustomAttributes = false;
66
- else if (options?.customAttributes?.openapi) extraProps.customAttributes = options.customAttributes.openapi;
67
- }
68
- if (metaType === "asyncapi") {
69
- if (options?.asyncapi) Object.assign(extraProps, { config: options.asyncapi });
70
- if (options?.customAttributes === false) extraProps.showCustomAttributes = false;
71
- else if (options?.customAttributes?.asyncapi) extraProps.customAttributes = options.customAttributes.asyncapi;
72
- }
73
- if (metaType === "csn") {
74
- if (options?.csn) Object.assign(extraProps, { config: options.csn });
75
- if (options?.customAttributes === false) extraProps.showCustomAttributes = false;
76
- else if (options?.customAttributes?.csn) extraProps.customAttributes = options.customAttributes.csn;
77
- }
78
- if (metaType === "a2a" && options?.a2a) Object.assign(extraProps, options.a2a);
79
- if (metaType === "mcp" && options?.mcp) Object.assign(extraProps, options.mcp);
88
+ const extraProps = buildRendererExtraProps(metaType, options);
80
89
  renderer = /* @__PURE__ */ jsx(RendererComponent, {
81
90
  content,
82
91
  className,
@@ -110,12 +119,12 @@ function MetadataRenderer({ content, renderers, options, type, className, theme
110
119
  height: "100%",
111
120
  ...theme
112
121
  },
113
- children: [label && /* @__PURE__ */ jsxs("div", {
122
+ children: [label && label !== PROTOCOL_LABELS.overlay && label !== PROTOCOL_LABELS.openapi && /* @__PURE__ */ jsxs("div", {
114
123
  style: {
115
124
  position: "absolute",
116
125
  top: 8,
117
126
  right: 8,
118
- zIndex: 10,
127
+ zIndex: 100,
119
128
  padding: "2px 8px",
120
129
  borderRadius: 4,
121
130
  fontSize: 11,
@@ -163,4 +172,617 @@ function createTheme(tokens) {
163
172
  return result;
164
173
  }
165
174
  //#endregion
166
- export { A2ARenderer, AsyncApiRenderer, CsnRenderer, McpRenderer, MetadataRenderer, OpenApiRenderer, createTheme, detectMetaType, extractVersion, loadObject, sapAsyncApiAttributesConfig, sapCsnAttributesConfig, sapOpenApiAttributesConfig };
175
+ //#region src/lib/openApi/customAttributes/sapAttributes/root/typeCheckXxtOverview.ts
176
+ function typeCheckExSapExtOverviewExSapExtOverview(obj) {
177
+ if (typeof obj !== "object" || obj === null) return false;
178
+ if (!("xSapExtOverview" in obj) || !Array.isArray(obj.xSapExtOverview)) return false;
179
+ return obj.xSapExtOverview.every((xSapExtOverview) => {
180
+ if (typeof xSapExtOverview !== "object" || xSapExtOverview === null) return false;
181
+ if (!("name" in xSapExtOverview) || !("values" in xSapExtOverview)) return false;
182
+ if (typeof xSapExtOverview.name !== "string") return false;
183
+ if (typeof xSapExtOverview.values === "string") return true;
184
+ if (!Array.isArray(xSapExtOverview.values)) return false;
185
+ if (xSapExtOverview.values.every((value) => typeof value === "string")) return true;
186
+ return xSapExtOverview.values.every((value) => {
187
+ if (typeof value !== "object" || value === null) return false;
188
+ if (!("text" in value) || typeof value.text !== "string") return false;
189
+ return "format" in value && (value.format === "plain" || value.format === "markdown");
190
+ });
191
+ });
192
+ }
193
+ //#endregion
194
+ //#region src/lib/openApi/customAttributes/sapAttributes/root/extOverview.tsx
195
+ function extOverview(props) {
196
+ if (!typeCheckExSapExtOverviewExSapExtOverview(props)) return null;
197
+ const { xSapExtOverview } = props;
198
+ return /* @__PURE__ */ jsxs("div", {
199
+ className: "sap-api-container",
200
+ children: [/* @__PURE__ */ jsxs("div", {
201
+ className: "sap-api-label sap-api-label--root",
202
+ children: ["SAP Extensibility Overview ", /* @__PURE__ */ jsx(attributeLink, { attributeName: "x-sap-ext-overview" })]
203
+ }), /* @__PURE__ */ jsx("div", {
204
+ className: "sap-api-value sap-api-value--root",
205
+ children: xSapExtOverview.map((extension) => /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("strong", { children: extension.name }), /* @__PURE__ */ jsx("ul", {
206
+ className: "sap-api-list",
207
+ children: typeof extension.values === "string" ? /* @__PURE__ */ jsx("li", { children: extension.values }) : extension.values.map((value) => typeof value === "string" ? /* @__PURE__ */ jsx("li", { children: value }, value) : /* @__PURE__ */ jsx("li", { children: value.format === "plain" ? value.text : /* @__PURE__ */ jsx(Markdown, { children: value.text }) }, value.text))
208
+ })] }, extension.name))
209
+ })]
210
+ });
211
+ }
212
+ //#endregion
213
+ //#region src/lib/openApi/customAttributes/sapAttributes/root/stateInfo.tsx
214
+ var background$1 = {
215
+ ACTIVE: "color-mix(in srgb, var(--scalar-color-green) 15%, transparent)",
216
+ BETA: "color-mix(in srgb, var(--scalar-color-blue) 15%, transparent)",
217
+ DEPRECATED: "color-mix(in srgb, var(--scalar-color-orange) 15%, transparent)",
218
+ DECOMMISSIONED: "color-mix(in srgb, var(--scalar-color-red) 15%, transparent)"
219
+ };
220
+ var color$1 = {
221
+ ACTIVE: "var(--scalar-color-green)",
222
+ BETA: "var(--scalar-color-blue)",
223
+ DEPRECATED: "var(--scalar-color-orange)",
224
+ DECOMMISSIONED: "var(--scalar-color-red)"
225
+ };
226
+ function StateInfo({ xSapStateInfo }) {
227
+ if (!xSapStateInfo) return null;
228
+ const status = xSapStateInfo.state?.toUpperCase();
229
+ const badge = /* @__PURE__ */ jsx("span", {
230
+ style: {
231
+ display: "inline-block",
232
+ borderRadius: "10px",
233
+ padding: "0 6px",
234
+ background: background$1[status] || "",
235
+ color: color$1[status] || ""
236
+ },
237
+ children: status
238
+ });
239
+ const dateFormatter = new Intl.DateTimeFormat("en-GB", { dateStyle: "long" });
240
+ const formatDate = (d) => {
241
+ const parsed = new Date(d);
242
+ return isNaN(parsed.getTime()) ? d : dateFormatter.format(parsed);
243
+ };
244
+ return /* @__PURE__ */ jsxs("div", {
245
+ className: "sap-api-container",
246
+ children: [/* @__PURE__ */ jsxs("div", {
247
+ className: "sap-api-label",
248
+ children: ["API State ", /* @__PURE__ */ jsx(attributeLink, { attributeName: "x-sap-stateInfo" })]
249
+ }), /* @__PURE__ */ jsxs("div", {
250
+ className: "sap-api-value",
251
+ children: [
252
+ badge,
253
+ xSapStateInfo.deprecationDate && /* @__PURE__ */ jsxs("div", { children: ["Deprecated on ", formatDate(xSapStateInfo.deprecationDate)] }),
254
+ xSapStateInfo.decommissionedDate && /* @__PURE__ */ jsxs("div", { children: ["Decommissioned on ", formatDate(xSapStateInfo.decommissionedDate)] }),
255
+ xSapStateInfo.successorApi && /* @__PURE__ */ jsxs("div", { children: ["Successor API: ", /* @__PURE__ */ jsx("a", {
256
+ href: xSapStateInfo.successorApi,
257
+ target: "_blank",
258
+ rel: "noreferrer",
259
+ className: "sap-api-link",
260
+ children: xSapStateInfo.successorApi
261
+ })] })
262
+ ]
263
+ })]
264
+ });
265
+ }
266
+ //#endregion
267
+ //#region src/lib/openApi/customAttributes/sapAttributes/root/ordId.tsx
268
+ function CopyIcon() {
269
+ return /* @__PURE__ */ jsxs("svg", {
270
+ viewBox: "0 0 24 24",
271
+ width: "1em",
272
+ height: "1em",
273
+ fill: "none",
274
+ stroke: "currentColor",
275
+ strokeWidth: "2",
276
+ "aria-hidden": "true",
277
+ children: [/* @__PURE__ */ jsx("rect", {
278
+ x: "9",
279
+ y: "9",
280
+ width: "13",
281
+ height: "13",
282
+ rx: "2"
283
+ }), /* @__PURE__ */ jsx("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })]
284
+ });
285
+ }
286
+ function CheckIcon() {
287
+ return /* @__PURE__ */ jsx("svg", {
288
+ viewBox: "0 0 24 24",
289
+ width: "1em",
290
+ height: "1em",
291
+ fill: "none",
292
+ stroke: "currentColor",
293
+ strokeWidth: "2",
294
+ "aria-hidden": "true",
295
+ children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" })
296
+ });
297
+ }
298
+ function ordId({ xSapOrdId }) {
299
+ const [copied, setCopied] = useState(false);
300
+ if (!xSapOrdId) return null;
301
+ const copy = () => {
302
+ navigator.clipboard?.writeText(xSapOrdId).then(() => {
303
+ setCopied(true);
304
+ setTimeout(() => setCopied(false), 1500);
305
+ });
306
+ };
307
+ return /* @__PURE__ */ jsxs("div", {
308
+ className: "sap-api-container",
309
+ children: [/* @__PURE__ */ jsxs("div", {
310
+ className: "sap-api-label",
311
+ children: ["ORD ID ", /* @__PURE__ */ jsx(attributeLink, { attributeName: "x-sap-ord-id" })]
312
+ }), /* @__PURE__ */ jsxs("div", {
313
+ className: "sap-api-value sap-api-ord-id",
314
+ children: [/* @__PURE__ */ jsx("span", {
315
+ className: "sap-api-ord-id-text",
316
+ children: xSapOrdId
317
+ }), /* @__PURE__ */ jsx("button", {
318
+ type: "button",
319
+ className: "sap-api-copy-btn",
320
+ onClick: copy,
321
+ "aria-label": "Copy ORD ID",
322
+ title: copied ? "Copied" : "Copy",
323
+ children: copied ? /* @__PURE__ */ jsx(CheckIcon, {}) : /* @__PURE__ */ jsx(CopyIcon, {})
324
+ })]
325
+ })]
326
+ });
327
+ }
328
+ //#endregion
329
+ //#region src/lib/openApi/customAttributes/sapAttributes/operation/deprecatedOperation.tsx
330
+ function deprecatedOperation({ xSapDeprecatedOperation }) {
331
+ const deprecationDate = new Intl.DateTimeFormat("en-GB", { dateStyle: "long" }).format(new Date(xSapDeprecatedOperation.deprecationDate));
332
+ return /* @__PURE__ */ jsxs("div", {
333
+ className: "sap-api-container",
334
+ children: [/* @__PURE__ */ jsxs("div", {
335
+ className: "sap-api-label",
336
+ children: ["SAP Deprecated Operation ", /* @__PURE__ */ jsx(attributeLink, { attributeName: "x-sap-deprecated-operation" })]
337
+ }), /* @__PURE__ */ jsxs("div", {
338
+ className: "sap-api-value",
339
+ children: [
340
+ "Deprecated on ",
341
+ deprecationDate,
342
+ " ",
343
+ /* @__PURE__ */ jsx("br", {}),
344
+ !xSapDeprecatedOperation.successorOperationRef && !xSapDeprecatedOperation.successorOperationId ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
345
+ " Successor ",
346
+ xSapDeprecatedOperation.successorOperationRef ? /* @__PURE__ */ jsx("a", {
347
+ href: xSapDeprecatedOperation.successorOperationRef,
348
+ rel: "noreferrer, noopener",
349
+ children: xSapDeprecatedOperation.successorOperationRef
350
+ }) : null,
351
+ xSapDeprecatedOperation.successorOperationId ? /* @__PURE__ */ jsx("span", { children: xSapDeprecatedOperation.successorOperationId }) : null
352
+ ] })
353
+ ]
354
+ })]
355
+ });
356
+ }
357
+ //#endregion
358
+ //#region src/lib/openApi/customAttributes/sapAttributes/schema/odmEntityName.tsx
359
+ function odmEntityName({ xSapOdmEntityName }) {
360
+ return /* @__PURE__ */ jsxs("div", {
361
+ className: "sap-api-container",
362
+ children: [/* @__PURE__ */ jsxs("div", {
363
+ className: "sap-api-label",
364
+ children: ["ODM entity name ", /* @__PURE__ */ jsx(attributeLink, { attributeName: "x-sap-odm-entity-name" })]
365
+ }), /* @__PURE__ */ jsx("div", {
366
+ className: "sap-api-value",
367
+ children: xSapOdmEntityName
368
+ })]
369
+ });
370
+ }
371
+ //#endregion
372
+ //#region src/lib/openApi/customAttributes/sapAttributes/schema/odmSemanticKey.tsx
373
+ function odmSemanticKey({ xSapOdmSemanticKey }) {
374
+ return /* @__PURE__ */ jsxs("div", {
375
+ className: "sap-api-container",
376
+ children: [/* @__PURE__ */ jsxs("div", {
377
+ className: "sap-api-label",
378
+ children: ["ODM Semantic Key ", /* @__PURE__ */ jsx(attributeLink, { attributeName: "x-sap-odm-semantic-key" })]
379
+ }), /* @__PURE__ */ jsx("div", {
380
+ className: "sap-api-value",
381
+ children: xSapOdmSemanticKey.map((entry) => /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("strong", { children: entry.name }), /* @__PURE__ */ jsx("ul", {
382
+ className: "sap-api-list",
383
+ children: entry.values.map((v) => /* @__PURE__ */ jsx("li", { children: v }, v))
384
+ })] }, entry.name))
385
+ })]
386
+ });
387
+ }
388
+ //#endregion
389
+ //#region src/lib/openApi/customAttributes/sapAttributes/sapPreset.ts
390
+ function component(fn) {
391
+ return { component: fn };
392
+ }
393
+ var sapOpenApiAttributesConfig = {
394
+ prefixStartsWith: "x-sap-",
395
+ documentationUrl: (name, { version }) => `https://github.com/SAP/openapi-specification/tree/main/sap-schemas/v${version}#${name}`,
396
+ extensions: {
397
+ "x-sap-compliance-level": {
398
+ type: "link",
399
+ label: "SAP Compliance Level",
400
+ callback: (v) => {
401
+ return {
402
+ "sap:base:v1": "https://github.com/open-resource-discovery/specification/blob/main/docs/spec-extensions/policy-levels/sap-base-v1.md",
403
+ "sap:core:v1": "https://github.com/open-resource-discovery/specification/blob/main/docs/spec-extensions/policy-levels/sap-core-v1.md",
404
+ "sap:core:v2": "https://github.com/open-resource-discovery/specification/blob/main/docs/spec-extensions/policy-levels/sap-core-v1.md"
405
+ }[String(v)];
406
+ }
407
+ },
408
+ "x-sap-shortText": {
409
+ type: "string",
410
+ label: "SAP Short Text"
411
+ },
412
+ "x-sap-software-min-version": {
413
+ type: "string",
414
+ label: "SAP Software Version"
415
+ },
416
+ "x-sap-api-type": {
417
+ type: "string",
418
+ label: "SAP API Type"
419
+ },
420
+ "x-sap-direction": {
421
+ type: "string",
422
+ label: "SAP Direction"
423
+ },
424
+ "x-sap-ord-id": component(ordId),
425
+ "x-sap-operation-intent": {
426
+ type: "string",
427
+ label: "SAP Operation Intent"
428
+ },
429
+ "x-sap-odm-oid": {
430
+ type: "string",
431
+ label: "ODM OID"
432
+ },
433
+ "x-sap-odm-oid-reference-entity-name": {
434
+ type: "string",
435
+ label: "ODM OID Reference Entity Name"
436
+ },
437
+ "x-sap-precision": {
438
+ type: "number",
439
+ label: "SAP Precision"
440
+ },
441
+ "x-sap-scale": {
442
+ type: "number",
443
+ label: "SAP Scale"
444
+ },
445
+ "x-sap-root-entity": {
446
+ type: "boolean",
447
+ label: "SAP Root Entity"
448
+ },
449
+ "x-sap-dpp-entity-semantics": {
450
+ type: "string",
451
+ label: "SAP DPP: Entity Semantics"
452
+ },
453
+ "x-sap-dpp-data-subject-role": {
454
+ type: "string",
455
+ label: "SAP DPP: Data Subject Role"
456
+ },
457
+ "x-sap-dpp-data-subject-role-description": {
458
+ type: "string",
459
+ label: "SAP DPP: Data Subject Role Description"
460
+ },
461
+ "x-sap-dpp-field-semantics": {
462
+ type: "string",
463
+ label: "SAP DPP: Field Semantics"
464
+ },
465
+ "x-sap-dpp-is-potentially-personal": {
466
+ type: "boolean",
467
+ label: "SAP DPP: Potentially Personal"
468
+ },
469
+ "x-sap-dpp-is-potentially-sensitive": {
470
+ type: "boolean",
471
+ label: "SAP DPP: Potentially Sensitive"
472
+ },
473
+ "x-sap-ext-overview": component(extOverview),
474
+ "x-sap-stateInfo": component(StateInfo),
475
+ "x-sap-extensible": {
476
+ type: "object",
477
+ label: "SAP Extensible"
478
+ },
479
+ "x-sap-deprecated-operation": component(deprecatedOperation),
480
+ "x-sap-odm-entity-name": component(odmEntityName),
481
+ "x-sap-odm-semantic-key": component(odmSemanticKey)
482
+ }
483
+ };
484
+ //#endregion
485
+ //#region src/lib/asyncApi/customAttributes/stateInfo.tsx
486
+ var background = {
487
+ ACTIVE: "color-mix(in srgb, #22c55e 15%, transparent)",
488
+ BETA: "color-mix(in srgb, #3b82f6 15%, transparent)",
489
+ DEPRECATED: "color-mix(in srgb, #f97316 15%, transparent)",
490
+ DECOMMISSIONED: "color-mix(in srgb, #ef4444 15%, transparent)"
491
+ };
492
+ var color = {
493
+ ACTIVE: "#16a34a",
494
+ BETA: "#2563eb",
495
+ DEPRECATED: "#ea580c",
496
+ DECOMMISSIONED: "#dc2626"
497
+ };
498
+ function AsyncApiStateInfo({ propertyName, propertyValue }) {
499
+ if (!propertyValue || typeof propertyValue !== "object") return null;
500
+ const info = propertyValue;
501
+ const status = info.state?.toUpperCase();
502
+ const badge = /* @__PURE__ */ jsx("span", {
503
+ style: {
504
+ display: "inline-block",
505
+ borderRadius: "10px",
506
+ padding: "0 6px",
507
+ background: background[status] || "",
508
+ color: color[status] || ""
509
+ },
510
+ children: status
511
+ });
512
+ const dateFormatter = new Intl.DateTimeFormat("en-GB", { dateStyle: "long" });
513
+ const formatDate = (d) => {
514
+ const parsed = new Date(d);
515
+ return isNaN(parsed.getTime()) ? d : dateFormatter.format(parsed);
516
+ };
517
+ return /* @__PURE__ */ jsxs("div", {
518
+ className: "asyncapi-attr-row",
519
+ children: [/* @__PURE__ */ jsxs("div", {
520
+ className: "asyncapi-attr-label",
521
+ children: ["API State ", /* @__PURE__ */ jsx(AttributeLink, { attributeName: propertyName })]
522
+ }), /* @__PURE__ */ jsxs("div", {
523
+ className: "asyncapi-attr-value",
524
+ children: [
525
+ badge,
526
+ info.deprecationDate && /* @__PURE__ */ jsxs("div", { children: ["Deprecated on ", formatDate(info.deprecationDate)] }),
527
+ info.decommissionedDate && /* @__PURE__ */ jsxs("div", { children: ["Decommissioned on ", formatDate(info.decommissionedDate)] }),
528
+ info.link && /* @__PURE__ */ jsxs("div", { children: ["More info: ", /* @__PURE__ */ jsx("a", {
529
+ href: info.link,
530
+ target: "_blank",
531
+ rel: "noreferrer",
532
+ className: "asyncapi-attr-link",
533
+ children: info.link
534
+ })] })
535
+ ]
536
+ })]
537
+ });
538
+ }
539
+ //#endregion
540
+ //#region src/lib/asyncApi/customAttributes/sapPreset.ts
541
+ var sapAsyncApiAttributesConfig = {
542
+ prefixStartsWith: "x-sap-",
543
+ documentationUrl: (name) => `https://github.com/SAP/asyncapi-specification#${name}`,
544
+ extensions: {
545
+ "x-sap-catalog-spec-version": {
546
+ type: "string",
547
+ label: "SAP Catalog Spec Version"
548
+ },
549
+ "x-sap-application-namespace": {
550
+ type: "string",
551
+ label: "SAP Application Namespace"
552
+ },
553
+ "x-sap-ord-id": {
554
+ type: "string",
555
+ label: "ORD ID"
556
+ },
557
+ "x-sap-shortText": {
558
+ type: "string",
559
+ label: "SAP Short Text"
560
+ },
561
+ "x-sap-software-min-version": {
562
+ type: "string",
563
+ label: "SAP Software Version"
564
+ },
565
+ "x-sap-stateInfo": { component: AsyncApiStateInfo },
566
+ "x-sap-event-spec-version": {
567
+ type: "string",
568
+ label: "SAP Event Spec Version"
569
+ },
570
+ "x-sap-event-source": {
571
+ type: "string",
572
+ label: "SAP Event Source"
573
+ },
574
+ "x-sap-event-source-parameters": {
575
+ type: "object",
576
+ label: "SAP Event Source Parameters"
577
+ },
578
+ "x-sap-event-version": {
579
+ type: "string",
580
+ label: "SAP Event Version"
581
+ },
582
+ "x-sap-event-characteristics": {
583
+ type: "object",
584
+ label: "SAP Event Characteristics"
585
+ },
586
+ "x-sap-object-type": {
587
+ type: "string",
588
+ label: "SAP Object Type"
589
+ },
590
+ "x-sap-odm-version": {
591
+ type: "string",
592
+ label: "SAP ODM Version"
593
+ },
594
+ "x-sap-logical-odm-event-version": {
595
+ type: "string",
596
+ label: "SAP Logical ODM Event Version"
597
+ },
598
+ "x-sap-dpp-entity-semantics": {
599
+ type: "string",
600
+ label: "SAP DPP: Entity Semantics"
601
+ },
602
+ "x-sap-dpp-data-subject-role": {
603
+ type: "string",
604
+ label: "SAP DPP: Data Subject Role"
605
+ },
606
+ "x-sap-dpp-data-subject-role-description": {
607
+ type: "string",
608
+ label: "SAP DPP: Data Subject Role Description"
609
+ },
610
+ "x-sap-dpp-field-semantics": {
611
+ type: "string",
612
+ label: "SAP DPP: Field Semantics"
613
+ },
614
+ "x-sap-dpp-is-potentially-personal": {
615
+ type: "boolean",
616
+ label: "SAP DPP: Potentially Personal"
617
+ },
618
+ "x-sap-dpp-is-potentially-sensitive": {
619
+ type: "boolean",
620
+ label: "SAP DPP: Potentially Sensitive"
621
+ }
622
+ }
623
+ };
624
+ //#endregion
625
+ //#region src/lib/csn/customAttributes/sapPreset.ts
626
+ var sapCsnAttributesConfig = {
627
+ prefixStartsWith: "@",
628
+ annotations: {
629
+ "@EndUserText.label": {
630
+ type: "string",
631
+ label: "End User Text · Label"
632
+ },
633
+ "@EndUserText.heading": {
634
+ type: "string",
635
+ label: "End User Text · Heading"
636
+ },
637
+ "@EndUserText.quickInfo": {
638
+ type: "string",
639
+ label: "End User Text · Quick Info"
640
+ },
641
+ "@ObjectModel.modelingPattern": {
642
+ type: "object",
643
+ label: "Modeling Pattern"
644
+ },
645
+ "@ObjectModel.text.element": {
646
+ type: "array",
647
+ label: "Text Element"
648
+ },
649
+ "@ObjectModel.text.association": {
650
+ type: "object",
651
+ label: "Text Association"
652
+ },
653
+ "@ObjectModel.semanticKey": {
654
+ type: "array",
655
+ label: "Semantic Key"
656
+ },
657
+ "@ObjectModel.representativeKey": {
658
+ type: "object",
659
+ label: "Representative Key"
660
+ },
661
+ "@ObjectModel.compositionRoot": {
662
+ type: "boolean",
663
+ label: "Composition Root"
664
+ },
665
+ "@ObjectModel.supportedCapabilities": {
666
+ type: "array",
667
+ label: "Supported Capabilities"
668
+ },
669
+ "@ObjectModel.usageType.sizeCategory": {
670
+ type: "string",
671
+ label: "Usage Type · Size Category"
672
+ },
673
+ "@ObjectModel.foreignKey.association": {
674
+ type: "object",
675
+ label: "Foreign Key Association"
676
+ },
677
+ "@Consumption.valueHelpDefinition": {
678
+ type: "array",
679
+ label: "Value Help"
680
+ },
681
+ "@Consumption.hidden": {
682
+ type: "boolean",
683
+ label: "Hidden"
684
+ },
685
+ "@PersonalData.entitySemantics": {
686
+ type: "string",
687
+ label: "DPP · Entity Semantics"
688
+ },
689
+ "@PersonalData.dataSubjectRole": {
690
+ type: "string",
691
+ label: "DPP · Data Subject Role"
692
+ },
693
+ "@PersonalData.dataSubjectRoleDescription": {
694
+ type: "string",
695
+ label: "DPP · Data Subject Role Description"
696
+ },
697
+ "@PersonalData.fieldSemantics": {
698
+ type: "string",
699
+ label: "DPP · Field Semantics"
700
+ },
701
+ "@PersonalData.isPotentiallyPersonal": {
702
+ type: "boolean",
703
+ label: "DPP · Potentially Personal"
704
+ },
705
+ "@PersonalData.isPotentiallySensitive": {
706
+ type: "boolean",
707
+ label: "DPP · Potentially Sensitive"
708
+ },
709
+ "@Semantics.currencyCode": {
710
+ type: "boolean",
711
+ label: "Semantics · Currency Code"
712
+ },
713
+ "@Semantics.amount.currencyCode": {
714
+ type: "object",
715
+ label: "Semantics · Amount Currency"
716
+ },
717
+ "@Semantics.unitOfMeasure": {
718
+ type: "boolean",
719
+ label: "Semantics · Unit of Measure"
720
+ },
721
+ "@Semantics.quantity.unitOfMeasure": {
722
+ type: "object",
723
+ label: "Semantics · Quantity Unit"
724
+ },
725
+ "@Semantics.text": {
726
+ type: "boolean",
727
+ label: "Semantics · Text"
728
+ },
729
+ "@Semantics.uuid": {
730
+ type: "boolean",
731
+ label: "Semantics · UUID"
732
+ },
733
+ "@Semantics.language": {
734
+ type: "boolean",
735
+ label: "Semantics · Language"
736
+ },
737
+ "@API.element.releaseState": {
738
+ type: "string",
739
+ label: "API · Element Release State"
740
+ },
741
+ "@API.entity.releaseState": {
742
+ type: "string",
743
+ label: "API · Entity Release State"
744
+ },
745
+ "@ODM.entityName": {
746
+ type: "string",
747
+ label: "ODM · Entity Name"
748
+ },
749
+ "@ODM.oid": {
750
+ type: "string",
751
+ label: "ODM · OID"
752
+ },
753
+ "@ODM.oidReference.entityName": {
754
+ type: "string",
755
+ label: "ODM · OID Reference Entity"
756
+ },
757
+ "@Aggregation.default": {
758
+ type: "object",
759
+ label: "Default Aggregation"
760
+ },
761
+ "@EntityRelationship.entityType": {
762
+ type: "string",
763
+ label: "Entity Relationship · Type"
764
+ },
765
+ "@EntityRelationship.entityIds": {
766
+ type: "array",
767
+ label: "Entity Relationship · IDs"
768
+ },
769
+ "@EntityRelationship.propertyType": {
770
+ type: "string",
771
+ label: "Entity Relationship · Property Type"
772
+ },
773
+ "@EntityRelationship.compositeReferences": {
774
+ type: "array",
775
+ label: "Entity Relationship · Composite References"
776
+ },
777
+ "@EntityRelationship.reference": {
778
+ type: "array",
779
+ label: "Entity Relationship · Reference"
780
+ },
781
+ "@DataIntegration.dataUnavailable": {
782
+ type: "boolean",
783
+ label: "Data Integration · Unavailable"
784
+ }
785
+ }
786
+ };
787
+ //#endregion
788
+ export { A2ARenderer, AsyncApiRenderer, CsnRenderer, McpRenderer, MetadataRenderer, OpenApiRenderer, OverlayRenderer, createTheme, detectMetaType, extractVersion, loadObject, sapAsyncApiAttributesConfig, sapCsnAttributesConfig, sapOpenApiAttributesConfig };