@simtlix/simfinity-postgres 3.14.0 → 3.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -31,7 +31,7 @@ import { postgresPlugin } from '@simtlix/simfinity-postgres';
31
31
  const simfinity = createSQL({ plugin: postgresPlugin({ pool, schema: 'library' }) });
32
32
  ```
33
33
 
34
- Install `@simtlix/simfinity-sql@3.14.0` as a direct dependency when importing its factory. PostgreSQL 15 or later is the only supported SQL plugin. The [SQL package guide](https://github.com/simtlix/simfinity.js/tree/master/packages/sql) documents relational planning and the versioned plugin contract.
34
+ Install `@simtlix/simfinity-sql@3.15.0` as a direct dependency when importing its factory. PostgreSQL 15 or later is the only supported SQL plugin. The [SQL package guide](https://github.com/simtlix/simfinity.js/tree/master/packages/sql) documents relational planning and the versioned plugin contract.
35
35
 
36
36
  Both factories permanently bind one pool and schema, and five optional settings: `multiRowInserts: false` keeps one `INSERT` per owned row instead of multi-row statements; `explicitNullsOrder: true` keeps the `NULLS` clause on sorts of `id` and required fields, as 3.5.9 did, instead of letting indexes serve them; `batchedCollections: true` reads the generated collection fields of the parents that share their arguments with one statement per 100 parents, in a transaction that turns JIT off for that transaction only, instead of one statement per field as 3.6.0 did and as the default still does, and can return unsorted and tied rows in another order; the opt-in `refreshTriggers: 'perRoot'` refreshes each changed root's owned shape and unique keys once per transaction, while its guard trigger stays deferred, instead of once per changed row; and the opt-in `ownerIndexes: 'minimal'` leaves out the `(__owner_id)` indexes that the primary key or a unique index covers on new owned and guard tables. An unknown `refreshTriggers` or `ownerIndexes` value throws `INVALID_DATABASE_SCHEMA` (400). Read the [upgrade notes](https://simtlix.github.io/simfinity.js/resources/compatibility.html#upgrade-to-3-6-0) before enabling the opt-ins: versions up to 3.5.9 cannot validate databases created with them. The returned runtime supports registration, generated queries and mutations, middleware and scopes, controllers and validators, custom queries and mutations, named views, state machines, nested relationship writes, embedded reconstruction, and native PostgreSQL model handles. Native handles expose `findById`, `find`, `create`, `update`, and `delete`; they are not Mongoose models. `find(args, { session })` accepts the generated GraphQL list query arguments. Existing `pg.Pool` configuration and `pg.PoolClient` query interfaces remain compatible across both factories. A custom pool or client wrapper should pass `pg`'s `command` through in query results: the plugin reads it from the `COMMIT` result to detect a transaction that PostgreSQL rolled back because one of its statements failed, and without it such a transaction reports success with nothing stored.
37
37
 
@@ -62,7 +62,7 @@ The module and every `createPostgres` instance expose the shared `auth`, `valida
62
62
  MCP integration is an independent opt-in and does not add MCP dependencies to PostgreSQL applications:
63
63
 
64
64
  ```sh
65
- npm install @simtlix/simfinity-mcp@3.14.0 @modelcontextprotocol/sdk@^1.31.0
65
+ npm install @simtlix/simfinity-mcp@3.15.0 @modelcontextprotocol/sdk@^1.31.0
66
66
  ```
67
67
 
68
68
  ```javascript
@@ -122,3 +122,24 @@ await initializeDatabase(pool, description, { mode: 'validate' });
122
122
  ```
123
123
 
124
124
  Low-level `describeDatabase(registrations, { schema, refreshTriggers, ownerIndexes })` uses the `public` schema when `schema` is omitted, not the schema of a configured runtime; pass the schema given to `configure()` or `createPostgres()`, or call `describeDatabase()` and `compileDatabaseSchema()` without arguments for the default instance. `compileDatabaseSchema` returns reviewable SQL. Low-level `initializeDatabase(pool, description, { mode })` creates or validates storage transactionally and never closes the pool. Create mode adds missing objects and rejects incompatible definitions; validate mode performs no DDL. Neither mode performs destructive schema synchronization or data migration.
125
+
126
+ Controller `onSaveCommitted`, `onUpdateCommitted`, `onDeleteCommitted` and `onTransitionCommitted` callbacks run serially after the owning transaction confirms commit and attempts cleanup. `configureAfterCommit({ onError })` configures reporting per runtime; callback failures do not fail the committed write. Borrowed lifecycle writes, such as those inside a registered mutation or `withTransaction(null, callback)`, join that owner's queue; a session this runtime did not create is rejected with `INVALID_SESSION`, as before. Existing hooks remain transactional. See [the contract, payloads and outbox requirements](https://simtlix.github.io/simfinity.js/guide/controllers.html#after-commit-callbacks).
127
+
128
+ ## Client metadata
129
+
130
+ Since 3.15.0, install the optional `@simtlix/simfinity-descriptor` package,
131
+ aligned with your Simfinity version. It exports `buildClientDescriptor(schema)`
132
+ and `createClientDescriptorHandler(schema, { authorize: 'public' })`. The builder
133
+ describes the exact `createSchema()` result; the explicitly mounted handler can
134
+ instead use an application access function. These functions are not facade/core
135
+ exports. The descriptor does not evaluate dynamic permissions or serialize
136
+ arbitrary validators.
137
+
138
+ Legacy introspection stays enabled by default in 3.x. To opt out, import
139
+ `configureIntrospection` from `@simtlix/simfinity-core/introspection` in a separate
140
+ bootstrap module and call it with `{ fieldExtensions: false }` **before importing
141
+ the runtime or facades**. That direct import requires core as a direct dependency
142
+ pinned to the facade's exact version, including under pnpm or Yarn PnP. A late
143
+ call fails without deleting installed metadata. Migrate clients selecting
144
+ `__Field.extensions` before opting out. See the [descriptor reference](https://simtlix.github.io/simfinity.js/reference/client-descriptor.html)
145
+ for the format, protected HTTP access and composition limits.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simtlix/simfinity-postgres",
3
- "version": "3.14.0",
3
+ "version": "3.15.0",
4
4
  "description": "PostgreSQL GraphQL runtime and schema generation with foreign keys for Simfinity",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -27,8 +27,8 @@
27
27
  "directory": "packages/postgres"
28
28
  },
29
29
  "dependencies": {
30
- "@simtlix/simfinity-core": "3.14.0",
31
- "@simtlix/simfinity-sql": "3.14.0",
30
+ "@simtlix/simfinity-core": "3.15.0",
31
+ "@simtlix/simfinity-sql": "3.15.0",
32
32
  "pg": "^8.16.3"
33
33
  },
34
34
  "peerDependencies": {
package/src/index.js CHANGED
@@ -22,7 +22,7 @@ export {
22
22
  /** Each instance permanently binds one pool/schema; getModel exposes PostgreSQL native helpers. */
23
23
  export const createPostgres = (options) => createSQL({ plugin: postgresPlugin(options) });
24
24
  const defaultInstance = createPostgres();
25
- export const { configureQueryLimits, configureMutationLimits, configure, connect, addNoEndpointType, createSchema, getModel, getType, getInputType, getRegistrations, use, registerMutation, registerCustomQuery, registerView, saveObject, preventCreatingCollection, withTransaction } = defaultInstance;
25
+ export const { configureQueryLimits, configureMutationLimits, configureAfterCommit, configure, connect, addNoEndpointType, createSchema, getModel, getType, getInputType, getRegistrations, use, registerMutation, registerCustomQuery, registerView, saveObject, preventCreatingCollection, withTransaction } = defaultInstance;
26
26
 
27
27
  /** Preserve the foundation low-level API while allowing initialization of the configured default instance. */
28
28
  export const initializeDatabase = (poolOrOptions, description, options) => description
package/types/index.d.ts CHANGED
@@ -15,6 +15,9 @@ export {
15
15
  validators,
16
16
  } from '@simtlix/simfinity-core';
17
17
  export type {
18
+ AfterCommitErrorDetails,
19
+ AfterCommitOptions,
20
+ CommittedControllerCallbacks,
18
21
  AuthPluginOptions,
19
22
  AuthRule,
20
23
  AuthRuleFunction,
@@ -300,6 +303,7 @@ export function createPostgres(options?: PostgresConfiguration): PostgresRuntime
300
303
  * anything other than a non-empty string.
301
304
  */
302
305
  export function caseFoldExpression(sqlExpression: string): string;
306
+ export const configureAfterCommit: PostgresRuntime['configureAfterCommit'];
303
307
  export const configure: PostgresRuntime['configure'];
304
308
  export const connect: PostgresRuntime['connect'];
305
309
  export const addNoEndpointType: PostgresRuntime['addNoEndpointType'];