2
3export let unserializeableLogEx = (async () => {
4 const { Configuration, OpenAIApi } = await import("npm:openai");
5 const configuration = new Configuration({
6 apiKey: process.env.openai,
7 });
8 const openai = new OpenAIApi(configuration);
9 console.log(openai);
10})();
1import { exportedKeys } from "https://esm.town/v/stevekrouse/exportedKeys";
2import { valTownInspoList } from "https://esm.town/v/rodrigotello/valTownInspoList?v=99";
3import { runValAPIAuth } from "https://esm.town/v/stevekrouse/runValAPIAuth";
4
5export let untitled_blackBoa = runValAPIAuth({
6 val: "@rodrigotello.updateInspoList",
7 args: [
24 import * as Plot from "https://cdn.jsdelivr.net/npm/@observablehq/plot@0.6.9/+esm";
25 import {debounce} from "https://cdn.jsdelivr.net/npm/lodash-es@4.17.21/+esm";
26 const ranks = await (await fetch('https://api.val.town/v1/run/tmcw.big_stories_ranks')).json();
27
28 let allDates = new Set();
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4export const privateAPIAuthenticated = fetchJSON(
5 "https://api.val.town/v1/run/stevekrouse.example3",
6 {
7 method: "GET",
6 const { micromark } = await import("npm:micromark");
7 const rows = await fetch(
8 "https://data.ny.gov/api/views/7rrd-248n/rows.csv?accessType=DOWNLOAD&sorting=true",
9 )
10 .then((r) => r.text())
2
3export let evalPost1 = fetchJSON(
4 "https://api.val.town/v1/eval",
5 {
6 method: "POST",
6 const nytimes =
7 await (await fetch(
8 `https://api.nytimes.com/svc/topstories/v2/home.json?api-key=${process.env.nytimes_api_key}`,
9 )).json();
10 const now = Date.now();
1export const testVTClient = (async () => {
2 const { createApiClient } = await import(
3 "https://esm.sh/gh/nbbaier/valtown-zodios@main/src/spec/valtown-client.ts"
4 );
5 const apiClient = createApiClient("https://api.val.town");
6 const params = {
7 params: { username: "stevekrouse", val_name: "fetchJSON" },
8 };
9 const user = await apiClient.getValname(params);
10 return user;
11})();
4export async function testMutateSemantics({
5 stateName,
6 api,
7 mutateExpected,
8 expected,
11}: {
12 stateName: string;
13 api: string;
14 mutateExpected?: boolean;
15 expected?: (old, next) => boolean;
18}) {
19 const { data: last } = await fetchJSON(
20 `${api}/eval/${stateName}`
21 );
22 const now = Date.now();
23 await fetchJSON(
24 `${api}/eval/${mutator(now)}`,
25 authenticated
26 ? {
30 );
31 const { data: next } = await fetchJSON(
32 `${api}/eval/${stateName}`
33 );
34 const mutated = next === now;
3
4
5There's nothing I like more than a little open data and transparency! This Val shows you how to use the [California Secretary of State Business Search](https://bizfileonline.sos.ca.gov/search/business) as a faux-API and get notifications when records change. This lets you know when a business updates their records, changes their good-standing status, and so on.
6
7Here's how to use it:
135. Now, in the network tab of your developer tools, you should see a request that ends with `false`. You'll find a number in that URL. Plug that number into the val at the spot at the top.
14
15
16
17(We're almost there!)
27### Notes
28
29- [opencorporates](https://opencorporates.com/) has a _way_ better system for open data around businesses, but to get a free API key you need to be a nonprofit or a registered journalist, and I am neither. But if you are, use that!
30- Thanks to America's laws around business registration, it's commonplace for businesses to mask their control and ownership by using registration agents and a few layers of corporate structure.