@pi-r/atlas 0.5.2 → 0.5.4
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 +1 -1
- package/README.md +1 -1
- package/client/index.js +6 -5
- package/package.json +7 -7
package/LICENSE
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright
|
|
1
|
+
Copyright 2024 An Pham
|
|
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
package/client/index.js
CHANGED
|
@@ -19,7 +19,7 @@ function sanitizeCredentials(item, credential) {
|
|
|
19
19
|
}
|
|
20
20
|
function validateDatabase(credential, data) {
|
|
21
21
|
const auth = credential.auth;
|
|
22
|
-
return !!(data.table && (auth
|
|
22
|
+
return !!(data.table && ((auth === null || auth === void 0 ? void 0 : auth.username) || credential.username || Module.isURL(data.uri) && (0, util_1.hasBasicAuth)(data.uri)));
|
|
23
23
|
}
|
|
24
24
|
exports.validateDatabase = validateDatabase;
|
|
25
25
|
function createDatabaseClient(credential, data) {
|
|
@@ -32,6 +32,7 @@ async function executeQuery(credential, data, sessionKey) {
|
|
|
32
32
|
}
|
|
33
33
|
exports.executeQuery = executeQuery;
|
|
34
34
|
async function executeBatchQuery(credential, batch, sessionKey) {
|
|
35
|
+
var _a, _b;
|
|
35
36
|
const length = batch.length;
|
|
36
37
|
const result = new Array(length);
|
|
37
38
|
const clients = {};
|
|
@@ -73,7 +74,7 @@ async function executeBatchQuery(credential, batch, sessionKey) {
|
|
|
73
74
|
cacheValue.renewCache = renewCache;
|
|
74
75
|
return this.getQueryResult(service, auth, queryString, cacheValue);
|
|
75
76
|
};
|
|
76
|
-
const getCollection = (mongoClient) => mongoClient.db(name, client
|
|
77
|
+
const getCollection = (mongoClient) => mongoClient.db(name, client === null || client === void 0 ? void 0 : client.db).collection(table, client === null || client === void 0 ? void 0 : client.collection);
|
|
77
78
|
if (aggregate) {
|
|
78
79
|
pipeline = Array.isArray(aggregate) ? aggregate : aggregate.pipeline;
|
|
79
80
|
}
|
|
@@ -87,7 +88,7 @@ async function executeBatchQuery(credential, batch, sessionKey) {
|
|
|
87
88
|
}
|
|
88
89
|
const collection = getCollection(await createClient(item, options));
|
|
89
90
|
if (pipeline) {
|
|
90
|
-
const aggregateOptions = aggregate
|
|
91
|
+
const aggregateOptions = (0, types_1.isPlainObject)(aggregate) ? aggregate.options : undefined;
|
|
91
92
|
if (coercing) {
|
|
92
93
|
pipeline.forEach(doc => (0, types_1.coerceObject)(doc));
|
|
93
94
|
if (aggregateOptions) {
|
|
@@ -110,7 +111,7 @@ async function executeBatchQuery(credential, batch, sessionKey) {
|
|
|
110
111
|
(0, types_1.coerceObject)(update);
|
|
111
112
|
}
|
|
112
113
|
if ((0, types_1.isArray)(update)) {
|
|
113
|
-
const insertOptions = item.execute
|
|
114
|
+
const insertOptions = (_a = item.execute) === null || _a === void 0 ? void 0 : _a.insert;
|
|
114
115
|
if (insertOptions && coercing) {
|
|
115
116
|
(0, types_1.coerceObject)(insertOptions);
|
|
116
117
|
}
|
|
@@ -131,7 +132,7 @@ async function executeBatchQuery(credential, batch, sessionKey) {
|
|
|
131
132
|
}
|
|
132
133
|
else {
|
|
133
134
|
if (update) {
|
|
134
|
-
const updateOptions = item.execute
|
|
135
|
+
const updateOptions = (_b = item.execute) === null || _b === void 0 ? void 0 : _b.update;
|
|
135
136
|
if (updateOptions && coercing) {
|
|
136
137
|
(0, types_1.coerceObject)(updateOptions);
|
|
137
138
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-r/atlas",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
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.7.
|
|
24
|
-
"@e-mc/db": "^0.7.
|
|
25
|
-
"@e-mc/module": "^0.7.
|
|
26
|
-
"@e-mc/types": "^0.7.
|
|
27
|
-
"@pi-r/mongodb": "^0.5.
|
|
28
|
-
"mongodb": "^6.
|
|
23
|
+
"@e-mc/cloud": "^0.7.5",
|
|
24
|
+
"@e-mc/db": "^0.7.5",
|
|
25
|
+
"@e-mc/module": "^0.7.5",
|
|
26
|
+
"@e-mc/types": "^0.7.5",
|
|
27
|
+
"@pi-r/mongodb": "^0.5.4",
|
|
28
|
+
"mongodb": "^6.5.0"
|
|
29
29
|
}
|
|
30
30
|
}
|