// Abstract
// Takes the name of the storage
/* eslint-disable no-console */
const BaseStorage = function (args) {
    if (args) {
        try {
            // webpack was crying here. It wouldnt let it build without this. Window does not exist server side.
            if (global.adapterReceiver) {
                global.adapterReceiver.loaded(args[0], this);
            }
            else {
                console.error("Global Adapter Receiver not found on the global object. Fatal error.");
            }
        }
        catch (e) {
            console.error("BaseStorage constructor", e);
        }
    }
    this.setBaseName = function (baseName) {
        this.baseName = baseName;
    };
    this.setUser = function (user) {
        this.userName = user;
    };
    this.save = function (params, callback) {
        const msg = "Save method not fulfilled in the active storage model.";
        console.warn(msg);
    };
    this.get = function (params, callback) {
        const msg = "Get method not fulfilled in the active storage model.";
        console.warn(msg);
    };
    this.keys = function (params, callback) {
        const msg = "Keys method not fulfilled in the active storage model.";
        console.warn(msg);
    };
    this.delete = function (params, callback) {
        const msg = "Delete method not fulfilled in the active storage model.";
        console.warn(msg);
    };
    this.clearCache = function (params, callback) {
        const msg = "Clear cache method not fulfilled in the active storage model.";
        console.warn(msg);
    };
    this.empty = function (callback) {
        const msg = "Empty method not fulfilled in the active storage model.";
        console.warn(msg);
    };
    this.getMultiple = function () { };
    // return full underlying key (based baseName + userName + topic + key)
    this.getCombinedKey = function (self, params) {
        return `${self.baseName}:${self.userName}:${params.topic}:${params.key}`;
    };
    // return prefix used to filter keys
    this.getKeyPreface = function (self, params) {
        let preface = `${self.baseName}:${self.userName}:${params.topic}:`;
        if ("keyPrefix" in params) {
            preface = preface + params.keyPrefix;
        }
        return preface;
    };
};
export default BaseStorage;
//# sourceMappingURL=base.js.map