syncano-server
Advanced tools
Comparing version 0.7.2-2 to 0.7.2-3
@@ -23,2 +23,6 @@ 'use strict'; | ||
var _instance = require('./instance'); | ||
var _instance2 = _interopRequireDefault(_instance); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -29,3 +33,3 @@ | ||
var instance = function instance(className) { | ||
var instanceConfig = function instanceConfig(className) { | ||
var config = _extends({}, options, { className: className }); | ||
@@ -44,5 +48,6 @@ | ||
var users = new _users2.default(); | ||
users.instance = instance(); | ||
users.instance = instanceConfig(); | ||
var account = new _account2.default(); | ||
var account = new _account2.default({ accountKey: options.accountKey }); | ||
var instance = new _instance2.default({ accountKey: options.accountKey }); | ||
@@ -52,2 +57,3 @@ return { | ||
account: account, | ||
instance: instance, | ||
data: new Proxy(new _data2.default(), { | ||
@@ -57,3 +63,3 @@ get: function get(target, className) { | ||
data.instance = instance(className); | ||
data.instance = instanceConfig(className); | ||
@@ -60,0 +66,0 @@ return data; |
@@ -6,3 +6,3 @@ 'use strict'; | ||
}); | ||
var SYNCANO_HOST = exports.SYNCANO_HOST = undefined || 'api.syncano.io'; | ||
var SYNCANO_HOST = exports.SYNCANO_HOST = 'api.syncano.rocks' || 'api.syncano.io'; | ||
var SYNCANO_API_VERSION = exports.SYNCANO_API_VERSION = 'v2'; |
{ | ||
"name": "syncano-server", | ||
"version": "0.7.2-2", | ||
"version": "0.7.2-3", | ||
"description": "A library to intereact with the Syncano API on a server side", | ||
@@ -23,3 +23,3 @@ "main": "lib/index.js", | ||
"test:unit": "cross-env NODE_ENV=test nyc yarn run unit", | ||
"lint": "xo src/**/*.js", | ||
"lint": "xo src/**/*.js test/**/*.js", | ||
"test:coverage": "nyc npm test && nyc report --reporter=text-lcov > coverage.lcov && codecov", | ||
@@ -54,2 +54,3 @@ "e2e": "mkdir -p e2e-tests/ && cross-env NODE_ENV=test mocha 'test/e2e/*.js' --reporter spec --require babel-register --timeout 30000 --slow 8000", | ||
"babel-register": "^6.5.1", | ||
"chai": "^3.5.0", | ||
"codecov": "^1.0.1", | ||
@@ -80,4 +81,14 @@ "cross-env": "^3.1.4", | ||
"CONFIG" | ||
], | ||
"overrides": [ | ||
{ | ||
"files": "test/**/*.js", | ||
"rules": { | ||
"prefer-arrow-callback": [ | ||
"off" | ||
] | ||
} | ||
} | ||
] | ||
} | ||
} |
import Data from './data' | ||
import Users from './users' | ||
import Account from './account' | ||
import Instance from './instance' | ||
export default function server(options = {}) { | ||
const instance = className => { | ||
const instanceConfig = className => { | ||
let config = {...options, className} | ||
@@ -20,5 +21,6 @@ | ||
const users = new Users() | ||
users.instance = instance() | ||
users.instance = instanceConfig() | ||
const account = new Account() | ||
const account = new Account({accountKey: options.accountKey}) | ||
const instance = new Instance({accountKey: options.accountKey}) | ||
@@ -28,2 +30,3 @@ return { | ||
account, | ||
instance, | ||
data: new Proxy(new Data(), { | ||
@@ -33,3 +36,3 @@ get(target, className) { | ||
data.instance = instance(className) | ||
data.instance = instanceConfig(className) | ||
@@ -36,0 +39,0 @@ return data |
Sorry, the diff of this file is not supported yet
273024
33
1088
23
10