@warlock.js/cascade 5.31.0 → 5.33.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/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,15 +1,14 @@
|
|
|
1
1
|
import { SyncContext, SyncInstruction } from "./types.mjs";
|
|
2
|
-
|
|
3
2
|
//#region ../../packages/cascade/src/sync/sync-context.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Default maximum sync depth.
|
|
6
5
|
* Prevents infinite sync chains.
|
|
7
6
|
*/
|
|
8
|
-
declare const DEFAULT_MAX_SYNC_DEPTH = 3;
|
|
7
|
+
export declare const DEFAULT_MAX_SYNC_DEPTH = 3;
|
|
9
8
|
/**
|
|
10
9
|
* Manages sync context and provides validation utilities.
|
|
11
10
|
*/
|
|
12
|
-
declare class SyncContextManager {
|
|
11
|
+
export declare class SyncContextManager {
|
|
13
12
|
/**
|
|
14
13
|
* Creates a new sync context from a sync instruction.
|
|
15
14
|
*
|
|
@@ -65,5 +64,4 @@ declare class SyncContextManager {
|
|
|
65
64
|
static canSyncDeeper(currentDepth: number, maxDepth: number): boolean;
|
|
66
65
|
}
|
|
67
66
|
//#endregion
|
|
68
|
-
export { DEFAULT_MAX_SYNC_DEPTH, SyncContextManager };
|
|
69
67
|
//# sourceMappingURL=sync-context.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-context.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/sync/sync-context.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"sync-context.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/sync/sync-context.ts"],"mappings":";;;;;;qBAYa;;;;qBAKA;;;;;;;;SAQG,cAAc,aAAa,iBAAiB,wBAAwB;;;;;;;;;;;SAwBpE,SACZ,eACA,iBACA,qBACA,kBACA;IACG;IAAgB;;;;;;;;;SA2BP,SAAS,iBAAiB;;;;;;;;SAW1B,YAAY,iBAAiB;;;;;;;SAU7B,YAAY;;;;;;;;SAWZ,cAAc,sBAAsB"}
|
package/esm/sync/sync-fanout.mjs
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { ChildModel } from "../model/model.types.mjs";
|
|
2
1
|
import { SyncConfig, SyncResult } from "./types.mjs";
|
|
2
|
+
import { ChildModel } from "../model/model.types.mjs";
|
|
3
3
|
import { Model } from "../model/model.mjs";
|
|
4
4
|
import { DriverContract } from "../contracts/database-driver.contract.mjs";
|
|
5
|
-
|
|
6
5
|
//#region ../../packages/cascade/src/sync/sync-manager.d.ts
|
|
7
6
|
/**
|
|
8
7
|
* Manages sync operations across models with multi-level support.
|
|
9
8
|
*/
|
|
10
|
-
declare class SyncManager {
|
|
9
|
+
export declare class SyncManager {
|
|
11
10
|
private readonly sourceModel;
|
|
12
11
|
private readonly driver;
|
|
13
12
|
/**
|
|
@@ -170,5 +169,4 @@ declare class SyncManager {
|
|
|
170
169
|
private createEmptyResult;
|
|
171
170
|
}
|
|
172
171
|
//#endregion
|
|
173
|
-
export { SyncManager };
|
|
174
172
|
//# sourceMappingURL=sync-manager.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-manager.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/sync/sync-manager.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"sync-manager.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/sync/sync-manager.ts"],"mappings":";;;;;;;;qBAqBa;mBACM;mBACA;;;;;;;EAQjB,YAAmB,aAAa,WAAW,QAAQ,QAAQ;;;;;;;;;EAa9C,WACX,2BACA,aAAa,0BAA0B,OACvC,0BACC,QAAQ;;;;;;;;;;;EAgEE,qBACX,2BACA,aAAa,0BAA0B,OACvC,yBACA,QAAQ,aACP,QAAQ;;;;;;;;;EA0DE,qBACX,2BACA,QAAQ,aACP,QAAQ;;;;;;;EAsDE,WAAW,4BAA4B,QAAQ;;;;;;;UAsD9C;;;;;;;;;UAiDA;;;;;;;;;;UA0CN;;;;;;;;;UAwCA;;;;;;;;UA+BA;;;;;;;;UAiBA;;;;;;;;;UAqBM;;;;;;;;UAmEN;;;;;;;UAmBA;;;;;;;;UAsBA;;;;;;;;UAeM;;;;;;UAoCN;;;;;;UAiBM;;;;;;UAuBA;;;;;;UAuBN"}
|
package/esm/sync/types.d.mts
CHANGED
|
@@ -1,94 +1,142 @@
|
|
|
1
1
|
import { ChildModel } from "../model/model.types.mjs";
|
|
2
2
|
import { Model } from "../model/model.mjs";
|
|
3
|
-
|
|
4
3
|
//#region ../../packages/cascade/src/sync/types.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Context information for a sync operation.
|
|
7
6
|
* Tracks the source, target, chain, and results of a sync operation.
|
|
8
7
|
*/
|
|
9
|
-
type SyncContext = {
|
|
10
|
-
/** Source model name (e.g., "Category") */
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
export type SyncContext = {
|
|
9
|
+
/** Source model name (e.g., "Category") */
|
|
10
|
+
sourceModel: string;
|
|
11
|
+
/** Source model primary key value */
|
|
12
|
+
sourceId: string | number;
|
|
13
|
+
/** Current depth in the sync chain (1, 2, 3...) */
|
|
14
|
+
currentDepth: number;
|
|
15
|
+
/** Chain of model names in the sync path (e.g., ["Category", "Product"]) */
|
|
16
|
+
syncChain: string[];
|
|
17
|
+
/** Target model name being synced to */
|
|
18
|
+
targetModel: string;
|
|
19
|
+
/** Filter to identify documents to update in target */
|
|
20
|
+
filter: Record<string, unknown>;
|
|
21
|
+
/** Update operations to apply to matched documents */
|
|
22
|
+
update: Record<string, unknown>;
|
|
23
|
+
/** Number of documents affected by this sync operation */
|
|
24
|
+
affectedCount: number;
|
|
25
|
+
/** Timestamp when the sync operation was executed */
|
|
18
26
|
timestamp: Date;
|
|
19
27
|
};
|
|
20
28
|
/**
|
|
21
29
|
* Result of a sync operation.
|
|
22
30
|
* Contains success status, counts, and error details.
|
|
23
31
|
*/
|
|
24
|
-
type SyncResult = {
|
|
25
|
-
/** Whether the overall sync operation succeeded */
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
export type SyncResult = {
|
|
33
|
+
/** Whether the overall sync operation succeeded */
|
|
34
|
+
success: boolean;
|
|
35
|
+
/** Total number of sync instructions attempted */
|
|
36
|
+
attempted: number;
|
|
37
|
+
/** Number of sync instructions that succeeded */
|
|
38
|
+
succeeded: number;
|
|
39
|
+
/** Number of sync instructions that failed */
|
|
40
|
+
failed: number;
|
|
41
|
+
/** Detailed error information for failed operations */
|
|
29
42
|
errors: Array<{
|
|
30
43
|
instruction: SyncInstruction;
|
|
31
44
|
error: Error;
|
|
32
|
-
}>;
|
|
33
|
-
|
|
45
|
+
}>;
|
|
46
|
+
/** Maximum depth reached in the sync chain */
|
|
47
|
+
depthReached: number;
|
|
48
|
+
/** All sync contexts created during the operation */
|
|
34
49
|
contexts: SyncContext[];
|
|
35
50
|
};
|
|
36
51
|
/**
|
|
37
52
|
* A single sync instruction to be executed.
|
|
38
53
|
* Contains all information needed to perform a sync update.
|
|
39
54
|
*/
|
|
40
|
-
type SyncInstruction = {
|
|
41
|
-
/** Target table/collection name */
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
55
|
+
export type SyncInstruction = {
|
|
56
|
+
/** Target table/collection name */
|
|
57
|
+
targetTable: string;
|
|
58
|
+
/** Target model name */
|
|
59
|
+
targetModel: string;
|
|
60
|
+
/** Filter to identify documents to update */
|
|
61
|
+
filter: Record<string, unknown>;
|
|
62
|
+
/** Update operations to apply */
|
|
63
|
+
update: Record<string, unknown>;
|
|
64
|
+
/** Current depth in the sync chain */
|
|
65
|
+
depth: number;
|
|
66
|
+
/** Chain of model names leading to this instruction */
|
|
67
|
+
chain: string[];
|
|
68
|
+
/** Source model name */
|
|
69
|
+
sourceModel: string;
|
|
70
|
+
/** Source model ID */
|
|
71
|
+
sourceId: string | number;
|
|
72
|
+
/** Whether this is an array update (requires positional operator) */
|
|
73
|
+
isArrayUpdate?: boolean;
|
|
74
|
+
/** Array field path for positional updates */
|
|
75
|
+
arrayField?: string;
|
|
76
|
+
/** Identifier field for array matching */
|
|
77
|
+
identifierField?: string;
|
|
78
|
+
/** Identifier value for array matching */
|
|
52
79
|
identifierValue?: string | number;
|
|
53
80
|
};
|
|
54
81
|
/**
|
|
55
82
|
* Configuration for a single sync relationship.
|
|
56
83
|
*/
|
|
57
|
-
type SyncConfig = {
|
|
58
|
-
/** Target field path in the target model (e.g., "category" or "products") */
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
84
|
+
export type SyncConfig = {
|
|
85
|
+
/** Target field path in the target model (e.g., "category" or "products") */
|
|
86
|
+
targetField: string;
|
|
87
|
+
/** Whether this is a many relationship (array of embedded documents) */
|
|
88
|
+
isMany: boolean;
|
|
89
|
+
/** Method name to call on source model to get embedded data */
|
|
90
|
+
embedKey: string;
|
|
91
|
+
/** Field name to use as identifier in array matching (for isMany) */
|
|
92
|
+
identifierField: string;
|
|
93
|
+
/** Maximum sync depth allowed from this relationship */
|
|
94
|
+
maxSyncDepth: number;
|
|
95
|
+
/** Whether to prevent circular sync chains */
|
|
96
|
+
preventCircularSync: boolean;
|
|
97
|
+
/** Fields to watch for changes (empty = all fields) */
|
|
98
|
+
watchFields: string[];
|
|
99
|
+
/** Whether to unset the field when source is deleted */
|
|
100
|
+
unsetOnDelete: boolean;
|
|
101
|
+
/** Target model class (for chaining) */
|
|
66
102
|
targetModelClass: ChildModel<Model>;
|
|
67
103
|
};
|
|
68
104
|
/**
|
|
69
105
|
* Options for building sync instructions.
|
|
70
106
|
*/
|
|
71
|
-
type SyncInstructionOptions = {
|
|
72
|
-
/** Current depth in the sync chain */
|
|
73
|
-
|
|
74
|
-
|
|
107
|
+
export type SyncInstructionOptions = {
|
|
108
|
+
/** Current depth in the sync chain */
|
|
109
|
+
currentDepth: number;
|
|
110
|
+
/** Chain of model names leading to this point */
|
|
111
|
+
syncChain: string[];
|
|
112
|
+
/** Maximum allowed depth for this sync operation */
|
|
113
|
+
maxDepth: number;
|
|
114
|
+
/** Whether to prevent circular references */
|
|
75
115
|
preventCircular: boolean;
|
|
76
116
|
};
|
|
77
117
|
/**
|
|
78
118
|
* Standard embed proeprties names.
|
|
79
119
|
*/
|
|
80
|
-
type EmbedKey = "embedData" | "embedParent" | "embedMinimal";
|
|
120
|
+
export type EmbedKey = "embedData" | "embedParent" | "embedMinimal";
|
|
81
121
|
/**
|
|
82
122
|
* Event payload for sync events.
|
|
83
123
|
*/
|
|
84
|
-
type SyncEventPayload = {
|
|
85
|
-
/** Source model name */
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
124
|
+
export type SyncEventPayload = {
|
|
125
|
+
/** Source model name */
|
|
126
|
+
sourceModel: string;
|
|
127
|
+
/** Source model ID */
|
|
128
|
+
sourceId: string | number;
|
|
129
|
+
/** Target model name */
|
|
130
|
+
targetModel: string;
|
|
131
|
+
/** Filter used to identify target documents */
|
|
132
|
+
filter: Record<string, unknown>;
|
|
133
|
+
/** Update operations applied */
|
|
134
|
+
update: Record<string, unknown>;
|
|
135
|
+
/** Number of documents affected */
|
|
136
|
+
affectedCount: number;
|
|
137
|
+
/** Current depth in sync chain */
|
|
138
|
+
depth: number;
|
|
139
|
+
/** Sync chain path */
|
|
92
140
|
chain: string[];
|
|
93
141
|
};
|
|
94
142
|
/**
|
|
@@ -96,16 +144,26 @@ type SyncEventPayload = {
|
|
|
96
144
|
*
|
|
97
145
|
* Holds all settings for how a source model syncs to a target model.
|
|
98
146
|
*/
|
|
99
|
-
type ModelSyncConfig = {
|
|
100
|
-
/** Source model class that triggers sync on changes */
|
|
101
|
-
readonly
|
|
102
|
-
|
|
103
|
-
readonly
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
147
|
+
export type ModelSyncConfig = {
|
|
148
|
+
/** Source model class that triggers sync on changes */
|
|
149
|
+
readonly sourceModel: ChildModel<Model>;
|
|
150
|
+
/** Target model class that receives synced data */
|
|
151
|
+
readonly targetModel: ChildModel<Model>;
|
|
152
|
+
/** Field path in target model where data is embedded */
|
|
153
|
+
readonly targetField: string;
|
|
154
|
+
/** Whether this syncs to an array field (true) or single field (false) */
|
|
155
|
+
readonly isMany: boolean;
|
|
156
|
+
/** Method name on source model to get embedded data */
|
|
157
|
+
embedKey: string | string[];
|
|
158
|
+
/** Field name used as identifier when syncing to arrays */
|
|
159
|
+
identifierField: string;
|
|
160
|
+
/** Maximum depth for chained sync operations */
|
|
161
|
+
maxSyncDepth: number;
|
|
162
|
+
/** Fields to watch - sync only triggers when these change (empty = all) */
|
|
163
|
+
watchFields: string[];
|
|
164
|
+
/** Whether to unset the target field when source is deleted */
|
|
165
|
+
unsetOnDelete: boolean;
|
|
166
|
+
/** Whether to delete target documents when source is deleted */
|
|
109
167
|
removeOnDelete: boolean;
|
|
110
168
|
};
|
|
111
169
|
/**
|
|
@@ -121,7 +179,7 @@ type ModelSyncConfig = {
|
|
|
121
179
|
* .unsetOnDelete();
|
|
122
180
|
* ```
|
|
123
181
|
*/
|
|
124
|
-
interface ModelSyncOperationContract {
|
|
182
|
+
export interface ModelSyncOperationContract {
|
|
125
183
|
/**
|
|
126
184
|
* Set the embed method to call on source model.
|
|
127
185
|
*
|
|
@@ -183,7 +241,7 @@ interface ModelSyncOperationContract {
|
|
|
183
241
|
* });
|
|
184
242
|
* ```
|
|
185
243
|
*/
|
|
186
|
-
interface ModelSyncContract {
|
|
244
|
+
export interface ModelSyncContract {
|
|
187
245
|
/**
|
|
188
246
|
* Create a sync operation for a single embedded document.
|
|
189
247
|
*
|
|
@@ -211,5 +269,4 @@ interface ModelSyncContract {
|
|
|
211
269
|
register(callback: () => void): () => void;
|
|
212
270
|
}
|
|
213
271
|
//#endregion
|
|
214
|
-
export { EmbedKey, ModelSyncConfig, ModelSyncContract, ModelSyncOperationContract, SyncConfig, SyncContext, SyncEventPayload, SyncInstruction, SyncInstructionOptions, SyncResult };
|
|
215
272
|
//# sourceMappingURL=types.d.mts.map
|
package/esm/sync/types.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/sync/types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/sync/types.ts"],"mappings":";;;;;;;YAYY;;EAEV;;EAGA;;EAGA;;EAGA;;EAGA;;EAGA,QAAQ;;EAGR,QAAQ;;EAGR;;EAGA,WAAW;;;;;;YAOD;;EAEV;;EAGA;;EAGA;;EAGA;;EAGA,QAAQ;IAAQ,aAAa;IAAiB,OAAO;;;EAGrD;;EAGA,UAAU;;;;;;YAOA;;EAEV;;EAGA;;EAGA,QAAQ;;EAGR,QAAQ;;EAGR;;EAGA;;EAGA;;EAGA;;EAGA;;EAGA;;EAGA;;EAGA;;;;;YAMU;;EAEV;;EAGA;;EAGA;;EAGA;;EAGA;;EAGA;;EAGA;;EAGA;;EAGA,kBAAkB,WAAW;;;;;YAMnB;;EAEV;;EAGA;;EAGA;;EAGA;;;;;YA0BU;;;;YAKA;;EAEV;;EAGA;;EAGA;;EAGA,QAAQ;;EAGR,QAAQ;;EAGR;;EAGA;;EAGA;;;;;;;YAYU;;WAED,aAAa,WAAW;;WAGxB,aAAa,WAAW;;WAGxB;;WAGA;;EAGT;;EAGA;;EAGA;;EAGA;;EAGA;;EAGA;;;;;;;;;;;;;;;iBAgBe;;;;;;;EAOf,MAAM;;;;;;;;EASN,WAAW;;;;;;;EAQX,SAAS;;;;;;;;EAST,YAAY;;;;;;EAOZ;;;;;;EAOA;;;;;EAMA;;;;;;;;;;;;;;;iBAgBe;;;;;;;;;EASf,KACE,QAAQ,WAAW,QACnB,QAAQ,WAAW,QACnB,gBACC;;;;;;;;;EAUH,SACE,QAAQ,WAAW,QACnB,QAAQ,WAAW,QACnB,gBACC;;;;;;;EAQH,SAAS"}
|
|
@@ -18,7 +18,7 @@ type AfterCommitCallback = () => void | Promise<void>;
|
|
|
18
18
|
* @example
|
|
19
19
|
* Product.events().onSaved(() => afterCommit(() => regenerateSitemap()));
|
|
20
20
|
*/
|
|
21
|
-
declare function afterCommit(fn: AfterCommitCallback): void;
|
|
21
|
+
export declare function afterCommit(fn: AfterCommitCallback): void;
|
|
22
22
|
//#endregion
|
|
23
|
-
export {
|
|
23
|
+
export {};
|
|
24
24
|
//# sourceMappingURL=after-commit.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"after-commit.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/transactions/after-commit.ts"],"mappings":";KAGK,
|
|
1
|
+
{"version":3,"file":"after-commit.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/transactions/after-commit.ts"],"mappings":";KAGK,mCAAmC;;;;;;;;;;;;;;;;;;;wBAwBxB,YAAY,IAAI"}
|
package/esm/types.d.mts
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* }
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
20
|
-
type StrictMode = "strip" | "fail" | "allow";
|
|
20
|
+
export type StrictMode = "strip" | "fail" | "allow";
|
|
21
21
|
/**
|
|
22
22
|
* Delete strategy for model destruction.
|
|
23
23
|
*
|
|
@@ -42,7 +42,7 @@ type StrictMode = "strip" | "fail" | "allow";
|
|
|
42
42
|
* await user.destroy({ strategy: "permanent" });
|
|
43
43
|
* ```
|
|
44
44
|
*/
|
|
45
|
-
type DeleteStrategy = "trash" | "permanent" | "soft";
|
|
45
|
+
export type DeleteStrategy = "trash" | "permanent" | "soft";
|
|
46
46
|
/**
|
|
47
47
|
* Naming convention for database column names.
|
|
48
48
|
*
|
|
@@ -63,7 +63,7 @@ type DeleteStrategy = "trash" | "permanent" | "soft";
|
|
|
63
63
|
* // Results in: createdAt, updatedAt, deletedAt
|
|
64
64
|
* ```
|
|
65
65
|
*/
|
|
66
|
-
type NamingConvention = "camelCase" | "snake_case";
|
|
66
|
+
export type NamingConvention = "camelCase" | "snake_case";
|
|
67
67
|
/**
|
|
68
68
|
* Unified model default configuration.
|
|
69
69
|
*
|
|
@@ -103,7 +103,7 @@ type NamingConvention = "camelCase" | "snake_case";
|
|
|
103
103
|
* }
|
|
104
104
|
* ```
|
|
105
105
|
*/
|
|
106
|
-
type ModelDefaults = {
|
|
106
|
+
export type ModelDefaults = {
|
|
107
107
|
/**
|
|
108
108
|
* Auto-generate incremental `id` field on insert (NoSQL only).
|
|
109
109
|
*
|
|
@@ -302,7 +302,7 @@ type ModelDefaults = {
|
|
|
302
302
|
* }
|
|
303
303
|
* ```
|
|
304
304
|
*/
|
|
305
|
-
type UuidStrategy = "v4" | "v7";
|
|
305
|
+
export type UuidStrategy = "v4" | "v7";
|
|
306
306
|
/**
|
|
307
307
|
* Migration-level defaults configurable per data source.
|
|
308
308
|
*
|
|
@@ -327,7 +327,7 @@ type UuidStrategy = "v4" | "v7";
|
|
|
327
327
|
* }
|
|
328
328
|
* ```
|
|
329
329
|
*/
|
|
330
|
-
type MigrationDefaults = {
|
|
330
|
+
export type MigrationDefaults = {
|
|
331
331
|
/**
|
|
332
332
|
* UUID generation strategy for `primaryUuid()` migration shortcut.
|
|
333
333
|
* Each driver maps this to its native SQL/expression.
|
|
@@ -389,7 +389,7 @@ type MigrationDefaults = {
|
|
|
389
389
|
* }
|
|
390
390
|
* ```
|
|
391
391
|
*/
|
|
392
|
-
type RelationDefaults = {
|
|
392
|
+
export type RelationDefaults = {
|
|
393
393
|
/**
|
|
394
394
|
* Suffix appended to the inferred relation name to form the foreign-key
|
|
395
395
|
* column name.
|
|
@@ -419,5 +419,4 @@ type RelationDefaults = {
|
|
|
419
419
|
pivotTableNamingOrder?: "alphabetical" | "owner_first";
|
|
420
420
|
};
|
|
421
421
|
//#endregion
|
|
422
|
-
export { DeleteStrategy, MigrationDefaults, ModelDefaults, NamingConvention, RelationDefaults, StrictMode, UuidStrategy };
|
|
423
422
|
//# sourceMappingURL=types.d.mts.map
|
package/esm/types.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","names":[],"sources":["../../../../../../../packages/cascade/src/types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../../../../../../../packages/cascade/src/types.ts"],"mappings":";;;;;;;;;;;;;;;;;;;YAkBY;;;;;;;;;;;;;;;;;;;;;;;;;YA0BA;;;;;;;;;;;;;;;;;;;;;YAsBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAyCA;;;;;;;;;;;EAeV;;;;;;;;;;;EAYA;;;;;;;;;;;;;;;;;EAkBA;;;;;;;;;;;EAYA;;;;;;;;;;;;;;;;;EAkBA;;;;;;;;;EAcA;;;;;;;;;;;;;;EAeA;;;;;;;;;;;;;;EAeA;;;;;;;;;;;;;;;;EAqBA,iBAAiB;;;;;;;;;;;;;;EAejB;;;;;;;;;;;;;;;;;;;EAoBA,wBAAwB;;;;;;;;;;;;;;;EAoBxB,aAAa;;;;;;;;;;;;;;EAmBb,mBAAmB;;;;;;;;;;;;;;;;;YAsBT;;;;;;;;;;;;;;;;;;;;;;;;;YA0BA;;;;;;;EAOV,eAAe;;;;;;;;;;EAWf;;;;;;;;;;;;;;;;;;;;;;;EAwBA;;;;;;;;;;;;;;;;;;;;;;YAuBU;;;;;;;;;;;EAWV;;;;;;;;;;;;;;;;EAiBA"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { DeleteStrategy, MigrationDefaults, ModelDefaults, RelationDefaults } from "../types.mjs";
|
|
2
2
|
import { DriverContract, TransactionContext } from "../contracts/database-driver.contract.mjs";
|
|
3
|
+
import "../contracts/index.mjs";
|
|
3
4
|
import { DataSource } from "../data-source/data-source.mjs";
|
|
4
|
-
|
|
5
5
|
//#region ../../packages/cascade/src/utils/connect-to-database.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* Supported database driver types.
|
|
8
8
|
*/
|
|
9
|
-
type DatabaseDriver = "mongodb" | "postgres" | "mysql";
|
|
9
|
+
export type DatabaseDriver = "mongodb" | "postgres" | "mysql";
|
|
10
10
|
/**
|
|
11
11
|
* Default model configuration options.
|
|
12
12
|
*
|
|
@@ -24,7 +24,7 @@ type DatabaseDriver = "mongodb" | "postgres" | "mysql";
|
|
|
24
24
|
*
|
|
25
25
|
* @see ModelDefaults for complete type definition and documentation
|
|
26
26
|
*/
|
|
27
|
-
type ModelDefaultConfig = Partial<ModelDefaults>;
|
|
27
|
+
export type ModelDefaultConfig = Partial<ModelDefaults>;
|
|
28
28
|
/**
|
|
29
29
|
* Connection options for establishing a database connection.
|
|
30
30
|
*
|
|
@@ -63,7 +63,7 @@ type ModelDefaultConfig = Partial<ModelDefaults>;
|
|
|
63
63
|
* };
|
|
64
64
|
* ```
|
|
65
65
|
*/
|
|
66
|
-
type ConnectionOptions<TDriverOptions = any, TClientOptions = any> = {
|
|
66
|
+
export type ConnectionOptions<TDriverOptions = any, TClientOptions = any> = {
|
|
67
67
|
/**
|
|
68
68
|
* Database driver to use.
|
|
69
69
|
* @default "mongodb"
|
|
@@ -305,7 +305,7 @@ type ConnectionOptions<TDriverOptions = any, TClientOptions = any> = {
|
|
|
305
305
|
* });
|
|
306
306
|
* ```
|
|
307
307
|
*/
|
|
308
|
-
declare function connectToDatabase<TDriverOptions = any, TClientOptions = any>(options: ConnectionOptions<TDriverOptions, TClientOptions>): Promise<DataSource>;
|
|
308
|
+
export declare function connectToDatabase<TDriverOptions = any, TClientOptions = any>(options: ConnectionOptions<TDriverOptions, TClientOptions>): Promise<DataSource>;
|
|
309
309
|
/**
|
|
310
310
|
* Get current driver instance.
|
|
311
311
|
*
|
|
@@ -317,12 +317,11 @@ declare function connectToDatabase<TDriverOptions = any, TClientOptions = any>(o
|
|
|
317
317
|
* const pgDriver = getDatabaseDriver<PostgresDriver>();
|
|
318
318
|
* ```
|
|
319
319
|
*/
|
|
320
|
-
declare function getDatabaseDriver<T extends DriverContract = any>(): T;
|
|
320
|
+
export declare function getDatabaseDriver<T extends DriverContract = any>(): T;
|
|
321
321
|
/**
|
|
322
322
|
* Perform database transaction(s)
|
|
323
323
|
* Shorthand to `dataSourceRegister.get().driver.transaction
|
|
324
324
|
*/
|
|
325
|
-
declare function transaction<T = any>(fn: (ctx: TransactionContext) => Promise<T>, options?: Record<string, unknown>): Promise<T>;
|
|
325
|
+
export declare function transaction<T = any>(fn: (ctx: TransactionContext) => Promise<T>, options?: Record<string, unknown>): Promise<T>;
|
|
326
326
|
//#endregion
|
|
327
|
-
export { ConnectionOptions, DatabaseDriver, ModelDefaultConfig, connectToDatabase, getDatabaseDriver, transaction };
|
|
328
327
|
//# sourceMappingURL=connect-to-database.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect-to-database.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/utils/connect-to-database.ts"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"connect-to-database.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/utils/connect-to-database.ts"],"mappings":";;;;;;;;YAUY;;;;;;;;;;;;;;;;;;YAmBA,qBAAqB,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAwC7B,kBAAkB,sBAAsB;;;;;EASlD,SAAS;;;;;;EAOT;;;;;EAMA;;;;EAKA;;;;;;;EAQA;;;;;;;;EAaA;;;;;EAMA;;;;;EAMA;;;;EAKA;;;;EAKA;;;;;EAMA;;;;;;;EAYA,gBAAgB;;;;;;;EAYhB,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmDhB,eAAe;;;;;;;;;;;;;;;;EAiBf,mBAAmB;;;;;;;;;;;;;;;;;EAkBnB,kBAAkB;;;;;;;;;;;EAgBlB,wBAAwB;;;;;;;;;;;EAYxB;;;;EASA;;;;;;;;;;;;IAYE;;;;;;IAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAgDkB,kBAAkB,sBAAsB,sBAC5D,SAAS,kBAAkB,gBAAgB,kBAC1C,QAAQ;;;;;;;;;;;;wBAmGK,kBAAkB,UAAU,yBAAyB;;;;;wBAU/C,YAAY,SAChC,KAAK,KAAK,uBAAuB,QAAQ,IACzC,UAAU,0BACT,QAAQ"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Model } from "../model/model.mjs";
|
|
2
2
|
import { TransformerCallback } from "@warlock.js/seal";
|
|
3
|
-
|
|
4
3
|
//#region ../../packages/cascade/src/utils/database-writer.utils.d.ts
|
|
5
4
|
type transformCallbackOptions = {
|
|
6
5
|
model: Model;
|
|
@@ -9,11 +8,11 @@ type transformCallbackOptions = {
|
|
|
9
8
|
isChanged: boolean;
|
|
10
9
|
isNew: boolean;
|
|
11
10
|
};
|
|
12
|
-
type ModelTransformCallback = (options: transformCallbackOptions) => unknown | Promise<unknown>;
|
|
11
|
+
export type ModelTransformCallback = (options: transformCallbackOptions) => unknown | Promise<unknown>;
|
|
13
12
|
/**
|
|
14
13
|
* Transfer value before saving it into the database
|
|
15
14
|
*/
|
|
16
|
-
declare function useModelTransformer(callback: ModelTransformCallback): TransformerCallback;
|
|
15
|
+
export declare function useModelTransformer(callback: ModelTransformCallback): TransformerCallback;
|
|
17
16
|
//#endregion
|
|
18
|
-
export {
|
|
17
|
+
export {};
|
|
19
18
|
//# sourceMappingURL=database-writer.utils.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"database-writer.utils.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/utils/database-writer.utils.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"database-writer.utils.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/utils/database-writer.utils.ts"],"mappings":";;;KAGK;EACH,OAAO;EACP;EACA;EACA;EACA;;YAGU,0BACV,SAAS,uCACI;;;;wBAKC,oBAAoB,UAAU,yBAAsB"}
|
|
@@ -2,12 +2,11 @@ import { DeleteStrategy, StrictMode } from "../types.mjs";
|
|
|
2
2
|
import { ModelSchema } from "../model/model.types.mjs";
|
|
3
3
|
import { Model } from "../model/model.mjs";
|
|
4
4
|
import { Infer, ObjectValidator } from "@warlock.js/seal";
|
|
5
|
-
|
|
6
5
|
//#region ../../packages/cascade/src/utils/define-model.d.ts
|
|
7
6
|
/**
|
|
8
7
|
* Configuration options for defining a model.
|
|
9
8
|
*/
|
|
10
|
-
type DefineModelOptions<TSchema extends ModelSchema> = {
|
|
9
|
+
export type DefineModelOptions<TSchema extends ModelSchema> = {
|
|
11
10
|
/**
|
|
12
11
|
* The database table/collection name.
|
|
13
12
|
*/
|
|
@@ -157,7 +156,7 @@ type DefineModelOptions<TSchema extends ModelSchema> = {
|
|
|
157
156
|
* console.log(post.title); // ✅ Type-safe!
|
|
158
157
|
* ```
|
|
159
158
|
*/
|
|
160
|
-
declare function defineModel<TSchema extends ModelSchema, TSchemaValidator extends ObjectValidator = ObjectValidator, TProperties extends Record<string, any> = {}, TStatics extends Record<string, any> = {}>(options: DefineModelOptions<TSchema> & {
|
|
159
|
+
export declare function defineModel<TSchema extends ModelSchema, TSchemaValidator extends ObjectValidator = ObjectValidator, TProperties extends Record<string, any> = {}, TStatics extends Record<string, any> = {}>(options: DefineModelOptions<TSchema> & {
|
|
161
160
|
schema: TSchemaValidator;
|
|
162
161
|
properties?: ThisType<Model<Infer.Output<TSchemaValidator>>> & TProperties;
|
|
163
162
|
statics?: ThisType<typeof Model<Infer.Output<TSchemaValidator>>> & TStatics;
|
|
@@ -179,7 +178,6 @@ declare function defineModel<TSchema extends ModelSchema, TSchemaValidator exten
|
|
|
179
178
|
* // { name: string; email: string; }
|
|
180
179
|
* ```
|
|
181
180
|
*/
|
|
182
|
-
type ModelType<T extends ReturnType<typeof defineModel>> = T extends (new (...args: any[]) => infer R) ? R extends Model<infer S> ? S : never : never;
|
|
181
|
+
export type ModelType<T extends ReturnType<typeof defineModel>> = T extends (new (...args: any[]) => infer R) ? R extends Model<infer S> ? S : never : never;
|
|
183
182
|
//#endregion
|
|
184
|
-
export { DefineModelOptions, ModelType, defineModel };
|
|
185
183
|
//# sourceMappingURL=define-model.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-model.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/utils/define-model.ts"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"define-model.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/utils/define-model.ts"],"mappings":";;;;;;;;YASY,mBAAmB,gBAAgB;;;;EAI7C;;;;;EAMA;;;;;EAMA,QAAQ;;;;;;;;;;;EAYR,iBAAiB;;;;;;;;EASjB,aAAa;;;;;;;EAQb;;;;;;EAOA;;;;;;EAOA;;;;;;;;;;;;;;;;;;;;;;;EAwBA,aAAa,SAAS,MAAM,YAAY;;;;;;;;;;;;;;;;;EAkBxC,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA2DI,YACd,gBAAgB,aAChB,yBAAyB,kBAAkB,iBAC3C,oBAAoB,0BACpB,iBAAiB,0BAEjB,SAAS,mBAAmB;EAC1B,QAAQ;EACR,aAAa,SAAS,MAAM,MAAM,OAAO,sBAAsB;EAC/D,UAAU,gBAAgB,MAAM,MAAM,OAAO,sBAAsB;UACpE,cAyEoB,QAAO,MAAA,OAAA,uBAAmB,MAAK,MAAA,OAAA,qBAAmB,eAAW,YAAA,gBAAA;;;;;;;;;;;;;;;;;;YAwBxE,UAAU,UAAU,kBAAkB,gBAAgB,mBAC7D,sBACM,KACP,UAAU,YAAY,KACpB"}
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
* escapeRegex("(a+)+$"); // "\\(a\\+\\)\\+\\$"
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
|
-
declare function escapeRegex(value: string): string;
|
|
31
|
+
export declare function escapeRegex(value: string): string;
|
|
32
32
|
/**
|
|
33
33
|
* Compile a `whereLike` pattern into regex source.
|
|
34
34
|
*
|
|
@@ -51,7 +51,7 @@ declare function escapeRegex(value: string): string;
|
|
|
51
51
|
* likePatternToRegexSource("a.b"); // "a\\.b" (a literal dot)
|
|
52
52
|
* ```
|
|
53
53
|
*/
|
|
54
|
-
declare function likePatternToRegexSource(pattern: string): string;
|
|
54
|
+
export declare function likePatternToRegexSource(pattern: string): string;
|
|
55
55
|
/**
|
|
56
56
|
* Resolve a `whereLike`-style argument to regex source.
|
|
57
57
|
*
|
|
@@ -61,7 +61,6 @@ declare function likePatternToRegexSource(pattern: string): string;
|
|
|
61
61
|
* @param pattern - A `RegExp` (trusted, used verbatim) or a string (escaped)
|
|
62
62
|
* @returns Regex source ready for `$regex`
|
|
63
63
|
*/
|
|
64
|
-
declare function resolveLikePattern(pattern: RegExp | string): string;
|
|
64
|
+
export declare function resolveLikePattern(pattern: RegExp | string): string;
|
|
65
65
|
//#endregion
|
|
66
|
-
export { escapeRegex, likePatternToRegexSource, resolveLikePattern };
|
|
67
66
|
//# sourceMappingURL=escape-regex.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"escape-regex.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/utils/escape-regex.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"escape-regex.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/utils/escape-regex.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAiCgB,YAAY;;;;;;;;;;;;;;;;;;;;;;;wBA0BZ,yBAAyB;;;;;;;;;;wBAazB,mBAAmB,SAAS"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { DataSource } from "../data-source/data-source.mjs";
|
|
2
|
-
|
|
3
2
|
//#region ../../packages/cascade/src/utils/once-connected.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Execute a callback once the driver is connected.
|
|
@@ -72,7 +71,7 @@ import { DataSource } from "../data-source/data-source.mjs";
|
|
|
72
71
|
* });
|
|
73
72
|
* ```
|
|
74
73
|
*/
|
|
75
|
-
declare function onceConnected(dataSourceOrNameOrCallback: DataSource | string | ((dataSource: DataSource) => void), callback?: (dataSource: DataSource) => void): void;
|
|
74
|
+
export declare function onceConnected(dataSourceOrNameOrCallback: DataSource | string | ((dataSource: DataSource) => void), callback?: (dataSource: DataSource) => void): void;
|
|
76
75
|
/**
|
|
77
76
|
* Execute a callback once the driver is disconnected.
|
|
78
77
|
*
|
|
@@ -144,7 +143,6 @@ declare function onceConnected(dataSourceOrNameOrCallback: DataSource | string |
|
|
|
144
143
|
* });
|
|
145
144
|
* ```
|
|
146
145
|
*/
|
|
147
|
-
declare function onceDisconnected(dataSourceOrNameOrCallback: DataSource | string | ((dataSource: DataSource) => void), callback?: (dataSource: DataSource) => void): void;
|
|
146
|
+
export declare function onceDisconnected(dataSourceOrNameOrCallback: DataSource | string | ((dataSource: DataSource) => void), callback?: (dataSource: DataSource) => void): void;
|
|
148
147
|
//#endregion
|
|
149
|
-
export { onceConnected, onceDisconnected };
|
|
150
148
|
//# sourceMappingURL=once-connected.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"once-connected.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/utils/once-connected.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"once-connected.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/utils/once-connected.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAqFgB,cACd,4BAA4B,wBAAwB,YAAY,sBAChE,YAAY,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAmIV,iBACd,4BAA4B,wBAAwB,YAAY,sBAChE,YAAY,YAAY"}
|