Skip to main content
Home
This package has been archived, and as such it is read-only.

Built and signed on GitHub Actions

Works with
This package works with Node.js, Deno, Bun, Browsers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score100%
Downloads31/wk
Published2 months ago (0.3.1)

01Edu AI framework for Sqlite & Deno based app

context

Keep track of information for each web request, like the URL and session. This lets you easily get the current request's details from anywhere.

T
GetContext

A function that returns the current request's context.

v
getContext

Returns the current request's context. If no context is found, it returns a default context.

T
NewContext

A function that creates a new request context. Useful for testing or running background jobs.

v
newContext

Creates a new request context. Useful for testing or running background jobs.

T
RequestContext

Represents the context for a single HTTP request. It holds all relevant information for the request lifecycle.

T
RunContext

A function that runs a callback within a specific request context. This is the foundation of how the context is managed across asynchronous operations.

v
runContext

Runs a callback within a specific request context, making it available via getContext. This is essential for ensuring that context is not lost in asynchronous operations.

db

Create and interact with SQLite database tables. You define the table's columns, and it automatically generates functions to insert, update, find, and run custom SQL queries on that table, reducing sql boilerplate.

f
createTable

Creates a new database table and returns an API for interacting with it.

v
db

The main database connection. It is a singleton instance of the Database class from the @db/sqlite module.

T
DBTypes

A mapping of database type names to their corresponding JavaScript types.

f
makeRestorePoint

Creates a restore point for the database, for use in testing environments. This function will throw an error if called in a production environment.

T
Row

Represents a row from a database table, with type inference based on the table properties.

f
sql

A template literal tag for executing arbitrary SQL queries.

f
sqlCheck

A template literal tag for creating a SQL query that checks for the existence of something.

T
TableAPI

The API returned by createTable, providing methods to interact with a specific database table.

T
TableProperties

Defines the structure of a database table's columns.

entries

Setup Entries, this is made for applications that want to be organized with entries as a generic fact representing all of the app state and changes. This takes inspiration from star schema and event sourcing. Entries additionally share concepts with our context module to embed structural request information like the session automatically per entry

f
initEntries

Initializes the entry system, creating tables, views, and an API for interacting with entries. Entries are a generic way to represent state changes and events in the application.

env

Util to define event variable with default fallback. Also define and share the expected APP_ENV required by our apps.

v
APP_ENV

The current application environment, determined by the APP_ENV environment variable. Defaults to 'dev' if not set.

T
AppEnvironments

The possible application environments.

v
CI_COMMIT_SHA

The git commit SHA of the current build, typically provided by a CI/CD system.

v
DEVTOOL_TOKEN

An authentication token for a developer tool service.

v
DEVTOOL_URL

The URL for a developer tool service.

f
ENV

Retrieves an environment variable by key. Throws an error if the variable is not set and no fallback is provided.

log

Add support for sending logs to our devtools. Our Logger also help shapping logs and recognize our context module.

I
Log

Represents the logger interface, with methods for each log level.

f
logger

Initializes and returns a logger instance. The logger's behavior depends on the application environment (APP_ENV). In 'prod', it batches logs and sends them to a remote devtool service. In 'dev', it logs to the console with pretty colors and call chain information. In 'test', it logs to the console with timestamps.

migration

Rely on sqlite PRAGMA user_version to apply migrations

f
runMigrations

Runs database migrations from a specified directory. Migrations are applied in order based on the version number in their filename. It uses the user_version pragma in SQLite to keep track of the current database version.

response

Set of simple shortcuts for creating standard JSON web responses for every HTTP status code, like respond.OK() or respond.NotFound(). It also automatically creates corresponding error classes for HTTP errors, so you can easily throw a NotFoundError in your code. This interact with our provided server to allow errors that can be used by both application code and to build http response.

v
respond

A collection of utility functions and error classes for creating standard Response objects.

c
ResponseError

A custom error class that encapsulates a Response object. This is the base class for all HTTP errors created by the respond object.

router

Type-safe HTTP Router module.

T
GenericRoutes
No documentation available
T
Handler

Descriptor for a handler that may authorize a session and convert input to output.