ts-prorm-orm 1.2.3 → 2.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 (204) hide show
  1. package/CHANGELOG.md +331 -1
  2. package/README.md +32 -24
  3. package/dist/compliance/data-classifier.d.ts +6 -0
  4. package/dist/compliance/data-classifier.js +6 -0
  5. package/dist/compliance/data-lineage.d.ts +4 -0
  6. package/dist/compliance/data-lineage.js +4 -0
  7. package/dist/compliance/data-masker.d.ts +4 -0
  8. package/dist/compliance/data-masker.js +4 -0
  9. package/dist/compliance/index.d.ts +4 -0
  10. package/dist/compliance/index.js +15 -1
  11. package/dist/compliance/pseudonymization.d.ts +4 -0
  12. package/dist/compliance/pseudonymization.js +4 -0
  13. package/dist/compliance/query-firewall.d.ts +9 -9
  14. package/dist/compliance/query-firewall.js +9 -9
  15. package/dist/compliance/rate-limiter.d.ts +4 -0
  16. package/dist/compliance/rate-limiter.js +4 -0
  17. package/dist/compliance/row-level-security.d.ts +2 -0
  18. package/dist/compliance/row-level-security.js +2 -0
  19. package/dist/compliance/security-decorator.d.ts +8 -0
  20. package/dist/compliance/security-decorator.js +8 -0
  21. package/dist/compliance/session-isolation.d.ts +4 -0
  22. package/dist/compliance/session-isolation.js +4 -0
  23. package/dist/compliance/worm-storage.d.ts +4 -0
  24. package/dist/compliance/worm-storage.js +4 -0
  25. package/dist/connection-manager.js +13 -1
  26. package/dist/core/expressions.d.ts +58 -0
  27. package/dist/core/expressions.js +83 -0
  28. package/dist/core/hooks-manager.d.ts +179 -0
  29. package/dist/core/hooks-manager.js +291 -0
  30. package/dist/core/types.d.ts +235 -0
  31. package/dist/core/types.js +9 -0
  32. package/dist/decorators/audit.d.ts +3 -1
  33. package/dist/decorators/audit.js +3 -1
  34. package/dist/decorators/check.d.ts +15 -15
  35. package/dist/decorators/check.js +15 -15
  36. package/dist/decorators/collate.d.ts +16 -0
  37. package/dist/decorators/collate.js +16 -0
  38. package/dist/decorators/comment.d.ts +3 -1
  39. package/dist/decorators/comment.js +3 -1
  40. package/dist/decorators/database-settings.d.ts +6 -0
  41. package/dist/decorators/database-settings.js +6 -0
  42. package/dist/decorators/default.d.ts +2 -0
  43. package/dist/decorators/default.js +2 -0
  44. package/dist/decorators/encryption.d.ts +7 -1
  45. package/dist/decorators/encryption.js +7 -1
  46. package/dist/decorators/engine.d.ts +4 -0
  47. package/dist/decorators/engine.js +4 -0
  48. package/dist/decorators/fk-constraints.d.ts +32 -32
  49. package/dist/decorators/fk-constraints.js +32 -32
  50. package/dist/decorators/foreign-table.d.ts +1 -1
  51. package/dist/decorators/generated.d.ts +8 -0
  52. package/dist/decorators/generated.js +8 -0
  53. package/dist/decorators/hstore.d.ts +6 -0
  54. package/dist/decorators/hstore.js +6 -0
  55. package/dist/decorators/index.d.ts +2 -0
  56. package/dist/decorators/index.js +11 -1
  57. package/dist/decorators/json-column.d.ts +2 -0
  58. package/dist/decorators/json-column.js +2 -0
  59. package/dist/decorators/jsonb.d.ts +6 -0
  60. package/dist/decorators/jsonb.js +6 -0
  61. package/dist/decorators/permissions.d.ts +12 -0
  62. package/dist/decorators/permissions.js +12 -0
  63. package/dist/decorators/procedure.d.ts +4 -2
  64. package/dist/decorators/procedure.js +4 -2
  65. package/dist/decorators/query-options.d.ts +24 -0
  66. package/dist/decorators/query-options.js +24 -0
  67. package/dist/decorators/range.d.ts +8 -0
  68. package/dist/decorators/range.js +8 -0
  69. package/dist/decorators/set-column.d.ts +2 -0
  70. package/dist/decorators/set-column.js +2 -0
  71. package/dist/decorators/spatial.d.ts +2 -0
  72. package/dist/decorators/spatial.js +2 -0
  73. package/dist/decorators/storage.d.ts +24 -0
  74. package/dist/decorators/storage.js +24 -0
  75. package/dist/decorators/timezone.d.ts +7 -7
  76. package/dist/decorators/timezone.js +7 -7
  77. package/dist/decorators/trigger.d.ts +3 -1
  78. package/dist/decorators/trigger.js +3 -1
  79. package/dist/decorators/uuid.d.ts +6 -0
  80. package/dist/decorators/uuid.js +6 -0
  81. package/dist/decorators/view.d.ts +7 -1
  82. package/dist/decorators/view.js +7 -1
  83. package/dist/diagrams/chen-diagram.d.ts +15 -12
  84. package/dist/diagrams/chen-diagram.js +76 -85
  85. package/dist/diagrams/class-diagram.d.ts +9 -8
  86. package/dist/diagrams/class-diagram.js +60 -82
  87. package/dist/diagrams/core/index.d.ts +13 -0
  88. package/dist/diagrams/core/index.js +33 -0
  89. package/dist/diagrams/core/layout.d.ts +104 -0
  90. package/dist/diagrams/core/layout.js +223 -0
  91. package/dist/diagrams/{svg-dom.d.ts → core/svg.d.ts} +8 -20
  92. package/dist/diagrams/{svg-dom.js → core/svg.js} +21 -29
  93. package/dist/diagrams/core/theme.d.ts +84 -0
  94. package/dist/diagrams/core/theme.js +62 -0
  95. package/dist/diagrams/dependency-diagram.d.ts +15 -14
  96. package/dist/diagrams/dependency-diagram.js +71 -105
  97. package/dist/diagrams/er-diagram.d.ts +13 -26
  98. package/dist/diagrams/er-diagram.js +180 -259
  99. package/dist/diagrams/flow-diagram.d.ts +16 -11
  100. package/dist/diagrams/flow-diagram.js +96 -91
  101. package/dist/diagrams/gantt-diagram.d.ts +10 -5
  102. package/dist/diagrams/gantt-diagram.js +77 -103
  103. package/dist/diagrams/index-diagram.d.ts +10 -10
  104. package/dist/diagrams/index-diagram.js +106 -116
  105. package/dist/diagrams/index.d.ts +6 -9
  106. package/dist/diagrams/index.js +9 -24
  107. package/dist/diagrams/migration-diagram.d.ts +8 -4
  108. package/dist/diagrams/migration-diagram.js +189 -161
  109. package/dist/diagrams/model-diagram.d.ts +34 -34
  110. package/dist/diagrams/model-diagram.js +106 -485
  111. package/dist/diagrams/package-diagram.d.ts +9 -6
  112. package/dist/diagrams/package-diagram.js +64 -101
  113. package/dist/diagrams/relational-diagram.d.ts +12 -10
  114. package/dist/diagrams/relational-diagram.js +87 -114
  115. package/dist/diagrams/schemadoc-diagram.d.ts +8 -8
  116. package/dist/diagrams/schemadoc-diagram.js +71 -93
  117. package/dist/diagrams/sequence-diagram.d.ts +10 -10
  118. package/dist/diagrams/sequence-diagram.js +64 -89
  119. package/dist/diagrams/state-diagram.d.ts +10 -9
  120. package/dist/diagrams/state-diagram.js +69 -92
  121. package/dist/diagrams/tree-diagram.d.ts +11 -5
  122. package/dist/diagrams/tree-diagram.js +41 -65
  123. package/dist/dialects/clickhouse/index.js +15 -0
  124. package/dist/dialects/cockroachdb/index.d.ts +1 -1
  125. package/dist/dialects/cockroachdb/index.js +32 -63
  126. package/dist/dialects/db2/index.js +23 -8
  127. package/dist/dialects/dialect.d.ts +141 -5
  128. package/dist/dialects/duckdb/index.js +9 -2
  129. package/dist/dialects/hana/index.js +22 -5
  130. package/dist/dialects/lock-clause-helper.d.ts +167 -0
  131. package/dist/dialects/lock-clause-helper.js +316 -0
  132. package/dist/dialects/mariadb/index.d.ts +7 -4
  133. package/dist/dialects/mariadb/index.js +36 -60
  134. package/dist/dialects/mssql/index.js +34 -3
  135. package/dist/dialects/mysql/index.d.ts +1 -1
  136. package/dist/dialects/mysql/index.js +17 -45
  137. package/dist/dialects/oracle/index.d.ts +14 -3
  138. package/dist/dialects/oracle/index.js +66 -36
  139. package/dist/dialects/order-expression-helper.d.ts +72 -0
  140. package/dist/dialects/order-expression-helper.js +154 -0
  141. package/dist/dialects/partial-index.d.ts +52 -0
  142. package/dist/dialects/partial-index.js +251 -0
  143. package/dist/dialects/postgres/index.d.ts +1 -1
  144. package/dist/dialects/postgres/index.js +43 -68
  145. package/dist/dialects/redshift/index.js +9 -2
  146. package/dist/dialects/snowflake/index.js +17 -0
  147. package/dist/dialects/spanner/index.js +7 -2
  148. package/dist/dialects/sqlite/driver.d.ts +55 -0
  149. package/dist/dialects/sqlite/driver.js +102 -0
  150. package/dist/dialects/sqlite/index.d.ts +1 -1
  151. package/dist/dialects/sqlite/index.js +49 -27
  152. package/dist/external-fields/decorator.d.ts +2 -0
  153. package/dist/external-fields/decorator.js +2 -0
  154. package/dist/graph/base-graph-dialect.d.ts +24 -3
  155. package/dist/graph/base-graph-dialect.js +43 -2
  156. package/dist/graph/dgraph/index.js +6 -0
  157. package/dist/graph/gremlin/index.d.ts +6 -0
  158. package/dist/graph/gremlin/index.js +12 -1
  159. package/dist/graph/index.d.ts +1 -1
  160. package/dist/graph/neo4j/index.d.ts +2 -0
  161. package/dist/graph/neo4j/index.js +6 -1
  162. package/dist/graph/types.d.ts +12 -1
  163. package/dist/index.d.ts +12 -3
  164. package/dist/index.js +53 -7
  165. package/dist/logging/index.d.ts +10 -0
  166. package/dist/logging/index.js +23 -0
  167. package/dist/logging/query-logging.d.ts +82 -0
  168. package/dist/logging/query-logging.js +102 -0
  169. package/dist/models/associations.d.ts +38 -0
  170. package/dist/models/associations.js +16 -0
  171. package/dist/models/decorators.d.ts +55 -19
  172. package/dist/models/decorators.js +95 -19
  173. package/dist/models/eager-load.d.ts +99 -0
  174. package/dist/models/eager-load.js +348 -5
  175. package/dist/models/indexes.d.ts +3 -2
  176. package/dist/models/indexes.js +7 -1
  177. package/dist/models/model.js +69 -43
  178. package/dist/prorm.d.ts +175 -409
  179. package/dist/prorm.js +1132 -553
  180. package/dist/query-builders/order-limit-builder.js +12 -10
  181. package/dist/query-builders/sql-compiler.d.ts +10 -3
  182. package/dist/query-builders/sql-compiler.js +14 -43
  183. package/dist/query-interface.d.ts +2 -1
  184. package/dist/schema-objects.d.ts +42 -0
  185. package/dist/schema-objects.js +28 -0
  186. package/dist/sql-constants.d.ts +44 -0
  187. package/dist/sql-constants.js +138 -1
  188. package/dist/types/index.d.ts +387 -17
  189. package/dist/types/index.js +10 -15
  190. package/dist/types/query-types.d.ts +26 -0
  191. package/dist/types/query-types.js +30 -0
  192. package/package.json +39 -8
  193. package/dist/decorators/belongs-to-many.js +0 -115
  194. package/dist/decorators/belongs-to.js +0 -115
  195. package/dist/decorators/has-many.js +0 -127
  196. package/dist/decorators/has-one.js +0 -116
  197. package/dist/diagrams/palette.d.ts +0 -138
  198. package/dist/diagrams/palette.js +0 -194
  199. package/dist/hooks/hooks-manager.d.ts +0 -189
  200. package/dist/hooks/hooks-manager.js +0 -350
  201. package/dist/hooks/index.d.ts +0 -8
  202. package/dist/hooks/index.js +0 -37
  203. /package/dist/{logging.d.ts → logging/logger.d.ts} +0 -0
  204. /package/dist/{logging.js → logging/logger.js} +0 -0
package/CHANGELOG.md CHANGED
@@ -5,16 +5,279 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
- ## [1.2.3]
8
+ ## [2.1.0] - 2026-09-07
9
+
10
+ ### Documentation
11
+
12
+ - **The documentation is now a guided path rather than a reference dump.** A
13
+ landing page, a getting-started tutorial that runs as written, a stated
14
+ reading order with an editorial hand-off at the end of each page, and an
15
+ overview page for every major section. The dialect and store indexes listed
16
+ 12 of 27 and 12 of 88 pages respectively; both are now complete and generated
17
+ from the pages themselves so they cannot drift.
18
+
19
+ - **An API reference generated from the source.** TypeDoc was configured but
20
+ never ran, leaving 11,098 TSDoc blocks invisible; it now builds in CI and
21
+ ships at `/reference`. TSDoc coverage of exported declarations rose from
22
+ 81.2% to 86.0%, and 97 usage examples that TypeDoc had been parsing as block
23
+ tags — rendering as mangled tag soup — are fenced correctly.
24
+
25
+ - **The viewer gained** collapsible grouped navigation (stores was 89 links in
26
+ one flat list), breadcrumbs, in-page contents, heading anchors, callouts,
27
+ mermaid diagrams and Ace syntax highlighting — with eleven Playwright smoke
28
+ tests covering it, since it is the one component that cannot be verified
29
+ without a browser.
30
+
31
+ - **All Vercel content is gone.** The 12 guides under `guides/docker/` were
32
+ written around Vercel Sandbox despite the directory name; each is rewritten
33
+ against real Docker using the images and credentials `docker-compose.test.yml`
34
+ already uses. `runbooks/rollback.md` described three things that no longer
35
+ exist and now documents the GitLab Pages deploy. What stays is
36
+ `stores/vercel-kv.md`: Vercel KV is a supported data store, not deployment
37
+ cruft.
38
+
39
+ ### Security
40
+
41
+ - **Cleared every HIGH and CRITICAL dependency advisory** (40 issues / 123
42
+ vulnerable paths at the start, including one Critical). `npm audit` goes from
43
+ 46 findings (19 high, 2 critical) to 16 (0 high, 0 critical); everything left
44
+ is moderate or low.
45
+
46
+ Most of it was lockfile staleness rather than unfixable advisories — the
47
+ declared ranges already permitted the patched versions. Refreshing within
48
+ those ranges moved `undici` 7.28.0 → 7.29.1 (the Critical: improper
49
+ certificate validation), `tar` 6.2.1 → 7.5.22, `mysql2` 3.20.0 → 3.24.3,
50
+ `mariadb` 3.5.2 → 3.5.4, `@xmldom/xmldom` 0.9.10 → 0.9.12 (11 advisories),
51
+ `thrift` 0.23.0 → 0.24.0, `protobufjs` 7.6.4 → 7.6.6, `browserslist` 4.28.1 →
52
+ 4.28.9, `fast-xml-parser` 5.9.3 → 5.11.1 and `brace-expansion` to 1.1.18 /
53
+ 2.1.4 / 5.0.9.
54
+
55
+ Three `overrides` cover transitives whose parents pin a vulnerable version:
56
+ `adm-zip` ^0.6.0 (pinned by `ibm_db`), `toml` ^5.0.0 (pinned by
57
+ `snowflake-sdk` at ^3.0.0) and `node-gyp` ^11.4.2, which pulls modern
58
+ `cacache` (19.0.1), `make-fetch-happen` (14.0.3) and `tar` 7.x through the
59
+ native-build toolchain. Note that npm `overrides` apply to this repository's
60
+ own install and are **not** inherited by packages that depend on
61
+ ts-prorm-orm.
62
+
63
+ npm proposed "fixes" that were actually downgrades — `ibm_db` 4.0.1 → 3.1.0
64
+ and `snowflake-sdk` 3.0.0 → 1.11.0. Those were rejected; the overrides above
65
+ address the same advisories without giving up a major version of DB2 or
66
+ Snowflake support.
67
+
68
+ - **Two advisories are accepted rather than fixed, in a documented `.snyk`
69
+ policy.** Both are HIGH, transitive, and have no upgrade available today; the
70
+ other 38 issues were fixed by moving to patched versions, not ignored. Each
71
+ entry carries a reason and a 2026-12-06 expiry so it has to be re-argued
72
+ rather than quietly living forever.
73
+
74
+ `adm-zip` (Symlink Attack) has **no fixed version at all** — 0.6.0 is the
75
+ latest release. It arrives only through `ibm_db`, and only in
76
+ `installer/driverInstall.js`, which unzips IBM's own CLI driver bundle at
77
+ install time; nothing in `ibm_db/lib` reaches it, and `allowScripts` does not
78
+ approve `ibm_db`, so that installer never runs here anyway.
79
+
80
+ `@opentelemetry/core` (unbounded resource allocation) *is* fixed in 2.8.0,
81
+ but that fix is unreachable: `@google-cloud/spanner` depends on the OTel 1.x
82
+ API, and `@opentelemetry/resources@1.30.1` pins core to exactly 1.30.1, so
83
+ core cannot move alone. Overriding the whole stack to 2.x was tried and
84
+ verified to break Spanner outright — `require('@google-cloud/spanner')`
85
+ throws `ExplicitBucketHistogramAggregation is not a constructor` — so the
86
+ override was reverted rather than shipping a broken Spanner dialect.
87
+
88
+ ### Removed
89
+
90
+ - **`sqlite3` is no longer a dependency.** Nothing in the codebase imported it
91
+ — SQLite runs on `better-sqlite3` (and `bun:sqlite` under Bun), which the
92
+ driver loader selects at runtime. It was a hard dependency, so every consumer
93
+ compiled a native addon for a package that was never loaded, and it dragged
94
+ in the vulnerable `node-gyp` 8.x / `cacache` 15.x / `tar` 6.2.1 toolchain.
95
+ Installs are smaller and one native build lighter.
96
+
97
+ - **The CI pipeline drops from 77 jobs to 13.** `db.gitlab-ci.yml` and its 59
98
+ `mirror:*` jobs are gone: each pulled a multi-gigabyte database image through
99
+ docker-in-docker and pushed it to this project's registry, purely so the
100
+ Docker guides could pull from a registry we control — and those guides now
101
+ pull from Docker Hub directly, so the jobs had no remaining consumer. The 18
102
+ `db-*` category stages went with them.
103
+
104
+ Also removed: the `test` shard matrix, `test:coverage`, `tf:plan` and
105
+ `tf:drift`. **The test suite no longer runs in CI**; `build:node22` (tsc) and
106
+ `lint` are the automated gates on a push. The full suite still runs through
107
+ `prepublishOnly` on the tag-triggered `publish` job — but not on
108
+ `publish:npm`, which uses `--ignore-scripts`.
109
+
110
+ ### Changed
111
+
112
+ - **Pinned `@qdrant/js-client-rest` to `~1.18.0`.** 1.19.0 removed `search()`
113
+ and `searchBatch()` in a *minor* release; their replacements (`query()` /
114
+ `queryBatch()`) take a different request shape and return `{ points }`
115
+ instead of an array, so adopting them would change the public signature of
116
+ `QdrantStore.searchBatch()`. Pinning keeps the API stable and still clears
117
+ the advisory, because 1.18.0's `undici ^6.24.0` range resolves to the fixed
118
+ 6.28.1. Migrating to the query API is deliberate future work.
119
+
120
+ ### Fixed
121
+
122
+ - **`allowScripts` no longer silently skips the native build.** It approved
123
+ `better-sqlite3@12.8.0` by exact version, so refreshing the lockfile to
124
+ 12.11.1 blocked the `node-gyp` install script — leaving no compiled binding
125
+ and failing 155 suites / 2,283 tests with no obvious cause. npm rejects
126
+ semver ranges in this field, so the entry now lists exact versions joined by
127
+ `||`. Note that after changing it you must `npm rebuild`, because npm only
128
+ runs install scripts when it actually (re)installs a package.
129
+ - **`sbom` no longer fails on peer-dependency noise.** `cyclonedx-npm` shells
130
+ out to `npm ls`, which exits `ELSPROBLEMS` because the root install uses
131
+ `--legacy-peer-deps`; `--ignore-npm-errors` tolerates it.
132
+ - **`snyk:code` no longer blocks on a missing entitlement.** Snyk Code is
133
+ separately licensed and returns `403 Forbidden (SNYK-CLI-0000)` with no
134
+ findings when the org lacks it — a licensing state, not a security result.
135
+ - **The documentation site can actually deploy.** `pages` had no `needs:`, so
136
+ it waited on every earlier stage and was silently blocked by unrelated
137
+ security-scan failures. It is decoupled with `needs: []`; the security jobs
138
+ still gate the pipeline, just not the docs.
139
+
140
+ ## [2.0.0]
141
+
142
+ ### Breaking
143
+
144
+ - **JSON/JSONB columns now return parsed values on every dialect.** Previously
145
+ the PostgreSQL and MySQL drivers returned an object while SQLite (and any
146
+ dialect storing JSON as TEXT) returned the raw string. Reads are now
147
+ consistent, which means **code that called `JSON.parse` on the result under
148
+ SQLite must drop that call** — it will now be parsing an object.
149
+
150
+ This is the only change requiring action on upgrade. Text that isn't valid
151
+ JSON is still returned as-is rather than throwing, so rows written by earlier
152
+ versions read back correctly.
153
+
154
+ ### Changed
155
+
156
+ - **JSON/JSONB columns now round-trip losslessly, and read back as parsed
157
+ values on every dialect.** Two separate problems, fixed together.
158
+
159
+ *Reads were dialect-specific.* The PostgreSQL and MySQL drivers already
160
+ returned an object; SQLite (and anything else storing JSON as TEXT) returned
161
+ the raw string, so the same model code behaved differently per engine.
162
+ `findAll`/`findOne`/`findByPk` now parse the string form everywhere.
163
+ **If you were calling `JSON.parse` yourself on SQLite, remove it** — the value
164
+ arrives parsed. Values that are already objects are untouched, and text that
165
+ isn't valid JSON is returned as-is rather than throwing, so rows written
166
+ before this release still read back correctly.
167
+
168
+ *Writes were asymmetric with reads.* A string value was written to the column
169
+ **unencoded** while the read side parsed unconditionally, so any string that
170
+ happened to be valid JSON changed type on the way back: `'123'` returned the
171
+ number `123`, `'true'` a boolean, `'{"a":1}'` an object, and
172
+ `'12345678901234567890'` came back as `12345678901234567000` — silent
173
+ precision loss. It also wrote invalid JSON on PostgreSQL, which rejects a bare
174
+ `hello` for a `json` column. Every value is now encoded on write, strings
175
+ included, in both the `define()` and class-based paths.
176
+
177
+ - **JSON/JSONB values were not serialized on write at all in some paths.** A
178
+ plain object survived by accident (the dialect's value escaper stringifies
179
+ objects), but an array was expanded into the `(a, b)` IN-list form and
180
+ produced invalid SQL. `create`, `bulkCreate`, `update` and `upsert` now
181
+ serialize explicitly.
9
182
 
10
183
  ### Fixed
11
184
 
185
+ - **`FindOptions.lock` never reached the dialect.** `findAll({ lock: 'UPDATE',
186
+ transaction: t })` compiled to a plain SELECT, so code written to serialize
187
+ concurrent updates took no lock at all. It is now forwarded, and PostgreSQL /
188
+ MySQL emit `FOR UPDATE` / `FOR SHARE` / `LOCK IN SHARE MODE` as documented.
189
+ Dialects without row-level locking (SQLite) still ignore it.
190
+ - **`FindOptions.union` / `unionType` were silently no-ops** on models built by
191
+ `prorm.define()` — the branches were declared, documented and compiled by the
192
+ dialects, but never passed to them, so only the main query ran.
193
+ - **`FindOptions.using` never worked.** It resolved the target through
194
+ `prorm.connectionManager`, which nothing ever set, so every call threw
195
+ `Connection 'x' not found. Available: none`; the class-based path then called
196
+ `.get()` on a plain object. `ConnectionManager.addConnection()` now registers
197
+ itself on the instance it creates, and `using` is implemented on both query
198
+ paths.
12
199
  - **`raw: true` was accepted and ignored.** Rows came back as full model
13
200
  instances carrying `save`/`update`/`destroy` and internal bookkeeping fields
14
201
  — slower than asked for, and wrong for grouped aggregates that correspond to
15
202
  no model instance. It now returns plain row objects.
16
203
  - `normalizeOperatorKeys` is exported from the package root, alongside the
17
204
  `operatorToWhereKey` and `getOperatorString` helpers it belongs with.
205
+ - **Row locking never compiled from the object form.** `lock: { level: 'UPDATE' }`
206
+ — and any object carrying `nowait` / `skipLocked` — emitted no lock clause at
207
+ all. Every documented shape now compiles across 9 dialects, including SQL
208
+ Server's table-hint syntax (`WITH (UPDLOCK, ROWLOCK, READPAST)`). A level a
209
+ dialect lacks throws naming the supported levels.
210
+ - **Composite unique constraints were never emitted.** Neither the `uniqueKeys`
211
+ model option nor the attribute-level `uniqueKey` grouping produced any SQL, so
212
+ uniqueness the model declared was never enforced by the database. Worse,
213
+ `sync({ alter: true })` *destroyed* constraints that had been emitted, because
214
+ SQLite implements `changeColumn` by rebuilding the table and the rebuild
215
+ dropped the `UNIQUE` clause. Both declaration forms now emit a real
216
+ constraint, and declared keys are re-applied after an alter.
217
+ - **Partial indexes.** `IndexOptions.where` compiled to bound placeholders,
218
+ which no database accepts in a `CREATE INDEX` predicate. Db2, SAP HANA and
219
+ ClickHouse silently dropped the predicate and returned an **unfiltered**
220
+ index; MariaDB and Oracle emitted a `WHERE` clause they have never accepted.
221
+ Predicates are now inlined as escaped literals where supported, and dialects
222
+ without partial indexes throw with the reason.
223
+ - **`ORDER BY` was broken on three dialects.** `[['name','DESC']]` produced
224
+ `ORDER BY [0] NAME, [1] DESC` on SQL Server and Snowflake; on Oracle a plain
225
+ `'name'` emitted one term per *character*. The `asc()` / `desc()` / `random()`
226
+ helpers were silently ignored on every dialect and on all four graph
227
+ dialects. `random()` now resolves per engine — `NEWID()` on SQL Server, where
228
+ `RAND()` is a per-query constant and would not shuffle at all.
229
+ - **Two filtering `include`s on the same parent column** merged into a shape the
230
+ where-builders don't recognise, collapsed to `"id" = ?`, and returned one
231
+ arbitrary parent.
232
+ - **`{ all: true }` includes** were never expanded, and did not compose with
233
+ `required: true`.
234
+ - **A bare-model include** (`include: [Post]`) threw a `TypeError` at the top
235
+ level and silently loaded nothing when nested; 11 documented `IncludeOptions`
236
+ fields were being dropped when include entries were rebuilt.
237
+ - **`findAndCountAll` ignored `union`**, so `count` described only the main
238
+ branch while `rows` covered all of them.
239
+ - **Foreign-key check toggling emitted MySQL syntax on PostgreSQL.** It now
240
+ routes per dialect family, and dialects with no session-level switch throw
241
+ naming their own alternative.
242
+ - **The published package could ship a stale build.** `npm run build` was a
243
+ plain `tsc`, which emits but never deletes, so a leftover `dist/logging.js`
244
+ from a removed source file shadowed `dist/logging/index.js` — Node resolves a
245
+ file before a directory — and the built package threw
246
+ `logQuery is not a function` on `bulkCreate`. The test suite could not catch
247
+ it, because it runs against `src/`. `build` now cleans first, and
248
+ `check:package` fails the publish on any stale output.
249
+
250
+ ### Added
251
+
252
+ - **30 previously unreachable exports.** `src/cache`, `src/audit`,
253
+ `src/prisma-migrate`, the `@Audit` decorator, `GraphCapabilityError` and
254
+ `DataLineage` were implemented but not exported, and the `exports` map allowed
255
+ no deep imports either. Five colliding cache type names are aliased so no
256
+ existing export changed meaning. `ts-prorm-orm/cache`, `/audit`, `/graph` and
257
+ `/prisma-migrate` subpaths expose them under their real names.
258
+ - **Bun support.** The SQLite dialect now resolves its driver per runtime:
259
+ `better-sqlite3` on Node, the built-in `bun:sqlite` on Bun. Bun needs no
260
+ native build step, and under Bun the better-sqlite3 addon may not be
261
+ installable at all. The two APIs differ in one place — bun:sqlite has no
262
+ `db.pragma()` — so the driver module adds it, keeping a single shape for the
263
+ dialect to code against with no runtime branching in the SQL layer. Under Bun
264
+ it still falls back to better-sqlite3 if that is what a project already
265
+ depends on. `scripts/bun-smoke.ts` exercises CRUD, operators, eager loading,
266
+ ordering, JSON, aggregates, paranoid deletes and transactions on Bun.
267
+ - **Documentation.** 29 developer guides plus an index, with every SQL example
268
+ captured from the running code rather than written from memory.
269
+ - **Tests.** ~4,000 connection-free tests across dialects, models, query
270
+ builders, compliance, optimizers, schema, graph and the CLI. `collectCoverageFrom`
271
+ now scopes coverage to shipped source (`src/test.ts` was inflating the
272
+ denominator despite being excluded from the build); no coverage threshold is
273
+ enforced.
274
+
275
+ ### Removed
276
+
277
+ - **`docs-next`** and its entire Vercel deployment pipeline. Documentation is
278
+ now a static React viewer published to GitLab Pages, and database image
279
+ mirroring moved to the project's own GitLab Container Registry.
280
+
18
281
 
19
282
  ## [1.2.2]
20
283
 
@@ -42,6 +305,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
42
305
  ### Added
43
306
 
44
307
  - **`avg()`** — the one standard aggregate that was missing.
308
+ - Removed `src/hooks/` — a 488-line model-level hook system imported by nothing
309
+ and exported from nowhere, the third such parallel implementation found (after
310
+ the association decorators and the duplicate eager-loaders). Its `HookName`
311
+ union was salvaged into `core/types`.
45
312
  - `exports` now permits `ts-prorm-orm/package.json`, which build tooling and
46
313
  version checks commonly read.
47
314
 
@@ -142,6 +409,69 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
142
409
 
143
410
  ## [Unreleased]
144
411
 
412
+ ### Fixed
413
+
414
+ - **Query logging fired twice and ignored per-query overrides.** The user's
415
+ `logging` callback was handed to the internal Logger as well as being invoked
416
+ by the query path, so it ran on both - and the Logger's copy honoured no
417
+ per-query setting, making `findAll({ logging: false })` log anyway. The
418
+ internal Logger now handles only slow-query detection and its own levels.
419
+ - **Four operations logged nothing at all.** `count`, `bulkCreate`, `increment`
420
+ and the aggregates never emitted a line, so turning logging on showed an
421
+ incomplete picture of what the ORM was doing. Every operation now routes
422
+ through one path.
423
+ - **`instance.validate({ hooks: true })` ran no hooks.** It read a
424
+ `_hooksManager` property that nothing ever assigned, so the flag was accepted
425
+ and both `beforeValidate` and `afterValidate` were skipped. Both call sites
426
+ (prorm.ts and models/model.ts) now use the model's declared hooks, the same
427
+ source every other lifecycle hook comes from.
428
+
429
+ ### Added
430
+
431
+ - **Sequelize-compatible query logging.** `logging` accepts `false`, `true` or a
432
+ `(sql, timing)` function at instance level, overridable per query - so one
433
+ noisy call can be traced without enabling logging globally, and one call can
434
+ be silenced without disabling it. Adds `benchmark` (append elapsed time) and
435
+ `logQueryParameters` (append bound values, off by default since bound values
436
+ routinely contain credentials). The resolution logic lives in
437
+ `src/logging/query-logging.ts` and is exported: `logQuery`,
438
+ `resolveQueryLogger`, `formatQueryLog`.
439
+ - **`unset<Association>()` on belongsTo** — clears the foreign key and persists
440
+ it. `set<Association>(null)` does the same thing and now explicitly accepts
441
+ null, but reads as an assignment rather than a removal.
442
+ - **`HookName` / `ModelHookMap` types** — hook names as a union rather than
443
+ `string`, so a misspelled hook is a compile error instead of a callback that
444
+ silently never runs.
445
+ - **`@AbstractModel`** — a base class that defines fields shared by several
446
+ models without getting a table of its own. Columns declared on it, and any
447
+ `@PrimaryKey` / `@AutoIncrement` / defaults on them, are inherited by the
448
+ concrete models that extend it; a subclass may redeclare a column to override
449
+ it. Passing the abstract class to `addModel()` is an error naming the class.
450
+ - **Finders**: `findOneOrFail` / `findByPkOrFail` (throw `EmptyResultError`
451
+ rather than returning null), `findLast` (inverts the ordering), `exists(where)`
452
+ (a COUNT rather than fetching a row), and `findInBatches` / `findEach` for
453
+ walking a large set without holding it in memory. Batching pages by primary
454
+ key rather than OFFSET, so per-batch cost stays flat and concurrent writes
455
+ cannot cause a page to be skipped.
456
+ - **Eleven lifecycle hooks that never fired for model-level operations**:
457
+ `beforeUpdate`/`afterUpdate`, `beforeDestroy`/`afterDestroy`,
458
+ `beforeSave`/`afterSave`, `beforeFind`/`afterFind`, `beforeCount`, and
459
+ `beforeUpsert`/`afterUpsert`. They existed for instance methods only, so
460
+ `Model.update(...)` bypassed them entirely. `beforeFind` may return replacement
461
+ options and `afterFind` a replacement result set.
462
+ - **`Model.increment()` / `Model.decrement()`** — add to or subtract from
463
+ numeric columns with `SET n = n + 1` in a single statement, so two concurrent
464
+ callers each apply their delta. Previously only per-instance helpers existed,
465
+ leaving a read-modify-write that silently drops one of two simultaneous
466
+ updates. Accepts a column, a list, or a per-column map; honours `where` and
467
+ paranoid filtering.
468
+ - **`Model.bulkUpdate(rows)`** — write different values to many rows in one
469
+ statement, compiled as a `CASE` per column (portable across every supported
470
+ dialect) rather than one UPDATE per row. Columns a row omits keep their
471
+ current value; rows not listed are untouched. Identify rows by a non-primary
472
+ column with `{ key }`.
473
+
474
+
145
475
  ### Comprehensive Feature Reference
146
476
 
147
477
  This section provides a complete reference of all ORM features organized by category.
package/README.md CHANGED
@@ -29,6 +29,13 @@ A TypeScript ORM supporting multiple database dialects with full TypeScript supp
29
29
  - **Validation**: Built-in and custom validators
30
30
  - **Stored Procedures**: Create and call stored procedures (across supported dialects)
31
31
  - **Triggers**: Database triggers with FOR EACH ROW and WHEN clauses (across supported dialects)
32
+ - **Query logging**: Sequelize-compatible `logging` (`false` / `true` / a
33
+ `(sql, timing)` function), overridable per query, plus `benchmark` for elapsed
34
+ time and `logQueryParameters` for bound values. Every operation logs, not just
35
+ some
36
+ - **Bulk writes**: `increment`/`decrement` do the arithmetic in the database, so
37
+ concurrent updates don't lose each other; `bulkUpdate` writes different values
38
+ to many rows in one statement instead of one round trip per row
32
39
  - **Aggregates**: `count`, `sum`, `avg`, `min`, `max` — all issuing real SQL
33
40
  aggregates and honouring `where`, scopes, soft-deletes and relation filters;
34
41
  `group` + `having` for grouped results
@@ -646,29 +653,30 @@ npm run diagram:model
646
653
 
647
654
  ## Documentation
648
655
 
649
- Full documentation is available in the `docs/` directory:
650
-
651
- - [Getting Started](./docs/) - Main documentation entry point
652
- - [Dialects](./docs/dialects/) - Database-specific documentation
653
- - [SQLite](./docs/dialects/sqlite.md)
654
- - [MySQL](./docs/dialects/mysql.md)
655
- - [PostgreSQL](./docs/dialects/postgres.md)
656
- - [MariaDB](./docs/dialects/mariadb.md)
657
- - [Oracle](./docs/dialects/oracle.md)
658
- - [MSSQL](./docs/dialects/mssql.md)
659
- - [API Reference](./docs/api/) - API documentation
660
- - [Models](./docs/api/models.md)
661
- - [Query Builder](./docs/api/queries.md)
662
- - [Hooks](./docs/api/hooks.md)
663
- - [Associations](./docs/api/associations.md)
664
-
665
- Additional documentation:
666
- - [Models](./docs/MODELS.md) - Model definition
667
- - [Migrations](./docs/MIGRATIONS.md) - Database migrations
668
- - [Associations](./docs/ASSOCIATIONS.md) - Relationship types
669
- - [Hooks](./docs/HOOKS.md) - Lifecycle hooks
670
- - [Stored Procedures](./docs/STORED_PROCEDURES.md) - Advanced database features
671
- - [Triggers](./docs/TRIGGERS.md) - Database triggers
656
+ Full documentation is in the [`docs/`](./docs/README.md) directory — start
657
+ there for the complete index.
658
+
659
+ **Core**
660
+ - [Defining models](./docs/guides/models.md) · [Data types](./docs/guides/data-types.md) · [Querying](./docs/guides/querying.md) · [Query operators](./docs/guides/query-operators.md)
661
+ - [SQL function builders](./docs/guides/sql-functions.md) · [Associations](./docs/guides/associations.md) · [Eager loading](./docs/guides/eager-loading.md) · [Scopes](./docs/guides/scopes.md) · [Hooks](./docs/guides/hooks.md) · [Validation](./docs/guides/validation.md) · [Virtual fields](./docs/guides/virtual-fields.md)
662
+ - [Transactions](./docs/guides/transactions.md) · [Bulk operations](./docs/guides/bulk-operations.md) · [Raw queries](./docs/guides/raw-queries.md) · [Streaming](./docs/guides/streams.md) · [Error handling](./docs/guides/error-handling.md)
663
+
664
+ **Schema**
665
+ - [Indexes & constraints](./docs/guides/indexes-and-constraints.md) · [Schema objects](./docs/guides/schema-objects.md) (views, triggers, procedures, sequences, RLS, partitions)
666
+ - [Migrations](./docs/guides/migrations.md) · [QueryInterface](./docs/guides/query-interface.md) · [Schema diffing](./docs/guides/schema-diffing.md) · [Prisma import](./docs/guides/prisma-import.md)
667
+
668
+ **Connections & performance**
669
+ - [Connection pooling](./docs/guides/connection-pooling.md) · [Multiple databases](./docs/guides/multiple-databases.md) · [Read replicas](./docs/guides/replication.md)
670
+ - [Caching](./docs/guides/caching.md) · [Query optimization](./docs/guides/query-optimization.md) · [Logging](./docs/guides/logging.md)
671
+
672
+ **Extending & operating**
673
+ - [Decorators](./docs/guides/decorators.md) · [TypeScript types](./docs/guides/typescript-types.md) · [External fields](./docs/guides/external-fields.md) · [SQL constants](./docs/guides/sql-constants.md) · [Extension catalogue](./docs/guides/extensions.md)
674
+ - [Audit logging](./docs/guides/audit-logging.md) · [User management](./docs/guides/user-management.md) · [Compliance](./docs/guides/compliance.md) · [Foreign data wrappers](./docs/guides/foreign-data-wrappers.md) · [Runbooks](./docs/runbooks/README.md)
675
+
676
+ **Databases & tooling**
677
+ - [Database types](./docs/database-types.md) · [SQL dialects](./docs/dialects/README.md) ([SQLite](./docs/dialects/sqlite.md), [PostgreSQL](./docs/dialects/postgres.md), [MySQL](./docs/dialects/mysql.md), [MariaDB](./docs/dialects/mariadb.md), [Oracle](./docs/dialects/oracle.md), [MSSQL](./docs/dialects/mssql.md), …)
678
+ - [Store adapters](./docs/stores/README.md) · [Graph databases](./docs/guides/graph-databases.md) · [SQLite advanced](./docs/guides/sqlite-advanced.md)
679
+ - [CLI](./docs/guides/cli.md) · [Diagrams](./docs/diagrams/README.md) · [Docker & sandboxes](./docs/guides/docker/)
672
680
 
673
681
  ### Architecture / Component Guides
674
682
 
@@ -676,7 +684,7 @@ In-depth, code-level reference docs for each major subsystem, living alongside t
676
684
 
677
685
  - [Dialects](src/dialects/README.md) - The `Dialect` interface and per-database (SQLite/MySQL/PostgreSQL/MariaDB/Oracle/MSSQL/CockroachDB/Redshift/Db2/Snowflake/ClickHouse/DuckDB/HANA/Spanner) implementations of connections, DDL, views, partitioning, RLS, and query building.
678
686
  - [Models](src/models/README.md) - The model layer: attribute/data types, `prorm.define()`, associations, scopes, indexes/constraints, and the model registry.
679
- - [Query Builders](src/query-builders/README.md) - Translates `where`/`order`/`limit`/`include` options into dialect-specific SQL strings and bound parameter values. Includes a typed SQL function-builder library (`src/query-builders/functions/**` - window functions, date/time, JSON paths, string/math functions, CASE expressions, cross-dialect aggregates, full-text search) usable via `import { ... } from 'ts-prorm-orm'`; see [SQL Functions](docs/query-features/queries.md#sql-functions) for worked examples.
687
+ - [Query Builders](src/query-builders/README.md) - Translates `where`/`order`/`limit`/`include` options into dialect-specific SQL strings and bound parameter values. Includes a typed SQL function-builder library (`src/query-builders/functions/**` - window functions, date/time, JSON paths, string/math functions, CASE expressions, cross-dialect aggregates, full-text search) usable via `import { ... } from 'ts-prorm-orm'`; see [`src/query-builders/README.md`](src/query-builders/README.md) for the function list.
680
688
  - [Extension Catalog](src/extensions/README.md) - A discoverability reference (not executable code) of ~124 verified real extensions/plugins/licensed features across dialects, queryable via `findExtension()`/`listExtensionsForDialect()`/`listExtensionsByCategory()`/`searchExtensions()`.
681
689
  - [Query Optimizers](src/query-optimizers/README.md) - Opt-in performance tooling (query hints, explain plans, slow-query logging, batch optimization, prepared-statement/result caching).
682
690
  - [Migrations](src/migrations/README.md) - Migration files, the `Migrator`, `PrormMeta` history tracking, seeders, `QueryInterface`, and schema diffing (`src/schema/`).
@@ -10,6 +10,7 @@
10
10
  * PIPL, AI Act EU, GDPR Art 25/30/32, and data classification requirements.
11
11
  *
12
12
  * Usage:
13
+ * ```ts
13
14
  * // Tag fields with sensitivity levels:
14
15
  * @Classify('PII')
15
16
  * @FieldClassification('email', 'PII')
@@ -25,6 +26,7 @@
25
26
  *
26
27
  * // Auto-discover fields by name patterns:
27
28
  * DataClassifier.autoDiscover(User, ['ssn', 'social', 'dob', 'card', 'password']);
29
+ * ```
28
30
  */
29
31
  export type SensitivityLevel = 'PUBLIC' | 'INTERNAL' | 'CONFIDENTIAL' | 'SECRET' | 'TOP_SECRET';
30
32
  export type DataCategory = 'PII' | 'PHI' | 'PCI' | 'PCI_PAN' | 'FINANCIAL' | 'HEALTH' | 'BIOMETRIC' | 'CUI' | 'SENSITIVE';
@@ -45,16 +47,20 @@ export interface ClassificationMetadata {
45
47
  /**
46
48
  * Classify the entire model (applies to all fields, use field-level for specifics).
47
49
  *
50
+ * ```ts
48
51
  * @Classify('CONFIDENTIAL')
49
52
  * class FinancialRecord extends Model { ... }
53
+ * ```
50
54
  */
51
55
  export declare function Classify(level: SensitivityLevel): (target: Function) => void;
52
56
  /**
53
57
  * Classify a specific field.
54
58
  *
59
+ * ```ts
55
60
  * @FieldClassification('email', 'PII')
56
61
  * @FieldClassification('ssn', 'PHI', { level: 'SECRET', regulations: ['HIPAA'] })
57
62
  * @FieldClassification('creditCard', 'PCI_PAN', { level: 'TOP_SECRET' })
63
+ * ```
58
64
  */
59
65
  export declare function FieldClassification(field: string, category: DataCategory, options?: Partial<ClassificationMetadata>): (target: Function) => void;
60
66
  /**
@@ -11,6 +11,7 @@
11
11
  * PIPL, AI Act EU, GDPR Art 25/30/32, and data classification requirements.
12
12
  *
13
13
  * Usage:
14
+ * ```ts
14
15
  * // Tag fields with sensitivity levels:
15
16
  * @Classify('PII')
16
17
  * @FieldClassification('email', 'PII')
@@ -26,6 +27,7 @@
26
27
  *
27
28
  * // Auto-discover fields by name patterns:
28
29
  * DataClassifier.autoDiscover(User, ['ssn', 'social', 'dob', 'card', 'password']);
30
+ * ```
29
31
  */
30
32
  Object.defineProperty(exports, "__esModule", { value: true });
31
33
  exports.DataClassifier = void 0;
@@ -54,8 +56,10 @@ function getClassifications(target) {
54
56
  /**
55
57
  * Classify the entire model (applies to all fields, use field-level for specifics).
56
58
  *
59
+ * ```ts
57
60
  * @Classify('CONFIDENTIAL')
58
61
  * class FinancialRecord extends Model { ... }
62
+ * ```
59
63
  */
60
64
  function Classify(level) {
61
65
  return function (target) {
@@ -68,9 +72,11 @@ function Classify(level) {
68
72
  /**
69
73
  * Classify a specific field.
70
74
  *
75
+ * ```ts
71
76
  * @FieldClassification('email', 'PII')
72
77
  * @FieldClassification('ssn', 'PHI', { level: 'SECRET', regulations: ['HIPAA'] })
73
78
  * @FieldClassification('creditCard', 'PCI_PAN', { level: 'TOP_SECRET' })
79
+ * ```
74
80
  */
75
81
  function FieldClassification(field, category, options = {}) {
76
82
  return function (target) {
@@ -25,9 +25,11 @@
25
25
  * // Get transformation history:
26
26
  * const transforms = await DataLineage.getTransformations(orderId, 'Orders');
27
27
  *
28
+ * ```ts
28
29
  * // Using the decorator:
29
30
  * @LineageTrack({ fields: ['amount', 'total'] })
30
31
  * class Order extends Model { ... }
32
+ * ```
31
33
  */
32
34
  import { ModelStatic, Prorm } from '../prorm';
33
35
  /** The origin of data - how it entered the system */
@@ -128,8 +130,10 @@ export interface LineageTrackOptions {
128
130
  /**
129
131
  * Decorator to mark fields for lineage tracking.
130
132
  *
133
+ * ```ts
131
134
  * @LineageTrack({ fields: ['amount', 'total', 'tax'] })
132
135
  * class Order extends Model { ... }
136
+ * ```
133
137
  */
134
138
  export declare function LineageTrack(options?: LineageTrackOptions): (target: Function) => void;
135
139
  /**
@@ -26,9 +26,11 @@
26
26
  * // Get transformation history:
27
27
  * const transforms = await DataLineage.getTransformations(orderId, 'Orders');
28
28
  *
29
+ * ```ts
29
30
  * // Using the decorator:
30
31
  * @LineageTrack({ fields: ['amount', 'total'] })
31
32
  * class Order extends Model { ... }
33
+ * ```
32
34
  */
33
35
  Object.defineProperty(exports, "__esModule", { value: true });
34
36
  exports.DataLineage = void 0;
@@ -46,8 +48,10 @@ const lineageRegistry = new Map();
46
48
  /**
47
49
  * Decorator to mark fields for lineage tracking.
48
50
  *
51
+ * ```ts
49
52
  * @LineageTrack({ fields: ['amount', 'total', 'tax'] })
50
53
  * class Order extends Model { ... }
54
+ * ```
51
55
  */
52
56
  function LineageTrack(options = {}) {
53
57
  return function (target) {
@@ -15,6 +15,7 @@
15
15
  * DataMasker.maskField(Payment, 'cardNumber', { pattern: 'card-last4', showLast: 4 });
16
16
  * DataMasker.maskField(Customer, 'email', { pattern: 'email' });
17
17
  *
18
+ * ```ts
18
19
  * // Or use the decorator:
19
20
  * @Mask('ssn', { pattern: 'ssn' })
20
21
  * class User extends Model { ... }
@@ -25,6 +26,7 @@
25
26
  *
26
27
  * // Or use the automatic hook:
27
28
  * DataMasker.applyHooks(User);
29
+ * ```
28
30
  */
29
31
  /** Built-in masking pattern identifiers; see {@link MaskPatternEnum} for the enum form. */
30
32
  export type MaskPattern = 'ssn' | 'card-last4' | 'card-first6' | 'email' | 'phone' | 'full' | 'none' | 'custom';
@@ -71,8 +73,10 @@ export declare function getMaskRules(Model: any): MaskRule[];
71
73
  /**
72
74
  * Decorator to mark a field for masking.
73
75
  *
76
+ * ```ts
74
77
  * @Mask('ssn', { pattern: 'ssn' })
75
78
  * class User extends Model { ... }
79
+ * ```
76
80
  */
77
81
  export declare function Mask(field: string, options?: MaskOptions): (target: Function) => void;
78
82
  /**
@@ -16,6 +16,7 @@
16
16
  * DataMasker.maskField(Payment, 'cardNumber', { pattern: 'card-last4', showLast: 4 });
17
17
  * DataMasker.maskField(Customer, 'email', { pattern: 'email' });
18
18
  *
19
+ * ```ts
19
20
  * // Or use the decorator:
20
21
  * @Mask('ssn', { pattern: 'ssn' })
21
22
  * class User extends Model { ... }
@@ -26,6 +27,7 @@
26
27
  *
27
28
  * // Or use the automatic hook:
28
29
  * DataMasker.applyHooks(User);
30
+ * ```
29
31
  */
30
32
  Object.defineProperty(exports, "__esModule", { value: true });
31
33
  exports.DataMasker = exports.MaskPatternEnum = void 0;
@@ -197,8 +199,10 @@ function getMaskRules(Model) {
197
199
  /**
198
200
  * Decorator to mark a field for masking.
199
201
  *
202
+ * ```ts
200
203
  * @Mask('ssn', { pattern: 'ssn' })
201
204
  * class User extends Model { ... }
205
+ * ```
202
206
  */
203
207
  function Mask(field, options = {}) {
204
208
  return function (target) {
@@ -15,6 +15,7 @@
15
15
  * import { ComplianceAuditTrail } from './compliance/audit-trail';
16
16
  * ComplianceAuditTrail.enable(prorm, UserModel, { getUserId: () => user.id });
17
17
  *
18
+ * ```ts
18
19
  * // 2. Field-level AES-256-GCM encryption
19
20
  * import { FieldEncryption } from './compliance/field-encryption';
20
21
  * FieldEncryption.configure('32-byte-hex-key');
@@ -65,6 +66,7 @@
65
66
  * import { DataClassifier } from './compliance/data-classifier';
66
67
  * @FieldClassification('email', 'PII') class User extends Model {}
67
68
  * const piiFields = DataClassifier.getPIIFields(User);
69
+ * ```
68
70
  */
69
71
  export { ComplianceAuditTrail, AuditTrailOptions } from './audit-trail';
70
72
  export { FieldEncryption, configureFieldEncryption, encryptValue, decryptValue, Encrypt, applyEncryptionHooks, getEncryptedFields, } from './field-encryption';
@@ -91,3 +93,5 @@ export { DSARWorkflow, DSARRequest, RequestStatus, RequestType, FulfillmentOptio
91
93
  export { PrivacyImpactAssessment, AssessmentStatus, RiskSeverity, PIARecord, RiskRecord, PIACreateOptions, RiskRecordOptions, } from './privacy-impact-assessment';
92
94
  export { BackupVerification, BackupSource, BackupConfig, BackupMetadata, VerificationResult, VerificationSchedule, VerificationHistoryEntry, } from './backup-verification';
93
95
  export { QueryFirewall, FirewallRule, FirewallRuleType, FirewallMode, FirewallModeEnum, FirewallOptions, QueryAnalysis, QueryOperation, BlockedQuery, getRecommendedRules, FIREWALL_RULES, OWASP_SQL_INJECTION_PATTERNS, CIS_BENCHMARK_RULES, PCI_DSS_RULES, HIPAA_RULES, SOX_RULES, NIST_CSF_RULES, POSTGRESQL_RULES, MYSQL_RULES, MARIADB_RULES, MSSQL_RULES, ORACLE_RULES, SQLITE_RULES, DATABASE_RULES, DatabaseType, FirewallRules, FirewallRuleDecoratorOptions, PostgreSQLFirewall, MySQLFirewall, MariaDBFirewall, MSSQLFirewall, OracleFirewall, SQLiteFirewall, applyFirewallRulesToModel, } from './query-firewall';
96
+ export { DataLineage, LineageTrack, getLineageFields, getLineageOptions, createDerivedRecord, createComputedRecord, applyHooks as applyLineageHooks, } from './data-lineage';
97
+ export type { DataSource, TransformationRecord, LineageRecord, LineageChain, LineageOptions, LineageTrackOptions, } from './data-lineage';