@dnax/core 0.4.1 → 0.4.2

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.
@@ -239,10 +239,6 @@ class useRest {
239
239
 
240
240
  var { valid, output, error } = this.validator(collection, data);
241
241
  if (!valid) fn.error(error, 400);
242
- data = {
243
- ...output,
244
- ...data,
245
- };
246
242
 
247
243
  if (col?.hooks?.beforeOperation && useHook) {
248
244
  await col.hooks.beforeOperation({
@@ -343,12 +339,7 @@ class useRest {
343
339
  d = await hashPasswordAuto(d, col);
344
340
  d = deepSetId(col, d);
345
341
  var { valid, output, error } = this.validator(collection, d);
346
-
347
342
  if (!valid) fn.error(error, 400);
348
- d = {
349
- ...output,
350
- ...d,
351
- };
352
343
  }
353
344
 
354
345
  if (col?.hooks?.beforeOperation && useHook) {
@@ -515,7 +506,7 @@ class useRest {
515
506
 
516
507
  let resultDocs = toJson(result.docs);
517
508
  if (typeof options?.elementAt == "number") {
518
- resultDocs = resultDocs[options?.elementAt] || null;
509
+ resultDocs = resultDocs[options?.elementAt] ?? null;
519
510
  }
520
511
  return resolve(resultDocs);
521
512
  } catch (err) {
package/lib/schema.ts CHANGED
@@ -118,7 +118,7 @@ function buildSchema(col: Collection) {
118
118
  if (f?.validate?.schema) {
119
119
  propertySchema[f.name] = f.validate.schema;
120
120
  }
121
- if (f?.defaultValue) {
121
+ if (f?.defaultValue !== undefined && f?.defaultValue !== null) {
122
122
  propertySchema[f.name] = propertySchema[f.name]?.default(f.defaultValue);
123
123
  }
124
124
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dnax/core",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "bin": {