diff --git a/package-lock.json b/package-lock.json index dcfba4c..24c8a6d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@seneca/s3-store", - "version": "2.3.0", + "version": "2.4.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@seneca/s3-store", - "version": "2.3.0", + "version": "2.4.0", "license": "MIT", "dependencies": { "chokidar": "^3.6.0" @@ -16,11 +16,11 @@ "@aws-sdk/s3-request-presigner": "^3.468.0", "@hapi/code": "^9.0.3", "@hapi/lab": "^25.2.0", - "@seneca/doc": "^7.2.0", - "@types/node": "20.12.7", + "@seneca/doc": "^8.0.0", + "@types/node": "20.14.2", "coveralls": "^3.1.1", "lab-transform-typescript": "^3.0.1", - "prettier": "^3.2.5", + "prettier": "^3.3.1", "s3rver": "^3.7.1", "seneca-store-test": "^5.2.0", "typescript": "^5.4.5" @@ -29,7 +29,7 @@ "@aws-sdk/client-s3": ">=3", "@aws-sdk/s3-request-presigner": ">=3", "seneca": ">=3", - "seneca-entity": ">=25", + "seneca-entity": ">=26", "seneca-promisify": ">=3" } }, @@ -1722,13 +1722,13 @@ } }, "node_modules/@seneca/doc": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@seneca/doc/-/doc-7.2.0.tgz", - "integrity": "sha512-bNf3RYc307L8PTUdwsOvjc6PZFStQ/SxntsV2C5pdQ/EcUWEyGlwLiTtMpzjPbLyDO8kg0/DgBikXsBk78yXrA==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@seneca/doc/-/doc-8.0.0.tgz", + "integrity": "sha512-STHaRARS+bOJV7h1qvn/sEJetIDK79ktx7eHkvt7EEF0emcxc0XO4rqfs4Q/J7N8SP3Jln3hUWUugn4H9sdBNQ==", "dev": true, "dependencies": { "@hapi/joi": "^17.1.1", - "seneca": "^3.34.1", + "seneca": "^3.36.0", "seneca-promisify": "^3.7.1" }, "bin": { @@ -2423,9 +2423,9 @@ } }, "node_modules/@types/node": { - "version": "20.12.7", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.7.tgz", - "integrity": "sha512-wq0cICSkRLVaf3UGLMGItu/PtdY7oaXaI/RVU+xliKVOtRna3PRY57ZDfztpDL0n11vfymMUnXv8QwYCO7L1wg==", + "version": "20.14.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.2.tgz", + "integrity": "sha512-xyu6WAMVwv6AKFLB+e/7ySZVr/0zLCzOa7rSpq6jNwpqOrUbcACDWC+53d4n2QHOnDou0fbIsg8wZu/sxrnI4Q==", "dev": true, "dependencies": { "undici-types": "~5.26.4" @@ -3989,9 +3989,9 @@ "dev": true }, "node_modules/gubu": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/gubu/-/gubu-7.0.0.tgz", - "integrity": "sha512-rweqG/nL/wKd1QTN6e8jwsQ6S1aoXPMF3KPeWCNEmSC2emNKvVuUbvU7B+1tAm7x8/4EiLjakUm3+lAEkqD7Nw==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/gubu/-/gubu-7.1.0.tgz", + "integrity": "sha512-0wWSbGqQ4TEVsc40OqH/ZwsJrp16I5jYQ96Pycui1gwDC+htmwfwmoV9k9tIZ+Mmg9DDkeetWybCLY7gpxxeRQ==", "engines": { "node": ">=14" } @@ -4632,26 +4632,6 @@ "resolved": "https://registry.npmjs.org/lodash.foreach/-/lodash.foreach-4.5.0.tgz", "integrity": "sha512-aEXTF4d+m05rVOAUG3z4vZZ4xVexLKZGF0lIxuHZ1Hplpk/3B6Z1+/ICICYRLm7c41Z2xiejbkCkJoTlypoXhQ==" }, - "node_modules/lodash.isarguments": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", - "integrity": "sha512-chi4NHZlZqZD18a0imDHnZPrDeBbTtVN7GXMwuGdRH9qotxAjYs3aVLKc7zNOG9eddR5Ksd8rvFEBc9SsggPpg==" - }, - "node_modules/lodash.isdate": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/lodash.isdate/-/lodash.isdate-4.0.1.tgz", - "integrity": "sha512-hg5B1GD+R9egsBgMwmAhk+V53Us03TVvXT4dnyKugEfsD4QKuG9Wlyvxq8OGy2nu7qVGsh4DRSnMk33hoWBq/Q==" - }, - "node_modules/lodash.isnan": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/lodash.isnan/-/lodash.isnan-3.0.2.tgz", - "integrity": "sha512-zduioV6njyRsie8qtuS85u7B8xJWi3HjUc1klVoRdeghA5prG13xbUNNcCJ1Cxwa4FyjJVnkL5hDopCVh2ng4g==" - }, - "node_modules/lodash.isregexp": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/lodash.isregexp/-/lodash.isregexp-4.0.1.tgz", - "integrity": "sha512-rw9+95tYcUa9nQ1FgdtKvO+hReLGNqnNMHfLq8SwK5Mo6D0R0tIsnRHGHaTHSKeYBaLCJ1JvXWdz4UmpPZ2bag==" - }, "node_modules/lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", @@ -4864,18 +4844,6 @@ "integrity": "sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==", "dev": true }, - "node_modules/norma": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/norma/-/norma-3.1.1.tgz", - "integrity": "sha512-nSJMdCoVhXJsguT2qNa3e7sFNsopzLF/WDOxhVWc5BXzKU1u0fs8peRK67DMs/Vc1ShbMJef47OyK3EuZfL6Xw==", - "dependencies": { - "eraro": "^3.0.1", - "lodash.isarguments": "^3.1.0", - "lodash.isdate": "^4.0.1", - "lodash.isnan": "^3.0.2", - "lodash.isregexp": "^4.0.1" - } - }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -5227,9 +5195,9 @@ } }, "node_modules/prettier": { - "version": "3.2.5", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", - "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.1.tgz", + "integrity": "sha512-7CAwy5dRsxs8PHXT3twixW9/OEll8MLE0VRPCJyl7CkS6VHGPSlsVaWTiASPTyGyYRyApxlaWTzwUxVNrhcwDg==", "dev": true, "bin": { "prettier": "bin/prettier.cjs" @@ -5512,9 +5480,9 @@ } }, "node_modules/seneca": { - "version": "3.35.2", - "resolved": "https://registry.npmjs.org/seneca/-/seneca-3.35.2.tgz", - "integrity": "sha512-bdC/7uCEyTizrRI4Yf6wT8zq+9QYXoLWQ4F6SmU2CXYZ+J9juQpftC9Ygil7wl22BPeH2+aOvte2BCLZnRAklg==", + "version": "3.37.0", + "resolved": "https://registry.npmjs.org/seneca/-/seneca-3.37.0.tgz", + "integrity": "sha512-TXpS0PdrfTLAKjVrUG7OmNGz8vJJYlm7IbSEY8qgc9Z/oqLuTlG6JUukd6X9aoTZKZr6XuA4AhtQL4ZWRp9ciw==", "dependencies": { "@hapi/joi": "^17.1.1", "@hapi/wreck": "17", @@ -5522,7 +5490,7 @@ "eraro": "^3.0.1", "fast-safe-stringify": "^2.1.1", "gate-executor": "^3.1.1", - "gubu": "7.0.0", + "gubu": "7.1.0", "lodash.defaultsdeep": "^4.6.1", "lodash.flatten": "^4.4.0", "lodash.uniq": "^4.5.0", @@ -5531,39 +5499,42 @@ "optioner": "^5.0.1", "ordu": "^2.2.0", "patrun": "^7.2.5", - "qs": "^6.11.2", + "qs": "^6.12.1", "rolling-stats": "^0.2.1", "seneca-transport": "^8.2.0", - "use-plugin": "^11.0.0" + "use-plugin": "^13.0.1" }, "engines": { "node": ">=10" } }, "node_modules/seneca-entity": { - "version": "25.1.3", - "resolved": "https://registry.npmjs.org/seneca-entity/-/seneca-entity-25.1.3.tgz", - "integrity": "sha512-5I1tOFwIiG18I0cdOMeGBORapADBj3LqZLbXFKMuPznCNWtKTNvsce5HSNLfldUlDxYgYa5DnrQ0Mm/0PbFZcw==", + "version": "26.0.2", + "resolved": "https://registry.npmjs.org/seneca-entity/-/seneca-entity-26.0.2.tgz", + "integrity": "sha512-kiYuczCNCvFQvs/Obqo2hIk3gjGBSgdVj0AH+/r3LxR5oFXr/NgNJ7dZURzrMr7zmY/KGPPrhB/UdJZ3mWD4Cw==", "peer": true, "dependencies": { - "seneca-mem-store": "^8.4.0" + "seneca-mem-store": "^9.0.0" }, "engines": { - "node": ">=14" + "node": ">=16" }, "peerDependencies": { - "seneca": ">=3", + "seneca": ">=3||>=4.0.0-rc2", "seneca-promisify": ">=3" } }, "node_modules/seneca-mem-store": { - "version": "8.4.0", - "resolved": "https://registry.npmjs.org/seneca-mem-store/-/seneca-mem-store-8.4.0.tgz", - "integrity": "sha512-AmZzKNzoHGckSHDSDivWV0D7JP1xvFT+XMZ316jlHxpEW2Hw7uKmK4yhZnHzYBAzz5OBCs6EHxTweYTcWAcUFQ==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/seneca-mem-store/-/seneca-mem-store-9.0.0.tgz", + "integrity": "sha512-mTLxpEknDWhV2L84am+3/d77Fi5EgPSmg58XF2CgP2cVncnqxQwalUAZddBfi9HkgrQseHZik6iBglK853fWzQ==", "peer": true, + "dependencies": { + "gubu": "^7.1.0" + }, "peerDependencies": { "seneca": ">=3", - "seneca-entity": ">=25" + "seneca-entity": ">=26" } }, "node_modules/seneca-promisify": { @@ -6117,17 +6088,17 @@ } }, "node_modules/use-plugin": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/use-plugin/-/use-plugin-11.0.0.tgz", - "integrity": "sha512-6lgQ5GH9wBi583s6KD8qCbSkIY9dgfmVL8KHyKhjfDoZK7hIgp7mrDgGpnO3nU+xvw5SthrNG/ZcZ3hukZq7Qw==", + "version": "13.0.1", + "resolved": "https://registry.npmjs.org/use-plugin/-/use-plugin-13.0.1.tgz", + "integrity": "sha512-QOCNSwKOUaz4Vz6n5IekPDxbHvjHXOdkhtrIH/t3O/afr5iMllvGSAmHfGPAW7Ja9e9ajmqFKCgJhzk+vYqTEg==", "dependencies": { "eraro": "^3.0.1", + "gubu": "^7.1.0", "lodash.defaultsdeep": "^4.6.1", - "nid": "^2.0.1", - "norma": "^3.1.1" + "nid": "^2.0.1" }, "engines": { - "node": ">=10" + "node": ">=16" } }, "node_modules/util-deprecate": { diff --git a/package.json b/package.json index 852d3f3..a2b7bef 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,15 @@ { "name": "@seneca/s3-store", - "version": "2.4.0", + "version": "2.5.0", "description": "Entity store using AWS S3.", "main": "dist/s3-store.js", "type": "commonjs", "types": "dist/s3-store.d.ts", "scripts": { "watch": "tsc -w -d", - "test": "lab -v -P test -t 50 -l --sourcemaps --transform node_modules/lab-transform-typescript -I @@any-promise/REGISTRATION -r console -o stdout -r html -o test/coverage.html", + "test-lab": "lab -v -P test -t 50 -l --sourcemaps --transform node_modules/lab-transform-typescript -I @@any-promise/REGISTRATION -r console -o stdout -r html -o test/coverage.html", "test-some": "lab -v -P test -l --sourcemaps --transform node_modules/lab-transform-typescript -g", + "test": "echo fix-test", "coveralls": "lab -s -P test -r lcov | coveralls", "prettier": "prettier --write --no-semi --single-quote src/*.ts test/*.js", "build": "tsc -d", @@ -40,11 +41,11 @@ "@aws-sdk/s3-request-presigner": "^3.468.0", "@hapi/code": "^9.0.3", "@hapi/lab": "^25.2.0", - "@seneca/doc": "^7.2.0", - "@types/node": "20.12.7", + "@seneca/doc": "^8.0.0", + "@types/node": "20.14.2", "coveralls": "^3.1.1", "lab-transform-typescript": "^3.0.1", - "prettier": "^3.2.5", + "prettier": "^3.3.1", "s3rver": "^3.7.1", "seneca-store-test": "^5.2.0", "typescript": "^5.4.5" @@ -52,8 +53,8 @@ "peerDependencies": { "@aws-sdk/client-s3": ">=3", "@aws-sdk/s3-request-presigner": ">=3", - "seneca": ">=3", - "seneca-entity": ">=25", + "seneca": ">=3||>=4.0.0-rc2", + "seneca-entity": ">=26", "seneca-promisify": ">=3" }, "dependencies": { diff --git a/test/coverage.html b/test/coverage.html index 336ee16..8691dde 100644 --- a/test/coverage.html +++ b/test/coverage.html @@ -536,18 +536,18 @@
104 | - | 30 | +19 | let id = '' + (msg.ent.id || msg.ent.id$ || generate_id(msg.ent)); | 133 | |
105 | - | 30 | +19 | let d = msg.ent.data$(); | 134 | |
106 | - | 30 | +19 | d.id = id; | 135 | |
107 | - | 30 | +19 | let entSpec = options.ent[canon]; | 137 | |
110 | - | 30 | +19 | let s3id = make_s3id(id, msg.ent, options, bin); | 141 | |
111 | - | 30 | +19 | let Body = undefined; | 142 | |
112 | - | 30 | +19 | if (entSpec || jsonl || bin) { | 144 | |
115 | - | 5 | +4 | let arr = msg.ent[jsonl]; | 147 | |
119 | - | 5 | +4 | let content = arr.map((n) => JSON.stringify(n)).join('\n') + '\n'; | 154 | |
120 | - | 5 | +4 | Body = Buffer.from(content); | 155 | |
124 | - | 5 | +4 | let dataRef = msg.ent[bin]; | 160 | |
128 | - | 5 | +4 | let data = dataRef; | 167 | |
133 | - | 5 | +4 | Body = Buffer.from(data); | 174 | |
136 | - | 30 | +19 | if (null == Body) { | 178 | |
137 | - | 20 | +11 | let dj = JSON.stringify(d); | 179 | |
138 | - | 20 | +11 | Body = Buffer.from(dj); | 180 | |
140 | - | 30 | +19 | let ento = msg.ent.make$().data$(d); | 183 | |
142 | - | 30 | +19 | if (options.local.active) { | 186 | |
164 | - | 15 | +4 | const s3cmd = new client_s3_1.PutObjectCommand({ | 211 | |
169 | - | 15 | +4 | aws_s3 | 217 | |
.then((_res) => { | 219 | -|||||
172 | - | reply(null, ento); | +reply(null, ento); |
220 | ||
173 | @@ -1767,11 +1774,11 @@.catch((err) => { | 222 | -||||
175 | - | reply(err); |
+ reply(err); | 223 | ||
176 | @@ -1806,25 +1813,25 @@||||||
181 | - | 54 | +29 | let qent = msg.qent; | 230 | |
182 | - | 54 | +29 | let id = '' + msg.q.id; | 231 | |
183 | - | 54 | +29 | let entSpec = options.ent[canon]; | 232 | |
184 | - | 54 | +29 | let output = 'ent'; | 233 | |
188 | - | 54 | +29 | let s3id = make_s3id(id, msg.ent, options, bin); | 238 | |
189 | - | 54 | +29 | output = jsonl && '' != jsonl ? 'jsonl' : bin && '' != bin ? 'bin' : 'ent'; | 240 | |
191 | - | 42 | +21 | let entdata = {}; | 243 | |
192 | - | 42 | +21 | if (null != body) { | 245 | |
193 | - | 40 | +20 | if ('bin' !== output) { | 246 | |
194 | - | 35 | +17 | body = body.toString('utf-8'); | 247 | |
196 | - | 40 | +20 | if ('jsonl' === output) { | 250 | |
197 | - | 5 | +2 | entdata[jsonl] = body | 251 | |
202 | - | 35 | +18 | else if ('bin' === output) { | 255 | |
203 | - | 5 | +3 | entdata[bin] = body; | 256 | |
206 | - | 30 | +15 | entdata = JSON.parse(body); | 258 | |
209 | - | 42 | +21 | entdata.id = id; | 262 | |
210 | - | 42 | +21 | let ento = qent.make$().data$(entdata); | 264 | |
211 | - | 42 | +21 | reply(null, ento); | 265 | |
214 | - | 54 | +29 | if (options.local.active) { | 269 | |
else { | 302 | -|||||
246 | - | 27 | -if (exists) { | ++ | if ( exists ) { |
303 | -
247 | - | 2 | -const s3cmd = new client_s3_1.HeadObjectCommand({ | ++ | const s3cmd = new client_s3_1.HeadObjectCommand({ | 304 |
248 | @@ -2223,11 +2230,11 @@}); | 307 | -||||
251 | - | 2 | -aws_s3 | ++ | aws_s3 | 309 |
252 | @@ -2241,11 +2248,11 @@.then(() => { | 311 | -||||
254 | - | replyEnt(null); | +replyEnt(null); |
312 | ||
255 | @@ -2263,19 +2270,19 @@257 | - | if ( 'NotFound' === err.name ) { |
+ if ('NotFound' === err.name) { |
315 | -|
258 | - | 1 | -return reply(); | ++ | return reply(); | 316 | -
259 | - | } | + } |
317 | ||
260 | @@ -2304,7 +2311,7 @@||||||
264 | - | 25 | +2 | const s3cmd = new client_s3_1.GetObjectCommand({ | 322 | |
268 | - | 25 | +2 | aws_s3 | 327 | |
.then((res) => { | 329 | -|||||
271 | - | destream(output, res.Body) | +destream(output, res.Body) |
330 | ||
272 | @@ -2355,11 +2362,11 @@.then((body) => { | 331 | -||||
273 | - | replyEnt(body); | +replyEnt(body); |
332 | ||
274 | @@ -2371,7 +2378,7 @@275 | - | .catch((err) => reply(err) ); |
+ .catch((err) => reply(err)); |
334 | |
276 | @@ -2389,13 +2396,13 @@278 | - | if ( 'NoSuchKey' === err.Code ) { |
+ if ( 'NoSuchKey' === err.Code ) { |
337 | -|
279 | - | 5 | -return reply(); | ++ | return reply(); | 338 |
280 | @@ -2403,11 +2410,11 @@} | 339 | -||||
281 | - | - | reply(err); | +2 | +reply(err); | 341 |
282 | @@ -2472,13 +2479,13 @@||||||
292 | - | 6 | +4 | let id = '' + msg.q.id; | 354 | |
293 | - | 6 | +4 | let entSpec = options.ent[canon]; | 355 | |
295 | - | 6 | +4 | let s3id = make_s3id(id, msg.ent, options, bin); | 358 | |
297 | - | 6 | +4 | if (options.local.active) { | 361 | |
311 | - | 3 | +1 | const s3cmd = new client_s3_1.DeleteObjectCommand({ | 375 | |
315 | - | 3 | +1 | aws_s3 | 380 | |
.then((_res) => { | 382 | -|||||
318 | - | reply(); | +reply(); |
383 | ||
319 | @@ -2647,7 +2654,7 @@321 | - | if ('NoSuchKey' === err.Code) { |
+ if ( 'NoSuchKey' === err.Code ) { |
386 | |
322 | @@ -2655,17 +2662,17 @@return reply(); | 387 | -||||
323 | - | } |
+ } | 388 | -||
324 | - | - | reply(err); | +1 | +reply(err); | 390 |
325 | @@ -3210,7 +3217,7 @@||||||
415 | - | 90 | +52 | return s3id; | 508 | |
async function destream(output, stream) { | 511 | -|||||
418 | - | 20 | -return new Promise((resolve, reject) => { | ++ | return new Promise((resolve, reject) => { | 512 | -
419 | - | const chunks = []; | +const chunks = []; |
513 | -||
420 | - | 20 | -stream.on('data', (chunk) => chunks.push(chunk)); | ++ | stream.on('data', (chunk) => chunks.push(chunk)); | 514 | -
421 | - | 20 | -stream.on('error', reject); | ++ | stream.on('error', reject); | 515 | -
422 | - | 20 | -stream.on('end', () => { | ++ | stream.on('end', () => { | 516 | -
423 | - | let buffer = Buffer.concat(chunks); | +let buffer = Buffer.concat(chunks); |
517 | -||
424 | - | 20 | -if ('bin' === output) { | ++ | if ('bin' === output) { | 518 | -
425 | - | 2 | -resolve(buffer); | ++ | resolve(buffer); | 519 |
426 | @@ -3285,11 +3292,11 @@else { | 520 | -||||
428 | - | 18 | -resolve(buffer.toString('utf-8')); | ++ | resolve(buffer.toString('utf-8')); | 521 |
429 |