ocpp-ws-io 2.1.7 → 2.1.9

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/dist/browser.mjs CHANGED
@@ -2,6 +2,9 @@
2
2
  function defineMiddleware(mw) {
3
3
  return mw;
4
4
  }
5
+ function createPlugin(plugin) {
6
+ return plugin;
7
+ }
5
8
  function defineRpcMiddleware(mw) {
6
9
  return mw;
7
10
  }
@@ -551,27 +554,37 @@ var NOOP_LOGGER = {
551
554
  };
552
555
 
553
556
  // src/browser/util.ts
554
- var RPC_ERROR_REGISTRY = /* @__PURE__ */ new Map([
555
- ["GenericError", RPCGenericError],
556
- ["RpcFrameworkError", RPCFrameworkError],
557
- ["MessageTypeNotSupported", RPCMessageTypeNotSupportedError],
558
- ["NotImplemented", RPCNotImplementedError],
559
- ["NotSupported", RPCNotSupportedError],
560
- ["InternalError", RPCInternalError],
561
- ["ProtocolError", RPCProtocolError],
562
- ["SecurityError", RPCSecurityError],
563
- ["FormatViolation", RPCFormatViolationError],
564
- ["FormationViolation", RPCFormationViolationError],
565
- ["PropertyConstraintViolation", RPCPropertyConstraintViolationError],
566
- [
567
- "OccurrenceConstraintViolation",
568
- RPCOccurrenceConstraintViolationError
569
- ],
570
- ["TypeConstraintViolation", RPCTypeConstraintViolationError]
571
- ]);
572
557
  function createRPCError(code, message, details = {}) {
573
- const Ctor = RPC_ERROR_REGISTRY.get(code) ?? RPCGenericError;
574
- return new Ctor(message, details);
558
+ switch (code) {
559
+ case "GenericError":
560
+ return new RPCGenericError(message, details);
561
+ case "RpcFrameworkError":
562
+ return new RPCFrameworkError(message, details);
563
+ case "MessageTypeNotSupported":
564
+ return new RPCMessageTypeNotSupportedError(message, details);
565
+ case "NotImplemented":
566
+ return new RPCNotImplementedError(message, details);
567
+ case "NotSupported":
568
+ return new RPCNotSupportedError(message, details);
569
+ case "InternalError":
570
+ return new RPCInternalError(message, details);
571
+ case "ProtocolError":
572
+ return new RPCProtocolError(message, details);
573
+ case "SecurityError":
574
+ return new RPCSecurityError(message, details);
575
+ case "FormatViolation":
576
+ return new RPCFormatViolationError(message, details);
577
+ case "FormationViolation":
578
+ return new RPCFormationViolationError(message, details);
579
+ case "PropertyConstraintViolation":
580
+ return new RPCPropertyConstraintViolationError(message, details);
581
+ case "OccurrenceConstraintViolation":
582
+ return new RPCOccurrenceConstraintViolationError(message, details);
583
+ case "TypeConstraintViolation":
584
+ return new RPCTypeConstraintViolationError(message, details);
585
+ default:
586
+ return new RPCGenericError(message, details);
587
+ }
575
588
  }
576
589
  var ERROR_PROPERTIES = [
577
590
  "name",
@@ -1275,6 +1288,7 @@ export {
1275
1288
  TimeoutError,
1276
1289
  combineAuth,
1277
1290
  createLoggingMiddleware,
1291
+ createPlugin,
1278
1292
  createRPCError,
1279
1293
  defineAuth,
1280
1294
  defineMiddleware,