Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Space api #51

Merged
merged 3 commits into from
Dec 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions lib/api.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const DB = require("./db/db").DB;
const Client = require("./websocket/websocket-client");
const Realtime = require("./realtime/realtime");
const Service = require('./functions');
const FileStore = require("./filestore/filestore");
const Pubsub = require("./pubsub/pubsub");
const fetchAsync = require("./utils").fetchAsync;
Expand Down Expand Up @@ -94,6 +93,10 @@ class Api {
return new DB(this.appId, this.url, this.options, "sql-mysql", this.realTime);
}

DB(db) {
return new DB(this.appId, this.url, this.options, db, this.realTime);
}

/**
* Calls a function from Function as a Service Engine
* @param {string} engineName - The name of engine with which the function is registered
Expand All @@ -114,20 +117,16 @@ class Api {
* });
*/

call(service, func, params, timeout) {
call(service, endpoint, params, timeout) {
if (timeout === undefined) timeout = 5000;
const url = `${this.url}v1/api/${this.appId}/functions/${service}/${func}`;
const url = `${this.url}v1/api/${this.appId}/functions/${service}/${endpoint}`;
const options = Object.assign({}, this.options, {
method: "POST",
body: JSON.stringify({ timeout: timeout, params: params })
});
return fetchAsync(url, options);
}

Service(service) {
return new Service(this.serviceOptions, this.client, service)
}

/**
* Returns a FileStore client instance
* @returns {external:FileStore} FileStore client instance
Expand Down
5 changes: 4 additions & 1 deletion lib/db/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ class Get {
this.params.find = db.generateFind(and(...conditions));
return this;
}

whereRaw(condition) {
this.params.find = condition;
return this;
}
/**
* Sets the fields to be selected
* @param {Object} select - The select object.
Expand Down
59 changes: 0 additions & 59 deletions lib/functions/index.js

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "space-api",
"version": "0.12.1",
"version": "0.15.0",
"description": "",
"main": "dist/index.js",
"scripts": {
Expand Down