Skip to content

Developing pgkiln ​

This chapter is for people who work on pgkiln itself. See also CONTRIBUTING.md.

Code map ​

db/
  migrations/NNN_*.sql     the meta schema, roles and SQL API; applied once each, in order
  seed/*.sql               the HR sample (not for production)
examples/                  example applications as SQL (the tutorial)
examples/plugins/          plug-in files (template components) to import
examples/gallery/          the App Gallery: gallery.json, starters/ and utilities/ (blueprints), samples/ (single-file sample apps)
scripts/migrate.ts         migration/seed runner (src/migrate.ts does the work)
website/                   the website pgkiln.vargar.eu (VitePress): landing page + this guide, synced from docs/ at build time;
                           cd website && npm install && npm run dev; scripts/deploy.sh publishes it (see website/deploy/)
scripts/screenshots.ts     the README's screenshots in docs/images/ (npm run screenshots, HR example)
scripts/oracle-e2e.sh      (sprint 192) Oracle Free + ora2pg (Docker) → PostgreSQL → import-apex --check and the import of f77536.sql;
                           scripts/apex-e2e-pages.ts opens every page as a user (.github/workflows/oracle-e2e.yml: manual, weekly;
                           sprint 209: first run green). Locally: ORA_CONTAINER, ORA_PORT and ALIAS keep parallel runs apart, --keep
                           leaves the Oracle container, the schema and the application
scripts/import-schema.ts   (sprint 251) writes src/import-schema.json from the catalog (after a migration that changes a check)
scripts/check-sample.ts    (sprint 166) one App Gallery sample: install, sign in as demo, render every page, report errors (--keep)
scripts/docker-start.ts    container entry point: checks secrets, migrates (locked), sets role and admin passwords, starts the server
                           (sprint 232) with SUPERUSER_DATABASE_URL: makes the owner without SUPERUSER first (src/owner-role.ts),
                           a superuser only while installing; --prepare stops before the server
scripts/docker-entrypoint.sh  the image's CMD: docker-start.ts --prepare, then the server without SUPERUSER_DATABASE_URL and
                           POSTGRES_PASSWORD in its environment
deploy/                    compose.yaml and .env.example for Docker (Dockerfile at the root; chapter 1); (sprint 213) its db service
                           is postgres:17 + pg_cron, built inline (dockerfile_inline, pull_policy: build)
docker/postgres/           (sprint 213) the development database's image (docker-compose.yml): postgres:17 + pg_cron + pgvector
scripts/check-compose-pgcron.sh  (sprint 213) CI's docker jobs (fresh install, upgrade): the bundled database has pg_cron created and it runs a job
bin/pgkiln.js              the `pgkiln` command line (runs src/cli/main.ts with tsx)
src/
  env.ts                   .env loader (imported first)
  migrate.ts               applies db/migrations and examples (scripts/migrate.ts, pgkiln migrate); (sprint 213) ensurePgCron creates
                           pg_cron when the server loads it for this database; logs each run that applies; (sprint 232) needsSuperuser: installing
                           (migrations before 175) needs a superuser, said before anything is applied; (sprint 239) byNumber: script
                           files in the order of their numbers (HR part 102 after 97)
  owner-role.ts            (sprint 232) pgkiln's owner without SUPERUSER, on a superuser connection: planOwner (the statements:
                           role, database, the old owner's objects one by one, default privileges, ADMIN OPTION on pgkiln's
                           roles and memberships granted again by the owner, pg_cron, statistics roles), applyOwner (one
                           transaction, ownerProblems refuses a lockout); used by the Docker start and pgkiln admin demote-owner
  instance.ts              instance settings (meta.setting over environment variables, cached 30 s) and the configuration overview
  instance-checks.ts       (sprint 133, SEC-6) lockout checks: instance key (unreadable secrets, backup confirmed per fingerprint in
                           meta.setting secret_key_backup), clock against the database and GitHub's Date header, passkeys of another
                           RP ID, break-glass administrators; rotateKey() re-encrypts every *_enc column in one transaction;
                           used by Instance settings, the Workspace home (cached count), server start-up and `pgkiln admin check`
                           (sprint 191, NX-S6) productionChecks(): the production readiness group (productionInstance: an https
                           PUBLIC_URL of a public host, or pgkiln admin check --production); every line ok or error
  oracle-sql.ts            (sprint 187) translateOracle: nvl, nvl2, decode, sysdate, systimestamp, dual, sequences, v(),
                           minus rewritten outside literals, q-quotes, quoted names and comments (codeMask); (sprint 217) median,
                           listagg, sysdate ± days, apex_lang.message, apex_app_setting.get_value
                           (sprint 209) plsqlAsSql: a PL/SQL process body that is SQL in disguise (DML statements, :ITEM := expr,
                           SELECT … INTO :ITEM, RETURNING … INTO :ITEM) as the SQL of a pgkiln sql process, else null
                           (sprint 211) plsqlStatements (top-level statements of a block); plsqlAsHtml: a dynamic content
                           region's `return expr;` or htp.p calls as the SELECT of a dynamic region, else null
  release-check.ts         (sprint 109) "pgkiln X is available": meta.setting 'release_check' over PGKILN_RELEASE_CHECK (off by default);
                           GitHub's releases/latest (PGKILN_RELEASE_URL in tests), 5 s timeout, 1 MB, cached a day per process,
                           never under node --test without PGKILN_RELEASE_URL; parseRelease keeps a semver and an https link only
                           or fails a file in public.pgkiln_install_log
  appfiles.ts              application export as one file per component (dir layout, static ids) and back
                           ((sprint 242) sourceOf(row): the file a row of filesToDoc's document came from, kept in a WeakMap)
  import-defaults.ts       (sprint 242, MG-16) keys a component file leaves out take the column's constant default from the
                           catalog (loadColumnDefaults; never ids, references or what export_app leaves out): fillDefaults on a
                           document (importDoc, adviseTarget; the filled keys per file), fillFiles on the files (diff, diff_app),
                           explainNotNull turns a NOT NULL violation of meta.import_app into one naming file, component and key;
                           a key present with null is never filled; MUST_GIVE: columns whose default is the open value for
                           access (rest_module roles/enabled, web_credential valid_for, app mfa/mfa_roles/local_login) are
                           not filled: absent or null refuses the import naming file and key, unless the component has none
                           of the rule's `since` keys (added with or after the column: an older pgkiln's export), which
                           gets the default as before
  import-errors.ts         (sprint 251, MG-28) import errors that name the file, component and key: loadImportSchema (the
                           catalog: cast-able column types, allowed-value checks, meta.condition_ok checks and its types,
                           unique keys), checkImportDoc (every problem of a document: types via castProblem, allowed values
                           with hints, conditionProblem = meta.condition_ok in JS, unique keys given twice per page/app),
                           explainImportError (22P02/22003/23505/23514 and explainNotNull's 23502 → the problems; a check
                           without values is evaluated on the document's rows; never err.detail), normalizeConditionKeys
                           (condition ↔ condition_expr, CONDITION_KEY; called by fillDefaults and fillFiles);
                           bundledImportSchema = import-schema.json, the snapshot `advise --offline` uses
  import-schema.json       (sprint 251) written by scripts/import-schema.ts; test/import-errors.test.ts fails when it differs
                           from the catalog
  apexparse.ts             (sprint 182) an APEX SQL export read as text, never run: a tokenizer ('' and q'[…]' quotes, unistr,
                           comments, SQL*Plus lines) and every wwv_* call as an ApexCall with its named arguments evaluated
                           (wwv_flow_imp.id → ApexId with every digit, wwv_flow_string.join, ||, nvl); joinSplitExport (install.sql order)
  apex-issues.ts           (sprint 187) apexIssues: a Team Development issue per component of an APEX import that needs
                           hand work (label APEX import, app and page); handWork(report)
  apeximport.ts            (sprint 182) apexToDoc: ApexCalls → a pgkiln/2 document (imported by meta.import_app like any export) and the
                           import report (mapped / mapped with notes / not mapped, needs porting); the validation, process, item,
                           region, condition and dynamic action type maps; apexSource (.sql or a .zip with limits), reportText
                           (sprint 187) Entry.oracle() returns the SQL rewritten by oracle-sql.ts and notes what was rewritten
                           (sprint 192) Entry.use()/scan(): the database objects each entry uses (ReportEntry.uses); unqualified
                           tables qualified with the schema (qualifyTables)
                           (sprint 209) build options (bo(): p_required_patch, a negative id is "!"), application items, processes,
                           computations and settings; report and grid column settings (worksheet, worksheet_column, the default
                           worksheet_rpt, report_columns, region_column, interactive_grid, ig_report_column; the column calls follow
                           their region); PL/SQL processes through plsqlProcess (oracle-sql.ts plsqlAsSql); APEX 26.2's login page
                           (Invoke API APEX_AUTHENTICATION.LOGIN) left out with its components
                           (sprint 211) saved interactive reports as ApexSavedReport (r<id>_* parameters; apexFilter, highlightColor,
                           savedReportUser), report columns' lists of values looked up in the query (lovDisplay), grid column
                           validations (gridValidation), breadcrumb entries → parent_page, chart axes (chartAxes), ACL roles
                           (aclRole, ACCESS_CONTROL_SCOPE), dynamic content regions (plsqlAsHtml)
                           (sprint 229) APEX's Global Page (page 0) is pgkiln's page 0, with its components (always normal)
  apex-saved-reports.ts    (sprint 211) apexSavedReports: an import's saved reports into meta.saved_report after meta.import_app,
                           in the import's transaction (region by page and static id; public ones owned by who imports)
  apex-check.ts            (sprint 192, NX-F5) sqlObjects (tables, sequences, pkg.proc calls of a SQL/PL/SQL text, statically),
                           soleTableColumn, qualifyTables; apexCheck: the report's uses looked up in pg_catalog (missing tables,
                           APEX views, columns, sequences, routines; a routine ora2pg converted as pkg.proc or pkg_proc is a hint),
                           notes on the entries; checkText for `pgkiln import-apex --check`; (sprint 217) APEX_VIEWS: the views
                           of db/migrations/182_apex_views.sql (schema apex), qualified by qualifyTables, not reported missing
  apex-region-props.ts     (sprint 230, AX-9..11) apexRegionProps: create_page_plug's Layout, Appearance, Accessibility,
                           Advanced, Header and Footer and Comments arguments → the region's migration-188 columns (with notes)
  blueprint.ts             blueprints (migration 063): checkBlueprint (names, types, references, pages, sample rows), tableOrder,
                           blueprintSql, buildBlueprint (tables, grants, rows, pages via meta.generate_page, menu), the AI draft schema
  blueprint-from-app.ts    (sprint 66) blueprintFromApp: an application's tables (catalog), pages and menu as a blueprint, notes; sample rows
  restcatalog.ts           (095) REST source catalogs ((sprint 219) yamlDocument: OpenAPI in YAML, core schema, ≤100 aliases):
                           checks, fromOpenApi (OpenAPI 3 / Swagger 2 → services: parameters with "key",
                           rows and columns from the response schema, write-back from collection and item paths, notes), catalog
                           files, load/insert/replace, sourceFromService
  workspace-export.ts      (sprint 67) a workspace's components as a file (pgkiln-workspace/1) and importWorkspace (one transaction);
                           (sprint 141) workspace_files, remote_servers (an existing server keeps its base URL), web_credentials (no secrets)
  team.ts                  (sprint 113) Team Development's data: workspaceDevelopers (members and administrators: assignees, @mentions),
                           issueHtml (markdownHtml + mentions), recordMentions, logIssue (history), teamSetup, teamCounts, pageIssues,
                           exportTeam / importTeam (the workspace export's "team" part)
  team-samples.ts          (sprint 113) the set-up wizard's samples per builder language (English; add a key for another)
  subscriptions.ts         application types and subscriptions (migration 056): offers, subscribe, refresh, publish, in sync
  workingcopy.ts           working copies (migration 055): create, three-way compare per component (base, main, copy),
                           merge into the main application or refresh the copy, both through cli/replace.ts
  cli/                     the command line: main.ts (commands, help, exit codes), apps.ts (connect, export,
                           read, import), files.ts (directories, zip), diff.ts, replace.ts (import --replace in place),
                           mcp.ts (`pgkiln mcp`: the MCP server for AI coding agents, chapter 20; sprint 194: each tool runs
                           with a ToolContext, LOCAL or the builder API's, and RemoteClient for --url), only.ts (sprint 116:
                           `import --replace --only pages/12`, the named files merged over the application's current export),
                           advise.ts (sprint 144: `pgkiln advise`, the Advisor on an export rolled back, text / JSON / SARIF
                           with each finding at its file), working-copy.ts (sprint 144: working copies and locks for the
                           command line and the MCP tools working_copy and lock_app)
  app.ts / server.ts       Fastify setup / entry point
  db.ts                    the owner and shared runtime pools, `runtime` (the current scope's: runtimeScope), appTx() (SET LOCAL ROLE + pgkiln.* settings, NOTICEs to the debug log), savepoints
  app-role.ts              (sprint 186, NX-S2) an application's own database role: setAppRole() (every application transaction:
                           a powerful role or none refused, none allowed only in development mode = a developer's page request with
                           the developer toolbar), roleProblem() for the forms, makeAppRole() / importRole() (app_<alias> for Settings →
                           Security and imports of a file without a role); meta.role_is_powerful and the meta.app trigger: migration 167
  workspace-db.ts          isolated workspaces (090): the isolated applications (cached 5 s), a pool per workspace login (passwords from
                           PGKILN_SECRET_KEY), runtimeForApp/runtimeForAlias, withAppDb, devDbForApp; app.ts scopes /a/:alias requests;
                           (sprint 185, 166) every workspace's developer login: devDbForWorkspace / devDbForApp never return the owner
                           (sprint 201, 175) a developer login's pool doesn't open while it can use a table in meta (meta.role_reaches_meta;
                           meta.workspace_sync_roles() takes such rights back first)
  browser-security.ts      (sprint 188, NX-S4) browser security per application (meta.app.browser_security): check() for the form,
                           settingsOf() what may be sent, headersFor() frame-ancestors and headers, browserSecurityOf() cached per alias
  security.ts              URL checksums, password policy, security headers (CSP nonce), throttling limits; (sprint 189) url_epoch per application
                           (rememberUrlEpoch from loadApp, checksumExpired for links made before Expire bookmarks)
  gallery-remote.ts        (sprint 181, migration 164) the App Gallery's remote catalogues: parseCatalogue (blueprints only, checked
                           and cut to size), refreshSource (guarded webRequest), remoteBlueprint (fetched on Install)
  ddl.ts                   Generate DDL and Schema Comparison: readSchema (catalog → one DDL per object, unqualified), ddlScript (order), compare, changeScript
  static-version.ts        the version of app.css, app.js, icons.svg and sw.js (?v= in their URLs, the service worker version): content hash, looked at again when a file changes
  session.ts               sessions (hashed tokens), activity log, login throttling; (sprint 200) saveState skips a readOnly session
                           (loadContext marks the service worker's prefetch so)
  reply-guard.ts           (sprint 200) an async handler that sent its reply and returns nothing waits for it (`return reply`),
                           instead of Fastify sending it again, empty, while an async onSend hook still runs
  sso.ts                   OpenID Connect: discovery, sign-in flow, ID token checks, account linking
  public-url.ts            (sprint 250, MG-25, migration 206) recordPublicUrl(): server.ts records PUBLIC_URL (else
                           http://127.0.0.1:<PORT>) in meta.instance_setting 'public_url' at start-up; meta.public_url() reads it for
                           meta.page_url(…, p_absolute => true) and meta.app_url() (never a request's Host header)
  saml.ts                  SAML 2.0 sign-in (node-saml): AuthnRequest, response checks, SP metadata
  ldap.ts                  LDAP directories: search + bind, groups, account linking (ldapts)
  devsso.ts                (sprint 129) developers through identity providers and directories: resolveDeveloper (subject, link, create,
                           administrators group), linkDeveloper, ssoRequired (a workspace's rule, break-glass), clearSsoOnly
  headerauth.ts            HTTP-header authentication: trusted proxies (PGKILN_AUTH_HEADER_PROXIES), header checks, accounts
  dbauth.ts                database-account authentication: role lists, a short connection as the role (DATABASE_URL target), membership/superuser checks
  customauth.ts            custom authentication: the app's function or PL/pgSQL body (a pg_temp function) and post-authentication code, as the app's role;
                           (sprint 241, MG-15, migration 197) meta.set_auth_user: the phase pgkiln.auth_phase is set around the post-authentication
                           code only, pgkiln.auth_user cleared before and read right after it (same transaction), authUserProblem() checks the
                           name again (= meta.auth_user_problem); "nobody" is never a session's user
                           (sprint 248, MG-21, migration 204) the hash query (custom_auth_hash_query): a pg_temp SQL function
                           (p_username) returns setof text, stable, in its own transaction; checked outside it by password-hashes.ts;
                           an unknown user or bad hash gets dummyCheck() with the app's last real hash shape (lastShape)
  password-hashes.ts       (sprint 248, MG-21) other systems' password hashes: parseHash (Django pbkdf2_sha256$/pbkdf2_sha1$, bcrypt
                           $2a$/$2b$/$2y$ normalised to $2a$, Django bcrypt$/bcrypt_sha256$; argon2 and $2x$ unsupported), verifyPasswordHash
                           (crypto.pbkdf2, bcrypt via a BcryptFn = pgcrypto crypt(), timingSafeEqual), dummyCheck; meta.make_password_hash in 204
  remember.ts              "Keep me signed in": rotating persistent sign-in tokens
  remember-username.ts     (sprint 231, AX-13, migration 189) "Remember username": the cookie pgkiln_user_<app id> of the app's path
                           (the typed name only, HttpOnly, SameSite=Lax), rememberedUsername() fills the sign-in form,
                           rememberUsernameChoice() after a successful sign-in (runtime/routes.ts POST /login)
  mfa.ts                   second factors: TOTP, recovery codes, a FactorStore per kind of user (developers, accounts);
                           the developers' policy, passkeys, trusted browsers (webauthn.ts: WebAuthn checks and the
                           session's one-time challenge)
  account-mfa.ts           (sprint 130) two-factor sign-in for application accounts: the application's rule (off, optional,
                           required, roles), secondStep, carriesSecondStep (remembered/shared sign-ins), resets;
                           (sprint 131) account passkeys, e-mail codes (emailCodeTarget, queueEmailCode), the session's
                           last second step (__MFA_AT, secondStepWithin) for step-up, accountMustUseMfa (API tokens);
                           (sprint 199) passkeyAlone, passkeysOffered, accountPasskeyByCredential (a passkey alone)
  workflow.ts              workflows: step checks, the runner with parallel branches (NOTIFY + polling), invoke_api steps
                           (the call between two transactions, with a lease), Advisor references, the diagram;
                           (sprint 114) send_mail and draft steps, switch cases on task outcomes, the diagram as a standalone SVG
  task-events.ts           (sprint 114) task events (complete, expire, fail: SQL, mail, start a workflow) and built-in task
                           notifications from e-mail templates: checks, the actions as the app role, the meta.task_hook outbox runner
  process-jobs.ts          background execution chains: the job queue (SKIP LOCKED, NOTIFY + polling), running a job as the app role
  queue-runner.ts          (sprint 177) startQueueRunner(): LISTEN + polling + wake for the next due row, shared by the web
                           request outbox and webhook events; backoffS() and the QUEUE_RETRY_S / QUEUE_RETRY_MAX_S settings
  webhooks.ts              (sprint 177, migration 161) inbound webhooks: webhookProblems(), signatureProblem() (HMAC-SHA256 and
                           Stripe, constant time), receive() (signature, event id, meta.webhook_event), webhookTick() (claim
                           with a lease, the handler's block as the app role, retries), startWebhookRunner(), the purge
  api.ts                   REST API tokens for PostgREST, API role checks
  builder-tokens.ts        (sprint 194, NX-F4, migration 171) personal builder tokens: createToken (pgkb_ + 256 random bits, sha256
                           only), tokensOf, revokeToken / revokeTokensOf, checkToken (Bearer header only; expiry, revocation,
                           workspace membership and the two-factor rule looked up at every request; tokenThrottled per address);
                           (sprint 204, migration 178) the sign-in a token was made after (auth_mfa / auth_sso / auth_via) and
                           signInProblem: refused when the developer must now use single sign-on or a second factor it lacked
  accounts.ts              account settings and the password policy (passwordProblem; breachedPasswordProblem, sprint 204); (sprint 223, migration 185)
                           appLoginControls(): a workspace's stricter failures, lifetime and minimum length for its applications
  breached-passwords.ts    (sprint 204, SEC-3) Have I Been Pwned range API: 5 hex characters of the SHA-1, Add-Padding, webRequest
                           with that host only, 3 s, fail open with a warning; setBreachTransport for tests (never the network)
  i18n.ts                  pgkiln's own texts (en, nl), translator, Accept-Language
  i18n/                    de, fr, es, it, pt, pl, sv, da, nb, fi, cs, tr, el, ru, uk, ja, zh, ko, ar, he: the built-in texts of
                           the other languages (English and Dutch are in i18n.ts)
  numformat.ts             number format masks (999G990D00): format, parse, language separators
  binds.ts                 :BIND scanner → escaped literals, splitStatements, SqlParams (query parameters) (unit tested)
  dataload.ts              CSV/XLSX/JSON/XML parsing, type inference, batched loading with row errors, data load definitions (mapping, transformations, format masks)
  sampledata.ts            Sample Data: describe() (catalog: identity, checks, enums, foreign keys), propose(), seeded generators, plan() (dependency order), insertRows() / generateAll(), SQL and CSV output
  sampledata-words.ts      built-in name, city, company and word lists of Sample Data
  unload.ts                Unload Data: unloadStatement() (one SELECT), openUnload() (cursor, batches, CSV/JSON/XLSX/XML encoders on Postgres text values)
  xml.ts                   safe XML reader (no DTDs or entities, limits) and xmlTable(): rows from a repeating element (unit tested);
                           (sprint 224) xmlToJson(): XML responses of REST data sources as JSON (@attributes, #text, repeats as arrays)
  sqlscript.ts             SQL scripts: splitScript() (statements, line numbers and offsets, psql commands), runScript() (stop/continue, transaction, savepoints)
  sqlworksheet.ts          (sprint 91) the worksheet's runs: pickStatements() (at the cursor, a selection, all), runStatements() (a log per
                           statement, psql command tags, notices, error line and column), explainStatement() (EXPLAIN / rolled-back ANALYZE;
                           a savepoint inside a worksheet transaction)
  worksheet-txn.ts         (sprint 107) the worksheet's transaction mode: an in-memory registry of pinned pg.Clients per (builder session,
                           worksheet tab), beginTxn() / endTxn() (caps per developer and server), accountRun() (statement count, DDL kept for
                           the Change Log until COMMIT), outsideTxnOnly(), sweepTxns() (idle timeout, ended sessions); onSessionEnd and
                           onClosePools roll back; WORKSHEET_TXN_IDLE_SECONDS / _MAX_PER_DEVELOPER / _MAX
  datamodel.ts             (sprint 98) Data Modeler diagrams: readModel() (catalog), boxSize(), fkPath() (crow's feet), autoLayout(), diagramSvg()
  changelog.ts             (sprint 106, migration 118) the change log: isSchemaDdl(), ddlTarget() (schema and object), changeName()
                           (add_bonus, create_index_x), recordChanges() (grouped per schema), Flyway / Liquibase / plain SQL writers;
                           (sprint 175, migration 157) rollbackFor() / rollbackOf() (the proposed rollback), --rollback lines,
                           flywayUndoFile() (U0001__name.sql); (sprint 221, migration 183) preconditionFor() / preconditionOf()
                           (a catalog count, expected 0, MARK_RAN), oneLine(), parseContext() / runsIn() (Liquibase contexts),
                           context:, labels:, --preconditions lines
  datasets.ts              (sprint 110, migration 120) Data Reporter datasets: checkDataset() (names, joins to earlier tables, columns
                           and filters on its tables, whitelisted operators; with a catalog: existing objects), datasetSql() (quoted
                           identifiers, literal values), readSchemaCatalog() (tables, views, columns, foreign keys), proposeJoin() /
                           proposeDataset(), storeDataset(), appDatasets() (the runtime's read), pgkiln-dataset/1 files
  reporting-app.ts         (sprint 110) reporting applications: createReportingApp() (createApp, SELECT-only grants on the datasets'
                           objects, type reporting, roles viewer/editor/administrator as schemes EDITOR and ADMIN, page 1 a Data
                           Reporter), reportingApps(), reportingAppCount() (meta.reporting_app_count, for the workspace home)
  tabledef.ts              (sprint 95) a table as a definition: readTable(), checkTable(), tableSql() (CREATE, or ALTER from the catalog's version)
  datasec.ts               (sprint 119, WS-13) data security per table: readSecurity() (policies, column privileges per role, the
                           masking view and its configuration in the view comment), checkSecurity(), securitySql() (GRANT / REVOKE,
                           the masking view owned by <schema>_masking); the page is builder/data-security.ts
  sqlformat.ts             (sprint 93) formatSql(): the worksheet's Format (clauses per line, keyword case; strings and comments kept)
  sqlplan.ts               (sprint 92) EXPLAIN (FORMAT JSON) as a tree: parsePlan() (self time, slowest step, misestimates), planText()
  quicksql.ts              Quick SQL: shorthand parser and PostgreSQL DDL generator (unit tested)
  xlsx.ts                  Excel writer for report downloads and Unload Data (typed cells, streamed through fflate's Zip)
  automations.ts           cron parser, next run in a time zone, scheduler (also meta.task_expire_tick, 094), running automations (the actions run
                           in PL/pgSQL: meta.automation_execute, shared with meta.run_automation; migration 044)
  html.ts                  auto-escaping html`` templates
  richtext.ts              rich text and Markdown items: allow-list HTML sanitiser (named references, simple tables), Markdown renderer
  qrcode.ts                QR code encoder (byte mode, versions 1–40) and SVG output for the qrcode item
  zxing.ts                 (sprint 239, MG-4) the zxing-wasm barcode decoder's two files (/static/vendor/zxing/reader.js and
                           zxing_reader.wasm, from the npm package) for scan buttons without BarcodeDetector; a scan item turns
                           on the page's 'wasm-unsafe-eval' (ctx.wasmEval → security.ts)
  css.ts                   PageCss: data-dependent styles as classes in the page's nonce'd <style> (CSP)
  page-positions.ts        (sprint 234, AX-12) PAGE_POSITIONS (APEX's Slot order), HEADER_POSITIONS, pageHasPosition() (which page
                           template has which; page 0 all), positionDropped(): shared by render.ts, designer.ts and the Advisor
  metadata.ts              types + loaders for apps and pages (components of excluded build options are left out here);
                           (sprint 229, AX-8) loadPage reads the Global Page (page 0) with the page and mergeGlobalPage adds
                           its regions, items, buttons, dynamic actions, computations, validations and processes (marked
                           global_page, by sequence; a page's own item or button of the same name wins; branches stay the page's)
  maptiles.ts              map tile server URL, attribution and CSP origin
  geocode.ts               the installation's geocoder for address items (GEOCODER_URL, Nominatim search API)
  mvt.ts                   Mapbox Vector Tile encoding for map layers served as tiles
  yamltext.ts              the text style of the directory export: a strict YAML subset, written and read
  webclient.ts             outgoing HTTP to web services: allow-list, address checks at connect time (SSRF), redirects, limits;
                           (sprint 118) a request's scope (OutboundScope): the workspace's network access list, checked on every hop
                           (checkUrl/scopeProblem), refusals reported to the scope
  network-acl.ts           (sprint 118, WS-9) workspace network access lists (meta.workspace.network_*): scopeForApp/scopeForWorkspace
                           (no cache), parseHostList, recordRefusal/purgeRefusals (meta.network_refusal, 7 days), mailHostAddress
                           (a workspace mail service's SMTP host: both lists, resolved once, the checked address connected to)
  remote-servers.ts        (sprint 141, AP-7) remote servers (meta.remote_server): serverProblems, serverUrl (PGKILN_SERVER_* env var
                           wins over base_url), joinUrl, resolveSource (a REST source on a server: full URL + the server's default
                           credential; used by loadSource/fetchSource/callOperation), catalog and AI service URLs (owner pool,
                           the application's own workspace only)
  json-sources.ts          (sprint 142, AP-8) JSON sources (meta.app.json_sources): jsonSourceProblems, proposeProfile (types and
                           arrays from sample documents), jsonSourceDdl (security_invoker views with the meta.json_source_write /
                           json_array_write triggers, the table's grants), documentViewDdl (duality-view analogue, meta.json_document_write),
                           withJsonColumns / parseJsonColumns (a report's json_columns), catalog helpers (primaryKey, tableGrants, childTables)
  datapump.ts              (sprint 103, DA-16) Schema Export / Import jobs (meta.dump_job): findTools (pg_dump/pg_restore ≥ the
                           server's major), startExport (pg_dump, argument array, PGPASSWORD), readToc/parseToc (pg_restore --list),
                           startImport (pg_restore -f - run in one transaction between schema renames; data-only in FK order),
                           cancel, delete, dumpTick (interrupted jobs, expired files; called by the scheduler)
  dumpscript.ts            (sprint 103) the import's script runner: ScriptLexer (psql-style split, COPY data, \restrict),
                           checkStatement (only the dump's schema; no roles, DO, COPY to/from files…), COPY FROM STDIN as a pg submittable
  dbroles.ts               (sprint 99, DA-13) Database Users' SQL: roleSql (CREATE/ALTER ROLE, memberships, search path, schema
                           and default privileges: only what differs from the catalog), dropSql, checkRole/checkPassword,
                           scramVerifier (SCRAM-SHA-256, SASLprep) and the password slot (maskSql for review and log, withVerifier to run)
  cron-schedule.ts         (sprint 101, DA-12) pg_cron schedules without a database: parseSchedule (cron fields, $, n seconds, macros),
                           nextRuns in a time zone, describeSchedule in words, the builder's presets and fields
  vector.ts                (sprint 136, AP-1) pgvector: pgvectorStatus(), vectorSchema() (operators and the type schema-qualified),
                           DISTANCES (cosine/l2/inner_product: operator, HNSW opclass, similarity), vectorColumnDims(); the embedding
                           queue (meta.embedding_queue, migration 136): embeddingTick() (groups, FOR UPDATE SKIP LOCKED, batches
                           within the provider's per-minute limit, written with devDbForApp(), retries with backoff), drainEmbeddings(),
                           kickEmbeddings(), startEmbeddingRunner() (server.ts; EMBEDDINGS=off, EMBEDDING_INTERVAL_S), vectorTriggers()
                           (meta.embedding_set / embedding_enqueue triggers and their arguments), backfill(), queueState()
  pgcron.ts                (sprint 101, DA-12) pg_cron for SQL Workshop → Scheduling: cronState (installed, loaded, cron.database_name,
                           access), jobs and runs, jobSql/activeSql/unscheduleSql/purgeSql (reviewed, then applySql), runNow
  secrets.ts               secrets at rest (web credentials): AES-256-GCM with PGKILN_SECRET_KEY (or a key given, for rotate-key);
                           keyFingerprint()
  websources.ts            web credentials (OAuth2 client credentials/password/refresh token grants, token cache, stored refresh
                           tokens; (sprint 222) authorization_code: authorizationUrl(), exchangeAuthorizationCode(), loadCredentialById()) and REST data sources: requests, JSON paths, typed rows, response cache, write-back operations
                           (callOperation); invoke(): the invoke API call shared by the invoke_api process and workflow step
  restsync.ts              REST data source synchronisation into a local table (merge/replace/append as the app role), run log,
                           syncTick() (scheduled and SQL-queued runs, called by the automations scheduler)
  webrequests.ts           web requests from SQL (meta.web_request, migration 052): runPending() after each sql page process
                           (same transaction), webRequestTick() for committed ones (automations scheduler), retention purge;
                           calls go through websources.ts call()/invoke() (allow-list, SSRF checks, credentials); (sprint 240)
                           runPending(…, budgetMs): Ajax callbacks and execute_sql dynamic actions (INTERACTIVE_BUDGET_MS, a request
                           with no time left becomes 'retry' for after the commit, DEFERRED_MESSAGE)
                           (sprint 177, migration 160) the outbox: outcome() (retry, gave_up), leases, ordering keys, the
                           idempotency header, callbackTick() (schema.function(id) as the app role), startWebRequestRunner()
                           (sprint 243, migration 200) binary bodies: body_blob / chunk_bytes sent with webupload.ts sendBinary();
                           a claimed request carries only body_blob_bytes, the bytes are read after the size check (blobOf)
  webupload.ts             (sprint 243, MG-17) binary request bodies: sendBinary() (POST/PUT/PATCH a Buffer through websources.ts
                           call(): allow-list, SSRF checks, credential URL prefix; maxUploadBytes() = PGKILN_REST_MAX_UPLOAD_BYTES;
                           chunkBytes: PUT in Content-Range ranges, 202 + nextExpectedRanges followed, as Graph upload sessions);
                           reuse it for any file sent to a web service
  objectstore.ts           object storage for file items (config.object_store): S3-compatible buckets signed with signV4 (a web
                           credential of type aws_sigv4); objectStoreOf/objectStoreProblem; putObject/getObject/deleteObject dispatch
                           on "provider" (s3, the default, or graph); used by runtime/files.ts (storeTempFile, dropObjects, downloads)
  objectstore-graph.ts     (sprint 244, MG-29) provider "graph": OneDrive / SharePoint through Microsoft Graph (drive or site +
                           folder, an oauth2 or bearer web credential); putGraph (simple PUT up to 4 MiB, else createUploadSession +
                           webupload.ts ranges without the credential), getGraph/deleteGraph (the item must lie in the folder:
                           inFolder), graphProblem, graphFileName; every request through websources.ts call()
  mail/                    e-mail (migration 081): providers.ts (one deliver() per provider: SMTP through nodemailer with a password
                           or XOAUTH2, Microsoft Graph sendMail, Amazon SES v2 raw MIME with signV4, Resend, Postmark, SendGrid,
                           Mailgun, log; MailError says whether a retry may help; client-credentials token cache; settingsProblems),
                           mail.ts (sendWith(): service enabled, allowed sender, secret decrypted; mailTick(): claim with SKIP LOCKED,
                           send, retry after 1/4/16/64 minutes, purge after 30 days; the NOTIFY pgkiln_mail listener);
                           (sprint 118) the service of meta.mail_service_for_app (the app's, else its workspace's own), each attempt's
                           provider and duration, serviceSettings()/verifyService(): a workspace service's checks (no base or token URL,
                           its SMTP host through network-acl.ts mailHostAddress); (sprint 236, 191) meta.mail_service_for_mail: the
                           service chosen when the mail was queued (mail_queue.service_id) while still the app's, else the one for its From
                           address (meta.mail_service_for_app(app, from)), else the default
                           redirect.ts (sprint 250, MG-24, migration 206): redirectFor(app) = MAIL_REDIRECT_TO (envRedirect, wins)
                           else meta.app.mail_redirect_to; redirectMail(): only to that address, [TEST] subject, X-Original-To/-Cc/-Bcc
                           (providers.ts xHeaders: X- headers only, one line) and a note at the top of the body; applied in sendWith()
                           (the worker records mail_queue.redirected_to) and the builder's test mail (builder/mail.ts runCheck)
  ai/                      AI services (migration 060): types.ts (the provider interface, AiError kinds),
                           anthropic.ts (Claude through @anthropic-ai/sdk: streamed, effort, structured outputs via
                           output_config.format, refusal fallbacks, stop_reason checks, typed SDK errors), openai.ts (the openai
                           SDK: Chat Completions, strict json_schema), service.ts (generate(): service allowed for the app, daily
                           limits, the call, meta.ai_usage), requests.ts (meta.ai_generate from SQL: runPendingAi() after an sql
                           process, aiRequestTick() in the scheduler, 24-hour purge), chat.ts (conversations with tools, migration
                           061: chat() runs the tool loop on a provider-format history (Claude: streamed, strict tools, tool_choice
                           auto, content appended unchanged; OpenAI: strict function tools), limits and usage per provider call;
                           (121) an agent's effort (Claude output_config.effort, OpenAI reasoning_effort) and output limit).
                           Providers (121): anthropic, openai, gemini (OpenAI-compatible endpoint, GEMINI_BASE_URL), openai_compatible
                           (Ollama, vLLM, Azure OpenAI; base URL required, key optional): service.ts serviceKey(), baseUrlFor(), providerLabel()
                           (sprint 136, AP-1) embeddings.ts: vector providers (meta.app.vector_providers: ai_service with an embedding
                           model, or a function), vectorProviderProblems(), embedTexts() (the openai SDK's embeddings API, float
                           encoding, dimensions checked, daily limits via checkDailyLimit(), meta.ai_usage source "embedding"; a
                           function provider through meta.embed on the caller's connection), embedQuery() (search texts remembered
                           10 minutes per process), vectorLiteral()
  debug.ts                 debug messages: DebugLog (levels, timed steps, NOTICEs of meta.debug from appTx), started in
                           loadContext, stored after the response (onResponse hook → meta.debug_save), hourly purge;
                           (sprint 218) debugNotices (a transaction's meta.debug NOTICEs), backgroundDebug / saveBackgroundDebug
                           for automations.ts (AUTOMATION) and process-jobs.ts (JOB); runtime/rest.ts starts a request's log
  icons.ts                 icon helper (sprite in public/icons.svg)
  telemetry/               (sprint 139, AP-6) OpenTelemetry without the SDK: trace.ts (the current trace in AsyncLocalStorage,
                           startTrace/endTrace, withSpan/rootSpan/recordSpan, traceApp, traceparent, a span per statement by
                           patching pg.Client#query, sanitizeSql/redactText, counters and histograms), config.ts (the instance's
                           settings: meta.setting otel_* over OTEL_* variables; workspaces' telemetry columns; app → workspace,
                           cached 30 s), export.ts (a queue per collector, OTLP/HTTP JSON for traces, logs and metrics, values
                           only where included, gauges from the queues, prometheusText(), sendTest()), http.ts (a trace per
                           request, request metrics, GET /metrics, POST /a/:alias/telemetry), browser.ts (the page's signed
                           <meta name="pgkiln-trace"> in layout.ts and relay() of what app.js reports). Spans come from
                           webclient.ts (outgoing calls, traceparent), ai/service.ts logUsage, runtime/ai-agents.ts logToolCall,
                           mail/mail.ts sendOne, workflow.ts runWorkflow; logs from session.ts logActivity
  page-alias.ts            (sprint 193, NX-F3) page aliases: RESERVED_PAGE_ALIASES (the runtime's own segments of /a/<app>/…, the
                           same list as migration 170's meta.page_alias_reserved; test/page-alias.test.ts scans the routes),
                           pageAliasProblem(), aliasFromName() (= meta.page_alias_slug), pageOfSegment() (loadContext: a number
                           or the alias of one of the app's pages)
  history.ts               (sprint 138, AP-5) change history and checksums: meta.app_snapshot (the export after the last recorded
                           change), recordHistory() (export again, workingcopy.ts components() of both, each added/changed/deleted
                           component with its files before and after into meta.component_change; called by app-updates.ts onSend,
                           the upgrade page and cli/replace.ts replaceApp), ensureSnapshot() (before a first change), diffDocs(),
                           appChecksum() / pageChecksums() (SHA-256 of the text layout without the alias), CHANGE_HISTORY_DAYS;
                           (sprint 193) notePageChanges(): meta.page_change (who changed a page last) for the pages a change touched,
                           and (builder/app-updates.ts) every page of a new application (Create, Import)
  runtime/
    routes.ts              HTTP handlers: show, submit, dynamic actions, cascading lists, login; (sprint 240, MG-7) a dialog submit
                           stays in the dialog (button / branch stay_in_dialog, migration 196; not after a close_dialog process);
                           execute_sql dynamic actions make their queued web requests (makeWebRequests)
    signin.ts              the sign-in form (built-in page and the login region of an application's own login page), safeNext, passwordResetAvailable
    passkey-signin.ts      (sprint 199, NX-U6) signing in with a passkey alone (meta.app.passkey_signin): the button above
                           the password fields (passkeyBlock), /login/passkey/options and /login/passkey (user-verified,
                           discoverable; the account's rules as for a password; method passkey+2fa), the sign-in card's
                           mark and theme colours (appMark, signInStyle)
    password-reset.ts      Forgot password: request (same answer either way), the link (token into the session), the new password
    two-step.ts            (sprint 130) the second step of signing in (/login/2fa: a code, or the first app and its recovery
                           codes), passwordSignIn, and My account → Two-factor sign-in; (sprint 131) passkeys at the
                           second step and as the first factor, e-mail codes, step-up (?next=, a signed-in user), My
                           account → REST API token (tokenSection)
    context.ts             PageContext, dbg()/timed() debug helpers, bind values, substitutions, public error messages, writeOut (streamed responses with back pressure)
    authz.ts               authorization schemes, conditions, visibility (menu requests count as buttons); (sprint 131)
                           step-up (mfa_minutes; StepUp sends the page's user to /login/2fa?next=)
                           (sprint 229) applyGlobalGate (in checkPageAccess and computeVisibility, once): page 0's Authorization
                           and Page requires sign-in, else dropGlobal takes its components out (loadContext already for a user
                           who isn't signed in, before URL items); routes.ts never shows page 0 itself (pageNo > 0)
    engine.ts              form fetch, validations, processes (conditions, execution chains, queueing background chains; web requests queued by an sql process are made right after it; sprint 209: each load process in a savepoint), application processes
    processes.ts           download (file or zip from a query, safe headers), workflow processes, configuration checks of chains
    logic.ts               computations (the page's and (102) the application's), branches (page, URL, function returning a URL, another application) and their conditions
                           (conditionHolds: the server-side condition types; sprint 235 item_contains / item_contains_any split a multi-value item on colons);
                           (sprint 240, MG-7) branchTaken (the branch and its href), staysInDialog, inDialog (dialog=1 on a URL);
                           (sprint 249) target type item (navigation.ts itemTarget), inPageBelow (MG-23: branch in_page_below,
                           migration 205: routes.ts hands the target to render.ts dialogClosePage data-dialog-goto, app.js
                           sends the page below there)
    navigation.ts          (sprint 249, MG-22) notePageView (routes.ts show page: the session's __LAST_PAGE/__LAST_URL and
                           __PREV_PAGE/__PREV_URL; context.ts previousPage → the built-ins APP_PREVIOUS_PAGE / APP_PREVIOUS_URL
                           in bindValues, reserved in binds.ts), itemTarget (an item branch's page, checked with pageAllowed,
                           else this page; the previous page's URL when the branch sets no items)
    shortcuts.ts           (103) "NAME" shortcuts in static content, help texts and confirm messages
    static-files.ts        (068) static application files (/a/<alias>/static/<name>), the <script>/<link> tags of a page; (141) static
                           workspace files (/a/<alias>/workspace-files/<name>, the application's own workspace's only, owner pool);
                           #APP_FILES# / #WORKSPACE_FILES# are substituted in context.ts substitute and template-components.ts
    render.ts              page chrome (nav, breadcrumb), dynamic action JSON, theme (the page's nonce'd <style>, light/dark and style switches);
                           (sprint 234, AX-12) renderPage places regions by display position: full_width after the breadcrumb bar,
                           dialogs after the footer (both in the page's form); the header's (HEADER_POSITIONS) go to chrome()'s
                           slots: .t-hpos after the logo, before the navigation bar, after the user menu, and .t-topnav under the
                           header (outside the form); a minimal page or a dialog leaves them out (app.css: one line, no frame);
                           (sprint 241, MG-13) page template no_navigation: chrome() without header and menu (PWA, push, live badges kept),
                           renderPage without the title bar (an sr-only <h1>)
    page-regions.ts        (sprint 140) breadcrumb and help_text regions: breadcrumbLinks (also the title bar's trail, left out when the
                           page has a breadcrumb region), the page's help text (meta.page.help) as Markdown with escaped &ITEM. values
    styles.ts              base styles (BASE_STYLES: Iris, Lavender, Standard; baseStyleOf → html data-style), Theme Roller style variants: fixed lists (fonts, sizes, corners), parseStyle/appStyles checks, the request's
                           style (user choice, default), themeCss() (only hex values and constants reach the CSS); (sprint 117) NAV_APPEARANCES
                           (Pillar Light / Dark), navAppearance() → the <body> classes nav-pillar-*, the header strip (--strip)
    template-options.ts    template options: the fixed CSS class list per region and button, templateClasses() (unknown values ignored)
    regions.ts             region shell + chart (drill-down links, gauge settings)/cards/dynamic dispatch with row limits, lazy placeholder and cache, buttons (menu buttons, badges; (124) menu entries {action} → data-menu-entry for menu_entry dynamic actions)
                           (sprint 195, migration 172) sub regions: childrenOf, renderChildren (tabs_container: tab links + panels that app.js
                           makes ARIA tabs; flex_container; a 12-column grid), after the region's own (cached) body; render.ts skips sub
                           regions at page level, authz.ts computeVisibility drops a sub region whose parent isn't shown
    item-texts.ts          (sprint 241, MG-10/11) itemLabel (&ITEM. substitutions in labels, also in the messages engine.ts gives),
                           itemPlaceholder (meta.item.placeholder, migration 197, or the older {"placeholder"} setting), PLACEHOLDER_TYPES,
                           NULL_CHOICE_TYPES (a select list's empty choice); items.ts renderItem uses them; (sprint 249, MG-27)
                           buttonLabel (&ITEM. in button and menu entry labels: regions.ts renderButton, renderMenu)
    report.ts, report-views.ts (group by, pivot, chart), compute.ts (computed column expressions), grid.ts (aggregates, row actions, Actions menu, single row view, layoutFromForm; sprint 240: the region's items in its toolbar, Save stays in a dialog), grid-layout.ts (column layouts: clean, arrange, per user), master-detail.ts (signed master row selection, details), facets.ts (facetChart: a facet's counts as a chart, sprint 65), items.ts
                           (report.ts: paging with row ranges and max_rows, keyset paging (keysetPlan, seekCondition, signed r<id>_k), pagerNav, streamed CSV/Excel downloads with a cursor;
                           (140) classic_report through renderReport: reportState drops the interactive settings, classicTemplate (value_pairs, badges, media_list),
                           pagination total/range/none;
                           items.ts: lovOptions, searchLov/lovLookup for popup LOVs, served by POST /a/:alias/:page/lov/:item/search in routes.ts;
                           LOV_TYPES / LOV_CHECKED / MULTI_VALUE: the list item types (shuttle, select_one, select_many since 140) checked on submit and colon-separated)
    region-cache.ts        region caching (keys per scope, CSRF placeholder, invalidation on submit) and lazy regions (GET …/region/:id is in routes.ts)
    region-props.ts        (sprint 230, migration 188, AX-9..11) a region's other property groups at runtime: gridClasses
                           (col-N, col-start-N), arrangeRows (Row CSS Classes: <div class="t-row">), shellExtras (CSS classes,
                           Custom/Column Attributes through an allowlist, values escaped), landmarkAttrs, regionIcon, frameContent
                           (Header/Footer Text, HTML DOM ID), readOnlyRegions (computeVisibility), customizedRegions,
                           customizePanel and POST /a/:alias/:page/customize (user preference PGKILN_REGIONS_P<page>)
    gantt-move.ts          (sprint 69) Gantt drag and drop: ganttEditable, targetTime, moveGanttTask (the task in the region's
                           query, gantt_move with :TASK_ID/:NEW_START/:NEW_END); the dragging itself is in app.js
    charts.ts              server-rendered charts (SVG and CSS classes): bar … radar, gauges, Gantt (time axis, dependencies), pyramid, polar, range, box plot (quantile, boxes), stock, (sprint 70) treemap and sunburst (buildTree, squarify), timeline, (sprint 220) sankey (sankeyLayout), nbox (nboxCells), picto (pictoUnit), drill-down marks, data table
    calendar.ts            calendar region: month/week/day/list views, create links, drag and drop (moveEvent, moveCalendarEvent;
                           the route POST …/calendar/:id/move is in routes.ts)
    links.ts               page links with checksums; fillItems() fills #column# in link items
    link-columns.ts        (sprint 238, MG-6) a report's link_columns (linkColumnsOf: label, page, items, style, icon, heading,
                           position, when) and row_actions (reportRowActionsOf: edit, links); reportLinks(): the cells before and
                           after the report's columns for the user (pages they may open only), and the links under a classic
                           template's rows; used by report.ts (interactive and classic reports)
    open-region.ts         (sprint 238, MG-14, migration 194) inline dialog regions by static id: overlayHash (a button's
                           target_region, a list entry's #static-id), openByStaticId (the one-time session value __OPEN_REGION
                           a process's or branch's open_region left: engine.ts runOne, logic.ts branchTarget, routes.ts),
                           openAfterError (a failed submit: the dialog of the pressed button or of an item or grid in error);
                           regions.ts renders those with open data-open-region, app.js shows them as modal dialogs
    facet-state.ts         facet definitions (checkbox, range, star; exclude, custom range), filters read from the URL, their SQL as query parameters
    smart-filters.ts       smart_filters region: search field, filter chips, suggestions
    display-selector.ts    display_selector region: tabs / select list over the page's regions (app.js makes them ARIA tabs)
    account.ts             My account (details, own password, preferences), the light/dark and style switches (POST …/account/theme, …/account/style)
    locale.ts              language, theme, text messages, translations, number symbols and time zone of a request
    format.ts              date masks; maskedFormatter() applies a column's or item's number or date mask
    files.ts               file items: multipart parsing, temporary files, signed downloads; (sprint 239) signature items (the
                           signature preset of a file item, metadata.ts presetItem; migration 195): pngSize, a real PNG of at most
                           1 MB and 4096 px, stored as <item>.png; items.ts signaturePad renders the pad (app.js signaturePads);
                           (sprint 247, MG-20) childFilter: a multiple item's "filter" (constant columns of a shared child table,
                           written on insert and added to every read, delete and download; &NAME. only of built-ins and protected
                           hidden items), isGallery ("display": "gallery", rendered by items.ts fileListControl); (sprint 252) parentItem: outside a
                           form region, "parent_item" (a protected hidden item) holds the record's key; saveParentItemFiles
                           runs after the submit processes (routes.ts)
    document.ts            document templates: tag language, HTML subset, PDF layout (pdfkit); (sprint 245) images and <br> inside
                           table cells and paragraphs (partsOf/drawParts), shadowedBuiltIns (query columns named like a built-in)
    documents.ts           ?doc=NAME: a template filled with the page's values
    document-pdf.ts        meta.document_pdf references drawn after each process into mail attachments; send_email document attachments (sprint 237);
                           meta.document_temp_file's temporary files drawn the same way (meta.document_pending, migration 202; sprint 245)
    maps.ts                map region (data for Leaflet: layers with a query each, markers, clusters or heat, PostGIS geometry as GeoJSON, report filter by area or distance; list fallback, head assets)
    spatial.ts             spatial filtering on the server: map area and distance parsing, PostGIS detection and SQL (ST_Intersects, ST_DWithin), lat/lng fallback (bounding box, haversine)
    pwa.ts                 Progressive Web App: manifest, service worker route, icons (PNG encoder), offline page
    rest.ts                REST modules: handler and template checks, matching, bearer tokens, module privilege, the constrained-role
                           check, execution (collections stream from a cursor), OpenAPI (templates, documented parameters, roles)
                           (sprint 175) etagOf() / noneMatch(): an ETag on a GET's answer, 304 for If-None-Match (after the handler ran)
                           (sprint 175) header parameters: headerName(), bound from the request header only, credential headers refused
                           (sprint 243) "body": "blob": BLOB_TYPE parser (MAX_UPLOAD_MB), :BODY_BLOB (bytea text) and :CONTENT_TYPE
    rest-handlers.ts       (sprint 104, migration 117) PL/pgSQL handlers (binds as settings, DO block, meta.rest_reply) and media
                           handlers (content type and file name cleaned, sandboxed response)
                           (sprint 176, migration 159) replyHeaders(): the response headers meta.rest_header set, checked again
                           (sprint 177) rest.ts finds the handler in onRequest; a webhook's request is read as raw bytes
                           (WEBHOOK_TYPE) and handed to src/webhooks.ts receive()
    autorest.ts            (sprint 100, migration 113) AutoREST: /a/:alias/autorest/<object>/ for the tables and views SQL Workshop →
                           RESTful Services published (meta.rest_object): caller() of rest.ts, SET ROLE to the app role, owner/BYPASSRLS
                           check, columns from the catalog (column grants), filters/q/order/paging, POST/PUT/DELETE by primary key, OpenAPI
    rest-sources.ts        REST data sources in apps: regions and LOVs as SQL over "rest", the invoke_api process (items; the call is websources.ts invoke()),
                           write-back of forms (fetch, form_dml) and grids (grid_dml) through the source's operations
    tree.ts                tree region
    lists.ts               lists: static entries or a query, visibility (authorization, conditions, page access), safe URLs; list regions, navigation menu and bar
    template-components.ts template components: template language (allow-list, directives, escaping), plug-in files, report column templates
    builtin-components.ts  built-in template components (ut_avatar, ut_badge, ut_comments, ut_content_row, ut_media_list, ut_metric_card, ut_timeline)
    template-region.ts     template_component region
    tasks.ts               task list region and task actions (approvals); (094) the vacation rule panel and route;
                           (sprint 114) custom outcome buttons, the Fail event and recovery of a failing completion SQL
    data-reporter.ts       Data Reporter region (migration 057): sources from the region's config, checkDef (offered columns, whitelists),
                           reportQuery/chartQuery, the list and editor (GET form), save/delete routes (meta.save_data_report);
                           (sprint 110) dataset sources (resolveSources), edit_authz / admin_authz / publishing, pins (a preference),
                           publish / pin routes, the stable URL GET /a/:alias/reports/:id
    form-designer.ts       Form Designer region (migration 106): sources from the region's config, checkFormDef (offered columns, displays,
                           actions), forms as cards, a form's rows, a row's form (lost update hash), the designer; row/design/delete routes
    json-form.ts           (sprint 246, MG-19, migration 203) json_form region: parseSchema (a JSON schema's properties as fields:
                           kinds, x-order, enum/oneOf choices, limits), loadJsonForm (schema and answers: one row of the Source as the
                           app role), answersFromBody (only the schema's fields, jf<region>:<key>/<row>/<key>; empty and removed rows
                           dropped, readOnly kept), checkJsonForm (required, enum, types, ranges, lengths, formats, counts), applyJsonForms
                           (routes.ts submit: the answers as JSON into the region's item, errors in ctx.jsonFormErrors for validate()),
                           renderJsonForm (rows: <noscript> empty rows, a <template> app.js copies for Add a row)
    workflows.ts           workflow console region and its actions
    ai.ts                  Generate text with AI: the ai_generate process (config checks, &ITEM. as delimited escaped data,
                           schemas from items, answers into items), aiInputs/aiOutputs for its dynamic action (route in routes.ts)
    assistant.ts           AI assistant region (migration 061): config checks, tool schemas and argument checks, context queries
                           and SQL tools as the app role (rolled back unless "writes"), REST tools, meta.ai_conversation per
                           session, formatAnswer (escaped), send/clear routes; (121) "agent": an AI agent's service, prompt, tools,
                           steps and authorization; links of navigate tools under the answer, browser actions once (__AIACT<id>)
    ai-agents.ts           (121) AI agents and AI tools (meta.app.ai_agents / ai_tools): checks (agentProblems, aiToolProblems,
                           definitionProblems), agentFor(), prepareTools() (authorization schemes, navigate pages the user may
                           open, strict schemas), runAgentTool() (sql: read-only transaction as the app role with a time limit;
                           function: named arguments, committed; rest; javascript: queued for the browser; navigate: URL and
                           checksum built here), logToolCall() (meta.ai_tool_call, debug level 4, 30-day purge); (136) retrieve:
                           retrieveTool() (QUERY only, search.ts retrieve() in a read-only transaction as the app role)
    ai-filter.ts           "Ask in your own words" on a report ("ai_filter", sprint 112: AI interactive reports): the box, the chips
                           form (Edit/Remove/Undo, undo history in the session), ask and chips routes; an AI service's structured
                           output (planSchema) or the phrase parser, then ir-plan.ts
    ir-plan.ts             what a question may set: checkPlan (shown columns, whitelists, computeSql), applyPlan (→ the report's
                           URL parameters), chipsOf/editChip/removeChip (a chip = one URL parameter value, edits checked again)
    ir-phrases.ts          the rule-based parser without an AI service: phrase tables per language (en, nl, de), clauses →
                           a RawPlan; values looked up among the report's rows through a Lookup (query parameter)
    pdf.ts                 report PDFs with report layouts (pdfkit); rows from a cursor in batches (tablePdf takes batches)
    search.ts              search region and search configurations (migration 080): words as ILIKE parameters, table/sql/list
                           sources as the app role in savepoints, marked results, configColumns/searchConfigProblems for the Advisor
                           (sprint 135, migration 135) search type fulltext: tsvectorSql (column, expression or built from the
                           searchable columns), websearch_to_tsquery / ts_rank_cd / ts_headline between private-use markers
                           (headlined() escapes, only the markers become <mark>), textSearchConfig() (pg_ts_config names only,
                           passed as $1::regconfig; tsConfigFor(language)), trigramSchema() and "did you mean" with pg_trgm
                           (sprint 136, migration 136) search types vector (vectorRows: the text embedded by the provider, nearest
                           rows by the schema-qualified distance operator, the vector as $1, min_similarity) and hybrid (full-text
                           and vector rankings, 50 rows each, reciprocal rank fusion 1/(60+rank) per key_column); retrieve() for
                           an agent's Retrieve tool
    url-region.ts          URL region (migration 078): literal origins only (urlTarget), &ITEM. URL-encoded, sandbox and height,
                           frameOrigins() for the CSP's frame-src (security.ts)
    ajax.ts                Ajax callbacks (migration 085: POST …/ajax/:name, point "ajax" processes, x01 … x10 binds) and the
                           download dynamic action (POST …/da/:id/download); (sprint 240, MG-8) a chain of SQL processes as a callback
                           (chainChildren, shouldRun; a chain's step is not callable by name), engine.ts makeWebRequests after each step
    availability.ts        availabilityRefusal(): who may use an application (migration 083); loadContext, the login page
                           and REST modules ask it (PostgREST: meta.api_check)
    feedback.ts            users' feedback page and the navigation bar entry (migration 084)
    notifications.ts       (sprint 165, migration 154) the notification bell (bellMarkup: unread count, newest 8, Mark all read),
                           /a/:alias/notifications, POST …/notifications/:id/open (the user's own only, marks read, its signed
                           link under the current alias) and …/notifications/read; GET …/:page/live (liveState: list entry
                           badges n:/b:<key>, buttons btn:<id>, the bell) with loadContext touch: false (no last_seen, no new session)
    img-origins.ts         (sprint 235) allowImage / allowImageAttribute: the https origins of rendered pictures (image items,
                           template components' <img src>, also in report column templates and cached regions) into ctx.imgSrc,
                           which security.ts adds to the CSP's img-src (normalised origins only, at most 50)
    data-items.ts          display image and address items (migration 086): imageUrl (https origins into the CSP's img-src),
                           GET …/image/:item (a BLOB from the item's query), POST …/geocode/:item, and items kept per user
                           (loadPreferences / savePreferences through meta.get_preference / set_preference)
    data-export.ts         the download process's {"export": …}: meta.data_export for csv/json/xml/html, Excel and PDF here
    devbar.ts              developer toolbar and session state viewer (migration 079): the pgkiln_devbar token of a builder
                           session (ensureDevbar/devbarOf), the toolbar markup, the viewer, clear and per-session debug routes
  builder/
    components.ts          property spec of every component (drives the property editor)
    ui.ts                  IDE shell (icon rail, toolbar, breadcrumb, status bar), builder theme, form helpers, CSRF check, app tabs
    api-v1.ts              (sprint 194) /builder/api/v1 for `pgkiln mcp --url`: the MCP tools with serverContext (the token's
                           workspace; the owner pool for pgkiln's tables of its applications, the workspace's developer login for
                           the database's objects), toolScope (read / write / sql), export, import (lock rules: changedPages,
                           lockedFor) and advise; every call in the activity log (builder_api / forbidden, "token #<id> <name>:
                           <call>: <outcome> (<status>)", sprint 204)
    tokens.ts              (sprint 194) Security → Builder tokens (make, shown once, list, revoke), tokenStepUp (a sign-in within
                           10 minutes with single sign-on / the second factor, else password and code), Developers → all tokens;
                           (sprint 204) the sign-in kept with the token, Not usable in the lists, Calls (/builder/security/tokens/calls)
    i18n.ts                (sprint 121) the builder's own texts: BUILDER_LANGUAGES, tr(s) / translatorFor(lang) → tx(key, params),
                           tx.rich (markup in a sentence), tx.dyn (keys made at run time), tx.label (known breadcrumb labels),
                           (sprint 162) tx.code (`backticks` become <code>), withTranslator / scopedTx (a request-scoped translator)
                           (sprint 164) inRequestScope / setRequestTranslator: scopedTx in every builder handler
    i18n/                  en.ts defines the builder's keys; de, es, fr, it, nl, pt, zh-cn, zh-tw, ja, ko (sprint 134) are Records of the same keys
    language.ts            (migration 127) the status bar's language menu (POST /builder/language), the sign-in page's
                           language links (?lang=, a cookie), meta.developer.language
    routes.ts              sign-in, app home, settings, activity, developers, create (POST, via newapp.ts)/import (POST)
                           (sprint 183, CD-2: the Pages report's Conditions column, conditions.ts serverCondition/conditionWords)
                           (sprint 198, NX-U3) Settings' right rail (.settings-layout / .settings-rail: railLinks per tab, railRelated,
                           the checklist with data-tabs="security signin"; builder.js shows the tab's parts and marks the section in view)
    pages-report.ts        (sprint 193, NX-F3) the app home's Pages report: Alias, Type, Updated, Updated by (meta.page_change),
                           filters with counts (filterPages, a facet without its own filter), sortPages, the column chooser
                           (PAGE_COLUMNS, meta.developer.page_columns, POST /builder/page-columns)
    page-type.ts           (sprint 193) pageType(): a page's type from its regions (the main region rule), pageTypeKey();
                           (sprint 229) 'global' for page 0 (pages-report.ts: no Run link, "On every page")
    wizards.ts             create page wizards: step 2 forms per page type (defaults from meta.wizard_defaults), POST → meta.generate_page
    create-page.ts         (137) Create page: the grid of page types with SVG previews (tabs Component / Feature / Copy), the table step,
                           Create page as copy (step per app and page, shared components mapped or copied → meta.copy_page)
                           (sprint 197, NX-U4) the quick forms Create pages from a table and Create blank page above the grid
                           (sprint 229, AX-8) the Global Page tile (?type=global, while the app has no page 0) → POST /apps/:id/pages
                           with page_no 0 (routes.ts: a page number must be typed; 0 is never modal); copy to and from page 0
    features.ts            (137) Add feature: review (what it adds) and install, once, of Access control, Activity reporting,
                           Configuration options, E-mail reporting, Feedback, About, Login page, Theme style selection, Push
                           (the generators are PL/pgSQL in migration 047: catalog, defaults, form/cards/calendar/chart/map/facets/master-detail)
    home.ts                App Builder home at /builder/apps and /builder (tiles, applications report/cards, Recent; /builder redirects
                           to the Workspace home when meta.workspace.builder_home = 'home'), Create, Import, Dashboard, Utilities;
                           (116) Updated by, working copies and the application lock in the report and the cards;
                           (sprint 231, AX-13) Updated by, Working copies and Lock are columns shown at every width (Sign-in col-low)
    app-updates.ts         (sprint 116, migration 125) who changed an application last: developer() notes a builder POST under
                           /apps/:id or /pages/:pid (or a Create / Import), an onSend hook records a success in meta.app_change
    workspace-home.ts      (sprint 109, migration 119) the Workspace home /builder/home, opened after sign-in: tool cards (Data Reporter
                           when GET /builder/reporter exists), workspace message edited in place (workspaceAdmin), Summary, Top
                           applications / users / developers over meta.developer.home_timeframe, System message (src/release-check.ts),
                           POST timeframe, message, release-check; releaseCheckRegion for Instance settings
    newapp.ts              creating an application (schema, role app_<alias>, Home page, first user): blank app, from a file, from tables
    apex-import.ts         (sprint 182) Import → From Oracle APEX: upload (meta.temp_file of the session), the report, import with
                           meta.import_app into the developer's workspace
    appfromfile.ts         Create → From a file: upload (src/dataload.ts parsing), proposed table/columns, one transaction:
                           app + table + rows (loadRows) + pages (meta.generate_page: report and form, chart, facets)
    appsheets.ts           Create → From a file with several sheets/JSON arrays: parseBook, proposed keys and foreign keys,
                           step 2 sections, one transaction (tables, rows, foreign keys, report+form per table); addDashboard
                           (a chart per table on one page, also used for existing tables)
    appwizard.ts           Create → From pasted data (kept as a temp file, then the From a file steps) and From existing tables
                           (a schema's tables/views → report+form or report pages, navigation, dashboard); (sprint 196) the short Create
                           screen (GET/POST /create: a name, the full form's defaults, the same create() as the full form at
                           /create/full and POST /apps; newapp.ts aliasFromName: an alias whose schema and role are free)
    forms.ts               generic component property form (lookups, render, save)
    backups.ts             Application → Backups (migration 082): list, back up now, download, restore (replaceApp), keep N;
                           backupTick() for the scheduler's daily backups of changed applications
    workspace-backups.ts   Workspace utilities → Manage backups (sprint 62): the backups of every application of the current
                           workspace, back them all up (only the changed ones by default)
    rest-catalogs.ts       Workspace utilities → REST Source Catalogs (095): list, import (file, pasted, URL), a catalog and its
                           services, download; catalogPicker and "from a catalog" for an application's REST data sources
    workspace-transfer.ts  Workspace utilities → Export and import (sprint 67, workspace administrators)
    find-workspace.ts      (096) Find my workspace: builderMail (Mail services → Builder mail), workspacesMail, the page (same answer
                           for every address, mail after the answer, limits per address and IP)
    availability.ts        Application → Availability (migration 083): status, message, users, build status (Run only is
                           enforced by locks.ts blockingLock); availabilityBadge() in the application header
    feedback.ts            Application → Feedback (migration 084): the setting, the list with filters, status and answers
    team.ts                (sprint 113, migration 122) Builder → Team Development /builder/team: issues (list with filters and saved views,
                           board by label group or milestone with a Move form per card, issue page with Markdown, comments, canned
                           responses, @mentions, history), labels and groups, milestones, templates, the set-up wizard; Make an issue
                           from feedback and developer comments; pageIssuesNote (Page Designer), appIssues (App Home), teamHomeBlock
                           (Workspace home). Every id from a request is looked up in the current workspace
    region-help.ts         the help of a region's settings per region type (Utilities → Show as JSON), with links to the guide
    mail.ts                Workspace utilities → Mail services (administrators: providers, write-only secret, allowed senders,
                           applications with From and daily limit, test; sprint 236: several services per application, the
                           Default column) and Applications → Activity → Mail (retry, cancel; the app's other services);
                           serviceForm/formValues/runCheck shared with workspace-mail.ts (sprint 118); (sprint 250) redirectRegion
                           and POST /apps/:id/mail/redirect: the app's Redirect all mail to, the MAIL_REDIRECT_TO notice
    mail-queue.ts          (sprint 118, WS-9) Administration → Mail queue (/builder/mail-queue): queueScope (administrators: all or
                           ?ws=; workspace administrators: the current workspace), figures, per hour, per workspace / application,
                           slowest provider calls, failures; Retry / Purge one or all failed, scope checked again per mail
    network-access.ts      (sprint 118, WS-9) Administration → Network access (/builder/network): the installation's list, a workspace's
                           list (workspaceAdmin), Check a URL (nothing called), the workspaces (administrators), refused calls
    rls-hint.ts            (sprint 186) the hint after a refusal by row level security or privileges (42501) in SQL Commands,
                           SQL Scripts, Sample Data and Load Data; administrators get the Owner connection from it
    owner-connection.ts    (sprint 185, NX-S1) the SQL Workshop's Owner connection: administrators only, a reason (session state
                           __OWNER), chooseOwner / endOwner, auditRun (worksheet, SQL Scripts) and auditedOwner (the other tools'
                           changing statements) into meta.owner_sql_audit; workspaces.ts workshopDb() picks it or the developer login
    workspace-mail.ts      (sprint 118, WS-9) a workspace's own mail service (/builder/workspaces/:id/mail, WORKSPACE_<id>): its
                           administrators only, write-only secret, checks through mail.ts runCheck with the workspace's guard
    workspace-resources.ts (sprint 141, AP-7) Workspace utilities → Static workspace files (/builder/workspace-files), Remote servers
                           (/builder/remote-servers: URL now, network verdict, used by; renaming moves sources/catalogs) and Web
                           credentials (/builder/workspace-credentials: write-only secrets): the current workspace, its developers see,
                           its administrators change
    shared.ts              Shared Components and access control
    designer.ts            page designer: component tree (with computations and branches), layout canvas and gallery, property editor, toolbar;
                           (sprint 86) GET /builder/apps/:app/pages/:no, /builder/pages/:id redirects browsers there (designerUrl in ui.ts)
                           (sprint 229) page 0: the Global Page note, Run opens the home page, Quick edit finds a P0_ item on page 0,
                           renumbering or deleting page 0 leaves the application's lock and comments (page_no 0) alone
    errors.ts              (sprint 86) the builder's HTML 404 and 500 pages for browsers (wantsHtml, a not-found handler and an onSend hook)
    arrange.ts             page designer layout changes: move, column span, create from the gallery, undo / redo;
                           (sprint 195) sub regions: moveComponent's parent (targetParent: one level), CONTAINER_LABELS (the gallery's
                           containers), duplicate and copy with sub regions, deleteRegion (sub regions move up to the page)
                           (sprint 207, AX-4) the layout's slots: designer.ts draws a Sub regions slot in every region at page level
                           (.pd-sub-spare unless a container or it has sub regions; data-holds on a region with sub regions)
                           and the button positions of SLOTTED_TEMPLATES (runtime/regions.ts: the templates slottedShell
                           places by position); builder.js / builder.css show the spares while dragging (pd-dragging-region,
                           -button, -holder) and on body.pd-max; the tree's Buttons node has a folder per position (li[data-slot]);
                           the layout bar's ? ([data-show-tab]) opens the Help tab, which holds the keyboard hint (#pd-kbd)
                           (sprint 234, AX-12) POSITION_LABELS of the new positions; designer.ts draws a zone per position in
                           PAGE_POSITIONS order (the header's three in .pd-header-zones; a header zone on a minimal or modal page
                           only while it holds regions, .is-off), the tree's folders in the same order
    sql.ts                 SQL Workshop: the home and the session's schema
    sql-tour.ts            (sprint 179) GET /builder/sql/tour: the guided tour of the SQL Workshop's tools (a step per tool, no script)
    launchpad.ts           (sprint 96) the SQL Workshop home's Launchpad (pins in meta.builder_pin, 109; tool groups), POST /builder/pins,
                           GET /builder/palette (the builder's search: JSON for Ctrl+K, a results page without JavaScript;
                           (sprint 203) sharedEntries(): the Shared Components entries of ?app= or the last opened application)
    sql-charts.ts          (sprint 97) charts of a query: chartSpec(), drawChart() (runtime/charts.ts, a PageCss in a nonce'd <style>), the
                           worksheet's Chart tab, SQL Workshop → Charts (meta.sql_chart, 110; read-only runs);
                           (sprint 173) an application page from a saved chart: chartRegionSource(), /apps/:id/chart-page
    sql-shares.ts          (sprint 176) share links for query results: POST /sql/shared keeps the worksheet's SELECT behind a
                           token (meta.sql_share, 158), GET /sql/shared/:token runs it read-only as the reader's connection
                           (runShare(), 500 rows), the maker or an administrator renames, extends, stops; /sql/shared lists
    sql-tools.ts           (sprint 96) SQL_TOOLS: every SQL Workshop tool with its group, tab and description (home, More menu, search)
    worksheet.ts           (sprint 173) POST /sql/worksheet/rows: the grid's next rows from an offset (read-only; public/worksheet.js
                           loads them while [data-ws-more-end] is in view);
                           (sprint 172) Keep notices: keptNotices() in the session state (__WSKEEP, __WSNOTICES);
                           (sprint 91) the SQL Worksheet (Database Actions' SQL; /sql/commands too): navigator (pickSchema, objects with
                           columns, objectStatements), toolbar, output tabs, history (meta.sql_history, 108), plan trees, Run as an app's role, (sprint 93) Save / Rename / Download as SQL Scripts, bind and substitution values, POST /sql/worksheet/format; GET /sql/worksheet/navigator;
                           (sprint 107) transaction mode: the txn field, Commit / Rollback (mode=commit|rollback), txnBadge(), GET/POST /sql/worksheet/txn (JSON)
    object-browser.ts      (sprint 75) the Object Browser: objects by type, system objects hidden, a table in tabs, column actions as SQL to review
    table-editor.ts        (sprint 95) Table Properties: GET/POST /sql/objects/table (create, edit ?o=, ?template=), fromForm(), Preview / Apply
                           (one transaction) / Open in the worksheet
    fulltext.ts            (sprint 135, AP-2) Table Properties › Add full-text search: GET/POST /sql/objects/fulltext?o= (text columns
                           with weights A–D, a configuration from pg_ts_config, fulltextDdl(): a generated tsvector column and a GIN
                           index), Preview / Apply (one transaction, recorded in the Change Log) / Open in the worksheet
    vector-column.ts       (sprint 136, AP-1) Table Properties › Add vector column: GET/POST /sql/objects/vector?o= (a provider of the
                           workspace's applications, source columns, distance; vectorDdl(): vector(n), HNSW index, the
                           meta.embedding_set / embedding_enqueue trigger), Preview / Apply (Change Log; the rows queued) / worksheet;
                           the table's vector columns with progress and Backfill (mode=backfill, all=on)
    vector-providers.ts    (sprint 136, AP-1) Shared Components → Vector providers (/apps/:id/vector-providers: list, provider form,
                           test, delete) and Workspace utilities → Vector providers (/vector-providers: pgvector status, Create
                           extension for administrators, the workspace's providers and vector columns); pgvectorNote()
    json-sources.ts        (sprint 142, AP-8) Shared Components → JSON sources (/apps/:id/json-sources: list, source form with
                           Propose from the data, views: Create views / worksheet (Change Log), page: createSourcePage() = a form
                           on the view and a detail grid per array, delete)
    document-view.ts       (sprint 142, AP-8) Table Properties › Document view: GET/POST /sql/objects/document?o= (child tables
                           by foreign key), Preview / Apply (Change Log) / worksheet
    telemetry.ts           (sprint 139, AP-6) Workspace utilities → OpenTelemetry (/telemetry: the collector, signals, values, user,
                           browser spans, /metrics and its token, status per collector, Send a test span; administrators) and a
                           workspace's own (/workspaces/:id/telemetry: as the instance / off / own collector; its administrators)
    data-security.ts       (sprint 119) a table's Security: GET/POST /sql/objects/security?o= (policies, roles × columns, masks), Preview / Apply
    object-actions.ts      (sprint 94) an object's ⋯ menu (objectMenu) in the worksheet and the Object Browser: Quick DDL (objectDdl), Drop with
                           dependents, Add index / trigger / policy as drafts; GET /sql/objects/action, /sql/objects/panel (Open in a panel)
    data-modeler.ts        (sprint 98) SQL Workshop → Data Modeler: /sql/modeler (diagrams, meta.sql_diagram, 111), /:id (SVG), /:id/objects, /layout,
                           /rename, /delete, /svg (export), /ddl (diagramDdl), /dictionary (data dictionary, ?download=1)
    scripts.ts             SQL Workshop → SQL Scripts: editor, upload/download, run, results per statement, run history
    quicksql.ts            SQL Workshop → Quick SQL page (preview, save as script, run)
    querybuilder.ts        SQL Workshop → Query Builder: catalog, joins by foreign key or drawn, functions/group by, buildQuery() from the URL; the canvas is in builder.js
    users.ts               user directory and identity providers
    builder-sso.ts         (sprint 129) a provider's or directory's Builder sign-in region, Security's identities, unlink, break-glass
    browser-security-settings.ts (sprint 188, NX-S4) Settings → Security → Browser security: the form, POST …/settings/browser, the checklist lines
    datapump.ts            (sprint 103, DA-16) SQL Workshop → Schema Export / Import (/builder/sql/data-pump, administrators only):
                           jobs, export form, upload (streamed to PGKILN_DUMP_DIR), archive preview and import options, job log, download
    db-users.ts            (sprint 99, DA-13) Administration → Database Users (/builder/db-users, administrators only): PostgreSQL
                           roles with highlights, create/edit (review the masked SQL, then Apply in one transaction), drop with
                           reassigning; pgkiln's own roles read-only, roles of applications and workspaces not dropped
                           (sprint 183) a role's Isolated workspace panel, POST /role/:name/workspace → workspaces.ts changeWorkspaceRole
    scheduling.ts          (sprint 101, DA-12) SQL Workshop → Scheduling (/builder/sql/scheduling, administrators only): pg_cron jobs
                           with next runs, create/edit with a schedule builder and preview (review the SQL, then Apply), disable,
                           run now, unschedule, run history and purge; (sprint 213) a line on Scheduling vs Automations;
                           without pg_cron pgkiln's automations first, the set-up steps folded below
    api.ts                 per-app REST API page (API role, tokens)
    globalization.ts       translations, XLIFF/CSV, text messages
    dataload.ts            SQL Workshop → Load Data (with definitions, save a mapping as one); data load definition spec (Shared Components)
    sampledata.ts          SQL Workshop → Sample Data: schema → tables → generator form; preview (rolled back), insert, SQL/CSV download, saved generators (meta.data_generator)
    unload.ts              SQL Workshop → Unload Data: table/view (columns, where, order) or query form, streamed download (read-only transaction, own connection)
    layouts.ts             report layouts: logo upload, PDF preview
    automations.ts         automations: actions (add, reorder), next run, Run now, run history with errors per row
    report-settings.ts     page designer: report settings form (columns, link, selection, PDF)
    settings-save.ts       (sprint 202, AX-2) the Attributes tab in the property editor's one form: embedSettings() turns a region's
                           settings forms into groups of form#pd-form (controls named "<key>:<field>", form="pd-form", no Save of
                           their own), settingsBodies() takes the post apart, settingsRoute() each form's own route; the savers
                           (saveReportSettings, saveRegionSettings, …) and saveRegionAttributes() are in the forms' modules
    region-props.ts        (sprint 230, AX-9..11) the region's property groups in APEX's order for components.ts (Layout,
                           Appearance, Accessibility, Advanced, Header and footer, Read only, Server cache, Customization, Comments,
                           Audit information); Field.virtual / config / valueBy / emptyLabel (forms.ts); labels pe.region.*, groups
                           pe.group.* in i18n/*; regionPropsProblem, withRegionAudit, stampRegionAudit (app-updates.ts)
    region-columns.ts      (sprint 205, AX-1) the Page Designer's Columns node: regionColumns() (the query's columns with their
                           types from reportColumns, then configuredColumns() no longer in the query), COLUMN_FIELDS per region
                           type, columnProperties() (form#pd-form for one column or several: shared values, Mixed, was_<key>),
                           mergeColumnSettings() (only changed fields; into headings, formats, column_options, hidden, pdf,
                           link, a grid's readonly and columns), POST /builder/pages/:pid/region/:rid/columns; designer.ts
                           draws the node (?c=column-<region>&col=<name>…), builder.js setupColumnSelect (Ctrl/Shift+click)
    type-names.ts          (sprint 202, AX-3) the Page Designer's type names in the builder language: optionName(kind, field, value)
                           (region/item/button types from the gallery's labels; dynamic action events and actions, process,
                           validation and computation types, region templates: pd.* keys); componentForm's selects and the tree
    component-regions.ts   (sprint 231, AX-14) the built-in template components as region types of the gallery and the Type list:
                           template_component:<static id> (never stored; a template_component region with config.component),
                           withComponentTypes(), regionTypeValue() (a region's type as named), newComponentRegion() (sample
                           query), takeComponentType() / applyComponentType() (designer.ts POST /c/region), arrange.ts createComponent
    region-settings.ts     page designer: settings forms for grid, chart (gauge, drill-down), cards, calendar (views, create, drag and drop), facets, smart filters, display selector, list
    search.ts              app search, "where used" (appEntries, search, whereUsed, usedInPanel)
    advisor.ts             Advisor: EXPLAIN every SQL fragment, reference checks, plpgsql_check; (sprint 229) globalPageFindings:
                           links, buttons, menu entries and the home page to page 0, branches and items without P0_ on page 0;
                           (sprint 234) positionFindings: a header position the page has not, items and submit buttons in a
                           header region (outside the page's form); (sprint 240) stay_in_dialog off a modal page or on a branch
                           to another app, Ajax callbacks that aren't SQL or a chain of SQL processes; (sprint 245) queryColumns
                           (a SELECT's columns through a temporary view, rolled back): a document template's column named like a built-in;
                           (sprint 249) in_page_below off a modal page, an item branch's target_item that
                           isn't an item, app item or APP_PREVIOUS_PAGE
    advisor-items-pages.ts (sprint 241) itemPageFindings: a placeholder no type shows, meta.set_auth_user outside custom
                           authentication's post-authentication code, No navigation on a modal page
    utilities.ts           (sprint 138, AP-5) an application's Utilities tab: tiles, dashboard figures, recently updated pages,
                           application and page checksums; Change history (filters, diffHtml of a change); the icon browser
                           /builder/icons; historyHooks() (preHandler: ensureSnapshot before a builder POST of an application);
                           (sprint 203) deletedPageNames(): a deleted page's last recorded name (pages/NNNN/page.yaml in the history)
    page-utilities.ts      (sprint 206, AX-5) the page designer's menus on the open page: pageCreateLinks() (Create → Copy this
                           page: create-page.ts's copy form with ?from=&page=; Issue for this page: team.ts's new issue with
                           ?app=&page=), pageUtilityLinks() (History of this page: utilities/history?page=; View as text, Page
                           checksum, Export this page); GET /builder/apps/:app/pages/:no/text (the page's files of the text layout,
                           read-only, and pageChecksums()) and …/export (filesToZip of pageFiles(): the page's folder, logged as
                           page_export); no import of one page (its folder goes into a text export, which is imported)
    dependencies.ts        (sprint 138) Utilities → Database object dependencies: appDependencies() (the Advisor's fragments, each
                           parsed as the app role into a BEGIN ATOMIC temp function, one statement by the extended protocol;
                           pg_depend → tables, views, sequences, functions; missing objects from the parser's errors; privileges
                           needed vs the role's), the page with Object Browser links
    upgrade.ts             (sprint 138) Utilities → Upgrade application: upgradeCandidates() (nav_appearance, date_picker,
                           popup_lov), preview diff, POST upgrade by key or rule (found again first), recorded in the history
    ui-defaults.ts         (sprint 138) UI defaults /builder/ui-defaults (meta.ui_default, migration 138): per column label, mask,
                           help, alignment, list of values; seed from comments; tables of the workspace's catalog only. The wizards
                           read them through meta.wizard_column_label and the meta.item trigger meta.ui_default_item
    ddl-tools.ts           SQL Workshop → DDL and Compare (src/ddl.ts); (sprint 106) the Apply and record form
    recycle-bin.ts         (sprint 228, migration 186) SQL Workshop → Recycle Bin (/builder/sql/recycle-bin): drop to the bin (rename to
                           BIN$… on workshopDb, meta.recycle_bin by oid), restore, purge, purge all; object-browser.ts hides BIN$ tables
    changelog.ts           (sprint 106) SQL Workshop → Change Log (/builder/sql/changes): change sets per schema, latest app export,
                           downloads (POST, mark exported_at), rename, delete; /sql/compare/apply (one transaction, recorded);
                           (sprint 175) POST /sql/changes/:id/rollback (the rollback block; never run);
                           (sprint 221) POST /sql/changes/:id/liquibase (context, labels, precondition) and the download's contexts
                           (sprint 180, migration 163) captureState(), the panel and POST /capture: the event
                           triggers meta.change_log_ddl / change_log_drop that record DDL of other tools (source external)
    sql-utilities.ts       SQL Workshop → Utilities (sprint 62): the tools' tiles, OBJECT_REPORTS (fixed catalogue SQL over the
                           connection's usable schemas), About Database; read only, with a timeout; /sql/utilities/monitor redirects to the SQL Monitor
    login-page.ts          Application settings → Login page and Forgot password; Create a login page (page 9999);
                           (sprint 231) Offer "Remember username" (meta.app.remember_username)
    top-sql.ts             Top SQL per app role from pg_stat_statements; (sprint 102) statementsState / statementsNote (installed and loaded?)
    sql-monitor.ts         (sprint 102, DA-14) SQL Workshop → SQL Monitor (administrators): /sql/monitor (sessions, wait events, progress;
                           ?fragment=1 the live part), POST /sql/monitor/session (cancel / terminate), /sql/monitor/top (topStatements:
                           pg_stat_statements sortable, bars), /reset, /statements/:queryid (totals by role, explainForMonitor: EXPLAIN only,
                           one statement by the extended protocol, read only, generic plan for $1), /statements/:queryid/worksheet
    plan-view.ts           (sprint 92; shared since 102) planView(): a plan (src/sqlplan.ts) as a tree, for the worksheet and the SQL Monitor
    diagnostics.ts         Activity → Debug messages (level, list, one request's entries, purge); Workspace utilities →
                           Installation (version, install/upgrade runs, applied and missing migrations; administrators)
    ldap.ts                Users → LDAP directories
    documents.ts           document template preview (Shared Components)
    pwa.ts                 Settings → Progressive Web App (icon upload)
    themeroller.ts         Settings → Theme Roller: style variants (add, edit, rename, delete), default style, users may choose;
                           (sprint 117) navigation appearance and header strip colours (application and per style), the preview's menu
    subscriptions.ts       Shared Components → Subscriptions: subscribe, refresh, unsubscribe, subscribers and publish; the note under a component
    reporter.ts            page designer: Data Reporter settings (sources: table or view, offered columns, labels, masks; sharing;
                           (sprint 110) a dataset as a source, who may edit, who may moderate, publishing)
    datasets.ts            (sprint 110) App Builder → Data Reporter (/builder/reporter): datasets (new: schema, tables; a dataset's
                           joins, columns, row filter, query and preview), files (download, export all, import), Create reporting
                           application
    form-designer.ts       page designer: Form Designer settings (designers' scheme; sources: key, actions, offered columns, labels, lists of values)
    workingcopies.ts       Working copies: list and create, compare with differences, merge or refresh with conflict choices, delete
    copy-app.ts            (sprint 203, AX-6) Copy application: GET /apps/:id/copy, POST /copy-app (copyApplication(): export →
                           import under a new alias, same workspace and app_access, automations and REST syncs off)
    rest.ts                REST module endpoints list and curl example (Shared Components)
    autorest.ts            (sprint 100) SQL Workshop → RESTful Services (/builder/sql/rest): publish a table or view through an
                           application of the workspace (checks: schema the workshop may use, app role not the owner), its page
                           (grants per method, RLS, security_invoker, endpoints, cURL/fetch, OpenAPI link), settings, disable
    rest-modules.ts        (sprint 104) SQL Workshop → RESTful Services → Modules (/builder/sql/rest/modules): modules of the
                           workspace's applications, the module › template › handler tree, handler forms, Try it (inject with a
                           short-lived token), Run only / lock checks; (sprint 177) the Webhook settings of a handler
    web-requests.ts        (sprint 177) RESTful Services → Web requests (/builder/sql/rest/requests): the outbox of the
                           workspace's applications; re-queue, cancel, call back again
    webhook-events.ts      (sprint 177) RESTful Services → Webhook events (/builder/sql/rest/events): events per handler, an
                           event's headers and body, re-process
    workflows.ts           workflow versions, diagram and instances (Shared Components)
    workflow-migrate.ts    (sprint 114) migrating running workflow instances to a newer version (map, preview, apply with
                           meta.migrate_workflows) and the diagram as an SVG file (PNG in builder.js)
    process-jobs.ts        page designer: the Jobs tab of a background chain process
    template-spec.ts       template component property form (Shared Components)
    websources.ts          web credentials and REST data sources: property specs, secret status, Test, suggested columns,
                           write-back operations, synchronisation settings, Synchronise now and run history
    oauth-consent.ts       (sprint 222, migration 184) the OAuth2 authorization code flow of web credentials: startConsent() (state + PKCE in
                           meta.web_credential_pending, bound to the builder session), consentPanel(), POST /apps/:id/web-credentials/:cid/authorize,
                           GET /builder/oauth/callback (one-time, ten minutes; the code exchanged, the refresh token stored encrypted);
                           workspace credentials: POST /workspace-credentials/:cid/authorize (workspace-resources.ts)
    templates.ts           template components: preview, plug-in export/import, region settings, report column templates
    ui-templates.ts        (sprint 203, AX-7) Shared Components → Templates (/apps/:id/templates): page, region, button, label,
                           classic report and list templates with where each is used (read-only; names in uit.* keys)
    code-editor.ts         code fields (data-code marks), /builder/code/completions (scoped to the app's role), /builder/code/check
    instance.ts            Workspace utilities → Instance settings (src/instance.ts: session and sign-in settings, configuration overview;
                           Lockout checks from src/instance-checks.ts and POST /instance/key-backup)
    gallery.ts             the App Gallery (sprint 61, 120): examples/gallery/gallery.json, sample apps (administrators: migrate --example,
                           or one SQL file of examples/ or examples/gallery/samples/ in one transaction), starter and utility apps
                           (blueprints of starters/ and utilities/ → openBlueprint's review), custom apps (the workspace's boilerplates);
                           four tabs with counts, ?q= search; (sprint 181) remote catalogues: the administrators' panel,
                           POST /gallery/sources[/:id/refresh|toggle|delete], /gallery/remote/:id/:kind/:key (fetch → review)
    app-groups.ts          application groups (092): a workspace's groups, a group per application (the App Builder home filters)
    cross-app.ts           Cross Application Reports (sprint 61): REPORTS (one SQL per topic over the workspace's applications)
    workspaces.ts          workspaces (064): loadWorkspaces/appAllowed (checked in ui.ts developer() for every /apps/:id and /pages/:pid
                           request), the current workspace (session state __WS), placeApp, the switcher, Workspace utilities → Workspaces;
                           (090) isolation and the workspace's database roles, workshopDb (the SQL Workshop's connection)
                           (093) workspace preferences (sql_workshop: checked in ui.ts developer() for /builder/sql…;
                           rest_services: checked in runtime/rest.ts) and extension links (the rail's Extensions menu in shell())
                           (sprint 225) createDeveloperForm, POST /workspaces/:id/developers/new and /remove: workspace administrators
                           create developers of their workspace only (never is_admin) and remove those of no other workspace
    locks.ts               page and application locks (blockingLock, checked in ui.ts developer() for every builder POST; appOfPath), developer comments, administrators
    blueprints.ts          Create → From a blueprint: list, JSON editor, AI draft, review (signed with the session), create in one transaction;
                           (sprint 66) From an application
    ai-builder.ts          App Builder AI (migration 062): the builder's AI service (meta.builder_ai), SQL Workshop → AI (SQL from a
                           question, shown not run; explain), describe tables (meta.ai_table_note, COMMENT ON, AI drafts),
                           create pages with AI (proposals checked by checkProposals, created with meta.generate_page)
    assistant.ts           page designer: AI assistant settings and a report's "Ask in your own words" (off, built-in phrases or an AI service, placeholder)
    ai.ts                  Workspace utilities → AI services (administrators: services, write-only encrypted keys, access and
                           daily limits per app, Test, usage log) and Activity → AI usage per application
    ai-agents.ts           (121) Shared Components → AI Agents: the agent and tool forms (checked before saving, renames follow
                           into agents and regions), toolCallTable() (Activity → AI usage → Tool calls), agentOptions()
    supporting.ts          supporting objects: review page, running the install/upgrade/deinstall scripts as the app's role in one transaction
public/
  app.css                  theme (light/dark, responsive; --font, --font-size, --radius for style variants; template option classes to-*;
                           (sprint 117) navigation tree states, RTL via logical properties, body.nav-pillar-*, u-color-*-subtle, the busy bar)
  app.js                   client runtime: dialogs (dialog_closed actions), popup LOVs (sprint 115: the next page loads on scroll through an
                           IntersectionObserver, ‹/More without one), dynamic actions (focus, classes, messages; sprint 115: wait_popup /
                           remove_wait_popup as a modal <dialog class="wait-popup">, pgkiln.waitPopup(), the menu_entry event), (sprint 140) shuttle()
                           and selectPick() (Select One / Many: combobox + listbox, chips) over the item's hidden <select>, grids (add/duplicate rows, master-detail refresh, move/resize columns, copy/paste of cell ranges), menus, lazy regions, maps (Leaflet layers, marker clusters, heat layer, layer legend, area/distance filter) (no inline JS)
  code-editor.js, .css     builder code editor: enhances <textarea data-code>, highlighting, suggestions (no dependencies);
                           (sprint 172) lexJs() for the body of a plv8 function (isPlv8: LANGUAGE plv8 in the statement);
                           (sprint 108) the current line, and read-only <pre data-code-view="sql|plpgsql|json|html"> highlighted;
                           its colours are the --ce-* tokens in builder.css
  palette.js               (sprint 96) the builder's search dialog (Ctrl+K), recently visited SQL Workshop pages, the Launchpad's tabs
  sql-monitor.js           (sprint 102) the SQL Monitor: reloads the sessions' live part every 5 / 15 / 60 s, Pause (localStorage pgkiln.sqlMonitor)
  data-modeler.js, .css    (sprint 98) the Data Modeler: drag boxes, undo/redo, save, zoom/fit, auto layout, mini-map, SVG/PNG export, print
  worksheet.js, .css       (sprint 91) the SQL Worksheet: run keys with the cursor, output tabs, navigator swap and search, drag and drop, splitters;
                           (92) grid sort, value dialog, history filter; (93) worksheet tabs in localStorage, Files, binds dialog, format, find, case;
                           (107) Autocommit / Transaction per tab, the badge from the server, beforeunload, rollback on closing a tab
  builder.css              builder only: IDE look (dark chrome, icon rail, panes); design tokens at the top (colour,
                           elevation, radius, type, motion; light and dark sets, sprint 105; code editor --ce-*, sprint 108),
                           then the shared controls
  builder.js               builder only: tabs, component tree, property filter, drag and drop on the layout
  builder-icons.svg        builder only: icons of the rail, toolbar and designer (b-*); b-kiln is the brand mark (brandMark() in ui.ts)
test/
  binds.test.ts            unit tests
  security.test.ts         security regression tests (in-process, against the database)
  sso.test.ts              single sign-on against an in-process mock identity provider
  api.test.ts              REST API: SQL as the API role; HTTP tests skip without PostgREST
  accounts.test.ts         own password, expiry, admin reset, preferences
  i18n.test.ts             languages, translations, text messages, date masks, XLIFF/CSV
  numformat.test.ts        number format masks: every element, rounding, parsing, separators
  globalization.test.ts    masks on HR page 29, time zones, the de/fr/es texts
  files.test.ts            file items: storage, limits, downloads, temporary files
  file-gallery-247.test.ts (sprint 247, MG-20) multiple file items on a shared child table (filter, text parent column) and the
                           gallery, on Sample Files' folders and people
  signature-scan-239.test.ts (sprint 239) signature items (preset, pad, temporary file, HR page 7) and the zxing files and CSP
  items.test.ts            rich text, Markdown, rating, combobox, date range, password reveal and QR code items
  item-region-types.test.ts (sprint 140) shuttle, select one/many, classic report, breadcrumb and help text: gallery, runtime, export, Advisor, HR page 50
  sub-regions.test.ts      (sprint 195) sub regions: the one-level rule, tabs/flex/grid rendering, the parent's condition, partial refresh,
                           export/import and files, copy page, the Page Designer (create, move, undo, duplicate, delete), Advisor, APEX import
  region-properties.test.ts (sprint 230, AX-9..11) layout classes and rows, attributes, landmark, header/footer, Read Only,
                           Customize link, the property editor's groups and saving, audit, export/import/replace, APEX mapping, HR page 57
  dataload.test.ts         parsing, Load Data, the data_load process
  sampledata.test.ts       Sample Data: CHECK parsing, proposals, option errors, seeds and streams, preview/insert/rollback, parents first, downloads, saved generators
  unload.test.ts           Unload Data: CSV/JSON/XLSX/XML output, read back with Load Data, read-only and one-statement checks, streaming
  app-from-file.test.ts    Create → From a file: proposed names and types, app + table + rows + pages, row errors, login, validation
  workshop.test.ts         SQL scripts, Quick SQL pages, query builder, data load definitions (Load Data, the process, export)
  cron-schedule.test.ts    (sprint 101) pg_cron schedules: parsing and errors, next runs across time zones and daylight saving, words
  scheduling.test.ts       (sprint 101) SQL Workshop → Scheduling: the SQL, the no-pg_cron page, create/edit/disable/run now/unschedule,
                           history and purge; against pg_cron when the test database has it, else test/pgcron-mock.ts (a stand-in)
  sql-charts.test.ts       (sprint 97) the worksheet's Chart tab, saving a chart, the Charts dashboard, a chart's page, read-only runs
  launchpad.test.ts        (sprint 96) Launchpad groups, pins (builder pages only, at most 24), the search (JSON and page)
  tabledef.test.ts         (sprint 95) table definitions round trip: CREATE, read, ALTER, read again; mistakes
  changelog.test.ts        (sprint 106) DDL recognition and names, recording from Table Properties, the worksheet and Compare,
                           downloads (Flyway, Liquibase, SQL), stable numbers, the latest application export
  table-editor.test.ts     (sprint 95) the Table Properties page: preview, apply, a failing apply rolls back, template, worksheet
  fulltext-search.test.ts  (sprint 135) full-text search configurations: stemming, rank order, highlights, websearch syntax, the
                           configuration fallback, did you mean (pg_trgm when it can be installed), the report search on a tsvector
                           column, the Advisor's GIN check, Add full-text search (preview, apply, change log), export/import
  vector-search.test.ts    (sprint 136) vector providers and their checks, meta.embed, Add vector column (preview, apply, the queue
                           with the mock's embeddings, a change queued again, Backfill, a failing batch), vector and hybrid search
                           ("time off for a family move" → Relocation leave; RLS), the Advisor, Retrieve tools on page 49, the
                           builder pages, export; skips what needs pgvector when it isn't installed
  object-actions.test.ts   (sprint 94) object menus: Quick DDL, Drop with dependents, Add index / trigger / policy, the panel, not-found
  data-modeler.test.ts     (sprint 98) Data Modeler: "hr core" with its FK lines, saved positions, SVG, objects, DDL, dictionary, geometry
  worksheet.test.ts        (sprint 91) the SQL Worksheet: statement at the cursor, Run Script log, plans, notices, history, navigator, Run as
  worksheet-txn.test.ts    (sprint 107) transaction mode: the tab's transaction, Commit / Rollback, typed COMMIT, aborted, idle timeout, refusals,
                           Explain in it, Change Log at COMMIT, the JSON endpoint, sign-out
  datasets.test.ts         (sprint 110) datasets: checks and SQL, proposed joins, the builder's pages, files, the workspace export;
                           a reporting application in two clicks, an editor publishes, a viewer opens the stable URL, pins
  quicksql.test.ts         Quick SQL parser and DDL generator
  xml.test.ts              XML reader: rows, attributes, paths, refused DTDs and entities, limits
  printing.test.ts         report PDFs
  fixtures/                test files (employees.xlsx)
  template-components.test.ts  template language, escaping, plug-ins, regions and column templates
  logic.test.ts            computations, branches, menu buttons and badges, new dynamic actions, build options, export
  notifications.test.ts    (165) meta.notify and its checks, the bell, opening and Mark all read, list entry badge queries,
                           the live endpoint, send_notification, the timer event, the settings (security cases in security.test.ts)
  page-logic.test.ts       download, chain (background jobs) and workflow processes, function/app branches, dialog_closed (HR page 28)
  code-editor.test.ts      code editor: completions scoped to the app's role, the check, marked fields
  builder-i18n.test.ts     (sprint 121) builder languages: the coverage check of src/builder against i18n/en.ts, the message
                           files, Deutsch on the sign-in page, the status bar menu, the choice per developer, English fallback
  builder-home.test.ts     App Builder home: search, sort, views, Recent, Create/Import pages, dashboard, utilities
  app-list.test.ts         (116) the App Builder list's Updated by, working copies and lock; what counts as a change
  import-errors.test.ts    (sprint 251) import errors naming file and key: casts and conditions mirror PostgreSQL, unique keys,
                           allowed values, condition/condition_expr, advise --offline, import-schema.json = the catalog
  import-only.test.ts      (116) pgkiln import --replace --only: a page or component file, refusals
  charts.test.ts           chart markup per kind (geometry as classes), gauges, Gantt time axis and dependencies, pyramid, polar, range, box plot, stock, drill-down links
  calendar.test.ts         calendar views, create links, moving events (pure and over HTTP)
  rest-sources.test.ts     REST data sources, web credentials, SSRF checks, invoke_api (mock service + HR page 23)
  rest-modules.test.ts     (sprint 104) modules, templates, PL/pgSQL and media handlers, OpenAPI, the builder's tree and Try it
  workflow-invoke.test.ts  workflow invoke_api steps: the call between transactions, faults, retry, lease, Advisor, export (mock service)
  workflow-outcomes.test.ts (sprint 114) custom task outcomes, task events and notifications, fail recovery, send_mail and draft
                           steps, migrating running instances, the SVG export (HR part 67: SALARY_CHANGE)
  large-tables.test.ts     row ranges, max_rows, row limits, lazy regions, region caching, streamed downloads (HR page 25)
  grid.test.ts             interactive grid: aggregates, layouts per user, saved grid reports, master-detail, row actions (HR page 27)
  custom-auth.test.ts      custom authentication: function body, named function, post-authentication code, builder settings
  document-temp-file.test.ts (sprint 245, MG-18/26) meta.document_temp_file (HR part 109: Keep a copy), images and <br> in
                           cells and paragraphs (positions read from the PDF), the Advisor's built-in column warning
  item-texts-auth-user.test.ts (sprint 241, MG-10/11/13/15) placeholders, &ITEM. in labels, page template no_navigation,
                           meta.set_auth_user (HR page 68, part 104); e2e/visitor-kiosk.test.ts in a browser at 390 and 1280 px
  instance.test.ts         instance settings: precedence, the administrators' page, throttling, no secrets
  drawers.test.ts          drawers and dialog sizes (065): Page Designer, what pages tell the browser, export/import
  page-positions.test.ts   (sprint 234, AX-12) the new display positions: rendered in place (header, top bar, full width, dialogs),
                           left out on a minimal page and in a dialog; the Page Designer's zones and tree in APEX's order, moves;
                           the Advisor's findings (also on an export)
  designer-slots.test.ts   (sprint 207, AX-4) the layout's slots per region template, the spare Sub regions slot, data-holds, the
                           tree's Buttons node by position, the keyboard hint in the Help tab
  debug.test.ts            debug messages: levels, meta.debug, timings, password values, rollbacks, retention, the viewer, the install log
  web-request.test.ts      meta.web_request (scheduler pass, page process path, sources, credentials, limits, retention) and
                           meta.parse_data compared with the data loader (src/dataload.ts); HR page 35
  outbox.test.ts           (sprint 177) the web request outbox: retries and backoff, gave up, leases, callbacks, ordering and
                           idempotency keys, NOTIFY delivery (a local HTTP server stands in for the web service)
  webhooks.test.ts         (sprint 177) webhook handlers: signatures, event ids, receive first and process later, retries, the
                           builder's handler form and events page, an isolated workspace
  builder-parity.test.ts   lists (HR page 31), page and application locks, comments, developers, supporting objects
  page-wizards.test.ts     create page wizards: catalog defaults, every page type generated and rendered, refusals, the builder steps
  theme-styles.test.ts     Theme Roller style variants (checks, CSS, user choice per app, builder page), template options, base style Iris
  theme-pillar.test.ts     (sprint 117) Pillar Light / Dark appearances and the header strip: checks, CSS, runtime classes, Theme Roller, export
  workspaces.test.ts       workspaces (064): Default, administrators' pages, current workspace, refused apps, imports and copies
  mail-network.test.ts     (sprint 118) network access lists (page process refused and logged in debug, narrowing only, redirects,
                           the page), a workspace's mail service (sending, SMTP host on the list), the Mail queue (yesterday's
                           SMTP failure, Retry, Purge, counts, scope)
  mail-services.test.ts    (sprint 236, 191) several mail services per application: one default (triggers, partial unique index),
                           the service by From address when queuing and sending, the limit per service, the builder, HR part 99
  gallery.test.ts          the App Gallery: every starter and utility created from its review and every sample app installed, with all
                           their pages rendering; sample apps (admins), the search, a failing script leaves nothing
  gallery-samples.ts       the gallery's shipped apps for the tests: SAMPLES (schema and role of each script), BLUEPRINTS, drop/install
  sample-coverage.test.ts  (sprint 166) every feature in a sample app: each value of the components' catalogues (check constraints
                           listed in sample-coverage.sql, and meta.condition_ok's condition types) is used by HR or a gallery
                           sample, or exempted there with a reason
  builder-apex-screens.test.ts sprint 61: sign-in with a workspace, message and banner, utilization, SQL Workshop home, groups, reports
  workspace-isolation.test.ts isolated workspaces (090): logins, RLS on meta, app_id, roles, SQL Workshop, scripts, imports
  ai.test.ts               AI services: Generate text with AI (text, structured outputs, errors, limits, keys), its dynamic action,
                           meta.ai_generate, the providers, HR page 37; against ai-mock.ts (no real API calls)
  ai-assistant.test.ts     AI assistant region (context, tools as the app role, writes, REST, histories, limits, sessions), OpenAI,
                           natural-language report filters, builder settings; against ai-script-mock.ts
  blueprints.test.ts       blueprints: checks and SQL, review then create (rows, pages, grants), one transaction, AI draft, save
  blueprint-from-app.test.ts  a blueprint of HR: checks clean, pages and menu, notes, a working copy with sample rows, workspaces
  rest-catalogs.test.ts    OpenAPI/Swagger reading, parameter keys, catalog files, the builder's pages, a data source from a service
  workspace-transfer.test.ts  a workspace's export, import into another workspace (added, kept, replaced, all or nothing), groups, access
  workspace-resources.test.ts  (sprint 141) remote servers (checks, env var, HR's CRM moves its sources, credentials, renames, catalogs,
                           AI services, the Advisor), static workspace files styling two applications, workspace credentials, the export
  json-sources.test.ts     (sprint 142) data profiles, the views' DDL, writing through them (unknown keys stay, arrays by row_key,
                           a table of documents, document views), HR page 51 (JSON path columns, form and skills grid), the builder, export
  tree-charts.test.ts      treemap and sunburst (the hierarchy, cycles, squarify), timeline (lanes, rows, points and periods)
  gantt-move.test.ts       an editable Gantt's markup, the move route, dates, who may drag, the builder's settings
  find-workspace.test.ts   developers' addresses, builder mail, the workspaces mail, the same answer, limits
  ai-builder.test.ts       App Builder AI: the builder's service, SQL from a question, explain, describe tables, pages with AI
  ai-script-mock.ts        a scripted mock of Claude (SSE, tool_use with a thinking block) and OpenAI (tool calls), reply by reply
  ai-mock.ts               a local mock of the Claude Messages API (SSE stream) and OpenAI Chat Completions; (136) OpenAI's
                           embeddings (/embeddings, also in ai-script-mock.ts): conceptEmbedding(), eight "topics", the same
                           as the HR example's hr.policy_embedding
  sprint-231.test.ts       (sprint 231) AX-13: Remember username (cookie, prefill, off, Login region attributes, settings,
                           an export before 189); AX-14: template components in the gallery and Type list, create, switch, export
  helpers.ts               a cookie-keeping test browser
  e2e/signature-scan.test.ts (sprint 239) a signature drawn by touch at 390 px and stored; a QR code read by zxing-wasm without
                           BarcodeDetector, within the CSP
  e2e/responsive.ts        browser tests at phone/tablet/desktop widths (Playwright), run per width by
                           e2e/responsive-<width>.test.ts (sprint 208: one file per width for the CI shards)
  e2e/settings-layout.test.ts (sprint 198, NX-U3) Settings' right rail: Sign-in in two screens and the checklist in view at
                           1456 × 836, real anchors (also without JavaScript), one column below 1280 px, 360/1366 px, axe
  e2e/builder-i18n.test.ts (sprint 121) Deutsch on the sign-in page, the status bar's language menu, German screens at 390 px, CSP
  e2e/file-gallery-247.test.ts (sprint 247, MG-20) Sample Files' picture gallery at 390 and 1440 px: square thumbnails, axe,
                           the full-size picture, removing a file on save
  e2e/gallery.test.ts      (sprint 120) the gallery's sample apps: every page at 4 widths, CSP, axe; dynamic actions; the four tabs at 390 px
  e2e/admin-mail-network.test.ts (sprint 118) Mail queue, Network access and a workspace's mail service at 390 px without JavaScript
  e2e/pillar.test.ts       (sprint 117) Pillar appearances: axe in light and dark, subtle colours, current vs parent entry, Arabic RTL, 390 px, preview
  e2e/code-editor.test.ts  the code editor in a browser: highlighting, keys, suggestions, touch, screen readers, syntax colours at AA in both themes (sprint 108)
  e2e/data-modeler.test.ts (sprint 98) the Data Modeler in a browser: drag, save, reload, undo/redo, zoom, mini-map, exports, phone
  e2e/worksheet.test.ts    (sprint 91) the SQL Worksheet in a browser: run keys, tabs, navigator, drag and drop, splitters, phone, no JavaScript;
                           (107) transaction mode: badge, reload, Rollback, closing a tab, Autocommit switch, beforeunload
  e2e/items.test.ts        sprint 26 item types in a browser: editors, tags, stars, dates, reveal; without JavaScript
  e2e/item-region-types.test.ts (sprint 140) the shuttle (buttons, keyboard, order) and Select One / Many in a browser; without JavaScript; 390 px
  e2e/sub-regions.test.ts  (sprint 195) HR page 53: ARIA tabs (keys, refresh inside a tab, remembered), flexbox at 360 px, without
                           JavaScript; a tabs container with a report and a form built by drag and drop
  e2e/app-home.test.ts     (sprint 197, NX-U4/U5) the app home is the Pages report and the side column, the quick forms on Create
                           page, the Page Designer's one Save at 360 and 1366 px, with and without JavaScript
  e2e/designer-columns.test.ts (sprint 205, AX-1) HR page 2's Columns node: click sal, Save, reload at 360 and 1366 px; Ctrl+click,
                           the keyboard, the Attributes tab's shortcut, without JavaScript (Select several columns)
  e2e/designer.test.ts     page designer: panes per width, drag and drop, keyboard, Arrange buttons, builder theme
  e2e/page-positions.test.ts (sprint 234, AX-12) HR page 70 at 390 and 1440 px (the header's regions, the top navigation bar,
                           full width content, the inline dialog), the layout's zones in order and a drag onto After logo
  e2e/region-slots.test.ts (sprint 207, AX-4) a region's slots: a gallery report onto a Tabs Container's Sub regions slot, a region
                           onto another's spare slot (shown while dragging, not its own, none for a holder), CREATE to Next on a
                           maximized layout, the bar's ? and the Help tab at 390 and 1366 px, without JavaScript
  e2e/calendar.test.ts     calendar drag and drop and create on click, view switching, chart drill-down
  e2e/gantt.test.ts        Gantt drag and drop: moving a task, its end, the keyboard, a click still drills down, the phone
  e2e/globalization.test.ts the browser's time zone (sign-in, app.js), no-JavaScript fallback, a masked number item
  e2e/grid.test.ts         interactive grid in a browser: master-detail refresh, move/resize columns, row menu, copy/paste; without JavaScript
  e2e/page-logic.test.ts   dialog_closed refreshes a region without a reload, download process in a browser, dialog link without JavaScript
  e2e/notifications.test.ts (165) a notification reaches the open page (bell and navigation bar badge), opened from the bell; a timer action
  e2e/ai-builder.test.ts   App Builder AI in a browser (mock Claude): SQL from a question, a drafted description, proposed pages,
                           a blueprint drafted and reviewed
  e2e/ai-assistant.test.ts the AI assistant and report questions on HR page 38 in a browser (mock Claude), with and without JavaScript
  e2e/ai.test.ts           Generate text with AI on HR page 37 in a browser (mock Claude): dynamic actions without a submit, errors, no JavaScript
  e2e/page-menus.test.ts   (206) page 3's Utilities → History of this page and Create → Copy this page with the keyboard, at 360 px and
                           1366 px and without JavaScript; View as text fits a phone

Builder texts in more languages ​

(sprint 121) The builder's own texts are keyed messages, like the runtime's: src/builder/i18n/en.ts defines every key (<screen>.<what>, e.g. rail.app_builder, pd.menu.create, ab.count with {n}), and the other ten files (de.ts, es.ts, fr.ts, it.ts, nl.ts, pt.ts, (sprint 134) zh-cn.ts, zh-tw.ts, ja.ts, ko.ts) are Record<BuilderKey, string> of the same keys. A language's code is its BCP 47 tag (zh-CN, zh-TW), used as it is in <html lang>, the cookie and meta.developer.language; public/builder.css gives the CJK languages their own font stacks by :lang(). A page takes its translator from the session and uses it for every text it shows:

ts
const tx = tr(s);                                  // the developer's language (meta.developer.language, in the session)
html`<h2>${tx('wh.summary')}</h2><p>${tx('ab.count', { n: 3 })}</p>`;   // plain text: html`` escapes it
tx.rich('ab.none_yet', { create: html`<a href="…">${tx('ab.create_one')}</a>` });   // markup inside a sentence
tx.dyn(`gallery.region.${type}`, REGION_LABELS[type][0]);              // a key made at run time, with a fallback
tx.code('cr.schedule_help');                     // (sprint 162) `backticked` parts become <code>: syntax help

(sprint 162) A long form built by many helpers (the region and report settings, RESTful Services' pages) doesn't pass tx to each of them: its entry point runs inside withTranslator(tr(s), () => …), and the helpers import scopedTx as tx, which takes the translator of the request being rendered from an AsyncLocalStorage (so two requests in different languages never mix; test/builder-i18n.test.ts renders German and French concurrently). (sprint 164) Every /builder route runs in a request scope (inRequestScope in app.ts), and developer() sets the developer's translator in it once the session is loaded (setRequestTranslator), so scopedTx works in any builder handler and the helpers it calls without withTranslator; before sign-in it follows the language cookie (cookieLanguage). Outside a request (the command line, MCP, background jobs) it is English. Plural counts that English writes differently get a separate _1 key, so the English stays exactly as before.

A missing text falls back to English, never to the raw key. Shared helpers that render chrome take the session as an optional last argument (appHeader(a, 'pages', s), workshopTabs('sql', s)); shell() translates known English breadcrumb labels (tx.label) so pages that aren't moved yet still get a translated trail.

Moving a screen over: replace its literal texts with tx('key'), add each key with its English text to en.ts (keep the English exactly as it was: tests and e2e tests assert it), then add the key to the ten other files (TypeScript refuses a file with a missing or an unknown key). A sentence with a link is one key with a {link} placeholder and tx.rich, not pieces glued together; a count has a _one and a plural key; never lower-case a translated label (German nouns). Flash messages are translated where they are set.

The coverage check (test/builder-i18n.test.ts, part of npm test and CI) scans src/builder/**/*.ts for tx('…'), tx.rich('…') and tr(s)('…') and fails when a key has no English text (templated keys such as `ago.${unit}` must match at least one English key); checks that every region type, item type, button action, display position, button position, component kind and SQL Workshop tool has its run-time key; and that every language file has exactly the English keys, the same {placeholders}, no empty texts and is mostly translated.

Texts in the browser (sprint 123). The builder's own JavaScript (public/*.js) asks for texts with keys js.<screen>.<what>: shell() puts every js.* key in the developer's language into the page as JSON in an attribute, <div id="builder-texts" hidden data-texts="…"> (escaped like any value; builder pages keep having no inline script). A script reads it once and fills placeholders itself:

js
const TEXTS = (() => { try { return JSON.parse(document.getElementById('builder-texts')?.dataset.texts || '{}'); } catch { return {}; } })();
const msg = (key, params = {}) => (TEXTS[key] ?? key).replace(/\{(\w+)\}/g, (m, k) => (k in params ? String(params[k]) : m));
announce(msg('js.ws.copied', { what }));

The coverage check also scans public/*.js for msg('js.…') and fails when a key has no English text. Text from the server (a JSON answer's message) is translated on the server.

Stays English by design: the property editor's field names and help (and a shared component form's field names and help, which work the same way), links to the guide, generated SQL, and pages not moved yet. The builder's language is separate from an application's languages (src/i18n.ts).

Principles ​

  • User-facing texts go through the translator: ctx.locale.t('key') for pgkiln's own texts (add the key to en and nl in src/i18n.ts and to src/i18n/de.ts, fr.ts, es.ts; TypeScript checks that every language has every key), ctx.locale.tr(text) for texts derived from application metadata.
  1. Metadata first. A feature is a column or row in meta.*, rendered by the runtime, editable in the builder, included in export/import and usable from SQL.
  2. User input never becomes SQL text. Use query parameters (SqlParams, binds.ts) or literal() for values, pg.escapeIdentifier only for identifiers checked against a known list, whitelists for operators and keywords, and integers for positions.
  3. Visibility is authority. Anything a user can trigger (buttons, items, dynamic actions, grid saves) must be checked against computeVisibility() on the server.
  4. Server-rendered HTML, progressive enhancement. Every page works without JavaScript; app.js uses event delegation, and the CSP forbids inline scripts. Styles: no style="…" attributes either (style-src 'self' 'nonce-…'). Use a class in app.css (the u-* utilities for one-off spacing); for values that depend on data (chart geometry) call ctx.css.cls('width:34%') (src/css.ts), which returns a class whose rule goes into the page's nonce'd <style>. A refreshed region sends its rules along and app.js adds them through the CSSOM. The e2e test fails on any CSP violation in the browser.
  5. Escape by default. Build HTML only with html```; use raw()` only for markup you generated.
  6. Responsive and accessible. Labels, keyboard support, focus rings, and layouts that pass the e2e overflow checks.

Running and testing ​

bash
npm run dev          # auto-restart
npm run typecheck
npm test             # binds + security tests (needs the database with the sample)
npm run test:e2e     # needs `npx playwright install chromium`; SCREENSHOTS=1 saves PNGs to test-results/
npm run db:reset     # fresh database

CI (.github/workflows/ci.yml) runs these jobs against PostgreSQL 17:

  • test: typecheck and npm test on a fresh database;
  • e2e: the browser tests, uploading the screenshots as artifacts; test/e2e/accessibility.test.ts runs axe-core (WCAG 2.1 A and AA rules) on every page of the HR example (light, dark, Iris) and the builder's main pages (in both builder themes, with the SQL Workshop and the wizards, since sprint 108) and allows no violation;
  • docker: builds the image and starts the compose stack as a user would; docker-upgrade upgrades an older image with docker compose pull;
  • upgrade: installs an earlier release (v0.31.0 …) with its HR example (git archive <tag> | tar -x, then scripts/migrate.ts --seed --root), upgrades to the commit and runs tests on the result: the whole suite after the oldest and the newest release, the tests that touch every table (export / import, the CLI, generated apps, sign-in) after the others.

(Sprint 208) The long suites run in shards, each a runner with its own database: test (1/3) … test (3/3), e2e (1/4) … e2e (4/4) and upgrade (v0.31.0, shard 1/3) …. (Sprint 212) scripts/test-shard.ts i/n <files> gives a shard its files, balanced by duration: the weights are the seconds in test/durations.json and test/e2e/durations.json (a file not listed weighs the median), longest first, each to the shard with the least so far. Every file runs in exactly one shard, and the same list always splits the same way. (Node's own --test-shard=i/n deals the sorted files out in turn: the shard with security.test.ts took twice as long as the next.) To run a shard locally:

bash
npm run pretest && npx tsx --test --test-concurrency=1 $(npx tsx scripts/test-shard.ts 2/3 test/*.test.ts)
npm run pretest:e2e && npx tsx --test --test-concurrency=1 $(npx tsx scripts/test-shard.ts 2/4 test/e2e/*.test.ts)

Refresh the weights now and then, after a release or when a shard runs much longer than the others (the reporter scripts/test-times.mjs adds up each file's top-level tests):

bash
npm run pretest && npx tsx --test --test-concurrency=1 --test-reporter=./scripts/test-times.mjs test/*.test.ts > test/durations.json
npm run pretest:e2e && npx tsx --test --test-concurrency=1 --test-reporter=./scripts/test-times.mjs test/e2e/*.test.ts > test/e2e/durations.json

A test counts under the file that defines it: test/e2e/responsive.ts's time is split by hand over the four responsive-<width>.test.ts (its suites phone (390px), … per width).

Tests in one file may depend on each other, never on another test file having run first: a shard starts on a fresh database with only the HR example installed, and which files share a shard changes with the weights. A file must also pass on its own and with --test-name-pattern (a top-level await goes before the first describe; a describe callback is never async: the runner can finish the file while it waits). A test file that takes minutes holds up its shard: split it, as test/e2e/responsive.ts is split into one responsive-<width>.test.ts per width.

The jobs test, e2e and upgrade (v0.31.0) (and upgrade (<newest>)) only gather their shards' results: test, e2e, docker and upgrade (v0.31.0) are the main branch's required checks, so keep those job names.

The releases to upgrade from are the UPGRADE_FROM line at the top of ci.yml, oldest first; the releases job turns it into the upgrade matrix. A pull request runs the oldest and the newest release (whole suite) and the three releases before the newest; a push to main, a pull request from a release-* branch, the nightly run and a manual run (Actions → CI → Run workflow) run every release. Add each new release at the end of UPGRADE_FROM. The releases other than the oldest and the newest run in batches, upgrade (v0.32.0 … v0.49.0): at most four jobs of up to 18 releases, three at a time in a job, each on a PostgreSQL container of its own (sprint 212: a full run has 16 other jobs, and GitHub runs 20 at a time). A batch prints each release's output in a group and fails at the end, naming the releases that failed.

A newer push to a pull request cancels the run still going for it.

CI has no .env and no PostgREST: only the variables in the workflow are set, and the PostgREST HTTP tests skip. To reproduce a CI failure, run the tests in a clean checkout (git worktree add) against a throwaway database with only those variables, and API_URL=http://127.0.0.1:1. A new required environment variable must be added to the workflow.

To try an upgrade locally (once there is an earlier release):

bash
mkdir -p /tmp/old && git archive v0.31.0 | tar -x -C /tmp/old
DATABASE_URL=<empty database> npx tsx scripts/migrate.ts --seed --root /tmp/old
DATABASE_URL=<same database> npm run example:hr && npm test

Adding a region type (example) ​

  1. Migration: allow the type in meta.region's check constraint (new file db/migrations/NNN_…sql).
  2. Types: add it to Region['type'] in src/metadata.ts.
  3. Renderer: write renderX(ctx, region) in src/runtime/x.ts returning html```, and add a caseinrenderRegion() (src/runtime/regions.ts). Run developer SQL through savepoint()and turn errors into messages withpublicError()`.
  4. Builder: add the type to the type options and describe its attributes in the config help (src/builder/components.ts).
  5. CSS: in public/app.css, including the phone breakpoint (max-width: 640px).
  6. Tests: input-handling tests in test/security.test.ts, and a page in the sample so the e2e test covers it at every width.
  7. Docs: chapter 4 and the parity matrix.

Adding an item type follows the same path through meta.item's constraint, ItemType, renderItem() in items.ts, and applyPostedItems() in routes.ts if it posts values differently; server-side format checks go in validate() (engine.ts), the builder's lists in components.ts (type options, attribute help) and ITEM_LABELS in arrange.ts (gallery), and browser enhancements at the end of public/app.js (the item must work without them).

Migrations ​

  • Never change a migration that has been released (tagged). Add a new numbered file.
  • Each file runs in one transaction. Prefer idempotent statements for roles and extensions (do $$ … if not exists … $$).
  • meta.export_app() / meta.import_app() (migration 013) use to_jsonb / jsonb_populate_record, so new columns travel automatically. A new table that references meta.app or meta.page must be added to both functions as a new top-level section (read it with coalesce(p_doc->'section', '[]')), or to NOT_EXPORTED in test/export.test.ts with a reason; that test fails until you do. Redefine the functions with create or replace in the new migration; don't wrap them.
  • Never rename or remove a section of the pgkiln/2 format (see chapter 3).
  • A new table that belongs to an application or references a component must also be listed in src/cli/replace.ts (replaced with the application's definition, or kept as installation data); test/cli.test.ts fails until it is. The directory format (chapter 18) needs no change: unknown sections and columns travel along.
  • (sprint 242) A new column's constant default is what an import gives a hand-written file that leaves the key out (src/import-defaults.ts reads it from the catalog). A column the export leaves out on purpose (installation state, a secret) must also be listed in NOT_EXPORTED there, or such a file would get its default. A new column whose default is the open value for access (no roles, any URL, enabled, off for a second factor) goes in MUST_GIVE, with since: the keys added in the same migration (older exports lack them and keep importing). Add a new application column to the since list of mfa / mfa_roles too.
  • (sprint 251) A migration that changes an allowed-value check (col = ANY (ARRAY[…])), a unique key or meta.condition_ok of an exported table, or the type of a column to/from a number or boolean, makes test/import-errors.test.ts fail until npx tsx scripts/import-schema.ts rewrites src/import-schema.json (what pgkiln advise --offline checks files against). Online imports read the catalog itself. A new table with a SQL condition goes in CONDITION_KEY (src/import-errors.ts).
  • (sprint 201) Grant a new meta table to pgkiln_runtime (or nobody), never to PUBLIC or an application's role: a role with any right on a meta table is powerful (meta.role_reaches_meta), and the workspaces' developer logins read none. A new view for application code granted to PUBLIC must show only the rows of meta.app_id() (or the session) and be added to the allow-list in test/security.test.ts (sprint 201), which fails for any other relation in meta a developer login can use. A new table with secrets, credentials or every workspace's rows gets row level security with the meta_owner_only policy (using ((select meta.meta_owner_member())), migration 175).

Releasing ​

  1. Update CHANGELOG.md and the version in package.json.
  2. Merge to main; CI must be green (every job). The main branch should be protected on GitHub (Settings → Branches → rule for main: require the CI checks).
  3. Tag: git tag -a vX.Y.Z -m vX.Y.Z && git push origin vX.Y.Z. The tag publishes the Docker image (docker-publish.yml: pgkiln/pgkiln and ghcr.io/pgkiln/pgkiln, amd64 and arm64) and the npm package (npm-publish.yml, trusted publishing with provenance; it refuses a tag that doesn't match package.json). Then gh release create vX.Y.Z with the changelog section as notes.
  4. Add the new tag at the end of the UPGRADE_FROM line in .github/workflows/ci.yml (see above): one edit; the releases job derives the upgrade matrix and the full-suite releases from it.

Released under the Apache-2.0 license. Not affiliated with Oracle; Oracle and APEX are trademarks of Oracle.