s3db.js 3.2.2 → 3.2.4

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/s3db.iife.js CHANGED
@@ -1181,7 +1181,7 @@ ${JSON.stringify(validation, null, 2)}`
1181
1181
  let lib;
1182
1182
  if (process) {
1183
1183
  try {
1184
- const { webcrypto } = await Promise.resolve().then(function () { return _polyfillNode_crypto; });
1184
+ const { webcrypto } = await import('crypto');
1185
1185
  lib = webcrypto;
1186
1186
  } catch (error) {
1187
1187
  throw new Error("Crypto API not available");
@@ -1339,7 +1339,9 @@ ${JSON.stringify(validation, null, 2)}`
1339
1339
  toArray: (value, { separator }) => (value || "").split(separator),
1340
1340
  toJSON: (value) => JSON.stringify(value),
1341
1341
  fromJSON: (value) => JSON.parse(value),
1342
- toNumber: (value) => lodashEs.isString(value) ? value.includes(".") ? parseFloat(value) : parseInt(value) : value
1342
+ toNumber: (value) => lodashEs.isString(value) ? value.includes(".") ? parseFloat(value) : parseInt(value) : value,
1343
+ toBool: (value) => ["true", "1", "yes"].includes(value),
1344
+ fromBool: (value) => value ? "1" : "0"
1343
1345
  };
1344
1346
  class Schema {
1345
1347
  constructor(args) {
@@ -1408,8 +1410,8 @@ ${JSON.stringify(validation, null, 2)}`
1408
1410
  this.addHook("afterUnmap", name, "toNumber");
1409
1411
  }
1410
1412
  if (definition.includes("boolean")) {
1411
- this.addHook("beforeMap", name, "toJSON");
1412
- this.addHook("afterUnmap", name, "fromJSON");
1413
+ this.addHook("beforeMap", name, "fromBool");
1414
+ this.addHook("afterUnmap", name, "toBool");
1413
1415
  }
1414
1416
  }
1415
1417
  }
@@ -13179,10 +13181,6 @@ ${JSON.stringify(validation, null, 2)}`
13179
13181
  }
13180
13182
  }
13181
13183
 
13182
- var _polyfillNode_crypto = /*#__PURE__*/Object.freeze({
13183
- __proto__: null
13184
- });
13185
-
13186
13184
  exports.BaseError = BaseError;
13187
13185
  exports.Cache = Cache;
13188
13186
  exports.CachePlugin = CachePlugin;