@frankframework/doc-library-core 1.0.3 → 1.0.4

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.
@@ -1,32 +1,37 @@
1
- function h(r, e) {
1
+ function c(r, n) {
2
+ if (Object.keys(r).length === 0) return null;
3
+ const t = r[n] ?? Object.values(r).find((e) => e.className === n);
4
+ return t || null;
5
+ }
6
+ function d(r, n) {
2
7
  const t = {};
3
- for (const n of Object.values(r))
4
- if (n.enum) {
5
- const s = e[n.enum];
6
- s && !t[n.enum] && (t[n.enum] = s);
8
+ for (const e of Object.values(r))
9
+ if (e.enum) {
10
+ const s = n[e.enum];
11
+ s && !t[e.enum] && (t[e.enum] = s);
7
12
  }
8
13
  return t;
9
14
  }
10
- function d(r) {
15
+ function h(r) {
11
16
  return Object.entries(r).reduce(
12
- (e, [t, n]) => (e[n.mandatory === !0 ? "required" : "optional"][t] = n, e),
17
+ (n, [t, e]) => (n[e.mandatory === !0 ? "required" : "optional"][t] = e, n),
13
18
  { required: {}, optional: {} }
14
19
  );
15
20
  }
16
- function c(r, e, t) {
17
- const n = {
21
+ function m(r, n, t) {
22
+ const e = {
18
23
  attributesRequired: [],
19
24
  attributesOptional: [],
20
25
  forwards: {},
21
26
  enums: {},
22
27
  parentElements: []
23
28
  };
24
- if (!r.parent) return n;
25
- const s = e[r.parent];
26
- if (!s) return n;
27
- const i = c(s, e, t);
29
+ if (!r.parent) return e;
30
+ const s = n[r.parent];
31
+ if (!s) return e;
32
+ const i = m(s, n, t);
28
33
  if (i.parentElements.unshift(s.name), s.attributes) {
29
- const { required: l, optional: a } = d(
34
+ const { required: l, optional: a } = h(
30
35
  s.attributes
31
36
  );
32
37
  Object.values(l).length > 0 && i.attributesRequired.unshift({
@@ -35,62 +40,72 @@ function c(r, e, t) {
35
40
  }), Object.values(a).length > 0 && i.attributesOptional.unshift({
36
41
  parentElementName: s.name,
37
42
  properties: a
38
- }), i.enums = { ...i.enums, ...h(s.attributes, t) };
43
+ }), i.enums = { ...i.enums, ...d(s.attributes, t) };
39
44
  }
40
45
  return s.forwards && (i.forwards = { ...i.forwards, ...s.forwards }), i;
41
46
  }
42
- function p(r, e, t) {
43
- const n = c(r, e, t);
47
+ function b(r, n, t) {
48
+ const e = m(r, n, t);
44
49
  return {
45
50
  ...r,
46
- parentElements: n.parentElements,
51
+ parentElements: e.parentElements,
47
52
  attributes: {
48
- ...f(n.attributesOptional),
49
- ...f(n.attributesRequired),
53
+ ...f(e.attributesOptional),
54
+ ...f(e.attributesRequired),
50
55
  ...r.attributes
51
56
  },
52
- forwards: { ...n.forwards, ...r.forwards },
53
- enums: n.enums
57
+ forwards: { ...e.forwards, ...r.forwards },
58
+ enums: e.enums
54
59
  };
55
60
  }
56
61
  function f(r) {
57
- let e = {};
62
+ let n = {};
58
63
  for (const t of r)
59
- e = { ...t.properties, ...e };
60
- return e;
64
+ n = { ...t.properties, ...n };
65
+ return n;
66
+ }
67
+ function D(r, n, t) {
68
+ const e = n[r.type ?? ""];
69
+ if (!e)
70
+ return { ...r, implementedBy: null };
71
+ const s = e.map((i) => c(t, i)).filter((i) => i !== null);
72
+ return {
73
+ ...r,
74
+ implementedBy: s
75
+ };
61
76
  }
62
- class b {
63
- getFiltersFromLabels(e) {
77
+ class g {
78
+ getFiltersFromLabels(n) {
64
79
  const t = {};
65
- for (const [n, s] of Object.entries(e)) {
66
- t[n] = {};
80
+ for (const [e, s] of Object.entries(n)) {
81
+ t[e] = {};
67
82
  for (const i of s)
68
- t[n][i] = [];
83
+ t[e][i] = [];
69
84
  }
70
85
  return t;
71
86
  }
72
- assignFrankDocElementsToFilters(e, t) {
73
- for (const [n, s] of Object.entries(t))
87
+ assignFrankDocElementsToFilters(n, t) {
88
+ for (const [e, s] of Object.entries(t))
74
89
  for (const i in s.labels) {
75
90
  const l = s.labels[i];
76
- !e[i] || !e[i][l] || e[i][l].push(n);
91
+ !n[i] || !n[i][l] || n[i][l].push(e);
77
92
  }
78
- return e;
93
+ return n;
79
94
  }
80
- getXMLElements(e) {
95
+ getXMLElements(n) {
81
96
  const t = {};
82
- for (const [n, s] of Object.entries(e.elementNames)) {
83
- const i = e.elements[s.className];
84
- t[n] = {
85
- ...p(i, e.elements, e.enums),
97
+ for (const [e, s] of Object.entries(n.elementNames)) {
98
+ const i = n.elements[s.className];
99
+ t[e] = {
100
+ ...b(i, n.elements, n.enums),
86
101
  ...s,
87
- name: n
102
+ name: e
88
103
  };
89
104
  }
90
105
  return t;
91
106
  }
92
107
  }
93
- class D extends b {
108
+ class F extends g {
94
109
  constructor() {
95
110
  super(...arguments), this._ffDoc = null, this._elements = null, this._filters = {};
96
111
  }
@@ -103,77 +118,74 @@ class D extends b {
103
118
  get filters() {
104
119
  return this._filters;
105
120
  }
106
- async initialize(e) {
107
- const t = await this.fetchJson(e);
121
+ async initialize(n) {
122
+ const t = await this.fetchJson(n);
108
123
  this._ffDoc = t, this._filters = this.assignFrankDocElementsToFilters(
109
124
  this.getFiltersFromLabels(t.labels),
110
125
  t.elementNames
111
126
  ), this._elements = this.getXMLElements(t);
112
127
  }
113
- async fetchJson(e) {
114
- return await (await fetch(e)).json();
128
+ async fetchJson(n) {
129
+ return await (await fetch(n)).json();
115
130
  }
116
131
  }
117
- const m = /\[([^\]]+)]\(([^)]+)\)/g, g = /<[^>]*>?/gm, o = /(?:{@link\s(.*?)})/g;
118
- function F(r, e, t) {
119
- let n = r.replaceAll(m, '<a target="_blank" href="$2" alt="$1">$1</a>').replaceAll(String.raw`\"`, '"');
120
- return t ? O(n, e) : (n = n.replaceAll(o, (s, i) => {
121
- const l = u(i, e);
122
- return l.href ? x(l) : l.text;
123
- }), [n]);
132
+ const p = /\[([^\]]+)]\(([^)]+)\)/g, x = /<[^>]*>?/gm, o = /(?:{@link\s(.*?)})/g;
133
+ function N(r, n, t) {
134
+ let e = r.replaceAll(p, '<a target="_blank" href="$2" alt="$1">$1</a>').replaceAll(String.raw`\"`, '"');
135
+ return t ? E(e, n) : (e = e.replaceAll(o, (s, i) => {
136
+ const l = u(i, n);
137
+ return l.href ? O(l) : l.text;
138
+ }), [e]);
124
139
  }
125
- function P(r, e) {
126
- return [r.replaceAll(m, "$1($2)").replaceAll(g, "").replaceAll(o, (n, s) => u(s, e).text).replaceAll(String.raw`\"`, '"')];
140
+ function P(r, n) {
141
+ return [r.replaceAll(p, "$1($2)").replaceAll(x, "").replaceAll(o, (e, s) => u(s, n).text).replaceAll(String.raw`\"`, '"')];
127
142
  }
128
- function x(r) {
143
+ function O(r) {
129
144
  return `<a href="#/${r.href}">${r.text}</a>`;
130
145
  }
131
- function u(r, e) {
132
- const t = r.indexOf("#"), n = t !== -1, s = n ? r.split("#")[0] : r;
146
+ function u(r, n) {
147
+ const t = r.indexOf("#"), e = t !== -1, s = e ? r.split("#")[0] : r;
133
148
  if (s === "")
134
- return { text: E(r, t) };
135
- const i = s.split(" "), l = w(i, n, r), a = k(e, i[0]);
136
- return a ? { href: a.className, text: l, element: a } : { text: l };
149
+ return { text: w(r, t) };
150
+ const i = s.split(" "), l = k(i, e, r), a = c(n, i[0]);
151
+ return a ? { href: a.className, text: l, element: a } : (console.warn(`could not find element [${l}]`), { text: l });
137
152
  }
138
- function O(r, e) {
153
+ function E(r, n) {
139
154
  const t = [];
140
- let n = 0;
155
+ let e = 0;
141
156
  for (const s of r.matchAll(o)) {
142
- const [i, l] = s, a = u(l, e);
143
- t.push(r.slice(n, s.index), a.href ? a : a.text), n = s.index + i.length;
157
+ const [i, l] = s, a = u(l, n);
158
+ t.push(r.slice(e, s.index), a.href ? a : a.text), e = s.index + i.length;
144
159
  }
145
- return n < r.length - 1 && t.push(r.slice(n)), t;
160
+ return e < r.length - 1 && t.push(r.slice(e)), t;
146
161
  }
147
- function E(r, e) {
148
- const t = r.slice(e), n = t.split(" ");
149
- return n.length === 2 ? n[1] : t.slice(1, t.indexOf("("));
162
+ function w(r, n) {
163
+ const t = r.slice(n), e = t.split(" ");
164
+ return e.length === 2 ? e[1] : t.slice(1, t.indexOf("("));
150
165
  }
151
- function w(r, e, t) {
152
- const n = r.at(-1);
153
- if (e) {
166
+ function k(r, n, t) {
167
+ const e = r.at(-1);
168
+ if (n) {
154
169
  const s = t.split("#")[1], i = s.slice(s.indexOf(") ") + 1).trim();
155
- return i.includes(" ") ? s.split(" ")[1] : `${n}.${i}`;
170
+ return i.includes(" ") ? s.split(" ")[1] : `${e}.${i}`;
156
171
  }
157
- return n;
158
- }
159
- function k(r, e) {
160
- if (Object.keys(r).length === 0) return null;
161
- const t = r[e] ?? Object.values(r).find((n) => n.className === e);
162
- return t || (console.warn(`could not find element [${e}]`), null);
172
+ return e;
163
173
  }
164
174
  export {
165
- D as FFDoc,
166
- b as FFDocBase,
167
- p as addInheritedPropertiesToElement,
168
- x as defaultLinkTransformation,
175
+ F as FFDoc,
176
+ g as FFDocBase,
177
+ b as addInheritedPropertiesToElement,
178
+ O as defaultLinkTransformation,
179
+ c as findElement,
169
180
  f as flattenInheritedParentElementProperties,
170
- c as getInheritedProperties,
181
+ m as getInheritedProperties,
171
182
  u as getLinkData,
172
- d as groupAttributesByMandatory,
183
+ h as groupAttributesByMandatory,
173
184
  o as linkRegex,
174
- m as markdownLinkRegex,
175
- g as tagsRegex,
176
- F as transformAsHtml,
185
+ p as markdownLinkRegex,
186
+ D as resolveInterfaceChildren,
187
+ x as tagsRegex,
188
+ N as transformAsHtml,
177
189
  P as transformAsText
178
190
  };
179
191
  //# sourceMappingURL=doc-library-core.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"doc-library-core.js","sources":["../src/frankdoc.utilities.ts","../src/ff-doc-base.ts","../src/ff-doc.ts","../src/javadoc.ts"],"sourcesContent":["import { Attribute, ElementClass, ElementProperty, EnumValue, FFDocJson } from './frankdoc.types';\n\nexport type InheritedParentElementProperties<T> = {\n parentElementName: string;\n properties: Record<string, T>;\n};\n\ntype InheritedPropertiesExtras = {\n enums: Record<string, EnumValue>;\n parentElements: string[];\n};\n\nexport type InheritedProperties = {\n attributesRequired: InheritedParentElementProperties<Attribute>[];\n attributesOptional: InheritedParentElementProperties<Attribute>[];\n forwards: Record<string, ElementProperty>;\n} & InheritedPropertiesExtras;\n\nexport type ElementClassWithInheritedProperties = ElementClass & InheritedPropertiesExtras;\n\nfunction filterUsedEnums(attributes: Record<string, Attribute>, enums: FFDocJson['enums']): Record<string, EnumValue> {\n const filteredEnums: Record<string, EnumValue> = {};\n for (const attribute of Object.values(attributes)) {\n if (attribute.enum) {\n const enumType = enums[attribute.enum];\n if (enumType && !filteredEnums[attribute.enum]) filteredEnums[attribute.enum] = enumType;\n }\n }\n return filteredEnums;\n}\n\nexport function groupAttributesByMandatory(attributes: Record<string, Attribute>): {\n required: Record<string, Attribute>;\n optional: Record<string, Attribute>;\n} {\n return Object.entries(attributes).reduce<{\n required: Record<string, Attribute>;\n optional: Record<string, Attribute>;\n }>(\n (collection, [name, attribute]) => {\n collection[attribute.mandatory === true ? 'required' : 'optional'][name] = attribute;\n return collection;\n },\n { required: {}, optional: {} },\n );\n}\n\nexport function getInheritedProperties(\n element: ElementClass,\n elements: FFDocJson['elements'],\n enums: FFDocJson['enums'],\n): InheritedProperties {\n const initialInheritedProperties: InheritedProperties = {\n attributesRequired: [],\n attributesOptional: [],\n forwards: {},\n enums: {},\n parentElements: [],\n };\n\n if (!element.parent) return initialInheritedProperties;\n const parentElement = elements[element.parent];\n if (!parentElement) return initialInheritedProperties;\n const inheritedProperties = getInheritedProperties(parentElement, elements, enums);\n inheritedProperties.parentElements.unshift(parentElement.name);\n\n if (parentElement.attributes) {\n // ES2024 has the Object.groupBy function which could make this a lot better\n const { required: attributesRequired, optional: attributesOptional } = groupAttributesByMandatory(\n parentElement.attributes,\n );\n if (Object.values(attributesRequired).length > 0) {\n inheritedProperties.attributesRequired.unshift({\n parentElementName: parentElement.name,\n properties: attributesRequired,\n });\n }\n if (Object.values(attributesOptional).length > 0) {\n inheritedProperties.attributesOptional.unshift({\n parentElementName: parentElement.name,\n properties: attributesOptional,\n });\n }\n inheritedProperties.enums = { ...inheritedProperties.enums, ...filterUsedEnums(parentElement.attributes, enums) };\n }\n\n if (parentElement.forwards)\n inheritedProperties.forwards = { ...inheritedProperties.forwards, ...parentElement.forwards };\n\n return inheritedProperties;\n}\n\nexport function addInheritedPropertiesToElement(\n element: ElementClass,\n elements: FFDocJson['elements'],\n enums: FFDocJson['enums'],\n): ElementClassWithInheritedProperties {\n const inheritedProperties = getInheritedProperties(element, elements, enums);\n return {\n ...element,\n parentElements: inheritedProperties.parentElements,\n attributes: {\n ...flattenInheritedParentElementProperties(inheritedProperties.attributesOptional),\n ...flattenInheritedParentElementProperties(inheritedProperties.attributesRequired),\n ...element.attributes,\n },\n forwards: { ...inheritedProperties.forwards, ...element.forwards },\n enums: inheritedProperties.enums,\n };\n}\n\nexport function flattenInheritedParentElementProperties<T>(\n inheritedProperties: InheritedParentElementProperties<T>[],\n): Record<string, T> {\n let flattenedProperties: Record<string, T> = {};\n for (const inheritedProperty of inheritedProperties) {\n flattenedProperties = { ...inheritedProperty.properties, ...flattenedProperties };\n }\n return flattenedProperties;\n}\n","import { ElementInfo, FFDocJson } from './frankdoc.types';\nimport { addInheritedPropertiesToElement, ElementClassWithInheritedProperties } from './frankdoc.utilities';\n\nexport type Filters = Record<string, FilterLabels>;\nexport type FilterLabels = Record<string, string[]>;\nexport type Elements = Record<string, ElementDetails>;\nexport type ElementDetails = ElementClassWithInheritedProperties & ElementInfo;\n\nexport abstract class FFDocBase {\n protected getFiltersFromLabels(labels: FFDocJson['labels']): Filters {\n const filters: Filters = {};\n for (const [filterGroup, filterLabels] of Object.entries(labels)) {\n filters[filterGroup] = {};\n for (const label of filterLabels) {\n filters[filterGroup][label] = [];\n }\n }\n return filters;\n }\n\n protected assignFrankDocElementsToFilters(filters: Filters, elements: FFDocJson['elementNames']): Filters {\n for (const [elementName, element] of Object.entries(elements)) {\n for (const elementFilterGroup in element.labels) {\n const elementFilterLabel = element.labels[elementFilterGroup];\n if (!filters[elementFilterGroup] || !filters[elementFilterGroup][elementFilterLabel]) continue;\n filters[elementFilterGroup][elementFilterLabel].push(elementName);\n }\n }\n return filters;\n }\n\n protected getXMLElements(json: FFDocJson): Elements {\n const elements: Elements = {};\n\n /* instead of looping over every xml element,\n * maybe parent elements already processed should be used as cache in order to reduce the number of loops\n */\n for (const [elementName, elementValue] of Object.entries(json.elementNames)) {\n const elementClassData = json.elements[elementValue.className];\n elements[elementName] = {\n ...addInheritedPropertiesToElement(elementClassData, json.elements, json.enums),\n ...elementValue,\n name: elementName,\n };\n }\n return elements;\n }\n}\n","import { FFDocJson } from './frankdoc.types';\nimport { Elements, FFDocBase, Filters } from './ff-doc-base';\n\nexport class FFDoc extends FFDocBase {\n private _ffDoc: FFDocJson | null = null;\n private _elements: Elements | null = null;\n private _filters: Filters = {};\n\n get ffDoc(): Readonly<FFDocJson | null> {\n return this._ffDoc;\n }\n\n get elements(): Readonly<Elements | null> {\n return this._elements;\n }\n\n get filters(): Readonly<Filters> {\n return this._filters;\n }\n\n async initialize(jsonUrl: string): Promise<void> {\n const ffDocJson = await this.fetchJson(jsonUrl);\n this._ffDoc = ffDocJson;\n this._filters = this.assignFrankDocElementsToFilters(\n this.getFiltersFromLabels(ffDocJson.labels),\n ffDocJson.elementNames,\n );\n this._elements = this.getXMLElements(ffDocJson);\n }\n\n private async fetchJson(url: string): Promise<FFDocJson> {\n const response = await fetch(url);\n return await response.json();\n }\n}\n","import { ElementClass, ElementInfo } from './frankdoc.types';\n\nexport type ElementsWithInfo = ElementClass & ElementInfo;\nexport type LinkData = {\n text: string;\n href?: string;\n element?: ElementsWithInfo;\n};\ntype TransformedJavadocPart = string | LinkData;\nexport type TransformedJavadoc = TransformedJavadocPart[];\n\n// eslint-disable-next-line sonarjs/slow-regex\nexport const markdownLinkRegex = /\\[([^\\]]+)]\\(([^)]+)\\)/g; // old regex: /\\[(.*?)\\]\\((.+?)\\)/g\nexport const tagsRegex = /<[^>]*>?/gm;\nexport const linkRegex = /(?:{@link\\s(.*?)})/g;\n\nexport function transformAsHtml(\n javadoc: string,\n elements: Record<string, ElementsWithInfo>,\n hasCustomLinkTransform: boolean,\n): TransformedJavadoc {\n let transformed = javadoc\n .replaceAll(markdownLinkRegex, '<a target=\"_blank\" href=\"$2\" alt=\"$1\">$1</a>')\n .replaceAll(String.raw`\\\"`, '\"');\n\n if (hasCustomLinkTransform) {\n return transformAsCustomHtml(transformed, elements);\n }\n\n transformed = transformed.replaceAll(linkRegex, (_, captureGroup) => {\n const linkData = getLinkData(captureGroup, elements);\n if (linkData.href) return defaultLinkTransformation(linkData);\n return linkData.text;\n });\n return [transformed];\n}\n\nexport function transformAsText(javadoc: string, elements: Record<string, ElementsWithInfo>): TransformedJavadoc {\n const text = javadoc\n .replaceAll(markdownLinkRegex, '$1($2)')\n .replaceAll(tagsRegex, '')\n .replaceAll(linkRegex, (_: string, captureGroup: string) => {\n const linkData = getLinkData(captureGroup, elements);\n return linkData.text;\n })\n .replaceAll(String.raw`\\\"`, '\"');\n return [text];\n}\n\nexport function defaultLinkTransformation(linkData: LinkData): string {\n return `<a href=\"#/${linkData.href}\">${linkData.text}</a>`;\n}\n\n/**\n * Creates LinkData object from `@link` taglet's data\n * @param captureGroup cature group received from regex matching with the `@link` taglet,\n * e.g. 'PipeLineSession pipeLineSession' for `{@link PipeLineSession pipeLineSession}`\n * @param elements\n */\nexport function getLinkData(captureGroup: string, elements: Record<string, ElementsWithInfo>): LinkData {\n const hashPosition = captureGroup.indexOf('#'),\n isMethod = hashPosition !== -1,\n elementString = isMethod ? captureGroup.split('#')[0] : captureGroup;\n\n if (elementString === '') {\n return { text: getInternalMethodReference(captureGroup, hashPosition) };\n }\n\n const elementParts = elementString.split(' '); //first part is the class name, 2nd part the written name\n const name = parseLinkName(elementParts, isMethod, captureGroup);\n\n const element = findElement(elements, elementParts[0]);\n if (!element) return { text: name };\n return { href: element.className, text: name, element };\n}\n\nfunction transformAsCustomHtml(javadoc: string, elements: Record<string, ElementsWithInfo>): TransformedJavadoc {\n const transformedParts: TransformedJavadocPart[] = [];\n let lastIndex = 0;\n for (const match of javadoc.matchAll(linkRegex)) {\n const [string, captureGroup] = match;\n const linkData = getLinkData(captureGroup, elements);\n transformedParts.push(javadoc.slice(lastIndex, match.index), linkData.href ? linkData : linkData.text);\n lastIndex = match.index + string.length;\n }\n if (lastIndex < javadoc.length - 1) transformedParts.push(javadoc.slice(lastIndex));\n return transformedParts;\n}\n\n/** Handle links to internal class methods */\nfunction getInternalMethodReference(captureGroup: string, hashPosition: number): string {\n const method = captureGroup.slice(hashPosition),\n methodParts = method.split(' ');\n return methodParts.length === 2\n ? methodParts[1] // 'methodName label' -> 'label'\n : method.slice(1, method.indexOf('('));\n}\n\nfunction parseLinkName(elementParts: string[], isMethod: boolean, captureGroup: string): string {\n const elementName = elementParts.at(-1)!; // element name/label\n if (isMethod) {\n const method = captureGroup.split('#')[1],\n methodNameOrLabel = method.slice(method.indexOf(') ') + 1).trim();\n return methodNameOrLabel.includes(' ') ? method.split(' ')[1] : `${elementName}.${methodNameOrLabel}`;\n }\n return elementName;\n}\n\nfunction findElement(elements: Record<string, ElementsWithInfo>, name: string): ElementsWithInfo | null {\n if (Object.keys(elements).length === 0) return null;\n const element = elements[name] ?? Object.values(elements).find((element) => element.className === name);\n if (element) return element;\n\n console.warn(`could not find element [${name}]`);\n return null;\n}\n"],"names":["filterUsedEnums","attributes","enums","filteredEnums","attribute","enumType","groupAttributesByMandatory","collection","name","getInheritedProperties","element","elements","initialInheritedProperties","parentElement","inheritedProperties","attributesRequired","attributesOptional","addInheritedPropertiesToElement","flattenInheritedParentElementProperties","flattenedProperties","inheritedProperty","FFDocBase","labels","filters","filterGroup","filterLabels","label","elementName","elementFilterGroup","elementFilterLabel","json","elementValue","elementClassData","FFDoc","jsonUrl","ffDocJson","url","markdownLinkRegex","tagsRegex","linkRegex","transformAsHtml","javadoc","hasCustomLinkTransform","transformed","transformAsCustomHtml","_","captureGroup","linkData","getLinkData","defaultLinkTransformation","transformAsText","hashPosition","isMethod","elementString","getInternalMethodReference","elementParts","parseLinkName","findElement","transformedParts","lastIndex","match","string","method","methodParts","methodNameOrLabel"],"mappings":"AAoBA,SAASA,EAAgBC,GAAuCC,GAAsD;AACpH,QAAMC,IAA2C,CAAA;AACjD,aAAWC,KAAa,OAAO,OAAOH,CAAU;AAC9C,QAAIG,EAAU,MAAM;AAClB,YAAMC,IAAWH,EAAME,EAAU,IAAI;AACrC,MAAIC,KAAY,CAACF,EAAcC,EAAU,IAAI,MAAGD,EAAcC,EAAU,IAAI,IAAIC;AAAA,IAClF;AAEF,SAAOF;AACT;AAEO,SAASG,EAA2BL,GAGzC;AACA,SAAO,OAAO,QAAQA,CAAU,EAAE;AAAA,IAIhC,CAACM,GAAY,CAACC,GAAMJ,CAAS,OAC3BG,EAAWH,EAAU,cAAc,KAAO,aAAa,UAAU,EAAEI,CAAI,IAAIJ,GACpEG;AAAA,IAET,EAAE,UAAU,IAAI,UAAU,CAAA,EAAC;AAAA,EAAE;AAEjC;AAEO,SAASE,EACdC,GACAC,GACAT,GACqB;AACrB,QAAMU,IAAkD;AAAA,IACtD,oBAAoB,CAAA;AAAA,IACpB,oBAAoB,CAAA;AAAA,IACpB,UAAU,CAAA;AAAA,IACV,OAAO,CAAA;AAAA,IACP,gBAAgB,CAAA;AAAA,EAAC;AAGnB,MAAI,CAACF,EAAQ,OAAQ,QAAOE;AAC5B,QAAMC,IAAgBF,EAASD,EAAQ,MAAM;AAC7C,MAAI,CAACG,EAAe,QAAOD;AAC3B,QAAME,IAAsBL,EAAuBI,GAAeF,GAAUT,CAAK;AAGjF,MAFAY,EAAoB,eAAe,QAAQD,EAAc,IAAI,GAEzDA,EAAc,YAAY;AAE5B,UAAM,EAAE,UAAUE,GAAoB,UAAUC,MAAuBV;AAAA,MACrEO,EAAc;AAAA,IAAA;AAEhB,IAAI,OAAO,OAAOE,CAAkB,EAAE,SAAS,KAC7CD,EAAoB,mBAAmB,QAAQ;AAAA,MAC7C,mBAAmBD,EAA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EAASH,CAAI,KAAK,OAAO,OAAOG,CAAQ,EAAE,KAAK,CAACD,MAAYA,EAAQ,cAAcF,CAAI;AACtG,SAAIE,MAEJ,QAAQ,KAAK,2BAA2BF,CAAI,GAAG,GACxC;AACT;"}
1
+ {"version":3,"file":"doc-library-core.js","sources":["../src/frankdoc.utilities.ts","../src/ff-doc-base.ts","../src/ff-doc.ts","../src/javadoc.ts"],"sourcesContent":["import { Attribute, Child, ElementClass, ElementProperty, EnumValue, FFDocJson } from './frankdoc.types';\nimport { ElementWithInfo } from './ff-doc-base';\n\ntype InheritedPropertiesExtras = {\n enums: Record<string, EnumValue>;\n parentElements: string[];\n};\n\nexport type InheritedParentElementProperties<T> = {\n parentElementName: string;\n properties: Record<string, T>;\n};\n\nexport type InheritedProperties = {\n attributesRequired: InheritedParentElementProperties<Attribute>[];\n attributesOptional: InheritedParentElementProperties<Attribute>[];\n forwards: Record<string, ElementProperty>;\n} & InheritedPropertiesExtras;\n\nexport type ElementClassWithInheritedProperties = ElementClass & InheritedPropertiesExtras;\n\nexport type ResolvedChild = Child & {\n implementedBy: ElementWithInfo[] | null;\n};\n\nexport function findElement(elements: Record<string, ElementWithInfo>, name: string): ElementWithInfo | null {\n if (Object.keys(elements).length === 0) return null;\n const element = elements[name] ?? Object.values(elements).find((element) => element.className === name);\n if (element) return element;\n\n return null;\n}\n\nfunction filterUsedEnums(attributes: Record<string, Attribute>, enums: FFDocJson['enums']): Record<string, EnumValue> {\n const filteredEnums: Record<string, EnumValue> = {};\n for (const attribute of Object.values(attributes)) {\n if (attribute.enum) {\n const enumType = enums[attribute.enum];\n if (enumType && !filteredEnums[attribute.enum]) filteredEnums[attribute.enum] = enumType;\n }\n }\n return filteredEnums;\n}\n\nexport function groupAttributesByMandatory(attributes: Record<string, Attribute>): {\n required: Record<string, Attribute>;\n optional: Record<string, Attribute>;\n} {\n return Object.entries(attributes).reduce<{\n required: Record<string, Attribute>;\n optional: Record<string, Attribute>;\n }>(\n (collection, [name, attribute]) => {\n collection[attribute.mandatory === true ? 'required' : 'optional'][name] = attribute;\n return collection;\n },\n { required: {}, optional: {} },\n );\n}\n\nexport function getInheritedProperties(\n element: ElementClass,\n elements: FFDocJson['elements'],\n enums: FFDocJson['enums'],\n): InheritedProperties {\n const initialInheritedProperties: InheritedProperties = {\n attributesRequired: [],\n attributesOptional: [],\n forwards: {},\n enums: {},\n parentElements: [],\n };\n\n if (!element.parent) return initialInheritedProperties;\n const parentElement = elements[element.parent];\n if (!parentElement) return initialInheritedProperties;\n const inheritedProperties = getInheritedProperties(parentElement, elements, enums);\n inheritedProperties.parentElements.unshift(parentElement.name);\n\n if (parentElement.attributes) {\n // ES2024 has the Object.groupBy function which could make this a lot better\n const { required: attributesRequired, optional: attributesOptional } = groupAttributesByMandatory(\n parentElement.attributes,\n );\n if (Object.values(attributesRequired).length > 0) {\n inheritedProperties.attributesRequired.unshift({\n parentElementName: parentElement.name,\n properties: attributesRequired,\n });\n }\n if (Object.values(attributesOptional).length > 0) {\n inheritedProperties.attributesOptional.unshift({\n parentElementName: parentElement.name,\n properties: attributesOptional,\n });\n }\n inheritedProperties.enums = { ...inheritedProperties.enums, ...filterUsedEnums(parentElement.attributes, enums) };\n }\n\n if (parentElement.forwards)\n inheritedProperties.forwards = { ...inheritedProperties.forwards, ...parentElement.forwards };\n\n return inheritedProperties;\n}\n\nexport function addInheritedPropertiesToElement(\n element: ElementClass,\n elements: FFDocJson['elements'],\n enums: FFDocJson['enums'],\n): ElementClassWithInheritedProperties {\n const inheritedProperties = getInheritedProperties(element, elements, enums);\n return {\n ...element,\n parentElements: inheritedProperties.parentElements,\n attributes: {\n ...flattenInheritedParentElementProperties(inheritedProperties.attributesOptional),\n ...flattenInheritedParentElementProperties(inheritedProperties.attributesRequired),\n ...element.attributes,\n },\n forwards: { ...inheritedProperties.forwards, ...element.forwards },\n enums: inheritedProperties.enums,\n };\n}\n\nexport function flattenInheritedParentElementProperties<T>(\n inheritedProperties: InheritedParentElementProperties<T>[],\n): Record<string, T> {\n let flattenedProperties: Record<string, T> = {};\n for (const inheritedProperty of inheritedProperties) {\n flattenedProperties = { ...inheritedProperty.properties, ...flattenedProperties };\n }\n return flattenedProperties;\n}\n\nexport function resolveInterfaceChildren(\n child: Child,\n types: FFDocJson['types'],\n elements: Record<string, ElementWithInfo>,\n): ResolvedChild {\n const implementedByClassNames = types[child.type ?? ''];\n if (!implementedByClassNames) {\n return { ...child, implementedBy: null };\n }\n\n const implementedBy = implementedByClassNames\n .map((className) => findElement(elements, className))\n .filter((element): element is ElementWithInfo => element !== null);\n return {\n ...child,\n implementedBy,\n };\n}\n","import { ElementClass, ElementInfo, FFDocJson } from './frankdoc.types';\nimport { addInheritedPropertiesToElement, ElementClassWithInheritedProperties } from './frankdoc.utilities';\n\nexport type Filters = Record<string, FilterLabels>;\nexport type FilterLabels = Record<string, string[]>;\nexport type Elements = Record<string, ElementDetails>;\nexport type ElementDetails = ElementClassWithInheritedProperties & ElementInfo;\nexport type ElementWithInfo = ElementClass & ElementInfo;\n\nexport abstract class FFDocBase {\n protected getFiltersFromLabels(labels: FFDocJson['labels']): Filters {\n const filters: Filters = {};\n for (const [filterGroup, filterLabels] of Object.entries(labels)) {\n filters[filterGroup] = {};\n for (const label of filterLabels) {\n filters[filterGroup][label] = [];\n }\n }\n return filters;\n }\n\n protected assignFrankDocElementsToFilters(filters: Filters, elements: FFDocJson['elementNames']): Filters {\n for (const [elementName, element] of Object.entries(elements)) {\n for (const elementFilterGroup in element.labels) {\n const elementFilterLabel = element.labels[elementFilterGroup];\n if (!filters[elementFilterGroup] || !filters[elementFilterGroup][elementFilterLabel]) continue;\n filters[elementFilterGroup][elementFilterLabel].push(elementName);\n }\n }\n return filters;\n }\n\n protected getXMLElements(json: FFDocJson): Elements {\n const elements: Elements = {};\n\n /* instead of looping over every xml element,\n * maybe parent elements already processed should be used as cache in order to reduce the number of loops\n */\n for (const [elementName, elementValue] of Object.entries(json.elementNames)) {\n const elementClassData = json.elements[elementValue.className];\n elements[elementName] = {\n ...addInheritedPropertiesToElement(elementClassData, json.elements, json.enums),\n ...elementValue,\n name: elementName,\n };\n }\n return elements;\n }\n}\n","import { FFDocJson } from './frankdoc.types';\nimport { Elements, FFDocBase, Filters } from './ff-doc-base';\n\nexport class FFDoc extends FFDocBase {\n private _ffDoc: FFDocJson | null = null;\n private _elements: Elements | null = null;\n private _filters: Filters = {};\n\n get ffDoc(): Readonly<FFDocJson | null> {\n return this._ffDoc;\n }\n\n get elements(): Readonly<Elements | null> {\n return this._elements;\n }\n\n get filters(): Readonly<Filters> {\n return this._filters;\n }\n\n async initialize(jsonUrl: string): Promise<void> {\n const ffDocJson = await this.fetchJson(jsonUrl);\n this._ffDoc = ffDocJson;\n this._filters = this.assignFrankDocElementsToFilters(\n this.getFiltersFromLabels(ffDocJson.labels),\n ffDocJson.elementNames,\n );\n this._elements = this.getXMLElements(ffDocJson);\n }\n\n private async fetchJson(url: string): Promise<FFDocJson> {\n const response = await fetch(url);\n return await response.json();\n }\n}\n","import { findElement } from './frankdoc.utilities';\nimport { ElementWithInfo } from './ff-doc-base';\n\nexport type LinkData = {\n text: string;\n href?: string;\n element?: ElementWithInfo;\n};\ntype TransformedJavadocPart = string | LinkData;\nexport type TransformedJavadoc = TransformedJavadocPart[];\n\n// eslint-disable-next-line sonarjs/slow-regex\nexport const markdownLinkRegex = /\\[([^\\]]+)]\\(([^)]+)\\)/g; // old regex: /\\[(.*?)\\]\\((.+?)\\)/g\nexport const tagsRegex = /<[^>]*>?/gm;\nexport const linkRegex = /(?:{@link\\s(.*?)})/g;\n\nexport function transformAsHtml(\n javadoc: string,\n elements: Record<string, ElementWithInfo>,\n hasCustomLinkTransform: boolean,\n): TransformedJavadoc {\n let transformed = javadoc\n .replaceAll(markdownLinkRegex, '<a target=\"_blank\" href=\"$2\" alt=\"$1\">$1</a>')\n .replaceAll(String.raw`\\\"`, '\"');\n\n if (hasCustomLinkTransform) {\n return transformAsCustomHtml(transformed, elements);\n }\n\n transformed = transformed.replaceAll(linkRegex, (_, captureGroup) => {\n const linkData = getLinkData(captureGroup, elements);\n if (linkData.href) return defaultLinkTransformation(linkData);\n return linkData.text;\n });\n return [transformed];\n}\n\nexport function transformAsText(javadoc: string, elements: Record<string, ElementWithInfo>): TransformedJavadoc {\n const text = javadoc\n .replaceAll(markdownLinkRegex, '$1($2)')\n .replaceAll(tagsRegex, '')\n .replaceAll(linkRegex, (_: string, captureGroup: string) => {\n const linkData = getLinkData(captureGroup, elements);\n return linkData.text;\n })\n .replaceAll(String.raw`\\\"`, '\"');\n return [text];\n}\n\nexport function defaultLinkTransformation(linkData: LinkData): string {\n return `<a href=\"#/${linkData.href}\">${linkData.text}</a>`;\n}\n\n/**\n * Creates LinkData object from `@link` taglet's data\n * @param captureGroup cature group received from regex matching with the `@link` taglet,\n * e.g. 'PipeLineSession pipeLineSession' for `{@link PipeLineSession pipeLineSession}`\n * @param elements\n */\nexport function getLinkData(captureGroup: string, elements: Record<string, ElementWithInfo>): LinkData {\n const hashPosition = captureGroup.indexOf('#'),\n isMethod = hashPosition !== -1,\n elementString = isMethod ? captureGroup.split('#')[0] : captureGroup;\n\n if (elementString === '') {\n return { text: getInternalMethodReference(captureGroup, hashPosition) };\n }\n\n const elementParts = elementString.split(' '); //first part is the class name, 2nd part the written name\n const name = parseLinkName(elementParts, isMethod, captureGroup);\n\n const element = findElement(elements, elementParts[0]);\n if (!element) {\n console.warn(`could not find element [${name}]`);\n return { text: name };\n }\n return { href: element.className, text: name, element };\n}\n\nfunction transformAsCustomHtml(javadoc: string, elements: Record<string, ElementWithInfo>): TransformedJavadoc {\n const transformedParts: TransformedJavadocPart[] = [];\n let lastIndex = 0;\n for (const match of javadoc.matchAll(linkRegex)) {\n const [string, captureGroup] = match;\n const linkData = getLinkData(captureGroup, elements);\n transformedParts.push(javadoc.slice(lastIndex, match.index), linkData.href ? linkData : linkData.text);\n lastIndex = match.index + string.length;\n }\n if (lastIndex < javadoc.length - 1) transformedParts.push(javadoc.slice(lastIndex));\n return transformedParts;\n}\n\n/** Handle links to internal class methods */\nfunction getInternalMethodReference(captureGroup: string, hashPosition: number): string {\n const method = captureGroup.slice(hashPosition),\n methodParts = method.split(' ');\n return methodParts.length === 2\n ? methodParts[1] // 'methodName label' -> 'label'\n : method.slice(1, method.indexOf('('));\n}\n\nfunction parseLinkName(elementParts: string[], isMethod: boolean, captureGroup: string): string {\n const elementName = elementParts.at(-1)!; // element name/label\n if (isMethod) {\n const method = captureGroup.split('#')[1],\n methodNameOrLabel = method.slice(method.indexOf(') ') + 1).trim();\n return methodNameOrLabel.includes(' ') ? method.split(' ')[1] : `${elementName}.${methodNameOrLabel}`;\n }\n return elementName;\n}\n"],"names":["findElement","elements","name","element","filterUsedEnums","attributes","enums","filteredEnums","attribute","enumType","groupAttributesByMandatory","collection","getInheritedProperties","initialInheritedProperties","parentElement","inheritedProperties","attributesRequired","attributesOptional","addInheritedPropertiesToElement","flattenInheritedParentElementProperties","flattenedProperties","inheritedProperty","resolveInterfaceChildren","child","types","implementedByClassNames","implementedBy","className","FFDocBase","labels","filters","filterGroup","filterLabels","label","elementName","elementFilterGroup","elementFilterLabel","json","elementValue","elementClassData","FFDoc","jsonUrl","ffDocJson","url","markdownLinkRegex","tagsRegex","linkRegex","transformAsHtml","javadoc","hasCustomLinkTransform","transformed","transformAsCustomHtml","_","captureGroup","linkData","getLinkData","defaultLinkTransformation","transformAsText","hashPosition","isMethod","elementString","getInternalMethodReference","elementParts","parseLinkName","transformedParts","lastIndex","match","string","method","methodParts","methodNameOrLabel"],"mappings":"AAyBO,SAASA,EAAYC,GAA2CC,GAAsC;AAC3G,MAAI,OAAO,KAAKD,CAAQ,EAAE,WAAW,EAAG,QAAO;AAC/C,QAAME,IAAUF,EAASC,CAAI,KAAK,OAAO,OAAOD,CAAQ,EAAE,KAAK,CAACE,MAAYA,EAAQ,cAAcD,CAAI;AACtG,SAAIC,KAEG;AACT;AAEA,SAASC,EAAgBC,GAAuCC,GAAsD;AACpH,QAAMC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GAAG,IAAIF,EAAO,MAAM,GAAG,EAAE,CAAC,IAAI,GAAGlC,CAAW,IAAIoC,CAAiB;AAAA,EACrG;AACA,SAAOpC;AACT;"}
@@ -1,9 +1,10 @@
1
- import { ElementInfo, FFDocJson } from './frankdoc.types';
1
+ import { ElementClass, ElementInfo, FFDocJson } from './frankdoc.types';
2
2
  import { ElementClassWithInheritedProperties } from './frankdoc.utilities';
3
3
  export type Filters = Record<string, FilterLabels>;
4
4
  export type FilterLabels = Record<string, string[]>;
5
5
  export type Elements = Record<string, ElementDetails>;
6
6
  export type ElementDetails = ElementClassWithInheritedProperties & ElementInfo;
7
+ export type ElementWithInfo = ElementClass & ElementInfo;
7
8
  export declare abstract class FFDocBase {
8
9
  protected getFiltersFromLabels(labels: FFDocJson['labels']): Filters;
9
10
  protected assignFrankDocElementsToFilters(filters: Filters, elements: FFDocJson['elementNames']): Filters;
@@ -1,18 +1,23 @@
1
- import { Attribute, ElementClass, ElementProperty, EnumValue, FFDocJson } from './frankdoc.types';
2
- export type InheritedParentElementProperties<T> = {
3
- parentElementName: string;
4
- properties: Record<string, T>;
5
- };
1
+ import { Attribute, Child, ElementClass, ElementProperty, EnumValue, FFDocJson } from './frankdoc.types';
2
+ import { ElementWithInfo } from './ff-doc-base';
6
3
  type InheritedPropertiesExtras = {
7
4
  enums: Record<string, EnumValue>;
8
5
  parentElements: string[];
9
6
  };
7
+ export type InheritedParentElementProperties<T> = {
8
+ parentElementName: string;
9
+ properties: Record<string, T>;
10
+ };
10
11
  export type InheritedProperties = {
11
12
  attributesRequired: InheritedParentElementProperties<Attribute>[];
12
13
  attributesOptional: InheritedParentElementProperties<Attribute>[];
13
14
  forwards: Record<string, ElementProperty>;
14
15
  } & InheritedPropertiesExtras;
15
16
  export type ElementClassWithInheritedProperties = ElementClass & InheritedPropertiesExtras;
17
+ export type ResolvedChild = Child & {
18
+ implementedBy: ElementWithInfo[] | null;
19
+ };
20
+ export declare function findElement(elements: Record<string, ElementWithInfo>, name: string): ElementWithInfo | null;
16
21
  export declare function groupAttributesByMandatory(attributes: Record<string, Attribute>): {
17
22
  required: Record<string, Attribute>;
18
23
  optional: Record<string, Attribute>;
@@ -20,4 +25,5 @@ export declare function groupAttributesByMandatory(attributes: Record<string, At
20
25
  export declare function getInheritedProperties(element: ElementClass, elements: FFDocJson['elements'], enums: FFDocJson['enums']): InheritedProperties;
21
26
  export declare function addInheritedPropertiesToElement(element: ElementClass, elements: FFDocJson['elements'], enums: FFDocJson['enums']): ElementClassWithInheritedProperties;
22
27
  export declare function flattenInheritedParentElementProperties<T>(inheritedProperties: InheritedParentElementProperties<T>[]): Record<string, T>;
28
+ export declare function resolveInterfaceChildren(child: Child, types: FFDocJson['types'], elements: Record<string, ElementWithInfo>): ResolvedChild;
23
29
  export {};
package/dist/javadoc.d.ts CHANGED
@@ -1,17 +1,16 @@
1
- import { ElementClass, ElementInfo } from './frankdoc.types';
2
- export type ElementsWithInfo = ElementClass & ElementInfo;
1
+ import { ElementWithInfo } from './ff-doc-base';
3
2
  export type LinkData = {
4
3
  text: string;
5
4
  href?: string;
6
- element?: ElementsWithInfo;
5
+ element?: ElementWithInfo;
7
6
  };
8
7
  type TransformedJavadocPart = string | LinkData;
9
8
  export type TransformedJavadoc = TransformedJavadocPart[];
10
9
  export declare const markdownLinkRegex: RegExp;
11
10
  export declare const tagsRegex: RegExp;
12
11
  export declare const linkRegex: RegExp;
13
- export declare function transformAsHtml(javadoc: string, elements: Record<string, ElementsWithInfo>, hasCustomLinkTransform: boolean): TransformedJavadoc;
14
- export declare function transformAsText(javadoc: string, elements: Record<string, ElementsWithInfo>): TransformedJavadoc;
12
+ export declare function transformAsHtml(javadoc: string, elements: Record<string, ElementWithInfo>, hasCustomLinkTransform: boolean): TransformedJavadoc;
13
+ export declare function transformAsText(javadoc: string, elements: Record<string, ElementWithInfo>): TransformedJavadoc;
15
14
  export declare function defaultLinkTransformation(linkData: LinkData): string;
16
15
  /**
17
16
  * Creates LinkData object from `@link` taglet's data
@@ -19,5 +18,5 @@ export declare function defaultLinkTransformation(linkData: LinkData): string;
19
18
  * e.g. 'PipeLineSession pipeLineSession' for `{@link PipeLineSession pipeLineSession}`
20
19
  * @param elements
21
20
  */
22
- export declare function getLinkData(captureGroup: string, elements: Record<string, ElementsWithInfo>): LinkData;
21
+ export declare function getLinkData(captureGroup: string, elements: Record<string, ElementWithInfo>): LinkData;
23
22
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frankframework/doc-library-core",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "type": "module",
5
5
  "description": "A powerful and easy-to-use library, designed to extract and process information from the FF! Doc JSON.",
6
6
  "module": "dist/doc-library-core.js",
@@ -17,9 +17,9 @@
17
17
  "directory": "packages/core"
18
18
  },
19
19
  "devDependencies": {
20
- "@microsoft/api-extractor": "^7.55.2",
20
+ "@microsoft/api-extractor": "^7.58.7",
21
21
  "unplugin-dts": "1.0.0-beta.6",
22
- "vite": "^7.3.1"
22
+ "vite": "^7.3.3"
23
23
  },
24
24
  "scripts": {
25
25
  "build": "vite build"