@metamask-previews/json-rpc-engine 10.1.1-preview-c96ff8f → 10.1.1-preview-6b15e01

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 (45) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/README.md +0 -27
  3. package/dist/v2/JsonRpcEngineV2.cjs +2 -5
  4. package/dist/v2/JsonRpcEngineV2.cjs.map +1 -1
  5. package/dist/v2/JsonRpcEngineV2.d.cts +4 -7
  6. package/dist/v2/JsonRpcEngineV2.d.cts.map +1 -1
  7. package/dist/v2/JsonRpcEngineV2.d.mts +4 -7
  8. package/dist/v2/JsonRpcEngineV2.d.mts.map +1 -1
  9. package/dist/v2/JsonRpcEngineV2.mjs +2 -5
  10. package/dist/v2/JsonRpcEngineV2.mjs.map +1 -1
  11. package/dist/v2/JsonRpcServer.cjs +6 -5
  12. package/dist/v2/JsonRpcServer.cjs.map +1 -1
  13. package/dist/v2/JsonRpcServer.d.cts +4 -10
  14. package/dist/v2/JsonRpcServer.d.cts.map +1 -1
  15. package/dist/v2/JsonRpcServer.d.mts +4 -10
  16. package/dist/v2/JsonRpcServer.d.mts.map +1 -1
  17. package/dist/v2/JsonRpcServer.mjs +6 -5
  18. package/dist/v2/JsonRpcServer.mjs.map +1 -1
  19. package/dist/v2/MiddlewareContext.cjs +1 -42
  20. package/dist/v2/MiddlewareContext.cjs.map +1 -1
  21. package/dist/v2/MiddlewareContext.d.cts +2 -12
  22. package/dist/v2/MiddlewareContext.d.cts.map +1 -1
  23. package/dist/v2/MiddlewareContext.d.mts +2 -12
  24. package/dist/v2/MiddlewareContext.d.mts.map +1 -1
  25. package/dist/v2/MiddlewareContext.mjs +1 -42
  26. package/dist/v2/MiddlewareContext.mjs.map +1 -1
  27. package/dist/v2/createScaffoldMiddleware.cjs.map +1 -1
  28. package/dist/v2/createScaffoldMiddleware.d.cts +3 -12
  29. package/dist/v2/createScaffoldMiddleware.d.cts.map +1 -1
  30. package/dist/v2/createScaffoldMiddleware.d.mts +3 -12
  31. package/dist/v2/createScaffoldMiddleware.d.mts.map +1 -1
  32. package/dist/v2/createScaffoldMiddleware.mjs.map +1 -1
  33. package/dist/v2/index.cjs.map +1 -1
  34. package/dist/v2/index.d.cts +1 -1
  35. package/dist/v2/index.d.cts.map +1 -1
  36. package/dist/v2/index.d.mts +1 -1
  37. package/dist/v2/index.d.mts.map +1 -1
  38. package/dist/v2/index.mjs.map +1 -1
  39. package/dist/v2/utils.cjs +2 -2
  40. package/dist/v2/utils.cjs.map +1 -1
  41. package/dist/v2/utils.d.cts.map +1 -1
  42. package/dist/v2/utils.d.mts.map +1 -1
  43. package/dist/v2/utils.mjs +2 -2
  44. package/dist/v2/utils.mjs.map +1 -1
  45. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.mts","sourceRoot":"","sources":["../../src/v2/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,KAAK,cAAc,EACpB,wBAAwB;AAEzB,YAAY,EACV,IAAI,EACJ,aAAa,EACb,cAAc,EACd,mBAAmB,GACpB,wBAAwB;AAEzB,MAAM,MAAM,WAAW,CAAC,MAAM,SAAS,aAAa,GAAG,aAAa,IAChE,mBAAmB,CAAC,MAAM,CAAC,GAC3B,cAAc,CAAC,MAAM,CAAC,CAAC;AAE3B,eAAO,MAAM,SAAS,2HAEoC,CAAC;AAE3D,eAAO,MAAM,cAAc,gGAE6B,CAAC;AAEzD;;;;;;;GAOG;AACH,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,CACnC,CAAC,SAAS,KAAK,GAAG,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,CACzC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,IAAI,GAC1B,CAAC,GACD,KAAK,CAAC;AAEV;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG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AMG;IACH,MAAM,CAAC,UAAU,CAAC,KAAK,SAAS,KAAK,EACnC,KAAK,EAAE,KAAK,GACX,KAAK,IAAI,KAAK,GAAG,kBAAkB;CAMvC"}
package/dist/v2/utils.mjs CHANGED
@@ -11,7 +11,7 @@ export const isNotification = (msg) => !isRequest(msg);
11
11
  export function stringify(value) {
12
12
  return JSON.stringify(value, null, 2);
13
13
  }
14
- const JsonRpcEngineErrorSymbol = Symbol.for('json-rpc-engine#JsonRpcEngineError');
14
+ const JsonRpcEngineErrorSymbol = Symbol.for('JsonRpcEngineError');
15
15
  export class JsonRpcEngineError extends Error {
16
16
  constructor(message) {
17
17
  super(message);
@@ -26,7 +26,7 @@ export class JsonRpcEngineError extends Error {
26
26
  * @returns Whether the value is a {@link JsonRpcEngineError} instance.
27
27
  */
28
28
  static isInstance(value) {
29
- return (JsonRpcEngineErrorSymbol in value &&
29
+ return (hasProperty(value, JsonRpcEngineErrorSymbol) &&
30
30
  value[JsonRpcEngineErrorSymbol] === true);
31
31
  }
32
32
  }
@@ -1 +1 @@
1
- {"version":3,"file":"utils.mjs","sourceRoot":"","sources":["../../src/v2/utils.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,WAAW,EAIZ,wBAAwB;AAazB,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,GAAwD,EACzB,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AAE3D,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,GAAwB,EACY,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;AAgBzD;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,KAAc;IACtC,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,wBAAwB,GAAG,MAAM,CAAC,GAAG,CACzC,oCAAoC,CACrC,CAAC;AAEF,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAG3C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QAHA,QAA0B,GAAG,IAAI,CAAC;QAIjD,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,UAAU,CACf,KAAY;QAEZ,OAAO,CACL,wBAAwB,IAAI,KAAK;YACjC,KAAK,CAAC,wBAAwB,CAAC,KAAK,IAAI,CACzC,CAAC;IACJ,CAAC;CACF;KAtBmB,wBAAwB","sourcesContent":["import {\n hasProperty,\n type JsonRpcNotification,\n type JsonRpcParams,\n type JsonRpcRequest,\n} from '@metamask/utils';\n\nexport type {\n Json,\n JsonRpcParams,\n JsonRpcRequest,\n JsonRpcNotification,\n} from '@metamask/utils';\n\nexport type JsonRpcCall<Params extends JsonRpcParams = JsonRpcParams> =\n | JsonRpcNotification<Params>\n | JsonRpcRequest<Params>;\n\nexport const isRequest = <Params extends JsonRpcParams>(\n msg: JsonRpcCall<Params> | Readonly<JsonRpcCall<Params>>,\n): msg is JsonRpcRequest<Params> => hasProperty(msg, 'id');\n\nexport const isNotification = <Params extends JsonRpcParams>(\n msg: JsonRpcCall<Params>,\n): msg is JsonRpcNotification<Params> => !isRequest(msg);\n\n/**\n * An unholy incantation that converts a union of object types into an\n * intersection of object types.\n *\n * @example\n * type A = { a: string } | { b: number };\n * type B = UnionToIntersection<A>; // { a: string } & { b: number }\n */\nexport type UnionToIntersection<U> = (\n U extends never ? never : (k: U) => void\n) extends (k: infer I) => void\n ? I\n : never;\n\n/**\n * JSON-stringifies a value.\n *\n * @param value - The value to stringify.\n * @returns The stringified value.\n */\nexport function stringify(value: unknown): string {\n return JSON.stringify(value, null, 2);\n}\n\nconst JsonRpcEngineErrorSymbol = Symbol.for(\n 'json-rpc-engine#JsonRpcEngineError',\n);\n\nexport class JsonRpcEngineError extends Error {\n private readonly [JsonRpcEngineErrorSymbol] = true;\n\n constructor(message: string) {\n super(message);\n this.name = 'JsonRpcEngineError';\n }\n\n /**\n * Check if a value is a {@link JsonRpcEngineError} instance.\n * Works across different package versions in the same realm.\n *\n * @param value - The value to check.\n * @returns Whether the value is a {@link JsonRpcEngineError} instance.\n */\n static isInstance<Value extends Error>(\n value: Value,\n ): value is Value & JsonRpcEngineError {\n return (\n JsonRpcEngineErrorSymbol in value &&\n value[JsonRpcEngineErrorSymbol] === true\n );\n }\n}\n"]}
1
+ {"version":3,"file":"utils.mjs","sourceRoot":"","sources":["../../src/v2/utils.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,WAAW,EAIZ,wBAAwB;AAazB,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,GAAwD,EACzB,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AAE3D,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,GAAwB,EACY,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;AAgBzD;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,KAAc;IACtC,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,wBAAwB,GAAG,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;AAElE,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAG3C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QAHA,QAA0B,GAAG,IAAI,CAAC;QAIjD,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,UAAU,CACf,KAAY;QAEZ,OAAO,CACL,WAAW,CAAC,KAAK,EAAE,wBAAwB,CAAC;YAC5C,KAAK,CAAC,wBAAwB,CAAC,KAAK,IAAI,CACzC,CAAC;IACJ,CAAC;CACF;KAtBmB,wBAAwB","sourcesContent":["import {\n hasProperty,\n type JsonRpcNotification,\n type JsonRpcParams,\n type JsonRpcRequest,\n} from '@metamask/utils';\n\nexport type {\n Json,\n JsonRpcParams,\n JsonRpcRequest,\n JsonRpcNotification,\n} from '@metamask/utils';\n\nexport type JsonRpcCall<Params extends JsonRpcParams = JsonRpcParams> =\n | JsonRpcNotification<Params>\n | JsonRpcRequest<Params>;\n\nexport const isRequest = <Params extends JsonRpcParams>(\n msg: JsonRpcCall<Params> | Readonly<JsonRpcCall<Params>>,\n): msg is JsonRpcRequest<Params> => hasProperty(msg, 'id');\n\nexport const isNotification = <Params extends JsonRpcParams>(\n msg: JsonRpcCall<Params>,\n): msg is JsonRpcNotification<Params> => !isRequest(msg);\n\n/**\n * An unholy incantation that converts a union of object types into an\n * intersection of object types.\n *\n * @example\n * type A = { a: string } | { b: number };\n * type B = UnionToIntersection<A>; // { a: string } & { b: number }\n */\nexport type UnionToIntersection<U> = (\n U extends never ? never : (k: U) => void\n) extends (k: infer I) => void\n ? I\n : never;\n\n/**\n * JSON-stringifies a value.\n *\n * @param value - The value to stringify.\n * @returns The stringified value.\n */\nexport function stringify(value: unknown): string {\n return JSON.stringify(value, null, 2);\n}\n\nconst JsonRpcEngineErrorSymbol = Symbol.for('JsonRpcEngineError');\n\nexport class JsonRpcEngineError extends Error {\n private readonly [JsonRpcEngineErrorSymbol] = true;\n\n constructor(message: string) {\n super(message);\n this.name = 'JsonRpcEngineError';\n }\n\n /**\n * Check if a value is a {@link JsonRpcEngineError} instance.\n * Works across different package versions in the same realm.\n *\n * @param value - The value to check.\n * @returns Whether the value is a {@link JsonRpcEngineError} instance.\n */\n static isInstance<Value extends Error>(\n value: Value,\n ): value is Value & JsonRpcEngineError {\n return (\n hasProperty(value, JsonRpcEngineErrorSymbol) &&\n value[JsonRpcEngineErrorSymbol] === true\n );\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/json-rpc-engine",
3
- "version": "10.1.1-preview-c96ff8f",
3
+ "version": "10.1.1-preview-6b15e01",
4
4
  "description": "A tool for processing JSON-RPC messages",
5
5
  "keywords": [
6
6
  "MetaMask",