s3db.js 3.2.0 → 3.2.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.
- package/dist/s3db.cjs.js +17 -9
- package/dist/s3db.cjs.min.js +4 -4
- package/dist/s3db.es.js +17 -9
- package/dist/s3db.es.min.js +5 -5
- package/dist/s3db.iife.js +17 -9
- package/dist/s3db.iife.min.js +6 -6
- package/package.json +1 -1
package/dist/s3db.es.js
CHANGED
|
@@ -744,7 +744,7 @@ class NoSuchBucket extends BaseError {
|
|
|
744
744
|
}
|
|
745
745
|
class NoSuchKey extends BaseError {
|
|
746
746
|
constructor({ bucket, key, ...rest }) {
|
|
747
|
-
super({ ...rest, bucket, message: `Key does not exists [bucket:${bucket}/${key}]` });
|
|
747
|
+
super({ ...rest, bucket, message: `Key [${key}] does not exists [bucket:${bucket}/${key}]` });
|
|
748
748
|
this.key = key;
|
|
749
749
|
}
|
|
750
750
|
}
|
|
@@ -1183,11 +1183,19 @@ class Client extends EventEmitter {
|
|
|
1183
1183
|
}
|
|
1184
1184
|
|
|
1185
1185
|
async function dynamicCrypto() {
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1186
|
+
let lib;
|
|
1187
|
+
if (process) {
|
|
1188
|
+
try {
|
|
1189
|
+
const { webcrypto } = await Promise.resolve().then(function () { return _polyfillNode_crypto; });
|
|
1190
|
+
lib = webcrypto;
|
|
1191
|
+
} catch (error) {
|
|
1192
|
+
throw new Error("Crypto API not available");
|
|
1193
|
+
}
|
|
1194
|
+
} else if (window) {
|
|
1195
|
+
lib = window.crypto;
|
|
1190
1196
|
}
|
|
1197
|
+
if (!lib) throw new Error("Could not load any crypto library");
|
|
1198
|
+
return lib;
|
|
1191
1199
|
}
|
|
1192
1200
|
async function sha256(message) {
|
|
1193
1201
|
const cryptoLib = await dynamicCrypto();
|
|
@@ -1334,9 +1342,9 @@ const SchemaActions = {
|
|
|
1334
1342
|
toString: (value) => String(value),
|
|
1335
1343
|
fromArray: (value, { separator }) => (value || []).join(separator),
|
|
1336
1344
|
toArray: (value, { separator }) => (value || "").split(separator),
|
|
1337
|
-
toNumber: (value) => isString$1(value) ? value.includes(".") ? parseFloat(value) : parseInt(value) : value,
|
|
1338
1345
|
toJSON: (value) => JSON.stringify(value),
|
|
1339
|
-
fromJSON: (value) => JSON.parse(value)
|
|
1346
|
+
fromJSON: (value) => JSON.parse(value),
|
|
1347
|
+
toNumber: (value) => isString$1(value) ? value.includes(".") ? parseFloat(value) : parseInt(value) : value
|
|
1340
1348
|
};
|
|
1341
1349
|
class Schema {
|
|
1342
1350
|
constructor(args) {
|
|
@@ -1405,8 +1413,8 @@ class Schema {
|
|
|
1405
1413
|
this.addHook("afterUnmap", name, "toNumber");
|
|
1406
1414
|
}
|
|
1407
1415
|
if (definition.includes("boolean")) {
|
|
1408
|
-
this.addHook("beforeMap", name, "
|
|
1409
|
-
this.addHook("afterUnmap", name, "
|
|
1416
|
+
this.addHook("beforeMap", name, "toJSON");
|
|
1417
|
+
this.addHook("afterUnmap", name, "fromJSON");
|
|
1410
1418
|
}
|
|
1411
1419
|
}
|
|
1412
1420
|
}
|