1console.log("This runs on import");
2
3export function test() {
4 console.log("This runs when test() is called");
5}
6console.log(theString);
7theString = theString.replace(`'squint-cljs/core.js'`, `'npm:squint-cljs/core.js'`);
8const AsyncFunction = Object.getPrototypeOf(async function() {}).constructor;
9await new AsyncFunction(theString)();
6 console.log(theString);
7 theString = theString.replace(`'squint-cljs/core.js'`, `'npm:squint-cljs/core.js'`);
8 const AsyncFunction = Object.getPrototypeOf(async function() {}).constructor;
9 await (new AsyncFunction(theString)());
10})();
14});
15
16export default async function(req: Request): Promise<Response> {
17 // Ensure only allowed pathnames are used
18 const { pathname, search } = new URL(req.url);
61}
62
63async function limitFreeModel(req: Request, user: any) {
64 if (user.tier === "pro") return req.body;
65 const input = await req.json();
2import { easyAQI } from "https://esm.town/v/stevekrouse/easyAQI";
3
4export async function aqi(interval: Interval) {
5 const location = "barcelona"; // <-- change to place, city, or zip code
6 const data = await easyAQI({ location });
18const resp = await fetch("https://maxm-wasmblobhost.web.val.run/jpxqvyy5tphiwehzklmioklpkpz4gpzs.wasm");
19const handler = await wasmHandler(new Uint8Array(await resp.arrayBuffer()));
20export default async function(req: Request): Promise<Response> {
21 return handler(req);
22}
3import { sqlite } from "https://esm.town/v/std/sqlite?v=4";
4
5async function addProduct(id, title, url, priceAmount, priceCurrencyCode) {
6 console.debug("Adding product", { id, title, url, priceAmount, priceCurrencyCode });
7 // Insert the product if it doesn't exist
29}
30
31async function sendNewProductMessage(products) {
32 if (!products || products.length === 0) {
33 console.log("No new products to send.");
53}
54
55export default async function(interval: Interval) {
56 const brokerId = Deno.env.get("SHOPIFY_STORE_ID");
57 const first = 30;
3// Send a pushover message.
4// token, user, and other opts are as specified at https://pushover.net/api
5export async function pushover({ token, user, message, title, device, ...opts }) {
6 try {
7 const requestBody = new URLSearchParams({
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function ShopifyProductSearch(brokerId, first = 20) {
4 // The GraphQL endpoint you're going to query
5 const url = "https://shop.app/web/api/graphql";
12 * @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
13 * @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
14 * @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
15 * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
16 * @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
A helper function to build a file's email
Simple functional CSS library for Val Town
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
import { OpenAI } from "https://esm.town/v/std/openai";
export default async function(req: Request): Promise<Response> {
if (req.method === "OPTIONS") {
return new Response(null, {
headers: {
"Access-Control-Allow-Origin": "*",