@frankframework/doc-library-core 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,17 +1,17 @@
1
- # FF! Doc Library for ESM / TS Applications
2
-
3
- The FF! Doc Library is a powerful and easy-to-use Node.js package designed to extract and process information from the `frankdoc.json`.
4
- This library simplifies working with the data structure and enables seamless integration with [FF! Reference](https://frankdoc.frankframework.org/#/search) and FF! Flow projects.
5
- No matter if you use React, Angular or vanilla JavaScript, FF! Doc Library has you covered.
6
-
7
- ## Usage
8
- ```js
9
- import { FFDoc } from '@frankframework/doc-library-core';
10
- ```
11
-
12
- ## Development
13
- ### Build
14
- Run `pnpm build` to build the library project using Vite. The bundled and type definition files will be stored in the `dist/` directory.
15
-
16
- ### Publishing
17
- Run `pnpm publish` in the this directory in order to publish the library to a package registry.
1
+ # FF! Doc Library for ESM / TS Applications
2
+
3
+ The FF! Doc Library is a powerful and easy-to-use Node.js package designed to extract and process information from the `frankdoc.json`.
4
+ This library simplifies working with the data structure and enables seamless integration with [FF! Reference](https://frankdoc.frankframework.org/#/search) and FF! Flow projects.
5
+ No matter if you use React, Angular or vanilla JavaScript, FF! Doc Library has you covered.
6
+
7
+ ## Usage
8
+ ```js
9
+ import { FFDoc } from '@frankframework/doc-library-core';
10
+ ```
11
+
12
+ ## Development
13
+ ### Build
14
+ Run `pnpm build` to build the library project using Vite. The bundled and type definition files will be stored in the `dist/` directory.
15
+
16
+ ### Publishing
17
+ Run `pnpm publish` in the this directory in order to publish the library to a package registry.
@@ -137,7 +137,7 @@ function u(r, n) {
137
137
  if (s === "")
138
138
  return { text: w(r, e) };
139
139
  const i = s.split(" "), a = x(i, t, r), l = E(n, i[0]);
140
- return l ? { href: l.name, text: a } : { text: a };
140
+ return l ? { href: l.className, text: a, element: l } : { text: a };
141
141
  }
142
142
  function w(r, n) {
143
143
  const e = r.slice(n), t = e.split(" ");
@@ -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 } from './frankdoc.types';\n\nexport type LinkData = { text: string; href?: string };\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, ElementClass>,\n hasCustomLinkTransform: boolean,\n): string[] {\n let value = `${javadoc}`;\n value = value.replaceAll(markdownLinkRegex, '<a target=\"_blank\" href=\"$2\" alt=\"$1\">$1</a>');\n\n if (hasCustomLinkTransform) {\n value = value.replaceAll(linkRegex, (_, captureGroup) => {\n const linkData = getLinkData(captureGroup, elements);\n if (linkData.href) return `\\\\\"${JSON.stringify(linkData)}\\\\\"`;\n return linkData.text;\n });\n return value.split(String.raw`\\\"`);\n }\n value = value.replaceAll(linkRegex, (_, captureGroup) => {\n const linkData = getLinkData(captureGroup, elements);\n if (linkData.href) return defaultLinkTransformation(linkData);\n return linkData.text;\n });\n\n value = value.replaceAll(String.raw`\\\"`, '\"');\n return [value];\n}\n\nexport function transformAsText(javadoc: string, elements: Record<string, ElementClass>): string[] {\n let value = `${javadoc}`;\n value = value.replaceAll(markdownLinkRegex, '$1($2)');\n value = value.replaceAll(tagsRegex, '');\n value = value.replaceAll(linkRegex, (_: string, captureGroup: string) => {\n const linkData = getLinkData(captureGroup, elements);\n return linkData.text;\n });\n value = value.replaceAll(String.raw`\\\"`, '\"');\n return [value];\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, ElementClass>): 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.name, text: name };\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, ElementClass>, simpleName: string): ElementClass | null {\n if (Object.keys(elements).length === 0) return null;\n const element = elements[simpleName];\n if (element) return element;\n\n console.warn(`could not find element [${simpleName}]`);\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","value","_","captureGroup","linkData","getLinkData","defaultLinkTransformation","transformAsText","hashPosition","isMethod","elementString","getInternalMethodReference","elementParts","parseLinkName","findElement","method","methodParts","methodNameOrLabel","simple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AE1D,MAAIO,MAAkB;AACpB,WAAO,EAAE,MAAMC,EAA2BR,GAAcK,CAAY,EAAA;AAGtE,QAAMI,IAAeF,EAAc,MAAM,GAAG,GACtC5C,IAAO+C,EAAcD,GAAcH,GAAUN,CAAY,GAEzDnC,IAAU8C,EAAY7C,GAAU2C,EAAa,CAAC,CAAC;AACrD,SAAK5C,IACE,EAAE,MAAMA,EAAQ,MAAM,MAAMF,EAAA,IADd,EAAE,MAAMA,EAAA;AAE/B;AAGA,SAAS6C,EAA2BR,GAAsBK,GAA8B;AACtF,QAAMO,IAASZ,EAAa,MAAMK,CAAY,GAC5CQ,IAAcD,EAAO,MAAM,GAAG;AAChC,SAAOC,EAAY,WAAW,IAC1BA,EAAY,CAAC,IACbD,EAAO,MAAM,GAAGA,EAAO,QAAQ,GAAG,CAAC;AACzC;AAEA,SAASF,EAAcD,GAAwBH,GAAmBN,GAA8B;AAC9F,QAAMlB,IAAc2B,EAAa,GAAG,EAAE;AACtC,MAAIH,GAAU;AACZ,UAAMM,IAASZ,EAAa,MAAM,GAAG,EAAE,CAAC,GACtCc,IAAoBF,EAAO,MAAMA,EAAO,QAAQ,IAAI,IAAI,CAAC,EAAE,KAAA;AAC7D,WAAOE,EAAkB,SAAS,GAAG,IAAIF,EAAO,MAAM,GAAG,EAAE,CAAC,IAAI,GAAG9B,CAAW,IAAIgC,CAAiB;AAAA,EACrG;AACA,SAAOhC;AACT;AAEA,SAAS6B,EAAY7C,GAAwCiD,GAAyC;AACpG,MAAI,OAAO,KAAKjD,CAAQ,EAAE,WAAW,EAAG,QAAO;AAC/C,QAAMD,IAAUC,EAASiD,CAAU;AACnC,SAAIlD,MAEJ,QAAQ,KAAK,2BAA2BkD,CAAU,GAAG,GAC9C;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, 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};\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): string[] {\n let value = `${javadoc}`;\n value = value.replaceAll(markdownLinkRegex, '<a target=\"_blank\" href=\"$2\" alt=\"$1\">$1</a>');\n\n if (hasCustomLinkTransform) {\n value = value.replaceAll(linkRegex, (_, captureGroup) => {\n const linkData = getLinkData(captureGroup, elements);\n if (linkData.href) return `\\\\\"${JSON.stringify(linkData)}\\\\\"`;\n return linkData.text;\n });\n return value.split(String.raw`\\\"`);\n }\n value = value.replaceAll(linkRegex, (_, captureGroup) => {\n const linkData = getLinkData(captureGroup, elements);\n if (linkData.href) return defaultLinkTransformation(linkData);\n return linkData.text;\n });\n\n value = value.replaceAll(String.raw`\\\"`, '\"');\n return [value];\n}\n\nexport function transformAsText(javadoc: string, elements: Record<string, ElementsWithInfo>): string[] {\n let value = `${javadoc}`;\n value = value.replaceAll(markdownLinkRegex, '$1($2)');\n value = value.replaceAll(tagsRegex, '');\n value = value.replaceAll(linkRegex, (_: string, captureGroup: string) => {\n const linkData = getLinkData(captureGroup, elements);\n return linkData.text;\n });\n value = value.replaceAll(String.raw`\\\"`, '\"');\n return [value];\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\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>, simpleName: string): ElementsWithInfo | null {\n if (Object.keys(elements).length === 0) return null;\n const element = elements[simpleName];\n if (element) return element;\n\n console.warn(`could not find element [${simpleName}]`);\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","value","_","captureGroup","linkData","getLinkData","defaultLinkTransformation","transformAsText","hashPosition","isMethod","elementString","getInternalMethodReference","elementParts","parseLinkName","findElement","method","methodParts","methodNameOrLabel","simpleName"],"mappings":"AAoBA,SAASA,EAAgBC,GAAuCC,GAAsD;AACp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R,GAAcK,CAAY,EAAA;AAGtE,QAAMI,IAAeF,EAAc,MAAM,GAAG,GACtC5C,IAAO+C,EAAcD,GAAcH,GAAUN,CAAY,GAEzDnC,IAAU8C,EAAY7C,GAAU2C,EAAa,CAAC,CAAC;AACrD,SAAK5C,IACE,EAAE,MAAMA,EAAQ,WAAW,MAAMF,GAAM,SAAAE,EAAA,IADzB,EAAE,MAAMF,EAAA;AAE/B;AAGA,SAAS6C,EAA2BR,GAAsBK,GAA8B;AACtF,QAAMO,IAASZ,EAAa,MAAMK,CAAY,GAC5CQ,IAAcD,EAAO,MAAM,GAAG;AAChC,SAAOC,EAAY,WAAW,IAC1BA,EAAY,CAAC,IACbD,EAAO,MAAM,GAAGA,EAAO,QAAQ,GAAG,CAAC;AACzC;AAEA,SAASF,EAAcD,GAAwBH,GAAmBN,GAA8B;AAC9F,QAAMlB,IAAc2B,EAAa,GAAG,EAAE;AACtC,MAAIH,GAAU;AACZ,UAAMM,IAASZ,EAAa,MAAM,GAAG,EAAE,CAAC,GACtCc,IAAoBF,EAAO,MAAMA,EAAO,QAAQ,IAAI,IAAI,CAAC,EAAE,KAAA;AAC7D,WAAOE,EAAkB,SAAS,GAAG,IAAIF,EAAO,MAAM,GAAG,EAAE,CAAC,IAAI,GAAG9B,CAAW,IAAIgC,CAAiB;AAAA,EACrG;AACA,SAAOhC;AACT;AAEA,SAAS6B,EAAY7C,GAA4CiD,GAA6C;AAC5G,MAAI,OAAO,KAAKjD,CAAQ,EAAE,WAAW,EAAG,QAAO;AAC/C,QAAMD,IAAUC,EAASiD,CAAU;AACnC,SAAIlD,MAEJ,QAAQ,KAAK,2BAA2BkD,CAAU,GAAG,GAC9C;AACT;"}
package/dist/javadoc.d.ts CHANGED
@@ -1,13 +1,15 @@
1
- import { ElementClass } from './frankdoc.types';
1
+ import { ElementClass, ElementInfo } from './frankdoc.types';
2
+ export type ElementsWithInfo = ElementClass & ElementInfo;
2
3
  export type LinkData = {
3
4
  text: string;
4
5
  href?: string;
6
+ element?: ElementsWithInfo;
5
7
  };
6
8
  export declare const markdownLinkRegex: RegExp;
7
9
  export declare const tagsRegex: RegExp;
8
10
  export declare const linkRegex: RegExp;
9
- export declare function transformAsHtml(javadoc: string, elements: Record<string, ElementClass>, hasCustomLinkTransform: boolean): string[];
10
- export declare function transformAsText(javadoc: string, elements: Record<string, ElementClass>): string[];
11
+ export declare function transformAsHtml(javadoc: string, elements: Record<string, ElementsWithInfo>, hasCustomLinkTransform: boolean): string[];
12
+ export declare function transformAsText(javadoc: string, elements: Record<string, ElementsWithInfo>): string[];
11
13
  export declare function defaultLinkTransformation(linkData: LinkData): string;
12
14
  /**
13
15
  * Creates LinkData object from `@link` taglet's data
@@ -15,4 +17,4 @@ export declare function defaultLinkTransformation(linkData: LinkData): string;
15
17
  * e.g. 'PipeLineSession pipeLineSession' for `{@link PipeLineSession pipeLineSession}`
16
18
  * @param elements
17
19
  */
18
- export declare function getLinkData(captureGroup: string, elements: Record<string, ElementClass>): LinkData;
20
+ export declare function getLinkData(captureGroup: string, elements: Record<string, ElementsWithInfo>): LinkData;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frankframework/doc-library-core",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
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.0",
20
+ "@microsoft/api-extractor": "^7.55.2",
21
21
  "unplugin-dts": "1.0.0-beta.6",
22
- "vite": "^7.2.2"
22
+ "vite": "^7.3.1"
23
23
  },
24
24
  "scripts": {
25
25
  "build": "vite build"