@open-charging-cloud/chargy-gui 0.0.0-stage → 0.1.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.
Files changed (170) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/LICENSE +661 -0
  3. package/README.md +48 -2
  4. package/SECURITY.md +21 -0
  5. package/dist/anchorKeyTrust.d.ts +9 -0
  6. package/dist/anchorKeyTrust.d.ts.map +1 -0
  7. package/dist/anchorKeyTrust.js +24 -0
  8. package/dist/anchorKeyTrust.js.map +1 -0
  9. package/dist/anchorKeyTrustView.d.ts +14 -0
  10. package/dist/anchorKeyTrustView.d.ts.map +1 -0
  11. package/dist/anchorKeyTrustView.js +95 -0
  12. package/dist/anchorKeyTrustView.js.map +1 -0
  13. package/dist/browserFiles.d.ts +5 -0
  14. package/dist/browserFiles.d.ts.map +1 -0
  15. package/dist/browserFiles.js +100 -0
  16. package/dist/browserFiles.js.map +1 -0
  17. package/dist/core/i18n.json +1518 -0
  18. package/dist/core/package.json +119 -0
  19. package/dist/core/validationRules.json +8 -0
  20. package/dist/domHelpers.d.ts +25 -0
  21. package/dist/domHelpers.d.ts.map +1 -0
  22. package/dist/domHelpers.js +212 -0
  23. package/dist/domHelpers.js.map +1 -0
  24. package/dist/historicalSessionPanel.d.ts +24 -0
  25. package/dist/historicalSessionPanel.d.ts.map +1 -0
  26. package/dist/historicalSessionPanel.js +108 -0
  27. package/dist/historicalSessionPanel.js.map +1 -0
  28. package/dist/index.d.ts +40 -0
  29. package/dist/index.d.ts.map +1 -0
  30. package/dist/index.js +56 -0
  31. package/dist/index.js.map +1 -0
  32. package/dist/liveLinkTrust.d.ts +208 -0
  33. package/dist/liveLinkTrust.d.ts.map +1 -0
  34. package/dist/liveLinkTrust.js +452 -0
  35. package/dist/liveLinkTrust.js.map +1 -0
  36. package/dist/livePOISession.d.ts +38 -0
  37. package/dist/livePOISession.d.ts.map +1 -0
  38. package/dist/livePOISession.js +193 -0
  39. package/dist/livePOISession.js.map +1 -0
  40. package/dist/measurementDetailsRenderer.d.ts +25 -0
  41. package/dist/measurementDetailsRenderer.d.ts.map +1 -0
  42. package/dist/measurementDetailsRenderer.js +343 -0
  43. package/dist/measurementDetailsRenderer.js.map +1 -0
  44. package/dist/poiConsistencyView.d.ts +3 -0
  45. package/dist/poiConsistencyView.d.ts.map +1 -0
  46. package/dist/poiConsistencyView.js +14 -0
  47. package/dist/poiConsistencyView.js.map +1 -0
  48. package/dist/poiObservedHistory.d.ts +49 -0
  49. package/dist/poiObservedHistory.d.ts.map +1 -0
  50. package/dist/poiObservedHistory.js +205 -0
  51. package/dist/poiObservedHistory.js.map +1 -0
  52. package/dist/poiTransport.d.ts +12 -0
  53. package/dist/poiTransport.d.ts.map +1 -0
  54. package/dist/poiTransport.js +74 -0
  55. package/dist/poiTransport.js.map +1 -0
  56. package/dist/poiTrustContext.d.ts +134 -0
  57. package/dist/poiTrustContext.d.ts.map +1 -0
  58. package/dist/poiTrustContext.js +243 -0
  59. package/dist/poiTrustContext.js.map +1 -0
  60. package/dist/poiTrustLineage.d.ts +10 -0
  61. package/dist/poiTrustLineage.d.ts.map +1 -0
  62. package/dist/poiTrustLineage.js +47 -0
  63. package/dist/poiTrustLineage.js.map +1 -0
  64. package/dist/poiURLs.d.ts +5 -0
  65. package/dist/poiURLs.d.ts.map +1 -0
  66. package/dist/poiURLs.js +24 -0
  67. package/dist/poiURLs.js.map +1 -0
  68. package/dist/poiWitnessManagement.d.ts +3 -0
  69. package/dist/poiWitnessManagement.d.ts.map +1 -0
  70. package/dist/poiWitnessManagement.js +127 -0
  71. package/dist/poiWitnessManagement.js.map +1 -0
  72. package/dist/poiWitnessTrust.d.ts +26 -0
  73. package/dist/poiWitnessTrust.d.ts.map +1 -0
  74. package/dist/poiWitnessTrust.js +90 -0
  75. package/dist/poiWitnessTrust.js.map +1 -0
  76. package/dist/pricePublicationData.d.ts +19 -0
  77. package/dist/pricePublicationData.d.ts.map +1 -0
  78. package/dist/pricePublicationData.js +83 -0
  79. package/dist/pricePublicationData.js.map +1 -0
  80. package/dist/roamingNetworks.d.ts +14 -0
  81. package/dist/roamingNetworks.d.ts.map +1 -0
  82. package/dist/roamingNetworks.js +33 -0
  83. package/dist/roamingNetworks.js.map +1 -0
  84. package/dist/securityFingerprint.d.ts +16 -0
  85. package/dist/securityFingerprint.d.ts.map +1 -0
  86. package/dist/securityFingerprint.js +36 -0
  87. package/dist/securityFingerprint.js.map +1 -0
  88. package/dist/securityFingerprintView.d.ts +3 -0
  89. package/dist/securityFingerprintView.d.ts.map +1 -0
  90. package/dist/securityFingerprintView.js +61 -0
  91. package/dist/securityFingerprintView.js.map +1 -0
  92. package/dist/sessionEvidenceStore.d.ts +23 -0
  93. package/dist/sessionEvidenceStore.d.ts.map +1 -0
  94. package/dist/sessionEvidenceStore.js +81 -0
  95. package/dist/sessionEvidenceStore.js.map +1 -0
  96. package/dist/sessionMeterKeyView.d.ts +9 -0
  97. package/dist/sessionMeterKeyView.d.ts.map +1 -0
  98. package/dist/sessionMeterKeyView.js +55 -0
  99. package/dist/sessionMeterKeyView.js.map +1 -0
  100. package/dist/sessionPOIData.d.ts +49 -0
  101. package/dist/sessionPOIData.d.ts.map +1 -0
  102. package/dist/sessionPOIData.js +161 -0
  103. package/dist/sessionPOIData.js.map +1 -0
  104. package/dist/sessionPOIPanel.d.ts +50 -0
  105. package/dist/sessionPOIPanel.d.ts.map +1 -0
  106. package/dist/sessionPOIPanel.js +288 -0
  107. package/dist/sessionPOIPanel.js.map +1 -0
  108. package/dist/sessionPriceData.d.ts +17 -0
  109. package/dist/sessionPriceData.d.ts.map +1 -0
  110. package/dist/sessionPriceData.js +51 -0
  111. package/dist/sessionPriceData.js.map +1 -0
  112. package/dist/sessionPricePanel.d.ts +31 -0
  113. package/dist/sessionPricePanel.d.ts.map +1 -0
  114. package/dist/sessionPricePanel.js +222 -0
  115. package/dist/sessionPricePanel.js.map +1 -0
  116. package/dist/sessionUIState.d.ts +12 -0
  117. package/dist/sessionUIState.d.ts.map +1 -0
  118. package/dist/sessionUIState.js +33 -0
  119. package/dist/sessionUIState.js.map +1 -0
  120. package/dist/stationProofData.d.ts +38 -0
  121. package/dist/stationProofData.d.ts.map +1 -0
  122. package/dist/stationProofData.js +83 -0
  123. package/dist/stationProofData.js.map +1 -0
  124. package/dist/stationProofPanel.d.ts +44 -0
  125. package/dist/stationProofPanel.d.ts.map +1 -0
  126. package/dist/stationProofPanel.js +304 -0
  127. package/dist/stationProofPanel.js.map +1 -0
  128. package/dist/stationProofView.d.ts +9 -0
  129. package/dist/stationProofView.d.ts.map +1 -0
  130. package/dist/stationProofView.js +186 -0
  131. package/dist/stationProofView.js.map +1 -0
  132. package/dist/trustAnchorData.d.ts +40 -0
  133. package/dist/trustAnchorData.d.ts.map +1 -0
  134. package/dist/trustAnchorData.js +91 -0
  135. package/dist/trustAnchorData.js.map +1 -0
  136. package/dist/trustAnchorDataView.d.ts +13 -0
  137. package/dist/trustAnchorDataView.d.ts.map +1 -0
  138. package/dist/trustAnchorDataView.js +69 -0
  139. package/dist/trustAnchorDataView.js.map +1 -0
  140. package/dist/trustAnchorImport.d.ts +5 -0
  141. package/dist/trustAnchorImport.d.ts.map +1 -0
  142. package/dist/trustAnchorImport.js +34 -0
  143. package/dist/trustAnchorImport.js.map +1 -0
  144. package/dist/trustAnchorPreview.d.ts +37 -0
  145. package/dist/trustAnchorPreview.d.ts.map +1 -0
  146. package/dist/trustAnchorPreview.js +180 -0
  147. package/dist/trustAnchorPreview.js.map +1 -0
  148. package/dist/trustManagement.d.ts +34 -0
  149. package/dist/trustManagement.d.ts.map +1 -0
  150. package/dist/trustManagement.js +405 -0
  151. package/dist/trustManagement.js.map +1 -0
  152. package/dist/trustStore.d.ts +75 -0
  153. package/dist/trustStore.d.ts.map +1 -0
  154. package/dist/trustStore.js +408 -0
  155. package/dist/trustStore.js.map +1 -0
  156. package/dist/trustTransitionView.d.ts +5 -0
  157. package/dist/trustTransitionView.d.ts.map +1 -0
  158. package/dist/trustTransitionView.js +110 -0
  159. package/dist/trustTransitionView.js.map +1 -0
  160. package/dist/trustedPublicKeys.d.ts +4 -0
  161. package/dist/trustedPublicKeys.d.ts.map +1 -0
  162. package/dist/trustedPublicKeys.js +25 -0
  163. package/dist/trustedPublicKeys.js.map +1 -0
  164. package/dist/wwcpPoi.d.ts +2 -0
  165. package/dist/wwcpPoi.d.ts.map +1 -0
  166. package/dist/wwcpPoi.js +2 -0
  167. package/dist/wwcpPoi.js.map +1 -0
  168. package/documentation/AUDIT.md +262 -0
  169. package/images/NGI0_tag.svg +149 -0
  170. package/package.json +75 -4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"measurementDetailsRenderer.js","sourceRoot":"","sources":["../src/measurementDetailsRenderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAOH,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAiB5E,SAAS,eAAe,CAAC,OAAoB,EACpB,MAAgH;IAErI,MAAM,KAAK,GAAI,OAA2C,CAAC,KAAK,CAAC;IACjE,IAAI,KAAK,KAAK,SAAS;QACnB,OAAO;IAEX,IAAI,MAAM,CAAC,OAAO,KAAQ,SAAS;QAAE,KAAK,CAAC,OAAO,GAAM,MAAM,CAAC,OAAO,CAAC;IACvE,IAAI,MAAM,CAAC,UAAU,KAAK,SAAS;QAAE,KAAK,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;IAC1E,IAAI,MAAM,CAAC,SAAS,KAAM,SAAS;QAAE,KAAK,CAAC,SAAS,GAAI,MAAM,CAAC,SAAS,CAAC;IACzE,IAAI,MAAM,CAAC,SAAS,KAAM,SAAS;QAAE,KAAK,CAAC,SAAS,GAAI,MAAM,CAAC,SAAS,CAAC;IACzE,IAAI,MAAM,CAAC,UAAU,KAAK,SAAS;QAAE,KAAK,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;AAE9E,C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AO,CAAC,iBAAiB,EAAE,KAAK,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IACzE,OAAO,CAAC,iBAAiB,CAAC,WAAW,GAAG,KAAK,CAAC,eAAe,CAAC,KAAK,CAAC;IAEpE,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS;QAC7B,eAAe,CAAC,OAAO,CAAC,cAAc,EAAE,KAAK,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAEtE,IAAI,KAAK,CAAC,iBAAiB,KAAK,SAAS;QACrC,uBAAuB,CAAC,OAAO,CAAC,sBAAsB,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAErF,IAAI,KAAK,CAAC,cAAc,KAAK,SAAS;QAClC,uBAAuB,CAAC,OAAO,CAAC,mBAAmB,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;AAEpH,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,6BAA6B,CAAC,gBAAmC,EACnC,OAA4C,EAC5C,OAAkD;IAElG,IAAI,gBAAgB,CAAC,MAAM,IAAI,IAAI;QAC/B,OAAO,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAEjE,MAAM,YAAY,GAAG,MAAM,gBAAgB,CAAC,MAAM,CAAC,uBAAuB,CAAC,gBAAgB,CAAC,CAAC;IAC7F,IAAI,YAAY,YAAY,KAAK;QAC7B,OAAO,YAAY,CAAC;IAExB,wBAAwB,CAAC,YAAY,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACzD,OAAO,SAAS,CAAC;AAErB,CAAC","sourcesContent":["/*\n * Copyright (c) 2018-2026 GraphDefined GmbH <achim.friedland@graphdefined.com>\n * This file is part of ChargyGUI <https://github.com/OpenChargingCloud/ChargyGUI.TS>\n *\n * Licensed under the Affero GPL license, Version 3.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.gnu.org/licenses/agpl.html\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n IMeasurementDetailField,\n IMeasurementDetailModel,\n IMeasurementValue\n} from \"@open-charging-cloud/chargy-core\";\nimport { clearElement, createDiv, renderPrettyJSON } from \"./domHelpers.js\";\n\nexport interface IMeasurementDetailsTargets {\n readonly errorDiv: HTMLDivElement;\n readonly introDiv: HTMLDivElement;\n readonly infoDiv: HTMLDivElement;\n readonly bufferValue: HTMLDivElement;\n readonly hashedBufferValue: HTMLDivElement;\n readonly publicKeyValue: HTMLDivElement;\n readonly signatureExpectedValue: HTMLDivElement;\n readonly signatureCheckValue: HTMLDivElement;\n}\n\nexport interface IMeasurementDetailsRenderOptions {\n readonly onShowPKIDetails?: (pkiData: unknown) => void;\n}\n\nfunction setElementStyle(element: HTMLElement,\n styles: Partial<Pick<CSSStyleDeclaration, \"display\" | \"fontFamily\" | \"maxHeight\" | \"overflowY\" | \"whiteSpace\">>): void {\n\n const style = (element as { style?: CSSStyleDeclaration }).style;\n if (style === undefined)\n return;\n\n if (styles.display !== undefined) style.display = styles.display;\n if (styles.fontFamily !== undefined) style.fontFamily = styles.fontFamily;\n if (styles.maxHeight !== undefined) style.maxHeight = styles.maxHeight;\n if (styles.overflowY !== undefined) style.overflowY = styles.overflowY;\n if (styles.whiteSpace !== undefined) style.whiteSpace = styles.whiteSpace;\n\n}\n\nfunction getDirectElementChild(parent: Element | null, index: number): Element | undefined {\n\n if (parent === null)\n return undefined;\n\n let currentIndex = 0;\n for (let child = parent.firstChild; child !== null; child = child.nextSibling)\n {\n if (child.nodeType === 1)\n {\n if (currentIndex === index)\n return child as Element;\n currentIndex++;\n }\n }\n\n return undefined;\n\n}\n\nfunction setParentHeader(valueElement: HTMLElement, header: string | undefined): void {\n\n if (header === undefined)\n return;\n\n const firstChild = getDirectElementChild(valueElement.parentElement, 0);\n if (firstChild !== undefined)\n firstChild.textContent = header;\n\n}\n\nfunction renderIntro(introDiv: HTMLDivElement,\n intro: IMeasurementDetailModel[\"intro\"]): void {\n\n const doc = introDiv.ownerDocument;\n const substitute = (text: string): string =>\n text.replace(\"{methodName}\", intro.methodName)\n .replace(\"{cryptoAlgorithm}\", intro.cryptoAlgorithm);\n\n clearElement(introDiv);\n\n const importantTag = /<span class=\"important\">([^<]*)<\\/span>/g;\n let lastIndex = 0;\n let match: RegExpExecArray | null;\n\n while ((match = importantTag.exec(intro.template)) !== null)\n {\n if (match.index > lastIndex)\n introDiv.appendChild(doc.createTextNode(substitute(intro.template.slice(lastIndex, match.index))));\n\n const span = doc.createElement(\"span\");\n span.className = \"important\";\n span.textContent = substitute(match[1] ?? \"\");\n introDiv.appendChild(span);\n\n lastIndex = match.index + match[0].length;\n }\n\n if (lastIndex < intro.template.length)\n introDiv.appendChild(doc.createTextNode(substitute(intro.template.slice(lastIndex))));\n\n}\n\nfunction addVisualBufferLink(hexSlice: string,\n bufferDiv: HTMLDivElement,\n lineDiv: HTMLDivElement): void {\n\n const entry = createDiv(bufferDiv, \"entry\", hexSlice);\n const lineId = getDirectElementChild(lineDiv, 0);\n const lineVal = getDirectElementChild(lineDiv, 1);\n\n entry.onmouseenter = (): void => {\n lineId?.classList.add(\"overEntry\");\n lineVal?.classList.add(\"overEntry\");\n };\n\n entry.onmouseleave = (): void => {\n lineId?.classList.remove(\"overEntry\");\n lineVal?.classList.remove(\"overEntry\");\n };\n\n lineDiv.onmouseenter = (): void => {\n entry.classList.add(\"overEntry\");\n };\n\n lineDiv.onmouseleave = (): void => {\n entry.classList.remove(\"overEntry\");\n };\n\n}\n\nfunction renderFieldRow(row: IMeasurementDetailField,\n infoDiv: HTMLDivElement,\n bufferDiv: HTMLDivElement): void {\n\n const doc = infoDiv.ownerDocument;\n const lineDiv = createDiv(infoDiv, \"row\");\n createDiv(lineDiv, \"id\", row.label);\n const valueDiv = createDiv(lineDiv, \"value\");\n\n if (row.lines !== undefined)\n {\n row.lines.forEach((item, index) => {\n if (index > 0)\n valueDiv.appendChild(doc.createElement(\"br\"));\n valueDiv.appendChild(doc.createTextNode(item));\n });\n }\n else\n {\n const headline = row.value ?? \"\";\n if (headline.length > 0)\n valueDiv.appendChild(doc.createTextNode(headline));\n\n if (row.statusItems !== undefined && row.statusItems.length > 0)\n {\n if (headline.length > 0)\n valueDiv.appendChild(doc.createElement(\"br\"));\n\n const statusSpan = doc.createElement(\"span\");\n statusSpan.className = \"statusInfos\";\n\n row.statusItems.forEach((item, index) => {\n if (index > 0)\n statusSpan.appendChild(doc.createElement(\"br\"));\n statusSpan.appendChild(doc.createTextNode(item));\n });\n\n valueDiv.appendChild(statusSpan);\n }\n }\n\n addVisualBufferLink(row.hexSlice, bufferDiv, lineDiv);\n\n}\n\nfunction renderOCMFPlainText(plainTextDiv: HTMLDivElement,\n model: Extract<IMeasurementDetailModel[\"plainText\"], { kind: \"ocmf\" }>): void {\n\n const doc = plainTextDiv.ownerDocument;\n clearElement(plainTextDiv);\n\n const compactDiv = doc.createElement(\"div\");\n compactDiv.className = \"compactValue\";\n plainTextDiv.appendChild(compactDiv);\n\n const ocmfPrefix = doc.createElement(\"span\");\n ocmfPrefix.className = \"ocmfHighlight\";\n ocmfPrefix.textContent = \"OCMF\";\n compactDiv.appendChild(ocmfPrefix);\n\n const rawBody = model.raw.substring(4);\n const firstIndex = rawBody.indexOf(\"|\");\n const lastIndex = rawBody.lastIndexOf(\"|\");\n\n if (firstIndex !== -1 && lastIndex !== -1 && lastIndex !== firstIndex)\n {\n if (firstIndex > 0)\n compactDiv.appendChild(doc.createTextNode(rawBody.substring(0, firstIndex)));\n\n const firstSep = doc.createElement(\"span\");\n firstSep.className = \"ocmfSeparator\";\n firstSep.textContent = \"|\";\n compactDiv.appendChild(firstSep);\n\n compactDiv.appendChild(doc.createTextNode(rawBody.substring(firstIndex + 1, lastIndex)));\n\n const lastSep = doc.createElement(\"span\");\n lastSep.className = \"ocmfSeparator\";\n lastSep.textContent = \"|\";\n compactDiv.appendChild(lastSep);\n\n const sigSpan = doc.createElement(\"span\");\n sigSpan.className = \"ocmfHighlight\";\n sigSpan.textContent = rawBody.substring(lastIndex + 1);\n compactDiv.appendChild(sigSpan);\n }\n else if (firstIndex !== -1)\n {\n if (firstIndex > 0)\n compactDiv.appendChild(doc.createTextNode(rawBody.substring(0, firstIndex)));\n\n const firstSep = doc.createElement(\"span\");\n firstSep.className = \"ocmfSeparator\";\n firstSep.textContent = \"|\";\n compactDiv.appendChild(firstSep);\n\n compactDiv.appendChild(doc.createTextNode(rawBody.substring(firstIndex + 1)));\n }\n else if (rawBody.length > 0)\n {\n compactDiv.appendChild(doc.createTextNode(rawBody));\n }\n\n setElementStyle(compactDiv, {\n fontFamily: \"monospace\",\n maxHeight: \"25vh\",\n overflowY: \"scroll\"\n });\n\n const prettyDiv = doc.createElement(\"div\");\n prettyDiv.className = \"prettyValue\";\n plainTextDiv.appendChild(prettyDiv);\n\n const prettyPrefix = doc.createElement(\"span\");\n prettyPrefix.className = \"ocmfHighlight\";\n prettyPrefix.textContent = \"OCMF\";\n prettyDiv.appendChild(prettyPrefix);\n\n const prettySep1 = doc.createElement(\"span\");\n prettySep1.className = \"ocmfSeparator\";\n prettySep1.textContent = \"|\";\n prettyDiv.appendChild(prettySep1);\n prettyDiv.appendChild(doc.createElement(\"br\"));\n\n renderPrettyJSON(prettyDiv, model.payload, model.payloadLabelResolver);\n\n const prettySep2 = doc.createElement(\"span\");\n prettySep2.className = \"ocmfSeparator\";\n prettySep2.textContent = \"|\";\n prettyDiv.appendChild(prettySep2);\n prettyDiv.appendChild(doc.createElement(\"br\"));\n\n renderPrettyJSON(prettyDiv, model.signature, model.signatureLabelResolver);\n\n compactDiv.onclick = (): void => {\n setElementStyle(compactDiv, { display: \"none\" });\n setElementStyle(prettyDiv, { display: \"block\" });\n };\n\n prettyDiv.onclick = (): void => {\n setElementStyle(compactDiv, { display: \"block\" });\n setElementStyle(prettyDiv, { display: \"none\" });\n };\n\n}\n\nfunction renderPublicKey(publicKeyDiv: HTMLDivElement,\n model: NonNullable<IMeasurementDetailModel[\"publicKey\"]>,\n options?: IMeasurementDetailsRenderOptions): void {\n\n const doc = publicKeyDiv.ownerDocument;\n setParentHeader(publicKeyDiv, model.header);\n\n switch (model.kind)\n {\n case \"plain\":\n if (model.value.length > 0)\n publicKeyDiv.textContent = model.value;\n break;\n\n case \"leadingFour\":\n clearElement(publicKeyDiv);\n if (model.value.startsWith(\"04\"))\n {\n const leadingSpan = doc.createElement(\"span\");\n leadingSpan.className = \"leadingFour\";\n leadingSpan.textContent = \"04\";\n publicKeyDiv.appendChild(leadingSpan);\n publicKeyDiv.appendChild(\n doc.createTextNode(\" \" + (model.value.substring(2).match(/.{1,8}/g)?.join(\" \") ?? (model.fallback ?? \"\")))\n );\n }\n else\n {\n publicKeyDiv.textContent = model.value.match(/.{1,8}/g)?.join(\" \") ?? (model.fallback ?? \"\");\n }\n break;\n\n case \"derXY\":\n clearElement(publicKeyDiv);\n publicKeyDiv.appendChild(doc.createTextNode(\"der: \" + model.value));\n publicKeyDiv.appendChild(doc.createElement(\"br\"));\n publicKeyDiv.appendChild(doc.createElement(\"br\"));\n publicKeyDiv.appendChild(doc.createTextNode(\"x:\\u00A0\\u00A0 \" + (model.x ?? \"-\")));\n publicKeyDiv.appendChild(doc.createElement(\"br\"));\n publicKeyDiv.appendChild(doc.createTextNode(\"y:\\u00A0\\u00A0 \" + (model.y ?? \"-\")));\n break;\n }\n\n const signatureContainer = getDirectElementChild(publicKeyDiv.parentElement, 3);\n if (signatureContainer !== undefined)\n {\n clearElement(signatureContainer);\n\n if (model.signatures !== undefined)\n {\n for (const sig of model.signatures)\n {\n const sigDiv = doc.createElement(\"div\");\n if (sig.clickable === true)\n sigDiv.classList.add(\"signature\");\n\n const icon = doc.createElement(\"i\");\n icon.className = sig.valid ? \"fas fa-check-circle\" : \"fas fa-times-circle\";\n sigDiv.appendChild(icon);\n sigDiv.appendChild(doc.createTextNode(sig.signer));\n\n if (sig.clickable === true && options?.onShowPKIDetails !== undefined)\n {\n const onShowPKIDetails = options.onShowPKIDetails;\n sigDiv.onclick = (): void => {\n onShowPKIDetails({});\n };\n }\n\n signatureContainer.appendChild(sigDiv);\n }\n }\n }\n\n}\n\nfunction renderExpectedSignature(signatureDiv: HTMLDivElement,\n model: NonNullable<IMeasurementDetailModel[\"expectedSignature\"]>): void {\n\n const doc = signatureDiv.ownerDocument;\n setParentHeader(signatureDiv, model.header);\n\n switch (model.kind)\n {\n case \"plain\":\n signatureDiv.textContent = model.value ?? \"\";\n break;\n\n case \"rs\":\n clearElement(signatureDiv);\n signatureDiv.appendChild(doc.createTextNode((model.prefixR ?? \"r: \") + (model.r ?? \"\")));\n signatureDiv.appendChild(doc.createElement(\"br\"));\n signatureDiv.appendChild(doc.createTextNode((model.prefixS ?? \"s: \") + (model.s ?? \"\")));\n break;\n\n case \"derRS\":\n clearElement(signatureDiv);\n signatureDiv.appendChild(doc.createTextNode((model.valueLabel ?? \"der\") + \": \" + (model.value ?? \"-\")));\n signatureDiv.appendChild(doc.createElement(\"br\"));\n signatureDiv.appendChild(doc.createElement(\"br\"));\n signatureDiv.appendChild(doc.createTextNode(\"R:\\u00A0\\u00A0 \" + (model.r ?? \"-\")));\n signatureDiv.appendChild(doc.createElement(\"br\"));\n signatureDiv.appendChild(doc.createTextNode(\"S:\\u00A0\\u00A0 \" + (model.s ?? \"-\")));\n break;\n }\n\n}\n\nfunction renderVerificationBadge(container: HTMLDivElement,\n valid: boolean,\n text: string): void {\n\n const doc = container.ownerDocument;\n clearElement(container);\n\n const icon = doc.createElement(\"i\");\n icon.className = valid ? \"fas fa-check-circle\" : \"fas fa-times-circle\";\n\n const description = doc.createElement(\"div\");\n description.id = \"description\";\n description.textContent = text;\n\n container.appendChild(icon);\n container.appendChild(description);\n\n}\n\n/**\n * Renders a DOM-free IMeasurementDetailModel produced by ChargyCore into the\n * caller-provided measurement details dialog elements using safe DOM APIs only.\n */\nexport function renderMeasurementDetails(model: IMeasurementDetailModel,\n targets: IMeasurementDetailsTargets,\n options?: IMeasurementDetailsRenderOptions): void {\n\n renderIntro(targets.introDiv, model.intro);\n\n setParentHeader(targets.bufferValue, model.plainText.header);\n\n switch (model.plainText.kind)\n {\n case \"fields\":\n setElementStyle(targets.bufferValue, {\n fontFamily: \"\",\n whiteSpace: \"\",\n maxHeight: \"\",\n overflowY: \"\"\n });\n for (const row of model.plainText.rows)\n renderFieldRow(row, targets.infoDiv, targets.bufferValue);\n break;\n\n case \"ocmf\":\n renderOCMFPlainText(targets.bufferValue, model.plainText);\n break;\n\n case \"preformatted\":\n targets.bufferValue.textContent = model.plainText.text;\n setElementStyle(targets.bufferValue, {\n fontFamily: \"monospace\",\n whiteSpace: \"pre\",\n maxHeight: \"25vh\",\n overflowY: \"scroll\"\n });\n break;\n\n case \"text\":\n targets.bufferValue.textContent = model.plainText.text;\n break;\n }\n\n setParentHeader(targets.hashedBufferValue, model.hashedPlainText.header);\n targets.hashedBufferValue.textContent = model.hashedPlainText.value;\n\n if (model.publicKey !== undefined)\n renderPublicKey(targets.publicKeyValue, model.publicKey, options);\n\n if (model.expectedSignature !== undefined)\n renderExpectedSignature(targets.signatureExpectedValue, model.expectedSignature);\n\n if (model.signatureCheck !== undefined)\n renderVerificationBadge(targets.signatureCheckValue, model.signatureCheck.valid, model.signatureCheck.text);\n\n}\n\n/**\n * Builds the verification detail model via ChargyCore and renders it into the\n * given DOM targets. Returns an Error if the measurement could not be rendered.\n */\nexport async function renderMeasurementValueDetails(measurementValue: IMeasurementValue,\n targets: IMeasurementDetailsTargets,\n options?: IMeasurementDetailsRenderOptions): Promise<Error | undefined> {\n\n if (measurementValue.method == null)\n return new Error(\"Missing measurement verification method!\");\n\n const modelOrError = await measurementValue.method.BuildMeasurementDetails(measurementValue);\n if (modelOrError instanceof Error)\n return modelOrError;\n\n renderMeasurementDetails(modelOrError, targets, options);\n return undefined;\n\n}\n"]}
@@ -0,0 +1,3 @@
1
+ import type { VersionComparison } from '@open-charging-cloud/wwcp-poi';
2
+ export declare function renderPOIConsistency(report: VersionComparison, localize: (key: string) => string): HTMLElement;
3
+ //# sourceMappingURL=poiConsistencyView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"poiConsistencyView.d.ts","sourceRoot":"","sources":["../src/poiConsistencyView.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,+BAA+B,CAAC;AACrE,wBAAgB,oBAAoB,CAAC,MAAM,EAAC,iBAAiB,EAAC,QAAQ,EAAC,CAAC,GAAG,EAAC,MAAM,KAAG,MAAM,GAAE,WAAW,CAOvG"}
@@ -0,0 +1,14 @@
1
+ export function renderPOIConsistency(report, localize) {
2
+ const root = document.createElement('section');
3
+ root.className = 'poiConsistency';
4
+ root.dataset['state'] = report.accepted ? 'valid' : 'invalid';
5
+ root.dataset['status'] = report.status;
6
+ root.appendChild(document.createElement('p')).textContent = (report.accepted ? '✅ ' : '❌ ') + localize(report.accepted ? report.status === 'historical' ? 'poiObservedHistorical' : 'poiObservedConsistent' : 'poiObservedRejected');
7
+ const details = root.appendChild(document.createElement('details'));
8
+ details.appendChild(document.createElement('summary')).textContent = localize('poiObservedDetails');
9
+ details.appendChild(document.createElement('p')).textContent = localize('poiObservedLimits');
10
+ for (const issue of report.issues)
11
+ details.appendChild(document.createElement('p')).textContent = issue.code + ' · ' + issue.chain + ' · ' + issue.detail;
12
+ return root;
13
+ }
14
+ //# sourceMappingURL=poiConsistencyView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"poiConsistencyView.js","sourceRoot":"","sources":["../src/poiConsistencyView.ts"],"names":[],"mappings":"AACA,MAAM,UAAU,oBAAoB,CAAC,MAAwB,EAAC,QAA6B;IACvF,MAAM,IAAI,GAAC,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IAAA,IAAI,CAAC,S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p-poi';\nexport function renderPOIConsistency(report:VersionComparison,localize:(key:string)=>string):HTMLElement {\n const root=document.createElement('section');root.className='poiConsistency';root.dataset['state']=report.accepted?'valid':'invalid';root.dataset['status']=report.status;\n root.appendChild(document.createElement('p')).textContent=(report.accepted?'✅ ':'❌ ')+localize(report.accepted?report.status==='historical'?'poiObservedHistorical':'poiObservedConsistent':'poiObservedRejected');\n const details=root.appendChild(document.createElement('details'));details.appendChild(document.createElement('summary')).textContent=localize('poiObservedDetails');\n details.appendChild(document.createElement('p')).textContent=localize('poiObservedLimits');\n for(const issue of report.issues)details.appendChild(document.createElement('p')).textContent=issue.code+' · '+issue.chain+' · '+issue.detail;\n return root;\n}\n"]}
@@ -0,0 +1,49 @@
1
+ import type { VerifiedTrustTransition, ObservedVersions, VersionObservation, VersionComparison } from '@open-charging-cloud/wwcp-poi';
2
+ export declare const observedHistoryDatabase = "ChargyPOIObservedHistory";
3
+ export interface ObservationScope {
4
+ readonly id: string;
5
+ readonly policyId: string;
6
+ readonly roamingNetworkId: string;
7
+ readonly operatorId: string;
8
+ }
9
+ export interface StoredObservedHistory extends ObservationScope {
10
+ readonly generation: string;
11
+ readonly updatedAt: number;
12
+ readonly state: ObservedVersions;
13
+ /** Public source evidence for reopening live data; never restored as local permission. */
14
+ readonly liveEvidence: Readonly<Record<string, string>>;
15
+ readonly checksum: string;
16
+ }
17
+ export interface ObservedHistoryRepository {
18
+ begin(scope: ObservationScope): Promise<StoredObservedHistory>;
19
+ transition(scope: ObservationScope, generation: string, verified: VerifiedTrustTransition, at: number): Promise<VersionComparison>;
20
+ observe(scope: ObservationScope, generation: string, points: readonly VersionObservation[], mode: 'current' | 'historical', at: number, live?: {
21
+ readonly chain: string;
22
+ readonly evidence: string;
23
+ }, signal?: AbortSignal): Promise<VersionComparison>;
24
+ }
25
+ export declare function broadcastTrustPolicyChange(): void;
26
+ export declare function broadcastWitnessPolicyChange(): void;
27
+ export declare class POIObservedHistoryStore implements ObservedHistoryRepository {
28
+ transition(scope: ObservationScope, generation: string, verified: VerifiedTrustTransition, at: number): Promise<VersionComparison>;
29
+ private open;
30
+ private transaction;
31
+ begin(scope: ObservationScope): Promise<StoredObservedHistory>;
32
+ observe(scope: ObservationScope, generation: string, points: readonly VersionObservation[], mode: 'current' | 'historical', at: number, live?: {
33
+ readonly chain: string;
34
+ readonly evidence: string;
35
+ }, signal?: AbortSignal): Promise<VersionComparison>;
36
+ list(): Promise<readonly StoredObservedHistory[]>;
37
+ reset(id: string): Promise<void>;
38
+ }
39
+ /** Explicit test repository with the same comparison rules; production never falls back to memory. */
40
+ export declare class MemoryPOIObservedHistory implements ObservedHistoryRepository {
41
+ private readonly records;
42
+ transition(scope: ObservationScope, generation: string, verified: VerifiedTrustTransition, at: number): Promise<VersionComparison>;
43
+ begin(scope: ObservationScope): Promise<StoredObservedHistory>;
44
+ observe(scope: ObservationScope, generation: string, points: readonly VersionObservation[], mode: 'current' | 'historical', at: number, live?: {
45
+ readonly chain: string;
46
+ readonly evidence: string;
47
+ }, signal?: AbortSignal): Promise<VersionComparison>;
48
+ }
49
+ //# sourceMappingURL=poiObservedHistory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"poiObservedHistory.d.ts","sourceRoot":"","sources":["../src/poiObservedHistory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,uBAAuB,EAAW,gBAAgB,EAAC,kBAAkB,EAAC,iBAAiB,EAAC,MAAM,+BAA+B,CAAC;AAE3I,eAAO,MAAM,uBAAuB,6BAA2B,CAAC;AAChE,MAAM,WAAW,gBAAgB;IAAE,QAAQ,CAAC,EAAE,EAAC,MAAM,CAAC;IAAA,QAAQ,CAAC,QAAQ,EAAC,MAAM,CAAC;IAAA,QAAQ,CAAC,gBAAgB,EAAC,MAAM,CAAC;IAAA,QAAQ,CAAC,UAAU,EAAC,MAAM,CAAC;CAAC;AAC5I,MAAM,WAAW,qBAAsB,SAAQ,gBAAgB;IAC3D,QAAQ,CAAC,UAAU,EAAC,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ptyObservedVersions, observedVersionsChecksum } from '@open-charging-cloud/wwcp-poi';
2
+ export const observedHistoryDatabase = 'ChargyPOIObservedHistory';
3
+ function checked(value) {
4
+ if (value === null || typeof value !== 'object')
5
+ throw new Error('Invalid stored version history');
6
+ const raw = value, state = raw['state'];
7
+ if (state === null || typeof state !== 'object' || !('version' in state) || state.version !== 1)
8
+ throw new Error('Invalid stored history schema');
9
+ const record = value;
10
+ const { checksum, ...body } = record;
11
+ if (typeof record.id !== 'string' || typeof record.policyId !== 'string' || typeof record.roamingNetworkId !== 'string' || typeof record.operatorId !== 'string' ||
12
+ typeof record.generation !== 'string' || !Number.isFinite(record.updatedAt) ||
13
+ checksum !== observedVersionsChecksum(body))
14
+ throw new Error('Stored version history integrity check failed');
15
+ if (record.state.points.some(point => point.kind === 'checkpoint' && point.rootDigest === undefined))
16
+ return seal({ ...record, state: { ...record.state, points: record.state.points.map(point => point.kind === 'checkpoint' && point.rootDigest === undefined ? checkpointVersionObservation(Checkpoint.parse(parseJSON(point.original))) : point) } });
17
+ return record;
18
+ }
19
+ function seal(input) {
20
+ const { checksum: _old, ...body } = input;
21
+ if (new TextEncoder().encode(JSON.stringify(body)).length > 16 * 1024 * 1024)
22
+ throw new Error('Local version history capacity reached');
23
+ return { ...body, checksum: observedVersionsChecksum(body) };
24
+ }
25
+ function empty(scope) {
26
+ return seal({ ...scope, generation: crypto.randomUUID(), updatedAt: Date.now(), state: emptyObservedVersions(), liveEvidence: {} });
27
+ }
28
+ function apply(record, scope, generation, points, mode, at, live) {
29
+ if (record.id !== scope.id || record.policyId !== scope.policyId || record.roamingNetworkId !== scope.roamingNetworkId || record.operatorId !== scope.operatorId || record.generation !== generation)
30
+ throw new Error('Local version-history scope changed or was reset during verification');
31
+ const comparison = compareObservedVersions(record.state, points, mode, at);
32
+ const liveEvidence = { ...record.liveEvidence };
33
+ if (comparison.accepted && mode === 'current' && live !== undefined)
34
+ liveEvidence[live.chain] = live.evidence;
35
+ return { record: seal({ ...record, state: comparison.state, updatedAt: at, liveEvidence }), comparison };
36
+ }
37
+ let connection;
38
+ let channel;
39
+ function notifyReset() {
40
+ if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function')
41
+ window.dispatchEvent(new Event('chargy-poi-history-reset'));
42
+ }
43
+ function resetChannel() {
44
+ if (channel === undefined && typeof window !== 'undefined' && typeof window.addEventListener === 'function' && typeof BroadcastChannel !== 'undefined') {
45
+ channel = new BroadcastChannel('chargy-poi-history');
46
+ channel.onmessage = (event) => {
47
+ if (event.data === 'reset')
48
+ notifyReset();
49
+ if (event.data === 'policy-change')
50
+ notifyPolicyChange();
51
+ if (event.data === 'witness-change')
52
+ notifyWitnessChange();
53
+ // A message only invalidates local work. It carries no trusted state or verdict.
54
+ if (event.data !== null && typeof event.data === 'object' && 'type' in event.data && event.data.type === 'observations')
55
+ window.dispatchEvent(new Event('chargy-poi-observations-changed'));
56
+ };
57
+ }
58
+ }
59
+ function notifyPolicyChange() { if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function')
60
+ window.dispatchEvent(new Event('chargy-poi-policy-change')); }
61
+ export function broadcastTrustPolicyChange() { resetChannel(); notifyPolicyChange(); channel?.postMessage('policy-change'); }
62
+ function notifyWitnessChange() { if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function')
63
+ window.dispatchEvent(new Event('chargy-poi-witness-change')); }
64
+ export function broadcastWitnessPolicyChange() { resetChannel(); notifyWitnessChange(); channel?.postMessage('witness-change'); }
65
+ export class POIObservedHistoryStore {
66
+ async transition(scope, generation, verified, at) {
67
+ const result = await this.transaction('readwrite', (store, done, fail) => {
68
+ const request = store.get(scope.id);
69
+ request.onsuccess = () => {
70
+ try {
71
+ const record = checked(request.result);
72
+ apply(record, scope, generation, [], 'historical', at);
73
+ const report = applyVerifiedTrustTransition(record.state, verified, at);
74
+ store.put(seal({ ...record, state: report.state, updatedAt: at }));
75
+ done({ report, changed: JSON.stringify(record.state) !== JSON.stringify(report.state) });
76
+ }
77
+ catch (error) {
78
+ fail(error);
79
+ }
80
+ };
81
+ });
82
+ if (result.changed)
83
+ channel?.postMessage({ type: 'observations', scopeId: scope.id });
84
+ return result.report;
85
+ }
86
+ async open() {
87
+ resetChannel();
88
+ connection ??= new Promise((resolve, reject) => {
89
+ if (typeof indexedDB === 'undefined') {
90
+ reject(new Error('Persistent version history unavailable'));
91
+ return;
92
+ }
93
+ const request = indexedDB.open(observedHistoryDatabase, 1);
94
+ let blocked = false;
95
+ request.onupgradeneeded = () => { request.result.createObjectStore('scopes', { keyPath: 'id' }); };
96
+ request.onblocked = () => { blocked = true; reject(new Error('Version history storage blocked by another tab')); };
97
+ request.onerror = () => { reject(request.error ?? new Error('Version history storage unavailable')); };
98
+ request.onsuccess = () => { const db = request.result; if (blocked) {
99
+ db.close();
100
+ return;
101
+ } db.onversionchange = () => { db.close(); connection = undefined; }; db.onclose = () => { connection = undefined; }; resolve(db); };
102
+ }).catch((error) => { connection = undefined; throw error; });
103
+ return connection;
104
+ }
105
+ async transaction(mode, run, signal) {
106
+ const db = await this.open();
107
+ signal?.throwIfAborted();
108
+ return new Promise((resolve, reject) => {
109
+ const tx = db.transaction('scopes', mode);
110
+ let answer;
111
+ let failure;
112
+ const abort = () => { try {
113
+ tx.abort();
114
+ }
115
+ catch { /* Completed. */ } };
116
+ const fail = (error) => { failure = error; abort(); };
117
+ signal?.addEventListener('abort', abort, { once: true });
118
+ tx.oncomplete = () => { signal?.removeEventListener('abort', abort); if (answer === undefined)
119
+ reject(new Error('Version history returned no result'));
120
+ else
121
+ resolve(answer.value); };
122
+ tx.onabort = () => { signal?.removeEventListener('abort', abort); reject(failure instanceof Error ? failure : tx.error ?? new Error('Version history operation cancelled')); };
123
+ try {
124
+ run(tx.objectStore('scopes'), value => { answer = { value }; }, fail);
125
+ }
126
+ catch (error) {
127
+ fail(error);
128
+ }
129
+ });
130
+ }
131
+ async begin(scope) {
132
+ return this.transaction('readwrite', (store, done, fail) => {
133
+ const request = store.get(scope.id);
134
+ request.onsuccess = () => { try {
135
+ const record = request.result === undefined ? empty(scope) : checked(request.result);
136
+ if (request.result === undefined)
137
+ store.put(record);
138
+ done(record);
139
+ }
140
+ catch (error) {
141
+ fail(error);
142
+ } };
143
+ });
144
+ }
145
+ async observe(scope, generation, points, mode, at, live, signal) {
146
+ const result = await this.transaction('readwrite', (store, done, fail) => {
147
+ const request = store.get(scope.id);
148
+ request.onsuccess = () => {
149
+ try {
150
+ const before = checked(request.result), result = apply(before, scope, generation, points, mode, at, live);
151
+ // Include newly supplied links and succession, not timestamps/live audit exports.
152
+ const changed = JSON.stringify(before.state) !== JSON.stringify(result.record.state);
153
+ store.put(result.record);
154
+ done({ report: result.comparison, changed });
155
+ }
156
+ catch (error) {
157
+ fail(error);
158
+ }
159
+ };
160
+ }, signal);
161
+ // Only other documents receive the hint, after commit. Identical rechecks cannot echo.
162
+ if (result.changed)
163
+ channel?.postMessage({ type: 'observations', scopeId: scope.id });
164
+ return result.report;
165
+ }
166
+ async list() {
167
+ return this.transaction('readonly', (store, done, fail) => { const request = store.getAll(); request.onsuccess = () => { try {
168
+ done(request.result.map(checked));
169
+ }
170
+ catch (error) {
171
+ fail(error);
172
+ } }; });
173
+ }
174
+ async reset(id) {
175
+ await this.transaction('readwrite', (store, done, fail) => { const request = store.get(id); request.onsuccess = () => { try {
176
+ const record = checked(request.result);
177
+ store.put(empty(record));
178
+ done(true);
179
+ }
180
+ catch (error) {
181
+ fail(error);
182
+ } }; });
183
+ notifyReset();
184
+ channel?.postMessage('reset');
185
+ }
186
+ }
187
+ /** Explicit test repository with the same comparison rules; production never falls back to memory. */
188
+ export class MemoryPOIObservedHistory {
189
+ records = new Map();
190
+ async transition(scope, generation, verified, at) {
191
+ const record = checked(this.records.get(scope.id));
192
+ apply(record, scope, generation, [], 'historical', at);
193
+ const report = applyVerifiedTrustTransition(record.state, verified, at);
194
+ this.records.set(scope.id, seal({ ...record, state: report.state, updatedAt: at }));
195
+ return Promise.resolve(report);
196
+ }
197
+ async begin(scope) { const record = this.records.get(scope.id) ?? empty(scope); this.records.set(scope.id, record); return Promise.resolve(record); }
198
+ async observe(scope, generation, points, mode, at, live, signal) {
199
+ signal?.throwIfAborted();
200
+ const result = apply(checked(this.records.get(scope.id)), scope, generation, points, mode, at, live);
201
+ this.records.set(scope.id, result.record);
202
+ return Promise.resolve(result.comparison);
203
+ }
204
+ }
205
+ //# sourceMappingURL=poiObservedHistory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"poiObservedHistory.js","sourceRoot":"","sources":["../src/poiObservedHistory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,4BAA4B,EAAC,SAAS,EAAC,4BAA4B,EAAC,uBAAuB,EAAC,qBAAqB,EAAC,wBAAwB,EAAC,MAAM,+BAA+B,CAAC;AAGpM,MAAM,CAAC,MAAM,uBAAuB,GAAC,0BAA0B,CAAC;AAahE,SAAS,OAAO,CAAC,KAAa;IAC1B,IAAG,KAAK,KAAG,IAAI,IAAE,OAAO,KAAK,KAAG,QAAQ;QAAC,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IAC3F,MAAM,GAAG,GAAC,KAA+B,EAAC,KAAK,GAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC7D,IAAG,KAAK,KAAG,IAAI,IAAE,OAAO,KAAK,KAAG,QAAQ,IAAE,CAAC,CAAC,SAAS,IAAI,KAAK,CAAC,IAAE,KAAK,CAAC,OAAO,KAAG,CAAC;QAAC,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACpI,MAAM,MAAM,GAAC,KAA8B,CAAC;IAC5C,MAAM,EAAC,QAAQ,EAAC,GAAG,IAAI,EAAC,GAAC,MAAM,CAAC;IAChC,IAAG,OAAO,MAAM,CAAC,EAAE,KAAG,QAAQ,IAAE,OAAO,MAAM,CAAC,QAAQ,KAAG,QAAQ,IAAE,OAAO,MAAM,CAAC,gBAAgB,KAAG,QAAQ,IAAE,OAAO,MAAM,CAAC,U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CAAC,CAAC,CAAA,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA,CAAC;IAC5L,KAAK,CAAC,OAAO,CAAC,KAAsB,EAAC,UAAiB,EAAC,MAAoC,EAAC,IAA2B,EAAC,EAAS,EACpI,IAAsD,EAAC,MAAmB;QAC1E,MAAM,EAAE,cAAc,EAAE,CAAC;QAAA,MAAM,MAAM,GAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,EAAC,KAAK,EAAC,UAAU,EAAC,MAAM,EAAC,IAAI,EAAC,EAAE,EAAC,IAAI,CAAC,CAAC;QAAA,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAAA,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAC7M,CAAC;CACJ","sourcesContent":["import {Checkpoint,checkpointVersionObservation,parseJSON,applyVerifiedTrustTransition,compareObservedVersions,emptyObservedVersions,observedVersionsChecksum} from '@open-charging-cloud/wwcp-poi';\nimport type {VerifiedTrustTransition,JSONValue,ObservedVersions,VersionObservation,VersionComparison} from '@open-charging-cloud/wwcp-poi';\n\nexport const observedHistoryDatabase='ChargyPOIObservedHistory';\nexport interface ObservationScope {readonly id:string;readonly policyId:string;readonly roamingNetworkId:string;readonly operatorId:string;}\nexport interface StoredObservedHistory extends ObservationScope {\n readonly generation:string;readonly updatedAt:number;readonly state:ObservedVersions;\n /** Public source evidence for reopening live data; never restored as local permission. */\n readonly liveEvidence:Readonly<Record<string,string>>;readonly checksum:string;\n}\nexport interface ObservedHistoryRepository {\n begin(scope:ObservationScope):Promise<StoredObservedHistory>;\n transition(scope:ObservationScope,generation:string,verified:VerifiedTrustTransition,at:number):Promise<VersionComparison>;\n observe(scope:ObservationScope,generation:string,points:readonly VersionObservation[],mode:'current'|'historical',at:number,\n live?:{readonly chain:string;readonly evidence:string},signal?:AbortSignal):Promise<VersionComparison>;\n}\nfunction checked(value:unknown):StoredObservedHistory {\n if(value===null||typeof value!=='object')throw new Error('Invalid stored version history');\n const raw=value as Record<string,unknown>,state=raw['state'];\n if(state===null||typeof state!=='object'||!('version' in state)||state.version!==1)throw new Error('Invalid stored history schema');\n const record=value as StoredObservedHistory;\n const {checksum,...body}=record;\n if(typeof record.id!=='string'||typeof record.policyId!=='string'||typeof record.roamingNetworkId!=='string'||typeof record.operatorId!=='string'||\n typeof record.generation!=='string'||!Number.isFinite(record.updatedAt)||\n checksum!==observedVersionsChecksum(body as unknown as JSONValue))throw new Error('Stored version history integrity check failed');\n if(record.state.points.some(point=>point.kind==='checkpoint'&&point.rootDigest===undefined))return seal({...record,state:{...record.state,points:record.state.points.map(point=>\n point.kind==='checkpoint'&&point.rootDigest===undefined?checkpointVersionObservation(Checkpoint.parse(parseJSON(point.original))):point)}});\n return record;\n}\nfunction seal(input:Omit<StoredObservedHistory,'checksum'>):StoredObservedHistory {\n const {checksum:_old,...body}=input as Omit<StoredObservedHistory,'checksum'>&{checksum?:string};\n if(new TextEncoder().encode(JSON.stringify(body)).length>16*1024*1024)throw new Error('Local version history capacity reached');\n return {...body,checksum:observedVersionsChecksum(body as unknown as JSONValue)};\n}\nfunction empty(scope:ObservationScope):StoredObservedHistory {\n return seal({...scope,generation:crypto.randomUUID(),updatedAt:Date.now(),state:emptyObservedVersions(),liveEvidence:{}});\n}\nfunction apply(record:StoredObservedHistory,scope:ObservationScope,generation:string,points:readonly VersionObservation[],mode:'current'|'historical',at:number,\n live?:{readonly chain:string;readonly evidence:string}):{record:StoredObservedHistory;comparison:VersionComparison} {\n if(record.id!==scope.id||record.policyId!==scope.policyId||record.roamingNetworkId!==scope.roamingNetworkId||record.operatorId!==scope.operatorId||record.generation!==generation)\n throw new Error('Local version-history scope changed or was reset during verification');\n const comparison=compareObservedVersions(record.state,points,mode,at);\n const liveEvidence={...record.liveEvidence};\n if(comparison.accepted&&mode==='current'&&live!==undefined)liveEvidence[live.chain]=live.evidence;\n return {record:seal({...record,state:comparison.state,updatedAt:at,liveEvidence}),comparison};\n}\nlet connection:Promise<IDBDatabase>|undefined;\nlet channel:BroadcastChannel|undefined;\nfunction notifyReset():void {\n if(typeof window!=='undefined'&&typeof window.dispatchEvent==='function')window.dispatchEvent(new Event('chargy-poi-history-reset'));\n}\nfunction resetChannel():void {\n if(channel===undefined&&typeof window!=='undefined'&&typeof window.addEventListener==='function'&&typeof BroadcastChannel!=='undefined'){\n channel=new BroadcastChannel('chargy-poi-history');channel.onmessage=(event:MessageEvent<unknown>):void=>{if(event.data==='reset')notifyReset();if(event.data==='policy-change')notifyPolicyChange();if(event.data==='witness-change')notifyWitnessChange();\n // A message only invalidates local work. It carries no trusted state or verdict.\n if(event.data!==null&&typeof event.data==='object'&&'type' in event.data&&event.data.type==='observations')\n window.dispatchEvent(new Event('chargy-poi-observations-changed'));\n };\n }\n}\nfunction notifyPolicyChange():void{if(typeof window!=='undefined'&&typeof window.dispatchEvent==='function')window.dispatchEvent(new Event('chargy-poi-policy-change'));}\nexport function broadcastTrustPolicyChange():void{resetChannel();notifyPolicyChange();channel?.postMessage('policy-change');}\nfunction notifyWitnessChange():void{if(typeof window!=='undefined'&&typeof window.dispatchEvent==='function')window.dispatchEvent(new Event('chargy-poi-witness-change'));}\nexport function broadcastWitnessPolicyChange():void{resetChannel();notifyWitnessChange();channel?.postMessage('witness-change');}\nexport class POIObservedHistoryStore implements ObservedHistoryRepository {\n public async transition(scope:ObservationScope,generation:string,verified:VerifiedTrustTransition,at:number):Promise<VersionComparison>{\n const result=await this.transaction<{report:VersionComparison;changed:boolean}>('readwrite',(store,done,fail)=>{const request=store.get(scope.id);request.onsuccess=():void=>{try{\n const record=checked(request.result);apply(record,scope,generation,[],'historical',at);\n const report=applyVerifiedTrustTransition(record.state,verified,at);\n store.put(seal({...record,state:report.state,updatedAt:at}));done({report,changed:JSON.stringify(record.state)!==JSON.stringify(report.state)});\n }catch(error){fail(error);}};});\n if(result.changed)channel?.postMessage({type:'observations',scopeId:scope.id});\n return result.report;\n }\n private async open():Promise<IDBDatabase> {\n resetChannel();\n connection??=new Promise<IDBDatabase>((resolve,reject)=>{\n if(typeof indexedDB==='undefined'){reject(new Error('Persistent version history unavailable'));return;}\n const request=indexedDB.open(observedHistoryDatabase,1);let blocked=false;\n request.onupgradeneeded=():void=>{request.result.createObjectStore('scopes',{keyPath:'id'});};\n request.onblocked=():void=>{blocked=true;reject(new Error('Version history storage blocked by another tab'));};\n request.onerror=():void=>{reject(request.error??new Error('Version history storage unavailable'));};\n request.onsuccess=():void=>{const db=request.result;if(blocked){db.close();return;}db.onversionchange=():void=>{db.close();connection=undefined;};db.onclose=():void=>{connection=undefined;};resolve(db);};\n }).catch((error:unknown)=>{connection=undefined;throw error;});\n return connection;\n }\n private async transaction<T>(mode:IDBTransactionMode,run:(store:IDBObjectStore,done:(value:T)=>void,fail:(error:unknown)=>void)=>void,signal?:AbortSignal):Promise<T> {\n const db=await this.open();signal?.throwIfAborted();\n return new Promise<T>((resolve,reject)=>{\n const tx=db.transaction('scopes',mode);let answer:{value:T}|undefined;let failure:unknown;\n const abort=():void=>{try{tx.abort();}catch{/* Completed. */}};\n const fail=(error:unknown):void=>{failure=error;abort();};signal?.addEventListener('abort',abort,{once:true});\n tx.oncomplete=():void=>{signal?.removeEventListener('abort',abort);if(answer===undefined)reject(new Error('Version history returned no result'));else resolve(answer.value);};\n tx.onabort=():void=>{signal?.removeEventListener('abort',abort);reject(failure instanceof Error?failure:tx.error??new Error('Version history operation cancelled'));};\n try{run(tx.objectStore('scopes'),value=>{answer={value};},fail);}catch(error){fail(error);}\n });\n }\n public async begin(scope:ObservationScope):Promise<StoredObservedHistory> {\n return this.transaction('readwrite',(store,done,fail)=>{\n const request=store.get(scope.id);request.onsuccess=():void=>{try{const record=request.result===undefined?empty(scope):checked(request.result);if(request.result===undefined)store.put(record);done(record);}catch(error){fail(error);}};\n });\n }\n public async observe(scope:ObservationScope,generation:string,points:readonly VersionObservation[],mode:'current'|'historical',at:number,\n live?:{readonly chain:string;readonly evidence:string},signal?:AbortSignal):Promise<VersionComparison> {\n const result=await this.transaction<{report:VersionComparison;changed:boolean}>('readwrite',(store,done,fail)=>{\n const request=store.get(scope.id);request.onsuccess=():void=>{try{\n const before=checked(request.result),result=apply(before,scope,generation,points,mode,at,live);\n // Include newly supplied links and succession, not timestamps/live audit exports.\n const changed=JSON.stringify(before.state)!==JSON.stringify(result.record.state);\n store.put(result.record);done({report:result.comparison,changed});\n }catch(error){fail(error);}};\n },signal);\n // Only other documents receive the hint, after commit. Identical rechecks cannot echo.\n if(result.changed)channel?.postMessage({type:'observations',scopeId:scope.id});\n return result.report;\n }\n public async list():Promise<readonly StoredObservedHistory[]> {\n return this.transaction('readonly',(store,done,fail)=>{const request=store.getAll();request.onsuccess=():void=>{try{done((request.result as unknown[]).map(checked));}catch(error){fail(error);}};});\n }\n public async reset(id:string):Promise<void> {\n await this.transaction<true>('readwrite',(store,done,fail)=>{const request=store.get(id);request.onsuccess=():void=>{try{const record=checked(request.result);store.put(empty(record));done(true);}catch(error){fail(error);}};});\n notifyReset();channel?.postMessage('reset');\n }\n}\n\n/** Explicit test repository with the same comparison rules; production never falls back to memory. */\nexport class MemoryPOIObservedHistory implements ObservedHistoryRepository {\n private readonly records=new Map<string,StoredObservedHistory>();\n public async transition(scope:ObservationScope,generation:string,verified:VerifiedTrustTransition,at:number):Promise<VersionComparison>{\n const record=checked(this.records.get(scope.id));apply(record,scope,generation,[],'historical',at);\n const report=applyVerifiedTrustTransition(record.state,verified,at);this.records.set(scope.id,seal({...record,state:report.state,updatedAt:at}));return Promise.resolve(report);\n }\n public async begin(scope:ObservationScope):Promise<StoredObservedHistory> {const record=this.records.get(scope.id)??empty(scope);this.records.set(scope.id,record);return Promise.resolve(record);}\n public async observe(scope:ObservationScope,generation:string,points:readonly VersionObservation[],mode:'current'|'historical',at:number,\n live?:{readonly chain:string;readonly evidence:string},signal?:AbortSignal):Promise<VersionComparison> {\n signal?.throwIfAborted();const result=apply(checked(this.records.get(scope.id)),scope,generation,points,mode,at,live);this.records.set(scope.id,result.record);return Promise.resolve(result.comparison);\n }\n}\n"]}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Returns the default fetch implementation used by WWCP POI loaders when no
3
+ * per-call `options.fetch` override is provided.
4
+ */
5
+ export declare function getDefaultPOIFetch(): typeof fetch;
6
+ /**
7
+ * Overrides the default fetch implementation used by WWCP POI loaders (for
8
+ * example, Electron's main-process bridge in ChargyDesktopApp).
9
+ */
10
+ export declare function setDefaultPOIFetch(fetchFn: typeof fetch): void;
11
+ export declare function readResponseWithinLimit(response: Response, maxPayloadBytes: number): Promise<Uint8Array>;
12
+ //# sourceMappingURL=poiTransport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"poiTransport.d.ts","sourceRoot":"","sources":["../src/poiTransport.ts"],"names":[],"mappings":"AAmBA;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,KAAK,CAEjD;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,KAAK,GAAG,IAAI,CAE9D;AAED,wBAAsB,uBAAuB,CAAC,QAAQ,EAAS,QAAQ,EACzB,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAgE1F"}
@@ -0,0 +1,74 @@
1
+ /*
2
+ * Copyright (c) 2018-2026 GraphDefined GmbH <achim.friedland@graphdefined.com>
3
+ * This file is part of ChargyGUI <https://github.com/OpenChargingCloud/ChargyGUI.TS>
4
+ *
5
+ * Licensed under the Affero GPL license, Version 3.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.gnu.org/licenses/agpl.html
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ let defaultPOIFetch = (input, init) => globalThis.fetch(input, init);
18
+ /**
19
+ * Returns the default fetch implementation used by WWCP POI loaders when no
20
+ * per-call `options.fetch` override is provided.
21
+ */
22
+ export function getDefaultPOIFetch() {
23
+ return defaultPOIFetch;
24
+ }
25
+ /**
26
+ * Overrides the default fetch implementation used by WWCP POI loaders (for
27
+ * example, Electron's main-process bridge in ChargyDesktopApp).
28
+ */
29
+ export function setDefaultPOIFetch(fetchFn) {
30
+ defaultPOIFetch = fetchFn;
31
+ }
32
+ export async function readResponseWithinLimit(response, maxPayloadBytes) {
33
+ const contentLengthHeader = response.headers.get("content-length");
34
+ if (contentLengthHeader != null) {
35
+ const contentLength = Number(contentLengthHeader);
36
+ if (Number.isFinite(contentLength) &&
37
+ contentLength > maxPayloadBytes) {
38
+ throw new Error("External verification payload exceeds configured limit.");
39
+ }
40
+ }
41
+ if (response.body == null) {
42
+ const data = new Uint8Array(await response.arrayBuffer());
43
+ if (data.byteLength > maxPayloadBytes)
44
+ throw new Error("External verification payload exceeds configured limit.");
45
+ return data;
46
+ }
47
+ const reader = response.body.getReader();
48
+ const chunks = new Array();
49
+ let length = 0;
50
+ try {
51
+ for (;;) {
52
+ const { done, value } = await reader.read();
53
+ if (done)
54
+ break;
55
+ length += value.byteLength;
56
+ if (length > maxPayloadBytes) {
57
+ await reader.cancel();
58
+ throw new Error("External verification payload exceeds configured limit.");
59
+ }
60
+ chunks.push(value);
61
+ }
62
+ }
63
+ finally {
64
+ reader.releaseLock();
65
+ }
66
+ const data = new Uint8Array(length);
67
+ let offset = 0;
68
+ for (const chunk of chunks) {
69
+ data.set(chunk, offset);
70
+ offset += chunk.byteLength;
71
+ }
72
+ return data;
73
+ }
74
+ //# sourceMappingURL=poiTransport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"poiTransport.js","sourceRoot":"","sources":["../src/poiT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I,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;YAE5C,IAAI,IAAI;gBACJ,MAAM;YAEV,MAAM,IAAI,KAAK,CAAC,UAAU,CAAC;YAE3B,IAAI,MAAM,GAAG,eAAe,EAC5B,CAAC;gBACG,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC;gBACtB,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;YAC/E,CAAC;YAED,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC;IACL,CAAC;YAED,CAAC;QACG,MAAM,CAAC,WAAW,EAAE,CAAC;IACzB,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;IACpC,IAAI,MAAM,GAAG,CAAC,CAAC;IAEf,KAAK,MAAM,KAAK,IAAI,MAAM,EAC1B,CAAC;QACG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,UAAU,CAAC;IAC/B,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC","sourcesContent":["/*\n * Copyright (c) 2018-2026 GraphDefined GmbH <achim.friedland@graphdefined.com>\n * This file is part of ChargyGUI <https://github.com/OpenChargingCloud/ChargyGUI.TS>\n *\n * Licensed under the Affero GPL license, Version 3.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.gnu.org/licenses/agpl.html\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nlet defaultPOIFetch: typeof fetch = (input, init) => globalThis.fetch(input, init);\n\n/**\n * Returns the default fetch implementation used by WWCP POI loaders when no\n * per-call `options.fetch` override is provided.\n */\nexport function getDefaultPOIFetch(): typeof fetch {\n return defaultPOIFetch;\n}\n\n/**\n * Overrides the default fetch implementation used by WWCP POI loaders (for\n * example, Electron's main-process bridge in ChargyDesktopApp).\n */\nexport function setDefaultPOIFetch(fetchFn: typeof fetch): void {\n defaultPOIFetch = fetchFn;\n}\n\nexport async function readResponseWithinLimit(response: Response,\n maxPayloadBytes: number): Promise<Uint8Array>\n{\n const contentLengthHeader = response.headers.get(\"content-length\");\n\n if (contentLengthHeader != null)\n {\n const contentLength = Number(contentLengthHeader);\n\n if (Number.isFinite(contentLength) &&\n contentLength > maxPayloadBytes)\n {\n throw new Error(\"External verification payload exceeds configured limit.\");\n }\n }\n\n if (response.body == null)\n {\n const data = new Uint8Array(await response.arrayBuffer());\n\n if (data.byteLength > maxPayloadBytes)\n throw new Error(\"External verification payload exceeds configured limit.\");\n\n return data;\n }\n\n const reader = response.body.getReader();\n const chunks = new Array<Uint8Array>();\n let length = 0;\n\n try\n {\n for (;;)\n {\n const { done, value } = await reader.read();\n\n if (done)\n break;\n\n length += value.byteLength;\n\n if (length > maxPayloadBytes)\n {\n await reader.cancel();\n throw new Error(\"External verification payload exceeds configured limit.\");\n }\n\n chunks.push(value);\n }\n }\n finally\n {\n reader.releaseLock();\n }\n\n const data = new Uint8Array(length);\n let offset = 0;\n\n for (const chunk of chunks)\n {\n data.set(chunk, offset);\n offset += chunk.byteLength;\n }\n\n return data;\n}\n"]}