postgrelize 0.0.0-stage → 1.1.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.
Files changed (319) hide show
  1. package/CHANGELOG.md +289 -0
  2. package/LICENSE +21 -0
  3. package/README.md +131 -2
  4. package/dist/associations/alias-minifier.d.ts +43 -0
  5. package/dist/associations/association-accessors.d.ts +21 -0
  6. package/dist/associations/association-key-types.d.ts +44 -0
  7. package/dist/associations/association-keys.d.ts +98 -0
  8. package/dist/associations/association-lookup.d.ts +26 -0
  9. package/dist/associations/association-shape.d.ts +25 -0
  10. package/dist/associations/association.d.ts +95 -0
  11. package/dist/associations/belongs-to-many.d.ts +86 -0
  12. package/dist/associations/belongs-to.d.ts +45 -0
  13. package/dist/associations/has-many.d.ts +79 -0
  14. package/dist/associations/has-one.d.ts +44 -0
  15. package/dist/associations/include-assembler.d.ts +21 -0
  16. package/dist/associations/include-columns.d.ts +24 -0
  17. package/dist/associations/include-joins.d.ts +17 -0
  18. package/dist/associations/include-loader.d.ts +48 -0
  19. package/dist/associations/include-order.d.ts +22 -0
  20. package/dist/associations/include-query-builder.d.ts +54 -0
  21. package/dist/associations/include-resolver.d.ts +29 -0
  22. package/dist/associations/include-rows.d.ts +47 -0
  23. package/dist/associations/include-sub-query.d.ts +35 -0
  24. package/dist/associations/include.d.ts +112 -0
  25. package/dist/associations/junction-keys.d.ts +23 -0
  26. package/dist/associations/nested-creator.d.ts +44 -0
  27. package/dist/associations/nested-saver.d.ts +30 -0
  28. package/dist/associations/owner-keys.d.ts +34 -0
  29. package/dist/associations/separate-include-loader.d.ts +24 -0
  30. package/dist/associations/types.d.ts +139 -0
  31. package/dist/connection/after-connect-hook.d.ts +24 -0
  32. package/dist/connection/connect-hooks.d.ts +26 -0
  33. package/dist/connection/connection-config.d.ts +33 -0
  34. package/dist/connection/connection-manager.d.ts +65 -0
  35. package/dist/connection/connection-types.d.ts +21 -0
  36. package/dist/connection/copy-from-stdin.d.ts +52 -0
  37. package/dist/connection/copy-runner.d.ts +30 -0
  38. package/dist/connection/copy-to-stdout.d.ts +49 -0
  39. package/dist/connection/copy.d.ts +22 -0
  40. package/dist/connection/notifications.d.ts +28 -0
  41. package/dist/connection/options.d.ts +165 -0
  42. package/dist/connection/query-logger.d.ts +41 -0
  43. package/dist/connection/replica-router.d.ts +20 -0
  44. package/dist/connection/statement-cache.d.ts +36 -0
  45. package/dist/connection/statement-timeout.d.ts +22 -0
  46. package/dist/data-types/abstract-data-type.d.ts +58 -0
  47. package/dist/data-types/array-literal-parser.d.ts +17 -0
  48. package/dist/data-types/array-type.d.ts +18 -0
  49. package/dist/data-types/bit-type.d.ts +14 -0
  50. package/dist/data-types/blob-type.d.ts +12 -0
  51. package/dist/data-types/char-type.d.ts +12 -0
  52. package/dist/data-types/composite-fields.d.ts +26 -0
  53. package/dist/data-types/composite-type.d.ts +32 -0
  54. package/dist/data-types/data-types.d.ts +176 -0
  55. package/dist/data-types/date-type.d.ts +14 -0
  56. package/dist/data-types/decimal-type.d.ts +13 -0
  57. package/dist/data-types/default-value-generator.d.ts +15 -0
  58. package/dist/data-types/enum-type.d.ts +19 -0
  59. package/dist/data-types/ewkb-reader.d.ts +18 -0
  60. package/dist/data-types/ewkb-writer.d.ts +17 -0
  61. package/dist/data-types/float-type.d.ts +12 -0
  62. package/dist/data-types/geometric-text.d.ts +65 -0
  63. package/dist/data-types/geometric-type.d.ts +46 -0
  64. package/dist/data-types/hstore-type.d.ts +16 -0
  65. package/dist/data-types/integer-type.d.ts +24 -0
  66. package/dist/data-types/json-type.d.ts +16 -0
  67. package/dist/data-types/multirange-type.d.ts +19 -0
  68. package/dist/data-types/range-type.d.ts +28 -0
  69. package/dist/data-types/record-text.d.ts +29 -0
  70. package/dist/data-types/scalar-type.d.ts +13 -0
  71. package/dist/data-types/spatial-type.d.ts +20 -0
  72. package/dist/data-types/string-type.d.ts +12 -0
  73. package/dist/data-types/text-type.d.ts +12 -0
  74. package/dist/data-types/timestamp-type.d.ts +15 -0
  75. package/dist/data-types/virtual-type.d.ts +15 -0
  76. package/dist/data-types/wall-clock.d.ts +14 -0
  77. package/dist/ddl/column-ddl.d.ts +73 -0
  78. package/dist/ddl/constraint-ddl.d.ts +30 -0
  79. package/dist/ddl/ddl-generator.d.ts +181 -0
  80. package/dist/ddl/ddl-guards.d.ts +60 -0
  81. package/dist/ddl/ddl-types.d.ts +204 -0
  82. package/dist/ddl/enum-ddl.d.ts +42 -0
  83. package/dist/ddl/extension-ddl.d.ts +57 -0
  84. package/dist/ddl/function-ddl.d.ts +98 -0
  85. package/dist/ddl/index-ddl.d.ts +29 -0
  86. package/dist/ddl/index-element-ddl.d.ts +19 -0
  87. package/dist/ddl/partition-ddl.d.ts +88 -0
  88. package/dist/ddl/partition-types.d.ts +94 -0
  89. package/dist/ddl/policy-ddl.d.ts +137 -0
  90. package/dist/ddl/routine-guards.d.ts +63 -0
  91. package/dist/ddl/sequence-ddl.d.ts +103 -0
  92. package/dist/ddl/sql-literal.d.ts +61 -0
  93. package/dist/ddl/table-ddl.d.ts +35 -0
  94. package/dist/ddl/trigger-ddl.d.ts +81 -0
  95. package/dist/ddl/view-ddl.d.ts +122 -0
  96. package/dist/decorators/association-applier.d.ts +18 -0
  97. package/dist/decorators/association-decorators.d.ts +72 -0
  98. package/dist/decorators/column-decorators.d.ts +147 -0
  99. package/dist/decorators/decorator-factory.d.ts +45 -0
  100. package/dist/decorators/decorator-signature.d.ts +26 -0
  101. package/dist/decorators/decorator-types.d.ts +24 -0
  102. package/dist/decorators/foreign-key-decorator.d.ts +21 -0
  103. package/dist/decorators/hook-decorators.d.ts +393 -0
  104. package/dist/decorators/init-arguments.d.ts +29 -0
  105. package/dist/decorators/model-decorators.d.ts +18 -0
  106. package/dist/decorators/model-metadata.d.ts +70 -0
  107. package/dist/decorators/table-decorators.d.ts +43 -0
  108. package/dist/decorators/timestamp-decorators.d.ts +38 -0
  109. package/dist/errors/base-error.d.ts +40 -0
  110. package/dist/errors/connection-errors.d.ts +152 -0
  111. package/dist/errors/database-errors.d.ts +186 -0
  112. package/dist/errors/errors.d.ts +5 -0
  113. package/dist/errors/map-pg-error.d.ts +27 -0
  114. package/dist/errors/misc-errors.d.ts +232 -0
  115. package/dist/errors/validation-errors.d.ts +141 -0
  116. package/dist/exports-associations.d.ts +6 -0
  117. package/dist/exports-core.d.ts +95 -0
  118. package/dist/exports-decorators.d.ts +8 -0
  119. package/dist/exports-errors.d.ts +2 -0
  120. package/dist/exports-model.d.ts +21 -0
  121. package/dist/exports-schema.d.ts +19 -0
  122. package/dist/expressions/call-expressions.d.ts +54 -0
  123. package/dist/expressions/condition-expressions.d.ts +51 -0
  124. package/dist/expressions/expression.d.ts +52 -0
  125. package/dist/expressions/jsonpath-helpers.d.ts +37 -0
  126. package/dist/expressions/logic.d.ts +25 -0
  127. package/dist/expressions/methods.d.ts +188 -0
  128. package/dist/expressions/op.d.ts +182 -0
  129. package/dist/expressions/query-expressions.d.ts +110 -0
  130. package/dist/expressions/row-expressions.d.ts +35 -0
  131. package/dist/expressions/search-helpers.d.ts +138 -0
  132. package/dist/expressions/trigram-helpers.d.ts +40 -0
  133. package/dist/hooks/hooks.d.ts +125 -0
  134. package/dist/index.cjs +21864 -0
  135. package/dist/index.cjs.map +1 -0
  136. package/dist/index.d.ts +6 -0
  137. package/dist/index.js +21688 -0
  138. package/dist/index.js.map +1 -0
  139. package/dist/model/attribute-columns.d.ts +85 -0
  140. package/dist/model/attribute-normalizer.d.ts +42 -0
  141. package/dist/model/attribute-options.d.ts +121 -0
  142. package/dist/model/bulk-insert-builder.d.ts +24 -0
  143. package/dist/model/bulk-options.d.ts +173 -0
  144. package/dist/model/copy-options.d.ts +51 -0
  145. package/dist/model/cte-builder.d.ts +134 -0
  146. package/dist/model/definition-normalizer.d.ts +26 -0
  147. package/dist/model/delete-query-builder.d.ts +42 -0
  148. package/dist/model/find-options.d.ts +144 -0
  149. package/dist/model/find-query-builder.d.ts +38 -0
  150. package/dist/model/inflector.d.ts +28 -0
  151. package/dist/model/insert-query-builder.d.ts +41 -0
  152. package/dist/model/instance-destroyer.d.ts +44 -0
  153. package/dist/model/instance-lifecycle-services.d.ts +61 -0
  154. package/dist/model/instance-lifecycle.d.ts +128 -0
  155. package/dist/model/instance-saver.d.ts +25 -0
  156. package/dist/model/instance-state.d.ts +48 -0
  157. package/dist/model/instance-validation.d.ts +35 -0
  158. package/dist/model/instance-values.d.ts +88 -0
  159. package/dist/model/instance-writer.d.ts +59 -0
  160. package/dist/model/join-source-builder.d.ts +25 -0
  161. package/dist/model/lateral-keys-builder.d.ts +25 -0
  162. package/dist/model/merge-action-builder.d.ts +31 -0
  163. package/dist/model/merge-options.d.ts +72 -0
  164. package/dist/model/merge-query-builder.d.ts +29 -0
  165. package/dist/model/merge-source-builder.d.ts +22 -0
  166. package/dist/model/mixins/model-aggregates.d.ts +69 -0
  167. package/dist/model/mixins/model-associations.d.ts +113 -0
  168. package/dist/model/mixins/model-constructor.d.ts +7 -0
  169. package/dist/model/mixins/model-finders.d.ts +140 -0
  170. package/dist/model/mixins/model-hooks.d.ts +142 -0
  171. package/dist/model/mixins/model-postgres.d.ts +198 -0
  172. package/dist/model/mixins/model-schema-binding.d.ts +36 -0
  173. package/dist/model/mixins/model-schema.d.ts +100 -0
  174. package/dist/model/mixins/model-scopes.d.ts +57 -0
  175. package/dist/model/mixins/model-writers.d.ts +175 -0
  176. package/dist/model/mixins/named-hooks.d.ts +28 -0
  177. package/dist/model/model-accessors.d.ts +22 -0
  178. package/dist/model/model-base.d.ts +83 -0
  179. package/dist/model/model-definition.d.ts +130 -0
  180. package/dist/model/model-instance-persistence.d.ts +132 -0
  181. package/dist/model/model-instance-values.d.ts +197 -0
  182. package/dist/model/model-operations.d.ts +22 -0
  183. package/dist/model/model-registry.d.ts +152 -0
  184. package/dist/model/model-services.d.ts +46 -0
  185. package/dist/model/model-state.d.ts +68 -0
  186. package/dist/model/model-values.d.ts +86 -0
  187. package/dist/model/model.d.ts +629 -0
  188. package/dist/model/on-conflict-builder.d.ts +111 -0
  189. package/dist/model/operations/bulk-create-operation.d.ts +40 -0
  190. package/dist/model/operations/copy-from-source.d.ts +51 -0
  191. package/dist/model/operations/copy-operation.d.ts +54 -0
  192. package/dist/model/operations/count-operation.d.ts +52 -0
  193. package/dist/model/operations/create-operation.d.ts +31 -0
  194. package/dist/model/operations/destroy-operation.d.ts +65 -0
  195. package/dist/model/operations/find-cursor.d.ts +23 -0
  196. package/dist/model/operations/find-lookups.d.ts +99 -0
  197. package/dist/model/operations/find-operation.d.ts +47 -0
  198. package/dist/model/operations/increment-operation.d.ts +40 -0
  199. package/dist/model/operations/insert-operation.d.ts +71 -0
  200. package/dist/model/operations/merge-operation.d.ts +56 -0
  201. package/dist/model/operations/model-operation.d.ts +33 -0
  202. package/dist/model/operations/update-operation.d.ts +45 -0
  203. package/dist/model/operations/upsert-operation.d.ts +39 -0
  204. package/dist/model/options.d.ts +103 -0
  205. package/dist/model/returning-old.d.ts +52 -0
  206. package/dist/model/row-mapper.d.ts +78 -0
  207. package/dist/model/row-plan.d.ts +31 -0
  208. package/dist/model/runtime.d.ts +56 -0
  209. package/dist/model/scope-registry.d.ts +81 -0
  210. package/dist/model/select-aggregates.d.ts +37 -0
  211. package/dist/model/select-lock.d.ts +13 -0
  212. package/dist/model/select-options.d.ts +92 -0
  213. package/dist/model/select-query-builder.d.ts +73 -0
  214. package/dist/model/select-targets.d.ts +77 -0
  215. package/dist/model/source-option-builder.d.ts +23 -0
  216. package/dist/model/source-options.d.ts +108 -0
  217. package/dist/model/statement-builder.d.ts +77 -0
  218. package/dist/model/statement-services.d.ts +2 -0
  219. package/dist/model/sync-hooks.d.ts +18 -0
  220. package/dist/model/table-sample-builder.d.ts +13 -0
  221. package/dist/model/types.d.ts +85 -0
  222. package/dist/model/unnest-insert-builder.d.ts +24 -0
  223. package/dist/model/update-query-builder.d.ts +39 -0
  224. package/dist/model/v6-conflict-builder.d.ts +37 -0
  225. package/dist/model/value-cloner.d.ts +17 -0
  226. package/dist/model/values-writer.d.ts +12 -0
  227. package/dist/model/where-options.d.ts +164 -0
  228. package/dist/model/write-options.d.ts +160 -0
  229. package/dist/model/written-rows.d.ts +56 -0
  230. package/dist/package-version.d.ts +8 -0
  231. package/dist/query/query-result-shaper.d.ts +93 -0
  232. package/dist/query/raw-query.d.ts +27 -0
  233. package/dist/query-interface/alter-planner.d.ts +40 -0
  234. package/dist/query-interface/bulk-data.d.ts +44 -0
  235. package/dist/query-interface/column-commands.d.ts +52 -0
  236. package/dist/query-interface/column-describer.d.ts +17 -0
  237. package/dist/query-interface/enum-commands.d.ts +36 -0
  238. package/dist/query-interface/index-commands.d.ts +57 -0
  239. package/dist/query-interface/model-tables.d.ts +58 -0
  240. package/dist/query-interface/object-commands.d.ts +71 -0
  241. package/dist/query-interface/partition-commands.d.ts +43 -0
  242. package/dist/query-interface/policy-commands.d.ts +54 -0
  243. package/dist/query-interface/query-interface-catalog.d.ts +180 -0
  244. package/dist/query-interface/query-interface-objects.d.ts +108 -0
  245. package/dist/query-interface/query-interface-partitions.d.ts +66 -0
  246. package/dist/query-interface/query-interface-policies.d.ts +86 -0
  247. package/dist/query-interface/query-interface-routines.d.ts +120 -0
  248. package/dist/query-interface/query-interface-tables.d.ts +179 -0
  249. package/dist/query-interface/query-interface-types.d.ts +62 -0
  250. package/dist/query-interface/query-interface-views.d.ts +84 -0
  251. package/dist/query-interface/query-interface.d.ts +256 -0
  252. package/dist/query-interface/routine-commands.d.ts +71 -0
  253. package/dist/query-interface/schema-synchronizer.d.ts +110 -0
  254. package/dist/query-interface/statement-runner.d.ts +40 -0
  255. package/dist/query-interface/sync-planner.d.ts +26 -0
  256. package/dist/query-interface/table-commands.d.ts +63 -0
  257. package/dist/query-interface/table-introspector.d.ts +58 -0
  258. package/dist/query-interface/view-commands.d.ts +47 -0
  259. package/dist/sequelize/instance-hook-adders.d.ts +72 -0
  260. package/dist/sequelize/sequelize-base.d.ts +196 -0
  261. package/dist/sequelize/sequelize-constructor.d.ts +7 -0
  262. package/dist/sequelize/sequelize-helpers.d.ts +133 -0
  263. package/dist/sequelize/sequelize-hooks.d.ts +99 -0
  264. package/dist/sequelize/sequelize-internals.d.ts +87 -0
  265. package/dist/sequelize/sequelize-notifications.d.ts +66 -0
  266. package/dist/sequelize/sequelize-schema.d.ts +125 -0
  267. package/dist/sequelize/sequelize-transactions.d.ts +96 -0
  268. package/dist/sequelize.d.ts +1175 -0
  269. package/dist/sql/ast-clauses.d.ts +137 -0
  270. package/dist/sql/ast-expressions.d.ts +88 -0
  271. package/dist/sql/ast-statements.d.ts +80 -0
  272. package/dist/sql/ast.d.ts +21 -0
  273. package/dist/sql/compile.d.ts +21 -0
  274. package/dist/sql/dml-compiler.d.ts +54 -0
  275. package/dist/sql/expression-compiler.d.ts +56 -0
  276. package/dist/sql/from-compiler.d.ts +39 -0
  277. package/dist/sql/identifier-quoter.d.ts +15 -0
  278. package/dist/sql/merge-compiler.d.ts +20 -0
  279. package/dist/sql/order.d.ts +15 -0
  280. package/dist/sql/query-compiler.d.ts +45 -0
  281. package/dist/sql/sql-chunks.d.ts +50 -0
  282. package/dist/sql/with-compiler.d.ts +19 -0
  283. package/dist/transaction/advisory-locks.d.ts +28 -0
  284. package/dist/transaction/cls-namespace.d.ts +44 -0
  285. package/dist/transaction/transaction-constants.d.ts +35 -0
  286. package/dist/transaction/transaction-runner.d.ts +78 -0
  287. package/dist/transaction/transaction-starter.d.ts +25 -0
  288. package/dist/transaction/transaction-statements.d.ts +29 -0
  289. package/dist/transaction/transaction.d.ts +201 -0
  290. package/dist/validation/attribute-validators.d.ts +23 -0
  291. package/dist/validation/builtin-attribute-validator.d.ts +19 -0
  292. package/dist/validation/builtin-validators.d.ts +16 -0
  293. package/dist/validation/core-validator.d.ts +16 -0
  294. package/dist/validation/custom-validators.d.ts +13 -0
  295. package/dist/validation/instance-validator.d.ts +25 -0
  296. package/dist/validation/schema-items.d.ts +22 -0
  297. package/dist/validation/standard-schema-validator.d.ts +30 -0
  298. package/dist/validation/standard-schema.d.ts +39 -0
  299. package/dist/validation/types.d.ts +36 -0
  300. package/dist/validation/validation-target.d.ts +13 -0
  301. package/dist/where/comparison-compiler.d.ts +27 -0
  302. package/dist/where/condition-compiler.d.ts +18 -0
  303. package/dist/where/operand-resolver.d.ts +10 -0
  304. package/dist/where/operator-allowlist.d.ts +14 -0
  305. package/dist/where/where-support.d.ts +52 -0
  306. package/dist/where/where.d.ts +46 -0
  307. package/dist/where/window-compiler.d.ts +14 -0
  308. package/llm/USAGE.md +423 -0
  309. package/package.json +103 -4
  310. package/skills/postgrelize/SKILL.md +57 -0
  311. package/skills/postgrelize/reference/associations.md +108 -0
  312. package/skills/postgrelize/reference/errors.md +37 -0
  313. package/skills/postgrelize/reference/migrating-from-sequelize.md +15 -0
  314. package/skills/postgrelize/reference/postgresql-features.md +157 -0
  315. package/skills/postgrelize/reference/querying.md +111 -0
  316. package/skills/postgrelize/reference/schema.md +135 -0
  317. package/skills/postgrelize/reference/security.md +34 -0
  318. package/skills/postgrelize/reference/transactions-and-sessions.md +122 -0
  319. package/skills/postgrelize/reference/writing.md +198 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,289 @@
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.1.0] - 2026-11-22
42
+
43
+ Sequelize v6 parity for a production migration (S19): `minifyAliases`, `afterConnect`, `useCLS(namespace)` with cls-hooked namespaces, the static aliases, hook shorthands and the missing `Model` / `QueryInterface` methods, backed by a test that compares the public API with `sequelize@6`.
44
+
45
+ ### Added
46
+
47
+ - `Sequelize#truncate` (empties all model tables, referencing tables first, as in v6), `Deferrable.SET_DEFERRED` / `Deferrable.SET_IMMEDIATE` for the `deferrable` transaction option and `queryInterface.deferConstraints` (S19). With these, every v6 name that postgrelize lacks is on the API-surface allow-list with a reason. [#107](https://github.com/tormozz48/postgrelize/pull/107)
48
+ - Sequelize v6 `QueryInterface` methods: `showIndex`, `showConstraint` (and `QueryTypes.SHOWCONSTRAINTS`), `getForeignKeysForTables`, `assertTableHasColumn`, `databaseVersion`, `createDatabase`, `dropDatabase`, `quoteIdentifier`, `quoteIdentifiers` (S19). The catalog lookups filter by schema and `showConstraint` honours the constraint name (v6 ignores it). [#106](https://github.com/tormozz48/postgrelize/pull/106)
49
+ - Sequelize v6 `Model` members: `describe`, `dropSchema`, `queryInterface`, `findCreateFind`, `getAssociations`, `getAssociationForAlias`, `hasAlias`, `removeAttribute`, `refreshAttributes`, and on instances `equalsOneOf`, `setAttributes`, `where` and `toString` (S19). `findCreateFind` inside a transaction uses a savepoint and returns the row that won a race with `created: false` (v6 returns an unsaved instance). [#105](https://github.com/tormozz48/postgrelize/pull/105)
50
+ - Hook shorthands as in Sequelize v6: `sequelize.beforeCreate(fn)` and the other hooks that run (also `beforeConnect`, `afterConnect`, `beforeBulkSync`, `afterBulkSync`), `sequelize.runHooks()`, `Model.beforeSync()` and `Model.afterSync()` (S19). [#104](https://github.com/tormozz48/postgrelize/pull/104)
51
+ - Sequelize v6 static aliases: the data types (`Sequelize.STRING`, ...), the error classes (also `QueryError`, `SequelizeScopeError`, `UnknownConstraintError`, `ValidationErrorItemOrigin` / `ValidationErrorItemType` and `Error`), `Deferrable`, `and`, `or`, `useInflection`, `version`, `Association` and the association classes, `QueryInterface`, `Validator`; the same data types and errors as module exports; `DataTypes.NUMERIC` and `DataTypes['DOUBLE PRECISION']`; instance members `queryInterface`, `QueryTypes`, `random()`, `escape()`, `validate()`, `getDatabaseName()`, `refreshTypes()`, `log()`, `and`, `or` (S19). [#103](https://github.com/tormozz48/postgrelize/pull/103)
52
+ - A test compares the public API surface of `Sequelize`, `Model`, `QueryInterface`, `Transaction`, `DataTypes` and the exports with `sequelize@6`; every v6 name postgrelize lacks is on an allow-list (`tests/compat/api-surface-exceptions.json`) that is rendered as "API differences" in the migration guide and only shrinks (S19). [#102](https://github.com/tormozz48/postgrelize/pull/102)
53
+ - `minifyAliases` constructor option (Sequelize v6 parity): shortens include column aliases and table aliases of 64 or more characters so deep includes with long association names stay within PostgreSQL's 63-byte identifier limit, and maps rows back. [#101](https://github.com/tormozz48/postgrelize/pull/101)
54
+
55
+ ### Fixed
56
+
57
+ - The `afterConnect` hook now runs for every new pooled connection after `beforeConnect`, with `(connection, config)` as in Sequelize v6; the hook may run queries on the connection, and an error it throws closes that connection and rejects the query that needed it (v6 parity). [#99](https://github.com/tormozz48/postgrelize/pull/99)
58
+ - `Sequelize.useCLS(namespace)` no longer ignores a `cls-hooked` style namespace: managed transactions store themselves under `namespace.get('transaction')` (cleared when they finish), queries without a `transaction` option read it from there, and a non-namespace argument throws `Must provide CLS namespace`, as in Sequelize v6 (v6 parity). `useCLS()` without an argument is unchanged. [#100](https://github.com/tormozz48/postgrelize/pull/100)
59
+
60
+ ## [1.0.0] - 2026-11-21
61
+
62
+ 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.
63
+
64
+ ### Breaking
65
+
66
+ - 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)
67
+
68
+ ### Added
69
+
70
+ - 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)
71
+ - Hero art and a favicon set for the documentation site. [#88](https://github.com/tormozz48/postgrelize/pull/88)
72
+ - npm version and downloads badges, and a migration note for users of the scoped name (S18b). [#92](https://github.com/tormozz48/postgrelize/pull/92)
73
+ - Backlog 5 roadmap spec for publishing on npmjs.com (planning only, no code). [#89](https://github.com/tormozz48/postgrelize/pull/89)
74
+
75
+ ### Changed
76
+
77
+ - 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)
78
+
79
+ ## [0.12.0] - 2026-11-16
80
+
81
+ ### Added
82
+
83
+ - Expression indexes: `{ expression }` index fields, with `nulls` ordering (S13, ADR-027). [#78](https://github.com/tormozz48/postgrelize/pull/78)
84
+ - `EXCLUDE` constraints, `NOT VALID` constraints and `validateConstraint` (S13, ADR-027). [#81](https://github.com/tormozz48/postgrelize/pull/81)
85
+ - PostgreSQL 18 constraint forms: `NOT ENFORCED`, `WITHOUT OVERLAPS`, `PERIOD` (S13, ADR-027). [#82](https://github.com/tormozz48/postgrelize/pull/82)
86
+ - Declarative table partitioning (S13, ADR-027). [#84](https://github.com/tormozz48/postgrelize/pull/84)
87
+ - Geometric data types `POINT`, `LINE`, `LSEG`, `BOX`, `PATH`, `POLYGON`, `CIRCLE` (S15, ADR-026). [#77](https://github.com/tormozz48/postgrelize/pull/77)
88
+ - `MULTIRANGE` data type (S15, ADR-026). [#79](https://github.com/tormozz48/postgrelize/pull/79)
89
+ - `COMPOSITE` data type (S15, ADR-026). [#80](https://github.com/tormozz48/postgrelize/pull/80)
90
+ - 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)
91
+
92
+ ### Changed
93
+
94
+ - 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)
95
+ - Added examples and guide entries for `NULLS FIRST/LAST`, `OVERRIDING` and long `IN` lists. [#86](https://github.com/tormozz48/postgrelize/pull/86)
96
+ - Release 0.12.0 version bump. [#87](https://github.com/tormozz48/postgrelize/pull/87)
97
+
98
+ ## [0.11.0] - 2026-11-16
99
+
100
+ ### Added
101
+
102
+ - QueryInterface support for extensions and sequences (S11, ADR-025). [#70](https://github.com/tormozz48/postgrelize/pull/70)
103
+ - QueryInterface support for functions and triggers (S11, ADR-025). [#72](https://github.com/tormozz48/postgrelize/pull/72)
104
+ - QueryInterface support for views and materialized views (S11, ADR-025). [#73](https://github.com/tormozz48/postgrelize/pull/73)
105
+ - Row-level security policies on QueryInterface (S11, ADR-025). [#74](https://github.com/tormozz48/postgrelize/pull/74)
106
+ - `UNLOGGED` and `TEMPORARY` tables (S11, ADR-025). [#75](https://github.com/tormozz48/postgrelize/pull/75)
107
+ - 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)
108
+
109
+ ### Changed
110
+
111
+ - Release flow documented: the release commit goes through a pull request. [#69](https://github.com/tormozz48/postgrelize/pull/69)
112
+ - Release 0.11.0 version bump. [#76](https://github.com/tormozz48/postgrelize/pull/76)
113
+
114
+ ## [0.10.0] - 2026-11-16
115
+
116
+ ### Added
117
+
118
+ - Opt-in named prepared statements through the `statementCache` option (S16, ADR-023). [#61](https://github.com/tormozz48/postgrelize/pull/61)
119
+ - `DEFERRABLE` transaction mode, per-query `statementTimeout` and `bulkCreate({ unnest: true })` (S16). [#64](https://github.com/tormozz48/postgrelize/pull/64)
120
+ - Set operations (`union`, `intersect`, `except`) on subqueries and `FETCH FIRST … WITH TIES` (S12, ADR-024). [#63](https://github.com/tormozz48/postgrelize/pull/63)
121
+ - `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)
122
+ - Data-modifying CTEs and CTE `SEARCH` / `CYCLE` clauses (S12, ADR-024). [#66](https://github.com/tormozz48/postgrelize/pull/66)
123
+ - New data types: HSTORE objects, `LTREE`, `TIMESTAMP`, `MONEY`, `MACADDR8`, `XML`, `BIT` / `VARBIT`, `TSQUERY` (S14). [#62](https://github.com/tormozz48/postgrelize/pull/62)
124
+ - Project logo. [#60](https://github.com/tormozz48/postgrelize/pull/60)
125
+
126
+ ### Changed
127
+
128
+ - Raw reads resolve the column plan once per result, so they run faster (S10b). [#67](https://github.com/tormozz48/postgrelize/pull/67)
129
+ - Release 0.10.0 version bump. [#68](https://github.com/tormozz48/postgrelize/pull/68)
130
+
131
+ ### Fixed
132
+
133
+ - HSTORE values are returned as objects. [#62](https://github.com/tormozz48/postgrelize/pull/62)
134
+
135
+ ## [0.9.0] - 2026-11-15
136
+
137
+ ### Added
138
+
139
+ - Public model decorators (`@Table`, `@Column`, association and hook decorators) and `sequelize.addModels` (S6g, ADR-022). [#42](https://github.com/tormozz48/postgrelize/pull/42)
140
+ - PostgreSQL coverage matrix page listing what is supported, literal-only, planned or out of scope (S9). [#41](https://github.com/tormozz48/postgrelize/pull/41)
141
+ - 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)
142
+ - TSDoc for the whole public API, enforced by tests and the docs build (S8b). [#49](https://github.com/tormozz48/postgrelize/pull/49)
143
+ - 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)
144
+ - 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)
145
+ - `Sequelize#createSchema`, `showAllSchemas`, `dropSchema` and `QueryInterface#dropAllSchemas`, which v6 exposes. [#34](https://github.com/tormozz48/postgrelize/pull/34)
146
+
147
+ ### Changed
148
+
149
+ - 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)
150
+ - 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)
151
+ - Test coverage raised to 99.7% lines, with thresholds enforced in CI (S7). [#44](https://github.com/tormozz48/postgrelize/pull/44)
152
+ - 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)
153
+
154
+ ### Fixed
155
+
156
+ - `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)
157
+ - `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)
158
+ - 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)
159
+ - 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)
160
+
161
+ ### Security
162
+
163
+ - 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)
164
+
165
+ ## [0.8.1] - 2026-11-15
166
+
167
+ ### Added
168
+
169
+ - `AGENTS.md` contributor guide and documentation sync rules (ADR-019). [#32](https://github.com/tormozz48/postgrelize/pull/32)
170
+
171
+ ### Fixed
172
+
173
+ - 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)
174
+
175
+ ## [0.8.0] - 2026-11-15
176
+
177
+ ### Breaking
178
+
179
+ - 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)
180
+
181
+ ### Changed
182
+
183
+ - 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)
184
+
185
+ ### Removed
186
+
187
+ - The `effect` dependency and the `postgrelize/effect` export. [#29](https://github.com/tormozz48/postgrelize/pull/29)
188
+
189
+ ### Fixed
190
+
191
+ - `describeTable` reads enum values from the column type's own schema, in declared order. [#29](https://github.com/tormozz48/postgrelize/pull/29)
192
+ - Expression classes are recognised across package copies, so `instanceof` checks keep working. [#29](https://github.com/tormozz48/postgrelize/pull/29)
193
+
194
+ ## [0.7.0] - 2026-11-15
195
+
196
+ ### Added
197
+
198
+ - VitePress documentation site with runnable examples and a generated API reference (S3). [#24](https://github.com/tormozz48/postgrelize/pull/24)
199
+ - 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)
200
+ - Hooks and the read pipeline (`findAll`, `count`) as Effect programs (S4 step 4). [#28](https://github.com/tormozz48/postgrelize/pull/28)
201
+
202
+ ### Fixed
203
+
204
+ - A transaction-start failure no longer leaks a pooled connection. [#26](https://github.com/tormozz48/postgrelize/pull/26)
205
+ - `include: [{ separate: true, limit }]` applies `limit` per parent, like v6. [#25](https://github.com/tormozz48/postgrelize/pull/25)
206
+ - `findEach` loads `separate: true` includes for each batch. [#25](https://github.com/tormozz48/postgrelize/pull/25)
207
+
208
+ ## [0.6.0] - 2026-11-14
209
+
210
+ ### Added
211
+
212
+ - README badges and a self-hosted coverage report (S1). [#20](https://github.com/tormozz48/postgrelize/pull/20)
213
+ - `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)
214
+
215
+ ### Fixed
216
+
217
+ - Included associations and junction rows are instance properties (`todo.User`, `user.Posts`). [#22](https://github.com/tormozz48/postgrelize/pull/22)
218
+ - `upsert` and `bulkCreate({ updateOnDuplicate })` pick the conflict target from unique `indexes` like v6 (sequelize#13734). [#22](https://github.com/tormozz48/postgrelize/pull/22)
219
+ - 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)
220
+ - `ARRAY(ENUM)` returns arrays (sequelize#15466, sequelize#11100). [#22](https://github.com/tormozz48/postgrelize/pull/22)
221
+ - `sync()` handles foreign-key cycles by adding back-references after all tables exist (sequelize#15522). [#22](https://github.com/tormozz48/postgrelize/pull/22)
222
+ - `addColumn` and `sync({ alter })` keep column `comment` (sequelize#17118). [#22](https://github.com/tormozz48/postgrelize/pull/22)
223
+ - `order: ['jsonCol.path']` works and orders by the jsonb value (sequelize#9040). [#22](https://github.com/tormozz48/postgrelize/pull/22)
224
+ - 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)
225
+ - `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)
226
+ - `bulkCreate({ ignoreDuplicates })` assigns returned rows to the inserted records. [#23](https://github.com/tormozz48/postgrelize/pull/23)
227
+ - `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)
228
+ - `sync({ schema })` and `drop({ schema })` act only on that schema (sequelize#18423). [#23](https://github.com/tormozz48/postgrelize/pull/23)
229
+ - `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)
230
+
231
+ ## [0.5.0] - 2026-11-14
232
+
233
+ ### Added
234
+
235
+ - `returningOld` / `oldValues`: `RETURNING old.*` on PostgreSQL 18 (ADR-015). [#17](https://github.com/tormozz48/postgrelize/pull/17)
236
+ - Scopes of included models apply, like v6 (ADR-015). [#17](https://github.com/tormozz48/postgrelize/pull/17)
237
+
238
+ ## [0.4.0] - 2026-11-14
239
+
240
+ ### Added
241
+
242
+ - Read replica routing with the `replication` option and `useMaster` (ADR-014). [#15](https://github.com/tormozz48/postgrelize/pull/15)
243
+ - Nested creation through `include`, for example `Post.create({ Comments: [...] }, { include })`. [#15](https://github.com/tormozz48/postgrelize/pull/15)
244
+
245
+ ## [0.3.0] - 2026-11-14
246
+
247
+ ### Added
248
+
249
+ - CTE options: `WITH` and `WITH RECURSIVE` (ADR-013). [#13](https://github.com/tormozz48/postgrelize/pull/13)
250
+ - `Model.copyTo` for `COPY … TO` (ADR-013). [#13](https://github.com/tormozz48/postgrelize/pull/13)
251
+
252
+ ## [0.2.0] - 2026-11-14
253
+
254
+ ### Added
255
+
256
+ - Query power (P1-A): subqueries, `EXISTS`, `DISTINCT ON`, window functions and row comparison. [#8](https://github.com/tormozz48/postgrelize/pull/8)
257
+ - Write power (P1-B): `UPDATE … FROM`, `DELETE … USING`, `INSERT … SELECT` and `MERGE`. [#9](https://github.com/tormozz48/postgrelize/pull/9)
258
+ - Connection power (P1-C): cursors, `LISTEN` / `NOTIFY`, `SET LOCAL`, advisory locks and `COPY`. [#10](https://github.com/tormozz48/postgrelize/pull/10)
259
+ - Schema power (P1-D): identity and generated columns, `INTERVAL`, `OVERRIDING` and enum alteration. [#11](https://github.com/tormozz48/postgrelize/pull/11)
260
+
261
+ ## [0.1.0] - 2026-11-14
262
+
263
+ First release: a PostgreSQL-only, Sequelize v6 drop-in ORM written in TypeScript, published to GitHub Packages.
264
+
265
+ ### Added
266
+
267
+ - 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)
268
+ - 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)
269
+ - `INSERT … ON CONFLICT` through the `onConflict` option and `Model.insert()`, plus security hardening (M2, ADR-003). [#3](https://github.com/tormozz48/postgrelize/pull/3)
270
+ - Hooks, validation (validator.js and Standard Schema), scopes, paranoid models and optimistic locking (M3, ADR-008). [#4](https://github.com/tormozz48/postgrelize/pull/4)
271
+ - Associations and eager loading with `include` (M4, ADR-009). [#5](https://github.com/tormozz48/postgrelize/pull/5)
272
+ - `QueryInterface`, `sync` / `drop` and constraints (M5, ADR-010). [#6](https://github.com/tormozz48/postgrelize/pull/6)
273
+
274
+ [Unreleased]: https://github.com/tormozz48/postgrelize/compare/v1.1.0...HEAD
275
+ [1.1.0]: https://github.com/tormozz48/postgrelize/compare/v1.0.0...v1.1.0
276
+ [1.0.0]: https://github.com/tormozz48/postgrelize/compare/v0.12.0...v1.0.0
277
+ [0.12.0]: https://github.com/tormozz48/postgrelize/compare/v0.11.0...v0.12.0
278
+ [0.11.0]: https://github.com/tormozz48/postgrelize/compare/v0.10.0...v0.11.0
279
+ [0.10.0]: https://github.com/tormozz48/postgrelize/compare/v0.9.0...v0.10.0
280
+ [0.9.0]: https://github.com/tormozz48/postgrelize/compare/v0.8.1...v0.9.0
281
+ [0.8.1]: https://github.com/tormozz48/postgrelize/compare/v0.8.0...v0.8.1
282
+ [0.8.0]: https://github.com/tormozz48/postgrelize/compare/v0.7.0...v0.8.0
283
+ [0.7.0]: https://github.com/tormozz48/postgrelize/compare/v0.6.0...v0.7.0
284
+ [0.6.0]: https://github.com/tormozz48/postgrelize/compare/v0.5.0...v0.6.0
285
+ [0.5.0]: https://github.com/tormozz48/postgrelize/compare/v0.4.0...v0.5.0
286
+ [0.4.0]: https://github.com/tormozz48/postgrelize/compare/v0.3.0...v0.4.0
287
+ [0.3.0]: https://github.com/tormozz48/postgrelize/compare/v0.2.0...v0.3.0
288
+ [0.2.0]: https://github.com/tormozz48/postgrelize/compare/v0.1.0...v0.2.0
289
+ [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
- # Temporary Holding Version
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
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
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,43 @@
1
+ import { SelectNode } from '../sql/ast.ts';
2
+ import { CompiledQuery } from '../sql/compile.ts';
3
+ import { IncludeNode } from './include.ts';
4
+ type Row = Readonly<Record<string, unknown>>;
5
+ /** A SELECT with shortened include aliases, and what is needed to read its rows back. */
6
+ export type MinifiedSelect = Readonly<{
7
+ select: SelectNode;
8
+ tableAliases: ReadonlyMap<string, string>;
9
+ columnAliases: ReadonlyMap<string, string>;
10
+ }>;
11
+ /**
12
+ * `minifyAliases` (Sequelize v6): replaces the aliases of include columns (`Posts.Comments.title`)
13
+ * with `_0`, `_1`, ... and table aliases of 64 or more characters with `%0`, `%1`, ..., so they stay
14
+ * within PostgreSQL's 63-byte identifier limit (longer ones are truncated and can collide), and maps
15
+ * result rows back to the original names.
16
+ */
17
+ export declare class AliasMinifier {
18
+ /**
19
+ * Shortens the include column aliases of a SELECT.
20
+ *
21
+ * @param select - SELECT with joined includes.
22
+ * @param includes - Include tree of the find.
23
+ * @returns SELECT with `_N` column aliases and the alias maps.
24
+ */
25
+ minify(select: SelectNode, includes: readonly IncludeNode[]): MinifiedSelect;
26
+ /**
27
+ * Replaces the long table aliases in compiled SQL (quoted identifiers only).
28
+ *
29
+ * @param query - Compiled query.
30
+ * @param minified - Result of {@link AliasMinifier.minify}.
31
+ * @returns Query with the short table aliases.
32
+ */
33
+ rewrite(query: CompiledQuery, minified: MinifiedSelect): CompiledQuery;
34
+ /**
35
+ * Restores the original column names in result rows.
36
+ *
37
+ * @param rows - Rows returned for the minified SELECT.
38
+ * @param minified - Result of {@link AliasMinifier.minify}.
39
+ * @returns Rows keyed by the original aliases.
40
+ */
41
+ restore(rows: readonly Row[], minified: MinifiedSelect): readonly Row[];
42
+ }
43
+ export {};
@@ -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 {};