@warlock.js/cascade 5.31.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 +11 -0
- package/cjs/index.cjs +104 -85
- 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.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-id-generator.d.mts +2 -3
- package/esm/drivers/mongodb/mongodb-id-generator.d.mts.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-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/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-driver.d.mts +4 -5
- package/esm/drivers/postgres/postgres-driver.d.mts.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 -1
- 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-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-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/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/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/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/methods/accessor-methods.mjs +1 -1
- package/esm/model/methods/accessor-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/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.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/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/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/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/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-fanout.mjs +1 -1
- package/esm/sync/sync-manager.d.mts +2 -4
- package/esm/sync/sync-manager.d.mts.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/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/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/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register-model.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/model/register-model.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"register-model.d.mts","names":["_$__model_types0.ModelSchema"],"sources":["../../../../../../../../packages/cascade/src/model/register-model.ts"],"mappings":";;;;;;;;;;;;;;;;YAiBY,WAAW,WAAW,kBAAkB;;;;YAKxC;;;;;;;;;;;EAWV;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAsCc,cAAc,UAAU,wBACrB,UAAU,WAAW,QAAM,OAAS,GAAC,SAAW,sBAAsB,OAAK;wBAoD9E,wBAAwB,cAAc,OAAO,WAAW;;;;;;;;;;;;;;;wBAkBxD,qBAAqB,eAAY,WAAA,MAAjCA;;;;;;;;;;;;;;wBAiBA,4BAAwB,YAAA,WAAA,MAAxBA;;;;wBAOA;wBAIA,yBAAyB;wBAIzB,kBAAkB,OAAO,WAAW,WAAW;;;;;wBAW/C,kBAAkB,OAAO,WAAW,WAAW;;;;;;;wBAwB/C,qBAAqB,OAAO,uBAAuB,WAAW;;;;;;;;;;wBAiB9D,iBAAiB,OAAO;;;;;;;;;;;;;;;;;;;;wBA0BxB"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { ChildModel } from "./model.types.mjs";
|
|
2
1
|
import { BelongsToManyOptions, BelongsToOptions, HasManyOptions, HasOneOptions } from "../relations/types.mjs";
|
|
2
|
+
import { ChildModel } from "./model.types.mjs";
|
|
3
3
|
import { Model } from "./model.mjs";
|
|
4
4
|
import { Lazy } from "@mongez/reinforcements";
|
|
5
|
-
|
|
6
5
|
//#region ../../packages/cascade/src/model/relation-decorators.d.ts
|
|
7
6
|
/**
|
|
8
7
|
* Key used to stash relation definitions on the decorator metadata object.
|
|
9
8
|
* Exported so `@RegisterModel` (in `register-model.ts`) can read it back.
|
|
10
9
|
*/
|
|
11
|
-
declare const RELATION_METADATA_KEY: unique symbol;
|
|
10
|
+
export declare const RELATION_METADATA_KEY: unique symbol;
|
|
12
11
|
/**
|
|
13
12
|
* Declares a `belongsTo` relation on a model field.
|
|
14
13
|
*
|
|
@@ -34,7 +33,7 @@ declare const RELATION_METADATA_KEY: unique symbol;
|
|
|
34
33
|
* }
|
|
35
34
|
* ```
|
|
36
35
|
*/
|
|
37
|
-
declare const BelongsTo: (modelRelation: string | ChildModel<Model> | Lazy<unknown>, options?: string | BelongsToOptions | undefined) => <This>(_value: undefined, context: ClassFieldDecoratorContext<This>) => void;
|
|
36
|
+
export declare const BelongsTo: (modelRelation: string | ChildModel<Model> | Lazy<unknown>, options?: string | BelongsToOptions | undefined) => <This>(_value: undefined, context: ClassFieldDecoratorContext<This, unknown>) => void;
|
|
38
37
|
/**
|
|
39
38
|
* Declares a `hasOne` relation on a model field.
|
|
40
39
|
*
|
|
@@ -50,7 +49,7 @@ declare const BelongsTo: (modelRelation: string | ChildModel<Model> | Lazy<unkno
|
|
|
50
49
|
* }
|
|
51
50
|
* ```
|
|
52
51
|
*/
|
|
53
|
-
declare const HasOne: (modelRelation: string | ChildModel<Model> | Lazy<unknown>, options?: string | HasOneOptions | undefined) => <This>(_value: undefined, context: ClassFieldDecoratorContext<This>) => void;
|
|
52
|
+
export declare const HasOne: (modelRelation: string | ChildModel<Model> | Lazy<unknown>, options?: string | HasOneOptions | undefined) => <This>(_value: undefined, context: ClassFieldDecoratorContext<This, unknown>) => void;
|
|
54
53
|
/**
|
|
55
54
|
* Declares a `hasMany` relation on a model field.
|
|
56
55
|
*
|
|
@@ -66,7 +65,7 @@ declare const HasOne: (modelRelation: string | ChildModel<Model> | Lazy<unknown>
|
|
|
66
65
|
* }
|
|
67
66
|
* ```
|
|
68
67
|
*/
|
|
69
|
-
declare const HasMany: (modelRelation: string | ChildModel<Model> | Lazy<unknown>, options?: string | HasManyOptions | undefined) => <This>(_value: undefined, context: ClassFieldDecoratorContext<This>) => void;
|
|
68
|
+
export declare const HasMany: (modelRelation: string | ChildModel<Model> | Lazy<unknown>, options?: string | HasManyOptions | undefined) => <This>(_value: undefined, context: ClassFieldDecoratorContext<This, unknown>) => void;
|
|
70
69
|
/**
|
|
71
70
|
* Declares a `belongsToMany` relation on a model field.
|
|
72
71
|
*
|
|
@@ -82,7 +81,6 @@ declare const HasMany: (modelRelation: string | ChildModel<Model> | Lazy<unknown
|
|
|
82
81
|
* }
|
|
83
82
|
* ```
|
|
84
83
|
*/
|
|
85
|
-
declare const BelongsToMany: (modelRelation: string | ChildModel<Model> | Lazy<unknown>, options?: string | BelongsToManyOptions | undefined) => <This>(_value: undefined, context: ClassFieldDecoratorContext<This>) => void;
|
|
84
|
+
export declare const BelongsToMany: (modelRelation: string | ChildModel<Model> | Lazy<unknown>, options?: string | BelongsToManyOptions | undefined) => <This>(_value: undefined, context: ClassFieldDecoratorContext<This, unknown>) => void;
|
|
86
85
|
//#endregion
|
|
87
|
-
export { BelongsTo, BelongsToMany, HasMany, HasOne, RELATION_METADATA_KEY };
|
|
88
86
|
//# sourceMappingURL=relation-decorators.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relation-decorators.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/model/relation-decorators.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"relation-decorators.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/model/relation-decorators.ts"],"mappings":";;;;;;;;;qBA2Ha;;;;;;;;;;;;;;;;;;;;;;;;;;qBAsFA,YAAS,wBAzEM,WAAW,SAAS,eAAa,mBAAA,kCAGxC,MAAI,mBAAmB,SAAA,2BAAA;;;;;;;;;;;;;;;;qBAuF/B,SAAM,wBA1FS,WAAW,SAAS,eAAa,mBAAA,+BAGxC,MAAI,mBAAmB,SAAA,2BAAA;;;;;;;;;;;;;;;;qBAwG/B,UAAO,wBA3GQ,WAAW,SAAS,eAAa,mBAAA,gCAGxC,MAAI,mBAAmB,SAAA,2BAAA;;;;;;;;;;;;;;;;qBAyH/B,gBAAa,wBA5HE,WAAW,SAAS,eAAa,mBAAA,sCAGxC,MAAI,mBAAmB,SAAA,2BAAA"}
|
|
@@ -5,20 +5,25 @@
|
|
|
5
5
|
* beyond "look up by registry name".
|
|
6
6
|
*/
|
|
7
7
|
type DataSourceSelector = {
|
|
8
|
-
/** Data source name from the registry. Omit to use the default source. */
|
|
8
|
+
/** Data source name from the registry. Omit to use the default source. */
|
|
9
|
+
readonly connection?: string;
|
|
9
10
|
};
|
|
10
11
|
/**
|
|
11
12
|
* Result of {@link createDatabase}.
|
|
12
13
|
*/
|
|
13
|
-
type CreateDatabaseResult = {
|
|
14
|
-
/** True if a new database was created; false if it already existed. */
|
|
14
|
+
export type CreateDatabaseResult = {
|
|
15
|
+
/** True if a new database was created; false if it already existed. */
|
|
16
|
+
readonly created: boolean;
|
|
17
|
+
/** The database name that was passed to the operation. */
|
|
15
18
|
readonly name: string;
|
|
16
19
|
};
|
|
17
20
|
/**
|
|
18
21
|
* Result of {@link dropAllTables}.
|
|
19
22
|
*/
|
|
20
|
-
type DropAllTablesResult = {
|
|
21
|
-
/** Names of tables that were dropped, in the order returned by the driver. */
|
|
23
|
+
export type DropAllTablesResult = {
|
|
24
|
+
/** Names of tables that were dropped, in the order returned by the driver. */
|
|
25
|
+
readonly tables: string[];
|
|
26
|
+
/** Count of dropped tables (equal to `tables.length`). */
|
|
22
27
|
readonly dropped: number;
|
|
23
28
|
};
|
|
24
29
|
/**
|
|
@@ -30,7 +35,7 @@ type DropAllTablesResult = {
|
|
|
30
35
|
* await createDatabase("analytics");
|
|
31
36
|
* await createDatabase("analytics", { connection: "warehouse" });
|
|
32
37
|
*/
|
|
33
|
-
declare function createDatabase(name: string, options?: DataSourceSelector): Promise<CreateDatabaseResult>;
|
|
38
|
+
export declare function createDatabase(name: string, options?: DataSourceSelector): Promise<CreateDatabaseResult>;
|
|
34
39
|
/**
|
|
35
40
|
* Drop every table on the configured data source. Lists tables first so the
|
|
36
41
|
* caller receives the names that were affected — useful for printing,
|
|
@@ -40,7 +45,7 @@ declare function createDatabase(name: string, options?: DataSourceSelector): Pro
|
|
|
40
45
|
* const { tables, dropped } = await dropAllTables();
|
|
41
46
|
* console.log(`Dropped ${dropped} tables: ${tables.join(", ")}`);
|
|
42
47
|
*/
|
|
43
|
-
declare function dropAllTables(options?: DataSourceSelector): Promise<DropAllTablesResult>;
|
|
48
|
+
export declare function dropAllTables(options?: DataSourceSelector): Promise<DropAllTablesResult>;
|
|
44
49
|
//#endregion
|
|
45
|
-
export {
|
|
50
|
+
export {};
|
|
46
51
|
//# sourceMappingURL=database.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"database.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/operations/database.ts"],"mappings":";;;;;;KAOK
|
|
1
|
+
{"version":3,"file":"database.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/operations/database.ts"],"mappings":";;;;;;KAOK;;WAEM;;;;;YAMC;;WAED;;WAEA;;;;;YAMC;;WAED;;WAEA;;;;;;;;;;;wBAYW,eACpB,cACA,UAAS,qBACR,QAAQ;;;;;;;;;;wBAgBW,cACpB,UAAS,qBACR,QAAQ"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { CreateDatabaseResult, DropAllTablesResult, createDatabase, dropAllTables } from "./database.mjs";
|
|
2
|
-
import { ExportMigrationsSQLOptions, PendingMigration, RollbackMigrationsOptions, exportMigrationsSQL, freshMigrate, listExecutedMigrations, listPendingMigrations, rollbackMigrations, runMigrations } from "./migrations.mjs";
|
|
2
|
+
import { ExportMigrationsSQLOptions, PendingMigration, RollbackMigrationsOptions, exportMigrationsSQL, freshMigrate, listExecutedMigrations, listPendingMigrations, rollbackMigrations, runMigrations } from "./migrations.mjs";
|
|
3
|
+
export { CreateDatabaseResult, DropAllTablesResult, ExportMigrationsSQLOptions, PendingMigration, RollbackMigrationsOptions, createDatabase, dropAllTables, exportMigrationsSQL, freshMigrate, listExecutedMigrations, listPendingMigrations, rollbackMigrations, runMigrations };
|
package/esm/operations/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createDatabase, dropAllTables } from "./database.mjs";
|
|
2
2
|
import { exportMigrationsSQL, freshMigrate, listExecutedMigrations, listPendingMigrations, rollbackMigrations, runMigrations } from "./migrations.mjs";
|
|
3
3
|
|
|
4
|
-
export {
|
|
4
|
+
export { createDatabase, dropAllTables, exportMigrationsSQL, freshMigrate, listExecutedMigrations, listPendingMigrations, rollbackMigrations, runMigrations };
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import { MigrationRecord, MigrationResult } from "../migration/types.mjs";
|
|
2
|
-
|
|
3
2
|
//#region ../../packages/cascade/src/operations/migrations.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Options for exporting migrations as SQL files.
|
|
6
5
|
*/
|
|
7
|
-
type ExportMigrationsSQLOptions = {
|
|
8
|
-
/** Export only pending migrations. Default: false (exports all registered). */
|
|
6
|
+
export type ExportMigrationsSQLOptions = {
|
|
7
|
+
/** Export only pending migrations. Default: false (exports all registered). */
|
|
8
|
+
readonly pendingOnly?: boolean;
|
|
9
|
+
/** Strip generated block comments and blank lines from the output. */
|
|
9
10
|
readonly compact?: boolean;
|
|
10
11
|
};
|
|
11
12
|
/**
|
|
12
13
|
* Options for rolling back migrations.
|
|
13
14
|
*/
|
|
14
|
-
type RollbackMigrationsOptions = {
|
|
15
|
-
/** Roll back every executed migration. Overrides `batches` when true. */
|
|
15
|
+
export type RollbackMigrationsOptions = {
|
|
16
|
+
/** Roll back every executed migration. Overrides `batches` when true. */
|
|
17
|
+
readonly all?: boolean;
|
|
18
|
+
/** Number of batches to roll back when `all` is not set. Default: 1. */
|
|
16
19
|
readonly batches?: number;
|
|
17
20
|
};
|
|
18
21
|
/**
|
|
@@ -26,7 +29,7 @@ type RollbackMigrationsOptions = {
|
|
|
26
29
|
* migrationRunner.registerMany([CreateUsersTable, AddEmailIndex]);
|
|
27
30
|
* const results = await runMigrations();
|
|
28
31
|
*/
|
|
29
|
-
declare function runMigrations(): Promise<MigrationResult[]>;
|
|
32
|
+
export declare function runMigrations(): Promise<MigrationResult[]>;
|
|
30
33
|
/**
|
|
31
34
|
* Roll back executed migrations. By default rolls back the most recent batch;
|
|
32
35
|
* pass `all: true` to undo every executed migration, or `batches: N` to undo
|
|
@@ -37,7 +40,7 @@ declare function runMigrations(): Promise<MigrationResult[]>;
|
|
|
37
40
|
* await rollbackMigrations({ batches: 3 }); // last three batches
|
|
38
41
|
* await rollbackMigrations({ all: true }); // everything
|
|
39
42
|
*/
|
|
40
|
-
declare function rollbackMigrations(options?: RollbackMigrationsOptions): Promise<MigrationResult[]>;
|
|
43
|
+
export declare function rollbackMigrations(options?: RollbackMigrationsOptions): Promise<MigrationResult[]>;
|
|
41
44
|
/**
|
|
42
45
|
* Roll back every executed migration, then run every registered migration.
|
|
43
46
|
* Equivalent to `rollbackMigrations({ all: true })` followed by
|
|
@@ -46,7 +49,7 @@ declare function rollbackMigrations(options?: RollbackMigrationsOptions): Promis
|
|
|
46
49
|
* @example
|
|
47
50
|
* await freshMigrate();
|
|
48
51
|
*/
|
|
49
|
-
declare function freshMigrate(): Promise<MigrationResult[]>;
|
|
52
|
+
export declare function freshMigrate(): Promise<MigrationResult[]>;
|
|
50
53
|
/**
|
|
51
54
|
* Export registered migrations as phase-ordered `.up.sql` and `.down.sql`
|
|
52
55
|
* files under `<cwd>/database/sql/`.
|
|
@@ -55,7 +58,7 @@ declare function freshMigrate(): Promise<MigrationResult[]>;
|
|
|
55
58
|
* await exportMigrationsSQL();
|
|
56
59
|
* await exportMigrationsSQL({ pendingOnly: true, compact: true });
|
|
57
60
|
*/
|
|
58
|
-
declare function exportMigrationsSQL(options?: ExportMigrationsSQLOptions): Promise<void>;
|
|
61
|
+
export declare function exportMigrationsSQL(options?: ExportMigrationsSQLOptions): Promise<void>;
|
|
59
62
|
/**
|
|
60
63
|
* Return the migration records persisted in the migrations table — one entry
|
|
61
64
|
* per migration that has ever been executed against the configured data
|
|
@@ -65,13 +68,15 @@ declare function exportMigrationsSQL(options?: ExportMigrationsSQLOptions): Prom
|
|
|
65
68
|
* const executed = await listExecutedMigrations();
|
|
66
69
|
* console.log(executed.map((record) => record.name));
|
|
67
70
|
*/
|
|
68
|
-
declare function listExecutedMigrations(): Promise<MigrationRecord[]>;
|
|
71
|
+
export declare function listExecutedMigrations(): Promise<MigrationRecord[]>;
|
|
69
72
|
/**
|
|
70
73
|
* A registered migration that has not yet been executed against the configured
|
|
71
74
|
* data source.
|
|
72
75
|
*/
|
|
73
|
-
type PendingMigration = {
|
|
74
|
-
/** Migration name/identifier, as it will be recorded once executed. */
|
|
76
|
+
export type PendingMigration = {
|
|
77
|
+
/** Migration name/identifier, as it will be recorded once executed. */
|
|
78
|
+
readonly name: string;
|
|
79
|
+
/** Creation timestamp, when the migration carries one. */
|
|
75
80
|
readonly createdAt?: string;
|
|
76
81
|
};
|
|
77
82
|
/**
|
|
@@ -89,7 +94,6 @@ type PendingMigration = {
|
|
|
89
94
|
* const pending = await listPendingMigrations();
|
|
90
95
|
* console.log(pending.map((migration) => migration.name));
|
|
91
96
|
*/
|
|
92
|
-
declare function listPendingMigrations(): Promise<PendingMigration[]>;
|
|
97
|
+
export declare function listPendingMigrations(): Promise<PendingMigration[]>;
|
|
93
98
|
//#endregion
|
|
94
|
-
export { ExportMigrationsSQLOptions, PendingMigration, RollbackMigrationsOptions, exportMigrationsSQL, freshMigrate, listExecutedMigrations, listPendingMigrations, rollbackMigrations, runMigrations };
|
|
95
99
|
//# sourceMappingURL=migrations.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrations.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/operations/migrations.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"migrations.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/operations/migrations.ts"],"mappings":";;;;;YAMY;;WAED;;WAEA;;;;;YAMC;;WAED;;WAEA;;;;;;;;;;;;;wBAcW,iBAAiB,QAAQ;;;;;;;;;;;wBAczB,mBACpB,UAAS,4BACR,QAAQ;;;;;;;;;wBAkBW,gBAAgB,QAAQ;;;;;;;;;wBAYxB,oBAAoB,UAAS,6BAAkC;;;;;;;;;;wBAa/D,0BAA0B,QAAQ;;;;;YAQ5C;;WAED;;WAEA;;;;;;;;;;;;;;;;;wBAkBW,yBAAyB,QAAQ"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { GroupByInput, HavingInput, JoinOptions, LeanDocument, LockForUpdateOptions, OrderDirection, RawExpression, WhereCallback, WhereObject, WhereOperator } from "../contracts/query-builder.contract.mjs";
|
|
2
|
-
|
|
3
2
|
//#region ../../packages/cascade/src/query-builder/query-builder.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* A single recorded query operation.
|
|
6
5
|
* `type` is the discriminator; `data` carries all parameters.
|
|
7
6
|
*/
|
|
8
|
-
type Op = {
|
|
7
|
+
export type Op = {
|
|
9
8
|
readonly type: string;
|
|
10
9
|
readonly data: Record<string, unknown>;
|
|
11
10
|
};
|
|
@@ -32,7 +31,7 @@ type Op = {
|
|
|
32
31
|
* // The sub-QB's operations[] are captured and stored in the joinWith op data.
|
|
33
32
|
* ```
|
|
34
33
|
*/
|
|
35
|
-
declare class QueryBuilder<T = unknown> {
|
|
34
|
+
export declare class QueryBuilder<T = unknown> {
|
|
36
35
|
/** Flat, ordered list of recorded operations. Public for parser access. */
|
|
37
36
|
operations: Op[];
|
|
38
37
|
/**
|
|
@@ -619,5 +618,4 @@ declare class QueryBuilder<T = unknown> {
|
|
|
619
618
|
when<V>(condition: V | boolean, callback: (builder: this, value: V) => void, otherwise?: (builder: this) => void): this;
|
|
620
619
|
}
|
|
621
620
|
//#endregion
|
|
622
|
-
export { Op, QueryBuilder };
|
|
623
621
|
//# sourceMappingURL=query-builder.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-builder.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/query-builder/query-builder.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"query-builder.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/query-builder/query-builder.ts"],"mappings":";;;;;;YAmDY;WACD;WACA,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;qBA0CJ,aAAa;;EAMjB,YAAY;;;;;;;;;;YAWT,SAAS;;EAOZ,sBAAsB;;EAEtB,uBAAuB,gBAAgB;;EAEvC,sBAAsB;;EAEtB;;EAOA,oBAAoB,wBAAwB;;EAE5C,gBAAgB;IAAc;IAAkB,gBAAgB;;;EAEhE,sBAAsB;;EAEtB;;EAOA;;;;;YAUG,aAAa,cAAc,MAAM;;;;;;;;EAkBpC,UAAU,kBAAkB;;;;;;;EA8B5B;;;;;;;;;;;;;;YA+BG,YAAY;;;;;;;EAUf;;;;;;;;;;EAyBA,QAAQ,aAAa,aAAa;;EAUlC,sBAAsB;;EAMtB;;;;;EASA,MAAM,sBAAsB;;;;;;;;;;EAuB5B,MAAM,eAAe;EACrB,MAAM,eAAe,UAAU,eAAe;EAC9C,MAAM,YAAY;EAClB,MAAM,UAAU,cAAc;;;;;EAqC9B,aAAa,YAAY;;;;;;;EAczB,QAAQ,eAAe;EACvB,QAAQ,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AAW,yBACX;;;;;EAWK,uBAAuB,YAAY,YAAY;;EAK/C,WAAW,cAAc;;EASzB,cAAc,eAAe,YAAY,eAAe;;EAKxD,aAAa;;EAKb,aAAa,QAAQ,eAAe,gBAAgB;;EAOpD,eAAe,QAAQ,eAAe,gBAAgB;;EAOtD,aAAa,MAAM;;EAMnB,SAAS;;;;;EAST;;EASA;;EAKA;;EAKA,UAAU;;;;;EASV,eAAe;;;;;;;;EAiBf,QAAQ,eAAe,YAAY;EACnC,QAAQ,QAAQ,eAAe;;EAgB/B,YAAY;;;;;;EASZ,WAAW,YAAY,eAAe;;;;;EAStC,cAAc;;EAOd,OAAO;;YAKJ;;;;;YAQA,YAAY;;YAKZ,aAAa;;EAYhB,MAAM;;EAMN,KAAK;;EAML,OAAO;;EAKP,KAAK;;;;;;;;;;;EAkBL,cAAc,UAAU;;;;;;EAsBxB,QAAQ,OAAO;;EAOf,WAAW,YAAY,eAAe;;;;;;;;;EAatC,OAAO,eAAe;EACtB,OAAO,eAAe,UAAU,eAAe;EAC/C,OAAO,WAAW;;EAwBlB,UAAU,YAAY,eAAe;;;;;EAarC,IAAI,WAAW;;;;;;;;EAYf,KAAK,GACV,WAAW,aACX,WAAW,eAAe,OAAO,YACjC,aAAa"}
|
|
@@ -1209,17 +1209,18 @@ var QueryBuilder = class QueryBuilder {
|
|
|
1209
1209
|
having(...args) {
|
|
1210
1210
|
if (args.length === 1) {
|
|
1211
1211
|
const input = args[0];
|
|
1212
|
-
if (Array.isArray(input))
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1212
|
+
if (Array.isArray(input)) {
|
|
1213
|
+
if (input.length === 2) this.addOperation("having", {
|
|
1214
|
+
field: input[0],
|
|
1215
|
+
operator: "=",
|
|
1216
|
+
value: input[1]
|
|
1217
|
+
});
|
|
1218
|
+
else this.addOperation("having", {
|
|
1219
|
+
field: input[0],
|
|
1220
|
+
operator: input[1],
|
|
1221
|
+
value: input[2]
|
|
1222
|
+
});
|
|
1223
|
+
} else for (const [key, value] of Object.entries(input)) this.addOperation("having", {
|
|
1223
1224
|
field: key,
|
|
1224
1225
|
operator: "=",
|
|
1225
1226
|
value
|