Adding version log on startup

This commit is contained in:
Fabian Stamm 2019-11-14 14:26:06 +01:00
parent 50268d05c5
commit e287890ca1
4 changed files with 10 additions and 6 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@hibas123/realtimedb", "name": "@hibas123/realtimedb",
"version": "2.0.0-beta.5", "version": "2.0.0-beta.6",
"description": "", "description": "",
"main": "lib/index.js", "main": "lib/index.js",
"private": true, "private": true,

View File

@ -117,7 +117,7 @@ export class ConnectionManager {
if (!handler) if (!handler)
throw new Error("Invalid Request!"); throw new Error("Invalid Request!");
let query = db.getQuery(path || [], session.id, isDoc ? "document" : "collection"); let query = db.getQuery(path || [], session, isDoc ? "document" : "collection");
let res = await handler({ let res = await handler({
id, id,
data, data,

View File

@ -4,6 +4,7 @@ import getLevelDB, { LevelDB, deleteLevelDB } from "../storage";
import DocumentLock from "./lock"; import DocumentLock from "./lock";
import { DocumentQuery, CollectionQuery, Query } from "./query"; import { DocumentQuery, CollectionQuery, Query } from "./query";
import Logging from "@hibas123/nodelogging"; import Logging from "@hibas123/nodelogging";
import Session from "./session";
export class DatabaseManager { export class DatabaseManager {
static databases = new Map<string, Database>(); static databases = new Map<string, Database>();
@ -105,13 +106,13 @@ export class Database {
} }
getQuery(path: string[], sender: string, type: "document" | "collection" | "any") { getQuery(path: string[], session: Session, type: "document" | "collection" | "any") {
if (type === "document") if (type === "document")
return new DocumentQuery(this, path, sender); return new DocumentQuery(this, path, session);
else if (type === "collection") else if (type === "collection")
return new CollectionQuery(this, path, sender); return new CollectionQuery(this, path, session);
else else
return new Query(this, path, sender); return new Query(this, path, session);
} }
async stop() { async stop() {

View File

@ -5,9 +5,12 @@ import { DatabaseManager } from "./database/database";
import { createServer } from "http"; import { createServer } from "http";
import { ConnectionManager } from "./connection"; import { ConnectionManager } from "./connection";
import { LoggingTypes } from "@hibas123/logging"; import { LoggingTypes } from "@hibas123/logging";
import * as pk from "../package.json";
Logging.logLevel = config.dev ? LoggingTypes.Debug : LoggingTypes.Log; Logging.logLevel = config.dev ? LoggingTypes.Debug : LoggingTypes.Log;
Logging.log("Starting Database version:", pk.version);
DatabaseManager.init().then(() => { DatabaseManager.init().then(() => {
const http = createServer(Web.callback()); const http = createServer(Web.callback());
ConnectionManager.bind(http); ConnectionManager.bind(http);