rads-db 3.0.77 → 3.0.79

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/dist/index.cjs CHANGED
@@ -888,7 +888,7 @@ function getRadsDbMethods(key, computedContext, driverInstance) {
888
888
  result2.id = uuid.v4();
889
889
  for (const [fieldName, field] of Object.entries(type.fields)) {
890
890
  if (field.defaultValue)
891
- result2[fieldName] = field.defaultValue;
891
+ result2[fieldName] = ___default.cloneDeep(field.defaultValue);
892
892
  if (field.defaultValueClass)
893
893
  result2[fieldName] = construct(field.defaultValueClass);
894
894
  }
package/dist/index.mjs CHANGED
@@ -881,7 +881,7 @@ function getRadsDbMethods(key, computedContext, driverInstance) {
881
881
  result2.id = v4();
882
882
  for (const [fieldName, field] of Object.entries(type.fields)) {
883
883
  if (field.defaultValue)
884
- result2[fieldName] = field.defaultValue;
884
+ result2[fieldName] = _.cloneDeep(field.defaultValue);
885
885
  if (field.defaultValueClass)
886
886
  result2[fieldName] = construct(field.defaultValueClass);
887
887
  }
@@ -146,6 +146,11 @@ var _default = options => (schema, entity) => {
146
146
  console.warn(`Db overloaded. Retrying after ${delay}ms...`);
147
147
  await new Promise(resolve => setTimeout(resolve, delay));
148
148
  }
149
+ if (chunkToSend.length !== 0) {
150
+ throw new _cosmos.RestError("Db oveloaded. Too many retries. Consider increasing database RU setting.", {
151
+ code: "429"
152
+ });
153
+ }
149
154
  ctx?.log?.({
150
155
  charge: _lodash.default.sumBy(responses, r => r.requestCharge),
151
156
  request: `put#${chunk[0]._partition}[${chunk.length}]`
@@ -1,4 +1,4 @@
1
- import { CosmosClient } from "@azure/cosmos";
1
+ import { CosmosClient, RestError } from "@azure/cosmos";
2
2
  import _ from "lodash";
3
3
  const cosmosClientCache = {};
4
4
  const databaseClientCache = {};
@@ -103,6 +103,11 @@ export default (options) => (schema, entity) => {
103
103
  console.warn(`Db overloaded. Retrying after ${delay}ms...`);
104
104
  await new Promise((resolve) => setTimeout(resolve, delay));
105
105
  }
106
+ if (chunkToSend.length !== 0) {
107
+ throw new RestError("Db oveloaded. Too many retries. Consider increasing database RU setting.", {
108
+ code: "429"
109
+ });
110
+ }
106
111
  ctx?.log?.({
107
112
  charge: _.sumBy(responses, (r) => r.requestCharge),
108
113
  request: `put#${chunk[0]._partition}[${chunk.length}]`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rads-db",
3
- "version": "3.0.77",
3
+ "version": "3.0.79",
4
4
  "packageManager": "pnpm@8.6.1",
5
5
  "description": "Say goodbye to boilerplate code and hello to efficient and elegant syntax.",
6
6
  "author": "",