Skip to content

Commit

Permalink
v2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rjrodger committed Jan 19, 2024
1 parent 4e7750e commit 93500d9
Show file tree
Hide file tree
Showing 7 changed files with 355 additions and 355 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion dist/s3-store.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/s3-store.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
37 changes: 19 additions & 18 deletions src/s3-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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,
Expand All @@ -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$
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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 } })
},
}
Expand Down Expand Up @@ -432,7 +431,6 @@ async function s3_store(this: any, options: any) {
}
}


const makeGatewayHandler = (msg: object) => {
const gatewayHandler = {
name: 's3',
Expand All @@ -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
}
Expand All @@ -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
Expand Down
Loading

0 comments on commit 93500d9

Please sign in to comment.