@pi-r/atlas 0.3.2 → 0.5.2

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/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2023 Studio Trigger
1
+ Copyright 2023 Wit Studio
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
4
 
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @pi-r/atlas
2
2
 
3
- PEP 402 - Forever Aina
3
+ PEP 402 - Forever Vivy
4
4
 
5
5
  ## LICENSE
6
6
 
package/client/index.js CHANGED
@@ -6,32 +6,16 @@ const types_1 = require("@e-mc/types");
6
6
  const util_1 = require("@e-mc/cloud/util");
7
7
  const mongodb_1 = require("@pi-r/mongodb");
8
8
  const Module = require("@e-mc/module");
9
- const MONGODB_V3 = Module.checkSemVer('mongodb', 1, 4);
10
9
  function sanitizeCredentials(item, credential) {
11
10
  const { username, password } = credential;
12
11
  if (username) {
13
12
  const auth = password ? { username, password } : { username };
14
- if (MONGODB_V3) {
15
- credential.auth = password || !credential.auth?.password ? auth : credential.auth;
16
- }
17
- else {
18
- credential.auth || (credential.auth = auth);
19
- }
13
+ credential.auth || (credential.auth = auth);
20
14
  delete credential.username;
21
15
  }
22
16
  if (password) {
23
17
  delete credential.password;
24
18
  }
25
- if (MONGODB_V3 && credential.auth) {
26
- if (!(0, util_1.hasBasicAuth)(item.uri)) {
27
- const auth = (0, util_1.getBasicAuth)(credential.auth);
28
- if (auth) {
29
- const [protocol, hostname] = item.uri.split('://');
30
- item.uri = protocol + '://' + auth + hostname;
31
- }
32
- }
33
- delete credential.auth;
34
- }
35
19
  }
36
20
  function validateDatabase(credential, data) {
37
21
  const auth = credential.auth;
@@ -76,7 +60,7 @@ async function executeBatchQuery(credential, batch, sessionKey) {
76
60
  limit = 1;
77
61
  }
78
62
  const renewCache = ignoreCache === 0;
79
- const options = item.options ? length === 1 && !MONGODB_V3 ? Object.assign(item.options, credential) : { ...item.options, ...credential } : length === 1 && !MONGODB_V3 ? credential : { ...credential };
63
+ const options = item.options ? length === 1 ? Object.assign(item.options, credential) : { ...item.options, ...credential } : length === 1 ? credential : { ...credential };
80
64
  let rows, queryString = caching && ignoreCache !== true || ignoreCache === false || ignoreCache === 1 || renewCache ? (name || '') + '_' + table + '_' + limit + Module.asString(options, true) + (sort ? Module.asString(sort, true) : '') + (client ? Module.asString(client, true) : '') : '', auth, pipeline;
81
65
  if (queryString) {
82
66
  sanitizeCredentials(item, options);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-r/atlas",
3
- "version": "0.3.2",
3
+ "version": "0.5.2",
4
4
  "description": "MongoDB Atlas cloud functions for E-mc.",
5
5
  "main": "client/index.js",
6
6
  "publishConfig": {
@@ -20,11 +20,11 @@
20
20
  "license": "MIT",
21
21
  "homepage": "https://github.com/anpham6/pi-r#readme",
22
22
  "dependencies": {
23
- "@e-mc/cloud": "^0.6.1",
24
- "@e-mc/db": "^0.6.1",
25
- "@e-mc/module": "^0.6.1",
26
- "@e-mc/types": "^0.6.1",
27
- "@pi-r/mongodb": "^0.3.2",
28
- "mongodb": "^5.9.2"
23
+ "@e-mc/cloud": "^0.7.2",
24
+ "@e-mc/db": "^0.7.2",
25
+ "@e-mc/module": "^0.7.2",
26
+ "@e-mc/types": "^0.7.2",
27
+ "@pi-r/mongodb": "^0.5.2",
28
+ "mongodb": "^6.4.0"
29
29
  }
30
30
  }