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