@warlock.js/cascade 5.30.0 → 5.32.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 +17 -0
- package/README.md +1 -5
- package/cjs/index.cjs +104 -86
- package/cjs/index.cjs.map +1 -1
- package/esm/context/database-data-source-context.d.mts +2 -3
- package/esm/context/database-data-source-context.d.mts.map +1 -1
- package/esm/context/database-transaction-context.d.mts +2 -3
- package/esm/context/database-transaction-context.d.mts.map +1 -1
- package/esm/contracts/database-driver.contract.d.mts +56 -36
- package/esm/contracts/database-driver.contract.d.mts.map +1 -1
- package/esm/contracts/database-id-generator.contract.d.mts +7 -5
- package/esm/contracts/database-id-generator.contract.d.mts.map +1 -1
- package/esm/contracts/database-remover.contract.d.mts +3 -5
- package/esm/contracts/database-remover.contract.d.mts.map +1 -1
- package/esm/contracts/database-restorer.contract.d.mts +6 -6
- package/esm/contracts/database-restorer.contract.d.mts.map +1 -1
- package/esm/contracts/database-writer.contract.d.mts +4 -6
- package/esm/contracts/database-writer.contract.d.mts.map +1 -1
- package/esm/contracts/driver-blueprint.contract.d.mts +2 -3
- package/esm/contracts/driver-blueprint.contract.d.mts.map +1 -1
- package/esm/contracts/index.d.mts +2 -1
- package/esm/contracts/migration-driver.contract.d.mts +101 -53
- package/esm/contracts/migration-driver.contract.d.mts.map +1 -1
- package/esm/contracts/query-builder.contract.d.mts +51 -33
- package/esm/contracts/query-builder.contract.d.mts.map +1 -1
- package/esm/contracts/sync-adapter.contract.d.mts +25 -14
- package/esm/contracts/sync-adapter.contract.d.mts.map +1 -1
- package/esm/data-source/data-source-registry.d.mts +4 -5
- package/esm/data-source/data-source-registry.d.mts.map +1 -1
- package/esm/data-source/data-source-registry.mjs.map +1 -1
- package/esm/data-source/data-source.d.mts +8 -5
- package/esm/data-source/data-source.d.mts.map +1 -1
- package/esm/database-dirty-tracker.d.mts +2 -2
- package/esm/database-dirty-tracker.d.mts.map +1 -1
- package/esm/database-dirty-tracker.mjs +3 -2
- package/esm/database-dirty-tracker.mjs.map +1 -1
- package/esm/drivers/mongodb/mongodb-driver.d.mts +3 -4
- package/esm/drivers/mongodb/mongodb-driver.d.mts.map +1 -1
- package/esm/drivers/mongodb/mongodb-driver.mjs.map +1 -1
- package/esm/drivers/mongodb/mongodb-id-generator.d.mts +2 -3
- package/esm/drivers/mongodb/mongodb-id-generator.d.mts.map +1 -1
- package/esm/drivers/mongodb/mongodb-id-generator.mjs.map +1 -1
- package/esm/drivers/mongodb/mongodb-migration-driver.d.mts +1 -3
- package/esm/drivers/mongodb/mongodb-migration-driver.d.mts.map +1 -1
- package/esm/drivers/mongodb/mongodb-query-builder.d.mts +2 -3
- package/esm/drivers/mongodb/mongodb-query-builder.d.mts.map +1 -1
- package/esm/drivers/mongodb/mongodb-query-builder.mjs +8 -5
- package/esm/drivers/mongodb/mongodb-query-builder.mjs.map +1 -1
- package/esm/drivers/mongodb/mongodb-query-operations.d.mts +1 -3
- package/esm/drivers/mongodb/mongodb-query-operations.d.mts.map +1 -1
- package/esm/drivers/mongodb/mongodb-query-operations.mjs.map +1 -1
- package/esm/drivers/mongodb/mongodb-query-parser.d.mts +7 -6
- package/esm/drivers/mongodb/mongodb-query-parser.d.mts.map +1 -1
- package/esm/drivers/mongodb/mongodb-query-parser.mjs +2 -6
- package/esm/drivers/mongodb/mongodb-query-parser.mjs.map +1 -1
- package/esm/drivers/mongodb/mongodb-sync-adapter.d.mts +1 -3
- package/esm/drivers/mongodb/mongodb-sync-adapter.d.mts.map +1 -1
- package/esm/drivers/mongodb/types.d.mts +11 -9
- package/esm/drivers/mongodb/types.d.mts.map +1 -1
- package/esm/drivers/postgres/index.d.mts +2 -1
- package/esm/drivers/postgres/index.mjs +1 -1
- package/esm/drivers/postgres/naming.mjs +1 -1
- package/esm/drivers/postgres/naming.mjs.map +1 -1
- package/esm/drivers/postgres/postgres-blueprint.d.mts +1 -3
- package/esm/drivers/postgres/postgres-blueprint.d.mts.map +1 -1
- package/esm/drivers/postgres/postgres-dialect.d.mts +4 -6
- package/esm/drivers/postgres/postgres-dialect.d.mts.map +1 -1
- package/esm/drivers/postgres/postgres-dialect.mjs.map +1 -1
- package/esm/drivers/postgres/postgres-driver.d.mts +4 -5
- package/esm/drivers/postgres/postgres-driver.d.mts.map +1 -1
- package/esm/drivers/postgres/postgres-driver.mjs.map +1 -1
- package/esm/drivers/postgres/postgres-migration-driver.d.mts +1 -3
- package/esm/drivers/postgres/postgres-migration-driver.d.mts.map +1 -1
- package/esm/drivers/postgres/postgres-migration-driver.mjs +13 -10
- package/esm/drivers/postgres/postgres-migration-driver.mjs.map +1 -1
- package/esm/drivers/postgres/postgres-query-builder.d.mts +4 -4
- package/esm/drivers/postgres/postgres-query-builder.d.mts.map +1 -1
- package/esm/drivers/postgres/postgres-query-builder.mjs +14 -10
- package/esm/drivers/postgres/postgres-query-builder.mjs.map +1 -1
- package/esm/drivers/postgres/postgres-query-parser.d.mts +16 -11
- package/esm/drivers/postgres/postgres-query-parser.d.mts.map +1 -1
- package/esm/drivers/postgres/postgres-query-parser.mjs +1 -2
- package/esm/drivers/postgres/postgres-query-parser.mjs.map +1 -1
- package/esm/drivers/postgres/postgres-sql-serializer.mjs +13 -10
- package/esm/drivers/postgres/postgres-sql-serializer.mjs.map +1 -1
- package/esm/drivers/postgres/postgres-ttl-purge.mjs +1 -1
- package/esm/drivers/postgres/postgres-ttl-purge.mjs.map +1 -1
- package/esm/drivers/postgres/postgres-type-converters.mjs +2 -2
- package/esm/drivers/postgres/postgres-type-converters.mjs.map +1 -1
- package/esm/drivers/postgres/postgres-update-validator.mjs +1 -1
- package/esm/drivers/postgres/postgres-update-validator.mjs.map +1 -1
- package/esm/drivers/postgres/types.d.mts +87 -45
- package/esm/drivers/postgres/types.d.mts.map +1 -1
- package/esm/drivers/sql/sql-dialect.contract.d.mts +1 -3
- package/esm/drivers/sql/sql-dialect.contract.d.mts.map +1 -1
- package/esm/drivers/sql/sql-types.d.mts +113 -59
- package/esm/drivers/sql/sql-types.d.mts.map +1 -1
- package/esm/errors/missing-data-source.error.d.mts +1 -2
- package/esm/errors/missing-data-source.error.d.mts.map +1 -1
- package/esm/errors/transaction-rollback.error.d.mts +1 -2
- package/esm/errors/transaction-rollback.error.d.mts.map +1 -1
- package/esm/errors/undefined-where-value.error.d.mts +1 -2
- package/esm/errors/undefined-where-value.error.d.mts.map +1 -1
- package/esm/errors/unsafe-filter.error.d.mts +1 -2
- package/esm/errors/unsafe-filter.error.d.mts.map +1 -1
- package/esm/errors/unsafe-raw-expression.error.d.mts +1 -2
- package/esm/errors/unsafe-raw-expression.error.d.mts.map +1 -1
- package/esm/errors/unsupported-lean-operation.error.d.mts +1 -2
- package/esm/errors/unsupported-lean-operation.error.d.mts.map +1 -1
- package/esm/errors/unsupported-lock-for-update.error.d.mts +1 -2
- package/esm/errors/unsupported-lock-for-update.error.d.mts.map +1 -1
- package/esm/errors/unsupported-query-operation.error.d.mts +1 -2
- package/esm/errors/unsupported-query-operation.error.d.mts.map +1 -1
- package/esm/errors/unsupported-query-operation.error.mjs.map +1 -1
- package/esm/errors/unsupported-update-operation.error.d.mts +1 -2
- package/esm/errors/unsupported-update-operation.error.d.mts.map +1 -1
- package/esm/events/model-events.d.mts +8 -6
- package/esm/events/model-events.d.mts.map +1 -1
- package/esm/expressions/aggregate-expressions.d.mts +7 -7
- package/esm/expressions/aggregate-expressions.d.mts.map +1 -1
- package/esm/expressions/column-expressions.d.mts +11 -11
- package/esm/expressions/column-expressions.d.mts.map +1 -1
- package/esm/expressions/column-expressions.mjs.map +1 -1
- package/esm/index.d.mts +7 -2
- package/esm/index.mjs +1 -1
- package/esm/migration/column-builder.d.mts +2 -3
- package/esm/migration/column-builder.d.mts.map +1 -1
- package/esm/migration/column-helpers.d.mts +49 -50
- package/esm/migration/column-helpers.d.mts.map +1 -1
- package/esm/migration/column-helpers.mjs +1 -1
- package/esm/migration/foreign-key-builder.d.mts +2 -3
- package/esm/migration/foreign-key-builder.d.mts.map +1 -1
- package/esm/migration/foreign-key-builder.mjs.map +1 -1
- package/esm/migration/index.d.mts +3 -2
- package/esm/migration/index.mjs +2 -2
- package/esm/migration/migration-runner.d.mts +7 -6
- package/esm/migration/migration-runner.d.mts.map +1 -1
- package/esm/migration/migration-runner.mjs +15 -11
- package/esm/migration/migration-runner.mjs.map +1 -1
- package/esm/migration/migration.d.mts +50 -32
- package/esm/migration/migration.d.mts.map +1 -1
- package/esm/migration/migration.mjs +1 -3
- package/esm/migration/migration.mjs.map +1 -1
- package/esm/migration/parse-created-at.mjs.map +1 -1
- package/esm/migration/sql-grammar.mjs.map +1 -1
- package/esm/migration/sql-serializer.d.mts +1 -3
- package/esm/migration/sql-serializer.d.mts.map +1 -1
- package/esm/migration/types.d.mts +7 -7
- package/esm/migration/types.d.mts.map +1 -1
- package/esm/model/generate-model-id.mjs.map +1 -1
- package/esm/model/methods/accessor-methods.mjs +1 -1
- package/esm/model/methods/accessor-methods.mjs.map +1 -1
- package/esm/model/methods/dirty-methods.mjs.map +1 -1
- package/esm/model/methods/hydration-methods.mjs.map +1 -1
- package/esm/model/methods/meta-methods.mjs +4 -2
- package/esm/model/methods/meta-methods.mjs.map +1 -1
- package/esm/model/methods/query-methods.mjs +1 -1
- package/esm/model/methods/query-methods.mjs.map +1 -1
- package/esm/model/methods/scope-methods.mjs.map +1 -1
- package/esm/model/methods/static-event-methods.mjs.map +1 -1
- package/esm/model/methods/write-methods.d.mts +3 -2
- package/esm/model/methods/write-methods.d.mts.map +1 -1
- package/esm/model/methods/write-methods.mjs +5 -2
- package/esm/model/methods/write-methods.mjs.map +1 -1
- package/esm/model/model.d.mts +9 -9
- package/esm/model/model.d.mts.map +1 -1
- package/esm/model/model.mjs.map +1 -1
- package/esm/model/model.types.d.mts +7 -7
- package/esm/model/model.types.d.mts.map +1 -1
- package/esm/model/register-model.d.mts +13 -15
- package/esm/model/register-model.d.mts.map +1 -1
- package/esm/model/register-model.mjs.map +1 -1
- package/esm/model/relation-decorators.d.mts +6 -8
- package/esm/model/relation-decorators.d.mts.map +1 -1
- package/esm/operations/database.d.mts +13 -8
- package/esm/operations/database.d.mts.map +1 -1
- package/esm/operations/index.d.mts +2 -1
- package/esm/operations/index.mjs +1 -1
- package/esm/operations/migrations.d.mts +18 -14
- package/esm/operations/migrations.d.mts.map +1 -1
- package/esm/operations/migrations.mjs.map +1 -1
- package/esm/query-builder/query-builder.d.mts +2 -4
- package/esm/query-builder/query-builder.d.mts.map +1 -1
- package/esm/query-builder/query-builder.mjs +12 -11
- package/esm/query-builder/query-builder.mjs.map +1 -1
- package/esm/relations/index.d.mts +2 -1
- package/esm/relations/index.mjs +1 -1
- package/esm/relations/key-conventions.mjs +2 -1
- package/esm/relations/key-conventions.mjs.map +1 -1
- package/esm/relations/pivot-operations.d.mts +3 -5
- package/esm/relations/pivot-operations.d.mts.map +1 -1
- package/esm/relations/pivot-operations.mjs.map +1 -1
- package/esm/relations/relation-hydrator.d.mts +3 -5
- package/esm/relations/relation-hydrator.d.mts.map +1 -1
- package/esm/relations/relation-loader.d.mts +2 -4
- package/esm/relations/relation-loader.d.mts.map +1 -1
- package/esm/relations/relation-loader.mjs +4 -5
- package/esm/relations/relation-loader.mjs.map +1 -1
- package/esm/relations/types.d.mts +14 -15
- package/esm/relations/types.d.mts.map +1 -1
- package/esm/remover/database-remover.d.mts +1 -3
- package/esm/remover/database-remover.d.mts.map +1 -1
- package/esm/remover/database-remover.mjs.map +1 -1
- package/esm/restorer/database-restorer.d.mts +1 -3
- package/esm/restorer/database-restorer.d.mts.map +1 -1
- package/esm/restorer/database-restorer.mjs +2 -1
- package/esm/restorer/database-restorer.mjs.map +1 -1
- package/esm/sql-database-dirty-tracker.d.mts +1 -3
- package/esm/sql-database-dirty-tracker.d.mts.map +1 -1
- package/esm/sync/model-events.mjs +1 -1
- package/esm/sync/model-sync-operation.d.mts +2 -4
- package/esm/sync/model-sync-operation.d.mts.map +1 -1
- package/esm/sync/model-sync.d.mts +3 -4
- package/esm/sync/model-sync.d.mts.map +1 -1
- package/esm/sync/sync-context.d.mts +2 -4
- package/esm/sync/sync-context.d.mts.map +1 -1
- package/esm/sync/sync-context.mjs.map +1 -1
- package/esm/sync/sync-fanout.mjs +1 -1
- package/esm/sync/sync-fanout.mjs.map +1 -1
- package/esm/sync/sync-manager.d.mts +2 -4
- package/esm/sync/sync-manager.d.mts.map +1 -1
- package/esm/sync/sync-manager.mjs.map +1 -1
- package/esm/sync/types.d.mts +121 -64
- package/esm/sync/types.d.mts.map +1 -1
- package/esm/transactions/after-commit.d.mts +2 -2
- package/esm/transactions/after-commit.d.mts.map +1 -1
- package/esm/types.d.mts +7 -8
- package/esm/types.d.mts.map +1 -1
- package/esm/utils/connect-to-database.d.mts +7 -8
- package/esm/utils/connect-to-database.d.mts.map +1 -1
- package/esm/utils/database-writer.utils.d.mts +3 -4
- package/esm/utils/database-writer.utils.d.mts.map +1 -1
- package/esm/utils/database-writer.utils.mjs.map +1 -1
- package/esm/utils/define-model.d.mts +3 -5
- package/esm/utils/define-model.d.mts.map +1 -1
- package/esm/utils/escape-regex.d.mts +3 -4
- package/esm/utils/escape-regex.d.mts.map +1 -1
- package/esm/utils/is-valid-date-value.mjs.map +1 -1
- package/esm/utils/once-connected.d.mts +2 -4
- package/esm/utils/once-connected.d.mts.map +1 -1
- package/esm/utils/sanitize-filter.d.mts +3 -4
- package/esm/utils/sanitize-filter.d.mts.map +1 -1
- package/esm/validation/database-seal-plugins.d.mts +2 -1
- package/esm/validation/database-writer-validation-error.d.mts +1 -3
- package/esm/validation/database-writer-validation-error.d.mts.map +1 -1
- package/esm/validation/index.d.mts +3 -1
- package/esm/validation/index.mjs +1 -1
- package/esm/validation/plugins/database-rules-plugin.d.mts +2 -3
- package/esm/validation/plugins/database-rules-plugin.d.mts.map +1 -1
- package/esm/validation/plugins/embed-validator-plugin.d.mts +4 -3
- package/esm/validation/plugins/embed-validator-plugin.d.mts.map +1 -1
- package/esm/validation/types.d.mts +14 -10
- package/esm/validation/types.d.mts.map +1 -1
- package/esm/validation/validators/embed-validator.d.mts +2 -3
- package/esm/validation/validators/embed-validator.d.mts.map +1 -1
- package/esm/writer/database-writer.d.mts +1 -3
- package/esm/writer/database-writer.d.mts.map +1 -1
- package/esm/writer/database-writer.mjs +1 -1
- package/esm/writer/database-writer.mjs.map +1 -1
- package/llms-full.txt +541 -434
- package/package.json +5 -5
- package/skills/aggregate-data/SKILL.md +28 -17
- package/skills/alter-migration/SKILL.md +325 -233
- package/skills/cascade-basics/SKILL.md +19 -19
- package/skills/configure-delete-strategy/SKILL.md +11 -11
- package/skills/define-model/SKILL.md +19 -17
- package/skills/define-relations/SKILL.md +13 -18
- package/skills/index.md +3 -0
- package/skills/manage-transactions/SKILL.md +18 -12
- package/skills/paginate-results/SKILL.md +6 -8
- package/skills/perform-atomic-ops/SKILL.md +26 -21
- package/skills/query-data/SKILL.md +27 -33
- package/skills/run-cascade-cli/SKILL.md +11 -10
- package/skills/search-by-vector/SKILL.md +8 -5
- package/skills/subscribe-to-model-events/SKILL.md +17 -17
- package/skills/track-changes/SKILL.md +9 -9
- package/skills/write-migration/SKILL.md +4 -4
|
@@ -13,28 +13,38 @@
|
|
|
13
13
|
* Contains the SQL string with placeholders and the corresponding parameter values.
|
|
14
14
|
* This separation prevents SQL injection by ensuring values are properly escaped.
|
|
15
15
|
*/
|
|
16
|
-
type SqlQueryResult = {
|
|
17
|
-
/** The SQL query string with parameter placeholders ($1, $2, etc. or ?) */
|
|
16
|
+
export type SqlQueryResult = {
|
|
17
|
+
/** The SQL query string with parameter placeholders ($1, $2, etc. or ?) */
|
|
18
|
+
readonly sql: string;
|
|
19
|
+
/** The parameter values in order matching the placeholders */
|
|
18
20
|
readonly params: unknown[];
|
|
19
21
|
};
|
|
20
22
|
/**
|
|
21
23
|
* Supported SQL JOIN types.
|
|
22
24
|
*/
|
|
23
|
-
type SqlJoinType = "inner" | "left" | "right" | "full" | "cross";
|
|
25
|
+
export type SqlJoinType = "inner" | "left" | "right" | "full" | "cross";
|
|
24
26
|
/**
|
|
25
27
|
* SQL JOIN clause definition.
|
|
26
28
|
*
|
|
27
29
|
* Represents a JOIN between two tables with its condition.
|
|
28
30
|
*/
|
|
29
|
-
type SqlJoinClause = {
|
|
30
|
-
/** Type of JOIN operation */
|
|
31
|
-
readonly
|
|
32
|
-
|
|
31
|
+
export type SqlJoinClause = {
|
|
32
|
+
/** Type of JOIN operation */
|
|
33
|
+
readonly type: SqlJoinType;
|
|
34
|
+
/** Target table to join */
|
|
35
|
+
readonly table: string;
|
|
36
|
+
/** Optional alias for the joined table */
|
|
37
|
+
readonly alias?: string;
|
|
38
|
+
/** JOIN condition */
|
|
33
39
|
readonly on: {
|
|
34
|
-
/** Field from the left (current) table */
|
|
35
|
-
readonly
|
|
40
|
+
/** Field from the left (current) table */
|
|
41
|
+
readonly left: string;
|
|
42
|
+
/** Comparison operator (usually "=") */
|
|
43
|
+
readonly operator: string;
|
|
44
|
+
/** Field from the right (joined) table */
|
|
36
45
|
readonly right: string;
|
|
37
|
-
};
|
|
46
|
+
};
|
|
47
|
+
/** Additional ON conditions (for complex joins) */
|
|
38
48
|
readonly additionalConditions?: Array<{
|
|
39
49
|
readonly left: string;
|
|
40
50
|
readonly operator: string;
|
|
@@ -44,76 +54,110 @@ type SqlJoinClause = {
|
|
|
44
54
|
/**
|
|
45
55
|
* SQL ORDER BY clause definition.
|
|
46
56
|
*/
|
|
47
|
-
type SqlOrderClause = {
|
|
48
|
-
/** Column to order by */
|
|
49
|
-
readonly
|
|
57
|
+
export type SqlOrderClause = {
|
|
58
|
+
/** Column to order by */
|
|
59
|
+
readonly column: string;
|
|
60
|
+
/** Sort direction */
|
|
61
|
+
readonly direction: "asc" | "desc";
|
|
62
|
+
/** Nulls position (PostgreSQL-specific) */
|
|
50
63
|
readonly nulls?: "first" | "last";
|
|
51
64
|
};
|
|
52
65
|
/**
|
|
53
66
|
* SQL GROUP BY clause definition.
|
|
54
67
|
*/
|
|
55
|
-
type SqlGroupClause = {
|
|
56
|
-
/** Columns to group by */
|
|
68
|
+
export type SqlGroupClause = {
|
|
69
|
+
/** Columns to group by */
|
|
70
|
+
readonly columns: string[];
|
|
57
71
|
};
|
|
58
72
|
/**
|
|
59
73
|
* SQL HAVING clause condition.
|
|
60
74
|
*/
|
|
61
|
-
type SqlHavingClause = {
|
|
62
|
-
/** Aggregate function (count, sum, avg, etc.) */
|
|
63
|
-
readonly
|
|
64
|
-
|
|
75
|
+
export type SqlHavingClause = {
|
|
76
|
+
/** Aggregate function (count, sum, avg, etc.) */
|
|
77
|
+
readonly aggregate: string;
|
|
78
|
+
/** Column the aggregate operates on */
|
|
79
|
+
readonly column: string;
|
|
80
|
+
/** Comparison operator */
|
|
81
|
+
readonly operator: string;
|
|
82
|
+
/** Value to compare against */
|
|
65
83
|
readonly value: unknown;
|
|
66
84
|
};
|
|
67
85
|
/**
|
|
68
86
|
* SQL WHERE clause operation types.
|
|
69
87
|
*/
|
|
70
|
-
type SqlWhereType = "where" | "orWhere" | "whereRaw" | "orWhereRaw" | "whereNot" | "orWhereNot" | "whereExists" | "whereNotExists";
|
|
88
|
+
export type SqlWhereType = "where" | "orWhere" | "whereRaw" | "orWhereRaw" | "whereNot" | "orWhereNot" | "whereExists" | "whereNotExists";
|
|
71
89
|
/**
|
|
72
90
|
* SQL WHERE clause operation.
|
|
73
91
|
*
|
|
74
92
|
* Represents a single WHERE condition with its type, field, operator, and value.
|
|
75
93
|
*/
|
|
76
|
-
type SqlWhereOperation = {
|
|
77
|
-
/** Type of WHERE clause (where, orWhere, whereRaw, etc.) */
|
|
78
|
-
readonly
|
|
79
|
-
|
|
80
|
-
readonly
|
|
81
|
-
|
|
82
|
-
readonly
|
|
94
|
+
export type SqlWhereOperation = {
|
|
95
|
+
/** Type of WHERE clause (where, orWhere, whereRaw, etc.) */
|
|
96
|
+
readonly type: SqlWhereType;
|
|
97
|
+
/** Field name (for standard where clauses) */
|
|
98
|
+
readonly field?: string;
|
|
99
|
+
/** Comparison operator */
|
|
100
|
+
readonly operator?: string;
|
|
101
|
+
/** Value to compare against */
|
|
102
|
+
readonly value?: unknown;
|
|
103
|
+
/** Raw SQL expression (for whereRaw clauses) */
|
|
104
|
+
readonly raw?: string;
|
|
105
|
+
/** Parameter bindings for raw expressions */
|
|
106
|
+
readonly bindings?: unknown[];
|
|
107
|
+
/** Nested conditions (for grouped where clauses) */
|
|
83
108
|
readonly nested?: SqlWhereOperation[];
|
|
84
109
|
};
|
|
85
110
|
/**
|
|
86
111
|
* SQL SELECT clause definition.
|
|
87
112
|
*/
|
|
88
|
-
type SqlSelectClause = {
|
|
89
|
-
/** Column name or expression */
|
|
90
|
-
readonly
|
|
113
|
+
export type SqlSelectClause = {
|
|
114
|
+
/** Column name or expression */
|
|
115
|
+
readonly expression: string;
|
|
116
|
+
/** Optional alias for the column */
|
|
117
|
+
readonly alias?: string;
|
|
118
|
+
/** Whether this is a raw expression */
|
|
91
119
|
readonly isRaw?: boolean;
|
|
92
120
|
};
|
|
93
121
|
/**
|
|
94
122
|
* Configuration for building SQL queries.
|
|
95
123
|
*/
|
|
96
|
-
type SqlQueryConfig = {
|
|
97
|
-
/** Target table name */
|
|
98
|
-
readonly
|
|
99
|
-
|
|
100
|
-
readonly
|
|
101
|
-
|
|
102
|
-
readonly
|
|
103
|
-
|
|
104
|
-
readonly
|
|
105
|
-
|
|
106
|
-
readonly
|
|
124
|
+
export type SqlQueryConfig = {
|
|
125
|
+
/** Target table name */
|
|
126
|
+
readonly table: string;
|
|
127
|
+
/** Table alias (optional) */
|
|
128
|
+
readonly alias?: string;
|
|
129
|
+
/** SELECT columns (empty = SELECT *) */
|
|
130
|
+
readonly select: SqlSelectClause[];
|
|
131
|
+
/** JOIN clauses */
|
|
132
|
+
readonly joins: SqlJoinClause[];
|
|
133
|
+
/** WHERE conditions */
|
|
134
|
+
readonly where: SqlWhereOperation[];
|
|
135
|
+
/** GROUP BY columns */
|
|
136
|
+
readonly groupBy: string[];
|
|
137
|
+
/** HAVING conditions */
|
|
138
|
+
readonly having: SqlHavingClause[];
|
|
139
|
+
/** ORDER BY clauses */
|
|
140
|
+
readonly orderBy: SqlOrderClause[];
|
|
141
|
+
/** LIMIT value */
|
|
142
|
+
readonly limit?: number;
|
|
143
|
+
/** OFFSET value */
|
|
144
|
+
readonly offset?: number;
|
|
145
|
+
/** DISTINCT flag */
|
|
107
146
|
readonly distinct?: boolean;
|
|
108
147
|
};
|
|
109
148
|
/**
|
|
110
149
|
* SQL INSERT operation definition.
|
|
111
150
|
*/
|
|
112
|
-
type SqlInsertOperation = {
|
|
113
|
-
/** Target table */
|
|
114
|
-
readonly
|
|
115
|
-
|
|
116
|
-
readonly
|
|
151
|
+
export type SqlInsertOperation = {
|
|
152
|
+
/** Target table */
|
|
153
|
+
readonly table: string;
|
|
154
|
+
/** Column names */
|
|
155
|
+
readonly columns: string[];
|
|
156
|
+
/** Values to insert (array of arrays for multi-row insert) */
|
|
157
|
+
readonly values: unknown[][];
|
|
158
|
+
/** Whether to return the inserted rows */
|
|
159
|
+
readonly returning?: string[] | boolean;
|
|
160
|
+
/** Conflict resolution (upsert) */
|
|
117
161
|
readonly onConflict?: {
|
|
118
162
|
readonly columns: string[];
|
|
119
163
|
readonly action: "update" | "nothing";
|
|
@@ -123,28 +167,38 @@ type SqlInsertOperation = {
|
|
|
123
167
|
/**
|
|
124
168
|
* SQL UPDATE operation definition.
|
|
125
169
|
*/
|
|
126
|
-
type SqlUpdateOperation = {
|
|
127
|
-
/** Target table */
|
|
128
|
-
readonly
|
|
129
|
-
|
|
130
|
-
readonly
|
|
131
|
-
|
|
132
|
-
readonly
|
|
170
|
+
export type SqlUpdateOperation = {
|
|
171
|
+
/** Target table */
|
|
172
|
+
readonly table: string;
|
|
173
|
+
/** Columns to set with their values */
|
|
174
|
+
readonly set: Record<string, unknown>;
|
|
175
|
+
/** Columns to increment */
|
|
176
|
+
readonly increment?: Record<string, number>;
|
|
177
|
+
/** Columns to set to NULL */
|
|
178
|
+
readonly unset?: string[];
|
|
179
|
+
/** WHERE conditions */
|
|
180
|
+
readonly where: SqlWhereOperation[];
|
|
181
|
+
/** Whether to return updated rows */
|
|
182
|
+
readonly returning?: string[] | boolean;
|
|
183
|
+
/** Maximum rows to update (some databases support LIMIT in UPDATE) */
|
|
133
184
|
readonly limit?: number;
|
|
134
185
|
};
|
|
135
186
|
/**
|
|
136
187
|
* SQL DELETE operation definition.
|
|
137
188
|
*/
|
|
138
|
-
type SqlDeleteOperation = {
|
|
139
|
-
/** Target table */
|
|
140
|
-
readonly
|
|
141
|
-
|
|
189
|
+
export type SqlDeleteOperation = {
|
|
190
|
+
/** Target table */
|
|
191
|
+
readonly table: string;
|
|
192
|
+
/** WHERE conditions */
|
|
193
|
+
readonly where: SqlWhereOperation[];
|
|
194
|
+
/** Whether to return deleted rows */
|
|
195
|
+
readonly returning?: string[] | boolean;
|
|
196
|
+
/** Maximum rows to delete */
|
|
142
197
|
readonly limit?: number;
|
|
143
198
|
};
|
|
144
199
|
/**
|
|
145
200
|
* Aggregate function types supported in SQL.
|
|
146
201
|
*/
|
|
147
|
-
type SqlAggregateFunction = "count" | "sum" | "avg" | "min" | "max" | "array_agg" | "string_agg" | "jsonb_agg";
|
|
202
|
+
export type SqlAggregateFunction = "count" | "sum" | "avg" | "min" | "max" | "array_agg" | "string_agg" | "jsonb_agg";
|
|
148
203
|
//#endregion
|
|
149
|
-
export { SqlAggregateFunction, SqlDeleteOperation, SqlGroupClause, SqlHavingClause, SqlInsertOperation, SqlJoinClause, SqlJoinType, SqlOrderClause, SqlQueryConfig, SqlQueryResult, SqlSelectClause, SqlUpdateOperation, SqlWhereOperation, SqlWhereType };
|
|
150
204
|
//# sourceMappingURL=sql-types.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sql-types.d.mts","names":[],"sources":["../../../../../../../../../packages/cascade/src/drivers/sql/sql-types.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"sql-types.d.mts","names":[],"sources":["../../../../../../../../../packages/cascade/src/drivers/sql/sql-types.ts"],"mappings":";;;;;;;;;;;;;;;YAeY;;WAED;;WAEA;;;;;YAMC;;;;;;YAOA;;WAED,MAAM;;WAEN;;WAEA;;WAEA;;aAEE;;aAEA;;aAEA;;;WAGF,uBAAuB;aACrB;aACA;aACA;;;;;;YAOD;;WAED;;WAEA;;WAEA;;;;;YAMC;;WAED;;;;;YAMC;;WAED;;WAEA;;WAEA;;WAEA;;;;;YAMC;;;;;;YAeA;;WAED,MAAM;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA,SAAS;;;;;YAMR;;WAED;;WAEA;;WAEA;;;;;YAMC;;WAED;;WAEA;;WAEA,QAAQ;;WAER,OAAO;;WAEP,OAAO;;WAEP;;WAEA,QAAQ;;WAER,SAAS;;WAET;;WAEA;;WAEA;;;;;YAMC;;WAED;;WAEA;;WAEA;;WAEA;;WAEA;aACE;aACA;aACA;;;;;;YAOD;;WAED;;WAEA,KAAK;;WAEL,YAAY;;WAEZ;;WAEA,OAAO;;WAEP;;WAEA;;;;;YAMC;;WAED;;WAEA,OAAO;;WAEP;;WAEA;;;;;YAMC"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* - Trying to get the default data source before any have been registered
|
|
8
8
|
* - Context override references an unregistered data source name
|
|
9
9
|
*/
|
|
10
|
-
declare class MissingDataSourceError extends Error {
|
|
10
|
+
export declare class MissingDataSourceError extends Error {
|
|
11
11
|
/**
|
|
12
12
|
* The name of the data source that was not found (if applicable).
|
|
13
13
|
*/
|
|
@@ -21,5 +21,4 @@ declare class MissingDataSourceError extends Error {
|
|
|
21
21
|
constructor(message: string, dataSourceName?: string);
|
|
22
22
|
}
|
|
23
23
|
//#endregion
|
|
24
|
-
export { MissingDataSourceError };
|
|
25
24
|
//# sourceMappingURL=missing-data-source.error.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"missing-data-source.error.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/errors/missing-data-source.error.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"missing-data-source.error.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/errors/missing-data-source.error.ts"],"mappings":";;;;;;;;;qBAQa,+BAA+B;;;;WAI1B;;;;;;;EAQhB,YAAmB,iBAAiB"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* an application error. It's caught by the transaction wrapper to perform
|
|
7
7
|
* cleanup and then re-thrown.
|
|
8
8
|
*/
|
|
9
|
-
declare class TransactionRollbackError extends Error {
|
|
9
|
+
export declare class TransactionRollbackError extends Error {
|
|
10
10
|
/**
|
|
11
11
|
* The reason for the rollback (if provided).
|
|
12
12
|
*/
|
|
@@ -19,5 +19,4 @@ declare class TransactionRollbackError extends Error {
|
|
|
19
19
|
constructor(reason?: string);
|
|
20
20
|
}
|
|
21
21
|
//#endregion
|
|
22
|
-
export { TransactionRollbackError };
|
|
23
22
|
//# sourceMappingURL=transaction-rollback.error.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-rollback.error.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/errors/transaction-rollback.error.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"transaction-rollback.error.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/errors/transaction-rollback.error.ts"],"mappings":";;;;;;;;qBAOa,iCAAiC;;;;WAI5B;;;;;;EAOhB,YAAmB"}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* valid, intentional query. To skip the query entirely when there's no
|
|
16
16
|
* value, guard the call site instead of calling `where()`.
|
|
17
17
|
*/
|
|
18
|
-
declare class UndefinedWhereValueError extends Error {
|
|
18
|
+
export declare class UndefinedWhereValueError extends Error {
|
|
19
19
|
/**
|
|
20
20
|
* The field whose value was `undefined`.
|
|
21
21
|
*/
|
|
@@ -28,5 +28,4 @@ declare class UndefinedWhereValueError extends Error {
|
|
|
28
28
|
constructor(field: string);
|
|
29
29
|
}
|
|
30
30
|
//#endregion
|
|
31
|
-
export { UndefinedWhereValueError };
|
|
32
31
|
//# sourceMappingURL=undefined-where-value.error.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"undefined-where-value.error.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/errors/undefined-where-value.error.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"undefined-where-value.error.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/errors/undefined-where-value.error.ts"],"mappings":";;;;;;;;;;;;;;;;;qBAgBa,iCAAiC;;;;WAI5B;;;;;;EAOhB,YAAmB"}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* - `whereIn` / `whereNull` / `whereBetween` / … for specific operators
|
|
11
11
|
* - `whereRaw({ ... })` (object form) for intentional raw driver filters
|
|
12
12
|
*/
|
|
13
|
-
declare class UnsafeFilterError extends Error {
|
|
13
|
+
export declare class UnsafeFilterError extends Error {
|
|
14
14
|
/**
|
|
15
15
|
* The field whose value contained the rejected operator key (if applicable).
|
|
16
16
|
*/
|
|
@@ -29,5 +29,4 @@ declare class UnsafeFilterError extends Error {
|
|
|
29
29
|
constructor(message: string, field?: string, operatorKey?: string);
|
|
30
30
|
}
|
|
31
31
|
//#endregion
|
|
32
|
-
export { UnsafeFilterError };
|
|
33
32
|
//# sourceMappingURL=unsafe-filter.error.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unsafe-filter.error.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/errors/unsafe-filter.error.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"unsafe-filter.error.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/errors/unsafe-filter.error.ts"],"mappings":";;;;;;;;;;;;qBAWa,0BAA0B;;;;WAIrB;;;;WAKA;;;;;;;;EAShB,YAAmB,iBAAiB,gBAAgB"}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Use the object form instead, e.g. `whereRaw({ $expr: { $gt: ["$stock", "$reserved"] } })`.
|
|
12
12
|
*/
|
|
13
|
-
declare class UnsafeRawExpressionError extends Error {
|
|
13
|
+
export declare class UnsafeRawExpressionError extends Error {
|
|
14
14
|
/**
|
|
15
15
|
* Creates a new UnsafeRawExpressionError.
|
|
16
16
|
*
|
|
@@ -19,5 +19,4 @@ declare class UnsafeRawExpressionError extends Error {
|
|
|
19
19
|
constructor(message: string);
|
|
20
20
|
}
|
|
21
21
|
//#endregion
|
|
22
|
-
export { UnsafeRawExpressionError };
|
|
23
22
|
//# sourceMappingURL=unsafe-raw-expression.error.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unsafe-raw-expression.error.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/errors/unsafe-raw-expression.error.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"unsafe-raw-expression.error.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/errors/unsafe-raw-expression.error.ts"],"mappings":";;;;;;;;;;;;qBAWa,iCAAiC;;;;;;EAM5C,YAAmB"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* model's `hidden` fields) by the Model layer, so lean mode refuses them rather
|
|
9
9
|
* than returning a half-loaded or unfiltered result.
|
|
10
10
|
*/
|
|
11
|
-
declare class UnsupportedLeanOperationError extends Error {
|
|
11
|
+
export declare class UnsupportedLeanOperationError extends Error {
|
|
12
12
|
/**
|
|
13
13
|
* The rejected builder operation (e.g. `"with"`, `"joinWith"`).
|
|
14
14
|
*/
|
|
@@ -21,5 +21,4 @@ declare class UnsupportedLeanOperationError extends Error {
|
|
|
21
21
|
constructor(operation: string);
|
|
22
22
|
}
|
|
23
23
|
//#endregion
|
|
24
|
-
export { UnsupportedLeanOperationError };
|
|
25
24
|
//# sourceMappingURL=unsupported-lean-operation.error.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unsupported-lean-operation.error.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/errors/unsupported-lean-operation.error.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"unsupported-lean-operation.error.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/errors/unsupported-lean-operation.error.ts"],"mappings":";;;;;;;;;;qBASa,sCAAsC;;;;WAIjC;;;;;;EAOhB,YAAmB"}
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
* Error thrown when `lockForUpdate()` is requested on MongoDB, whose document
|
|
4
4
|
* model has no row-level `SELECT ... FOR UPDATE` equivalent.
|
|
5
5
|
*/
|
|
6
|
-
declare class UnsupportedLockForUpdateError extends Error {
|
|
6
|
+
export declare class UnsupportedLockForUpdateError extends Error {
|
|
7
7
|
constructor();
|
|
8
8
|
}
|
|
9
9
|
//#endregion
|
|
10
|
-
export { UnsupportedLockForUpdateError };
|
|
11
10
|
//# sourceMappingURL=unsupported-lock-for-update.error.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unsupported-lock-for-update.error.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/errors/unsupported-lock-for-update.error.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"unsupported-lock-for-update.error.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/errors/unsupported-lock-for-update.error.ts"],"mappings":";;;;;qBAIa,sCAAsC;EACjD"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Builders throw this instead of silently dropping the stage, so a caller
|
|
8
8
|
* never receives rows shaped differently from what the query asked for.
|
|
9
9
|
*/
|
|
10
|
-
declare class UnsupportedQueryOperationError extends Error {
|
|
10
|
+
export declare class UnsupportedQueryOperationError extends Error {
|
|
11
11
|
/**
|
|
12
12
|
* The operation that was rejected (e.g. `"unwind"`, `"addFields"`).
|
|
13
13
|
*/
|
|
@@ -26,5 +26,4 @@ declare class UnsupportedQueryOperationError extends Error {
|
|
|
26
26
|
constructor(operation: string, driver: string, hint?: string);
|
|
27
27
|
}
|
|
28
28
|
//#endregion
|
|
29
|
-
export { UnsupportedQueryOperationError };
|
|
30
29
|
//# sourceMappingURL=unsupported-query-operation.error.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unsupported-query-operation.error.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/errors/unsupported-query-operation.error.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"unsupported-query-operation.error.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/errors/unsupported-query-operation.error.ts"],"mappings":";;;;;;;;;qBAQa,uCAAuC;;;;WAIlC;;;;WAKA;;;;;;;;EAShB,YAAmB,mBAAmB,gBAAgB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unsupported-query-operation.error.mjs","names":[],"sources":["../../../../../../../../packages/cascade/src/errors/unsupported-query-operation.error.ts"],"sourcesContent":["/**\n * Error thrown when a query builder is asked for a read operation its driver\n * cannot express — e.g. a MongoDB-only aggregation stage such as `unwind()` or\n * `addFields()` on a SQL driver.\n *\n * Builders throw this instead of silently dropping the stage, so a caller\n * never receives rows shaped differently from what the query asked for.\n */\nexport class UnsupportedQueryOperationError extends Error {\n /**\n * The operation that was rejected (e.g. `\"unwind\"`, `\"addFields\"`).\n */\n public readonly operation: string;\n\n /**\n * The driver that rejected it (e.g. `\"postgres\"`).\n */\n public readonly driver: string;\n\n /**\n * Creates a new UnsupportedQueryOperationError.\n *\n * @param operation - The rejected operation\n * @param driver - The driver name\n * @param hint - Optional guidance appended to the message\n */\n public constructor(operation: string, driver: string, hint?: string) {\n super(`The ${driver} driver does not support ${operation}() in queries.` + (hint ? ` ${hint}` : \"\"));\n this.name = \"UnsupportedQueryOperationError\";\n this.operation = operation;\n this.driver = driver;\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, UnsupportedQueryOperationError);\n }\n }\n}\n"],"mappings":";;;;;;;;;AAQA,IAAa,iCAAb,MAAa,uCAAuC,MAAM;;;;CAIxD,AAAgB;;;;CAKhB,AAAgB;;;;;;;;CAShB,AAAO,YAAY,WAAmB,QAAgB,MAAe;EACnE,
|
|
1
|
+
{"version":3,"file":"unsupported-query-operation.error.mjs","names":[],"sources":["../../../../../../../../packages/cascade/src/errors/unsupported-query-operation.error.ts"],"sourcesContent":["/**\n * Error thrown when a query builder is asked for a read operation its driver\n * cannot express — e.g. a MongoDB-only aggregation stage such as `unwind()` or\n * `addFields()` on a SQL driver.\n *\n * Builders throw this instead of silently dropping the stage, so a caller\n * never receives rows shaped differently from what the query asked for.\n */\nexport class UnsupportedQueryOperationError extends Error {\n /**\n * The operation that was rejected (e.g. `\"unwind\"`, `\"addFields\"`).\n */\n public readonly operation: string;\n\n /**\n * The driver that rejected it (e.g. `\"postgres\"`).\n */\n public readonly driver: string;\n\n /**\n * Creates a new UnsupportedQueryOperationError.\n *\n * @param operation - The rejected operation\n * @param driver - The driver name\n * @param hint - Optional guidance appended to the message\n */\n public constructor(operation: string, driver: string, hint?: string) {\n super(\n `The ${driver} driver does not support ${operation}() in queries.` + (hint ? ` ${hint}` : \"\"),\n );\n this.name = \"UnsupportedQueryOperationError\";\n this.operation = operation;\n this.driver = driver;\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, UnsupportedQueryOperationError);\n }\n }\n}\n"],"mappings":";;;;;;;;;AAQA,IAAa,iCAAb,MAAa,uCAAuC,MAAM;;;;CAIxD,AAAgB;;;;CAKhB,AAAgB;;;;;;;;CAShB,AAAO,YAAY,WAAmB,QAAgB,MAAe;EACnE,MACE,OAAO,OAAO,2BAA2B,UAAU,mBAAmB,OAAO,IAAI,SAAS,GAC5F;EACA,KAAK,OAAO;EACZ,KAAK,YAAY;EACjB,KAAK,SAAS;EAEd,IAAI,MAAM,mBACR,MAAM,kBAAkB,MAAM,8BAA8B;CAEhE;AACF"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Drivers throw this instead of silently dropping the operation, so a caller
|
|
8
8
|
* never believes a write happened that did not.
|
|
9
9
|
*/
|
|
10
|
-
declare class UnsupportedUpdateOperationError extends Error {
|
|
10
|
+
export declare class UnsupportedUpdateOperationError extends Error {
|
|
11
11
|
/**
|
|
12
12
|
* The operation that was rejected (e.g. `"pipeline update"`, `"$addToSet"`).
|
|
13
13
|
*/
|
|
@@ -26,5 +26,4 @@ declare class UnsupportedUpdateOperationError extends Error {
|
|
|
26
26
|
constructor(operation: string, driver: string, hint?: string);
|
|
27
27
|
}
|
|
28
28
|
//#endregion
|
|
29
|
-
export { UnsupportedUpdateOperationError };
|
|
30
29
|
//# sourceMappingURL=unsupported-update-operation.error.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unsupported-update-operation.error.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/errors/unsupported-update-operation.error.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"unsupported-update-operation.error.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/errors/unsupported-update-operation.error.ts"],"mappings":";;;;;;;;;qBAQa,wCAAwC;;;;WAInC;;;;WAKA;;;;;;;;EAShB,YAAmB,mBAAmB,gBAAgB"}
|
|
@@ -2,6 +2,8 @@ import { DeleteStrategy } from "../types.mjs";
|
|
|
2
2
|
import { ModelSchema } from "../model/model.types.mjs";
|
|
3
3
|
import { Model } from "../model/model.mjs";
|
|
4
4
|
import { QueryBuilderContract } from "../contracts/query-builder.contract.mjs";
|
|
5
|
+
import "../contracts/index.mjs";
|
|
6
|
+
import "../index.mjs";
|
|
5
7
|
//#region ../../packages/cascade/src/events/model-events.d.ts
|
|
6
8
|
type OnValidatingEventContext = {
|
|
7
9
|
isInsert: boolean;
|
|
@@ -16,7 +18,7 @@ type OnDeletingEventContext = {
|
|
|
16
18
|
primaryKeyValue: string | number;
|
|
17
19
|
primaryKey: string;
|
|
18
20
|
};
|
|
19
|
-
type OnDeletedEventContext = OnDeletingEventContext & {
|
|
21
|
+
export type OnDeletedEventContext = OnDeletingEventContext & {
|
|
20
22
|
deletedCount: number;
|
|
21
23
|
trashRecord?: Record<string, unknown>;
|
|
22
24
|
};
|
|
@@ -39,9 +41,9 @@ type OnFetchedEventContext = {
|
|
|
39
41
|
* The list mirrors the hooks in the legacy ORM so downstream code can subscribe
|
|
40
42
|
* with consistent semantics.
|
|
41
43
|
*/
|
|
42
|
-
type ModelEventName = "fetching" | "hydrating" | "fetched" | "validating" | "validated" | "saving" | "saved" | "creating" | "created" | "updating" | "updated" | "deleting" | "deleted" | "restoring" | "restored";
|
|
44
|
+
export type ModelEventName = "fetching" | "hydrating" | "fetched" | "validating" | "validated" | "saving" | "saved" | "creating" | "created" | "updating" | "updated" | "deleting" | "deleted" | "restoring" | "restored";
|
|
43
45
|
/** Signature of an event listener registered against a model lifecycle hook. */
|
|
44
|
-
type ModelEventListener<TModel, TContext = unknown> = (model: TModel, context: TContext) => void | Promise<void>;
|
|
46
|
+
export type ModelEventListener<TModel, TContext = unknown> = (model: TModel, context: TContext) => void | Promise<void>;
|
|
45
47
|
/**
|
|
46
48
|
* Light-weight async event emitter used to power model lifecycle hooks.
|
|
47
49
|
*
|
|
@@ -49,7 +51,7 @@ type ModelEventListener<TModel, TContext = unknown> = (model: TModel, context: T
|
|
|
49
51
|
* re-use it in drivers, writers, and other core services without pulling in
|
|
50
52
|
* heavier event libraries.
|
|
51
53
|
*/
|
|
52
|
-
declare class ModelEvents<TModel> {
|
|
54
|
+
export declare class ModelEvents<TModel> {
|
|
53
55
|
readonly listeners: Map<ModelEventName, Set<ModelEventListener<TModel, unknown>>>;
|
|
54
56
|
/**
|
|
55
57
|
* Register a listener for the given event.
|
|
@@ -228,7 +230,7 @@ declare class ModelEvents<TModel> {
|
|
|
228
230
|
* Global event emitter invoked for every model instance, regardless of type.
|
|
229
231
|
* Useful for cross-cutting concerns like auditing or request-scoped enrichment.
|
|
230
232
|
*/
|
|
231
|
-
declare const globalModelEvents: ModelEvents<Model<ModelSchema>>;
|
|
233
|
+
export declare const globalModelEvents: ModelEvents<Model<ModelSchema>>;
|
|
232
234
|
//#endregion
|
|
233
|
-
export {
|
|
235
|
+
export {};
|
|
234
236
|
//# sourceMappingURL=model-events.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-events.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/events/model-events.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"model-events.d.mts","names":["_$__0.ModelSchema"],"sources":["../../../../../../../../packages/cascade/src/events/model-events.ts"],"mappings":";;;;;;;KAIK;EACH;EACA;;KAGG;EACH;EACA;;KAGG;EACH,UAAU;EACV;EACA;;YAGU,wBAAwB;EAClC;EACA,cAAc;;KAGX;EACH;EACA;;KAGG;EACH,OAAO;EACP,mBAAmB,WAAW;;KAG3B;EACH,OAAO;EACP;EACA;;;;;;;;YASU;;YAkBA,mBAAmB,QAAQ,uBACrC,OAAO,QACP,SAAS,oBACC;;;;;;;;qBASC,YAAY;WACP,WAAS,IAAA,gBAAA,IAAA,mBAAA;;;;;EAMlB,GAAG,oBACR,OAAO,gBACP,UAAU,mBAAmB,QAAQ;;;;EAUhC,KAAK,oBACV,OAAO,gBACP,UAAU,mBAAmB,QAAQ;;;;EAehC,IAAI,oBACT,OAAO,gBACP,UAAU,mBAAmB,QAAQ;;;;EAe1B,KAAK,oBAChB,OAAO,gBACP,OAAO,QACP,SAAS,WACR;;;;EAaU,aAAa,oBACxB,OAAO,sBACP,UAAU,WACT;;;;EAOI;;;;;;;;;;EAaA,SAAS,WAAW,sBACzB,UAAU,mBAAmB,QAAQ;;;;;;;;;EAahC,QAAQ,oBAAoB,UAAU,mBAAmB,QAAQ;;;;;;;;;EAYjE,WAAW,oBAChB,UAAU,mBAAmB,QAAQ;;;;;;;;;EAahC,UAAU,oBAAoB,UAAU,mBAAmB,QAAQ;;;;;;;;;EAYnE,WAAW,oBAChB,UAAU,mBAAmB,QAAQ;;;;;;;;;EAahC,UAAU,oBAAoB,UAAU,mBAAmB,QAAQ;;;;;;;;;EAYnE,WAAW,WAAW,wBAC3B,UAAU,mBAAmB,QAAQ;;;;;;;;;EAahC,UAAU,WAAW,uBAC1B,UAAU,mBAAmB,QAAQ;;;;;;;;;EAahC,aAAa,WAAW,0BAC7B,UAAU,mBAAmB,QAAQ;;;;;;;;;EAahC,YAAY,oBACjB,UAAU,mBAAmB,QAAQ;;;;;;;;;;EAchC,WAAW,WAAW,wBAC3B,UAAU,mBAAmB,QAAQ;;;;;;;;;;EAchC,YAAY,WAAW,yBAC5B,UAAU,mBAAmB,QAAQ;;;;;;;;;;EAchC,UAAU,WAAW,uBAC1B,UAAU,mBAAmB,QAAQ;;;;;;;;;EAahC,YAAY,oBACjB,UAAU,mBAAmB,QAAQ;;;;;;;;;EAahC,WAAW,oBAChB,UAAU,mBAAmB,QAAQ;;;;;;;;UAY/B;;;;;;qBAcG,mBAAiB,YAAA,MAAjBA"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ColumnExpression, ColumnExpressionInput } from "./column-expressions.mjs";
|
|
2
|
-
|
|
3
2
|
//#region ../../packages/cascade/src/expressions/aggregate-expressions.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Abstract aggregate expression format.
|
|
@@ -7,8 +6,10 @@ import { ColumnExpression, ColumnExpressionInput } from "./column-expressions.mj
|
|
|
7
6
|
* This format is database-agnostic and will be translated by each driver
|
|
8
7
|
* to their native syntax.
|
|
9
8
|
*/
|
|
10
|
-
type AggregateExpression = {
|
|
11
|
-
/** The aggregate function type */
|
|
9
|
+
export type AggregateExpression = {
|
|
10
|
+
/** The aggregate function type */
|
|
11
|
+
__agg: AggregateFunction;
|
|
12
|
+
/** The field to aggregate (null for count, or when `__expr` carries a composed expression) */
|
|
12
13
|
__field: string | null;
|
|
13
14
|
/**
|
|
14
15
|
* A typed column expression to aggregate over, when the aggregate operates
|
|
@@ -21,18 +22,18 @@ type AggregateExpression = {
|
|
|
21
22
|
/**
|
|
22
23
|
* Supported aggregate functions.
|
|
23
24
|
*/
|
|
24
|
-
type AggregateFunction = "count" | "countDistinct" | "sum" | "avg" | "min" | "max" | "first" | "last" | "distinct" | "floor";
|
|
25
|
+
export type AggregateFunction = "count" | "countDistinct" | "sum" | "avg" | "min" | "max" | "first" | "last" | "distinct" | "floor";
|
|
25
26
|
/**
|
|
26
27
|
* Checks if a value is an abstract aggregate expression.
|
|
27
28
|
*/
|
|
28
|
-
declare function isAggregateExpression(value: unknown): value is AggregateExpression;
|
|
29
|
+
export declare function isAggregateExpression(value: unknown): value is AggregateExpression;
|
|
29
30
|
/**
|
|
30
31
|
* Database-agnostic aggregation expression helpers.
|
|
31
32
|
*
|
|
32
33
|
* These helpers create abstract expressions that each driver translates
|
|
33
34
|
* to their native format.
|
|
34
35
|
*/
|
|
35
|
-
declare const $agg: {
|
|
36
|
+
export declare const $agg: {
|
|
36
37
|
/**
|
|
37
38
|
* Count documents in each group.
|
|
38
39
|
*
|
|
@@ -257,5 +258,4 @@ declare const $agg: {
|
|
|
257
258
|
last(field: string): AggregateExpression;
|
|
258
259
|
};
|
|
259
260
|
//#endregion
|
|
260
|
-
export { $agg, AggregateExpression, AggregateFunction, isAggregateExpression };
|
|
261
261
|
//# sourceMappingURL=aggregate-expressions.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aggregate-expressions.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/expressions/aggregate-expressions.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"aggregate-expressions.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/expressions/aggregate-expressions.ts"],"mappings":";;;;;;;;YAoCY;;EAEV,OAAO;;EAEP;;;;;;;EAOA,SAAS;;;;;YAMC;;;;wBAeI,sBAAsB,iBAAiB,SAAS;;;;;;;qBAenD;;;;;;;;;;;;;;;;;EAiBX,SAAS;;;;;;;;;;;;;;;;;;;;;EAwBT,cAAa,gBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8B9B,IAAG,OAAQ,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;EA+BnC,OAAM,qBAAsB;;;;;;;;;;;;;;;;;;EAyB5B,IAAG,gBAAiB;;;;;;;;;;;;;;;;;;EAqBpB,IAAG,gBAAiB;;;;;;;;;;;;;;;;;;EAqBpB,IAAG,gBAAiB;;;;;;;;;;;;;;;;;;;;EAuBpB,SAAQ,gBAAiB;;;;;;;;;;;;;;;;;;;EAsBzB,MAAK,gBAAiB;;;;;;;;;;;;;;;;;;;;EAuBtB,MAAK,gBAAiB;;;;;;;;;;;;;;;;;;;;EAuBtB,KAAI,gBAAiB"}
|