@lowdefy/connection-mongodb 4.0.0-rc.0 → 4.0.0-rc.1

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.
Files changed (26) hide show
  1. package/dist/auth/adapters/MongoDBAdapter/MongoDBAdapter.js +3 -3
  2. package/dist/connections/MongoDBCollection/MongoDBAggregation/MongoDBAggregation.js +1 -1
  3. package/dist/connections/MongoDBCollection/MongoDBAggregation/schema.js +1 -1
  4. package/dist/connections/MongoDBCollection/MongoDBCollection.js +1 -1
  5. package/dist/connections/MongoDBCollection/MongoDBDeleteMany/MongoDBDeleteMany.js +3 -3
  6. package/dist/connections/MongoDBCollection/MongoDBDeleteMany/schema.js +1 -1
  7. package/dist/connections/MongoDBCollection/MongoDBDeleteOne/MongoDBDeleteOne.js +6 -9
  8. package/dist/connections/MongoDBCollection/MongoDBDeleteOne/schema.js +1 -1
  9. package/dist/connections/MongoDBCollection/MongoDBFind/MongoDBFind.js +1 -1
  10. package/dist/connections/MongoDBCollection/MongoDBFind/schema.js +1 -1
  11. package/dist/connections/MongoDBCollection/MongoDBFindOne/MongoDBFindOne.js +1 -1
  12. package/dist/connections/MongoDBCollection/MongoDBFindOne/schema.js +1 -1
  13. package/dist/connections/MongoDBCollection/MongoDBInsertMany/MongoDBInsertMany.js +2 -2
  14. package/dist/connections/MongoDBCollection/MongoDBInsertMany/schema.js +1 -1
  15. package/dist/connections/MongoDBCollection/MongoDBInsertOne/MongoDBInsertOne.js +2 -2
  16. package/dist/connections/MongoDBCollection/MongoDBInsertOne/schema.js +1 -1
  17. package/dist/connections/MongoDBCollection/MongoDBUpdateMany/MongoDBUpdateMany.js +2 -2
  18. package/dist/connections/MongoDBCollection/MongoDBUpdateMany/schema.js +1 -1
  19. package/dist/connections/MongoDBCollection/MongoDBUpdateOne/MongoDBUpdateOne.js +7 -12
  20. package/dist/connections/MongoDBCollection/MongoDBUpdateOne/schema.js +1 -1
  21. package/dist/connections/MongoDBCollection/getCollection.js +1 -1
  22. package/dist/connections/MongoDBCollection/schema.js +1 -1
  23. package/dist/connections/MongoDBCollection/serialize.js +1 -1
  24. package/dist/connections.js +1 -1
  25. package/dist/types.js +1 -1
  26. package/package.json +11 -11
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
@@ -24,8 +24,8 @@ Default collections are:
24
24
  }
25
25
  */ // TODO: Docs: MongoDB database name should be in databaseUri
26
26
  function MongoDBAdapter({ properties }) {
27
- const { databaseUri , mongoDBClientOptions , collections } = properties;
27
+ const { databaseUri , mongoDBClientOptions , options } = properties;
28
28
  const clientPromise = new MongoClient(databaseUri, mongoDBClientOptions).connect();
29
- return NextAuthMongoDBAdapter(clientPromise, collections);
29
+ return NextAuthMongoDBAdapter(clientPromise, options);
30
30
  }
31
31
  export default MongoDBAdapter;
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
@@ -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: 'MongoDBInsertMany',
40
- user: connection.changeLog?.user
39
+ type: 'MongoDBDeleteMany',
40
+ meta: connection.changeLog?.meta
41
41
  });
42
42
  }
43
43
  } catch (error) {
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
@@ -24,7 +24,8 @@ async function MongodbDeleteOne({ blockId , connection , pageId , request , requ
24
24
  let response;
25
25
  try {
26
26
  if (logCollection) {
27
- response = await collection.findOneAndDelete(filter, options);
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: response,
38
+ before: value,
38
39
  timestamp: new Date(),
39
40
  type: 'MongoDBDeleteOne',
40
- user: connection.changeLog?.user
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
- const { acknowledged , deletedCount } = serialize(response);
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-2022 Lowdefy, Inc
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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
@@ -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
- user: connection.changeLog?.user
40
+ meta: connection.changeLog?.meta
41
41
  });
42
42
  }
43
43
  } catch (error) {
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
@@ -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
- user: connection.changeLog?.user
40
+ meta: connection.changeLog?.meta
41
41
  });
42
42
  }
43
43
  } catch (error) {
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
@@ -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
- user: connection.changeLog?.user
41
+ meta: connection.changeLog?.meta
42
42
  });
43
43
  }
44
44
  } catch (error) {
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
@@ -24,9 +24,10 @@ async function MongodbUpdateOne({ blockId , connection , pageId , request , requ
24
24
  let response;
25
25
  try {
26
26
  if (logCollection) {
27
- response = await collection.findOneAndUpdate(filter, update, options);
27
+ const { value , ...responseWithoutValue } = await collection.findOneAndUpdate(filter, update, options);
28
+ response = responseWithoutValue;
28
29
  const after = await collection.findOne({
29
- _id: response._id
30
+ _id: value._id
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: response,
42
+ before: value,
42
43
  after,
43
44
  timestamp: new Date(),
44
45
  type: 'MongoDBUpdateOne',
45
- user: connection.changeLog?.user
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
- const { modifiedCount , upsertedId , upsertedCount , matchedCount } = serialize(response);
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-2022 Lowdefy, Inc
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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
package/dist/types.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable import/namespace */ /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/connection-mongodb",
3
- "version": "4.0.0-rc.0",
3
+ "version": "4.0.0-rc.1",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "homepage": "https://lowdefy.com",
@@ -42,25 +42,25 @@
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.0",
46
- "@next-auth/mongodb-adapter": "1.0.3",
47
- "mongodb": "4.6.0",
45
+ "@lowdefy/helpers": "4.0.0-rc.1",
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.0",
52
- "@shelf/jest-mongodb": "4.1.0",
53
- "@swc/cli": "0.1.57",
54
- "@swc/core": "1.2.194",
55
- "@swc/jest": "0.2.21",
51
+ "@lowdefy/ajv": "4.0.0-rc.1",
52
+ "@shelf/jest-mongodb": "4.1.4",
53
+ "@swc/cli": "0.1.59",
54
+ "@swc/core": "1.3.24",
55
+ "@swc/jest": "0.2.24",
56
56
  "jest": "28.1.0",
57
57
  "jest-environment-node": "28.1.0",
58
- "next-auth": "4.10.3",
58
+ "next-auth": "4.18.8",
59
59
  "react": "18.2.0",
60
60
  "react-dom": "18.2.0"
61
61
  },
62
62
  "publishConfig": {
63
63
  "access": "public"
64
64
  },
65
- "gitHead": "f6872d7ff6da421710096536fce7b2016ef8f35c"
65
+ "gitHead": "ecc4f16c19eede929eda177db524cf13a8053379"
66
66
  }