hn_notifierutils.ts4 matches
5export const HN_API_URL = "https://hn.algolia.com/api/v1/items";
67export function countAllChildren(item: HNAPIResponse): number {
8const stack: HNAPIResponse[] = [item];
9let count = 0;
21}
2223export async function getHNItem(id: number) {
24return await betterFetch<HNAPIResponse>(
25`${HN_API_URL}/${id}`,
27}
2829export async function getHNCommentStoryTitle(storyId: number): Promise<{
30data: { storyTitle: string } | null;
31error: {
47}
4849export async function createDBItem(id: number, data: HNAPIResponse): Promise<DBItem> {
50const comments = countAllChildren(data);
51
hn_notifierqueries.ts5 matches
9* @returns {Promise<DBItem[]>} The inserted item
10*/
11export async function follow(item: DBItem): Promise<DBItem> {
12const { id, comments, title, type } = item;
13const res = await sqlite.execute({
23* @returns {Promise<void>}
24*/
25export async function unfollow(id: number): Promise<void> {
26await sqlite.execute({
27sql: `DELETE FROM ${tableName} WHERE id = ?`,
35* @returns {Promise<DBItem[]>} The matching item(s)
36*/
37export async function getItem(id: number): Promise<DBItem | undefined> {
38const res = await sqlite.execute({
39sql: `SELECT * FROM ${tableName} WHERE id = ?`,
47* @returns {Promise<DBItem[]>} Array of all items
48*/
49export async function getAllItems(): Promise<DBItem[]> {
50const res = await sqlite.execute(`SELECT * FROM ${tableName}`);
51return sqliteRowsToObject<DBItem>(res);
57* @returns {Promise<DBItem[]>} The updated item
58*/
59export async function updateCommentCount(item: DBItem): Promise<DBItem[]> {
60const { id, comments } = item;
61const res = await sqlite.execute({
hn_notifiermigrations.ts1 match
9)`;
1011export async function createTables() {
12await sqlite.batch([schema]);
13}
hn_notifierItemContext.tsx4 matches
16isLoading: false,
17saveUrl: async () => {
18throw new Error("saveUrl function not implemented");
19},
20unfollowUrl: async () => {
21throw new Error("unfollowUrl function not implemented");
22},
23fetchUrls: async () => {
24throw new Error("fetchUrls function not implemented");
25},
26});
34const [isLoading, setIsLoading] = useState<boolean>(false);
3536// Function to fetch URLs that can be called from components
37const fetchUrls = async (): Promise<void> => {
38setIsLoading(true);
hn_notifierInput.tsx1 match
37}
3839// Save the URL using the context function
40console.log("saving:", id);
41await saveUrl(id);
hn_notifierApp.tsx1 match
5import ListSection from "https://esm.town/v/nbbaier/hn_notifier/frontend/components/ListSection.tsx";
67export function App() {
8return (
9<ItemsProvider>
roughVizPlaygroundmain.tsx8 matches
1export default async function handler(request) {
2return new Response(
3`
444
445<script>
446// Helper function to generate CSV data for line chart
447function generateCsvData() {
448const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
449let csvString = 'month,value1,value2\\n';
460
461// Initialize charts
462document.addEventListener('DOMContentLoaded', function() {
463// Get current settings
464const getSettings = () => {
480// Update display values
481['roughness', 'bowing', 'fill-weight', 'stroke-width', 'inner-stroke-width'].forEach(id => {
482document.getElementById(id).addEventListener('input', function() {
483document.getElementById(\`\${id}-value\`).textContent = this.value;
484});
486
487// Apply settings button
488document.getElementById('apply-settings').addEventListener('click', function() {
489// Clear existing charts
490document.querySelectorAll('.chart-container > div:first-of-type').forEach(chart => {
500});
501
502function createCharts(settings) {
503if (typeof roughViz === 'undefined') {
504console.error('roughViz library is not loaded');
639}
640
641function updateCodeExamples(settings) {
642const codeExamples = document.querySelectorAll('.code-example pre');
643
vsmarketplaceRSSmain.tsx1 match
44}
4546export default async function server(request: Request): Promise<Response> {
47const url = new URL(request.url);
48const pathParts = url.pathname.split("/").filter(Boolean);
dazzlingCoffeeTigermain.tsx2 matches
2import { generateText } from "npm:ai";
34export default async function(req: Request): Promise<Response> {
5if (req.method !== "POST") {
6return Response.json({ message: "This function only accepts POST requests." }, { status: 400 });
7}
8try {
1"I'm sorry, but I need a specific toolDescription in order to generate the required TypeScript code. Could you please provide the toolDescription so I can create the cloud function for you?"