Update dependencies
This commit is contained in:
1 parent
afd1a61696
commit
24b047bd5e
11 files changed
+7606
-88
No files matched your search
+1
-1
@@ -1,3 +1,3 @@
|
||||
*~
|
||||
node_modules
|
||||
public
|
||||
dist
|
||||
+50
-55
@@ -245,17 +245,16 @@ function fulfill(accessTimestamp, _fulfillTimestamp) {
|
||||
updated = true;
|
||||
let filter = queries.filter.get(queryResponse);
|
||||
filter = unpackExpression(filter);
|
||||
m
|
||||
.request({
|
||||
method: "HEAD",
|
||||
url:
|
||||
`/api/${resourceType}/?` +
|
||||
m.buildQueryString({
|
||||
filter: funcCache.get(expression.stringify, filter)
|
||||
}),
|
||||
extract: xhr => +xhr.getResponseHeader("x-total-count"),
|
||||
background: true
|
||||
})
|
||||
m.request({
|
||||
method: "HEAD",
|
||||
url:
|
||||
`/api/${resourceType}/?` +
|
||||
m.buildQueryString({
|
||||
filter: funcCache.get(expression.stringify, filter)
|
||||
}),
|
||||
extract: xhr => +xhr.getResponseHeader("x-total-count"),
|
||||
background: true
|
||||
})
|
||||
.then(c => {
|
||||
queries.value.set(queryResponse, c);
|
||||
queries.fulfilled.set(queryResponse, fulfillTimestamp);
|
||||
@@ -291,19 +290,18 @@ function fulfill(accessTimestamp, _fulfillTimestamp) {
|
||||
updated = true;
|
||||
let filter = queries.filter.get(queryResponse);
|
||||
filter = unpackExpression(filter);
|
||||
m
|
||||
.request({
|
||||
method: "GET",
|
||||
url:
|
||||
`/api/${resourceType}/?` +
|
||||
m.buildQueryString({
|
||||
filter: funcCache.get(expression.stringify, filter),
|
||||
limit: 1,
|
||||
skip: limit - 1,
|
||||
sort: JSON.stringify(sort),
|
||||
projection: Object.keys(sort).join(",")
|
||||
})
|
||||
})
|
||||
m.request({
|
||||
method: "GET",
|
||||
url:
|
||||
`/api/${resourceType}/?` +
|
||||
m.buildQueryString({
|
||||
filter: funcCache.get(expression.stringify, filter),
|
||||
limit: 1,
|
||||
skip: limit - 1,
|
||||
sort: JSON.stringify(sort),
|
||||
projection: Object.keys(sort).join(",")
|
||||
})
|
||||
})
|
||||
.then(res => {
|
||||
if (res.length) {
|
||||
// Generate bookmark object
|
||||
@@ -379,18 +377,17 @@ function fulfill(accessTimestamp, _fulfillTimestamp) {
|
||||
|
||||
allPromises2.push(
|
||||
new Promise((resolve2, reject2) => {
|
||||
m
|
||||
.request({
|
||||
method: "GET",
|
||||
url:
|
||||
`/api/${resourceType}/?` +
|
||||
m.buildQueryString({
|
||||
filter: funcCache.get(
|
||||
expression.stringify,
|
||||
combinedFilterDiff
|
||||
)
|
||||
})
|
||||
})
|
||||
m.request({
|
||||
method: "GET",
|
||||
url:
|
||||
`/api/${resourceType}/?` +
|
||||
m.buildQueryString({
|
||||
filter: funcCache.get(
|
||||
expression.stringify,
|
||||
combinedFilterDiff
|
||||
)
|
||||
})
|
||||
})
|
||||
.then(res => {
|
||||
for (let r of res) {
|
||||
const id =
|
||||
@@ -453,26 +450,24 @@ function postTasks(deviceId, tasks) {
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
m
|
||||
.request({
|
||||
method: "POST",
|
||||
url: `/api/devices/${encodeURIComponent(deviceId)}/tasks`,
|
||||
data: tasks,
|
||||
extract: xhr => {
|
||||
if (xhr.status !== 200) throw new Error(xhr.response);
|
||||
const connectionRequestStatus = xhr.getResponseHeader(
|
||||
"Connection-Request"
|
||||
);
|
||||
let st = JSON.parse(xhr.response);
|
||||
for (let [i, t] of st.entries()) {
|
||||
tasks[i]._id = t._id;
|
||||
tasks[i].status = t.status;
|
||||
tasks[i].fault = t.fault;
|
||||
}
|
||||
resolve(connectionRequestStatus);
|
||||
m.request({
|
||||
method: "POST",
|
||||
url: `/api/devices/${encodeURIComponent(deviceId)}/tasks`,
|
||||
data: tasks,
|
||||
extract: xhr => {
|
||||
if (xhr.status !== 200) throw new Error(xhr.response);
|
||||
const connectionRequestStatus = xhr.getResponseHeader(
|
||||
"Connection-Request"
|
||||
);
|
||||
let st = JSON.parse(xhr.response);
|
||||
for (let [i, t] of st.entries()) {
|
||||
tasks[i]._id = t._id;
|
||||
tasks[i].status = t.status;
|
||||
tasks[i].fault = t.fault;
|
||||
}
|
||||
})
|
||||
.catch(reject);
|
||||
resolve(connectionRequestStatus);
|
||||
}
|
||||
}).catch(reject);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
File renamed without changes.
File renamed without changes.
Generated
+7472
File diff suppressed because it is too large.
Load diff
+21
-18
@@ -4,31 +4,34 @@
|
||||
"description": "",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"lint": "eslint --fix common/*.js common/validators/*.js server/*.js client/*.js client/components/*.js;prettier --write common/*.js common/validators/*.js server/*.js client/*.js client/components/*.js client/css/*.css",
|
||||
"build": "npm run lint;webpack;postcss -c postcss.config.js client/css/app.css -o public/app.css",
|
||||
"start": "node server/server"
|
||||
"lint": "eslint --fix common/*.js common/validators/*.js server/*.js client/*.js client/components/*.js;prettier --write *.js common/*.js common/validators/*.js server/*.js client/*.js client/components/*.js client/css/*.css",
|
||||
"build": "npm run lint;webpack;postcss -c postcss.config.js client/css/app.css -o dist/public/app.css",
|
||||
"start": "cd dist && node server"
|
||||
},
|
||||
"author": "Zaid Abdulla <zaid@genieacs.com>",
|
||||
"dependencies": {
|
||||
"jsonwebtoken": "^8.2.1",
|
||||
"koa": "^2.5.0",
|
||||
"koa-body": "^2.5.0",
|
||||
"koa-bodyparser": "^4.2.0",
|
||||
"koa-compress": "^2.0.0",
|
||||
"koa-jwt": "^3.3.1",
|
||||
"jsonwebtoken": "^8.3.0",
|
||||
"koa": "^2.5.2",
|
||||
"koa-bodyparser": "^4.2.1",
|
||||
"koa-compress": "^3.0.0",
|
||||
"koa-jwt": "^3.3.2",
|
||||
"koa-router": "^7.4.0",
|
||||
"koa-static": "^4.0.2",
|
||||
"mithril": "^1.1.6",
|
||||
"mongodb": "^3.0.10",
|
||||
"parsimmon": "^1.7.2"
|
||||
"koa-static": "^5.0.0",
|
||||
"mongodb": "^3.1.1",
|
||||
"parsimmon": "^1.12.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"cssnano": "^3.10.0",
|
||||
"eslint": "^4.19.1",
|
||||
"postcss-cli": "^4.1.1",
|
||||
"clean-webpack-plugin": "^0.1.19",
|
||||
"copy-webpack-plugin": "^4.5.2",
|
||||
"cssnano": "^4.0.5",
|
||||
"eslint": "^5.2.0",
|
||||
"mithril": "^1.1.6",
|
||||
"postcss-cli": "^6.0.0",
|
||||
"postcss-cssnext": "^3.1.0",
|
||||
"postcss-import": "^11.1.0",
|
||||
"prettier": "^1.11.1",
|
||||
"webpack": "^3.11.0"
|
||||
"prettier": "^1.14.0",
|
||||
"webpack": "^4.16.3",
|
||||
"webpack-cli": "^3.1.0",
|
||||
"webpack-node-externals": "^1.7.2"
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
module.exports = {
|
||||
plugins: [
|
||||
require("postcss-import"),
|
||||
require("postcss-cssnext")({warnForDuplicates: false}),
|
||||
require("postcss-cssnext")({ warnForDuplicates: false }),
|
||||
require("cssnano")
|
||||
]
|
||||
}
|
||||
};
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
const configFile = require("../config.json");
|
||||
const fs = require("fs");
|
||||
const configFile = JSON.parse(fs.readFileSync("./config.json"));
|
||||
|
||||
let config;
|
||||
|
||||
|
||||
+8
-4
@@ -21,10 +21,14 @@ function getClient(db) {
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const CONNECTION_URL = config.server.mongodbConnectionUrl;
|
||||
mongodb.MongoClient.connect(CONNECTION_URL, (err, client) => {
|
||||
if (err) return reject(err);
|
||||
resolve((_client[db] = client.db(db)));
|
||||
});
|
||||
mongodb.MongoClient.connect(
|
||||
CONNECTION_URL,
|
||||
{ useNewUrlParser: true },
|
||||
(err, client) => {
|
||||
if (err) return reject(err);
|
||||
resolve((_client[db] = client.db(db)));
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ const Koa = require("koa");
|
||||
const Router = require("koa-router");
|
||||
const koaStatic = require("koa-static");
|
||||
const koaCompress = require("koa-compress");
|
||||
const koaBody = require("koa-body");
|
||||
const koaBodyParser = require("koa-bodyparser");
|
||||
const koaJwt = require("koa-jwt");
|
||||
const jwt = require("jsonwebtoken");
|
||||
|
||||
@@ -81,7 +81,7 @@ router.post("/logout", async ctx => {
|
||||
ctx.body = "";
|
||||
});
|
||||
|
||||
koa.use(koaBody());
|
||||
koa.use(koaBodyParser());
|
||||
router.use("/api", api.routes(), api.allowedMethods());
|
||||
|
||||
router.get("/", async ctx => {
|
||||
|
||||
+48
-5
@@ -1,6 +1,49 @@
|
||||
module.exports = {
|
||||
entry: "./client/app.js",
|
||||
output: {
|
||||
filename: "public/app.js"
|
||||
const nodeExternals = require("webpack-node-externals");
|
||||
const CopyWebpackPlugin = require("copy-webpack-plugin");
|
||||
const CleanWebpackPlugin = require("clean-webpack-plugin");
|
||||
|
||||
const mode = "production";
|
||||
|
||||
function transformPackageJson(content) {
|
||||
const pkg = JSON.parse(content);
|
||||
delete pkg["devDependencies"];
|
||||
pkg["scripts"] = {
|
||||
start: "node server"
|
||||
};
|
||||
return JSON.stringify(pkg, null, 2);
|
||||
}
|
||||
|
||||
module.exports = [
|
||||
{
|
||||
mode: mode,
|
||||
entry: "./server/server.js",
|
||||
target: "node",
|
||||
externals: [nodeExternals()],
|
||||
output: {
|
||||
filename: "server.js"
|
||||
},
|
||||
plugins: [
|
||||
new CleanWebpackPlugin(["dist"]),
|
||||
new CopyWebpackPlugin(
|
||||
[
|
||||
{ from: "images/logo.svg", to: "public/logo.svg" },
|
||||
{ from: "images/favicon.png", to: "public/favicon.png" },
|
||||
{ from: "config.json", to: "config.json" },
|
||||
{
|
||||
from: "package.json",
|
||||
to: "package.json",
|
||||
transform: transformPackageJson
|
||||
}
|
||||
],
|
||||
{}
|
||||
)
|
||||
]
|
||||
},
|
||||
{
|
||||
mode: mode,
|
||||
entry: "./client/app.js",
|
||||
output: {
|
||||
filename: "public/app.js"
|
||||
}
|
||||
}
|
||||
};
|
||||
];
|
||||
Reference in new issue
Block a user