@pi-r/atlas 0.2.9 → 0.2.11

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 2020-24 Code Geass
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
@@ -1,6 +1,6 @@
1
1
  # @pi-r/atlas
2
2
 
3
- PEP 402 - Forever Josee + Nunnally
3
+ PEP 402 - Forever
4
4
 
5
5
  ## LICENSE
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.9",
3
+ "version": "0.2.11",
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.5",
24
- "@e-mc/db": "^0.5.5",
25
- "@e-mc/module": "^0.5.5",
26
- "@e-mc/types": "^0.5.5",
27
- "@pi-r/mongodb": "^0.2.9",
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.11",
28
28
  "mongodb": "^5.9.2"
29
29
  }
30
30
  }
@@ -0,0 +1,14 @@
1
+ import type { CloudDatabase } from '@e-mc/types/lib/cloud';
2
+
3
+ import type { MongoDBClientDBOptions, MongoDBFilterValue } from '@pi-r/mongodb/types';
4
+
5
+ import type { Document, Filter, MongoClientOptions, OptionalUnlessRequiredId, UpdateFilter } from 'mongodb';
6
+
7
+ export interface AtlasDatabaseQuery extends CloudDatabase<Filter<Document> | MongoDBFilterValue, MongoClientOptions, UpdateFilter<Document> | OptionalUnlessRequiredId<unknown>[], AtlasDatabaseCredential>, MongoDBClientDBOptions {
8
+ source: "cloud";
9
+ service: "atlas";
10
+ uri: string;
11
+ updateType?: 0 | 1 | 2 | 3;
12
+ }
13
+
14
+ export interface AtlasDatabaseCredential extends AuthValue, MongoClientOptions {}