react-native-mosquito-transport 0.0.17 → 0.0.18
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-mosquito-transport",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.18",
|
|
4
4
|
"description": "React native javascript sdk for mosquito-transport (https://github.com/deflexable/mosquito-transport)",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
"javascript",
|
|
16
16
|
"selfhosted",
|
|
17
17
|
"serverless",
|
|
18
|
-
"Baas",
|
|
19
18
|
"database",
|
|
20
19
|
"react-native",
|
|
21
20
|
"mongodb"
|
|
@@ -32,7 +31,7 @@
|
|
|
32
31
|
"buffer": "^6.0.3",
|
|
33
32
|
"crypto-js": "^4.2.0",
|
|
34
33
|
"fast-json-stable-stringify": "^2.1.0",
|
|
35
|
-
"guard-object": "^1.0.
|
|
34
|
+
"guard-object": "^1.0.7",
|
|
36
35
|
"json-buffer": "^3.0.1",
|
|
37
36
|
"lodash.get": "^4.4.2",
|
|
38
37
|
"lodash.isequal": "^4.5.0",
|
|
@@ -36,8 +36,9 @@ export const insertRecord = async (builder, accessId, query, value) => {
|
|
|
36
36
|
kaf = `${objToUniqueString(extraction || {})},${(excludeFields || []).join(',')},${(returnOnly || []).join(',')}`,
|
|
37
37
|
colData = getLodash(CacheStore.DatabaseStore, [projectUrl, dbUrl, dbName, path, 'data', kaf], []);
|
|
38
38
|
|
|
39
|
+
// TODO:
|
|
39
40
|
(Array.isArray(value) ? value : [value]).forEach(e => {
|
|
40
|
-
const b4DocIndex = colData.findIndex(v => v
|
|
41
|
+
const b4DocIndex = colData.findIndex(v => v?._id === e?._id);
|
|
41
42
|
if (b4DocIndex === -1) {
|
|
42
43
|
colData.push(e);
|
|
43
44
|
} else colData[b4DocIndex] = e;
|
|
@@ -150,7 +150,7 @@ const listenDocument = (callback, onError, builder, config) => {
|
|
|
150
150
|
const mtoken = disableAuth ? undefined : Scoped.AuthJWTToken[projectUrl],
|
|
151
151
|
authObj = {
|
|
152
152
|
commands: {
|
|
153
|
-
config,
|
|
153
|
+
config: stripRequestConfig(config),
|
|
154
154
|
path,
|
|
155
155
|
find: findOne || find,
|
|
156
156
|
sort,
|
|
@@ -368,6 +368,14 @@ const countCollection = async (builder, config) => {
|
|
|
368
368
|
return g;
|
|
369
369
|
}
|
|
370
370
|
|
|
371
|
+
const stripRequestConfig = (config) => {
|
|
372
|
+
const known_fields = ['extraction', 'returnOnly', 'excludeFields'];
|
|
373
|
+
const requestConfig = Object.entries({ ...config }).map(([k, v]) =>
|
|
374
|
+
known_fields.includes(k) ? [k, v] : null
|
|
375
|
+
).filter(v => v);
|
|
376
|
+
return requestConfig.length ? Object.fromEntries(requestConfig) : undefined;
|
|
377
|
+
}
|
|
378
|
+
|
|
371
379
|
const findObject = async (builder, config) => {
|
|
372
380
|
const { projectUrl, serverE2E_PublicKey, dbUrl, dbName, accessKey, maxRetries = 7, path, disableCache, uglify, command } = builder,
|
|
373
381
|
{ find, findOne, sort, direction, limit, random } = command,
|
|
@@ -445,7 +453,15 @@ const findObject = async (builder, config) => {
|
|
|
445
453
|
|
|
446
454
|
const [reqBuilder, [privateKey]] = buildFetchInterface({
|
|
447
455
|
body: {
|
|
448
|
-
commands: {
|
|
456
|
+
commands: {
|
|
457
|
+
config: stripRequestConfig(config),
|
|
458
|
+
path,
|
|
459
|
+
find: findOne || find,
|
|
460
|
+
sort,
|
|
461
|
+
direction,
|
|
462
|
+
limit,
|
|
463
|
+
random
|
|
464
|
+
},
|
|
449
465
|
dbName,
|
|
450
466
|
dbUrl
|
|
451
467
|
},
|