@ocpp-debugkit/toolkit 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.
- package/LICENSE +201 -0
- package/NOTICE +14 -0
- package/README.md +35 -0
- package/dist/cli/commands/inspect.d.ts +8 -0
- package/dist/cli/commands/inspect.d.ts.map +1 -0
- package/dist/cli/commands/inspect.js +63 -0
- package/dist/cli/commands/inspect.js.map +1 -0
- package/dist/cli/commands/report.d.ts +9 -0
- package/dist/cli/commands/report.d.ts.map +1 -0
- package/dist/cli/commands/report.js +54 -0
- package/dist/cli/commands/report.js.map +1 -0
- package/dist/cli/commands/scenario.d.ts +10 -0
- package/dist/cli/commands/scenario.d.ts.map +1 -0
- package/dist/cli/commands/scenario.js +104 -0
- package/dist/cli/commands/scenario.js.map +1 -0
- package/dist/cli/index.d.ts +7 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +47 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/utils.d.ts +13 -0
- package/dist/cli/utils.d.ts.map +1 -0
- package/dist/cli/utils.js +43 -0
- package/dist/cli/utils.js.map +1 -0
- package/dist/core/__fixtures__/connector-fault.d.ts +116 -0
- package/dist/core/__fixtures__/connector-fault.d.ts.map +1 -0
- package/dist/core/__fixtures__/connector-fault.js +231 -0
- package/dist/core/__fixtures__/connector-fault.js.map +1 -0
- package/dist/core/__fixtures__/failed-auth.d.ts +64 -0
- package/dist/core/__fixtures__/failed-auth.d.ts.map +1 -0
- package/dist/core/__fixtures__/failed-auth.js +173 -0
- package/dist/core/__fixtures__/failed-auth.js.map +1 -0
- package/dist/core/__fixtures__/normal-session.d.ts +108 -0
- package/dist/core/__fixtures__/normal-session.d.ts.map +1 -0
- package/dist/core/__fixtures__/normal-session.js +261 -0
- package/dist/core/__fixtures__/normal-session.js.map +1 -0
- package/dist/core/detection.d.ts +23 -0
- package/dist/core/detection.d.ts.map +1 -0
- package/dist/core/detection.js +226 -0
- package/dist/core/detection.js.map +1 -0
- package/dist/core/fixtures/index.d.ts +298 -0
- package/dist/core/fixtures/index.d.ts.map +1 -0
- package/dist/core/fixtures/index.js +19 -0
- package/dist/core/fixtures/index.js.map +1 -0
- package/dist/core/index.d.ts +14 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +22 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/normalizer.d.ts +83 -0
- package/dist/core/normalizer.d.ts.map +1 -0
- package/dist/core/normalizer.js +289 -0
- package/dist/core/normalizer.js.map +1 -0
- package/dist/core/parser.d.ts +53 -0
- package/dist/core/parser.d.ts.map +1 -0
- package/dist/core/parser.js +282 -0
- package/dist/core/parser.js.map +1 -0
- package/dist/core/schemas.d.ts +68 -0
- package/dist/core/schemas.d.ts.map +1 -0
- package/dist/core/schemas.js +81 -0
- package/dist/core/schemas.js.map +1 -0
- package/dist/core/summarizer.d.ts +25 -0
- package/dist/core/summarizer.d.ts.map +1 -0
- package/dist/core/summarizer.js +47 -0
- package/dist/core/summarizer.js.map +1 -0
- package/dist/core/timeline.d.ts +26 -0
- package/dist/core/timeline.d.ts.map +1 -0
- package/dist/core/timeline.js +318 -0
- package/dist/core/timeline.js.map +1 -0
- package/dist/core/types.d.ts +160 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +9 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/validator.d.ts +33 -0
- package/dist/core/validator.d.ts.map +1 -0
- package/dist/core/validator.js +122 -0
- package/dist/core/validator.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/react/components.d.ts +50 -0
- package/dist/react/components.d.ts.map +1 -0
- package/dist/react/components.js +49 -0
- package/dist/react/components.js.map +1 -0
- package/dist/react/index.d.ts +11 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +10 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/types.d.ts +33 -0
- package/dist/react/types.d.ts.map +1 -0
- package/dist/react/types.js +5 -0
- package/dist/react/types.js.map +1 -0
- package/dist/replay/engine.d.ts +55 -0
- package/dist/replay/engine.d.ts.map +1 -0
- package/dist/replay/engine.js +86 -0
- package/dist/replay/engine.js.map +1 -0
- package/dist/replay/index.d.ts +11 -0
- package/dist/replay/index.d.ts.map +1 -0
- package/dist/replay/index.js +11 -0
- package/dist/replay/index.js.map +1 -0
- package/dist/reporter/index.d.ts +6 -0
- package/dist/reporter/index.d.ts.map +1 -0
- package/dist/reporter/index.js +5 -0
- package/dist/reporter/index.js.map +1 -0
- package/dist/reporter/markdown.d.ts +20 -0
- package/dist/reporter/markdown.d.ts.map +1 -0
- package/dist/reporter/markdown.js +181 -0
- package/dist/reporter/markdown.js.map +1 -0
- package/dist/reporter/types.d.ts +34 -0
- package/dist/reporter/types.d.ts.map +1 -0
- package/dist/reporter/types.js +9 -0
- package/dist/reporter/types.js.map +1 -0
- package/dist/scenarios/__scenarios__/station-offline.d.ts +94 -0
- package/dist/scenarios/__scenarios__/station-offline.d.ts.map +1 -0
- package/dist/scenarios/__scenarios__/station-offline.js +168 -0
- package/dist/scenarios/__scenarios__/station-offline.js.map +1 -0
- package/dist/scenarios/__scenarios__/unexpected-stop-reason.d.ts +112 -0
- package/dist/scenarios/__scenarios__/unexpected-stop-reason.d.ts.map +1 -0
- package/dist/scenarios/__scenarios__/unexpected-stop-reason.js +216 -0
- package/dist/scenarios/__scenarios__/unexpected-stop-reason.js.map +1 -0
- package/dist/scenarios/index.d.ts +21 -0
- package/dist/scenarios/index.d.ts.map +1 -0
- package/dist/scenarios/index.js +61 -0
- package/dist/scenarios/index.js.map +1 -0
- package/package.json +110 -0
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Synthetic trace fixtures for testing and development.
|
|
3
|
+
*
|
|
4
|
+
* All fixtures are fully synthetic — no real station identifiers, transaction
|
|
5
|
+
* IDs, idTag values, or personal data.
|
|
6
|
+
*
|
|
7
|
+
* @see docs/trace-format-spec.md
|
|
8
|
+
*/
|
|
9
|
+
import normalSession from '../__fixtures__/normal-session.js';
|
|
10
|
+
import failedAuth from '../__fixtures__/failed-auth.js';
|
|
11
|
+
import connectorFault from '../__fixtures__/connector-fault.js';
|
|
12
|
+
export { normalSession, failedAuth, connectorFault };
|
|
13
|
+
export declare const fixtures: {
|
|
14
|
+
readonly normalSession: {
|
|
15
|
+
traceId: string;
|
|
16
|
+
metadata: {
|
|
17
|
+
stationId: string;
|
|
18
|
+
ocppVersion: string;
|
|
19
|
+
source: string;
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
|
22
|
+
events: ({
|
|
23
|
+
timestamp: string;
|
|
24
|
+
direction: string;
|
|
25
|
+
message: (string | number | {
|
|
26
|
+
chargePointVendor: string;
|
|
27
|
+
chargePointModel: string;
|
|
28
|
+
chargePointSerialNumber: string;
|
|
29
|
+
firmwareVersion: string;
|
|
30
|
+
})[];
|
|
31
|
+
} | {
|
|
32
|
+
timestamp: string;
|
|
33
|
+
direction: string;
|
|
34
|
+
message: (string | number | {
|
|
35
|
+
currentTime: string;
|
|
36
|
+
interval: number;
|
|
37
|
+
status: string;
|
|
38
|
+
})[];
|
|
39
|
+
} | {
|
|
40
|
+
timestamp: string;
|
|
41
|
+
direction: string;
|
|
42
|
+
message: (string | number | {
|
|
43
|
+
connectorId: number;
|
|
44
|
+
status: string;
|
|
45
|
+
errorCode: string;
|
|
46
|
+
})[];
|
|
47
|
+
} | {
|
|
48
|
+
timestamp: string;
|
|
49
|
+
direction: string;
|
|
50
|
+
message: {}[];
|
|
51
|
+
} | {
|
|
52
|
+
timestamp: string;
|
|
53
|
+
direction: string;
|
|
54
|
+
message: (string | number | {
|
|
55
|
+
idTag: string;
|
|
56
|
+
})[];
|
|
57
|
+
} | {
|
|
58
|
+
timestamp: string;
|
|
59
|
+
direction: string;
|
|
60
|
+
message: (string | number | {
|
|
61
|
+
idTagInfo: {
|
|
62
|
+
status: string;
|
|
63
|
+
expiryDate: string;
|
|
64
|
+
parentIdTag: string;
|
|
65
|
+
};
|
|
66
|
+
})[];
|
|
67
|
+
} | {
|
|
68
|
+
timestamp: string;
|
|
69
|
+
direction: string;
|
|
70
|
+
message: (string | number | {
|
|
71
|
+
connectorId: number;
|
|
72
|
+
idTag: string;
|
|
73
|
+
meterStart: number;
|
|
74
|
+
timestamp: string;
|
|
75
|
+
})[];
|
|
76
|
+
} | {
|
|
77
|
+
timestamp: string;
|
|
78
|
+
direction: string;
|
|
79
|
+
message: (string | number | {
|
|
80
|
+
transactionId: number;
|
|
81
|
+
idTagInfo: {
|
|
82
|
+
status: string;
|
|
83
|
+
};
|
|
84
|
+
})[];
|
|
85
|
+
} | {
|
|
86
|
+
timestamp: string;
|
|
87
|
+
direction: string;
|
|
88
|
+
message: (string | number | {
|
|
89
|
+
connectorId: number;
|
|
90
|
+
transactionId: number;
|
|
91
|
+
meterValue: {
|
|
92
|
+
timestamp: string;
|
|
93
|
+
sampledValue: {
|
|
94
|
+
value: string;
|
|
95
|
+
measurand: string;
|
|
96
|
+
unit: string;
|
|
97
|
+
}[];
|
|
98
|
+
}[];
|
|
99
|
+
})[];
|
|
100
|
+
} | {
|
|
101
|
+
timestamp: string;
|
|
102
|
+
direction: string;
|
|
103
|
+
message: (string | number | {
|
|
104
|
+
transactionId: number;
|
|
105
|
+
idTag: string;
|
|
106
|
+
meterStop: number;
|
|
107
|
+
timestamp: string;
|
|
108
|
+
reason: string;
|
|
109
|
+
})[];
|
|
110
|
+
} | {
|
|
111
|
+
timestamp: string;
|
|
112
|
+
direction: string;
|
|
113
|
+
message: (string | number | {
|
|
114
|
+
idTagInfo: {
|
|
115
|
+
status: string;
|
|
116
|
+
};
|
|
117
|
+
})[];
|
|
118
|
+
})[];
|
|
119
|
+
};
|
|
120
|
+
readonly failedAuth: {
|
|
121
|
+
traceId: string;
|
|
122
|
+
metadata: {
|
|
123
|
+
stationId: string;
|
|
124
|
+
ocppVersion: string;
|
|
125
|
+
source: string;
|
|
126
|
+
description: string;
|
|
127
|
+
};
|
|
128
|
+
events: ({
|
|
129
|
+
timestamp: string;
|
|
130
|
+
direction: string;
|
|
131
|
+
message: (string | number | {
|
|
132
|
+
chargePointVendor: string;
|
|
133
|
+
chargePointModel: string;
|
|
134
|
+
chargePointSerialNumber: string;
|
|
135
|
+
firmwareVersion: string;
|
|
136
|
+
})[];
|
|
137
|
+
} | {
|
|
138
|
+
timestamp: string;
|
|
139
|
+
direction: string;
|
|
140
|
+
message: (string | number | {
|
|
141
|
+
currentTime: string;
|
|
142
|
+
interval: number;
|
|
143
|
+
status: string;
|
|
144
|
+
})[];
|
|
145
|
+
} | {
|
|
146
|
+
timestamp: string;
|
|
147
|
+
direction: string;
|
|
148
|
+
message: (string | number | {
|
|
149
|
+
connectorId: number;
|
|
150
|
+
status: string;
|
|
151
|
+
errorCode: string;
|
|
152
|
+
})[];
|
|
153
|
+
} | {
|
|
154
|
+
timestamp: string;
|
|
155
|
+
direction: string;
|
|
156
|
+
message: {}[];
|
|
157
|
+
} | {
|
|
158
|
+
timestamp: string;
|
|
159
|
+
direction: string;
|
|
160
|
+
message: (string | number | {
|
|
161
|
+
idTag: string;
|
|
162
|
+
})[];
|
|
163
|
+
} | {
|
|
164
|
+
timestamp: string;
|
|
165
|
+
direction: string;
|
|
166
|
+
message: (string | number | {
|
|
167
|
+
idTagInfo: {
|
|
168
|
+
status: string;
|
|
169
|
+
};
|
|
170
|
+
})[];
|
|
171
|
+
} | {
|
|
172
|
+
timestamp: string;
|
|
173
|
+
direction: string;
|
|
174
|
+
message: (string | number | {
|
|
175
|
+
connectorId: number;
|
|
176
|
+
status: string;
|
|
177
|
+
errorCode: string;
|
|
178
|
+
info: string;
|
|
179
|
+
})[];
|
|
180
|
+
})[];
|
|
181
|
+
};
|
|
182
|
+
readonly connectorFault: {
|
|
183
|
+
traceId: string;
|
|
184
|
+
metadata: {
|
|
185
|
+
stationId: string;
|
|
186
|
+
ocppVersion: string;
|
|
187
|
+
source: string;
|
|
188
|
+
description: string;
|
|
189
|
+
};
|
|
190
|
+
events: ({
|
|
191
|
+
timestamp: string;
|
|
192
|
+
direction: string;
|
|
193
|
+
message: (string | number | {
|
|
194
|
+
chargePointVendor: string;
|
|
195
|
+
chargePointModel: string;
|
|
196
|
+
chargePointSerialNumber: string;
|
|
197
|
+
firmwareVersion: string;
|
|
198
|
+
})[];
|
|
199
|
+
} | {
|
|
200
|
+
timestamp: string;
|
|
201
|
+
direction: string;
|
|
202
|
+
message: (string | number | {
|
|
203
|
+
currentTime: string;
|
|
204
|
+
interval: number;
|
|
205
|
+
status: string;
|
|
206
|
+
})[];
|
|
207
|
+
} | {
|
|
208
|
+
timestamp: string;
|
|
209
|
+
direction: string;
|
|
210
|
+
message: (string | number | {
|
|
211
|
+
connectorId: number;
|
|
212
|
+
status: string;
|
|
213
|
+
errorCode: string;
|
|
214
|
+
})[];
|
|
215
|
+
} | {
|
|
216
|
+
timestamp: string;
|
|
217
|
+
direction: string;
|
|
218
|
+
message: {}[];
|
|
219
|
+
} | {
|
|
220
|
+
timestamp: string;
|
|
221
|
+
direction: string;
|
|
222
|
+
message: (string | number | {
|
|
223
|
+
idTag: string;
|
|
224
|
+
})[];
|
|
225
|
+
} | {
|
|
226
|
+
timestamp: string;
|
|
227
|
+
direction: string;
|
|
228
|
+
message: (string | number | {
|
|
229
|
+
idTagInfo: {
|
|
230
|
+
status: string;
|
|
231
|
+
expiryDate: string;
|
|
232
|
+
};
|
|
233
|
+
})[];
|
|
234
|
+
} | {
|
|
235
|
+
timestamp: string;
|
|
236
|
+
direction: string;
|
|
237
|
+
message: (string | number | {
|
|
238
|
+
connectorId: number;
|
|
239
|
+
idTag: string;
|
|
240
|
+
meterStart: number;
|
|
241
|
+
timestamp: string;
|
|
242
|
+
})[];
|
|
243
|
+
} | {
|
|
244
|
+
timestamp: string;
|
|
245
|
+
direction: string;
|
|
246
|
+
message: (string | number | {
|
|
247
|
+
transactionId: number;
|
|
248
|
+
idTagInfo: {
|
|
249
|
+
status: string;
|
|
250
|
+
};
|
|
251
|
+
})[];
|
|
252
|
+
} | {
|
|
253
|
+
timestamp: string;
|
|
254
|
+
direction: string;
|
|
255
|
+
message: (string | number | {
|
|
256
|
+
connectorId: number;
|
|
257
|
+
transactionId: number;
|
|
258
|
+
meterValue: {
|
|
259
|
+
timestamp: string;
|
|
260
|
+
sampledValue: {
|
|
261
|
+
value: string;
|
|
262
|
+
measurand: string;
|
|
263
|
+
unit: string;
|
|
264
|
+
}[];
|
|
265
|
+
}[];
|
|
266
|
+
})[];
|
|
267
|
+
} | {
|
|
268
|
+
timestamp: string;
|
|
269
|
+
direction: string;
|
|
270
|
+
message: (string | number | {
|
|
271
|
+
connectorId: number;
|
|
272
|
+
status: string;
|
|
273
|
+
errorCode: string;
|
|
274
|
+
info: string;
|
|
275
|
+
})[];
|
|
276
|
+
} | {
|
|
277
|
+
timestamp: string;
|
|
278
|
+
direction: string;
|
|
279
|
+
message: (string | number | {
|
|
280
|
+
transactionId: number;
|
|
281
|
+
idTag: string;
|
|
282
|
+
meterStop: number;
|
|
283
|
+
timestamp: string;
|
|
284
|
+
reason: string;
|
|
285
|
+
})[];
|
|
286
|
+
} | {
|
|
287
|
+
timestamp: string;
|
|
288
|
+
direction: string;
|
|
289
|
+
message: (string | number | {
|
|
290
|
+
idTagInfo: {
|
|
291
|
+
status: string;
|
|
292
|
+
};
|
|
293
|
+
})[];
|
|
294
|
+
})[];
|
|
295
|
+
};
|
|
296
|
+
};
|
|
297
|
+
export declare const fixtureNames: readonly ["normal-session", "failed-auth", "connector-fault"];
|
|
298
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/fixtures/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,aAAa,MAAM,mCAAmC,CAAC;AAC9D,OAAO,UAAU,MAAM,gCAAgC,CAAC;AACxD,OAAO,cAAc,MAAM,oCAAoC,CAAC;AAEhE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC;AAErD,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIX,CAAC;AAEX,eAAO,MAAM,YAAY,+DAAgE,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Synthetic trace fixtures for testing and development.
|
|
3
|
+
*
|
|
4
|
+
* All fixtures are fully synthetic — no real station identifiers, transaction
|
|
5
|
+
* IDs, idTag values, or personal data.
|
|
6
|
+
*
|
|
7
|
+
* @see docs/trace-format-spec.md
|
|
8
|
+
*/
|
|
9
|
+
import normalSession from '../__fixtures__/normal-session.js';
|
|
10
|
+
import failedAuth from '../__fixtures__/failed-auth.js';
|
|
11
|
+
import connectorFault from '../__fixtures__/connector-fault.js';
|
|
12
|
+
export { normalSession, failedAuth, connectorFault };
|
|
13
|
+
export const fixtures = {
|
|
14
|
+
normalSession,
|
|
15
|
+
failedAuth,
|
|
16
|
+
connectorFault,
|
|
17
|
+
};
|
|
18
|
+
export const fixtureNames = ['normal-session', 'failed-auth', 'connector-fault'];
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/fixtures/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,aAAa,MAAM,mCAAmC,CAAC;AAC9D,OAAO,UAAU,MAAM,gCAAgC,CAAC;AACxD,OAAO,cAAc,MAAM,oCAAoC,CAAC;AAEhE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC;AAErD,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,aAAa;IACb,UAAU;IACV,cAAc;CACN,CAAC;AAEX,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,gBAAgB,EAAE,aAAa,EAAE,iBAAiB,CAAU,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Barrel export for the @ocpp-debugkit/core package.
|
|
3
|
+
*/
|
|
4
|
+
export * from './types.js';
|
|
5
|
+
export * from './schemas.js';
|
|
6
|
+
export { parseTrace, ParseError, MAX_INPUT_SIZE_BYTES, MAX_EVENT_COUNT } from './parser.js';
|
|
7
|
+
export type { TraceFormat } from './parser.js';
|
|
8
|
+
export { normalizeEvents, normalizeTimestamp, inferDirection, reverseDirection, classifyMessageType, extractAction, extractPayload, extractErrorCode, extractErrorDescription, } from './normalizer.js';
|
|
9
|
+
export { buildSessionTimeline } from './timeline.js';
|
|
10
|
+
export { detectFailures } from './detection.js';
|
|
11
|
+
export { summarizeSession, summarizeSessions } from './summarizer.js';
|
|
12
|
+
export { validateMessage, validateMessages } from './validator.js';
|
|
13
|
+
export * from './fixtures/index.js';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,cAAc,YAAY,CAAC;AAG3B,cAAc,cAAc,CAAC;AAG7B,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC5F,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,uBAAuB,GACxB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAGrD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGtE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGnE,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Barrel export for the @ocpp-debugkit/core package.
|
|
3
|
+
*/
|
|
4
|
+
// Types
|
|
5
|
+
export * from './types.js';
|
|
6
|
+
// Schemas (Zod)
|
|
7
|
+
export * from './schemas.js';
|
|
8
|
+
// Parser
|
|
9
|
+
export { parseTrace, ParseError, MAX_INPUT_SIZE_BYTES, MAX_EVENT_COUNT } from './parser.js';
|
|
10
|
+
// Normalizer
|
|
11
|
+
export { normalizeEvents, normalizeTimestamp, inferDirection, reverseDirection, classifyMessageType, extractAction, extractPayload, extractErrorCode, extractErrorDescription, } from './normalizer.js';
|
|
12
|
+
// Timeline
|
|
13
|
+
export { buildSessionTimeline } from './timeline.js';
|
|
14
|
+
// Detection
|
|
15
|
+
export { detectFailures } from './detection.js';
|
|
16
|
+
// Summarizer
|
|
17
|
+
export { summarizeSession, summarizeSessions } from './summarizer.js';
|
|
18
|
+
// Validator
|
|
19
|
+
export { validateMessage, validateMessages } from './validator.js';
|
|
20
|
+
// Fixtures
|
|
21
|
+
export * from './fixtures/index.js';
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,QAAQ;AACR,cAAc,YAAY,CAAC;AAE3B,gBAAgB;AAChB,cAAc,cAAc,CAAC;AAE7B,SAAS;AACT,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG5F,aAAa;AACb,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,uBAAuB,GACxB,MAAM,iBAAiB,CAAC;AAEzB,WAAW;AACX,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD,YAAY;AACZ,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,aAAa;AACb,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEtE,YAAY;AACZ,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEnE,WAAW;AACX,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event normalizer — transforms raw trace event inputs into canonical
|
|
3
|
+
* `Event` objects with classified message type, direction, and timestamps.
|
|
4
|
+
*
|
|
5
|
+
* @see ADR-0003 (canonical event model)
|
|
6
|
+
* @see ADR-0004 (message direction)
|
|
7
|
+
* @see ADR-0005 (timestamp normalization)
|
|
8
|
+
*/
|
|
9
|
+
import type { Direction, Event, MessageType, TraceEventInput, RawOcppMessage } from './types.js';
|
|
10
|
+
/**
|
|
11
|
+
* Infer the direction of a Call message from its action name (ADR-0004).
|
|
12
|
+
* - If the action is known to be CS→CSMS, return 'CS_TO_CSMS'.
|
|
13
|
+
* - If the action is known to be CSMS→CS, return 'CSMS_TO_CS'.
|
|
14
|
+
* - If the action is not recognized, return 'UNKNOWN'.
|
|
15
|
+
*
|
|
16
|
+
* For CallResult/CallError, the direction is the reverse of the original Call.
|
|
17
|
+
* Since we don't have the original Call's direction here, we infer based on
|
|
18
|
+
* the matched Call's action. For responses without a matched Call, we use
|
|
19
|
+
* 'UNKNOWN'.
|
|
20
|
+
*/
|
|
21
|
+
export declare function inferDirection(messageType: MessageType, action: string | null): Direction;
|
|
22
|
+
/**
|
|
23
|
+
* Determine the reverse direction for a response.
|
|
24
|
+
* Call CS→CSMS → Response CSMS→CS, and vice versa.
|
|
25
|
+
*/
|
|
26
|
+
export declare function reverseDirection(dir: Direction): Direction;
|
|
27
|
+
/**
|
|
28
|
+
* Normalize a timestamp to epoch milliseconds.
|
|
29
|
+
*
|
|
30
|
+
* Accepts:
|
|
31
|
+
* - ISO 8601 strings (UTC or with offset)
|
|
32
|
+
* - Unix epoch in milliseconds (number >= 10^12)
|
|
33
|
+
* - Unix epoch in seconds (number < 10^12)
|
|
34
|
+
* - null/undefined → null
|
|
35
|
+
*
|
|
36
|
+
* @returns epoch milliseconds, or null if the timestamp is missing or invalid.
|
|
37
|
+
*/
|
|
38
|
+
export declare function normalizeTimestamp(timestamp: string | number | null | undefined): number | null;
|
|
39
|
+
/**
|
|
40
|
+
* Classify the OCPP message type from the raw message array.
|
|
41
|
+
* - [2, ...] → 'Call'
|
|
42
|
+
* - [3, ...] → 'CallResult'
|
|
43
|
+
* - [4, ...] → 'CallError'
|
|
44
|
+
*/
|
|
45
|
+
export declare function classifyMessageType(message: RawOcppMessage): MessageType;
|
|
46
|
+
/**
|
|
47
|
+
* Extract the action name from a Call message.
|
|
48
|
+
* Only Call messages have an action (at index 2).
|
|
49
|
+
*/
|
|
50
|
+
export declare function extractAction(message: RawOcppMessage): string | null;
|
|
51
|
+
/**
|
|
52
|
+
* Extract the payload from any message type.
|
|
53
|
+
* - Call: index 3
|
|
54
|
+
* - CallResult: index 2
|
|
55
|
+
* - CallError: index 4 (ErrorDetails)
|
|
56
|
+
*/
|
|
57
|
+
export declare function extractPayload(message: RawOcppMessage): unknown;
|
|
58
|
+
/**
|
|
59
|
+
* Extract error code from a CallError message (index 2).
|
|
60
|
+
*/
|
|
61
|
+
export declare function extractErrorCode(message: RawOcppMessage): string | null;
|
|
62
|
+
/**
|
|
63
|
+
* Extract error description from a CallError message (index 3).
|
|
64
|
+
*/
|
|
65
|
+
export declare function extractErrorDescription(message: RawOcppMessage): string | null;
|
|
66
|
+
/**
|
|
67
|
+
* Normalize an array of raw trace event inputs into canonical `Event` objects.
|
|
68
|
+
*
|
|
69
|
+
* This function:
|
|
70
|
+
* 1. Classifies the message type (Call/CallResult/CallError)
|
|
71
|
+
* 2. Extracts action, payload, error fields
|
|
72
|
+
* 3. Normalizes timestamps to epoch milliseconds
|
|
73
|
+
* 4. Resolves direction: uses explicit direction if provided, otherwise
|
|
74
|
+
* infers from action name (for Calls) or from the matched Call (for responses)
|
|
75
|
+
* 5. Generates sequential event IDs
|
|
76
|
+
*
|
|
77
|
+
* Events are NOT reordered (ADR-0005). Out-of-order timestamps are preserved
|
|
78
|
+
* as-is; the caller can detect them after normalization.
|
|
79
|
+
*
|
|
80
|
+
* @see ADR-0003, ADR-0004, ADR-0005
|
|
81
|
+
*/
|
|
82
|
+
export declare function normalizeEvents(inputs: TraceEventInput[]): Event[];
|
|
83
|
+
//# sourceMappingURL=normalizer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalizer.d.ts","sourceRoot":"","sources":["../../src/core/normalizer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AA0DjG;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAUzF;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,SAAS,GAAG,SAAS,CAS1D;AAaD;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAgC/F;AAMD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,cAAc,GAAG,WAAW,CAaxE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,GAAG,IAAI,CAMpE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAW/D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,GAAG,IAAI,CAMvE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,GAAG,IAAI,CAM9E;AAMD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,eAAe,EAAE,GAAG,KAAK,EAAE,CAoDlE"}
|