@xyo-network/serialization
Advanced tools
Comparing version 0.41.0 to 0.42.0
@@ -9,3 +9,3 @@ /// <reference types="node" /> | ||
private readonly readableName; | ||
constructor(serializationService: IXyoSerializationService, parseResult: IParseResult, readableName: string); | ||
constructor(serializationService: IXyoSerializationService, parseResult: IParseResult, readableName: string, srcBuffer?: Buffer); | ||
readonly schemaObjectId: number; | ||
@@ -12,0 +12,0 @@ getReadableName(): string; |
@@ -16,4 +16,4 @@ "use strict"; | ||
class XyoTreeIterator extends base_serializable_1.XyoBaseSerializable { | ||
constructor(serializationService, parseResult, readableName) { | ||
super(serializationService.schema); | ||
constructor(serializationService, parseResult, readableName, srcBuffer) { | ||
super(serializationService.schema, srcBuffer); | ||
this.serializationService = serializationService; | ||
@@ -20,0 +20,0 @@ this.parseResult = parseResult; |
@@ -21,2 +21,3 @@ "use strict"; | ||
const on_the_fly_serializable_1 = require("./helpers/on-the-fly-serializable"); | ||
const xyo_filler_1 = require("./xyo-filler"); | ||
class XyoSerializationService extends base_1.XyoBase { | ||
@@ -49,3 +50,3 @@ constructor(schema) { | ||
const schemaKey = Object.keys(this.schema).find(key => this.schema[key].id === parseResult.id); | ||
return new tree_iterator_1.XyoTreeIterator(this, parseResult, schemaKey || 'unknown'); | ||
return new tree_iterator_1.XyoTreeIterator(this, parseResult, schemaKey || 'unknown', src); | ||
} | ||
@@ -62,4 +63,5 @@ parse(src) { | ||
const recipe = this.recipes[srcSchema.id]; | ||
// this happens when there is a type we do not know about | ||
if (!recipe) { | ||
throw new errors_1.XyoError(`No recipe exists for ${srcSchema.id}`); | ||
return new xyo_filler_1.XyoFiller(this.schema, src); | ||
} | ||
@@ -66,0 +68,0 @@ const deserializationResult = recipe.deserialize(src, this); |
{ | ||
"name": "@xyo-network/serialization", | ||
"version": "0.41.0", | ||
"version": "0.42.0", | ||
"description": "Serialization services in the xyo network", | ||
@@ -10,4 +10,4 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@xyo-network/base": "^0.41.0", | ||
"@xyo-network/errors": "^0.41.0", | ||
"@xyo-network/base": "^0.42.0", | ||
"@xyo-network/errors": "^0.42.0", | ||
"bn.js": "^4.11.8" | ||
@@ -25,3 +25,3 @@ }, | ||
}, | ||
"gitHead": "f703984b246ba86e88767d1719d92ab1ab2bf579" | ||
"gitHead": "b994e171d3c211f157500cd10cbab3d6cdebd60b" | ||
} |
@@ -21,5 +21,6 @@ /* | ||
private readonly parseResult: IParseResult, | ||
private readonly readableName: string | ||
private readonly readableName: string, | ||
srcBuffer?: Buffer | ||
) { | ||
super(serializationService.schema) | ||
super(serializationService.schema, srcBuffer) | ||
@@ -26,0 +27,0 @@ } |
@@ -23,2 +23,4 @@ /* | ||
import { XyoOnTheFlySerializable } from "./helpers/on-the-fly-serializable" | ||
import { read } from "fs" | ||
import { XyoFiller } from "./xyo-filler" | ||
@@ -39,2 +41,3 @@ export class XyoSerializationService extends XyoBase implements IXyoSerializationService { | ||
const result = serializable.serialize() | ||
const buf = result instanceof Buffer ? | ||
@@ -64,3 +67,3 @@ result : | ||
const schemaKey = Object.keys(this.schema).find(key => this.schema[key].id === parseResult.id) | ||
return new XyoTreeIterator(this, parseResult, schemaKey || 'unknown') | ||
return new XyoTreeIterator(this, parseResult, schemaKey || 'unknown', src) | ||
} | ||
@@ -80,4 +83,6 @@ | ||
const recipe = this.recipes[srcSchema.id] | ||
// this happens when there is a type we do not know about | ||
if (!recipe) { | ||
throw new XyoError(`No recipe exists for ${srcSchema.id}`) | ||
return (new XyoFiller(this.schema, src) as IXyoSerializableObject) as T | ||
} | ||
@@ -84,0 +89,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
142946
101
2816
+ Added@xyo-network/base@0.42.0(transitive)
+ Added@xyo-network/errors@0.42.0(transitive)
- Removed@xyo-network/base@0.41.0(transitive)
- Removed@xyo-network/errors@0.41.0(transitive)
Updated@xyo-network/base@^0.42.0
Updated@xyo-network/errors@^0.42.0