@xyo-network/serialization
Advanced tools
Comparing version 0.7.0 to 0.8.0
@@ -59,2 +59,4 @@ /// <reference types="node" /> | ||
serializeHex(): string; | ||
getReadableName(): string; | ||
getReadableValue(): any; | ||
} | ||
@@ -72,3 +74,2 @@ export interface IXyoDeserializer<T extends IXyoSerializableObject> { | ||
headerBytes: Buffer; | ||
toSerializable(): IXyoSerializableObject; | ||
} | ||
@@ -75,0 +76,0 @@ export interface IOnTheFlyGetDataOptions { |
@@ -8,3 +8,3 @@ "use strict"; | ||
* @Last modified by: ryanxyo | ||
* @Last modified time: Wednesday, 12th December 2018 12:17:05 pm | ||
* @Last modified time: Wednesday, 12th December 2018 1:23:31 pm | ||
* @License: All Rights Reserved | ||
@@ -11,0 +11,0 @@ * @Copyright: Copyright XY | The Findables Company |
@@ -9,2 +9,4 @@ /// <reference types="node" /> | ||
constructor(schema: IXyoObjectSchema); | ||
getReadableName(): string; | ||
abstract getReadableValue(): any; | ||
abstract getData(): Buffer | IXyoSerializableObject | IXyoSerializableObject[]; | ||
@@ -11,0 +13,0 @@ serialize(): Buffer; |
@@ -8,3 +8,3 @@ "use strict"; | ||
* @Last modified by: ryanxyo | ||
* @Last modified time: Wednesday, 12th December 2018 10:58:12 am | ||
* @Last modified time: Wednesday, 12th December 2018 1:36:28 pm | ||
* @License: All Rights Reserved | ||
@@ -25,2 +25,5 @@ * @Copyright: Copyright XY | The Findables Company | ||
} | ||
getReadableName() { | ||
return Object.keys(this.schema).find(k => this.schema[k].id === this.schemaObjectId) || String(this.schemaObjectId); | ||
} | ||
serialize() { | ||
@@ -27,0 +30,0 @@ if (this.srcBuffer) { |
@@ -7,5 +7,9 @@ /// <reference types="node" /> | ||
private readonly dataOptions; | ||
constructor(schema: IXyoObjectSchema, schemaObjectId: number, dataOptions: IOnTheFlyGetDataOptions); | ||
private readonly readableName; | ||
private readonly readableValue; | ||
constructor(schema: IXyoObjectSchema, schemaObjectId: number, dataOptions: IOnTheFlyGetDataOptions, readableName: string, readableValue: any); | ||
getReadableName(): string; | ||
getReadableValue(): void; | ||
getData(): Buffer | IXyoSerializableObject | IXyoSerializableObject[]; | ||
} | ||
//# sourceMappingURL=on-the-fly-serializable.d.ts.map |
@@ -9,3 +9,3 @@ "use strict"; | ||
* @Last modified by: ryanxyo | ||
* @Last modified time: Wednesday, 12th December 2018 10:59:24 am | ||
* @Last modified time: Wednesday, 12th December 2018 1:22:02 pm | ||
* @License: All Rights Reserved | ||
@@ -17,7 +17,15 @@ * @Copyright: Copyright XY | The Findables Company | ||
class XyoOnTheFlySerializable extends base_serializable_1.XyoBaseSerializable { | ||
constructor(schema, schemaObjectId, dataOptions) { | ||
constructor(schema, schemaObjectId, dataOptions, readableName, readableValue) { | ||
super(schema); | ||
this.schemaObjectId = schemaObjectId; | ||
this.dataOptions = dataOptions; | ||
this.readableName = readableName; | ||
this.readableValue = readableValue; | ||
} | ||
getReadableName() { | ||
throw this.readableName; | ||
} | ||
getReadableValue() { | ||
throw this.readableValue; | ||
} | ||
getData() { | ||
@@ -24,0 +32,0 @@ // tslint:disable-next-line:no-unused-expression |
/// <reference types="node" /> | ||
import { IParseResult, IXyoSerializableObject } from "../@types"; | ||
import { IParseResult } from "../@types"; | ||
export declare class ParseQuery { | ||
@@ -13,4 +13,3 @@ private readonly parseResult; | ||
isReadable(): boolean; | ||
toSerializable(): IXyoSerializableObject; | ||
} | ||
//# sourceMappingURL=parse-query.d.ts.map |
@@ -8,3 +8,3 @@ "use strict"; | ||
* @Last modified by: ryanxyo | ||
* @Last modified time: Friday, 7th December 2018 4:27:29 pm | ||
* @Last modified time: Wednesday, 12th December 2018 1:23:27 pm | ||
* @License: All Rights Reserved | ||
@@ -73,7 +73,4 @@ * @Copyright: Copyright XY | The Findables Company | ||
} | ||
toSerializable() { | ||
return this.parseResult.toSerializable(); | ||
} | ||
} | ||
exports.ParseQuery = ParseQuery; | ||
//# sourceMappingURL=parse-query.js.map |
@@ -8,3 +8,3 @@ "use strict"; | ||
* @Last modified by: ryanxyo | ||
* @Last modified time: Wednesday, 12th December 2018 11:00:53 am | ||
* @Last modified time: Wednesday, 12th December 2018 1:23:50 pm | ||
* @License: All Rights Reserved | ||
@@ -16,3 +16,2 @@ * @Copyright: Copyright XY | The Findables Company | ||
const sliceItem_1 = require("./sliceItem"); | ||
const on_the_fly_serializable_1 = require("./on-the-fly-serializable"); | ||
function parse(src, schema) { | ||
@@ -29,8 +28,3 @@ const partialSchema = readHeader_1.readHeader(src); | ||
dataBytes: data, | ||
iterableType: 'not-iterable', | ||
toSerializable: () => { | ||
return new on_the_fly_serializable_1.XyoOnTheFlySerializable(schema, partialSchema.id, { | ||
buffer: data | ||
}); | ||
} | ||
iterableType: 'not-iterable' | ||
}; | ||
@@ -45,8 +39,3 @@ } | ||
iterableType: 'not-iterable', | ||
dataBytes: data, | ||
toSerializable: () => { | ||
return new on_the_fly_serializable_1.XyoOnTheFlySerializable(schema, partialSchema.id, { | ||
buffer: data | ||
}); | ||
} | ||
dataBytes: data | ||
}; | ||
@@ -83,8 +72,3 @@ } | ||
dataBytes: bytes, | ||
headerBytes: Buffer.concat([innerHeaderBytes, sizeBytes]), | ||
toSerializable: () => { | ||
return new on_the_fly_serializable_1.XyoOnTheFlySerializable(schema, innerHeader.id, { | ||
buffer: bytes | ||
}); | ||
} | ||
headerBytes: Buffer.concat([innerHeaderBytes, sizeBytes]) | ||
}); | ||
@@ -99,8 +83,3 @@ } | ||
iterableType: partialSchema.iterableType, | ||
dataBytes: data, | ||
toSerializable: () => { | ||
return new on_the_fly_serializable_1.XyoOnTheFlySerializable(schema, partialSchema.id, { | ||
buffer: data | ||
}); | ||
} | ||
dataBytes: data | ||
}; | ||
@@ -107,0 +86,0 @@ } |
@@ -8,4 +8,7 @@ /// <reference types="node" /> | ||
private readonly parseResult; | ||
constructor(serializationService: IXyoSerializationService, parseResult: IParseResult); | ||
private readonly readableName; | ||
constructor(serializationService: IXyoSerializationService, parseResult: IParseResult, readableName: string); | ||
readonly schemaObjectId: number; | ||
getReadableName(): string; | ||
getReadableValue(): string; | ||
getData(): Buffer; | ||
@@ -12,0 +15,0 @@ query(): ParseQuery; |
@@ -8,3 +8,3 @@ "use strict"; | ||
* @Last modified by: ryanxyo | ||
* @Last modified time: Wednesday, 12th December 2018 12:11:30 pm | ||
* @Last modified time: Wednesday, 12th December 2018 1:28:00 pm | ||
* @License: All Rights Reserved | ||
@@ -17,6 +17,7 @@ * @Copyright: Copyright XY | The Findables Company | ||
class XyoTreeIterator extends base_serializable_1.XyoBaseSerializable { | ||
constructor(serializationService, parseResult) { | ||
constructor(serializationService, parseResult, readableName) { | ||
super(serializationService.schema); | ||
this.serializationService = serializationService; | ||
this.parseResult = parseResult; | ||
this.readableName = readableName; | ||
} | ||
@@ -26,2 +27,8 @@ get schemaObjectId() { | ||
} | ||
getReadableName() { | ||
return this.readableName; | ||
} | ||
getReadableValue() { | ||
return Buffer.concat([this.parseResult.headerBytes, this.parseResult.dataBytes]).toString('hex'); | ||
} | ||
getData() { | ||
@@ -28,0 +35,0 @@ return this.parseResult.dataBytes; |
@@ -8,3 +8,3 @@ "use strict"; | ||
* @Last modified by: ryanxyo | ||
* @Last modified time: Wednesday, 12th December 2018 12:16:41 pm | ||
* @Last modified time: Wednesday, 12th December 2018 1:32:39 pm | ||
* @License: All Rights Reserved | ||
@@ -49,3 +49,4 @@ * @Copyright: Copyright XY | The Findables Company | ||
const parseResult = this.parse(src); | ||
return new tree_iterator_1.XyoTreeIterator(this, parseResult); | ||
const schemaKey = Object.keys(this.schema).find(key => this.schema[key].id === parseResult.id); | ||
return new tree_iterator_1.XyoTreeIterator(this, parseResult, schemaKey || 'unknown'); | ||
} | ||
@@ -88,3 +89,3 @@ parse(src) { | ||
} | ||
return new on_the_fly_serializable_1.XyoOnTheFlySerializable(this.schema, this.schema.typedSet.id, options); | ||
return new on_the_fly_serializable_1.XyoOnTheFlySerializable(this.schema, this.schema.typedSet.id, options, 'typedSet', tCollection); | ||
} | ||
@@ -99,3 +100,3 @@ untypedArrayOf(tCollection) { | ||
} | ||
return new on_the_fly_serializable_1.XyoOnTheFlySerializable(this.schema, this.schema.untypedSet.id, options); | ||
return new on_the_fly_serializable_1.XyoOnTheFlySerializable(this.schema, this.schema.untypedSet.id, options, 'untypedSet', tCollection); | ||
} | ||
@@ -102,0 +103,0 @@ findFirstElement(collection, schemaObjectId) { |
{ | ||
"name": "@xyo-network/serialization", | ||
"version": "0.7.0", | ||
"version": "0.8.0", | ||
"description": "Serialization services in the xyo network", | ||
@@ -10,4 +10,4 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@xyo-network/base": "^0.7.0", | ||
"@xyo-network/errors": "^0.7.0", | ||
"@xyo-network/base": "^0.8.0", | ||
"@xyo-network/errors": "^0.8.0", | ||
"bn.js": "^4.11.8" | ||
@@ -25,3 +25,3 @@ }, | ||
}, | ||
"gitHead": "95077b5c60fd3a2fe5252422f38346c47739271a" | ||
"gitHead": "7367c87d96afe3ecec362c40290e4e719b5415df" | ||
} |
@@ -7,3 +7,3 @@ /* | ||
* @Last modified by: ryanxyo | ||
* @Last modified time: Wednesday, 12th December 2018 12:17:05 pm | ||
* @Last modified time: Wednesday, 12th December 2018 1:23:31 pm | ||
* @License: All Rights Reserved | ||
@@ -89,2 +89,4 @@ * @Copyright: Copyright XY | The Findables Company | ||
serializeHex(): string | ||
getReadableName(): string | ||
getReadableValue(): any | ||
} | ||
@@ -104,3 +106,2 @@ | ||
headerBytes: Buffer | ||
toSerializable(): IXyoSerializableObject | ||
} | ||
@@ -107,0 +108,0 @@ |
@@ -7,3 +7,3 @@ /* | ||
* @Last modified by: ryanxyo | ||
* @Last modified time: Wednesday, 12th December 2018 10:58:12 am | ||
* @Last modified time: Wednesday, 12th December 2018 1:36:28 pm | ||
* @License: All Rights Reserved | ||
@@ -23,3 +23,2 @@ * @Copyright: Copyright XY | The Findables Company | ||
public abstract schemaObjectId: number | ||
public srcBuffer: Buffer | null = null | ||
@@ -31,2 +30,8 @@ | ||
public getReadableName(): string { | ||
return Object.keys(this.schema).find(k => this.schema[k].id === this.schemaObjectId) || String(this.schemaObjectId) | ||
} | ||
public abstract getReadableValue(): any | ||
// tslint:disable-next-line:max-line-length | ||
@@ -33,0 +38,0 @@ public abstract getData(): Buffer | IXyoSerializableObject | IXyoSerializableObject[] |
@@ -7,3 +7,3 @@ /* | ||
* @Last modified by: ryanxyo | ||
* @Last modified time: Wednesday, 12th December 2018 10:59:24 am | ||
* @Last modified time: Wednesday, 12th December 2018 1:22:02 pm | ||
* @License: All Rights Reserved | ||
@@ -21,3 +21,5 @@ * @Copyright: Copyright XY | The Findables Company | ||
public readonly schemaObjectId: number, | ||
private readonly dataOptions: IOnTheFlyGetDataOptions | ||
private readonly dataOptions: IOnTheFlyGetDataOptions, | ||
private readonly readableName: string, | ||
private readonly readableValue: any | ||
) { | ||
@@ -27,2 +29,9 @@ super(schema) | ||
public getReadableName(): string { | ||
throw this.readableName | ||
} | ||
public getReadableValue() { | ||
throw this.readableValue | ||
} | ||
public getData(): Buffer | IXyoSerializableObject | IXyoSerializableObject[] { | ||
@@ -29,0 +38,0 @@ // tslint:disable-next-line:no-unused-expression |
@@ -7,3 +7,3 @@ /* | ||
* @Last modified by: ryanxyo | ||
* @Last modified time: Friday, 7th December 2018 4:27:29 pm | ||
* @Last modified time: Wednesday, 12th December 2018 1:23:27 pm | ||
* @License: All Rights Reserved | ||
@@ -90,6 +90,2 @@ * @Copyright: Copyright XY | The Findables Company | ||
} | ||
public toSerializable(): IXyoSerializableObject { | ||
return this.parseResult.toSerializable() | ||
} | ||
} |
@@ -7,3 +7,3 @@ /* | ||
* @Last modified by: ryanxyo | ||
* @Last modified time: Wednesday, 12th December 2018 11:00:53 am | ||
* @Last modified time: Wednesday, 12th December 2018 1:23:50 pm | ||
* @License: All Rights Reserved | ||
@@ -29,8 +29,3 @@ * @Copyright: Copyright XY | The Findables Company | ||
dataBytes: data, | ||
iterableType: 'not-iterable', | ||
toSerializable: () => { | ||
return new XyoOnTheFlySerializable(schema, partialSchema.id, { | ||
buffer: data | ||
}) | ||
} | ||
iterableType: 'not-iterable' | ||
} | ||
@@ -46,8 +41,3 @@ } | ||
iterableType: 'not-iterable', | ||
dataBytes: data, | ||
toSerializable: () => { | ||
return new XyoOnTheFlySerializable(schema, partialSchema.id, { | ||
buffer: data | ||
}) | ||
} | ||
dataBytes: data | ||
} | ||
@@ -88,8 +78,3 @@ } | ||
dataBytes: bytes, | ||
headerBytes: Buffer.concat([innerHeaderBytes, sizeBytes]), | ||
toSerializable: () => { | ||
return new XyoOnTheFlySerializable(schema, innerHeader.id, { | ||
buffer: bytes | ||
}) | ||
} | ||
headerBytes: Buffer.concat([innerHeaderBytes, sizeBytes]) | ||
}) | ||
@@ -106,9 +91,4 @@ } | ||
iterableType: partialSchema.iterableType!, | ||
dataBytes: data, | ||
toSerializable: () => { | ||
return new XyoOnTheFlySerializable(schema, partialSchema.id, { | ||
buffer: data | ||
}) | ||
} | ||
dataBytes: data | ||
} | ||
} |
@@ -7,3 +7,3 @@ /* | ||
* @Last modified by: ryanxyo | ||
* @Last modified time: Wednesday, 12th December 2018 12:11:30 pm | ||
* @Last modified time: Wednesday, 12th December 2018 1:28:00 pm | ||
* @License: All Rights Reserved | ||
@@ -21,3 +21,4 @@ * @Copyright: Copyright XY | The Findables Company | ||
private readonly serializationService: IXyoSerializationService, | ||
private readonly parseResult: IParseResult | ||
private readonly parseResult: IParseResult, | ||
private readonly readableName: string | ||
) { | ||
@@ -31,2 +32,10 @@ super(serializationService.schema) | ||
public getReadableName(): string { | ||
return this.readableName | ||
} | ||
public getReadableValue() { | ||
return Buffer.concat([this.parseResult.headerBytes, this.parseResult.dataBytes]).toString('hex') | ||
} | ||
public getData(): Buffer { | ||
@@ -33,0 +42,0 @@ return this.parseResult.dataBytes |
@@ -7,3 +7,3 @@ /* | ||
* @Last modified by: ryanxyo | ||
* @Last modified time: Wednesday, 12th December 2018 11:14:43 am | ||
* @Last modified time: Wednesday, 12th December 2018 1:58:10 pm | ||
* @License: All Rights Reserved | ||
@@ -275,2 +275,6 @@ * @Copyright: Copyright XY | The Findables Company | ||
} | ||
public getReadableValue () { | ||
return this.value | ||
} | ||
} | ||
@@ -289,2 +293,6 @@ | ||
} | ||
public getReadableValue () { | ||
return this.value | ||
} | ||
} | ||
@@ -301,2 +309,6 @@ | ||
} | ||
public getReadableValue () { | ||
return this.collection.map(i => i.getReadableValue()) | ||
} | ||
} | ||
@@ -313,2 +325,6 @@ | ||
} | ||
public getReadableValue () { | ||
return this.collection.map(i => i.getReadableValue()) | ||
} | ||
} |
@@ -7,3 +7,3 @@ /* | ||
* @Last modified by: ryanxyo | ||
* @Last modified time: Wednesday, 12th December 2018 12:16:41 pm | ||
* @Last modified time: Wednesday, 12th December 2018 1:32:39 pm | ||
* @License: All Rights Reserved | ||
@@ -62,3 +62,4 @@ * @Copyright: Copyright XY | The Findables Company | ||
const parseResult = this.parse(src) | ||
return new XyoTreeIterator(this, parseResult) | ||
const schemaKey = Object.keys(this.schema).find(key => this.schema[key].id === parseResult.id) | ||
return new XyoTreeIterator(this, parseResult, schemaKey || 'unknown') | ||
} | ||
@@ -108,3 +109,3 @@ | ||
} | ||
return new XyoOnTheFlySerializable(this.schema, this.schema.typedSet.id, options) | ||
return new XyoOnTheFlySerializable(this.schema, this.schema.typedSet.id, options, 'typedSet', tCollection) | ||
} | ||
@@ -119,3 +120,3 @@ | ||
} | ||
return new XyoOnTheFlySerializable(this.schema, this.schema.untypedSet.id, options) | ||
return new XyoOnTheFlySerializable(this.schema, this.schema.untypedSet.id, options, 'untypedSet', tCollection) | ||
} | ||
@@ -122,0 +123,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
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
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
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
138568
2709
+ Added@xyo-network/base@0.8.0(transitive)
+ Added@xyo-network/errors@0.8.0(transitive)
+ Added@xyo-network/logger@0.8.0(transitive)
- Removed@xyo-network/base@0.7.0(transitive)
- Removed@xyo-network/errors@0.7.0(transitive)
- Removed@xyo-network/logger@0.7.0(transitive)
Updated@xyo-network/base@^0.8.0
Updated@xyo-network/errors@^0.8.0