@pi-r/atlas 0.6.6 → 0.6.8
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/README.md +2 -0
- package/client/index.js +7 -6
- package/package.json +7 -7
package/README.md
CHANGED
package/client/index.js
CHANGED
|
@@ -17,7 +17,7 @@ function sanitizeCredentials(credential) {
|
|
|
17
17
|
}
|
|
18
18
|
function validateDatabase(credential, data) {
|
|
19
19
|
const auth = credential.auth;
|
|
20
|
-
return !!(data.table && Module.isURL(data.uri) && (auth
|
|
20
|
+
return !!(data.table && Module.isURL(data.uri) && ((auth === null || auth === void 0 ? void 0 : auth.username) || credential.username || (0, util_1.hasBasicAuth)(data.uri)));
|
|
21
21
|
}
|
|
22
22
|
exports.validateDatabase = validateDatabase;
|
|
23
23
|
function createDatabaseClient(credential, data) {
|
|
@@ -30,6 +30,7 @@ async function executeQuery(credential, data, sessionKey) {
|
|
|
30
30
|
}
|
|
31
31
|
exports.executeQuery = executeQuery;
|
|
32
32
|
async function executeBatchQuery(credential, batch, sessionKey) {
|
|
33
|
+
var _a, _b;
|
|
33
34
|
const length = batch.length;
|
|
34
35
|
const result = new Array(length);
|
|
35
36
|
const clients = {};
|
|
@@ -63,9 +64,9 @@ async function executeBatchQuery(credential, batch, sessionKey) {
|
|
|
63
64
|
sanitizeCredentials(options);
|
|
64
65
|
auth = { uri: item.uri, options };
|
|
65
66
|
}
|
|
66
|
-
const getInstance = (target) => target.db(name, client
|
|
67
|
-
const getCollection = (target) => getInstance(target).collection(table, client
|
|
68
|
-
const runCommand = async (target, document) => getInstance(target).command(document, client
|
|
67
|
+
const getInstance = (target) => target.db(name, client === null || client === void 0 ? void 0 : client.db);
|
|
68
|
+
const getCollection = (target) => getInstance(target).collection(table, client === null || client === void 0 ? void 0 : client.collection);
|
|
69
|
+
const runCommand = async (target, document) => getInstance(target).command(document, client === null || client === void 0 ? void 0 : client.command);
|
|
69
70
|
const getCache = () => {
|
|
70
71
|
if (ignoreCache !== 1) {
|
|
71
72
|
cacheValue.renewCache = ignoreCache === 0;
|
|
@@ -84,7 +85,7 @@ async function executeBatchQuery(credential, batch, sessionKey) {
|
|
|
84
85
|
(0, types_1.coerceObject)(update);
|
|
85
86
|
}
|
|
86
87
|
if (Array.isArray(update)) {
|
|
87
|
-
const insertOptions = item.execute
|
|
88
|
+
const insertOptions = (_a = item.execute) === null || _a === void 0 ? void 0 : _a.insert;
|
|
88
89
|
if (insertOptions && coercing) {
|
|
89
90
|
(0, types_1.coerceObject)(insertOptions);
|
|
90
91
|
}
|
|
@@ -133,7 +134,7 @@ async function executeBatchQuery(credential, batch, sessionKey) {
|
|
|
133
134
|
}
|
|
134
135
|
else {
|
|
135
136
|
if (update && updateType === 1) {
|
|
136
|
-
const updateOptions = item.execute
|
|
137
|
+
const updateOptions = (_b = item.execute) === null || _b === void 0 ? void 0 : _b.update;
|
|
137
138
|
if (updateOptions && coercing) {
|
|
138
139
|
(0, types_1.coerceObject)(updateOptions);
|
|
139
140
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-r/atlas",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.8",
|
|
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.8.
|
|
24
|
-
"@e-mc/db": "^0.8.
|
|
25
|
-
"@e-mc/module": "^0.8.
|
|
26
|
-
"@e-mc/types": "^0.8.
|
|
27
|
-
"@pi-r/mongodb": "^0.6.
|
|
28
|
-
"mongodb": "^6.
|
|
23
|
+
"@e-mc/cloud": "^0.8.14",
|
|
24
|
+
"@e-mc/db": "^0.8.14",
|
|
25
|
+
"@e-mc/module": "^0.8.14",
|
|
26
|
+
"@e-mc/types": "^0.8.14",
|
|
27
|
+
"@pi-r/mongodb": "^0.6.8",
|
|
28
|
+
"mongodb": "^6.8.0"
|
|
29
29
|
}
|
|
30
30
|
}
|