s3db.js 7.0.0 → 7.0.1
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 +6490 -25451
- package/dist/s3db.cjs.min.js +1 -1
- package/dist/s3db.es.js +6486 -25448
- package/dist/s3db.es.min.js +1 -1
- package/dist/s3db.iife.js +6489 -25453
- package/dist/s3db.iife.min.js +1 -1
- package/package.json +38 -7
- package/src/client.class.js +2 -2
- package/src/concerns/crypto.js +17 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "s3db.js",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.1",
|
|
4
4
|
"description": "Use AWS S3, the world's most reliable document storage, as a database with this ORM.",
|
|
5
5
|
"main": "dist/s3db.cjs.js",
|
|
6
6
|
"module": "dist/s3db.es.js",
|
|
@@ -38,22 +38,53 @@
|
|
|
38
38
|
"PLUGINS.md",
|
|
39
39
|
"UNLICENSE"
|
|
40
40
|
],
|
|
41
|
-
"peerDependencies": {},
|
|
42
41
|
"dependencies": {
|
|
43
|
-
"@aws-sdk/client-s3": "^3.
|
|
42
|
+
"@aws-sdk/client-s3": "^3.846.0",
|
|
44
43
|
"@supercharge/promise-pool": "^3.2.0",
|
|
45
|
-
"fastest-validator": "^1.19.
|
|
46
|
-
"
|
|
47
|
-
"json-stable-stringify": "^1.
|
|
44
|
+
"fastest-validator": "^1.19.1",
|
|
45
|
+
"flat": "^6.0.1",
|
|
46
|
+
"json-stable-stringify": "^1.3.0",
|
|
48
47
|
"lodash-es": "^4.17.21",
|
|
49
|
-
"nanoid": "
|
|
48
|
+
"nanoid": "5.1.5",
|
|
49
|
+
"zlib": "^1.0.5"
|
|
50
|
+
},
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"@aws-sdk/client-sqs": "^3.0.0",
|
|
53
|
+
"@google-cloud/bigquery": "^7.0.0",
|
|
54
|
+
"amqplib": "^0.10.8",
|
|
55
|
+
"pg": "^8.0.0",
|
|
56
|
+
"uuid": "^9.0.0"
|
|
57
|
+
},
|
|
58
|
+
"peerDependenciesMeta": {
|
|
59
|
+
"@aws-sdk/client-sqs": {
|
|
60
|
+
"optional": true
|
|
61
|
+
},
|
|
62
|
+
"@google-cloud/bigquery": {
|
|
63
|
+
"optional": true
|
|
64
|
+
},
|
|
65
|
+
"pg": {
|
|
66
|
+
"optional": true
|
|
67
|
+
},
|
|
68
|
+
"uuid": {
|
|
69
|
+
"optional": true
|
|
70
|
+
},
|
|
71
|
+
"amqplib": {
|
|
72
|
+
"optional": true
|
|
73
|
+
}
|
|
50
74
|
},
|
|
51
75
|
"devDependencies": {
|
|
76
|
+
"@rollup/plugin-commonjs": "^28.0.6",
|
|
77
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
78
|
+
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
52
79
|
"@rollup/plugin-replace": "^6.0.1",
|
|
80
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
53
81
|
"@types/node": "24.0.14",
|
|
82
|
+
"dotenv": "^17.2.0",
|
|
54
83
|
"jest": "^29.7.0",
|
|
55
84
|
"rollup": "^4.27.4",
|
|
56
85
|
"rollup-plugin-copy": "^3.5.0",
|
|
86
|
+
"rollup-plugin-esbuild": "^6.2.1",
|
|
87
|
+
"rollup-plugin-polyfill-node": "^0.13.0",
|
|
57
88
|
"rollup-plugin-terser": "^7.0.2",
|
|
58
89
|
"typescript": "5.8.3"
|
|
59
90
|
},
|
package/src/client.class.js
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
DeleteObjectsCommand,
|
|
17
17
|
ListObjectsV2Command,
|
|
18
18
|
} from '@aws-sdk/client-s3';
|
|
19
|
-
import { md5 } from
|
|
19
|
+
import { md5 } from "./concerns/crypto.js";
|
|
20
20
|
|
|
21
21
|
import { mapAwsError, UnknownError, NoSuchKey, NotFound } from "./errors.js";
|
|
22
22
|
import { ConnectionString } from "./connection-string.class.js";
|
|
@@ -60,7 +60,7 @@ export class Client extends EventEmitter {
|
|
|
60
60
|
if (context.commandName === 'DeleteObjectsCommand') {
|
|
61
61
|
const body = args.request.body;
|
|
62
62
|
if (body && typeof body === 'string') {
|
|
63
|
-
const contentMd5 =
|
|
63
|
+
const contentMd5 = await md5(body);
|
|
64
64
|
args.request.headers['Content-MD5'] = contentMd5;
|
|
65
65
|
}
|
|
66
66
|
}
|
package/src/concerns/crypto.js
CHANGED
|
@@ -82,6 +82,23 @@ export async function decrypt(encryptedBase64, passphrase) {
|
|
|
82
82
|
return decoder.decode(decryptedContent);
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
export async function md5(data) {
|
|
86
|
+
if (typeof process === 'undefined') {
|
|
87
|
+
throw new CryptoError('MD5 hashing is only available in Node.js environment', { context: 'md5' });
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const [ok, err, result] = await tryFn(async () => {
|
|
91
|
+
const { createHash } = await import('crypto');
|
|
92
|
+
return createHash('md5').update(data).digest('base64');
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
if (!ok) {
|
|
96
|
+
throw new CryptoError('MD5 hashing failed', { original: err, data });
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return result;
|
|
100
|
+
}
|
|
101
|
+
|
|
85
102
|
async function getKeyMaterial(passphrase, salt) {
|
|
86
103
|
const [okCrypto, errCrypto, cryptoLib] = await tryFn(dynamicCrypto);
|
|
87
104
|
if (!okCrypto) throw new CryptoError('Crypto API not available', { original: errCrypto });
|