@teamplay/backend 0.3.1 → 0.3.3

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.
@@ -1,4 +1,4 @@
1
- import ShareDbMingoMemory from 'sharedb-mingo-memory'
1
+ import ShareDbMingoMemory from './sharedbMingo.js'
2
2
  import { getExistingSqliteDb, loadSqliteDbToMingo } from './utils.js'
3
3
 
4
4
  export const db = await getMingoDb({
@@ -1,7 +1,7 @@
1
- import ShareDbMingoMemory from 'sharedb-mingo-memory'
2
1
  import { resolve } from 'path'
3
2
  import sqlite3 from 'sqlite3'
4
3
  import uuid from '@teamplay/utils/uuid'
4
+ import ShareDbMingoMemory from './sharedbMingo.js'
5
5
  import { loadSqliteDbToMingo, getExistingSqliteDb } from './utils.js'
6
6
 
7
7
  const DEFAULT_DB_PATH = './local.db'
package/db/mongo.js CHANGED
@@ -29,7 +29,7 @@ function getMongoDb ({ url, optsString, sslKeyPath, sslCertPath, sslCaPath }) {
29
29
  return {
30
30
  db: ShareDbMongo({
31
31
  mongo: callback => callback(null, mongoClient),
32
- allowAllQueries: true
32
+ allowAggregateQueries: true
33
33
  }),
34
34
  mongo,
35
35
  mongoClient,
@@ -0,0 +1,17 @@
1
+ import ShareDbMingo from 'sharedb-mingo-memory'
2
+
3
+ // patch ShareDbMingo to properly support aggregations
4
+ let patched
5
+ function patchSharedbMingoAggregations () {
6
+ if (patched) return
7
+ patched = true
8
+ const oldCanPollDoc = ShareDbMingo.prototype.canPollDoc
9
+ ShareDbMingo.prototype.canPollDoc = function (collection, query) {
10
+ if (query.hasOwnProperty('$aggregate')) return false // eslint-disable-line no-prototype-builtins
11
+ return oldCanPollDoc.call(this, collection, query)
12
+ }
13
+ }
14
+
15
+ patchSharedbMingoAggregations()
16
+
17
+ export default ShareDbMingo
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamplay/backend",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "Create new ShareDB backend instance",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -12,11 +12,11 @@
12
12
  ".": "./index.js"
13
13
  },
14
14
  "dependencies": {
15
- "@teamplay/schema": "^0.3.1",
16
- "@teamplay/server-aggregate": "^0.3.1",
17
- "@teamplay/sharedb-access": "^0.3.1",
18
- "@teamplay/sharedb-schema": "^0.3.1",
19
- "@teamplay/utils": "^0.3.1",
15
+ "@teamplay/schema": "^0.3.3",
16
+ "@teamplay/server-aggregate": "^0.3.3",
17
+ "@teamplay/sharedb-access": "^0.3.3",
18
+ "@teamplay/sharedb-schema": "^0.3.3",
19
+ "@teamplay/utils": "^0.3.3",
20
20
  "@types/ioredis-mock": "^8.2.5",
21
21
  "ioredis": "^5.3.2",
22
22
  "ioredis-mock": "^8.9.0",
@@ -29,5 +29,5 @@
29
29
  "sharedb-redis-pubsub": "^2.0.1",
30
30
  "sqlite3": "^5.1.6"
31
31
  },
32
- "gitHead": "cc2715ccbfdf6213abc607aceaae76c331a7738d"
32
+ "gitHead": "3cb65f144eafd59cbb646328e503f4747df98279"
33
33
  }