postgrelize 0.0.0-stage → 1.0.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/CHANGELOG.md +269 -0
- package/LICENSE +21 -0
- package/README.md +131 -2
- package/dist/associations/association-accessors.d.ts +21 -0
- package/dist/associations/association-key-types.d.ts +44 -0
- package/dist/associations/association-keys.d.ts +98 -0
- package/dist/associations/association-lookup.d.ts +26 -0
- package/dist/associations/association-shape.d.ts +25 -0
- package/dist/associations/association.d.ts +95 -0
- package/dist/associations/belongs-to-many.d.ts +86 -0
- package/dist/associations/belongs-to.d.ts +45 -0
- package/dist/associations/has-many.d.ts +79 -0
- package/dist/associations/has-one.d.ts +44 -0
- package/dist/associations/include-assembler.d.ts +21 -0
- package/dist/associations/include-columns.d.ts +24 -0
- package/dist/associations/include-joins.d.ts +17 -0
- package/dist/associations/include-loader.d.ts +48 -0
- package/dist/associations/include-order.d.ts +22 -0
- package/dist/associations/include-query-builder.d.ts +54 -0
- package/dist/associations/include-resolver.d.ts +29 -0
- package/dist/associations/include-rows.d.ts +47 -0
- package/dist/associations/include-sub-query.d.ts +35 -0
- package/dist/associations/include.d.ts +112 -0
- package/dist/associations/junction-keys.d.ts +23 -0
- package/dist/associations/nested-creator.d.ts +44 -0
- package/dist/associations/nested-saver.d.ts +30 -0
- package/dist/associations/owner-keys.d.ts +34 -0
- package/dist/associations/separate-include-loader.d.ts +24 -0
- package/dist/associations/types.d.ts +139 -0
- package/dist/connection/connection-config.d.ts +33 -0
- package/dist/connection/connection-manager.d.ts +65 -0
- package/dist/connection/connection-types.d.ts +21 -0
- package/dist/connection/copy-from-stdin.d.ts +52 -0
- package/dist/connection/copy-runner.d.ts +30 -0
- package/dist/connection/copy-to-stdout.d.ts +49 -0
- package/dist/connection/copy.d.ts +22 -0
- package/dist/connection/notifications.d.ts +28 -0
- package/dist/connection/options.d.ts +158 -0
- package/dist/connection/query-logger.d.ts +41 -0
- package/dist/connection/replica-router.d.ts +20 -0
- package/dist/connection/statement-cache.d.ts +36 -0
- package/dist/connection/statement-timeout.d.ts +22 -0
- package/dist/data-types/abstract-data-type.d.ts +58 -0
- package/dist/data-types/array-literal-parser.d.ts +17 -0
- package/dist/data-types/array-type.d.ts +18 -0
- package/dist/data-types/bit-type.d.ts +14 -0
- package/dist/data-types/blob-type.d.ts +12 -0
- package/dist/data-types/char-type.d.ts +12 -0
- package/dist/data-types/composite-fields.d.ts +26 -0
- package/dist/data-types/composite-type.d.ts +32 -0
- package/dist/data-types/data-types.d.ts +172 -0
- package/dist/data-types/date-type.d.ts +14 -0
- package/dist/data-types/decimal-type.d.ts +13 -0
- package/dist/data-types/default-value-generator.d.ts +15 -0
- package/dist/data-types/enum-type.d.ts +19 -0
- package/dist/data-types/ewkb-reader.d.ts +18 -0
- package/dist/data-types/ewkb-writer.d.ts +17 -0
- package/dist/data-types/float-type.d.ts +12 -0
- package/dist/data-types/geometric-text.d.ts +65 -0
- package/dist/data-types/geometric-type.d.ts +46 -0
- package/dist/data-types/hstore-type.d.ts +16 -0
- package/dist/data-types/integer-type.d.ts +24 -0
- package/dist/data-types/json-type.d.ts +16 -0
- package/dist/data-types/multirange-type.d.ts +19 -0
- package/dist/data-types/range-type.d.ts +28 -0
- package/dist/data-types/record-text.d.ts +29 -0
- package/dist/data-types/scalar-type.d.ts +13 -0
- package/dist/data-types/spatial-type.d.ts +20 -0
- package/dist/data-types/string-type.d.ts +12 -0
- package/dist/data-types/text-type.d.ts +12 -0
- package/dist/data-types/timestamp-type.d.ts +15 -0
- package/dist/data-types/virtual-type.d.ts +15 -0
- package/dist/data-types/wall-clock.d.ts +14 -0
- package/dist/ddl/column-ddl.d.ts +73 -0
- package/dist/ddl/constraint-ddl.d.ts +30 -0
- package/dist/ddl/ddl-generator.d.ts +181 -0
- package/dist/ddl/ddl-guards.d.ts +60 -0
- package/dist/ddl/ddl-types.d.ts +193 -0
- package/dist/ddl/enum-ddl.d.ts +42 -0
- package/dist/ddl/extension-ddl.d.ts +57 -0
- package/dist/ddl/function-ddl.d.ts +98 -0
- package/dist/ddl/index-ddl.d.ts +29 -0
- package/dist/ddl/index-element-ddl.d.ts +19 -0
- package/dist/ddl/partition-ddl.d.ts +88 -0
- package/dist/ddl/partition-types.d.ts +94 -0
- package/dist/ddl/policy-ddl.d.ts +137 -0
- package/dist/ddl/routine-guards.d.ts +63 -0
- package/dist/ddl/sequence-ddl.d.ts +103 -0
- package/dist/ddl/sql-literal.d.ts +61 -0
- package/dist/ddl/table-ddl.d.ts +35 -0
- package/dist/ddl/trigger-ddl.d.ts +81 -0
- package/dist/ddl/view-ddl.d.ts +122 -0
- package/dist/decorators/association-applier.d.ts +18 -0
- package/dist/decorators/association-decorators.d.ts +72 -0
- package/dist/decorators/column-decorators.d.ts +147 -0
- package/dist/decorators/decorator-factory.d.ts +45 -0
- package/dist/decorators/decorator-signature.d.ts +26 -0
- package/dist/decorators/decorator-types.d.ts +24 -0
- package/dist/decorators/foreign-key-decorator.d.ts +21 -0
- package/dist/decorators/hook-decorators.d.ts +393 -0
- package/dist/decorators/init-arguments.d.ts +29 -0
- package/dist/decorators/model-decorators.d.ts +18 -0
- package/dist/decorators/model-metadata.d.ts +70 -0
- package/dist/decorators/table-decorators.d.ts +43 -0
- package/dist/decorators/timestamp-decorators.d.ts +38 -0
- package/dist/errors/base-error.d.ts +40 -0
- package/dist/errors/connection-errors.d.ts +152 -0
- package/dist/errors/database-errors.d.ts +152 -0
- package/dist/errors/errors.d.ts +5 -0
- package/dist/errors/map-pg-error.d.ts +27 -0
- package/dist/errors/misc-errors.d.ts +188 -0
- package/dist/errors/validation-errors.d.ts +117 -0
- package/dist/exports-core.d.ts +15 -0
- package/dist/exports-decorators.d.ts +8 -0
- package/dist/exports-errors.d.ts +2 -0
- package/dist/exports-model.d.ts +21 -0
- package/dist/exports-schema.d.ts +19 -0
- package/dist/expressions/call-expressions.d.ts +54 -0
- package/dist/expressions/condition-expressions.d.ts +51 -0
- package/dist/expressions/expression.d.ts +52 -0
- package/dist/expressions/jsonpath-helpers.d.ts +37 -0
- package/dist/expressions/methods.d.ts +188 -0
- package/dist/expressions/op.d.ts +182 -0
- package/dist/expressions/query-expressions.d.ts +110 -0
- package/dist/expressions/row-expressions.d.ts +35 -0
- package/dist/expressions/search-helpers.d.ts +138 -0
- package/dist/expressions/trigram-helpers.d.ts +40 -0
- package/dist/hooks/hooks.d.ts +125 -0
- package/dist/index.cjs +20461 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +20332 -0
- package/dist/index.js.map +1 -0
- package/dist/model/attribute-columns.d.ts +85 -0
- package/dist/model/attribute-normalizer.d.ts +42 -0
- package/dist/model/attribute-options.d.ts +121 -0
- package/dist/model/bulk-insert-builder.d.ts +24 -0
- package/dist/model/bulk-options.d.ts +173 -0
- package/dist/model/copy-options.d.ts +51 -0
- package/dist/model/cte-builder.d.ts +134 -0
- package/dist/model/definition-normalizer.d.ts +26 -0
- package/dist/model/delete-query-builder.d.ts +42 -0
- package/dist/model/find-options.d.ts +144 -0
- package/dist/model/find-query-builder.d.ts +38 -0
- package/dist/model/insert-query-builder.d.ts +41 -0
- package/dist/model/instance-destroyer.d.ts +44 -0
- package/dist/model/instance-lifecycle-services.d.ts +61 -0
- package/dist/model/instance-lifecycle.d.ts +128 -0
- package/dist/model/instance-saver.d.ts +25 -0
- package/dist/model/instance-state.d.ts +48 -0
- package/dist/model/instance-validation.d.ts +35 -0
- package/dist/model/instance-values.d.ts +80 -0
- package/dist/model/instance-writer.d.ts +59 -0
- package/dist/model/join-source-builder.d.ts +25 -0
- package/dist/model/lateral-keys-builder.d.ts +25 -0
- package/dist/model/merge-action-builder.d.ts +31 -0
- package/dist/model/merge-options.d.ts +72 -0
- package/dist/model/merge-query-builder.d.ts +29 -0
- package/dist/model/merge-source-builder.d.ts +22 -0
- package/dist/model/mixins/model-aggregates.d.ts +69 -0
- package/dist/model/mixins/model-associations.d.ts +73 -0
- package/dist/model/mixins/model-constructor.d.ts +7 -0
- package/dist/model/mixins/model-finders.d.ts +124 -0
- package/dist/model/mixins/model-hooks.d.ts +138 -0
- package/dist/model/mixins/model-postgres.d.ts +198 -0
- package/dist/model/mixins/model-schema-binding.d.ts +36 -0
- package/dist/model/mixins/model-schema.d.ts +55 -0
- package/dist/model/mixins/model-scopes.d.ts +57 -0
- package/dist/model/mixins/model-writers.d.ts +175 -0
- package/dist/model/mixins/named-hooks.d.ts +28 -0
- package/dist/model/model-accessors.d.ts +22 -0
- package/dist/model/model-base.d.ts +83 -0
- package/dist/model/model-definition.d.ts +130 -0
- package/dist/model/model-instance-persistence.d.ts +132 -0
- package/dist/model/model-instance-values.d.ts +154 -0
- package/dist/model/model-operations.d.ts +22 -0
- package/dist/model/model-registry.d.ts +139 -0
- package/dist/model/model-services.d.ts +46 -0
- package/dist/model/model-state.d.ts +60 -0
- package/dist/model/model-values.d.ts +86 -0
- package/dist/model/model.d.ts +560 -0
- package/dist/model/on-conflict-builder.d.ts +111 -0
- package/dist/model/operations/bulk-create-operation.d.ts +40 -0
- package/dist/model/operations/copy-from-source.d.ts +51 -0
- package/dist/model/operations/copy-operation.d.ts +54 -0
- package/dist/model/operations/count-operation.d.ts +52 -0
- package/dist/model/operations/create-operation.d.ts +31 -0
- package/dist/model/operations/destroy-operation.d.ts +65 -0
- package/dist/model/operations/find-cursor.d.ts +23 -0
- package/dist/model/operations/find-lookups.d.ts +89 -0
- package/dist/model/operations/find-operation.d.ts +47 -0
- package/dist/model/operations/increment-operation.d.ts +40 -0
- package/dist/model/operations/insert-operation.d.ts +71 -0
- package/dist/model/operations/merge-operation.d.ts +56 -0
- package/dist/model/operations/model-operation.d.ts +33 -0
- package/dist/model/operations/update-operation.d.ts +45 -0
- package/dist/model/operations/upsert-operation.d.ts +39 -0
- package/dist/model/options.d.ts +103 -0
- package/dist/model/returning-old.d.ts +52 -0
- package/dist/model/row-mapper.d.ts +78 -0
- package/dist/model/row-plan.d.ts +31 -0
- package/dist/model/runtime.d.ts +54 -0
- package/dist/model/scope-registry.d.ts +81 -0
- package/dist/model/select-aggregates.d.ts +37 -0
- package/dist/model/select-lock.d.ts +13 -0
- package/dist/model/select-options.d.ts +92 -0
- package/dist/model/select-query-builder.d.ts +73 -0
- package/dist/model/select-targets.d.ts +77 -0
- package/dist/model/source-option-builder.d.ts +23 -0
- package/dist/model/source-options.d.ts +108 -0
- package/dist/model/statement-builder.d.ts +77 -0
- package/dist/model/statement-services.d.ts +2 -0
- package/dist/model/sync-hooks.d.ts +18 -0
- package/dist/model/table-sample-builder.d.ts +13 -0
- package/dist/model/types.d.ts +85 -0
- package/dist/model/unnest-insert-builder.d.ts +24 -0
- package/dist/model/update-query-builder.d.ts +39 -0
- package/dist/model/v6-conflict-builder.d.ts +37 -0
- package/dist/model/value-cloner.d.ts +17 -0
- package/dist/model/values-writer.d.ts +12 -0
- package/dist/model/where-options.d.ts +164 -0
- package/dist/model/write-options.d.ts +160 -0
- package/dist/model/written-rows.d.ts +56 -0
- package/dist/query/query-result-shaper.d.ts +91 -0
- package/dist/query/raw-query.d.ts +27 -0
- package/dist/query-interface/alter-planner.d.ts +40 -0
- package/dist/query-interface/bulk-data.d.ts +44 -0
- package/dist/query-interface/column-commands.d.ts +52 -0
- package/dist/query-interface/column-describer.d.ts +17 -0
- package/dist/query-interface/enum-commands.d.ts +36 -0
- package/dist/query-interface/index-commands.d.ts +57 -0
- package/dist/query-interface/model-tables.d.ts +58 -0
- package/dist/query-interface/object-commands.d.ts +71 -0
- package/dist/query-interface/partition-commands.d.ts +43 -0
- package/dist/query-interface/policy-commands.d.ts +54 -0
- package/dist/query-interface/query-interface-objects.d.ts +108 -0
- package/dist/query-interface/query-interface-partitions.d.ts +66 -0
- package/dist/query-interface/query-interface-policies.d.ts +86 -0
- package/dist/query-interface/query-interface-routines.d.ts +120 -0
- package/dist/query-interface/query-interface-tables.d.ts +179 -0
- package/dist/query-interface/query-interface-types.d.ts +62 -0
- package/dist/query-interface/query-interface-views.d.ts +84 -0
- package/dist/query-interface/query-interface.d.ts +256 -0
- package/dist/query-interface/routine-commands.d.ts +71 -0
- package/dist/query-interface/schema-synchronizer.d.ts +99 -0
- package/dist/query-interface/statement-runner.d.ts +40 -0
- package/dist/query-interface/sync-planner.d.ts +26 -0
- package/dist/query-interface/table-commands.d.ts +63 -0
- package/dist/query-interface/table-introspector.d.ts +58 -0
- package/dist/query-interface/view-commands.d.ts +47 -0
- package/dist/sequelize/sequelize-base.d.ts +196 -0
- package/dist/sequelize/sequelize-constructor.d.ts +7 -0
- package/dist/sequelize/sequelize-hooks.d.ts +86 -0
- package/dist/sequelize/sequelize-internals.d.ts +87 -0
- package/dist/sequelize/sequelize-notifications.d.ts +66 -0
- package/dist/sequelize/sequelize-schema.d.ts +106 -0
- package/dist/sequelize/sequelize-transactions.d.ts +96 -0
- package/dist/sequelize.d.ts +790 -0
- package/dist/sql/ast-clauses.d.ts +137 -0
- package/dist/sql/ast-expressions.d.ts +88 -0
- package/dist/sql/ast-statements.d.ts +80 -0
- package/dist/sql/ast.d.ts +21 -0
- package/dist/sql/compile.d.ts +21 -0
- package/dist/sql/dml-compiler.d.ts +54 -0
- package/dist/sql/expression-compiler.d.ts +56 -0
- package/dist/sql/from-compiler.d.ts +39 -0
- package/dist/sql/identifier-quoter.d.ts +15 -0
- package/dist/sql/merge-compiler.d.ts +20 -0
- package/dist/sql/order.d.ts +15 -0
- package/dist/sql/query-compiler.d.ts +45 -0
- package/dist/sql/sql-chunks.d.ts +50 -0
- package/dist/sql/with-compiler.d.ts +19 -0
- package/dist/transaction/advisory-locks.d.ts +28 -0
- package/dist/transaction/transaction-constants.d.ts +35 -0
- package/dist/transaction/transaction-runner.d.ts +60 -0
- package/dist/transaction/transaction-starter.d.ts +25 -0
- package/dist/transaction/transaction-statements.d.ts +28 -0
- package/dist/transaction/transaction.d.ts +198 -0
- package/dist/validation/attribute-validators.d.ts +23 -0
- package/dist/validation/builtin-attribute-validator.d.ts +19 -0
- package/dist/validation/builtin-validators.d.ts +16 -0
- package/dist/validation/core-validator.d.ts +16 -0
- package/dist/validation/custom-validators.d.ts +13 -0
- package/dist/validation/instance-validator.d.ts +25 -0
- package/dist/validation/schema-items.d.ts +22 -0
- package/dist/validation/standard-schema-validator.d.ts +30 -0
- package/dist/validation/standard-schema.d.ts +39 -0
- package/dist/validation/types.d.ts +36 -0
- package/dist/validation/validation-target.d.ts +13 -0
- package/dist/where/comparison-compiler.d.ts +27 -0
- package/dist/where/condition-compiler.d.ts +18 -0
- package/dist/where/operand-resolver.d.ts +10 -0
- package/dist/where/operator-allowlist.d.ts +14 -0
- package/dist/where/where-support.d.ts +52 -0
- package/dist/where/where.d.ts +46 -0
- package/dist/where/window-compiler.d.ts +14 -0
- package/llm/USAGE.md +423 -0
- package/package.json +102 -4
- package/skills/postgrelize/SKILL.md +57 -0
- package/skills/postgrelize/reference/associations.md +108 -0
- package/skills/postgrelize/reference/errors.md +37 -0
- package/skills/postgrelize/reference/migrating-from-sequelize.md +15 -0
- package/skills/postgrelize/reference/postgresql-features.md +157 -0
- package/skills/postgrelize/reference/querying.md +111 -0
- package/skills/postgrelize/reference/schema.md +135 -0
- package/skills/postgrelize/reference/security.md +34 -0
- package/skills/postgrelize/reference/transactions-and-sessions.md +122 -0
- package/skills/postgrelize/reference/writing.md +198 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `postgrelize` are documented in this file.
|
|
4
|
+
|
|
5
|
+
The format follows [Keep a Changelog 1.1.0](https://keepachangelog.com/en/1.1.0/), and the project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html). From 1.0.0 a breaking change raises the major version, a new feature the minor version and a fix the patch version (before 1.0.0 a breaking change raised the minor version). Breaking changes are listed under **Breaking** and also under the usual heading.
|
|
6
|
+
|
|
7
|
+
Entries link the pull request and, for roadmap work, the stage name and the ADR or spec that describes it (specs and ADRs live in [`.10x/`](https://github.com/tormozz48/postgrelize/tree/main/.10x)). Until 0.12.0 the package was published as `@tormozz48/postgrelize` on GitHub Packages only.
|
|
8
|
+
|
|
9
|
+
## Stages and releases
|
|
10
|
+
|
|
11
|
+
| Stage | Shipped in | Pull requests | Spec / ADR |
|
|
12
|
+
| ------------------------------------------------------------------------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------- |
|
|
13
|
+
| M0 tooling, M1 core, M2 `ON CONFLICT`, M3 lifecycle, M4 associations, M5 schema | 0.1.0 | [#1](https://github.com/tormozz48/postgrelize/pull/1)–[#6](https://github.com/tormozz48/postgrelize/pull/6) | MVP design, ADR-001 to ADR-005, ADR-008 to ADR-010 |
|
|
14
|
+
| P1 PostgreSQL power (A query, B write, C connection, D schema) | 0.2.0 | [#8](https://github.com/tormozz48/postgrelize/pull/8)–[#11](https://github.com/tormozz48/postgrelize/pull/11) | P1 design |
|
|
15
|
+
| CTE options, `copyTo` | 0.3.0 | [#13](https://github.com/tormozz48/postgrelize/pull/13) | CTE and COPY design, ADR-013 |
|
|
16
|
+
| Read replicas, nested creation | 0.4.0 | [#15](https://github.com/tormozz48/postgrelize/pull/15) | Replication design, ADR-012, ADR-014 |
|
|
17
|
+
| `returningOld`, scopes of included models | 0.5.0 | [#17](https://github.com/tormozz48/postgrelize/pull/17) | RETURNING old design, ADR-015 |
|
|
18
|
+
| Backlog 2: S1 README and coverage, S2 Sequelize issues review | 0.6.0 | [#20](https://github.com/tormozz48/postgrelize/pull/20), [#22](https://github.com/tormozz48/postgrelize/pull/22), [#23](https://github.com/tormozz48/postgrelize/pull/23) | Backlog 2 roadmap, S2 design, ADR-016 |
|
|
19
|
+
| Backlog 2: S3 docs site, S4 Effect core (steps 1 to 4) | 0.7.0 | [#24](https://github.com/tormozz48/postgrelize/pull/24)–[#26](https://github.com/tormozz48/postgrelize/pull/26), [#28](https://github.com/tormozz48/postgrelize/pull/28) | S4 design, ADR-017 |
|
|
20
|
+
| OOP rewrite (S4 stopped, Effect removed) | 0.8.0 | [#29](https://github.com/tormozz48/postgrelize/pull/29) | OOP rewrite design, ADR-018 |
|
|
21
|
+
| Test isolation, contributor guide | 0.8.1 | [#31](https://github.com/tormozz48/postgrelize/pull/31), [#32](https://github.com/tormozz48/postgrelize/pull/32) | ADR-019 |
|
|
22
|
+
| Backlog 3: S5 injection assurance | 0.9.0 | [#34](https://github.com/tormozz48/postgrelize/pull/34) | ADR-020 |
|
|
23
|
+
| Backlog 3: S6 refactor (a to g), public decorators | 0.9.0 | [#35](https://github.com/tormozz48/postgrelize/pull/35)–[#40](https://github.com/tormozz48/postgrelize/pull/40), [#42](https://github.com/tormozz48/postgrelize/pull/42), [#43](https://github.com/tormozz48/postgrelize/pull/43) | S6 design, ADR-021, ADR-022 |
|
|
24
|
+
| Backlog 3: S9 PostgreSQL coverage matrix | 0.9.0 | [#41](https://github.com/tormozz48/postgrelize/pull/41) | pg gap analysis |
|
|
25
|
+
| Backlog 3: S7 coverage, S7b parity and robustness | 0.9.0 | [#44](https://github.com/tormozz48/postgrelize/pull/44), [#47](https://github.com/tormozz48/postgrelize/pull/47), [#48](https://github.com/tormozz48/postgrelize/pull/48), [#50](https://github.com/tormozz48/postgrelize/pull/50) | S7b design |
|
|
26
|
+
| Backlog 3: S8 LLM docs and TSDoc | 0.9.0 | [#46](https://github.com/tormozz48/postgrelize/pull/46), [#49](https://github.com/tormozz48/postgrelize/pull/49) | ADR-007 |
|
|
27
|
+
| Backlog 3: S10 performance | 0.9.0 | [#51](https://github.com/tormozz48/postgrelize/pull/51)–[#53](https://github.com/tormozz48/postgrelize/pull/53), [#55](https://github.com/tormozz48/postgrelize/pull/55)–[#57](https://github.com/tormozz48/postgrelize/pull/57) | S10 design |
|
|
28
|
+
| S16 session extras, named prepared statements | 0.10.0 | [#61](https://github.com/tormozz48/postgrelize/pull/61), [#64](https://github.com/tormozz48/postgrelize/pull/64) | S16 design, ADR-023 |
|
|
29
|
+
| Backlog 4: S14 types I | 0.10.0 | [#62](https://github.com/tormozz48/postgrelize/pull/62) | S14 design |
|
|
30
|
+
| Backlog 4: S12 set operations and FROM sources | 0.10.0 | [#63](https://github.com/tormozz48/postgrelize/pull/63), [#65](https://github.com/tormozz48/postgrelize/pull/65), [#66](https://github.com/tormozz48/postgrelize/pull/66) | S12 design, ADR-024 |
|
|
31
|
+
| S10b raw reads | 0.10.0 | [#67](https://github.com/tormozz48/postgrelize/pull/67) | S10b design |
|
|
32
|
+
| Backlog 4: S11 DDL objects, S17 operator helpers | 0.11.0 | [#70](https://github.com/tormozz48/postgrelize/pull/70)–[#75](https://github.com/tormozz48/postgrelize/pull/75) | S11 design, ADR-025, S17 design |
|
|
33
|
+
| Backlog 4: S13 constraints, indexes, partitioning | 0.12.0 | [#78](https://github.com/tormozz48/postgrelize/pull/78), [#81](https://github.com/tormozz48/postgrelize/pull/81), [#82](https://github.com/tormozz48/postgrelize/pull/82), [#84](https://github.com/tormozz48/postgrelize/pull/84) | S13 design, ADR-027 |
|
|
34
|
+
| Backlog 4: S15 types II | 0.12.0 | [#77](https://github.com/tormozz48/postgrelize/pull/77), [#79](https://github.com/tormozz48/postgrelize/pull/79), [#80](https://github.com/tormozz48/postgrelize/pull/80), [#83](https://github.com/tormozz48/postgrelize/pull/83) | S15 design, ADR-026 |
|
|
35
|
+
| S16b feature examples enforcement | 0.12.0 | [#85](https://github.com/tormozz48/postgrelize/pull/85), [#86](https://github.com/tormozz48/postgrelize/pull/86) | Feature examples design |
|
|
36
|
+
| Brand: logo (0.10.0), hero art and favicon | 0.10.0, 1.0.0 | [#60](https://github.com/tormozz48/postgrelize/pull/60), [#88](https://github.com/tormozz48/postgrelize/pull/88) | none |
|
|
37
|
+
| Backlog 5: distribution on npmjs.com (S18a) | 1.0.0 | [#89](https://github.com/tormozz48/postgrelize/pull/89), [#90](https://github.com/tormozz48/postgrelize/pull/90) | Backlog 5 roadmap, ADR-028 |
|
|
38
|
+
|
|
39
|
+
## [Unreleased]
|
|
40
|
+
|
|
41
|
+
## [1.0.0] - 2026-11-21
|
|
42
|
+
|
|
43
|
+
First release on npmjs.com, as `postgrelize` (`npm i postgrelize`). The scoped `@tormozz48/postgrelize` mirror on GitHub Packages continues at the same version and is deprecated (ADR-028). The public API exported from `src/index.ts` is now covered by Semantic Versioning.
|
|
44
|
+
|
|
45
|
+
### Breaking
|
|
46
|
+
|
|
47
|
+
- The package is renamed from `@tormozz48/postgrelize` to `postgrelize` for publishing on npmjs.com; install it with `npm i postgrelize` and update imports (S18a, ADR-028). [#90](https://github.com/tormozz48/postgrelize/pull/90)
|
|
48
|
+
|
|
49
|
+
### Added
|
|
50
|
+
|
|
51
|
+
- Release workflow publishes to npmjs.com with provenance and keeps a deprecated GitHub Packages mirror (S18a, ADR-028). [#90](https://github.com/tormozz48/postgrelize/pull/90)
|
|
52
|
+
- Hero art and a favicon set for the documentation site. [#88](https://github.com/tormozz48/postgrelize/pull/88)
|
|
53
|
+
- npm version and downloads badges, and a migration note for users of the scoped name (S18b). [#92](https://github.com/tormozz48/postgrelize/pull/92)
|
|
54
|
+
- Backlog 5 roadmap spec for publishing on npmjs.com (planning only, no code). [#89](https://github.com/tormozz48/postgrelize/pull/89)
|
|
55
|
+
|
|
56
|
+
### Changed
|
|
57
|
+
|
|
58
|
+
- CI runs the checks on Node 20, 22 and 24; one integration and compat job runs on Node 24 with PostgreSQL 18. [#93](https://github.com/tormozz48/postgrelize/pull/93)
|
|
59
|
+
|
|
60
|
+
## [0.12.0] - 2026-11-16
|
|
61
|
+
|
|
62
|
+
### Added
|
|
63
|
+
|
|
64
|
+
- Expression indexes: `{ expression }` index fields, with `nulls` ordering (S13, ADR-027). [#78](https://github.com/tormozz48/postgrelize/pull/78)
|
|
65
|
+
- `EXCLUDE` constraints, `NOT VALID` constraints and `validateConstraint` (S13, ADR-027). [#81](https://github.com/tormozz48/postgrelize/pull/81)
|
|
66
|
+
- PostgreSQL 18 constraint forms: `NOT ENFORCED`, `WITHOUT OVERLAPS`, `PERIOD` (S13, ADR-027). [#82](https://github.com/tormozz48/postgrelize/pull/82)
|
|
67
|
+
- Declarative table partitioning (S13, ADR-027). [#84](https://github.com/tormozz48/postgrelize/pull/84)
|
|
68
|
+
- Geometric data types `POINT`, `LINE`, `LSEG`, `BOX`, `PATH`, `POLYGON`, `CIRCLE` (S15, ADR-026). [#77](https://github.com/tormozz48/postgrelize/pull/77)
|
|
69
|
+
- `MULTIRANGE` data type (S15, ADR-026). [#79](https://github.com/tormozz48/postgrelize/pull/79)
|
|
70
|
+
- `COMPOSITE` data type (S15, ADR-026). [#80](https://github.com/tormozz48/postgrelize/pull/80)
|
|
71
|
+
- PostGIS `GEOGRAPHY` and `GEOMETRY` GeoJSON values with a hex EWKB reader and writer, tested in an optional CI job (S15, ADR-026). [#83](https://github.com/tormozz48/postgrelize/pull/83)
|
|
72
|
+
|
|
73
|
+
### Changed
|
|
74
|
+
|
|
75
|
+
- Every PostgreSQL feature beyond Sequelize v6 now needs a runnable example, a guide section and a CI check (S16b). [#85](https://github.com/tormozz48/postgrelize/pull/85)
|
|
76
|
+
- Added examples and guide entries for `NULLS FIRST/LAST`, `OVERRIDING` and long `IN` lists. [#86](https://github.com/tormozz48/postgrelize/pull/86)
|
|
77
|
+
- Release 0.12.0 version bump. [#87](https://github.com/tormozz48/postgrelize/pull/87)
|
|
78
|
+
|
|
79
|
+
## [0.11.0] - 2026-11-16
|
|
80
|
+
|
|
81
|
+
### Added
|
|
82
|
+
|
|
83
|
+
- QueryInterface support for extensions and sequences (S11, ADR-025). [#70](https://github.com/tormozz48/postgrelize/pull/70)
|
|
84
|
+
- QueryInterface support for functions and triggers (S11, ADR-025). [#72](https://github.com/tormozz48/postgrelize/pull/72)
|
|
85
|
+
- QueryInterface support for views and materialized views (S11, ADR-025). [#73](https://github.com/tormozz48/postgrelize/pull/73)
|
|
86
|
+
- Row-level security policies on QueryInterface (S11, ADR-025). [#74](https://github.com/tormozz48/postgrelize/pull/74)
|
|
87
|
+
- `UNLOGGED` and `TEMPORARY` tables (S11, ADR-025). [#75](https://github.com/tormozz48/postgrelize/pull/75)
|
|
88
|
+
- Operator and search helpers: `Op.similarTo`, `Op.notSimilarTo`, `jsonPathExists`, range and network operators, full-text helpers (`toTsVector`, `tsRank`, `tsHeadline`, `setWeight`) and `pg_trgm` helpers (S17). [#71](https://github.com/tormozz48/postgrelize/pull/71)
|
|
89
|
+
|
|
90
|
+
### Changed
|
|
91
|
+
|
|
92
|
+
- Release flow documented: the release commit goes through a pull request. [#69](https://github.com/tormozz48/postgrelize/pull/69)
|
|
93
|
+
- Release 0.11.0 version bump. [#76](https://github.com/tormozz48/postgrelize/pull/76)
|
|
94
|
+
|
|
95
|
+
## [0.10.0] - 2026-11-16
|
|
96
|
+
|
|
97
|
+
### Added
|
|
98
|
+
|
|
99
|
+
- Opt-in named prepared statements through the `statementCache` option (S16, ADR-023). [#61](https://github.com/tormozz48/postgrelize/pull/61)
|
|
100
|
+
- `DEFERRABLE` transaction mode, per-query `statementTimeout` and `bulkCreate({ unnest: true })` (S16). [#64](https://github.com/tormozz48/postgrelize/pull/64)
|
|
101
|
+
- Set operations (`union`, `intersect`, `except`) on subqueries and `FETCH FIRST … WITH TIES` (S12, ADR-024). [#63](https://github.com/tormozz48/postgrelize/pull/63)
|
|
102
|
+
- `FROM` sources: `VALUES`, set-returning functions with ordinality, `JSON_TABLE` (PostgreSQL 17), `LATERAL` and `TABLESAMPLE` (S12, ADR-024). [#65](https://github.com/tormozz48/postgrelize/pull/65)
|
|
103
|
+
- Data-modifying CTEs and CTE `SEARCH` / `CYCLE` clauses (S12, ADR-024). [#66](https://github.com/tormozz48/postgrelize/pull/66)
|
|
104
|
+
- New data types: HSTORE objects, `LTREE`, `TIMESTAMP`, `MONEY`, `MACADDR8`, `XML`, `BIT` / `VARBIT`, `TSQUERY` (S14). [#62](https://github.com/tormozz48/postgrelize/pull/62)
|
|
105
|
+
- Project logo. [#60](https://github.com/tormozz48/postgrelize/pull/60)
|
|
106
|
+
|
|
107
|
+
### Changed
|
|
108
|
+
|
|
109
|
+
- Raw reads resolve the column plan once per result, so they run faster (S10b). [#67](https://github.com/tormozz48/postgrelize/pull/67)
|
|
110
|
+
- Release 0.10.0 version bump. [#68](https://github.com/tormozz48/postgrelize/pull/68)
|
|
111
|
+
|
|
112
|
+
### Fixed
|
|
113
|
+
|
|
114
|
+
- HSTORE values are returned as objects. [#62](https://github.com/tormozz48/postgrelize/pull/62)
|
|
115
|
+
|
|
116
|
+
## [0.9.0] - 2026-11-15
|
|
117
|
+
|
|
118
|
+
### Added
|
|
119
|
+
|
|
120
|
+
- Public model decorators (`@Table`, `@Column`, association and hook decorators) and `sequelize.addModels` (S6g, ADR-022). [#42](https://github.com/tormozz48/postgrelize/pull/42)
|
|
121
|
+
- PostgreSQL coverage matrix page listing what is supported, literal-only, planned or out of scope (S9). [#41](https://github.com/tormozz48/postgrelize/pull/41)
|
|
122
|
+
- LLM-facing documentation: `llms.txt`, `llms-full.txt`, `llm/USAGE.md` and an Agent Skill shipped in the npm package (S8a). [#46](https://github.com/tormozz48/postgrelize/pull/46)
|
|
123
|
+
- TSDoc for the whole public API, enforced by tests and the docs build (S8b). [#49](https://github.com/tormozz48/postgrelize/pull/49)
|
|
124
|
+
- Security page, SQL-injection test suite (payload and property tests), CodeQL scanning and `SECURITY.md` (S5, ADR-020). [#34](https://github.com/tormozz48/postgrelize/pull/34)
|
|
125
|
+
- Performance guide, plus a benchmark that compares every case with Sequelize v6 (S10). [#51](https://github.com/tormozz48/postgrelize/pull/51), [#57](https://github.com/tormozz48/postgrelize/pull/57)
|
|
126
|
+
- `Sequelize#createSchema`, `showAllSchemas`, `dropSchema` and `QueryInterface#dropAllSchemas`, which v6 exposes. [#34](https://github.com/tormozz48/postgrelize/pull/34)
|
|
127
|
+
|
|
128
|
+
### Changed
|
|
129
|
+
|
|
130
|
+
- Internals are split into small classes, mixins and decorators under enforced size limits (S6a to S6f, ADR-021). [#35](https://github.com/tormozz48/postgrelize/pull/35), [#36](https://github.com/tormozz48/postgrelize/pull/36), [#37](https://github.com/tormozz48/postgrelize/pull/37), [#38](https://github.com/tormozz48/postgrelize/pull/38), [#39](https://github.com/tormozz48/postgrelize/pull/39), [#40](https://github.com/tormozz48/postgrelize/pull/40), [#43](https://github.com/tormozz48/postgrelize/pull/43)
|
|
131
|
+
- Performance work on row mapping, include assembly, option merging, hook dispatch, SQL assembly, `toJSON`, change tracking and validation (S10). [#52](https://github.com/tormozz48/postgrelize/pull/52), [#53](https://github.com/tormozz48/postgrelize/pull/53), [#55](https://github.com/tormozz48/postgrelize/pull/55), [#56](https://github.com/tormozz48/postgrelize/pull/56)
|
|
132
|
+
- Test coverage raised to 99.7% lines, with thresholds enforced in CI (S7). [#44](https://github.com/tormozz48/postgrelize/pull/44)
|
|
133
|
+
- Parity and robustness fixes against Sequelize v6 behaviour (S7b). [#47](https://github.com/tormozz48/postgrelize/pull/47), [#48](https://github.com/tormozz48/postgrelize/pull/48), [#50](https://github.com/tormozz48/postgrelize/pull/50)
|
|
134
|
+
|
|
135
|
+
### Fixed
|
|
136
|
+
|
|
137
|
+
- `create`, `bulkCreate` and `save` with an explicit `fields` list add timestamps, version and defaulted keys like v6. [#47](https://github.com/tormozz48/postgrelize/pull/47)
|
|
138
|
+
- `Model.schema(name, options)` returns a schema-bound model, `set()` keeps an attribute changed after setting it back, `aggregate` honours `plain: false` and `dataType`, and `hasHook` of an unregistered type returns `undefined`. [#47](https://github.com/tormozz48/postgrelize/pull/47)
|
|
139
|
+
- LISTEN reconnects after a failed connect, `beforeBulkSync` / `afterBulkSync` and per-model sync hooks run, and checked-out clients handle errors and are discarded when broken. [#48](https://github.com/tormozz48/postgrelize/pull/48)
|
|
140
|
+
- Association, validation and raw-query results match v6 (for example `hasOne` setters, `EagerLoadingError` on a wrong alias, `belongsToMany` `joinTableAttributes`). [#50](https://github.com/tormozz48/postgrelize/pull/50)
|
|
141
|
+
|
|
142
|
+
### Security
|
|
143
|
+
|
|
144
|
+
- Closed the injection paths found by the S5 audit: unknown lock strengths fall back to `FOR UPDATE`, `Model.aggregate` validates the function name, `where(attr, comparator, value)` rejects comment tokens, `transaction({ isolationLevel })` and `deferrable` accept only known constants, DDL type options must be non-negative integers, and the `timezone` option must be an offset or IANA name (S5, ADR-020). [#34](https://github.com/tormozz48/postgrelize/pull/34)
|
|
145
|
+
|
|
146
|
+
## [0.8.1] - 2026-11-15
|
|
147
|
+
|
|
148
|
+
### Added
|
|
149
|
+
|
|
150
|
+
- `AGENTS.md` contributor guide and documentation sync rules (ADR-019). [#32](https://github.com/tormozz48/postgrelize/pull/32)
|
|
151
|
+
|
|
152
|
+
### Fixed
|
|
153
|
+
|
|
154
|
+
- Test databases are isolated per run and lock-ordering races in tests are removed. No library code changed. [#31](https://github.com/tormozz48/postgrelize/pull/31)
|
|
155
|
+
|
|
156
|
+
## [0.8.0] - 2026-11-15
|
|
157
|
+
|
|
158
|
+
### Breaking
|
|
159
|
+
|
|
160
|
+
- The `postgrelize/effect` entry point and the Effect-based API are removed. Use the main `postgrelize` entry point. [#29](https://github.com/tormozz48/postgrelize/pull/29)
|
|
161
|
+
|
|
162
|
+
### Changed
|
|
163
|
+
|
|
164
|
+
- The whole library is rewritten as small classes with injected collaborators instead of an Effect core (OOP rewrite, ADR-018, supersedes ADR-005 and ADR-017). [#29](https://github.com/tormozz48/postgrelize/pull/29)
|
|
165
|
+
|
|
166
|
+
### Removed
|
|
167
|
+
|
|
168
|
+
- The `effect` dependency and the `postgrelize/effect` export. [#29](https://github.com/tormozz48/postgrelize/pull/29)
|
|
169
|
+
|
|
170
|
+
### Fixed
|
|
171
|
+
|
|
172
|
+
- `describeTable` reads enum values from the column type's own schema, in declared order. [#29](https://github.com/tormozz48/postgrelize/pull/29)
|
|
173
|
+
- Expression classes are recognised across package copies, so `instanceof` checks keep working. [#29](https://github.com/tormozz48/postgrelize/pull/29)
|
|
174
|
+
|
|
175
|
+
## [0.7.0] - 2026-11-15
|
|
176
|
+
|
|
177
|
+
### Added
|
|
178
|
+
|
|
179
|
+
- VitePress documentation site with runnable examples and a generated API reference (S3). [#24](https://github.com/tormozz48/postgrelize/pull/24)
|
|
180
|
+
- Effect-based connection and transaction layer and the `postgrelize/effect` entry point (S4 steps 1 to 3, ADR-017). [#26](https://github.com/tormozz48/postgrelize/pull/26)
|
|
181
|
+
- Hooks and the read pipeline (`findAll`, `count`) as Effect programs (S4 step 4). [#28](https://github.com/tormozz48/postgrelize/pull/28)
|
|
182
|
+
|
|
183
|
+
### Fixed
|
|
184
|
+
|
|
185
|
+
- A transaction-start failure no longer leaks a pooled connection. [#26](https://github.com/tormozz48/postgrelize/pull/26)
|
|
186
|
+
- `include: [{ separate: true, limit }]` applies `limit` per parent, like v6. [#25](https://github.com/tormozz48/postgrelize/pull/25)
|
|
187
|
+
- `findEach` loads `separate: true` includes for each batch. [#25](https://github.com/tormozz48/postgrelize/pull/25)
|
|
188
|
+
|
|
189
|
+
## [0.6.0] - 2026-11-14
|
|
190
|
+
|
|
191
|
+
### Added
|
|
192
|
+
|
|
193
|
+
- README badges and a self-hosted coverage report (S1). [#20](https://github.com/tormozz48/postgrelize/pull/20)
|
|
194
|
+
- `docs/sequelize-issues.md`: a public page of the Sequelize v6 PostgreSQL issues postgrelize fixes (S2, ADR-016). [#22](https://github.com/tormozz48/postgrelize/pull/22), [#23](https://github.com/tormozz48/postgrelize/pull/23)
|
|
195
|
+
|
|
196
|
+
### Fixed
|
|
197
|
+
|
|
198
|
+
- Included associations and junction rows are instance properties (`todo.User`, `user.Posts`). [#22](https://github.com/tormozz48/postgrelize/pull/22)
|
|
199
|
+
- `upsert` and `bulkCreate({ updateOnDuplicate })` pick the conflict target from unique `indexes` like v6 (sequelize#13734). [#22](https://github.com/tormozz48/postgrelize/pull/22)
|
|
200
|
+
- Explicit `createdAt` / `updatedAt` attributes keep their definition (sequelize#10419), and `upsert` keeps a supplied `updatedAt` (sequelize#17486). [#22](https://github.com/tormozz48/postgrelize/pull/22)
|
|
201
|
+
- `ARRAY(ENUM)` returns arrays (sequelize#15466, sequelize#11100). [#22](https://github.com/tormozz48/postgrelize/pull/22)
|
|
202
|
+
- `sync()` handles foreign-key cycles by adding back-references after all tables exist (sequelize#15522). [#22](https://github.com/tormozz48/postgrelize/pull/22)
|
|
203
|
+
- `addColumn` and `sync({ alter })` keep column `comment` (sequelize#17118). [#22](https://github.com/tormozz48/postgrelize/pull/22)
|
|
204
|
+
- `order: ['jsonCol.path']` works and orders by the jsonb value (sequelize#9040). [#22](https://github.com/tormozz48/postgrelize/pull/22)
|
|
205
|
+
- JSON `where` keys with `,`, `"` or `\` match correctly (sequelize#18617), jsonb operators work on nested paths (sequelize#5173), and `{ [Op.any]: [...] }` works (sequelize#16043). [#23](https://github.com/tormozz48/postgrelize/pull/23)
|
|
206
|
+
- `upsert({ overriding })` works on `GENERATED ALWAYS` identity columns (sequelize#14497) and uses a partial unique index predicate (sequelize#12595). [#23](https://github.com/tormozz48/postgrelize/pull/23)
|
|
207
|
+
- `bulkCreate({ ignoreDuplicates })` assigns returned rows to the inserted records. [#23](https://github.com/tormozz48/postgrelize/pull/23)
|
|
208
|
+
- `describeTable` unquotes literal defaults (sequelize#16787), and `sync({ alter })` keeps the sequence of non-key `autoIncrement` columns (sequelize#13167). [#23](https://github.com/tormozz48/postgrelize/pull/23)
|
|
209
|
+
- `sync({ schema })` and `drop({ schema })` act only on that schema (sequelize#18423). [#23](https://github.com/tormozz48/postgrelize/pull/23)
|
|
210
|
+
- `belongsToMany` with a custom `sourceKey` and `limit` (sequelize#18256), and a top-level `$include.attr$` condition with a `hasMany` include and `limit` (sequelize#12971). [#23](https://github.com/tormozz48/postgrelize/pull/23)
|
|
211
|
+
|
|
212
|
+
## [0.5.0] - 2026-11-14
|
|
213
|
+
|
|
214
|
+
### Added
|
|
215
|
+
|
|
216
|
+
- `returningOld` / `oldValues`: `RETURNING old.*` on PostgreSQL 18 (ADR-015). [#17](https://github.com/tormozz48/postgrelize/pull/17)
|
|
217
|
+
- Scopes of included models apply, like v6 (ADR-015). [#17](https://github.com/tormozz48/postgrelize/pull/17)
|
|
218
|
+
|
|
219
|
+
## [0.4.0] - 2026-11-14
|
|
220
|
+
|
|
221
|
+
### Added
|
|
222
|
+
|
|
223
|
+
- Read replica routing with the `replication` option and `useMaster` (ADR-014). [#15](https://github.com/tormozz48/postgrelize/pull/15)
|
|
224
|
+
- Nested creation through `include`, for example `Post.create({ Comments: [...] }, { include })`. [#15](https://github.com/tormozz48/postgrelize/pull/15)
|
|
225
|
+
|
|
226
|
+
## [0.3.0] - 2026-11-14
|
|
227
|
+
|
|
228
|
+
### Added
|
|
229
|
+
|
|
230
|
+
- CTE options: `WITH` and `WITH RECURSIVE` (ADR-013). [#13](https://github.com/tormozz48/postgrelize/pull/13)
|
|
231
|
+
- `Model.copyTo` for `COPY … TO` (ADR-013). [#13](https://github.com/tormozz48/postgrelize/pull/13)
|
|
232
|
+
|
|
233
|
+
## [0.2.0] - 2026-11-14
|
|
234
|
+
|
|
235
|
+
### Added
|
|
236
|
+
|
|
237
|
+
- Query power (P1-A): subqueries, `EXISTS`, `DISTINCT ON`, window functions and row comparison. [#8](https://github.com/tormozz48/postgrelize/pull/8)
|
|
238
|
+
- Write power (P1-B): `UPDATE … FROM`, `DELETE … USING`, `INSERT … SELECT` and `MERGE`. [#9](https://github.com/tormozz48/postgrelize/pull/9)
|
|
239
|
+
- Connection power (P1-C): cursors, `LISTEN` / `NOTIFY`, `SET LOCAL`, advisory locks and `COPY`. [#10](https://github.com/tormozz48/postgrelize/pull/10)
|
|
240
|
+
- Schema power (P1-D): identity and generated columns, `INTERVAL`, `OVERRIDING` and enum alteration. [#11](https://github.com/tormozz48/postgrelize/pull/11)
|
|
241
|
+
|
|
242
|
+
## [0.1.0] - 2026-11-14
|
|
243
|
+
|
|
244
|
+
First release: a PostgreSQL-only, Sequelize v6 drop-in ORM written in TypeScript, published to GitHub Packages.
|
|
245
|
+
|
|
246
|
+
### Added
|
|
247
|
+
|
|
248
|
+
- Project tooling, CI/CD on GitHub Actions and the first documentation (M0, ADR-001, ADR-006, ADR-007). [#1](https://github.com/tormozz48/postgrelize/pull/1)
|
|
249
|
+
- Core: `Sequelize`, model CRUD, `where` and `Op`, data types, errors and transactions, on the `pg` driver with bound parameters (M1, ADR-002, ADR-004). [#2](https://github.com/tormozz48/postgrelize/pull/2)
|
|
250
|
+
- `INSERT … ON CONFLICT` through the `onConflict` option and `Model.insert()`, plus security hardening (M2, ADR-003). [#3](https://github.com/tormozz48/postgrelize/pull/3)
|
|
251
|
+
- Hooks, validation (validator.js and Standard Schema), scopes, paranoid models and optimistic locking (M3, ADR-008). [#4](https://github.com/tormozz48/postgrelize/pull/4)
|
|
252
|
+
- Associations and eager loading with `include` (M4, ADR-009). [#5](https://github.com/tormozz48/postgrelize/pull/5)
|
|
253
|
+
- `QueryInterface`, `sync` / `drop` and constraints (M5, ADR-010). [#6](https://github.com/tormozz48/postgrelize/pull/6)
|
|
254
|
+
|
|
255
|
+
[Unreleased]: https://github.com/tormozz48/postgrelize/compare/v1.0.0...HEAD
|
|
256
|
+
[1.0.0]: https://github.com/tormozz48/postgrelize/compare/v0.12.0...v1.0.0
|
|
257
|
+
[0.12.0]: https://github.com/tormozz48/postgrelize/compare/v0.11.0...v0.12.0
|
|
258
|
+
[0.11.0]: https://github.com/tormozz48/postgrelize/compare/v0.10.0...v0.11.0
|
|
259
|
+
[0.10.0]: https://github.com/tormozz48/postgrelize/compare/v0.9.0...v0.10.0
|
|
260
|
+
[0.9.0]: https://github.com/tormozz48/postgrelize/compare/v0.8.1...v0.9.0
|
|
261
|
+
[0.8.1]: https://github.com/tormozz48/postgrelize/compare/v0.8.0...v0.8.1
|
|
262
|
+
[0.8.0]: https://github.com/tormozz48/postgrelize/compare/v0.7.0...v0.8.0
|
|
263
|
+
[0.7.0]: https://github.com/tormozz48/postgrelize/compare/v0.6.0...v0.7.0
|
|
264
|
+
[0.6.0]: https://github.com/tormozz48/postgrelize/compare/v0.5.0...v0.6.0
|
|
265
|
+
[0.5.0]: https://github.com/tormozz48/postgrelize/compare/v0.4.0...v0.5.0
|
|
266
|
+
[0.4.0]: https://github.com/tormozz48/postgrelize/compare/v0.3.0...v0.4.0
|
|
267
|
+
[0.3.0]: https://github.com/tormozz48/postgrelize/compare/v0.2.0...v0.3.0
|
|
268
|
+
[0.2.0]: https://github.com/tormozz48/postgrelize/compare/v0.1.0...v0.2.0
|
|
269
|
+
[0.1.0]: https://github.com/tormozz48/postgrelize/releases/tag/v0.1.0
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Andrey Kuznetsov
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,132 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="docs/public/logo-wordmark-dark.svg">
|
|
4
|
+
<img alt="postgrelize" src="docs/public/logo-wordmark.svg" height="64">
|
|
5
|
+
</picture>
|
|
6
|
+
</p>
|
|
2
7
|
|
|
3
|
-
|
|
8
|
+
<p align="center">
|
|
9
|
+
PostgreSQL-only ORM for Node.js with the <a href="https://sequelize.org/docs/v6/">Sequelize v6</a> API — plus the PostgreSQL features Sequelize can't express.
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
<p align="center">
|
|
13
|
+
<a href="https://www.npmjs.com/package/postgrelize"><img alt="npm version" src="https://img.shields.io/npm/v/postgrelize?label=npm"></a>
|
|
14
|
+
<a href="https://www.npmjs.com/package/postgrelize"><img alt="npm downloads" src="https://img.shields.io/npm/dw/postgrelize?label=downloads"></a>
|
|
15
|
+
<a href="https://github.com/tormozz48/postgrelize/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/tormozz48/postgrelize/actions/workflows/ci.yml/badge.svg?branch=main"></a>
|
|
16
|
+
<a href="https://tormozz48.github.io/postgrelize/coverage/"><img alt="coverage" src="https://img.shields.io/endpoint?url=https%3A%2F%2Ftormozz48.github.io%2Fpostgrelize%2Fcoverage%2Fbadge.json"></a>
|
|
17
|
+
<img alt="PostgreSQL 16–18" src="https://img.shields.io/badge/PostgreSQL-16%20%7C%2017%20%7C%2018-336791?logo=postgresql&logoColor=white">
|
|
18
|
+
<img alt="Node.js 20+" src="https://img.shields.io/badge/node-%3E%3D20-339933?logo=node.js&logoColor=white">
|
|
19
|
+
<img alt="TypeScript" src="https://img.shields.io/badge/TypeScript-strict-3178C6?logo=typescript&logoColor=white">
|
|
20
|
+
<a href="https://tormozz48.github.io/postgrelize/"><img alt="docs" src="https://img.shields.io/badge/docs-API%20reference-blue"></a>
|
|
21
|
+
<a href="LICENSE"><img alt="MIT license" src="https://img.shields.io/github/license/tormozz48/postgrelize"></a>
|
|
22
|
+
</p>
|
|
23
|
+
|
|
24
|
+
## Why postgrelize
|
|
25
|
+
|
|
26
|
+
- **Drop-in for Sequelize v6.** `Sequelize`, `Model`, `DataTypes`, `Op`, hooks, validations, scopes, paranoid models, associations and `include`, transactions, `QueryInterface` and `sync` behave like v6. A differential test suite runs every scenario on both libraries and compares results.
|
|
27
|
+
- **PostgreSQL first.** One dialect, so every feature can use PostgreSQL fully instead of the lowest common denominator.
|
|
28
|
+
- **Safe by default.** Values are always bound parameters; identifiers are quoted; order directions, cast types and operators are allow-listed.
|
|
29
|
+
- **Typed and documented.** Strict TypeScript, TSDoc on every export, [API reference](https://tormozz48.github.io/postgrelize/).
|
|
30
|
+
|
|
31
|
+
### What you get on top of Sequelize v6
|
|
32
|
+
|
|
33
|
+
| Area | postgrelize | Sequelize v6 |
|
|
34
|
+
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------ |
|
|
35
|
+
| Upserts | `onConflict` with any target, expression updates, `WHERE`, `DO NOTHING`; `Model.insert()` with `wasInserted` per row | `upsert` / `updateOnDuplicate` with fixed column lists |
|
|
36
|
+
| Bulk writes | `bulkCreate({ unnest: true })` past the 65535-parameter limit, `MERGE` (`Model.merge`), `UPDATE ... FROM`, `DELETE ... USING`, `INSERT ... SELECT` (`Model.insertFrom`) | — |
|
|
37
|
+
| Old values | `returningOld` → `instance.oldValues` (PostgreSQL 18 `RETURNING OLD`) | — |
|
|
38
|
+
| Import / export | `COPY FROM STDIN` / `COPY TO STDOUT` streaming (`Model.copyFrom`, `Model.copyTo`) | — |
|
|
39
|
+
| Queries | CTEs incl. `WITH RECURSIVE`, set operations (`union()`, `intersect()`, `except()`), `FETCH … WITH TIES`, `LATERAL` (incl. top-N per parent includes), `VALUES` / set-returning functions / `JSON_TABLE` in `FROM`, `TABLESAMPLE`, data-modifying CTEs (`Model.deleteStatement()` …), CTE `SEARCH` / `CYCLE`, subqueries (`Model.subquery`, `exists()`), operator and search helpers (`Op.similarTo`, `Op.jsonPathExists`, subnet and `pg_trgm` operators, `jsonbPath()`, full-text `websearchToTsQuery()` / `tsRank()` / `tsHeadline()`), `DISTINCT ON`, window functions (`over()`), row comparison (`tuple()`), server-side cursors (`Model.findEach`), `= ANY($1)` for large `IN` lists | literals only |
|
|
40
|
+
| Sessions | `LISTEN/NOTIFY`, `SET LOCAL` for RLS, advisory locks, `DEFERRABLE` transactions, per-query `statementTimeout` | — |
|
|
41
|
+
| Scaling | read replicas with round-robin readers (`replication`, `useMaster`); opt-in named prepared statements (`statementCache`) | read replicas |
|
|
42
|
+
| Models | optional decorators (`@Table`, `@Column`, `@HasMany`, hook decorators, …) and `sequelize.addModels`, in both TC39 and legacy decorator modes | `Model.init` / `define` only |
|
|
43
|
+
| Schema objects | `QueryInterface` extensions, sequences, views and materialized views, row-level security policies, `UNLOGGED` / `TEMPORARY` tables, expression indexes, `EXCLUDE`, `NOT VALID`, `NOT ENFORCED` and temporal (`WITHOUT OVERLAPS`, `PERIOD`) constraints, declarative partitioning, functions and triggers (`createExtension`, `createSequence`, `createView`, `refreshMaterializedView`, `createFunction`, `createTrigger`) | — |
|
|
44
|
+
| Schema | identity and generated columns, `INTERVAL`, `HSTORE` objects, `LTREE`, `TIMESTAMP`, `MONEY`, `BIT` / `VARBIT`, `XML`, `MACADDR8`, `TSQUERY`, geometric types (`POINT`, `LSEG`, `BOX`, `PATH`, `POLYGON`, `CIRCLE`), multiranges, composite types, PostGIS `GEOMETRY` / `GEOGRAPHY` as GeoJSON, `UNIQUE NULLS NOT DISTINCT`, Standard Schema (zod / valibot / arktype) validation | — |
|
|
45
|
+
|
|
46
|
+
## Install
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npm install postgrelize pg
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The package is published on npmjs.com as `postgrelize`. The former GitHub Packages name `@tormozz48/postgrelize` is deprecated: switch the dependency and your imports to `postgrelize`.
|
|
53
|
+
|
|
54
|
+
### For LLMs and agents
|
|
55
|
+
|
|
56
|
+
The package ships `llm/USAGE.md` (a compact, tested usage guide) and an Agent Skill in `skills/postgrelize/`, next to the typed `.d.ts` files with TSDoc. The docs site publishes [`llms.txt`](https://tormozz48.github.io/postgrelize/llms.txt) and [`llms-full.txt`](https://tormozz48.github.io/postgrelize/llms-full.txt). See [Using with LLMs and agents](https://tormozz48.github.io/postgrelize/guide/llm).
|
|
57
|
+
|
|
58
|
+
## Quick start
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
import { DataTypes, Model, Op, Sequelize, excluded, literal } from 'postgrelize';
|
|
62
|
+
import type { CreationOptional, InferAttributes, InferCreationAttributes } from 'postgrelize';
|
|
63
|
+
|
|
64
|
+
const sequelize = new Sequelize(process.env.DATABASE_URL!, { logging: false });
|
|
65
|
+
|
|
66
|
+
class Counter extends Model<InferAttributes<Counter>, InferCreationAttributes<Counter>> {
|
|
67
|
+
declare id: CreationOptional<number>;
|
|
68
|
+
declare key: string;
|
|
69
|
+
declare hits: number;
|
|
70
|
+
declare version: CreationOptional<number>;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
Counter.init(
|
|
74
|
+
{
|
|
75
|
+
id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true },
|
|
76
|
+
key: { type: DataTypes.TEXT, allowNull: false, unique: true },
|
|
77
|
+
hits: { type: DataTypes.INTEGER, allowNull: false, defaultValue: 0 },
|
|
78
|
+
version: { type: DataTypes.INTEGER, allowNull: false, defaultValue: 1 },
|
|
79
|
+
},
|
|
80
|
+
{ sequelize },
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
await sequelize.sync();
|
|
84
|
+
|
|
85
|
+
// Sequelize v6 API works as before
|
|
86
|
+
await Counter.findAll({ where: { hits: { [Op.gte]: 10 } }, order: [['hits', 'DESC']] });
|
|
87
|
+
|
|
88
|
+
// PostgreSQL extension: expression-based upsert with a condition
|
|
89
|
+
const rows = await Counter.insert([{ key: 'home', hits: 1, version: 2 }], {
|
|
90
|
+
onConflict: {
|
|
91
|
+
target: ['key'],
|
|
92
|
+
action: {
|
|
93
|
+
update: { hits: literal('"Counter"."hits" + EXCLUDED."hits"'), version: excluded('version') },
|
|
94
|
+
where: { version: { [Op.lt]: excluded('version') } },
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
rows.forEach((row) => console.log(row.key, row.wasInserted ? 'inserted' : 'updated'));
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Compatibility
|
|
102
|
+
|
|
103
|
+
- PostgreSQL 16, 17 and 18 (tested in CI); some features need newer servers: `MERGE ... RETURNING` 17+, `returningOld` 18+.
|
|
104
|
+
- Node.js 20+ (tested on 20, 22 and 24), `pg` driver.
|
|
105
|
+
- A few behaviours intentionally differ from Sequelize v6 where v6 is wrong for PostgreSQL (e.g. `describeTable` defaults to `current_schema()` instead of `public`); see [Sequelize issues fixed in postgrelize](docs/sequelize-issues.md) for the full list.
|
|
106
|
+
|
|
107
|
+
## Links
|
|
108
|
+
|
|
109
|
+
- [API reference](https://tormozz48.github.io/postgrelize/)
|
|
110
|
+
- [PostgreSQL coverage](https://tormozz48.github.io/postgrelize/postgresql-coverage) — which PostgreSQL 16–18 features are supported, test-backed, planned or out of scope
|
|
111
|
+
- [Coverage report](https://tormozz48.github.io/postgrelize/coverage/)
|
|
112
|
+
- [Changelog](CHANGELOG.md) — every release and roadmap stage, linked to tags
|
|
113
|
+
- [Package versions](https://www.npmjs.com/package/postgrelize) · [Tags](https://github.com/tormozz48/postgrelize/tags)
|
|
114
|
+
|
|
115
|
+
## Development
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
npm ci
|
|
119
|
+
npm run db:up # PostgreSQL 16 in Docker on port 54329
|
|
120
|
+
npm run lint && npm run format:check && npm run typecheck
|
|
121
|
+
npm test # unit + integration + differential (vs sequelize@6)
|
|
122
|
+
npm run build && npm run test:build
|
|
123
|
+
npm run llm:build # regenerate llm/USAGE.md and skills/ from docs/llm + docs/examples/llm-usage.ts
|
|
124
|
+
npm run docs # documentation site into docs/.vitepress/dist (npm run docs:dev to preview)
|
|
125
|
+
npm run test:coverage # coverage report into coverage/
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Contribution rules (architecture, tests, documentation sync, releases) are in [AGENTS.md](AGENTS.md). Design records, ADRs and reviews live in `.10x/`.
|
|
129
|
+
|
|
130
|
+
## License
|
|
131
|
+
|
|
132
|
+
MIT
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AssociationName, AssociationType } from './types.ts';
|
|
2
|
+
/** Names of the accessor methods of an association and their installation on a prototype. */
|
|
3
|
+
export declare class AssociationAccessors {
|
|
4
|
+
#private;
|
|
5
|
+
/**
|
|
6
|
+
* Accessor method names of an association.
|
|
7
|
+
*
|
|
8
|
+
* @param type - Kind of association.
|
|
9
|
+
* @param name - Singular and plural alias forms.
|
|
10
|
+
* @returns Accessor key → method name.
|
|
11
|
+
*/
|
|
12
|
+
namesFor(type: AssociationType, name: AssociationName): Readonly<Record<string, string>>;
|
|
13
|
+
/**
|
|
14
|
+
* Installs the accessor methods on a model prototype, leaving existing methods untouched.
|
|
15
|
+
*
|
|
16
|
+
* @param association - Association whose methods implement the accessors.
|
|
17
|
+
* @param prototype - Source model prototype.
|
|
18
|
+
* @param accessors - Accessor key → method name.
|
|
19
|
+
*/
|
|
20
|
+
install(association: object, prototype: object, accessors: Readonly<Record<string, string>>): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ModelStatic, AnyModel } from '../model/options.ts';
|
|
2
|
+
import { AssociationName, AssociationThrough } from './types.ts';
|
|
3
|
+
type Model = ModelStatic<AnyModel>;
|
|
4
|
+
/** Keys resolved by a concrete association. */
|
|
5
|
+
export type AssociationKeyFields = Readonly<{
|
|
6
|
+
/** Foreign key attribute. */
|
|
7
|
+
foreignKey: string;
|
|
8
|
+
/** Column of the foreign key. */
|
|
9
|
+
identifierField: string;
|
|
10
|
+
/** Source attribute referenced by the foreign key. */
|
|
11
|
+
sourceKey: string;
|
|
12
|
+
/** Target attribute referenced by the foreign key or by `otherKey`. */
|
|
13
|
+
targetKey: string;
|
|
14
|
+
/** Junction foreign key pointing at the target (belongsToMany). */
|
|
15
|
+
otherKey: string | undefined;
|
|
16
|
+
/** Junction model (belongsToMany). */
|
|
17
|
+
through: AssociationThrough | undefined;
|
|
18
|
+
}>;
|
|
19
|
+
/** Model and key a foreign key attribute references, with the referential actions given. */
|
|
20
|
+
export type ReferenceSpec = Readonly<{
|
|
21
|
+
/** Referenced model. */
|
|
22
|
+
model: Model;
|
|
23
|
+
/** Referenced attribute. */
|
|
24
|
+
key: string;
|
|
25
|
+
/** `ON DELETE` action given in the options. */
|
|
26
|
+
onDelete: string | undefined;
|
|
27
|
+
/** `ON UPDATE` action given in the options. */
|
|
28
|
+
onUpdate: string | undefined;
|
|
29
|
+
/** `constraints` option. */
|
|
30
|
+
constraints: boolean | undefined;
|
|
31
|
+
}>;
|
|
32
|
+
/** Referential actions used when the options give none (`auto`: `SET NULL` when nullable). */
|
|
33
|
+
export type ReferenceDefaults = Readonly<{
|
|
34
|
+
onDelete: string;
|
|
35
|
+
onUpdate: string;
|
|
36
|
+
}>;
|
|
37
|
+
/** Alias and keys of a hasOne / hasMany association. */
|
|
38
|
+
export type TargetKeys = Readonly<{
|
|
39
|
+
/** Singular and plural alias forms. */
|
|
40
|
+
name: AssociationName;
|
|
41
|
+
/** Resolved keys. */
|
|
42
|
+
keys: AssociationKeyFields;
|
|
43
|
+
}>;
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { AttributeDefinition } from '../model/model-definition.ts';
|
|
2
|
+
import { AnyModel, ModelStatic, Values } from '../model/options.ts';
|
|
3
|
+
import { ReferenceDefaults, ReferenceSpec } from './association-key-types.ts';
|
|
4
|
+
import { AssociationName, AssociationOptions, ForeignKeyOptions } from './types.ts';
|
|
5
|
+
type Model = ModelStatic<AnyModel>;
|
|
6
|
+
export type { AssociationKeyFields, ReferenceDefaults, ReferenceSpec, TargetKeys, } from './association-key-types.ts';
|
|
7
|
+
/** Naming and foreign key attribute rules shared by the association classes (Sequelize v6 defaults). */
|
|
8
|
+
export declare class AssociationKeys {
|
|
9
|
+
#private;
|
|
10
|
+
/**
|
|
11
|
+
* Converts `snake_case` / `kebab-case` / spaced names to camelCase.
|
|
12
|
+
*
|
|
13
|
+
* @param value - Name to convert.
|
|
14
|
+
* @returns camelCase name.
|
|
15
|
+
*/
|
|
16
|
+
camelize(value: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Singular and plural forms of a model name.
|
|
19
|
+
*
|
|
20
|
+
* @param model - Model class.
|
|
21
|
+
* @returns Name forms.
|
|
22
|
+
*/
|
|
23
|
+
modelName(model: Model): AssociationName;
|
|
24
|
+
/**
|
|
25
|
+
* First primary key attribute of a model.
|
|
26
|
+
*
|
|
27
|
+
* @param model - Model class.
|
|
28
|
+
* @returns Attribute name (`id` when the model has none).
|
|
29
|
+
*/
|
|
30
|
+
primaryKey(model: Model): string;
|
|
31
|
+
/**
|
|
32
|
+
* Attribute definition by name.
|
|
33
|
+
*
|
|
34
|
+
* @param model - Model class.
|
|
35
|
+
* @param name - Attribute name.
|
|
36
|
+
* @returns Definition, if the attribute exists.
|
|
37
|
+
*/
|
|
38
|
+
attributeOf(model: Model, name: string): AttributeDefinition | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Column of an attribute.
|
|
41
|
+
*
|
|
42
|
+
* @param model - Model class.
|
|
43
|
+
* @param name - Attribute name.
|
|
44
|
+
* @returns Column name (the attribute name when not defined).
|
|
45
|
+
*/
|
|
46
|
+
fieldOf(model: Model, name: string): string;
|
|
47
|
+
/**
|
|
48
|
+
* Attribute name of a `foreignKey` / `otherKey` option.
|
|
49
|
+
*
|
|
50
|
+
* @param option - Option value.
|
|
51
|
+
* @returns Attribute name, if given.
|
|
52
|
+
*/
|
|
53
|
+
foreignKeyName(option: string | ForeignKeyOptions | undefined): string | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Object form of a `foreignKey` / `otherKey` option.
|
|
56
|
+
*
|
|
57
|
+
* @param option - Option value.
|
|
58
|
+
* @returns Foreign key options (empty for a string).
|
|
59
|
+
*/
|
|
60
|
+
foreignKeyExtras(option: string | ForeignKeyOptions | undefined): ForeignKeyOptions;
|
|
61
|
+
/**
|
|
62
|
+
* Singular and plural alias forms.
|
|
63
|
+
*
|
|
64
|
+
* @param as - `as` option.
|
|
65
|
+
* @param fallback - Forms used without `as`.
|
|
66
|
+
* @param multi - Whether a string alias is the plural form.
|
|
67
|
+
* @returns Alias forms.
|
|
68
|
+
*/
|
|
69
|
+
aliasNames(as: string | AssociationName | undefined, fallback: AssociationName, multi: boolean): AssociationName;
|
|
70
|
+
/**
|
|
71
|
+
* `references` / `onDelete` / `onUpdate` attribute options of a foreign key.
|
|
72
|
+
*
|
|
73
|
+
* @param spec - Referenced model and key, with the actions from the options.
|
|
74
|
+
* @param allowNull - Whether the key may be `NULL` (for the `auto` delete action).
|
|
75
|
+
* @param defaults - Actions used when the options give none.
|
|
76
|
+
* @returns Attribute options (empty with `constraints: false`).
|
|
77
|
+
*/
|
|
78
|
+
reference(spec: ReferenceSpec, allowNull: boolean, defaults: ReferenceDefaults): Values;
|
|
79
|
+
/**
|
|
80
|
+
* Attribute options of a foreign key.
|
|
81
|
+
*
|
|
82
|
+
* @param type - Referenced attribute (its data type is reused).
|
|
83
|
+
* @param extras - Object form of the foreign key option.
|
|
84
|
+
* @param base - Further attribute options.
|
|
85
|
+
* @returns Attribute options.
|
|
86
|
+
*/
|
|
87
|
+
keyAttribute(type: AttributeDefinition | undefined, extras: ForeignKeyOptions, base?: Values): Values;
|
|
88
|
+
/**
|
|
89
|
+
* Adds the foreign key attribute (with its reference) to the model that holds the key.
|
|
90
|
+
*
|
|
91
|
+
* @param owner - Model that holds the foreign key.
|
|
92
|
+
* @param referenced - Model the key references.
|
|
93
|
+
* @param referencedKey - Referenced attribute.
|
|
94
|
+
* @param foreignKey - Foreign key attribute name.
|
|
95
|
+
* @param options - Association options.
|
|
96
|
+
*/
|
|
97
|
+
addForeignKey(owner: Model, referenced: Model, referencedKey: string, foreignKey: string, options: AssociationOptions): void;
|
|
98
|
+
}
|