Skip to content

Commit

Permalink
feat: terms and conditions plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
mvayngrib committed Dec 24, 2017
1 parent 9e48754 commit 5f27c09
Show file tree
Hide file tree
Showing 25 changed files with 302 additions and 44 deletions.
18 changes: 14 additions & 4 deletions lib/cacheable-bucket-item.js

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

2 changes: 1 addition & 1 deletion lib/delivery-http.js

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

2 changes: 2 additions & 0 deletions lib/s3-utils.js

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

29 changes: 23 additions & 6 deletions lib/samplebot/configure.js

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

12 changes: 10 additions & 2 deletions lib/samplebot/customize.js

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

2 changes: 1 addition & 1 deletion lib/samplebot/lambda/http/inbox.js

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

2 changes: 1 addition & 1 deletion lib/samplebot/lambda/http/onfido-webhook.js

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

2 changes: 1 addition & 1 deletion lib/samplebot/lambda/mqtt/onmessage.js

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

2 changes: 1 addition & 1 deletion lib/samplebot/lambda/onmessagestream.js

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

15 changes: 12 additions & 3 deletions lib/samplebot/strategy/index.js

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

61 changes: 61 additions & 0 deletions lib/samplebot/strategy/ts-and-cs.js

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

24 changes: 18 additions & 6 deletions src/cacheable-bucket-item.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,36 @@

import { omit } from 'lodash'
import { Bucket } from './bucket'
import { DatedValue } from './types'

const identity = a => a

export class CacheableBucketItem {
private value: any
private parse: Function
private lastModified?: number
constructor(opts: {
bucket:Bucket,
key:string,
ttl?: number
parse?: Function
}) {
this.value = opts.bucket.getCacheable(opts)
this.parse = identity
this.value = opts.bucket.getCacheable(omit(opts, ['parse']))
this.parse = opts.parse || identity
this.lastModified = null
}

public getDatedValue = async ():Promise<DatedValue> => {
const value = await this.get()
return {
value,
lastModified: this.lastModified
}
}

public get = async (opts?) => {
const value = await this.value.get(opts)
return this.parse(value)
public get = async (opts?):Promise<any> => {
const { Body, LastModified } = await this.value.get(opts)
this.lastModified = new Date(LastModified).getTime()
return this.parse(Body)
}

public put = async (value:any, opts={}) => {
Expand Down
2 changes: 1 addition & 1 deletion src/delivery-http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Env from './env'
import Errors = require('./errors')

const zlib = promisify(_zlib)
const COMPRESSION_THRESHOLD = 2000
const COMPRESSION_THRESHOLD = 0//2000
const FETCH_TIMEOUT = 10000

export default class Delivery extends EventEmitter implements IDelivery {
Expand Down
1 change: 1 addition & 0 deletions src/s3-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export = function createUtils ({ s3, logger }) {
}) => {
if (!key) throw new Error('expected "key"')
if (!bucket) throw new Error('expected "bucket"')
if (!ttl) throw new Error('expected "ttl"')

let cached
let type
Expand Down

0 comments on commit 5f27c09

Please sign in to comment.