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.cjs.js CHANGED
@@ -1188,7 +1188,7 @@ async function dynamicCrypto() {
1188
1188
  let lib;
1189
1189
  if (process) {
1190
1190
  try {
1191
- const { webcrypto } = await Promise.resolve().then(function () { return _polyfillNode_crypto; });
1191
+ const { webcrypto } = await import('crypto');
1192
1192
  lib = webcrypto;
1193
1193
  } catch (error) {
1194
1194
  throw new Error("Crypto API not available");
@@ -1346,7 +1346,9 @@ const SchemaActions = {
1346
1346
  toArray: (value, { separator }) => (value || "").split(separator),
1347
1347
  toJSON: (value) => JSON.stringify(value),
1348
1348
  fromJSON: (value) => JSON.parse(value),
1349
- toNumber: (value) => lodashEs.isString(value) ? value.includes(".") ? parseFloat(value) : parseInt(value) : value
1349
+ toNumber: (value) => lodashEs.isString(value) ? value.includes(".") ? parseFloat(value) : parseInt(value) : value,
1350
+ toBool: (value) => ["true", "1", "yes"].includes(value),
1351
+ fromBool: (value) => value ? "1" : "0"
1350
1352
  };
1351
1353
  class Schema {
1352
1354
  constructor(args) {
@@ -1415,8 +1417,8 @@ class Schema {
1415
1417
  this.addHook("afterUnmap", name, "toNumber");
1416
1418
  }
1417
1419
  if (definition.includes("boolean")) {
1418
- this.addHook("beforeMap", name, "toJSON");
1419
- this.addHook("afterUnmap", name, "fromJSON");
1420
+ this.addHook("beforeMap", name, "fromBool");
1421
+ this.addHook("afterUnmap", name, "toBool");
1420
1422
  }
1421
1423
  }
1422
1424
  }
@@ -13186,10 +13188,6 @@ class CachePlugin extends Plugin {
13186
13188
  }
13187
13189
  }
13188
13190
 
13189
- var _polyfillNode_crypto = /*#__PURE__*/Object.freeze({
13190
- __proto__: null
13191
- });
13192
-
13193
13191
  exports.BaseError = BaseError;
13194
13192
  exports.Cache = Cache;
13195
13193
  exports.CachePlugin = CachePlugin;