"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "BaseDocumentStore", {
    enumerable: true,
    get: function() {
        return BaseDocumentStore;
    }
});
const _Node = require("../../Node.js");
const _constants = require("../constants.js");
const defaultPersistPath = `${_constants.DEFAULT_PERSIST_DIR}/${_constants.DEFAULT_DOC_STORE_PERSIST_FILENAME}`;
class BaseDocumentStore {
    // Save/load
    persist(persistPath = defaultPersistPath) {
    // Persist the docstore to a file.
    }
    // Nodes
    getNodes(nodeIds, raiseError = true) {
        return Promise.all(nodeIds.map((nodeId)=>this.getNode(nodeId, raiseError)));
    }
    async getNode(nodeId, raiseError = true) {
        const doc = await this.getDocument(nodeId, raiseError);
        if (!(doc instanceof _Node.BaseNode)) {
            throw new Error(`Document ${nodeId} is not a Node.`);
        }
        return doc;
    }
    async getNodeDict(nodeIdDict) {
        const result = {};
        for(const index in nodeIdDict){
            result[index] = await this.getNode(nodeIdDict[index]);
        }
        return result;
    }
}
