UNPKG

reduct-js

Version:

ReductStore Client SDK for Javascript/NodeJS/Typescript

35 lines (34 loc) 1.37 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BucketSettings = exports.QuotaType = void 0; var QuotaType; (function (QuotaType) { QuotaType[QuotaType["NONE"] = 0] = "NONE"; QuotaType[QuotaType["FIFO"] = 1] = "FIFO"; QuotaType[QuotaType["HARD"] = 2] = "HARD"; })(QuotaType = exports.QuotaType || (exports.QuotaType = {})); /** * Represents bucket settings */ class BucketSettings { static parse(data) { const { max_block_size, max_block_records, quota_type, quota_size } = data; return { maxBlockSize: max_block_size !== undefined ? BigInt(max_block_size) : undefined, maxBlockRecords: max_block_records !== undefined ? BigInt(max_block_records) : undefined, // @ts-ignore quotaType: quota_type !== undefined ? QuotaType[quota_type] : undefined, quotaSize: quota_size !== undefined ? BigInt(quota_size) : undefined, }; } static serialize(settings) { const { maxBlockSize, maxBlockRecords, quotaType, quotaSize } = settings; return { max_block_size: maxBlockSize, max_block_records: maxBlockRecords, quota_type: quotaType !== undefined ? QuotaType[quotaType] : undefined, quota_size: quotaSize, }; } } exports.BucketSettings = BucketSettings;