@pi-r/atlas 0.2.2 → 0.2.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/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2023 An Pham
1
+ Copyright 2023 Mile Square Park
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,5 +1,7 @@
1
- ### @pi-r/atlas
1
+ # @pi-r/atlas
2
2
 
3
- ### LICENSE
3
+ PEP 402 - Forever
4
+
5
+ ## LICENSE
4
6
 
5
7
  MIT
package/client/index.js CHANGED
@@ -74,7 +74,7 @@ async function executeBatchQuery(credential, batch, sessionKey) {
74
74
  const { service, name, table, id, aggregate, sort, client, ignoreCache } = item;
75
75
  if (!table) {
76
76
  closeClient();
77
- throw (0, util_1.formatError)(item, "Missing database table" /* ERR_DB.TABLE */);
77
+ throw (0, util_1.formatError)(item, "Missing database table");
78
78
  }
79
79
  let { query, update, limit = 0 } = item;
80
80
  if (id && (!query || limit === 1)) {
@@ -133,11 +133,14 @@ async function executeBatchQuery(credential, batch, sessionKey) {
133
133
  }
134
134
  if ((0, types_1.isArray)(update)) {
135
135
  const insertOptions = item.execute?.insert;
136
- if (insertOptions) {
137
- await collection.insertMany(update, coercing ? (0, types_1.coerceObject)(insertOptions) : insertOptions);
136
+ if (insertOptions && coercing) {
137
+ (0, types_1.coerceObject)(insertOptions);
138
+ }
139
+ if (update.length === 1) {
140
+ await collection.insertOne(update[0], insertOptions);
138
141
  }
139
142
  else {
140
- await collection.insertMany(update);
143
+ await collection.insertMany(update, insertOptions);
141
144
  }
142
145
  update = undefined;
143
146
  }
@@ -150,7 +153,11 @@ async function executeBatchQuery(credential, batch, sessionKey) {
150
153
  }
151
154
  else {
152
155
  if (update) {
153
- await collection.updateMany(filter, update);
156
+ const updateOptions = item.execute?.update;
157
+ if (updateOptions && coercing) {
158
+ (0, types_1.coerceObject)(updateOptions);
159
+ }
160
+ await collection.updateMany(filter, update, updateOptions);
154
161
  }
155
162
  const items = collection.find(filter, command);
156
163
  if (sort) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-r/atlas",
3
- "version": "0.2.2",
3
+ "version": "0.2.8",
4
4
  "description": "MongoDB Atlas cloud functions for E-mc.",
5
5
  "main": "client/index.js",
6
6
  "publishConfig": {
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "repository": {
10
10
  "type": "git",
11
- "url": "https://github.com/anpham6/pi-r.git",
11
+ "url": "git+https://github.com/anpham6/pi-r.git",
12
12
  "directory": "src/cloud/atlas"
13
13
  },
14
14
  "keywords": [
@@ -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.3",
24
- "@e-mc/db": "^0.5.3",
25
- "@e-mc/module": "^0.5.3",
26
- "@e-mc/types": "^0.5.3",
27
- "@pi-r/mongodb": "^0.2.2",
28
- "mongodb": "^5.5.0"
23
+ "@e-mc/cloud": "^0.5.4",
24
+ "@e-mc/db": "^0.5.4",
25
+ "@e-mc/module": "^0.5.4",
26
+ "@e-mc/types": "^0.5.4",
27
+ "@pi-r/mongodb": "^0.2.8",
28
+ "mongodb": "^5.9.2"
29
29
  }
30
30
  }