Comparing version 0.1.2 to 0.1.3
@@ -178,2 +178,3 @@ /// <reference types="node" /> | ||
getSerializedLength(opts?: SerializeOptions | undefined): number; | ||
recomputeOffsets(opts?: SerializeOptions | undefined): void; | ||
toJSON(): any; | ||
@@ -200,2 +201,3 @@ mapValuesToSerializable(): { | ||
getSerializedLength(opts?: SerializeOptions | undefined): number; | ||
recomputeOffsets(opts?: SerializeOptions | undefined): void; | ||
toJSON(): any; | ||
@@ -202,0 +204,0 @@ mapValuesToSerializable(): { |
@@ -41,2 +41,10 @@ /// <reference types="node" /> | ||
getSerializedLength(opts?: SerializeOptions): number; | ||
/** Recompute offsets in the database and record headers. | ||
* | ||
* This will update the following based on the current field values: | ||
* - `header.appInfoId` | ||
* - `header.sortInfoId` | ||
* - `entry.localChunkId` for each record | ||
*/ | ||
recomputeOffsets(opts?: SerializeOptions): void; | ||
} | ||
@@ -76,2 +84,10 @@ /** PDB databases. */ | ||
getSerializedLength(opts?: SerializeOptions | undefined): number; | ||
/** Recompute offsets in the database and record headers. | ||
* | ||
* This will update the following based on the current field values: | ||
* - `header.appInfoId` | ||
* - `header.sortInfoId` | ||
* - `entry.localChunkId` for each record | ||
*/ | ||
recomputeOffsets(opts?: SerializeOptions | undefined): void; | ||
toJSON(): any; | ||
@@ -123,2 +139,10 @@ mapValuesToSerializable(): { | ||
getSerializedLength(opts?: SerializeOptions | undefined): number; | ||
/** Recompute offsets in the database and record headers. | ||
* | ||
* This will update the following based on the current field values: | ||
* - `header.appInfoId` | ||
* - `header.sortInfoId` | ||
* - `entry.localChunkId` for each record | ||
*/ | ||
recomputeOffsets(opts?: SerializeOptions | undefined): void; | ||
toJSON(): any; | ||
@@ -159,2 +183,10 @@ mapValuesToSerializable(): { | ||
getSerializedLength(opts?: SerializeOptions | undefined): number; | ||
/** Recompute offsets in the database and record headers. | ||
* | ||
* This will update the following based on the current field values: | ||
* - `header.appInfoId` | ||
* - `header.sortInfoId` | ||
* - `entry.localChunkId` for each record | ||
*/ | ||
recomputeOffsets(opts?: SerializeOptions | undefined): void; | ||
toJSON(): any; | ||
@@ -191,2 +223,10 @@ mapValuesToSerializable(): { | ||
getSerializedLength(opts?: SerializeOptions | undefined): number; | ||
/** Recompute offsets in the database and record headers. | ||
* | ||
* This will update the following based on the current field values: | ||
* - `header.appInfoId` | ||
* - `header.sortInfoId` | ||
* - `entry.localChunkId` for each record | ||
*/ | ||
recomputeOffsets(opts?: SerializeOptions | undefined): void; | ||
toJSON(): any; | ||
@@ -232,2 +272,10 @@ mapValuesToSerializable(): { | ||
getSerializedLength(opts?: SerializeOptions | undefined): number; | ||
/** Recompute offsets in the database and record headers. | ||
* | ||
* This will update the following based on the current field values: | ||
* - `header.appInfoId` | ||
* - `header.sortInfoId` | ||
* - `entry.localChunkId` for each record | ||
*/ | ||
recomputeOffsets(opts?: SerializeOptions | undefined): void; | ||
toJSON(): any; | ||
@@ -264,2 +312,10 @@ mapValuesToSerializable(): { | ||
getSerializedLength(opts?: SerializeOptions | undefined): number; | ||
/** Recompute offsets in the database and record headers. | ||
* | ||
* This will update the following based on the current field values: | ||
* - `header.appInfoId` | ||
* - `header.sortInfoId` | ||
* - `entry.localChunkId` for each record | ||
*/ | ||
recomputeOffsets(opts?: SerializeOptions | undefined): void; | ||
toJSON(): any; | ||
@@ -266,0 +322,0 @@ mapValuesToSerializable(): { |
@@ -124,2 +124,5 @@ "use strict"; | ||
opts = __assign({ encoding: util_1.DEFAULT_ENCODING }, opts); | ||
this.recomputeOffsets(opts); | ||
var writer = new smart_buffer_1.SmartBuffer(); | ||
writer.writeBuffer(this.header.serialize(opts)); | ||
var recordList = new this.recordListType(); | ||
@@ -130,24 +133,2 @@ recordList.values = this.records.map(function (_a) { | ||
}); | ||
var offset = this.header.getSerializedLength(opts) + | ||
recordList.getSerializedLength(opts); | ||
if (this.appInfo) { | ||
this.header.appInfoId = offset; | ||
offset += this.appInfo.getSerializedLength(opts); | ||
} | ||
else { | ||
this.header.appInfoId = 0; | ||
} | ||
if (this.sortInfo) { | ||
this.header.sortInfoId = offset; | ||
offset += this.sortInfo.getSerializedLength(opts); | ||
} | ||
else { | ||
this.header.sortInfoId = 0; | ||
} | ||
for (var i = 0; i < this.records.length; ++i) { | ||
recordList.values[i].localChunkId = offset; | ||
offset += this.records[i].getSerializedLength(opts); | ||
} | ||
var writer = new smart_buffer_1.SmartBuffer(); | ||
writer.writeBuffer(this.header.serialize(opts)); | ||
writer.writeBuffer(recordList.serialize(opts)); | ||
@@ -185,2 +166,37 @@ if (this.appInfo) { | ||
}; | ||
/** Recompute offsets in the database and record headers. | ||
* | ||
* This will update the following based on the current field values: | ||
* - `header.appInfoId` | ||
* - `header.sortInfoId` | ||
* - `entry.localChunkId` for each record | ||
*/ | ||
Database.prototype.recomputeOffsets = function (opts) { | ||
opts = __assign({ encoding: util_1.DEFAULT_ENCODING }, opts); | ||
var recordList = new this.recordListType(); | ||
recordList.values = this.records.map(function (_a) { | ||
var entry = _a.entry; | ||
return entry; | ||
}); | ||
var offset = this.header.getSerializedLength(opts) + | ||
recordList.getSerializedLength(opts); | ||
if (this.appInfo) { | ||
this.header.appInfoId = offset; | ||
offset += this.appInfo.getSerializedLength(opts); | ||
} | ||
else { | ||
this.header.appInfoId = 0; | ||
} | ||
if (this.sortInfo) { | ||
this.header.sortInfoId = offset; | ||
offset += this.sortInfo.getSerializedLength(opts); | ||
} | ||
else { | ||
this.header.sortInfoId = 0; | ||
} | ||
for (var i = 0; i < this.records.length; ++i) { | ||
recordList.values[i].localChunkId = offset; | ||
offset += this.records[i].getSerializedLength(opts); | ||
} | ||
}; | ||
return Database; | ||
@@ -187,0 +203,0 @@ }(serio_1.SObject)); |
@@ -185,2 +185,3 @@ /// <reference types="node" /> | ||
getSerializedLength(opts?: SerializeOptions | undefined): number; | ||
recomputeOffsets(opts?: SerializeOptions | undefined): void; | ||
toJSON(): any; | ||
@@ -207,2 +208,3 @@ mapValuesToSerializable(): { | ||
getSerializedLength(opts?: SerializeOptions | undefined): number; | ||
recomputeOffsets(opts?: SerializeOptions | undefined): void; | ||
toJSON(): any; | ||
@@ -209,0 +211,0 @@ mapValuesToSerializable(): { |
@@ -38,2 +38,3 @@ /// <reference types="node" /> | ||
getSerializedLength(opts?: SerializeOptions | undefined): number; | ||
recomputeOffsets(opts?: SerializeOptions | undefined): void; | ||
/** Memo sort order. | ||
@@ -64,2 +65,3 @@ * | ||
getSerializedLength(opts?: SerializeOptions | undefined): number; | ||
recomputeOffsets(opts?: SerializeOptions | undefined): void; | ||
/** Memo sort order. | ||
@@ -66,0 +68,0 @@ * |
@@ -67,2 +67,3 @@ /// <reference types="node" /> | ||
getSerializedLength(opts?: SerializeOptions | undefined): number; | ||
recomputeOffsets(opts?: SerializeOptions | undefined): void; | ||
toJSON(): any; | ||
@@ -89,2 +90,3 @@ mapValuesToSerializable(): { | ||
getSerializedLength(opts?: SerializeOptions | undefined): number; | ||
recomputeOffsets(opts?: SerializeOptions | undefined): void; | ||
toJSON(): any; | ||
@@ -91,0 +93,0 @@ mapValuesToSerializable(): { |
@@ -48,2 +48,3 @@ /// <reference types="node" /> | ||
getSerializedLength(opts?: SerializeOptions | undefined): number; | ||
recomputeOffsets(opts?: SerializeOptions | undefined): void; | ||
toJSON(): any; /** Not sure what this is ¯\_(ツ)_/¯ */ | ||
@@ -70,2 +71,3 @@ mapValuesToSerializable(): { | ||
getSerializedLength(opts?: SerializeOptions | undefined): number; | ||
recomputeOffsets(opts?: SerializeOptions | undefined): void; | ||
toJSON(): any; /** Not sure what this is ¯\_(ツ)_/¯ */ | ||
@@ -72,0 +74,0 @@ mapValuesToSerializable(): { |
{ | ||
"name": "palm-pdb", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Work with Palm OS PDB and PRC files", | ||
@@ -5,0 +5,0 @@ "repository": { |
341711
6353