# Installation and setup

The steps to set up db2kit in an application, then the everyday tasks: add a table or a view, add a stored procedure, follow a catalog change, update db2kit. Each step links to its reference page.

| Step                                                   | Section                                           |
| :----------------------------------------------------- | :------------------------------------------------ |
| 1. Install db2kit and `ibm_db`, then `npx db2kit init` | [Install](#install)                               |
| 2. Write the two configurations, CLI and application   | [Configure](#configure)                           |
| 3. Check the connection and the catalog access         | [Check](#check)                                   |
| 4. Add a table or a view                               | [Add a table or a view](#add-a-table-or-a-view)   |
| 5. Add a stored procedure                              | [Add a stored procedure](#add-a-stored-procedure) |
| After a catalog change                                 | [Follow the catalog](#follow-the-catalog)         |
| New db2kit version                                     | [Update db2kit](#update-db2kit)                   |

## Requirements

| Item                | Requirement                                                                             | Why                                                                  |
| :------------------ | :-------------------------------------------------------------------------------------- | :------------------------------------------------------------------- |
| Node.js             | 22.12 or later                                                                          | Native TypeScript support for the config file, `process.loadEnvFile` |
| `ibm_db`            | 4.x, installed in the application                                                       | Native Db2 driver. db2kit declares it as a `peerDependency`          |
| Db2 Connect license | Required for Db2 for z/OS                                                               | Without it, the connection fails with SQL1598N                       |
| Db2 privileges      | `SELECT` on application tables, read access to the `SYSIBM` catalog for code generation | `doctor` checks catalog read access                                  |

## Install

```sh
npm install db2kit ibm_db
npx db2kit --version          # the version the application really loads
```

db2kit is published on npm as a stable version since 1.0.1, under the `latest` tag: `npm install db2kit` finds it. `package-lock.json` records the exact version and its checksum, so the CI and every developer install the same build. Every version is published from a build that passed `npm run check` (typecheck, unit tests, build, then the built package as applications load it): `prepack` runs it before `npm publish` and `npm pack` alike.

Without access to the npm registry (a closed network), or to try a version not published yet, install the archive produced by `npm pack` in the repository of db2kit:

```sh
# in this repository
npm pack                     # writes db2kit-<version>.tgz (ignored by git)

# in the application
npm install ./vendor/db2kit-<version>.tgz ibm_db
npx db2kit --version          # the version the application really loads
```

Keep the archive in the application repository (for instance `vendor/`): `package.json` then refers to it by path, `package-lock.json` records its checksum, and the CI and every developer install the same file. New versions: [Update db2kit](#update-db2kit).

Then, before anything else, and before a code assistant works on the project:

```sh
npx db2kit init               # db2kit.config.mts, and the db2kit section of AGENTS.md
```

Then, in order: the connection in `.env` and `npx db2kit doctor` ([Check](#check)), the application reading the configuration ([Configure](#configure)), and the objects of the first feature, one at a time, with `npx db2kit add` ([Add a table or a view](#add-a-table-or-a-view), [Add a stored procedure](#add-a-stored-procedure)).

`init` writes `db2kit.config.mts` when the project has no configuration file: valid as it is, each option said in one line, those to decide left as comments (`defaultInputs`, `fieldStatus`), then says what comes next: the variables of the connection in `.env`, then `doctor`. It never overwrites a configuration file. It also writes, in the instruction file code assistants read, the rules none may break (never open `.env`, never try a login again after a refused one, never generate more than the objects a person named) and where the documentation is. Without it, an assistant sees nothing of db2kit until the first `generate`, and the first thing it does may be to generate a whole schema. It opens no connection: it runs before the configuration exists ([cli.md](cli.md#init)).

`ibm_db` downloads the IBM clidriver at install time. If your network blocks it, install a clidriver separately and set `IBM_DB_HOME` before `npm install` (see the ibm_db documentation).

The clidriver is a native library: run `npm install` on the system that runs the application, or in its image, never copy `node_modules` from another machine. It also needs a recent glibc. On an older server, the first connection fails with `ibm_db is installed, but the system refuses its native library: ... GLIBC_2.xx not found`, and `npx db2kit doctor` says the same on its `Module ibm_db` line. Compare with `ldd --version` on the server. ibm_db 4 downloads its latest clidriver unless told otherwise: install it again with an older one that the server takes: the Linux x64 clidriver v11.5.9 needs at most `GLIBC_2.14` in every library it ships, v12.1.2 `GLIBC_2.34` (checked with the line below). To ask nothing of the server, write the choice in the `.npmrc` of the application, committed: `clidriver=v11.5.9`. npm hands it to the installer of ibm_db on every `npm install` and `npm ci`, on every machine (npm 11 warns about a key it does not know, and installs all the same). For one install only: `CLIDRIVER_DOWNLOAD_VERSION=v11.5.9 npm install ibm_db` (PowerShell: `$env:CLIDRIVER_DOWNLOAD_VERSION = "v11.5.9"` first), or `IBM_DB_HOME` set to a clidriver already installed before `npm install`. The newest glibc a clidriver needs: `objdump -T node_modules/ibm_db/installer/clidriver/lib/libdb2.so.1 | grep -o 'GLIBC_[0-9.]*' | sort -uV | tail -1`, to compare with `ldd --version`. A client license file (below) goes into the clidriver installed this way. The other way out: a system with that glibc or later (a more recent base image).

## Db2 Connect license

Two options, to check with your mainframe team:

- **Server-side activation**: the z/OS subsystem is activated, nothing to do on the client.
- **Client license file**: copy `db2consv_zs.lic` into `node_modules/ibm_db/installer/clidriver/license/`. Repeat this step in the production Docker image.

If another Node.js tool already connects from your workstation, the license is in place there. Check that it is also in place in the production image.

## Docker

The image needs `make`, `gcc`, `g++` and `python3` to build `ibm_db`, plus `libxcrypt-compat` if the build fails on `libcrypt`. Alpine is not supported by `ibm_db`.

## Configure

One configuration file, `db2kit.config.mts` at the root of the project, read by two programs ([configuration.md](configuration.md) has every key). `npx db2kit init` writes it when the project has none:

| Program                                                             | Reads it                                            | Takes from it                                                                                                                                                  |
| :------------------------------------------------------------------ | :-------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| the CLI: `generate`, `check`, `list`, `describe`, `probe`, `doctor` | at each command, in its own process                 | everything, but it always connects read-only, sends no audit event, reads the catalog one statement at a time, and loads the environment file of `cli.envFile` |
| the application: `findMany`, `call`, `$transaction`                 | when it creates its client, with `loadConfigFile()` | everything but `cli` and `codegen`. It loads no environment file: it loads its own environment, as it already does                                             |

So the application never holds a copy of the configuration, which would drift from the one the descriptors and outcome rules were generated with. The file is code, read when each program starts: a value that changes with the environment (the size of the pool, read-only mode) is read there from the environment variables of the process.

**1. The file**, `db2kit.config.mts`. The `.mts` extension loads it as an ES module even in a CommonJS project (NestJS). It imports `db2kit` and, by relative paths, files of the project: no application path alias, no NestJS, since the CLI loads it alone ([configuration.md](configuration.md#the-settings-of-the-application-inside-its-build) for settings compiled with the application). Only TypeScript that Node.js can strip: no `enum`, no `namespace`.

**One configuration, two module systems.** A CommonJS application (NestJS compiles to CommonJS) `require`s db2kit, and its `db2kit.config.mts`, an ES module, `import`s it: Node.js then loads db2kit twice, once per module system. The command line adds a third copy, its own, and loads the configuration through the package. They work as one, from db2kit 0.33.0: what one copy builds carries a global mark (`Symbol.for`) that every copy reads, and the copy that receives it checks it again by its own rules (a `procedures.fieldStatus` built in the configuration file, a codec, `sql`, a named query); an error thrown by one copy is an `instanceof` of the same class of the other (`Db2InputError` of one is a `Db2UsageError` of the other). Nothing to write in the application. `npx db2kit doctor` lists the copies of its process, and warns when their versions differ: a project installs one version, and runs `npx db2kit`, the command line of that version.

```ts
import { connectionFromEnv, defineConfig } from 'db2kit';

const production = process.env.NODE_ENV === 'production';

export default defineConfig({
  // Names of the variables, never their values (configuration.md).
  connection: connectionFromEnv('DB_APP'),
  // Sized from the load (production.md, Pool size). The CLI uses one connection whatever max.
  pool: { max: production ? 8 : 2, min: 1 },
  // The name the DBA sees for the application, and for the commands of the CLI.
  audit: { applicationName: 'my-api' },
  codegen: { outDir: 'src/db2/generated' },
  // The environment file every command of the CLI loads, relative to this file. The
  // application ignores it.
  cli: { envFile: '.env' },
});
```

**2. The application** reads it when it creates its client. With NestJS, `Db2Module.forRootAsync` from `db2kit/nestjs` ([nestjs.md](nestjs.md#module)), which creates the client and closes it at shutdown:

```ts
import { ConfigModule } from '@nestjs/config';
import { loadConfigFile } from 'db2kit';
import { Db2Module } from 'db2kit/nestjs';

Db2Module.forRootAsync({
  useFactory: async () => {
    // With @nestjs/config: the variables of .env are assigned before the file is read.
    await ConfigModule.envVariablesLoaded;
    return { config: await loadConfigFile() };
  },
});
```

Without NestJS: `createDb2(await loadConfigFile(), { logger })`. What only the application needs is added to what the file gives, never copied from it: `{ config: { ...config, audit: { ...config.audit, sinks: [...] } } }`. Without `audit.sinks`, `Db2Module` sends the events to the Nest logger `Db2`.

In production, the image holds `db2kit.config.mts` in the working folder of the process (the build of the application does not copy it), or the application gives its path, `loadConfigFile({ path })`. A TypeScript file is read through the type stripping of Node.js, on by default from Node.js 22.18; on an earlier 22, write the file as `db2kit.config.mjs`.

**3. The environment.** The variables named by `connectionFromEnv` (`DB_APP_DATABASE`, `DB_APP_HOST`, `DB_APP_PORT`, `DB_APP_USERNAME`, `DB_APP_PASSWORD`, optional `DB_APP_CURRENT_SCHEMA` and `DB_APP_EXTRA_KEYWORDS`) live in the environment of the process, never in a committed file. The application loads them as it already does. The CLI loads the file named by `cli.envFile` in its configuration, or the one given with `-e`: `npx db2kit generate ... -e .env`. The commands below show `-e .env`: leave it out once `cli.envFile` names the file. The CLI loads that file after it read the configuration file: a value the file reads from a variable of `.env` is not set yet for the CLI. Only the connection matters to the CLI, and `connectionFromEnv` reads it later, at the connection.

## Check

```sh
npx db2kit -v                 # the version the application really loads
npx db2kit doctor -e .env     # configuration, driver, connection, server, catalog access
```

See [cli.md](cli.md) to read the report. Every CLI command opens a new connection, so a new login: with a wrong password, fix it before running another command, since repeated failures can revoke the account ([Protection of the account](configuration.md#protection-of-the-account)).

## Add a table or a view

`npx db2kit add MYSCHEMA.CONTRACT`, in a terminal, does the steps below that need no decision, asks before a second model of a table already generated, and proposes the relations the columns suggest with the models already generated, each declared after a yes ([cli.md](cli.md#add)). The steps by hand:

```sh
npx db2kit list MYSCHEMA -e .env                 # what the schema holds, and what generate accepts
npx db2kit describe MYSCHEMA.CONTRACT -e .env    # catalog facts, writes nothing
npx db2kit generate MYSCHEMA.CONTRACT -e .env    # writes the model, records it in the manifest
```

1. **Choose the object** with `list`. A view is accepted when it is a plain projection of one table, other views are refused with the reason ([models.md](models.md#views)). When two views read the same table with the same columns, generate one of them.
2. **Read the warnings** of `generate`. Without a primary key nor a unique index, `findUnique` and `cursor` are refused on the model. An index that is not selective does not let a filter through the index guard.
3. **Use the model**, from `<outDir>/tables/MYSCHEMA.CONTRACT.generated.ts`:
   ```ts
   import { contract } from './db2/generated/tables/MYSCHEMA.CONTRACT.generated';

   const rows = await db.findMany(contract, { where: { region: '100' }, take: 50 });
   ```
   `take` is always required. On a large table, the filter must use a selective index, or the read is refused before any network call ([models.md](models.md)).
4. **Commit** the generated file and `manifest.json`: code review then shows every catalog change that reaches the application.

## Add a stored procedure

One command, in a terminal, run by a person. It brings the procedure as far as the files of the project allow, and asks only what they do not hold ([cli.md](cli.md#add)):

```sh
npx db2kit add MYSCHEMA.MY_PROC
```

The catalog gives the type of each parameter, never which value means success, refusal or error: only the program and the team that owns it know. So the work has three parts: the answers of that team, what `add` does with them, and what is left to write by hand.

### 1. The answers of the team that owns the program

Ask before the command, for each procedure or for all of them but the exceptions named. A rule written from a guess checks the guess, not the program: a test with `FakeDriver` replays what it is given.

When the programs come in families, write the answers once per family as a convention in `db2kit.config.mts` ([procedures.md](procedures.md#conventions)): `add` then proposes the convention whose outputs a procedure has, and the only question left for the team is whether the program follows it. `add` writes these questions for you, named for the procedure, in a sheet to send: `db2kit-sheets/SCHEMA.NAME.html` ([cli.md](cli.md#sheet)). Open it in a browser, select all, copy, and paste it into a mail or a Confluence page: the team fills in its Answer column. It also gives the parameters as the program declares them, in PL/I or COBOL, and asks who answered and when.

| #   | Question                                                                                                                     | Where the answer goes                                                                                                                                                                                                                                                                                                  |
| :-- | :--------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 1   | Which values of the global status outputs (a return code, the SQL code the program reports in an output) mean success?       | The `success` constants of its rule, written by `add`                                                                                                                                                                                                                                                                  |
| 2   | Which values mean a refusal by the program, and which a technical error? What does each code mean?                           | A refusal: the `refused` key of its rule, each value with its meaning, the reason of the HTTP 422 answer, written by `npx db2kit sheet SCHEMA.NAME --answers` from the page of the error codes of the sheet. A technical error of Db2 itself: nothing to write, a `CALL` that fails is a `Db2QueryError` with its code |
| 3   | Per field: which outputs hold the code, the message and the flag of each field, and which values mean an error or a warning? | `procedures.fieldStatus` of `db2kit.config.mts`, the default every rule takes with `fieldStatus: null` ([procedures.md](procedures.md#status-per-field))                                                                                                                                                               |
| 4   | Does the program commit or roll back by itself?                                                                              | Whether `add --rollback` may try it on the test subsystem, and whether it may run inside `db.$transaction` ([transactions.md](transactions.md#procedures-in-a-transaction))                                                                                                                                            |
| 5   | Which procedures do not follow the common convention?                                                                        | A rule of their own, with their own `fieldStatus` or `evaluate`                                                                                                                                                                                                                                                        |

A missing answer stops nothing: `add` writes the files all the same, leaves what nobody knows as `null` or as a comment in the rule, and `db.call` then refuses the call before it is sent. Nothing passes in silence.

### 2. What `add` does, in order

Each step writes a file or asks a question. Run again, it asks only what the files do not hold; without a terminal (a script, an assistant), it does what needs no answer and says where it stopped.

| Step             | A procedure that reads (`READS SQL DATA`, `CONTAINS SQL`, `NO SQL`)                                                                                                                                                               | A procedure that modifies data (`MODIFIES SQL DATA`)                                                                                                                                                                                                                                                                                                      |
| :--------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| descriptor       | `procedures/MYSCHEMA.MY_PROC/MYSCHEMA.MY_PROC.generated.ts`, rewritten at each `generate`, and the draft rule `MYSCHEMA.MY_PROC.outcome.ts`, created once then owned by the team ([procedures.md](procedures.md#generated-files)) | The same                                                                                                                                                                                                                                                                                                                                                  |
| status outputs   | Proposed from the names that read like a code (`RETURN_CODE`, `SQL_CODE`...), never a message; confirmed or named by the person. Those a field status groups are left out, and without one, those that come one per field         | The same                                                                                                                                                                                                                                                                                                                                                  |
| cases            | The inputs of `found` (returns rows) and `empty` (finds nothing), typed one by one as their type, or pasted as one JSON; `null` where the parameter takes it. The inputs of `procedures.defaultInputs` are never asked            | `accepted` and `refused`, asked only with `--rollback`                                                                                                                                                                                                                                                                                                    |
| calls            | After a yes on the location shown (`CURRENT SERVER`): each case once, then once more warm                                                                                                                                         | Only with `--rollback`, on a location listed in `cli.rollbackServers`, once the team confirmed the program never commits by itself (answer 4): each case in a transaction always rolled back, a witness row telling whether the program ended the transaction itself ([cli.md](cli.md#trying-a-procedure-that-modifies-data)). Without it, no call at all |
| success values   | The values the cases agree on, written in the rule after a yes, one constant per status output                                                                                                                                    | Those of `accepted`, written once the person says the program accepted it; or, without a call, the values the team gave (answer 1), typed or pasted                                                                                                                                                                                                       |
| result set types | The columns the cases returned, written in `MYSCHEMA.MY_PROC.results.ts` after a yes: `MyProcRow`, `MyProcRow2`...                                                                                                                | The same, from the calls of `--rollback`; otherwise written by hand, from the program                                                                                                                                                                                                                                                                     |

`add` never writes `validated: true`, and never calls a procedure that modifies data without `--rollback`. It calls a procedure only for what is missing, success values or result set types: run again once the rule and the types are written, it calls nothing and says so. `npx db2kit probe SCHEMA.NAME` calls the cases again at each run, each judged by the rule, the evidence to show before `validated: true`, and `add` names it in its `Next:` block. It ends with the board of the procedure, one row per step marked `OK`, `TO DO` or `LATER` ([cli.md](cli.md#add)), which `npx db2kit status SCHEMA.NAME` shows again at any time, from the files alone, without a connection; `npx db2kit status` gives one line per procedure of the project. `--language fr`, or `cli: { language: 'fr' }` in `db2kit.config.mts`, prints all of it in French ([cli.md](cli.md#language)). Its last lines, `Next:`, say what is left: first the questions for the team named for this procedure (the codes of its fields, the values of its global codes that mean a refusal), then the call in a service and its test, then `validated: true`. A draft whose success values cover outputs that come one per field is written again without them, after a yes: an output is a success value or part of a field, never both.

### 3. What is left to write by hand

1. **The rule**, in `MYSCHEMA.MY_PROC.outcome.ts`. Four parts, data first, code last ([procedures.md](procedures.md#the-parts-of-a-rule)). The sheet the team returned writes the first two, after a yes: `npx db2kit sheet MYSCHEMA.MY_PROC --answers reply.html` ([cli.md](cli.md#reading-the-answers-back)):
   - `success`: the constants `add` wrote. A constant still at `null` is a value nobody gave: the call is refused until it is written.
   - `fieldStatus`: `null` takes the default of `db2kit.config.mts` (answer 3), its own `defineFieldStatus({ ... })` overrides it for this procedure, no key means no status per field. A rejected field makes the verdict `rejected` (HTTP 422), a warning goes with a success.
   - `refused`: the values of a status output that mean the program refused the request (answer 2), `refused: { returnCode: ['NOK', 'E01'] }`. Such a value, the success values not matching, makes the call rejected (HTTP 422), the output and its value its reason. When a family of programs shares these values, a convention says them once ([procedures.md](procedures.md#conventions)).
   - `evaluate`, only for what the others cannot say: a refusal that depends on several outputs, a reason in words. Through one function of the application that each rule imports, when several rules share it:

     ```ts
     // src/db2/outcome-common.ts, in the application
     import type { OutcomeContext, OutcomeVerdict } from 'db2kit';

     /** A refusal the program says with a reason code next to its return code. */
     export function reasonedRefusal(
       output: { reasonCode?: unknown; message?: unknown },
       context: OutcomeContext,
     ): OutcomeVerdict {
       if (!context.successMatched && output.reasonCode === 'R1')
         return { status: 'rejected', reasons: { request: String(output.message) } };
       return context.verdict;
     }
     ```

     Then `evaluate: reasonedRefusal` in the rule. With success and refused values alone, any other answer is `unknown` (HTTP 502), on purpose: a code nobody named as a refusal stays an anomaly ([procedures.md](procedures.md#outcome-rules)). `evaluate` must never return `success` when `successMatched` is false.

2. **The call in a service**: the `...WithOutcome` export of the rule and its types, never the descriptor alone ([procedures.md](procedures.md#types-to-import)):

   ```ts
   import {
     myProcWithOutcome,
     type MyProcInput,
   } from './db2/generated/procedures/MYSCHEMA.MY_PROC/MYSCHEMA.MY_PROC.outcome';

   const { output, resultSets, warnings } = await db.call(myProcWithOutcome, input);
   ```

   A rejection throws `Db2ProcedureRejectedError`, an unknown status `Db2ProcedureStatusUnknownError`: with NestJS, `Db2ExceptionFilter` answers 422 and 502 ([nestjs.md](nestjs.md#exception-filter)). The service catches neither.

3. **A test without Db2**, with `FakeDriver.onCall` on the same export, so that the rule is tested too: one answer of the program per case, success, refusal and an unknown status, as the team described them ([testing.md](testing.md#procedures-by-property-name)). Never a `Db2ProcedureRejectedError` thrown by the test itself: the fake gives the outputs, the rule concludes.

4. **`validated: true`**, written by a person once the rule was checked against the program: by the calls of `add` on the test subsystem, or by the team. Nothing checks it automatically. Until then, `npx db2kit check` lists the rule as a draft, and a procedure that modifies data is refused inside `db.$transaction`.

5. **Commit** the folder of the procedure and `manifest.json`. `npx db2kit check` in the CI compares the descriptor with the catalog and lists the rules still drafts and the `unchecked(` calls.

### Without a terminal, or in a script

The same calls, one piece at a time, each command writing nothing without being told: `npx db2kit describe MYSCHEMA.MY_PROC` (the catalog facts), `npx db2kit generate MYSCHEMA.MY_PROC` (the folder and the draft rule), then `npx db2kit probe MYSCHEMA.MY_PROC` with its cases file, `db2kit-cases/MYSCHEMA.MY_PROC.json`, filled in by a person ([cli.md](cli.md#probe)). `probe` refuses a procedure that modifies data: its values come from the team.

A first try of a procedure that reads, before its rule exists, is written `db.call(unchecked(myProc, 'the reason'), input)`: the reason goes to the audit event of each call and `npx db2kit check` lists it, so that the call is not forgotten ([procedures.md](procedures.md#a-call-without-its-outcome-rule)). Never written to make a TypeScript error go away.

## Follow the catalog

```sh
npx db2kit generate -e .env    # regenerates every table and procedure of the manifest
npx db2kit check -e .env       # exit code 1 when a generated file differs from the catalog
```

Run `check` in the CI when it can reach the subsystem, or before each release. Outcome rules are never rewritten: after a change of a procedure's outputs, review its rule by hand.

## Update db2kit

1. In the application: `npm install db2kit@latest`, then `npx db2kit -v`. From an archive instead: in the repository of db2kit, `git pull`, raise `version` in `package.json`, then `npm pack` (two archives must never share a name: with the same name, the application can keep the previous archive without any warning), then in the application replace the archive in `vendor/`, `npm install ./vendor/db2kit-<version>.tgz` and `npx db2kit -v`.
2. Read the lines of the versions passed in the table below: some need a step in the application.
3. Restart the application: a watch mode does not reload `node_modules`.
4. Run `npx db2kit generate -e .env`: a new version can change the generated files. Read what it reports.

Changes that need a step in the application:

| Version       | Change                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | What to do                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| :------------ | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 0.2.0         | One folder per procedure, and `procedures/README.md`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | `generate` refuses a procedure still in the flat layout and says what to move: its `.outcome.ts` into its folder (and the imports), the old `.generated.ts` to delete                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| 0.3.0         | Success values in outcome rules, `procedures.outcomeConvention`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | Nothing required: existing rules keep working. To use the convention, add it to both configurations, and to get a draft with `success` constants, delete a rule that holds nothing of value and run `generate` again                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| 0.5.0         | Input codecs, `procedures.defaultInputs`, connection recovery, `db2kit/nestjs`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | Nothing required. Reads whose connection was lost are now retried once (`query.retryLostReads: false` to keep the error). `Db2InputError` replaces `Db2UsageError` for refused input values, and is one: existing `catch` blocks keep working. To use the module, replace the provider written by hand with `Db2Module.forRoot` ([nestjs.md](nestjs.md)). An input listed in `procedures.defaultInputs` becomes optional after `generate`                                                                                                                                                                                                                                                                                                                                                                  |
| 0.6.0         | `db2kit/testing`, `ibmDbDriver` exported                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | Nothing required. To test without Db2, see [testing.md](testing.md)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| 0.7.0         | Unique keys and hover docs in generated models, `docs/code-assistants.md`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | Run `npx db2kit generate -e .env`: every table model changes, and `check` reports them until then. Models generated before keep working, checked at runtime only. Calls that TypeScript now refuses (`findUnique` or `cursor` on a model without unique key, a `findUnique` that is not exactly one key) were already refused at runtime                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| 0.8.0         | Status per field (`defineFieldStatus`, `procedures.fieldStatus`), warnings, `evaluate` at every call                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | Nothing required for rules with `success` values only. A rule with `evaluate` now also sees the calls whose success values do not match (`context.successMatched` is false): it can explain them as a rejection, a `success` it returns there counts as unknown. Reasons can be objects (the parts of a field), and the audit `messages` of a procedure are now `{ notice, reasons, warnings }`. `generate` now writes `AGENTS.md` next to the generated files, for code assistants: it adds a section pointing to it in `AGENTS.md` at the root of the project, or asks before creating that file (`codegen.projectInstructions`, [configuration.md](configuration.md)). Optional: `cli: { envFile: '.env' }` in `db2kit.config.mts` replaces `-e .env` at each command ([cli.md](cli.md#common-options)) |
| 0.9.0         | Named queries (`defineQuery`, `db.run`), table writes opt-in per table (`models.writable`)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | Nothing required: every model stays read-only until `models.writable` lists it, in the configuration of the application. To write a table with the object API, add it there ([models.md](models.md#writing)). To move a shared read out of a service, see [queries.md](queries.md#named-queries)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| 0.10.0        | Unknown configuration keys refused, `pool.receiveTimeoutMs` (60 s), `jsonlSink` retention, stricter checks of the configuration                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | Start the application once: a key db2kit does not know, a section that is not an object, fixed `extraKeywords` that set `PWD`, `UID` or `RECEIVETIMEOUT`, a sink without `handle` and a non-boolean `types.trimChar` now stop the startup, each named. Set `pool.receiveTimeoutMs` above the slowest expected statement: a statement waiting longer than 60 s for a reply now fails (`CONNECTION_LOST`, `NO_REPLY`). Add `retentionDays` to every `jsonlSink` ([audit.md](audit.md#retention)). Run `npx db2kit generate`: its `AGENTS.md` now holds the configuration checklist, each setting with its value in effect, to go through. The to-do list of [checklists.md](checklists.md#configuration-of-an-application) covers the rest                                                                   |
| 0.11.0        | Relations (`defineRelations`, `relations.ts`), `include`, `some`, `none`, `every`, `aggregate`, `groupBy`, the `Tables` index, `AuditParams`, the text of a Db2 error out of the logs, `exists`, `db.compile`, `findPages`, the index guard in the types, `audit.refusals`, `npx db2kit probe`, `CallResult.columns`, result set types (`probe --write-types`), the commands of the CLI in `AGENTS.md`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | Run `npx db2kit generate`: it writes `tables/index.ts` and creates `relations.ts` once, for the team to fill in ([models.md](models.md#relations)). The text of a Db2 error now leaves the audit trail and the log of the `db2kit/nestjs` filter unless `audit.params` is `'full'`: log `messageWithoutDb2Text(error)` in the application for the same rule ([audit.md](audit.md#the-text-of-a-db2-error)). A read sorted by a `DECIMAL` beyond 15 digits now sorts by number: it sorted the text, 10 before 9. To type the result sets of a procedure that reads: `npx db2kit probe SCHEMA.PROC -i cases.json --write-types` ([procedures.md](procedures.md#result-set-types))                                                                                                                            |
| 0.12.0        | `pool.receiveTimeoutMs` also sends `QueryTimeout`, which bounds a statement on a network cut without notice where `ReceiveTimeout` alone did not; `QueryTimeout` refused in the extra keywords                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| 0.13.0        | `npx db2kit init`, and the rules no code assistant may break in the db2kit section of the instruction file of the project and in the guide `generate` writes; a `Code assistants` row in `doctor`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | Run `npx db2kit init`: it writes the section, or brings the section of an earlier version up to date. `doctor` warns until then. A variable with the prefix of the connection that db2kit does not read (`_READ_ONLY`, a table name...) does nothing: a person removes it from the environment file (an assistant never opens it), the configuration holds every other setting ([configuration.md](configuration.md#from-environment-variables-read-at-each-new-connection))                                                                                                                                                                                                                                                                                                                               |
| 0.13.1        | `generate` and `describe` name a prefix they do not know (`view:`, `alias:`) and give the command to type: a view or an alias goes without a prefix, or with `table:`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | Nothing required                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| 0.14.0        | `loadConfigFile()`: the application reads `db2kit.config.mts` when it creates its client, one configuration for the CLI and the application; the CLI opens one connection whatever `pool`; the section of `init` names the configuration file                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | Replace the configuration written in the code of the application with `loadConfigFile()` (`Db2Module.forRootAsync` with NestJS, [nestjs.md](nestjs.md#module)), after moving into `db2kit.config.mts` what only the code held (pool, audit name): one file, its values per environment read there from `process.env`. Copy the file into the image of production. Run `npx db2kit init`: the section of `AGENTS.md` changed                                                                                                                                                                                                                                                                                                                                                                                |
| 0.15.0        | `<Name>Field` in every generated model, every property by name, and `SortOrder` exported as a constant (`SortOrder.Asc`, `SortOrder.Desc`)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | Run `npx db2kit generate`: every model gets its constant, and `check` reports them until then. Nothing else required: the words `'asc'`, `'desc'` and the property names written as text keep working. To use them: `by: [ContractField.status]`, `orderBy: { [ContractField.startDate]: SortOrder.Desc }` ([models.md](models.md#select-orderby-take))                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| 0.16.0        | `allowScan` takes the reason of the person who decided the scan, never `true`: the client logs each scan once per process with its reason, and the audit event carries `scanReason`. Every `Db2UsageError` has a `code` (`INDEX_GUARD`, `USAGE`), which the NestJS filter answers. `check` lists every `allowScan` of the code. The CLI reads the TypeScript files of the project as the project compiles them: `probe` loads the outcome rule of a CommonJS project. Hover help on every option of the object API                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | **Required**: replace each `allowScan: true` with the reason of the scan, `allowScan: 'reference list, read once a day'`, written by the person who decided it, or remove it and read a smaller table: TypeScript and the call refuse `true`. Run `npx db2kit generate`: the hover help of the models and the guide changed. A log of `error.code` now gets `INDEX_GUARD` or `USAGE` for a refusal, where it had none                                                                                                                                                                                                                                                                                                                                                                                      |
| 0.17.0        | `probe` finds the cases file of each procedure, `db2kit-cases/SCHEMA.NAME.json` at the root of the project, and writes it when it does not exist, with every input to fill in and an explanation of each, then makes no call: `-i` is optional. It refuses an explanation left in place and an input the procedure does not take, before any call. `init` and `probe` add `/db2kit-cases/` to the `.gitignore` of the project. Each call of `probe` runs without the outcome rule, which then judges it: a draft that answers `unknown` no longer hides the outputs and the result sets, gives its reason, and `--write-types` works with it. `--status NAMES` shows the values of outputs no rule names yet. `Db2ProcedureStatusUnknownError.detail`                                                                                                                                                                                                                                                                                                                                    | Move each cases file to `db2kit-cases/SCHEMA.NAME.json`, or run `npx db2kit probe SCHEMA.NAME` once to get the template, then fill it in. Run `npx db2kit init` or `generate` again: the guide and the section of the project changed                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| 0.17.1        | The template of a cases file says to write a number without quotes, and `probe` refuses a number between quotes for a type that takes no text (`INTEGER`, `DOUBLE`...) before any call, with a message that says so. When the outcome rule names no status output yet, its note says so instead of "no rule"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | In a cases file, write each number without quotes: `100`, not `"100"`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| 0.17.2        | The type of a result set column has its size again: `CHAR(7)`, `DECIMAL(9,2)`, where `probe` showed `CHAR(0)` and `DECIMAL(0,2)`. ibm_db 4.0.1 overwrites the precision it reads, so db2kit reads the length and the display size instead. `FakeDriver` gives the metadata as ibm_db does, the precision at 0                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | A `.results.ts` written by `probe --write-types` before 0.17.2 holds sizes at 0: run `probe --write-types` again. A test that reads `SQL_DESC_PRECISION` from `FakeDriver` gets 0, as from ibm_db: read `SQL_DESC_LENGTH`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 0.18.0        | Every value of a `DATE`, `TIME` or `TIMESTAMP` parameter of `db.call`, filter or write of the object API is checked before sending: `YYYY-MM-DD`, `HH:MM:SS` or `HH.MM.SS`, `YYYY-MM-DD-HH.MM.SS.FFFFFF` or `YYYY-MM-DD HH:MM:SS.FFFFFF`, and a date or time that exists. Any other form is refused with the name of the field and the form of the value (`the form 99999999`), never the value: Db2 answered -180 or -181 naming neither. New code `INVALID_DATETIME` for -180 and -181, with a hint, which `probe` shows under the error                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | **Required where it applies**: a date sent in another form, `20260105`, `01/05/2026` or `05.01.2026`, is now refused before sending. Send `YYYY-MM-DD`. A program that takes `YYYYMMDD` has a `CHAR` parameter: give it `codecs.dateText`. Run `npx db2kit generate`: the hover help of the date columns changed. A test that expected `OTHER` for -180 or -181 gets `INVALID_DATETIME`                                                                                                                                                                                                                                                                                                                                                                                                                    |
| 0.19.0        | `npx db2kit init` writes `db2kit.config.mts` when the project has no configuration file: valid as it is, each option said in one line, `defaultInputs`, `outcomeConvention` and `fieldStatus` left as comments, then the next steps. It never overwrites a configuration file                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | Nothing to do: a project with a configuration file keeps it. To see the commented options, run `npx db2kit init` in an empty folder                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| 0.20.0        | The setup roadmap: `npx db2kit setup` serves on `127.0.0.1` every step from the install to a table and a procedure that work, with what db2kit finds done in the project (never a connection, never a value), the checks and notes saved in `db2kit-setup/progress.json`. `init` writes the page in `db2kit-setup/roadmap.html` and adds `/db2kit-setup/` to the `.gitignore`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | Nothing required. Run `npx db2kit init` to get the page and the `.gitignore` entry, and `generate` to bring the section of `AGENTS.md` up to date, then `npx db2kit setup`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| 0.21.0        | Readable output of the command line: colors in a terminal (green, yellow and red as the words say, cyan for what to type), `NO_COLOR` and `FORCE_COLOR` honored. `probe` reports one line per case, then each error, reason and output once, the columns of a result set only with `--columns` or when they differ between cases. `generate` ends a run of several objects with a count by status                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | Nothing required. `NO_COLOR=1` for plain output in a terminal. A script that read the report of `probe` reads its new layout, or the object `runProbe` returns                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| 0.21.1        | A list of `--status` or `-t` split by the shell (PowerShell passes an unquoted `a,b` as two arguments, every shell does with a space after the comma) is refused with exit code 2, saying how to write it, instead of the usage line. The hints of `probe` give the option to type, its names in quotes                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | Write the lists in quotes, without space: `--status "RETURN_CODE,SQL_CODE"`, or repeat the option. Run `generate` to bring `AGENTS.md` up to date                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| 0.22.0        | `procedures.outcomeConvention` removed: each outcome rule holds its own success values, one constant per status output. `probe` compares them with what the cases return and, when the cases agree on other values and the rule is a draft, asks before writing them in the rule. A success value left at `null` is not written yet: `db.call` refuses the call before sending it, where it took the convention before                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | A configuration that still has `outcomeConvention` is refused, saying where its values go. Before removing it, write its values in the constants of each rule that keeps `null`, or run `npx db2kit probe SCHEMA.NAME` and answer y. Run `generate` to bring the guides up to date                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| 0.22.1        | `npx db2kit -v` shows the version the command line was built from, written into its code, and every command says so when the `package.json` next to it says another: a project that links the folder of db2kit gets its `package.json` with `git pull`, but `dist` only with a build                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | Nothing required. If a command says the versions differ: `npm run build` in the folder of db2kit, or `npm pack` and install the archive again                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| 0.22.2        | The warning of the result sets of a procedure names `SCHEMA.NAME.results.ts` once `probe --write-types` wrote it, in the output of `generate` and in the descriptor                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | Nothing required. `generate` brings the comment of the descriptor up to date                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| 0.23.0        | `probe` proposes the result set types as it proposes the success values: it compares the columns the cases returned with `SCHEMA.NAME.results.ts`, says when they are the same, and asks in a terminal before writing other columns or a new file. `--write-types` now writes without asking, for a script; without it, a refusal no longer gives exit code 1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | Nothing required. Run `npx db2kit probe SCHEMA.NAME` and answer y to type the result sets. Run `generate` to bring the guides up to date                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| 0.23.1        | `SCHEMA.NAME.results.ts` names the row of each result set: `MyProcRow` for the first, `MyProcRow2` for the next, to type a function that maps one row                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | Nothing required. `npx db2kit probe SCHEMA.NAME` sees a file written by an earlier version and proposes to write it again: answer y                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| 0.24.0        | `npx db2kit add SCHEMA.NAME`: one table, view or procedure brought as far as the files allow, asking only what they do not hold (cases typed in the terminal, the calls after a yes, the relations its columns suggest). `npx db2kit map`: `db2kit-setup/map.html`, the configuration, the models, the procedures and the files of the application that use them. A new rule for code assistants: never answer a question of `npx db2kit` for the person                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | Nothing required. `npx db2kit generate` brings the db2kit section of the instruction file and `AGENTS.md` up to date                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| 0.25.0        | `npx db2kit add`: the inputs of a case, or every case, pasted as one JSON object over as many lines as it takes; for a procedure that modifies data, the success values the team that owns the program gave, typed or pasted, written after a yes. The command line reads the terminal once for the whole command, so that every line of a paste reaches the questions                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | Nothing required                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| 0.26.0        | `npx db2kit add SCHEMA.NAME --rollback`: a procedure that modifies data called on a test subsystem, each case in a transaction always rolled back, its location listed in the new `cli.rollbackServers`, a witness row telling whether the program ended the transaction itself. `db.$transaction(fn, { rollback: true })`: a transaction that always ends with `ROLLBACK`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | Nothing required. To try a procedure that modifies data: `cli: { rollbackServers: ['LOCATION'] }` with the location of the test subsystem (`npx db2kit doctor` shows it), never that of production                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| 0.26.1        | `add`: a JSON pasted in a terminal that delivers it in parts (a Windows console) kept in order, the rest of a line never put in front of it; a JSON refused says at which line and column of the paste, never what it holds                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| 0.27.0        | `add` and `probe`: many status values shown case beside case, one output per row, the usual value counted once; a message never suggested as a status (a text can hold data); `add --rollback` writes the success values only once the person says the program accepted the case `accepted`, and proposes nothing when every case returned the same values                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| 0.28.0        | Status per field made visible: the draft rule of a procedure whose outputs come one per field shows a `defineFieldStatus` example built from them, checked as at startup; `fieldStatus: null` says it takes the default of the configuration and how to override it; `add` proposes as status outputs only those the default does not group; the skeleton of `init` holds a commented default                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| 0.29.0        | The draft rule re-exports the types of its descriptor, `XxxInput` and `XxxOutput`: a service imports the call and its types from the `.outcome.ts` file (a draft written before still reads as a draft); the status per field, its default and its override documented for the developer (hover help of `procedures.fieldStatus` and of `fieldStatus` in a rule, `docs/procedures.md` step by step), in `procedures/README.md` and in `AGENTS.md` written by `generate`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 0.30.0        | **Breaking.** `db.call` refuses a descriptor alone, in the types and at run time (`USAGE`): it checked nothing, and a rejection the program reports in its outputs read as a result. A call without its rule is written `unchecked(descriptor, reason)`: its reason goes into the audit event, and `npx db2kit check` lists every such call. The generated descriptor says so when hovered; `probe` and `add --rollback` call through `unchecked()`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | Build the application: `tsc` lists every `db.call(descriptor, input)`. Replace each with the `...WithOutcome` export of its `.outcome.ts` file, or, for a call without its rule on purpose, `db.call(unchecked(descriptor, 'the reason'), input)`, `unchecked` imported from `db2kit`. Then `npx db2kit generate` rewrites the descriptors with their hover help                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| 0.30.1        | The section `init` writes in the instruction file of the project, the `AGENTS.md` of `generate` and `docs/code-assistants.md` say that an assistant never writes `unchecked()` or `allowScan` to make an error go away, and how to migrate the calls of a descriptor alone. `db.call` of a descriptor alone with an input typed `any` is a TypeScript error too                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | `npx db2kit init` (`doctor` says the section is out of date until then), then `npx db2kit generate`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| 0.30.2        | The CLI loads the TypeScript files of the project (the configuration, the outcome rules) when the project installed TypeScript 7, the native compiler, which has no `transpileModule`: it stopped with `Cannot read properties of undefined (reading 'ESNext')`. Type stripping of Node.js compiles them then, an `enum` included, and without TypeScript too                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | Nothing required                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| 0.30.3        | A `Buffer` reaches Db2 as binary. ibm_db alone described it as text, `VARCHAR`: Db2 for z/OS refused it where binary is expected (-301, `SQL0301N`), and a binary column written or compared with a `Buffer` could have received the bytes as text. In a query, a write of the object API and an input of a procedure                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | Nothing required. A binary column written by an earlier version: compare a few rows with what the application sent                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| 0.30.4        | `db2kit/testing` takes the types of the library from `db2kit`: its declarations held a copy of them, and `FakeDriver.onCall` refused a descriptor of `db2kit` in the types (`Types of property 'inputCodecs' are incompatible`), in an ES module as in CommonJS. Found while building section N of the acceptance battery                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | Nothing required. A cast written to get around it (`as never`) can go                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| 0.30.5        | `Db2PoolTimeoutError` carries `code: 'POOL_TIMEOUT'`, as `Db2UnavailableError` carries `UNAVAILABLE`: `db2HealthCheck` gave `pingError: 'OTHER'` when no connection came within `pool.acquireTimeoutMs`. The audit and the exception filter already named it. Found by N4 of the acceptance battery                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | Nothing required. A test of `error.code` on a pool timeout now reads `POOL_TIMEOUT`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| 0.31.0        | A text longer than the column it is compared with is refused by the driver, which gives the marker the type and length of the column (SQLSTATE 22001, SQLCODE -99999, observed on Db2 13 for z/OS): `Db2QueryError` gets the code `VALUE_TOO_LONG` for SQLSTATE 22001, whatever the SQLCODE, with what to do, and `db2kit/nestjs` answers it 400. The filters of the object API refuse such a text before sending, with the property and the lengths, as its writes did. The message of `Db2PoolTimeoutError` names a login slower than `pool.acquireTimeoutMs` as a cause, beside the network. Found by the acceptance battery                                                                                                                                                                                                                                                                                                                                                                                                                                                          | A `switch` over every `Db2ErrorCode` gets one more case. A filter of the object API that sent a text longer than its column now gets `Db2UsageError` before sending, instead of `Db2QueryError` `OTHER` from the driver. In SQL written by hand, check the length or `CAST` the marker ([queries.md](queries.md#accepted-values))                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| 0.32.0        | The command line stands out where it needs a person: each yes or no question between two blank lines, marked with `?`, in bold and the accent color, then `(y/N)`, and the steps left in a numbered `Next:` block at the end of `init`, `doctor`, `generate`, `probe` and `add`, each a command to run or a file to edit, within 100 characters. The draft rule of a procedure whose outputs come one per field proposes an output of one character in every field as a third role, `flag`, in commented lines with the first rule of `classify`. The skeleton of `init` shows a code, a message and a flag. `docs/procedures.md` gains a complete example of a status per field, run as a test                                                                                                                                                                                                                                                                                                                                                                                          | Nothing required. A script that reads the output of a command: a question now ends with `(y/N)` after its `?`, the one of `AGENTS.md` included (it said `[y/N]`), and the steps come after the last lines. A draft rule written before keeps its comments                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 0.33.0        | One db2kit at run time, whatever loads it. A CommonJS application whose `db2kit.config.mts` holds a `procedures.fieldStatus` starts: the copy it requires takes the field status that the ES module copy, loaded by the configuration file, built. The same for a codec, `sql`, a named query, and the command line, which bundles its own copy. Each is checked again by the copy that receives it. An error of one copy is an `instanceof` of the same class of the other. `npx db2kit doctor` lists the copies of its process and warns when their versions differ. `query` and `execute` refuse a statement not written with `sql`, `sql.join` a list that holds something else                                                                                                                                                                                                                                                                                                                                                                                                      | Nothing required. The workaround of a status per field given in each rule rather than in the configuration can go: `procedures.fieldStatus` in `db2kit.config.mts`, `fieldStatus: null` in the rules. A project that installs db2kit once and runs `npx db2kit` has one version                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| 0.34.0        | `npx db2kit setup` and `npx db2kit map` removed, with the two HTML pages they wrote in `db2kit-setup/`: neither was found fit. The steps of a project stay in this page and in `code-assistants.md`, the relations in `relations.ts` and in the proposals of `add`. `init` no longer writes `db2kit-setup/roadmap.html`, and its last step names `npx db2kit add`. The section Add a stored procedure of this page rewritten around `add`: the answers to get from the team first, what `add` does with them, what is left to write by hand. `add` ends with the steps left: the call in a service, a test, the rule checked. Section L of the acceptance battery, the links between objects of the application (`DB2KIT_IT_LINKS`). The five pages about db2kit itself (`roadmap.md`, `acceptance.md`, `integration-tests.md`, `verification.md`, `architecture.md`) stay in the repository and leave the package, which loses 700 KB of notes                                                                                                                                          | Nothing required. A project that ran `setup` or `map` can delete `db2kit-setup/` and the `/db2kit-setup/` line of its `.gitignore`. A script that called either command gets `Unknown command`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| 0.35.0        | The relative imports of the files db2kit writes follow the project, `codegen.importExtension`: `.js` in an ES module package at `nodenext`, `.ts` with `rewriteRelativeImportExtensions` or `allowImportingTsExtensions`, none otherwise, as before. Before, they never had an extension, which an ES module project at `nodenext` refuses (TS2835, and TS2834 for the import of `./tables` in `relations.ts`, now `./tables/index` in such a project). `doctor` shows the form in effect. `generate` and `check` name a rule or a `relations.ts` whose imports have another form. `npx db2kit verify`: what the application defined, run again read only on a location of `cli.verifyServers`, and compared with `db2kit-verify.json`, written by its first run: the generated files against the catalog, every procedure that reads with its cases through its rule, a few rows of every model, and the read cases of `db2kit-cases/reads.ts`, an example of every method that reads written by its first run, its filter values taken from a sample row kept in memory, never a value | In an ES module project at `nodenext` (or with `rewriteRelativeImportExtensions`): `npx db2kit generate` rewrites the descriptors, the result set types and `tables/index.ts`. Then correct by hand, once, the relative imports of each `.outcome.ts` and of `relations.ts` that `generate` names: db2kit never rewrites them. Elsewhere: nothing, the files stay as they are. To use `verify`: list the test subsystem in `cli.verifyServers`, run it once, commit `db2kit-verify.json`, then run it again: the read cases it wrote run as they are, nothing to type                                                                                                                                                                                                                                      |
| 0.36.0        | The keys of a cases file of `probe`, `add` and `verify` are the names of the inputs in the catalog, as `SYSPARMS` and DBeaver show them (`CLIENT_ID`), the same form in every procedure. Before, they were the properties of the descriptor (`clientId`). The prompts of `add` and the input refusals of `probe` name the inputs the same way. A property name, or a catalog name in another case, is refused before any call with the name to write                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | In each file of `db2kit-cases/`, rename the keys of each case to the names of the catalog: `probe` names each key to rename, the values stay. `npx db2kit describe SCHEMA.NAME` gives the names. db2kit never rewrites the file                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| 0.36.1        | `npx db2kit add` writes the cases file of a procedure that reads when it does not exist, even once the rule and the types are written: it stopped there before, while `verify` named `add` to write it                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | To write the cases file again in the form of 0.36.0, delete it and run `npx db2kit add SCHEMA.NAME` in a terminal: paste the former content at the first input, its keys by property or by catalog name, and `add` writes it with the names of the catalog                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| 0.36.2        | The read cases `verify` writes sort `findPages` by a list on a unique key of several columns: the former template sorted by one object of several properties, refused before sending with `USAGE`. `no sample` gives its reason. A procedure `verify` does not call names `add --rollback` when it modifies data                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | Delete `db2kit-cases/reads.ts` and run `npx db2kit verify` twice to get the corrected template, or in the file replace each `orderBy: { a: 'asc', b: 'asc' }` of a `findPages` case by `orderBy: [{ a: 'asc' }, { b: 'asc' }]`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| 0.36.3        | When Db2 becomes unreachable and the breaker opens, the requests already waiting for a connection fail together with `Db2UnavailableError`, as a new request does. Before, the pool let them go one by one as it tried an open again for each, which could hold a request more than a second. `npm run test:load` in the repository of db2kit: the library under many concurrent requests, on the fake driver                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | Nothing                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| 0.36.4        | The requests waiting for a connection when the breaker opens are refused at once in every case: 0.36.3 refused them on a later turn of the event loop, which a stream of requests failing without any I/O could delay. `npm run test:load` takes `DB2KIT_LOAD_CALLERS` and `DB2KIT_LOAD_POOL` beside `DB2KIT_LOAD_SCALE`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | Nothing                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| 0.37.0-beta.0 | First version on npm, under the `beta` tag: `npm install db2kit@beta` replaces the archive kept in the application ([Install](#install)). The list of tests of db2kit on a real subsystem leaves `checklists.md` for `integration-tests.md`, in the repository of db2kit: `checklists.md` keeps the configuration of an application                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | `npm install db2kit@beta`, then remove the archive from `vendor/` and its path from `package.json`. Nothing else                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| 0.37.0-beta.1 | `npx db2kit add` on a procedure whose outputs come one per field, with no status per field for them: it no longer proposes the codes of the fields as success values, only the global codes (`RETURN_CODE`, `SQL_CODE`), and a draft it wrote with such success values is written again without them, after a yes; a rule edited by hand, it says what to remove. Its `Next:` block starts with the questions only the team that owns the program answers, named for the procedure: the codes of its fields, what its one-character output per field says, the values of its global codes that mean a refusal. `--rollback` shows the codes of the fields beside the status values of the cases                                                                                                                                                                                                                                                                                                                                                                                          | Nothing required. A rule `add` wrote with the codes of the fields among its success values: run `npx db2kit add SCHEMA.NAME` again and answer yes, or remove them from `success` by hand                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| 0.37.0-beta.2 | The CLI and `loadConfigFile` refuse a function as the default export of the configuration, which db2kit never calls, and say what to write. `FakeDriver.onCall`, `procedureMask`, `callPattern` and `groupBySuffix` take a procedure whose result sets `probe` typed. `ibm_db` refused by the system, for its glibc, is said so, with the older clidriver to install.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| 0.37.0-beta.3 | Adding a procedure made simpler. The board of a procedure at the end of `add`, and `npx db2kit status`, from the files alone. The procedure path and the help in French, `cli.language` or `--language fr`. `npx db2kit sheet`: the questions for the team that owns the program, the success value of each status output, its error codes and their meaning on a page of their own, read back from the reply with `--answers`, or as JSON with `--json`. Named conventions, `procedures.conventions` and `convention: 'name'` in a rule, `add` proposing those that fit, `check` naming the rules a change of one reaches. A new key `refused` of a rule, each value with its meaning when given, the reason of the HTTP 422 answer.                                                                                                                                                                                                                                                                                                                                                    |
| 1.0.1         | First stable version, published under the `latest` tag: `npm install db2kit` finds it, `@beta` is no longer needed. From a beta: `npm install db2kit@latest`. The output of `npx db2kit add` for a procedure is laid out in phases, the files first, a heading per phase, short lines with a mark, questions that name what they decide, and a shorter `Next:` block ([cli.md](cli.md#add)). Nothing to change in the application                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
