All files / tcb-admin-node/src/db db.js

94.74% Statements 18/19
25% Branches 1/4
100% Functions 4/4
94.74% Lines 18/19
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34  14x 14x 14x 14x 14x 14x 14x     9x 9x 9x 9x     1x     18x     18x     8x 8x     8x     14x  
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Geo = require("./geo");
const collection_1 = require("./collection");
const command_1 = require("./command");
const serverDate_1 = require("./serverDate");
const request_1 = require("./request");
const regexp_1 = require("./regexp");
class Db {
    constructor(config) {
        this.config = config;
        this.Geo = Geo;
        this.command = command_1.Command;
        this.RegExp = regexp_1.RegExpConstructor;
    }
    serverDate({ offset = 0 } = {}) {
        return new serverDate_1.ServerDate({ offset });
    }
    collection(collName) {
        Iif (!collName) {
            throw new Error("Collection name is required");
        }
        return new collection_1.CollectionReference(this, collName);
    }
    createCollection(collName) {
        let request = new request_1.Request(this);
        const params = {
            collectionName: collName
        };
        return request.send("addCollection", params);
    }
}
exports.Db = Db;