This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// for more info: https://docs.redsift.com/docs/client-code-siftcontroller | |
loadView(state) { | |
console.log('counter: loadView', state); | |
// ... | |
switch (state.type) { | |
// ... | |
case 'summary': | |
return { | |
html: 'summary.html', | |
data: {} //this.getX() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- package.json | |
- gulpfile.js | |
- bundle.config.js | |
- src/ | |
- scripts | |
- controller.js | |
- email-client-controller.js | |
- view.js | |
- styles | |
- *.css / *.styl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
others.map(value => { | |
let text = value.textBody || value.strippedHtmlBody || ''; | |
return text; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const others = json.filter(j => j.user !== j['from'].email); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
redsift create counter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -sSL https://static-sdk.redsift.io/install | bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let textUtils = require('@redsift/text-utilities'); | |
module.exports = function (got) { | |
// got.in contains the key/value pairs that match the given query | |
const inData = got.in; | |
console.log('counter: node1.js: running...', inData.data); | |
const json = inData.data.map(d => JSON.parse(d.value)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"nodes":[{ | |
"#": "First Node", | |
"input": { | |
"bucket": "gmailEmails" | |
}, | |
"implementation": { | |
"javascript": "server/node1.js" | |
}, | |
"outputs": { | |
"count": {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"outputs":{ | |
"exports":{ | |
"count" : { | |
"key$schema":"string" | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let textUtils = require('@redsift/text-utilities'); | |
// ... | |
let counts = others.map(value => { | |
let text = value.textBody || value.strippedHtmlBody || ''; | |
let count = textUtils.splitWords(textUtils.trimEmailThreads(text)).length; | |
return count; | |
}); | |
console.log(counts); |