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.js CHANGED
@@ -41,6 +41,7 @@ __export(browser_exports, {
41
41
  TimeoutError: () => TimeoutError,
42
42
  combineAuth: () => combineAuth,
43
43
  createLoggingMiddleware: () => createLoggingMiddleware,
44
+ createPlugin: () => createPlugin,
44
45
  createRPCError: () => createRPCError,
45
46
  defineAuth: () => defineAuth,
46
47
  defineMiddleware: () => defineMiddleware,
@@ -53,6 +54,9 @@ module.exports = __toCommonJS(browser_exports);
53
54
  function defineMiddleware(mw) {
54
55
  return mw;
55
56
  }
57
+ function createPlugin(plugin) {
58
+ return plugin;
59
+ }
56
60
  function defineRpcMiddleware(mw) {
57
61
  return mw;
58
62
  }
@@ -598,27 +602,37 @@ var NOOP_LOGGER = {
598
602
  };
599
603
 
600
604
  // src/browser/util.ts
601
- var RPC_ERROR_REGISTRY = /* @__PURE__ */ new Map([
602
- ["GenericError", RPCGenericError],
603
- ["RpcFrameworkError", RPCFrameworkError],
604
- ["MessageTypeNotSupported", RPCMessageTypeNotSupportedError],
605
- ["NotImplemented", RPCNotImplementedError],
606
- ["NotSupported", RPCNotSupportedError],
607
- ["InternalError", RPCInternalError],
608
- ["ProtocolError", RPCProtocolError],
609
- ["SecurityError", RPCSecurityError],
610
- ["FormatViolation", RPCFormatViolationError],
611
- ["FormationViolation", RPCFormationViolationError],
612
- ["PropertyConstraintViolation", RPCPropertyConstraintViolationError],
613
- [
614
- "OccurrenceConstraintViolation",
615
- RPCOccurrenceConstraintViolationError
616
- ],
617
- ["TypeConstraintViolation", RPCTypeConstraintViolationError]
618
- ]);
619
605
  function createRPCError(code, message, details = {}) {
620
- const Ctor = RPC_ERROR_REGISTRY.get(code) ?? RPCGenericError;
621
- return new Ctor(message, details);
606
+ switch (code) {
607
+ case "GenericError":
608
+ return new RPCGenericError(message, details);
609
+ case "RpcFrameworkError":
610
+ return new RPCFrameworkError(message, details);
611
+ case "MessageTypeNotSupported":
612
+ return new RPCMessageTypeNotSupportedError(message, details);
613
+ case "NotImplemented":
614
+ return new RPCNotImplementedError(message, details);
615
+ case "NotSupported":
616
+ return new RPCNotSupportedError(message, details);
617
+ case "InternalError":
618
+ return new RPCInternalError(message, details);
619
+ case "ProtocolError":
620
+ return new RPCProtocolError(message, details);
621
+ case "SecurityError":
622
+ return new RPCSecurityError(message, details);
623
+ case "FormatViolation":
624
+ return new RPCFormatViolationError(message, details);
625
+ case "FormationViolation":
626
+ return new RPCFormationViolationError(message, details);
627
+ case "PropertyConstraintViolation":
628
+ return new RPCPropertyConstraintViolationError(message, details);
629
+ case "OccurrenceConstraintViolation":
630
+ return new RPCOccurrenceConstraintViolationError(message, details);
631
+ case "TypeConstraintViolation":
632
+ return new RPCTypeConstraintViolationError(message, details);
633
+ default:
634
+ return new RPCGenericError(message, details);
635
+ }
622
636
  }
623
637
  var ERROR_PROPERTIES = [
624
638
  "name",