-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
197 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
service_name: travis-pro | ||
repo_token: zgpod0geOMNC14TXI2rEVKebvyveiVfMQ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"filename":"/Users/yawetse/Developer/github/typesettin/other-projects/lowkie/example/sampledb.json","collections":[{"name":"kittens","data":[],"idIndex":[201,202,203,204,205,206,207],"binaryIndices":{},"constraints":null,"uniqueNames":[],"transforms":{},"objType":"kittens","dirty":true,"cachedIndex":null,"cachedBinaryIndex":null,"cachedData":null,"adaptiveBinaryIndices":true,"transactional":false,"cloneObjects":false,"cloneMethod":"parse-stringify","asyncListeners":false,"disableChangesApi":true,"autoupdate":false,"ttl":null,"maxId":207,"DynamicViews":[],"events":{"insert":[null],"update":[null],"pre-insert":[],"pre-update":[],"close":[],"flushbuffer":[],"error":[],"delete":[null],"warning":[null]},"changes":[]}],"databaseVersion":1.1,"engineVersion":1.1,"autosave":false,"autosaveInterval":5000,"autosaveHandle":null,"throttledSaves":true,"options":{"serializationMethod":"normal","destructureDelimiter":"$<\n"},"persistenceMethod":"fs","persistenceAdapter":null,"verbose":false,"events":{"init":[null],"loaded":[],"flushChanges":[],"close":[],"changes":[],"warning":[]},"ENV":"NODEJS"} | ||
{"filename":"/Users/yawetse/Developer/github/typesettin/lowkie/example/sampledb.json","collections":[{"name":"kittens","data":[],"idIndex":[201,202,208,209],"binaryIndices":{},"constraints":null,"uniqueNames":[],"transforms":{},"objType":"kittens","dirty":true,"cachedIndex":null,"cachedBinaryIndex":null,"cachedData":null,"adaptiveBinaryIndices":true,"transactional":false,"cloneObjects":false,"cloneMethod":"parse-stringify","asyncListeners":false,"disableChangesApi":true,"autoupdate":false,"ttl":null,"maxId":209,"DynamicViews":[],"events":{"insert":[null],"update":[null],"pre-insert":[],"pre-update":[],"close":[],"flushbuffer":[],"error":[],"delete":[null],"warning":[null]},"changes":[]}],"databaseVersion":1.1,"engineVersion":1.1,"autosave":false,"autosaveInterval":5000,"autosaveHandle":null,"throttledSaves":true,"options":{"serializationMethod":"normal","destructureDelimiter":"$<\n"},"persistenceMethod":"fs","persistenceAdapter":null,"verbose":false,"events":{"init":[null],"loaded":[],"flushChanges":[],"close":[],"changes":[],"warning":[]},"ENV":"NODEJS"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
{"name":"king0.2726792766487611","entitytype":"kat","_id":"fbd8080a9272ecaa15d1bb6d0f4b3314","meta":{"revision":0,"created":1490576236063,"version":0},"$loki":201} | ||
{"name":"prince0.8735373934837287","entitytype":"kat","description":10983021,"_id":"d48e3dde06a8e758b6afa6bf2d103cb2","meta":{"revision":0,"created":1490576507732,"version":0},"$loki":202} | ||
{"name":"queen0.8482004465847226","entitytype":"kat","description":10983021,"_id":"80a605aae9ecb2599b176f1e92dc64e8","meta":{"revision":0,"created":1490632925062,"version":0},"$loki":208} | ||
{"name":"jester0.26873625459623796","entitytype":"kat","_id":"fdf9c37302d3a58538bea96d72584632","meta":{"revision":0,"created":1490632930071,"version":0},"$loki":209} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
'use strict'; | ||
const events = require('events'); | ||
const lowkieSchema = require('./schema'); | ||
const lowkieModel = require('./model'); | ||
const lowkieConnect = require('./connect'); | ||
const lowkieProxyHandler = require('./lowkieProxyHandler'); | ||
/** | ||
* lowkie ORM singleton class | ||
* | ||
* @class lowkie | ||
*/ | ||
class lowkie { | ||
/** | ||
* Creates an instance of lowkie. | ||
* @param {any} [options={}] | ||
* | ||
* @memberOf lowkie | ||
*/ | ||
constructor(options = {}) { | ||
this.config = Object.assign({ | ||
adapterType: 'file', | ||
debug: false, | ||
strictSchemas: true, | ||
}, options); | ||
this.connections = new Map(); | ||
this.db = undefined; | ||
this.models = undefined; | ||
this.connection = new events.EventEmitter(); | ||
this.model = lowkieModel.bind(this); | ||
this.connect = lowkieConnect.bind(this); | ||
this.Schema.Types = lowkieSchema.Types; | ||
return new Proxy(this, lowkieProxyHandler.call(this)); | ||
} | ||
/** | ||
* creates lowkie schema, also includes helpers for document validations | ||
* | ||
* @param {object} scheme | ||
* @returns instance of lowkieSchema | ||
* | ||
* @memberOf lowkie | ||
*/ | ||
Schema(scheme) { | ||
return new lowkieSchema(scheme, this); | ||
} | ||
} | ||
|
||
module.exports = lowkie; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters