@rpcbase/server 0.17.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/database.js +16 -0
- package/express/session.js +1 -1
- package/index.js +7 -2
- package/mongoose/index.js +8 -0
- package/mongoose/rts_delete_plugin.js +12 -0
- package/package.json +2 -1
package/database.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* @flow */
|
|
2
|
+
const mongoose = require("mongoose")
|
|
3
|
+
const validator = require("validator")
|
|
4
|
+
|
|
5
|
+
const {DATABASE_PORT} = process.env
|
|
6
|
+
|
|
7
|
+
if (typeof DATABASE_PORT === "string" && !validator.isPort(DATABASE_PORT)) {
|
|
8
|
+
throw new Error("expected DATABASE_PORT to be a valid port number")
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const mongo_url = `mongodb://database:${DATABASE_PORT}/commit-queue`
|
|
12
|
+
|
|
13
|
+
module.exports = async() => {
|
|
14
|
+
const ret = await mongoose.connect(mongo_url)
|
|
15
|
+
// TODO: handle connection ret
|
|
16
|
+
}
|
package/express/session.js
CHANGED
|
@@ -6,7 +6,7 @@ const redis_store = require("connect-redis")(session)
|
|
|
6
6
|
|
|
7
7
|
const {SESSION_STORE_PORT} = process.env
|
|
8
8
|
|
|
9
|
-
if (!validator.isPort(SESSION_STORE_PORT)) {
|
|
9
|
+
if (typeof SESSION_STORE_PORT === "string" && !validator.isPort(SESSION_STORE_PORT)) {
|
|
10
10
|
throw new Error("expected SESSION_STORE_PORT to be a valid port number")
|
|
11
11
|
}
|
|
12
12
|
|
package/index.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
/* @flow */
|
|
2
|
-
const rpc_router = require("./rpc/rpc_router")
|
|
3
2
|
const client_router = require("./client/client_router")
|
|
3
|
+
const database = require("./database")
|
|
4
4
|
const express = require("./express")
|
|
5
|
+
const mongoose = require("./mongoose")
|
|
6
|
+
const rpc_router = require("./rpc/rpc_router")
|
|
7
|
+
|
|
5
8
|
|
|
6
9
|
module.exports = {
|
|
10
|
+
client_router,
|
|
11
|
+
database,
|
|
7
12
|
express,
|
|
13
|
+
mongoose,
|
|
8
14
|
rpc_router,
|
|
9
|
-
client_router,
|
|
10
15
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* @flow */
|
|
2
|
+
|
|
3
|
+
// fixes the mongodb issue with missing fullDocument in change streams
|
|
4
|
+
// that is required for dispatching to proper sockets in real time state
|
|
5
|
+
|
|
6
|
+
module.exports = (schema, options) => {
|
|
7
|
+
console.log("MONGOOSE DELETE PLUGIN")
|
|
8
|
+
|
|
9
|
+
schema.post(["deleteOne"], (arg, arg2) => {
|
|
10
|
+
console.log("DELETE WOWO", arg, arg2)
|
|
11
|
+
})
|
|
12
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rpcbase/server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"license": "SSPL-1.0",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"bin": {
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"express": "4.17.2",
|
|
17
17
|
"express-session": "1.17.2",
|
|
18
18
|
"glob": "7.2.0",
|
|
19
|
+
"mongoose": "6.1.5",
|
|
19
20
|
"redis": "3.1.2",
|
|
20
21
|
"validator": "13.7.0",
|
|
21
22
|
"yargs": "17.3.1"
|