@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.
- package/CHANGELOG.md +87 -0
- package/LICENSE +661 -0
- package/README.md +48 -2
- package/SECURITY.md +21 -0
- package/dist/anchorKeyTrust.d.ts +9 -0
- package/dist/anchorKeyTrust.d.ts.map +1 -0
- package/dist/anchorKeyTrust.js +24 -0
- package/dist/anchorKeyTrust.js.map +1 -0
- package/dist/anchorKeyTrustView.d.ts +14 -0
- package/dist/anchorKeyTrustView.d.ts.map +1 -0
- package/dist/anchorKeyTrustView.js +95 -0
- package/dist/anchorKeyTrustView.js.map +1 -0
- package/dist/browserFiles.d.ts +5 -0
- package/dist/browserFiles.d.ts.map +1 -0
- package/dist/browserFiles.js +100 -0
- package/dist/browserFiles.js.map +1 -0
- package/dist/core/i18n.json +1518 -0
- package/dist/core/package.json +119 -0
- package/dist/core/validationRules.json +8 -0
- package/dist/domHelpers.d.ts +25 -0
- package/dist/domHelpers.d.ts.map +1 -0
- package/dist/domHelpers.js +212 -0
- package/dist/domHelpers.js.map +1 -0
- package/dist/historicalSessionPanel.d.ts +24 -0
- package/dist/historicalSessionPanel.d.ts.map +1 -0
- package/dist/historicalSessionPanel.js +108 -0
- package/dist/historicalSessionPanel.js.map +1 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +56 -0
- package/dist/index.js.map +1 -0
- package/dist/liveLinkTrust.d.ts +208 -0
- package/dist/liveLinkTrust.d.ts.map +1 -0
- package/dist/liveLinkTrust.js +452 -0
- package/dist/liveLinkTrust.js.map +1 -0
- package/dist/livePOISession.d.ts +38 -0
- package/dist/livePOISession.d.ts.map +1 -0
- package/dist/livePOISession.js +193 -0
- package/dist/livePOISession.js.map +1 -0
- package/dist/measurementDetailsRenderer.d.ts +25 -0
- package/dist/measurementDetailsRenderer.d.ts.map +1 -0
- package/dist/measurementDetailsRenderer.js +343 -0
- package/dist/measurementDetailsRenderer.js.map +1 -0
- package/dist/poiConsistencyView.d.ts +3 -0
- package/dist/poiConsistencyView.d.ts.map +1 -0
- package/dist/poiConsistencyView.js +14 -0
- package/dist/poiConsistencyView.js.map +1 -0
- package/dist/poiObservedHistory.d.ts +49 -0
- package/dist/poiObservedHistory.d.ts.map +1 -0
- package/dist/poiObservedHistory.js +205 -0
- package/dist/poiObservedHistory.js.map +1 -0
- package/dist/poiTransport.d.ts +12 -0
- package/dist/poiTransport.d.ts.map +1 -0
- package/dist/poiTransport.js +74 -0
- package/dist/poiTransport.js.map +1 -0
- package/dist/poiTrustContext.d.ts +134 -0
- package/dist/poiTrustContext.d.ts.map +1 -0
- package/dist/poiTrustContext.js +243 -0
- package/dist/poiTrustContext.js.map +1 -0
- package/dist/poiTrustLineage.d.ts +10 -0
- package/dist/poiTrustLineage.d.ts.map +1 -0
- package/dist/poiTrustLineage.js +47 -0
- package/dist/poiTrustLineage.js.map +1 -0
- package/dist/poiURLs.d.ts +5 -0
- package/dist/poiURLs.d.ts.map +1 -0
- package/dist/poiURLs.js +24 -0
- package/dist/poiURLs.js.map +1 -0
- package/dist/poiWitnessManagement.d.ts +3 -0
- package/dist/poiWitnessManagement.d.ts.map +1 -0
- package/dist/poiWitnessManagement.js +127 -0
- package/dist/poiWitnessManagement.js.map +1 -0
- package/dist/poiWitnessTrust.d.ts +26 -0
- package/dist/poiWitnessTrust.d.ts.map +1 -0
- package/dist/poiWitnessTrust.js +90 -0
- package/dist/poiWitnessTrust.js.map +1 -0
- package/dist/pricePublicationData.d.ts +19 -0
- package/dist/pricePublicationData.d.ts.map +1 -0
- package/dist/pricePublicationData.js +83 -0
- package/dist/pricePublicationData.js.map +1 -0
- package/dist/roamingNetworks.d.ts +14 -0
- package/dist/roamingNetworks.d.ts.map +1 -0
- package/dist/roamingNetworks.js +33 -0
- package/dist/roamingNetworks.js.map +1 -0
- package/dist/securityFingerprint.d.ts +16 -0
- package/dist/securityFingerprint.d.ts.map +1 -0
- package/dist/securityFingerprint.js +36 -0
- package/dist/securityFingerprint.js.map +1 -0
- package/dist/securityFingerprintView.d.ts +3 -0
- package/dist/securityFingerprintView.d.ts.map +1 -0
- package/dist/securityFingerprintView.js +61 -0
- package/dist/securityFingerprintView.js.map +1 -0
- package/dist/sessionEvidenceStore.d.ts +23 -0
- package/dist/sessionEvidenceStore.d.ts.map +1 -0
- package/dist/sessionEvidenceStore.js +81 -0
- package/dist/sessionEvidenceStore.js.map +1 -0
- package/dist/sessionMeterKeyView.d.ts +9 -0
- package/dist/sessionMeterKeyView.d.ts.map +1 -0
- package/dist/sessionMeterKeyView.js +55 -0
- package/dist/sessionMeterKeyView.js.map +1 -0
- package/dist/sessionPOIData.d.ts +49 -0
- package/dist/sessionPOIData.d.ts.map +1 -0
- package/dist/sessionPOIData.js +161 -0
- package/dist/sessionPOIData.js.map +1 -0
- package/dist/sessionPOIPanel.d.ts +50 -0
- package/dist/sessionPOIPanel.d.ts.map +1 -0
- package/dist/sessionPOIPanel.js +288 -0
- package/dist/sessionPOIPanel.js.map +1 -0
- package/dist/sessionPriceData.d.ts +17 -0
- package/dist/sessionPriceData.d.ts.map +1 -0
- package/dist/sessionPriceData.js +51 -0
- package/dist/sessionPriceData.js.map +1 -0
- package/dist/sessionPricePanel.d.ts +31 -0
- package/dist/sessionPricePanel.d.ts.map +1 -0
- package/dist/sessionPricePanel.js +222 -0
- package/dist/sessionPricePanel.js.map +1 -0
- package/dist/sessionUIState.d.ts +12 -0
- package/dist/sessionUIState.d.ts.map +1 -0
- package/dist/sessionUIState.js +33 -0
- package/dist/sessionUIState.js.map +1 -0
- package/dist/stationProofData.d.ts +38 -0
- package/dist/stationProofData.d.ts.map +1 -0
- package/dist/stationProofData.js +83 -0
- package/dist/stationProofData.js.map +1 -0
- package/dist/stationProofPanel.d.ts +44 -0
- package/dist/stationProofPanel.d.ts.map +1 -0
- package/dist/stationProofPanel.js +304 -0
- package/dist/stationProofPanel.js.map +1 -0
- package/dist/stationProofView.d.ts +9 -0
- package/dist/stationProofView.d.ts.map +1 -0
- package/dist/stationProofView.js +186 -0
- package/dist/stationProofView.js.map +1 -0
- package/dist/trustAnchorData.d.ts +40 -0
- package/dist/trustAnchorData.d.ts.map +1 -0
- package/dist/trustAnchorData.js +91 -0
- package/dist/trustAnchorData.js.map +1 -0
- package/dist/trustAnchorDataView.d.ts +13 -0
- package/dist/trustAnchorDataView.d.ts.map +1 -0
- package/dist/trustAnchorDataView.js +69 -0
- package/dist/trustAnchorDataView.js.map +1 -0
- package/dist/trustAnchorImport.d.ts +5 -0
- package/dist/trustAnchorImport.d.ts.map +1 -0
- package/dist/trustAnchorImport.js +34 -0
- package/dist/trustAnchorImport.js.map +1 -0
- package/dist/trustAnchorPreview.d.ts +37 -0
- package/dist/trustAnchorPreview.d.ts.map +1 -0
- package/dist/trustAnchorPreview.js +180 -0
- package/dist/trustAnchorPreview.js.map +1 -0
- package/dist/trustManagement.d.ts +34 -0
- package/dist/trustManagement.d.ts.map +1 -0
- package/dist/trustManagement.js +405 -0
- package/dist/trustManagement.js.map +1 -0
- package/dist/trustStore.d.ts +75 -0
- package/dist/trustStore.d.ts.map +1 -0
- package/dist/trustStore.js +408 -0
- package/dist/trustStore.js.map +1 -0
- package/dist/trustTransitionView.d.ts +5 -0
- package/dist/trustTransitionView.d.ts.map +1 -0
- package/dist/trustTransitionView.js +110 -0
- package/dist/trustTransitionView.js.map +1 -0
- package/dist/trustedPublicKeys.d.ts +4 -0
- package/dist/trustedPublicKeys.d.ts.map +1 -0
- package/dist/trustedPublicKeys.js +25 -0
- package/dist/trustedPublicKeys.js.map +1 -0
- package/dist/wwcpPoi.d.ts +2 -0
- package/dist/wwcpPoi.d.ts.map +1 -0
- package/dist/wwcpPoi.js +2 -0
- package/dist/wwcpPoi.js.map +1 -0
- package/documentation/AUDIT.md +262 -0
- package/images/NGI0_tag.svg +149 -0
- package/package.json +75 -4
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { renderPOIConsistency } from './poiConsistencyView.js';
|
|
2
|
+
import { isObject, prettyJSON, parseJSON, parseWitnessPublicationPolicy, WITNESS_PUBLICATION_POLICY_CONTEXT } from '@open-charging-cloud/wwcp-poi';
|
|
3
|
+
import { renderSecurityFingerprint } from './securityFingerprintView.js';
|
|
4
|
+
function asText(value) { return typeof value === 'string' ? value : prettyJSON(value ?? null); }
|
|
5
|
+
export class SessionPricePanel {
|
|
6
|
+
root;
|
|
7
|
+
actions;
|
|
8
|
+
localize;
|
|
9
|
+
language;
|
|
10
|
+
controller = null;
|
|
11
|
+
constructor(root, actions, localize, language) {
|
|
12
|
+
this.root = root;
|
|
13
|
+
this.actions = actions;
|
|
14
|
+
this.localize = localize;
|
|
15
|
+
this.language = language;
|
|
16
|
+
root.className = 'sessionPrices';
|
|
17
|
+
}
|
|
18
|
+
dispose() { this.controller?.abort(); this.controller = null; }
|
|
19
|
+
async open(policyId) {
|
|
20
|
+
this.dispose();
|
|
21
|
+
this.root.replaceChildren();
|
|
22
|
+
this.root.appendChild(document.createElement('h4')).textContent = this.localize('poiPriceTitle');
|
|
23
|
+
if (policyId === '') {
|
|
24
|
+
this.root.appendChild(document.createElement('p')).textContent = this.localize('poiChoosePolicy');
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const body = this.root.appendChild(document.createElement('div'));
|
|
28
|
+
body.className = 'sessionPriceResult';
|
|
29
|
+
body.dataset['state'] = 'idle';
|
|
30
|
+
body.setAttribute('role', 'status');
|
|
31
|
+
if (this.actions.waitingForStart === true) {
|
|
32
|
+
body.dataset['state'] = 'waiting';
|
|
33
|
+
body.textContent = this.localize('poiLivePriceWaiting');
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const button = this.root.appendChild(document.createElement('button'));
|
|
37
|
+
button.type = 'button';
|
|
38
|
+
button.textContent = this.localize(this.actions.hasEvidence ? 'poiPriceRecheck' : 'poiPriceLoad');
|
|
39
|
+
button.dataset['action'] = 'load-prices';
|
|
40
|
+
const run = async (load) => {
|
|
41
|
+
this.dispose();
|
|
42
|
+
const controller = new AbortController();
|
|
43
|
+
this.controller = controller;
|
|
44
|
+
button.disabled = true;
|
|
45
|
+
body.replaceChildren();
|
|
46
|
+
body.dataset['state'] = 'pending';
|
|
47
|
+
body.textContent = this.localize('poiPriceChecking');
|
|
48
|
+
try {
|
|
49
|
+
const checked = load ? await this.actions.load(policyId, controller.signal) : await this.actions.check(policyId, controller.signal);
|
|
50
|
+
controller.signal.throwIfAborted();
|
|
51
|
+
this.render(body, checked, policyId, controller.signal);
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
if (controller.signal.aborted)
|
|
55
|
+
return;
|
|
56
|
+
body.replaceChildren();
|
|
57
|
+
body.dataset['state'] = 'invalid';
|
|
58
|
+
body.appendChild(document.createElement('p')).textContent = this.localize('poiPriceFailed');
|
|
59
|
+
const details = body.appendChild(document.createElement('details'));
|
|
60
|
+
details.appendChild(document.createElement('summary')).textContent = this.localize('poiDiagnostics');
|
|
61
|
+
details.appendChild(document.createElement('pre')).textContent = error instanceof Error ? error.message : String(error);
|
|
62
|
+
}
|
|
63
|
+
finally {
|
|
64
|
+
if (!controller.signal.aborted) {
|
|
65
|
+
button.disabled = false;
|
|
66
|
+
button.textContent = this.localize(this.actions.hasEvidence ? 'poiPriceRecheck' : 'poiPriceLoad');
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
button.onclick = () => { void run(!this.actions.hasEvidence); };
|
|
71
|
+
if (this.actions.hasEvidence)
|
|
72
|
+
await run(false);
|
|
73
|
+
else
|
|
74
|
+
body.textContent = this.localize('poiPriceMissing');
|
|
75
|
+
}
|
|
76
|
+
render(body, checked, policyId, signal) {
|
|
77
|
+
const { price, start, rates, document: source } = checked;
|
|
78
|
+
body.replaceChildren();
|
|
79
|
+
const startOK = start.signaturesValid && start.historicalAssociation === 'rno-attested-at-reading-times';
|
|
80
|
+
const bound = price.applicability === 'bound' && startOK;
|
|
81
|
+
body.dataset['state'] = checked.consistency?.accepted === false || price.publicationBeforeStart === 'invalid' ? 'invalid' : bound && rates.status === 'rates-match' && price.publication === 'valid' && start.status === 'verified' && !price.chainGaps ? 'valid' :
|
|
82
|
+
price.signatures === 'invalid' || price.applicability === 'invalid' || price.publication === 'invalid' || rates.status === 'conflict' ? 'invalid' : 'warning';
|
|
83
|
+
body.dataset['applicability'] = price.applicability;
|
|
84
|
+
body.dataset['publication'] = price.publication;
|
|
85
|
+
body.dataset['rates'] = rates.status;
|
|
86
|
+
const beforeStart = price.publicationBeforeStart === 'witnessed-before-signed-start' && startOK;
|
|
87
|
+
body.dataset['beforeStart'] = beforeStart ? 'witnessed' : price.publicationBeforeStart === 'invalid' ? 'invalid' : 'not-proven';
|
|
88
|
+
const row = (label, state) => {
|
|
89
|
+
const p = body.appendChild(document.createElement('p'));
|
|
90
|
+
p.dataset['state'] = state;
|
|
91
|
+
p.textContent = (state === 'valid' ? '✅ ' : state === 'invalid' ? '❌ ' : '⏳ ') + this.localize(label);
|
|
92
|
+
};
|
|
93
|
+
if (checked.consistency !== undefined)
|
|
94
|
+
body.appendChild(renderPOIConsistency(checked.consistency, this.localize));
|
|
95
|
+
row('poiPriceDefinitionValid', 'valid');
|
|
96
|
+
row(price.signatures === 'valid' ? 'poiPriceSignaturesValid' : price.signatures === 'missing' ? 'poiPriceMissing' : 'poiPriceSignaturesInvalid', price.signatures === 'valid' ? 'valid' : price.signatures === 'missing' ? 'warning' : 'invalid');
|
|
97
|
+
row(startOK ? 'poiPriceStartValid' : 'poiPriceStartUnproven', startOK ? 'valid' : 'invalid');
|
|
98
|
+
const labels = { bound: 'poiPriceBound', unbound: 'poiPriceUnbound', missing: 'poiPriceNoApplicable', invalid: 'poiPriceBindingInvalid', ambiguous: 'poiPriceAmbiguous', unsupported: 'poiPriceUnsupported' };
|
|
99
|
+
row(bound ? 'poiPriceBound' : price.applicability === 'bound' ? 'poiPriceUnbound' : labels[price.applicability], bound ? 'valid' : price.applicability === 'invalid' ? 'invalid' : 'warning');
|
|
100
|
+
if (start.status === 'key-conflict')
|
|
101
|
+
row('poiMeterKeyConflict', 'warning');
|
|
102
|
+
row(rates.status === 'rates-match' && startOK ? 'poiPriceRatesMatch' : rates.status === 'conflict' ? 'poiPriceRatesConflict' : 'poiPriceRatesUnproven', rates.status === 'rates-match' && startOK ? 'valid' : rates.status === 'conflict' ? 'invalid' : 'warning');
|
|
103
|
+
row(price.publication === 'valid' ? 'poiPriceIncluded' : price.publication === 'invalid' ? 'poiPricePublicationInvalid' : 'poiPricePublicationMissing', price.publication === 'valid' ? 'valid' : price.publication === 'invalid' ? 'invalid' : 'warning');
|
|
104
|
+
if (price.publication === 'valid' && !beforeStart)
|
|
105
|
+
row(price.witnessedBy.length > 0 ? 'poiHistoryWitnessed' : 'poiHistoryWitnessMissing', price.witnessedBy.length > 0 ? 'valid' : 'warning');
|
|
106
|
+
const publication = body.appendChild(document.createElement('section'));
|
|
107
|
+
publication.className = 'poiPricePublication';
|
|
108
|
+
publication.dataset['state'] = beforeStart ? 'valid' : price.publicationBeforeStart === 'invalid' ? 'invalid' : 'warning';
|
|
109
|
+
publication.appendChild(document.createElement('p')).textContent = (beforeStart ? '✅ ' : price.publicationBeforeStart === 'invalid' ? '❌ ' : '⏳ ') + this.localize(beforeStart ? 'poiPublicationBeforeStart' : price.publicationBeforeStart === 'invalid' ? 'poiPublicationInvalid' : 'poiPublicationPending');
|
|
110
|
+
if (price.publicationWitnesses !== undefined) {
|
|
111
|
+
publication.appendChild(document.createElement('p')).textContent = this.localize('poiWitnessQuorum') + ': ' + String(price.publicationWitnesses.organizations.length) + ' / ' + String(price.publicationWitnesses.requiredOrganizations);
|
|
112
|
+
publication.appendChild(document.createElement('p')).textContent = this.localize('poiPublicationTimeScope');
|
|
113
|
+
const receiptDetails = publication.appendChild(document.createElement('details'));
|
|
114
|
+
receiptDetails.appendChild(document.createElement('summary')).textContent = this.localize('poiPublicationDetails');
|
|
115
|
+
const receiptList = receiptDetails.appendChild(document.createElement('div'));
|
|
116
|
+
receiptList.className = 'poiPublicationReceipts';
|
|
117
|
+
for (const receipt of price.publicationWitnesses.receipts) {
|
|
118
|
+
const article = receiptList.appendChild(document.createElement('article'));
|
|
119
|
+
article.className = 'poiPublicationReceipt';
|
|
120
|
+
article.dataset['receiptState'] = receipt.status;
|
|
121
|
+
article.appendChild(document.createElement('h5')).textContent = (receipt.organization ?? receipt.witnessId) + ' · ' + receipt.status;
|
|
122
|
+
if (receipt.sourceURL !== undefined)
|
|
123
|
+
article.appendChild(document.createElement('p')).textContent = receipt.sourceURL;
|
|
124
|
+
if (receipt.latestPublicationAt !== undefined)
|
|
125
|
+
article.appendChild(document.createElement('p')).textContent = this.localize('poiPublicationLatest') + ': ' + new Date(receipt.latestPublicationAt).toLocaleString(this.language);
|
|
126
|
+
if (receipt.keyId !== undefined)
|
|
127
|
+
article.appendChild(renderSecurityFingerprint(receipt.keyId, this.localize));
|
|
128
|
+
article.appendChild(document.createElement('p')).textContent = receipt.detail;
|
|
129
|
+
}
|
|
130
|
+
if (price.publicationWitnesses.receipts.length === 0)
|
|
131
|
+
receiptDetails.appendChild(document.createElement('p')).textContent = this.localize('poiPublicationNoReceipts');
|
|
132
|
+
}
|
|
133
|
+
if (this.actions.loadPublication !== undefined && price.selected !== undefined && price.publication === 'valid') {
|
|
134
|
+
const fetchButton = publication.appendChild(document.createElement('button'));
|
|
135
|
+
fetchButton.type = 'button';
|
|
136
|
+
fetchButton.textContent = this.localize('poiPublicationLoad');
|
|
137
|
+
fetchButton.dataset['action'] = 'load-publication';
|
|
138
|
+
fetchButton.onclick = () => {
|
|
139
|
+
fetchButton.disabled = true;
|
|
140
|
+
void this.actions.loadPublication?.(policyId, signal).then(next => { signal.throwIfAborted(); this.render(body, next, policyId, signal); }).catch((error) => {
|
|
141
|
+
if (!signal.aborted) {
|
|
142
|
+
fetchButton.disabled = false;
|
|
143
|
+
const p = publication.appendChild(document.createElement('p'));
|
|
144
|
+
p.textContent = this.localize('poiPublicationLoadFailed') + ': ' + (error instanceof Error ? error.message : String(error));
|
|
145
|
+
p.setAttribute('role', 'alert');
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
body.appendChild(document.createElement('p')).textContent = this.localize(beforeStart ? 'poiPriceWitnessedLimits' : 'poiPriceLimits');
|
|
151
|
+
if (price.chainGaps)
|
|
152
|
+
row('poiPriceChainGaps', 'warning');
|
|
153
|
+
const selected = price.selected;
|
|
154
|
+
if (selected !== undefined) {
|
|
155
|
+
const title = body.appendChild(document.createElement('p'));
|
|
156
|
+
title.className = 'sessionPriceSelected';
|
|
157
|
+
title.textContent = asText(selected.tariff['@id']) + ' · ' + selected.currency;
|
|
158
|
+
const components = body.appendChild(document.createElement('dl'));
|
|
159
|
+
components.className = 'sessionPriceComponents';
|
|
160
|
+
for (const element of selected.elements)
|
|
161
|
+
for (const component of Array.isArray(element['priceComponents']) ? element['priceComponents'] : []) {
|
|
162
|
+
if (!isObject(component))
|
|
163
|
+
continue;
|
|
164
|
+
components.appendChild(document.createElement('dt')).textContent = asText(component['type']);
|
|
165
|
+
components.appendChild(document.createElement('dd')).textContent = asText(component['price']) + ' ' + selected.currency + (component['type'] === 'ENERGY' ? '/kWh' : component['type'] === 'TIME' ? '/h' : '') + ' · ' + this.localize('poiPriceStep') + ': ' + asText(component['stepSize']);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
const details = body.appendChild(document.createElement('details'));
|
|
169
|
+
details.appendChild(document.createElement('summary')).textContent = this.localize('poiPriceDetails');
|
|
170
|
+
const supplied = parseJSON(source.text);
|
|
171
|
+
if (isObject(supplied) && Array.isArray(supplied['witnessCandidates']) && supplied['witnessCandidates'].length > 0) {
|
|
172
|
+
const candidates = details.appendChild(document.createElement('details'));
|
|
173
|
+
candidates.appendChild(document.createElement('summary')).textContent = this.localize('poiWitnessCandidates');
|
|
174
|
+
candidates.appendChild(document.createElement('p')).textContent = this.localize('poiWitnessCandidatesScope');
|
|
175
|
+
candidates.appendChild(document.createElement('p')).textContent = this.localize('poiWitnessSettingsPath');
|
|
176
|
+
try {
|
|
177
|
+
const recommended = parseWitnessPublicationPolicy({ '@context': WITNESS_PUBLICATION_POLICY_CONTEXT, requiredOrganizations: 2, witnesses: supplied['witnessCandidates'] });
|
|
178
|
+
for (const witness of recommended.witnesses) {
|
|
179
|
+
candidates.appendChild(document.createElement('p')).textContent = witness.organization + ' · ' + witness.id;
|
|
180
|
+
for (const key of witness.keys)
|
|
181
|
+
candidates.appendChild(renderSecurityFingerprint(key.id, this.localize));
|
|
182
|
+
}
|
|
183
|
+
candidates.appendChild(document.createElement('pre')).textContent = prettyJSON(recommended.json);
|
|
184
|
+
}
|
|
185
|
+
catch {
|
|
186
|
+
candidates.appendChild(document.createElement('pre')).textContent = prettyJSON(supplied['witnessCandidates']);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
details.appendChild(document.createElement('p')).textContent = this.localize(source.origin === 'network' ? 'poiPriceDownloaded' : 'poiPriceSupplied') + ': ' + source.sourceURL;
|
|
190
|
+
details.appendChild(document.createElement('p')).textContent = new Date(source.receivedAt).toLocaleString(this.language);
|
|
191
|
+
if (selected !== undefined) {
|
|
192
|
+
details.appendChild(document.createElement('p')).textContent = asText(selected.statement['algorithm']);
|
|
193
|
+
details.appendChild(renderSecurityFingerprint(asText(selected.statement['keyId']), this.localize));
|
|
194
|
+
details.appendChild(document.createElement('p')).textContent = this.localize('poiPriceDigest') + ': ' + selected.digest;
|
|
195
|
+
const elements = details.appendChild(document.createElement('details'));
|
|
196
|
+
elements.appendChild(document.createElement('summary')).textContent = this.localize('poiPriceElements');
|
|
197
|
+
elements.appendChild(document.createElement('pre')).textContent = prettyJSON([...selected.elements]);
|
|
198
|
+
}
|
|
199
|
+
for (const diagnostic of [...price.diagnostics, start.detail, rates.detail])
|
|
200
|
+
details.appendChild(document.createElement('p')).textContent = diagnostic;
|
|
201
|
+
const raw = details.appendChild(document.createElement('details'));
|
|
202
|
+
raw.appendChild(document.createElement('summary')).textContent = this.localize('trustDataRawLabel');
|
|
203
|
+
raw.appendChild(document.createElement('pre')).textContent = source.text;
|
|
204
|
+
if (this.actions.save !== undefined) {
|
|
205
|
+
const save = body.appendChild(document.createElement('button'));
|
|
206
|
+
save.type = 'button';
|
|
207
|
+
save.textContent = this.localize('poiHistorySave');
|
|
208
|
+
save.dataset['action'] = 'save-price-evidence';
|
|
209
|
+
save.onclick = () => {
|
|
210
|
+
save.disabled = true;
|
|
211
|
+
void this.actions.save?.(policyId, signal).then(() => { if (!signal.aborted)
|
|
212
|
+
save.textContent = this.localize('poiHistorySaved'); }).catch(() => {
|
|
213
|
+
if (!signal.aborted) {
|
|
214
|
+
save.disabled = false;
|
|
215
|
+
body.appendChild(document.createElement('p')).textContent = this.localize('poiHistorySaveFailed');
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
//# sourceMappingURL=sessionPricePanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessionPricePanel.js","sourceRoot":"","sources":["../src/sessionPricePanel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,yBAAyB,CAAC;AAE7D,OAAO,EAAC,QAAQ,EAAC,UAAU,EAAC,SAAS,EAAC,6BAA6B,EAAC,kCAAkC,EAAC,MAAM,+BAA+B,CAAC;AAI7I,OAAO,EAAC,yBAAyB,EAAC,MAAM,8BAA8B,CAAC;AAEvE,SAAS,MAAM,CAAC,KAAyB,IAAU,OAAO,OAAO,KAAK,KAAG,QAAQ,CAAA,CAAC,CAAA,KAAK,CAAA,CAAC,CAAA,UAAU,CAAC,KAAK,IAAE,IAAI,CAAC,CAAC,CAAA,CAAC;AAWjH,MAAM,OAAO,iBAAiB;IAEU;IAAkC;IACjD;IAA+C;IAF5D,U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AC,IAAG,CAAC,MAAM,CAAC,OAAO;oBAAC,IAAI,CAAC,WAAW,GAAC,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC,KAAK,CAAC,GAAE,EAAE;oBAC5K,IAAG,CAAC,MAAM,CAAC,OAAO,EAAC,CAAC;wBAAA,IAAI,CAAC,QAAQ,GAAC,KAAK,CAAC;wBAAA,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,WAAW,GAAC,IAAI,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAC;oBAAA,CAAC;gBAC7I,CAAC,CAAC,CAAC;YAAA,CAAC,CAAC;QACT,CAAC;IACL,CAAC;CACJ","sourcesContent":["import {renderPOIConsistency} from './poiConsistencyView.js';\nimport type {VersionComparison} from '@open-charging-cloud/wwcp-poi';\nimport {isObject,prettyJSON,parseJSON,parseWitnessPublicationPolicy,WITNESS_PUBLICATION_POLICY_CONTEXT} from '@open-charging-cloud/wwcp-poi';\nimport type {JSONValue,SessionPriceVerification} from '@open-charging-cloud/wwcp-poi';\nimport type {IBoundOCMFResult,IOCMFPriceRateComparison} from '@open-charging-cloud/chargy-core';\nimport type {SessionPriceDocument} from './sessionPriceData.js';\nimport {renderSecurityFingerprint} from './securityFingerprintView.js';\n\nfunction asText(value:JSONValue|undefined):string {return typeof value==='string'?value:prettyJSON(value??null);}\n\nexport interface SessionPriceCheck {readonly consistency?:VersionComparison;readonly price:SessionPriceVerification;readonly start:IBoundOCMFResult;readonly rates:IOCMFPriceRateComparison;readonly document:SessionPriceDocument;}\nexport interface SessionPriceActions {\n readonly hasEvidence:boolean;\n readonly waitingForStart?:boolean;\n readonly check:(policyId:string,signal:AbortSignal)=>Promise<SessionPriceCheck>;\n readonly load:(policyId:string,signal:AbortSignal)=>Promise<SessionPriceCheck>;\n readonly loadPublication?:(policyId:string,signal:AbortSignal)=>Promise<SessionPriceCheck>;\n readonly save?: (policyId:string,signal:AbortSignal)=>Promise<void>;\n}\nexport class SessionPricePanel {\n private controller:AbortController|null=null;\n public constructor(private readonly root:HTMLElement,private readonly actions:SessionPriceActions,\n private readonly localize:(key:string)=>string,private readonly language:string){root.className='sessionPrices';}\n public dispose():void {this.controller?.abort();this.controller=null;}\n public async open(policyId:string):Promise<void>{\n this.dispose();this.root.replaceChildren();this.root.appendChild(document.createElement('h4')).textContent=this.localize('poiPriceTitle');\n if(policyId===''){this.root.appendChild(document.createElement('p')).textContent=this.localize('poiChoosePolicy');return;}\n const body=this.root.appendChild(document.createElement('div'));body.className='sessionPriceResult';body.dataset['state']='idle';body.setAttribute('role','status');\n if(this.actions.waitingForStart===true){body.dataset['state']='waiting';body.textContent=this.localize('poiLivePriceWaiting');return;}\n const button=this.root.appendChild(document.createElement('button'));button.type='button';\n button.textContent=this.localize(this.actions.hasEvidence?'poiPriceRecheck':'poiPriceLoad');button.dataset['action']='load-prices';\n const run=async(load:boolean):Promise<void>=>{\n this.dispose();const controller=new AbortController();this.controller=controller;button.disabled=true;\n body.replaceChildren();body.dataset['state']='pending';body.textContent=this.localize('poiPriceChecking');\n try{\n const checked=load?await this.actions.load(policyId,controller.signal):await this.actions.check(policyId,controller.signal);controller.signal.throwIfAborted();\n this.render(body,checked,policyId,controller.signal);\n }catch(error){\n if(controller.signal.aborted)return;body.replaceChildren();body.dataset['state']='invalid';body.appendChild(document.createElement('p')).textContent=this.localize('poiPriceFailed');\n const details=body.appendChild(document.createElement('details'));details.appendChild(document.createElement('summary')).textContent=this.localize('poiDiagnostics');\n details.appendChild(document.createElement('pre')).textContent=error instanceof Error?error.message:String(error);\n }finally{if(!controller.signal.aborted){button.disabled=false;button.textContent=this.localize(this.actions.hasEvidence?'poiPriceRecheck':'poiPriceLoad');}}\n };\n button.onclick=():void=>{void run(!this.actions.hasEvidence);};\n if(this.actions.hasEvidence)await run(false);else body.textContent=this.localize('poiPriceMissing');\n }\n private render(body:HTMLElement,checked:SessionPriceCheck,policyId:string,signal:AbortSignal):void {\n const {price,start,rates,document:source}=checked;body.replaceChildren();\n const startOK=start.signaturesValid&&start.historicalAssociation==='rno-attested-at-reading-times';\n const bound=price.applicability==='bound'&&startOK;\n body.dataset['state']=checked.consistency?.accepted===false||price.publicationBeforeStart==='invalid'?'invalid':bound&&rates.status==='rates-match'&&price.publication==='valid'&&start.status==='verified'&&!price.chainGaps?'valid':\n price.signatures==='invalid'||price.applicability==='invalid'||price.publication==='invalid'||rates.status==='conflict'?'invalid':'warning';\n body.dataset['applicability']=price.applicability;body.dataset['publication']=price.publication;body.dataset['rates']=rates.status;\n const beforeStart=price.publicationBeforeStart==='witnessed-before-signed-start'&&startOK;\n body.dataset['beforeStart']=beforeStart?'witnessed':price.publicationBeforeStart==='invalid'?'invalid':'not-proven';\n const row=(label:string,state:'valid'|'warning'|'invalid'):void=>{\n const p=body.appendChild(document.createElement('p'));p.dataset['state']=state;p.textContent=(state==='valid'?'✅ ':state==='invalid'?'❌ ':'⏳ ')+this.localize(label);\n };\n if(checked.consistency!==undefined)body.appendChild(renderPOIConsistency(checked.consistency,this.localize));\n row('poiPriceDefinitionValid','valid');\n row(price.signatures==='valid'?'poiPriceSignaturesValid':price.signatures==='missing'?'poiPriceMissing':'poiPriceSignaturesInvalid',price.signatures==='valid'?'valid':price.signatures==='missing'?'warning':'invalid');\n row(startOK?'poiPriceStartValid':'poiPriceStartUnproven',startOK?'valid':'invalid');\n const labels={bound:'poiPriceBound',unbound:'poiPriceUnbound',missing:'poiPriceNoApplicable',invalid:'poiPriceBindingInvalid',ambiguous:'poiPriceAmbiguous',unsupported:'poiPriceUnsupported'};\n row(bound?'poiPriceBound':price.applicability==='bound'?'poiPriceUnbound':labels[price.applicability],bound?'valid':price.applicability==='invalid'?'invalid':'warning');\n if(start.status==='key-conflict')row('poiMeterKeyConflict','warning');\n row(rates.status==='rates-match'&&startOK?'poiPriceRatesMatch':rates.status==='conflict'?'poiPriceRatesConflict':'poiPriceRatesUnproven',rates.status==='rates-match'&&startOK?'valid':rates.status==='conflict'?'invalid':'warning');\n row(price.publication==='valid'?'poiPriceIncluded':price.publication==='invalid'?'poiPricePublicationInvalid':'poiPricePublicationMissing',price.publication==='valid'?'valid':price.publication==='invalid'?'invalid':'warning');\n if(price.publication==='valid'&&!beforeStart)row(price.witnessedBy.length>0?'poiHistoryWitnessed':'poiHistoryWitnessMissing',price.witnessedBy.length>0?'valid':'warning');\n const publication=body.appendChild(document.createElement('section'));publication.className='poiPricePublication';publication.dataset['state']=beforeStart?'valid':price.publicationBeforeStart==='invalid'?'invalid':'warning';\n publication.appendChild(document.createElement('p')).textContent=(beforeStart?'✅ ':price.publicationBeforeStart==='invalid'?'❌ ':'⏳ ')+this.localize(beforeStart?'poiPublicationBeforeStart':price.publicationBeforeStart==='invalid'?'poiPublicationInvalid':'poiPublicationPending');\n if(price.publicationWitnesses!==undefined){\n publication.appendChild(document.createElement('p')).textContent=this.localize('poiWitnessQuorum')+': '+String(price.publicationWitnesses.organizations.length)+' / '+String(price.publicationWitnesses.requiredOrganizations);\n publication.appendChild(document.createElement('p')).textContent=this.localize('poiPublicationTimeScope');\n const receiptDetails=publication.appendChild(document.createElement('details'));receiptDetails.appendChild(document.createElement('summary')).textContent=this.localize('poiPublicationDetails');\n const receiptList=receiptDetails.appendChild(document.createElement('div'));receiptList.className='poiPublicationReceipts';\n for(const receipt of price.publicationWitnesses.receipts){\n const article=receiptList.appendChild(document.createElement('article'));article.className='poiPublicationReceipt';article.dataset['receiptState']=receipt.status;\n article.appendChild(document.createElement('h5')).textContent=(receipt.organization??receipt.witnessId)+' · '+receipt.status;\n if(receipt.sourceURL!==undefined)article.appendChild(document.createElement('p')).textContent=receipt.sourceURL;\n if(receipt.latestPublicationAt!==undefined)article.appendChild(document.createElement('p')).textContent=this.localize('poiPublicationLatest')+': '+new Date(receipt.latestPublicationAt).toLocaleString(this.language);\n if(receipt.keyId!==undefined)article.appendChild(renderSecurityFingerprint(receipt.keyId,this.localize));\n article.appendChild(document.createElement('p')).textContent=receipt.detail;\n }\n if(price.publicationWitnesses.receipts.length===0)receiptDetails.appendChild(document.createElement('p')).textContent=this.localize('poiPublicationNoReceipts');\n }\n if(this.actions.loadPublication!==undefined&&price.selected!==undefined&&price.publication==='valid'){\n const fetchButton=publication.appendChild(document.createElement('button'));fetchButton.type='button';fetchButton.textContent=this.localize('poiPublicationLoad');fetchButton.dataset['action']='load-publication';\n fetchButton.onclick=():void=>{fetchButton.disabled=true;void this.actions.loadPublication?.(policyId,signal).then(next=>{signal.throwIfAborted();this.render(body,next,policyId,signal);}).catch((error:unknown)=>{\n if(!signal.aborted){fetchButton.disabled=false;const p=publication.appendChild(document.createElement('p'));p.textContent=this.localize('poiPublicationLoadFailed')+': '+(error instanceof Error?error.message:String(error));p.setAttribute('role','alert');}\n });};\n }\n body.appendChild(document.createElement('p')).textContent=this.localize(beforeStart?'poiPriceWitnessedLimits':'poiPriceLimits');\n if(price.chainGaps)row('poiPriceChainGaps','warning');\n const selected=price.selected;\n if(selected!==undefined){\n const title=body.appendChild(document.createElement('p'));title.className='sessionPriceSelected';title.textContent=asText(selected.tariff['@id'])+' · '+selected.currency;\n const components=body.appendChild(document.createElement('dl'));components.className='sessionPriceComponents';\n for(const element of selected.elements)for(const component of Array.isArray(element['priceComponents'])?element['priceComponents']:[]){\n if(!isObject(component))continue;components.appendChild(document.createElement('dt')).textContent=asText(component['type']);\n components.appendChild(document.createElement('dd')).textContent=asText(component['price'])+' '+selected.currency+(component['type']==='ENERGY'?'/kWh':component['type']==='TIME'?'/h':'')+' · '+this.localize('poiPriceStep')+': '+asText(component['stepSize']);\n }\n }\n const details=body.appendChild(document.createElement('details'));details.appendChild(document.createElement('summary')).textContent=this.localize('poiPriceDetails');\n const supplied=parseJSON(source.text);\n if(isObject(supplied)&&Array.isArray(supplied['witnessCandidates'])&&supplied['witnessCandidates'].length>0){\n const candidates=details.appendChild(document.createElement('details'));candidates.appendChild(document.createElement('summary')).textContent=this.localize('poiWitnessCandidates');\n candidates.appendChild(document.createElement('p')).textContent=this.localize('poiWitnessCandidatesScope');\n candidates.appendChild(document.createElement('p')).textContent=this.localize('poiWitnessSettingsPath');\n try{const recommended=parseWitnessPublicationPolicy({'@context':WITNESS_PUBLICATION_POLICY_CONTEXT,requiredOrganizations:2,witnesses:supplied['witnessCandidates']});\n for(const witness of recommended.witnesses){candidates.appendChild(document.createElement('p')).textContent=witness.organization+' · '+witness.id;for(const key of witness.keys)candidates.appendChild(renderSecurityFingerprint(key.id,this.localize));}\n candidates.appendChild(document.createElement('pre')).textContent=prettyJSON(recommended.json);\n }catch{candidates.appendChild(document.createElement('pre')).textContent=prettyJSON(supplied['witnessCandidates']);}\n }\n details.appendChild(document.createElement('p')).textContent=this.localize(source.origin==='network'?'poiPriceDownloaded':'poiPriceSupplied')+': '+source.sourceURL;\n details.appendChild(document.createElement('p')).textContent=new Date(source.receivedAt).toLocaleString(this.language);\n if(selected!==undefined){details.appendChild(document.createElement('p')).textContent=asText(selected.statement['algorithm']);details.appendChild(renderSecurityFingerprint(asText(selected.statement['keyId']),this.localize));\n details.appendChild(document.createElement('p')).textContent=this.localize('poiPriceDigest')+': '+selected.digest;\n const elements=details.appendChild(document.createElement('details'));elements.appendChild(document.createElement('summary')).textContent=this.localize('poiPriceElements');\n elements.appendChild(document.createElement('pre')).textContent=prettyJSON([...selected.elements]);}\n for(const diagnostic of [...price.diagnostics,start.detail,rates.detail])details.appendChild(document.createElement('p')).textContent=diagnostic;\n const raw=details.appendChild(document.createElement('details'));raw.appendChild(document.createElement('summary')).textContent=this.localize('trustDataRawLabel');raw.appendChild(document.createElement('pre')).textContent=source.text;\n if(this.actions.save!==undefined){\n const save=body.appendChild(document.createElement('button'));save.type='button';save.textContent=this.localize('poiHistorySave');save.dataset['action']='save-price-evidence';\n save.onclick=():void=>{save.disabled=true;void this.actions.save?.(policyId,signal).then(()=>{if(!signal.aborted)save.textContent=this.localize('poiHistorySaved');}).catch(()=>{\n if(!signal.aborted){save.disabled=false;body.appendChild(document.createElement('p')).textContent=this.localize('poiHistorySaveFailed');}\n });};\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { IChargingSession } from "@open-charging-cloud/chargy-core";
|
|
2
|
+
/**
|
|
3
|
+
* Keeps DOM elements associated with charging sessions outside ChargyCore's
|
|
4
|
+
* pure metrological data structures (strict software separation under WELMEC 7.2).
|
|
5
|
+
*/
|
|
6
|
+
export declare class SessionElementRegistry {
|
|
7
|
+
private readonly elements;
|
|
8
|
+
set(session: IChargingSession, element: HTMLDivElement): void;
|
|
9
|
+
get(session: IChargingSession): HTMLDivElement | undefined;
|
|
10
|
+
delete(session: IChargingSession): boolean;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=sessionUIState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessionUIState.d.ts","sourceRoot":"","sources":["../src/sessionUIState.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEzE;;;GAGG;AACH,qBAAa,sBAAsB;IAE/B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAmD;IAErE,GAAG,CAAC,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,cAAc,GAAG,IAAI;IAI7D,GAAG,CAAC,OAAO,EAAE,gBAAgB,GAAG,cAAc,GAAG,SAAS;IAI1D,MAAM,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO;CAIpD"}
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
/**
|
|
18
|
+
* Keeps DOM elements associated with charging sessions outside ChargyCore's
|
|
19
|
+
* pure metrological data structures (strict software separation under WELMEC 7.2).
|
|
20
|
+
*/
|
|
21
|
+
export class SessionElementRegistry {
|
|
22
|
+
elements = new WeakMap();
|
|
23
|
+
set(session, element) {
|
|
24
|
+
this.elements.set(session, element);
|
|
25
|
+
}
|
|
26
|
+
get(session) {
|
|
27
|
+
return this.elements.get(session);
|
|
28
|
+
}
|
|
29
|
+
delete(session) {
|
|
30
|
+
return this.elements.delete(session);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=sessionUIState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessionUIState.js","sourceRoot":"","sources":["../src/sessionUIState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH;;;GAGG;AACH,MAAM,OAAO,sBAAsB;IAEd,QAAQ,GAAG,IAAI,OAAO,EAAoC,CAAC;IAErE,GAAG,CAAC,OAAyB,EAAE,OAAuB;QACzD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC;IAEM,GAAG,CAAC,OAAyB;QAChC,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAEM,MAAM,CAAC,OAAyB;QACnC,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;CAEJ","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 { IChargingSession } from \"@open-charging-cloud/chargy-core\";\n\n/**\n * Keeps DOM elements associated with charging sessions outside ChargyCore's\n * pure metrological data structures (strict software separation under WELMEC 7.2).\n */\nexport class SessionElementRegistry {\n\n private readonly elements = new WeakMap<IChargingSession, HTMLDivElement>();\n\n public set(session: IChargingSession, element: HTMLDivElement): void {\n this.elements.set(session, element);\n }\n\n public get(session: IChargingSession): HTMLDivElement | undefined {\n return this.elements.get(session);\n }\n\n public delete(session: IChargingSession): boolean {\n return this.elements.delete(session);\n }\n\n}\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { VersionComparison, VerifiedChargingStation } from '@open-charging-cloud/wwcp-poi';
|
|
2
|
+
import type { POITrustContext, POITrustService } from './poiTrustContext.js';
|
|
3
|
+
import type { ITransportAllowances } from './liveLinkTrust.js';
|
|
4
|
+
export declare const stationProofMaxBytes: number;
|
|
5
|
+
export interface StationProofDocument {
|
|
6
|
+
/** Supplied with the original session input, rather than retrieved from sourceURL. */
|
|
7
|
+
readonly origin?: 'embedded';
|
|
8
|
+
readonly sourceURL: string;
|
|
9
|
+
readonly downloadedAt: string;
|
|
10
|
+
readonly text: string;
|
|
11
|
+
}
|
|
12
|
+
export interface LoadedStationProof {
|
|
13
|
+
readonly consistency?: VersionComparison;
|
|
14
|
+
readonly document: StationProofDocument;
|
|
15
|
+
readonly evseId: string;
|
|
16
|
+
readonly context: POITrustContext;
|
|
17
|
+
readonly station: VerifiedChargingStation;
|
|
18
|
+
}
|
|
19
|
+
export interface StationProofAttempt {
|
|
20
|
+
readonly consistency?: VersionComparison;
|
|
21
|
+
readonly sourceURL: string;
|
|
22
|
+
readonly stage: 'download' | 'verification';
|
|
23
|
+
readonly message: string;
|
|
24
|
+
}
|
|
25
|
+
export declare class StationProofLoadError extends Error {
|
|
26
|
+
readonly attempts: readonly StationProofAttempt[];
|
|
27
|
+
constructor(attempts: readonly StationProofAttempt[]);
|
|
28
|
+
}
|
|
29
|
+
/** Only approved anchor sources. Each candidate is verified by the shared library before accepting a mirror. */
|
|
30
|
+
export declare function loadStationProof(trust: Pick<POITrustService, 'resolve' | 'verifyStation'>, policyId: string, inputEVSE: string, options: {
|
|
31
|
+
readonly signal: AbortSignal;
|
|
32
|
+
readonly fetch?: typeof fetch;
|
|
33
|
+
readonly allowances?: ITransportAllowances;
|
|
34
|
+
readonly timeoutMs?: number;
|
|
35
|
+
readonly totalTimeoutMs?: number;
|
|
36
|
+
readonly onSource?: (url: string) => void;
|
|
37
|
+
}): Promise<LoadedStationProof>;
|
|
38
|
+
//# sourceMappingURL=stationProofData.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stationProofData.d.ts","sourceRoot":"","sources":["../src/stationProofData.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAChG,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG7E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAI/D,eAAO,MAAM,oBAAoB,QAAkB,CAAC;AAEpD,MAAM,WAAW,oBAAoB;IACjC,sFAAsF;IACtF,QAAQ,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC;IAC7B,QAAQ,CAA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AI,CAAC;CAC7C,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAkErE"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { parseJSON } from '@open-charging-cloud/wwcp-poi';
|
|
2
|
+
import { POIHistoryError } from './poiTrustContext.js';
|
|
3
|
+
import { pollTargetProblem } from './liveLinkTrust.js';
|
|
4
|
+
import { getDefaultPOIFetch, readResponseWithinLimit } from './poiTransport.js';
|
|
5
|
+
import { stationEVSEId, stationProofURL } from './poiURLs.js';
|
|
6
|
+
export const stationProofMaxBytes = 2 * 1024 * 1024;
|
|
7
|
+
export class StationProofLoadError extends Error {
|
|
8
|
+
attempts;
|
|
9
|
+
constructor(attempts) {
|
|
10
|
+
super('No source supplied a station proof that could be loaded and verified');
|
|
11
|
+
this.attempts = attempts;
|
|
12
|
+
this.name = 'StationProofLoadError';
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/** Only approved anchor sources. Each candidate is verified by the shared library before accepting a mirror. */
|
|
16
|
+
export async function loadStationProof(trust, policyId, inputEVSE, options) {
|
|
17
|
+
const evseId = stationEVSEId(inputEVSE);
|
|
18
|
+
options.signal.throwIfAborted();
|
|
19
|
+
const context = await trust.resolve(policyId);
|
|
20
|
+
options.signal.throwIfAborted();
|
|
21
|
+
const overall = new AbortController();
|
|
22
|
+
const parentAbort = () => { overall.abort(options.signal.reason); };
|
|
23
|
+
options.signal.addEventListener('abort', parentAbort, { once: true });
|
|
24
|
+
const deadline = setTimeout(() => { overall.abort(new Error('Station proof download deadline exceeded')); }, options.totalTimeoutMs ?? 30000);
|
|
25
|
+
const attempts = [];
|
|
26
|
+
try {
|
|
27
|
+
for (const base of context.verification.anchor.urls) {
|
|
28
|
+
options.signal.throwIfAborted();
|
|
29
|
+
if (overall.signal.aborted)
|
|
30
|
+
break;
|
|
31
|
+
const sourceURL = stationProofURL(base, evseId);
|
|
32
|
+
const url = new URL(sourceURL);
|
|
33
|
+
const problem = pollTargetProblem(url, false, options.allowances);
|
|
34
|
+
if (problem !== null || url.username !== '' || url.password !== '') {
|
|
35
|
+
attempts.push({ sourceURL, stage: 'download', message: 'This source is not allowed by the transport policy' });
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
const controller = new AbortController();
|
|
39
|
+
const abort = () => { controller.abort(overall.signal.reason); };
|
|
40
|
+
overall.signal.addEventListener('abort', abort, { once: true });
|
|
41
|
+
const timer = setTimeout(() => { controller.abort(new Error('Station proof request timed out')); }, options.timeoutMs ?? 15000);
|
|
42
|
+
let stage = 'download';
|
|
43
|
+
try {
|
|
44
|
+
options.onSource?.(sourceURL);
|
|
45
|
+
controller.signal.throwIfAborted();
|
|
46
|
+
const response = await (options.fetch ?? getDefaultPOIFetch())(sourceURL, {
|
|
47
|
+
signal: controller.signal, credentials: 'omit', redirect: 'error', cache: 'no-store',
|
|
48
|
+
headers: { Accept: 'application/json' }
|
|
49
|
+
});
|
|
50
|
+
if (!response.ok)
|
|
51
|
+
throw new Error(`HTTP ${response.status}`);
|
|
52
|
+
const bytes = await readResponseWithinLimit(response, stationProofMaxBytes);
|
|
53
|
+
controller.signal.throwIfAborted();
|
|
54
|
+
const document = {
|
|
55
|
+
sourceURL, downloadedAt: new Date().toISOString(),
|
|
56
|
+
text: new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(bytes)
|
|
57
|
+
};
|
|
58
|
+
stage = 'verification';
|
|
59
|
+
// Read current local decisions again after I/O. The downloaded operator cannot replace the saved policy.
|
|
60
|
+
const verified = await trust.verifyStation(policyId, parseJSON(document.text), { evseId }, controller.signal);
|
|
61
|
+
controller.signal.throwIfAborted();
|
|
62
|
+
options.signal.throwIfAborted();
|
|
63
|
+
return { ...verified, document, evseId };
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
options.signal.throwIfAborted();
|
|
67
|
+
const reason = controller.signal.aborted ? controller.signal.reason : error;
|
|
68
|
+
attempts.push({ sourceURL, stage, message: reason instanceof Error ? reason.message : String(reason),
|
|
69
|
+
...(reason instanceof POIHistoryError ? { consistency: reason.report } : {}) });
|
|
70
|
+
}
|
|
71
|
+
finally {
|
|
72
|
+
clearTimeout(timer);
|
|
73
|
+
overall.signal.removeEventListener('abort', abort);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
finally {
|
|
78
|
+
clearTimeout(deadline);
|
|
79
|
+
options.signal.removeEventListener('abort', parentAbort);
|
|
80
|
+
}
|
|
81
|
+
throw new StationProofLoadError(attempts);
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=stationProofData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stationProofData.js","sourceRoot":"","sources":["../src/stationProofData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAG1D,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE9D,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAyBpD,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IACT;IAAnC,YAAmC,QAAwC;QACvE,KAAK,CAAC,sEAAsE,CAAC,CAAC;QAD/C,aAAQ,GAAR,QAAQ,CAAgC;QAEvE,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACxC,CAAC;CACJ;AAED,gHAAgH;AAChH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,KAAyD,EACzD,QAAgB,EAAE,SAAiB,EAAE,OAOpC;IACpC,MAAM,MAAM,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC;IACxC,OAAO,CAAC,MAAM,CAAC,cAAc,EAA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CAAC,CAAC;gBACpB,OAAO,CAAC,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YACvD,CAAC;QACL,CAAC;IACL,CAAC;YACO,CAAC;QACL,YAAY,CAAC,QAAQ,CAAC,CAAC;QACvB,OAAO,CAAC,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IAC7D,CAAC;IACD,MAAM,IAAI,qBAAqB,CAAC,QAAQ,CAAC,CAAC;AAC9C,CAAC","sourcesContent":["import { parseJSON } from '@open-charging-cloud/wwcp-poi';\nimport type { VersionComparison, VerifiedChargingStation } from '@open-charging-cloud/wwcp-poi';\nimport type { POITrustContext, POITrustService } from './poiTrustContext.js';\nimport {POIHistoryError} from './poiTrustContext.js';\nimport { pollTargetProblem } from './liveLinkTrust.js';\nimport type { ITransportAllowances } from './liveLinkTrust.js';\nimport { getDefaultPOIFetch, readResponseWithinLimit } from './poiTransport.js';\nimport { stationEVSEId, stationProofURL } from './poiURLs.js';\n\nexport const stationProofMaxBytes = 2 * 1024 * 1024;\n\nexport interface StationProofDocument {\n /** Supplied with the original session input, rather than retrieved from sourceURL. */\n readonly origin?: 'embedded';\n readonly sourceURL: string;\n readonly downloadedAt: string;\n readonly text: string;\n}\n\nexport interface LoadedStationProof {\n readonly consistency?:VersionComparison;\n readonly document: StationProofDocument;\n readonly evseId: string;\n readonly context: POITrustContext;\n readonly station: VerifiedChargingStation;\n}\n\nexport interface StationProofAttempt {\n readonly consistency?:VersionComparison;\n readonly sourceURL: string;\n readonly stage: 'download' | 'verification';\n readonly message: string;\n}\n\nexport class StationProofLoadError extends Error {\n public constructor(public readonly attempts: readonly StationProofAttempt[]) {\n super('No source supplied a station proof that could be loaded and verified');\n this.name = 'StationProofLoadError';\n }\n}\n\n/** Only approved anchor sources. Each candidate is verified by the shared library before accepting a mirror. */\nexport async function loadStationProof(trust: Pick<POITrustService, 'resolve' | 'verifyStation'>,\n policyId: string, inputEVSE: string, options: {\n readonly signal: AbortSignal;\n readonly fetch?: typeof fetch;\n readonly allowances?: ITransportAllowances;\n readonly timeoutMs?: number;\n readonly totalTimeoutMs?: number;\n readonly onSource?: (url: string) => void;\n }): Promise<LoadedStationProof> {\n const evseId = stationEVSEId(inputEVSE);\n options.signal.throwIfAborted();\n const context = await trust.resolve(policyId);\n options.signal.throwIfAborted();\n const overall = new AbortController();\n const parentAbort = (): void => { overall.abort(options.signal.reason); };\n options.signal.addEventListener('abort', parentAbort, { once: true });\n const deadline = setTimeout(() => { overall.abort(new Error('Station proof download deadline exceeded')); }, options.totalTimeoutMs ?? 30000);\n const attempts: StationProofAttempt[] = [];\n try {\n for (const base of context.verification.anchor.urls) {\n options.signal.throwIfAborted();\n if (overall.signal.aborted)\n break;\n const sourceURL = stationProofURL(base, evseId);\n const url = new URL(sourceURL);\n const problem = pollTargetProblem(url, false, options.allowances);\n if (problem !== null || url.username !== '' || url.password !== '') {\n attempts.push({ sourceURL, stage: 'download', message: 'This source is not allowed by the transport policy' });\n continue;\n }\n const controller = new AbortController();\n const abort = (): void => { controller.abort(overall.signal.reason); };\n overall.signal.addEventListener('abort', abort, { once: true });\n const timer = setTimeout(() => { controller.abort(new Error('Station proof request timed out')); }, options.timeoutMs ?? 15000);\n let stage: StationProofAttempt['stage'] = 'download';\n try {\n options.onSource?.(sourceURL);\n controller.signal.throwIfAborted();\n const response = await (options.fetch ?? getDefaultPOIFetch())(sourceURL, {\n signal: controller.signal, credentials: 'omit', redirect: 'error', cache: 'no-store',\n headers: { Accept: 'application/json' }\n });\n if (!response.ok)\n throw new Error(`HTTP ${response.status}`);\n const bytes = await readResponseWithinLimit(response, stationProofMaxBytes);\n controller.signal.throwIfAborted();\n const document: StationProofDocument = {\n sourceURL, downloadedAt: new Date().toISOString(),\n text: new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(bytes)\n };\n stage = 'verification';\n // Read current local decisions again after I/O. The downloaded operator cannot replace the saved policy.\n const verified = await trust.verifyStation(policyId, parseJSON(document.text), { evseId },controller.signal);\n controller.signal.throwIfAborted();\n options.signal.throwIfAborted();\n return { ...verified, document, evseId };\n }\n catch (error) {\n options.signal.throwIfAborted();\n const reason: unknown = controller.signal.aborted ? controller.signal.reason : error;\n attempts.push({ sourceURL, stage, message: reason instanceof Error ? reason.message : String(reason),\n ...(reason instanceof POIHistoryError?{consistency:reason.report}:{}) });\n }\n finally {\n clearTimeout(timer);\n overall.signal.removeEventListener('abort', abort);\n }\n }\n }\n finally {\n clearTimeout(deadline);\n options.signal.removeEventListener('abort', parentAbort);\n }\n throw new StationProofLoadError(attempts);\n}\n"]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { POITrustService } from './poiTrustContext.js';
|
|
2
|
+
import type { TrustStore } from './trustStore.js';
|
|
3
|
+
import type { LoadedStationProof, StationProofDocument } from './stationProofData.js';
|
|
4
|
+
import type { ITransportAllowances } from './liveLinkTrust.js';
|
|
5
|
+
/** Owns one settings-page operation. Navigation, cancellation and a newer operation invalidate all pending UI writes. */
|
|
6
|
+
export declare class StationProofPanel {
|
|
7
|
+
private readonly root;
|
|
8
|
+
private readonly store;
|
|
9
|
+
private readonly trust;
|
|
10
|
+
private readonly policyId;
|
|
11
|
+
private readonly localize;
|
|
12
|
+
private readonly language;
|
|
13
|
+
private readonly allowances;
|
|
14
|
+
private readonly subject?;
|
|
15
|
+
private readonly input;
|
|
16
|
+
private readonly submit;
|
|
17
|
+
private readonly cancel;
|
|
18
|
+
private readonly message;
|
|
19
|
+
private readonly result;
|
|
20
|
+
private readonly history;
|
|
21
|
+
private operation;
|
|
22
|
+
private generation;
|
|
23
|
+
private historyGeneration;
|
|
24
|
+
private disposed;
|
|
25
|
+
private ready;
|
|
26
|
+
private lastProof;
|
|
27
|
+
private readonly focus;
|
|
28
|
+
constructor(root: HTMLElement, store: TrustStore, trust: POITrustService, policyId: string, localize: (key: string) => string, language: string, allowances?: ITransportAllowances, value?: string, subject?: {
|
|
29
|
+
readonly evseId: string;
|
|
30
|
+
readonly document?: StationProofDocument;
|
|
31
|
+
readonly onState?: (state: "pending" | "valid" | "warning" | "invalid" | "idle", proof?: LoadedStationProof) => void;
|
|
32
|
+
} | undefined);
|
|
33
|
+
get value(): string;
|
|
34
|
+
mount(): Promise<void>;
|
|
35
|
+
dispose(): void;
|
|
36
|
+
private button;
|
|
37
|
+
private busy;
|
|
38
|
+
private showError;
|
|
39
|
+
private openDocument;
|
|
40
|
+
private run;
|
|
41
|
+
private refreshHistory;
|
|
42
|
+
private renderSaved;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=stationProofPanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stationProofPanel.d.ts","sourceRoot":"","sources":["../src/stationProofPanel.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAsB,MAAM,iBAAiB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AACtF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAM/D,yHAAyH;AACzH,qBAAa,iBAAiB;IAkBP,OAAO,CAAC,QAAQ,CAAC,IAAI;IAAe,OAAO,CAAC,QAAQ,CAAC,KAAK;IACzD,OAAO,CAAC,QAAQ,CAAC,KAAK;IAAmB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAClE,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAA2B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAC7E,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;IArB7C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAmB;IACzC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoB;IAC3C,OAAO,CAAC,QAAQ,CAAC,MAAM,CA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