reduct-js
Version:
ReductStore Client SDK for Javascript/NodeJS/Typescript
70 lines (69 loc) • 1.91 kB
JavaScript
"use strict";
/**
* Replication settings
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ReplicationSettings = exports.OriginalReplicationSettings = void 0;
class OriginalReplicationSettings {
constructor() {
this.src_bucket = "";
this.dst_bucket = "";
this.dst_host = "";
this.dst_token = "";
this.entries = [];
}
}
exports.OriginalReplicationSettings = OriginalReplicationSettings;
/**
* Replication settings
*/
class ReplicationSettings {
constructor() {
/**
* Source bucket. Must exist.
*/
this.srcBucket = "";
/**
* Destination bucket. Must exist.
*/
this.dstBucket = "";
/**
* Destination host. Must exist.
*/
this.dstHost = "";
/**
* Destination token. Must have write access to the destination bucket.
*/
this.dstToken = "";
/**
* List of entries to replicate. If empty, all entries are replicated. Wildcards are supported.
*/
this.entries = [];
}
static parse(data) {
return {
srcBucket: data.src_bucket,
dstBucket: data.dst_bucket,
dstHost: data.dst_host,
dstToken: data.dst_token,
include: data.include,
exclude: data.exclude,
entries: data.entries,
eachS: data.each_s,
eachN: data.each_n ? BigInt(data.each_n) : data.each_n,
when: data.when,
};
}
static serialize(data) {
return {
src_bucket: data.srcBucket,
dst_bucket: data.dstBucket,
dst_host: data.dstHost,
dst_token: data.dstToken,
each_s: data.eachS,
each_n: data.eachN,
...data,
};
}
}
exports.ReplicationSettings = ReplicationSettings;