diff --git a/dist/s3-store.js b/dist/s3-store.js index 6546a7f..c23e081 100644 --- a/dist/s3-store.js +++ b/dist/s3-store.js @@ -123,10 +123,15 @@ async function s3_store(options) { } // Binary files else if ('string' === typeof bin && '' !== bin) { - let data = msg.ent[bin]; - if (null == data) { + let dataRef = msg.ent[bin]; + if (null == dataRef) { throw new Error('s3-store: option ent.bin data field not found: ' + bin); } + let data = dataRef; + // A function can be used to 'hide" very large data. + if ('function' === typeof dataRef) { + data = dataRef(); + } Body = Buffer.from(data); } } diff --git a/dist/s3-store.js.map b/dist/s3-store.js.map index 213d807..397da61 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,EAAE,KAAK;QACZ,6EAA6E;QAC7E,UAAU,EAAE,IAAA,cAAO,EAAC,MAAM,EAAE,IAAA,YAAK,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAEnD,yBAAyB;QACzB,eAAe,EAAE,IAAA,WAAI,EAAC,IAAA,YAAK,EAAC,IA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AC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,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 178ac9f..fec1341 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@seneca/s3-store", - "version": "2.2.0", + "version": "2.3.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 aca6659..25b7bdf 100644 --- a/src/s3-store.ts +++ b/src/s3-store.ts @@ -160,13 +160,20 @@ async function s3_store(this: any, options: any) { // Binary files else if ('string' === typeof bin && '' !== bin) { - let data = msg.ent[bin] - if (null == data) { + let dataRef = msg.ent[bin] + if (null == dataRef) { throw new Error( 's3-store: option ent.bin data field not found: ' + bin, ) } + let data = dataRef + + // A function can be used to 'hide" very large data. + if ('function' === typeof dataRef) { + data = dataRef() + } + Body = Buffer.from(data) } } diff --git a/test/coverage.html b/test/coverage.html index 88edb54..3f5dfed 100644 --- a/test/coverage.html +++ b/test/coverage.html @@ -536,7 +536,7 @@
  • Test Report
  • Coverage Report
  • - 80.76 + 80.43 dist/s3-store.js
  • Linting Report
  • @@ -547,7 +547,7 @@

    Test Report

    0
    0
    17
    -
    9174
    +
    1863
    @@ -574,119 +574,119 @@

    Test Report

    happy - 1017 + 211 2 jsonl-s3 - 1750 + 266 3 jsonl-s3-customid - 747 + 119 4 jsonl-local-basic - 236 + 74 5 bin-s3-basic - 296 + 114 6 bin-local-basic - 445 + 75 7 bin-local-customid - 316 + 66 8 store-init load-store-plugin - 186 + 119 9 store-init clear-data - 57 + 20 10 store-keyvalue save-load-auto-id - 709 + 121 11 store-keyvalue save-load-given-id - 762 + 99 12 store-keyvalue remove - 212 + 67 13 store-init load-store-plugin - 140 + 120 14 store-init clear-data - 7 + 6 15 store-keyvalue save-load-auto-id - 80 + 44 16 store-keyvalue save-load-given-id - 89 + 34 17 store-keyvalue remove - 123 + 16 @@ -694,10 +694,10 @@

    Test Report

    Code Coverage Report

    -
    80.76%
    -
    369
    -
    298
    -
    71
    +
    80.43%
    +
    373
    +
    300
    +
    73
    @@ -707,10 +707,10 @@

    Code Coverage Report

    dist/s3-store.js

    -
    80.76%
    -
    369
    -
    298
    -
    71
    +
    80.43%
    +
    373
    +
    300
    +
    73
    @@ -1477,13 +1477,13 @@

    dist/s3-store.js

    - + - + @@ -1501,1644 +1501,1674 @@

    dist/s3-store.js

    - + - - - + + + - - - + + + - - + + - - + + - - - + + + - - + + - + - - - + + + - - + + - - - + + + - - - - + + + + - + - - + + - + - - + + - + - - + + - - - - + + + + - - + + - - + + - + - - - + + + - - + + - - + + - - - + + + - - - + + + - - + + - - + + - - + + - - - + + + - - - + + + - - + + - - + + - - + + - - - + + + - - - + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - + + + + - - + + - - + + - - + + - - + + - - - + + + - - + + - - - + + + - - - + + + - - - + + + - - - - + + + + - - - + + + - - - + + + - - + + - + - - - - + + + + - - - - + + + + - - + + - - - + + + - - + + - - + + - + - - - + + + - - - + + + - - - + + + - - + + - - - + + + - - - + + + - - - + + + - - + + - - + + - - - + + + - - - + + + - - - + + + - - - + + + - - + + - - + + - - + + - - + + - + - - - + + + - - - - + + + + - + - + - - + + - - - - + + + + - - + + - + - + - - - + + + - - + + - - - + + + - - - + + + - - - + + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - - + + + - - - + + + - - + + - - + + - - + + - - - + + + - - - + + + - - + + - - + + - + - - - + + + - - + + - - - + + + - - + + - - + + - - - + + + - - + + - - - - + + + + - - - + + + - - + + - - - + + + - - + + - - - + + + - + - + - - + + - - + + - - + + - + - + - - + + - - - + + + - - - - + + + + - - + + - - - - + + + + - + - + - + - - + + - + - - - + + + - - + + - - + + - - - - + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - - - + + + + - - + + - - + + - - + + - - - + + + - - - + + + - - + + - - + + - - + + - - - - + + + + - - - + + + - - - + + + - - - + + + - - + + - - - + + + - - - + + + - - - + + + - + - + - - + + - - + + - + - + - + - - - + + + - - + + - - + + - - - - + + + + - - + + - - + + - - + + - - - + + + - - + + - + - + - + - - + + - - - - + + + + - - - + + + - - - + + + - - - + + + - + - - - + + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - + + - - - + + + - - + + - - + + - - - + + + - - - + + + - - - + + + - - - + + + - + - - - + + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - - + + + - - + + - - + + - - - - + + + + - - - + + + - - + + - - + + - - - + + + - - - - + + + + - - + + - - + + - - + + - - + + - - + + - - - + + + - - + + - - - + + + - - - + + + - - - + + + - - - + + + - - + + - - - + + + - - + + - - + + - - - + + + - - + + - - + + - - + + - - - + + + - + - + - + - + - + - - - + + + - - - + + + - - + + - - + + - - + + - - - + + + - - + + - + - - + + - - + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - + + - - + + - - - + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    126 5 let data = msg.ent[bin]; let dataRef = msg.ent[bin]; 163
    127
    if (
    null == data
    ) {
    if (
    null == dataRef
    ) {
    164
    128 130 5 Body = Buffer.from(data); let data = dataRef; 170
    131 }171
    // A function can be used to 'hide" very large data.172
    132 }172
    if (
    'function' === typeof dataRef
    ) {
    173
    133 30 if (null == Body) { data = dataRef(); 174
    134 20 let dj = JSON.stringify(d); } 175
    135 20 Body = Buffer.from(dj);1765 Body = Buffer.from(data);177
    136 }177 }178
    137 // console.log('BODY', Body, entSpec?.bin ? '' : '<' + Body.toString() + '>') } 179
    138 // console.log('options:: ', options, seneca.util.Nid() )18030 if (null == Body) {181
    139 30 let ento = msg.ent.make$().data$(d);20 let dj = JSON.stringify(d); 182
    140 // Local file18420 Body = Buffer.from(dj);183
    141 30 if (options.local.active) {185
    }184
    142
    let full = path_1.default.join(local_folder,
    s3id
    ||
    id
    );
    // console.log('BODY', Body, entSpec?.bin ? '' : '<' + Body.toString() + '>') 186
    143 15 let path = path_1.default.dirname(full); // console.log('options:: ', options, seneca.util.Nid() ) 187
    144
    if (
    options.debug
    ) {
    30 let ento = msg.ent.make$().data$(d); 189
    145 console.log(PLUGIN, 'save', path, Body.length);190 // Local file191
    146 }191
    30 if (options.local.active) {192
    147 15 promises_1.default.mkdir(path, { recursive: true })
    let full = path_1.default.join(local_folder,
    s3id
    ||
    id
    );
    193
    148 .then(() => {15 let path = path_1.default.dirname(full); 194
    149 promises_1.default.writeFile(full, Body)195
    if (
    options.debug
    ) {
    196
    150 .then((_res) => {196 console.log(PLUGIN, 'save', path, Body.length);197
    151 reply(null, ento);197 }198
    152 })19815 promises_1.default.mkdir(path, { recursive: true })200
    153 .catch((err) => {199
    .then(() => {201
    154
    reply(err);
    200 promises_1.default.writeFile(full, Body)202
    155 });201 .then((_res) => {203
    156 })202 reply(null, ento);204
    157 .catch((err) => {203
    })205
    158
    reply(err);
    204
    .catch((err) => {206
    159 });205
    reply(err);
    207
    160 }206 });208
    161 // AWS S3208 })209
    162 else {209
    .catch((err) => {210
    163 15 const s3cmd = new client_s3_1.PutObjectCommand({210
    reply(err);
    211
    164 ...s3_shared_options,211 });212
    165 Key: s3id,212 }213
    166 Body,213 // AWS S3215
    167 });214 else {216
    168 15 aws_s3216 const s3cmd = new client_s3_1.PutObjectCommand({217
    169 .send(s3cmd)217 ...s3_shared_options,218
    170 .then((_res) => {218 Key: s3id,219
    171 reply(null, ento);219 Body,220
    172 })220 });221
    173 .catch((err) => {221
    15 aws_s3223
    174
    reply(err);
    222 .send(s3cmd)224
    175 });223 .then((_res) => {225
    176 }224 reply(null, ento);226
    177 },225 })227
    178 load: function (msg, reply) {227
    .catch((err) => {228
    179 let canon = msg.ent.entity$;228
    reply(err);
    229
    180 50 let qent = msg.qent;229 });230
    181 50 let id = '' + msg.q.id;230 }231
    182 50 let entSpec = options.ent[canon];231 },232
    183 50 let output = 'ent';232
    load: function (msg, reply) {234
    184
    let jsonl = (
    entSpec === null
    || entSpec === void 0 ? void 0 : entSpec.jsonl) ||
    msg.jsonl$
    || msg.q.jsonl$;
    233
    let canon = msg.ent.entity$;235
    185
    let bin = (
    entSpec === null
    || entSpec === void 0 ? void 0 : entSpec.bin) ||
    msg.bin$
    || msg.q.bin$;
    23450 let qent = msg.qent;236
    186 50 let s3id = make_s3id(id, msg.ent, options, bin);236 let id = '' + msg.q.id;237
    187 50 output = jsonl && '' != jsonl ? 'jsonl' : bin && '' != bin ? 'bin' : 'ent'; let entSpec = options.ent[canon]; 238
    188 function replyEnt(body) {240
    50 let output = 'ent';239
    189 40 let entdata = {};241
    let jsonl = (
    entSpec === null
    || entSpec === void 0 ? void 0 : entSpec.jsonl) ||
    msg.jsonl$
    || msg.q.jsonl$;
    240
    190 // console.log('DES', output, body)243
    let bin = (
    entSpec === null
    || entSpec === void 0 ? void 0 : entSpec.bin) ||
    msg.bin$
    || msg.q.bin$;
    241
    191 40 if ('bin' !== output) {24450 let s3id = make_s3id(id, msg.ent, options, bin);243
    192 35 body = body.toString('utf-8');50 output = jsonl && '' != jsonl ? 'jsonl' : bin && '' != bin ? 'bin' : 'ent'; 245
    193 }246 function replyEnt(body) {247
    194 40 if ('jsonl' === output) { let entdata = {}; 248
    195 5 entdata[jsonl] = body249 // console.log('DES', output, body)250
    196 .split('\n')25040 if ('bin' !== output) {251
    197 .filter((n) => '' !== n)25135 body = body.toString('utf-8');252
    198 .map((n) => JSON.parse(n));252 }253
    199 }25340 if ('jsonl' === output) {255
    200 35 else if ('bin' === output) {2535 entdata[jsonl] = body256
    201 5 entdata[bin] = body;254 .split('\n')257
    202 }255 .filter((n) => '' !== n)258
    203 else {255 .map((n) => JSON.parse(n));259
    204 30 entdata = JSON.parse(body);256 }260
    205 }25735 else if ('bin' === output) {260
    206 40 entdata.id = id;2595 entdata[bin] = body;261
    207 40 let ento = qent.make$().data$(entdata);261 }262
    208 40 reply(null, ento); else { 262
    209 }30 entdata = JSON.parse(body); 263
    210 // Local file265 }264
    211 50 if (options.local.active) {40 entdata.id = id; 266
    212
    let full = path_1.default.join(local_folder,
    s3id
    ||
    id
    );
    26740 let ento = qent.make$().data$(entdata);268
    213 // console.log('FULL', full)268
    40 reply(null, ento);269
    214
    if (
    options.debug
    ) {
    } 270
    215 console.log(PLUGIN, 'load', full);271 // Local file272
    216 }272
    50 if (options.local.active) {273
    217 25 promises_1.default.readFile(full)
    let full = path_1.default.join(local_folder,
    s3id
    ||
    id
    );
    274
    218 .then((body) => { // console.log('FULL', full) 275
    219 replyEnt(body);276
    if (
    options.debug
    ) {
    277
    220 })277 console.log(PLUGIN, 'load', full);278
    221 .catch((err) => {278
    }279
    222
    if (
    'ENOENT' == err.code
    ) {
    27925 promises_1.default.readFile(full)281
    223 5 return reply();280 .then((body) => {282
    224 }281
    replyEnt(body);283
    225 reply(err);282 })284
    226 });283
    .catch((err) => {285
    227 }284
    if (
    'ENOENT' == err.code
    ) {
    286
    228 // AWS S32865 return reply();287
    229 else {287
    }288
    230 25 const s3cmd = new client_s3_1.GetObjectCommand({288 reply(err);289
    231 ...s3_shared_options,289 });290
    232 Key: s3id,290 }291
    233 });291 // AWS S3293
    234 25 aws_s3293 else {294
    235 .send(s3cmd)29425 const s3cmd = new client_s3_1.GetObjectCommand({295
    236 .then((res) => {295 ...s3_shared_options,296
    237 // console.log(res)296 Key: s3id,297
    238 destream(output, res.Body) }); 298
    239 .then((body) => {29925 aws_s3300
    240 replyEnt(body);300 .send(s3cmd)301
    241 })301
    .then((res) => {302
    242
    .catch((err) =>
    reply(err)
    );
    302 // console.log(res)303
    243 })303 destream(output, res.Body)305
    244 .catch((err) => {304
    .then((body) => {306
    245
    if (
    'NoSuchKey' === err.Code
    ) {
    305 replyEnt(body);307
    246 5 return reply();306
    })308
    247 }307
    .catch((err) =>
    reply(err)
    );
    309
    248 reply(err);309 })310
    249 });310
    .catch((err) => {311
    250 }311
    if (
    'NoSuchKey' === err.Code
    ) {
    312
    251 },3125 return reply();313
    252 // NOTE: S3 folder listing not supported yet. } 314
    253 list: function (_msg, reply) {315 reply(err);316
    254 reply([]);316 });317
    255 },317 }318
    256 remove: function (msg, reply) { }, 319
    257
    let canon = (
    msg.ent
    ||
    msg.qent
    ).entity$;
    320 // NOTE: S3 folder listing not supported yet.321
    258 6 let id = '' + msg.q.id;321 list: function (_msg, reply) {322
    259 6 let entSpec = options.ent[canon];322
    reply([]);323
    260
    let bin = (
    entSpec === null
    || entSpec === void 0 ? void 0 :
    entSpec.bin
    ) ||
    msg.bin$
    || msg.q.bin$;
    323 },324
    261 6 let s3id = make_s3id(id, msg.ent, options, bin);325
    remove: function (msg, reply) {326
    262 // Local file
    let canon = (
    msg.ent
    ||
    msg.qent
    ).entity$;
    327
    263 6 if (options.local.active) { let id = '' + msg.q.id; 328
    264
    let full = path_1.default.join(local_folder,
    s3id
    ||
    id
    );
    6 let entSpec = options.ent[canon]; 329
    265 3 promises_1.default.unlink(full)331
    let bin = (
    entSpec === null
    || entSpec === void 0 ? void 0 :
    entSpec.bin
    ) ||
    msg.bin$
    || msg.q.bin$;
    330
    266 .then((_res) => {6 let s3id = make_s3id(id, msg.ent, options, bin); 332
    267 reply();333 // Local file334
    268 })334
    6 if (options.local.active) {335
    269 .catch((err) => {335
    let full = path_1.default.join(local_folder,
    s3id
    ||
    id
    );
    336
    270
    if (
    'ENOENT' == err.code
    ) {
    3363 promises_1.default.unlink(full)338
    271 2 return reply();337 .then((_res) => {339
    272 }338
    reply();340
    273 reply(err);339 })341
    274 });340
    .catch((err) => {342
    275 }341
    if (
    'ENOENT' == err.code
    ) {
    343
    276 else {3412 return reply();344
    277 3 const s3cmd = new client_s3_1.DeleteObjectCommand({342
    }345
    278 ...s3_shared_options,343 reply(err);346
    279 Key: s3id,344 });347
    280 });345 }348
    281 3 aws_s3347 else {348
    282 .send(s3cmd)3483 const s3cmd = new client_s3_1.DeleteObjectCommand({349
    283 .then((_res) => {349 ...s3_shared_options,350
    284 reply();350 Key: s3id,351
    285 })351 });352
    286 .catch((err) => {352
    3 aws_s3354
    287
    if ('NoSuchKey' === err.Code) {
    353
    .send(s3cmd)355
    288 return reply();354
    .then((_res) => {356
    289
    }
    355
    reply();357
    290 reply(err);357 })358
    291 });358
    .catch((err) => {359
    292 }359
    if ('NoSuchKey' === err.Code) {
    360
    293 },360
    return reply();361
    294 close: function (_msg, reply) {
    }
    362
    295
    reply();
    363 reply(err);364
    296 },364 });365
    297 native: function (_msg, reply) { } 366
    298
    reply({ client: aws_s3, local: { ...options.local } });
    }, 367
    299 },368
    close: function (_msg, reply) {369
    300 };369
    reply();
    370
    301 9 let meta = init(seneca, options, store); }, 371
    302 9 seneca.message('cloud:aws,service:store,get:url,kind:upload', {375
    native: function (_msg, reply) {373
    303 bucket: String,376
    reply({ client: aws_s3, local: { ...options.local } });
    374
    304 filepath: String,377 },375
    305 expire: Number,378 };376
    306 }, get_upload_url);3819 let meta = init(seneca, options, store);378
    307 9 seneca.message('cloud:aws,service:store,get:url,kind:download', {385 seneca.message('cloud:aws,service:store,get:url,kind:upload', {382
    308 bucket: String,386383
    309 filepath: String,387384
    310 expire: Number,388385
    311 }, get_download_url);391 }, get_upload_url);388
    312 async function get_upload_url(msg) {393
    9 seneca.message('cloud:aws,service:store,get:url,kind:download', {392
    313 const bucket = msg.bucket;394
    bucket: String,393
    314 const filepath = msg.filepath;395
    filepath: String,394
    315 const expire = msg.expire;396
    expire: Number,395
    316 const command = new client_s3_1.PutObjectCommand({ }, get_download_url); 398
    317 Bucket: bucket,399
    async function get_upload_url(msg) {400
    318 Key: filepath,400
    const bucket = msg.bucket;401
    319 });401 const filepath = msg.filepath;402
    320 const url = await (0, s3_request_presigner_1.getSignedUrl)(aws_s3, command, {402
    const expire = msg.expire;403
    321 expiresIn: expire,403 const command = new client_s3_1.PutObjectCommand({405
    322 });404
    Bucket: bucket,406
    323 return {406 Key: filepath,407
    324 url,407
    });408
    325 bucket,408 const url = await (0, s3_request_presigner_1.getSignedUrl)(aws_s3, command, {409
    326 filepath,409 expiresIn: expire,410
    327 expire,410
    });411
    328 };411 return {413
    329 }412 url,414
    330 async function get_download_url(msg) {414
    bucket,415
    331 const bucket = msg.bucket;415
    filepath,416
    332 const filepath = msg.filepath;416
    expire,417
    333 const expire = msg.expire;417
    };418
    334 const command = new client_s3_1.GetObjectCommand({ } 419
    335 Bucket: bucket,420
    async function get_download_url(msg) {421
    336 Key: filepath,421
    const bucket = msg.bucket;422
    337 });422 const filepath = msg.filepath;423
    338 const url = await (0, s3_request_presigner_1.getSignedUrl)(aws_s3, command, {423
    const expire = msg.expire;424
    339 expiresIn: expire,424 const command = new client_s3_1.GetObjectCommand({426
    340 });425
    Bucket: bucket,427
    341 return {426 Key: filepath,428
    342 url,427
    });429
    343 bucket,428 const url = await (0, s3_request_presigner_1.getSignedUrl)(aws_s3, command, {430
    344 filepath,429 expiresIn: expire,431
    345 expire,430
    });432
    346 };431 return {433
    347 }432 url,434
    348 9 const makeGatewayHandler = (msgin) => {434
    bucket,435
    349
    const msg = seneca.util.Jsonic(msgin);
    435
    filepath,436
    350 const gatewayHandler = {436 expire,437
    351 name: 's3',437 };438
    352 match: (trigger) => {438
    }439
    353
    let matched = 'aws:s3' === trigger.record.eventSource;
    439
    9 const makeGatewayHandler = (msgin) => {441
    354 console.log('S3 MATCHED', matched, trigger);440
    const msg = seneca.util.Jsonic(msgin);
    442
    355 return matched;441 const gatewayHandler = {443
    356 },442 name: 's3',444
    357 process: async function (trigger, gateway) {446 match: (trigger) => {445
    358
    let { record, event } = trigger;
    448
    let matched = 'aws:s3' === trigger.record.eventSource;
    446
    359 return gateway({ ...msg, record, event }, trigger);449
    console.log('S3 MATCHED', matched, trigger);447
    360 },450 return matched;448
    361 };451
    },449
    362 return gatewayHandler;452
    process: async function (trigger, gateway) {453
    363 };453
    let { record, event } = trigger;
    455
    364 9 return {455 return gateway({ ...msg, record, event }, trigger);456
    365 name: store.name,456 },457
    366 tag: meta.tag,457
    };458
    367 exports: {458 return gatewayHandler;459
    368 native: aws_s3,459 };460
    369 makeGatewayHandler,4609 return {462
    370 },461 name: store.name,463
    371 };462 tag: meta.tag,464
    372 }463 exports: {465
    373 function make_s3id(id, ent, options, bin) {465
    native: aws_s3,466
    374
    let s3id =
    null == id
    makeGatewayHandler, 467
    375
    ?
    null
    }, 468
    376 : (null == options.folder }; 469
    377 ? options.prefix + ent.entity$} 470
    378 : options.folder) +471
    function make_s3id(id, ent, options, bin) {472
    379 ('' == options.folder ? '' : '/') +472
    let s3id =
    null == id
    474
    380 id +473
    ?
    null
    475
    381 (bin ? '' : options.suffix);474 : (null == options.folder476
    382 // console.log('make_s3id', s3id, id, ent, options)476 ? options.prefix + ent.entity$477
    383 86 return s3id;477 : options.folder) +478
    384 }478 ('' == options.folder ? '' : '/') +479
    385 async function destream(output, stream) { id + 480
    386 20 return new Promise((resolve, reject) => { (bin ? '' : options.suffix); 481
    387 const chunks = [];482 // console.log('make_s3id', s3id, id, ent, options)483
    388 20 stream.on('data', (chunk) => chunks.push(chunk));48386 return s3id;484
    389 20 stream.on('error', reject);484}485
    390 20 stream.on('end', () => {485async function destream(output, stream) {487
    391 let buffer = Buffer.concat(chunks);48620 return new Promise((resolve, reject) => {488
    392 20 if ('bin' === output) {487 const chunks = [];489
    393 2 resolve(buffer);48820 stream.on('data', (chunk) => chunks.push(chunk));490
    394 }48920 stream.on('error', reject);491
    395 else {48920 stream.on('end', () => {492
    396 18 resolve(buffer.toString('utf-8'));490 let buffer = Buffer.concat(chunks);493
    397 }49120 if ('bin' === output) {494
    398 });4922 resolve(buffer);495
    399 });493 }496
    400 }494 else {496
    401 1Object.defineProperty(s3_store, 'name', { value: 's3-store' });49618 resolve(buffer.toString('utf-8'));497
    402 1module.exports = s3_store;497 }498
    403 });499
    404 });500
    405}501
    4061Object.defineProperty(s3_store, 'name', { value: 's3-store' });503
    4071module.exports = s3_store;504
    408 //# sourceMappingURL=s3-store.js.map