fix: a credential store holds credentials of one kind, without a kind field in its entries, and the dialog edits several stores in tabs.
Release / release (push) Successful in 19s

This commit is contained in:
slawek committed 2026-10-28 20:57:45 +01:00
1 parent b0b7a4bb7f
commit 7959c90012
9 files changed
+319 -224

No files matched your search

+24 -19
View File
@@ -33,16 +33,17 @@ export default defineConfig(({ mode }) => ({
```
To change the toolkit and an application together, `npm link --no-save` replaces the installed
package with the checkout, the TypeScript source, in each package of the application:
package with the checkout, the TypeScript source, in each package of the application, whatever
version it names. The applications run it for both their packages as `npm run dev-link`:
```sh
npm link --no-save ../sk-react-toolkit
npm --prefix web link --no-save ../../sk-react-toolkit
```json
{ "scripts": { "dev-link": "npm link --no-save --no-fund ../sk-react-toolkit && cd web && npm link --no-save --no-fund ../../sk-react-toolkit" } }
```
`package.json` and the lock file keep the published version; `npm ci` or `npm install` replaces
the link with it again. A change of the toolkit reaches the application through a release of the
toolkit and an update of the dependency.
`package.json` and the lock files keep the published version; `npm ci` or `npm install` replaces
the link with it again, and `npm run dev-link` links the checkout again. A change of the toolkit
reaches the released application through a release of the toolkit and an update of the
dependency.
The peer dependencies are the application's: `fastify` and `@fastify/static` for the server
helpers; `react`, `react-dom`, `@mui/material`, `@mui/icons-material` and Emotion for the web
@@ -88,16 +89,16 @@ code; `vite` for the Vite helpers.
## Credential store
A credential store is a list of credentials in a key of the application's `config.json`, of the
kinds the application gives, such as a database connection or a service principal. Each entry has
a `name`, unique and not one of the store's reserved names, a `kind`, and the fields of its kind:
A credential store is a list of credentials in a key of the application's `config.json`, all of
the one kind the application gives the store, such as a database connection or a service
principal; an application with several kinds has a store, a key, for each. Each entry has a
`name`, unique and not one of the store's reserved names, and the fields of the store's kind:
```json
{
"credentials": [
"pg_connections": [
{
"name": "state",
"kind": "postgresql",
"host": "db.example.com",
"port": 5432,
"database": "platform",
@@ -109,7 +110,8 @@ a `name`, unique and not one of the store's reserved names, a `kind`, and the fi
}
```
A kind (`CredentialKind`) names its fields (`CredentialField`), each by its key in `config.json`,
A kind (`CredentialKind`) has a label for one credential and names its fields
(`CredentialField`), each by its key in `config.json`,
with a label, a help text, a type, `text`, `port`, `guid` or `choice` with its `choices`, whether
it is required, and whether it is secret. `POSTGRESQL_KIND` is the kind of a PostgreSQL
connection: `host`, `port`, `database`, `user`, `ssl_mode` (`disable`, `require` or
@@ -121,7 +123,7 @@ file `ENCRYPTION_KEY_FILE` names, without its final newline. Without either, no
saved or used; a secret encrypted with another key cannot be decrypted and has to be entered
again.
`CredentialStore` describes a store: the path of `config.json`, the key, the kinds, the reserved
`CredentialStore` describes a store: the path of `config.json`, the key, the kind, the reserved
names and whether a missing `config.json` reads as `{}`.
- `credentialProblems(value, store)`: the problems of the key's value by `<key>.<index>.<field>`,
@@ -131,16 +133,19 @@ names and whether a missing `config.json` reads as `{}`.
- `registerCredentialRoutes(app, store, prefix, log)`: `GET <prefix>/read`, `POST
<prefix>/validate` and `POST <prefix>/write`. Read answers the credentials, `CredentialProfile`,
with `values` (the fields that are not secret, as text), `secrets` (null for each secret, never
answered) and `stored` (which secrets are kept), the kinds, the reserved names, the path of
answered) and `stored` (which secrets are kept), the kind, the reserved names, the path of
`config.json`, its version and whether the server has a key. A write takes the version read and
the credentials; a secret is null to keep the secret of the credential named `original`, `''`
for none, or the new secret, which is encrypted. A file that changed since the version read is
409, credentials with problems 422; the other keys of `config.json` are kept.
`CredentialsButton` (`prefix`, `title`, `icon`, `note`, `onSaved`) opens the store's credentials in
a dialog: a list at the left with Add for each kind and Remove, and the fields of the credential
selected, as its kind names them. A secret shows only whether it is kept: Set or Change replaces
it and Remove drops it.
`CredentialsButton` (`stores`, `title`, `icon`, `note`, `onSaved`) opens the credentials of the
stores in a dialog. `stores` lists the prefix of each store's routes and the label of its tab; the
tabs are shown when there are several stores, which share one `config.json`. Each tab has a list at
the left with Add and Remove, and the fields of the credential selected, as the store's kind names
them; a tab with a problem has a red label. A secret shows only whether it is kept: Set or Change
replaces it and Remove drops it. Save writes each store that changed, each write with the version
the previous one answers.
## Development