diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7b48c74..55aed5d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,8 +33,8 @@ jobs: - run: npm run build --if-present - run: npm test - - name: Coveralls - uses: coverallsapp/github-action@master - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - path-to-lcov: ./coverage/lcov.info + # - name: Coveralls + # uses: coverallsapp/github-action@master + # with: + # github-token: ${{ secrets.GITHUB_TOKEN }} + # path-to-lcov: ./coverage/lcov.info diff --git a/dist/s3-store.js b/dist/s3-store.js index 2039d34..d7b8f6b 100644 --- a/dist/s3-store.js +++ b/dist/s3-store.js @@ -356,7 +356,7 @@ async function s3_store(options) { process: async function (trigger, gateway) { let { record, event } = trigger; return gateway({ ...msg, record, event }, trigger); - } + }, }; return gatewayHandler; }; diff --git a/dist/s3-store.js.map b/dist/s3-store.js.map index 93ca80c..eed39e3 100644 --- a/dist/s3-store.js.map +++ b/dist/s3-store.js.map @@ -1 +1 @@ -{"version":3,"file":"s3-store.js","sourceRoot":"","sources":["../src/s3-store.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;;;AAEzD,gDAAuB;AACvB,2DAA6B;AAE7B,wDAA+B;AAE/B,+BAAmE;AAEnE,kDAK2B;AAE3B,wEAA4D;AAE5D,gCAAgC;AAEhC,QAAQ,CAAC,QAAQ,GAAG;IAClB,KAAK,EAAE,KAAK;IAEZ,MAAM,EAAE,IAAA,YAAK,EAAC,cAAc,CAAC;IAC7B,MAAM,EAAE,IAAA,YAAK,EAAC,OAAO,CAAC;IACtB,MAAM,EAAE,IAAA,UAAG,GAAE;IACb,EAAE,EAAE,EAAE;IAEN,yBAAyB;IACzB,GAAG,EAAE,IAAA,WAAI,EAAC,EAAE,CAAC;IAEb,MAAM,EAAE,IAAA,WAAI,EAAC,EAAE,CAAC;IAEhB,+DAA+D;IAC/D,KAAK,EAAE;QACL,MAAM,EAAE,KAAK;QACb,MAAM,EAAE,EAAE;QACV,KAAK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E,UAAU,EAAE,CAAC,CAAA;AAC9D,MAAM,CAAC,OAAO,GAAG,QAAQ,CAAA"} \ No newline at end of file diff --git a/package.json b/package.json index e1e155b..2bbf7c7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@seneca/s3-store", - "version": "1.1.0", + "version": "2.0.0", "description": "Entity store using AWS S3.", "main": "dist/s3-store.js", "type": "commonjs", diff --git a/src/s3-store.ts b/src/s3-store.ts index 53d079e..711e12a 100644 --- a/src/s3-store.ts +++ b/src/s3-store.ts @@ -71,7 +71,7 @@ async function s3_store(this: any, options: any) { let local_folder: string = '' - seneca.init(function(reply: () => void) { + seneca.init(function (reply: () => void) { if (options.local.active) { let folder: string = options.local.folder local_folder = @@ -116,8 +116,7 @@ async function s3_store(this: any, options: any) { // .on('ready', () => console.log('WATCH initial scan complete. ready for changes')); } } - } - else { + } else { const s3_opts = { s3ForcePathStyle: true, ...options.s3, @@ -130,7 +129,7 @@ async function s3_store(this: any, options: any) { let store = { name: 's3-store', - save: function(msg: any, reply: any) { + save: function (msg: any, reply: any) { // console.log('MSG', msg) let canon = msg.ent.entity$ @@ -225,7 +224,7 @@ async function s3_store(this: any, options: any) { } }, - load: function(msg: any, reply: any) { + load: function (msg: any, reply: any) { let canon = msg.ent.entity$ let qent = msg.qent let id = '' + msg.q.id @@ -313,11 +312,11 @@ async function s3_store(this: any, options: any) { }, // NOTE: S3 folder listing not supported yet. - list: function(_msg: any, reply: any) { + list: function (_msg: any, reply: any) { reply([]) }, - remove: function(msg: any, reply: any) { + remove: function (msg: any, reply: any) { let canon = (msg.ent || msg.qent).entity$ let id = '' + msg.q.id let entSpec = options.ent[canon] @@ -360,11 +359,11 @@ async function s3_store(this: any, options: any) { } }, - close: function(_msg: any, reply: () => void) { + close: function (_msg: any, reply: () => void) { reply() }, - native: function(_msg: any, reply: any) { + native: function (_msg: any, reply: any) { reply({ client: aws_s3, local: { ...options.local } }) }, } @@ -432,7 +431,6 @@ async function s3_store(this: any, options: any) { } } - const makeGatewayHandler = (msg: object) => { const gatewayHandler = { name: 's3', @@ -441,11 +439,14 @@ async function s3_store(this: any, options: any) { console.log('S3 MATCHED', matched, trigger) return matched }, - process: async function( - this: typeof seneca, trigger: { record: any, event: any }, gateway: Function) { + process: async function ( + this: typeof seneca, + trigger: { record: any; event: any }, + gateway: Function, + ) { let { record, event } = trigger return gateway({ ...msg, record, event }, trigger) - } + }, } return gatewayHandler } @@ -465,11 +466,11 @@ function make_s3id(id: string, ent: any, options: any, bin: boolean) { null == id ? null : (null == options.folder - ? options.prefix + ent.entity$ - : options.folder) + - ('' == options.folder ? '' : '/') + - id + - (bin ? '' : options.suffix) + ? options.prefix + ent.entity$ + : options.folder) + + ('' == options.folder ? '' : '/') + + id + + (bin ? '' : options.suffix) // console.log('make_s3id', s3id, id, ent, options) return s3id diff --git a/test/coverage.html b/test/coverage.html index 947ec26..bd9d33a 100644 --- a/test/coverage.html +++ b/test/coverage.html @@ -547,7 +547,7 @@

Test Report

0
0
17
-
1743
+
1635
@@ -574,42 +574,42 @@

Test Report

happy - 170 + 165 2 jsonl-s3 - 194 + 191 3 jsonl-s3-customid - 104 + 108 4 jsonl-local-basic - 80 + 76 5 bin-s3-basic - 101 + 100 6 bin-local-basic - 76 + 72 7 @@ -623,7 +623,7 @@

Test Report

store-init load-store-plugin - 122 + 120 9 @@ -637,56 +637,56 @@

Test Report

store-keyvalue save-load-auto-id - 110 + 101 11 store-keyvalue save-load-given-id - 90 + 84 12 store-keyvalue remove - 81 + 61 13 store-init load-store-plugin - 122 + 118 14 store-init clear-data - 4 + 5 15 store-keyvalue save-load-auto-id - 62 + 35 16 store-keyvalue save-load-given-id - 27 + 24 17 store-keyvalue remove - 14 + 17 @@ -1274,1585 +1274,1585 @@

dist/s3-store.js

else { - 120 + 119 93 5 const s3_opts = { - 121 + 120 94 s3ForcePathStyle: true, - 122 + 121 95 ...options.s3, - 123 + 122 96 }; - 124 + 123 97 5 aws_s3 = new client_s3_1.S3Client(s3_opts); - 125 + 124 98 } - 126 + 125 99 9 reply(); - 128 + 127 100 }); - 129 + 128 101 9 let store = { - 131 + 130 102 name: 's3-store', - 132 + 131 103 save: function (msg, reply) { - 133 + 132 104 // console.log('MSG', msg) - 134 + 133 105 let canon = msg.ent.entity$; - 136 + 135 106 30 let id = '' + (msg.ent.id || msg.ent.id$ || generate_id(msg.ent)); - 137 + 136 107 30 let d = msg.ent.data$(); - 138 + 137 108 30 d.id = id; - 139 + 138 109 30 let entSpec = options.ent[canon]; - 141 + 140 110
let jsonl = (
entSpec === null
|| entSpec === void 0 ? void 0 : entSpec.jsonl) || msg.jsonl$ || msg.q.jsonl$;
- 142 + 141 111
let bin = (
entSpec === null
|| entSpec === void 0 ? void 0 : entSpec.bin) || msg.bin$ || msg.q.bin$;
- 143 + 142 112 30 let s3id = make_s3id(id, msg.ent, options, bin); - 145 + 144 113 30 let Body = undefined; - 146 + 145 114 30 if (entSpec || jsonl || bin) { - 148 + 147 115 // JSONL files - 149 + 148 116
if ('string' === typeof jsonl &&
'' !== jsonl
) {
- 150 + 149 117 5 let arr = msg.ent[jsonl]; - 151 + 150 118
if (
!Array.isArray(arr)
) {
- 152 + 151 119 throw new Error('s3-store: option ent.jsonl array field not found: ' + jsonl); - 155 + 154 120 } - 156 + 155 121 5 let content = arr.map((n) => JSON.stringify(n)).join('\n') + '\n'; - 158 + 157 122 5 Body = Buffer.from(content); - 159 + 158 123 } - 160 + 159 124 // Binary files - 162 + 161 125
else if (
'string' === typeof bin
&&
'' !== bin
) {
- 163 + 162 126 5 let data = msg.ent[bin]; - 164 + 163 127
if (
null == data
) {
- 165 + 164 128 throw new Error('s3-store: option ent.bin data field not found: ' + bin); - 168 + 167 129 } - 169 + 168 130 5 Body = Buffer.from(data); - 171 + 170 131 } - 172 + 171 132 } - 173 + 172 133 30 if (null == Body) { - 175 + 174 134 20 let dj = JSON.stringify(d); - 176 + 175 135 20 Body = Buffer.from(dj); - 177 + 176 136 } - 178 + 177 137 // console.log('BODY', Body, entSpec?.bin ? '' : '<' + Body.toString() + '>') - 180 + 179 138 // console.log('options:: ', options, seneca.util.Nid() ) - 181 + 180 139 30 let ento = msg.ent.make$().data$(d); - 183 + 182 140 // Local file - 185 + 184 141 30 if (options.local.active) { - 186 + 185 142
let full = path_1.default.join(local_folder,
s3id
||
id
);
- 187 + 186 143 15 let path = path_1.default.dirname(full); - 188 + 187 144
if (
options.debug
) {
- 190 + 189 145 console.log(PLUGIN, 'save', path, Body.length); - 191 + 190 146 } - 192 + 191 147 15 promises_1.default.mkdir(path, { recursive: true }) - 194 + 193 148 .then(() => { - 195 + 194 149 promises_1.default.writeFile(full, Body) - 196 + 195 150 .then((_res) => { - 197 + 196 151 reply(null, ento); - 198 + 197 152 }) - 199 + 198 153 .catch((err) => { - 200 + 199 154
reply(err);
- 201 + 200 155 }); - 202 + 201 156 }) - 203 + 202 157 .catch((err) => { - 204 + 203 158
reply(err);
- 205 + 204 159 }); - 206 + 205 160 } - 207 + 206 161 // AWS S3 - 209 + 208 162 else { - 210 + 209 163 15 const s3cmd = new client_s3_1.PutObjectCommand({ - 211 + 210 164 ...s3_shared_options, - 212 + 211 165 Key: s3id, - 213 + 212 166 Body, - 214 + 213 167 }); - 215 + 214 168 15 aws_s3 - 217 + 216 169 .send(s3cmd) - 218 + 217 170 .then((_res) => { - 219 + 218 171 reply(null, ento); - 220 + 219 172 }) - 221 + 220 173 .catch((err) => { - 222 + 221 174
reply(err);
- 223 + 222 175 }); - 224 + 223 176 } - 225 + 224 177 }, - 226 + 225 178 load: function (msg, reply) { - 228 + 227 179 let canon = msg.ent.entity$; - 229 + 228 180 50 let qent = msg.qent; - 230 + 229 181 50 let id = '' + msg.q.id; - 231 + 230 182 50 let entSpec = options.ent[canon]; - 232 + 231 183 50 let output = 'ent'; - 233 + 232 184
let jsonl = (
entSpec === null
|| entSpec === void 0 ? void 0 : entSpec.jsonl) ||
msg.jsonl$
|| msg.q.jsonl$;
- 234 + 233 185
let bin = (
entSpec === null
|| entSpec === void 0 ? void 0 : entSpec.bin) ||
msg.bin$
|| msg.q.bin$;
- 235 + 234 186 50 let s3id = make_s3id(id, msg.ent, options, bin); - 237 + 236 187 50 output = jsonl && '' != jsonl ? 'jsonl' : bin && '' != bin ? 'bin' : 'ent'; - 239 + 238 188 function replyEnt(body) { - 241 + 240 189 40 let entdata = {}; - 242 + 241 190 // console.log('DES', output, body) - 244 + 243 191 40 if ('bin' !== output) { - 245 + 244 192 35 body = body.toString('utf-8'); - 246 + 245 193 } - 247 + 246 194 40 if ('jsonl' === output) { - 249 + 248 195 5 entdata[jsonl] = body - 250 + 249 196 .split('\n') - 251 + 250 197 .filter((n) => '' !== n) - 252 + 251 198 .map((n) => JSON.parse(n)); - 253 + 252 199 } - 254 + 253 200 35 else if ('bin' === output) { - 254 + 253 201 5 entdata[bin] = body; - 255 + 254 202 } - 256 + 255 203 else { - 256 + 255 204 30 entdata = JSON.parse(body); - 257 + 256 205 } - 258 + 257 206 40 entdata.id = id; - 260 + 259 207 40 let ento = qent.make$().data$(entdata); - 262 + 261 208 40 reply(null, ento); - 263 + 262 209 } - 264 + 263 210 // Local file - 266 + 265 211 50 if (options.local.active) { - 267 + 266 212
let full = path_1.default.join(local_folder,
s3id
||
id
);
- 268 + 267 213 // console.log('FULL', full) - 269 + 268 214
if (
options.debug
) {
- 271 + 270 215 console.log(PLUGIN, 'load', full); - 272 + 271 216 } - 273 + 272 217 25 promises_1.default.readFile(full) - 275 + 274 218 .then((body) => { - 276 + 275 219 replyEnt(body); - 277 + 276 220 }) - 278 + 277 221 .catch((err) => { - 279 + 278 222
if (
'ENOENT' == err.code
) {
- 280 + 279 223 5 return reply(); - 281 + 280 224 } - 282 + 281 225 reply(err); - 283 + 282 226 }); - 284 + 283 227 } - 285 + 284 228 // AWS S3 - 287 + 286 229 else { - 288 + 287 230 25 const s3cmd = new client_s3_1.GetObjectCommand({ - 289 + 288 231 ...s3_shared_options, - 290 + 289 232 Key: s3id, - 291 + 290 233 }); - 292 + 291 234 25 aws_s3 - 294 + 293 235 .send(s3cmd) - 295 + 294 236 .then((res) => { - 296 + 295 237 // console.log(res) - 297 + 296 238 destream(output, res.Body) - 299 + 298 239 .then((body) => { - 300 + 299 240 replyEnt(body); - 301 + 300 241 }) - 302 + 301 242
.catch((err) =>
reply(err)
);
- 303 + 302 243 }) - 304 + 303 244 .catch((err) => { - 305 + 304 245
if (
'NoSuchKey' === err.Code
) {
- 306 + 305 246 5 return reply(); - 307 + 306 247 } - 308 + 307 248 reply(err); - 310 + 309 249 }); - 311 + 310 250 } - 312 + 311 251 }, - 313 + 312 252 // NOTE: S3 folder listing not supported yet. - 315 + 314 253 list: function (_msg, reply) { - 316 + 315 254 reply([]); - 317 + 316 255 }, - 318 + 317 256 remove: function (msg, reply) { - 320 + 319 257
let canon = (
msg.ent
||
msg.qent
).entity$;
- 321 + 320 258 6 let id = '' + msg.q.id; - 322 + 321 259 6 let entSpec = options.ent[canon]; - 323 + 322 260
let bin = (
entSpec === null
|| entSpec === void 0 ? void 0 :
entSpec.bin
) ||
msg.bin$
|| msg.q.bin$;
- 324 + 323 261 6 let s3id = make_s3id(id, msg.ent, options, bin); - 326 + 325 262 // Local file - 328 + 327 263 6 if (options.local.active) { - 329 + 328 264
let full = path_1.default.join(local_folder,
s3id
||
id
);
- 330 + 329 265 3 promises_1.default.unlink(full) - 332 + 331 266 .then((_res) => { - 333 + 332 267 reply(); - 334 + 333 268 }) - 335 + 334 269 .catch((err) => { - 336 + 335 270
if (
'ENOENT' == err.code
) {
- 337 + 336 271 2 return reply(); - 338 + 337 272 } - 339 + 338 273 reply(err); - 340 + 339 274 }); - 341 + 340 275 } - 342 + 341 276 else { - 342 + 341 277 3 const s3cmd = new client_s3_1.DeleteObjectCommand({ - 343 + 342 278 ...s3_shared_options, - 344 + 343 279 Key: s3id, - 345 + 344 280 }); - 346 + 345 281 3 aws_s3 - 348 + 347 282 .send(s3cmd) - 349 + 348 283 .then((_res) => { - 350 + 349 284 reply(); - 351 + 350 285 }) - 352 + 351 286 .catch((err) => { - 353 + 352 287
if ('NoSuchKey' === err.Code) {
- 354 + 353 288 return reply(); - 355 + 354 289
}
- 356 + 355 290 reply(err); - 358 + 357 291 }); - 359 + 358 292 } - 360 + 359 293 }, - 361 + 360 294 close: function (_msg, reply) { - 363 + 362 295
reply();
- 364 + 363 296 }, - 365 + 364 297 native: function (_msg, reply) { - 367 + 366 298
reply({ client: aws_s3, local: { ...options.local } });
- 368 + 367 299 }, - 369 + 368 300 }; - 370 + 369 301 9 let meta = init(seneca, options, store); - 372 + 371 302 9 seneca.message('cloud:aws,service:store,get:url,kind:upload', { - 376 + 375 303 bucket: String, - 377 + 376 304 filepath: String, - 378 + 377 305 expire: Number, - 379 + 378 306 }, get_upload_url); - 382 + 381 307 9 seneca.message('cloud:aws,service:store,get:url,kind:download', { - 386 + 385 308 bucket: String, - 387 + 386 309 filepath: String, - 388 + 387 310 expire: Number, - 389 + 388 311 }, get_download_url); - 392 + 391 312 async function get_upload_url(msg) { - 394 + 393 313 const bucket = msg.bucket; - 395 + 394 314 const filepath = msg.filepath; - 396 + 395 315 const expire = msg.expire; - 397 + 396 316 const command = new client_s3_1.PutObjectCommand({ - 399 + 398 317 Bucket: bucket, - 400 + 399 318 Key: filepath, - 401 + 400 319 }); - 402 + 401 320 const url = await (0, s3_request_presigner_1.getSignedUrl)(aws_s3, command, { - 403 + 402 321 expiresIn: expire, - 404 + 403 322 }); - 405 + 404 323 return { - 407 + 406 324 url, - 408 + 407 325 bucket, - 409 + 408 326 filepath, - 410 + 409 327 expire, - 411 + 410 328 }; - 412 + 411 329 } - 413 + 412 330 async function get_download_url(msg) { - 415 + 414 331 const bucket = msg.bucket; - 416 + 415 332 const filepath = msg.filepath; - 417 + 416 333 const expire = msg.expire; - 418 + 417 334 const command = new client_s3_1.GetObjectCommand({ - 420 + 419 335 Bucket: bucket, - 421 + 420 336 Key: filepath, - 422 + 421 337 }); - 423 + 422 338 const url = await (0, s3_request_presigner_1.getSignedUrl)(aws_s3, command, { - 424 + 423 339 expiresIn: expire, - 425 + 424 340 }); - 426 + 425 341 return { - 427 + 426 342 url, - 428 + 427 343 bucket, - 429 + 428 344 filepath, - 430 + 429 345 expire, - 431 + 430 346 }; - 432 + 431 347 } - 433 + 432 348 9 const makeGatewayHandler = (msg) => { - 436 + 434 349
const gatewayHandler = {
- 437 + 435 350 name: 's3', - 438 + 436 351 match: (trigger) => { - 439 + 437 352
let matched = 'aws:s3' === trigger.record.eventSource;
- 440 + 438 353 console.log('S3 MATCHED', matched, trigger); - 441 + 439 354 return matched; - 442 + 440 355 }, - 443 + 441 356 @@ -2864,271 +2864,271 @@

dist/s3-store.js

let { record, event } = trigger;
- 446 + 447 358 return gateway({ ...msg, record, event }, trigger); - 447 + 448 359 - } - 448 + }, + 449 360
};
- 449 + 450 361 return gatewayHandler; - 450 + 451 362 }; - 451 + 452 363 9 return { - 453 + 454 364 name: store.name, - 454 + 455 365 tag: meta.tag, - 455 + 456 366 exports: { - 456 + 457 367 native: aws_s3, - 457 + 458 368 makeGatewayHandler, - 458 + 459 369 }, - 459 + 460 370 }; - 460 + 461 371 } - 461 + 462 372 function make_s3id(id, ent, options, bin) { - 463 + 464 373
let s3id =
null == id
- 465 + 466 374
?
null
- 466 + 467 375 : (null == options.folder - 467 + 468 376 ? options.prefix + ent.entity$ - 468 + 469 377 : options.folder) + - 469 + 470 378 ('' == options.folder ? '' : '/') + - 470 + 471 379 id + - 471 + 472 380 (bin ? '' : options.suffix); - 472 + 473 381 // console.log('make_s3id', s3id, id, ent, options) - 474 + 475 382 86 return s3id; - 475 + 476 383 } - 476 + 477 384 async function destream(output, stream) { - 478 + 479 385 20 return new Promise((resolve, reject) => { - 479 + 480 386 const chunks = []; - 480 + 481 387 20 stream.on('data', (chunk) => chunks.push(chunk)); - 481 + 482 388 20 stream.on('error', reject); - 482 + 483 389 20 stream.on('end', () => { - 483 + 484 390 let buffer = Buffer.concat(chunks); - 484 + 485 391 20 if ('bin' === output) { - 485 + 486 392 2 resolve(buffer); - 486 + 487 393 } - 487 + 488 394 else { - 487 + 488 395 18 resolve(buffer.toString('utf-8')); - 488 + 489 396 } - 489 + 490 397 }); - 490 + 491 398 }); - 491 + 492 399 } - 492 + 493 400 1 Object.defineProperty(s3_store, 'name', { value: 's3-store' }); - 494 + 495 401 1 module.exports = s3_store; - 495 + 496 402 diff --git a/test/s3-store.test.js b/test/s3-store.test.js index e1714e9..764a6d4 100644 --- a/test/s3-store.test.js +++ b/test/s3-store.test.js @@ -62,7 +62,7 @@ const local_opts = { active: true, folder: __dirname + '/s3files/data', suffixMode: 'genid', - onObjectCreated: {'':'aim:local-s3,cmd:object-created'}, + onObjectCreated: { '': 'aim:local-s3,cmd:object-created' }, }, }, } @@ -329,8 +329,7 @@ async function makeOptions() { locals3.config.s3.region = 'eu-west-1' console.log('locals3.config', locals3.config) return locals3.config - } - else { + } else { return require('./aws-s3-opts') } }