View how-to-dag-outputs-2.json
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" | |
}, | |
"threads": { | |
"import": "_email.tid" | |
} | |
} | |
} |
View how-to-dag-3.json
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": { | |
"messageCounts": {} |
View how-to-dag-stores-1.json
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
"stores":{ | |
"messageCounts" : { | |
"key$schema":"string/string" | |
} | |
} |
View how-to-node1-1.js
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
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)); | |
json.forEach(function(value, i){ | |
console.log('datum#', i, 'value:', value) |
View how-to-controller-2.js
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
constructor() { | |
// You have to call the super() method to initialize the base class. | |
super(); | |
this._suHandler = this.onStorageUpdate.bind(this); | |
} | |
loadView(state) { | |
console.log('counter: loadView', state); | |
this.storage.subscribe(['count'], this._suHandler); |
View how-to-view-1.js
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
//... | |
constructor() { | |
// You have to call the super() method to initialize the base class. | |
super(); | |
this.controller.subscribe('counts', this.onCounts.bind(this)); | |
} | |
// for more info: https://docs.redsift.com/docs/client-code-siftview | |
presentView(value) { | |
console.log('counter: presentView: ', value); |
View how-to-summary-1.html
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
<div class="column"> | |
<p>I'm a Sift!</p> | |
<p id='number'>0</p> | |
</div> |
View how-to-node1-3b.js
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
return { | |
key: `${value.threadId}/${value.id}`, // instead of 'value.id | |
value: { | |
count: count, | |
date: value.date | |
} | |
} |
View how-to-node2-1.js
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
module.exports = function (got) { | |
const total = got.in.data.reduce((p, d) => p + parseInt(d.value), 0); | |
return { | |
key: 'word_count', | |
value: total | |
} | |
} |
View how-to-email-client-controller.js
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
loadThreadListView (listInfo) { | |
console.log('counter: loadThreadListView: ', listInfo); | |
if (listInfo) { | |
return { | |
template: '001_list_common_txt', | |
value: { | |
color: '#ffffff', | |
backgroundColor: '#e11010', | |
subtitle: listInfo + ' words' | |
} |