@stryke/json 0.5.5 → 0.5.6

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.
@@ -31,7 +31,8 @@ class StormJSON extends _superjson.default {
31
31
  return s && (t = s.serialize(t)), this.stringifyBase(t);
32
32
  }
33
33
  static stringifyBase(e) {
34
- return StormJSON.instance.stringify(e);
34
+ const r = StormJSON.instance.stringify(e);
35
+ return r.substring(r.indexOf('{"json":'), r.lastIndexOf("}"));
35
36
  }
36
37
  static parseJson(e, r) {
37
38
  try {
@@ -1 +1 @@
1
- import{isObject as o}from"@stryke/type-checks/is-object";import{isString as l}from"@stryke/type-checks/is-string";import{Buffer as a}from"buffer/";import{parse as c}from"jsonc-parser";import u from"superjson";import{formatParseError as p}from"./utils/parse-error";export class StormJSON extends u{static#e;static get instance(){return StormJSON.#e||(StormJSON.#e=new StormJSON),StormJSON.#e}static deserialize(e){return StormJSON.instance.deserialize(e)}static serialize(e){return StormJSON.instance.serialize(e)}static parse(e){return StormJSON.instance.parse(e)}static stringify(e,r){const s=StormJSON.instance.customTransformerRegistry.findApplicable(e);let t=e;return s&&(t=s.serialize(t)),this.stringifyBase(t)}static stringifyBase(e){return StormJSON.instance.stringify(e)}static parseJson(e,r){try{if(r?.expectComments===!1)return StormJSON.instance.parse(e)}catch{}const s=[],t={allowTrailingComma:!0,...r},n=c(e,s,t);if(s.length>0&&s[0])throw new Error(p(e,s[0]));return n}static register(e,r,s,t){StormJSON.instance.registerCustom({isApplicable:t,serialize:r,deserialize:s},e)}static registerClass(e,r){StormJSON.instance.registerClass(e,{identifier:l(r)?r:r?.identifier||e.name,allowProps:r&&o(r)&&r?.allowProps&&Array.isArray(r.allowProps)?r.allowProps:["__typename"]})}constructor(){super({dedupe:!0})}}StormJSON.instance.registerCustom({isApplicable:i=>a.isBuffer(i),serialize:i=>i.toString("base64"),deserialize:i=>a.from(i,"base64")},"Bytes");
1
+ import{isObject as o}from"@stryke/type-checks/is-object";import{isString as l}from"@stryke/type-checks/is-string";import{Buffer as a}from"buffer/";import{parse as c}from"jsonc-parser";import u from"superjson";import{formatParseError as p}from"./utils/parse-error";export class StormJSON extends u{static#e;static get instance(){return StormJSON.#e||(StormJSON.#e=new StormJSON),StormJSON.#e}static deserialize(e){return StormJSON.instance.deserialize(e)}static serialize(e){return StormJSON.instance.serialize(e)}static parse(e){return StormJSON.instance.parse(e)}static stringify(e,r){const s=StormJSON.instance.customTransformerRegistry.findApplicable(e);let t=e;return s&&(t=s.serialize(t)),this.stringifyBase(t)}static stringifyBase(e){const r=StormJSON.instance.stringify(e);return r.substring(r.indexOf('{"json":'),r.lastIndexOf("}"))}static parseJson(e,r){try{if(r?.expectComments===!1)return StormJSON.instance.parse(e)}catch{}const s=[],t={allowTrailingComma:!0,...r},n=c(e,s,t);if(s.length>0&&s[0])throw new Error(p(e,s[0]));return n}static register(e,r,s,t){StormJSON.instance.registerCustom({isApplicable:t,serialize:r,deserialize:s},e)}static registerClass(e,r){StormJSON.instance.registerClass(e,{identifier:l(r)?r:r?.identifier||e.name,allowProps:r&&o(r)&&r?.allowProps&&Array.isArray(r.allowProps)?r.allowProps:["__typename"]})}constructor(){super({dedupe:!0})}}StormJSON.instance.registerCustom({isApplicable:i=>a.isBuffer(i),serialize:i=>i.toString("base64"),deserialize:i=>a.from(i,"base64")},"Bytes");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stryke/json",
3
- "version": "0.5.5",
3
+ "version": "0.5.6",
4
4
  "type": "module",
5
5
  "description": "A package containing JSON parsing/stringify utilities used by Storm Software.",
6
6
  "repository": {