gizapp/pages
File-system routing: a folder of pages is a site. giz writes the module PAGES/.routes for it (a program imports site from it); this file serves what that module declares. A route file is a .ghtml file in lower case (index.ghtml, [slug].ghtml), a .md file (rendered by Markdown) or a .html file (sent as it is). [name] in a path is a parameter, index is its folder, _layout.ghtml wraps the pages of its folder and below, 404.* is the not-found page.
import * as Pages from "gizapp/pages";Types
Props
type Props = { params: Http.Params; request: Http.Request; context: Table.Context; form: Http.Params; locale: Locale; languages: Vec<Locale>; }What a route file reads: params and request by name, me (who asks), the tables through context, the fields that the
page posted (form: the action, the state and the bound controls, written by the generated code of the page), and locale, the
language the page is answered in (app/i18n.giz), by which its text and its numbers and dates show, among the languages of the site (its
source language first; a language picker lists them).
params:gizlang_http.Paramsrequest:gizlang_http.Requestcontext:M118.Contextform:gizlang_http.Paramslocale:gizlang_locale.Localelanguages:Vec<gizlang_locale.Locale>
Route
type Route = { pattern: string; kind: string; render: Render; text: string; style: string; run: Answer; place: string; methods?: Vec<string>; revision?: string; }A page: how it renders, and the scoped style of its file. kind is "view" (a .ghtml file), "markdown", "file" or
"handler" (a .giz file, which run answers). place is its address with the groups of its folders
(/(shop)/cart), which the layouts cover; "" is its pattern.
pattern:stringkind:stringrender:(arg0: M114.Props, arg1: gizlang_html.Html) => gizlang_html.Htmltext:stringstyle:stringrun:(arg0: M114.Props) => gizlang_http.Responseplace:stringmethods:_gizlang_sdk_core.Option<Vec<string>>revision:_gizlang_sdk_core.Option<string>
Layout
type Layout = { prefix: string; render: Render; style: string; revision?: string; }A layout wraps the pages whose pattern starts with prefix.
prefix:stringrender:(arg0: M114.Props, arg1: gizlang_html.Html) => gizlang_html.Htmlstyle:stringrevision:_gizlang_sdk_core.Option<string>
Guard
type Guard = { prefix: string; before: (props: Props) => Option<Http.Response>; }What a folder's _middleware.giz runs before each route under PREFIX (its place, groups included): BEFORE answers in the
route's place (a redirect to sign in, a 403, a rewrite's answer) or lets it run. Outer folders run first.
prefix:stringbefore:(arg0: M114.Props) => _gizlang_sdk_core.Option<gizlang_http.Response>
Site
type Site = { router: Http.Router<i64>; routes: Vec<Route>; layouts: Vec<Layout>; missing: Vec<Route>; speaking: I.Speaking; guards?: Vec<Guard>; }A site: its routes, layouts and not-found page, and the languages it speaks (app/i18n.giz).
router:gizlang_http.Router<i64>routes:Vec<M114.Route>layouts:Vec<M114.Layout>missing:Vec<M114.Route>speaking:_gizlang_lib_app__i18n.Speakingguards:_gizlang_sdk_core.Option<Vec<M114.Guard>>— The guards of its folders, outermost first.
Keeping
type Keeping = (field: string, name: string, type: string, data: bytes) => string throws Model.RejectionKeeps a file that a page's file input sent, in the app's own place: the input's state NAME, the file's name, its media type and its bytes; the address a page reads it at.
Keeper
type Keeper = () => Keeping effects {io, fail}Makes the Keeping of one serving thread (Application.keeps): a thread makes its own, as it makes its mounts.
Host
type Host = { context: (request: Http.Request) => Table.Context; db: Option<Data.Db>; shapes: Vec<Model.Shape>; files: string; keep: Option<Keeping>; presence: App.Presence; actions: Vec<Model.AnyAction<Table.Context>>; }What a site runs on: the tables of a request as the person who asks may use them, and the database whose changes pages follow.
context:(arg0: gizlang_http.Request) => M118.Contextdb:_gizlang_sdk_core.Option<M139.Db>shapes:Vec<M141.Shape>files:string— The folder that keeps the files a page's file input sends (served at /files/), or "": none.keep:_gizlang_sdk_core.Option<(arg0: string, arg1: string, arg2: string, arg3: bytes) => string throws M141.Rejection>— Where a file of a file input goes instead of that folder (Application.keeps): none keeps it there.presence:_gizlang_lib_app__app.Presence— Who has which view open (a grid shows the others).actions:Vec<M141.AnyAction<M118.Context>>— The actions an agent or a page calls at /_a/NAME and lists at /_tools: the tables' five, then the app's own.
Remote
type Remote = { base: string; headers: Vec<Http.Header>; }Another app that a remote action calls: its address and the headers that sign each call (its bearer).
base:stringheaders:Vec<gizlang_http.Header>
File
type File = { name: string; type: string; size: i64; url: string; }A file that a page's file input sent: its name, media type, size, and its address here (/files/…).
name:stringtype:stringsize:i64url:string
Served
type Served = { db: Data.Db; people: Data.Db; folder: string; shell: App.Shell; }What a handler of an Application gets in its serving thread: its System, the app's database there and the people's (schema auth), the folder of its files and its page shell.
db:M139.Dbpeople:M139.Dbfolder:stringshell:_gizlang_lib_app__app.Shell
People
type People = { title: string; origin: string; password: bool; secret: bytes; owner: string; mail: (served: Served) => Mailing effects {io, fail}; providers?: Vec<OAuth.Provider>; sso?: bool; }The people of an Application (Application.signIn): TITLE names the app on its sign-in page, ORIGIN is its address in a mailed link, PASSWORD allows a password beside the link, SECRET signs sessions, OWNER (a person id) owns the tables (the program's own writes are the owner's), and MAIL makes, on a serving thread, what sends a sign-in link.
title:stringorigin:stringpassword:boolsecret:bytesowner:stringmail:(arg0: M114.Served) => M114.Mailing effects { fail, io }providers:_gizlang_sdk_core.Option<Vec<_gizlang_lib_app__auth__oauth.Provider>>— The providers a person may also sign in with (OAuth.google, OAuth.github, OAuth.oidc), a button each.sso:_gizlang_sdk_core.Option<bool>— Teams may sign their people in with their own single sign-on (Auth.Site.sso).
Mailing
type Mailing = { send: (to: string, link: string) => bool; }What sends sign-in links on the serving thread that made it (People.mail): send says whether link link went to
to.
send:(arg0: string, arg1: string) => bool
Person
type Person = (served: Served) => Asking effects {alloc, fail}Who asks in a request, made on each serving thread from what it serves with: the app's one owner (ME), the person of a session of its people (Application.signIn, else the public), or what a host that keeps its own sessions gives.
HostedPerson
type HostedPerson = (served: Served) => Asking effects {read, alloc, fail}The rows of an app that one thread serves, its host's (Application.hosting): they may hold that thread's state.
HostedMounting
type HostedMounting = (context: () => Table.Context, shell: App.Shell) => Mount effects {read, io, fail}A mount of a hosted app (Hosting.mount): it may hold the thread's state.
Rows
type Rows = { person: HostedPerson; mounts: Vec<HostedMounting>; custom: () => Vec<Model.AnyAction<Table.Context>> effects {read, fail, alloc}; }The rows of a hosted app (Hosting): who asks, what answers beside the pages, and its own actions.
person:(arg0: M114.Served) => ((arg0: gizlang_http.Request) => gizlang_security.Principal) effects { fail, read, alloc }mounts:Vec<(arg0: () => M118.Context, arg1: _gizlang_lib_app__app.Shell) => M114.Mount effects { fail, read, io }>custom:() => Vec<M141.AnyAction<M118.Context>> effects { fail, read, alloc }
Asking
type Asking = (request: Http.Request) => Security.Principal effects {io, fail, read, write, console}Who asks in one request (Person).
Application
type Application = { folder: string; store: Sql.Database; engine: Option<Data.Engine>; feed: Option<Relay.Relay>; db: Data.Db; site: () => Site effects {fail, alloc}; shapes: Vec<Model.Shape>; theme: string; elements: Vec<App.Element>; people: Option<People>; person: Person; ownerOnlyFiles: bool; mounts: Vec<Mounting>; keeping: Option<Keeper>; custom: Actions<Table.Context>; threads: i64; ready: App.Listening; socket?: string; }A site of pages over its own GizDB with the tables of shapes, for one person. listen serves it; each, rows,
save and file are the program's side of the same tables, so a row that the program writes reaches each open page
by itself.
folder:stringstore:gizlang_sql.Databaseengine:_gizlang_sdk_core.Option<M135.Engine>— The engine of its GizDB folder when this process serves it (gizdb/app store): pages then read it on each thread.feed:_gizlang_sdk_core.Option<M144.Relay>— The changes of a server's store (Relay), which pages follow; none on the engine this process serves.db:M139.Dbsite:() => M114.Site effects { fail, alloc }shapes:Vec<M141.Shape>theme:string— The sheet of tokens of its pages (Application.theme): "" for the default theme.elements:Vec<_gizlang_lib_app__app.Element>— The Web Components thatenhanceadds to the page shell (Application.look), beside the grid.people:_gizlang_sdk_core.Option<M114.People>— Its people, when it has more than its one owner (Application.signIn).person:(arg0: M114.Served) => ((arg0: gizlang_http.Request) => gizlang_security.Principal) effects { fail, alloc }— Who asks in a request (Application.person).ownerOnlyFiles:bool— Protect /files/NAME by requiring the authenticated application's owner.mounts:Vec<(arg0: () => M118.Context, arg1: _gizlang_lib_app__app.Shell) => M114.Mount effects { fail, io }>— What answers beside the pages (Application.mount).keeping:_gizlang_sdk_core.Option<() => ((arg0: string, arg1: string, arg2: string, arg3: bytes) => string throws M141.Rejection) effects { fail, io }>— Where the files of a file input go (Application.keeps): none keeps them in the app's folder, at /files/.custom:() => Vec<M141.AnyAction<M118.Context>> effects { fail, alloc }— The app's own actions (Application.actions), beside the five of each table.threads:i64— The threads that serve it (Application.threads): 0 is one for each core (App.serving).ready:() => void— What runs once its port listens (Application.listening).socket:_gizlang_sdk_core.Option<string>— The Unix socket it serves on instead of a port (Application.at).
Context
type Context = Table.ContextWhat a page, an action and a mount run with: the scoped records of the person of the request (me), the System.
Mount
type Mount = { answer: (request: Http.Request, owner: bool) => Option<Http.ReplyPlan>; upload: (request: Http.Request) => Option<Upload> effects {read, io, fail}; }What answers beside the pages of an app: bytes of any size, sent and taken as they flow (a Drive, an object
store), so no answer or upload is held whole. answer gives the plan of a request it takes (none: the pages answer
it); upload takes, from its head, a request whose body it reads as it comes (none: the request is read whole), and
answers it on its exchange. owner says whether the request may act as the app's owner: always for an app without
sign-in, else the owner's session. A request that carries its own credential (a signature, a token, a link) is
answered without it; any other request of a mount for someone else is left to the pages, whose sign-in refuses it.
answer:(arg0: gizlang_http.Request, arg1: bool) => _gizlang_sdk_core.Option<gizlang_http.ReplyPlan>upload:(arg0: gizlang_http.Request) => _gizlang_sdk_core.Option<(arg0: bool, arg1: mut gizlang_http.Exchange) => bool throws gizlang_http.HttpError> effects { fail, read, io }
Upload
type Upload = (owner: bool, exchange: mut Http.Exchange) => bool throws Http.HttpErrorAn upload that a mount took: it reads the body from exchange and answers there.
Mounting
type Mounting = (context: () => Table.Context, shell: App.Shell) => Mount effects {io, fail}Makes the mount of one serving thread from its own System and the program's tables, as the owner uses them, in the page SHELL of the generation that serves (Application.look). CONTEXT makes the owner's context of one request: a Gate scope is for one request, so a mount never keeps one.
Within
type Within<S> = { open: (c: Table.Context) => S throws Model.Rejection; close: (s: S) => void; list: Vec<Model.AnyAction<S>>; }The actions LIST on the context S, with what makes S for each call and what releases it after: OPEN builds S from the request's context, and a Rejection from it is the call's answer (401, 403).
Opaque: create and use it through this module's functions.
Actions
type Actions<C> = () => Vec<Model.AnyAction<C>> effects {fail, alloc}What makes the actions of an app on each serving thread.
Viewing
type Viewing = (context: Table.Context) => ((rest: string, request: Http.Request) => Views.Opened throws Model.Rejection) effects {io, fail}Makes the views of one serving thread from its own System and the program's tables, as the owner uses them.
Hosted
type Hosted = { answer: (request: Http.Request) => Http.ReplyPlan; uploads: Http.RequestHead; shell: App.Shell; }An app that another server hosts (Application.hosted): that server owns the listener, its threads, limits and TLS.
answer:(arg0: gizlang_http.Request) => gizlang_http.ReplyPlan— The plan of each request of the app's host, in the server's thread: its pages, mounts, actions, live polls and the files of its shell. A test reads it whole: Http.whole(app.hosted().answer).uploads:(arg0: gizlang_http.Request) => _gizlang_sdk_core.Option<(arg0: mut gizlang_http.Exchange) => bool throws gizlang_http.HttpError> effects { fail, read, io }— The requests that a mount reads as they come (Mount.upload), for the server's uploads.shell:_gizlang_lib_app__app.Shell— The page shell whose version the app's pages carry: the server serves it for the app's host only.
Hosting
type Hosting = { app: Application; rows: Rows; }The app as one thread of its host serves it: its rows (mount, person, actionsIn) may then hold that thread's
state, which the rows of a threaded app may not. Set the rest before.
app:M114.Applicationrows:M114.Rows
Functions
standalone
function standalone(): HostA host with no database: a page that declares a table shows an empty one.
Effects: fail, write, alloc.
hosted
function hosted(db: Data.Db, space: string, shapes: Vec<Model.Shape>, actor: Asking): HostA host over the database DB of the Space SPACE: ACTOR names the person of a request, and the Gate judges every read and write of a page. SHAPES are the tables of the pages (the ones the Space is provisioned with): the long poll of a page tells a person of the changes of rows that the person may read, and of no other.
Effects: fail, write, alloc.
view
function view(pattern: string, render: Render, style: string, place: string = "", revision: string = ""): RouteA page at PATTERN that RENDER draws, with its STYLE.
Effects: fail, alloc.
markdown
function markdown(pattern: string, text: string, place: string = ""): RouteA page at PATTERN made from the Markdown TEXT.
Effects: fail, alloc.
file
function file(pattern: string, text: string, place: string = ""): RouteA file at PATTERN that is served as TEXT.
Effects: fail, alloc.
endpoint
function endpoint(pattern: string, run: Answer, place: string = "", methods: Vec<string> = []): RouteThe handler RUN at PATTERN for every method (an API, a webhook: a .giz file of the folder that exports handle). It reads
the tables as the person who asks, and a request that writes is one transaction, as a page's action.
Effects: fail, alloc.
layout
function layout(prefix: string, render: Render, style: string, revision: string = ""): LayoutA layout that RENDER draws around each page under PREFIX, with its STYLE.
guard
function guard(prefix: string, before: (props: Props) => Option<Http.Response>): GuardA guard that BEFORE is for each route under PREFIX (see Guard).
handlerMethods
function handlerMethods(): Vec<string>The page handler methods shared by standalone and platform routes.
Effects: fail, alloc.
site
function site(routes: Vec<Route>, layouts: Vec<Layout>, missing: Vec<Route>, guards: Vec<Guard> = []): SiteThe site of ROUTES. MISSING holds the not-found page, if the folder has one; GUARDS run before the routes they cover. A failing declaration (two files for one address) stops the program at start.
Effects: fail, alloc.
speaking
function speaking(site: Site, source: string, tags: Vec<string>): SiteSITE in its source language SOURCE and the languages TAGS of its catalogs (locales/ko.json beside its pages; the .routes module
passes them), each at its own address (/ko/…).
Effects: fail, alloc.
byCookie
function byCookie(site: Site): SiteSITE with its languages chosen by the person and the browser at every address, for an application behind a sign-in.
Effects: fail, alloc.
call
function call<I, O>(context: Table.Context, name: string, input: I): O throws Model.RejectionRuns the action NAME of the app that hosts the page with INPUT as the person of CONTEXT, and gives its answer: a page calls an action by its contract (its name, input and answer types), and each app that hosts the page provides it, as itself or as a call to another (remote). A refusal is thrown as it is; an action the app does not have is a 404.
remote
function remote<I, O>(name: string, doc: string, at: () => Remote throws string): Model.AnyAction<Table.Context>The action NAME (DOC says what it does) of the app at REMOTE (POST BASE/_a/NAME), as an action of this app: an app that shows another's work forwards the calls of a page by the same contract (call), so the page runs in both. A refusal comes back as the other app said it; one it cannot reach is a 503.
handle
function handle(site: Site, shell: App.Shell, host: Host, request: Http.Request): Http.ResponseThe response for REQUEST: the page of its address, the not-found page for an address without one, and for SUBSCRIPTIONS the long poll of a
table that the page follows (t the table, p the position, u the address of the page): it answers the patches of the parts of the page that read
the table, after a change that the person may see.
Effects: fail, read, write, console, io, alloc.
shell
function shell(theme: string): App.ShellThe page shell of a site of pages: the design system and the kernel. THEME is the site's sheet of tokens (empty: the default theme):
Tokens.css([...uiTheme(), own overlays], false), or the sheet of Tailwind.stylesheet, whose @theme is the same tokens. The
components follow it in their components layer, so a utility class on an element beats the defaults of a component while the
component's own scoped <style> still beats the utility.
Effects: fail, read, write, console, io, alloc.
handler
function handler(site: Site, shell: App.Shell, host: Host): (request: Http.Request) => Http.ResponseThe handler of SITE in SHELL on HOST, for a host of its own (the tests, a benchmark). An app serves with
Local.app(site).listen(8080) (gizdb/app), which gives the shell, ETags, compression, security headers and automatic HTTPS.
Effects: fail, alloc.
imports
function imports(at: Host): Http.RequestHeadThe streamed requests of a handler on HOST, for its listener's uploads (App.listenOn): the imports of its views, whose
body is read as it comes (Views.importing).
Effects: fail, alloc.
positionOf
function positionOf(page: string): stringThe follow id in data-pos="…" of the first watch of PAGE.
Effects: fail, alloc.
poll
function poll(site: Site, shell: App.Shell, host: Host, headers: Vec<Http.Header>, table: string, id: string, address: string, state: string): stringThe answer of the long poll of the page ADDRESS (a path, no &) for TABLE after the follow ID, with the state STATE (the fields of #_g) that the page posts;
HEADERS are the headers of the person (its session). It waits for a change.
Effects: fail, read, write, console, io, alloc.
nextOf
function nextOf(told: string): stringThe follow id that an answer of the poll gives for the next one.
Effects: fail, alloc.
fileName
function fileName(f: File): stringThe last part of the name of file F: its name without folders.
Effects: fail, alloc.
fileBadge
function fileBadge(f: File): stringThe short kind of file F for its card: its extension ("PDF", "PNG"), else "Text" or "File".
Effects: fail, alloc.
fileKind
function fileKind(f: File): stringWhat file F holds, by its type (else its name): "image", "video", "audio", or "" another kind.
Effects: fail, alloc.
files
function files(text: string): Vec<File>The files that the state TEXT of a file input lists (<input type="file" value={files}>), oldest first.
Effects: fail, alloc.
frame
function frame(request: Http.Request): stringThe lazy part of its page that REQUEST asks for (the kernel's ?_frame=KEY when the part is shown), "" for the whole
page: a page renders a long part (a ModelPicker's list, lazy) in full only for it.
Effects: fail, alloc.
address
function address(request: Http.Request, names: Vec<string>, values: Vec<string>, initials: Vec<string>): stringThe address of the page for the state NAMES = VALUES: its path, and ?name=value for each state that is not its INITIAL.
Effects: fail, alloc.
field
function field(form: Http.Params, name: string): stringThe last value posted under NAME, or empty.
Effects: fail.
text
function text(form: Http.Params, name: string, initial: string): stringThe state NAME of a page: what the form posted, else INITIAL. The state is in the page (hidden fields and bound controls), not in the server.
Effects: fail, alloc.
integer
function integer(form: Http.Params, name: string, initial: i64): i64The integer state NAME of a page: what the form posted, else INITIAL (also when the posted text is not an integer).
Effects: fail, alloc.
number
function number(form: Http.Params, name: string, initial: f64): f64The number state NAME of a page: what the form posted, else INITIAL (also when the posted text is not a number).
Effects: fail, alloc.
flag
function flag(form: Http.Params, name: string, initial: bool): boolThe flag state NAME of a page: what the form posted, else INITIAL.
Effects: fail, alloc.
appOn
function appOn(site: () => Site effects {fail, alloc}, shapes: Vec<Model.Shape>, folder: string, store: Sql.Database, engine: Option<Data.Engine>, follows: Option<Relay.Relay> = undefined): ApplicationThe app of site (the site of a folder's .routes) in folder over STORE, with the tables of shapes made when they
are missing, and its files in FOLDER/files. ENGINE is STORE's GizDB engine when this process serves it (gizdb/app
app), and its pages then read it on each thread; on any other store they follow its changes through a Relay (FOLLOWS:
the host's own, one for each store), and listen serves on one thread. A .ts app (app/start.giz) gives its SQLite or PostgreSQL store and no engine.
const app = Local.app(site, [Model.shape<Turn>()]); app.each(Query.from<Turn>().filter((it) => it.done === false), (t: Turn) => { app.save({ ...t, answer: "…", done: true }); }); return app.listen(8080);
Effects: fail, read, write, console, io, alloc.
act
function act<I, O>(action: Model.Action<Table.Context, I, O>, context: Table.Context, posted: Http.Params, prefix: string, controls: (input: I) => Vec<bool>): stringA form's action (GHTML <form action={a}>, and <form create={table}> with adding): A runs as the person of CONTEXT
with the fields of POSTED that begin with PREFIX, through the handler of its tool. "" when it is done, else the reason,
which the form shows as a refused write. CONTROLS names each control of the form as a field of I, so the compiler checks
the names and kinds; it never runs.
adding
function adding<T>(table: Table.Table<T>): Model.Action<Table.Context, T, T>The add tool of TABLE (add_T) as a typed Action: a <form create={table}> calls it as an action form calls its Action.
Methods
Application.threads
function Application.threads(self: Application, count: i64): ApplicationThe app served on COUNT threads, not one for each core: an app of one person (GizDesk) makes each thread's handlers and state at its start for nothing. Each thread still serves many requests at once, as tasks.
Application.listening
function Application.listening(self: Application, run: App.Listening): ApplicationThe app with RUN, which runs once its port listens and before its first request: a program that opens a window on its own server waits for nothing.
Application.at
function Application.at(self: Application, path: string): ApplicationThe app served on the Unix socket PATH instead of a port: a program's own front end reaches it there (gizapp/host),
and no other program sees a port. Call it before listen.
Application.protectFiles
function Application.protectFiles(self: Application): ApplicationReject all file downloads except those requested by the authenticated owner. For collaborative files, use a dedicated resource-aware policy instead of sharing a raw URL.
Application.keeps
function Application.keeps(self: Application, keep: Keeper): ApplicationThe app whose file inputs give their files to what KEEP makes (a store of its own, such as a drive) instead of the app's folder:
it answers the address a page reads the file at. Call it before listen.
Application.signIn
function Application.signIn(self: Application, people: People): ApplicationThe app with many PEOPLE, each signed in by gizapp Auth (its tables in schema auth): /auth/sign-in, /auth/link and
/auth/sign-out (Auth.routes), and on each page the person of the session, whose reads and writes the Gate judges; a
visitor who is not signed in is the public. PEOPLE.owner owns the tables. Call it before listen.
Effects: fail, read, write, console, io, alloc.
Application.person
function Application.person(self: Application, person: Person): ApplicationThe app whose requests ask as PERSON gives (a host's own sessions); its pages, actions and mounts see that person. Its owner is the one of signIn, else ME.
Application.actions
function Application.actions(self: Application, made: Actions<Table.Context>): ApplicationThe app with its own actions (Model.action) beside the five of each table: each is listed at GET /_tools and runs at
POST /_a/NAME, and a page's form or data-a calls it by its id. MADE makes them on each serving thread, so it holds no
state of the caller's thread. Call it before listen.
Effects: fail, alloc.
Application.actionsIn
function Application.actionsIn<S>(self: Application, made: () => Within<S> effects {fail, alloc}): ApplicationThe app with its own actions on the app's own context S (Model.action<S, I, O>), which MADE makes on each serving thread with their OPEN and CLOSE (Within), after the ones it has. Agents, the JSON API and the pages call the actions alike.
Application.theme
function Application.theme(self: Application, theme: string): ApplicationThe app in the theme THEME, a sheet of tokens (Pages.shell): Tokens.css([...Web.uiTheme(), brand], false) or the sheet of
Tailwind.stylesheet. Call it before listen.
Application.admin
function Application.admin(self: Application, prefix: string): ApplicationThe app with the admin screens of its tables under PREFIX ("/admin"): a list, a record and a new record of each
(gizapp/admin), in the page shell of the app; their forms post to the tables' tools. They answer the owner only. Call
it before listen.
Effects: fail, io, alloc.
Application.account
function Application.account(self: Application, email: string, name: string, password: string): string throws stringThe id of the account EMAIL among the app's people (schema auth): signed in with PASSWORD, or made with NAME on the first
run, for People.owner. An account that exists with another password is refused, never overwritten.
Effects: fail, read, write, console, io, alloc.
Application.mount
function Application.mount(self: Application, mounting: Mounting): ApplicationThe app with mounting answering beside its pages (Mount). Call it before listen.
Effects: fail, alloc.
Application.view
function Application.view(self: Application, name: string, viewing: Viewing): ApplicationThe app with the views of viewing at /_view/NAME/REST, beside its tables at /_view/TABLE: one protocol and one element
(<giz-grid>, <giz-chart>) for every relation. They answer the owner only, since viewing opens them as the owner. NAME is
not a table's name. Call it before listen.
Effects: fail, alloc.
Application.context
function Application.context(self: Application): Table.ContextThe program's table context, under the same owner and Gate as add/save.
Effects: fail, read, write, console, io, alloc.
Application.listen
function Application.listen(self: Application, port: i64): i64Serves the pages on port (Web.listen: a thread for each CPU, one on a server's store, and HTTPS with HTTP/2 and
HTTP/3 when TLS_DOMAINS names the site), and the files of file at /files/NAME; the exit status.
Effects: fail, read, write, console, io, alloc.
Application.enhance
function Application.enhance(self: Application, tag: string, script: bytes, style: bytes): Application throws stringThe app with the Web Component TAG (App.enhancement): its ES module SCRIPT and its STYLE, which a page loads only when it
holds the tag. Call it before listen.
Effects: fail, alloc.
Application.built
function Application.built(self: Application, dist: string, names: Vec<string>): Application throws stringThe app with the elements NAMES that app/components builds into DIST (App.elements). Call it before listen.
Effects: fail, io, alloc.
Application.components
function Application.components(self: Application, names: Vec<string>): Application throws stringThe app with the components NAMES that app/components builds into app/components/dist (chart, desktop, terminal):
from the first built folder of the working folder's, the one beside the program (an app shipped with its components)
and the toolchain's checkout's (GIZLANG_ROOT).
Effects: fail, io, alloc.
Application.hosted
function Application.hosted(self: Application): HostedThe app hosted in another server's thread, its System there (Hosting.hosted).
Effects: fail, read, write, console, io, alloc.
Application.hosting
function Application.hosting(self: Application): HostingThe app with its rows set so far, as one thread of its host serves it (Hosting).
Effects: fail, alloc.
Hosting.mount
function Hosting.mount(self: Hosting, mounting: HostedMounting): HostingThe hosted app with mounting answering beside its pages (Application.mount).
Effects: fail, alloc.
Hosting.person
function Hosting.person(self: Hosting, person: HostedPerson): HostingThe hosted app whose requests ask as PERSON gives (Application.person).
Hosting.actionsIn
function Hosting.actionsIn<S>(self: Hosting, w: Within<S>): HostingThe hosted app with its own actions on the context S that W gives, after the ones it has (Application.actionsIn).
Hosting.hosted
function Hosting.hosted(self: Hosting): HostedThe app hosted in another server's thread with OWN, its System there. A known limit: giz live does not renew a
hosted app's pages; the server makes it again.
Effects: fail, read, write, console, io, alloc.
Application.from
function Application.from<T>(self: Application): Query.Query<T>Every row of the table of T, as a Query that the app's database runs: app.from<Task>().filter((t) => !t.done).rows()!.
Application.add
function Application.add<T>(self: Application, v: T): T throws Model.RejectionAdds the row V to the table of T, and gives it as added: an empty text key is made, and sorts by time. A row the database refuses (its Gate, a missing or doubled key) throws its Rejection, with the status and the reason.
Application.save
function Application.save<T>(self: Application, v: T): void throws Model.RejectionWrites the row V of the table of T: each page that shows it changes by itself. A refusal throws, as add.
Application.remove
function Application.remove<T>(self: Application, v: T): void throws Model.RejectionDeletes the row V of the table of T: each page that shows it drops it. A refusal throws, as add.
Application.each
function Application.each<T>(self: Application, find: Query.Query<T>, handle: (v: T) => void): voidCalls handle for each row of T that FIND selects, now and whenever one comes or changes, one at a time, from a task
of its own: a queue of work in a table. handle saves the row so that FIND no longer selects it (done = true), else
it is handled again.