{"id":"dbe889f1-05ec-47b5-a117-d894706420c7","name":"Stars","slug":"github-star-history","isPublic":true,"organizationId":"1d89c866-802d-4e0a-a9ef-05660d38a0f4","currentVersionId":"ac5fc98a-23a7-470a-a417-84f1836cc7ba","userId":"5d0e3769-e0c6-42cd-a7b9-a112e178296f","createdAt":"2021-12-09T12:22:10.668Z","updatedAt":"2022-01-17T04:45:12.567Z","dataQueries":[{"id":"e4c5b5b3-23cb-4161-b90d-28d443b47944","name":"runjs2","kind":"runjs","options":{"code":"const stargazersURL = `https://api.github.com/repos/${components.textinput1.value}/stargazers?per_page=100&page={page}`;\n\nconst totalPages = parseInt(queries.restapi1.data.starGazers/100);\n\nlet pages = [...Array(totalPages).keys()];\n\nlet dates = {};\nlet results = [];\n\nlet headers = {\n 'Accept': 'application/vnd.github.v3.star+json'\n}\n\nif(components.passwordinput1.value !== '') { \n headers['Authorization'] = `token ${components.passwordinput1.value}`\n}\n\nfor(const page of pages) {\n const url = stargazersURL.replace('{page}', page + 1);\n const data = (await axios.get(url, { headers })).data;\n \n for(star of data) {\n const starredAt = moment(star.starred_at).endOf('day').format('yyyy-MM-DD');\n dates[starredAt] = (dates[starredAt] || 0) + 1;\n }\n \n}\n\nlet total = 0;\nfor (date of Object.keys(dates)) {\n total = total + dates[date];\n results.push({ x: date, y: total});\n}\n\nreturn results;"},"dataSourceId":null,"appId":"dbe889f1-05ec-47b5-a117-d894706420c7","createdAt":"2021-12-09T12:22:10.667Z","updatedAt":"2021-12-09T13:07:31.327Z"},{"id":"f006d058-8cac-442e-a093-a2757247fefb","name":"restapi1","kind":"restapi","options":{"method":"get","url":"https://api.github.com/repos/{{components.textinput1.value}}","url_params":[["",""]],"headers":[["",""]],"body":[["",""]],"enableTransformation":true,"transformation":"// write your code here\n// return value will be set as data and the original data will be available as rawData\nreturn { starGazers: data.stargazers_count }; ","events":[{"eventId":"onDataQuerySuccess","actionId":"run-query","message":"Hello world!","queryId":"e4c5b5b3-23cb-4161-b90d-28d443b47944","queryName":"runjs2"}]},"dataSourceId":null,"appId":"dbe889f1-05ec-47b5-a117-d894706420c7","createdAt":"2021-12-09T12:22:10.667Z","updatedAt":"2021-12-09T12:22:10.667Z"}],"dataSources":[],"appVersions":[{"id":"ac5fc98a-23a7-470a-a417-84f1836cc7ba","name":"vv","definition":{"components":{"e2007b03-4c80-4925-8816-b3867579b2b6":{"component":{"name":"chart1","displayName":"Chart","description":"Display charts","component":"Chart","defaultSize":{"width":20,"height":400},"others":{"showOnDesktop":{"type":"toggle","displayName":"Show on desktop"},"showOnMobile":{"type":"toggle","displayName":"Show on mobile"}},"properties":{"title":{"type":"code","displayName":"Title"},"data":{"type":"json","displayName":"Data"},"loadingState":{"type":"code","displayName":"Loading State"},"markerColor":{"type":"color","displayName":"Marker color"},"showGridLines":{"type":"toggle","displayName":"Show grid lines"},"type":{"type":"select","displayName":"Chart type","options":[{"name":"Line","value":"line"},{"name":"Bar","value":"bar"},{"name":"Pie","value":"pie"}]}},"events":{},"styles":{"visibility":{"type":"code","displayName":"Visibility"},"disabledState":{"type":"code","displayName":"Disable"}},"exposedVariables":{"show":null},"definition":{"others":{"showOnDesktop":{"value":true},"showOnMobile":{"value":false}},"properties":{"title":{"value":"Stars over time "},"markerColor":{"value":"#394d9d"},"showGridLines":{"value":true},"loadingState":{"value":"{{queries.runjs2.isLoading || queries.restapi1.isLoading}}"},"type":{"value":"line"},"data":{"value":"{{queries.runjs2.data}}"}},"events":[],"styles":{"visibility":{"value":"{{true}}"},"disabledState":{"value":"{{false}}"}}}},"layouts":{"desktop":{"top":200,"left":2.36158105241994,"width":32,"height":550}}},"f073e059-7476-4999-86f8-335e1d6c095e":{"component":{"name":"textinput1","displayName":"Text Input","description":"Text field for forms","component":"TextInput","defaultSize":{"width":4,"height":30},"others":{"showOnDesktop":{"type":"toggle","displayName":"Show on desktop"},"showOnMobile":{"type":"toggle","displayName":"Show on mobile"}},"properties":{"value":{"type":"code","displayName":"Default value"},"placeholder":{"type":"code","displayName":"Placeholder"}},"validation":{"regex":{"type":"code","displayName":"Regex"},"minLength":{"type":"code","displayName":"Min length"},"maxLength":{"type":"code","displayName":"Max length"},"customRule":{"type":"code","displayName":"Custom validation"}},"events":{},"styles":{"visibility":{"type":"code","displayName":"Visibility"},"disabledState":{"type":"code","displayName":"Disable"}},"exposedVariables":{"value":""},"definition":{"validation":{"regex":{"value":""},"minLength":{"value":null},"maxLength":{"value":null},"customRule":{"value":null}},"others":{"showOnDesktop":{"value":true},"showOnMobile":{"value":false}},"properties":{"value":{"value":""},"placeholder":{"value":"ToolJet/ToolJet"}},"events":[],"styles":{"visibility":{"value":"{{true}}"},"disabledState":{"value":"{{false}}"}}}},"layouts":{"desktop":{"top":130,"left":2.325578813582382,"width":10,"height":40}}},"919579eb-4b19-4cf1-8fbb-701dd933412c":{"component":{"name":"text2","displayName":"Text","description":"Display markdown or HTML","component":"Text","others":{"showOnDesktop":{"type":"toggle","displayName":"Show on desktop"},"showOnMobile":{"type":"toggle","displayName":"Show on mobile"}},"properties":{"text":{"type":"code","displayName":"Text"},"loadingState":{"type":"code","displayName":"Show loading state"}},"defaultSize":{"width":3,"height":30},"events":[],"styles":{"textColor":{"type":"color","displayName":"Text Color"},"visibility":{"type":"code","displayName":"Visibility"},"disabledState":{"type":"code","displayName":"Disable"}},"exposedVariables":{},"definition":{"others":{"showOnDesktop":{"value":true},"showOnMobile":{"value":false}},"properties":{"text":{"value":"Repository"},"visible":{"value":true},"loadingState":{"value":"{{false}}"}},"events":[],"styles":{"textColor":{"value":"#000"},"visibility":{"value":"{{true}}"},"disabledState":{"value":"{{false}}"}}}},"layouts":{"desktop":{"top":100,"left":2.3255811756240323,"width":4,"height":30}}},"3222f722-d6ff-4cdc-bc04-4c1dbe40ae86":{"component":{"name":"button1","displayName":"Button","description":"Trigger actions: queries, alerts etc","component":"Button","defaultSize":{"width":3,"height":30},"others":{"showOnDesktop":{"type":"toggle","displayName":"Show on desktop"},"showOnMobile":{"type":"toggle","displayName":"Show on mobile"}},"properties":{"text":{"type":"code","displayName":"Button Text"},"loadingState":{"type":"code","displayName":"Loading State"}},"events":{"onClick":{"displayName":"On click"}},"styles":{"backgroundColor":{"type":"color","displayName":"Background color"},"textColor":{"type":"color","displayName":"Text color"},"visibility":{"type":"code","displayName":"Visibility"},"disabledState":{"type":"code","displayName":"Disable"},"borderRadius":{"type":"code","displayName":"Border radius"}},"exposedVariables":{},"definition":{"others":{"showOnDesktop":{"value":true},"showOnMobile":{"value":false}},"properties":{"text":{"value":"Fetch History"},"visible":{"value":true},"loadingState":{"value":"{{queries.runjs2.isLoading || queries.restapi1.isLoading}}"}},"events":[{"eventId":"onClick","actionId":"run-query","message":"Hello world!","queryId":"f006d058-8cac-442e-a093-a2757247fefb","queryName":"restapi1"}],"styles":{"backgroundColor":{"value":"#3c4bdc"},"textColor":{"value":"#fff"},"visibility":{"value":"{{true}}"},"borderRadius":{"value":"{{4}}"},"disabledState":{"value":"{{false}}"}}}},"layouts":{"desktop":{"top":130,"left":28.178344348635836,"width":5,"height":40}}},"002460c5-7ae0-450a-8eec-2039f8ef1463":{"component":{"name":"text3","displayName":"Text","description":"Display markdown or HTML","component":"Text","others":{"showOnDesktop":{"type":"toggle","displayName":"Show on desktop"},"showOnMobile":{"type":"toggle","displayName":"Show on mobile"}},"properties":{"text":{"type":"code","displayName":"Text"},"loadingState":{"type":"code","displayName":"Show loading state"}},"defaultSize":{"width":3,"height":30},"events":[],"styles":{"textColor":{"type":"color","displayName":"Text Color"},"visibility":{"type":"code","displayName":"Visibility"},"disabledState":{"type":"code","displayName":"Disable"}},"exposedVariables":{},"definition":{"others":{"showOnDesktop":{"value":true},"showOnMobile":{"value":false}},"properties":{"text":{"value":"Required if more than 5000 stars. Token is not stored or sent to backend."},"visible":{"value":true},"loadingState":{"value":"{{false}}"}},"events":[],"styles":{"textColor":{"value":"#a92121"},"visibility":{"value":"{{true}}"},"disabledState":{"value":"{{false}}"}}}},"layouts":{"desktop":{"top":240,"left":79.00856337123992,"width":8,"height":60}}},"c6592886-aa84-4f4b-9204-65a3570b6193":{"component":{"name":"text4","displayName":"Text","description":"Display markdown or HTML","component":"Text","others":{"showOnDesktop":{"type":"toggle","displayName":"Show on desktop"},"showOnMobile":{"type":"toggle","displayName":"Show on mobile"}},"properties":{"text":{"type":"code","displayName":"Text"},"loadingState":{"type":"code","displayName":"Show loading state"}},"defaultSize":{"width":3,"height":30},"events":[],"styles":{"textColor":{"type":"color","displayName":"Text Color"},"visibility":{"type":"code","displayName":"Visibility"},"disabledState":{"type":"code","displayName":"Disable"}},"exposedVariables":{},"definition":{"others":{"showOnDesktop":{"value":true},"showOnMobile":{"value":false}},"properties":{"text":{"value":"Built using https://github.com/ToolJet/ToolJet"},"visible":{"value":true},"loadingState":{"value":"{{false}}"}},"events":[],"styles":{"textColor":{"value":"#000"},"visibility":{"value":"{{true}}"},"disabledState":{"value":"{{false}}"}}}},"layouts":{"desktop":{"top":770,"left":2.3255811756240323,"width":13,"height":30}}},"4c6dd385-c867-49a3-9553-deeb32ae1557":{"component":{"name":"container1","displayName":"Container","description":"Wrapper for multiple components","defaultSize":{"width":5,"height":200},"component":"Container","others":{"showOnDesktop":{"type":"toggle","displayName":"Show on desktop"},"showOnMobile":{"type":"toggle","displayName":"Show on mobile"}},"properties":{},"events":{},"styles":{"backgroundColor":{"type":"color"},"visibility":{"type":"code","displayName":"Visibility"},"disabledState":{"type":"code","displayName":"Disable"}},"exposedVariables":{},"definition":{"others":{"showOnDesktop":{"value":true},"showOnMobile":{"value":false}},"properties":{"visible":{"value":true}},"events":[],"styles":{"backgroundColor":{"value":"#fff"},"visibility":{"value":"{{true}}"},"disabledState":{"value":"{{false}}"}}}},"layouts":{"desktop":{"top":310,"left":79.04095951476702,"width":8,"height":440}}},"8a3a0a85-44f3-4241-bd55-b95608dfcf4e":{"component":{"name":"text5","displayName":"Text","description":"Display markdown or HTML","component":"Text","others":{"showOnDesktop":{"type":"toggle","displayName":"Show on desktop"},"showOnMobile":{"type":"toggle","displayName":"Show on mobile"}},"properties":{"text":{"type":"code","displayName":"Text"},"loadingState":{"type":"code","displayName":"Show loading state"}},"defaultSize":{"width":3,"height":30},"events":[],"styles":{"textColor":{"type":"color","displayName":"Text Color"},"visibility":{"type":"code","displayName":"Visibility"},"disabledState":{"type":"code","displayName":"Disable"}},"exposedVariables":{},"definition":{"others":{"showOnDesktop":{"value":true},"showOnMobile":{"value":false}},"properties":{"text":{"value":"This repository has {{queries.restapi1.data.starGazers}} stars 🌟"},"visible":{"value":true},"loadingState":{"value":"{{false}}"}},"events":[],"styles":{"textColor":{"value":"#000"},"visibility":{"value":"{{true}}"},"disabledState":{"value":"{{false}}"}}}},"parent":"4c6dd385-c867-49a3-9553-deeb32ae1557","layouts":{"desktop":{"top":30,"left":4.796531874795149,"width":39.067200999949264,"height":70}}},"09ca79b6-9576-4afa-9144-05e7688f24ee":{"component":{"name":"text7","displayName":"Text","description":"Display markdown or HTML","component":"Text","others":{"showOnDesktop":{"type":"toggle","displayName":"Show on desktop"},"showOnMobile":{"type":"toggle","displayName":"Show on mobile"}},"properties":{"text":{"type":"code","displayName":"Text"},"loadingState":{"type":"code","displayName":"Show loading state"}},"defaultSize":{"width":3,"height":30},"events":[],"styles":{"textColor":{"type":"color","displayName":"Text Color"},"visibility":{"type":"code","displayName":"Visibility"},"disabledState":{"type":"code","displayName":"Disable"}},"exposedVariables":{},"definition":{"others":{"showOnDesktop":{"value":true},"showOnMobile":{"value":false}},"properties":{"text":{"value":"Repository was created {{moment(queries.restapi1.rawData.created_at).fromNow()}} ago."},"visible":{"value":true},"loadingState":{"value":"{{false}}"}},"events":[],"styles":{"textColor":{"value":"#000"},"visibility":{"value":"{{true}}"},"disabledState":{"value":"{{false}}"}}}},"parent":"4c6dd385-c867-49a3-9553-deeb32ae1557","layouts":{"desktop":{"top":110,"left":5.404523725480118,"width":37.103522291585676,"height":50}}},"d53e0412-bba9-47d7-bf37-1cb5e91eefed":{"component":{"name":"container2","displayName":"Container","description":"Wrapper for multiple components","defaultSize":{"width":5,"height":200},"component":"Container","others":{"showOnDesktop":{"type":"toggle","displayName":"Show on desktop"},"showOnMobile":{"type":"toggle","displayName":"Show on mobile"}},"properties":{},"events":{},"styles":{"backgroundColor":{"type":"color"},"visibility":{"type":"code","displayName":"Visibility"},"disabledState":{"type":"code","displayName":"Disable"}},"exposedVariables":{},"definition":{"others":{"showOnDesktop":{"value":true},"showOnMobile":{"value":false}},"properties":{"visible":{"value":true}},"events":[],"styles":{"backgroundColor":{"value":"#fff"},"visibility":{"value":"{{true}}"},"disabledState":{"value":"{{false}}"}}}},"layouts":{"desktop":{"top":0,"left":0,"width":43,"height":60}}},"8a367ae0-68cf-4ef8-947d-4a25b8ded078":{"component":{"name":"text6","displayName":"Text","description":"Display markdown or HTML","component":"Text","others":{"showOnDesktop":{"type":"toggle","displayName":"Show on desktop"},"showOnMobile":{"type":"toggle","displayName":"Show on mobile"}},"properties":{"text":{"type":"code","displayName":"Text"},"loadingState":{"type":"code","displayName":"Show loading state"}},"defaultSize":{"width":3,"height":30},"events":[],"styles":{"textColor":{"type":"color","displayName":"Text Color"},"visibility":{"type":"code","displayName":"Visibility"},"disabledState":{"type":"code","displayName":"Disable"}},"exposedVariables":{},"definition":{"others":{"showOnDesktop":{"value":true},"showOnMobile":{"value":false}},"properties":{"text":{"value":"