invest-trackercrypto_news_cron.tsx2 matches
2import { blob } from "https://esm.town/v/std/blob";
34const KEY = Deno.env.get("NEWSDATA")!; // API key
5const KEEP = 20; // store up to 20
6const WINDOW_MIN = 1440; // last 24 h
9/* 1 ─ build query (size 10, English) */
10const q = encodeURIComponent("bitcoin OR btc OR ethereum OR eth OR solana OR sol");
11const url = `https://newsdata.io/api/1/latest?apikey=${KEY}&q=${q}&language=en&size=10`;
1213/* 2 ─ fetch & peek */
invest-trackerprice_alert_cron.tsx2 matches
51async function sendWhatsApp(text: string) {
52const enc = encodeURIComponent(text.substring(0, 900)); // 900 char max
53const url = `https://api.callmebot.com/whatsapp.php?phone=${PHONE}`
54+ `&text=${enc}&apikey=${KEY}`;
55await fetch(url).then(r => r.text());
56}
ChatHTMLRenderer.tsx23 matches
9}
1011interface MCPContextAPI {
12// Tool operations
13listTools: () => Promise<any[]>;
37* - Renders HTML in a secure iframe
38* - Provides fullscreen enter/exit affordances
39* - Exposes MCP context API to iframe content
40* - Handles iframe communication via postMessage
41*/
47console.log("[MCP/Browser Renderer] HTMLRenderer: Rendering HTML:", { mcpClients });
4849// Create MCP context API that will be exposed to iframe
50const createMCPContext = useCallback((): MCPContextAPI => {
51const findClientByName = (serverName: string) => {
52console.log("[MCP/Browser Renderer] Finding client by name:", serverName, mcpClients);
177const { type, id, method, args } = event.data;
178179if (type !== "mcp-api-call") {
180return;
181}
186187if (typeof methodFunc !== "function") {
188throw new Error(`Unknown MCP API method: ${method}`);
189}
190192193iframe.contentWindow?.postMessage({
194type: "mcp-api-response",
195id,
196success: true,
199} catch (error) {
200iframe.contentWindow?.postMessage({
201type: "mcp-api-response",
202id,
203success: false,
222</script>
223<script>
224// MCP Context API for iframe content
225window.mcpContext = {
226// Async wrapper for postMessage communication
227async callAPI(method, ...args) {
228return new Promise((resolve, reject) => {
229const id = Math.random().toString(36).substr(2, 9);
230
231const handleResponse = (event) => {
232if (event.data.type === 'mcp-api-response' && event.data.id === id) {
233window.removeEventListener('message', handleResponse);
234if (event.data.success) {
243
244window.parent.postMessage({
245type: 'mcp-api-call',
246id,
247method,
252setTimeout(() => {
253window.removeEventListener('message', handleResponse);
254reject(new Error('MCP API call timeout'));
255}, 30000);
256});
258
259// Convenience methods
260async listTools() { return this.callAPI('listTools'); },
261async callTool(serverName, toolName, args) { return this.callAPI('callTool', serverName, toolName, args); },
262async listPrompts() { return this.callAPI('listPrompts'); },
263async getPrompt(serverName, promptName, args) { return this.callAPI('getPrompt', serverName, promptName, args); },
264async listResources() { return this.callAPI('listResources'); },
265async readResource(serverName, uri) { return this.callAPI('readResource', serverName, uri); },
266log(level, message, data) { this.callAPI('log', level, message, data); },
267requestFullscreen() { this.callAPI('requestFullscreen'); },
268exitFullscreen() { this.callAPI('exitFullscreen'); },
269async isFullscreen() { return this.callAPI('isFullscreen'); }
270};
271
1import { getArticle, getAuthor } from "./_api.ts";
2import { createServer } from "./_server.ts";
3
1import { getArticle } from "./_api.ts";
2import { createServer } from "./_server.ts";
3
1import { getArticle } from "./_api.ts";
2import { createServer } from "./_server.ts";
3
graphql-crash-course_api.ts0 matches
1import { setTimeout } from "node:timers/promises";
23const articles = [{
4id: 0,
5title: "A Crash Course in GraphQL",
hm-invoicesv1PLAN.md14 matches
6## Phase Completion Checklist
7- [x] Phase 1: Foundation & Database Setup
8- [x] Phase 2: Core Backend API
9- [x] Phase 3: Frontend Foundation
10- [x] Phase 4: Enhanced UI & Interactions
59---
6061## Phase 2: Core Backend API
62**Goal**: Build RESTful API endpoints for invoice management
6364### Tasks:
651. **Main API Setup**
66- Create `main.tsx` with Hono app configuration
67- Set up error handling and static file serving
68- Configure CORS if needed
69702. **Invoice API Endpoints**
71- `GET /api/invoices` - List all invoices with filtering
72- `POST /api/invoices` - Create new invoice
73- `PUT /api/invoices/:id` - Update invoice (mainly status changes)
74- `GET /api/invoices/stats` - Dashboard statistics
75763. **Vendor API Endpoints**
77- `GET /api/vendors` - List all vendors
7879### Deliverables:
80- Complete REST API for invoice management
81- API endpoints tested via admin tools or direct calls
82- Proper error handling and validation
83171172## Technical Stack
173- **Backend**: Hono.js for API routes
174- **Database**: SQLite with Val Town's sqlite service
175- **Frontend**: React 18.2.0 with TypeScript
hm-invoicesv1StatusProgress.tsx3 matches
64{getStatusIcon(status, index)}
65</span>
66<span className="text-xs mt-1 capitalize">
67{status}
68</span>
76<div className="text-sm opacity-70">
77Step {currentIndex + 1} of {statuses.length}:
78<span className="font-medium capitalize ml-1">{currentStatus}</span>
79</div>
80{interactive && currentIndex < statuses.length - 1 && (
124max="100"
125></progress>
126<span className="text-xs capitalize font-medium">
127{currentStatus}
128</span>
hm-invoicesv1App.tsx12 matches
23import React, { useState, useEffect } from "https://esm.sh/react@18.2.0";
4import { InvoiceWithVendor, Vendor, InvoiceFilters, InvoiceStats, InvoiceStatus, ApiResponse } from "../../shared/types.ts";
5import InvoiceList from "./InvoiceList.tsx";
6import InvoiceForm from "./InvoiceForm.tsx";
18const [activeTab, setActiveTab] = useState<'dashboard' | 'invoices' | 'add'>('dashboard');
1920// Fetch data from API
21useEffect(() => {
22fetchData();
40
41const [invoicesResponse, vendorsResponse] = await Promise.all([
42fetch(`/api/invoices?${queryParams.toString()}`),
43fetch('/api/vendors')
44]);
4548}
4950const invoicesData: ApiResponse<InvoiceWithVendor[]> = await invoicesResponse.json();
51const vendorsData: ApiResponse<Vendor[]> = await vendorsResponse.json();
5253if (!invoicesData.success || !vendorsData.success) {
69try {
70setStatsLoading(true);
71const response = await fetch('/api/invoices/stats');
72
73if (!response.ok) {
75}
7677const data: ApiResponse<InvoiceStats> = await response.json();
78
79if (!data.success) {
92const handleAddInvoice = async (invoiceData: any) => {
93try {
94const response = await fetch('/api/invoices', {
95method: 'POST',
96headers: {
104}
105106const data: ApiResponse<InvoiceWithVendor> = await response.json();
107
108if (!data.success) {
123const handleStatusUpdate = async (invoiceId: number, newStatus: InvoiceStatus) => {
124try {
125const response = await fetch(`/api/invoices/${invoiceId}`, {
126method: 'PUT',
127headers: {
135}
136137const data: ApiResponse<InvoiceWithVendor> = await response.json();
138
139if (!data.success) {