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.es.js CHANGED
@@ -1186,7 +1186,7 @@ async function dynamicCrypto() {
1186
1186
  let lib;
1187
1187
  if (process) {
1188
1188
  try {
1189
- const { webcrypto } = await Promise.resolve().then(function () { return _polyfillNode_crypto; });
1189
+ const { webcrypto } = await import('crypto');
1190
1190
  lib = webcrypto;
1191
1191
  } catch (error) {
1192
1192
  throw new Error("Crypto API not available");
@@ -1344,7 +1344,9 @@ const SchemaActions = {
1344
1344
  toArray: (value, { separator }) => (value || "").split(separator),
1345
1345
  toJSON: (value) => JSON.stringify(value),
1346
1346
  fromJSON: (value) => JSON.parse(value),
1347
- toNumber: (value) => isString$1(value) ? value.includes(".") ? parseFloat(value) : parseInt(value) : value
1347
+ toNumber: (value) => isString$1(value) ? value.includes(".") ? parseFloat(value) : parseInt(value) : value,
1348
+ toBool: (value) => ["true", "1", "yes"].includes(value),
1349
+ fromBool: (value) => value ? "1" : "0"
1348
1350
  };
1349
1351
  class Schema {
1350
1352
  constructor(args) {
@@ -1413,8 +1415,8 @@ class Schema {
1413
1415
  this.addHook("afterUnmap", name, "toNumber");
1414
1416
  }
1415
1417
  if (definition.includes("boolean")) {
1416
- this.addHook("beforeMap", name, "toJSON");
1417
- this.addHook("afterUnmap", name, "fromJSON");
1418
+ this.addHook("beforeMap", name, "fromBool");
1419
+ this.addHook("afterUnmap", name, "toBool");
1418
1420
  }
1419
1421
  }
1420
1422
  }
@@ -13184,8 +13186,4 @@ class CachePlugin extends Plugin {
13184
13186
  }
13185
13187
  }
13186
13188
 
13187
- var _polyfillNode_crypto = /*#__PURE__*/Object.freeze({
13188
- __proto__: null
13189
- });
13190
-
13191
13189
  export { BaseError, Cache, CachePlugin, Client, ConnectionString, CostsPlugin, Database, ErrorMap, InvalidResourceItem, MemoryCache, MissingMetadata, NoSuchBucket, NoSuchKey, NotFound, Plugin, PluginObject, ResourceIdsPageReader, ResourceIdsReader, ResourceReader, ResourceWriter, S3Cache, S3_DEFAULT_ENDPOINT, S3_DEFAULT_REGION, S3db, UnknownError, Validator, ValidatorManager, decrypt, encrypt, sha256, streamToString };