kirby-ocpp 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/README.md +134 -95
  2. package/THIRD_PARTY_NOTICES.md +6 -2
  3. package/bin/kirby-ocpp.js +55 -0
  4. package/package.json +22 -44
  5. package/dist/cli.d.ts +0 -2
  6. package/dist/cli.js +0 -72
  7. package/dist/config.d.ts +0 -2
  8. package/dist/config.js +0 -53
  9. package/dist/ocpp/client.d.ts +0 -59
  10. package/dist/ocpp/client.js +0 -299
  11. package/dist/ocpp/schema-validator.d.ts +0 -15
  12. package/dist/ocpp/schema-validator.js +0 -75
  13. package/dist/ocpp/schemas/json/Authorize.json +0 -16
  14. package/dist/ocpp/schemas/json/AuthorizeResponse.json +0 -40
  15. package/dist/ocpp/schemas/json/BootNotification.json +0 -49
  16. package/dist/ocpp/schemas/json/BootNotificationResponse.json +0 -30
  17. package/dist/ocpp/schemas/json/CancelReservation.json +0 -15
  18. package/dist/ocpp/schemas/json/CancelReservationResponse.json +0 -20
  19. package/dist/ocpp/schemas/json/ChangeAvailability.json +0 -24
  20. package/dist/ocpp/schemas/json/ChangeAvailabilityResponse.json +0 -21
  21. package/dist/ocpp/schemas/json/ChangeConfiguration.json +0 -21
  22. package/dist/ocpp/schemas/json/ChangeConfigurationResponse.json +0 -22
  23. package/dist/ocpp/schemas/json/ClearCache.json +0 -8
  24. package/dist/ocpp/schemas/json/ClearCacheResponse.json +0 -20
  25. package/dist/ocpp/schemas/json/ClearChargingProfile.json +0 -27
  26. package/dist/ocpp/schemas/json/ClearChargingProfileResponse.json +0 -20
  27. package/dist/ocpp/schemas/json/DataTransfer.json +0 -23
  28. package/dist/ocpp/schemas/json/DataTransferResponse.json +0 -25
  29. package/dist/ocpp/schemas/json/DiagnosticsStatusNotification.json +0 -22
  30. package/dist/ocpp/schemas/json/DiagnosticsStatusNotificationResponse.json +0 -8
  31. package/dist/ocpp/schemas/json/FirmwareStatusNotification.json +0 -25
  32. package/dist/ocpp/schemas/json/FirmwareStatusNotificationResponse.json +0 -8
  33. package/dist/ocpp/schemas/json/GetCompositeSchedule.json +0 -27
  34. package/dist/ocpp/schemas/json/GetCompositeScheduleResponse.json +0 -79
  35. package/dist/ocpp/schemas/json/GetConfiguration.json +0 -16
  36. package/dist/ocpp/schemas/json/GetConfigurationResponse.json +0 -40
  37. package/dist/ocpp/schemas/json/GetDiagnostics.json +0 -30
  38. package/dist/ocpp/schemas/json/GetDiagnosticsResponse.json +0 -13
  39. package/dist/ocpp/schemas/json/GetLocalListVersion.json +0 -8
  40. package/dist/ocpp/schemas/json/GetLocalListVersionResponse.json +0 -15
  41. package/dist/ocpp/schemas/json/Heartbeat.json +0 -8
  42. package/dist/ocpp/schemas/json/HeartbeatResponse.json +0 -16
  43. package/dist/ocpp/schemas/json/MeterValues.json +0 -151
  44. package/dist/ocpp/schemas/json/MeterValuesResponse.json +0 -8
  45. package/dist/ocpp/schemas/json/RemoteStartTransaction.json +0 -127
  46. package/dist/ocpp/schemas/json/RemoteStartTransactionResponse.json +0 -20
  47. package/dist/ocpp/schemas/json/RemoteStopTransaction.json +0 -15
  48. package/dist/ocpp/schemas/json/RemoteStopTransactionResponse.json +0 -20
  49. package/dist/ocpp/schemas/json/ReserveNow.json +0 -33
  50. package/dist/ocpp/schemas/json/ReserveNowResponse.json +0 -23
  51. package/dist/ocpp/schemas/json/Reset.json +0 -20
  52. package/dist/ocpp/schemas/json/ResetResponse.json +0 -20
  53. package/dist/ocpp/schemas/json/SendLocalList.json +0 -68
  54. package/dist/ocpp/schemas/json/SendLocalListResponse.json +0 -22
  55. package/dist/ocpp/schemas/json/SetChargingProfile.json +0 -124
  56. package/dist/ocpp/schemas/json/SetChargingProfileResponse.json +0 -21
  57. package/dist/ocpp/schemas/json/StartTransaction.json +0 -32
  58. package/dist/ocpp/schemas/json/StartTransactionResponse.json +0 -44
  59. package/dist/ocpp/schemas/json/StatusNotification.json +0 -70
  60. package/dist/ocpp/schemas/json/StatusNotificationResponse.json +0 -8
  61. package/dist/ocpp/schemas/json/StopTransaction.json +0 -177
  62. package/dist/ocpp/schemas/json/StopTransactionResponse.json +0 -37
  63. package/dist/ocpp/schemas/json/TriggerMessage.json +0 -27
  64. package/dist/ocpp/schemas/json/TriggerMessageResponse.json +0 -21
  65. package/dist/ocpp/schemas/json/UnlockConnector.json +0 -15
  66. package/dist/ocpp/schemas/json/UnlockConnectorResponse.json +0 -21
  67. package/dist/ocpp/schemas/json/UpdateFirmware.json +0 -27
  68. package/dist/ocpp/schemas/json/UpdateFirmwareResponse.json +0 -8
  69. package/dist/ocpp/types.d.ts +0 -106
  70. package/dist/ocpp/types.js +0 -1
  71. package/dist/station/authorization.d.ts +0 -20
  72. package/dist/station/authorization.js +0 -78
  73. package/dist/station/charging-profile-registry.d.ts +0 -18
  74. package/dist/station/charging-profile-registry.js +0 -125
  75. package/dist/station/configuration-commands.d.ts +0 -11
  76. package/dist/station/configuration-commands.js +0 -29
  77. package/dist/station/configuration-registry.d.ts +0 -13
  78. package/dist/station/configuration-registry.js +0 -39
  79. package/dist/station/configuration.d.ts +0 -7
  80. package/dist/station/configuration.js +0 -88
  81. package/dist/station/connector-registry.d.ts +0 -25
  82. package/dist/station/connector-registry.js +0 -89
  83. package/dist/station/connector-status.d.ts +0 -7
  84. package/dist/station/connector-status.js +0 -66
  85. package/dist/station/local-auth-list.d.ts +0 -8
  86. package/dist/station/local-auth-list.js +0 -31
  87. package/dist/station/maintenance-lifecycle.d.ts +0 -25
  88. package/dist/station/maintenance-lifecycle.js +0 -110
  89. package/dist/station/meter-value-scheduler.d.ts +0 -21
  90. package/dist/station/meter-value-scheduler.js +0 -78
  91. package/dist/station/metering.d.ts +0 -15
  92. package/dist/station/metering.js +0 -138
  93. package/dist/station/ocpp-message.d.ts +0 -2
  94. package/dist/station/ocpp-message.js +0 -9
  95. package/dist/station/offline-transaction-sync.d.ts +0 -29
  96. package/dist/station/offline-transaction-sync.js +0 -99
  97. package/dist/station/payload.d.ts +0 -4
  98. package/dist/station/payload.js +0 -12
  99. package/dist/station/persistence.d.ts +0 -28
  100. package/dist/station/persistence.js +0 -206
  101. package/dist/station/reservation-rules.d.ts +0 -3
  102. package/dist/station/reservation-rules.js +0 -18
  103. package/dist/station/reservation-scheduler.d.ts +0 -11
  104. package/dist/station/reservation-scheduler.js +0 -33
  105. package/dist/station/smart-charging.d.ts +0 -45
  106. package/dist/station/smart-charging.js +0 -251
  107. package/dist/station/status-scheduler.d.ts +0 -16
  108. package/dist/station/status-scheduler.js +0 -58
  109. package/dist/station/transaction-message-retry.d.ts +0 -3
  110. package/dist/station/transaction-message-retry.js +0 -7
  111. package/dist/station/transaction-rules.d.ts +0 -7
  112. package/dist/station/transaction-rules.js +0 -34
  113. package/dist/station/trigger-message.d.ts +0 -2
  114. package/dist/station/trigger-message.js +0 -11
  115. package/dist/station-store.d.ts +0 -41
  116. package/dist/station-store.js +0 -104
  117. package/dist/station.d.ts +0 -113
  118. package/dist/station.js +0 -1204
  119. package/dist/tui.d.ts +0 -96
  120. package/dist/tui.js +0 -1656
  121. package/docs/OCPP_1.6J_CONFORMANCE.md +0 -61
@@ -1,8 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-04/schema#",
3
- "id": "urn:OCPP:1.6:2019:12:StatusNotificationResponse",
4
- "title": "StatusNotificationResponse",
5
- "type": "object",
6
- "properties": {},
7
- "additionalProperties": false
8
- }
@@ -1,177 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-04/schema#",
3
- "id": "urn:OCPP:1.6:2025:04:StopTransactionRequest",
4
- "title": "StopTransactionRequest",
5
- "type": "object",
6
- "properties": {
7
- "idTag": {
8
- "type": "string",
9
- "maxLength": 20
10
- },
11
- "meterStop": {
12
- "type": "integer"
13
- },
14
- "timestamp": {
15
- "type": "string",
16
- "format": "date-time"
17
- },
18
- "transactionId": {
19
- "type": "integer"
20
- },
21
- "reason": {
22
- "type": "string",
23
- "additionalProperties": false,
24
- "enum": [
25
- "EmergencyStop",
26
- "EVDisconnected",
27
- "HardReset",
28
- "Local",
29
- "Other",
30
- "PowerLoss",
31
- "Reboot",
32
- "Remote",
33
- "SoftReset",
34
- "UnlockCommand",
35
- "DeAuthorized"
36
- ]
37
- },
38
- "transactionData": {
39
- "type": "array",
40
- "items": {
41
- "type": "object",
42
- "properties": {
43
- "timestamp": {
44
- "type": "string",
45
- "format": "date-time"
46
- },
47
- "sampledValue": {
48
- "type": "array",
49
- "items": {
50
- "type": "object",
51
- "properties": {
52
- "value": {
53
- "type": "string"
54
- },
55
- "context": {
56
- "type": "string",
57
- "additionalProperties": false,
58
- "enum": [
59
- "Interruption.Begin",
60
- "Interruption.End",
61
- "Sample.Clock",
62
- "Sample.Periodic",
63
- "Transaction.Begin",
64
- "Transaction.End",
65
- "Trigger",
66
- "Other"
67
- ]
68
- },
69
- "format": {
70
- "type": "string",
71
- "additionalProperties": false,
72
- "enum": [
73
- "Raw",
74
- "SignedData"
75
- ]
76
- },
77
- "measurand": {
78
- "type": "string",
79
- "additionalProperties": false,
80
- "enum": [
81
- "Energy.Active.Export.Register",
82
- "Energy.Active.Import.Register",
83
- "Energy.Reactive.Export.Register",
84
- "Energy.Reactive.Import.Register",
85
- "Energy.Active.Export.Interval",
86
- "Energy.Active.Import.Interval",
87
- "Energy.Reactive.Export.Interval",
88
- "Energy.Reactive.Import.Interval",
89
- "Power.Active.Export",
90
- "Power.Active.Import",
91
- "Power.Offered",
92
- "Power.Reactive.Export",
93
- "Power.Reactive.Import",
94
- "Power.Factor",
95
- "Current.Import",
96
- "Current.Export",
97
- "Current.Offered",
98
- "Voltage",
99
- "Frequency",
100
- "Temperature",
101
- "SoC",
102
- "RPM"
103
- ]
104
- },
105
- "phase": {
106
- "type": "string",
107
- "additionalProperties": false,
108
- "enum": [
109
- "L1",
110
- "L2",
111
- "L3",
112
- "N",
113
- "L1-N",
114
- "L2-N",
115
- "L3-N",
116
- "L1-L2",
117
- "L2-L3",
118
- "L3-L1"
119
- ]
120
- },
121
- "location": {
122
- "type": "string",
123
- "additionalProperties": false,
124
- "enum": [
125
- "Cable",
126
- "EV",
127
- "Inlet",
128
- "Outlet",
129
- "Body"
130
- ]
131
- },
132
- "unit": {
133
- "type": "string",
134
- "additionalProperties": false,
135
- "enum": [
136
- "Wh",
137
- "kWh",
138
- "varh",
139
- "kvarh",
140
- "W",
141
- "kW",
142
- "VA",
143
- "kVA",
144
- "var",
145
- "kvar",
146
- "A",
147
- "V",
148
- "K",
149
- "Celcius",
150
- "Celsius",
151
- "Fahrenheit",
152
- "Percent"
153
- ]
154
- }
155
- },
156
- "additionalProperties": false,
157
- "required": [
158
- "value"
159
- ]
160
- }
161
- }
162
- },
163
- "additionalProperties": false,
164
- "required": [
165
- "timestamp",
166
- "sampledValue"
167
- ]
168
- }
169
- }
170
- },
171
- "additionalProperties": false,
172
- "required": [
173
- "transactionId",
174
- "timestamp",
175
- "meterStop"
176
- ]
177
- }
@@ -1,37 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-04/schema#",
3
- "id": "urn:OCPP:1.6:2019:12:StopTransactionResponse",
4
- "title": "StopTransactionResponse",
5
- "type": "object",
6
- "properties": {
7
- "idTagInfo": {
8
- "type": "object",
9
- "properties": {
10
- "expiryDate": {
11
- "type": "string",
12
- "format": "date-time"
13
- },
14
- "parentIdTag": {
15
- "type": "string",
16
- "maxLength": 20
17
- },
18
- "status": {
19
- "type": "string",
20
- "additionalProperties": false,
21
- "enum": [
22
- "Accepted",
23
- "Blocked",
24
- "Expired",
25
- "Invalid",
26
- "ConcurrentTx"
27
- ]
28
- }
29
- },
30
- "additionalProperties": false,
31
- "required": [
32
- "status"
33
- ]
34
- }
35
- },
36
- "additionalProperties": false
37
- }
@@ -1,27 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-04/schema#",
3
- "id": "urn:OCPP:1.6:2019:12:TriggerMessageRequest",
4
- "title": "TriggerMessageRequest",
5
- "type": "object",
6
- "properties": {
7
- "requestedMessage": {
8
- "type": "string",
9
- "additionalProperties": false,
10
- "enum": [
11
- "BootNotification",
12
- "DiagnosticsStatusNotification",
13
- "FirmwareStatusNotification",
14
- "Heartbeat",
15
- "MeterValues",
16
- "StatusNotification"
17
- ]
18
- },
19
- "connectorId": {
20
- "type": "integer"
21
- }
22
- },
23
- "additionalProperties": false,
24
- "required": [
25
- "requestedMessage"
26
- ]
27
- }
@@ -1,21 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-04/schema#",
3
- "id": "urn:OCPP:1.6:2019:12:TriggerMessageResponse",
4
- "title": "TriggerMessageResponse",
5
- "type": "object",
6
- "properties": {
7
- "status": {
8
- "type": "string",
9
- "additionalProperties": false,
10
- "enum": [
11
- "Accepted",
12
- "Rejected",
13
- "NotImplemented"
14
- ]
15
- }
16
- },
17
- "additionalProperties": false,
18
- "required": [
19
- "status"
20
- ]
21
- }
@@ -1,15 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-04/schema#",
3
- "id": "urn:OCPP:1.6:2019:12:UnlockConnectorRequest",
4
- "title": "UnlockConnectorRequest",
5
- "type": "object",
6
- "properties": {
7
- "connectorId": {
8
- "type": "integer"
9
- }
10
- },
11
- "additionalProperties": false,
12
- "required": [
13
- "connectorId"
14
- ]
15
- }
@@ -1,21 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-04/schema#",
3
- "id": "urn:OCPP:1.6:2019:12:UnlockConnectorResponse",
4
- "title": "UnlockConnectorResponse",
5
- "type": "object",
6
- "properties": {
7
- "status": {
8
- "type": "string",
9
- "additionalProperties": false,
10
- "enum": [
11
- "Unlocked",
12
- "UnlockFailed",
13
- "NotSupported"
14
- ]
15
- }
16
- },
17
- "additionalProperties": false,
18
- "required": [
19
- "status"
20
- ]
21
- }
@@ -1,27 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-04/schema#",
3
- "id": "urn:OCPP:1.6:2019:12:UpdateFirmwareRequest",
4
- "title": "UpdateFirmwareRequest",
5
- "type": "object",
6
- "properties": {
7
- "location": {
8
- "type": "string",
9
- "format": "uri"
10
- },
11
- "retries": {
12
- "type": "integer"
13
- },
14
- "retrieveDate": {
15
- "type": "string",
16
- "format": "date-time"
17
- },
18
- "retryInterval": {
19
- "type": "integer"
20
- }
21
- },
22
- "additionalProperties": false,
23
- "required": [
24
- "location",
25
- "retrieveDate"
26
- ]
27
- }
@@ -1,8 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-04/schema#",
3
- "id": "urn:OCPP:1.6:2019:12:UpdateFirmwareResponse",
4
- "title": "UpdateFirmwareResponse",
5
- "type": "object",
6
- "properties": {},
7
- "additionalProperties": false
8
- }
@@ -1,106 +0,0 @@
1
- export type OcppCall = [2, string, string, Record<string, unknown>];
2
- export type OcppCallResult = [3, string, Record<string, unknown>];
3
- export type OcppCallError = [4, string, string, string, Record<string, unknown>];
4
- export type OcppMessage = OcppCall | OcppCallResult | OcppCallError;
5
- export type ConnectorStatus = "Available" | "Preparing" | "Charging" | "SuspendedEVSE" | "SuspendedEV" | "Finishing" | "Reserved" | "Unavailable" | "Faulted";
6
- export type ChargePointErrorCode = "ConnectorLockFailure" | "EVCommunicationError" | "GroundFailure" | "HighTemperature" | "InternalError" | "LocalListConflict" | "NoError" | "OtherError" | "OverCurrentFailure" | "PowerMeterFailure" | "PowerSwitchFailure" | "ReaderFailure" | "ResetFailure" | "UnderVoltage" | "OverVoltage" | "WeakSignal";
7
- export type AvailabilityType = "Operative" | "Inoperative";
8
- export type RegistrationStatus = "Accepted" | "Pending" | "Rejected";
9
- export type DiagnosticsStatus = "Idle" | "Uploaded" | "UploadFailed" | "Uploading";
10
- export type FirmwareStatus = "Downloaded" | "DownloadFailed" | "Downloading" | "Idle" | "InstallationFailed" | "Installing" | "Installed";
11
- export type StopReason = "EmergencyStop" | "EVDisconnected" | "HardReset" | "Local" | "Other" | "PowerLoss" | "Reboot" | "Remote" | "SoftReset" | "UnlockCommand" | "DeAuthorized";
12
- export interface CallResponse {
13
- messageId: string;
14
- payload: Record<string, unknown>;
15
- }
16
- export interface CallErrorResponse {
17
- messageId: string;
18
- code: string;
19
- description: string;
20
- details: Record<string, unknown>;
21
- }
22
- export interface PendingCall {
23
- action: string;
24
- resolve: (response: CallResponse) => void;
25
- reject: (error: Error) => void;
26
- timeout: NodeJS.Timeout;
27
- }
28
- export interface StationConfig {
29
- centralSystemUrl: string;
30
- chargePointId: string;
31
- vendor: string;
32
- model: string;
33
- connectorId: number;
34
- connectorCount: number;
35
- heartbeatIntervalSeconds: number;
36
- persistState: boolean;
37
- stateDirectory?: string;
38
- webSocketSubprotocol: string;
39
- webSocketPingIntervalSeconds: number;
40
- webSocketReconnectEnabled: boolean;
41
- webSocketReconnectInitialDelayMs: number;
42
- webSocketReconnectMaxDelayMs: number;
43
- webSocketReconnectMaxAttempts: number;
44
- callTimeoutMs: number;
45
- tlsRejectUnauthorized: boolean;
46
- tlsCaFile?: string;
47
- tlsCertFile?: string;
48
- tlsKeyFile?: string;
49
- tlsServerName?: string;
50
- }
51
- export interface ConnectorState {
52
- id: number;
53
- status: ConnectorStatus;
54
- availability: AvailabilityType;
55
- errorCode: ChargePointErrorCode;
56
- info?: string;
57
- vendorId?: string;
58
- vendorErrorCode?: string;
59
- evConnected: boolean;
60
- transactionId?: number;
61
- transactionStartedAt?: string;
62
- reservationId?: number;
63
- reservationIdTag?: string;
64
- reservationParentIdTag?: string;
65
- reservationExpiryDate?: string;
66
- lastIdTag?: string;
67
- stopTransactionAtWh?: number;
68
- pendingStartTransaction?: PendingStartTransaction;
69
- pendingStopTransaction?: PendingStopTransaction;
70
- meterWh: number;
71
- }
72
- export interface PendingStartTransaction {
73
- connectorId: number;
74
- idTag: string;
75
- meterStart: number;
76
- timestamp: string;
77
- reservationId?: number;
78
- }
79
- export interface PendingStopTransaction {
80
- meterStop: number;
81
- timestamp: string;
82
- reason: StopReason;
83
- idTag?: string;
84
- transactionData: Record<string, unknown>[];
85
- }
86
- export interface StationState {
87
- connected: boolean;
88
- booted: boolean;
89
- registrationStatus: RegistrationStatus | "Unknown";
90
- connectorStatus: ConnectorStatus;
91
- availability: AvailabilityType;
92
- transactionId?: number;
93
- reservationId?: number;
94
- localListVersion: number;
95
- meterWh: number;
96
- connectors: ConnectorState[];
97
- diagnosticsStatus?: DiagnosticsStatus;
98
- firmwareStatus?: FirmwareStatus;
99
- lastHeartbeatAt?: Date;
100
- }
101
- export interface LogEntry {
102
- at: Date;
103
- level: "info" | "success" | "warn" | "error" | "in" | "out";
104
- message: string;
105
- details?: string;
106
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,20 +0,0 @@
1
- export type IdTagStatus = "Accepted" | "Blocked" | "Expired" | "Invalid" | "ConcurrentTx";
2
- export interface IdTagInfo {
3
- status: IdTagStatus;
4
- expiryDate?: string;
5
- parentIdTag?: string;
6
- }
7
- export interface AuthorizationDecision {
8
- accepted: boolean;
9
- idTagInfo: IdTagInfo;
10
- source: "CentralSystem" | "LocalList" | "AuthorizationCache" | "OfflineUnknown" | "None";
11
- }
12
- export declare function authorizeLocally(idTag: string, requireOfflinePermission: boolean, localAuthorizationList: Map<string, Record<string, unknown> | undefined>, authorizationCache: Map<string, Record<string, unknown> | undefined>, configuration: {
13
- localAuthListEnabled: boolean;
14
- localAuthorizeOffline: boolean;
15
- authorizationCacheEnabled: boolean;
16
- allowOfflineTxForUnknownId: boolean;
17
- }): AuthorizationDecision;
18
- export declare function normalizeIdTagInfo(value: Record<string, unknown> | undefined): IdTagInfo;
19
- export declare function serializeIdTagInfo(idTagInfo: IdTagInfo): Record<string, unknown>;
20
- export declare function isAcceptedIdTagInfo(idTagInfo: IdTagInfo): boolean;
@@ -1,78 +0,0 @@
1
- export function authorizeLocally(idTag, requireOfflinePermission, localAuthorizationList, authorizationCache, configuration) {
2
- if (requireOfflinePermission && !configuration.localAuthorizeOffline) {
3
- return {
4
- accepted: false,
5
- idTagInfo: { status: "Invalid" },
6
- source: "None"
7
- };
8
- }
9
- const localListInfo = localAuthorizationList.get(idTag);
10
- if (configuration.localAuthListEnabled && localAuthorizationList.has(idTag)) {
11
- const idTagInfo = normalizeIdTagInfo(localListInfo);
12
- return {
13
- accepted: isAcceptedIdTagInfo(idTagInfo),
14
- idTagInfo,
15
- source: "LocalList"
16
- };
17
- }
18
- if (configuration.authorizationCacheEnabled && authorizationCache.has(idTag)) {
19
- const idTagInfo = normalizeIdTagInfo(authorizationCache.get(idTag));
20
- return {
21
- accepted: isAcceptedIdTagInfo(idTagInfo),
22
- idTagInfo,
23
- source: "AuthorizationCache"
24
- };
25
- }
26
- if (requireOfflinePermission && configuration.allowOfflineTxForUnknownId) {
27
- return {
28
- accepted: true,
29
- idTagInfo: { status: "Accepted" },
30
- source: "OfflineUnknown"
31
- };
32
- }
33
- return {
34
- accepted: false,
35
- idTagInfo: { status: "Invalid" },
36
- source: "None"
37
- };
38
- }
39
- export function normalizeIdTagInfo(value) {
40
- const status = readIdTagStatus(value?.status, "Accepted");
41
- const expiryDate = readOptionalString(value?.expiryDate);
42
- const parentIdTag = readOptionalString(value?.parentIdTag);
43
- const idTagInfo = {
44
- status: expiryDate && Date.parse(expiryDate) <= Date.now() ? "Expired" : status
45
- };
46
- if (expiryDate) {
47
- idTagInfo.expiryDate = expiryDate;
48
- }
49
- if (parentIdTag) {
50
- idTagInfo.parentIdTag = parentIdTag;
51
- }
52
- return idTagInfo;
53
- }
54
- export function serializeIdTagInfo(idTagInfo) {
55
- const output = { status: idTagInfo.status };
56
- if (idTagInfo.expiryDate) {
57
- output.expiryDate = idTagInfo.expiryDate;
58
- }
59
- if (idTagInfo.parentIdTag) {
60
- output.parentIdTag = idTagInfo.parentIdTag;
61
- }
62
- return output;
63
- }
64
- export function isAcceptedIdTagInfo(idTagInfo) {
65
- return idTagInfo.status === "Accepted";
66
- }
67
- function readIdTagStatus(value, fallback) {
68
- return value === "Accepted" ||
69
- value === "Blocked" ||
70
- value === "Expired" ||
71
- value === "Invalid" ||
72
- value === "ConcurrentTx"
73
- ? value
74
- : fallback;
75
- }
76
- function readOptionalString(value) {
77
- return typeof value === "string" ? value : undefined;
78
- }
@@ -1,18 +0,0 @@
1
- import { type ChargingProfileEntry } from "./smart-charging.js";
2
- export declare class ChargingProfileRegistry {
3
- private readonly profiles;
4
- get length(): number;
5
- entries(): ChargingProfileEntry[];
6
- replace(entries: ChargingProfileEntry[]): void;
7
- set(connectorId: number, profilePayload: unknown, options: {
8
- hasConnector: (id: number) => boolean;
9
- transactionIdForConnector: (id: number) => number | undefined;
10
- }): "Accepted" | "Rejected";
11
- clear(payload: Record<string, unknown>): "Accepted" | "Unknown";
12
- clearForTransaction(transactionId: number): boolean;
13
- pruneExpired(at?: Date): boolean;
14
- compositeSchedulePayload(payload: Record<string, unknown>, transactionId: number | undefined, transactionStartedAt?: string): {
15
- payload: Record<string, unknown>;
16
- prunedExpired: boolean;
17
- } | undefined;
18
- }