Unverified Commit b35b01a1 authored by graywolf336's avatar graywolf336
Browse files

Update the dev environment to work with the new updates

parent 6cd6696f
import { AppConsole, ILoggerStorageEntry } from '@rocket.chat/apps-engine/server/logging';
import { AppLogStorage, IAppLogStorageFindOptions, IAppStorageItem } from '@rocket.chat/apps-engine/server/storage';
import * as Datastore from 'nedb';
export class ServerAppLogStorage extends AppLogStorage {
private db: Datastore;
constructor() {
super('nedb');
this.db = new Datastore({ filename: '.server-data/app-logs.nedb', autoload: true });
}
public find(query: { [field: string]: any; },
options?: IAppLogStorageFindOptions): Promise<Array<ILoggerStorageEntry>> {
throw new Error('Method not implemented.');
}
public storeEntries(appId: string, logger: AppConsole): Promise<ILoggerStorageEntry> {
return new Promise((resolve, reject) => {
const item = AppConsole.toStorageEntry(appId, logger);
this.db.insert(item, (err: Error, doc: ILoggerStorageEntry) => {
if (err) {
reject(err);
} else {
resolve(doc);
}
});
});
}
public getEntriesFor(appId: string): Promise<Array<ILoggerStorageEntry>> {
throw new Error('Method not implemented.');
}
}
......@@ -5,11 +5,13 @@ import * as path from 'path';
import * as socketIO from 'socket.io';
import { ServerAppBridges } from './bridges/bridges';
import { ServerAppLogStorage } from './logStorage';
import { ServerAppStorage } from './storage';
export class Orchestrator {
public bridges: ServerAppBridges;
public storage: ServerAppStorage;
public logStorage: ServerAppLogStorage;
public manager: AppManager;
private io: SocketIO.Server;
......@@ -17,7 +19,8 @@ export class Orchestrator {
constructor() {
this.bridges = new ServerAppBridges();
this.storage = new ServerAppStorage();
this.manager = new AppManager(this.storage, this.bridges);
this.logStorage = new ServerAppLogStorage();
this.manager = new AppManager(this.storage, this.logStorage, this.bridges);
}
public loadAndUpdate(): Promise<boolean> {
......
......@@ -66,7 +66,7 @@ export class ServerAppStorage extends AppStorage {
public update(item: IAppStorageItem): Promise<IAppStorageItem> {
return new Promise((resolve, reject) => {
this.db.update({ id: item.id }, item, (err: Error, numOfUpdated: number) => {
this.db.update({ id: item.id }, item, {}, (err: Error, numOfUpdated: number) => {
if (err) {
reject(err);
} else {
......
......@@ -28,29 +28,29 @@
}
},
"@rocket.chat/apps-engine": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/@rocket.chat/apps-engine/-/apps-engine-0.3.0.tgz",
"integrity": "sha512-RQ0qIqjdgAcKD+8Avi99bBfopPGwMxMLyjeeqbHAhLDnrzumwS5Cxq1YDKtTugfMWEwxokHUeLOHGfX6wax4kQ==",
"version": "0.3.5",
"resolved": "https://registry.npmjs.org/@rocket.chat/apps-engine/-/apps-engine-0.3.5.tgz",
"integrity": "sha512-Ao9TG/1uSpksASg6ya7J8B8dmuKj/koBOQHVGzkEgAnkb0EcFoha1ecGpWfCIRvxybp+8xDjQyp40m6QdLZBSg==",
"requires": {
"@rocket.chat/apps-ts-definition": "0.7.2",
"@rocket.chat/apps-ts-definition": "0.7.6",
"adm-zip": "0.4.7",
"semver": "5.4.1",
"semver": "5.5.0",
"stack-trace": "0.0.10",
"typescript": "2.4.1",
"uuid": "3.1.0"
},
"dependencies": {
"semver": {
"version": "5.4.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz",
"integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg=="
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz",
"integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA=="
}
}
},
"@rocket.chat/apps-ts-definition": {
"version": "0.7.2",
"resolved": "https://registry.npmjs.org/@rocket.chat/apps-ts-definition/-/apps-ts-definition-0.7.2.tgz",
"integrity": "sha512-/cXSWhjDBk0CTImInxn+4dBexGsXcreOlpl2x+XBCoR6D2AbPb9Q8pxhYt8mltou957bcYJ93rgaN7u3tByxLQ==",
"version": "0.7.6",
"resolved": "https://registry.npmjs.org/@rocket.chat/apps-ts-definition/-/apps-ts-definition-0.7.6.tgz",
"integrity": "sha512-BcBYkasXQ6UTTFN5j13Gu5RzKGSpuNPe62BqPdbD0kOpofGcCb4F3gpso8XABsqKeN8jc+Z2gRTEjvQgE9HWgw==",
"requires": {
"reflect-metadata": "0.1.10"
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment