@lowdefy/connection-mongodb 4.0.0-rc.0 → 4.0.0-rc.10
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/dist/auth/adapters/MongoDBAdapter/MongoDBAdapter.js +4 -4
- package/dist/connections/MongoDBCollection/MongoDBAggregation/MongoDBAggregation.js +5 -5
- package/dist/connections/MongoDBCollection/MongoDBAggregation/schema.js +1 -1
- package/dist/connections/MongoDBCollection/MongoDBCollection.js +1 -1
- package/dist/connections/MongoDBCollection/MongoDBDeleteMany/MongoDBDeleteMany.js +7 -7
- package/dist/connections/MongoDBCollection/MongoDBDeleteMany/schema.js +1 -1
- package/dist/connections/MongoDBCollection/MongoDBDeleteOne/MongoDBDeleteOne.js +9 -12
- package/dist/connections/MongoDBCollection/MongoDBDeleteOne/schema.js +1 -1
- package/dist/connections/MongoDBCollection/MongoDBFind/MongoDBFind.js +4 -4
- package/dist/connections/MongoDBCollection/MongoDBFind/schema.js +1 -1
- package/dist/connections/MongoDBCollection/MongoDBFindOne/MongoDBFindOne.js +4 -4
- package/dist/connections/MongoDBCollection/MongoDBFindOne/schema.js +1 -1
- package/dist/connections/MongoDBCollection/MongoDBInsertMany/MongoDBInsertMany.js +6 -6
- package/dist/connections/MongoDBCollection/MongoDBInsertMany/schema.js +1 -1
- package/dist/connections/MongoDBCollection/MongoDBInsertOne/MongoDBInsertOne.js +6 -6
- package/dist/connections/MongoDBCollection/MongoDBInsertOne/schema.js +1 -1
- package/dist/connections/MongoDBCollection/MongoDBUpdateMany/MongoDBUpdateMany.js +6 -6
- package/dist/connections/MongoDBCollection/MongoDBUpdateMany/schema.js +1 -1
- package/dist/connections/MongoDBCollection/MongoDBUpdateOne/MongoDBUpdateOne.js +10 -15
- package/dist/connections/MongoDBCollection/MongoDBUpdateOne/schema.js +1 -1
- package/dist/connections/MongoDBCollection/getCollection.js +3 -3
- package/dist/connections/MongoDBCollection/schema.js +1 -1
- package/dist/connections/MongoDBCollection/serialize.js +8 -22
- package/dist/connections.js +1 -1
- package/dist/types.js +1 -1
- package/package.json +14 -13
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -23,9 +23,9 @@ Default collections are:
|
|
|
23
23
|
VerificationTokens: "verification_tokens",
|
|
24
24
|
}
|
|
25
25
|
*/ // TODO: Docs: MongoDB database name should be in databaseUri
|
|
26
|
-
function MongoDBAdapter({ properties
|
|
27
|
-
const { databaseUri
|
|
26
|
+
function MongoDBAdapter({ properties }) {
|
|
27
|
+
const { databaseUri, mongoDBClientOptions, options } = properties;
|
|
28
28
|
const clientPromise = new MongoClient(databaseUri, mongoDBClientOptions).connect();
|
|
29
|
-
return NextAuthMongoDBAdapter(clientPromise,
|
|
29
|
+
return NextAuthMongoDBAdapter(clientPromise, options);
|
|
30
30
|
}
|
|
31
31
|
export default MongoDBAdapter;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/ import getCollection from '../getCollection.js';
|
|
16
16
|
import { serialize, deserialize } from '../serialize.js';
|
|
17
17
|
import schema from './schema.js';
|
|
18
|
-
function checkOutAndMerge({ pipeline
|
|
18
|
+
function checkOutAndMerge({ pipeline, connection }) {
|
|
19
19
|
if (connection.write !== true) {
|
|
20
20
|
pipeline.forEach((stage)=>{
|
|
21
21
|
if (stage.$out != null || stage.$merge != null) {
|
|
@@ -24,14 +24,14 @@ function checkOutAndMerge({ pipeline , connection }) {
|
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
async function MongodbAggregation({ request
|
|
27
|
+
async function MongodbAggregation({ request, connection }) {
|
|
28
28
|
const deserializedRequest = deserialize(request);
|
|
29
|
-
const { pipeline
|
|
29
|
+
const { pipeline, options } = deserializedRequest;
|
|
30
30
|
checkOutAndMerge({
|
|
31
31
|
pipeline,
|
|
32
32
|
connection
|
|
33
33
|
});
|
|
34
|
-
const { collection
|
|
34
|
+
const { collection, client } = await getCollection({
|
|
35
35
|
connection
|
|
36
36
|
});
|
|
37
37
|
let res;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
*/ import getCollection from '../getCollection.js';
|
|
16
16
|
import { serialize, deserialize } from '../serialize.js';
|
|
17
17
|
import schema from './schema.js';
|
|
18
|
-
async function MongodbDeleteMany({ blockId
|
|
18
|
+
async function MongodbDeleteMany({ blockId, connection, pageId, request, requestId, payload }) {
|
|
19
19
|
const deserializedRequest = deserialize(request);
|
|
20
|
-
const { filter
|
|
21
|
-
const { collection
|
|
20
|
+
const { filter, options } = deserializedRequest;
|
|
21
|
+
const { collection, client, logCollection } = await getCollection({
|
|
22
22
|
connection
|
|
23
23
|
});
|
|
24
24
|
let response;
|
|
@@ -36,8 +36,8 @@ async function MongodbDeleteMany({ blockId , connection , pageId , request , req
|
|
|
36
36
|
requestId,
|
|
37
37
|
response,
|
|
38
38
|
timestamp: new Date(),
|
|
39
|
-
type: '
|
|
40
|
-
|
|
39
|
+
type: 'MongoDBDeleteMany',
|
|
40
|
+
meta: connection.changeLog?.meta
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
} catch (error) {
|
|
@@ -45,7 +45,7 @@ async function MongodbDeleteMany({ blockId , connection , pageId , request , req
|
|
|
45
45
|
throw error;
|
|
46
46
|
}
|
|
47
47
|
await client.close();
|
|
48
|
-
const { acknowledged
|
|
48
|
+
const { acknowledged, deletedCount } = serialize(response);
|
|
49
49
|
return {
|
|
50
50
|
acknowledged,
|
|
51
51
|
deletedCount
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -15,16 +15,17 @@
|
|
|
15
15
|
*/ import getCollection from '../getCollection.js';
|
|
16
16
|
import { serialize, deserialize } from '../serialize.js';
|
|
17
17
|
import schema from './schema.js';
|
|
18
|
-
async function MongodbDeleteOne({ blockId
|
|
18
|
+
async function MongodbDeleteOne({ blockId, connection, pageId, request, requestId, payload }) {
|
|
19
19
|
const deserializedRequest = deserialize(request);
|
|
20
|
-
const { filter
|
|
21
|
-
const { collection
|
|
20
|
+
const { filter, options } = deserializedRequest;
|
|
21
|
+
const { collection, client, logCollection } = await getCollection({
|
|
22
22
|
connection
|
|
23
23
|
});
|
|
24
24
|
let response;
|
|
25
25
|
try {
|
|
26
26
|
if (logCollection) {
|
|
27
|
-
|
|
27
|
+
const { value, ...responseWithoutValue } = await collection.findOneAndDelete(filter, options);
|
|
28
|
+
response = responseWithoutValue;
|
|
28
29
|
await logCollection.insertOne({
|
|
29
30
|
args: {
|
|
30
31
|
filter,
|
|
@@ -34,10 +35,10 @@ async function MongodbDeleteOne({ blockId , connection , pageId , request , requ
|
|
|
34
35
|
pageId,
|
|
35
36
|
payload,
|
|
36
37
|
requestId,
|
|
37
|
-
before:
|
|
38
|
+
before: value,
|
|
38
39
|
timestamp: new Date(),
|
|
39
40
|
type: 'MongoDBDeleteOne',
|
|
40
|
-
|
|
41
|
+
meta: connection.changeLog?.meta
|
|
41
42
|
});
|
|
42
43
|
} else {
|
|
43
44
|
response = await collection.deleteOne(filter, options);
|
|
@@ -47,11 +48,7 @@ async function MongodbDeleteOne({ blockId , connection , pageId , request , requ
|
|
|
47
48
|
throw error;
|
|
48
49
|
}
|
|
49
50
|
await client.close();
|
|
50
|
-
|
|
51
|
-
return {
|
|
52
|
-
acknowledged,
|
|
53
|
-
deletedCount
|
|
54
|
-
};
|
|
51
|
+
return serialize(response);
|
|
55
52
|
}
|
|
56
53
|
MongodbDeleteOne.schema = schema;
|
|
57
54
|
MongodbDeleteOne.meta = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
*/ import getCollection from '../getCollection.js';
|
|
16
16
|
import { serialize, deserialize } from '../serialize.js';
|
|
17
17
|
import schema from './schema.js';
|
|
18
|
-
async function MongodbFind({ request
|
|
18
|
+
async function MongodbFind({ request, connection }) {
|
|
19
19
|
const deserializedRequest = deserialize(request);
|
|
20
|
-
const { query
|
|
21
|
-
const { collection
|
|
20
|
+
const { query, options } = deserializedRequest;
|
|
21
|
+
const { collection, client } = await getCollection({
|
|
22
22
|
connection
|
|
23
23
|
});
|
|
24
24
|
let res;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
*/ import getCollection from '../getCollection.js';
|
|
16
16
|
import { serialize, deserialize } from '../serialize.js';
|
|
17
17
|
import schema from './schema.js';
|
|
18
|
-
async function MongodbFindOne({ request
|
|
18
|
+
async function MongodbFindOne({ request, connection }) {
|
|
19
19
|
const deserializedRequest = deserialize(request);
|
|
20
|
-
const { query
|
|
21
|
-
const { collection
|
|
20
|
+
const { query, options } = deserializedRequest;
|
|
21
|
+
const { collection, client } = await getCollection({
|
|
22
22
|
connection
|
|
23
23
|
});
|
|
24
24
|
let res;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
*/ import getCollection from '../getCollection.js';
|
|
16
16
|
import { serialize, deserialize } from '../serialize.js';
|
|
17
17
|
import schema from './schema.js';
|
|
18
|
-
async function MongodbInsertMany({ blockId
|
|
18
|
+
async function MongodbInsertMany({ blockId, connection, pageId, request, requestId, payload }) {
|
|
19
19
|
const deserializedRequest = deserialize(request);
|
|
20
|
-
const { docs
|
|
21
|
-
const { collection
|
|
20
|
+
const { docs, options } = deserializedRequest;
|
|
21
|
+
const { collection, client, logCollection } = await getCollection({
|
|
22
22
|
connection
|
|
23
23
|
});
|
|
24
24
|
let response;
|
|
@@ -37,7 +37,7 @@ async function MongodbInsertMany({ blockId , connection , pageId , request , req
|
|
|
37
37
|
response,
|
|
38
38
|
timestamp: new Date(),
|
|
39
39
|
type: 'MongoDBInsertMany',
|
|
40
|
-
|
|
40
|
+
meta: connection.changeLog?.meta
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
} catch (error) {
|
|
@@ -45,7 +45,7 @@ async function MongodbInsertMany({ blockId , connection , pageId , request , req
|
|
|
45
45
|
throw error;
|
|
46
46
|
}
|
|
47
47
|
await client.close();
|
|
48
|
-
const { acknowledged
|
|
48
|
+
const { acknowledged, insertedCount } = serialize(response);
|
|
49
49
|
return {
|
|
50
50
|
acknowledged,
|
|
51
51
|
insertedCount
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
*/ import getCollection from '../getCollection.js';
|
|
16
16
|
import { serialize, deserialize } from '../serialize.js';
|
|
17
17
|
import schema from './schema.js';
|
|
18
|
-
async function MongodbInsertOne({ blockId
|
|
18
|
+
async function MongodbInsertOne({ blockId, connection, pageId, request, requestId, payload }) {
|
|
19
19
|
const deserializedRequest = deserialize(request);
|
|
20
|
-
const { doc
|
|
21
|
-
const { collection
|
|
20
|
+
const { doc, options } = deserializedRequest;
|
|
21
|
+
const { collection, client, logCollection } = await getCollection({
|
|
22
22
|
connection
|
|
23
23
|
});
|
|
24
24
|
let response;
|
|
@@ -37,7 +37,7 @@ async function MongodbInsertOne({ blockId , connection , pageId , request , requ
|
|
|
37
37
|
response,
|
|
38
38
|
timestamp: new Date(),
|
|
39
39
|
type: 'MongoDBInsertOne',
|
|
40
|
-
|
|
40
|
+
meta: connection.changeLog?.meta
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
} catch (error) {
|
|
@@ -45,7 +45,7 @@ async function MongodbInsertOne({ blockId , connection , pageId , request , requ
|
|
|
45
45
|
throw error;
|
|
46
46
|
}
|
|
47
47
|
await client.close();
|
|
48
|
-
const { acknowledged
|
|
48
|
+
const { acknowledged, insertedId } = serialize(response);
|
|
49
49
|
return {
|
|
50
50
|
acknowledged,
|
|
51
51
|
insertedId
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
*/ import getCollection from '../getCollection.js';
|
|
16
16
|
import { serialize, deserialize } from '../serialize.js';
|
|
17
17
|
import schema from './schema.js';
|
|
18
|
-
async function MongodbUpdateMany({ blockId
|
|
18
|
+
async function MongodbUpdateMany({ blockId, connection, pageId, request, requestId, payload }) {
|
|
19
19
|
const deserializedRequest = deserialize(request);
|
|
20
|
-
const { filter
|
|
21
|
-
const { collection
|
|
20
|
+
const { filter, update, options } = deserializedRequest;
|
|
21
|
+
const { collection, client, logCollection } = await getCollection({
|
|
22
22
|
connection
|
|
23
23
|
});
|
|
24
24
|
let response;
|
|
@@ -38,7 +38,7 @@ async function MongodbUpdateMany({ blockId , connection , pageId , request , req
|
|
|
38
38
|
response,
|
|
39
39
|
timestamp: new Date(),
|
|
40
40
|
type: 'MongoDBUpdateMany',
|
|
41
|
-
|
|
41
|
+
meta: connection.changeLog?.meta
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
} catch (error) {
|
|
@@ -46,7 +46,7 @@ async function MongodbUpdateMany({ blockId , connection , pageId , request , req
|
|
|
46
46
|
throw error;
|
|
47
47
|
}
|
|
48
48
|
await client.close();
|
|
49
|
-
const { modifiedCount
|
|
49
|
+
const { modifiedCount, upsertedId, upsertedCount, matchedCount } = serialize(response);
|
|
50
50
|
return {
|
|
51
51
|
modifiedCount,
|
|
52
52
|
upsertedId,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -15,18 +15,19 @@
|
|
|
15
15
|
*/ import getCollection from '../getCollection.js';
|
|
16
16
|
import { serialize, deserialize } from '../serialize.js';
|
|
17
17
|
import schema from './schema.js';
|
|
18
|
-
async function MongodbUpdateOne({ blockId
|
|
18
|
+
async function MongodbUpdateOne({ blockId, connection, pageId, request, requestId, payload }) {
|
|
19
19
|
const deserializedRequest = deserialize(request);
|
|
20
|
-
const { filter
|
|
21
|
-
const { collection
|
|
20
|
+
const { filter, update, options } = deserializedRequest;
|
|
21
|
+
const { collection, client, logCollection } = await getCollection({
|
|
22
22
|
connection
|
|
23
23
|
});
|
|
24
24
|
let response;
|
|
25
25
|
try {
|
|
26
26
|
if (logCollection) {
|
|
27
|
-
|
|
27
|
+
const { value, ...responseWithoutValue } = await collection.findOneAndUpdate(filter, update, options);
|
|
28
|
+
response = responseWithoutValue;
|
|
28
29
|
const after = await collection.findOne({
|
|
29
|
-
_id: response.
|
|
30
|
+
_id: value ? value._id : response.lastErrorObject?.upserted
|
|
30
31
|
});
|
|
31
32
|
await logCollection.insertOne({
|
|
32
33
|
args: {
|
|
@@ -38,11 +39,11 @@ async function MongodbUpdateOne({ blockId , connection , pageId , request , requ
|
|
|
38
39
|
pageId,
|
|
39
40
|
payload,
|
|
40
41
|
requestId,
|
|
41
|
-
before:
|
|
42
|
+
before: value,
|
|
42
43
|
after,
|
|
43
44
|
timestamp: new Date(),
|
|
44
45
|
type: 'MongoDBUpdateOne',
|
|
45
|
-
|
|
46
|
+
meta: connection.changeLog?.meta
|
|
46
47
|
});
|
|
47
48
|
} else {
|
|
48
49
|
response = await collection.updateOne(filter, update, options);
|
|
@@ -52,13 +53,7 @@ async function MongodbUpdateOne({ blockId , connection , pageId , request , requ
|
|
|
52
53
|
throw error;
|
|
53
54
|
}
|
|
54
55
|
await client.close();
|
|
55
|
-
|
|
56
|
-
return {
|
|
57
|
-
modifiedCount,
|
|
58
|
-
upsertedId,
|
|
59
|
-
upsertedCount,
|
|
60
|
-
matchedCount
|
|
61
|
-
};
|
|
56
|
+
return serialize(response);
|
|
62
57
|
}
|
|
63
58
|
MongodbUpdateOne.schema = schema;
|
|
64
59
|
MongodbUpdateOne.meta = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import { MongoClient } from 'mongodb';
|
|
16
|
-
async function getCollection({ connection
|
|
16
|
+
async function getCollection({ connection }) {
|
|
17
17
|
let client;
|
|
18
|
-
const { collection
|
|
18
|
+
const { collection, databaseName, databaseUri, changeLog, options } = connection;
|
|
19
19
|
client = new MongoClient(databaseUri, options);
|
|
20
20
|
await client.connect();
|
|
21
21
|
try {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import { ObjectId } from 'mongodb';
|
|
16
|
-
import { type } from '@lowdefy/helpers';
|
|
16
|
+
import { serializer, type } from '@lowdefy/helpers';
|
|
17
17
|
function replacer(_, value) {
|
|
18
18
|
if (type.isObject(value)) {
|
|
19
19
|
Object.keys(value).forEach((key)=>{
|
|
@@ -23,12 +23,6 @@ function replacer(_, value) {
|
|
|
23
23
|
_oid: value[key].toHexString()
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
if (type.isDate(value[key])) {
|
|
27
|
-
// eslint-disable-next-line no-param-reassign
|
|
28
|
-
value[key] = {
|
|
29
|
-
_date: value[key].valueOf()
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
26
|
});
|
|
33
27
|
return value;
|
|
34
28
|
}
|
|
@@ -39,11 +33,6 @@ function replacer(_, value) {
|
|
|
39
33
|
_oid: item.toHexString()
|
|
40
34
|
};
|
|
41
35
|
}
|
|
42
|
-
if (type.isDate(item)) {
|
|
43
|
-
return {
|
|
44
|
-
_date: item.valueOf()
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
36
|
return item;
|
|
48
37
|
});
|
|
49
38
|
}
|
|
@@ -54,20 +43,17 @@ function reviver(key, value) {
|
|
|
54
43
|
if (value._oid) {
|
|
55
44
|
return ObjectId.createFromHexString(value._oid);
|
|
56
45
|
}
|
|
57
|
-
if (type.isInt(value._date) || type.isString(value._date)) {
|
|
58
|
-
return new Date(value._date);
|
|
59
|
-
}
|
|
60
46
|
}
|
|
61
47
|
return value;
|
|
62
48
|
}
|
|
63
49
|
function serialize(obj) {
|
|
64
|
-
|
|
65
|
-
|
|
50
|
+
return serializer.copy(obj, {
|
|
51
|
+
replacer
|
|
52
|
+
});
|
|
66
53
|
}
|
|
67
|
-
// need to use replacer here, since objects are already partially deserialised.
|
|
68
|
-
// otherwise dates become strings
|
|
69
54
|
function deserialize(obj) {
|
|
70
|
-
|
|
71
|
-
|
|
55
|
+
return serializer.copy(obj, {
|
|
56
|
+
reviver
|
|
57
|
+
});
|
|
72
58
|
}
|
|
73
59
|
export { serialize, deserialize };
|
package/dist/connections.js
CHANGED
package/dist/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/connection-mongodb",
|
|
3
|
-
"version": "4.0.0-rc.
|
|
3
|
+
"version": "4.0.0-rc.10",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"homepage": "https://lowdefy.com",
|
|
@@ -42,25 +42,26 @@
|
|
|
42
42
|
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@lowdefy/helpers": "4.0.0-rc.
|
|
46
|
-
"@next-auth/mongodb-adapter": "1.
|
|
47
|
-
"mongodb": "4.
|
|
45
|
+
"@lowdefy/helpers": "4.0.0-rc.10",
|
|
46
|
+
"@next-auth/mongodb-adapter": "1.1.1",
|
|
47
|
+
"mongodb": "4.13.0",
|
|
48
48
|
"saslprep": "1.0.3"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@lowdefy/ajv": "4.0.0-rc.
|
|
52
|
-
"@shelf/jest-mongodb": "4.1.
|
|
53
|
-
"@swc/cli": "0.1.
|
|
54
|
-
"@swc/core": "1.
|
|
55
|
-
"@swc/jest": "0.2.
|
|
56
|
-
"jest": "28.1.
|
|
57
|
-
"jest-environment-node": "28.1.
|
|
58
|
-
"next
|
|
51
|
+
"@lowdefy/ajv": "4.0.0-rc.10",
|
|
52
|
+
"@shelf/jest-mongodb": "4.1.4",
|
|
53
|
+
"@swc/cli": "0.1.62",
|
|
54
|
+
"@swc/core": "1.3.70",
|
|
55
|
+
"@swc/jest": "0.2.27",
|
|
56
|
+
"jest": "28.1.3",
|
|
57
|
+
"jest-environment-node": "28.1.3",
|
|
58
|
+
"next": "12.3.4",
|
|
59
|
+
"next-auth": "4.20.1",
|
|
59
60
|
"react": "18.2.0",
|
|
60
61
|
"react-dom": "18.2.0"
|
|
61
62
|
},
|
|
62
63
|
"publishConfig": {
|
|
63
64
|
"access": "public"
|
|
64
65
|
},
|
|
65
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "537af074f27770e32da9da8d48490f2eda94b406"
|
|
66
67
|
}
|