@x5e/gink
Version:
an eventually consistent database
33 lines • 1.09 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Retrieval = void 0;
const builders_1 = require("./builders");
const utils_1 = require("./utils");
/**
* Creates a bundle view from the encoded bytes and metadata info, only parsing
* the bytes to create the builder if actually needed.
*/
class Retrieval {
constructor(bundle) {
this.bundleBytes = bundle.bundleBytes;
this.bundleInfo = bundle.bundleInfo;
}
get info() {
return this.bundleInfo;
}
get bytes() {
return this.bundleBytes;
}
get builder() {
if (!this.bundleBuilder) {
let body = this.bundleBytes;
if (utils_1.signingBundles)
body = body.subarray(64);
console.log(`length: ${body.length}, sig: ${(0, utils_1.getSig)(body)}, ${(0, utils_1.generateTimestamp)()}`);
this.bundleBuilder = (builders_1.BundleBuilder.deserializeBinary(body));
}
return this.bundleBuilder;
}
}
exports.Retrieval = Retrieval;
//# sourceMappingURL=Retrieval.js.map