open-index/open-npm huggingface dataset:
npm package: @saltastro/bulma-plot-container
Description: Web component for displaying plots with extra information
Author: SALT Astronomy
Latest version: 0.1.0

# bulma-plot-container: Plot container for plots with additional information

bulma-plot-container defines web components that let you add plots to your website which display plot information when you hover over them and open a modal with a larger version when you click on them. [Bulma](https://bulma.io) is used for styling.

While the web components are mostly intended for plots, you may use them with any other content, such as images.

This project was motivated by functionality on [ESO's data quality site](http://www.eso.org/observing/dfo/quality/).

## Documentation

You can view the documentation on [Read the Docs](https://bulma-plot-container.readthedocs.io/en/latest/).

## Installation

To use the plot container on a web page, include its JavaScript file in the page header:

```html
<script src="https://unpkg.com/@saltastro/bulma-plot-container"></script>
```

If you prefer serving the JavaScript file yourself, install the package with npm:

```bash
npm install --save @saltastro/bulma-plot-container
```

The file to serve then is `node_modules/@saltastro/bulma-plot-container/dist/index.js`.

## Example

Here is a simple example of using the web components.

```html
<!DOCTYPE html>
<html>
<head>
<script src="https://unpkg.com/@saltastro/bulma-plot-container"></script>
<style>
  .plot {
    width: 300px;
    height: 300px;
    padding: 1em;
    border: solid 1px lightgray;
    color: green;
  }
  
  .large-plot {
    width: 600px;
    height: 600px;
    padding: 1em;
    border: solid 1px lightgray;
    color: blue;
  }
  
  .info {
    padding: 1em;
    border: solid 1px lightgray;
    color: orange;
  }
</style>
</head>
<body>
<plot-container>
  <div class="plot">
    <p>Here would</p>
    <p>be your</p>
    <p>plot</p>
  </div>
  <plot-info>
    <div class="info">
      <p>Here would</p>
      <p>be some info</p>
      <p>about the plot</p>
    </div>
  </plot-info>
  <plot-modal>
    <div class="large-plot">
      <p>Here would</p>
      <p>be a larger version</p>
      <p>of your plot</p>
    </div>
  </plot-modal>
</plot-container>
</body>
</html>
```

Both the `plot-info` and `plot-modal` element are optional.
npm package: @saltcorn/agents
Description: AI agents for Saltcorn
Author: Tom Nielsen
Latest version: 0.7.8

# agents

AI Agents for Saltcorn

To use this plugin:

1. Create an action of type Agent. Configure with system prompt and skills
2. Create a view of type Agent chat, picking that agent in the configuration

The module is currently unstable. Some skills will be moved to other modules which will have to be installed as well.
npm package: @saltcorn/any-bootstrap-theme
Description: Configurable bootstrap layout plugin
Author: Tom Nielsen
Latest version: 0.6.9

![Saltcorn logo](https://saltcorn.com/files/serve/16)
# any-bootstrap-theme

Configurable Bootstrap themes based on [Bootswatch](https://github.com/thomaspark/bootswatch/) for [Saltcorn platform](https://saltcorn.com/)

## Installing / Getting started

[Setting the user interface theme for Saltcorn](https://wiki.saltcorn.com/view/ShowPage?title=Setting%20the%20user%20interface%20theme)

## Developing

```shell
git clone https://github.com/saltcorn/any-bootstrap-theme
```
TODO

## Versioning

We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [link to tags on this repository](/tags).

## Configuration

Click to Configure plugin in Plugin card in Plugins and pack store.

## Tests

Describe and show how to run the tests with code examples.
Explain what these tests test and why.

```shell
Give an example
```

## Style guide

We use [prettier](https://github.com/saltcorn/saltcorn/#prettier).

## Licensing 

The project is licensed under the [MIT License](/LICENSE).
npm package: @saltcorn/bash
Description: Run bash actions in Saltcorn
Author: Tom Nielsen
Latest version: 0.2.5

# bash
Run bash actions in Saltcorn

The `run_bash_script` action allows you to run shell code. It used to be 
restricted to bash scripts, but you can now use any shell interpreter 
(including Python).

### Setting the shell interpreter

If you want to use a different shell interpreter than `bash`, you can set 
the first line to a [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix))

### Accessing the row

If the action is run against a specific row (e.g. as a button in List or 
Show views, or Insert/Update triggers), the fields are used to set environment
variables. These are named `ROW_{field name in upper case}`. For instance, if 
the row contains a field called `name` then the environment variable `ROW_NAME` 
will be set. To access this in a bash script you should proceeded by a dollar sign ($),
for instance:

`echo $ROW_NAME`

### Accessing the user

The environment variables `SC_USER_ID` and `SC_USER_ROLE` are set to the 
user ID and the user's role ID, respectively

### In workflows


To use this in workflows you use environment variables to access 
variables in the context. You cannot use interpolation in the code as this might 
conflict with your chosen shell interpreter.

After the action has completed, the following variables will be set in the context 

* `exitcode`: the exit code as a number 
* `stdout`: the process standard output 
* `stderr`: the process standard error
npm package: @saltcorn/captcha
Description: Bot detection with Captchas
Author: Tom Nielsen
Latest version: 0.1.5

# captcha

Protect forms from bots. Uses svg-captcha underneath, other engines may be added in the future.

## How to use

1. Install this module (captcha in the Saltcorn module store)
2. Create a field in the table where you want to protect row creation of the type `SvgCaptchaCertificate`.
3. In the Edit view on this table, you must include the field with type `SvgCaptchaCertificate` twice:

   - Once with the fieldview `SvgCaptchaImage`: this will show the image and also include a hidden element with an encryption of the solution (using bcrypt)
   - Once with the `SvgCaptchaInput` fieldview: this is where the user will enter the text in the image

   This was split into two fieldviews to give more flexibility to the form design.
npm package: @saltcorn/code-view
Description: Generate Saltcorn view output from code
Author: Tom Nielsen
Latest version: 0.2.1

# js-code-view

Generate view output from JavaScript code.

Configured by writing a script that returns the HTML for the view. This can be either
run on Server or Client Page.

## Example code

Client page code:

Add one to output of a statistics view on the same page:

```
return +$('.TaskUniqueProject').html() +1
```

Server code:

Use `markupTags` to access markup tags, `db` to access database directly, `Table` to find tables. `user` and `req` are also in scope.

Same as above example, run on server (more verbose, same output)

```
const {script, domReady, div} = markupTags

return div({id:"helloworld"})+script(domReady(`
    const taskCount = +$('.TaskUniqueProject').html()
	$('#helloworld').html(taskCount+1)
`))
```
npm package: @saltcorn/docling
Description: onvert document files (PDF, DOCX, PPTX) to Markdown
Author: Tom Nielsen
Latest version: 0.2.3

# docling
Convert document files (PDF, DOCX, PPTX) to Markdown

This module provides an Saltcorn action that uses docling to convert files (PDF, .docx word documents and more) to markdown. 

### Installation

Before the actions can run the module needs to install docling in a new python virtual environment. Please make sure your server is able to create virtual environments. On Debian/Ubuntu this can be done by installing the python3-venv systems package. 

In order to install the virtual environment, configure the Saltcorn docling module. You will see a short message about this installation requirement and then click finish to perform the actual installation. 

### Manual installation

This module will look for a working python venv with docling installed in the saltcorn-docling-env direcotry inside the XDG data directory.
On Debain/Ubuntu this resolves to `$HOME/.local/share/saltcorn-docling-env` where `$HOME` is the home directory of the 
user running Saltcorn. You can check by running `systemd-path user-shared`. To create this manually (i.e. without configuring the module through the 
Saltcorn UI), run these commands:

```
python -m venv $HOME/.local/share/saltcorn-docling-env
$HOME/.local/share/saltcorn-docling-env/bin/pip install docling
```

### Action Usage

To use this module, create a table that has a file field (which will contain the source documents) and a string or markdown field (which will be set to the output of the source documents in markdown format). The link the action `docling_to_markdown` to a button or to a table trigger on this table. In the configuration for this action you should choose the appropriate fields. Running the action will then perform the conversion and set the contents of the string or markdown field.

### Functions usage

The module also provides two functions `docling_file_to_markdown` and `docling_html_to_markdown` which each take a single argument and return a markdown string.

docling_file_to_markdown takes a string containing a file path in your file store and produces markdown

docling_html_to_markdown takes a string containing HTML (this should be a full document with DOCTYPE) and produces markdown.

This module also export two other functions to generate text from HTML:

The function `htmlToText` which is the `htmlToText`
(alias for `convert`) from the [html-to-text module](https://www.npmjs.com/package/html-to-text). This generates text (not markdown) froma single argument which is an html string.

The function `turndown_html_to_markdown` uses the [turndown](https://www.npmjs.com/package/turndown) module to generate markdown from HTML. It takes two arguments, the first is an HTML string, and the second is optional, an object with the [turndown options](https://github.com/mixmark-io/turndown?tab=readme-ov-file#options)

Example for run_js_code action:
```
const md = turndown_html_to_markdown(`<h1>Hello</h1>world`)
console.log(md)
```
npm package: @saltcorn/drawio
Description: Drawing diagrams with draw.io
Author: Tom Nielsen
Latest version: 0.1.4

# draw.io plugin for Saltcorn

Provides an edit fieldview for the HTML data type

Caveats:

- Contacts embedded.diagrams.net when you edit. Unclear what data is shared.
- Diagrams cannot be escaped for Cross Site Scripting (XSS) payloads. you must show diagrams with unsafeNotEscaped HTML fieldview. You should not allow untrusted users to run the editor.
- Can't be used in popup edit forms.
npm package: @saltcorn/editorjs
Description: A Free, Block-Style Editor with Universal JSON Output
Author: RUTAYISIRE MANZI Gerard Valentin
Latest version: 0.1.1

# editorjs

Saltcorn plugin that adds the Editor.js block-style rich text editor with JSON storage and HTML rendering helpers.

## Use

1. Add a JSON field to your table to hold Editor.js data.
2. In a form view, choose the `editorjs` field view for that field to get the block editor UI.
3. In a show/list view, choose the `editorjs_viewer` field view to render the stored content.

## Rendering elsewhere

The plugin exposes a function `editorjs_to_html(content)` that converts stored Editor.js JSON into HTML. Use it in workflows or formulas when you need HTML output.

### Using `editorjs_to_html`

- Automatic field adder: install the HTML plugin for the HTML datatype, add a new field to the table with HTML type, check "Calculated" and "Stored", click Next, and in the Formula input add `editorjs_to_html(content)` (replace `content` with your JSON field name).
- Custom function: create an action in the view configuration that runs `run_js_code` and use `editorjs_to_html(content)` in the Code input, similar to the above approach.
npm package: @saltcorn/fullcalendar
Description: Calendar view plugin
Author: Tom Nielsen
Latest version: 0.5.9

# fullcalendar
Calendar plugin based on [FullCalendar](https://fullcalendar.io/).
For more information, see the [fullcalendar documentation](https://fullcalendar.io/docs).

## Setup
This plugin creates a new viewtemplate which displays a calendar.

You will need a table for your events. It will need several fields:

| Purpose | Type | Required? |
|-|-|-|
| Title of event to display on the calendar | string | yes |
| Time/date the event starts | date | yes |
| Time/date the event ends | date | no |
| Duration of the event (instead of end time/date) | float or int | no |
| Is this an all-day event? | bool | no |
| Color of the event | color | no |

You can also specify an edit view to create new events and a show/edit view to display when the user clicks an event on the calendar.

## Calendar views
When setting up a calendar, you will have the option to specify different view options such as month, week, day, list, etc. You can use any of the default options listed in the "views" section of the [fullcalendar documentation](https://fullcalendar.io/docs).

Advanced users can specify their own [views object](https://fullcalendar.io/docs/custom-view-with-settings). You can use your custom views in the other fields when setting up your calendar. This will be appended to the inside of object under `views`

Example of a custom views object:
```
  myView: {
    type: 'timeGrid',
    duration: { weeks: 1 },
    buttonText: 'My View',
    slotDuration: '00:15:00',
  }
```
npm package: @saltcorn/imap
Description: Sync IMAP folders to tables for inbound email processing
Author: Tom Nielsen
Latest version: 0.3.9

# imap

Sync IMAP folders to tables for inbound email processing.

# how to use plugin

1. Install this module (imap in the Saltcorn module store).
   
2. Configure connection to email server in plugin settings.
   
   ![image](https://github.com/AleksandrSokolov/imap/assets/327030/a0dce3a4-2997-487b-8ada-1ece05e658d0)
   where
   * Username - your email address
   * Password - application password for your email address
   * Host - imap interface hostname of your email server
   * TLS - set if your server uses encryption

3. Create table for use by this plugin.This table will be populated with incomming emais.

   ![image](https://github.com/AleksandrSokolov/imap/assets/327030/cc8e445b-f6f2-4317-9d9c-9c0804ee394a)

   The table needs to have fields:
   * uid_field (Integer) - email id. 
   * subj_field (String - email subject
   * from_field (String)- first "from" address for email
   * file_field (File) - first file attachment for email
   * date_field (String)- email receiving date
   Field names don't matter. The presence of fields and the correct field type are important.

4. Create trigger, e.g. imap:

   ![image](https://github.com/AleksandrSokolov/imap/assets/327030/3e36e4d5-7ae3-454a-a652-993ae8e566cc)

   where
   * Name - name of trigger
   * When - use Often if wants to check mails every 5 minutes
   * Action - use action imap_sync
   * Description - just description if needed

5. Configure trigger

   ![image](https://github.com/AleksandrSokolov/imap/assets/327030/a36d0af9-4933-4202-b07a-a82fa0f4f2bd)

   where
   * Destination table - inbox table. Name can be any.
   * UID field - usuall ID. But can be any Integer field from destionation table.
   * Subject field - email subject field
   * From field - email from field
   * Date field - email receiving date field
   * File field - first attached file from email

6. Run trigger

# implemented Actions

* imap_sync - starts imap sync. 
  
# known limitations

* imap port 993
* only INBOX folder supported
* only first from adress stored
* message text is not supported
* only first file attachment stored
npm package: @saltcorn/js-code-view
Description: Generate Saltcorn view output from JavaScript code
Author: Tom Nielsen
Latest version: 0.1.1

# js-code-view

Generate view output from JavaScript code.

Configured by writing a script that returns the HTML for the view. This can be either
run on Server or Client Page.

## Example code

Client page code:

Add one to output of a statistics view on the same page:

```
return +$('.TaskUniqueProject').html() +1
```

Server code:

Use `markupTags` to access markup tags, `db` to access database directly, `Table` to find tables. `user` and `req` are also in scope.

Same as above example, run on server (more verbose, same output)

```
const {script, domReady, div} = markupTags

return div({id:"helloworld"})+script(domReady(`
    const taskCount = +$('.TaskUniqueProject').html()
	$('#helloworld').html(taskCount+1)
`))
```
npm package: @saltcorn/ldap-auth
Description: Authentication with LDAP
Author: Tom Nielsen
Latest version: 0.1.8

# ldap-auth

LDAP/Active Directory Authentication for Saltcorn

to test with public server, use these settings:

Server URL: ldap://ldap.forumsys.com
Bind DN: cn=read-only-admin,dc=example,dc=com
Bind Credentials: password
Search Base: dc=example,dc=com
Search Filter: (uid={{username}})

then log on as

uid: euler
password: password

see https://www.forumsys.com/tutorials/integration-how-to/ldap/online-ldap-test-server/
npm package: @saltcorn/leaflet-map
Description: Leaflet map view templates
Author: Tom Nielsen
Latest version: 0.2.3

# leaflet-map
A view plugin that: 
- adds an openstreetmap map and markers from a table having latitude and longtitude fields (both of type Float)
- can popup a show view at eack marker
- can limit the number of markers (row) shown on the map
npm package: @saltcorn/markmap
Description: Mark map field-view for Saltcorn
Author: RUTAYISIRE MANZI Gerard Valentin
Latest version: 0.1.0

# Mark Map Field View

A simple field view that renders Markdown content as an interactive mind map. Works in Show and List views and supports light and dark modes.

## When to use

- Field type: Markdown
- Views: Show and List

## Usage

1. Ensure your data field is of type Markdown.
2. In your Show or List view configuration, select "Markmap" as the renderer for that Markdown field.
3. Optionally adjust the configuration (see below).

## Configuration

- height: number or CSS size for the map container (default: 400)
- initialExpandLevel: Initial expand level (default: 2)
- fit: true | false — fit to container on load (default: true)
- toolbar: true | false - show/hide toolbar (default: true)
- zoom: true | false (default: true)
- pan: true| false (default: true)
- d3Scheme: List of d3 Categorical schemes 

## Dark & Light mode

- Auto mode follows the app/system theme.
- Override by setting theme to "light" or "dark".
npm package: @saltcorn/mauapay
Description: Payment processing with Mauapay
Author: Tom Nielsen
Latest version: 0.2.4

# Mauapay Saltcorn module

To use this module:

1. Install in your Saltcorn Application from the module store. You will be prompted for the publishable
   API key and the secret API key. Enter this as you find them in the Mauapay account business information.

2. Create a table to represent payment requests. This should have the following fields:

   - A Float field for amounts
   - a String fields for the transaction reference ID
   - Either a Bool Field for whether the transaction has succeeded (payment made), or a String field for status. You can also have both of these fields

3. Create at least one Show view on this table. This is the view that will be shown when a transaction has finished
   and has been verified as succeeded/failed/cancelled etc.

4. Create a view on this table with the pattern `MauaPay Callback`. This needs to be configured with the fields on your table and you also need to select the show views the user will be directed to in case of success/failure/cancellation

5. Create an Insert trigger on this table with the `mauapay_payment_request` action type. This needs to be configured with the fields and with the call back view that you created above

6. Create an Edit view on this table, or find some other way of inserting rows in the table. Now whenever a row is inserted it will perform a payment request. If you are inserting this using some other method then edit forms, we may need to test it and see if it works. I have only tested with Edit views
npm package: @saltcorn/mcp-server
Description: MCP server plugin for Saltcorn
Author: Christian Hugo
Latest version: 0.1.0

# mcp-server

Expose Agent triggers as MCP tools callable by any AI client.

Requires the [agents](https://github.com/saltcorn/agents) plugin.

## How it works

Agent triggers with `when_trigger` set to **API call** are exposed as MCP tools. This is required because only API call triggers have a **Minimum role** setting, which controls which users can see and invoke the tool.

## Endpoint

```
POST /mcp
GET  /mcp
```

The endpoint is stateless and uses the [Streamable HTTP](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#streamable-http) MCP transport.

## Authentication

Requests must include a valid API token as a bearer token:

```
Authorization: Bearer <your-api-token>
```
npm package: @saltcorn/multi-file-upload
Description: A Saltcorn plugin to upload multiple files.
Author: RUTAYISIRE MANZI Gerard Valentin
Latest version: 0.1.1

# Multi File Upload View Template

This plugin provides a **Multi file upload** view template for Saltcorn. It lets users upload several files into a child table linked to the current record, show existing files, and optionally delete both the child rows and the stored files.

## Requirements

1. **Parent table** – the view belongs to the table that holds the main record (e.g. `projects`).
2. **Child table** – a table that stores files (e.g. `project_files`) with:
   - a foreign-key field pointing to the parent table
   - a `File` or `File[]` field for the uploaded file(s)

Once this relation exists, it will be selectable when configuring the view.

## Configure the view

Key options in the view configuration:

- **Child relation** – which foreign key links to the parent record.
- **File field** – which `File`/`File[]` column stores the uploads.
- **Upload folder** – optional subfolder in the Files area.
- **Minimum role to read files** – access level for uploaded files.
- **Upload UI** – choose between multiple file input, drag & drop, or FilePond.
- **Show existing files** – list current child rows above the uploader.
- **Allow deleting files** – show a delete icon next to each file.
- **Remove stored file when deleting** – also delete the underlying file from storage.

## How to use

1. Create the parent and child tables and their relation.
2. Create a new view of type **Multi file upload** on the parent table and configure it.
3. Embed this **Multi file upload** view into the parent table's **Show** or **Edit** view where users should upload files.
4. Save a parent record, then upload files; check that the list updates and deletion behaves as expected.
npm package: @saltcorn/mysql-tables
Description: Table provider for remote MySQL and MariaDB tables
Author: Tom Nielsen
Latest version: 0.1.0

# mysql-tables
Table provider for remote MySQL and MariaDB tables

This module contains a Saltcorn table provider for remote MySQL and MariaDB tables. Use this to access a table on a different database as if it were a normal Saltcorn table.

There are two ways of setting up a remote table:

* The standard way is to create a table and select the "MySQL remote table" as the table provider. In the configuration, you will on the first screen select the database connection parameters (host URL, port, username, password, database name, and table name). On the second page you can adjust the fields that have been guessed from connecting to the database. This way works fine if you are only importing a single table.

* If you are importing multiple tables and there are relations between them, it is easier to run the "MySQL Database Explorer" view, which is only available to the administrator and will be in your list of views. Here you also enter the database connection parameters, but not the table name. When you have entered the other connection parameters, press "Look up tables" and a list of the tables will appear. Here, select all of the tables you would like to import and then click "Import tables". This means you don't have to enter the connection parameters multiple times, and it will also correctly set up any relations as foreign key fields between the imported tables.

If you have added fields to the remote table after doing an import, simply use the "MySQL Database Explorer" to import these tables again. The list of fields will be updated.

If you would prefer not to have your database connection password stored in the database you can set this up as an environment variable, as indicated on the sublabel for the password connection parameter. You should set the `SC_EXTMYSQL_PASS_{database name}` environment variable. For instance, if your database is called `testdb1` then set the `SC_EXTMYSQL_PASS_testdb1` environment variable.

## Query function

This module also provides the `extMySqlQuery` function for use in code actions. It takes a connection object, an SQL query string, and optionally an array of parameters. Queries are executed in a read-only transaction for safety. Example usage:

```javascript
const result = await extMySqlQuery(
  { host: "db.example.com", port: 3306, user: "reader", password: "secret", database: "mydb" },
  "SELECT * FROM orders WHERE status = ?",
  ["pending"]
);
// result.rows contains the query results
```
npm package: @saltcorn/nominatim-geocode
Description: Geocoding with Nominatim
Author: Tom Nielsen
Latest version: 0.2.0

# nominatim-geocode

Geocoding with Nominatim from OpenStreetMap

Available from the Saltcorn store as "nominatim-geocode"

This plug-in supplies functions for geocoding (converting addresses to latitude and longitude coordinates) for use in Saltcorn calculated functions.

Two functions are supplied: `geocode_lat` and `geocode_long`. These two functions are identical in their arguments and operation and differ only in that the former returns latitude and the latter returns longitude. Both functions:

- are asynchronous and therefore must be used in a stored calculated field
- Expect as argument an object with valid query parameters to the API

This can be as vague as `{ q: address }` or can contain more structure:
`{country: 'de', postalcode:'10115', street: 'Somestreet XX'}`. See the documentation for the underlying node library [nominatim-geocoder](https://www.npmjs.com/package/nominatim-geocoder), the official [Nominatim search API documentation](https://nominatim.org/release-docs/develop/api/Search/) and examples below.

These functions use the underlying Nominatim API, which is rate limited. If you are adding the stored field to a table with many existing rows, you may see that the fields will be filled out slowly (at a rate of one per second).

Although to calculate a geographical location two function invocations are required, in practice only one API call is made because calls with identical arguments are cached.

To use this library, you must create two stored calculated variables of type Float, and call the `geocode_lat` and `geocode_long` functions in the formula.

Example: In this example we are converting UK postcodes to latitude and longitude so they can be displayed on a map. The table of interest has a field of type String named `postcode` containing the full UK postcode, a 6 to 7 digit string.

We add two stored calculated fields labelled `lat` and `long`, with these formulae:

- `lat` formula: `geocode_lat({country: 'uk', postalcode: postcode })`
- `long` formula: `geocode_long({country: 'uk', postalcode: postcode })`
npm package: @saltcorn/overlays
Description: View overlays
Author: Tom Nielsen
Latest version: 0.1.1

# overlays

View overlays

This module enables to you run a view as a static overlay on pages and views in Saltcorn. It supplies an action `display_view_overlay` that causes an overlay to appear on the current view.

To use this as a PageLoad action, Saltcorn 1.4.0-beta.5 or later is required. Otherwise use it as an On Page Load action inside specific views or pages, or in response to button clicks. 

To use this with PageLoad:

1. Build a view you would like to serve as an overlay on pages and views. Ideally, this should have all of its content on a card or a container with a a set background - otherwise it will appear transparent. Also set the height and the width in the box settings.
2. Create a trigger with When = PageLoad, action = display_view_overlay.
3. In the trigger configuration, select the view. You can enter a show-if formula and a formula for the state of the view.

In scope for the formulas is whatever the payload (row) is for your trigger. For PageLoad, this includes: `type`, which is `"page"` or `"view"`. `name`, the name of the current page. `query`, the view state in object form. But if you run the action with a different *when* trigger, the row is in scope.

The variable `url` is always in scope in the formulas, this is the relative url (e.g. `"/view/myview?id=1"`)
npm package: @saltcorn/page-to-pdf
Description: Generate PDF from page
Author: Tom Nielsen
Latest version: 0.6.2

# page-to-pdf

This plugin requires Google Chrome or Chromium to be installed. It will look in

`/usr/bin/chromium-browser`

and

`/usr/bin/chromium`

for a Chromium executable. On Ubuntu this will be satified by the `chromium-browser` package:

`sudo apt install chromium-browser`.

This is already installed on the DigitalOcean Marketplace Saltcorn 0.6.0+ droplet.

If these are not found it will default to Puppetter's standard Chromium/Google Chrome search path. For instance, it works on macOS with Chromium installed.
npm package: @saltcorn/paypal
Description: Payment processing with Paypal
Author: Tom Nielsen
Latest version: 0.1.3

Paypal module for Saltcorn
==========================

BETA RELEASE - IN DEVELOPMENT

To use this module:

1. Install in your Saltcorn Application from the module store. You will be prompted for the Client ID and Client Secret, and set mode to Live or Sandbox.

2. There should be a table for either products or transactions (or both). If you run
the payment on a transaction table you can better track if the payment was successful
inside Saltcorn.

3. Create view on this table with the view pattern `Paypal Callback`. Fill the field
that will be set if the payment is successful, and pick the destination views for
successful and failed payments (on the same table, so you should create a Show view 
for these outcomes).

4. Create an action (in a view, or insert triggger) of type `paypal_create_payment`.
Pick the callback view created above, and the amount and currency. Amount can be a field
or a formula. If it is a formula, you can use join fields to access the amount on another table, e.g. if you have a transaction table with a key field to the products table.

5. Encourage your users to click the button created in step 4.

6. Profit!
npm package: @saltcorn/pgvector
Description: Vector embeddings type for Saltcorn
Author: Tom Nielsen
Latest version: 0.2.0

# pgvector

Vector embeddings type

## Installation.

You must install the pgvector postgresql module. see https://github.com/pgvector/pgvector for full instructions.

```
cd /tmp
git clone --branch v0.6.2 https://github.com/pgvector/pgvector.git
apt-get install postgresql-server-dev-all #may need sudo
cd pgvector
make
make install #may need sudo
```

Restart PostgreSQL

then you must run `CREATE EXTENSION vector;` as the postgres user on your database

```
root@regqa:~# sudo -iu postgres psql -d saltcorn
psql (15.6 (Debian 15.6-0+deb12u1))
Type "help" for help.

saltcorn=# create extension vector;
```
npm package: @saltcorn/plain-date
Description: PlainDate: Date without time and timezone, drop-in compatible with Date
Author: Tom Nielsen
Latest version: 0.2.5

# @saltcorn/plain-date

@saltcorn/plain-date is a JavaScript class for representing plain dates (no time or
timezone information). It is designed to be drop-in compatible with JavaScript's Date
class.

```javascript
const PlainDate = require("@saltcorn/plain-date");

let today = new PlainDate();
today;
// => PlainDate { year: 2025, month: 7, day: 29 }
today.toISOString();
// => '2025-07-29'
today.setDate(13);
// => 1752361200000
today.toISOString();
// => '2025-07-13'
today.toLocaleDateString();
// => '7/13/2025'
```

Run `plain_date.toDate()` to get the Date object for midnight in the ¯\\\_(ツ)\_/¯ timezone.

### Parsing Dates from pg

To parse dates from PostgreSQL with PlainDate, add this to your code:

```javascript
const PlainDate = require("@saltcorn/plain-date");
var types = require("pg").types;
types.setTypeParser(types.builtins.DATE, (d) =>
  d === null ? null : new PlainDate(d)
);
```

### Limitations

If you pass timezone information in a date string to PlainDate.parse or new PlainDate, and this is a different timezone to the computer's timezone, you could get a date shift.

Missing methods: `toUTCString`
npm package: @saltcorn/playwright-benchmark
Description: Benchmarks and load testing with playwright
Author: Tom Nielsen
Latest version: 0.1.3

playwright-benchmark
====================

Benchmark or load test a web application using a real browser environment. 

### Example

```javascript
const PlaywrightBenchmark = require("@saltcorn/playwright-benchmark");

const pb = new PlaywrightBenchmark({
  // (optional) baseUrl will be added to all urls in pages
  baseUrl: "http://localhost:3000",
  // use startSession to acquire a login session/cookie
  async startSession({ page }) {
    // note that baseUrl is not added here
    await page.goto("http://localhost:3000/auth/login");
    await page.fill('input[name="email"]', "admin@foo.com");
    await page.fill('input[type="password"]', "AhGGr6rhu45");
    await page.click('button:has-text("Login")');
  },
  // the pages we will benchmark.
  pages: [
    {
      // the URL. baseUrl will be added
      url: "/view/authorlist",
      // the page need to contain this string (and status 200) to be considered load
      contains: "Leo Tolstoy",
      // timeout in ms. optional, default 30000
      timeout: 60000,
    },
    { url: "/view/BookTabulator", contains: "Leo Tolstoy" },
  ],
});

// run the test
(async () => {
  await pb.run({
    // how many times to visit each page per thread
    ntimes: 5,
    // number of concurrent threads
    concurrency: 1,
  });
  //print the results
  console.table(pb.calc_stats());
  //print the on-page errors
  console.log(pb.url_errors);
})();

```
npm package: @saltcorn/postgres-tables
Description: Table provider for remote PostgreSQL tables
Author: Tom Nielsen
Latest version: 0.2.1

# postgres-tables
Table provider for remote PostgreSQL tables

This module contains a Saltcorn table provider for remote postgresql tables. Use this to access a table on a different database as if it were a normal Saltcorn table.

There are two ways of setting up a remote table:

* The standard way is to create a table and select the "PostgreSQL remote table" as the table provider. In the configuration, you will on the first screen select the database connection parameters (host URL, port, username, password, database name, schema and table name). On the second page you can adjust the fields that have been guessed from connecting to the database. This way works fine if you are only importing a single table. 

* If you are importing multiple tables and there are relations between them, it is easier to run the "PostgreSQL Database Explorer" view, which is only available to the administrator and will be in your list of views. Here you also enter the database connection parameters, but not the table name. When you have entered the other connection parameters, press "Look up tables" and a list of the tables will appear. Here, select all of the tables you would like to import and then click "Import tables". This means you don't have to enter the connection parameters multiple times, and it will also correctly set up any relations as foreign key fields between the imported tables.

If you have added fields to the remote table after doing an import, simply use the PostgreSQL database explorer" to import these tables again. The list of fields will be updated.

If you would prefer not to have your database connection password stored in the database you can set this up as an environment variable, as indicated on the sublabel for the password connection parameter. You should set the `SC_EXTPG_PASS_{database name}` environment variable. For instance, if you database is called `testdb1` then set the `SC_EXTPG_PASS_testdb1` environment variable.
npm package: @saltcorn/rag
Description: Actions for Retrieval-Augmented Generation
Author: Tom Nielsen
Latest version: 0.1.5

# rag
Actions for Retrieval-Augmented Generation

This module provides actions for implementing retrieval augmented generation in saltcorn.

### chunk document action

This action will break a larger markdown document into chunks and insert them on a related table. It is configured by selecting the field that has the entire document,  an inbound table and a text field on the inbound table which will contain the text chunks. You also select the chunking strategy but there is currently only one strategy, to split the document into paragraphs.

You could set this up as an insert trigger on a table.

### get embedding action 

This action will calculate the vector embedding for a piece of text and place it on a field on the same table that contains the field with the text. The action is configured by choosing the text and the vector field, and also has an option for overriding the LLM model and endpoint configuration.

It is recommended that you create a table with one text field and one vector field and select this as an action for an insert trigger on this table.
npm package: @saltcorn/record-and-rerun
Description: Record and rerun user interactions in Saltcorn applications
Author: Christian Hugo
Latest version: 0.1.16

# record-and-rerun
This plugin allows you to record user interactions (navigations, clicks and keypresses) on a page, store them in the database and rerun them later using the playwright framework. This way you can easily create automated tests (*or benchmarks*) based on real user interactions.
## System requirements
This plugin requires **Playwright** on your server.  
Playwright needs several system libraries that must be installed with `sudo`.

While configuring the plugin, you will see a button *Install Playwright*, but this only works if all dependencies are fulfilled. 
You can ensure this by running:

    sudo npx playwright install-deps

and click the button. Or alternatively, install everything on your own:

    sudo npx playwright install-deps
    npx playwright install
## Plugin configuration
In the plugin configuration you have an option to set up the standard Tables, Views and Actions. 
### Database schema
The table-schema looks like this:

![Session overview](./docs/standard-tables.png)

* **session_recordings**: For each recorded session you get a row in `session_recordings` with the name and session type (web or mobile)  
  *Note: mobile support is still experimental.*
* **session_events**: The actual events are stored in `session_events` in a JSON field.
* **session_runs:**: When you do a rerun (or benchmark), a row in `session_runs` is created. Important fields:
  - success: `Boolean` field indicating if the run was successful
  - html-report: `File` field storing the HTML report generated by Playwright
  - benchmark_results: `JSON` field storing the benchmark results if was a benchmark run

### Views
The following views are created:

* **Sessions Recorder**: View to start or stop recording sessions.  
  When you start a recording, the current user is logged out and redirected to `/`.  
  Make sure the user who initiates the recording has an **API token** configured.  
  This token is used to upload the recorded events, and it works even if the user being recorded (after the logout) does **not** have access rights to the `session_events` table.
* **Sessions List**: This view lists all recorded sessions and provides buttons to either rerun a session or run a benchmark.  
  The rerun button triggers the `rerun_user_workflow` action, while the benchmark button uses the `benchmark_user_workflow` action.
* **Session Events List**: In this view you can see the recorded events as JSON data.
* **Session Runs List**: Shows the results of a rerun (HTML report and success flag).
* **Session Benchmark Runs List**: Shows the results of a benchmark run (benchmark results as JSON and success flag).
npm package: @saltcorn/saml-auth
Description: Authentication with any SAML identity provider
Author: Christian Hugo
Latest version: 0.1.0

# saml-auth
Authentication with any SAML identity provider

This plugin adds the [passport-saml](https://github.com/node-saml/passport-saml) passport strategy to your server.

To select certificates and private keys, please create a 'certs' folder at the root of your saltcorn file system and upload them there. Please make sure at least v0.9.0-beta.2 is installed.
npm package: @saltcorn/select2
Description: Typeahead fieldviews based on select2
Author: Tom Nielsen
Latest version: 0.7.7

# select2

Typeahead fieldviews based on select2

### Moving the input box

you can move the input box with CSS. Try this for you custom CSS in application settings

```css
.select2-dropdown--below {
    top: -2.8rem;
}
```

[Source](https://stackoverflow.com/questions/31556402/select2-change-container-position/31969103#31969103)
npm package: @saltcorn/signature-pad
Description: Record signatures to file images
Author: Tom Nielsen
Latest version: 0.3.1

# signature-pad

Record signatures to file images, based on the [signature_pad library](https://github.com/szimek/signature_pad)

## How to use

1. Install the signature-pad in Saltcorn version 0.8.6-beta.5 or later
2. In a table, create a field with type "File". We will assume this is called Signature but it can called anything
3. Create an Edit view for your table
4. Click on the Signature field that is already generated. It will show a normal file choose.
5. Change the field view to "Signature Pad" in the field settings.
6. Optionally, set the folder you would like the signature of files to be put in.

Thats it! Now when you save the form, the signature is added as PNG file and linked in the table row.

If you are modifying an existing Edit view, just drop a field into the canvas in the builder, change field to Signature (or whatever you called the signature field) and change the fieldview to Signature Pad
npm package: @saltcorn/sklearn-regression
Description: Regression models for Saltcorn
Author: Tom Nielsen
Latest version: 0.4.1

# sklearn-regression

Regression models for Saltcorn based on scikit-learn.

## Installation

This requires Python 3.x to be available as `python3` in your environment. In
addition, install the following modules with `pip`:

```
pip install pandas scikit-learn nbconvert jupyter matplotlib
```

You may also need Pandoc installed, on Debian/Ubuntu run:

```
sudo apt install pandoc
```

Finally, install this module (sklearn-regression) in your Saltcorn
instance from the module store.

## Creating a model

After you have installed at least one module (for instance, this module)
that provides model patterns, you can create models based on tables. Scroll
all the way down to the bottom of the table settings page and there will be a
section for models, where are you can add a new model. To configure and run
a new predictive model you need to create two types of entities:

- You need to first create a _model_, which specifies the predictors and
  the outcome variables, and also the class of regression model (Linear,
  Lasso etc) you would like to use.
- Then for each model you need to define at least one _model instance_. The
  model instance will set particular values for the hyperparameters, if any.

When you create a model instance it will be trained on all the data in the table.
It will give values for an accuracy score which can be compared across different
model instances and different models, in this case R^2 which can be used to
compare all regression models.

Running a model ionstance also produces a report which is generated from Jupyter
notebook. This gives some more details and diagnostic plots to help you assess the model fit quality.

## Making predictions

Predictions can be made either by using functions, or by adding a calculated
field. The calculated field is the easiest as if it does not involve entering
a formula.

Create a new stored calculated expression of a Float type on the table on which
you have run a model instance. On the first settings page for the new field,
there is a drop-down box at the top where you can choose the formula of the
calculated field value. The default value is "JavaScript expression", change this
to "Model prediction". Then you will be able to choose a model, model instance
and the prediction required.
npm package: @saltcorn/smartcore-js-linux-arm-gnueabihf
Description: Template project for writing node package with napi-rs
Latest version: 0.2.20

# `@saltcorn/smartcore-js-linux-arm-gnueabihf`

This is the **armv7-unknown-linux-gnueabihf** binary for `@saltcorn/smartcore-js`
npm package: @saltcorn/sql
Description: Actions and views based on SQL
Author: Tom Nielsen
Latest version: 0.6.1

# sql

Actions and views based on SQL

### SQLView view

Use this view to create HTML code views of the results of arbitrary SQL queries

1. Create a view of this type.
2. Set output type = Table or JSON to begin with
3. Start by creating your SQL query with no qualifiers (which will come from the URL query state). The preview table should update as you type
4. When you are happy with the SQL query, switch to output type = HTML
5. Create your HTML code, use `{{ rows }}` to access rows. For instance if your query is an aggregation with a single row result (e.g. `SELECT COUNT(*) FROM...`), access this with `{{ rows[0].count }}`, for example `<h2>{{ rows[0].count }}</h2>`. You can also loop, e.g. `{{# for(const row of rows) { }}`
6. When you are happy with both you are SQL and HTML code, Think about whether you need any parameters from the state. List these comma-separated, in order and use in the SQL code as `$1`, `$2` etc. Example SQL code: `select * from _sc_config where key = $1;`

### run_sql_code action

This action allows you to run arbitrary SQL. You specify values from the row that needs to be included in the query using positional parameters `$1`, `$2` etc.

### SQL query table provider

This will give you a Saltcorn "virtual table" based on an SQL
query and specifying result fields (these will be guessed from the query
result, but you need to check and assign a primary key).

Normally you don't need to worry about the where clause when this is
filtered by one of the columns in a view. Your query will be parsed,
and the appropriate where clause will be inserted before the final query
is run.

There are some very specific cases in which you need to include information
about the user in the query in a way that cannot be done in the normal way by state filtering. In this case, you can use string interpolation to include information about the user. For instance:

```
... where baz in (select id from zubs where user_zub = {{ user.myzub }} ) ...
```

User row values used in this way are automatically escaped by the
[sqlstring](https://www.npmjs.com/package/sqlstring) to prevent SQL
injection.
npm package: @saltcorn/svg-icons
Description: Use SVG files as icons
Author: Tom Nielsen
Latest version: 0.1.2

# svg-icons
Use uploaded SVG files as icons

1. Upload your SVG icons to the Saltcorn file store. Set permission to access to public
2. In the configuration for this module, enter your SVG icons. Each has a short identifier (no spaces), and you have to enter the path to the file in the file store. For instance if you have uploaded a file called coffee.svg im the root of the filestore, enter coffee.svg for the SVG file path. In the future we will make it so you pick the file

you may have to restart Saltcorn after editing the module config :-( - this will be fixed.

You should now be able to pick your SVG files as icons in the builder.