@rlesser
Get Favorites on Resy
This function fetches your favorite restaurants and venues, as specified in your Hit List.
Inputs
An object
containing:
authToken
- Your authentication token, normally generated from @rlesser.Resy_authenticate.
Returns
A Favorites
object, containing the ids of your favorite venues, defined in the type below.
See other Resy vals I've made.
SQLite Table Export Utils
This allows for a val.town-hosted SQLite table to be exported as:
- JSON (
Record<string, unknown>[]
) - Arrow IPC (
Uint8Array
) - TODO: Others?
This can then be used by a HTTP endpoint, like so:
Create valimport { exportSQLiteTable, SQLiteTableExportFormat } from "https://esm.town/v/rlesser/sqliteTableExportUtils";
export default async function(req: Request): Promise<Response> {
const tableName = new URL(req.url).searchParams.get("table");
if (!tableName) {
return new Response("Table name is required", { status: 400 });
}
const format = (new URL(req.url).searchParams.get("format") || "arrowIPC") as SQLiteTableExportFormat;
const data = await exportSQLiteTable(tableName, format);
if (data instanceof Uint8Array) {
return new Response(data, {
headers: { "Content-Type": "application/octet-stream" },
});
} else {
return Response.json(data);
}
}
TODO
- Specify limit and offset of export, for pagination
- Smart assessment of if the export is going to be over the val.town limit of 10MB, adjust to paginated of so.
- Support other export formats.
PRs welcome!
Dependency Graph Explorer
This val allows for dependency graph exploration.
getDependencyGraph
Iteratively explores the dependency graph of a val and its children, returning the results.
arguments
- valUrlOrSlug
string
- the full val url or slug (author/name
) of the val
returns
An object containing:
- dependencyMap
Map<string, string[]>
- A map of vals (by id) to dependencies (vals or non-val id) - moduleMap
Map<string, Module>
- A map of modules (by val or non-val id) to module information. Module object contains: -
- slug
string
- the slug of the module, how it should be displayed visually
- slug
-
- id
string
- the id of the module, corresponding to how it's displayed in the code, normally as a url.
- id
-
- websiteUrl
string
- the website link for the module, a normally a link to either valtown or npm.
- websiteUrl
-
- category
string|null
- the category of the module, such as "valtown", "esm.sh", or "npm". Those without a predefined category are in null.
- category
Convert markdown to Html with Github styling
Forked to add remark-mermaid
Get a Venue's Calendar on Resy
This function fetches the calendar for a given venue on Resy, which gives information on which days the venue is available, sold-out, or closed.
Inputs
An object
containing:
venue_id
- The Resy venue id, either fetched from the website's network data or from @rlesser_getFavorites (Todo: add venue id from url function).num_seats
- The number of seats you are checking for availability for. Use 2 as a default if you just want to know when the restaurant is closed.
Returns
A VenueCalendar
object, containing:
last_calendar_day
- A string representing the last day the restaurant has made their calendar available for (normally a few weeks out from today).scheduled
- An object containing a list of dates and restaurant statuses. See type below.
See other Resy vals I've made.
Authenticate with Resy
This function can be used to generate an authentication token for Resy, which can be used to view favorites, set notifies, or even make reservations.
Inputs
An AuthParams
object containing:
email
- The email address for your Resy account. Probably best to keep private.password
- The password for your Resy account. Definitely keep this private, and place it in a secret.
Returns
An AuthResponse
object containing:
id
- Your Resy account id.token
- Your Resy account token, used to authenticate you in subsequent API calls.
See other Resy vals I've made.