ts-prorm-orm 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.
- package/CHANGELOG.md +1111 -0
- package/LICENSE +21 -0
- package/README.md +573 -0
- package/dist/audit/history-query.js +180 -0
- package/dist/audit/index.js +23 -0
- package/dist/audit/logger.js +236 -0
- package/dist/cache/cache-manager.js +84 -0
- package/dist/cache/index.js +16 -0
- package/dist/cache/redis-cluster-cache.js +557 -0
- package/dist/cli.js +2200 -0
- package/dist/compliance/audit-trail.js +68 -0
- package/dist/compliance/backup-verification.js +685 -0
- package/dist/compliance/breach-detector.js +505 -0
- package/dist/compliance/consent-record.js +227 -0
- package/dist/compliance/consent-versioning.js +331 -0
- package/dist/compliance/cross-border-log.js +530 -0
- package/dist/compliance/data-classifier.js +258 -0
- package/dist/compliance/data-lineage.js +565 -0
- package/dist/compliance/data-masker.js +303 -0
- package/dist/compliance/data-portability.js +265 -0
- package/dist/compliance/data-retention.js +195 -0
- package/dist/compliance/dsar-workflow.js +342 -0
- package/dist/compliance/field-encryption.js +223 -0
- package/dist/compliance/immutable-record.js +148 -0
- package/dist/compliance/index.js +260 -0
- package/dist/compliance/privacy-impact-assessment.js +364 -0
- package/dist/compliance/pseudonymization.js +269 -0
- package/dist/compliance/query-firewall.js +1182 -0
- package/dist/compliance/rate-limiter.js +580 -0
- package/dist/compliance/right-to-erasure.js +117 -0
- package/dist/compliance/row-level-security.js +246 -0
- package/dist/compliance/security-decorator.js +574 -0
- package/dist/compliance/security-monitor.js +525 -0
- package/dist/compliance/sensitive-data-discovery.js +476 -0
- package/dist/compliance/session-isolation.js +472 -0
- package/dist/compliance/tls-enforcer.js +108 -0
- package/dist/compliance/worm-storage.js +712 -0
- package/dist/connection-manager.js +198 -0
- package/dist/connection-pool.js +519 -0
- package/dist/decorators/audit.js +136 -0
- package/dist/decorators/belongs-to-many.js +115 -0
- package/dist/decorators/belongs-to.js +115 -0
- package/dist/decorators/check.js +435 -0
- package/dist/decorators/collate.js +329 -0
- package/dist/decorators/comment.js +205 -0
- package/dist/decorators/database-settings.js +236 -0
- package/dist/decorators/default.js +244 -0
- package/dist/decorators/encryption.js +235 -0
- package/dist/decorators/engine.js +97 -0
- package/dist/decorators/fk-constraints.js +594 -0
- package/dist/decorators/foreign-table.js +136 -0
- package/dist/decorators/generated.js +274 -0
- package/dist/decorators/has-many.js +127 -0
- package/dist/decorators/has-one.js +116 -0
- package/dist/decorators/hstore.js +129 -0
- package/dist/decorators/index.js +355 -0
- package/dist/decorators/json-column.js +83 -0
- package/dist/decorators/jsonb.js +101 -0
- package/dist/decorators/orm-decorators.js +425 -0
- package/dist/decorators/permissions.js +294 -0
- package/dist/decorators/procedure.js +210 -0
- package/dist/decorators/query-options.js +556 -0
- package/dist/decorators/range.js +167 -0
- package/dist/decorators/set-column.js +83 -0
- package/dist/decorators/spatial.js +114 -0
- package/dist/decorators/storage.js +580 -0
- package/dist/decorators/timezone.js +512 -0
- package/dist/decorators/trigger.js +90 -0
- package/dist/decorators/uuid.js +135 -0
- package/dist/decorators/view.js +258 -0
- package/dist/diagrams/chen-diagram.js +354 -0
- package/dist/diagrams/class-diagram.js +384 -0
- package/dist/diagrams/dependency-diagram.js +432 -0
- package/dist/diagrams/er-diagram.js +605 -0
- package/dist/diagrams/flow-diagram.js +394 -0
- package/dist/diagrams/gantt-diagram.js +411 -0
- package/dist/diagrams/index-diagram.js +353 -0
- package/dist/diagrams/index.js +184 -0
- package/dist/diagrams/migration-diagram.js +316 -0
- package/dist/diagrams/model-diagram.js +616 -0
- package/dist/diagrams/package-diagram.js +376 -0
- package/dist/diagrams/palette.js +85 -0
- package/dist/diagrams/relational-diagram.js +455 -0
- package/dist/diagrams/schemadoc-diagram.js +309 -0
- package/dist/diagrams/sequence-diagram.js +307 -0
- package/dist/diagrams/state-diagram.js +344 -0
- package/dist/diagrams/svg-dom.js +111 -0
- package/dist/diagrams/tree-diagram.js +250 -0
- package/dist/dialects/clickhouse/index.js +1742 -0
- package/dist/dialects/cockroachdb/index.js +4677 -0
- package/dist/dialects/cratedb/index.js +441 -0
- package/dist/dialects/databricks/index.js +517 -0
- package/dist/dialects/db2/index.js +2225 -0
- package/dist/dialects/dialect.js +720 -0
- package/dist/dialects/duckdb/index.js +2014 -0
- package/dist/dialects/exasol/index.js +357 -0
- package/dist/dialects/firebird/index.js +495 -0
- package/dist/dialects/greenplum/index.js +457 -0
- package/dist/dialects/hana/index.js +1741 -0
- package/dist/dialects/mariadb/index.js +3590 -0
- package/dist/dialects/mssql/index.js +2296 -0
- package/dist/dialects/mysql/index.js +4058 -0
- package/dist/dialects/oracle/index.js +2999 -0
- package/dist/dialects/postgres/index.js +5319 -0
- package/dist/dialects/query-stream-helper.js +152 -0
- package/dist/dialects/questdb/index.js +433 -0
- package/dist/dialects/redshift/index.js +2277 -0
- package/dist/dialects/singlestore/index.js +354 -0
- package/dist/dialects/snowflake/index.js +2082 -0
- package/dist/dialects/spanner/index.js +1768 -0
- package/dist/dialects/sqlite/index.js +3382 -0
- package/dist/dialects/tidb/index.js +377 -0
- package/dist/dialects/timescaledb/index.js +164 -0
- package/dist/dialects/trino/index.js +420 -0
- package/dist/dialects/turso/index.js +227 -0
- package/dist/dialects/vertica/index.js +317 -0
- package/dist/dialects/yugabytedb/index.js +424 -0
- package/dist/errors/index.js +472 -0
- package/dist/errors/utils.js +340 -0
- package/dist/errors.js +21 -0
- package/dist/extensions/catalog/cloud-warehouse-features.js +207 -0
- package/dist/extensions/catalog/mssql-features.js +147 -0
- package/dist/extensions/catalog/mysql-mariadb-plugins.js +229 -0
- package/dist/extensions/catalog/oracle-db2-features.js +196 -0
- package/dist/extensions/catalog/postgres-extensions.js +516 -0
- package/dist/extensions/index.js +71 -0
- package/dist/extensions/types.js +13 -0
- package/dist/foreign-data.js +173 -0
- package/dist/hooks/hooks-manager.js +350 -0
- package/dist/hooks/index.js +37 -0
- package/dist/index.js +463 -0
- package/dist/logging.js +335 -0
- package/dist/migrations/index.js +40 -0
- package/dist/migrations/migration.js +196 -0
- package/dist/migrations/migrator.js +411 -0
- package/dist/migrations/prormmigration.js +275 -0
- package/dist/migrations/query-interface.js +435 -0
- package/dist/migrations/seeder.js +353 -0
- package/dist/models/associations.js +852 -0
- package/dist/models/constraints.js +288 -0
- package/dist/models/data-types.js +2518 -0
- package/dist/models/decorators.js +445 -0
- package/dist/models/index.js +33 -0
- package/dist/models/indexes.js +531 -0
- package/dist/models/methods.js +382 -0
- package/dist/models/model-manager.js +103 -0
- package/dist/models/model.js +5349 -0
- package/dist/models/operators.js +67 -0
- package/dist/models/scopes.js +189 -0
- package/dist/models/typescript-types.js +26 -0
- package/dist/nosql/aerospike/index.js +205 -0
- package/dist/nosql/allegrograph/index.js +169 -0
- package/dist/nosql/arangodb/index.js +364 -0
- package/dist/nosql/azure-blob/index.js +206 -0
- package/dist/nosql/beanstalkd/index.js +231 -0
- package/dist/nosql/beequeue/index.js +210 -0
- package/dist/nosql/bigchaindb/index.js +195 -0
- package/dist/nosql/bigtable/index.js +224 -0
- package/dist/nosql/blazegraph/index.js +173 -0
- package/dist/nosql/bullmq/index.js +191 -0
- package/dist/nosql/cassandra/index.js +174 -0
- package/dist/nosql/chroma/index.js +190 -0
- package/dist/nosql/cloudflare-kv/index.js +220 -0
- package/dist/nosql/coherence/index.js +200 -0
- package/dist/nosql/cosmosdb/index.js +157 -0
- package/dist/nosql/couchbase/index.js +213 -0
- package/dist/nosql/dax/index.js +212 -0
- package/dist/nosql/deno-kv/index.js +206 -0
- package/dist/nosql/dgraph/index.js +171 -0
- package/dist/nosql/doris/index.js +169 -0
- package/dist/nosql/druid/index.js +162 -0
- package/dist/nosql/dynamodb/index.js +937 -0
- package/dist/nosql/elasticsearch/index.js +377 -0
- package/dist/nosql/etcd/index.js +502 -0
- package/dist/nosql/eventhubs/index.js +213 -0
- package/dist/nosql/eventstore/index.js +254 -0
- package/dist/nosql/faunadb/index.js +188 -0
- package/dist/nosql/firestore/index.js +177 -0
- package/dist/nosql/fluree/index.js +148 -0
- package/dist/nosql/fuseki/index.js +170 -0
- package/dist/nosql/gcs/index.js +172 -0
- package/dist/nosql/gearman/index.js +160 -0
- package/dist/nosql/geode/index.js +196 -0
- package/dist/nosql/graphdb/index.js +169 -0
- package/dist/nosql/graylog/index.js +188 -0
- package/dist/nosql/gridgain/index.js +171 -0
- package/dist/nosql/hazelcast/index.js +162 -0
- package/dist/nosql/hbase/index.js +230 -0
- package/dist/nosql/ignite/index.js +173 -0
- package/dist/nosql/immudb/index.js +184 -0
- package/dist/nosql/index.js +232 -0
- package/dist/nosql/infinispan/index.js +200 -0
- package/dist/nosql/influxdb/index.js +0 -0
- package/dist/nosql/kafka/index.js +234 -0
- package/dist/nosql/keyspaces/index.js +189 -0
- package/dist/nosql/kinesis/index.js +253 -0
- package/dist/nosql/leveldb/index.js +153 -0
- package/dist/nosql/lmdb/index.js +160 -0
- package/dist/nosql/loki/index.js +201 -0
- package/dist/nosql/marklogic/index.js +204 -0
- package/dist/nosql/materialize/index.js +145 -0
- package/dist/nosql/meilisearch/index.js +154 -0
- package/dist/nosql/memcached/index.js +223 -0
- package/dist/nosql/milvus/index.js +410 -0
- package/dist/nosql/minio/index.js +265 -0
- package/dist/nosql/momento/index.js +179 -0
- package/dist/nosql/mongodb/index.js +461 -0
- package/dist/nosql/nats/index.js +247 -0
- package/dist/nosql/nedb/index.js +164 -0
- package/dist/nosql/neo4j/index.js +450 -0
- package/dist/nosql/neptune/index.js +470 -0
- package/dist/nosql/nsq/index.js +200 -0
- package/dist/nosql/opensearch/index.js +186 -0
- package/dist/nosql/orientdb/index.js +175 -0
- package/dist/nosql/papertrail/index.js +200 -0
- package/dist/nosql/pinecone/index.js +0 -0
- package/dist/nosql/pinot/index.js +133 -0
- package/dist/nosql/pouchdb/index.js +172 -0
- package/dist/nosql/prometheus/index.js +174 -0
- package/dist/nosql/provendb/index.js +147 -0
- package/dist/nosql/pubsub/index.js +187 -0
- package/dist/nosql/pulsar/index.js +232 -0
- package/dist/nosql/qdrant/index.js +295 -0
- package/dist/nosql/qldb/index.js +192 -0
- package/dist/nosql/r2/index.js +281 -0
- package/dist/nosql/rabbitmq/index.js +237 -0
- package/dist/nosql/ravendb/index.js +175 -0
- package/dist/nosql/redis/index.js +607 -0
- package/dist/nosql/redpanda/index.js +237 -0
- package/dist/nosql/resque/index.js +203 -0
- package/dist/nosql/rethinkdb/index.js +232 -0
- package/dist/nosql/rocksdb/index.js +152 -0
- package/dist/nosql/rockset/index.js +126 -0
- package/dist/nosql/s3/index.js +298 -0
- package/dist/nosql/scylladb/index.js +178 -0
- package/dist/nosql/signoz/index.js +227 -0
- package/dist/nosql/sns/index.js +201 -0
- package/dist/nosql/solr/index.js +231 -0
- package/dist/nosql/splunk/index.js +227 -0
- package/dist/nosql/sqs/index.js +246 -0
- package/dist/nosql/stardog/index.js +169 -0
- package/dist/nosql/starrocks/index.js +170 -0
- package/dist/nosql/store.js +2 -0
- package/dist/nosql/sumologic/index.js +213 -0
- package/dist/nosql/surrealdb/index.js +179 -0
- package/dist/nosql/terminusdb/index.js +151 -0
- package/dist/nosql/tigergraph/index.js +469 -0
- package/dist/nosql/typesense/index.js +148 -0
- package/dist/nosql/unqlite/index.js +157 -0
- package/dist/nosql/upstash/index.js +167 -0
- package/dist/nosql/vercel-kv/index.js +166 -0
- package/dist/nosql/victoriametrics/index.js +213 -0
- package/dist/nosql/virtuoso/index.js +169 -0
- package/dist/nosql/weaviate/index.js +276 -0
- package/dist/operators/index.js +108 -0
- package/dist/operators.js +2690 -0
- package/dist/prisma-migrate/index.js +38 -0
- package/dist/prisma-migrate/migration-generator.js +125 -0
- package/dist/prisma-migrate/model-generator.js +172 -0
- package/dist/prisma-migrate/relations.js +100 -0
- package/dist/prisma-migrate/schema-parser.js +167 -0
- package/dist/prisma-migrate/type-mapper.js +40 -0
- package/dist/prorm.js +6832 -0
- package/dist/query-builders/cte-builder.js +80 -0
- package/dist/query-builders/functions/aggregate.js +390 -0
- package/dist/query-builders/functions/conditional.js +503 -0
- package/dist/query-builders/functions/datetime.js +695 -0
- package/dist/query-builders/functions/fulltext.js +439 -0
- package/dist/query-builders/functions/index.js +93 -0
- package/dist/query-builders/functions/json.js +427 -0
- package/dist/query-builders/functions/math.js +399 -0
- package/dist/query-builders/functions/string.js +518 -0
- package/dist/query-builders/functions/window.js +328 -0
- package/dist/query-builders/include-builder.js +323 -0
- package/dist/query-builders/index-expression-builder.js +242 -0
- package/dist/query-builders/index.js +161 -0
- package/dist/query-builders/insert-builder.js +164 -0
- package/dist/query-builders/model-helpers.js +38 -0
- package/dist/query-builders/order-limit-builder.js +239 -0
- package/dist/query-builders/sql-compiler.js +2040 -0
- package/dist/query-builders/subquery-builder.js +152 -0
- package/dist/query-builders/update-builder.js +182 -0
- package/dist/query-builders/view-builder.js +218 -0
- package/dist/query-builders/where-builder.js +1532 -0
- package/dist/query-interface.js +622 -0
- package/dist/query-optimizers/batch-optimizer.js +426 -0
- package/dist/query-optimizers/explain-plans.js +415 -0
- package/dist/query-optimizers/index.js +51 -0
- package/dist/query-optimizers/prepared-statement-cache.js +423 -0
- package/dist/query-optimizers/query-hints.js +438 -0
- package/dist/query-optimizers/query-optimizer.js +278 -0
- package/dist/query-optimizers/slow-query-logger.js +271 -0
- package/dist/replica-manager.js +507 -0
- package/dist/schema/index.js +15 -0
- package/dist/schema/migration-generator.js +374 -0
- package/dist/schema/schema-differ.js +549 -0
- package/dist/schema/types.js +6 -0
- package/dist/sql-constants.js +300 -0
- package/dist/sqlite-advanced.js +1047 -0
- package/dist/streams/index.js +12 -0
- package/dist/streams/transforms.js +178 -0
- package/dist/transaction.js +456 -0
- package/dist/types/index.js +180 -0
- package/dist/user-management.js +127 -0
- package/dist/utils/date.js +300 -0
- package/dist/utils/index.js +1079 -0
- package/dist/utils/string.js +161 -0
- package/dist/validators/index.js +19 -0
- package/dist/validators/validator.js +911 -0
- package/package.json +190 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,1111 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Comprehensive Feature Reference
|
|
11
|
+
|
|
12
|
+
This section provides a complete reference of all ORM features organized by category.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Database Dialects
|
|
17
|
+
|
|
18
|
+
| Dialect | Status | Notes |
|
|
19
|
+
|---------|--------|-------|
|
|
20
|
+
| SQLite | ✅ Stable | In-memory, file-based, attach/detach |
|
|
21
|
+
| PostgreSQL | ✅ Stable | Full feature support |
|
|
22
|
+
| MySQL | ✅ Stable | InnoDB, MyISAM engines |
|
|
23
|
+
| MariaDB | ✅ Stable | MySQL compatible |
|
|
24
|
+
| MSSQL/SQL Server | ⚠️ Experimental | RLS, partitions, procedures, triggers, user management |
|
|
25
|
+
| Oracle | ⚠️ Experimental | Sequences, partitions, procedures, triggers, materialized views, user management |
|
|
26
|
+
|
|
27
|
+
### Dialect-Specific Features
|
|
28
|
+
|
|
29
|
+
**SQLite:**
|
|
30
|
+
- `attach(database, alias)` - Attach multiple databases
|
|
31
|
+
- `detach(alias)` - Detach database
|
|
32
|
+
- `backup(targetDb)` - Online backup
|
|
33
|
+
- `optimize()` - VACUUM and ANALYZE
|
|
34
|
+
- `pragma(name, value)` - Database pragmas
|
|
35
|
+
- Full-text search (FTS5)
|
|
36
|
+
- Window functions
|
|
37
|
+
- CTEs (Common Table Expressions)
|
|
38
|
+
- Recursive queries
|
|
39
|
+
- Savepoints
|
|
40
|
+
|
|
41
|
+
**PostgreSQL:**
|
|
42
|
+
- Foreign Data Wrappers (FDW)
|
|
43
|
+
- Database extensions
|
|
44
|
+
- User/Role management
|
|
45
|
+
- Row-level security (RLS)
|
|
46
|
+
- Partitioned tables
|
|
47
|
+
- Materialized views
|
|
48
|
+
- Window functions
|
|
49
|
+
- Array types
|
|
50
|
+
- JSON/JSONB
|
|
51
|
+
- HSTORE key-value
|
|
52
|
+
- Range types
|
|
53
|
+
|
|
54
|
+
**MySQL/MariaDB:**
|
|
55
|
+
- Storage engine selection
|
|
56
|
+
- Charset/Collation
|
|
57
|
+
- Partitioning
|
|
58
|
+
- Full-text search
|
|
59
|
+
- Spatial/GIS types
|
|
60
|
+
- Sequences (via AUTO_INCREMENT table pattern)
|
|
61
|
+
- Partial indexes
|
|
62
|
+
- Stored procedures and triggers
|
|
63
|
+
|
|
64
|
+
**Oracle:**
|
|
65
|
+
- Schema support
|
|
66
|
+
- Sequences with CYCLE and CACHE options
|
|
67
|
+
- Stored procedures and functions
|
|
68
|
+
- Triggers (BEFORE, AFTER, INSTEAD OF)
|
|
69
|
+
- Materialized views with FAST/COMPLETE refresh
|
|
70
|
+
- User and role management
|
|
71
|
+
- Partitioned tables (RANGE, LIST, HASH)
|
|
72
|
+
- Row-level security (VPD policies)
|
|
73
|
+
|
|
74
|
+
**MSSQL/SQL Server:**
|
|
75
|
+
- Schema support
|
|
76
|
+
- Sequences
|
|
77
|
+
- Stored procedures and functions
|
|
78
|
+
- Triggers (INSTEAD OF, AFTER)
|
|
79
|
+
- User and role management
|
|
80
|
+
- Partitioned tables
|
|
81
|
+
- Row-level security (Security Policies)
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Data Types
|
|
86
|
+
|
|
87
|
+
### String Types
|
|
88
|
+
- `STRING(length, binary)` - VARCHAR or TEXT
|
|
89
|
+
- `VARCHAR(length, binary)` - Variable-length
|
|
90
|
+
- `CHAR(length)` - Fixed-length
|
|
91
|
+
- `TEXT('tiny'|'medium'|'long')` - Unlimited text
|
|
92
|
+
|
|
93
|
+
### Number Types
|
|
94
|
+
- `INTEGER({length, unsigned, zerofill})` - 32-bit integer
|
|
95
|
+
- `BIGINT({length, unsigned, zerofill})` - 64-bit integer
|
|
96
|
+
- `FLOAT(precision)` - Floating-point
|
|
97
|
+
- `DOUBLE(precision)` - Double precision
|
|
98
|
+
- `DECIMAL(precision, scale, unsigned)` - Fixed-point
|
|
99
|
+
- `REAL` - Single precision
|
|
100
|
+
|
|
101
|
+
### Boolean & Date
|
|
102
|
+
- `BOOLEAN` - True/false
|
|
103
|
+
- `DATE(precision, timezone)` - DateTime with timezone
|
|
104
|
+
- `DATEONLY` - Date only (no time)
|
|
105
|
+
- `TIME(precision, timezone)` - Time only
|
|
106
|
+
- `NOW` - Current timestamp
|
|
107
|
+
|
|
108
|
+
### UUID & JSON
|
|
109
|
+
- `UUID` - Universal unique identifier
|
|
110
|
+
- `UUIDV4` - Auto-generate UUID v4
|
|
111
|
+
- `JSON(useNative)` - JSON object
|
|
112
|
+
- `JSONB(useNative)` - Binary JSON (PostgreSQL)
|
|
113
|
+
|
|
114
|
+
### Binary Types
|
|
115
|
+
- `BLOB('tiny'|'medium'|'long')` - Binary data
|
|
116
|
+
- `BINARY(length)` - Fixed binary
|
|
117
|
+
- `VARBINARY(length)` - Variable binary
|
|
118
|
+
|
|
119
|
+
### Enum & Array
|
|
120
|
+
- `ENUM(...values)` - Enumeration
|
|
121
|
+
- `ARRAY(type)` - PostgreSQL array
|
|
122
|
+
|
|
123
|
+
### Spatial & Network
|
|
124
|
+
- `GEOMETRY(type, srid)` - Spatial geometry
|
|
125
|
+
- `GEOGRAPHY(type, srid)` - Geographic coordinates
|
|
126
|
+
- `HSTORE(useNative)` - Key-value store (PostgreSQL)
|
|
127
|
+
- `RANGE(subtype)` - Range types (PostgreSQL)
|
|
128
|
+
- `INET` - IPv4/IPv6 address
|
|
129
|
+
- `CIDR` - Network address
|
|
130
|
+
- `MACADDR` - MAC address
|
|
131
|
+
|
|
132
|
+
### Special Types
|
|
133
|
+
- `INTERVAL` - Time interval
|
|
134
|
+
- `DECIMAL(precision, scale)` - Numeric with precision
|
|
135
|
+
- `NUMBER` - Generic number
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Query Operators (Op)
|
|
140
|
+
|
|
141
|
+
### Comparison Operators
|
|
142
|
+
- `Op.eq` / `Op.ne` - Equal / Not equal
|
|
143
|
+
- `Op.gt` / `Op.gte` - Greater than / Greater or equal
|
|
144
|
+
- `Op.lt` / `Op.lte` - Less than / Less or equal
|
|
145
|
+
|
|
146
|
+
### Set Membership
|
|
147
|
+
- `Op.in` - Value in array
|
|
148
|
+
- `Op.notIn` - Value not in array
|
|
149
|
+
|
|
150
|
+
### Range Operators
|
|
151
|
+
- `Op.between` - Between range (inclusive)
|
|
152
|
+
- `Op.notBetween` - Not between range
|
|
153
|
+
|
|
154
|
+
### Pattern Matching
|
|
155
|
+
- `Op.like` / `Op.notLike` - LIKE pattern match
|
|
156
|
+
- `Op.iLike` / `Op.notILike` - Case-insensitive LIKE
|
|
157
|
+
- `Op.regexp` / `Op.notRegexp` - Regular expression
|
|
158
|
+
- `Op.iRegexp` / `Op.notIRegexp` - Case-insensitive regex
|
|
159
|
+
- `Op.startsWith` / `Op.notStartsWith` - Prefix match
|
|
160
|
+
- `Op.endsWith` / `Op.notEndsWith` - Suffix match
|
|
161
|
+
- `Op.substring` / `Op.notSubstring` - Substring match
|
|
162
|
+
- `Op.match` - Full-text search (MySQL/PostgreSQL)
|
|
163
|
+
|
|
164
|
+
### Null Checks
|
|
165
|
+
- `Op.isNull` - IS NULL
|
|
166
|
+
- `Op.isNotNull` - IS NOT NULL
|
|
167
|
+
|
|
168
|
+
### Logical Operators
|
|
169
|
+
- `Op.and` - AND conjunction
|
|
170
|
+
- `Op.or` - OR disjunction
|
|
171
|
+
- `Op.not` - NOT negation
|
|
172
|
+
|
|
173
|
+
### JSON/Array Operators
|
|
174
|
+
- `Op.contains` - Contains (JSON/array)
|
|
175
|
+
- `Op.overlap` - Overlap (array)
|
|
176
|
+
- `Op.all` - ALL array elements
|
|
177
|
+
- `Op.any` - ANY array element
|
|
178
|
+
- `Op.adjacent` - Adjacent ranges
|
|
179
|
+
|
|
180
|
+
### Existence Operators
|
|
181
|
+
- `Op.exists` / `Op.notExists` - EXISTS subquery
|
|
182
|
+
|
|
183
|
+
### Helper Functions
|
|
184
|
+
- `where()` - Create where clause
|
|
185
|
+
- `and()` - AND helper
|
|
186
|
+
- `or()` - OR helper
|
|
187
|
+
- `not()` - NOT helper
|
|
188
|
+
- `like()`, `iLike()` - Like helpers
|
|
189
|
+
- `between()`, `notBetween()` - Range helpers
|
|
190
|
+
- `inOp()`, `notIn()` - IN helpers
|
|
191
|
+
- `isNull()`, `isNotNull()` - NULL helpers
|
|
192
|
+
- `asc()`, `desc()` - Order helpers
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## CRUD Operations
|
|
197
|
+
|
|
198
|
+
### Create
|
|
199
|
+
- `Model.create(values, options)` - Insert record
|
|
200
|
+
- `Model.bulkCreate(records, options)` - Batch insert
|
|
201
|
+
- `Model.upsert(values, options)` - Insert or update
|
|
202
|
+
- `instance.save(options)` - Save instance
|
|
203
|
+
|
|
204
|
+
### Read
|
|
205
|
+
- `Model.findAll(options)` - Find all matching
|
|
206
|
+
- `Model.findOne(options)` - Find first match
|
|
207
|
+
- `Model.findByPk(pk, options)` - Find by primary key
|
|
208
|
+
- `Model.findOrCreate(options)` - Find or create
|
|
209
|
+
- `Model.findAndCountAll(options)` - Find with count
|
|
210
|
+
|
|
211
|
+
### Update
|
|
212
|
+
- `Model.update(values, options)` - Update matching
|
|
213
|
+
- `instance.update(values, options)` - Update instance
|
|
214
|
+
- `instance.save(options)` - Persist changes
|
|
215
|
+
|
|
216
|
+
### Delete
|
|
217
|
+
- `Model.destroy(options)` - Delete matching
|
|
218
|
+
- `instance.destroy(options)` - Delete instance
|
|
219
|
+
- `Model.truncate(options)` - Truncate table
|
|
220
|
+
|
|
221
|
+
### Aggregates
|
|
222
|
+
- `Model.count(options)` - COUNT(*)
|
|
223
|
+
- `Model.sum(field, options)` - SUM(field)
|
|
224
|
+
- `Model.min(field, options)` - MIN(field)
|
|
225
|
+
- `Model.max(field, options)` - MAX(field)
|
|
226
|
+
- `Model.avg(field, options)` - AVG(field)
|
|
227
|
+
- `Model.increment(fields, options)` - Atomic increment
|
|
228
|
+
- `Model.decrement(fields, options)` - Atomic decrement
|
|
229
|
+
|
|
230
|
+
### Instance Methods
|
|
231
|
+
- `instance.get(key)` - Get field value
|
|
232
|
+
- `instance.set(key, value)` - Set field value
|
|
233
|
+
- `instance.changed()` - Get changed fields
|
|
234
|
+
- `instance.previous(key)` - Get previous value
|
|
235
|
+
- `instance.reload(options)` - Reload from DB
|
|
236
|
+
|
|
237
|
+
### Raw Queries
|
|
238
|
+
- `prorm.query(sql, options)` - Raw SQL
|
|
239
|
+
- `Model.rawQuery(sql, options)` - Raw with model
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## Query Options
|
|
244
|
+
|
|
245
|
+
### Where Clause
|
|
246
|
+
```typescript
|
|
247
|
+
{
|
|
248
|
+
where: {
|
|
249
|
+
field: value,
|
|
250
|
+
field: { [Op.operator]: value },
|
|
251
|
+
[Op.and]: [{ field: value }, { field: value }],
|
|
252
|
+
[Op.or]: [{ field: value }, { field: value }],
|
|
253
|
+
[Op.not]: { field: value }
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### Include (Joins)
|
|
259
|
+
```typescript
|
|
260
|
+
{
|
|
261
|
+
include: [
|
|
262
|
+
{ model: OtherModel, as: 'alias' },
|
|
263
|
+
{ model: OtherModel, where: { ... }, required: true },
|
|
264
|
+
{ model: ThroughModel, through: { where: { ... } } }
|
|
265
|
+
]
|
|
266
|
+
}
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### Attributes
|
|
270
|
+
```typescript
|
|
271
|
+
{
|
|
272
|
+
attributes: ['id', 'name'],
|
|
273
|
+
attributes: { include: ['id'], exclude: ['password'] }
|
|
274
|
+
}
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
### Ordering & Grouping
|
|
278
|
+
```typescript
|
|
279
|
+
{
|
|
280
|
+
order: [['name', 'ASC'], ['createdAt', 'DESC']],
|
|
281
|
+
group: 'category',
|
|
282
|
+
having: { count: { [Op.gt]: 10 } }
|
|
283
|
+
}
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### Pagination
|
|
287
|
+
```typescript
|
|
288
|
+
{
|
|
289
|
+
limit: 10,
|
|
290
|
+
offset: 20
|
|
291
|
+
}
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### Locking
|
|
295
|
+
```typescript
|
|
296
|
+
{
|
|
297
|
+
lock: Transaction.LOCK.UPDATE,
|
|
298
|
+
lock: Transaction.LOCK.SHARE
|
|
299
|
+
}
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
304
|
+
## Associations
|
|
305
|
+
|
|
306
|
+
### Association Types
|
|
307
|
+
- `Model.hasOne(Target, options)` - One-to-One
|
|
308
|
+
- `Model.hasMany(Target, options)` - One-to-Many
|
|
309
|
+
- `Model.belongsTo(Target, options)` - Many-to-One
|
|
310
|
+
- `Model.belongsToMany(Target, { through })` - Many-to-Many
|
|
311
|
+
|
|
312
|
+
### Association Options
|
|
313
|
+
- `as` - Alias
|
|
314
|
+
- `foreignKey` - Foreign key name
|
|
315
|
+
- `otherKey` - Target key (belongsToMany)
|
|
316
|
+
- `onDelete` - CASCADE/SET NULL/RESTRICT
|
|
317
|
+
- `onUpdate` - CASCADE/SET NULL/RESTRICT
|
|
318
|
+
- `through` - Junction model
|
|
319
|
+
- `constraints` - Enable/disable FK constraints
|
|
320
|
+
|
|
321
|
+
### Association Methods (Auto-generated)
|
|
322
|
+
- `instance.getAlias()` - Get associated
|
|
323
|
+
- `instance.setAlias(value)` - Set associated
|
|
324
|
+
- `instance.createAlias()` - Create associated
|
|
325
|
+
- `instance.addAlias()` - Add to association
|
|
326
|
+
- `instance.removeAlias()` - Remove from association
|
|
327
|
+
- `instance.hasAlias()` - Check membership
|
|
328
|
+
- `instance.countAlias()` - Count associated
|
|
329
|
+
|
|
330
|
+
### Special Associations
|
|
331
|
+
- Self-referencing (tree structures)
|
|
332
|
+
- Composite primary keys
|
|
333
|
+
- Custom join table names
|
|
334
|
+
- Non-unique foreign keys
|
|
335
|
+
- Polymorphic associations
|
|
336
|
+
|
|
337
|
+
### Eager Loading
|
|
338
|
+
- `include: [{ model: X }]` - Load with
|
|
339
|
+
- `{ all: true }` - Load all associations
|
|
340
|
+
- `{ nested: true }` - Recursive load
|
|
341
|
+
- `{ where: {} }` - Filter included
|
|
342
|
+
- `{ required: true }` - INNER JOIN
|
|
343
|
+
|
|
344
|
+
---
|
|
345
|
+
|
|
346
|
+
## Hooks / Lifecycle Events
|
|
347
|
+
|
|
348
|
+
### Model Hooks
|
|
349
|
+
- `beforeValidate` / `afterValidate`
|
|
350
|
+
- `beforeCreate` / `afterCreate`
|
|
351
|
+
- `beforeUpdate` / `afterUpdate`
|
|
352
|
+
- `beforeSave` / `afterSave`
|
|
353
|
+
- `beforeDestroy` / `afterDestroy`
|
|
354
|
+
- `beforeUpsert` / `afterUpsert`
|
|
355
|
+
- `beforeBulkCreate` / `afterBulkCreate`
|
|
356
|
+
- `beforeBulkUpdate` / `afterBulkUpdate`
|
|
357
|
+
- `beforeBulkDestroy` / `afterBulkDestroy`
|
|
358
|
+
- `beforeFind` / `afterFind`
|
|
359
|
+
- `beforeCount` / `afterCount`
|
|
360
|
+
|
|
361
|
+
### Instance Hooks
|
|
362
|
+
- `beforeDefine` / `afterDefine`
|
|
363
|
+
- `beforeSync` / `afterSync`
|
|
364
|
+
- `beforeConnect` / `afterConnect`
|
|
365
|
+
- `beforeDisconnect` / `afterDisconnect`
|
|
366
|
+
|
|
367
|
+
### Hook Options
|
|
368
|
+
- `hooks: { beforeCreate: fn }` - Define in model
|
|
369
|
+
- `model.addHook('hook', fn)` - Add after definition
|
|
370
|
+
- `{ hooks: false }` - Disable hooks
|
|
371
|
+
- `{ validate: false }` - Skip validation
|
|
372
|
+
|
|
373
|
+
---
|
|
374
|
+
|
|
375
|
+
## Validators
|
|
376
|
+
|
|
377
|
+
### Built-in Validators
|
|
378
|
+
- `notNull` - Not null
|
|
379
|
+
- `notEmpty` - Not empty string
|
|
380
|
+
- `isEmail` - Valid email
|
|
381
|
+
- `isUrl` - Valid URL
|
|
382
|
+
- `isIP` - IP address
|
|
383
|
+
- `isIPv4` / `isIPv6` - Specific IP
|
|
384
|
+
- `isAlpha` - Letters only
|
|
385
|
+
- `isAlphanumeric` - Letters and numbers
|
|
386
|
+
- `isNumeric` - Numbers only
|
|
387
|
+
- `isInt` / `isFloat` - Number types
|
|
388
|
+
- `isDecimal` - Decimal numbers
|
|
389
|
+
- `isLowercase` / `isUppercase` - Case
|
|
390
|
+
- `isDate` - Valid date
|
|
391
|
+
- `isAfter(date)` - After date
|
|
392
|
+
- `isBefore(date)` - Before date
|
|
393
|
+
- `isIn(array)` - In array
|
|
394
|
+
- `notIn(array)` - Not in array
|
|
395
|
+
- `len(min, max)` - Length check
|
|
396
|
+
- `min` / `max` - Numeric bounds
|
|
397
|
+
- `matches(regex)` - Regex match
|
|
398
|
+
- `contains(str)` - Contains substring
|
|
399
|
+
- `notContains(str)` - Not contains
|
|
400
|
+
- `isCreditCard` - Credit card number
|
|
401
|
+
- `isFQDN` - Fully qualified domain
|
|
402
|
+
- `isUUID` - UUID format
|
|
403
|
+
- `isDateString` - Date string
|
|
404
|
+
|
|
405
|
+
### Custom Validators
|
|
406
|
+
```typescript
|
|
407
|
+
{
|
|
408
|
+
validate: {
|
|
409
|
+
myValidator(value) {
|
|
410
|
+
if (condition) throw new Error('Invalid');
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
### Cross-field Validation
|
|
417
|
+
```typescript
|
|
418
|
+
{
|
|
419
|
+
validate: {
|
|
420
|
+
passwordMatch() {
|
|
421
|
+
if (this.password !== this.confirmPassword) {
|
|
422
|
+
throw new Error('Passwords do not match');
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
---
|
|
430
|
+
|
|
431
|
+
## Scopes
|
|
432
|
+
|
|
433
|
+
### Default Scope
|
|
434
|
+
```typescript
|
|
435
|
+
{
|
|
436
|
+
defaultScope: {
|
|
437
|
+
where: { active: true },
|
|
438
|
+
order: ['createdAt', 'DESC']
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
### Named Scopes
|
|
444
|
+
```typescript
|
|
445
|
+
{
|
|
446
|
+
scopes: {
|
|
447
|
+
active: { where: { active: true } },
|
|
448
|
+
popular: { where: { views: { [Op.gt]: 100 } } },
|
|
449
|
+
recent: (days) => ({
|
|
450
|
+
where: {
|
|
451
|
+
createdAt: { [Op.gte]: daysAgo(days) }
|
|
452
|
+
}
|
|
453
|
+
})
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
### Scope Methods
|
|
459
|
+
- `Model.scope('name')` - Apply scope
|
|
460
|
+
- `Model.scope(['a', 'b'])` - Combine scopes
|
|
461
|
+
- `Model.unscoped()` - Remove default scope
|
|
462
|
+
- `Model.addScope('name', options)` - Add scope dynamically
|
|
463
|
+
|
|
464
|
+
---
|
|
465
|
+
|
|
466
|
+
## Transactions
|
|
467
|
+
|
|
468
|
+
### Transaction Types
|
|
469
|
+
- `prorm.transaction(fn)` - Managed (auto commit/rollback)
|
|
470
|
+
- `prorm.transaction()` - Manual transaction
|
|
471
|
+
|
|
472
|
+
### Transaction Options
|
|
473
|
+
```typescript
|
|
474
|
+
{
|
|
475
|
+
isolationLevel: Transaction.ISOLATION_LEVELS.READ_COMMITTED,
|
|
476
|
+
type: Transaction.TYPES.DEFERRED
|
|
477
|
+
}
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
### Isolation Levels
|
|
481
|
+
- `READ_UNCOMMITTED`
|
|
482
|
+
- `READ_COMMITTED`
|
|
483
|
+
- `REPEATABLE_READ`
|
|
484
|
+
- `SERIALIZABLE`
|
|
485
|
+
|
|
486
|
+
### Transaction Types (SQLite)
|
|
487
|
+
- `DEFERRED`
|
|
488
|
+
- `IMMEDIATE`
|
|
489
|
+
- `EXCLUSIVE`
|
|
490
|
+
|
|
491
|
+
### Locking
|
|
492
|
+
- `LOCK.UPDATE` - Pessimistic write lock
|
|
493
|
+
- `LOCK.SHARE` - Pessimistic read lock
|
|
494
|
+
|
|
495
|
+
### Savepoints
|
|
496
|
+
- `t.savepoint(name)` - Create savepoint
|
|
497
|
+
- `t.rollbackTo(name)` - Rollback to savepoint
|
|
498
|
+
- `t.releaseSavepoint(name)` - Release savepoint
|
|
499
|
+
|
|
500
|
+
---
|
|
501
|
+
|
|
502
|
+
## Indexes & Constraints
|
|
503
|
+
|
|
504
|
+
### Index Types
|
|
505
|
+
- `primaryKey` - Primary key (auto)
|
|
506
|
+
- `unique` - Unique index
|
|
507
|
+
- `index` - Regular index
|
|
508
|
+
- `fulltext` - Full-text search
|
|
509
|
+
- `spatial` - Spatial index
|
|
510
|
+
|
|
511
|
+
### Index Options
|
|
512
|
+
```typescript
|
|
513
|
+
{
|
|
514
|
+
indexes: [
|
|
515
|
+
{ fields: ['email'], unique: true },
|
|
516
|
+
{ fields: [{ attribute: 'name', length: 10 }] },
|
|
517
|
+
{ fields: ['status'], where: { deletedAt: null } }, // Partial
|
|
518
|
+
{ fields: [{ expression: 'LOWER(name)' }] }, // Functional
|
|
519
|
+
{ type: 'BTREE' | 'HASH' | 'GIN' | 'GiST' | 'BRIN' }
|
|
520
|
+
]
|
|
521
|
+
}
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
### Constraints
|
|
525
|
+
- `primaryKey` - Primary key
|
|
526
|
+
- `unique` - Unique constraint
|
|
527
|
+
- `foreignKey` - Foreign key
|
|
528
|
+
- `check` - CHECK constraint
|
|
529
|
+
- `exclusion` - Exclusion (PostgreSQL)
|
|
530
|
+
|
|
531
|
+
### Foreign Key Actions
|
|
532
|
+
- `onDelete`: CASCADE / SET NULL / RESTRICT / NO ACTION
|
|
533
|
+
- `onUpdate`: CASCADE / SET NULL / RESTRICT / NO ACTION
|
|
534
|
+
|
|
535
|
+
---
|
|
536
|
+
|
|
537
|
+
## Migrations
|
|
538
|
+
|
|
539
|
+
### Migration Class
|
|
540
|
+
```typescript
|
|
541
|
+
class Migration20240101 extends Migration {
|
|
542
|
+
async up(queryInterface, Prorm) {
|
|
543
|
+
await queryInterface.createTable('users', { ... });
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
async down(queryInterface, Prorm) {
|
|
547
|
+
await queryInterface.dropTable('users');
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
### Query Interface Methods
|
|
553
|
+
- `createTable` / `dropTable`
|
|
554
|
+
- `addColumn` / `removeColumn` / `changeColumn`
|
|
555
|
+
- `renameColumn` / `renameTable`
|
|
556
|
+
- `addIndex` / `removeIndex`
|
|
557
|
+
- `addConstraint` / `removeConstraint`
|
|
558
|
+
- `createView` / `dropView`
|
|
559
|
+
- `createSchema` / `dropSchema`
|
|
560
|
+
- `bulkInsert` / `bulkDelete` / `bulkUpdate`
|
|
561
|
+
|
|
562
|
+
### CLI Commands
|
|
563
|
+
- `orm migration:create` - Generate migration
|
|
564
|
+
- `orm db:migrate` - Run migrations
|
|
565
|
+
- `orm db:migrate:undo` - Undo last
|
|
566
|
+
- `orm db:migrate:undo:all` - Undo all
|
|
567
|
+
- `orm db:migrate:status` - Show status
|
|
568
|
+
- `orm db:seed` - Run seeders
|
|
569
|
+
- `orm db:seed:undo` - Undo seeders
|
|
570
|
+
|
|
571
|
+
---
|
|
572
|
+
|
|
573
|
+
## Soft Deletes (Paranoid)
|
|
574
|
+
|
|
575
|
+
### Enable
|
|
576
|
+
```typescript
|
|
577
|
+
{
|
|
578
|
+
paranoid: true, // Adds deletedAt column
|
|
579
|
+
deletedAt: 'deletedAt' // Custom column name
|
|
580
|
+
}
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
### Operations
|
|
584
|
+
- `destroy()` - Sets deletedAt (soft delete)
|
|
585
|
+
- `destroy({ force: true })` - Hard delete
|
|
586
|
+
- `restore()` - Restore soft-deleted
|
|
587
|
+
- `findAll({ paranoid: false })` - Include deleted
|
|
588
|
+
|
|
589
|
+
---
|
|
590
|
+
|
|
591
|
+
## Virtual Fields
|
|
592
|
+
|
|
593
|
+
### Define
|
|
594
|
+
```typescript
|
|
595
|
+
{
|
|
596
|
+
fullName: {
|
|
597
|
+
type: DataTypes.VIRTUAL,
|
|
598
|
+
get() { return `${this.firstName} ${this.lastName}`; }
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
### With Setter
|
|
604
|
+
```typescript
|
|
605
|
+
{
|
|
606
|
+
name: {
|
|
607
|
+
type: DataTypes.VIRTUAL,
|
|
608
|
+
get() { return this.getDataValue('name'); },
|
|
609
|
+
set(value) { this.setDataValue('name', value.toUpperCase()); }
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
```
|
|
613
|
+
|
|
614
|
+
---
|
|
615
|
+
|
|
616
|
+
## Connection Pool
|
|
617
|
+
|
|
618
|
+
### Configuration
|
|
619
|
+
```typescript
|
|
620
|
+
{
|
|
621
|
+
pool: {
|
|
622
|
+
min: 2,
|
|
623
|
+
max: 10,
|
|
624
|
+
idle: 10000,
|
|
625
|
+
acquire: 30000,
|
|
626
|
+
evict: 1000
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
### Pool Events
|
|
632
|
+
- `acquire` / `release`
|
|
633
|
+
- `create` / `destroy`
|
|
634
|
+
- `error` / `enqueue` / `dequeue`
|
|
635
|
+
- `timeout` / `health-check`
|
|
636
|
+
|
|
637
|
+
### Pool Metrics
|
|
638
|
+
```typescript
|
|
639
|
+
pool.metrics.size // Total pool size
|
|
640
|
+
pool.metrics.available // Available connections
|
|
641
|
+
pool.metrics.inUse // In-use connections
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
---
|
|
645
|
+
|
|
646
|
+
## Query Optimization
|
|
647
|
+
|
|
648
|
+
### Slow Query Logger
|
|
649
|
+
```typescript
|
|
650
|
+
{
|
|
651
|
+
slowQueryThreshold: 1000,
|
|
652
|
+
alertThreshold: 5000,
|
|
653
|
+
onSlowQuery: (sql, timing) => { ... }
|
|
654
|
+
}
|
|
655
|
+
```
|
|
656
|
+
|
|
657
|
+
### Explain Plans
|
|
658
|
+
```typescript
|
|
659
|
+
{
|
|
660
|
+
explain: {
|
|
661
|
+
format: 'JSON' | 'TEXT' | 'XML' | 'YAML'
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
```
|
|
665
|
+
|
|
666
|
+
### Prepared Statements
|
|
667
|
+
```typescript
|
|
668
|
+
{
|
|
669
|
+
preparedStatements: true,
|
|
670
|
+
cachePreparedStatements: 100 // LRU cache size
|
|
671
|
+
}
|
|
672
|
+
```
|
|
673
|
+
|
|
674
|
+
### Query Hints
|
|
675
|
+
- MySQL: `USE INDEX`, `FORCE INDEX`
|
|
676
|
+
- PostgreSQL: `SET`, `hint`
|
|
677
|
+
|
|
678
|
+
### Batch Optimizer
|
|
679
|
+
```typescript
|
|
680
|
+
{
|
|
681
|
+
batchSize: 1000,
|
|
682
|
+
useTransaction: true,
|
|
683
|
+
onProgress: (completed, total) => { ... }
|
|
684
|
+
}
|
|
685
|
+
```
|
|
686
|
+
|
|
687
|
+
---
|
|
688
|
+
|
|
689
|
+
## Decorators
|
|
690
|
+
|
|
691
|
+
### Security
|
|
692
|
+
- `@Secure` - Password hashing
|
|
693
|
+
- `@SecureField` - Field-level encryption
|
|
694
|
+
- `createBcryptAdapter()` - Bcrypt hashing
|
|
695
|
+
- `createArgon2Adapter()` - Argon2 hashing
|
|
696
|
+
|
|
697
|
+
### Database Objects
|
|
698
|
+
- `@Procedure` - Stored procedure
|
|
699
|
+
- `@SqlFunction` - SQL function
|
|
700
|
+
- `@View` - Database view
|
|
701
|
+
|
|
702
|
+
### Permissions
|
|
703
|
+
- `@CanView` / `@CannotView`
|
|
704
|
+
- `@CanWrite` / `@CannotWrite`
|
|
705
|
+
- `@Permission` - Field-level permissions
|
|
706
|
+
- `filterByPermissions()` - Filter output
|
|
707
|
+
- `filterWriteByPermissions()` - Filter input
|
|
708
|
+
|
|
709
|
+
### Field Mapping
|
|
710
|
+
- `@Column` - Column name mapping
|
|
711
|
+
- `@Table` - Table configuration
|
|
712
|
+
- `@Index` - Index definition
|
|
713
|
+
- `@ForeignKey` - Foreign key
|
|
714
|
+
- `@Comment` - Documentation
|
|
715
|
+
- `@Default` - Default value
|
|
716
|
+
- `@Generated` - Auto-generated
|
|
717
|
+
- `@Check` - Check constraint
|
|
718
|
+
|
|
719
|
+
### Type Decorators
|
|
720
|
+
- `@HStore` - PostgreSQL HSTORE
|
|
721
|
+
- `@JsonColumn` / `@Jsonb` - JSON column
|
|
722
|
+
- `@Range` - PostgreSQL range
|
|
723
|
+
- `@SetColumn` - Set column type
|
|
724
|
+
- `@Spatial` - Spatial type
|
|
725
|
+
- `@Uuid` - UUID type
|
|
726
|
+
|
|
727
|
+
---
|
|
728
|
+
|
|
729
|
+
## CLI Commands
|
|
730
|
+
|
|
731
|
+
### Model Generation
|
|
732
|
+
```bash
|
|
733
|
+
orm model:generate --name User --attributes name:string,email:string
|
|
734
|
+
```
|
|
735
|
+
|
|
736
|
+
### Migration
|
|
737
|
+
```bash
|
|
738
|
+
orm migration:create --name add_field
|
|
739
|
+
orm db:migrate
|
|
740
|
+
orm db:migrate:undo
|
|
741
|
+
```
|
|
742
|
+
|
|
743
|
+
### Database
|
|
744
|
+
```bash
|
|
745
|
+
orm db:seed
|
|
746
|
+
orm db:seed:undo
|
|
747
|
+
orm db:migrate:status
|
|
748
|
+
```
|
|
749
|
+
|
|
750
|
+
### Diagram Generation
|
|
751
|
+
```bash
|
|
752
|
+
orm diagram:model --file User.json --out User.svg
|
|
753
|
+
orm diagram:er --file schema.json --out schema.svg
|
|
754
|
+
```
|
|
755
|
+
|
|
756
|
+
---
|
|
757
|
+
|
|
758
|
+
## SQLite Advanced Features
|
|
759
|
+
|
|
760
|
+
### Views
|
|
761
|
+
- `createView(name, definition)`
|
|
762
|
+
- `dropView(name)`
|
|
763
|
+
- `listViews()`
|
|
764
|
+
- `getViewDefinition(name)`
|
|
765
|
+
|
|
766
|
+
### Triggers
|
|
767
|
+
- `createTrigger(name, table, event, action)`
|
|
768
|
+
- `createAfterInsertTrigger(name, table, action)`
|
|
769
|
+
- `createAfterUpdateTrigger(name, table, action)`
|
|
770
|
+
- `createAfterDeleteTrigger(name, table, action)`
|
|
771
|
+
- `createBeforeInsertTrigger(name, table, action)`
|
|
772
|
+
- `createInsteadOfTrigger(name, table, action)`
|
|
773
|
+
- `dropTrigger(name)`
|
|
774
|
+
- `listTriggers()`
|
|
775
|
+
|
|
776
|
+
### Full-Text Search (FTS5)
|
|
777
|
+
- `createFTS5Table(name, columns)`
|
|
778
|
+
- `createFTS5FromTable(source, fts)`
|
|
779
|
+
- `fullTextSearch(table, query)`
|
|
780
|
+
- `fts5Search(ftsTable, query)`
|
|
781
|
+
- `rebuildFTS5(table)`
|
|
782
|
+
- `optimizeFTS5(table)`
|
|
783
|
+
|
|
784
|
+
### JSON Functions
|
|
785
|
+
- `jsonExtract(column, path)`
|
|
786
|
+
- `jsonSet(column, path, value)`
|
|
787
|
+
- `jsonArrayAppend(column, path, value)`
|
|
788
|
+
- `jsonRemove(column, path)`
|
|
789
|
+
- `jsonArrayLength(column, path)`
|
|
790
|
+
- `jsonContains(column, value)`
|
|
791
|
+
- `jsonEach(column, path)` - As table
|
|
792
|
+
- `jsonTree(column, path)` - As tree
|
|
793
|
+
|
|
794
|
+
### Window Functions
|
|
795
|
+
- `rowNumber()`
|
|
796
|
+
- `rank()`
|
|
797
|
+
- `denseRank()`
|
|
798
|
+
- `ntile(n)`
|
|
799
|
+
- `lag(column, offset, default)`
|
|
800
|
+
- `lead(column, offset, default)`
|
|
801
|
+
- `firstValue(column)`
|
|
802
|
+
- `lastValue(column)`
|
|
803
|
+
- `nthValue(column, n)`
|
|
804
|
+
|
|
805
|
+
### CTEs (Common Table Expressions)
|
|
806
|
+
- `buildCTE(name, columns, query, recursive)`
|
|
807
|
+
- `executeRecursiveCTE(cte, baseCase, recursiveCase)`
|
|
808
|
+
|
|
809
|
+
### Database Management
|
|
810
|
+
- `vacuum(options)` - Optimize database
|
|
811
|
+
- `analyze(target)` - Update statistics
|
|
812
|
+
- `getTableStats(table)`
|
|
813
|
+
- `getIndexStats(index)`
|
|
814
|
+
- `reindex(target)`
|
|
815
|
+
- `pragma(name, value)`
|
|
816
|
+
|
|
817
|
+
### Savepoints
|
|
818
|
+
- `savepoint(name)`
|
|
819
|
+
- `releaseSavepoint(name)`
|
|
820
|
+
- `rollbackToSavepoint(name)`
|
|
821
|
+
- `withSavepoint(name, fn)`
|
|
822
|
+
|
|
823
|
+
### Extensions
|
|
824
|
+
- `loadExtension(path)`
|
|
825
|
+
- `setExtensionLoading(enabled)`
|
|
826
|
+
- `getLoadedExtensions()`
|
|
827
|
+
|
|
828
|
+
---
|
|
829
|
+
|
|
830
|
+
## PostgreSQL Features
|
|
831
|
+
|
|
832
|
+
### Foreign Data Wrappers
|
|
833
|
+
- `createServer(name, options)`
|
|
834
|
+
- `createUserMapping(server, user, options)`
|
|
835
|
+
- `createForeignTable(name, server, columns)`
|
|
836
|
+
- `importForeignSchema(remoteServer, remoteSchema)`
|
|
837
|
+
- `listServers()`
|
|
838
|
+
- `dropForeignTable(name)`
|
|
839
|
+
|
|
840
|
+
### Extensions
|
|
841
|
+
- `createExtension(name)`
|
|
842
|
+
- `dropExtension(name)`
|
|
843
|
+
- `listExtensions()`
|
|
844
|
+
|
|
845
|
+
### User Management
|
|
846
|
+
- `createUser(name, options)`
|
|
847
|
+
- `createRole(name, options)`
|
|
848
|
+
- `grantRole(user, role)`
|
|
849
|
+
- `grant(privilege, object, to)`
|
|
850
|
+
- `revoke(privilege, object, from)`
|
|
851
|
+
- `listUsers()`
|
|
852
|
+
- `listPrivileges(user)`
|
|
853
|
+
|
|
854
|
+
### Row-Level Security
|
|
855
|
+
- Enable on table with RLS policy
|
|
856
|
+
- `createPolicy(name, table, using, with_check)`
|
|
857
|
+
- `dropPolicy(name, table)`
|
|
858
|
+
|
|
859
|
+
### Materialized Views
|
|
860
|
+
- `createMaterializedView(name, query)`
|
|
861
|
+
- `refreshMaterializedView(name)`
|
|
862
|
+
- `dropMaterializedView(name)`
|
|
863
|
+
|
|
864
|
+
---
|
|
865
|
+
|
|
866
|
+
## Error Classes
|
|
867
|
+
|
|
868
|
+
### Core Errors
|
|
869
|
+
- `PrormError` - Base error
|
|
870
|
+
- `ConnectionError` - Connection failures
|
|
871
|
+
- `DatabaseError` - SQL errors
|
|
872
|
+
- `ValidationError` - Validation failures
|
|
873
|
+
|
|
874
|
+
### Constraint Errors
|
|
875
|
+
- `UniqueConstraintError` - Duplicate key
|
|
876
|
+
- `ForeignKeyConstraintError` - FK violation
|
|
877
|
+
- `ExclusionConstraintError` - Exclusion violation
|
|
878
|
+
|
|
879
|
+
### Other Errors
|
|
880
|
+
- `TimeoutError` - Connection/query timeout
|
|
881
|
+
- `ResourceLockedError` - Deadlock/lock conflict
|
|
882
|
+
- `BulkRecordError` - Bulk operation error
|
|
883
|
+
- `AssociationError` - Association misuse
|
|
884
|
+
- `EmptyResultError` - No results found
|
|
885
|
+
|
|
886
|
+
### Error Helpers
|
|
887
|
+
- `isPrormError(error)`
|
|
888
|
+
- `isValidationError(error)`
|
|
889
|
+
- `isConnectionError(error)`
|
|
890
|
+
- `isConstraintError(error)`
|
|
891
|
+
- `isEmptyResultError(error)`
|
|
892
|
+
- `wrapError(error, message)`
|
|
893
|
+
- `formatError(error)`
|
|
894
|
+
|
|
895
|
+
---
|
|
896
|
+
|
|
897
|
+
## Utilities
|
|
898
|
+
|
|
899
|
+
### Case Conversion
|
|
900
|
+
- `camelToSnake(str)`
|
|
901
|
+
- `snakeToCamel(str)`
|
|
902
|
+
- `camelToKebab(str)`
|
|
903
|
+
- `kebabToCamel(str)`
|
|
904
|
+
- `camelize(str)`
|
|
905
|
+
- `snakeCase(str)`
|
|
906
|
+
- `upperFirst(str)`
|
|
907
|
+
- `lowerFirst(str)`
|
|
908
|
+
|
|
909
|
+
### Inflection
|
|
910
|
+
- `pluralize(word)`
|
|
911
|
+
- `singularize(word)`
|
|
912
|
+
|
|
913
|
+
### Object Helpers
|
|
914
|
+
- `cloneDeep(obj)`
|
|
915
|
+
- `merge(target, source)`
|
|
916
|
+
- `pick(obj, keys)`
|
|
917
|
+
- `omit(obj, keys)`
|
|
918
|
+
- `isEmpty(obj)`
|
|
919
|
+
- `coalesce(...values)`
|
|
920
|
+
|
|
921
|
+
### UUID
|
|
922
|
+
- `generateUUID()`
|
|
923
|
+
- `generateShortUUID()`
|
|
924
|
+
- `isValidUUID(str)`
|
|
925
|
+
|
|
926
|
+
### SQL Formatting
|
|
927
|
+
- `formatValues(values, dialect)`
|
|
928
|
+
- `formatValue(value, dialect)`
|
|
929
|
+
- `escapeString(str, dialect)`
|
|
930
|
+
- `escapeId(identifier, dialect)`
|
|
931
|
+
- `formatWhere(where, dialect)`
|
|
932
|
+
- `escapeLike(pattern, dialect)`
|
|
933
|
+
|
|
934
|
+
### String Utilities
|
|
935
|
+
- `upperCase(str)`
|
|
936
|
+
- `lowerCase(str)`
|
|
937
|
+
- `capitalize(str)`
|
|
938
|
+
- `capitalizeWords(str)`
|
|
939
|
+
- `trim(str)`
|
|
940
|
+
- `padStart(str, length, char)`
|
|
941
|
+
- `padEnd(str, length, char)`
|
|
942
|
+
- `truncate(str, length)`
|
|
943
|
+
|
|
944
|
+
### Date Utilities
|
|
945
|
+
- `now()`
|
|
946
|
+
- `today()`
|
|
947
|
+
- `utcNow()`
|
|
948
|
+
- `dateToString(date)`
|
|
949
|
+
- `stringToDate(str)`
|
|
950
|
+
|
|
951
|
+
### Validation
|
|
952
|
+
- `isEmail(str)`
|
|
953
|
+
- `isURL(str)`
|
|
954
|
+
- `isUUID(str)`
|
|
955
|
+
- `isIP(str)`
|
|
956
|
+
- `isMobilePhone(str)`
|
|
957
|
+
|
|
958
|
+
---
|
|
959
|
+
|
|
960
|
+
## Logging
|
|
961
|
+
|
|
962
|
+
### Log Levels
|
|
963
|
+
- `LogLevel.DEBUG`
|
|
964
|
+
- `LogLevel.INFO`
|
|
965
|
+
- `LogLevel.WARN`
|
|
966
|
+
- `LogLevel.ERROR`
|
|
967
|
+
- `LogLevel.SILENT`
|
|
968
|
+
|
|
969
|
+
### Logger Methods
|
|
970
|
+
- `logger.debug(msg, meta)`
|
|
971
|
+
- `logger.info(msg, meta)`
|
|
972
|
+
- `logger.warn(msg, meta)`
|
|
973
|
+
- `logger.error(msg, meta)`
|
|
974
|
+
|
|
975
|
+
### SQL Logging
|
|
976
|
+
```typescript
|
|
977
|
+
{
|
|
978
|
+
logging: console.log // Console logging
|
|
979
|
+
logging: (sql) => { ... } // Custom function
|
|
980
|
+
logging: false // Disable
|
|
981
|
+
}
|
|
982
|
+
```
|
|
983
|
+
|
|
984
|
+
### Custom Logger
|
|
985
|
+
- `createLogger(options)`
|
|
986
|
+
- `createSilentLogger()`
|
|
987
|
+
- `getDefaultLogger()`
|
|
988
|
+
- `setDefaultLogger(logger)`
|
|
989
|
+
|
|
990
|
+
---
|
|
991
|
+
|
|
992
|
+
## Recent Additions
|
|
993
|
+
|
|
994
|
+
### Added (v1.0.0+)
|
|
995
|
+
|
|
996
|
+
#### Database Features Implemented Across All Dialects
|
|
997
|
+
- **Sequences**: Full implementation for PostgreSQL, MySQL, MariaDB, SQLite, Oracle, MSSQL
|
|
998
|
+
- `createSequence(name, options)` - Create sequence with start, increment, min/max, cycle options
|
|
999
|
+
- `dropSequence(name)` - Drop sequence
|
|
1000
|
+
- `nextSequenceValue(name)` - Get next value
|
|
1001
|
+
- `currSequenceValue(name)` - Get current value
|
|
1002
|
+
- `listSequences()` - List all sequences
|
|
1003
|
+
|
|
1004
|
+
- **Table Partitions**: Full implementation for all 6 dialects
|
|
1005
|
+
- `createPartition(table, type, ranges)` - Create table partition (RANGE, LIST, HASH)
|
|
1006
|
+
- `dropPartition(table, partition)` - Drop partition
|
|
1007
|
+
- `addPartition(table, partition)` - Add new partition
|
|
1008
|
+
- `listPartitions(table)` - List partitions
|
|
1009
|
+
|
|
1010
|
+
- **Partial Indexes**: Implementation for MySQL, MariaDB, PostgreSQL, Oracle, MSSQL
|
|
1011
|
+
- `createPartialIndex(table, indexName, fields, where, options)` - Partial/conditional index
|
|
1012
|
+
|
|
1013
|
+
- **Stored Procedures**: Full implementation with parameter support
|
|
1014
|
+
- `createProcedure(name, params, returnType, body)` - Create stored procedure
|
|
1015
|
+
- `dropProcedure(name)` - Drop procedure
|
|
1016
|
+
- `listProcedures(schema)` - List procedures
|
|
1017
|
+
|
|
1018
|
+
- **Triggers**: Full implementation with FOR EACH ROW and WHEN clause support
|
|
1019
|
+
- `createTrigger(options)` - Create trigger with timing, events, body, forEachRow, when
|
|
1020
|
+
- `dropTrigger(name, table)` - Drop trigger
|
|
1021
|
+
- `listTriggers(table)` - List triggers
|
|
1022
|
+
|
|
1023
|
+
- **Materialized Views**: Implementation for PostgreSQL and Oracle
|
|
1024
|
+
- `createMaterializedView(name, query, options)` - Create materialized view
|
|
1025
|
+
- `refreshMaterializedView(name, method)` - Refresh with COMPLETE or FAST
|
|
1026
|
+
- `dropMaterializedView(name)` - Drop view
|
|
1027
|
+
|
|
1028
|
+
- **User Management**: Implementation for Oracle, MSSQL, PostgreSQL
|
|
1029
|
+
- `createUser(name, options)` - Create database user with password, profile, quotas
|
|
1030
|
+
- `dropUser(name)` - Drop user
|
|
1031
|
+
- `createRole(name, options)` - Create role
|
|
1032
|
+
- `grant(privilege, object, to)` - Grant privileges
|
|
1033
|
+
- `revoke(privilege, object, from)` - Revoke privileges
|
|
1034
|
+
- `listUsers()` / `listRoles()` - List users and roles
|
|
1035
|
+
|
|
1036
|
+
- **Row-Level Security (RLS)**: Implementation for PostgreSQL, Oracle, MSSQL
|
|
1037
|
+
- PostgreSQL: `createPolicy(name, table, using, with_check)` with RLS enable
|
|
1038
|
+
- Oracle: VPD policies using `createPolicy()`
|
|
1039
|
+
- MSSQL: Security policies with `createSecurityPolicy()`
|
|
1040
|
+
|
|
1041
|
+
#### Association Enhancements
|
|
1042
|
+
- **Polymorphic Associations**: `polymorphicHasMany()`, `polymorphicBelongsTo()`
|
|
1043
|
+
- **Self-referential Associations**: `hasManyChildren()`, `belongsToParent()`
|
|
1044
|
+
|
|
1045
|
+
#### Dialect Status Updates
|
|
1046
|
+
- Oracle dialect support (experimental) - Now with sequences, stored procedures, triggers, materialized views
|
|
1047
|
+
- MSSQL/SQL Server dialect support (experimental) - Now with RLS, user management, partitions
|
|
1048
|
+
- New column type decorators: `@HStore`, `@JsonColumn`, `@Jsonb`, `@Range`, `@SetColumn`, `@Spatial`, `@Uuid`
|
|
1049
|
+
- Organized examples: `examples/advanced/`, `examples/basic/`, `examples/concepts/`, `examples/diagrams/`, `examples/real-world/`
|
|
1050
|
+
- New documentation: Events, MariaDB, MySQL, PostgreSQL guides
|
|
1051
|
+
- GitLab CI pipeline with matrix builds (Node 18/20/22), test, lint, coverage stages
|
|
1052
|
+
- GitLab Pages deployment for documentation
|
|
1053
|
+
- GitLab Package Registry publishing on tags
|
|
1054
|
+
- Pre-commit hooks with husky and lint-staged
|
|
1055
|
+
- SQLite advanced features: attach database, detach, backup, optimize
|
|
1056
|
+
- Stored procedures and functions support
|
|
1057
|
+
- Triggers support for automatic actions on insert/update/delete
|
|
1058
|
+
- Materialized views support
|
|
1059
|
+
- Full-text search with indexable columns
|
|
1060
|
+
- Check constraints for custom validation rules
|
|
1061
|
+
- Collation and charset configuration per column
|
|
1062
|
+
- Comment annotations for tables and columns
|
|
1063
|
+
- Database storage engine configuration (MySQL/MariaDB)
|
|
1064
|
+
- Timezone-aware timestamps
|
|
1065
|
+
- Generated/computed columns
|
|
1066
|
+
- Row-level security (PostgreSQL)
|
|
1067
|
+
- Composite foreign keys
|
|
1068
|
+
- Composite unique constraints
|
|
1069
|
+
- Partial indexes
|
|
1070
|
+
- Functional indexes
|
|
1071
|
+
- Partitioned tables (PostgreSQL, MySQL)
|
|
1072
|
+
- Window functions support
|
|
1073
|
+
- CTEs (Common Table Expressions) support
|
|
1074
|
+
- Recursive queries
|
|
1075
|
+
- Bulk operations with upsert
|
|
1076
|
+
- Named constraints
|
|
1077
|
+
- Foreign table wrappers (PostgreSQL)
|
|
1078
|
+
- User and role management (PostgreSQL, MySQL)
|
|
1079
|
+
- Privilege grants and revocations
|
|
1080
|
+
- Database extensions management
|
|
1081
|
+
- Seeder for test data population
|
|
1082
|
+
- Event system for custom events
|
|
1083
|
+
- Audit logging for changes tracking
|
|
1084
|
+
|
|
1085
|
+
### Changed
|
|
1086
|
+
- Improved TypeScript generic inference on `findAll` return types
|
|
1087
|
+
- Stricter validation error messages now include field path for nested objects
|
|
1088
|
+
- Examples reorganized into categorized directories
|
|
1089
|
+
|
|
1090
|
+
---
|
|
1091
|
+
|
|
1092
|
+
## [1.0.0] - 2026-03-26
|
|
1093
|
+
|
|
1094
|
+
### Core ORM
|
|
1095
|
+
|
|
1096
|
+
- `Prorm` class as the primary entry point — accepts `dialect`, `database`, `username`,
|
|
1097
|
+
`password`, `host`, `port`, `storage` (SQLite), `logging`, `pool`, and `dialectOptions`
|
|
1098
|
+
- `prorm.define(modelName, attributes, options)` for defining models
|
|
1099
|
+
- `Model.init(attributes, options)` static class-based model definition
|
|
1100
|
+
- `prorm.sync({ force?, alter? })` for creating or altering tables to match model definitions
|
|
1101
|
+
- `prorm.authenticate()` for testing the database connection
|
|
1102
|
+
- `prorm.close()` for gracefully shutting down all connections
|
|
1103
|
+
- `prorm.query(sql, options)` for raw SQL execution with `QueryTypes` enum
|
|
1104
|
+
- `prorm.transaction(callback)` managed transaction with automatic commit/rollback
|
|
1105
|
+
- `prorm.transaction()` manual transaction returned as a `Transaction` object
|
|
1106
|
+
- `Prorm` as event emitter for connection lifecycle events
|
|
1107
|
+
|
|
1108
|
+
---
|
|
1109
|
+
|
|
1110
|
+
[Unreleased]: https://gitlab.com/Malcolmston/prod-orm/-/compare/v1.0.0...HEAD
|
|
1111
|
+
[1.0.0]: https://gitlab.com/Malcolmston/prod-orm/-/releases/v1.0.0
|