UNPKG

@baqhub/sdk

Version:

The official JavaScript SDK for the BAQ federated app platform.

46 lines (45 loc) 1.05 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AnyBlobLink = exports.BlobLink = exports.BlobLinkClass = void 0; const tslib_1 = require("tslib"); const IO = tslib_1.__importStar(require("../../helpers/io.js")); // // Runtime model. // class BlobLinkClass extends IO.Type { constructor(type) { const model = IO.object({ hash: IO.string, type: type, size: IO.number, name: IO.string, }); super("BlobLink", model.is, model.validate, model.encode); } } exports.BlobLinkClass = BlobLinkClass; function blobLink(type) { return new BlobLinkClass(IO.literal(type)); } const RAnyBlobLink = new BlobLinkClass(IO.string); // // I/O. // function buildBlobLink(blobResponse, type, name) { return { hash: blobResponse.hash, size: blobResponse.size, type, name, }; } // // Exports. // exports.BlobLink = { io: blobLink, new: buildBlobLink, }; exports.AnyBlobLink = { io: () => RAnyBlobLink, };