import { __extends } from "tslib";
import { array, defaulted, string } from "superstruct";
import { AbstractAdapter } from "./abstract";
var envConfig = defaulted(array(string()), []);
var AddressList = /** @class */ (function (_super) {
    __extends(AddressList, _super);
    function AddressList(opts) {
        var _a, _b;
        return _super.call(this, (_a = opts === null || opts === void 0 ? void 0 : opts.name) !== null && _a !== void 0 ? _a : "process.env", (_b = opts === null || opts === void 0 ? void 0 : opts.path) !== null && _b !== void 0 ? _b : "ACROSS_IGNORED_ADDRESSES", opts) || this;
    }
    AddressList.prototype.update = function () {
        var config = process.env[this.path];
        if (!config) {
            return Promise.resolve([]);
        }
        var addresses;
        try {
            addresses = JSON.parse(config);
            if (!envConfig.is(addresses)) {
                return this.error("Address format validation failure.");
            }
        }
        catch (err) {
            return this.error(err);
        }
        return Promise.resolve(addresses);
    };
    return AddressList;
}(AbstractAdapter));
export { AddressList };
//# sourceMappingURL=env.js.map