turbine-orm 0.93.1 → 0.94.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 +49 -23
- package/dist/adapters/cockroachdb.d.ts +3 -3
- package/dist/adapters/cockroachdb.js +7 -11
- package/dist/adapters/index.d.ts +1 -1
- package/dist/adapters/yugabytedb.js +1 -1
- package/dist/better-sqlite3.d.ts +132 -0
- package/dist/better-sqlite3.js +303 -0
- package/dist/catalog-metadata.d.ts +250 -0
- package/dist/catalog-metadata.js +730 -0
- package/dist/cjs/adapters/cockroachdb.d.ts +3 -3
- package/dist/cjs/adapters/cockroachdb.js +7 -11
- package/dist/cjs/adapters/index.d.ts +1 -1
- package/dist/cjs/adapters/yugabytedb.js +1 -1
- package/dist/cjs/better-sqlite3.d.ts +132 -0
- package/dist/cjs/better-sqlite3.js +311 -0
- package/dist/cjs/catalog-metadata.d.ts +250 -0
- package/dist/cjs/catalog-metadata.js +747 -0
- package/dist/cjs/cli/compile-query.d.ts +6 -3
- package/dist/cjs/cli/compile-query.js +24 -3
- package/dist/cjs/cli/config.d.ts +35 -10
- package/dist/cjs/cli/config.js +173 -42
- package/dist/cjs/cli/d1-config.d.ts +14 -0
- package/dist/cjs/cli/d1-config.js +9 -0
- package/dist/cjs/cli/d1-local.d.ts +31 -0
- package/dist/cjs/cli/d1-local.js +298 -0
- package/dist/cjs/cli/d1-migrations.d.ts +16 -0
- package/dist/cjs/cli/d1-migrations.js +156 -0
- package/dist/cjs/cli/d1-project.d.ts +23 -0
- package/dist/cjs/cli/d1-project.js +314 -0
- package/dist/cjs/cli/d1-seed.d.ts +35 -0
- package/dist/cjs/cli/d1-seed.js +220 -0
- package/dist/cjs/cli/destructive.js +1 -2
- package/dist/cjs/cli/error-catalog.d.ts +3 -3
- package/dist/cjs/cli/error-catalog.js +21 -3
- package/dist/cjs/cli/index.d.ts +13 -8
- package/dist/cjs/cli/index.js +503 -71
- package/dist/cjs/cli/libsql-migrate-command.d.ts +5 -0
- package/dist/cjs/cli/libsql-migrate-command.js +82 -0
- package/dist/cjs/cli/libsql-migrate-status.d.ts +33 -0
- package/dist/cjs/cli/libsql-migrate-status.js +189 -0
- package/dist/cjs/cli/libsql-migrate.d.ts +14 -0
- package/dist/cjs/cli/libsql-migrate.js +522 -0
- package/dist/cjs/cli/libsql-project-config.d.ts +11 -0
- package/dist/cjs/cli/libsql-project-config.js +59 -0
- package/dist/cjs/cli/libsql-project.d.ts +52 -0
- package/dist/cjs/cli/libsql-project.js +409 -0
- package/dist/cjs/cli/libsql-seed-command.d.ts +29 -0
- package/dist/cjs/cli/libsql-seed-command.js +93 -0
- package/dist/cjs/cli/loader.d.ts +6 -5
- package/dist/cjs/cli/loader.js +53 -9
- package/dist/cjs/cli/mcp.d.ts +16 -1
- package/dist/cjs/cli/mcp.js +219 -125
- package/dist/cjs/cli/migrate.d.ts +2 -2
- package/dist/cjs/cli/migrate.js +29 -14
- package/dist/cjs/cli/mssql-doctor.d.ts +44 -0
- package/dist/cjs/cli/mssql-doctor.js +277 -0
- package/dist/cjs/cli/mssql-migrate-command.d.ts +9 -0
- package/dist/cjs/cli/mssql-migrate-command.js +230 -0
- package/dist/cjs/cli/mssql-migrate-connection.d.ts +51 -0
- package/dist/cjs/cli/mssql-migrate-connection.js +255 -0
- package/dist/cjs/cli/mssql-migrate-sql.d.ts +12 -0
- package/dist/cjs/cli/mssql-migrate-sql.js +282 -0
- package/dist/cjs/cli/mssql-migrate.d.ts +45 -0
- package/dist/cjs/cli/mssql-migrate.js +296 -0
- package/dist/cjs/cli/mssql-project.d.ts +34 -0
- package/dist/cjs/cli/mssql-project.js +171 -0
- package/dist/cjs/cli/mssql-seed.d.ts +7 -0
- package/dist/cjs/cli/mssql-seed.js +78 -0
- package/dist/cjs/cli/mssql-tools.d.ts +37 -0
- package/dist/cjs/cli/mssql-tools.js +354 -0
- package/dist/cjs/cli/mysql-doctor.d.ts +48 -0
- package/dist/cjs/cli/mysql-doctor.js +323 -0
- package/dist/cjs/cli/mysql-migrate-command.d.ts +7 -0
- package/dist/cjs/cli/mysql-migrate-command.js +290 -0
- package/dist/cjs/cli/mysql-migrate-sql.d.ts +18 -0
- package/dist/cjs/cli/mysql-migrate-sql.js +166 -0
- package/dist/cjs/cli/mysql-migrate.d.ts +77 -0
- package/dist/cjs/cli/mysql-migrate.js +619 -0
- package/dist/cjs/cli/mysql-project.d.ts +49 -0
- package/dist/cjs/cli/mysql-project.js +284 -0
- package/dist/cjs/cli/mysql-push-command.d.ts +7 -0
- package/dist/cjs/cli/mysql-push-command.js +94 -0
- package/dist/cjs/cli/mysql-push.d.ts +15 -0
- package/dist/cjs/cli/mysql-push.js +98 -0
- package/dist/cjs/cli/mysql-schema-command.d.ts +5 -0
- package/dist/cjs/cli/mysql-schema-command.js +58 -0
- package/dist/cjs/cli/mysql-schema-ddl.d.ts +37 -0
- package/dist/cjs/cli/mysql-schema-ddl.js +234 -0
- package/dist/cjs/cli/mysql-schema-snapshot.d.ts +21 -0
- package/dist/cjs/cli/mysql-schema-snapshot.js +127 -0
- package/dist/cjs/cli/mysql-schema.d.ts +27 -0
- package/dist/cjs/cli/mysql-schema.js +206 -0
- package/dist/cjs/cli/mysql-seed-loader.cjs +58 -0
- package/dist/cjs/cli/mysql-seed-loader.d.cts +3 -0
- package/dist/cjs/cli/mysql-seed.d.ts +6 -0
- package/dist/cjs/cli/mysql-seed.js +83 -0
- package/dist/cjs/cli/mysql-tools.d.ts +44 -0
- package/dist/cjs/cli/mysql-tools.js +336 -0
- package/dist/cjs/cli/no-follow.d.ts +29 -0
- package/dist/cjs/cli/no-follow.js +73 -0
- package/dist/cjs/cli/pii-predicate-guard.d.ts +1 -1
- package/dist/cjs/cli/pii-predicate-guard.js +2 -2
- package/dist/cjs/cli/pii-tags.d.ts +2 -2
- package/dist/cjs/cli/pii-tags.js +1 -1
- package/dist/cjs/cli/prisma-schema.js +2 -2
- package/dist/cjs/cli/sql-statements.d.ts +1 -1
- package/dist/cjs/cli/sql-statements.js +1 -1
- package/dist/cjs/cli/sqlite-doctor.d.ts +35 -0
- package/dist/cjs/cli/sqlite-doctor.js +400 -0
- package/dist/cjs/cli/sqlite-migrate-command.d.ts +4 -0
- package/dist/cjs/cli/sqlite-migrate-command.js +175 -0
- package/dist/cjs/cli/sqlite-migrate.d.ts +61 -0
- package/dist/cjs/cli/sqlite-migrate.js +692 -0
- package/dist/cjs/cli/sqlite-project.d.ts +42 -0
- package/dist/cjs/cli/sqlite-project.js +254 -0
- package/dist/cjs/cli/sqlite-schema-command.d.ts +4 -0
- package/dist/cjs/cli/sqlite-schema-command.js +82 -0
- package/dist/cjs/cli/sqlite-schema-ddl.d.ts +25 -0
- package/dist/cjs/cli/sqlite-schema-ddl.js +252 -0
- package/dist/cjs/cli/sqlite-schema.d.ts +25 -0
- package/dist/cjs/cli/sqlite-schema.js +334 -0
- package/dist/cjs/cli/sqlite-seed.d.ts +4 -0
- package/dist/cjs/cli/sqlite-seed.js +94 -0
- package/dist/cjs/cli/sqlite-tools.d.ts +24 -0
- package/dist/cjs/cli/sqlite-tools.js +169 -0
- package/dist/cjs/cli/studio.js +9 -9
- package/dist/cjs/cli/tool-capabilities.d.ts +72 -0
- package/dist/cjs/cli/tool-capabilities.js +120 -0
- package/dist/cjs/cli/tool-command.d.ts +11 -0
- package/dist/cjs/cli/tool-command.js +49 -0
- package/dist/cjs/cli/ui.d.ts +1 -1
- package/dist/cjs/cli/ui.js +1 -1
- package/dist/cjs/client.d.ts +20 -20
- package/dist/cjs/client.js +65 -344
- package/dist/cjs/connection-url.d.ts +1 -1
- package/dist/cjs/connection-url.js +1 -1
- package/dist/cjs/core.d.ts +58 -0
- package/dist/cjs/core.js +225 -0
- package/dist/cjs/d1/catalog-metadata.d.ts +5 -0
- package/dist/cjs/d1/catalog-metadata.js +230 -0
- package/dist/cjs/d1/catalog.d.ts +15 -0
- package/dist/cjs/d1/catalog.js +88 -0
- package/dist/cjs/d1/generate.d.ts +8 -0
- package/dist/cjs/d1/generate.js +163 -0
- package/dist/cjs/d1/introspect.d.ts +21 -0
- package/dist/cjs/d1/introspect.js +74 -0
- package/dist/cjs/d1/migrate.d.ts +29 -0
- package/dist/cjs/d1/migrate.js +222 -0
- package/dist/cjs/d1/migrations/sql.d.ts +2 -0
- package/dist/cjs/d1/migrations/sql.js +109 -0
- package/dist/cjs/d1/pool.d.ts +14 -0
- package/dist/cjs/d1/pool.js +90 -0
- package/dist/cjs/d1/sql.d.ts +5 -0
- package/dist/cjs/d1/sql.js +140 -0
- package/dist/cjs/d1/sqlite-dialect.d.ts +16 -0
- package/dist/cjs/d1/sqlite-dialect.js +579 -0
- package/dist/cjs/d1/types.d.ts +29 -0
- package/dist/cjs/d1/types.js +2 -0
- package/dist/cjs/d1.d.ts +53 -0
- package/dist/cjs/d1.js +220 -0
- package/dist/cjs/dialect.d.ts +33 -5
- package/dist/cjs/dialect.js +8 -6
- package/dist/cjs/errors.d.ts +38 -1
- package/dist/cjs/errors.js +72 -18
- package/dist/cjs/generate.d.ts +19 -3
- package/dist/cjs/generate.js +330 -97
- package/dist/cjs/global-filters-config.js +4 -4
- package/dist/cjs/index-advisor.js +6 -6
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +3 -2
- package/dist/cjs/introspect.d.ts +59 -356
- package/dist/cjs/introspect.js +158 -984
- package/dist/cjs/libsql/bindings.d.ts +2 -0
- package/dist/cjs/libsql/bindings.js +78 -0
- package/dist/cjs/libsql/dialect.d.ts +3 -0
- package/dist/cjs/libsql/dialect.js +48 -0
- package/dist/cjs/libsql/generate.d.ts +4 -0
- package/dist/cjs/libsql/generate.js +56 -0
- package/dist/cjs/libsql/introspect.d.ts +16 -0
- package/dist/cjs/libsql/introspect.js +295 -0
- package/dist/cjs/libsql/pool.d.ts +42 -0
- package/dist/cjs/libsql/pool.js +275 -0
- package/dist/cjs/libsql/seed-cleanup.d.ts +2 -0
- package/dist/cjs/libsql/seed-cleanup.js +19 -0
- package/dist/cjs/libsql/values.d.ts +20 -0
- package/dist/cjs/libsql/values.js +75 -0
- package/dist/cjs/libsql-seed.d.ts +19 -0
- package/dist/cjs/libsql-seed.js +50 -0
- package/dist/cjs/libsql.d.ts +28 -0
- package/dist/cjs/libsql.js +88 -0
- package/dist/cjs/live-query.d.ts +33 -0
- package/dist/cjs/live-query.js +172 -0
- package/dist/cjs/log-codes.d.ts +1 -1
- package/dist/cjs/log-codes.js +4 -0
- package/dist/cjs/mssql-seed.d.ts +27 -0
- package/dist/cjs/mssql-seed.js +118 -0
- package/dist/cjs/mssql.d.ts +7 -7
- package/dist/cjs/mssql.js +365 -53
- package/dist/cjs/mysql-seed.d.ts +25 -0
- package/dist/cjs/mysql-seed.js +169 -0
- package/dist/cjs/mysql.d.ts +18 -6
- package/dist/cjs/mysql.js +602 -94
- package/dist/cjs/neon-http/client.d.ts +95 -0
- package/dist/cjs/neon-http/client.js +291 -0
- package/dist/cjs/neon-http/sql.d.ts +3 -0
- package/dist/cjs/neon-http/sql.js +116 -0
- package/dist/cjs/neon-http.d.ts +5 -0
- package/dist/cjs/neon-http.js +8 -0
- package/dist/cjs/neon-ws/load-driver.cjs +44 -0
- package/dist/cjs/neon-ws/load-driver.d.cts +9 -0
- package/dist/cjs/neon-ws/recovery.d.ts +14 -0
- package/dist/cjs/neon-ws/recovery.js +69 -0
- package/dist/cjs/neon-ws/snapshot.d.ts +3 -0
- package/dist/cjs/neon-ws/snapshot.js +17 -0
- package/dist/cjs/neon-ws/transport.d.ts +112 -0
- package/dist/cjs/neon-ws/transport.js +290 -0
- package/dist/cjs/neon-ws.d.ts +26 -0
- package/dist/cjs/neon-ws.js +189 -0
- package/dist/cjs/nested-write.d.ts +34 -3
- package/dist/cjs/nested-write.js +117 -24
- package/dist/cjs/notification-hub/consumer.d.ts +22 -0
- package/dist/cjs/notification-hub/consumer.js +111 -0
- package/dist/cjs/notification-hub.d.ts +41 -0
- package/dist/cjs/notification-hub.js +373 -0
- package/dist/cjs/pg-catalog-text.d.ts +96 -0
- package/dist/cjs/pg-catalog-text.js +213 -0
- package/dist/cjs/pg-types.d.ts +46 -2
- package/dist/cjs/pipeline-submittable.d.ts +15 -5
- package/dist/cjs/pipeline-submittable.js +103 -48
- package/dist/cjs/pipeline.d.ts +5 -2
- package/dist/cjs/pipeline.js +111 -41
- package/dist/cjs/plan-divergence.d.ts +1 -1
- package/dist/cjs/plan-divergence.js +1 -1
- package/dist/cjs/powdb-introspect.d.ts +1 -1
- package/dist/cjs/powdb-introspect.js +5 -5
- package/dist/cjs/powdb-shared.d.ts +5 -5
- package/dist/cjs/powdb-shared.js +6 -5
- package/dist/cjs/powdb.d.ts +28 -10
- package/dist/cjs/powdb.js +80 -28
- package/dist/cjs/powql.d.ts +50 -28
- package/dist/cjs/powql.js +47 -33
- package/dist/cjs/prisma-compat.js +4 -5
- package/dist/cjs/prisma-schema-fingerprint.d.ts +1 -1
- package/dist/cjs/prisma-schema-fingerprint.js +1 -1
- package/dist/cjs/query/aggregates.d.ts +0 -13
- package/dist/cjs/query/aggregates.js +105 -238
- package/dist/cjs/query/batched-loader.d.ts +1 -1
- package/dist/cjs/query/batched-loader.js +18 -20
- package/dist/cjs/query/builder.d.ts +108 -144
- package/dist/cjs/query/builder.js +592 -893
- package/dist/cjs/query/compound-unique.d.ts +18 -3
- package/dist/cjs/query/compound-unique.js +110 -43
- package/dist/cjs/query/cursor-tuple.d.ts +17 -0
- package/dist/cjs/query/cursor-tuple.js +121 -0
- package/dist/cjs/query/expr.d.ts +2 -0
- package/dist/cjs/query/expr.js +40 -23
- package/dist/cjs/query/filters.d.ts +39 -7
- package/dist/cjs/query/filters.js +77 -19
- package/dist/cjs/query/normalize-args.d.ts +1 -1
- package/dist/cjs/query/normalize-args.js +7 -5
- package/dist/cjs/query/option-surface.d.ts +1 -1
- package/dist/cjs/query/option-surface.js +5 -3
- package/dist/cjs/query/pg-type-parsers.d.ts +126 -0
- package/dist/cjs/query/pg-type-parsers.js +306 -0
- package/dist/cjs/query/relation-names.d.ts +4 -2
- package/dist/cjs/query/relation-names.js +21 -12
- package/dist/cjs/query/relations.d.ts +19 -7
- package/dist/cjs/query/relations.js +329 -260
- package/dist/cjs/query/row-lock.js +3 -3
- package/dist/cjs/query/sql-comment.js +3 -3
- package/dist/cjs/query/stream-idle.d.ts +11 -1
- package/dist/cjs/query/stream-idle.js +53 -13
- package/dist/cjs/query/stream-signal.d.ts +21 -0
- package/dist/cjs/query/stream-signal.js +132 -0
- package/dist/cjs/query/temporal-parsers.d.ts +101 -0
- package/dist/cjs/query/temporal-parsers.js +362 -0
- package/dist/cjs/query/types.d.ts +67 -20
- package/dist/cjs/query/utils.d.ts +2 -878
- package/dist/cjs/query/utils.js +25 -2058
- package/dist/cjs/query/warn-registry.d.ts +1 -1
- package/dist/cjs/query/warn-registry.js +1 -1
- package/dist/cjs/query/where-compile.d.ts +4 -1
- package/dist/cjs/query/where-compile.js +18 -14
- package/dist/cjs/query/where.d.ts +14 -7
- package/dist/cjs/query/where.js +244 -436
- package/dist/cjs/query/writes.d.ts +33 -2
- package/dist/cjs/query/writes.js +104 -77
- package/dist/cjs/query-utils.d.ts +687 -0
- package/dist/cjs/query-utils.js +1444 -0
- package/dist/cjs/realtime.d.ts +1 -1
- package/dist/cjs/realtime.js +3 -3
- package/dist/cjs/schema-builder.js +2 -2
- package/dist/cjs/schema-metadata.d.ts +13 -3
- package/dist/cjs/schema-metadata.js +33 -5
- package/dist/cjs/schema-sql.d.ts +15 -24
- package/dist/cjs/schema-sql.js +53 -63
- package/dist/cjs/schema.d.ts +37 -2
- package/dist/cjs/schema.js +29 -2
- package/dist/cjs/seed.js +5 -5
- package/dist/cjs/serverless.d.ts +24 -71
- package/dist/cjs/serverless.js +24 -71
- package/dist/cjs/sql.d.ts +111 -0
- package/dist/cjs/sql.js +335 -0
- package/dist/cjs/sqlite-seed.d.ts +17 -0
- package/dist/cjs/sqlite-seed.js +31 -0
- package/dist/cjs/sqlite.d.ts +32 -19
- package/dist/cjs/sqlite.js +865 -652
- package/dist/cjs/supplied-pool-types.js +10 -9
- package/dist/cjs/transaction-control.js +6 -1
- package/dist/cjs/transaction-outcome.d.ts +61 -0
- package/dist/cjs/transaction-outcome.js +239 -0
- package/dist/cjs/transaction-state.d.ts +82 -13
- package/dist/cjs/transaction-state.js +222 -56
- package/dist/cjs/transaction-transport.d.ts +38 -0
- package/dist/cjs/transaction-transport.js +157 -0
- package/dist/cjs/typed-sql.d.ts +1 -1
- package/dist/cjs/typed-sql.js +1 -1
- package/dist/cli/compile-query.d.ts +6 -3
- package/dist/cli/compile-query.js +25 -4
- package/dist/cli/config.d.ts +35 -10
- package/dist/cli/config.js +170 -43
- package/dist/cli/d1-config.d.ts +14 -0
- package/dist/cli/d1-config.js +6 -0
- package/dist/cli/d1-local.d.ts +31 -0
- package/dist/cli/d1-local.js +285 -0
- package/dist/cli/d1-migrations.d.ts +16 -0
- package/dist/cli/d1-migrations.js +151 -0
- package/dist/cli/d1-project.d.ts +23 -0
- package/dist/cli/d1-project.js +304 -0
- package/dist/cli/d1-seed.d.ts +35 -0
- package/dist/cli/d1-seed.js +213 -0
- package/dist/cli/destructive.js +1 -2
- package/dist/cli/error-catalog.d.ts +3 -3
- package/dist/cli/error-catalog.js +21 -3
- package/dist/cli/index.d.ts +13 -8
- package/dist/cli/index.js +500 -71
- package/dist/cli/libsql-migrate-command.d.ts +5 -0
- package/dist/cli/libsql-migrate-command.js +77 -0
- package/dist/cli/libsql-migrate-status.d.ts +33 -0
- package/dist/cli/libsql-migrate-status.js +182 -0
- package/dist/cli/libsql-migrate.d.ts +14 -0
- package/dist/cli/libsql-migrate.js +516 -0
- package/dist/cli/libsql-project-config.d.ts +11 -0
- package/dist/cli/libsql-project-config.js +55 -0
- package/dist/cli/libsql-project.d.ts +52 -0
- package/dist/cli/libsql-project.js +391 -0
- package/dist/cli/libsql-seed-command.d.ts +29 -0
- package/dist/cli/libsql-seed-command.js +85 -0
- package/dist/cli/loader.d.ts +6 -5
- package/dist/cli/loader.js +50 -9
- package/dist/cli/mcp.d.ts +16 -1
- package/dist/cli/mcp.js +220 -127
- package/dist/cli/migrate.d.ts +2 -2
- package/dist/cli/migrate.js +29 -14
- package/dist/cli/mssql-doctor.d.ts +44 -0
- package/dist/cli/mssql-doctor.js +237 -0
- package/dist/cli/mssql-migrate-command.d.ts +9 -0
- package/dist/cli/mssql-migrate-command.js +192 -0
- package/dist/cli/mssql-migrate-connection.d.ts +51 -0
- package/dist/cli/mssql-migrate-connection.js +245 -0
- package/dist/cli/mssql-migrate-sql.d.ts +12 -0
- package/dist/cli/mssql-migrate-sql.js +275 -0
- package/dist/cli/mssql-migrate.d.ts +45 -0
- package/dist/cli/mssql-migrate.js +290 -0
- package/dist/cli/mssql-project.d.ts +34 -0
- package/dist/cli/mssql-project.js +160 -0
- package/dist/cli/mssql-seed.d.ts +7 -0
- package/dist/cli/mssql-seed.js +73 -0
- package/dist/cli/mssql-tools.d.ts +37 -0
- package/dist/cli/mssql-tools.js +341 -0
- package/dist/cli/mysql-doctor.d.ts +48 -0
- package/dist/cli/mysql-doctor.js +316 -0
- package/dist/cli/mysql-migrate-command.d.ts +7 -0
- package/dist/cli/mysql-migrate-command.js +285 -0
- package/dist/cli/mysql-migrate-sql.d.ts +18 -0
- package/dist/cli/mysql-migrate-sql.js +162 -0
- package/dist/cli/mysql-migrate.d.ts +77 -0
- package/dist/cli/mysql-migrate.js +606 -0
- package/dist/cli/mysql-project.d.ts +49 -0
- package/dist/cli/mysql-project.js +272 -0
- package/dist/cli/mysql-push-command.d.ts +7 -0
- package/dist/cli/mysql-push-command.js +89 -0
- package/dist/cli/mysql-push.d.ts +15 -0
- package/dist/cli/mysql-push.js +95 -0
- package/dist/cli/mysql-schema-command.d.ts +5 -0
- package/dist/cli/mysql-schema-command.js +54 -0
- package/dist/cli/mysql-schema-ddl.d.ts +37 -0
- package/dist/cli/mysql-schema-ddl.js +227 -0
- package/dist/cli/mysql-schema-snapshot.d.ts +21 -0
- package/dist/cli/mysql-schema-snapshot.js +119 -0
- package/dist/cli/mysql-schema.d.ts +27 -0
- package/dist/cli/mysql-schema.js +200 -0
- package/dist/cli/mysql-seed-loader.cjs +25 -0
- package/dist/cli/mysql-seed-loader.d.cts +3 -0
- package/dist/cli/mysql-seed.d.ts +6 -0
- package/dist/cli/mysql-seed.js +75 -0
- package/dist/cli/mysql-tools.d.ts +44 -0
- package/dist/cli/mysql-tools.js +290 -0
- package/dist/cli/no-follow.d.ts +29 -0
- package/dist/cli/no-follow.js +67 -0
- package/dist/cli/pii-predicate-guard.d.ts +1 -1
- package/dist/cli/pii-predicate-guard.js +2 -2
- package/dist/cli/pii-tags.d.ts +2 -2
- package/dist/cli/pii-tags.js +1 -1
- package/dist/cli/prisma-schema.js +2 -2
- package/dist/cli/sql-statements.d.ts +1 -1
- package/dist/cli/sql-statements.js +1 -1
- package/dist/cli/sqlite-doctor.d.ts +35 -0
- package/dist/cli/sqlite-doctor.js +392 -0
- package/dist/cli/sqlite-migrate-command.d.ts +4 -0
- package/dist/cli/sqlite-migrate-command.js +171 -0
- package/dist/cli/sqlite-migrate.d.ts +61 -0
- package/dist/cli/sqlite-migrate.js +681 -0
- package/dist/cli/sqlite-project.d.ts +42 -0
- package/dist/cli/sqlite-project.js +244 -0
- package/dist/cli/sqlite-schema-command.d.ts +4 -0
- package/dist/cli/sqlite-schema-command.js +79 -0
- package/dist/cli/sqlite-schema-ddl.d.ts +25 -0
- package/dist/cli/sqlite-schema-ddl.js +248 -0
- package/dist/cli/sqlite-schema.d.ts +25 -0
- package/dist/cli/sqlite-schema.js +330 -0
- package/dist/cli/sqlite-seed.d.ts +4 -0
- package/dist/cli/sqlite-seed.js +57 -0
- package/dist/cli/sqlite-tools.d.ts +24 -0
- package/dist/cli/sqlite-tools.js +163 -0
- package/dist/cli/studio.js +9 -9
- package/dist/cli/tool-capabilities.d.ts +72 -0
- package/dist/cli/tool-capabilities.js +114 -0
- package/dist/cli/tool-command.d.ts +11 -0
- package/dist/cli/tool-command.js +45 -0
- package/dist/cli/ui.d.ts +1 -1
- package/dist/cli/ui.js +1 -1
- package/dist/client.d.ts +20 -20
- package/dist/client.js +62 -341
- package/dist/connection-url.d.ts +1 -1
- package/dist/connection-url.js +1 -1
- package/dist/core.d.ts +58 -0
- package/dist/core.js +220 -0
- package/dist/d1/catalog-metadata.d.ts +5 -0
- package/dist/d1/catalog-metadata.js +227 -0
- package/dist/d1/catalog.d.ts +15 -0
- package/dist/d1/catalog.js +82 -0
- package/dist/d1/generate.d.ts +8 -0
- package/dist/d1/generate.js +160 -0
- package/dist/d1/introspect.d.ts +21 -0
- package/dist/d1/introspect.js +71 -0
- package/dist/d1/migrate.d.ts +29 -0
- package/dist/d1/migrate.js +217 -0
- package/dist/d1/migrations/sql.d.ts +2 -0
- package/dist/d1/migrations/sql.js +106 -0
- package/dist/d1/pool.d.ts +14 -0
- package/dist/d1/pool.js +86 -0
- package/dist/d1/sql.d.ts +5 -0
- package/dist/d1/sql.js +135 -0
- package/dist/d1/sqlite-dialect.d.ts +16 -0
- package/dist/d1/sqlite-dialect.js +572 -0
- package/dist/d1/types.d.ts +29 -0
- package/dist/d1/types.js +1 -0
- package/dist/d1.d.ts +53 -0
- package/dist/d1.js +215 -0
- package/dist/dialect.d.ts +33 -5
- package/dist/dialect.js +6 -4
- package/dist/errors.d.ts +38 -1
- package/dist/errors.js +68 -17
- package/dist/generate.d.ts +19 -3
- package/dist/generate.js +330 -97
- package/dist/global-filters-config.js +2 -2
- package/dist/index-advisor.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/introspect.d.ts +59 -356
- package/dist/introspect.js +116 -943
- package/dist/libsql/bindings.d.ts +2 -0
- package/dist/libsql/bindings.js +75 -0
- package/dist/libsql/dialect.d.ts +3 -0
- package/dist/libsql/dialect.js +45 -0
- package/dist/libsql/generate.d.ts +4 -0
- package/dist/libsql/generate.js +53 -0
- package/dist/libsql/introspect.d.ts +16 -0
- package/dist/libsql/introspect.js +289 -0
- package/dist/libsql/pool.d.ts +42 -0
- package/dist/libsql/pool.js +270 -0
- package/dist/libsql/seed-cleanup.d.ts +2 -0
- package/dist/libsql/seed-cleanup.js +15 -0
- package/dist/libsql/values.d.ts +20 -0
- package/dist/libsql/values.js +68 -0
- package/dist/libsql-seed.d.ts +19 -0
- package/dist/libsql-seed.js +46 -0
- package/dist/libsql.d.ts +28 -0
- package/dist/libsql.js +79 -0
- package/dist/live-query.d.ts +33 -0
- package/dist/live-query.js +169 -0
- package/dist/log-codes.d.ts +1 -1
- package/dist/log-codes.js +4 -0
- package/dist/mssql-seed.d.ts +27 -0
- package/dist/mssql-seed.js +114 -0
- package/dist/mssql.d.ts +7 -7
- package/dist/mssql.js +366 -54
- package/dist/mysql-seed.d.ts +25 -0
- package/dist/mysql-seed.js +165 -0
- package/dist/mysql.d.ts +18 -6
- package/dist/mysql.js +603 -95
- package/dist/neon-http/client.d.ts +95 -0
- package/dist/neon-http/client.js +286 -0
- package/dist/neon-http/sql.d.ts +3 -0
- package/dist/neon-http/sql.js +112 -0
- package/dist/neon-http.d.ts +5 -0
- package/dist/neon-http.js +2 -0
- package/dist/neon-ws/load-driver.cjs +11 -0
- package/dist/neon-ws/load-driver.d.cts +9 -0
- package/dist/neon-ws/recovery.d.ts +14 -0
- package/dist/neon-ws/recovery.js +66 -0
- package/dist/neon-ws/snapshot.d.ts +3 -0
- package/dist/neon-ws/snapshot.js +15 -0
- package/dist/neon-ws/transport.d.ts +112 -0
- package/dist/neon-ws/transport.js +286 -0
- package/dist/neon-ws.d.ts +26 -0
- package/dist/neon-ws.js +182 -0
- package/dist/nested-write.d.ts +34 -3
- package/dist/nested-write.js +114 -22
- package/dist/notification-hub/consumer.d.ts +22 -0
- package/dist/notification-hub/consumer.js +106 -0
- package/dist/notification-hub.d.ts +41 -0
- package/dist/notification-hub.js +370 -0
- package/dist/pg-catalog-text.d.ts +96 -0
- package/dist/pg-catalog-text.js +208 -0
- package/dist/pg-types.d.ts +46 -2
- package/dist/pipeline-submittable.d.ts +15 -5
- package/dist/pipeline-submittable.js +105 -50
- package/dist/pipeline.d.ts +5 -2
- package/dist/pipeline.js +113 -43
- package/dist/plan-divergence.d.ts +1 -1
- package/dist/plan-divergence.js +1 -1
- package/dist/powdb-introspect.d.ts +1 -1
- package/dist/powdb-introspect.js +5 -5
- package/dist/powdb-shared.d.ts +5 -5
- package/dist/powdb-shared.js +6 -5
- package/dist/powdb.d.ts +28 -10
- package/dist/powdb.js +80 -28
- package/dist/powql.d.ts +50 -28
- package/dist/powql.js +49 -35
- package/dist/prisma-compat.js +4 -5
- package/dist/prisma-schema-fingerprint.d.ts +1 -1
- package/dist/prisma-schema-fingerprint.js +1 -1
- package/dist/query/aggregates.d.ts +0 -13
- package/dist/query/aggregates.js +97 -230
- package/dist/query/batched-loader.d.ts +1 -1
- package/dist/query/batched-loader.js +5 -7
- package/dist/query/builder.d.ts +108 -144
- package/dist/query/builder.js +563 -864
- package/dist/query/compound-unique.d.ts +18 -3
- package/dist/query/compound-unique.js +99 -33
- package/dist/query/cursor-tuple.d.ts +17 -0
- package/dist/query/cursor-tuple.js +114 -0
- package/dist/query/expr.d.ts +2 -0
- package/dist/query/expr.js +32 -16
- package/dist/query/filters.d.ts +39 -7
- package/dist/query/filters.js +69 -14
- package/dist/query/normalize-args.d.ts +1 -1
- package/dist/query/normalize-args.js +4 -2
- package/dist/query/option-surface.d.ts +1 -1
- package/dist/query/option-surface.js +4 -2
- package/dist/query/pg-type-parsers.d.ts +126 -0
- package/dist/query/pg-type-parsers.js +296 -0
- package/dist/query/relation-names.d.ts +4 -2
- package/dist/query/relation-names.js +15 -7
- package/dist/query/relations.d.ts +19 -7
- package/dist/query/relations.js +293 -227
- package/dist/query/row-lock.js +1 -1
- package/dist/query/sql-comment.js +1 -1
- package/dist/query/stream-idle.d.ts +11 -1
- package/dist/query/stream-idle.js +51 -13
- package/dist/query/stream-signal.d.ts +21 -0
- package/dist/query/stream-signal.js +125 -0
- package/dist/query/temporal-parsers.d.ts +101 -0
- package/dist/query/temporal-parsers.js +354 -0
- package/dist/query/types.d.ts +67 -20
- package/dist/query/utils.d.ts +2 -878
- package/dist/query/utils.js +5 -2003
- package/dist/query/warn-registry.d.ts +1 -1
- package/dist/query/warn-registry.js +1 -1
- package/dist/query/where-compile.d.ts +4 -1
- package/dist/query/where-compile.js +14 -10
- package/dist/query/where.d.ts +14 -7
- package/dist/query/where.js +236 -430
- package/dist/query/writes.d.ts +33 -2
- package/dist/query/writes.js +90 -65
- package/dist/query-utils.d.ts +687 -0
- package/dist/query-utils.js +1390 -0
- package/dist/realtime.d.ts +1 -1
- package/dist/realtime.js +3 -3
- package/dist/schema-builder.js +2 -2
- package/dist/schema-metadata.d.ts +13 -3
- package/dist/schema-metadata.js +33 -5
- package/dist/schema-sql.d.ts +15 -24
- package/dist/schema-sql.js +50 -60
- package/dist/schema.d.ts +37 -2
- package/dist/schema.js +29 -2
- package/dist/seed.js +5 -5
- package/dist/serverless.d.ts +24 -71
- package/dist/serverless.js +24 -71
- package/dist/sql.d.ts +111 -0
- package/dist/sql.js +321 -0
- package/dist/sqlite-seed.d.ts +17 -0
- package/dist/sqlite-seed.js +27 -0
- package/dist/sqlite.d.ts +32 -19
- package/dist/sqlite.js +859 -648
- package/dist/supplied-pool-types.js +2 -1
- package/dist/transaction-control.js +6 -1
- package/dist/transaction-outcome.d.ts +61 -0
- package/dist/transaction-outcome.js +234 -0
- package/dist/transaction-state.d.ts +82 -13
- package/dist/transaction-state.js +220 -57
- package/dist/transaction-transport.d.ts +38 -0
- package/dist/transaction-transport.js +153 -0
- package/dist/typed-sql.d.ts +1 -1
- package/dist/typed-sql.js +1 -1
- package/package.json +239 -13
- package/skills/turbine-orm/SKILL.md +6 -5
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { PgCompatPool, PgCompatPoolClient, PgCompatQueryResult } from '../pg-types.js';
|
|
2
|
+
import { createRecovery } from './recovery.js';
|
|
3
|
+
/** Only per-client Neon settings. No global-only HTTP or fetch defaults. */
|
|
4
|
+
export interface NeonWsDriverOptions {
|
|
5
|
+
webSocketConstructor?: new (...args: never[]) => unknown;
|
|
6
|
+
wsProxy?: string | ((host: string, port: number | string) => string);
|
|
7
|
+
useSecureWebSocket?: boolean;
|
|
8
|
+
forceDisablePgSSL?: boolean;
|
|
9
|
+
coalesceWrites?: boolean;
|
|
10
|
+
pipelineConnect?: 'password' | false;
|
|
11
|
+
pipelineTLS?: boolean;
|
|
12
|
+
disableSNI?: boolean;
|
|
13
|
+
disableWarningInBrowsers?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface NeonWsPoolConfig {
|
|
16
|
+
connectionString: string;
|
|
17
|
+
max?: number;
|
|
18
|
+
idleTimeoutMillis?: number;
|
|
19
|
+
connectionTimeoutMillis?: number;
|
|
20
|
+
maxLifetimeSeconds?: number;
|
|
21
|
+
application_name?: string;
|
|
22
|
+
ssl?: boolean | Record<string, unknown>;
|
|
23
|
+
}
|
|
24
|
+
/** Structural declarations keep the optional peer out of other consumers' types. */
|
|
25
|
+
export interface NeonWsClient {
|
|
26
|
+
query<R = Record<string, unknown>>(text: string, values?: unknown[]): Promise<PgCompatQueryResult<R>>;
|
|
27
|
+
readonly neonConfig: NeonWsDriverOptions;
|
|
28
|
+
on(event: string, listener: (...args: unknown[]) => void): unknown;
|
|
29
|
+
removeListener(event: string, listener: (...args: unknown[]) => void): unknown;
|
|
30
|
+
}
|
|
31
|
+
export interface NeonWsPool extends PgCompatPool {
|
|
32
|
+
}
|
|
33
|
+
export type NeonWsSource = {
|
|
34
|
+
connection: NeonWsPoolConfig;
|
|
35
|
+
driver?: NeonWsDriverOptions;
|
|
36
|
+
pool?: never;
|
|
37
|
+
client?: never;
|
|
38
|
+
} | {
|
|
39
|
+
pool: NeonWsPool;
|
|
40
|
+
connection?: never;
|
|
41
|
+
client?: never;
|
|
42
|
+
driver?: never;
|
|
43
|
+
} | {
|
|
44
|
+
client: NeonWsClient;
|
|
45
|
+
connection?: never;
|
|
46
|
+
pool?: never;
|
|
47
|
+
driver?: never;
|
|
48
|
+
};
|
|
49
|
+
interface DriverClient extends NeonWsClient {
|
|
50
|
+
connect(): Promise<void>;
|
|
51
|
+
connect(callback: (error?: Error) => void): void;
|
|
52
|
+
connection: {
|
|
53
|
+
stream: {
|
|
54
|
+
destroy(): void;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
connectionTimeoutHandle?: ReturnType<typeof setTimeout>;
|
|
58
|
+
release(error?: Error | boolean): void;
|
|
59
|
+
end(): Promise<void>;
|
|
60
|
+
_types?: unknown;
|
|
61
|
+
_connected?: boolean;
|
|
62
|
+
_ending?: boolean;
|
|
63
|
+
}
|
|
64
|
+
interface DriverPool extends NeonWsPool {
|
|
65
|
+
Client: new (config: unknown) => DriverClient;
|
|
66
|
+
on(event: 'error', listener: (error: Error) => void): this;
|
|
67
|
+
removeListener(event: string, listener: (...args: unknown[]) => void): this;
|
|
68
|
+
options?: unknown;
|
|
69
|
+
_clients?: unknown;
|
|
70
|
+
}
|
|
71
|
+
export interface NeonWsDriver {
|
|
72
|
+
Client: new (config: unknown) => DriverClient;
|
|
73
|
+
Pool: new (config: NeonWsPoolConfig) => DriverPool;
|
|
74
|
+
}
|
|
75
|
+
/** A local lease, never proof of the endpoint's backend session mode. */
|
|
76
|
+
export declare class NeonWsTransport implements PgCompatPool {
|
|
77
|
+
private readonly signal?;
|
|
78
|
+
readonly singleClient: boolean;
|
|
79
|
+
readonly transactionRecovery: ReturnType<typeof createRecovery>;
|
|
80
|
+
readonly Client: NeonWsDriver['Client'];
|
|
81
|
+
private readonly pool?;
|
|
82
|
+
private readonly client?;
|
|
83
|
+
private readonly owned;
|
|
84
|
+
private readonly active;
|
|
85
|
+
private readonly connecting;
|
|
86
|
+
private readonly closingClients;
|
|
87
|
+
private readonly observers;
|
|
88
|
+
private closed;
|
|
89
|
+
private leased;
|
|
90
|
+
private ending?;
|
|
91
|
+
private stopReason;
|
|
92
|
+
private readonly pendingStops;
|
|
93
|
+
private forcedConnections;
|
|
94
|
+
onAbort?: () => void;
|
|
95
|
+
onFailure?: (kind: 'poolError' | 'connectionLost', error: Error) => void;
|
|
96
|
+
private readonly abort;
|
|
97
|
+
private readonly idleError;
|
|
98
|
+
constructor(source: NeonWsSource, driver: NeonWsDriver, signal?: AbortSignal | undefined);
|
|
99
|
+
get options(): unknown;
|
|
100
|
+
get _clients(): unknown;
|
|
101
|
+
get totalCount(): number;
|
|
102
|
+
get idleCount(): number;
|
|
103
|
+
get waitingCount(): number;
|
|
104
|
+
assertOpen(): void;
|
|
105
|
+
private untilStopped;
|
|
106
|
+
connect(): Promise<PgCompatPoolClient>;
|
|
107
|
+
query<R = Record<string, unknown>>(text: string, values?: unknown[]): Promise<PgCompatQueryResult<R>>;
|
|
108
|
+
assertCanStop(): void;
|
|
109
|
+
stop(): number;
|
|
110
|
+
end(): Promise<void>;
|
|
111
|
+
}
|
|
112
|
+
export {};
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import { ConnectionError, ValidationError } from '../errors.js';
|
|
2
|
+
import { createRecovery } from './recovery.js';
|
|
3
|
+
/** A local lease, never proof of the endpoint's backend session mode. */
|
|
4
|
+
export class NeonWsTransport {
|
|
5
|
+
signal;
|
|
6
|
+
singleClient;
|
|
7
|
+
transactionRecovery;
|
|
8
|
+
Client;
|
|
9
|
+
pool;
|
|
10
|
+
client;
|
|
11
|
+
owned;
|
|
12
|
+
active = new Set();
|
|
13
|
+
connecting = new Set();
|
|
14
|
+
closingClients = new Set();
|
|
15
|
+
observers = new Set();
|
|
16
|
+
closed = false;
|
|
17
|
+
leased = false;
|
|
18
|
+
ending;
|
|
19
|
+
stopReason = new ConnectionError('Neon WebSocket binding is disconnected');
|
|
20
|
+
pendingStops = new Set();
|
|
21
|
+
forcedConnections = 0;
|
|
22
|
+
onAbort;
|
|
23
|
+
onFailure;
|
|
24
|
+
abort = () => {
|
|
25
|
+
this.stopReason = this.signal?.reason;
|
|
26
|
+
this.stop();
|
|
27
|
+
this.onAbort?.();
|
|
28
|
+
};
|
|
29
|
+
idleError = (error) => {
|
|
30
|
+
if (this.owned && !this.closed)
|
|
31
|
+
this.onFailure?.('poolError', error);
|
|
32
|
+
};
|
|
33
|
+
constructor(source, driver, signal) {
|
|
34
|
+
this.signal = signal;
|
|
35
|
+
const keys = ['connection', 'pool', 'client'].filter((key) => source[key] !== undefined);
|
|
36
|
+
if (keys.length !== 1)
|
|
37
|
+
throw new ValidationError('Neon WebSocket source must specify exactly one of connection, pool or client');
|
|
38
|
+
this.owned = source.connection !== undefined;
|
|
39
|
+
this.singleClient = source.client !== undefined;
|
|
40
|
+
this.transactionRecovery = createRecovery(this.singleClient);
|
|
41
|
+
this.Client = driver.Client;
|
|
42
|
+
if (source.connection) {
|
|
43
|
+
const settings = { ...source.driver };
|
|
44
|
+
const BaseClient = driver.Client;
|
|
45
|
+
const connecting = this.connecting;
|
|
46
|
+
class ScopedClient extends BaseClient {
|
|
47
|
+
constructor(config) {
|
|
48
|
+
super(config);
|
|
49
|
+
Object.assign(this.neonConfig, settings);
|
|
50
|
+
}
|
|
51
|
+
connect(callback) {
|
|
52
|
+
connecting.add(this);
|
|
53
|
+
const pending = new Promise((resolve, reject) => {
|
|
54
|
+
let settled = false;
|
|
55
|
+
const done = (error) => {
|
|
56
|
+
if (settled)
|
|
57
|
+
return;
|
|
58
|
+
settled = true;
|
|
59
|
+
connecting.delete(this);
|
|
60
|
+
if (error)
|
|
61
|
+
reject(error);
|
|
62
|
+
else
|
|
63
|
+
resolve();
|
|
64
|
+
};
|
|
65
|
+
try {
|
|
66
|
+
super.connect(done);
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
// Neon can reject configuration before installing its end handler.
|
|
70
|
+
// Do not await end on a stream which never opened a WebSocket.
|
|
71
|
+
done(error);
|
|
72
|
+
clearTimeout(this.connectionTimeoutHandle);
|
|
73
|
+
this.connection.stream.destroy();
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
if (callback)
|
|
77
|
+
void pending.then(() => callback(), callback);
|
|
78
|
+
else
|
|
79
|
+
return pending;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
this.pool = new driver.Pool({ ...source.connection });
|
|
83
|
+
this.pool.Client = ScopedClient;
|
|
84
|
+
}
|
|
85
|
+
else if (source.pool) {
|
|
86
|
+
if (!(source.pool instanceof driver.Pool))
|
|
87
|
+
throw new ValidationError('pool must be an actual @neondatabase/serverless Pool');
|
|
88
|
+
this.pool = source.pool;
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
if (!(source.client instanceof driver.Client))
|
|
92
|
+
throw new ValidationError('client must be an actual connected @neondatabase/serverless Client');
|
|
93
|
+
const supplied = source.client;
|
|
94
|
+
if (supplied._connected !== true || supplied._ending) {
|
|
95
|
+
throw new ValidationError('client must already be connected and queryable before binding');
|
|
96
|
+
}
|
|
97
|
+
this.client = supplied;
|
|
98
|
+
}
|
|
99
|
+
this.pool?.on('error', this.idleError);
|
|
100
|
+
this.signal?.addEventListener('abort', this.abort, { once: true });
|
|
101
|
+
if (this.signal?.aborted)
|
|
102
|
+
this.abort();
|
|
103
|
+
}
|
|
104
|
+
get options() {
|
|
105
|
+
return this.pool?.options;
|
|
106
|
+
}
|
|
107
|
+
get _clients() {
|
|
108
|
+
return this.pool?._clients ?? (this.client ? [this.client] : []);
|
|
109
|
+
}
|
|
110
|
+
get totalCount() {
|
|
111
|
+
return this.pool?.totalCount ?? 0;
|
|
112
|
+
}
|
|
113
|
+
get idleCount() {
|
|
114
|
+
return this.pool?.idleCount ?? 0;
|
|
115
|
+
}
|
|
116
|
+
get waitingCount() {
|
|
117
|
+
return this.pool?.waitingCount ?? 0;
|
|
118
|
+
}
|
|
119
|
+
assertOpen() {
|
|
120
|
+
if (this.closed)
|
|
121
|
+
throw this.stopReason;
|
|
122
|
+
}
|
|
123
|
+
async untilStopped(operation) {
|
|
124
|
+
let rejectStop;
|
|
125
|
+
const stopped = new Promise((_resolve, reject) => {
|
|
126
|
+
rejectStop = reject;
|
|
127
|
+
});
|
|
128
|
+
this.pendingStops.add(rejectStop);
|
|
129
|
+
if (this.closed)
|
|
130
|
+
rejectStop(this.stopReason);
|
|
131
|
+
try {
|
|
132
|
+
return await Promise.race([operation, stopped]);
|
|
133
|
+
}
|
|
134
|
+
finally {
|
|
135
|
+
// A persistent binding must not retain settled query reactions until disconnect.
|
|
136
|
+
this.pendingStops.delete(rejectStop);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
async connect() {
|
|
140
|
+
this.assertOpen();
|
|
141
|
+
if (this.client && this.leased)
|
|
142
|
+
throw new ConnectionError('The supplied Neon Client is already leased; use a Pool for concurrent work');
|
|
143
|
+
if (this.client)
|
|
144
|
+
this.leased = true;
|
|
145
|
+
const acquire = this.client ? Promise.resolve(this.client) : this.pool.connect();
|
|
146
|
+
let raw;
|
|
147
|
+
try {
|
|
148
|
+
// A stopped acquisition is returned promptly; the eventual checkout is destroyed below.
|
|
149
|
+
raw = await this.untilStopped(acquire);
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
if (this.client)
|
|
153
|
+
this.leased = false;
|
|
154
|
+
if (this.closed && !this.client)
|
|
155
|
+
void acquire.then((late) => late.release(true), () => { });
|
|
156
|
+
throw error;
|
|
157
|
+
}
|
|
158
|
+
if (this.closed) {
|
|
159
|
+
if (this.client)
|
|
160
|
+
this.leased = false;
|
|
161
|
+
else
|
|
162
|
+
raw.release(true);
|
|
163
|
+
throw this.stopReason;
|
|
164
|
+
}
|
|
165
|
+
const recovery = createRecovery(this.singleClient);
|
|
166
|
+
let released = false;
|
|
167
|
+
let lost;
|
|
168
|
+
const onError = (error) => {
|
|
169
|
+
if (lost)
|
|
170
|
+
return;
|
|
171
|
+
lost = error;
|
|
172
|
+
if (this.owned && !this.closed)
|
|
173
|
+
this.onFailure?.('connectionLost', error);
|
|
174
|
+
};
|
|
175
|
+
const detach = () => {
|
|
176
|
+
raw.removeListener('error', onError);
|
|
177
|
+
raw.removeListener('end', detach);
|
|
178
|
+
this.observers.delete(detach);
|
|
179
|
+
};
|
|
180
|
+
this.observers.add(detach);
|
|
181
|
+
raw.on('end', detach);
|
|
182
|
+
raw.on('error', onError);
|
|
183
|
+
const lease = {
|
|
184
|
+
release: (error) => {
|
|
185
|
+
if (released)
|
|
186
|
+
return;
|
|
187
|
+
released = true;
|
|
188
|
+
this.active.delete(lease);
|
|
189
|
+
if (this.client)
|
|
190
|
+
this.leased = false;
|
|
191
|
+
else
|
|
192
|
+
raw.release(error ?? lost);
|
|
193
|
+
// Failed pooled sockets can emit a second error while closing.
|
|
194
|
+
if (this.client || !(error || lost))
|
|
195
|
+
detach();
|
|
196
|
+
},
|
|
197
|
+
};
|
|
198
|
+
this.active.add(lease);
|
|
199
|
+
// Deliberately expose no native pg cancellation/connection internals. A WS
|
|
200
|
+
// close is not PostgreSQL CancelRequest delivery or proof of rollback.
|
|
201
|
+
return {
|
|
202
|
+
_types: raw._types,
|
|
203
|
+
transactionRecovery: recovery,
|
|
204
|
+
query: async (text, values) => {
|
|
205
|
+
this.assertOpen();
|
|
206
|
+
if (released)
|
|
207
|
+
throw new ConnectionError('Neon WebSocket checkout has been released');
|
|
208
|
+
// The parser wrapper supplies query configs. Only classify their text;
|
|
209
|
+
// forward the original config (including types) and values untouched.
|
|
210
|
+
const commit = (typeof text === 'string' ? text : text.text) === 'COMMIT';
|
|
211
|
+
if (commit)
|
|
212
|
+
recovery.commitSent();
|
|
213
|
+
const result = await this.untilStopped(raw.query(text, values));
|
|
214
|
+
if (commit && result.command === 'ROLLBACK')
|
|
215
|
+
recovery.commitSent(true);
|
|
216
|
+
return result;
|
|
217
|
+
},
|
|
218
|
+
release: lease.release,
|
|
219
|
+
on: raw.on.bind(raw),
|
|
220
|
+
removeListener: raw.removeListener.bind(raw),
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
async query(text, values) {
|
|
224
|
+
const client = await this.connect();
|
|
225
|
+
try {
|
|
226
|
+
return await client.query(text, values);
|
|
227
|
+
}
|
|
228
|
+
finally {
|
|
229
|
+
client.release();
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
assertCanStop() {
|
|
233
|
+
if (this.client && this.leased)
|
|
234
|
+
throw new ConnectionError('Cannot disconnect a busy caller-owned Neon Client; await its operation first');
|
|
235
|
+
}
|
|
236
|
+
stop() {
|
|
237
|
+
if (this.closed)
|
|
238
|
+
return this.forcedConnections;
|
|
239
|
+
this.forcedConnections = this.client ? 0 : this.active.size + this.connecting.size;
|
|
240
|
+
this.closed = true;
|
|
241
|
+
for (const reject of this.pendingStops)
|
|
242
|
+
reject(this.stopReason);
|
|
243
|
+
this.pendingStops.clear();
|
|
244
|
+
// Only the owned subclass is tracked here. Destroy the stream before end():
|
|
245
|
+
// a graceful Terminate can itself wait on the unfinished startup handshake.
|
|
246
|
+
// The driver's connect callback removes the failed Client from its Pool.
|
|
247
|
+
for (const raw of this.connecting) {
|
|
248
|
+
const closed = new Promise((resolve) => {
|
|
249
|
+
const done = () => {
|
|
250
|
+
raw.removeListener('end', done);
|
|
251
|
+
resolve();
|
|
252
|
+
};
|
|
253
|
+
raw.on('end', done);
|
|
254
|
+
});
|
|
255
|
+
this.closingClients.add(closed);
|
|
256
|
+
void closed.then(() => this.closingClients.delete(closed));
|
|
257
|
+
raw.connection.stream.destroy();
|
|
258
|
+
}
|
|
259
|
+
// A supplied single Client belongs to the caller and is never terminated.
|
|
260
|
+
for (const lease of [...this.active])
|
|
261
|
+
if (!this.client)
|
|
262
|
+
lease.release(true);
|
|
263
|
+
this.signal?.removeEventListener('abort', this.abort);
|
|
264
|
+
return this.forcedConnections;
|
|
265
|
+
}
|
|
266
|
+
end() {
|
|
267
|
+
this.stop();
|
|
268
|
+
if (!this.ending) {
|
|
269
|
+
this.ending = (async () => {
|
|
270
|
+
try {
|
|
271
|
+
if (this.owned)
|
|
272
|
+
await this.pool.end();
|
|
273
|
+
await Promise.all(this.closingClients);
|
|
274
|
+
}
|
|
275
|
+
finally {
|
|
276
|
+
this.pool?.removeListener('error', this.idleError);
|
|
277
|
+
for (const detach of this.observers)
|
|
278
|
+
detach();
|
|
279
|
+
this.onFailure = undefined;
|
|
280
|
+
this.onAbort = undefined;
|
|
281
|
+
}
|
|
282
|
+
})();
|
|
283
|
+
}
|
|
284
|
+
return this.ending;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** Optional Neon Pool/Client WebSocket binding. See docs/neon-websocket.md. */
|
|
2
|
+
import { TurbineClient } from './client.js';
|
|
3
|
+
import type { EngineClientConfig } from './engine-config.js';
|
|
4
|
+
import { type NeonWsSource } from './neon-ws/transport.js';
|
|
5
|
+
import type { SchemaMetadata } from './schema.js';
|
|
6
|
+
export type { NeonWsClient, NeonWsDriverOptions, NeonWsPool, NeonWsPoolConfig, NeonWsSource, } from './neon-ws/transport.js';
|
|
7
|
+
export interface NeonWsOptions extends EngineClientConfig {
|
|
8
|
+
/** Explicit assertion about the actual endpoint, not its checked-out logical client. */
|
|
9
|
+
sessionMode: 'persistent' | 'transaction';
|
|
10
|
+
/** Edge connections must be created, used and closed inside one invocation. */
|
|
11
|
+
lifetime: 'persistent' | 'invocation';
|
|
12
|
+
/** Ends this binding and destroys its pooled checkouts. Unsupported for a supplied Client. */
|
|
13
|
+
signal?: AbortSignal;
|
|
14
|
+
/** Names default off; transaction poolers cannot enable them here. */
|
|
15
|
+
preparedStatements?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Bind an owned Pool, a caller-owned Neon Pool, or an already-connected exclusive
|
|
19
|
+
* Neon Client. Supplied resources are never ended. No driver globals are changed.
|
|
20
|
+
* The generated client type adds declarative table accessors, as with turbineHttp.
|
|
21
|
+
*/
|
|
22
|
+
export declare function turbineNeonWs<TClient extends TurbineClient = TurbineClient>(source: NeonWsSource, schema: SchemaMetadata, options: NeonWsOptions): Promise<TClient>;
|
|
23
|
+
/** Own a Pool for exactly one invocation, closing on success, failure or abort. */
|
|
24
|
+
export declare function withNeonWs<T, TClient extends TurbineClient = TurbineClient>(source: Extract<NeonWsSource, {
|
|
25
|
+
connection: unknown;
|
|
26
|
+
}>, schema: SchemaMetadata, options: Omit<NeonWsOptions, 'lifetime'>, run: (db: TClient) => Promise<T>): Promise<T>;
|
package/dist/neon-ws.js
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/** Optional Neon Pool/Client WebSocket binding. See docs/neon-websocket.md. */
|
|
2
|
+
import { TurbineClient } from './client.js';
|
|
3
|
+
import { ConnectionError, UnsupportedFeatureError, ValidationError } from './errors.js';
|
|
4
|
+
import loadNeonDriver from './neon-ws/load-driver.cjs';
|
|
5
|
+
import snapshot from './neon-ws/snapshot.js';
|
|
6
|
+
import { NeonWsTransport, } from './neon-ws/transport.js';
|
|
7
|
+
// Keep supported inherited accessors exhaustive as the public interfaces evolve.
|
|
8
|
+
// Unknown own enumerable fields still pass through, matching ordinary object spread.
|
|
9
|
+
const optionFields = {
|
|
10
|
+
logging: true,
|
|
11
|
+
logger: true,
|
|
12
|
+
diagnostics: true,
|
|
13
|
+
defaultLimit: true,
|
|
14
|
+
warnOnUnlimited: true,
|
|
15
|
+
utcTimestamps: true,
|
|
16
|
+
temporalInfinity: true,
|
|
17
|
+
planCacheMode: true,
|
|
18
|
+
statementTimeoutMs: true,
|
|
19
|
+
streamIdleTimeoutMs: true,
|
|
20
|
+
sqlComment: true,
|
|
21
|
+
scopedConnect: true,
|
|
22
|
+
relationLoadStrategy: true,
|
|
23
|
+
stableRelationOrder: true,
|
|
24
|
+
implicitPkOrdering: true,
|
|
25
|
+
autoToOneJoinMaxRows: true,
|
|
26
|
+
autoRoundTripMs: true,
|
|
27
|
+
jsonEncoding: true,
|
|
28
|
+
errorMessages: true,
|
|
29
|
+
logQueryParams: true,
|
|
30
|
+
sqlCache: true,
|
|
31
|
+
sqlCacheSize: true,
|
|
32
|
+
globalFilters: true,
|
|
33
|
+
sessionMode: true,
|
|
34
|
+
lifetime: true,
|
|
35
|
+
signal: true,
|
|
36
|
+
preparedStatements: true,
|
|
37
|
+
};
|
|
38
|
+
const connectionFields = {
|
|
39
|
+
connectionString: true,
|
|
40
|
+
max: true,
|
|
41
|
+
idleTimeoutMillis: true,
|
|
42
|
+
connectionTimeoutMillis: true,
|
|
43
|
+
maxLifetimeSeconds: true,
|
|
44
|
+
application_name: true,
|
|
45
|
+
ssl: true,
|
|
46
|
+
};
|
|
47
|
+
const driverFields = {
|
|
48
|
+
webSocketConstructor: true,
|
|
49
|
+
wsProxy: true,
|
|
50
|
+
useSecureWebSocket: true,
|
|
51
|
+
forceDisablePgSSL: true,
|
|
52
|
+
coalesceWrites: true,
|
|
53
|
+
pipelineConnect: true,
|
|
54
|
+
pipelineTLS: true,
|
|
55
|
+
disableSNI: true,
|
|
56
|
+
disableWarningInBrowsers: true,
|
|
57
|
+
};
|
|
58
|
+
/** Capture supported effective fields once, without invoking unrelated class getters. */
|
|
59
|
+
function effective(value, fields) {
|
|
60
|
+
const keys = new Set([...Object.keys(value), ...Object.keys(fields)]);
|
|
61
|
+
return Object.fromEntries([...keys].filter((key) => key in value).map((key) => [key, Reflect.get(value, key)]));
|
|
62
|
+
}
|
|
63
|
+
class NeonWsTurbine extends TurbineClient {
|
|
64
|
+
transport;
|
|
65
|
+
wsOptions;
|
|
66
|
+
closing;
|
|
67
|
+
constructor(transport, schema, wsOptions) {
|
|
68
|
+
const { sessionMode: _mode, lifetime: _lifetime, signal: _signal, ...config } = wsOptions;
|
|
69
|
+
super({ ...config, pool: transport, preparedStatements: config.preparedStatements ?? false }, schema);
|
|
70
|
+
this.transport = transport;
|
|
71
|
+
this.wsOptions = wsOptions;
|
|
72
|
+
transport.onFailure = (kind, error) => this.emitPoolEvent(kind, { error, pool: 'primary' });
|
|
73
|
+
}
|
|
74
|
+
async $listen(channel, handler, options) {
|
|
75
|
+
if (this.wsOptions.sessionMode !== 'persistent' ||
|
|
76
|
+
this.wsOptions.lifetime !== 'persistent' ||
|
|
77
|
+
this.transport.singleClient) {
|
|
78
|
+
throw new UnsupportedFeatureError('$listen', 'Neon WebSocket', 'Requires an explicitly persistent backend session, persistent lifetime and a Pool with a dedicated listener slot.');
|
|
79
|
+
}
|
|
80
|
+
this.transport.assertOpen();
|
|
81
|
+
return super.$listen(channel, handler, options);
|
|
82
|
+
}
|
|
83
|
+
async disconnect(options) {
|
|
84
|
+
if (options?.timeoutMs !== undefined && (!Number.isSafeInteger(options.timeoutMs) || options.timeoutMs < 0)) {
|
|
85
|
+
throw new ValidationError('disconnect timeoutMs must be a non-negative safe integer');
|
|
86
|
+
}
|
|
87
|
+
if (!this.closing) {
|
|
88
|
+
// Stop acquisition before subscription teardown, including a reconnect already in flight.
|
|
89
|
+
this.transport.assertCanStop();
|
|
90
|
+
const forcedConnections = this.transport.stop();
|
|
91
|
+
this.closing = (async () => {
|
|
92
|
+
try {
|
|
93
|
+
await super.disconnect();
|
|
94
|
+
}
|
|
95
|
+
finally {
|
|
96
|
+
await this.transport.end();
|
|
97
|
+
}
|
|
98
|
+
return { timedOut: false, forcedConnections };
|
|
99
|
+
})();
|
|
100
|
+
}
|
|
101
|
+
const result = await this.closing;
|
|
102
|
+
return options === undefined ? undefined : result;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Bind an owned Pool, a caller-owned Neon Pool, or an already-connected exclusive
|
|
107
|
+
* Neon Client. Supplied resources are never ended. No driver globals are changed.
|
|
108
|
+
* The generated client type adds declarative table accessors, as with turbineHttp.
|
|
109
|
+
*/
|
|
110
|
+
export async function turbineNeonWs(source, schema, options) {
|
|
111
|
+
// Admission and construction must consume the same inputs, including while
|
|
112
|
+
// optional driver resolution yields. Resource and AbortSignal identities stay intact.
|
|
113
|
+
const { logger, ...configuration } = effective(options ?? {}, optionFields);
|
|
114
|
+
options = { ...snapshot(configuration), logger };
|
|
115
|
+
const { connection, driver: settings, pool, client } = source;
|
|
116
|
+
const connectionConfig = connection === undefined ? undefined : effective(connection, connectionFields);
|
|
117
|
+
const ssl = connectionConfig?.ssl;
|
|
118
|
+
source = {
|
|
119
|
+
connection: connectionConfig === undefined
|
|
120
|
+
? undefined
|
|
121
|
+
: snapshot({
|
|
122
|
+
...connectionConfig,
|
|
123
|
+
ssl: ssl && typeof ssl === 'object'
|
|
124
|
+
? effective(ssl, { rejectUnauthorized: true, ca: true, key: true, cert: true, servername: true })
|
|
125
|
+
: ssl,
|
|
126
|
+
}),
|
|
127
|
+
driver: settings === undefined ? undefined : snapshot(effective(settings, driverFields)),
|
|
128
|
+
pool,
|
|
129
|
+
client,
|
|
130
|
+
};
|
|
131
|
+
if (!options ||
|
|
132
|
+
!['persistent', 'transaction'].includes(options.sessionMode) ||
|
|
133
|
+
!['persistent', 'invocation'].includes(options.lifetime)) {
|
|
134
|
+
throw new ValidationError('Neon WebSocket requires explicit sessionMode and lifetime');
|
|
135
|
+
}
|
|
136
|
+
if (options.sessionMode === 'transaction' && options.preparedStatements === true) {
|
|
137
|
+
throw new UnsupportedFeatureError('preparedStatements', 'Neon transaction pooler', 'Named statements require an explicitly compatible backend; leave preparedStatements disabled.');
|
|
138
|
+
}
|
|
139
|
+
if (source.client !== undefined && options.signal) {
|
|
140
|
+
throw new UnsupportedFeatureError('signal', 'caller-owned Neon Client', 'Cancellation would require ending the caller connection. Use an owned Pool or caller-owned Pool instead.');
|
|
141
|
+
}
|
|
142
|
+
options.signal?.throwIfAborted();
|
|
143
|
+
// Optional package resolution is deferred until the optional factory is called.
|
|
144
|
+
let driver;
|
|
145
|
+
try {
|
|
146
|
+
driver = await loadNeonDriver();
|
|
147
|
+
}
|
|
148
|
+
catch (cause) {
|
|
149
|
+
throw new ConnectionError('Neon WebSocket requires the optional @neondatabase/serverless package (1.2 or later). Install @neondatabase/serverless.', { cause });
|
|
150
|
+
}
|
|
151
|
+
const transport = new NeonWsTransport(source, driver, options.signal);
|
|
152
|
+
try {
|
|
153
|
+
const db = new NeonWsTurbine(transport, schema, { ...options });
|
|
154
|
+
transport.onAbort = () => {
|
|
155
|
+
void db.disconnect().catch(() => { });
|
|
156
|
+
};
|
|
157
|
+
if (options.signal?.aborted) {
|
|
158
|
+
await db.disconnect();
|
|
159
|
+
options.signal.throwIfAborted();
|
|
160
|
+
}
|
|
161
|
+
return db;
|
|
162
|
+
}
|
|
163
|
+
catch (error) {
|
|
164
|
+
await transport.end();
|
|
165
|
+
throw error;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
/** Own a Pool for exactly one invocation, closing on success, failure or abort. */
|
|
169
|
+
export async function withNeonWs(source, schema, options, run) {
|
|
170
|
+
if (!('connection' in source))
|
|
171
|
+
throw new ValidationError('withNeonWs requires an owned connection configuration');
|
|
172
|
+
const db = await turbineNeonWs(source, schema, {
|
|
173
|
+
...effective(options, optionFields),
|
|
174
|
+
lifetime: 'invocation',
|
|
175
|
+
});
|
|
176
|
+
try {
|
|
177
|
+
return await run(db);
|
|
178
|
+
}
|
|
179
|
+
finally {
|
|
180
|
+
await db.disconnect();
|
|
181
|
+
}
|
|
182
|
+
}
|
package/dist/nested-write.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export interface ExtractedFields {
|
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* Transaction context for nested write operations.
|
|
21
|
-
* Matches the subset of TransactionClient
|
|
21
|
+
* Matches the subset of TransactionClient used for nested writes.
|
|
22
22
|
*/
|
|
23
23
|
export interface NestedWriteContext {
|
|
24
24
|
schema: SchemaMetadata;
|
|
@@ -53,6 +53,7 @@ export interface NestedWriteContext {
|
|
|
53
53
|
update(args: {
|
|
54
54
|
where: Record<string, unknown>;
|
|
55
55
|
data: Record<string, unknown>;
|
|
56
|
+
optimisticLock?: NestedOptimisticLock;
|
|
56
57
|
}): Promise<T>;
|
|
57
58
|
updateMany(args: {
|
|
58
59
|
where: Record<string, unknown>;
|
|
@@ -104,6 +105,26 @@ export declare function hasRelationFields(data: Record<string, unknown>, tableMe
|
|
|
104
105
|
* Handles composite keys. Returns a new object (does not mutate input).
|
|
105
106
|
*/
|
|
106
107
|
export declare function injectForeignKey(childData: Record<string, unknown>, relation: RelationDef, parentRow: Record<string, unknown>, schema: SchemaMetadata): Record<string, unknown>;
|
|
108
|
+
/**
|
|
109
|
+
* {@link assertArrayWrite} over every row a nested write will write,
|
|
110
|
+
* before it opens a transaction: the engine binds each level's rows only when
|
|
111
|
+
* it reaches them, after the rows above are written. `rows` is a row of
|
|
112
|
+
* `table` or a list of them. A key is a relation exactly when the engine reads
|
|
113
|
+
* it as one ({@link isRelationEntry}) and its payload is followed by
|
|
114
|
+
* {@link PAYLOAD_ROWS}; any other key naming a column is a value and is never
|
|
115
|
+
* descended into, so neither a JSON document nor a column named like an
|
|
116
|
+
* operation (`data`, `create`, `set`) is taken for a payload. An update's
|
|
117
|
+
* `{ set }` is checked as the value it writes.
|
|
118
|
+
*
|
|
119
|
+
* The same walk refuses a tree that is too deep, with the error a read gives
|
|
120
|
+
* for the same depth. The engine counts depth only along a chain of `create`
|
|
121
|
+
* operations that themselves nest, so a row at the last level, or a chain
|
|
122
|
+
* through `update`, `upsert` or `connectOrCreate`, was written however deep it
|
|
123
|
+
* sat, and the tree returned to the caller then stopped at the read limit
|
|
124
|
+
* without those rows. A write is accepted only when its whole tree can be
|
|
125
|
+
* returned.
|
|
126
|
+
*/
|
|
127
|
+
export declare function assertNestedArrayWrites(schema: SchemaMetadata, table: string, rows: unknown, depth?: number, path?: string[]): void;
|
|
107
128
|
/**
|
|
108
129
|
* Split rows destined for `createMany` into CONTIGUOUS runs that each name the
|
|
109
130
|
* same fields.
|
|
@@ -150,10 +171,20 @@ export interface NestedReturnShape {
|
|
|
150
171
|
select?: Record<string, boolean>;
|
|
151
172
|
omit?: Record<string, boolean>;
|
|
152
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* The `optimisticLock` of an `update` whose `data` carries relation writes. It
|
|
176
|
+
* applies to the TOP-LEVEL row only: executeNestedUpdate hands it to the
|
|
177
|
+
* parent's own UPDATE, which runs before any relation operation.
|
|
178
|
+
*/
|
|
179
|
+
export interface NestedOptimisticLock {
|
|
180
|
+
field: string;
|
|
181
|
+
expected: number;
|
|
182
|
+
}
|
|
153
183
|
export declare function executeNestedCreate(ctx: NestedWriteContext, tableName: string, data: Record<string, unknown>, depth?: number, path?: string[], returnShape?: NestedReturnShape): Promise<Record<string, unknown>>;
|
|
154
184
|
/**
|
|
155
185
|
* Tree-walking update: updates the parent row with scalar data, then
|
|
156
186
|
* processes each relation operation (create, connect, connectOrCreate,
|
|
157
|
-
* disconnect, set, delete), and reads back the full tree.
|
|
187
|
+
* disconnect, set, delete), and reads back the full tree. `optimisticLock`
|
|
188
|
+
* is the top-level `update`'s, checked and bumped by the parent's UPDATE.
|
|
158
189
|
*/
|
|
159
|
-
export declare function executeNestedUpdate(ctx: NestedWriteContext, tableName: string, where: Record<string, unknown>, data: Record<string, unknown>, depth?: number, path?: string[], returnShape?: NestedReturnShape): Promise<Record<string, unknown>>;
|
|
190
|
+
export declare function executeNestedUpdate(ctx: NestedWriteContext, tableName: string, where: Record<string, unknown>, data: Record<string, unknown>, depth?: number, path?: string[], returnShape?: NestedReturnShape, optimisticLock?: NestedOptimisticLock): Promise<Record<string, unknown>>;
|