@xyo-network/serialization
Advanced tools
Comparing version 0.55.2-alpha.0 to 0.55.6-alpha.0
/// <reference types="node" /> | ||
import { XyoTreeIterator } from "../helpers/tree-iterator"; | ||
import { XyoTreeIterator } from '../helpers/tree-iterator'; | ||
export interface IXyoObjectPartialSchema { | ||
@@ -4,0 +4,0 @@ /** |
@@ -7,3 +7,3 @@ "use strict"; | ||
* @Filename: index.ts | ||
* @Last modified time: Friday, 14th December 2018 12:09:06 pm | ||
@@ -10,0 +10,0 @@ * @License: All Rights Reserved |
/// <reference types="node" /> | ||
import { IXyoSerializableObject, IXyoObjectSchema, IXyoObjectPartialSchema } from "../@types"; | ||
import { XyoBase } from "@xyo-network/base"; | ||
import { IXyoSerializableObject, IXyoObjectSchema, IXyoObjectPartialSchema } from '../@types'; | ||
import { XyoBase } from '@xyo-network/base'; | ||
export declare abstract class XyoBaseSerializable extends XyoBase implements IXyoSerializableObject { | ||
@@ -5,0 +5,0 @@ private readonly schema; |
@@ -7,3 +7,3 @@ "use strict"; | ||
* @Filename: base-serializable.ts | ||
* @Last modified time: Friday, 14th December 2018 12:09:57 pm | ||
@@ -10,0 +10,0 @@ * @License: All Rights Reserved |
@@ -7,3 +7,3 @@ "use strict"; | ||
* @Filename: findSchemaById.ts | ||
* @Last modified time: Wednesday, 6th March 2019 4:42:51 pm | ||
@@ -10,0 +10,0 @@ * @License: All Rights Reserved |
/// <reference types="node" /> | ||
import { IXyoObjectPartialSchema } from "../@types"; | ||
import { IXyoObjectPartialSchema } from '../@types'; | ||
export declare function getDataBytes(src: Buffer, partialSchema: IXyoObjectPartialSchema, srcIncludesHeader: boolean): Buffer; | ||
//# sourceMappingURL=getDataBytes.d.ts.map |
@@ -7,3 +7,3 @@ "use strict"; | ||
* @Filename: getDataBytes.ts | ||
* @Last modified time: Wednesday, 6th March 2019 4:42:51 pm | ||
@@ -22,3 +22,3 @@ * @License: All Rights Reserved | ||
if (partialSchema.sizeIdentifierSize === null) { | ||
throw new errors_1.XyoError(`sizeIdentifierSize is null`); | ||
throw new errors_1.XyoError('sizeIdentifierSize is null'); | ||
} | ||
@@ -29,3 +29,3 @@ const numberOfBytesIncludingSize = getNumberOfBytesIncludingSize(src, headerOffset, partialSchema.sizeIdentifierSize); | ||
if (src.length < dataEnd) { | ||
throw new errors_1.XyoError(`Could not get data bytes, wrong buffer size`); | ||
throw new errors_1.XyoError('Could not get data bytes, wrong buffer size'); | ||
} | ||
@@ -39,3 +39,3 @@ return src.slice(dataStart, dataEnd); | ||
if (src.length < (offset + 1)) { | ||
throw new errors_1.XyoError(`sizeIdentifierSize could not be read`); | ||
throw new errors_1.XyoError('sizeIdentifierSize could not be read'); | ||
} | ||
@@ -45,3 +45,3 @@ return src.readUInt8(offset); | ||
if (src.length < (offset + 2)) { | ||
throw new errors_1.XyoError(`sizeIdentifierSize could not be read`); | ||
throw new errors_1.XyoError('sizeIdentifierSize could not be read'); | ||
} | ||
@@ -51,3 +51,3 @@ return src.readUInt16BE(offset); | ||
if (src.length < (offset + 4)) { | ||
throw new errors_1.XyoError(`sizeIdentifierSize could not be read`); | ||
throw new errors_1.XyoError('sizeIdentifierSize could not be read'); | ||
} | ||
@@ -57,9 +57,9 @@ return src.readUInt32BE(offset); | ||
if (src.length < (offset + 8)) { | ||
throw new errors_1.XyoError(`sizeIdentifierSize could not be read`); | ||
throw new errors_1.XyoError('sizeIdentifierSize could not be read'); | ||
} | ||
return new bn_js_1.default(src.slice(offset, offset + 8).toString('hex'), 16).toNumber(); | ||
default: | ||
throw new errors_1.XyoError(`sizeIdentifierSize could not be resolved`); | ||
throw new errors_1.XyoError('sizeIdentifierSize could not be resolved'); | ||
} | ||
} | ||
//# sourceMappingURL=getDataBytes.js.map |
/// <reference types="node" /> | ||
import { IXyoObjectPartialSchema } from "../@types"; | ||
import { IXyoObjectPartialSchema } from '../@types'; | ||
/** | ||
@@ -4,0 +4,0 @@ * Builds a dynamic header based on the size of bytes for a schema |
@@ -7,3 +7,3 @@ "use strict"; | ||
* @Filename: getHeader.ts | ||
* @Last modified time: Wednesday, 6th March 2019 4:42:51 pm | ||
@@ -49,3 +49,3 @@ * @License: All Rights Reserved | ||
default: | ||
throw new errors_1.XyoError(`This should never happen exception`); | ||
throw new errors_1.XyoError('This should never happen exception'); | ||
} | ||
@@ -52,0 +52,0 @@ })(); |
@@ -7,3 +7,3 @@ "use strict"; | ||
* @Filename: getLeastNumberOfBytesToEncodeSize.ts | ||
* @Last modified time: Wednesday, 28th November 2018 5:00:37 pm | ||
@@ -10,0 +10,0 @@ * @License: All Rights Reserved |
@@ -7,3 +7,3 @@ "use strict"; | ||
* @Filename: getNumberOfBytesRequiredForSizeBuffer.ts | ||
* @Last modified time: Wednesday, 6th March 2019 4:42:51 pm | ||
@@ -40,3 +40,3 @@ * @License: All Rights Reserved | ||
default: | ||
throw new errors_1.XyoError(`This should never happen exception`); | ||
throw new errors_1.XyoError('This should never happen exception'); | ||
} | ||
@@ -43,0 +43,0 @@ })(); |
@@ -7,3 +7,3 @@ "use strict"; | ||
* @Filename: getSizeHeader.ts | ||
* @Last modified time: Wednesday, 28th November 2018 5:17:42 pm | ||
@@ -10,0 +10,0 @@ * @License: All Rights Reserved |
/// <reference types="node" /> | ||
import { XyoBaseSerializable } from "./base-serializable"; | ||
import { IXyoSerializableObject, IOnTheFlyGetDataOptions, IXyoObjectSchema } from "../@types"; | ||
import { XyoBaseSerializable } from './base-serializable'; | ||
import { IXyoSerializableObject, IOnTheFlyGetDataOptions, IXyoObjectSchema } from '../@types'; | ||
export declare class XyoOnTheFlySerializable extends XyoBaseSerializable { | ||
@@ -5,0 +5,0 @@ readonly schemaObjectId: number; |
@@ -8,3 +8,3 @@ "use strict"; | ||
* @Filename: on-the-fly-serializable.ts | ||
* @Last modified time: Wednesday, 6th March 2019 4:42:51 pm | ||
@@ -44,3 +44,3 @@ * @License: All Rights Reserved | ||
} | ||
throw new errors_1.XyoError(`No option implemented for OnTheFlySerializable`); | ||
throw new errors_1.XyoError('No option implemented for OnTheFlySerializable'); | ||
} | ||
@@ -47,0 +47,0 @@ } |
/// <reference types="node" /> | ||
import { IParseResult } from "../@types"; | ||
import { IParseResult } from '../@types'; | ||
export declare class ParseQuery { | ||
@@ -4,0 +4,0 @@ private readonly parseResult; |
@@ -7,3 +7,3 @@ "use strict"; | ||
* @Filename: parse-query.ts | ||
* @Last modified time: Wednesday, 6th March 2019 4:42:51 pm | ||
@@ -34,3 +34,3 @@ * @License: All Rights Reserved | ||
if (this.isReadable()) { | ||
throw new errors_1.XyoError(`No children to map`); | ||
throw new errors_1.XyoError('No children to map'); | ||
} | ||
@@ -43,6 +43,6 @@ return this.parseResult.data.map((item, index) => { | ||
if (this.isReadable()) { | ||
throw new errors_1.XyoError(`No children to map`); | ||
throw new errors_1.XyoError('No children to map'); | ||
} | ||
if (index > this.parseResult.data.length) { | ||
throw new errors_1.XyoError(`Index out of range`); | ||
throw new errors_1.XyoError('Index out of range'); | ||
} | ||
@@ -53,3 +53,3 @@ return new ParseQuery(this.parseResult.data[index]); | ||
if (this.isReadable()) { | ||
throw new errors_1.XyoError(`No children to map`); | ||
throw new errors_1.XyoError('No children to map'); | ||
} | ||
@@ -56,0 +56,0 @@ return this.parseResult.data.reduce(reducer, startingValue); |
/// <reference types="node" /> | ||
import { IParseResult, IXyoObjectSchema } from "../@types"; | ||
import { IParseResult, IXyoObjectSchema } from '../@types'; | ||
export declare function parse(src: Buffer, schema: IXyoObjectSchema): IParseResult; | ||
//# sourceMappingURL=parse.d.ts.map |
@@ -7,3 +7,3 @@ "use strict"; | ||
* @Filename: parse.ts | ||
* @Last modified time: Wednesday, 12th December 2018 1:23:50 pm | ||
@@ -10,0 +10,0 @@ * @License: All Rights Reserved |
/// <reference types="node" /> | ||
import { IXyoObjectPartialSchema } from "../@types"; | ||
import { IXyoObjectPartialSchema } from '../@types'; | ||
export declare function readHeader(header: Buffer): IXyoObjectPartialSchema; | ||
//# sourceMappingURL=readHeader.d.ts.map |
@@ -7,3 +7,3 @@ "use strict"; | ||
* @Filename: readHeader.ts | ||
* @Last modified time: Wednesday, 6th March 2019 4:42:51 pm | ||
@@ -17,3 +17,3 @@ * @License: All Rights Reserved | ||
if (header.length < 2) { | ||
throw new errors_1.XyoError(`The minimum size of a header is 2 bytes`); | ||
throw new errors_1.XyoError('The minimum size of a header is 2 bytes'); | ||
} | ||
@@ -41,3 +41,3 @@ const topByte = header.readUInt8(0); | ||
} | ||
throw new Error(`This should never happen`); | ||
throw new Error('This should never happen'); | ||
})(), | ||
@@ -49,3 +49,3 @@ iterableType: (() => { | ||
if (!isIterable && isTyped) { // 0b01 | ||
throw new errors_1.XyoError(`Impossible state for serialization`); | ||
throw new errors_1.XyoError('Impossible state for serialization'); | ||
} | ||
@@ -58,3 +58,3 @@ if (isIterable && !isTyped) { // 0b10 | ||
} | ||
throw new Error(`This should never happen`); | ||
throw new Error('This should never happen'); | ||
})() | ||
@@ -61,0 +61,0 @@ }; |
/// <reference types="node" /> | ||
import { IXyoObjectSchema, IXyoSerializableObject, IXyoObjectPartialSchema } from "../@types"; | ||
import { IXyoObjectSchema, IXyoSerializableObject, IXyoObjectPartialSchema } from '../@types'; | ||
export declare function resolveSerializablesToBuffer(schema: IXyoObjectPartialSchema, objectSchema: IXyoObjectSchema, serializables: IXyoSerializableObject[]): Buffer; | ||
//# sourceMappingURL=resolveSerializablesToBuffer.d.ts.map |
@@ -7,3 +7,3 @@ "use strict"; | ||
* @Filename: resolveSerializablesToBuffer.ts | ||
* @Last modified time: Wednesday, 6th March 2019 4:42:51 pm | ||
@@ -34,3 +34,3 @@ * @License: All Rights Reserved | ||
if (numberOfSerializerTypes === 0) { | ||
throw new errors_1.XyoError(`Serializers do not conform`); | ||
throw new errors_1.XyoError('Serializers do not conform'); | ||
} | ||
@@ -37,0 +37,0 @@ let arraySerializationType; |
/// <reference types="node" /> | ||
import { IXyoObjectPartialSchema } from "../@types"; | ||
import { IXyoObjectPartialSchema } from '../@types'; | ||
/** | ||
@@ -4,0 +4,0 @@ * Serializes an arbitrary buffer in accordance with the XYO packing protocol |
@@ -7,3 +7,3 @@ "use strict"; | ||
* @Filename: serialize.ts | ||
* @Last modified time: Wednesday, 28th November 2018 5:17:05 pm | ||
@@ -10,0 +10,0 @@ * @License: All Rights Reserved |
/// <reference types="node" /> | ||
import { IXyoObjectPartialSchema } from "../@types"; | ||
import { IXyoObjectPartialSchema } from '../@types'; | ||
export declare function sliceItem(src: Buffer, offset: number, partialSchema: IXyoObjectPartialSchema, includesHeader: boolean): Buffer; | ||
//# sourceMappingURL=sliceItem.d.ts.map |
@@ -7,3 +7,3 @@ "use strict"; | ||
* @Filename: sliceItem.ts | ||
* @Last modified time: Wednesday, 28th November 2018 5:29:53 pm | ||
@@ -10,0 +10,0 @@ * @License: All Rights Reserved |
@@ -7,3 +7,3 @@ "use strict"; | ||
* @Filename: tree-iterator.ts | ||
* @Last modified time: Wednesday, 12th December 2018 1:28:00 pm | ||
@@ -10,0 +10,0 @@ * @License: All Rights Reserved |
@@ -7,3 +7,3 @@ "use strict"; | ||
* @Filename: index.ts | ||
* @Last modified time: Wednesday, 12th December 2018 12:17:37 pm | ||
@@ -10,0 +10,0 @@ * @License: All Rights Reserved |
@@ -18,3 +18,3 @@ "use strict"; | ||
getReadableValue() { | ||
return "Unknown"; | ||
return 'Unknown'; | ||
} | ||
@@ -21,0 +21,0 @@ } |
/// <reference types="node" /> | ||
import { BufferOrString, IXyoSerializationService, IXyoSerializableObject, IXyoDeserializer, IXyoObjectSchema, IParseResult } from "./@types"; | ||
import { BufferOrString, IXyoSerializationService, IXyoSerializableObject, IXyoDeserializer, IXyoObjectSchema, IParseResult } from './@types'; | ||
import { XyoBase } from '@xyo-network/base'; | ||
import { XyoTreeIterator } from "./helpers/tree-iterator"; | ||
import { XyoTreeIterator } from './helpers/tree-iterator'; | ||
export declare class XyoSerializationService extends XyoBase implements IXyoSerializationService { | ||
@@ -9,3 +9,3 @@ readonly schema: IXyoObjectSchema; | ||
constructor(schema: IXyoObjectSchema); | ||
serialize(serializable: IXyoSerializableObject, serializationType?: "buffer" | "hex" | undefined): BufferOrString; | ||
serialize(serializable: IXyoSerializableObject, serializationType?: 'buffer' | 'hex' | undefined): BufferOrString; | ||
addDeserializer(deserializer: IXyoDeserializer<IXyoSerializableObject>): void; | ||
@@ -12,0 +12,0 @@ deserialize(deserializable: BufferOrString): XyoTreeIterator; |
@@ -7,3 +7,3 @@ "use strict"; | ||
* @Filename: xyo-serialization-service.ts | ||
* @Last modified time: Wednesday, 6th March 2019 4:42:51 pm | ||
@@ -10,0 +10,0 @@ * @License: All Rights Reserved |
{ | ||
"name": "@xyo-network/serialization", | ||
"version": "0.55.2-alpha.0", | ||
"version": "0.55.6-alpha.0", | ||
"description": "Serialization services in the xyo network", | ||
@@ -10,4 +10,4 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@xyo-network/base": "^0.55.2-alpha.0", | ||
"@xyo-network/errors": "^0.55.2-alpha.0", | ||
"@xyo-network/base": "^0.55.6-alpha.0", | ||
"@xyo-network/errors": "^0.55.6-alpha.0", | ||
"bn.js": "^4.11.8" | ||
@@ -25,3 +25,3 @@ }, | ||
}, | ||
"gitHead": "62e4cabbc28af84e01f2c9d2c76c82a8e633cfdf" | ||
"gitHead": "e75c364eb6fc7be583feb2c92757f5039d555292" | ||
} |
@@ -6,3 +6,3 @@ /* | ||
* @Filename: index.ts | ||
* @Last modified time: Friday, 14th December 2018 12:09:06 pm | ||
@@ -13,3 +13,3 @@ * @License: All Rights Reserved | ||
import { XyoTreeIterator } from "../helpers/tree-iterator" | ||
import { XyoTreeIterator } from '../helpers/tree-iterator' | ||
export interface IXyoObjectPartialSchema { | ||
@@ -16,0 +16,0 @@ |
@@ -6,3 +6,3 @@ /* | ||
* @Filename: base-serializable.ts | ||
* @Last modified time: Friday, 14th December 2018 12:09:57 pm | ||
@@ -13,7 +13,7 @@ * @License: All Rights Reserved | ||
import { IXyoSerializableObject, IXyoObjectSchema, IXyoObjectPartialSchema, IParseResult } from "../@types" | ||
import { XyoBase } from "@xyo-network/base" | ||
import { resolveSerializablesToBuffer } from "./resolveSerializablesToBuffer" | ||
import { serialize } from "./serialize" | ||
import { findSchemaById } from "./findSchemaById" | ||
import { IXyoSerializableObject, IXyoObjectSchema, IXyoObjectPartialSchema, IParseResult } from '../@types' | ||
import { XyoBase } from '@xyo-network/base' | ||
import { resolveSerializablesToBuffer } from './resolveSerializablesToBuffer' | ||
import { serialize } from './serialize' | ||
import { findSchemaById } from './findSchemaById' | ||
import { readHeader } from './readHeader' | ||
@@ -20,0 +20,0 @@ |
@@ -6,3 +6,3 @@ /* | ||
* @Filename: findSchemaById.ts | ||
* @Last modified time: Wednesday, 6th March 2019 4:42:51 pm | ||
@@ -9,0 +9,0 @@ * @License: All Rights Reserved |
@@ -6,3 +6,3 @@ /* | ||
* @Filename: getDataBytes.ts | ||
* @Last modified time: Wednesday, 6th March 2019 4:42:51 pm | ||
@@ -13,4 +13,4 @@ * @License: All Rights Reserved | ||
import { XyoError, XyoErrors } from "@xyo-network/errors" | ||
import { IXyoObjectPartialSchema } from "../@types" | ||
import { XyoError, XyoErrors } from '@xyo-network/errors' | ||
import { IXyoObjectPartialSchema } from '../@types' | ||
import BN from 'bn.js' | ||
@@ -21,3 +21,3 @@ | ||
if (partialSchema.sizeIdentifierSize === null) { | ||
throw new XyoError(`sizeIdentifierSize is null`) | ||
throw new XyoError('sizeIdentifierSize is null') | ||
} | ||
@@ -30,3 +30,3 @@ | ||
if (src.length < dataEnd) { | ||
throw new XyoError(`Could not get data bytes, wrong buffer size`) | ||
throw new XyoError('Could not get data bytes, wrong buffer size') | ||
} | ||
@@ -41,3 +41,3 @@ | ||
if (src.length < (offset + 1)) { | ||
throw new XyoError(`sizeIdentifierSize could not be read`) | ||
throw new XyoError('sizeIdentifierSize could not be read') | ||
} | ||
@@ -47,3 +47,3 @@ return src.readUInt8(offset) | ||
if (src.length < (offset + 2)) { | ||
throw new XyoError(`sizeIdentifierSize could not be read`) | ||
throw new XyoError('sizeIdentifierSize could not be read') | ||
} | ||
@@ -53,3 +53,3 @@ return src.readUInt16BE(offset) | ||
if (src.length < (offset + 4)) { | ||
throw new XyoError(`sizeIdentifierSize could not be read`) | ||
throw new XyoError('sizeIdentifierSize could not be read') | ||
} | ||
@@ -59,8 +59,8 @@ return src.readUInt32BE(offset) | ||
if (src.length < (offset + 8)) { | ||
throw new XyoError(`sizeIdentifierSize could not be read`) | ||
throw new XyoError('sizeIdentifierSize could not be read') | ||
} | ||
return new BN(src.slice(offset, offset + 8).toString('hex'), 16).toNumber() | ||
default: | ||
throw new XyoError(`sizeIdentifierSize could not be resolved`) | ||
throw new XyoError('sizeIdentifierSize could not be resolved') | ||
} | ||
} |
@@ -6,3 +6,3 @@ /* | ||
* @Filename: getHeader.ts | ||
* @Last modified time: Wednesday, 6th March 2019 4:42:51 pm | ||
@@ -13,6 +13,6 @@ * @License: All Rights Reserved | ||
import { IXyoObjectPartialSchema } from "../@types" | ||
import { IXyoObjectPartialSchema } from '../@types' | ||
import { XyoError, XyoErrors } from '@xyo-network/errors' | ||
import { getSizeHeader } from "./getSizeHeader" | ||
import { getLeastNumberOfBytesToEncodeSize } from "./getLeastNumberOfBytesToEncodeSize" | ||
import { getSizeHeader } from './getSizeHeader' | ||
import { getLeastNumberOfBytesToEncodeSize } from './getLeastNumberOfBytesToEncodeSize' | ||
@@ -51,3 +51,3 @@ /** | ||
default: | ||
throw new XyoError(`This should never happen exception`) | ||
throw new XyoError('This should never happen exception') | ||
} | ||
@@ -54,0 +54,0 @@ })() |
@@ -6,3 +6,3 @@ /* | ||
* @Filename: getLeastNumberOfBytesToEncodeSize.ts | ||
* @Last modified time: Wednesday, 28th November 2018 5:00:37 pm | ||
@@ -9,0 +9,0 @@ * @License: All Rights Reserved |
@@ -6,3 +6,3 @@ /* | ||
* @Filename: getNumberOfBytesRequiredForSizeBuffer.ts | ||
* @Last modified time: Wednesday, 6th March 2019 4:42:51 pm | ||
@@ -43,3 +43,3 @@ * @License: All Rights Reserved | ||
default: | ||
throw new XyoError(`This should never happen exception`) | ||
throw new XyoError('This should never happen exception') | ||
} | ||
@@ -46,0 +46,0 @@ })() |
@@ -6,3 +6,3 @@ /* | ||
* @Filename: getSizeHeader.ts | ||
* @Last modified time: Wednesday, 28th November 2018 5:17:42 pm | ||
@@ -9,0 +9,0 @@ * @License: All Rights Reserved |
@@ -6,3 +6,3 @@ /* | ||
* @Filename: on-the-fly-serializable.ts | ||
* @Last modified time: Wednesday, 6th March 2019 4:42:51 pm | ||
@@ -12,5 +12,5 @@ * @License: All Rights Reserved | ||
*/ | ||
import { XyoBaseSerializable } from "./base-serializable" | ||
import { IXyoSerializableObject, IOnTheFlyGetDataOptions, IXyoObjectSchema } from "../@types" | ||
import { XyoError, XyoErrors } from "@xyo-network/errors" | ||
import { XyoBaseSerializable } from './base-serializable' | ||
import { IXyoSerializableObject, IOnTheFlyGetDataOptions, IXyoObjectSchema } from '../@types' | ||
import { XyoError, XyoErrors } from '@xyo-network/errors' | ||
@@ -53,5 +53,5 @@ export class XyoOnTheFlySerializable extends XyoBaseSerializable { | ||
throw new XyoError(`No option implemented for OnTheFlySerializable`) | ||
throw new XyoError('No option implemented for OnTheFlySerializable') | ||
} | ||
} |
@@ -6,3 +6,3 @@ /* | ||
* @Filename: parse-query.ts | ||
* @Last modified time: Wednesday, 6th March 2019 4:42:51 pm | ||
@@ -13,4 +13,4 @@ * @License: All Rights Reserved | ||
import { IParseResult, IXyoSerializableObject } from "../@types" | ||
import { XyoError, XyoErrors } from "@xyo-network/errors" | ||
import { IParseResult, IXyoSerializableObject } from '../@types' | ||
import { XyoError, XyoErrors } from '@xyo-network/errors' | ||
@@ -41,3 +41,3 @@ export class ParseQuery { | ||
if (this.isReadable()) { | ||
throw new XyoError(`No children to map`) | ||
throw new XyoError('No children to map') | ||
} | ||
@@ -52,7 +52,7 @@ | ||
if (this.isReadable()) { | ||
throw new XyoError(`No children to map`) | ||
throw new XyoError('No children to map') | ||
} | ||
if (index > (this.parseResult.data as IParseResult[]).length) { | ||
throw new XyoError(`Index out of range`) | ||
throw new XyoError('Index out of range') | ||
} | ||
@@ -65,3 +65,3 @@ | ||
if (this.isReadable()) { | ||
throw new XyoError(`No children to map`) | ||
throw new XyoError('No children to map') | ||
} | ||
@@ -68,0 +68,0 @@ |
@@ -6,3 +6,3 @@ /* | ||
* @Filename: parse.ts | ||
* @Last modified time: Wednesday, 12th December 2018 1:23:50 pm | ||
@@ -13,6 +13,6 @@ * @License: All Rights Reserved | ||
import { readHeader } from "./readHeader" | ||
import { sliceItem } from "./sliceItem" | ||
import { IParseResult, IXyoObjectSchema } from "../@types" | ||
import { XyoOnTheFlySerializable } from "./on-the-fly-serializable" | ||
import { readHeader } from './readHeader' | ||
import { sliceItem } from './sliceItem' | ||
import { IParseResult, IXyoObjectSchema } from '../@types' | ||
import { XyoOnTheFlySerializable } from './on-the-fly-serializable' | ||
@@ -19,0 +19,0 @@ export function parse(src: Buffer, schema: IXyoObjectSchema): IParseResult { |
@@ -6,3 +6,3 @@ /* | ||
* @Filename: readHeader.ts | ||
* @Last modified time: Wednesday, 6th March 2019 4:42:51 pm | ||
@@ -13,8 +13,8 @@ * @License: All Rights Reserved | ||
import { IXyoObjectPartialSchema } from "../@types" | ||
import { XyoError, XyoErrors } from "@xyo-network/errors" | ||
import { IXyoObjectPartialSchema } from '../@types' | ||
import { XyoError, XyoErrors } from '@xyo-network/errors' | ||
export function readHeader(header: Buffer): IXyoObjectPartialSchema { | ||
if (header.length < 2) { | ||
throw new XyoError(`The minimum size of a header is 2 bytes`) | ||
throw new XyoError('The minimum size of a header is 2 bytes') | ||
} | ||
@@ -48,3 +48,3 @@ | ||
} | ||
throw new Error(`This should never happen`) | ||
throw new Error('This should never happen') | ||
})(), | ||
@@ -58,3 +58,3 @@ | ||
if (!isIterable && isTyped) { // 0b01 | ||
throw new XyoError(`Impossible state for serialization`) | ||
throw new XyoError('Impossible state for serialization') | ||
} | ||
@@ -70,5 +70,5 @@ | ||
throw new Error(`This should never happen`) | ||
throw new Error('This should never happen') | ||
})() | ||
} | ||
} |
@@ -6,3 +6,3 @@ /* | ||
* @Filename: resolveSerializablesToBuffer.ts | ||
* @Last modified time: Wednesday, 6th March 2019 4:42:51 pm | ||
@@ -13,8 +13,8 @@ * @License: All Rights Reserved | ||
import { IXyoObjectSchema, IXyoSerializableObject, IIterableType, IXyoObjectPartialSchema } from "../@types" | ||
import { XyoError, XyoErrors } from "@xyo-network/errors" | ||
import { getHeader } from "./getHeader" | ||
import { getNumberOfBytesRequiredForSizeBuffer } from "./getNumberOfBytesRequiredForSizeBuffer" | ||
import { getSizeHeader } from "./getSizeHeader" | ||
import { readHeader } from "./readHeader" | ||
import { IXyoObjectSchema, IXyoSerializableObject, IIterableType, IXyoObjectPartialSchema } from '../@types' | ||
import { XyoError, XyoErrors } from '@xyo-network/errors' | ||
import { getHeader } from './getHeader' | ||
import { getNumberOfBytesRequiredForSizeBuffer } from './getNumberOfBytesRequiredForSizeBuffer' | ||
import { getSizeHeader } from './getSizeHeader' | ||
import { readHeader } from './readHeader' | ||
@@ -45,3 +45,3 @@ export function resolveSerializablesToBuffer( | ||
if (numberOfSerializerTypes === 0) { | ||
throw new XyoError(`Serializers do not conform`) | ||
throw new XyoError('Serializers do not conform') | ||
} | ||
@@ -48,0 +48,0 @@ |
@@ -6,3 +6,3 @@ /* | ||
* @Filename: serialize.ts | ||
* @Last modified time: Wednesday, 28th November 2018 5:17:05 pm | ||
@@ -13,4 +13,4 @@ * @License: All Rights Reserved | ||
import { IXyoObjectPartialSchema } from "../@types" | ||
import { getHeader } from "./getHeader" | ||
import { IXyoObjectPartialSchema } from '../@types' | ||
import { getHeader } from './getHeader' | ||
@@ -17,0 +17,0 @@ /** |
@@ -6,3 +6,3 @@ /* | ||
* @Filename: sliceItem.ts | ||
* @Last modified time: Wednesday, 28th November 2018 5:29:53 pm | ||
@@ -13,4 +13,4 @@ * @License: All Rights Reserved | ||
import { IXyoObjectPartialSchema } from "../@types" | ||
import { getDataBytes } from "./getDataBytes" | ||
import { IXyoObjectPartialSchema } from '../@types' | ||
import { getDataBytes } from './getDataBytes' | ||
@@ -17,0 +17,0 @@ export function sliceItem( |
@@ -6,3 +6,3 @@ /* | ||
* @Filename: tree-iterator.ts | ||
* @Last modified time: Wednesday, 12th December 2018 1:28:00 pm | ||
@@ -9,0 +9,0 @@ * @License: All Rights Reserved |
@@ -6,3 +6,3 @@ /* | ||
* @Filename: index.ts | ||
* @Last modified time: Wednesday, 12th December 2018 12:17:37 pm | ||
@@ -9,0 +9,0 @@ * @License: All Rights Reserved |
@@ -6,3 +6,3 @@ /* | ||
* @Filename: parse.spec.ts | ||
* @Last modified time: Wednesday, 12th December 2018 11:16:10 am | ||
@@ -13,4 +13,4 @@ * @License: All Rights Reserved | ||
import { parse } from "../helpers/parse" | ||
import { IParseResult } from "../@types" | ||
import { parse } from '../helpers/parse' | ||
import { IParseResult } from '../@types' | ||
@@ -29,3 +29,3 @@ describe('Parsing', () => { | ||
if (!result) { | ||
throw new Error(`Result should be defined`) | ||
throw new Error('Result should be defined') | ||
} | ||
@@ -52,3 +52,3 @@ | ||
if (!result) { | ||
throw new Error(`Result should be defined`) | ||
throw new Error('Result should be defined') | ||
} | ||
@@ -81,3 +81,3 @@ | ||
if (!result) { | ||
throw new Error(`Result should be defined`) | ||
throw new Error('Result should be defined') | ||
} | ||
@@ -114,3 +114,3 @@ | ||
if (!result) { | ||
throw new Error(`Result should be defined`) | ||
throw new Error('Result should be defined') | ||
} | ||
@@ -163,3 +163,3 @@ | ||
if (!result) { | ||
throw new Error(`Result should be defined`) | ||
throw new Error('Result should be defined') | ||
} | ||
@@ -214,3 +214,3 @@ | ||
if (!result) { | ||
throw new Error(`Result should be defined`) | ||
throw new Error('Result should be defined') | ||
} | ||
@@ -217,0 +217,0 @@ expect(result.data).toBeInstanceOf(Array) |
@@ -6,3 +6,3 @@ /* | ||
* @Filename: serialization.spec.ts | ||
* @Last modified time: Wednesday, 12th December 2018 1:58:10 pm | ||
@@ -18,5 +18,5 @@ * @License: All Rights Reserved | ||
describe(`Serialization`, () => { | ||
describe('Serialization', () => { | ||
it(`Should serialize typed simple collection`, () => { | ||
it('Should serialize typed simple collection', () => { | ||
const schema: IXyoObjectSchema = { | ||
@@ -45,3 +45,3 @@ x: { | ||
it(`Should serialize typed simple collection using high watermark for size encoding`, () => { | ||
it('Should serialize typed simple collection using high watermark for size encoding', () => { | ||
const schema: IXyoObjectSchema = { | ||
@@ -81,3 +81,3 @@ x: { | ||
it(`Should serialize untyped simple collection`, () => { | ||
it('Should serialize untyped simple collection', () => { | ||
const schema: IXyoObjectSchema = { | ||
@@ -106,3 +106,3 @@ x: { | ||
it(`Should serialize typed simple collection with 2 objects`, () => { | ||
it('Should serialize typed simple collection with 2 objects', () => { | ||
const schema: IXyoObjectSchema = { | ||
@@ -133,3 +133,3 @@ x: { | ||
it(`Should serialize untyped simple collection with 2 objects`, () => { | ||
it('Should serialize untyped simple collection with 2 objects', () => { | ||
const schema: IXyoObjectSchema = { | ||
@@ -162,3 +162,3 @@ x: { | ||
it(`Should serialize a collection of untyped collections with 0 objects`, () => { | ||
it('Should serialize a collection of untyped collections with 0 objects', () => { | ||
const schema: IXyoObjectSchema = { | ||
@@ -187,3 +187,3 @@ x: { | ||
it(`Should serialize a collection of untyped collections 2 objects`, () => { | ||
it('Should serialize a collection of untyped collections 2 objects', () => { | ||
const schema: IXyoObjectSchema = { | ||
@@ -225,3 +225,3 @@ x: { | ||
it(`Should serialize a collection of typed collections 2 objects`, () => { | ||
it('Should serialize a collection of typed collections 2 objects', () => { | ||
const schema: IXyoObjectSchema = { | ||
@@ -228,0 +228,0 @@ x: { |
@@ -6,3 +6,3 @@ /* | ||
* @Filename: serialize.spec.ts | ||
* @Last modified time: Wednesday, 28th November 2018 5:28:37 pm | ||
@@ -9,0 +9,0 @@ * @License: All Rights Reserved |
@@ -24,5 +24,5 @@ | ||
public getReadableValue(): any { | ||
return "Unknown" | ||
return 'Unknown' | ||
} | ||
} |
@@ -6,3 +6,3 @@ /* | ||
* @Filename: xyo-serialization-service.ts | ||
* @Last modified time: Wednesday, 6th March 2019 4:42:51 pm | ||
@@ -13,6 +13,6 @@ * @License: All Rights Reserved | ||
import { BufferOrString, IXyoSerializationService, IXyoSerializableObject, IXyoDeserializer, IXyoObjectSchema, IParseResult, IOnTheFlyGetDataOptions } from "./@types" | ||
import { BufferOrString, IXyoSerializationService, IXyoSerializableObject, IXyoDeserializer, IXyoObjectSchema, IParseResult, IOnTheFlyGetDataOptions } from './@types' | ||
import { XyoBase } from '@xyo-network/base' | ||
import { resolveSerializablesToBuffer } from "./helpers/resolveSerializablesToBuffer" | ||
import { resolveSerializablesToBuffer } from './helpers/resolveSerializablesToBuffer' | ||
import { XyoError, XyoErrors } from '@xyo-network/errors' | ||
@@ -22,7 +22,7 @@ import { serialize } from './helpers/serialize' | ||
import { readHeader } from './helpers/readHeader' | ||
import { parse } from "./helpers/parse" | ||
import { XyoTreeIterator } from "./helpers/tree-iterator" | ||
import { XyoOnTheFlySerializable } from "./helpers/on-the-fly-serializable" | ||
import { read } from "fs" | ||
import { XyoFiller } from "./xyo-filler" | ||
import { parse } from './helpers/parse' | ||
import { XyoTreeIterator } from './helpers/tree-iterator' | ||
import { XyoOnTheFlySerializable } from './helpers/on-the-fly-serializable' | ||
import { read } from 'fs' | ||
import { XyoFiller } from './xyo-filler' | ||
@@ -40,3 +40,3 @@ export class XyoSerializationService extends XyoBase implements IXyoSerializationService { | ||
serializable: IXyoSerializableObject, | ||
serializationType?: "buffer" | "hex" | undefined | ||
serializationType?: 'buffer' | 'hex' | undefined | ||
): BufferOrString { | ||
@@ -43,0 +43,0 @@ const result = serializable.serialize() |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
524047
0
+ Added@xyo-network/base@0.55.6-alpha.0(transitive)
+ Added@xyo-network/errors@0.55.6-alpha.0(transitive)
+ Added@xyo-network/logger@0.55.6-alpha.0(transitive)
- Removed@xyo-network/base@0.55.2-alpha.0(transitive)
- Removed@xyo-network/errors@0.55.2-alpha.0(transitive)
- Removed@xyo-network/logger@0.55.2-alpha.0(transitive)