Skip to content

Commit 6cbb5ff

Browse files
khannaabhiYourTechBud
authored andcommitted
Space api (#51)
* deleted function module * DB alias * whereRaw
1 parent b904806 commit 6cbb5ff

File tree

4 files changed

+11
-68
lines changed

4 files changed

+11
-68
lines changed

lib/api.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
const DB = require("./db/db").DB;
22
const Client = require("./websocket/websocket-client");
33
const Realtime = require("./realtime/realtime");
4-
const Service = require('./functions');
54
const FileStore = require("./filestore/filestore");
65
const Pubsub = require("./pubsub/pubsub");
76
const fetchAsync = require("./utils").fetchAsync;
@@ -94,6 +93,10 @@ class Api {
9493
return new DB(this.appId, this.url, this.options, "sql-mysql", this.realTime);
9594
}
9695

96+
DB(db) {
97+
return new DB(this.appId, this.url, this.options, db, this.realTime);
98+
}
99+
97100
/**
98101
* Calls a function from Function as a Service Engine
99102
* @param {string} engineName - The name of engine with which the function is registered
@@ -114,20 +117,16 @@ class Api {
114117
* });
115118
*/
116119

117-
call(service, func, params, timeout) {
120+
call(service, endpoint, params, timeout) {
118121
if (timeout === undefined) timeout = 5000;
119-
const url = `${this.url}v1/api/${this.appId}/functions/${service}/${func}`;
122+
const url = `${this.url}v1/api/${this.appId}/functions/${service}/${endpoint}`;
120123
const options = Object.assign({}, this.options, {
121124
method: "POST",
122125
body: JSON.stringify({ timeout: timeout, params: params })
123126
});
124127
return fetchAsync(url, options);
125128
}
126129

127-
Service(service) {
128-
return new Service(this.serviceOptions, this.client, service)
129-
}
130-
131130
/**
132131
* Returns a FileStore client instance
133132
* @returns {external:FileStore} FileStore client instance

lib/db/get.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ class Get {
5151
this.params.find = db.generateFind(and(...conditions));
5252
return this;
5353
}
54-
54+
whereRaw(condition) {
55+
this.params.find = condition;
56+
return this;
57+
}
5558
/**
5659
* Sets the fields to be selected
5760
* @param {Object} select - The select object.

lib/functions/index.js

Lines changed: 0 additions & 59 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "space-api",
3-
"version": "0.12.1",
3+
"version": "0.15.0",
44
"description": "",
55
"main": "dist/index.js",
66
"scripts": {

0 commit comments

Comments
 (0)