@pi-r/atlas 0.2.10 → 0.2.12

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 (2) hide show
  1. package/client/index.js +6 -5
  2. package/package.json +6 -6
package/client/index.js CHANGED
@@ -34,7 +34,7 @@ function sanitizeCredentials(item, credential) {
34
34
  }
35
35
  function validateDatabase(credential, data) {
36
36
  const auth = credential.auth;
37
- return !!(data.table && (auth?.username || credential.username || Module.isURL(data.uri) && (0, util_1.hasBasicAuth)(data.uri)));
37
+ return !!(data.table && ((auth === null || auth === void 0 ? void 0 : auth.username) || credential.username || Module.isURL(data.uri) && (0, util_1.hasBasicAuth)(data.uri)));
38
38
  }
39
39
  exports.validateDatabase = validateDatabase;
40
40
  function createDatabaseClient(credential, data) {
@@ -54,6 +54,7 @@ async function executeQuery(credential, data, sessionKey) {
54
54
  }
55
55
  exports.executeQuery = executeQuery;
56
56
  async function executeBatchQuery(credential, batch, sessionKey) {
57
+ var _a, _b;
57
58
  const length = batch.length;
58
59
  const result = new Array(length);
59
60
  const clients = {};
@@ -95,7 +96,7 @@ async function executeBatchQuery(credential, batch, sessionKey) {
95
96
  cacheValue.renewCache = renewCache;
96
97
  return this.getQueryResult(service, auth, queryString, cacheValue);
97
98
  };
98
- const getCollection = (mongoClient) => mongoClient.db(name, client?.db).collection(table, client?.collection);
99
+ 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);
99
100
  if (aggregate) {
100
101
  pipeline = Array.isArray(aggregate) ? aggregate : aggregate.pipeline;
101
102
  }
@@ -109,7 +110,7 @@ async function executeBatchQuery(credential, batch, sessionKey) {
109
110
  }
110
111
  const collection = getCollection(await createClient(item, options));
111
112
  if (pipeline) {
112
- const aggregateOptions = aggregate?.options;
113
+ const aggregateOptions = aggregate === null || aggregate === void 0 ? void 0 : aggregate.options;
113
114
  if (coercing) {
114
115
  pipeline.forEach(doc => (0, types_1.coerceObject)(doc));
115
116
  if (aggregateOptions) {
@@ -132,7 +133,7 @@ async function executeBatchQuery(credential, batch, sessionKey) {
132
133
  (0, types_1.coerceObject)(update);
133
134
  }
134
135
  if ((0, types_1.isArray)(update)) {
135
- const insertOptions = item.execute?.insert;
136
+ const insertOptions = (_a = item.execute) === null || _a === void 0 ? void 0 : _a.insert;
136
137
  if (insertOptions && coercing) {
137
138
  (0, types_1.coerceObject)(insertOptions);
138
139
  }
@@ -153,7 +154,7 @@ async function executeBatchQuery(credential, batch, sessionKey) {
153
154
  }
154
155
  else {
155
156
  if (update) {
156
- const updateOptions = item.execute?.update;
157
+ const updateOptions = (_b = item.execute) === null || _b === void 0 ? void 0 : _b.update;
157
158
  if (updateOptions && coercing) {
158
159
  (0, types_1.coerceObject)(updateOptions);
159
160
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-r/atlas",
3
- "version": "0.2.10",
3
+ "version": "0.2.12",
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.5.6",
24
- "@e-mc/db": "^0.5.6",
25
- "@e-mc/module": "^0.5.6",
26
- "@e-mc/types": "^0.5.6",
27
- "@pi-r/mongodb": "^0.2.10",
23
+ "@e-mc/cloud": "^0.5.10",
24
+ "@e-mc/db": "^0.5.10",
25
+ "@e-mc/module": "^0.5.10",
26
+ "@e-mc/types": "^0.5.10",
27
+ "@pi-r/mongodb": "^0.2.12",
28
28
  "mongodb": "^5.9.2"
29
29
  }
30
30
  }